Reconcile debugger and save state stuff into a single implementation.
Fixes #497 and fixes #496. Still rough edges, but at least less duplication.
This commit is contained in:
@@ -255,20 +255,20 @@ void EmulatorWindow::CpuTimeScalarSetDouble() {
|
||||
}
|
||||
|
||||
void EmulatorWindow::CpuBreakIntoDebugger() {
|
||||
auto debugger = emulator()->debugger();
|
||||
if (!debugger) {
|
||||
if (!FLAGS_debug) {
|
||||
xe::ui::ImGuiDialog::ShowMessageBox(window_.get(), "Xenia Debugger",
|
||||
"Xenia must be launched with the "
|
||||
"--debug flag in order to enable "
|
||||
"debugging.");
|
||||
return;
|
||||
}
|
||||
if (debugger->execution_state() == debug::ExecutionState::kRunning) {
|
||||
auto processor = emulator()->processor();
|
||||
if (processor->execution_state() == cpu::ExecutionState::kRunning) {
|
||||
// Currently running, so interrupt (and show the debugger).
|
||||
debugger->Pause();
|
||||
processor->Pause();
|
||||
} else {
|
||||
// Not running, so just bring the debugger into focus.
|
||||
debugger->Show();
|
||||
processor->ShowDebugger();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ project("xenia-app")
|
||||
"xenia-core",
|
||||
"xenia-cpu",
|
||||
"xenia-cpu-backend-x64",
|
||||
"xenia-debug",
|
||||
"xenia-debug-ui",
|
||||
"xenia-gpu",
|
||||
"xenia-gpu-gl4",
|
||||
|
||||
@@ -137,9 +137,9 @@ int xenia_main(const std::vector<std::wstring>& args) {
|
||||
// Set a debug handler.
|
||||
// This will respond to debugging requests so we can open the debug UI.
|
||||
std::unique_ptr<xe::debug::ui::DebugWindow> debug_window;
|
||||
if (emulator->debugger()) {
|
||||
emulator->debugger()->set_debug_listener_request_handler([&](
|
||||
xe::debug::Debugger* debugger) {
|
||||
if (FLAGS_debug) {
|
||||
emulator->processor()->set_debug_listener_request_handler([&](
|
||||
xe::cpu::Processor* processor) {
|
||||
if (debug_window) {
|
||||
return debug_window.get();
|
||||
}
|
||||
@@ -147,7 +147,7 @@ int xenia_main(const std::vector<std::wstring>& args) {
|
||||
debug_window = xe::debug::ui::DebugWindow::Create(
|
||||
emulator.get(), emulator_window->loop());
|
||||
debug_window->window()->on_closed.AddListener([&](xe::ui::UIEvent* e) {
|
||||
emulator->debugger()->set_debug_listener(nullptr);
|
||||
emulator->processor()->set_debug_listener(nullptr);
|
||||
emulator_window->loop()->Post([&]() { debug_window.reset(); });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user