Skip to content

Commit

Permalink
Correct geometry mode update for Turbo3D.
Browse files Browse the repository at this point in the history
Fixed glitches in Dark Rift, #2033
  • Loading branch information
gonetz committed Apr 3, 2019
1 parent 1eea6d4 commit 3d74542
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/RSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ void RSP_ProcessDList()
gSP.matrix.stackSize = 32;
gSP.matrix.modelViewi = 0;
gSP.status[0] = gSP.status[1] = gSP.status[2] = gSP.status[3] = 0;
gSP.changed |= CHANGED_MATRIX | CHANGED_LIGHT | CHANGED_LOOKAT;
gSP.geometryMode = 0U;
gSP.changed |= CHANGED_MATRIX | CHANGED_LIGHT | CHANGED_LOOKAT | CHANGED_GEOMETRYMODE;
gSP.tri_num = 0;
gSP.cbfd.advancedLighting = false;
gDP.changed &= ~CHANGED_CPU_FB_WRITE;
Expand Down Expand Up @@ -180,7 +181,7 @@ void RSP_ProcessDList()
break;
}

if(RSP.infloop && REG.SP_STATUS) {
if (RSP.infloop && REG.SP_STATUS) {
*REG.SP_STATUS &= ~(SP_STATUS_TASKDONE | SP_STATUS_HALT | SP_STATUS_BROKE);
return;
}
Expand Down
3 changes: 0 additions & 3 deletions src/gDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,6 @@ void gDPFullSync()
FrameBuffer_CopyDepthBuffer(gDP.colorImage.address);
}

gSP.geometryMode = 0U;
gSP.changed |= CHANGED_GEOMETRYMODE;

*REG.MI_INTR |= MI_INTR_DP;

CheckInterrupts();
Expand Down
7 changes: 2 additions & 5 deletions src/uCodes/Turbo3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,11 @@ void Turbo3D_LoadObject(u32 pstate, u32 pvtx, u32 ptri)
gDPSetOtherMode( _SHIFTR( w0, 0, 24 ), // mode0
w1 ); // mode1

gSPSetGeometryMode(ostate->renderState);

if (ostate->flag != GT_FLAG_NOMTX)
gSPForceMatrix(pstate + sizeof(T3DState));

gSPClearGeometryMode(G_LIGHTING);
gSPClearGeometryMode(G_FOG);
gSPSetGeometryMode(G_SHADING_SMOOTH);
gSPClearGeometryMode(G_LIGHTING | G_FOG);
gSPSetGeometryMode(ostate->renderState | G_SHADING_SMOOTH | G_SHADE | G_ZBUFFER | G_CULL_BACK);

if (pvtx != 0)
gSPVertex(pvtx, ostate->vtxCount, ostate->vtxV0);
Expand Down

0 comments on commit 3d74542

Please sign in to comment.