summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/CMakeLists.txt2
-rw-r--r--src/citra_qt/citra_qt.vcxproj6
-rw-r--r--src/citra_qt/citra_qt.vcxproj.filters16
-rw-r--r--src/citra_qt/debugger/graphics.cpp83
-rw-r--r--src/citra_qt/debugger/graphics.hxx43
-rw-r--r--src/citra_qt/main.cpp6
-rw-r--r--src/citra_qt/main.hxx2
7 files changed, 151 insertions, 7 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 549f69217..1968e34d3 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -2,6 +2,7 @@ set(SRCS
2 bootmanager.cpp 2 bootmanager.cpp
3 debugger/callstack.cpp 3 debugger/callstack.cpp
4 debugger/disassembler.cpp 4 debugger/disassembler.cpp
5 debugger/graphics.cpp
5 debugger/ramview.cpp 6 debugger/ramview.cpp
6 debugger/registers.cpp 7 debugger/registers.cpp
7 hotkeys.cpp 8 hotkeys.cpp
@@ -38,6 +39,7 @@ qt4_wrap_cpp(MOC_SRCS
38 bootmanager.hxx 39 bootmanager.hxx
39 debugger/callstack.hxx 40 debugger/callstack.hxx
40 debugger/disassembler.hxx 41 debugger/disassembler.hxx
42 debugger/graphics.hxx
41 debugger/registers.hxx 43 debugger/registers.hxx
42 debugger/ramview.hxx 44 debugger/ramview.hxx
43 hotkeys.hxx 45 hotkeys.hxx
diff --git a/src/citra_qt/citra_qt.vcxproj b/src/citra_qt/citra_qt.vcxproj
index 3f24bbfbf..a1b24f676 100644
--- a/src/citra_qt/citra_qt.vcxproj
+++ b/src/citra_qt/citra_qt.vcxproj
@@ -130,6 +130,7 @@
130 <ClCompile Include="config\controller_config.cpp" /> 130 <ClCompile Include="config\controller_config.cpp" />
131 <ClCompile Include="config\controller_config_util.cpp" /> 131 <ClCompile Include="config\controller_config_util.cpp" />
132 <ClCompile Include="debugger\callstack.cpp" /> 132 <ClCompile Include="debugger\callstack.cpp" />
133 <ClCompile Include="debugger\graphics.cpp" />
133 <ClCompile Include="debugger\registers.cpp" /> 134 <ClCompile Include="debugger\registers.cpp" />
134 <ClCompile Include="debugger\disassembler.cpp" /> 135 <ClCompile Include="debugger\disassembler.cpp" />
135 <ClCompile Include="debugger\ramview.cpp" /> 136 <ClCompile Include="debugger\ramview.cpp" />
@@ -143,9 +144,10 @@
143 <MOC Include="..\..\externals\qhexedit\qhexedit_p.h" /> 144 <MOC Include="..\..\externals\qhexedit\qhexedit_p.h" />
144 <MOC Include="..\..\externals\qhexedit\xbytearray.h" /> 145 <MOC Include="..\..\externals\qhexedit\xbytearray.h" />
145 <MOC Include="debugger\callstack.hxx" /> 146 <MOC Include="debugger\callstack.hxx" />
146 <MOC Include="debugger\registers.hxx" />
147 <MOC Include="debugger\disassembler.hxx" /> 147 <MOC Include="debugger\disassembler.hxx" />
148 <MOC Include="debugger\graphics.hxx" />
148 <MOC Include="debugger\ramview.hxx" /> 149 <MOC Include="debugger\ramview.hxx" />
150 <MOC Include="debugger\registers.hxx" />
149 <MOC Include="bootmanager.hxx" /> 151 <MOC Include="bootmanager.hxx" />
150 <MOC Include="hotkeys.hxx" /> 152 <MOC Include="hotkeys.hxx" />
151 <MOC Include="main.hxx" /> 153 <MOC Include="main.hxx" />
@@ -182,4 +184,4 @@
182 <ImportGroup Label="ExtensionTargets"> 184 <ImportGroup Label="ExtensionTargets">
183 <Import Project="qt-build.targets" /> 185 <Import Project="qt-build.targets" />
184 </ImportGroup> 186 </ImportGroup>
185</Project> \ No newline at end of file 187</Project>
diff --git a/src/citra_qt/citra_qt.vcxproj.filters b/src/citra_qt/citra_qt.vcxproj.filters
index 2b3838e29..faa4d9f52 100644
--- a/src/citra_qt/citra_qt.vcxproj.filters
+++ b/src/citra_qt/citra_qt.vcxproj.filters
@@ -36,10 +36,13 @@
36 <ClCompile Include="debugger\callstack.cpp"> 36 <ClCompile Include="debugger\callstack.cpp">
37 <Filter>debugger</Filter> 37 <Filter>debugger</Filter>
38 </ClCompile> 38 </ClCompile>
39 <ClCompile Include="debugger\ramview.cpp"> 39 <ClCompile Include="debugger\disassembler.cpp">
40 <Filter>debugger</Filter> 40 <Filter>debugger</Filter>
41 </ClCompile> 41 </ClCompile>
42 <ClCompile Include="debugger\disassembler.cpp"> 42 <ClCompile Include="debugger\graphics.cpp">
43 <Filter>debugger</Filter>
44 </ClCompile>
45 <ClCompile Include="debugger\ramview.cpp">
43 <Filter>debugger</Filter> 46 <Filter>debugger</Filter>
44 </ClCompile> 47 </ClCompile>
45 <ClCompile Include="debugger\registers.cpp"> 48 <ClCompile Include="debugger\registers.cpp">
@@ -65,10 +68,13 @@
65 <MOC Include="debugger\callstack.hxx"> 68 <MOC Include="debugger\callstack.hxx">
66 <Filter>debugger</Filter> 69 <Filter>debugger</Filter>
67 </MOC> 70 </MOC>
68 <MOC Include="debugger\ramview.hxx"> 71 <MOC Include="debugger\disassembler.hxx">
69 <Filter>debugger</Filter> 72 <Filter>debugger</Filter>
70 </MOC> 73 </MOC>
71 <MOC Include="debugger\disassembler.hxx"> 74 <MOC Include="debugger\graphics.hxx">
75 <Filter>debugger</Filter>
76 </MOC>
77 <MOC Include="debugger\ramview.hxx">
72 <Filter>debugger</Filter> 78 <Filter>debugger</Filter>
73 </MOC> 79 </MOC>
74 <MOC Include="debugger\registers.hxx"> 80 <MOC Include="debugger\registers.hxx">
@@ -106,4 +112,4 @@
106 <ItemGroup> 112 <ItemGroup>
107 <Text Include="CMakeLists.txt" /> 113 <Text Include="CMakeLists.txt" />
108 </ItemGroup> 114 </ItemGroup>
109</Project> \ No newline at end of file 115</Project>
diff --git a/src/citra_qt/debugger/graphics.cpp b/src/citra_qt/debugger/graphics.cpp
new file mode 100644
index 000000000..9aaade8f9
--- /dev/null
+++ b/src/citra_qt/debugger/graphics.cpp
@@ -0,0 +1,83 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include "graphics.hxx"
6#include <QListView>
7#include <QVBoxLayout>
8#include <QDebug>
9
10extern GraphicsDebugger g_debugger;
11
12GPUCommandStreamItemModel::GPUCommandStreamItemModel(QObject* parent) : QAbstractListModel(parent), command_count(0)
13{
14 connect(this, SIGNAL(GXCommandFinished(int)), this, SLOT(OnGXCommandFinishedInternal(int)));
15}
16
17int GPUCommandStreamItemModel::rowCount(const QModelIndex& parent) const
18{
19 return command_count;
20}
21
22QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) const
23{
24 if (!index.isValid())
25 return QVariant();
26
27 int command_index = index.row();
28 const GSP_GPU::GXCommand& command = GetDebugger()->ReadGXCommandHistory(command_index);
29 if (role == Qt::DisplayRole)
30 {
31 std::map<GSP_GPU::GXCommandId, const char*> command_names;
32 command_names[GSP_GPU::GXCommandId::REQUEST_DMA] = "REQUEST_DMA";
33 command_names[GSP_GPU::GXCommandId::SET_COMMAND_LIST_FIRST] = "SET_COMMAND_LIST_FIRST";
34 command_names[GSP_GPU::GXCommandId::SET_MEMORY_FILL] = "SET_MEMORY_FILL";
35 command_names[GSP_GPU::GXCommandId::SET_DISPLAY_TRANSFER] = "SET_DISPLAY_TRANSFER";
36 command_names[GSP_GPU::GXCommandId::SET_TEXTURE_COPY] = "SET_TEXTURE_COPY";
37 command_names[GSP_GPU::GXCommandId::SET_COMMAND_LIST_LAST] = "SET_COMMAND_LIST_LAST";
38 QString str = QString("%1 %2 %3 %4 %5 %6 %7 %8 %9").arg(command_names[static_cast<GSP_GPU::GXCommandId>(command.id)])
39 .arg(command.data[0], 8, 16, QLatin1Char('0'))
40 .arg(command.data[1], 8, 16, QLatin1Char('0'))
41 .arg(command.data[2], 8, 16, QLatin1Char('0'))
42 .arg(command.data[3], 8, 16, QLatin1Char('0'))
43 .arg(command.data[4], 8, 16, QLatin1Char('0'))
44 .arg(command.data[5], 8, 16, QLatin1Char('0'))
45 .arg(command.data[6], 8, 16, QLatin1Char('0'))
46 .arg(command.data[7], 8, 16, QLatin1Char('0'));
47 return QVariant(str);
48 }
49 else
50 {
51 return QVariant();
52 }
53}
54
55void GPUCommandStreamItemModel::GXCommandProcessed(int total_command_count)
56{
57 emit GXCommandFinished(total_command_count);
58}
59
60void GPUCommandStreamItemModel::OnGXCommandFinishedInternal(int total_command_count)
61{
62 if (total_command_count == 0)
63 return;
64
65 int prev_command_count = command_count;
66 command_count = total_command_count;
67 emit dataChanged(index(prev_command_count,0), index(total_command_count-1,0));
68}
69
70
71GPUCommandStreamWidget::GPUCommandStreamWidget(QWidget* parent) : QDockWidget(tr("Graphics Debugger"), parent)
72{
73 // TODO: set objectName!
74
75 GPUCommandStreamItemModel* command_model = new GPUCommandStreamItemModel(this);
76 g_debugger.RegisterObserver(command_model);
77
78 QListView* command_list = new QListView;
79 command_list->setModel(command_model);
80 command_list->setFont(QFont("monospace"));
81
82 setWidget(command_list);
83}
diff --git a/src/citra_qt/debugger/graphics.hxx b/src/citra_qt/debugger/graphics.hxx
new file mode 100644
index 000000000..72656f93c
--- /dev/null
+++ b/src/citra_qt/debugger/graphics.hxx
@@ -0,0 +1,43 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <QAbstractListModel>
8#include <QDockWidget>
9
10#include "video_core/gpu_debugger.h"
11
12class GPUCommandStreamItemModel : public QAbstractListModel, public GraphicsDebugger::DebuggerObserver
13{
14 Q_OBJECT
15
16public:
17 GPUCommandStreamItemModel(QObject* parent);
18
19 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
20 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
21
22public:
23 void GXCommandProcessed(int total_command_count) override;
24
25public slots:
26 void OnGXCommandFinishedInternal(int total_command_count);
27
28signals:
29 void GXCommandFinished(int total_command_count);
30
31private:
32 int command_count;
33};
34
35class GPUCommandStreamWidget : public QDockWidget
36{
37 Q_OBJECT
38
39public:
40 GPUCommandStreamWidget(QWidget* parent = 0);
41
42private:
43};
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 9be982909..79367c3ed 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -19,6 +19,7 @@
19#include "debugger/registers.hxx" 19#include "debugger/registers.hxx"
20#include "debugger/callstack.hxx" 20#include "debugger/callstack.hxx"
21#include "debugger/ramview.hxx" 21#include "debugger/ramview.hxx"
22#include "debugger/graphics.hxx"
22 23
23#include "core/system.h" 24#include "core/system.h"
24#include "core/loader.h" 25#include "core/loader.h"
@@ -47,10 +48,15 @@ GMainWindow::GMainWindow()
47 addDockWidget(Qt::RightDockWidgetArea, callstackWidget); 48 addDockWidget(Qt::RightDockWidgetArea, callstackWidget);
48 callstackWidget->hide(); 49 callstackWidget->hide();
49 50
51 graphicsWidget = new GPUCommandStreamWidget(this);
52 addDockWidget(Qt::RightDockWidgetArea, graphicsWidget);
53 callstackWidget->hide();
54
50 QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); 55 QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging"));
51 debug_menu->addAction(disasmWidget->toggleViewAction()); 56 debug_menu->addAction(disasmWidget->toggleViewAction());
52 debug_menu->addAction(registersWidget->toggleViewAction()); 57 debug_menu->addAction(registersWidget->toggleViewAction());
53 debug_menu->addAction(callstackWidget->toggleViewAction()); 58 debug_menu->addAction(callstackWidget->toggleViewAction());
59 debug_menu->addAction(graphicsWidget->toggleViewAction());
54 60
55 // Set default UI state 61 // Set default UI state
56 // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half 62 // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half
diff --git a/src/citra_qt/main.hxx b/src/citra_qt/main.hxx
index fa122f76e..100bdbd00 100644
--- a/src/citra_qt/main.hxx
+++ b/src/citra_qt/main.hxx
@@ -10,6 +10,7 @@ class GRenderWindow;
10class DisassemblerWidget; 10class DisassemblerWidget;
11class RegistersWidget; 11class RegistersWidget;
12class CallstackWidget; 12class CallstackWidget;
13class GPUCommandStreamWidget;
13 14
14class GMainWindow : public QMainWindow 15class GMainWindow : public QMainWindow
15{ 16{
@@ -50,6 +51,7 @@ private:
50 DisassemblerWidget* disasmWidget; 51 DisassemblerWidget* disasmWidget;
51 RegistersWidget* registersWidget; 52 RegistersWidget* registersWidget;
52 CallstackWidget* callstackWidget; 53 CallstackWidget* callstackWidget;
54 GPUCommandStreamWidget* graphicsWidget;
53}; 55};
54 56
55#endif // _CITRA_QT_MAIN_HXX_ 57#endif // _CITRA_QT_MAIN_HXX_