From 614ec7e9b1f144f5b9e18db762bd671491d084e7 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Mon, 3 Sep 2018 12:39:52 +0200 Subject: [PATCH] Fix 32-bit vram bank mapping Fixes texture corruption and other problems in many games --- core/hw/pvr/pvr_mem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/hw/pvr/pvr_mem.cpp b/core/hw/pvr/pvr_mem.cpp index dc89e7551..8cde33a44 100644 --- a/core/hw/pvr/pvr_mem.cpp +++ b/core/hw/pvr/pvr_mem.cpp @@ -281,14 +281,14 @@ u32 pvr_map32(u32 offset32) { //64b wide bus is achieved by interleaving the banks every 32 bits const u32 bank_bit = VRAM_BANK_BIT; - const u32 static_bits = VRAM_MASK - (VRAM_BANK_BIT * 2 - 1); - const u32 offset_bits = VRAM_BANK_BIT - 1; + const u32 static_bits = VRAM_MASK - (VRAM_BANK_BIT * 2 - 1) | 3; + const u32 offset_bits = (VRAM_BANK_BIT - 1) & ~3; u32 bank = (offset32 & VRAM_BANK_BIT) / VRAM_BANK_BIT; u32 rv = offset32 & static_bits; - rv |= (offset32 & offset_bits) * 8; + rv |= (offset32 & offset_bits) * 2; rv |= bank * 4;