all repos — mgba @ 257284d3e209dbc67244027360c7870be030b28d

mGBA Game Boy Advance Emulator

GBA Video: Fix block masking in mosaic mode 0
Vicki Pfau vi@endrift.com
Tue, 28 Jul 2020 17:44:53 -0700
commit

257284d3e209dbc67244027360c7870be030b28d

parent

4cfc7bcf226a2b72c915fa74ec037d0edcf75257

1 files changed, 10 insertions(+), 10 deletions(-)

jump to
M src/gba/renderers/software-mode0.csrc/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; \ } \ } \