all repos — mgba @ 4aed125b3e4de2bd563d497967520c379ab46a40

mGBA Game Boy Advance Emulator

GBA Video: Add window y offsetting
Vicki Pfau vi@endrift.com
Thu, 22 Oct 2020 20:31:58 -0700
commit

4aed125b3e4de2bd563d497967520c379ab46a40

parent

c8e1e14d3f36ad1507f69d990cf94629df9db97d

M include/mgba/internal/gba/renderers/video-software.hinclude/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.csrc/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.csrc/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) {