GBA Video: Ignore horizontally off-screen sprite timing (fixes #2391)

This commit is contained in:
Vicki Pfau 2022-01-22 04:27:19 -08:00
parent c41d1e18dc
commit d1bc394ca3
2 changed files with 14 additions and 9 deletions

View File

@ -22,6 +22,7 @@ Emulation fixes:
- GBA I/O: Disable open bus behavior on invalid register 06A
- GBA Memory: Fix misaligned 32-bit I/O loads (fixes mgba.io/i/2307)
- GBA Video: Fix OpenGL rendering on M1 Macs
- GBA Video: Ignore horizontally off-screen sprite timing (fixes mgba.io/i/2391)
Other fixes:
- Core: Don't attempt to restore rewind diffs past start of rewind
- FFmpeg: Fix crash when encoding audio with some containers

View File

@ -24,16 +24,20 @@ int GBAVideoRendererCleanOAM(struct GBAObj* oam, struct GBAVideoRendererSprite*
width <<= GBAObjAttributesAGetDoubleSize(obj.a);
cycles = 10 + width * 2;
}
if (GBAObjAttributesAGetY(obj.a) < GBA_VIDEO_VERTICAL_PIXELS || GBAObjAttributesAGetY(obj.a) + height >= VIDEO_VERTICAL_TOTAL_PIXELS) {
int y = GBAObjAttributesAGetY(obj.a) + offsetY;
sprites[oamMax].y = y;
sprites[oamMax].endY = y + height;
sprites[oamMax].cycles = cycles;
sprites[oamMax].obj = obj;
sprites[oamMax].index = i;
++oamMax;
if (GBAObjAttributesAGetY(obj.a) >= GBA_VIDEO_VERTICAL_PIXELS && GBAObjAttributesAGetY(obj.a) + height < VIDEO_VERTICAL_TOTAL_PIXELS) {
continue;
}
if (GBAObjAttributesBGetX(obj.b) >= GBA_VIDEO_HORIZONTAL_PIXELS && GBAObjAttributesBGetX(obj.b) + width < 512) {
continue;
}
int y = GBAObjAttributesAGetY(obj.a) + offsetY;
sprites[oamMax].y = y;
sprites[oamMax].endY = y + height;
sprites[oamMax].cycles = cycles;
sprites[oamMax].obj = obj;
sprites[oamMax].index = i;
++oamMax;
}
}
return oamMax;
}
}