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 b96d980a98
commit 745b1c76b5
2 changed files with 14 additions and 9 deletions

View File

@ -1,6 +1,7 @@
0.9.4: (Future)
Emulation fixes:
- GBA I/O: Disable open bus behavior on invalid register 06A
- GBA Video: Ignore horizontally off-screen sprite timing (fixes mgba.io/i/2391)
Other fixes:
- FFmpeg: Fix crash when encoding audio with some containers
- FFmpeg: Fix GIF recording (fixes mgba.io/i/2393)

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;
}
}