Pica: Unify ugly address translation hacks.
This commit is contained in:
parent
7e210e0229
commit
40f123b7c0
7 changed files with 33 additions and 24 deletions
|
@ -199,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);
|
||||
|
@ -224,7 +224,7 @@ void GraphicsFramebufferWidget::OnUpdate()
|
|||
case Format::RGBA8:
|
||||
{
|
||||
QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32);
|
||||
u32* color_buffer = (u32*)Memory::GetPointer(framebuffer_address);
|
||||
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);
|
||||
|
@ -239,7 +239,7 @@ void GraphicsFramebufferWidget::OnUpdate()
|
|||
case Format::RGB8:
|
||||
{
|
||||
QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32);
|
||||
u8* color_buffer = Memory::GetPointer(framebuffer_address);
|
||||
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;
|
||||
|
@ -254,7 +254,7 @@ void GraphicsFramebufferWidget::OnUpdate()
|
|||
case Format::RGBA5551:
|
||||
{
|
||||
QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32);
|
||||
u32* color_buffer = (u32*)Memory::GetPointer(framebuffer_address);
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue