GBA Video: Fix sprite mosaic clamping (fixes #1008)
1
CHANGES
|
@ -25,6 +25,7 @@ Emulation fixes:
|
||||||
- GBA Memory: Fix writing to OBJ memory in modes 3 and 5
|
- GBA Memory: Fix writing to OBJ memory in modes 3 and 5
|
||||||
- GBA: Fix RTC on non-standard sized ROMs (fixes mgba.io/i/1400)
|
- GBA: Fix RTC on non-standard sized ROMs (fixes mgba.io/i/1400)
|
||||||
- GBA Memory: Prevent writing to mirrored BG VRAM (fixes mgba.io/i/743)
|
- GBA Memory: Prevent writing to mirrored BG VRAM (fixes mgba.io/i/743)
|
||||||
|
- GBA Video: Fix sprite mosaic clamping (fixes mgba.io/i/1008)
|
||||||
Other fixes:
|
Other fixes:
|
||||||
- Qt: More app metadata fixes
|
- Qt: More app metadata fixes
|
||||||
- Qt: Fix load recent from archive (fixes mgba.io/i/1325)
|
- Qt: Fix load recent from archive (fixes mgba.io/i/1325)
|
||||||
|
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.3 KiB |
|
@ -17,19 +17,12 @@
|
||||||
#define SPRITE_MOSAIC_LOOP(DEPTH, TYPE) \
|
#define SPRITE_MOSAIC_LOOP(DEPTH, TYPE) \
|
||||||
SPRITE_YBASE_ ## DEPTH(inY); \
|
SPRITE_YBASE_ ## DEPTH(inY); \
|
||||||
unsigned tileData; \
|
unsigned tileData; \
|
||||||
if (outX % mosaicH) { \
|
|
||||||
if (!inX && xOffset > 0) { \
|
|
||||||
inX = mosaicH - (outX % mosaicH); \
|
|
||||||
outX += mosaicH - (outX % mosaicH); \
|
|
||||||
} else if (inX == width - xOffset) { \
|
|
||||||
inX = mosaicH + (outX % mosaicH); \
|
|
||||||
outX += mosaicH - (outX % mosaicH); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
for (; outX < condition; ++outX, inX += xOffset) { \
|
for (; outX < condition; ++outX, inX += xOffset) { \
|
||||||
int localX = inX - xOffset * (outX % mosaicH); \
|
int localX = inX - xOffset * (outX % mosaicH); \
|
||||||
if (localX < 0 || localX > width - 1) { \
|
if (localX < 0) { \
|
||||||
continue; \
|
localX = 0; \
|
||||||
|
} else if (localX > width - 1) {\
|
||||||
|
localX = width - 1; \
|
||||||
} \
|
} \
|
||||||
SPRITE_XBASE_ ## DEPTH(localX); \
|
SPRITE_XBASE_ ## DEPTH(localX); \
|
||||||
SPRITE_DRAW_PIXEL_ ## DEPTH ## _ ## TYPE(localX); \
|
SPRITE_DRAW_PIXEL_ ## DEPTH ## _ ## TYPE(localX); \
|
||||||
|
|
|
@ -805,11 +805,17 @@ static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) {
|
||||||
struct GBAVideoRendererSprite* sprite = &renderer->sprites[i];
|
struct GBAVideoRendererSprite* sprite = &renderer->sprites[i];
|
||||||
int localY = y;
|
int localY = y;
|
||||||
renderer->end = 0;
|
renderer->end = 0;
|
||||||
|
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)) {
|
||||||
localY = mosaicY;
|
localY = mosaicY;
|
||||||
}
|
if (localY < sprite->y) {
|
||||||
if ((localY < sprite->y && (sprite->endY - 256 < 0 || localY >= sprite->endY - 256)) || localY >= sprite->endY) {
|
localY = sprite->y;
|
||||||
continue;
|
}
|
||||||
|
if (localY >= sprite->endY) {
|
||||||
|
localY = sprite->endY - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (w = 0; w < renderer->nWindows; ++w) {
|
for (w = 0; w < renderer->nWindows; ++w) {
|
||||||
if (renderer->spriteCyclesRemaining <= 0) {
|
if (renderer->spriteCyclesRemaining <= 0) {
|
||||||
|
|