Compare commits

..

2 commits

Author SHA1 Message Date
IliasHDZ
f8a12ae8e6
Merge e222313f22 into e5dd2c9c40 2024-08-21 14:31:32 +05:00
IliasHDZ
e222313f22 change to wchar and use max_path 2024-08-21 11:29:40 +05:00

View file

@ -142,8 +142,8 @@ unsigned int gdTimestamp = 0;
// this function will set the current working directory to the game's directory // this function will set the current working directory to the game's directory
// to avoid the game crashing due to not being able to find the resources // to avoid the game crashing due to not being able to find the resources
static void fixCWD() { static void fixCWD() {
char cwd[1024]; WCHAR cwd[MAX_PATH];
DWORD size = GetModuleFileNameA(NULL, cwd, sizeof(cwd)); DWORD size = GetModuleFileNameW(NULL, cwd, sizeof(cwd));
if (size == sizeof(cwd)) return; if (size == sizeof(cwd)) return;
for (int i = size - 1; i >= 0; i--) { for (int i = size - 1; i >= 0; i--) {
if (cwd[i] == '\\') { if (cwd[i] == '\\') {
@ -151,7 +151,7 @@ static void fixCWD() {
break; break;
} }
} }
SetCurrentDirectoryA(cwd); SetCurrentDirectoryW(cwd);
} }
int WINAPI gdMainHook(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { int WINAPI gdMainHook(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) {