all repos — mgba @ 9841db0d947477103fe12566737301693e509d13

mGBA Game Boy Advance Emulator

GBA Video: Don't draw sprites using unmapped VRAM in GL renderer (fixes #1865)
Vicki Pfau vi@endrift.com
Sat, 22 Aug 2020 21:56:57 -0700
commit

9841db0d947477103fe12566737301693e509d13

parent

597628736f16b9c60020662101cc54e5a7c2001f

2 files changed, 5 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -38,6 +38,7 @@ - GBA SIO: Fix deseralizing SIO registers

- GBA Video: Latch scanline at end of Hblank (fixes mgba.io/i/1319) - GBA Video: Fix Hblank timing - GBA Video: Invalidate map cache when modifying BGCNT (fixes mgba.io/i/1846) + - GBA Video: Don't draw sprites using unmapped VRAM in GL renderer (fixes mgba.io/i/1865) - SM83: Emulate HALT bug Other fixes: - 3DS: Redo video sync to be more precise
M src/gba/renderers/gl.csrc/gba/renderers/gl.c

@@ -1630,6 +1630,10 @@ int height = GBAVideoObjSizes[GBAObjAttributesAGetShape(sprite->a) * 4 + GBAObjAttributesBGetSize(sprite->b)][1];

int32_t x = (uint32_t) GBAObjAttributesBGetX(sprite->b) << 23; x >>= 23; + if (GBARegisterDISPCNTGetMode(renderer->dispcnt) >= 3 && GBAObjAttributesCGetTile(sprite->c) < 512) { + return; + } + int align = GBAObjAttributesAIs256Color(sprite->a) && !GBARegisterDISPCNTIsObjCharacterMapping(renderer->dispcnt); unsigned charBase = (BASE_TILE >> 1) + (GBAObjAttributesCGetTile(sprite->c) & ~align) * 0x10; int stride = GBARegisterDISPCNTIsObjCharacterMapping(renderer->dispcnt) ? (width >> 3) : (0x20 >> GBAObjAttributesAGet256Color(sprite->a));