summaryrefslogtreecommitdiffstats
path: root/src/citra_qt/debugger/graphics_framebuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt/debugger/graphics_framebuffer.cpp')
-rw-r--r--src/citra_qt/debugger/graphics_framebuffer.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/citra_qt/debugger/graphics_framebuffer.cpp b/src/citra_qt/debugger/graphics_framebuffer.cpp
index ac47f298d..484be1db5 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;