@@ -136,4 +136,102 @@ void DebugFont_DrawLine(char* text, int posX, int posY, int color)
136136
137137 i ++ ;
138138 }
139+ }
140+
141+ // Jam this here, cause byte budget
142+ static int timeFrame ;
143+ static int timeCpu ;
144+ static int timeGpu ;
145+ static int timeRed ;
146+ static int timeGreen ;
147+ static int timeBlue ;
148+
149+ void DebugProfiler_ListAllDebugStats ()
150+ {
151+ if ((sdata -> gGT -> gameMode1 & DEBUG_MENU ) != 0 )
152+ return ;
153+
154+ int Debug_GetNumSections ();
155+ int numSectionsUsed = Debug_GetNumSections ();
156+
157+ int Debug_GetFirstSect ();
158+ struct ProfilerSection * ptrSectArr = Debug_GetFirstSect ();
159+
160+ if ((sdata -> gGT -> timer & FPS_DOUBLE (16 )) != 0 )
161+ {
162+ timeFrame =
163+ ptrSectArr [numSectionsUsed - 1 ].timeEnd -
164+ ptrSectArr [0 ].timeStart ;
165+
166+ timeCpu =
167+ ptrSectArr [numSectionsUsed - 2 ].timeEnd -
168+ ptrSectArr [0 ].timeStart ;
169+
170+ for (int i = 0 ; i < numSectionsUsed ; i ++ )
171+ {
172+ if ((ptrSectArr [i ].flagsVDT & 2 ) != 0 )
173+ {
174+ timeGpu =
175+ ptrSectArr [i ].posD -
176+ ptrSectArr [0 ].timeStart ;
177+ }
178+
179+ if (* (int * )& ptrSectArr [i ].a == 0xff00 )
180+ {
181+ timeRed =
182+ ptrSectArr [i ].timeEnd -
183+ ptrSectArr [i ].timeStart ;
184+ }
185+
186+ if (* (int * )& ptrSectArr [i ].a == 0xff0000 )
187+ {
188+ timeGreen =
189+ ptrSectArr [i ].timeEnd -
190+ ptrSectArr [i ].timeStart ;
191+ }
192+
193+ if (* (int * )& ptrSectArr [i ].a == 0xff000000 )
194+ {
195+ timeBlue =
196+ ptrSectArr [i ].timeEnd -
197+ ptrSectArr [i ].timeStart ;
198+ }
199+ }
200+ }
201+
202+ if (timeFrame == 0 ) return ;
203+ if (timeCpu == 0 ) return ;
204+ if (timeGpu == 0 ) return ;
205+ if (timeRed == 0 ) return ;
206+ if (timeGreen == 0 ) return ;
207+ if (timeBlue == 0 ) return ;
208+
209+ #ifndef REBUILD_PC
210+ char * string = 0x1f800000 ;
211+ #else
212+ char string [128 ];
213+ #endif
214+
215+ // Time units:
216+ // 262 -> 1 vsync (60fps)
217+ // 524 -> 2 vsync (30fps)
218+ // 15720 -> 1 full second
219+
220+ sprintf (string , "FULL %d %dFPS" , timeFrame , 15720 /timeFrame );
221+ DECOMP_DecalFont_DrawLine (string , 0x14 , 0x44 , FONT_SMALL , 0 );
222+
223+ sprintf (string , "CPU %d %dFPS" , timeCpu , 15720 /timeCpu );
224+ DECOMP_DecalFont_DrawLine (string , 0x14 , 0x4C , FONT_SMALL , 0 );
225+
226+ sprintf (string , "GPU %d %dFPS" , timeGpu , 15720 /timeGpu );
227+ DECOMP_DecalFont_DrawLine (string , 0x14 , 0x54 , FONT_SMALL , 0 );
228+
229+ sprintf (string , "RED %d" , timeRed );
230+ DECOMP_DecalFont_DrawLine (string , 0x14 , 0x5C , FONT_SMALL , 0 );
231+
232+ sprintf (string , "GREN %d" , timeGreen );
233+ DECOMP_DecalFont_DrawLine (string , 0x14 , 0x64 , FONT_SMALL , 0 );
234+
235+ sprintf (string , "BLUE %d" , timeBlue );
236+ DECOMP_DecalFont_DrawLine (string , 0x14 , 0x6C , FONT_SMALL , 0 );
139237}
0 commit comments