fix that bug where NSMB's backgrounds lagged one frame behind

This commit is contained in:
StapleButter 2017-03-21 02:11:49 +01:00
parent 08a634371a
commit cc86aa57ae
3 changed files with 13 additions and 2 deletions

View File

@ -692,6 +692,12 @@ void StartScanline(u32 line)
// (TODO, eventually: emulate it properly) // (TODO, eventually: emulate it properly)
NDS::CheckDMAs(0, 0x04); NDS::CheckDMAs(0, 0x04);
if (line == 0)
{
GPU2D_A->VBlankEnd();
GPU2D_B->VBlankEnd();
}
// draw // draw
GPU2D_A->DrawScanline(line); GPU2D_A->DrawScanline(line);
GPU2D_B->DrawScanline(line); GPU2D_B->DrawScanline(line);

View File

@ -426,12 +426,16 @@ void GPU2D::DrawScanline(u32 line)
void GPU2D::VBlank() void GPU2D::VBlank()
{ {
CaptureCnt &= ~(1<<31);
}
void GPU2D::VBlankEnd()
{
// TODO: find out the exact time this happens
BGXRefInternal[0] = BGXRef[0]; BGXRefInternal[0] = BGXRef[0];
BGXRefInternal[1] = BGXRef[1]; BGXRefInternal[1] = BGXRef[1];
BGYRefInternal[0] = BGYRef[0]; BGYRefInternal[0] = BGYRef[0];
BGYRefInternal[1] = BGYRef[1]; BGYRefInternal[1] = BGYRef[1];
CaptureCnt &= ~(1<<31);
} }

View File

@ -38,6 +38,7 @@ public:
void DrawScanline(u32 line); void DrawScanline(u32 line);
void VBlank(); void VBlank();
void VBlankEnd();
void BGExtPalDirty(u32 base); void BGExtPalDirty(u32 base);
void OBJExtPalDirty(); void OBJExtPalDirty();