diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/citra_qt/bootmanager.cpp | 6 | ||||
| -rw-r--r-- | src/citra_qt/bootmanager.h | 8 | ||||
| -rw-r--r-- | src/citra_qt/debugger/disassembler.cpp | 4 | ||||
| -rw-r--r-- | src/citra_qt/debugger/disassembler.h | 4 | ||||
| -rw-r--r-- | src/citra_qt/debugger/registers.cpp | 4 | ||||
| -rw-r--r-- | src/citra_qt/debugger/registers.h | 4 | ||||
| -rw-r--r-- | src/citra_qt/main.cpp | 31 |
7 files changed, 26 insertions, 35 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 4be410fe0..66a9e6fba 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -48,7 +48,7 @@ void EmuThread::run() { | |||
| 48 | Core::RunLoop(); | 48 | Core::RunLoop(); |
| 49 | 49 | ||
| 50 | was_active = running || exec_step; | 50 | was_active = running || exec_step; |
| 51 | if (!was_active) | 51 | if (!was_active && !stop_run) |
| 52 | emit DebugModeEntered(); | 52 | emit DebugModeEntered(); |
| 53 | } else if (exec_step) { | 53 | } else if (exec_step) { |
| 54 | if (!was_active) | 54 | if (!was_active) |
| @@ -273,10 +273,10 @@ void GRenderWindow::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,un | |||
| 273 | setMinimumSize(minimal_size.first, minimal_size.second); | 273 | setMinimumSize(minimal_size.first, minimal_size.second); |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | void GRenderWindow::OnEmulationStarted(EmuThread* emu_thread) { | 276 | void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread) { |
| 277 | this->emu_thread = emu_thread; | 277 | this->emu_thread = emu_thread; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | void GRenderWindow::OnEmulationStopped() { | 280 | void GRenderWindow::OnEmulationStopping() { |
| 281 | emu_thread = nullptr; | 281 | emu_thread = nullptr; |
| 282 | } | 282 | } |
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index e57522187..715faf2d7 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h | |||
| @@ -51,9 +51,9 @@ public: | |||
| 51 | bool IsRunning() { return running; } | 51 | bool IsRunning() { return running; } |
| 52 | 52 | ||
| 53 | /** | 53 | /** |
| 54 | * Requests for the emulation thread to stop running and shutdown emulation | 54 | * Requests for the emulation thread to stop running |
| 55 | */ | 55 | */ |
| 56 | void RequestShutdown() { | 56 | void RequestStop() { |
| 57 | stop_run = true; | 57 | stop_run = true; |
| 58 | running = false; | 58 | running = false; |
| 59 | }; | 59 | }; |
| @@ -115,8 +115,8 @@ public: | |||
| 115 | public slots: | 115 | public slots: |
| 116 | void moveContext(); // overridden | 116 | void moveContext(); // overridden |
| 117 | 117 | ||
| 118 | void OnEmulationStarted(EmuThread* emu_thread); | 118 | void OnEmulationStarting(EmuThread* emu_thread); |
| 119 | void OnEmulationStopped(); | 119 | void OnEmulationStopping(); |
| 120 | 120 | ||
| 121 | private: | 121 | private: |
| 122 | void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override; | 122 | void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override; |
diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp index 6400bb856..08c6b49bd 100644 --- a/src/citra_qt/debugger/disassembler.cpp +++ b/src/citra_qt/debugger/disassembler.cpp | |||
| @@ -241,7 +241,7 @@ int DisassemblerWidget::SelectedRow() { | |||
| 241 | return disasm_ui.treeView->selectionModel()->currentIndex().row(); | 241 | return disasm_ui.treeView->selectionModel()->currentIndex().row(); |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | void DisassemblerWidget::OnEmulationStarted(EmuThread* emu_thread) { | 244 | void DisassemblerWidget::OnEmulationStarting(EmuThread* emu_thread) { |
| 245 | this->emu_thread = emu_thread; | 245 | this->emu_thread = emu_thread; |
| 246 | 246 | ||
| 247 | model = new DisassemblerModel(this); | 247 | model = new DisassemblerModel(this); |
| @@ -256,7 +256,7 @@ void DisassemblerWidget::OnEmulationStarted(EmuThread* emu_thread) { | |||
| 256 | setEnabled(true); | 256 | setEnabled(true); |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | void DisassemblerWidget::OnEmulationStopped() { | 259 | void DisassemblerWidget::OnEmulationStopping() { |
| 260 | disasm_ui.treeView->setModel(nullptr); | 260 | disasm_ui.treeView->setModel(nullptr); |
| 261 | delete model; | 261 | delete model; |
| 262 | emu_thread = nullptr; | 262 | emu_thread = nullptr; |
diff --git a/src/citra_qt/debugger/disassembler.h b/src/citra_qt/debugger/disassembler.h index b771e95b7..45b0a7e08 100644 --- a/src/citra_qt/debugger/disassembler.h +++ b/src/citra_qt/debugger/disassembler.h | |||
| @@ -65,8 +65,8 @@ public slots: | |||
| 65 | void OnDebugModeEntered(); | 65 | void OnDebugModeEntered(); |
| 66 | void OnDebugModeLeft(); | 66 | void OnDebugModeLeft(); |
| 67 | 67 | ||
| 68 | void OnEmulationStarted(EmuThread* emu_thread); | 68 | void OnEmulationStarting(EmuThread* emu_thread); |
| 69 | void OnEmulationStopped(); | 69 | void OnEmulationStopping(); |
| 70 | 70 | ||
| 71 | private: | 71 | private: |
| 72 | // returns -1 if no row is selected | 72 | // returns -1 if no row is selected |
diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cpp index 2b1e8ceb8..5527a2afd 100644 --- a/src/citra_qt/debugger/registers.cpp +++ b/src/citra_qt/debugger/registers.cpp | |||
| @@ -71,11 +71,11 @@ void RegistersWidget::OnDebugModeEntered() { | |||
| 71 | void RegistersWidget::OnDebugModeLeft() { | 71 | void RegistersWidget::OnDebugModeLeft() { |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | void RegistersWidget::OnEmulationStarted(EmuThread* emu_thread) { | 74 | void RegistersWidget::OnEmulationStarting(EmuThread* emu_thread) { |
| 75 | setEnabled(true); | 75 | setEnabled(true); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | void RegistersWidget::OnEmulationStopped() { | 78 | void RegistersWidget::OnEmulationStopping() { |
| 79 | // Reset widget text | 79 | // Reset widget text |
| 80 | for (int i = 0; i < 16; ++i) | 80 | for (int i = 0; i < 16; ++i) |
| 81 | registers->child(i)->setText(1, QString("")); | 81 | registers->child(i)->setText(1, QString("")); |
diff --git a/src/citra_qt/debugger/registers.h b/src/citra_qt/debugger/registers.h index 0356de290..68e3fb908 100644 --- a/src/citra_qt/debugger/registers.h +++ b/src/citra_qt/debugger/registers.h | |||
| @@ -21,8 +21,8 @@ public slots: | |||
| 21 | void OnDebugModeEntered(); | 21 | void OnDebugModeEntered(); |
| 22 | void OnDebugModeLeft(); | 22 | void OnDebugModeLeft(); |
| 23 | 23 | ||
| 24 | void OnEmulationStarted(EmuThread* emu_thread); | 24 | void OnEmulationStarting(EmuThread* emu_thread); |
| 25 | void OnEmulationStopped(); | 25 | void OnEmulationStopping(); |
| 26 | 26 | ||
| 27 | private: | 27 | private: |
| 28 | Ui::ARMRegisters cpu_regs_ui; | 28 | Ui::ARMRegisters cpu_regs_ui; |
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(); |