diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-05-09 22:22:52 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-05-09 22:22:52 +0200 |
commit | 9fe24cb1e7b2cb9b77ff1a6ce4b0ba9bf052f347 (patch) | |
tree | 071bb34db7feda58e187916c6efb06eb9afd2d6f /src/GPU3D.cpp | |
parent | 36fa62143628dbeab410fe1e6f1caf6955d0d7a6 (diff) |
latch 3D registers upon VBlank
(fixes the last bugs in Gericom's train game)
Diffstat (limited to 'src/GPU3D.cpp')
-rw-r--r-- | src/GPU3D.cpp | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp index 0f700d9..4d9eca3 100644 --- a/src/GPU3D.cpp +++ b/src/GPU3D.cpp @@ -60,7 +60,16 @@ // // viewport Y coordinates are upside-down // -// clear color/depth/bitmap/etc registers (04000350/04000354) are double-buffered +// several registers are latched upon VBlank, the renderer uses the latched registers +// latched registers include: +// DISP3DCNT +// alpha test ref value +// fog color, offset, density table +// toon table +// edge table +// clear attributes +// +// TODO: check how DISP_1DOT_DEPTH works and whether it's latched namespace GPU3D @@ -153,16 +162,27 @@ FIFO<CmdFIFOEntry>* CmdPIPE; u32 NumCommands, CurCommand, ParamCount, TotalParams; u32 DispCnt; -u8 AlphaRefVal; -u8 AlphaRef; +u8 AlphaRefVal, AlphaRef; u16 ToonTable[32]; u16 EdgeTable[8]; -u32 FogColor; -u32 FogOffset; +u32 FogColor, FogOffset; u8 FogDensityTable[32]; +u32 ClearAttr1, ClearAttr2; + +u32 RenderDispCnt; +u8 RenderAlphaRef; + +u16 RenderToonTable[32]; +u16 RenderEdgeTable[8]; + +u32 RenderFogColor, RenderFogOffset; +u8 RenderFogDensityTable[32]; + +u32 RenderClearAttr1, RenderClearAttr2; + u32 GXStat; u32 ExecParams[32]; @@ -241,9 +261,6 @@ Vertex* RenderVertexRAM; Polygon* RenderPolygonRAM; u32 RenderNumPolygons; -u32 ClearAttr1, ClearAttr2; -u32 RenderClearAttr1, RenderClearAttr2; - u32 FlushRequest; u32 FlushAttributes; @@ -1790,7 +1807,16 @@ void VBlank() RenderPolygonRAM = CurPolygonRAM; RenderNumPolygons = NumPolygons; - // TODO: find out which other registers are latched for rendering + RenderDispCnt = DispCnt; + RenderAlphaRef = AlphaRef; + + memcpy(RenderEdgeTable, EdgeTable, 8*2); + memcpy(RenderToonTable, ToonTable, 32*2); + + RenderFogColor = FogColor; + RenderFogOffset = FogOffset; + memcpy(RenderFogDensityTable, FogDensityTable, 32); + RenderClearAttr1 = ClearAttr1; RenderClearAttr2 = ClearAttr2; |