From f19744ae88c98638f4e9fb58a2d795359c8871c9 Mon Sep 17 00:00:00 2001
From: Eladash <18193363+elad335@users.noreply.github.com>
Date: Sat, 20 Jan 2024 21:25:10 +0200
Subject: [PATCH] Savestates: Fix restart when suspend mode is off
Add a new menu button for explicit exit (mostly for debug purposes)
---
rpcs3/rpcs3qt/gs_frame.cpp | 8 ++++++++
rpcs3/rpcs3qt/main_window.cpp | 16 ++++++++++++++++
rpcs3/rpcs3qt/main_window.ui | 9 +++++++++
rpcs3/rpcs3qt/settings_dialog.cpp | 5 +----
4 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp
index f893029180..1476e9a470 100644
--- a/rpcs3/rpcs3qt/gs_frame.cpp
+++ b/rpcs3/rpcs3qt/gs_frame.cpp
@@ -383,6 +383,14 @@ void gs_frame::handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKey
{
if (!m_disable_kb_hotkeys)
{
+ if (!g_cfg.savestate.suspend_emu)
+ {
+ Emu.after_kill_callback = []()
+ {
+ Emu.Restart();
+ };
+ }
+
Emu.Kill(false, true);
return;
}
diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp
index b17dd31a18..e318b543a9 100644
--- a/rpcs3/rpcs3qt/main_window.cpp
+++ b/rpcs3/rpcs3qt/main_window.cpp
@@ -57,6 +57,7 @@
#include "Emu/vfs_config.h"
#include "Emu/System.h"
#include "Emu/system_utils.hpp"
+#include "Emu/system_config.h"
#include "Crypto/unpkg.h"
#include "Crypto/unself.h"
@@ -2395,6 +2396,21 @@ void main_window::CreateConnects()
connect(ui->actionCreate_Savestate, &QAction::triggered, this, []()
{
gui_log.notice("User triggered savestate creation from utilities.");
+
+ if (!g_cfg.savestate.suspend_emu)
+ {
+ Emu.after_kill_callback = []()
+ {
+ Emu.Restart();
+ };
+ }
+
+ Emu.Kill(false, true);
+ });
+
+ connect(ui->actionCreate_Savestate_And_Exit, &QAction::triggered, this, []()
+ {
+ gui_log.notice("User triggered savestate creation and emulation stop from utilities.");
Emu.Kill(false, true);
});
diff --git a/rpcs3/rpcs3qt/main_window.ui b/rpcs3/rpcs3qt/main_window.ui
index 5a7c6b766d..7c5d338501 100644
--- a/rpcs3/rpcs3qt/main_window.ui
+++ b/rpcs3/rpcs3qt/main_window.ui
@@ -300,6 +300,7 @@
+