Support narrow windows

This commit is contained in:
Jeffrey Pfau 2013-11-10 22:43:57 -08:00
parent 53dd260b3e
commit 7d526e97f4
1 changed files with 7 additions and 3 deletions

View File

@ -763,6 +763,10 @@ static void _drawBackgroundMode0(struct GBAVideoSoftwareRenderer* renderer, stru
BACKGROUND_TEXT_SELECT_CHARACTER; BACKGROUND_TEXT_SELECT_CHARACTER;
int end = outX + 0x8 - mod8; int end = outX + 0x8 - mod8;
if (end > renderer->end) {
// TODO: ensure tiles are properly aligned from this
end = renderer->end;
}
if (!background->multipalette) { if (!background->multipalette) {
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4; paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4;
palette = &mainPalette[paletteData]; palette = &mainPalette[paletteData];
@ -817,9 +821,9 @@ static void _drawBackgroundMode0(struct GBAVideoSoftwareRenderer* renderer, stru
palette = &mainPalette[paletteData]; palette = &mainPalette[paletteData];
if (!GBA_TEXT_MAP_HFLIP(mapData)) { if (!GBA_TEXT_MAP_HFLIP(mapData)) {
outX = renderer->end - mod8; outX = renderer->end - mod8;
if (outX < 0) { if (outX < renderer->start) {
tileData >>= 4 * -outX; tileData >>= 4 * (renderer->start - outX);
outX = 0; outX = renderer->start;
} }
for (; outX < renderer->end; ++outX) { for (; outX < renderer->end; ++outX) {
uint32_t* pixel = &renderer->row[outX]; uint32_t* pixel = &renderer->row[outX];