summaryrefslogtreecommitdiffstats
path: root/src/citra_qt/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt/debugger')
-rw-r--r--src/citra_qt/debugger/callstack.cpp4
-rw-r--r--src/citra_qt/debugger/graphics_breakpoints.cpp14
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.cpp56
-rw-r--r--src/citra_qt/debugger/graphics_framebuffer.cpp23
4 files changed, 66 insertions, 31 deletions
diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp
index 895851be3..a9ec2f7fe 100644
--- a/src/citra_qt/debugger/callstack.cpp
+++ b/src/citra_qt/debugger/callstack.cpp
@@ -27,10 +27,10 @@ void CallstackWidget::OnCPUStepped()
ARM_Interface* app_core = Core::g_app_core;
u32 sp = app_core->GetReg(13); //stack pointer
- u32 addr, ret_addr, call_addr, func_addr;
+ u32 ret_addr, call_addr, func_addr;
int counter = 0;
- for (int addr = 0x10000000; addr >= sp; addr -= 4)
+ for (u32 addr = 0x10000000; addr >= sp; addr -= 4)
{
ret_addr = Memory::Read32(addr);
call_addr = ret_addr - 4; //get call address???
diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp
index e391f895b..9486f06cc 100644
--- a/src/citra_qt/debugger/graphics_breakpoints.cpp
+++ b/src/citra_qt/debugger/graphics_breakpoints.cpp
@@ -39,15 +39,17 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const
switch (index.column()) {
case 0:
{
- std::map<Pica::DebugContext::Event, QString> map;
- map.insert({Pica::DebugContext::Event::CommandLoaded, tr("Pica command loaded")});
- map.insert({Pica::DebugContext::Event::CommandProcessed, tr("Pica command processed")});
- map.insert({Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch")});
- map.insert({Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")});
+ static const std::map<Pica::DebugContext::Event, QString> map = {
+ { Pica::DebugContext::Event::CommandLoaded, tr("Pica command loaded") },
+ { Pica::DebugContext::Event::CommandProcessed, tr("Pica command processed") },
+ { Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch") },
+ { Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch") },
+ { Pica::DebugContext::Event::VertexLoaded, tr("Vertex Loaded") }
+ };
_dbg_assert_(Debug_GPU, map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents));
- return map[event];
+ return (map.find(event) != map.end()) ? map.at(event) : QString();
}
case 1:
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp
index 83102c647..753cc25da 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) {
QImage decoded_image(info.width, info.height, QImage::Format_ARGB32);
for (int y = 0; y < info.height; ++y) {
for (int x = 0; x < info.width; ++x) {
- Math::Vec4<u8> color = Pica::DebugUtils::LookupTexture(src, x, y, info);
+ Math::Vec4<u8> color = Pica::DebugUtils::LookupTexture(src, x, y, info, true);
decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a()));
}
}
@@ -47,7 +47,7 @@ public:
};
TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo& info, QWidget* parent)
- : QDockWidget(tr("Texture 0x%1").arg(info.address, 8, 16, QLatin1Char('0'))),
+ : QDockWidget(tr("Texture 0x%1").arg(info.physical_address, 8, 16, QLatin1Char('0'))),
info(info) {
QWidget* main_widget = new QWidget;
@@ -60,7 +60,7 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo
phys_address_spinbox->SetBase(16);
phys_address_spinbox->SetRange(0, 0xFFFFFFFF);
phys_address_spinbox->SetPrefix("0x");
- phys_address_spinbox->SetValue(info.address);
+ phys_address_spinbox->SetValue(info.physical_address);
connect(phys_address_spinbox, SIGNAL(ValueChanged(qint64)), this, SLOT(OnAddressChanged(qint64)));
QComboBox* format_choice = new QComboBox;
@@ -69,6 +69,13 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo
format_choice->addItem(tr("RGBA5551"));
format_choice->addItem(tr("RGB565"));
format_choice->addItem(tr("RGBA4"));
+ format_choice->addItem(tr("IA8"));
+ format_choice->addItem(tr("UNK6"));
+ format_choice->addItem(tr("I8"));
+ format_choice->addItem(tr("A8"));
+ format_choice->addItem(tr("IA4"));
+ format_choice->addItem(tr("UNK10"));
+ format_choice->addItem(tr("A4"));
format_choice->setCurrentIndex(static_cast<int>(info.format));
connect(format_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(OnFormatChanged(int)));
@@ -125,7 +132,7 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo
}
void TextureInfoDockWidget::OnAddressChanged(qint64 value) {
- info.address = value;
+ info.physical_address = value;
emit UpdatePixmap(ReloadPixmap());
}
@@ -150,7 +157,7 @@ void TextureInfoDockWidget::OnStrideChanged(int value) {
}
QPixmap TextureInfoDockWidget::ReloadPixmap() const {
- u8* src = Memory::GetPointer(info.address);
+ u8* src = Memory::GetPointer(Pica::PAddrToVAddr(info.physical_address));
return QPixmap::fromImage(LoadTexture(src, info));
}
@@ -223,9 +230,21 @@ void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace&
void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) {
const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt();
- if (COMMAND_IN_RANGE(command_id, texture0)) {
- auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(Pica::registers.texture0,
- Pica::registers.texture0_format);
+ if (COMMAND_IN_RANGE(command_id, texture0) ||
+ COMMAND_IN_RANGE(command_id, texture1) ||
+ COMMAND_IN_RANGE(command_id, texture2)) {
+
+ unsigned index;
+ if (COMMAND_IN_RANGE(command_id, texture0)) {
+ index = 0;
+ } else if (COMMAND_IN_RANGE(command_id, texture1)) {
+ index = 1;
+ } else {
+ index = 2;
+ }
+ auto config = Pica::registers.GetTextures()[index].config;
+ auto format = Pica::registers.GetTextures()[index].format;
+ auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
// TODO: Instead, emit a signal here to be caught by the main window widget.
auto main_window = static_cast<QMainWindow*>(parent());
@@ -237,10 +256,23 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
QWidget* new_info_widget;
const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt();
- if (COMMAND_IN_RANGE(command_id, texture0)) {
- u8* src = Memory::GetPointer(Pica::registers.texture0.GetPhysicalAddress());
- auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(Pica::registers.texture0,
- Pica::registers.texture0_format);
+ if (COMMAND_IN_RANGE(command_id, texture0) ||
+ COMMAND_IN_RANGE(command_id, texture1) ||
+ COMMAND_IN_RANGE(command_id, texture2)) {
+
+ unsigned index;
+ if (COMMAND_IN_RANGE(command_id, texture0)) {
+ index = 0;
+ } else if (COMMAND_IN_RANGE(command_id, texture1)) {
+ index = 1;
+ } else {
+ index = 2;
+ }
+ auto config = Pica::registers.GetTextures()[index].config;
+ auto format = Pica::registers.GetTextures()[index].format;
+
+ auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
+ u8* src = Memory::GetPointer(Pica::PAddrToVAddr(config.GetPhysicalAddress()));
new_info_widget = new TextureInfoWidget(src, info);
} else {
new_info_widget = new QWidget;
diff --git a/src/citra_qt/debugger/graphics_framebuffer.cpp b/src/citra_qt/debugger/graphics_framebuffer.cpp
index fb62e8f17..dd41c3880 100644
--- a/src/citra_qt/debugger/graphics_framebuffer.cpp
+++ b/src/citra_qt/debugger/graphics_framebuffer.cpp
@@ -125,7 +125,8 @@ GraphicsFramebufferWidget::GraphicsFramebufferWidget(std::shared_ptr<Pica::Debug
setWidget(main_widget);
// Load current data - TODO: Make sure this works when emulation is not running
- emit Update();
+ if (debug_context && debug_context->at_breakpoint)
+ emit Update();
widget()->setEnabled(false); // TODO: Only enable if currently at breakpoint
}
@@ -198,7 +199,7 @@ void GraphicsFramebufferWidget::OnUpdate()
auto framebuffer = Pica::registers.framebuffer;
using Framebuffer = decltype(framebuffer);
- framebuffer_address = framebuffer.GetColorBufferAddress();
+ framebuffer_address = framebuffer.GetColorBufferPhysicalAddress();
framebuffer_width = framebuffer.GetWidth();
framebuffer_height = framebuffer.GetHeight();
framebuffer_format = static_cast<Format>(framebuffer.color_format);
@@ -223,9 +224,9 @@ void GraphicsFramebufferWidget::OnUpdate()
case Format::RGBA8:
{
QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32);
- u32* color_buffer = (u32*)Memory::GetPointer(framebuffer_address);
- for (int y = 0; y < framebuffer_height; ++y) {
- for (int x = 0; x < framebuffer_width; ++x) {
+ u32* color_buffer = (u32*)Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address));
+ for (unsigned y = 0; y < framebuffer_height; ++y) {
+ for (unsigned x = 0; x < framebuffer_width; ++x) {
u32 value = *(color_buffer + x + y * framebuffer_width);
decoded_image.setPixel(x, y, qRgba((value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF, 255/*value >> 24*/));
@@ -238,9 +239,9 @@ void GraphicsFramebufferWidget::OnUpdate()
case Format::RGB8:
{
QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32);
- u8* color_buffer = Memory::GetPointer(framebuffer_address);
- for (int y = 0; y < framebuffer_height; ++y) {
- for (int x = 0; x < framebuffer_width; ++x) {
+ u8* color_buffer = Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address));
+ for (unsigned y = 0; y < framebuffer_height; ++y) {
+ for (unsigned x = 0; x < framebuffer_width; ++x) {
u8* pixel_pointer = color_buffer + x * 3 + y * 3 * framebuffer_width;
decoded_image.setPixel(x, y, qRgba(pixel_pointer[0], pixel_pointer[1], pixel_pointer[2], 255/*value >> 24*/));
@@ -253,9 +254,9 @@ void GraphicsFramebufferWidget::OnUpdate()
case Format::RGBA5551:
{
QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32);
- u32* color_buffer = (u32*)Memory::GetPointer(framebuffer_address);
- for (int y = 0; y < framebuffer_height; ++y) {
- for (int x = 0; x < framebuffer_width; ++x) {
+ u32* color_buffer = (u32*)Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address));
+ for (unsigned y = 0; y < framebuffer_height; ++y) {
+ for (unsigned x = 0; x < framebuffer_width; ++x) {
u16 value = *(u16*)(((u8*)color_buffer) + x * 2 + y * framebuffer_width * 2);
u8 r = (value >> 11) & 0x1F;
u8 g = (value >> 6) & 0x1F;