QT: Add ability to pass launch arguments with CLI option -gameargs

This commit is contained in:
AKuHAK 2023-12-23 22:32:26 +02:00 committed by Connor McLaughlin
parent 90a09eb520
commit a81b20d9d5
1 changed files with 8 additions and 2 deletions

View File

@ -1528,6 +1528,7 @@ void QtHost::PrintCommandLineHelp(const std::string_view& progname)
std::fprintf(stderr, " -batch: Enables batch mode (exits after shutting down).\n"); std::fprintf(stderr, " -batch: Enables batch mode (exits after shutting down).\n");
std::fprintf(stderr, " -nogui: Hides main window while running (implies batch mode).\n"); std::fprintf(stderr, " -nogui: Hides main window while running (implies batch mode).\n");
std::fprintf(stderr, " -elf <file>: Overrides the boot ELF with the specified filename.\n"); std::fprintf(stderr, " -elf <file>: Overrides the boot ELF with the specified filename.\n");
std::fprintf(stderr, " -gameargs <string>: passes the specified quoted space-delimited string of launch arguments.\n");
std::fprintf(stderr, " -disc <path>: Uses the specified host DVD drive as a source.\n"); std::fprintf(stderr, " -disc <path>: Uses the specified host DVD drive as a source.\n");
std::fprintf(stderr, " -logfile <path>: Writes the application log to path instead of emulog.txt.\n"); std::fprintf(stderr, " -logfile <path>: Writes the application log to path instead of emulog.txt.\n");
std::fprintf(stderr, " -bios: Starts the BIOS (System Menu/OSDSYS).\n"); std::fprintf(stderr, " -bios: Starts the BIOS (System Menu/OSDSYS).\n");
@ -1622,6 +1623,11 @@ bool QtHost::ParseCommandLineOptions(const QStringList& args, std::shared_ptr<VM
AutoBoot(autoboot)->elf_override = (++it)->toStdString(); AutoBoot(autoboot)->elf_override = (++it)->toStdString();
continue; continue;
} }
else if (CHECK_ARG_PARAM(QStringLiteral("-gameargs")))
{
EmuConfig.CurrentGameArgs = (++it)->toStdString();
continue;
}
else if (CHECK_ARG_PARAM(QStringLiteral("-disc"))) else if (CHECK_ARG_PARAM(QStringLiteral("-disc")))
{ {
AutoBoot(autoboot)->source_type = CDVD_SourceType::Disc; AutoBoot(autoboot)->source_type = CDVD_SourceType::Disc;