save extraArgs to CVar for easier testing

This commit is contained in:
Ricardo Luís Vaz Silva 2025-05-14 14:58:35 -03:00 committed by Magnus Norddahl
commit 9f23178e76
2 changed files with 6 additions and 1 deletions

View file

@ -607,6 +607,8 @@ FString FIWadManager::IWADPathFileSearch(const FString &file)
return "";
}
CVAR(String, extra_args, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
int FIWadManager::IdentifyVersion (std::vector<std::string>&wadfiles, const char *iwad, const char *zdoom_wad, const char *optional_wad)
{
const char *iwadparm = Args->CheckValue ("-iwad");
@ -871,13 +873,15 @@ int FIWadManager::IdentifyVersion (std::vector<std::string>&wadfiles, const char
if (autoloadbrightmaps) flags |= 4;
if (autoloadwidescreen) flags |= 8;
FString extraArgs;
FString extraArgs = *extra_args;
pick = I_PickIWad(&wads[0], (int)wads.Size(), queryiwad, pick, flags, extraArgs);
if (pick >= 0)
{
extraArgs.StripLeftRight();
extra_args = extraArgs.GetChars();
if(extraArgs.Len() > 0)
{
Args->AppendArgsString(extraArgs);

View file

@ -20,6 +20,7 @@ int LauncherWindow::ExecModal(WadStuff* wads, int numwads, int defaultiwad, int*
auto launcher = std::make_unique<LauncherWindow>(wads, numwads, defaultiwad, autoloadflags);
launcher->SetFrameGeometry((screenSize.width - windowWidth) * 0.5, (screenSize.height - windowHeight) * 0.5, windowWidth, windowHeight);
if(extraArgs) launcher->PlayGame->SetExtraArgs(extraArgs->GetChars());
launcher->Show();
DisplayWindow::RunLoop();