diff options
| author | 2015-05-21 02:12:59 +0200 | |
|---|---|---|
| committer | 2015-07-13 22:27:21 +0200 | |
| commit | 01a526e1c449f86bbb626dd83f3f6cf94c2d86d4 (patch) | |
| tree | a641344e90c78e537ed46c306b76d1adb82a863f /src | |
| parent | Add CiTrace recording support. (diff) | |
| download | yuzu-01a526e1c449f86bbb626dd83f3f6cf94c2d86d4.tar.gz yuzu-01a526e1c449f86bbb626dd83f3f6cf94c2d86d4.tar.xz yuzu-01a526e1c449f86bbb626dd83f3f6cf94c2d86d4.zip | |
citra-qt: Properly disable the CiTrace widget upon starting/stopping emulation.
Diffstat (limited to 'src')
| -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 @@ | |||
| 8 | #include <QComboBox> | 8 | #include <QComboBox> |
| 9 | #include <QFileDialog> | 9 | #include <QFileDialog> |
| 10 | #include <QLabel> | 10 | #include <QLabel> |
| 11 | #include <QMessageBox> | ||
| 11 | #include <QPushButton> | 12 | #include <QPushButton> |
| 12 | #include <QSpinBox> | 13 | #include <QSpinBox> |
| 13 | 14 | ||
| @@ -49,8 +50,6 @@ GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> | |||
| 49 | } | 50 | } |
| 50 | main_widget->setLayout(main_layout); | 51 | main_widget->setLayout(main_layout); |
| 51 | setWidget(main_widget); | 52 | setWidget(main_widget); |
| 52 | |||
| 53 | // TODO: Make sure to have this widget disabled as soon as emulation is started! | ||
| 54 | } | 53 | } |
| 55 | 54 | ||
| 56 | void GraphicsTracingWidget::StartRecording() { | 55 | void GraphicsTracingWidget::StartRecording() { |
| @@ -121,3 +120,33 @@ void GraphicsTracingWidget::OnBreakPointHit(Pica::DebugContext::Event event, voi | |||
| 121 | void GraphicsTracingWidget::OnResumed() { | 120 | void GraphicsTracingWidget::OnResumed() { |
| 122 | widget()->setEnabled(false); | 121 | widget()->setEnabled(false); |
| 123 | } | 122 | } |
| 123 | |||
| 124 | void GraphicsTracingWidget::OnEmulationStarting(EmuThread* emu_thread) { | ||
| 125 | // Disable tracing starting/stopping until a GPU breakpoint is reached | ||
| 126 | widget()->setEnabled(false); | ||
| 127 | } | ||
| 128 | |||
| 129 | void GraphicsTracingWidget::OnEmulationStopping() { | ||
| 130 | // TODO: Is it safe to access the context here? | ||
| 131 | |||
| 132 | auto context = context_weak.lock(); | ||
| 133 | if (!context) | ||
| 134 | return; | ||
| 135 | |||
| 136 | |||
| 137 | if (context->recorder) { | ||
| 138 | auto reply = QMessageBox::question(this, tr("CiTracing still active"), | ||
| 139 | tr("A CiTrace is still being recorded. Do you want to save it? If not, all recorded data will be discarded."), | ||
| 140 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); | ||
| 141 | |||
| 142 | if (reply == QMessageBox::Yes) { | ||
| 143 | StopRecording(); | ||
| 144 | } else { | ||
| 145 | AbortRecording(); | ||
| 146 | } | ||
| 147 | } | ||
| 148 | |||
| 149 | // If the widget was disabled before, enable it now to allow starting | ||
| 150 | // tracing before starting the next emulation session | ||
| 151 | widget()->setEnabled(true); | ||
| 152 | } | ||
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 @@ | |||
| 6 | 6 | ||
| 7 | #include "graphics_breakpoint_observer.h" | 7 | #include "graphics_breakpoint_observer.h" |
| 8 | 8 | ||
| 9 | class EmuThread; | ||
| 10 | |||
| 9 | class GraphicsTracingWidget : public BreakPointObserverDock { | 11 | class GraphicsTracingWidget : public BreakPointObserverDock { |
| 10 | Q_OBJECT | 12 | Q_OBJECT |
| 11 | 13 | ||
| @@ -20,6 +22,9 @@ private slots: | |||
| 20 | void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override; | 22 | void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override; |
| 21 | void OnResumed() override; | 23 | void OnResumed() override; |
| 22 | 24 | ||
| 25 | void OnEmulationStarting(EmuThread* emu_thread); | ||
| 26 | void OnEmulationStopping(); | ||
| 27 | |||
| 23 | signals: | 28 | signals: |
| 24 | void SetStartTracingButtonEnabled(bool enable); | 29 | void SetStartTracingButtonEnabled(bool enable); |
| 25 | void SetStopTracingButtonEnabled(bool enable); | 30 | 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) | |||
| 154 | connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping())); | 154 | connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping())); |
| 155 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); | 155 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); |
| 156 | connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); | 156 | connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); |
| 157 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), graphicsTracingWidget, SLOT(OnEmulationStarting(EmuThread*))); | ||
| 158 | connect(this, SIGNAL(EmulationStopping()), graphicsTracingWidget, SLOT(OnEmulationStopping())); | ||
| 159 | |||
| 157 | 160 | ||
| 158 | // Setup hotkeys | 161 | // Setup hotkeys |
| 159 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); | 162 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); |