Skip to content

Commit

Permalink
decompile profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
RevoSucks committed Aug 25, 2023
1 parent aeab778 commit 97b3cc7
Show file tree
Hide file tree
Showing 10 changed files with 459 additions and 18 deletions.
5 changes: 1 addition & 4 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ extern void func_800057C0(void);
extern u32 func_80006314(s32, s32, s32, s32, s32); // types unknown

// 75F0.s
extern void func_80008154(s32, s32, char*, ...);

// 9D20.s
extern void func_80009120(s32);
extern void HAL_Printf(s32 x, s32 y, char *str, ...);

// C030.s
extern s32 func_8000B4C4(void);
Expand Down
9 changes: 5 additions & 4 deletions splat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ segments:
- [0x6BC0, asm] #
- [0x75F0, asm] # stage loader
- [0x8EC0, c, crash_screen] # crash handler
- [0x9D20, asm] #
- [0x9D20, c, profiler]
- [0xAF00, asm] # camera code
- [0xB130, c, hal_libc]
- [0xB230, c, gb_tower]
Expand Down Expand Up @@ -326,7 +326,7 @@ segments:

# .data is somewhere in here
- [0x6A1B0, .data, crash_screen]
- [0x6A3B0, data, rom_data_6A3B0]
- [0x6A3B0, .data, profiler]
- [0x6A3D0, .data, gb_tower]
- [0x6A3E0, data, rom_data_6A3E0]
- [0x7A180, .data, libleo/driverominit]
Expand Down Expand Up @@ -355,7 +355,7 @@ segments:
- [0x7BB20, .rodata, 3A80]
- [0x7BB50, rodata, rom_rodata_7BB50]
- [0x7BBE0, .rodata, crash_screen]
- [0x7BFA0, rodata, rom_rodata_7BFA0]
- [0x7BFA0, .rodata, profiler]
- [0x7BFC0, .rodata, gb_tower]
- [0x7C000, rodata, rom_rodata_7C000]
- [0x7C180, rodata, rom_rodata_7C180]
Expand Down Expand Up @@ -419,7 +419,8 @@ segments:
- {vram: 0x800A7320, type: .bss, name: controller}
- {vram: 0x800A7420, type: .bss, name: unk_bss_3}
- {vram: 0x800A74C0, type: .bss, name: crash_screen}
- {vram: 0x800A7EA0, type: .bss, name: unk_bss_2}
- {vram: 0x800A7EA0, type: .bss, name: profiler}
- {vram: 0x800A8100, type: .bss, name: unk_bss_2}
- {vram: 0x80103880, type: .bss, name: libultra/gu/rotate}
- {vram: 0x80103890, type: .bss, name: libultra/os/timerintr}
- {vram: 0x801038E4, type: .bss, name: libultra/io/cartrominit}
Expand Down
4 changes: 2 additions & 2 deletions src/3A80.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void func_8000310C(Gfx** dlist)
func_8000302C(dlist, sp48, sp44, 0xFFCB);
func_8000302C(dlist, sp44, sp40, 0x2ABF);
func_8000302C(dlist, sp40, sp3C, 0xFFCB);
func_80008154(coord, 0x14, "MEM: +%XH (+%dK)", temp_s1, temp_s1 / 1024);
HAL_Printf(coord, 0x14, "MEM: +%XH (+%dK)", temp_s1, temp_s1 / 1024);
}
else
{
Expand All @@ -97,7 +97,7 @@ void func_8000310C(Gfx** dlist)
func_8000302C(dlist, sp34, sp2C, 0xFFCB);
func_8000302C(dlist, sp2C, sp30, 0xF94B);
func_8000302C(dlist, sp30, sp28, 0xFFCB);
func_80008154(coord, 0x14, "MEM: -%XH (-%dK)", -temp_s1, -temp_s1 / 1024);
HAL_Printf(coord, 0x14, "MEM: -%XH (-%dK)", -temp_s1, -temp_s1 / 1024);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/DDC0.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "ultra64.h"
#include "dp_intro.h"
#include "profiler.h"

extern s32 D_800A83A0;

Expand Down Expand Up @@ -114,13 +115,13 @@ void func_8000D3A8(void *unused) {
// thread loop
while(1) {
func_80004CF4(&D_800A8480);
func_80009210();
profiler_log_thread4_time();
if ((D_800A83A0 != 0) && (D_800A62E0.unkA38 < 0x15)) {
func_80037340(&D_800A83A8[D_800A8478].mesg20);
func_800053B4(&D_800A83A8[D_800A8478].mesg, 0);
}
D_800A8478 ^= 1;
func_80009210();
profiler_log_thread4_time();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/crash_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ u16 gCrashScreenUnlockInputs[] = {
};

void crash_screen_sleep(s32 ms) {
u64 cycles = (ms * 1000LL) * 3000 / 64ULL;
u64 cycles = (ms * 1000LL) * 3000ULL / 64ULL;
osSetTime(0);
while (osGetTime() < cycles) {
}
Expand Down
9 changes: 5 additions & 4 deletions src/dp_intro.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "common.h"
#include "dp_intro.h"
#include "crash_screen.h"
#include "profiler.h"

// dp_intro.c

Expand Down Expand Up @@ -210,7 +211,7 @@ void func_800015A8(void) {
}
D_8008474C = D_8008473C;
D_8008473C = D_8008472C;
func_80009120(3);
profiler_log_thread5_time(THREAD5_END);
func_80004CF4(&D_80083CA0);
}

Expand All @@ -237,12 +238,12 @@ void func_8000183C(UNUSED void *arg) {
func_800017E4();
continue;
}
func_80009120(0);
profiler_log_thread5_time(THREAD5_START);
D_80083CA0.unkA8A = 1;
osRecvMesg(&D_8008468C, &sp4C, 1);
D_80083CA0.unkA8A = 0;
func_80009120(1);
func_80009120(2);
profiler_log_thread5_time(UNK_EVENT_1);
profiler_log_thread5_time(UNK_EVENT_2);
func_8000152C(sp4C);
func_800015A8();
osSendMesg(&D_800846A4, (void* )0x444F4E45, 0);
Expand Down
Loading

0 comments on commit 97b3cc7

Please sign in to comment.