Fix commandLine for CreateProcessW

Remove unnecessary ternary (binary is never iw4x-sp.exe)
This commit is contained in:
mxve 2024-03-31 22:05:20 +02:00
parent 01b8737488
commit 0801553556

View File

@ -244,12 +244,12 @@ namespace Components
return;
}
auto workingDir = std::filesystem::current_path().string();
const std::string binary = *Game::sys_exitCmdLine;
const std::string command = binary == "iw4x-sp.exe" ? "iw4x-sp" : "iw4x";
const std::filesystem::path workingDir = std::filesystem::current_path();
const std::wstring binary = Utils::String::Convert(*Game::sys_exitCmdLine);
const std::wstring commandLine = std::format(L"\"{}\" iw4x --pass \"{}\"", (workingDir / binary).wstring(), Utils::GetLaunchParameters());
SetEnvironmentVariableA("MW2_INSTALL", workingDir.data());
Utils::Library::LaunchProcess(Utils::String::Convert(binary), std::format(L"{} --pass \"{}\"", Utils::String::Convert(command), Utils::GetLaunchParameters()), workingDir);
SetEnvironmentVariableA("MW2_INSTALL", workingDir.string().data());
Utils::Library::LaunchProcess(binary, commandLine, workingDir);
}
__declspec(naked) void QuickPatch::SND_GetAliasOffset_Stub()