Skip to content

Commit f85eb81

Browse files
author
Niko
committed
Profiler FMV fixes, and Kernel fixes
1 parent dc8227b commit f85eb81

2 files changed

Lines changed: 26 additions & 16 deletions

File tree

  • decompile/General/AltMods/DebugMenu
  • mods/Standalones/Profiler/src

decompile/General/AltMods/DebugMenu/Profiler.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include "DebugStructs.h"
22

33
// June 1999 used 64, reduced for Retail CTR
4-
#define MAX_SECTIONS 32
4+
#define MAX_SECTIONS 16
55

66
// No room, need MEMPACK_AllocMem
7-
// static struct ProfilerSection sections[32];
7+
// static struct ProfilerSection sections[MAX_SECTIONS];
88
static struct ProfilerSection* ptrSectArr=0;
99
static struct ProfilerSection* ptrOpenSect=0;
1010

@@ -40,7 +40,7 @@ struct ProfilerSection* DebugProfiler_GetOpen()
4040

4141
void DebugProfiler_Init()
4242
{
43-
int size = sizeof(struct ProfilerSection) * 32;
43+
int size = sizeof(struct ProfilerSection) * MAX_SECTIONS;
4444
ptrSectArr = DECOMP_MEMPACK_AllocMem(size);
4545
}
4646

@@ -53,7 +53,7 @@ void DebugProfiler_Reset()
5353

5454
void DebugProfiler_SectionStart(char* name, char r, char g, char b)
5555
{
56-
if(numSectionsUsed >= 32)
56+
if(numSectionsUsed >= MAX_SECTIONS)
5757
{
5858
printf("Out of sections\n");
5959
while(1) {}
@@ -89,8 +89,15 @@ void DebugProfiler_Subsection(int flag)
8989

9090
if(ptrOpenSect == 0)
9191
{
92+
// dont force-open for DrawSync
93+
if(flag == 2)
94+
return;
95+
96+
if(sdata->mainGameState != 3)
97+
return;
98+
9299
// dont let fake sections explode on-boot
93-
if(numSectionsUsed > 20)
100+
if(numSectionsUsed > (MAX_SECTIONS-6))
94101
return;
95102

96103
fakeSectionOpen = 1;

mods/Standalones/Profiler/src/main.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
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];
98
static struct ProfilerSection* ptrSectArr=0;
109
static struct ProfilerSection* ptrOpenSect=0;
1110

@@ -41,7 +40,7 @@ struct ProfilerSection* DebugProfiler_GetOpen()
4140

4241
void DebugProfiler_Init()
4342
{
44-
ptrSectArr = 0x8000F000;
43+
ptrSectArr = &sections[0];
4544
}
4645

4746
void DebugProfiler_Reset()
@@ -53,7 +52,7 @@ void DebugProfiler_Reset()
5352

5453
void 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
130137
void DebugProfiler_SectionRestart(int time)
131138
{
132139
if(ptrOpenSect == 0)
133140
return;
134141

135142
ptrOpenSect->timeStart = time;
136143
}
144+
#endif
137145

138146
int 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

Comments
 (0)