fix bug that occured when a flush command was sent between lines 192 and 215

This commit is contained in:
StapleButter 2017-03-21 18:08:11 +01:00
parent 3590d210f3
commit 91f46b00fb
1 changed files with 8 additions and 5 deletions

View File

@ -1570,7 +1570,7 @@ void ExecuteCommand()
break; break;
case 0x50: // flush case 0x50: // flush
FlushRequest = 1; FlushRequest |= 0x1;
FlushAttributes = ExecParams[0] & 0x3; FlushAttributes = ExecParams[0] & 0x3;
CycleCount = 392; CycleCount = 392;
break; break;
@ -1592,7 +1592,7 @@ void ExecuteCommand()
void Run(s32 cycles) void Run(s32 cycles)
{ {
if (FlushRequest) if (FlushRequest & 0x1)
return; return;
if (CycleCount <= 0 && CmdPIPE->IsEmpty()) if (CycleCount <= 0 && CmdPIPE->IsEmpty())
return; return;
@ -1635,7 +1635,7 @@ void CheckFIFODMA()
void VBlank() void VBlank()
{ {
if (FlushRequest) if (FlushRequest & 0x1)
{ {
RenderVertexRAM = CurVertexRAM; RenderVertexRAM = CurVertexRAM;
RenderPolygonRAM = CurPolygonRAM; RenderPolygonRAM = CurPolygonRAM;
@ -1647,6 +1647,9 @@ void VBlank()
NumVertices = 0; NumVertices = 0;
NumPolygons = 0; NumPolygons = 0;
FlushRequest &= ~0x1;
FlushRequest |= 0x2;
} }
} }
@ -1655,11 +1658,11 @@ void VCount215()
// TODO: detect other conditions that could require rerendering // TODO: detect other conditions that could require rerendering
// the DS is said to present new 3D frames all the time, even if no commands are sent // the DS is said to present new 3D frames all the time, even if no commands are sent
if (FlushRequest) if (FlushRequest & 0x2)
{ {
SoftRenderer::RenderFrame(RenderVertexRAM, RenderPolygonRAM, RenderNumPolygons); SoftRenderer::RenderFrame(RenderVertexRAM, RenderPolygonRAM, RenderNumPolygons);
FlushRequest = 0; FlushRequest &= ~0x2;
} }
} }