all repos — mgba @ 7d526e97f40b34f328e8b5b20314e0c6b3e7b740

mGBA Game Boy Advance Emulator

Support narrow windows
Jeffrey Pfau jeffrey@endrift.com
Sun, 10 Nov 2013 22:43:57 -0800
commit

7d526e97f40b34f328e8b5b20314e0c6b3e7b740

parent

53dd260b3efca894447efefa8734448feac0c54a

1 files changed, 7 insertions(+), 3 deletions(-)

jump to
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -763,6 +763,10 @@ int mod8 = inX & 0x7;

BACKGROUND_TEXT_SELECT_CHARACTER; int end = outX + 0x8 - mod8; + if (end > renderer->end) { + // TODO: ensure tiles are properly aligned from this + end = renderer->end; + } if (!background->multipalette) { paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4; palette = &mainPalette[paletteData];

@@ -817,9 +821,9 @@ paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4;

palette = &mainPalette[paletteData]; if (!GBA_TEXT_MAP_HFLIP(mapData)) { outX = renderer->end - mod8; - if (outX < 0) { - tileData >>= 4 * -outX; - outX = 0; + if (outX < renderer->start) { + tileData >>= 4 * (renderer->start - outX); + outX = renderer->start; } for (; outX < renderer->end; ++outX) { uint32_t* pixel = &renderer->row[outX];