GBA Video: Add window y offsetting
Vicki Pfau vi@endrift.com
Thu, 22 Oct 2020 20:31:58 -0700
3 files changed,
9 insertions(+),
3 deletions(-)
M
include/mgba/internal/gba/renderers/video-software.h
→
include/mgba/internal/gba/renderers/video-software.h
@@ -120,6 +120,8 @@ struct WindowN {
struct GBAVideoWindowRegion h; struct GBAVideoWindowRegion v; struct WindowControl control; + int16_t offsetX; + int16_t offsetY; } winN[2]; struct WindowControl winout;
M
src/gba/core.c
→
src/gba/core.c
@@ -1099,6 +1099,10 @@ gbacore->renderer.objOffsetX = x;
gbacore->renderer.objOffsetY = y; gbacore->renderer.oamDirty = 1; break; + case GBA_LAYER_WIN0: + gbacore->renderer.winN[id - GBA_LAYER_WIN0].offsetX = x; + gbacore->renderer.winN[id - GBA_LAYER_WIN0].offsetY = y; + break; default: return; }
M
src/gba/renderers/video-software.c
→
src/gba/renderers/video-software.c
@@ -443,13 +443,13 @@ }
static void _breakWindow(struct GBAVideoSoftwareRenderer* softwareRenderer, struct WindowN* win, int y) { if (win->v.end >= win->v.start) { - if (y >= win->v.end) { + if (y >= win->v.end + win->offsetY) { return; } - if (y < win->v.start) { + if (y < win->v.start + win->offsetY) { return; } - } else if (y >= win->v.end && y < win->v.start) { + } else if (y >= win->v.end + win->offsetY && y < win->v.start + win->offsetY) { return; } if (win->h.end > GBA_VIDEO_HORIZONTAL_PIXELS || win->h.end < win->h.start) {