From ef597ad7df7cdc1e1532a9e2ca87ef748df5b864 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Sat, 29 Jul 2023 18:34:24 -0500 Subject: [PATCH] Decompile 4F7F0.c --- diff.py | 5 ++++- include/libleo/internal.h | 1 + splat.yaml | 2 +- src/4F7F0.c | 39 +++++++++++++++++++++++++++++++++++++++ src/C030.c | 1 + src/libleo/leomecha.c | 1 - 6 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 src/4F7F0.c diff --git a/diff.py b/diff.py index e5e87aae..d4c7a8bc 100644 --- a/diff.py +++ b/diff.py @@ -389,7 +389,10 @@ def search_map_file(fn_name): rom = int(tokens[5], 0) ram_to_rom = rom - ram if line.endswith(" " + fn_name): - ram = int(line.split()[0], 0) + try: + ram = int(line.split()[0], 0) + except: + ram = int(line.split()[1], 0) if cur_objfile is not None and ram_to_rom is not None: cands.append((cur_objfile, ram + ram_to_rom)) last_line = line diff --git a/include/libleo/internal.h b/include/libleo/internal.h index b2c79294..4dbfa1b8 100644 --- a/include/libleo/internal.h +++ b/include/libleo/internal.h @@ -186,6 +186,7 @@ extern u16 leoLba_to_phys(u32 lba); extern s32 __leoActive; extern s32 __leoResetCalled; extern s32 __leoQueuesCreated; +extern s32 currentCommand; extern u32 LEO_country_code; extern u32 LEOasic_bm_ctl_shadow; extern u32 LEOasic_seq_ctl_shadow; diff --git a/splat.yaml b/splat.yaml index 23886888..91dce6c3 100644 --- a/splat.yaml +++ b/splat.yaml @@ -112,7 +112,7 @@ segments: - [0x4BDC0, asm] - [0x4CBC0, asm] - [0x4F410, asm] - - [0x4F7F0, asm] + - [0x4F7F0, c] - [0x4F870, asm] - [0x4FDB0, asm] - [0x4FE60, asm] diff --git a/src/4F7F0.c b/src/4F7F0.c new file mode 100644 index 00000000..96069e07 --- /dev/null +++ b/src/4F7F0.c @@ -0,0 +1,39 @@ +#include "common.h" + +struct UnkArray4 { + u32 unk0; + u32 unk4; + u16 unk8; + u16 unkA; + f32 unkC; + u32 unk10; + u32 unk14; + u32 unk18; + u32 unk1C; +}; +struct UnkStructUnk8 { + char filler[0x88]; + u32 unk88; +}; +struct UnkStruct8004EBF0 { + char filler[0x8]; + struct UnkStructUnk8* unk8; +}; +void func_80047500(void*, u8, void*, void*); +struct UnkArray4* func_800495F8(); +struct UnkArray4* D_80078584; + +void func_8004EBF0(struct UnkStruct8004EBF0* arg0, f32 arg1) { + struct UnkArray4 *temp_v0; + + if (arg0->unk8 != NULL) { + temp_v0 = func_800495F8(); + if (temp_v0 != NULL) { + temp_v0->unk4 = (s32) (D_80078584->unk1C + arg0->unk8->unk88); + temp_v0->unk8 = 7; + temp_v0->unkC = arg1; + temp_v0->unk0 = 0; + func_80047500(arg0->unk8, 3, temp_v0, arg0); + } + } +} diff --git a/src/C030.c b/src/C030.c index 3f732be5..2cf657eb 100644 --- a/src/C030.c +++ b/src/C030.c @@ -1,5 +1,6 @@ #include "ultra64.h" #include "ultra64/controller.h" +#include "controller.h" extern s32 D_800697E0; extern u8 D_800A82B0[32]; diff --git a/src/libleo/leomecha.c b/src/libleo/leomecha.c index a9ffa552..a2909ffb 100644 --- a/src/libleo/leomecha.c +++ b/src/libleo/leomecha.c @@ -1,7 +1,6 @@ #include #include "libleo/internal.h" -extern s32 currentCommand; extern u32 asic_cur_status; // static? extern u32 unit_atten; // static?