Pica: Unify ugly address translation hacks.

This commit is contained in:
Tony Wasserka 2014-12-15 21:28:45 +01:00
parent 7e210e0229
commit 40f123b7c0
7 changed files with 33 additions and 24 deletions

View file

@ -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;
@ -125,7 +125,7 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo
}
void TextureInfoDockWidget::OnAddressChanged(qint64 value) {
info.address = value;
info.physical_address = value;
emit UpdatePixmap(ReloadPixmap());
}
@ -150,7 +150,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));
}

View file

@ -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);