Skip to content

Commit 5d676a3

Browse files
author
Niko
committed
profiler progress
1 parent ac72338 commit 5d676a3

2 files changed

Lines changed: 85 additions & 2 deletions

File tree

decompile/General/GAMEPAD/GAMEPAD_03_PollVsync.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ void DECOMP_GAMEPAD_PollVsync(struct GamepadSystem *gGamepads)
9999
pad++;
100100
}
101101

102+
// NEED TO MOVE
103+
// Should be in MainDrawCb_01_Vsync
104+
// Check defrag to make sure bytes allow
105+
#if 1
106+
102107
#ifdef USE_PROFILER
103108
void DebugProfiler_Subsection(int flag);
104109
DebugProfiler_Subsection(1);
@@ -114,4 +119,7 @@ void DECOMP_GAMEPAD_PollVsync(struct GamepadSystem *gGamepads)
114119
sdata->queueReady = 1;
115120
}
116121
}
122+
123+
#endif
124+
117125
}

mods/Standalones/Profiler/src/main.c

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,70 @@ void Hook_RenderBucket_Execute(int a, int b)
398398
//printf("Retail Instance: %d\n", x);
399399
}
400400

401-
// ...
401+
void Hook_StartLev1P2P(int a, int b)
402+
{
403+
void DebugProfiler_SectionStart(char* name, char r, char g, char b);
404+
DebugProfiler_SectionStart(0, 0, 0, 0xFF);
405+
406+
CTR_ClearRenderLists_1P2P(a, b);
407+
}
408+
409+
void Hook_StartLev3P4P(int a, int b)
410+
{
411+
void DebugProfiler_SectionStart(char* name, char r, char g, char b);
412+
DebugProfiler_SectionStart(0, 0, 0, 0xFF);
413+
414+
CTR_ClearRenderLists_3P4P(a, b);
415+
}
416+
417+
void Hook_EndLev1P(int a, int b, int c)
418+
{
419+
DrawSky_Full(a, b, c);
420+
421+
int DebugProfiler_SectionEnd();
422+
DebugProfiler_SectionEnd();
423+
}
424+
425+
void Hook_EndLev2P(
426+
int a, int b, int c, int d,
427+
int e, int f, int g)
428+
{
429+
DrawLevelOvr2P(a,b,c,d,e,f,g);
430+
431+
int DebugProfiler_SectionEnd();
432+
DebugProfiler_SectionEnd();
433+
}
434+
435+
void Hook_EndLev3P(
436+
int a, int b, int c, int d,
437+
int e, int f, int g, int h)
438+
{
439+
DrawLevelOvr3P(a,b,c,d,e,f,g,h);
440+
441+
int DebugProfiler_SectionEnd();
442+
DebugProfiler_SectionEnd();
443+
}
444+
445+
void Hook_EndLev4P(
446+
int a, int b, int c, int d,
447+
int e, int f, int g, int h, int i)
448+
{
449+
DrawLevelOvr4P(a,b,c,d,e,f,g,h,i);
450+
451+
int DebugProfiler_SectionEnd();
452+
DebugProfiler_SectionEnd();
453+
}
454+
455+
void Hook_RaceFlag_DrawSelf()
456+
{
457+
void DebugProfiler_SectionStart(char* name, char r, char g, char b);
458+
DebugProfiler_SectionStart(0, 0xFF, 0, 0xFF);
459+
460+
RaceFlag_DrawSelf();
461+
462+
int DebugProfiler_SectionEnd();
463+
DebugProfiler_SectionEnd();
464+
}
402465

403466
int Hook_Timer()
404467
{
@@ -417,6 +480,8 @@ void Hook_DrawOTag(int a)
417480
DrawOTag(a);
418481
}
419482

483+
// JMP hooks for callbacks...
484+
420485
#define JAL(dest) (((unsigned long)dest & 0x3FFFFFF) >> 2 | 0xC000000)
421486

422487
void RunEntryHook()
@@ -452,8 +517,18 @@ void RunEntryHook()
452517
*(int*)0x8003cd70 = JAL(Hook_MainFrame_ResetDB);
453518
*(int*)0x8003ce74 = JAL(Hook_MainFrame_GameLogic);
454519
*(int*)0x80036be0 = JAL(Hook_RenderBucket_Execute);
455-
520+
*(int*)0x80036d94 = JAL(Hook_StartLev1P2P);
521+
*(int*)0x80036f90 = JAL(Hook_StartLev1P2P);
522+
*(int*)0x800370d4 = JAL(Hook_StartLev3P4P);
523+
*(int*)0x8003723c = JAL(Hook_StartLev3P4P);
524+
*(int*)0x80036f50 = JAL(Hook_EndLev1P);
525+
*(int*)0x80037088 = JAL(Hook_EndLev2P);
526+
*(int*)0x800371e4 = JAL(Hook_EndLev3P);
527+
*(int*)0x80037374 = JAL(Hook_EndLev4P);
528+
*(int*)0x80037830 = JAL(Hook_RaceFlag_DrawSelf);
456529

457530
*(int*)0x80037854 = JAL(Hook_Timer);
458531
*(int*)0x800379b0 = JAL(Hook_DrawOTag);
532+
533+
// JMPs for vsync/drawsync
459534
}

0 commit comments

Comments
 (0)