diff options
author | Tony Wasserka <NeoBrainX@gmail.com> | 2015-05-21 02:12:59 +0200 |
---|---|---|
committer | Tony Wasserka <NeoBrainX@gmail.com> | 2015-07-13 22:27:21 +0200 |
commit | 01a526e1c449f86bbb626dd83f3f6cf94c2d86d4 (patch) | |
tree | a641344e90c78e537ed46c306b76d1adb82a863f | |
parent | Add CiTrace recording support. (diff) | |
download | yuzu-01a526e1c449f86bbb626dd83f3f6cf94c2d86d4.tar yuzu-01a526e1c449f86bbb626dd83f3f6cf94c2d86d4.tar.gz yuzu-01a526e1c449f86bbb626dd83f3f6cf94c2d86d4.tar.bz2 yuzu-01a526e1c449f86bbb626dd83f3f6cf94c2d86d4.tar.lz yuzu-01a526e1c449f86bbb626dd83f3f6cf94c2d86d4.tar.xz yuzu-01a526e1c449f86bbb626dd83f3f6cf94c2d86d4.tar.zst yuzu-01a526e1c449f86bbb626dd83f3f6cf94c2d86d4.zip |
-rw-r--r-- | src/citra_qt/debugger/graphics_tracing.cpp | 33 | ||||
-rw-r--r-- | src/citra_qt/debugger/graphics_tracing.h | 5 | ||||
-rw-r--r-- | src/citra_qt/main.cpp | 3 |
3 files changed, 39 insertions, 2 deletions
diff --git a/src/citra_qt/debugger/graphics_tracing.cpp b/src/citra_qt/debugger/graphics_tracing.cpp index 2e74193f5..eac405820 100644 --- a/src/citra_qt/debugger/graphics_tracing.cpp +++ b/src/citra_qt/debugger/graphics_tracing.cpp @@ -8,6 +8,7 @@ #include <QComboBox> #include <QFileDialog> #include <QLabel> +#include <QMessageBox> #include <QPushButton> #include <QSpinBox> @@ -49,8 +50,6 @@ GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> } main_widget->setLayout(main_layout); setWidget(main_widget); - - // TODO: Make sure to have this widget disabled as soon as emulation is started! } void GraphicsTracingWidget::StartRecording() { @@ -121,3 +120,33 @@ void GraphicsTracingWidget::OnBreakPointHit(Pica::DebugContext::Event event, voi void GraphicsTracingWidget::OnResumed() { widget()->setEnabled(false); } + +void GraphicsTracingWidget::OnEmulationStarting(EmuThread* emu_thread) { + // Disable tracing starting/stopping until a GPU breakpoint is reached + widget()->setEnabled(false); +} + +void GraphicsTracingWidget::OnEmulationStopping() { + // TODO: Is it safe to access the context here? + + auto context = context_weak.lock(); + if (!context) + return; + + + if (context->recorder) { + auto reply = QMessageBox::question(this, tr("CiTracing still active"), + tr("A CiTrace is still being recorded. Do you want to save it? If not, all recorded data will be discarded."), + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); + + if (reply == QMessageBox::Yes) { + StopRecording(); + } else { + AbortRecording(); + } + } + + // If the widget was disabled before, enable it now to allow starting + // tracing before starting the next emulation session + widget()->setEnabled(true); +} diff --git a/src/citra_qt/debugger/graphics_tracing.h b/src/citra_qt/debugger/graphics_tracing.h index 397a7173b..2a0e4819b 100644 --- a/src/citra_qt/debugger/graphics_tracing.h +++ b/src/citra_qt/debugger/graphics_tracing.h @@ -6,6 +6,8 @@ #include "graphics_breakpoint_observer.h" +class EmuThread; + class GraphicsTracingWidget : public BreakPointObserverDock { Q_OBJECT @@ -20,6 +22,9 @@ private slots: void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override; void OnResumed() override; + void OnEmulationStarting(EmuThread* emu_thread); + void OnEmulationStopping(); + signals: void SetStartTracingButtonEnabled(bool enable); void SetStopTracingButtonEnabled(bool enable); diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 6bfb6e417..2746de779 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -154,6 +154,9 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping())); connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); + connect(this, SIGNAL(EmulationStarting(EmuThread*)), graphicsTracingWidget, SLOT(OnEmulationStarting(EmuThread*))); + connect(this, SIGNAL(EmulationStopping()), graphicsTracingWidget, SLOT(OnEmulationStopping())); + // Setup hotkeys RegisterHotkey("Main Window", "Load File", QKeySequence::Open); |