Add support to boot using PS3 game path or TITLEID in CLI and shortcuts

Allowing to move of game directories without having to update the shortcut path. (as long as it is registered within RPCS3 UI).
This commit is contained in:
Eladash 2022-12-02 19:21:06 +02:00 committed by Ivan
parent b0e376ae76
commit b7d80ab335
2 changed files with 98 additions and 12 deletions

View file

@ -1133,7 +1133,20 @@ int main(int argc, char** argv)
}
else if (const QStringList args = parser.positionalArguments(); !args.isEmpty() && !is_updating && !parser.isSet(arg_installfw) && !parser.isSet(arg_installpkg))
{
sys_log.notice("Booting application from command line: %s", ::at32(args, 0).toStdString());
std::string spath = sstr(::at32(args, 0));
if (spath.starts_with("%RPCS3_VFS%"))
{
sys_log.notice("Booting application from command line using VFS path: %s", spath.substr(("%RPCS3_VFS%"sv).size()));
}
else if (spath.starts_with("%RPCS3_GAMEID%"))
{
sys_log.notice("Booting application from command line using GAMEID: %s", spath.substr(("%RPCS3_GAMEID%"sv).size()));
}
else
{
sys_log.notice("Booting application from command line: %s", spath);
}
// Propagate command line arguments
std::vector<std::string> rpcs3_argv;
@ -1163,7 +1176,7 @@ int main(int argc, char** argv)
}
// Postpone startup to main event loop
Emu.CallFromMainThread([path = sstr(QFileInfo(::at32(args, 0)).absoluteFilePath()), rpcs3_argv = std::move(rpcs3_argv), config_path = std::move(config_path)]() mutable
Emu.CallFromMainThread([path = spath.starts_with("%RPCS3_") ? spath : sstr(QFileInfo(::at32(args, 0)).absoluteFilePath()), rpcs3_argv = std::move(rpcs3_argv), config_path = std::move(config_path)]() mutable
{
Emu.argv = std::move(rpcs3_argv);
Emu.SetForceBoot(true);