diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 0d7578a867..2575931393 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1957,9 +1957,12 @@ void Emulator::Stop(bool restart) // Always Enable display sleep, not only if it was prevented. enable_display_sleep(); - if (!m_force_boot && Quit(g_cfg.misc.autoexit.get())) + if (!m_force_boot) { - return; + if (Quit(g_cfg.misc.autoexit.get())) + { + return; + } } m_force_boot = false; diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 4839ff7a62..e24a564a8d 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -83,7 +83,12 @@ class Emulator final u32 m_usrid{1}; bool m_force_global_config = false; + + // This flag should be adjusted before each Stop() or each BootGame() and similar because: + // 1. It forces an application to boot immediately by calling Run() in Load(). + // 2. It signifies that we don't want to exit on Stop(), for example if we want to transition to another application. bool m_force_boot = false; + bool m_has_gui = true; public: diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 26f8a7a3f8..2c8a21e1d8 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -2227,7 +2227,10 @@ void main_window::closeEvent(QCloseEvent* closeEvent) } // Cleanly stop and quit the emulator. - Emu.Stop(); + if (!Emu.IsStopped()) + { + Emu.Stop(); + } Emu.Quit(true); }