diff --git a/src/core/system.cpp b/src/core/system.cpp index 21542ff1e..2ca1e7a54 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -560,6 +560,12 @@ bool Boot(const SystemBootParameters& params) return false; } + if (params.start_paused) + { + DebugAssert(s_state == State::Running); + s_state = State::Paused; + } + return true; } @@ -699,7 +705,7 @@ bool Boot(const SystemBootParameters& params) } // Good to go. - s_state = State::Running; + s_state = params.start_paused ? State::Paused : State::Running; return true; } diff --git a/src/core/system.h b/src/core/system.h index 5f923fabb..7209b3f51 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -31,6 +31,7 @@ struct SystemBootParameters u32 media_playlist_index = 0; bool load_image_to_ram = false; bool force_software_renderer = false; + bool start_paused = false; }; namespace System { diff --git a/src/duckstation-qt/debuggerwindow.cpp b/src/duckstation-qt/debuggerwindow.cpp index 03e0ec55e..6a622e8e0 100644 --- a/src/duckstation-qt/debuggerwindow.cpp +++ b/src/duckstation-qt/debuggerwindow.cpp @@ -19,7 +19,7 @@ DebuggerWindow::DebuggerWindow(QWidget* parent /* = nullptr */) setUIEnabled(false); } -DebuggerWindow::~DebuggerWindow() {} +DebuggerWindow::~DebuggerWindow() = default; void DebuggerWindow::onEmulationPaused(bool paused) { diff --git a/src/duckstation-qt/debuggerwindow.h b/src/duckstation-qt/debuggerwindow.h index 08e3f513a..b937788bb 100644 --- a/src/duckstation-qt/debuggerwindow.h +++ b/src/duckstation-qt/debuggerwindow.h @@ -24,11 +24,13 @@ public: Q_SIGNALS: void closed(); +public Q_SLOTS: + void onEmulationPaused(bool paused); + protected: void closeEvent(QCloseEvent* event); private Q_SLOTS: - void onEmulationPaused(bool paused); void onDebuggerMessageReported(const QString& message); void refreshAll(); diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index fa11e8d9e..e3d919bde 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -1359,8 +1359,11 @@ void MainWindow::onToolsCPUDebuggerTriggered() connect(m_debugger_window, &DebuggerWindow::closed, this, &MainWindow::onCPUDebuggerClosed); } + m_host_interface->pauseSystem(true, true); m_debugger_window->show(); - m_host_interface->pauseSystem(true); + + // the debugger will miss the pause event above (or we were already paused), so fire it now + m_debugger_window->onEmulationPaused(true); } void MainWindow::onCPUDebuggerClosed()