all repos — mgba @ e6863a6cc540f70480842f1a39271b14c5f14c5b

mGBA Game Boy Advance Emulator

Fix mosaic drawing of 256-color mirrored background tiles
Jeffrey Pfau jeffrey@endrift.com
Wed, 09 Jul 2014 22:49:05 -0700
commit

e6863a6cc540f70480842f1a39271b14c5f14c5b

parent

c3136b914e6577610019ae52c872b03028eb81c4

1 files changed, 9 insertions(+), 7 deletions(-)

jump to
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -1066,18 +1066,20 @@ charBase = ((background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) >> 2) + (localY << 1); \

tileData = carryData; \ for (x = 0; x < 8; ++x) { \ if (!mosaicWait) { \ - if (x >= 4) { \ - tileData = ((uint32_t*)renderer->d.vram)[charBase + 1]; \ - if (!GBA_TEXT_MAP_HFLIP(mapData)) { \ + if (!GBA_TEXT_MAP_HFLIP(mapData)) { \ + if (x >= 4) { \ + tileData = ((uint32_t*)renderer->d.vram)[charBase + 1]; \ tileData >>= (x - 4) * 8; \ } else { \ - tileData >>= (7 - x) * 8; \ + tileData = ((uint32_t*)renderer->d.vram)[charBase]; \ + tileData >>= x * 8; \ } \ } else { \ - tileData = ((uint32_t*)renderer->d.vram)[charBase]; \ - if (!GBA_TEXT_MAP_HFLIP(mapData)) { \ - tileData >>= x * 8; \ + if (x >= 4) { \ + tileData = ((uint32_t*)renderer->d.vram)[charBase]; \ + tileData >>= (7 - x) * 8; \ } else { \ + tileData = ((uint32_t*)renderer->d.vram)[charBase + 1]; \ tileData >>= (3 - x) * 8; \ } \ } \