diff options
| author | NΞVΛR <danielo-24@hotmail.com> | 2026-03-01 18:40:09 +0100 |
|---|---|---|
| committer | NΞVΛR <danielo-24@hotmail.com> | 2026-03-01 18:40:09 +0100 |
| commit | e23945a020f6483202e21df360f615b1ea55b119 (patch) | |
| tree | 03a79fc02bbd7805c8e920331e5dbc6176969248 /Minecraft.Client/Windows64 | |
| parent | fa254306949eec458cdff71c3867ded0e7494d2f (diff) | |
Fixed performance issue
thx to @void2012
Diffstat (limited to 'Minecraft.Client/Windows64')
| -rw-r--r-- | Minecraft.Client/Windows64/Windows64_Minecraft.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 50791c02..42fb2d44 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -717,13 +717,23 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, UNREFERENCED_PARAMETER(lpCmdLine); - char exePath[MAX_PATH]; - GetModuleFileNameA(NULL, exePath, MAX_PATH); - char* x64_pos = strstr(exePath, "\\x64\\"); - if (x64_pos) { - *x64_pos = 0; - strcat_s(exePath, MAX_PATH, "\\Minecraft.Client"); - SetCurrentDirectoryA(exePath); + WCHAR exePath[MAX_PATH] = { 0 }; + GetModuleFileNameW(NULL, exePath, MAX_PATH); + WCHAR* lastSlash = wcsrchr(exePath, L'\\'); + if (lastSlash) { + *lastSlash = L'\0'; + + WCHAR devCheckPath[MAX_PATH] = { 0 }; + swprintf_s(devCheckPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client\\Minecraft.Client.vcxproj", exePath); + + if (GetFileAttributesW(devCheckPath) != INVALID_FILE_ATTRIBUTES) { + WCHAR projectPath[MAX_PATH] = { 0 }; + swprintf_s(projectPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client", exePath); + SetCurrentDirectoryW(projectPath); + } + else { + SetCurrentDirectoryW(exePath); + } } // Declare DPI awareness so GetSystemMetrics returns physical pixels |
