diff --git a/CHANGES b/CHANGES index bff1820d1..496363924 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ 0.7.3: (Future) +Emulation fixes: + - GBA Video: Fix wrapped sprite mosaic clamping (fixes mgba.io/i/1432) Other fixes: - Switch: Fix threading-related crash on second launch - Qt: Fix FPS target maxing out at 59.727 (fixes mgba.io/i/1421) diff --git a/cinema/gba/obj/sma2-mosaic-clamp/baseline_0000.png b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0000.png new file mode 100644 index 000000000..d05b02e16 Binary files /dev/null and b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0000.png differ diff --git a/cinema/gba/obj/sma2-mosaic-clamp/baseline_0001.png b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0001.png new file mode 100644 index 000000000..bcb7a39ea Binary files /dev/null and b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0001.png differ diff --git a/cinema/gba/obj/sma2-mosaic-clamp/baseline_0002.png b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0002.png new file mode 100644 index 000000000..92763de4a Binary files /dev/null and b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0002.png differ diff --git a/cinema/gba/obj/sma2-mosaic-clamp/baseline_0003.png b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0003.png new file mode 100644 index 000000000..c48410ca5 Binary files /dev/null and b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0003.png differ diff --git a/cinema/gba/obj/sma2-mosaic-clamp/baseline_0004.png b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0004.png new file mode 100644 index 000000000..11cb7a1f4 Binary files /dev/null and b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0004.png differ diff --git a/cinema/gba/obj/sma2-mosaic-clamp/baseline_0005.png b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0005.png new file mode 100644 index 000000000..0796c9e35 Binary files /dev/null and b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0005.png differ diff --git a/cinema/gba/obj/sma2-mosaic-clamp/baseline_0006.png b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0006.png new file mode 100644 index 000000000..8172f4670 Binary files /dev/null and b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0006.png differ diff --git a/cinema/gba/obj/sma2-mosaic-clamp/baseline_0007.png b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0007.png new file mode 100644 index 000000000..3ccd126c3 Binary files /dev/null and b/cinema/gba/obj/sma2-mosaic-clamp/baseline_0007.png differ diff --git a/cinema/gba/obj/sma2-mosaic-clamp/test.mvl b/cinema/gba/obj/sma2-mosaic-clamp/test.mvl new file mode 100644 index 000000000..9fece4fdb Binary files /dev/null and b/cinema/gba/obj/sma2-mosaic-clamp/test.mvl differ diff --git a/src/gba/renderers/video-software.c b/src/gba/renderers/video-software.c index df9437db6..5c29dd973 100644 --- a/src/gba/renderers/video-software.c +++ b/src/gba/renderers/video-software.c @@ -834,12 +834,12 @@ static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) { if ((y < sprite->y && (sprite->endY - 256 < 0 || y >= sprite->endY - 256)) || y >= sprite->endY) { continue; } - if (GBAObjAttributesAIsMosaic(sprite->obj.a)) { + if (GBAObjAttributesAIsMosaic(sprite->obj.a) && mosaicV > 1) { localY = mosaicY; - if (localY < sprite->y) { + if (localY < sprite->y && sprite->y < GBA_VIDEO_VERTICAL_PIXELS) { localY = sprite->y; } - if (localY >= sprite->endY) { + if (localY >= (sprite->endY & 0xFF)) { localY = sprite->endY - 1; } }