Fix bug with Auth (#478)
This commit is contained in:
parent
7a5e3f3df4
commit
c890b4c8a4
@ -104,12 +104,25 @@ namespace Utils
|
||||
return address;
|
||||
}
|
||||
|
||||
void SetLegacyEnvironment()
|
||||
{
|
||||
wchar_t binaryPath[512];
|
||||
GetModuleFileNameW(GetModuleHandleW(nullptr), binaryPath, sizeof(binaryPath) / sizeof(wchar_t));
|
||||
|
||||
auto* exeBaseName = std::wcsrchr(binaryPath, L'\\');
|
||||
exeBaseName[0] = L'\0';
|
||||
|
||||
// Make the game work without the xlabs launcher
|
||||
SetCurrentDirectoryW(binaryPath);
|
||||
}
|
||||
|
||||
void SetEnvironment()
|
||||
{
|
||||
wchar_t* buffer{};
|
||||
std::size_t size{};
|
||||
if (_wdupenv_s(&buffer, &size, L"XLABS_MW2_INSTALL") != 0 || buffer == nullptr)
|
||||
{
|
||||
SetLegacyEnvironment();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user