From 0962028877805a5d593535561e7de891973688f6 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 4 Jan 2025 16:14:09 +0100 Subject: [PATCH] Keep game window open when loading the last savestate --- .../RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.cpp | 1 + .../RSX/Overlays/HomeMenu/overlay_home_menu_savestate.cpp | 2 ++ rpcs3/Emu/System.cpp | 7 +++++-- rpcs3/Emu/System.h | 2 +- rpcs3/Emu/savestate_utils.cpp | 5 ++++- rpcs3/rpcs3qt/gs_frame.cpp | 2 ++ rpcs3/rpcs3qt/main_window.cpp | 2 ++ 7 files changed, 17 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.cpp b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.cpp index 2bce50e829..6706e241c8 100644 --- a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.cpp +++ b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_main_menu.cpp @@ -114,6 +114,7 @@ namespace rsx Emu.CallFromMainThread([]() { + // Make sure we keep the game window opened Emu.SetContinuousMode(true); Emu.Restart(false); }); diff --git a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_savestate.cpp b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_savestate.cpp index 60fbbd8224..e224bc5727 100644 --- a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_savestate.cpp +++ b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_savestate.cpp @@ -26,6 +26,8 @@ namespace rsx if (!suspend_mode) { Emu.after_kill_callback = []() { Emu.Restart(); }; + + // Make sure we keep the game window opened Emu.SetContinuousMode(true); } Emu.Kill(false, true); diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 7494d512b9..ee0c8204c1 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -2912,10 +2912,13 @@ u64 get_sysutil_cb_manager_read_count(); void qt_events_aware_op(int repeat_duration_ms, std::function wrapped_op); -void Emulator::GracefulShutdown(bool allow_autoexit, bool async_op, bool savestate) +void Emulator::GracefulShutdown(bool allow_autoexit, bool async_op, bool savestate, bool continuous_mode) { // Make sure we close the game window - Emu.SetContinuousMode(false); + if (!continuous_mode) + { + Emu.SetContinuousMode(false); + } // Ensure no game has booted inbetween const auto guard = Emu.MakeEmulationStateGuard(); diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index fd48c199ae..2934253b39 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -419,7 +419,7 @@ public: bool Pause(bool freeze_emulation = false, bool show_resume_message = true); void Resume(); - void GracefulShutdown(bool allow_autoexit = true, bool async_op = false, bool savestate = false); + void GracefulShutdown(bool allow_autoexit = true, bool async_op = false, bool savestate = false, bool continuous_mode = false); void Kill(bool allow_autoexit = true, bool savestate = false, savestate_stage* stage = nullptr); game_boot_result Restart(bool graceful = true); bool Quit(bool force_quit); diff --git a/rpcs3/Emu/savestate_utils.cpp b/rpcs3/Emu/savestate_utils.cpp index 85a2a82574..a40cda95c3 100644 --- a/rpcs3/Emu/savestate_utils.cpp +++ b/rpcs3/Emu/savestate_utils.cpp @@ -322,7 +322,10 @@ bool boot_last_savestate(bool testing) if (result) { sys_log.success("Booting the most recent savestate \'%s\' using the Reload shortcut.", savestate_path); - Emu.GracefulShutdown(false); + + // Make sure we keep the game window opened + Emu.SetContinuousMode(true); + Emu.GracefulShutdown(false, false, false, true); if (game_boot_result error = Emu.BootGame(savestate_path, "", true); error != game_boot_result::no_errors) { diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index 41421cfdcf..f2e6e32b08 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -328,6 +328,8 @@ void gs_frame::handle_shortcut(gui::shortcuts::shortcut shortcut_key, const QKey { Emu.Restart(); }; + + // Make sure we keep the game window opened Emu.SetContinuousMode(true); } diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 0702e43020..46e056e43a 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -2590,6 +2590,8 @@ void main_window::CreateConnects() { Emu.Restart(); }; + + // Make sure we keep the game window opened Emu.SetContinuousMode(true); }