From fc191a34904e8c6a0e4c40425457a5b389d4b529 Mon Sep 17 00:00:00 2001 From: inspuration Date: Mon, 9 Jun 2014 15:52:51 -0400 Subject: [PATCH] Fixed build errors and runtime errors in new gpu debugger menus. --- src/citra_qt/debugger/graphics_cmdlists.cpp | 9 ++++++++- src/video_core/gpu_debugger.h | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index 195197ef5..081c63ff0 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp @@ -17,6 +17,7 @@ GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractItemModel(p QModelIndex GPUCommandListModel::index(int row, int column, const QModelIndex& parent) const { TreeItem* item; + TreeItem* internal; if (!parent.isValid()) { item = root_item; @@ -24,7 +25,13 @@ QModelIndex GPUCommandListModel::index(int row, int column, const QModelIndex& p item = (TreeItem*)parent.internalPointer(); } - return createIndex(row, column, item->children[row]); + if (item->children.size() <= row) { + internal = item; + } + else { internal = item->children[row]; } + + + return createIndex(row, column, internal); } QModelIndex GPUCommandListModel::parent(const QModelIndex& child) const diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index 6a1e04244..13edb9a47 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h @@ -20,9 +20,9 @@ public: // A vector of commands represented by their raw byte sequence struct PicaCommand : public std::vector { - Pica::CommandHeader& GetHeader() + Pica::CommandHeader& GetHeader() const { - u32& val = at(1); + const u32& val = at(1); return *(Pica::CommandHeader*)&val; } }; @@ -64,7 +64,7 @@ public: } protected: - GraphicsDebugger* GetDebugger() + GraphicsDebugger* GetDebugger() const { return observed; }