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.
This commit is contained in:
Arisotura 2019-07-24 02:46:30 +02:00
parent c1fa5d8283
commit 3c006fd361
2 changed files with 31 additions and 8 deletions

View File

@ -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,7 +1329,7 @@ void GPU2D::DrawScanlineBGMode6(u32 line)
{
if (DispCnt & 0x0100)
{
if (DispCnt & 0x8)
if ((!Num) && (DispCnt & 0x8))
DrawBG_3D();
}
}
@ -1344,6 +1338,34 @@ void GPU2D::DrawScanlineBGMode6(u32 line)
}
}
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)
InterleaveSprites(0x8000 | (i<<16));
}
}
void GPU2D::DrawScanline_BGOBJ(u32 line)
{
// forced blank disables BG/OBJ compositing
@ -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

View File

@ -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);