Pass game arguments to beamng on windows

This commit is contained in:
Tixx 2024-10-05 18:34:39 +02:00
parent 68a4d64387
commit 0c53ff4cd4
2 changed files with 9 additions and 2 deletions

View File

@ -84,7 +84,14 @@ void StartGame(std::string Dir) {
std::string BaseDir = Dir; //+"\\Bin64";
// Dir += R"(\Bin64\BeamNG.drive.x64.exe)";
Dir += "\\BeamNG.drive.exe";
bSuccess = CreateProcessA(Dir.c_str(), nullptr, nullptr, nullptr, TRUE, 0, nullptr, BaseDir.c_str(), &si, &pi);
std::string gameArgs = "";
for (int i = 0; i < options.game_arguments_length; i++) {
gameArgs += " ";
gameArgs += options.game_arguments[i];
}
bSuccess = CreateProcessA(nullptr, (LPSTR)(Dir + gameArgs).c_str(), nullptr, nullptr, TRUE, 0, nullptr, BaseDir.c_str(), &si, &pi);
if (bSuccess) {
info("Game Launched!");
GamePID = pi.dwProcessId;

View File

@ -68,7 +68,7 @@ void InitOptions(int argc, char *argv[], Options &options) {
options.no_download = true;
options.no_launch = true;
options.no_update = true;
} else if (argument == "--") {
} else if (argument == "--game") {
options.game_arguments = &argv[i + 1];
options.game_arguments_length = argc - i - 1;
break;