Fix 32-bit vram bank mapping

Fixes texture corruption and other problems in many games
This commit is contained in:
Flyinghead 2018-09-03 12:39:52 +02:00
parent a8711e2cf2
commit 614ec7e9b1
1 changed files with 3 additions and 3 deletions

View File

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