mirror of https://github.com/mgba-emu/mgba.git
GBA Video: Fix mode 0 being able to read tiles above appropriate tile range
This commit is contained in:
parent
1a9b0eec6f
commit
c2040a1f63
1
CHANGES
1
CHANGES
|
@ -59,6 +59,7 @@ Bugfixes:
|
||||||
- GBA BIOS: Fix BIOS prefetch after reset
|
- GBA BIOS: Fix BIOS prefetch after reset
|
||||||
- GBA Memory: Fix alignment of open bus 8- and 16-bit loads
|
- GBA Memory: Fix alignment of open bus 8- and 16-bit loads
|
||||||
- GBA BIOS: Fix HuffUnComp boundary conditions
|
- GBA BIOS: Fix HuffUnComp boundary conditions
|
||||||
|
- GBA Video: Fix mode 0 being able to read tiles above appropriate tile range
|
||||||
Misc:
|
Misc:
|
||||||
- Qt: Disable sync to video by default
|
- Qt: Disable sync to video by default
|
||||||
- GBA: Exit cleanly on FATAL if the port supports it
|
- GBA: Exit cleanly on FATAL if the port supports it
|
||||||
|
|
|
@ -1010,6 +1010,10 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4; \
|
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4; \
|
||||||
palette = &mainPalette[paletteData]; \
|
palette = &mainPalette[paletteData]; \
|
||||||
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 5)) + (localY << 2); \
|
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 5)) + (localY << 2); \
|
||||||
|
if (UNLIKELY(charBase >= 0x10000)) { \
|
||||||
|
pixel += 8; \
|
||||||
|
continue; \
|
||||||
|
} \
|
||||||
LOAD_32(tileData, charBase, vram); \
|
LOAD_32(tileData, charBase, vram); \
|
||||||
if (tileData) { \
|
if (tileData) { \
|
||||||
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
|
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
|
||||||
|
@ -1058,6 +1062,7 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
int end2 = end - 4; \
|
int end2 = end - 4; \
|
||||||
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
|
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
|
||||||
int shift = inX & 0x3; \
|
int shift = inX & 0x3; \
|
||||||
|
if (LIKELY(charBase < 0x10000)) { \
|
||||||
if (end2 > outX) { \
|
if (end2 > outX) { \
|
||||||
LOAD_32(tileData, charBase, vram); \
|
LOAD_32(tileData, charBase, vram); \
|
||||||
tileData >>= 8 * shift; \
|
tileData >>= 8 * shift; \
|
||||||
|
@ -1066,16 +1071,20 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN); \
|
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
} \
|
||||||
\
|
\
|
||||||
|
if (LIKELY(charBase < 0x10000)) { \
|
||||||
LOAD_32(tileData, charBase + 4, vram); \
|
LOAD_32(tileData, charBase + 4, vram); \
|
||||||
tileData >>= 8 * shift; \
|
tileData >>= 8 * shift; \
|
||||||
for (; outX < end; ++outX, ++pixel) { \
|
for (; outX < end; ++outX, ++pixel) { \
|
||||||
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN); \
|
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN); \
|
||||||
} \
|
} \
|
||||||
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
int start = outX; \
|
int start = outX; \
|
||||||
outX = end - 1; \
|
outX = end - 1; \
|
||||||
pixel = &renderer->row[outX]; \
|
pixel = &renderer->row[outX]; \
|
||||||
|
if (LIKELY(charBase < 0x10000)) { \
|
||||||
if (end2 > start) { \
|
if (end2 > start) { \
|
||||||
LOAD_32(tileData, charBase, vram); \
|
LOAD_32(tileData, charBase, vram); \
|
||||||
for (; outX >= end2; --outX, --pixel) { \
|
for (; outX >= end2; --outX, --pixel) { \
|
||||||
|
@ -1083,17 +1092,23 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
} \
|
} \
|
||||||
charBase += 4; \
|
charBase += 4; \
|
||||||
} \
|
} \
|
||||||
|
} \
|
||||||
\
|
\
|
||||||
|
if (LIKELY(charBase < 0x10000)) { \
|
||||||
LOAD_32(tileData, charBase, vram); \
|
LOAD_32(tileData, charBase, vram); \
|
||||||
for (; outX >= renderer->start; --outX, --pixel) { \
|
for (; outX >= renderer->start; --outX, --pixel) { \
|
||||||
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN); \
|
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN); \
|
||||||
} \
|
} \
|
||||||
|
} \
|
||||||
outX = end; \
|
outX = end; \
|
||||||
pixel = &renderer->row[outX]; \
|
pixel = &renderer->row[outX]; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DRAW_BACKGROUND_MODE_0_TILE_PREFIX_256(BLEND, OBJWIN) \
|
#define DRAW_BACKGROUND_MODE_0_TILE_PREFIX_256(BLEND, OBJWIN) \
|
||||||
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
|
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
|
||||||
|
if (UNLIKELY(charBase >= 0x10000)) { \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
int end = mod8 - 4; \
|
int end = mod8 - 4; \
|
||||||
pixel = &renderer->row[outX]; \
|
pixel = &renderer->row[outX]; \
|
||||||
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
|
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
|
||||||
|
@ -1139,6 +1154,10 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
for (; tileX < tileEnd; ++tileX) { \
|
for (; tileX < tileEnd; ++tileX) { \
|
||||||
BACKGROUND_TEXT_SELECT_CHARACTER; \
|
BACKGROUND_TEXT_SELECT_CHARACTER; \
|
||||||
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
|
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
|
||||||
|
if (UNLIKELY(charBase >= 0x10000)) { \
|
||||||
|
pixel += 8; \
|
||||||
|
continue; \
|
||||||
|
} \
|
||||||
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
|
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
|
||||||
LOAD_32(tileData, charBase, vram); \
|
LOAD_32(tileData, charBase, vram); \
|
||||||
if (tileData) { \
|
if (tileData) { \
|
||||||
|
|
Loading…
Reference in New Issue