Fixed performance issue
thx to @void2012
This commit is contained in:
@@ -717,13 +717,23 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
|
|
||||||
|
|
||||||
char exePath[MAX_PATH];
|
WCHAR exePath[MAX_PATH] = { 0 };
|
||||||
GetModuleFileNameA(NULL, exePath, MAX_PATH);
|
GetModuleFileNameW(NULL, exePath, MAX_PATH);
|
||||||
char* x64_pos = strstr(exePath, "\\x64\\");
|
WCHAR* lastSlash = wcsrchr(exePath, L'\\');
|
||||||
if (x64_pos) {
|
if (lastSlash) {
|
||||||
*x64_pos = 0;
|
*lastSlash = L'\0';
|
||||||
strcat_s(exePath, MAX_PATH, "\\Minecraft.Client");
|
|
||||||
SetCurrentDirectoryA(exePath);
|
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
|
// Declare DPI awareness so GetSystemMetrics returns physical pixels
|
||||||
|
|||||||
Reference in New Issue
Block a user