GBA Video: Fix double-size OBJ wrapping in GL renderer (fixes #1712)

This commit is contained in:
Vicki Pfau 2020-05-27 15:19:17 -07:00
parent 4297ae70fd
commit a0953f1764
2 changed files with 5 additions and 4 deletions

View File

@ -25,6 +25,7 @@ Emulation fixes:
- 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)

View File

@ -1634,10 +1634,6 @@ void GBAVideoGLRendererDrawSprite(struct GBAVideoGLRenderer* renderer, struct GB
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)) {
@ -1645,6 +1641,10 @@ void GBAVideoGLRendererDrawSprite(struct GBAVideoGLRenderer* renderer, struct GB
totalHeight <<= 1;
}
if (spriteY + totalHeight >= 256) {
spriteY -= 256;
}
const struct GBAVideoGLShader* shader = &renderer->objShader[GBAObjAttributesAGet256Color(sprite->a)];
const GLuint* uniforms = shader->uniforms;
glBindFramebuffer(GL_FRAMEBUFFER, renderer->fbo[GBA_GL_FBO_OBJ]);