Qt: Fix opening debugger when system already paused

This commit is contained in:
Connor McLaughlin 2020-12-27 00:15:12 +10:00
parent dc46d52029
commit 3cd3d1c09d
5 changed files with 16 additions and 4 deletions

View file

@ -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;
}

View file

@ -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 {

View file

@ -19,7 +19,7 @@ DebuggerWindow::DebuggerWindow(QWidget* parent /* = nullptr */)
setUIEnabled(false);
}
DebuggerWindow::~DebuggerWindow() {}
DebuggerWindow::~DebuggerWindow() = default;
void DebuggerWindow::onEmulationPaused(bool paused)
{

View file

@ -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();

View file

@ -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()