diff options
Diffstat (limited to 'src/citra_qt/debugger/graphics_cmdlists.cpp')
| -rw-r--r-- | src/citra_qt/debugger/graphics_cmdlists.cpp | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index 7f97cf143..95187e54d 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp | |||
| @@ -24,7 +24,7 @@ QImage LoadTexture(u8* src, const Pica::DebugUtils::TextureInfo& info) { | |||
| 24 | QImage decoded_image(info.width, info.height, QImage::Format_ARGB32); | 24 | QImage decoded_image(info.width, info.height, QImage::Format_ARGB32); |
| 25 | for (int y = 0; y < info.height; ++y) { | 25 | for (int y = 0; y < info.height; ++y) { |
| 26 | for (int x = 0; x < info.width; ++x) { | 26 | for (int x = 0; x < info.width; ++x) { |
| 27 | Math::Vec4<u8> color = Pica::DebugUtils::LookupTexture(src, x, y, info); | 27 | Math::Vec4<u8> color = Pica::DebugUtils::LookupTexture(src, x, y, info, true); |
| 28 | decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a())); | 28 | decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a())); |
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| @@ -47,7 +47,7 @@ public: | |||
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo& info, QWidget* parent) | 49 | TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo& info, QWidget* parent) |
| 50 | : QDockWidget(tr("Texture 0x%1").arg(info.address, 8, 16, QLatin1Char('0'))), | 50 | : QDockWidget(tr("Texture 0x%1").arg(info.physical_address, 8, 16, QLatin1Char('0'))), |
| 51 | info(info) { | 51 | info(info) { |
| 52 | 52 | ||
| 53 | QWidget* main_widget = new QWidget; | 53 | QWidget* main_widget = new QWidget; |
| @@ -60,7 +60,7 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo | |||
| 60 | phys_address_spinbox->SetBase(16); | 60 | phys_address_spinbox->SetBase(16); |
| 61 | phys_address_spinbox->SetRange(0, 0xFFFFFFFF); | 61 | phys_address_spinbox->SetRange(0, 0xFFFFFFFF); |
| 62 | phys_address_spinbox->SetPrefix("0x"); | 62 | phys_address_spinbox->SetPrefix("0x"); |
| 63 | phys_address_spinbox->SetValue(info.address); | 63 | phys_address_spinbox->SetValue(info.physical_address); |
| 64 | connect(phys_address_spinbox, SIGNAL(ValueChanged(qint64)), this, SLOT(OnAddressChanged(qint64))); | 64 | connect(phys_address_spinbox, SIGNAL(ValueChanged(qint64)), this, SLOT(OnAddressChanged(qint64))); |
| 65 | 65 | ||
| 66 | QComboBox* format_choice = new QComboBox; | 66 | QComboBox* format_choice = new QComboBox; |
| @@ -69,6 +69,13 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo | |||
| 69 | format_choice->addItem(tr("RGBA5551")); | 69 | format_choice->addItem(tr("RGBA5551")); |
| 70 | format_choice->addItem(tr("RGB565")); | 70 | format_choice->addItem(tr("RGB565")); |
| 71 | format_choice->addItem(tr("RGBA4")); | 71 | format_choice->addItem(tr("RGBA4")); |
| 72 | format_choice->addItem(tr("IA8")); | ||
| 73 | format_choice->addItem(tr("UNK6")); | ||
| 74 | format_choice->addItem(tr("I8")); | ||
| 75 | format_choice->addItem(tr("A8")); | ||
| 76 | format_choice->addItem(tr("IA4")); | ||
| 77 | format_choice->addItem(tr("UNK10")); | ||
| 78 | format_choice->addItem(tr("A4")); | ||
| 72 | format_choice->setCurrentIndex(static_cast<int>(info.format)); | 79 | format_choice->setCurrentIndex(static_cast<int>(info.format)); |
| 73 | connect(format_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(OnFormatChanged(int))); | 80 | connect(format_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(OnFormatChanged(int))); |
| 74 | 81 | ||
| @@ -125,7 +132,7 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo | |||
| 125 | } | 132 | } |
| 126 | 133 | ||
| 127 | void TextureInfoDockWidget::OnAddressChanged(qint64 value) { | 134 | void TextureInfoDockWidget::OnAddressChanged(qint64 value) { |
| 128 | info.address = value; | 135 | info.physical_address = value; |
| 129 | emit UpdatePixmap(ReloadPixmap()); | 136 | emit UpdatePixmap(ReloadPixmap()); |
| 130 | } | 137 | } |
| 131 | 138 | ||
| @@ -150,7 +157,7 @@ void TextureInfoDockWidget::OnStrideChanged(int value) { | |||
| 150 | } | 157 | } |
| 151 | 158 | ||
| 152 | QPixmap TextureInfoDockWidget::ReloadPixmap() const { | 159 | QPixmap TextureInfoDockWidget::ReloadPixmap() const { |
| 153 | u8* src = Memory::GetPointer(info.address); | 160 | u8* src = Memory::GetPointer(Pica::PAddrToVAddr(info.physical_address)); |
| 154 | return QPixmap::fromImage(LoadTexture(src, info)); | 161 | return QPixmap::fromImage(LoadTexture(src, info)); |
| 155 | } | 162 | } |
| 156 | 163 | ||
| @@ -223,9 +230,21 @@ void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& | |||
| 223 | 230 | ||
| 224 | void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { | 231 | void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { |
| 225 | const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt(); | 232 | const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt(); |
| 226 | if (COMMAND_IN_RANGE(command_id, texture0)) { | 233 | if (COMMAND_IN_RANGE(command_id, texture0) || |
| 227 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(Pica::registers.texture0, | 234 | COMMAND_IN_RANGE(command_id, texture1) || |
| 228 | Pica::registers.texture0_format); | 235 | COMMAND_IN_RANGE(command_id, texture2)) { |
| 236 | |||
| 237 | unsigned index; | ||
| 238 | if (COMMAND_IN_RANGE(command_id, texture0)) { | ||
| 239 | index = 0; | ||
| 240 | } else if (COMMAND_IN_RANGE(command_id, texture1)) { | ||
| 241 | index = 1; | ||
| 242 | } else { | ||
| 243 | index = 2; | ||
| 244 | } | ||
| 245 | auto config = Pica::registers.GetTextures()[index].config; | ||
| 246 | auto format = Pica::registers.GetTextures()[index].format; | ||
| 247 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); | ||
| 229 | 248 | ||
| 230 | // TODO: Instead, emit a signal here to be caught by the main window widget. | 249 | // TODO: Instead, emit a signal here to be caught by the main window widget. |
| 231 | auto main_window = static_cast<QMainWindow*>(parent()); | 250 | auto main_window = static_cast<QMainWindow*>(parent()); |
| @@ -237,10 +256,23 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | |||
| 237 | QWidget* new_info_widget; | 256 | QWidget* new_info_widget; |
| 238 | 257 | ||
| 239 | const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt(); | 258 | const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt(); |
| 240 | if (COMMAND_IN_RANGE(command_id, texture0)) { | 259 | if (COMMAND_IN_RANGE(command_id, texture0) || |
| 241 | u8* src = Memory::GetPointer(Pica::registers.texture0.GetPhysicalAddress()); | 260 | COMMAND_IN_RANGE(command_id, texture1) || |
| 242 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(Pica::registers.texture0, | 261 | COMMAND_IN_RANGE(command_id, texture2)) { |
| 243 | Pica::registers.texture0_format); | 262 | |
| 263 | unsigned index; | ||
| 264 | if (COMMAND_IN_RANGE(command_id, texture0)) { | ||
| 265 | index = 0; | ||
| 266 | } else if (COMMAND_IN_RANGE(command_id, texture1)) { | ||
| 267 | index = 1; | ||
| 268 | } else { | ||
| 269 | index = 2; | ||
| 270 | } | ||
| 271 | auto config = Pica::registers.GetTextures()[index].config; | ||
| 272 | auto format = Pica::registers.GetTextures()[index].format; | ||
| 273 | |||
| 274 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); | ||
| 275 | u8* src = Memory::GetPointer(Pica::PAddrToVAddr(config.GetPhysicalAddress())); | ||
| 244 | new_info_widget = new TextureInfoWidget(src, info); | 276 | new_info_widget = new TextureInfoWidget(src, info); |
| 245 | } else { | 277 | } else { |
| 246 | new_info_widget = new QWidget; | 278 | new_info_widget = new QWidget; |