diff options
Diffstat (limited to 'src/citra_qt/main.cpp')
| -rw-r--r-- | src/citra_qt/main.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index f21c55db6..c3e637792 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -139,12 +139,12 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) | |||
| 139 | connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode())); | 139 | connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode())); |
| 140 | connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog())); | 140 | connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog())); |
| 141 | 141 | ||
| 142 | connect(this, SIGNAL(EmulationStarted(EmuThread*)), disasmWidget, SLOT(OnEmulationStarted(EmuThread*))); | 142 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), disasmWidget, SLOT(OnEmulationStarting(EmuThread*))); |
| 143 | connect(this, SIGNAL(EmulationStopped()), disasmWidget, SLOT(OnEmulationStopped())); | 143 | connect(this, SIGNAL(EmulationStopping()), disasmWidget, SLOT(OnEmulationStopping())); |
| 144 | connect(this, SIGNAL(EmulationStarted(EmuThread*)), registersWidget, SLOT(OnEmulationStarted(EmuThread*))); | 144 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), registersWidget, SLOT(OnEmulationStarting(EmuThread*))); |
| 145 | connect(this, SIGNAL(EmulationStopped()), registersWidget, SLOT(OnEmulationStopped())); | 145 | connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping())); |
| 146 | connect(this, SIGNAL(EmulationStarted(EmuThread*)), render_window, SLOT(OnEmulationStarted(EmuThread*))); | 146 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); |
| 147 | connect(this, SIGNAL(EmulationStopped()), render_window, SLOT(OnEmulationStopped())); | 147 | connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); |
| 148 | 148 | ||
| 149 | // Setup hotkeys | 149 | // Setup hotkeys |
| 150 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); | 150 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); |
| @@ -210,7 +210,7 @@ void GMainWindow::BootGame(std::string filename) { | |||
| 210 | 210 | ||
| 211 | // Create and start the emulation thread | 211 | // Create and start the emulation thread |
| 212 | emu_thread = Common::make_unique<EmuThread>(render_window); | 212 | emu_thread = Common::make_unique<EmuThread>(render_window); |
| 213 | emit EmulationStarted(emu_thread.get()); | 213 | emit EmulationStarting(emu_thread.get()); |
| 214 | emu_thread->start(); | 214 | emu_thread->start(); |
| 215 | 215 | ||
| 216 | // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues | 216 | // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues |
| @@ -230,25 +230,16 @@ void GMainWindow::BootGame(std::string filename) { | |||
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | void GMainWindow::ShutdownGame() { | 232 | void GMainWindow::ShutdownGame() { |
| 233 | // Shutdown the emulation thread | 233 | emu_thread->RequestStop(); |
| 234 | emu_thread->RequestShutdown(); | ||
| 235 | |||
| 236 | // Disconnect signals that are attached to the current emulation thread | ||
| 237 | disconnect(emu_thread.get(), SIGNAL(DebugModeEntered()), disasmWidget, SLOT(OnDebugModeEntered())); | ||
| 238 | disconnect(emu_thread.get(), SIGNAL(DebugModeEntered()), registersWidget, SLOT(OnDebugModeEntered())); | ||
| 239 | disconnect(emu_thread.get(), SIGNAL(DebugModeEntered()), callstackWidget, SLOT(OnDebugModeEntered())); | ||
| 240 | disconnect(emu_thread.get(), SIGNAL(DebugModeLeft()), disasmWidget, SLOT(OnDebugModeLeft())); | ||
| 241 | disconnect(emu_thread.get(), SIGNAL(DebugModeLeft()), registersWidget, SLOT(OnDebugModeLeft())); | ||
| 242 | disconnect(emu_thread.get(), SIGNAL(DebugModeLeft()), callstackWidget, SLOT(OnDebugModeLeft())); | ||
| 243 | 234 | ||
| 244 | // Release emu threads from any breakpoints | 235 | // Release emu threads from any breakpoints |
| 245 | // This belongs after RequestShutdown() and before wait() because if emulation stops on a GPU | 236 | // This belongs after RequestStop() and before wait() because if emulation stops on a GPU |
| 246 | // breakpoint after (or before) RequestShutdown() is called, the emulation would never be able | 237 | // breakpoint after (or before) RequestStop() is called, the emulation would never be able |
| 247 | // to continue out to the main loop and terminate. Thus wait() would hang forever. | 238 | // to continue out to the main loop and terminate. Thus wait() would hang forever. |
| 248 | // TODO(bunnei): This function is not thread safe, but it's being used as if it were | 239 | // TODO(bunnei): This function is not thread safe, but it's being used as if it were |
| 249 | Pica::g_debug_context->ClearBreakpoints(); | 240 | Pica::g_debug_context->ClearBreakpoints(); |
| 250 | 241 | ||
| 251 | emit EmulationStopped(); | 242 | emit EmulationStopping(); |
| 252 | 243 | ||
| 253 | // Wait for emulation thread to complete and delete it | 244 | // Wait for emulation thread to complete and delete it |
| 254 | emu_thread->wait(); | 245 | emu_thread->wait(); |