Fix "Exit RPCS3 when process finishes" command line crash

Added force_boot to force boot on cmdline boot.
Load() caused a Stop() that exited the application with "Exit RPCS3 when process finishes" enabled. Now Stop is only called if the emu is not stopped
This commit is contained in:
Unknown 2017-11-01 12:55:46 +01:00 committed by Ivan
parent dd5791a2cc
commit de465cb941
3 changed files with 16 additions and 3 deletions

View file

@ -281,9 +281,17 @@ std::string Emulator::GetLibDir()
return fmt::replace_all(g_cfg.vfs.dev_flash, "$(EmulatorDir)", emu_dir) + "sys/external/"; return fmt::replace_all(g_cfg.vfs.dev_flash, "$(EmulatorDir)", emu_dir) + "sys/external/";
} }
void Emulator::SetForceBoot(bool force_boot)
{
m_force_boot = force_boot;
}
void Emulator::Load(bool add_only) void Emulator::Load(bool add_only)
{ {
Stop(); if (!IsStopped())
{
Stop();
}
try try
{ {
@ -616,9 +624,10 @@ void Emulator::Load(bool add_only)
return; return;
} }
if (g_cfg.misc.autostart && IsReady()) if ((m_force_boot || g_cfg.misc.autostart) && IsReady())
{ {
Run(); Run();
m_force_boot = false;
} }
else if (IsPaused()) else if (IsPaused())
{ {

View file

@ -182,6 +182,8 @@ class Emulator final
std::string m_title_id; std::string m_title_id;
std::string m_title; std::string m_title;
bool m_force_boot = false;
public: public:
Emulator() = default; Emulator() = default;
@ -247,6 +249,8 @@ public:
static std::string GetHddDir(); static std::string GetHddDir();
static std::string GetLibDir(); static std::string GetLibDir();
void SetForceBoot(bool force_boot);
void Load(bool add_only = false); void Load(bool add_only = false);
void Run(); void Run();
bool Pause(); bool Pause();

View file

@ -74,8 +74,8 @@ int main(int argc, char** argv)
QTimer::singleShot(2, [path = sstr(QFileInfo(args.at(0)).canonicalFilePath()), argv = std::move(argv)]() mutable QTimer::singleShot(2, [path = sstr(QFileInfo(args.at(0)).canonicalFilePath()), argv = std::move(argv)]() mutable
{ {
Emu.argv = std::move(argv); Emu.argv = std::move(argv);
Emu.SetForceBoot(true);
Emu.BootGame(path, true); Emu.BootGame(path, true);
Emu.Run();
}); });
} }