handle address wrap around in texture cache

fixes out of bounds access in Mario 64
also slightly optimise paletted texture conversion
This commit is contained in:
RSDuck
2024-10-27 23:32:05 +01:00
parent b60f42b281
commit 58ab33210a
5 changed files with 136 additions and 114 deletions

View File

@ -499,6 +499,17 @@ public:
OAMDirty |= 1 << (addr / 1024);
}
template <typename T>
inline T ReadVRAMFlat_Texture(u32 addr) const
{
return *(T*)&VRAMFlat_Texture[addr & 0x7FFFF];
}
template <typename T>
inline T ReadVRAMFlat_TexPal(u32 addr) const
{
return *(T*)&VRAMFlat_TexPal[addr & 0x1FFFF];
}
void SetPowerCnt(u32 val) noexcept;
void StartFrame() noexcept;