mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 22:00:05 +00:00 
			
		
		
		
	Merge pull request #997 from Lectem/cmdlist_full_debug
citra-qt: Improve pica command list widget (add mask, fix some issues)
This commit is contained in:
		
						commit
						f5144e6c10
					
				
					 4 changed files with 52 additions and 50 deletions
				
			
		|  | @ -175,29 +175,29 @@ int GPUCommandListModel::rowCount(const QModelIndex& parent) const { | |||
| } | ||||
| 
 | ||||
| int GPUCommandListModel::columnCount(const QModelIndex& parent) const { | ||||
|     return 3; | ||||
|     return 4; | ||||
| } | ||||
| 
 | ||||
| QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const { | ||||
|     if (!index.isValid()) | ||||
|         return QVariant(); | ||||
| 
 | ||||
|     const auto& writes = pica_trace.writes; | ||||
|     const Pica::CommandProcessor::CommandHeader cmd{writes[index.row()].Id()}; | ||||
|     const u32 val{writes[index.row()].Value()}; | ||||
|     const auto& write = pica_trace.writes[index.row()]; | ||||
| 
 | ||||
|     if (role == Qt::DisplayRole) { | ||||
|         QString content; | ||||
|         switch ( index.column() ) { | ||||
|         case 0: | ||||
|             return QString::fromLatin1(Pica::Regs::GetCommandName(cmd.cmd_id).c_str()); | ||||
|             return QString::fromLatin1(Pica::Regs::GetCommandName(write.cmd_id).c_str()); | ||||
|         case 1: | ||||
|             return QString("%1").arg(cmd.cmd_id, 3, 16, QLatin1Char('0')); | ||||
|             return QString("%1").arg(write.cmd_id, 3, 16, QLatin1Char('0')); | ||||
|         case 2: | ||||
|             return QString("%1").arg(val, 8, 16, QLatin1Char('0')); | ||||
|             return QString("%1").arg(write.mask, 4, 2, QLatin1Char('0')); | ||||
|         case 3: | ||||
|             return QString("%1").arg(write.value, 8, 16, QLatin1Char('0')); | ||||
|         } | ||||
|     } else if (role == CommandIdRole) { | ||||
|         return QVariant::fromValue<int>(cmd.cmd_id.Value()); | ||||
|         return QVariant::fromValue<int>(write.cmd_id); | ||||
|     } | ||||
| 
 | ||||
|     return QVariant(); | ||||
|  | @ -213,6 +213,8 @@ QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientatio | |||
|         case 1: | ||||
|             return tr("Register"); | ||||
|         case 2: | ||||
|             return tr("Mask"); | ||||
|         case 3: | ||||
|             return tr("New Value"); | ||||
|         } | ||||
| 
 | ||||
|  | @ -260,7 +262,7 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { | |||
| } | ||||
| 
 | ||||
| void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | ||||
|     QWidget* new_info_widget; | ||||
|     QWidget* new_info_widget = nullptr; | ||||
| 
 | ||||
|     const unsigned int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); | ||||
|     if (COMMAND_IN_RANGE(command_id, texture0) || | ||||
|  | @ -281,14 +283,15 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | |||
|         auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); | ||||
|         u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress()); | ||||
|         new_info_widget = new TextureInfoWidget(src, info); | ||||
|     } else { | ||||
|         new_info_widget = new QWidget; | ||||
|     } | ||||
| 
 | ||||
|     widget()->layout()->removeWidget(command_info_widget); | ||||
|     delete command_info_widget; | ||||
|     widget()->layout()->addWidget(new_info_widget); | ||||
|     command_info_widget = new_info_widget; | ||||
|     if (command_info_widget) { | ||||
|         delete command_info_widget; | ||||
|         command_info_widget = nullptr; | ||||
|     } | ||||
|     if (new_info_widget) { | ||||
|         widget()->layout()->addWidget(new_info_widget); | ||||
|         command_info_widget = new_info_widget; | ||||
|     } | ||||
| } | ||||
| #undef COMMAND_IN_RANGE | ||||
| 
 | ||||
|  | @ -300,7 +303,9 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
| 
 | ||||
|     list_widget = new QTreeView; | ||||
|     list_widget->setModel(model); | ||||
|     list_widget->setFont(QFont("monospace")); | ||||
|     QFont font("monospace"); | ||||
|     font.setStyleHint(QFont::Monospace); // Automatic fallback to a monospace font on on platforms without a font called "monospace"
 | ||||
|     list_widget->setFont(font); | ||||
|     list_widget->setRootIsDecorated(false); | ||||
|     list_widget->setUniformRowHeights(true); | ||||
| 
 | ||||
|  | @ -324,7 +329,7 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
| 
 | ||||
|     connect(copy_all, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard())); | ||||
| 
 | ||||
|     command_info_widget = new QWidget; | ||||
|     command_info_widget = nullptr; | ||||
| 
 | ||||
|     QVBoxLayout* main_layout = new QVBoxLayout; | ||||
|     main_layout->addWidget(list_widget); | ||||
|  | @ -334,7 +339,6 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
|         sub_layout->addWidget(copy_all); | ||||
|         main_layout->addLayout(sub_layout); | ||||
|     } | ||||
|     main_layout->addWidget(command_info_widget); | ||||
|     main_widget->setLayout(main_layout); | ||||
| 
 | ||||
|     setWidget(main_widget); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue