Savestates: Make Ctrl+R work when not ingame

Restore old behavior of Ctrl+R making it restart emulation when stoppped.
This commit is contained in:
Eladash 2022-10-03 11:23:24 +03:00 committed by Ivan
parent 9b5cc7cda7
commit f34773ed73
2 changed files with 18 additions and 8 deletions

View File

@ -2536,6 +2536,12 @@ std::shared_ptr<utils::serial> Emulator::Kill(bool allow_autoexit, bool savestat
}
sys_log.success("Saved savestate! path='%s'", path);
if (!g_cfg.savestate.suspend_emu)
{
// Allow to reboot from GUI
m_path = path;
}
}
ar.set_reading_state();
@ -2567,16 +2573,14 @@ std::shared_ptr<utils::serial> Emulator::Kill(bool allow_autoexit, bool savestat
game_boot_result Emulator::Restart()
{
if (m_state == system_state::stopped)
if (!IsStopped())
{
return game_boot_result::generic_error;
}
auto save_args = std::make_tuple(argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_mode);
GracefulShutdown(false, false);
std::tie(argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_mode) = std::move(save_args);
}
// Reload with prior configs.
if (const auto error = Load(m_title_id); error != game_boot_result::no_errors)

View File

@ -279,6 +279,12 @@ void gs_frame::keyPressEvent(QKeyEvent *keyEvent)
case Qt::Key_R:
if (keyEvent->modifiers() == Qt::ControlModifier && !m_disable_kb_hotkeys)
{
if (Emu.IsStopped())
{
Emu.Restart();
return;
}
extern bool boot_last_savestate();
boot_last_savestate();
}