aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GPU.cpp4
-rw-r--r--src/GPU3D.cpp30
-rw-r--r--src/GPU3D.h1
3 files changed, 34 insertions, 1 deletions
diff --git a/src/GPU.cpp b/src/GPU.cpp
index 0e11af8..c9ab6a0 100644
--- a/src/GPU.cpp
+++ b/src/GPU.cpp
@@ -729,6 +729,10 @@ void StartScanline(u32 line)
GPU2D_B->VBlank();
GPU3D::VBlank();
}
+ else if (line == 215)
+ {
+ GPU3D::VCount215();
+ }
}
NDS::ScheduleEvent(NDS::Event_LCD, true, HBLANK_CYCLES, StartHBlank, line);
diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp
index 8758ce8..bbf9a16 100644
--- a/src/GPU3D.cpp
+++ b/src/GPU3D.cpp
@@ -221,6 +221,10 @@ Polygon* CurPolygonRAM;
u32 NumVertices, NumPolygons;
u32 CurRAMBank;
+Vertex* RenderVertexRAM;
+Polygon* RenderPolygonRAM;
+u32 RenderNumPolygons;
+
u32 ClearAttr1, ClearAttr2;
u32 FlushRequest;
@@ -1637,7 +1641,9 @@ void VBlank()
{
if (FlushRequest)
{
- SoftRenderer::RenderFrame(CurVertexRAM, CurPolygonRAM, NumPolygons);
+ RenderVertexRAM = CurVertexRAM;
+ RenderPolygonRAM = CurPolygonRAM;
+ RenderNumPolygons = NumPolygons;
CurRAMBank = CurRAMBank?0:1;
CurVertexRAM = &VertexRAM[CurRAMBank ? 6144 : 0];
@@ -1645,6 +1651,17 @@ void VBlank()
NumVertices = 0;
NumPolygons = 0;
+ }
+}
+
+void VCount215()
+{
+ // 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
+
+ if (FlushRequest)
+ {
+ SoftRenderer::RenderFrame(RenderVertexRAM, RenderPolygonRAM, RenderNumPolygons);
FlushRequest = 0;
}
@@ -1668,6 +1685,14 @@ u16 Read16(u32 addr)
{
case 0x04000060:
return DispCnt;
+
+ case 0x04000320:
+ return 46; // TODO, eventually
+
+ case 0x04000604:
+ return NumPolygons;
+ case 0x04000606:
+ return NumVertices;
}
printf("unknown GPU3D read16 %08X\n", addr);
@@ -1696,6 +1721,9 @@ u32 Read32(u32 addr)
(fifolevel == 0 ? (1<<26) : 0);
}
+ case 0x04000604:
+ return NumPolygons | (NumVertices << 16);
+
case 0x04000680: return VecMatrix[0];
case 0x04000684: return VecMatrix[1];
case 0x04000688: return VecMatrix[2];
diff --git a/src/GPU3D.h b/src/GPU3D.h
index c1adc2f..be121bf 100644
--- a/src/GPU3D.h
+++ b/src/GPU3D.h
@@ -72,6 +72,7 @@ void CheckFIFOIRQ();
void CheckFIFODMA();
void VBlank();
+void VCount215();
u32* GetLine(int line);
u8 Read8(u32 addr);