Skip to content

Commit e056323

Browse files
author
Niko
committed
Profiler works in OG
1 parent 5d676a3 commit e056323

File tree

1 file changed

+15
-2
lines changed
  • mods/Standalones/Profiler/src

1 file changed

+15
-2
lines changed

mods/Standalones/Profiler/src/main.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,19 @@ void Hook_DrawOTag(int a)
480480
DrawOTag(a);
481481
}
482482

483-
// JMP hooks for callbacks...
483+
void Hook_RA_Vsync()
484+
{
485+
void DebugProfiler_Subsection(int flag);
486+
DebugProfiler_Subsection(1);
487+
}
488+
489+
void Hook_RA_DrawSync()
490+
{
491+
void DebugProfiler_Subsection(int flag);
492+
DebugProfiler_Subsection(2);
493+
}
484494

495+
#define JMP(dest) (((unsigned long)dest & 0x3FFFFFF) >> 2 | 0x8000000)
485496
#define JAL(dest) (((unsigned long)dest & 0x3FFFFFF) >> 2 | 0xC000000)
486497

487498
void RunEntryHook()
@@ -530,5 +541,7 @@ void RunEntryHook()
530541
*(int*)0x80037854 = JAL(Hook_Timer);
531542
*(int*)0x800379b0 = JAL(Hook_DrawOTag);
532543

533-
// JMPs for vsync/drawsync
544+
// JMPs for vsync/drawsync on JR $RA
545+
*(int*)0x80034b40 = JMP(Hook_RA_Vsync);
546+
*(int*)0x80034a9c = JMP(Hook_RA_DrawSync);
534547
}

0 commit comments

Comments
 (0)