22#include "DebugStructs.h"
33
44// June 1999 used 64, reduced for Retail CTR
5- #define MAX_SECTIONS 32
5+ #define MAX_SECTIONS 16
66
7- // No room, need MEMPACK_AllocMem
8- // static struct ProfilerSection sections[32];
7+ static struct ProfilerSection sections [MAX_SECTIONS ];
98static struct ProfilerSection * ptrSectArr = 0 ;
109static struct ProfilerSection * ptrOpenSect = 0 ;
1110
@@ -41,7 +40,7 @@ struct ProfilerSection* DebugProfiler_GetOpen()
4140
4241void DebugProfiler_Init ()
4342{
44- ptrSectArr = 0x8000F000 ;
43+ ptrSectArr = & sections [ 0 ] ;
4544}
4645
4746void DebugProfiler_Reset ()
@@ -53,7 +52,7 @@ void DebugProfiler_Reset()
5352
5453void DebugProfiler_SectionStart (char * name , char r , char g , char b )
5554{
56- if (numSectionsUsed >= 32 )
55+ if (numSectionsUsed >= MAX_SECTIONS )
5756 {
5857 printf ("Out of sections\n" );
5958 while (1 ) {}
@@ -89,8 +88,15 @@ void DebugProfiler_Subsection(int flag)
8988
9089 if (ptrOpenSect == 0 )
9190 {
91+ // dont force-open for DrawSync
92+ if (flag == 2 )
93+ return ;
94+
95+ if (sdata -> mainGameState != 3 )
96+ return ;
97+
9298 // dont let fake sections explode on-boot
93- if (numSectionsUsed > 20 )
99+ if (numSectionsUsed > ( MAX_SECTIONS - 6 ) )
94100 return ;
95101
96102 fakeSectionOpen = 1 ;
@@ -127,13 +133,15 @@ void DebugProfiler_Subsection(int flag)
127133 }
128134}
129135
136+ #if 0
130137void DebugProfiler_SectionRestart (int time )
131138{
132139 if (ptrOpenSect == 0 )
133140 return ;
134141
135142 ptrOpenSect -> timeStart = time ;
136143}
144+ #endif
137145
138146int DebugProfiler_SectionEnd ()
139147{
@@ -301,9 +309,6 @@ void DebugProfiler_ListAllDebugStats()
301309 if (timeFrame == 0 ) return ;
302310 if (timeCpu == 0 ) return ;
303311 if (timeGpu == 0 ) return ;
304- if (timeRed == 0 ) return ;
305- if (timeGreen == 0 ) return ;
306- if (timeBlue == 0 ) return ;
307312
308313 #ifndef REBUILD_PC
309314 char * string = 0x1f800000 ;
@@ -495,10 +500,8 @@ void Hook_ENTER_DrawSync()
495500 {
496501 gGT -> bool_DrawOTag_InProgress = 0 ;
497502
498- #ifdef USE_PROFILER
499503 void DebugProfiler_Subsection (int flag );
500504 DebugProfiler_Subsection (2 );
501- #endif
502505 }
503506
504507 return ;
0 commit comments