aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2018-11-25 18:36:47 +0100
committerStapleButter <thetotalworm@gmail.com>2018-11-25 18:36:47 +0100
commit2035784f9f9e226f5dc2b7d58f8a18346211d380 (patch)
treec6b3332bc4b2da48f5f26386a202294e97383aa5
parent5f1f2a7b4a7e0fb7323fb9190ab9d8f99d60d424 (diff)
on the DS, windows with backward coordinates end up inside-out. revise window code accordingly. fixes #287.
-rw-r--r--src/GPU2D.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp
index 8a2eb19..0fc7987 100644
--- a/src/GPU2D.cpp
+++ b/src/GPU2D.cpp
@@ -988,25 +988,19 @@ void GPU2D::CalculateWindowMask(u32 line, u8* mask)
if ((DispCnt & (1<<14)) && Win1Active)
{
// window 1
- u32 x1 = Win1Coords[0];
- u32 x2 = Win1Coords[1];
- if (x2 == 0 && x1 > 0) x2 = 256;
- if (x1 > x2) x2 = 255; // checkme
+ u8 x1 = Win1Coords[0];
+ u8 x2 = Win1Coords[1];
- for (u32 i = x1; i < x2; i++)
- mask[i] = WinCnt[1];
+ while (x1 != x2) mask[x1++] = WinCnt[1];
}
if ((DispCnt & (1<<13)) && Win0Active)
{
// window 0
- u32 x1 = Win0Coords[0];
- u32 x2 = Win0Coords[1];
- if (x2 == 0 && x1 > 0) x2 = 256;
- if (x1 > x2) x2 = 255; // checkme
+ u8 x1 = Win0Coords[0];
+ u8 x2 = Win0Coords[1];
- for (u32 i = x1; i < x2; i++)
- mask[i] = WinCnt[0];
+ while (x1 != x2) mask[x1++] = WinCnt[0];
}
}