r5sdk/r5dev/utilities.h

37 lines
841 B
C
Raw Normal View History

2021-04-13 04:45:22 -07:00
#pragma once
#include <stdio.h>
#include <string>
#include "hooks.h"
namespace
2021-04-13 04:45:22 -07:00
{
BOOL FileExists(LPCTSTR szPath)
{
DWORD dwAttrib = GetFileAttributes(szPath);
return (dwAttrib != INVALID_FILE_ATTRIBUTES &&
!(dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
}
static void DbgPrint(LPCSTR Format, ...)
{
CHAR Buffer[512] = { 0 };
va_list Args;
2021-04-13 04:45:22 -07:00
// Get the variable arg pointer.
va_start(Args, Format);
2021-04-13 04:45:22 -07:00
// Format print the string.
int length = vsnprintf(Buffer, sizeof(Buffer), Format, Args);
va_end(Args);
2021-04-13 04:45:22 -07:00
// Output the string to the debugger.
OutputDebugString(Buffer);
}
2021-04-13 04:45:22 -07:00
static void HexDump(const char* header, const char* file, const char* mode, int func, const void* data, int size)
{
// todo..
}
}