GBA Video: Fix block masking in mosaic mode 0
Vicki Pfau vi@endrift.com
Tue, 28 Jul 2020 17:44:53 -0700
1 files changed,
10 insertions(+),
10 deletions(-)
M
src/gba/renderers/software-mode0.c
→
src/gba/renderers/software-mode0.c
@@ -357,21 +357,21 @@ vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \ carryData = 0; \ } else { \ - LOAD_32(tileData, charBase, vram); \ + LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \ if (!GBA_TEXT_MAP_HFLIP(mapData)) { \ if (x >= 4) { \ - LOAD_32(tileData, charBase + 4, vram); \ + LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \ tileData >>= (x - 4) * 8; \ } else { \ - LOAD_32(tileData, charBase, vram); \ + LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \ tileData >>= x * 8; \ } \ } else { \ if (x >= 4) { \ - LOAD_32(tileData, charBase, vram); \ + LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \ tileData >>= (7 - x) * 8; \ } else { \ - LOAD_32(tileData, charBase + 4, vram); \ + LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \ tileData >>= (3 - x) * 8; \ } \ } \@@ -592,21 +592,21 @@ vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \ carryData = 0; \ } else { \ - LOAD_32(tileData, charBase, vram); \ + LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \ if (!GBA_TEXT_MAP_HFLIP(mapData)) { \ if (x >= 4) { \ - LOAD_32(tileData, charBase + 4, vram); \ + LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \ tileData >>= (x - 4) * 8; \ } else { \ - LOAD_32(tileData, charBase, vram); \ + LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \ tileData >>= x * 8; \ } \ } else { \ if (x >= 4) { \ - LOAD_32(tileData, charBase, vram); \ + LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \ tileData >>= (7 - x) * 8; \ } else { \ - LOAD_32(tileData, charBase + 4, vram); \ + LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \ tileData >>= (3 - x) * 8; \ } \ } \