all repos — mgba @ ced522097553234a43e5ee923f1cafce73c2d15c

mGBA Game Boy Advance Emulator

Out of bounds start coordinates are treated as 0 for windows (fixes #82)
Jeffrey Pfau jeffrey@endrift.com
Sat, 05 Jul 2014 14:40:15 -0700
commit

ced522097553234a43e5ee923f1cafce73c2d15c

parent

7142a0f820eff4f4d1aae1a45e9d6c74f8b5219b

1 files changed, 12 insertions(+), 0 deletions(-)

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

@@ -259,24 +259,36 @@ _updatePalettes(softwareRenderer);

break; case REG_WIN0H: softwareRenderer->winN[0].h.packed = value; + if (softwareRenderer->winN[0].h.start > VIDEO_HORIZONTAL_PIXELS) { + softwareRenderer->winN[0].h.start = 0; + } if (softwareRenderer->winN[0].h.start > softwareRenderer->winN[0].h.end || softwareRenderer->winN[0].h.end > VIDEO_HORIZONTAL_PIXELS) { softwareRenderer->winN[0].h.end = VIDEO_HORIZONTAL_PIXELS; } break; case REG_WIN1H: softwareRenderer->winN[1].h.packed = value; + if (softwareRenderer->winN[1].h.start > VIDEO_HORIZONTAL_PIXELS) { + softwareRenderer->winN[1].h.start = 0; + } if (softwareRenderer->winN[1].h.start > softwareRenderer->winN[1].h.end || softwareRenderer->winN[1].h.end > VIDEO_HORIZONTAL_PIXELS) { softwareRenderer->winN[1].h.end = VIDEO_HORIZONTAL_PIXELS; } break; case REG_WIN0V: softwareRenderer->winN[0].v.packed = value; + if (softwareRenderer->winN[0].v.start > VIDEO_VERTICAL_PIXELS) { + softwareRenderer->winN[0].v.start = 0; + } if (softwareRenderer->winN[0].v.start > softwareRenderer->winN[0].v.end || softwareRenderer->winN[0].v.end > VIDEO_HORIZONTAL_PIXELS) { softwareRenderer->winN[0].v.end = VIDEO_VERTICAL_PIXELS; } break; case REG_WIN1V: softwareRenderer->winN[1].v.packed = value; + if (softwareRenderer->winN[1].v.start > VIDEO_VERTICAL_PIXELS) { + softwareRenderer->winN[1].v.start = 0; + } if (softwareRenderer->winN[1].v.start > softwareRenderer->winN[1].v.end || softwareRenderer->winN[1].v.end > VIDEO_HORIZONTAL_PIXELS) { softwareRenderer->winN[1].v.end = VIDEO_VERTICAL_PIXELS; }