Skip to content

Commit

Permalink
fix some bugs with compressed texture look up (#2051)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaklyy authored Aug 1, 2024
1 parent 29c67f2 commit d0a7239
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/GPU3D_Soft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,20 @@ void SoftRenderer::TextureLookup(const GPU& gpu, u32 texparam, u32 texpal, s16 s
{
vramaddr += ((t & 0x3FC) * (width>>2)) + (s & 0x3FC);
vramaddr += (t & 0x3);
vramaddr &= 0x7FFFF; // address used for all calcs wraps around after slot 3

u32 slot1addr = 0x20000 + ((vramaddr & 0x1FFFC) >> 1);
if (vramaddr >= 0x40000)
slot1addr += 0x10000;

u8 val = ReadVRAM_Texture<u8>(vramaddr, gpu);
val >>= (2 * (s & 0x3));
u8 val;
if (vramaddr >= 0x20000 && vramaddr < 0x40000) // reading slot 1 for texels should always read 0
val = 0;
else
{
val = ReadVRAM_Texture<u8>(vramaddr, gpu);
val >>= (2 * (s & 0x3));
}

u16 palinfo = ReadVRAM_Texture<u16>(slot1addr, gpu);
u32 paloffset = (palinfo & 0x3FFF) << 2;
Expand Down

0 comments on commit d0a7239

Please sign in to comment.