mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-01 07:13:36 +00:00
Add cmdline support
This commit is contained in:
parent
dbb2251f93
commit
00a0d37455
@ -528,21 +528,26 @@ void Emulator::Load(bool add_only)
|
||||
vm::ps3::init();
|
||||
|
||||
if (argv.empty())
|
||||
{
|
||||
argv.resize(1);
|
||||
}
|
||||
|
||||
if (argv[0].empty())
|
||||
{
|
||||
if (m_path.find(hdd0_game) != -1)
|
||||
{
|
||||
argv.emplace_back("/dev_hdd0/game/" + m_path.substr(hdd0_game.size()));
|
||||
argv[0] = "/dev_hdd0/game/" + m_path.substr(hdd0_game.size());
|
||||
}
|
||||
else if (!bdvd_dir.empty() && fs::is_dir(bdvd_dir))
|
||||
{
|
||||
// Disc games are on /dev_bdvd/
|
||||
const std::size_t pos = m_path.rfind("PS3_GAME");
|
||||
argv.emplace_back("/dev_bdvd/" + m_path.substr(pos));
|
||||
argv[0] = "/dev_bdvd/" + m_path.substr(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
// For homebrew
|
||||
argv.emplace_back("/host_root/" + m_path);
|
||||
argv[0] = "/host_root/" + m_path;
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Elf path: %s", argv[0]);
|
||||
@ -581,7 +586,12 @@ void Emulator::Load(bool add_only)
|
||||
|
||||
if (argv.empty())
|
||||
{
|
||||
argv.emplace_back("host_root:" + m_path);
|
||||
argv.resize(1);
|
||||
}
|
||||
|
||||
if (argv[0].empty())
|
||||
{
|
||||
argv[0] = "host_root:" + m_path;
|
||||
LOG_NOTICE(LOADER, "Elf path: %s", argv[0]);
|
||||
}
|
||||
|
||||
|
@ -47,16 +47,33 @@ int main(int argc, char** argv)
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("Welcome to RPCS3 command line.");
|
||||
parser.addPositionalArgument("(S)ELF", "Path for directly executing a (S)ELF");
|
||||
parser.addPositionalArgument("[Args...]", "Optional args for the executable");
|
||||
parser.addHelpOption();
|
||||
parser.process(app);
|
||||
|
||||
app.Init();
|
||||
|
||||
if (parser.positionalArguments().length() > 0)
|
||||
QStringList args = parser.positionalArguments();
|
||||
|
||||
if (args.length() > 0)
|
||||
{
|
||||
// Ugly workaround
|
||||
QTimer::singleShot(2, [path = sstr(QFileInfo(parser.positionalArguments().at(0)).canonicalFilePath())]
|
||||
// Propagate command line arguments
|
||||
std::vector<std::string> argv;
|
||||
|
||||
if (args.length() > 1)
|
||||
{
|
||||
argv.emplace_back();
|
||||
|
||||
for (std::size_t i = 1; i < args.length(); i++)
|
||||
{
|
||||
argv.emplace_back(args[i].toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
// Ugly workaround
|
||||
QTimer::singleShot(2, [path = sstr(QFileInfo(args.at(0)).canonicalFilePath()), argv = std::move(argv)]() mutable
|
||||
{
|
||||
Emu.argv = std::move(argv);
|
||||
Emu.BootGame(path, true);
|
||||
Emu.Run();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user