GB Video: SGB border drawing improvements
Vicki Pfau vi@endrift.com
Thu, 04 Oct 2018 09:45:38 -0700
2 files changed,
11 insertions(+),
10 deletions(-)
M
CHANGES
→
CHANGES
@@ -117,6 +117,7 @@ - Qt: Fix jumbled background when paused
- Qt: Fix FPS counter on Windows - GB, GBA Savedata: Fix leaks when loading masked save (fixes mgba.io/i/1197) - Qt: Fix focus issues with load/save state overlay + - GB Video: Fix SGB border hole size Misc: - mGUI: Add SGB border configuration option - mGUI: Add support for different settings types
M
src/gb/renderers/software.c
→
src/gb/renderers/software.c
@@ -56,7 +56,7 @@ }
int x, y; for (y = 0; y < 224; ++y) { for (x = 0; x < 256; x += 8) { - if (x >= 48 && x < 208 && y >= 40 && y < 104) { + if (x >= 48 && x < 208 && y >= 40 && y < 184) { continue; } uint16_t mapData;@@ -79,16 +79,13 @@ size_t base = y * renderer->outputBufferStride + x;
int paletteBase = SGBBgAttributesGetPalette(mapData) * 0x10; int colorSelector; + int flip = 0; if (SGBBgAttributesIsXFlip(mapData)) { - for (i = 0; i < 8; ++i) { - colorSelector = (tileData[0] >> i & 0x1) << 0 | (tileData[1] >> i & 0x1) << 1 | (tileData[2] >> i & 0x1) << 2 | (tileData[3] >> i & 0x1) << 3; - renderer->outputBuffer[base + i] = renderer->palette[paletteBase | colorSelector]; - } - } else { - for (i = 7; i >= 0; --i) { - colorSelector = (tileData[0] >> i & 0x1) << 0 | (tileData[1] >> i & 0x1) << 1 | (tileData[2] >> i & 0x1) << 2 | (tileData[3] >> i & 0x1) << 3; - renderer->outputBuffer[base + 7 - i] = renderer->palette[paletteBase | colorSelector]; - } + flip = 7; + } + for (i = 7; i >= 0; --i) { + colorSelector = (tileData[0] >> i & 0x1) << 0 | (tileData[1] >> i & 0x1) << 1 | (tileData[2] >> i & 0x1) << 2 | (tileData[3] >> i & 0x1) << 3; + renderer->outputBuffer[(base + 7 - i) ^ flip] = renderer->palette[paletteBase | colorSelector]; } } }@@ -712,6 +709,9 @@
static void GBVideoSoftwareRendererEnableSGBBorder(struct GBVideoRenderer* renderer, bool enable) { struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer; if (softwareRenderer->model == GB_MODEL_SGB) { + if (enable == softwareRenderer->sgbBorders) { + return; + } softwareRenderer->sgbBorders = enable; if (softwareRenderer->sgbBorders && !renderer->sgbRenderMode) { _regenerateSGBBorder(softwareRenderer);