diff --git a/src/citra_qt/debugger/graphics/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics/graphics_breakpoints.cpp index d3d32997c1..282b3e8de6 100644 --- a/src/citra_qt/debugger/graphics/graphics_breakpoints.cpp +++ b/src/citra_qt/debugger/graphics/graphics_breakpoints.cpp @@ -30,23 +30,8 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const { switch (role) { case Qt::DisplayRole: { if (index.column() == 0) { - static const std::map map = { - {Pica::DebugContext::Event::PicaCommandLoaded, tr("Pica command loaded")}, - {Pica::DebugContext::Event::PicaCommandProcessed, tr("Pica command processed")}, - {Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch")}, - {Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")}, - {Pica::DebugContext::Event::VertexShaderInvocation, tr("Vertex shader invocation")}, - {Pica::DebugContext::Event::IncomingDisplayTransfer, - tr("Incoming display transfer")}, - {Pica::DebugContext::Event::GSPCommandProcessed, tr("GSP command processed")}, - {Pica::DebugContext::Event::BufferSwapped, tr("Buffers swapped")}, - }; - - DEBUG_ASSERT(map.size() == - static_cast(Pica::DebugContext::Event::NumEvents)); - return (map.find(event) != map.end()) ? map.at(event) : QString(); + return DebugContextEventToString(event); } - break; } @@ -128,6 +113,30 @@ void BreakPointModel::OnResumed() { active_breakpoint = context->active_breakpoint; } +QString BreakPointModel::DebugContextEventToString(Pica::DebugContext::Event event) { + switch (event) { + case Pica::DebugContext::Event::PicaCommandLoaded: + return tr("Pica command loaded"); + case Pica::DebugContext::Event::PicaCommandProcessed: + return tr("Pica command processed"); + case Pica::DebugContext::Event::IncomingPrimitiveBatch: + return tr("Incoming primitive batch"); + case Pica::DebugContext::Event::FinishedPrimitiveBatch: + return tr("Finished primitive batch"); + case Pica::DebugContext::Event::VertexShaderInvocation: + return tr("Vertex shader invocation"); + case Pica::DebugContext::Event::IncomingDisplayTransfer: + return tr("Incoming display transfer"); + case Pica::DebugContext::Event::GSPCommandProcessed: + return tr("GSP command processed"); + case Pica::DebugContext::Event::BufferSwapped: + return tr("Buffers swapped"); + case Pica::DebugContext::Event::NumEvents: + break; + } + return tr("Unknown debug context event"); +} + GraphicsBreakPointsWidget::GraphicsBreakPointsWidget( std::shared_ptr debug_context, QWidget* parent) : QDockWidget(tr("Pica Breakpoints"), parent), Pica::DebugContext::BreakPointObserver( diff --git a/src/citra_qt/debugger/graphics/graphics_breakpoints_p.h b/src/citra_qt/debugger/graphics/graphics_breakpoints_p.h index e4711dadc4..3a53c06a05 100644 --- a/src/citra_qt/debugger/graphics/graphics_breakpoints_p.h +++ b/src/citra_qt/debugger/graphics/graphics_breakpoints_p.h @@ -29,6 +29,8 @@ public: void OnResumed(); private: + static QString DebugContextEventToString(Pica::DebugContext::Event event); + std::weak_ptr context_weak; bool at_breakpoint; Pica::DebugContext::Event active_breakpoint;