@@ -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
403466int 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
422487void 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