mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-10-12 02:08:45 +00:00
Qt/VMManager: Add -gamecfg command-line arg
This commit is contained in:
+7
-1
@@ -2136,7 +2136,8 @@ void QtHost::PrintCommandLineHelp(const std::string_view progname)
|
||||
std::fprintf(stderr, " -portable: Force enable portable mode to store data in local PCSX2 path instead of the default configuration path. Overrides '-datapath'.\n");
|
||||
std::fprintf(stderr, " -datapath <path>: Specify the directory to be used for all application data.\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, " -gameargs <string>: Passes the specified quoted space-delimited string of launch arguments.\n");
|
||||
std::fprintf(stderr, " -gamecfg <file>: Overrides the game settings with the ones in the specified INI file.\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, " -bios: Starts the BIOS (System Menu/OSDSYS).\n");
|
||||
@@ -2249,6 +2250,11 @@ bool QtHost::ParseCommandLineOptions(const QStringList& args, std::shared_ptr<VM
|
||||
EmuConfig.CurrentGameArgs = (++it)->toStdString();
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG_PARAM(QStringLiteral("-gamecfg")))
|
||||
{
|
||||
AutoBoot(autoboot)->game_config = (++it)->toStdString();
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG_PARAM(QStringLiteral("-disc")))
|
||||
{
|
||||
AutoBoot(autoboot)->source_type = CDVD_SourceType::Disc;
|
||||
|
||||
@@ -180,6 +180,7 @@ static std::string s_elf_path;
|
||||
static std::pair<u32, u32> s_elf_text_range;
|
||||
static bool s_elf_executed = false;
|
||||
static std::string s_elf_override;
|
||||
static std::string s_game_settings_override;
|
||||
static std::string s_input_profile_name;
|
||||
static u32 s_frame_advance_count = 0;
|
||||
static bool s_fast_boot_requested = false;
|
||||
@@ -818,6 +819,10 @@ bool VMManager::ReloadGameSettings()
|
||||
|
||||
std::string VMManager::GetGameSettingsPath(const std::string_view game_serial, u32 game_crc)
|
||||
{
|
||||
// Game settings override via -gamecfg command line flag
|
||||
if (!s_game_settings_override.empty())
|
||||
return s_game_settings_override;
|
||||
|
||||
std::string sanitized_serial(Path::SanitizeFileName(game_serial));
|
||||
|
||||
return game_serial.empty() ?
|
||||
@@ -1373,6 +1378,7 @@ VMBootResult VMManager::Initialize(const VMBootParameters& boot_params, Error* e
|
||||
GSDumpReplayer::Shutdown();
|
||||
|
||||
s_elf_override = {};
|
||||
s_game_settings_override = {};
|
||||
ClearELFInfo();
|
||||
ClearDiscDetails();
|
||||
|
||||
@@ -1473,6 +1479,23 @@ VMBootResult VMManager::Initialize(const VMBootParameters& boot_params, Error* e
|
||||
}
|
||||
ScopedGuard close_cdvd(&DoCDVDclose);
|
||||
|
||||
if (!boot_params.game_config.empty())
|
||||
{
|
||||
if (!StringUtil::compareNoCase(Path::GetExtension(boot_params.game_config), "ini"))
|
||||
{
|
||||
Error::SetStringFmt(error,
|
||||
TRANSLATE_FS("VMManager", "Requested game config '{}' is not an INI file."), boot_params.game_config);
|
||||
return VMBootResult::StartupFailure;
|
||||
}
|
||||
else if (!FileSystem::FileExists(boot_params.game_config.c_str()))
|
||||
{
|
||||
Error::SetStringFmt(error,
|
||||
TRANSLATE_FS("VMManager", "Requested game config '{}' does not exist."), boot_params.game_config);
|
||||
return VMBootResult::StartupFailure;
|
||||
}
|
||||
s_game_settings_override = boot_params.game_config;
|
||||
}
|
||||
|
||||
// Figure out which game we're running! This also loads game settings.
|
||||
UpdateDiscDetails(true);
|
||||
|
||||
@@ -1690,6 +1713,7 @@ void VMManager::Shutdown(bool save_resume_state)
|
||||
|
||||
SaveSessionTime(s_disc_serial);
|
||||
s_elf_override = {};
|
||||
s_game_settings_override = {};
|
||||
ClearELFInfo();
|
||||
CDVDsys_ClearFiles();
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ struct VMBootParameters
|
||||
std::string filename;
|
||||
std::string elf_override;
|
||||
std::string save_state;
|
||||
std::string game_config;
|
||||
std::optional<s32> state_index;
|
||||
std::optional<CDVD_SourceType> source_type;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user