GBA Video: Fix double-size OBJ wrapping in GL renderer (fixes #1712)
Vicki Pfau vi@endrift.com
Wed, 27 May 2020 15:19:17 -0700
2 files changed,
5 insertions(+),
4 deletions(-)
M
CHANGES
→
CHANGES
@@ -25,6 +25,7 @@ - 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) + - GBA Video: Fix double-size OBJ wrapping in GL renderer (fixes mgba.io/1712) Other fixes: - All: Improve export headers (fixes mgba.io/i/1738) - ARM Debugger: Clear low bit on breakpoint addresses (fixes mgba.io/i/1764)
M
src/gba/renderers/gl.c
→
src/gba/renderers/gl.c
@@ -1634,15 +1634,15 @@ 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)); - if (spriteY + height >= 256) { - spriteY -= 256; - } - int totalWidth = width; int totalHeight = height; if (GBAObjAttributesAIsTransformed(sprite->a) && GBAObjAttributesAIsDoubleSize(sprite->a)) { totalWidth <<= 1; totalHeight <<= 1; + } + + if (spriteY + totalHeight >= 256) { + spriteY -= 256; } const struct GBAVideoGLShader* shader = &renderer->objShader[GBAObjAttributesAGet256Color(sprite->a)];