Fix exitspawn (autoexit option)

Fix other situations affected by this options
This commit is contained in:
Nekotekina 2017-11-24 11:00:47 +03:00
parent 2ac773385f
commit f7803927d9
6 changed files with 21 additions and 10 deletions

View File

@ -292,6 +292,7 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr<sys_exit2_param> ar
Emu.CallAfter([path = std::move(path), argv = std::move(argv), envp = std::move(envp), data = std::move(data), disc = vfs::get("/dev_bdvd/"), klic = fxm::get_always<LoadedNpdrmKeys_t>()->devKlic]() mutable
{
sys_process.success("Process finished -> %s", argv[0]);
Emu.SetForceBoot(true);
Emu.Stop();
Emu.argv = std::move(argv);
Emu.envp = std::move(envp);
@ -303,12 +304,8 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr<sys_exit2_param> ar
Emu.klic.assign(klic.begin(), klic.end());
}
Emu.SetForceBoot(true);
Emu.BootGame(path, true);
if (Emu.IsReady() && !g_cfg.misc.autostart)
{
Emu.Run();
}
});
thread_ctrl::eternalize();

View File

@ -787,9 +787,12 @@ void Emulator::Stop()
{
if (m_state.exchange(system_state::stopped) == system_state::stopped)
{
m_force_boot = false;
return;
}
const bool do_exit = !m_force_boot && g_cfg.misc.autoexit;
LOG_NOTICE(GENERAL, "Stopping emulator...");
GetCallbacks().on_stop();
@ -838,7 +841,7 @@ void Emulator::Stop()
RSXIOMem.Clear();
vm::close();
if (g_cfg.misc.autoexit)
if (do_exit)
{
GetCallbacks().exit();
}
@ -857,6 +860,8 @@ void Emulator::Stop()
data.clear();
disc.clear();
klic.clear();
m_force_boot = false;
}
s32 error_code::error_report(const fmt_type_info* sup, u64 arg, const fmt_type_info* sup2, u64 arg2)

View File

@ -51,6 +51,7 @@ auto_pause_settings_dialog::auto_pause_settings_dialog(QWidget *parent) : QDialo
});
connect(cancelButton, &QAbstractButton::clicked, this, &QWidget::close);
Emu.SetForceBoot(true);
Emu.Stop();
LoadEntries();

View File

@ -742,6 +742,7 @@ bool game_list_frame::Boot(const GameInfo& game)
{
Q_EMIT RequestIconPathSet(game.path);
Emu.SetForceBoot(true);
Emu.Stop();
if (!Emu.BootGame(game.path))

View File

@ -87,7 +87,7 @@ void gs_frame::keyPressEvent(QKeyEvent *keyEvent)
if (keyEvent->modifiers() == Qt::ControlModifier && (!Emu.IsStopped())) { Emu.Stop(); return; }
break;
case Qt::Key_R:
if (keyEvent->modifiers() == Qt::ControlModifier && (!Emu.GetBoot().empty())) { Emu.Stop(); Emu.Load(); return; }
if (keyEvent->modifiers() == Qt::ControlModifier && (!Emu.GetBoot().empty())) { Emu.SetForceBoot(true); Emu.Stop(); Emu.Load(); return; }
break;
case Qt::Key_E:
if (keyEvent->modifiers() == Qt::ControlModifier)

View File

@ -180,7 +180,7 @@ void main_window::CreateThumbnailToolbar()
RepaintThumbnailIcons();
connect(m_thumb_stop, &QWinThumbnailToolButton::clicked, [=]() { Emu.Stop(); });
connect(m_thumb_restart, &QWinThumbnailToolButton::clicked, [=]() { Emu.Stop(); Emu.Load(); });
connect(m_thumb_restart, &QWinThumbnailToolButton::clicked, [=]() { Emu.SetForceBoot(true); Emu.Stop(); Emu.Load(); });
connect(m_thumb_playPause, &QWinThumbnailToolButton::clicked, Pause);
#endif
}
@ -270,6 +270,7 @@ void main_window::BootElf()
const std::string path = sstr(QFileInfo(filePath).canonicalFilePath());
SetAppIconFromPath(path);
Emu.SetForceBoot(true);
Emu.Stop();
if (!Emu.BootGame(path, true))
@ -304,6 +305,8 @@ void main_window::BootGame()
if (stopped) Emu.Resume();
return;
}
Emu.SetForceBoot(true);
Emu.Stop();
guiSettings->SetValue(gui::fd_boot_game, QFileInfo(dirPath).path());
const std::string path = sstr(dirPath);
@ -347,6 +350,7 @@ void main_window::InstallPkg(const QString& dropPath)
return;
}
Emu.SetForceBoot(true);
Emu.Stop();
guiSettings->SetValue(gui::fd_install_pkg, QFileInfo(filePath).path());
@ -446,6 +450,7 @@ void main_window::InstallPup(const QString& dropPath)
return;
}
Emu.SetForceBoot(true);
Emu.Stop();
guiSettings->SetValue(gui::fd_install_pup, QFileInfo(filePath).path());
@ -590,6 +595,7 @@ void main_window::DecryptSPRXLibraries()
return;
}
Emu.SetForceBoot(true);
Emu.Stop();
guiSettings->SetValue(gui::fd_decrypt_sprx, QFileInfo(modules.first()).path());
@ -905,6 +911,7 @@ void main_window::BootRecentAction(const QAction* act)
SetAppIconFromPath(sstr(pth));
Emu.SetForceBoot(true);
Emu.Stop();
if (!Emu.BootGame(sstr(pth), true))
@ -1131,7 +1138,7 @@ void main_window::CreateConnects()
connect(ui->exitAct, &QAction::triggered, this, &QWidget::close);
connect(ui->sysPauseAct, &QAction::triggered, Pause);
connect(ui->sysStopAct, &QAction::triggered, [=]() { Emu.Stop(); });
connect(ui->sysRebootAct, &QAction::triggered, [=]() { Emu.Stop(); Emu.Load(); });
connect(ui->sysRebootAct, &QAction::triggered, [=]() { Emu.SetForceBoot(true); Emu.Stop(); Emu.Load(); });
connect(ui->sysSendOpenMenuAct, &QAction::triggered, [=]
{
@ -1543,7 +1550,7 @@ void main_window::keyPressEvent(QKeyEvent *keyEvent)
case Qt::Key_E: if (Emu.IsPaused()) Emu.Resume(); else if (Emu.IsReady()) Emu.Run(); return;
case Qt::Key_P: if (Emu.IsRunning()) Emu.Pause(); return;
case Qt::Key_S: if (!Emu.IsStopped()) Emu.Stop(); return;
case Qt::Key_R: if (!Emu.GetBoot().empty()) { Emu.Stop(); Emu.Run(); } return;
case Qt::Key_R: if (!Emu.GetBoot().empty()) { Emu.SetForceBoot(true); Emu.Stop(); Emu.Run(); } return;
}
}
}