all repos — mgba @ 4f246827a63b1874bd940f43dd8fe22dfae02ed6

mGBA Game Boy Advance Emulator

GBA Video: Improve sprite cycle counting (fixes #1126)
Vicki Pfau vi@endrift.com
Fri, 20 Jul 2018 17:16:58 -0700
commit

4f246827a63b1874bd940f43dd8fe22dfae02ed6

parent

070f318c15524a477efaa6755aa84809059411c4

2 files changed, 4 insertions(+), 3 deletions(-)

jump to
M CHANGESCHANGES

@@ -41,6 +41,7 @@ - GBA SIO: Fix unconnected SIOCNT for multi mode (fixes mgba.io/i/1105)

- GBA BIOS: Fix BitUnPack final byte - GB I/O: DMA register is R/W - GB Video: Fix SCX timing + - GBA Video: Improve sprite cycle counting (fixes mgba.io/i/1126) Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
M src/gba/renderers/software-obj.csrc/gba/renderers/software-obj.c

@@ -193,7 +193,6 @@ uint32_t current;

if (GBAObjAttributesAIsTransformed(sprite->a)) { int totalWidth = width << GBAObjAttributesAGetDoubleSize(sprite->a); int totalHeight = height << GBAObjAttributesAGetDoubleSize(sprite->a); - renderer->spriteCyclesRemaining -= 10; struct GBAOAMMatrix mat; LOAD_16(mat.a, 0, &renderer->d.oam->mat[GBAObjAttributesBGetMatIndex(sprite->b)].a); LOAD_16(mat.b, 0, &renderer->d.oam->mat[GBAObjAttributesBGetMatIndex(sprite->b)].b);

@@ -253,6 +252,7 @@

if (outX < start || outX >= condition) { return 0; } + renderer->spriteCyclesRemaining -= 10; if (!GBAObjAttributesAIs256Color(sprite->a)) { palette = &palette[GBAObjAttributesCGetPalette(sprite->c) << 4];

@@ -273,7 +273,7 @@ } else {

SPRITE_TRANSFORMED_LOOP(256, NORMAL); } } - if (x + totalWidth > VIDEO_HORIZONTAL_PIXELS) { + if (end == VIDEO_HORIZONTAL_PIXELS && x + totalWidth > VIDEO_HORIZONTAL_PIXELS) { renderer->spriteCyclesRemaining -= (x + totalWidth - VIDEO_HORIZONTAL_PIXELS) * 2; } } else {

@@ -333,7 +333,7 @@ } else {

SPRITE_NORMAL_LOOP(256, NORMAL); } } - if (x + width > VIDEO_HORIZONTAL_PIXELS) { + if (end == VIDEO_HORIZONTAL_PIXELS && x + width > VIDEO_HORIZONTAL_PIXELS) { renderer->spriteCyclesRemaining -= x + width - VIDEO_HORIZONTAL_PIXELS; } }