mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	citra-qt: Add GX command history viewer.
This commit is contained in:
		
							parent
							
								
									31666632ca
								
							
						
					
					
						commit
						87e98ff97b
					
				
					 7 changed files with 151 additions and 7 deletions
				
			
		|  | @ -2,6 +2,7 @@ set(SRCS | |||
|             bootmanager.cpp | ||||
|             debugger/callstack.cpp | ||||
|             debugger/disassembler.cpp | ||||
|             debugger/graphics.cpp | ||||
|             debugger/ramview.cpp | ||||
|             debugger/registers.cpp | ||||
|             hotkeys.cpp | ||||
|  | @ -38,6 +39,7 @@ qt4_wrap_cpp(MOC_SRCS | |||
|                         bootmanager.hxx | ||||
|                         debugger/callstack.hxx | ||||
|                         debugger/disassembler.hxx | ||||
|                         debugger/graphics.hxx | ||||
|                         debugger/registers.hxx | ||||
|                         debugger/ramview.hxx | ||||
|                         hotkeys.hxx | ||||
|  |  | |||
|  | @ -130,6 +130,7 @@ | |||
|     <ClCompile Include="config\controller_config.cpp" /> | ||||
|     <ClCompile Include="config\controller_config_util.cpp" /> | ||||
|     <ClCompile Include="debugger\callstack.cpp" /> | ||||
|     <ClCompile Include="debugger\graphics.cpp" /> | ||||
|     <ClCompile Include="debugger\registers.cpp" /> | ||||
|     <ClCompile Include="debugger\disassembler.cpp" /> | ||||
|     <ClCompile Include="debugger\ramview.cpp" /> | ||||
|  | @ -143,9 +144,10 @@ | |||
|     <MOC Include="..\..\externals\qhexedit\qhexedit_p.h" /> | ||||
|     <MOC Include="..\..\externals\qhexedit\xbytearray.h" /> | ||||
|     <MOC Include="debugger\callstack.hxx" /> | ||||
|     <MOC Include="debugger\registers.hxx" /> | ||||
|     <MOC Include="debugger\disassembler.hxx" /> | ||||
|     <MOC Include="debugger\graphics.hxx" /> | ||||
|     <MOC Include="debugger\ramview.hxx" /> | ||||
|     <MOC Include="debugger\registers.hxx" /> | ||||
|     <MOC Include="bootmanager.hxx" /> | ||||
|     <MOC Include="hotkeys.hxx" /> | ||||
|     <MOC Include="main.hxx" /> | ||||
|  | @ -182,4 +184,4 @@ | |||
|   <ImportGroup Label="ExtensionTargets"> | ||||
|     <Import Project="qt-build.targets" /> | ||||
|   </ImportGroup> | ||||
| </Project> | ||||
| </Project> | ||||
|  |  | |||
|  | @ -36,10 +36,13 @@ | |||
|     <ClCompile Include="debugger\callstack.cpp"> | ||||
|       <Filter>debugger</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="debugger\ramview.cpp"> | ||||
|     <ClCompile Include="debugger\disassembler.cpp"> | ||||
|       <Filter>debugger</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="debugger\disassembler.cpp"> | ||||
|     <ClCompile Include="debugger\graphics.cpp"> | ||||
|       <Filter>debugger</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="debugger\ramview.cpp"> | ||||
|       <Filter>debugger</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="debugger\registers.cpp"> | ||||
|  | @ -65,10 +68,13 @@ | |||
|     <MOC Include="debugger\callstack.hxx"> | ||||
|       <Filter>debugger</Filter> | ||||
|     </MOC> | ||||
|     <MOC Include="debugger\ramview.hxx"> | ||||
|     <MOC Include="debugger\disassembler.hxx"> | ||||
|       <Filter>debugger</Filter> | ||||
|     </MOC> | ||||
|     <MOC Include="debugger\disassembler.hxx"> | ||||
|     <MOC Include="debugger\graphics.hxx"> | ||||
|       <Filter>debugger</Filter> | ||||
|     </MOC> | ||||
|     <MOC Include="debugger\ramview.hxx"> | ||||
|       <Filter>debugger</Filter> | ||||
|     </MOC> | ||||
|     <MOC Include="debugger\registers.hxx"> | ||||
|  | @ -106,4 +112,4 @@ | |||
|   <ItemGroup> | ||||
|     <Text Include="CMakeLists.txt" /> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
| </Project> | ||||
|  |  | |||
							
								
								
									
										83
									
								
								src/citra_qt/debugger/graphics.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								src/citra_qt/debugger/graphics.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,83 @@ | |||
| // Copyright 2014 Citra Emulator Project
 | ||||
| // Licensed under GPLv2
 | ||||
| // Refer to the license.txt file included.
 | ||||
| 
 | ||||
| #include "graphics.hxx" | ||||
| #include <QListView> | ||||
| #include <QVBoxLayout> | ||||
| #include <QDebug> | ||||
| 
 | ||||
| extern GraphicsDebugger g_debugger; | ||||
| 
 | ||||
| GPUCommandStreamItemModel::GPUCommandStreamItemModel(QObject* parent) : QAbstractListModel(parent), command_count(0) | ||||
| { | ||||
|     connect(this, SIGNAL(GXCommandFinished(int)), this, SLOT(OnGXCommandFinishedInternal(int))); | ||||
| } | ||||
| 
 | ||||
| int GPUCommandStreamItemModel::rowCount(const QModelIndex& parent) const | ||||
| { | ||||
|     return command_count; | ||||
| } | ||||
| 
 | ||||
| QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) const | ||||
| { | ||||
|     if (!index.isValid()) | ||||
|         return QVariant(); | ||||
| 
 | ||||
|     int command_index = index.row(); | ||||
|     const GSP_GPU::GXCommand& command = GetDebugger()->ReadGXCommandHistory(command_index); | ||||
|     if (role == Qt::DisplayRole) | ||||
|     { | ||||
|         std::map<GSP_GPU::GXCommandId, const char*> command_names; | ||||
|         command_names[GSP_GPU::GXCommandId::REQUEST_DMA] = "REQUEST_DMA"; | ||||
|         command_names[GSP_GPU::GXCommandId::SET_COMMAND_LIST_FIRST] = "SET_COMMAND_LIST_FIRST"; | ||||
|         command_names[GSP_GPU::GXCommandId::SET_MEMORY_FILL] = "SET_MEMORY_FILL"; | ||||
|         command_names[GSP_GPU::GXCommandId::SET_DISPLAY_TRANSFER] = "SET_DISPLAY_TRANSFER"; | ||||
|         command_names[GSP_GPU::GXCommandId::SET_TEXTURE_COPY] = "SET_TEXTURE_COPY"; | ||||
|         command_names[GSP_GPU::GXCommandId::SET_COMMAND_LIST_LAST] = "SET_COMMAND_LIST_LAST"; | ||||
|         QString str = QString("%1 %2 %3 %4 %5 %6 %7 %8 %9").arg(command_names[static_cast<GSP_GPU::GXCommandId>(command.id)]) | ||||
|                         .arg(command.data[0], 8, 16, QLatin1Char('0')) | ||||
|                         .arg(command.data[1], 8, 16, QLatin1Char('0')) | ||||
|                         .arg(command.data[2], 8, 16, QLatin1Char('0')) | ||||
|                         .arg(command.data[3], 8, 16, QLatin1Char('0')) | ||||
|                         .arg(command.data[4], 8, 16, QLatin1Char('0')) | ||||
|                         .arg(command.data[5], 8, 16, QLatin1Char('0')) | ||||
|                         .arg(command.data[6], 8, 16, QLatin1Char('0')) | ||||
|                         .arg(command.data[7], 8, 16, QLatin1Char('0')); | ||||
|         return QVariant(str); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         return QVariant(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void GPUCommandStreamItemModel::GXCommandProcessed(int total_command_count) | ||||
| { | ||||
|     emit GXCommandFinished(total_command_count); | ||||
| } | ||||
| 
 | ||||
| void GPUCommandStreamItemModel::OnGXCommandFinishedInternal(int total_command_count) | ||||
| { | ||||
|     if (total_command_count == 0) | ||||
|         return; | ||||
| 
 | ||||
|     int prev_command_count = command_count; | ||||
|     command_count = total_command_count; | ||||
|     emit dataChanged(index(prev_command_count,0), index(total_command_count-1,0)); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| GPUCommandStreamWidget::GPUCommandStreamWidget(QWidget* parent) : QDockWidget(tr("Graphics Debugger"), parent) | ||||
| { | ||||
|     // TODO: set objectName!
 | ||||
| 
 | ||||
|     GPUCommandStreamItemModel* command_model = new GPUCommandStreamItemModel(this); | ||||
|     g_debugger.RegisterObserver(command_model); | ||||
| 
 | ||||
|     QListView* command_list = new QListView; | ||||
|     command_list->setModel(command_model); | ||||
|     command_list->setFont(QFont("monospace")); | ||||
| 
 | ||||
|     setWidget(command_list); | ||||
| } | ||||
							
								
								
									
										43
									
								
								src/citra_qt/debugger/graphics.hxx
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/citra_qt/debugger/graphics.hxx
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,43 @@ | |||
| // Copyright 2014 Citra Emulator Project
 | ||||
| // Licensed under GPLv2
 | ||||
| // Refer to the license.txt file included.
 | ||||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <QAbstractListModel> | ||||
| #include <QDockWidget> | ||||
| 
 | ||||
| #include "video_core/gpu_debugger.h" | ||||
| 
 | ||||
| class GPUCommandStreamItemModel : public QAbstractListModel, public GraphicsDebugger::DebuggerObserver | ||||
| { | ||||
|     Q_OBJECT | ||||
| 
 | ||||
| public: | ||||
|     GPUCommandStreamItemModel(QObject* parent); | ||||
| 
 | ||||
|     int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||||
|     QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||||
| 
 | ||||
| public: | ||||
|     void GXCommandProcessed(int total_command_count) override; | ||||
| 
 | ||||
| public slots: | ||||
|     void OnGXCommandFinishedInternal(int total_command_count); | ||||
| 
 | ||||
| signals: | ||||
|     void GXCommandFinished(int total_command_count); | ||||
| 
 | ||||
| private: | ||||
|     int command_count; | ||||
| }; | ||||
| 
 | ||||
| class GPUCommandStreamWidget : public QDockWidget | ||||
| { | ||||
|     Q_OBJECT | ||||
| 
 | ||||
| public: | ||||
|     GPUCommandStreamWidget(QWidget* parent = 0); | ||||
| 
 | ||||
| private: | ||||
| }; | ||||
|  | @ -19,6 +19,7 @@ | |||
| #include "debugger/registers.hxx" | ||||
| #include "debugger/callstack.hxx" | ||||
| #include "debugger/ramview.hxx" | ||||
| #include "debugger/graphics.hxx" | ||||
| 
 | ||||
| #include "core/system.h" | ||||
| #include "core/loader.h" | ||||
|  | @ -47,10 +48,15 @@ GMainWindow::GMainWindow() | |||
|     addDockWidget(Qt::RightDockWidgetArea, callstackWidget); | ||||
|     callstackWidget->hide(); | ||||
| 
 | ||||
|     graphicsWidget = new GPUCommandStreamWidget(this); | ||||
|     addDockWidget(Qt::RightDockWidgetArea, graphicsWidget); | ||||
|     callstackWidget->hide(); | ||||
| 
 | ||||
|     QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); | ||||
|     debug_menu->addAction(disasmWidget->toggleViewAction()); | ||||
|     debug_menu->addAction(registersWidget->toggleViewAction()); | ||||
|     debug_menu->addAction(callstackWidget->toggleViewAction()); | ||||
|     debug_menu->addAction(graphicsWidget->toggleViewAction()); | ||||
| 
 | ||||
|     // Set default UI state
 | ||||
|     // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half
 | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ class GRenderWindow; | |||
| class DisassemblerWidget; | ||||
| class RegistersWidget; | ||||
| class CallstackWidget; | ||||
| class GPUCommandStreamWidget; | ||||
| 
 | ||||
| class GMainWindow : public QMainWindow | ||||
| { | ||||
|  | @ -50,6 +51,7 @@ private: | |||
|     DisassemblerWidget* disasmWidget; | ||||
|     RegistersWidget* registersWidget; | ||||
|     CallstackWidget* callstackWidget; | ||||
|     GPUCommandStreamWidget* graphicsWidget; | ||||
| }; | ||||
| 
 | ||||
| #endif // _CITRA_QT_MAIN_HXX_
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue