From dccd234f4af8da829940a60fd4fd756a844fc9b3 Mon Sep 17 00:00:00 2001 From: gijs Date: Fri, 29 Sep 2023 18:53:09 +0200 Subject: [PATCH] Decompiled `UnusedMallocNo` --- include/common.h | 1 - linker_scripts/symbols/addr.txt | 2 +- splat.yaml | 47 ++++++--- src/_ob_overconfident_mother.c | 52 ++++++++++ src/_ob_rabid_jar.c | 166 ++++++++++++++++++++++++++++++++ 5 files changed, 252 insertions(+), 16 deletions(-) create mode 100644 src/_ob_overconfident_mother.c create mode 100644 src/_ob_rabid_jar.c diff --git a/include/common.h b/include/common.h index 4596a13..c20ec80 100644 --- a/include/common.h +++ b/include/common.h @@ -333,7 +333,6 @@ extern const char STR_CREATING_NEW_DATA[]; extern const char STR_CREATING_A_NEW_FILE[]; extern const char STR_ADDING_NEW_DATA[]; extern const char STR_buSave_SAVING[]; -extern const char STR_UNUSEDMALLOCNO_INSUFFICIENT_MEMORY[]; // extern const char STR_LHa___s_s__s[]; extern const char STR_Error[]; diff --git a/linker_scripts/symbols/addr.txt b/linker_scripts/symbols/addr.txt index 93844c7..3a17727 100644 --- a/linker_scripts/symbols/addr.txt +++ b/linker_scripts/symbols/addr.txt @@ -575,7 +575,7 @@ STR_CREATING_A_NEW_FILE = 0x800ADEC8; STR_ADDING_NEW_DATA = 0x800ADEA4; // type:asciz STR_buSave_SAVING = 0x800ADF08; // type:asciz -STR_UNUSEDMALLOCNO_INSUFFICIENT_MEMORY = 0x800ADF88; // type:asciz force_migration:True +STR_UNUSEDMALLOCNO_INSUFFICIENT_MEMORY = 0x800ADF88; // type:asciz STR_FILE_NOT_FOUND = 0x800AE2AC; // type:asciz force_migration:True D_overlay_286BD0_8023E378_29A2B8 = 0x8023E378; // type:asciz rom:0x29A2B8 diff --git a/splat.yaml b/splat.yaml index 722f18b..39dee07 100644 --- a/splat.yaml +++ b/splat.yaml @@ -54,12 +54,24 @@ segments: find_file_boundaries: True subsegments: - [0x1060, c, "main"] - # Unsure about these - - [0x4AC0, asm, "_ob_overconfident_mother"] - - [0x5FC0, asm, "_ob_rabid_jar"] - - [0x68E0, asm] - - [0x8700, asm] - - [0xA370, asm, "lha"] + - [0x4AC0, c, "_ob_overconfident_mother"] + - [0x5FC0, c, "_ob_rabid_jar"] + + - [0xB0B0, asm] + # - [0xBB10, asm] + # - [0xBFC0, asm] + # - [0xC310, asm] + # - [0xC990, asm] + # - [0xD600, asm] + # - [0xE1F0, asm] + # - [0xE3F0, asm] + # - [0xEC00, asm] + # - [0xECF0, asm] + # - [0xF5A0, asm] + # - [0xF850, asm] + # - [0xF8B0, asm] + # - [0xF970, asm] + # - [0xFA40, asm] - [0xFC80, c, "boot"] @@ -328,8 +340,17 @@ segments: - [0x3E100, data] - - [0x3E330, rodata] + - [0x3E330, .rodata, "_ob_rabid_jar"] + # - [0x3E3E0, rodata] + - [0x3E460, rodata] + # - [0x3E470, rodata] + # - [0x3E480, rodata] + # - [0x3E490, rodata] + + - [0x3E4A0, rodata] + # - [0x3E680, rodata] + # - [0x3E6A0, rodata] - [0x3E7A0, .rodata, "_ob_spooky_degree"] - [0x3E7C0, .rodata, "_ob_ambitious_fold"] @@ -1360,7 +1381,7 @@ segments: # - { start: 0x281860, type: bss, vram: 0x8022D0D0 } - # # __SOME_OVERLAY_TABLE[14] + # __SOME_OVERLAY_TABLE[14] # - type: code # dir: overlay_281860 # start: 0x281860 @@ -1369,15 +1390,13 @@ segments: # symbol_name_format: overlay_281860_$VRAM_$ROM # exclusive_ram_id: test_overlapping # subsegments: - # - [0x281860, asm] + # - [0x281860, asm] # - [0x282FE0, asm] # - [0x283DF0, asm] - # - [0x2866F0, rodata, 282FE0] - # - [0x286940, rodata] - # - [0x286960, rodata] - # - [0x286B50, rodata, 281860] - # - [0x286B90, rodata, 283DF0] + # - [0x2866F0, data] + + # - [0x286B50, rodata] # - { start: 0x286BD0, type: bss, vram: 0x8022AC00 } diff --git a/src/_ob_overconfident_mother.c b/src/_ob_overconfident_mother.c new file mode 100644 index 0000000..29ad3cf --- /dev/null +++ b/src/_ob_overconfident_mother.c @@ -0,0 +1,52 @@ +#include "common.h" + +void func_800746C0(void) { +} + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_800746C8); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80074834); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", buSave); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_800749C0); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80074AD4); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80074BF0); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80074C58); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", romCopy_256); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80074DA0); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80074F9C); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_8007513C); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80075224); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80075360); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_8007541C); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80075578); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80075688); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_8007578C); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80075858); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_800758FC); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_8007599C); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80075A84); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80075AC4); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80075B00); + +INCLUDE_ASM(const s32, "_ob_overconfident_mother", func_80075B60); diff --git a/src/_ob_rabid_jar.c b/src/_ob_rabid_jar.c new file mode 100644 index 0000000..4d9e508 --- /dev/null +++ b/src/_ob_rabid_jar.c @@ -0,0 +1,166 @@ +#include "common.h" + +typedef struct { + s32 field_0x0; + u8 field_0x4[0xA0]; + s32 field_0x8; +} SomethingMalloc; + +extern SomethingMalloc D_800E8300[]; + +INCLUDE_ASM(const s32, "_ob_rabid_jar", __calls_loads_overlay_array); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076150); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076188); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076194); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_800761A4); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", __loads_overlay_array); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076324); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", __get_overlay_index); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_800764E0); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_800765D8); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076AE8); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076DC8); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076E00); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076E2C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076E58); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076EAC); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076F00); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80076F5C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007705C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80077160); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80077200); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80077288); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80077314); + +/* 7768 80077368 */ +s32 UnusedMallocNo(s32 arg0) { + s32 var_a1; + SomethingMalloc** var_v1; + + var_a1 = 0; + var_v1 = &D_800E8300[arg0]; +loop_1: + if (*var_v1 != 0) { + var_a1 += 1; + var_v1 += 1; + if (var_a1 >= 10) { + osSyncPrintf("UnusedMallocNo(): 空きがない!\n", var_a1); + while(1); + } + goto loop_1; + } + return var_a1; +} + + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_800773D4); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007740C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007745C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80077494); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_800775EC); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80077BF8); + +void func_80077F80(void) { } + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80077F88); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_800780D4); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80078164); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007819C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_800782EC); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80078300); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007834C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80078658); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80078674); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007896C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80078C6C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079028); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007913C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079358); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079380); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007938C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079618); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079850); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_800798AC); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079950); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079AFC); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079BD8); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079CB4); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079D60); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079D98); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079DF8); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079E50); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079E9C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079EF4); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_80079F70); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007A070); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", Unpack); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", __read_u32_le); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007A80C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007AB30); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007AB7C); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", func_8007ABAC); + +INCLUDE_ASM(const s32, "_ob_rabid_jar", UnpackProc);