diff options
author | Arisotura <thetotalworm@gmail.com> | 2019-07-24 02:46:30 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2019-07-24 02:46:30 +0200 |
commit | 3c006fd36154e48325c3cf862ed3287b265924c1 (patch) | |
tree | 03c8ed5eb52b43c85707429bcf0c8560ab442fa7 /src | |
parent | c1fa5d8283cde76110690d15b2d127ead65d2265 (diff) |
GPU2D: fill gaps in BG modes
* mode6 actually works on the sub GPU, albeit limited to 1/4 the full bitmap size due to having only 128K of VRAM
* mode7 draws BG0, BG1 and sprites. no BG2/BG3.
Diffstat (limited to 'src')
-rw-r--r-- | src/GPU2D.cpp | 38 | ||||
-rw-r--r-- | src/GPU2D.h | 1 |
2 files changed, 31 insertions, 8 deletions
diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp index 9d7ab8f..4bba235 100644 --- a/src/GPU2D.cpp +++ b/src/GPU2D.cpp @@ -1316,12 +1316,6 @@ void GPU2D::DrawScanlineBGMode(u32 line) void GPU2D::DrawScanlineBGMode6(u32 line) { - if (Num) - { - printf("GPU2D: MODE6 ON SUB GPU???\n"); - return; - } - for (int i = 3; i >= 0; i--) { if ((BGCnt[2] & 0x3) == i) @@ -1335,8 +1329,36 @@ void GPU2D::DrawScanlineBGMode6(u32 line) { if (DispCnt & 0x0100) { - if (DispCnt & 0x8) + if ((!Num) && (DispCnt & 0x8)) + DrawBG_3D(); + } + } + if ((DispCnt & 0x1000) && NumSprites) + InterleaveSprites(0x8000 | (i<<16)); + } +} + +void GPU2D::DrawScanlineBGMode7(u32 line) +{ + // mode 7 only has text-mode BG0 and BG1 + + for (int i = 3; i >= 0; i--) + { + if ((BGCnt[1] & 0x3) == i) + { + if (DispCnt & 0x0200) + { + DrawBG_Text(line, 1); + } + } + if ((BGCnt[0] & 0x3) == i) + { + if (DispCnt & 0x0100) + { + if ((!Num) && (DispCnt & 0x8)) DrawBG_3D(); + else + DrawBG_Text(line, 0); } } if ((DispCnt & 0x1000) && NumSprites) @@ -1376,7 +1398,6 @@ void GPU2D::DrawScanline_BGOBJ(u32 line) else memset(WindowMask, 0xFF, 256); - // TODO: what happens in mode 7? mode 6 on the sub engine? switch (DispCnt & 0x7) { case 0: DrawScanlineBGMode<0>(line); break; @@ -1386,6 +1407,7 @@ void GPU2D::DrawScanline_BGOBJ(u32 line) case 4: DrawScanlineBGMode<4>(line); break; case 5: DrawScanlineBGMode<5>(line); break; case 6: DrawScanlineBGMode6(line); break; + case 7: DrawScanlineBGMode7(line); break; } // color special effects diff --git a/src/GPU2D.h b/src/GPU2D.h index b9a2422..6ad9783 100644 --- a/src/GPU2D.h +++ b/src/GPU2D.h @@ -135,6 +135,7 @@ private: template<u32 bgmode> void DrawScanlineBGMode(u32 line); void DrawScanlineBGMode6(u32 line); + void DrawScanlineBGMode7(u32 line); void DrawScanline_BGOBJ(u32 line); static void DrawPixel_Normal(u32* dst, u16 color, u32 flag); |