From 62b5ca0aa8384e278100139b56a991dc5212ff12 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 13 Mar 2017 12:07:40 -0700 Subject: [PATCH] GBA Video: Fix Window on tall displays --- .../internal/gba/renderers/video-software.h | 2 +- src/gba/renderers/video-software.c | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/mgba/internal/gba/renderers/video-software.h b/include/mgba/internal/gba/renderers/video-software.h index 48a9ac210..d52af88e2 100644 --- a/include/mgba/internal/gba/renderers/video-software.h +++ b/include/mgba/internal/gba/renderers/video-software.h @@ -168,7 +168,7 @@ struct GBAVideoSoftwareRenderer { int start; int end; int masterEnd; - int masterHeight; + unsigned masterHeight; int masterScanlines; int masterBright; diff --git a/src/gba/renderers/video-software.c b/src/gba/renderers/video-software.c index 240a6d53a..b93848b7e 100644 --- a/src/gba/renderers/video-software.c +++ b/src/gba/renderers/video-software.c @@ -310,26 +310,26 @@ static uint16_t GBAVideoSoftwareRendererWriteVideoRegister(struct GBAVideoRender case REG_WIN0V: softwareRenderer->winN[0].v.end = value; softwareRenderer->winN[0].v.start = value >> 8; - if (softwareRenderer->winN[0].v.start > VIDEO_VERTICAL_PIXELS && softwareRenderer->winN[0].v.start > softwareRenderer->winN[0].v.end) { + if (softwareRenderer->winN[0].v.start > softwareRenderer->masterHeight && softwareRenderer->winN[0].v.start > softwareRenderer->winN[0].v.end) { softwareRenderer->winN[0].v.start = 0; } - if (softwareRenderer->winN[0].v.end > VIDEO_VERTICAL_PIXELS) { - softwareRenderer->winN[0].v.end = VIDEO_VERTICAL_PIXELS; - if (softwareRenderer->winN[0].v.start > VIDEO_VERTICAL_PIXELS) { - softwareRenderer->winN[0].v.start = VIDEO_VERTICAL_PIXELS; + if (softwareRenderer->winN[0].v.end > softwareRenderer->masterHeight) { + softwareRenderer->winN[0].v.end = softwareRenderer->masterHeight; + if (softwareRenderer->winN[0].v.start > softwareRenderer->masterHeight) { + softwareRenderer->winN[0].v.start = softwareRenderer->masterHeight; } } break; case REG_WIN1V: softwareRenderer->winN[1].v.end = value; softwareRenderer->winN[1].v.start = value >> 8; - if (softwareRenderer->winN[1].v.start > VIDEO_VERTICAL_PIXELS && softwareRenderer->winN[1].v.start > softwareRenderer->winN[1].v.end) { + if (softwareRenderer->winN[1].v.start > softwareRenderer->masterHeight && softwareRenderer->winN[1].v.start > softwareRenderer->winN[1].v.end) { softwareRenderer->winN[1].v.start = 0; } - if (softwareRenderer->winN[1].v.end > VIDEO_VERTICAL_PIXELS) { - softwareRenderer->winN[1].v.end = VIDEO_VERTICAL_PIXELS; - if (softwareRenderer->winN[1].v.start > VIDEO_VERTICAL_PIXELS) { - softwareRenderer->winN[1].v.start = VIDEO_VERTICAL_PIXELS; + if (softwareRenderer->winN[1].v.end > softwareRenderer->masterHeight) { + softwareRenderer->winN[1].v.end = softwareRenderer->masterHeight; + if (softwareRenderer->winN[1].v.start > softwareRenderer->masterHeight) { + softwareRenderer->winN[1].v.start = softwareRenderer->masterHeight; } } break;