GBA Video: Add missing parts of 256-color mode 0 mosaic (fixes #1701)

This commit is contained in:
Vicki Pfau 2020-05-25 15:07:54 -07:00
parent ff1033b801
commit 11ccbca4ff
2 changed files with 51 additions and 2 deletions

View File

@ -24,6 +24,7 @@ Emulation fixes:
- GBA Video: Fix Hblank timing
- GBA Video: Fix mosaic objects drawing past the end (fixes mgba.io/i/1702)
- GBA Video: Fix disabling OBJWIN in GL renderer (fixes mgba.io/i/1759)
- GBA Video: Add missing parts of 256-color mode 0 mosaic (fixes mgba.io/1701)
Other fixes:
- All: Improve export headers (fixes mgba.io/i/1738)
- ARM Debugger: Clear low bit on breakpoint addresses (fixes mgba.io/i/1764)

View File

@ -329,8 +329,56 @@
}
#define DRAW_BACKGROUND_MODE_0_MOSAIC_256(BLEND, OBJWIN) \
x = inX & 7; \
if (mosaicWait) { \
int baseX = x - (mosaicH - mosaicWait); \
if (baseX < 0) { \
int disturbX = (16 + baseX) >> 3; \
inX -= disturbX << 3; \
localX = tileX * 8 + inX; \
BACKGROUND_TEXT_SELECT_CHARACTER; \
localY = inY & 0x7; \
if (GBA_TEXT_MAP_VFLIP(mapData)) { \
localY = 7 - localY; \
} \
baseX -= disturbX << 3; \
inX += disturbX << 3; \
} else { \
localX = tileX * 8 + inX; \
BACKGROUND_TEXT_SELECT_CHARACTER; \
localY = inY & 0x7; \
if (GBA_TEXT_MAP_VFLIP(mapData)) { \
localY = 7 - localY; \
} \
} \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
if (UNLIKELY(charBase >= 0x10000)) { \
carryData = 0; \
} else { \
LOAD_32(tileData, charBase, vram); \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
if (x >= 4) { \
LOAD_32(tileData, charBase + 4, vram); \
tileData >>= (x - 4) * 8; \
} else { \
LOAD_32(tileData, charBase, vram); \
tileData >>= x * 8; \
} \
} else { \
if (x >= 4) { \
LOAD_32(tileData, charBase, vram); \
tileData >>= (7 - x) * 8; \
} else { \
LOAD_32(tileData, charBase + 4, vram); \
tileData >>= (3 - x) * 8; \
} \
} \
tileData &= 0xFF; \
carryData = tileData; \
} \
} \
localX = tileX * 8 + inX; \
for (; tileX < tileEnd; ++tileX) { \
for (; length; ++tileX) { \
mapData = background->mapCache[(localX >> 3) & 0x3F]; \
localX += 8; \
localY = inY & 0x7; \
@ -339,7 +387,7 @@
} \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
tileData = carryData; \
for (x = 0; x < 8; ++x) { \
for (x = 0; x < 8 && length; ++x, --length) { \
if (!mosaicWait) { \
if (UNLIKELY(charBase >= 0x10000)) { \
carryData = 0; \