From fa254306949eec458cdff71c3867ded0e7494d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=CE=9EV=CE=9BR?= Date: Sun, 1 Mar 2026 18:19:38 +0100 Subject: [PATCH] Fix for exe not running, not founding the project directory In _tWinMain (Windows64_Minecraft.cpp) add logic to detect if the executable path contains "\\x64\\". If found, truncate the path at that position, append "\\Minecraft.Client" and call SetCurrentDirectoryA to set the process working directory. This ensures relative resource paths resolve correctly when running from an x64 build output directory; the change is guarded by a substring check and uses MAX_PATH-safe APIs. --- Minecraft.Client/Windows64/Windows64_Minecraft.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 931e7f17..50791c02 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -716,6 +716,16 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, UNREFERENCED_PARAMETER(hPrevInstance); 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); + } + // Declare DPI awareness so GetSystemMetrics returns physical pixels SetProcessDPIAware(); g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);