From 0d7d00a97fbe21d2f863a34eda05ad0d93a53fd5 Mon Sep 17 00:00:00 2001 From: tehzz Date: Fri, 30 Dec 2022 12:14:51 -0500 Subject: [PATCH 01/10] add ASM to GOBAL_ASM C file util --- utils/split_asm.py | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 utils/split_asm.py diff --git a/utils/split_asm.py b/utils/split_asm.py new file mode 100755 index 0000000..965c6f4 --- /dev/null +++ b/utils/split_asm.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 + +''' Split an asm (.s) file into a series of function.s files + and a GLOBAL_ASM .c file that imports those funcion.s files +''' + +import sys +from pathlib import Path + +if len(sys.argv) != 4: + print(f"Usage: {sys.argv[0]} ") + exit() + +def fail(msg): + print(msg, file=sys.stderr) + exit(1) + + +def assert_is_dir(p): + if not p.is_dir(): + fail(f"Path <{p}> is not a directory") + +def is_routine_glabel(line): + return "glabel" in line and "D_" not in line and "jtgt" not in line and "L8" not in line + +def id_routines(input): + # routine name => String + routines = dict() + def store_routine(state): + if state is not None: + routines[state[0]] = state[1] + state = None + + with open(input, 'r') as f: + # (name, textbuf) + state = None + text_section = False + for line in f: + if line.startswith(".section"): + text_section = line.split()[1] in [".text", ".text,"] + store_routine(state) + elif is_routine_glabel(line) and text_section: + name = line.split()[-1] + # store "completed" prior routine + store_routine(state) + # and start collecting the next routine + state = (name, line) + elif state is not None and text_section: + state = (state[0], state[1] + line) + + # output final routine + store_routine(state) + + return routines + +def write_split_files(nm_dir, c_out, routines): + # routineName => routineNonMatchingFile + with open(c_out, "w+") as cf: + cf.write("#include \n\n") + cf.write('#pragma GCC diagnostic push\n') + cf.write('#pragma GCC diagnostic ignored "-Wunknown-pragmas"\n') + + for (routine, text) in routines.items(): + nm_out = nm_dir / Path(routine).with_suffix('.s') + + f = open(nm_out, "w") + f.write(".section .text\n") + f.write(text) + f.close() + + cf.write(f'\n#ifdef MIPS_TO_C\n#else\n#pragma GLOBAL_ASM("{nm_out}")\n#endif\n') + + cf.write('#pragma GCC diagnostic pop\n') + +def main(): + s_in = Path(sys.argv[1]) + s_out_base = Path(sys.argv[2]) + c_out_dir = Path(sys.argv[3]) + + input_filename = s_in.stem + s_out_dir = s_out_base / Path(*c_out_dir.parts[1:]) / input_filename + c_out_file = c_out_dir / s_in.with_suffix('.c').name + + s_out_dir.relative_to + + s_out_dir.mkdir(parents=True, exist_ok=True) + c_out_dir.mkdir(parents=True, exist_ok=True) + assert_is_dir(s_out_dir) + assert_is_dir(c_out_dir) + + routines = id_routines(s_in) + write_split_files(s_out_dir, c_out_file, routines) + # print(routines) + + +if __name__ == '__main__': + main() From ea6d7f92754d3a391e82863b35d7d67816fca7a8 Mon Sep 17 00:00:00 2001 From: tehzz Date: Fri, 30 Dec 2022 12:15:14 -0500 Subject: [PATCH 02/10] split intro_loader (2EC0) --- splat.yaml | 2 +- src/intro_loader.c | 75 ++++++++++++++++ src/nonmatchings/intro_loader/func_800022C0.s | 51 +++++++++++ src/nonmatchings/intro_loader/func_80002380.s | 49 +++++++++++ src/nonmatchings/intro_loader/func_80002430.s | 81 +++++++++++++++++ src/nonmatchings/intro_loader/func_8000254C.s | 34 ++++++++ src/nonmatchings/intro_loader/func_800025C4.s | 26 ++++++ src/nonmatchings/intro_loader/func_80002620.s | 28 ++++++ src/nonmatchings/intro_loader/func_80002680.s | 62 +++++++++++++ src/nonmatchings/intro_loader/func_80002764.s | 12 +++ src/nonmatchings/intro_loader/func_80002784.s | 49 +++++++++++ src/nonmatchings/intro_loader/func_80002838.s | 86 +++++++++++++++++++ src/nonmatchings/intro_loader/func_80002960.s | 58 +++++++++++++ src/nonmatchings/intro_loader/func_80002A14.s | 7 ++ src/nonmatchings/intro_loader/func_80002A24.s | 6 ++ src/nonmatchings/intro_loader/func_80002A30.s | 6 ++ 16 files changed, 631 insertions(+), 1 deletion(-) create mode 100644 src/intro_loader.c create mode 100644 src/nonmatchings/intro_loader/func_800022C0.s create mode 100644 src/nonmatchings/intro_loader/func_80002380.s create mode 100644 src/nonmatchings/intro_loader/func_80002430.s create mode 100644 src/nonmatchings/intro_loader/func_8000254C.s create mode 100644 src/nonmatchings/intro_loader/func_800025C4.s create mode 100644 src/nonmatchings/intro_loader/func_80002620.s create mode 100644 src/nonmatchings/intro_loader/func_80002680.s create mode 100644 src/nonmatchings/intro_loader/func_80002764.s create mode 100644 src/nonmatchings/intro_loader/func_80002784.s create mode 100644 src/nonmatchings/intro_loader/func_80002838.s create mode 100644 src/nonmatchings/intro_loader/func_80002960.s create mode 100644 src/nonmatchings/intro_loader/func_80002A14.s create mode 100644 src/nonmatchings/intro_loader/func_80002A24.s create mode 100644 src/nonmatchings/intro_loader/func_80002A30.s diff --git a/splat.yaml b/splat.yaml index 6afde13..2e9834c 100644 --- a/splat.yaml +++ b/splat.yaml @@ -36,7 +36,7 @@ segments: - [0x1F70, bin, noppad_1F70] # Extra nop align like earlier. Weird - [0x1F80, c, dp_intro] # dp intro code - [0x28E0, c, memmap] - - [0x2EC0, asm] # intro loader + - [0x2EC0, c, intro_loader] # intro loader - [0x3640, asm] # - [0x3A80, asm] # transition loader - [0x3FB0, asm] # PRES-JPEG decoder diff --git a/src/intro_loader.c b/src/intro_loader.c new file mode 100644 index 0000000..3d9a0de --- /dev/null +++ b/src/intro_loader.c @@ -0,0 +1,75 @@ +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunknown-pragmas" + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_800022C0.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002380.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002430.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_8000254C.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_800025C4.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002620.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002680.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002764.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002784.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002838.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002960.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002A14.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002A24.s") +#endif + +#ifdef MIPS_TO_C +#else +#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002A30.s") +#endif +#pragma GCC diagnostic pop diff --git a/src/nonmatchings/intro_loader/func_800022C0.s b/src/nonmatchings/intro_loader/func_800022C0.s new file mode 100644 index 0000000..7fabc0a --- /dev/null +++ b/src/nonmatchings/intro_loader/func_800022C0.s @@ -0,0 +1,51 @@ +.section .text +glabel func_800022C0 +/* 2EC0 800022C0 27BDFFE8 */ addiu $sp, $sp, -0x18 +/* 2EC4 800022C4 AFA5001C */ sw $a1, 0x1C($sp) +/* 2EC8 800022C8 8FB9001C */ lw $t9, 0x1C($sp) +/* 2ECC 800022CC 3C05800A */ lui $a1, %hi(D_800A6070) +/* 2ED0 800022D0 24A56070 */ addiu $a1, $a1, %lo(D_800A6070) +/* 2ED4 800022D4 2403FFF0 */ addiu $v1, $zero, -0x10 +/* 2ED8 800022D8 248E000F */ addiu $t6, $a0, 0xF +/* 2EDC 800022DC 01C37824 */ and $t7, $t6, $v1 +/* 2EE0 800022E0 25F80010 */ addiu $t8, $t7, 0x10 +/* 2EE4 800022E4 03234024 */ and $t0, $t9, $v1 +/* 2EE8 800022E8 2509FFF0 */ addiu $t1, $t0, -0x10 +/* 2EEC 800022EC 01385823 */ subu $t3, $t1, $t8 +/* 2EF0 800022F0 270CFFF0 */ addiu $t4, $t8, -0x10 +/* 2EF4 800022F4 AFBF0014 */ sw $ra, 0x14($sp) +/* 2EF8 800022F8 ACB80020 */ sw $t8, 0x20($a1) +/* 2EFC 800022FC ACA90024 */ sw $t1, 0x24($a1) +/* 2F00 80002300 ACAB001C */ sw $t3, 0x1C($a1) +/* 2F04 80002304 ACA00030 */ sw $zero, 0x30($a1) +/* 2F08 80002308 ACAC0028 */ sw $t4, 0x28($a1) +/* 2F0C 8000230C AD800000 */ sw $zero, 0x0($t4) +/* 2F10 80002310 8CAE0028 */ lw $t6, 0x28($a1) +/* 2F14 80002314 3C04800A */ lui $a0, %hi(D_800A6074) +/* 2F18 80002318 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 2F1C 8000231C ADC00004 */ sw $zero, 0x4($t6) +/* 2F20 80002320 8CAF0028 */ lw $t7, 0x28($a1) +/* 2F24 80002324 24060001 */ addiu $a2, $zero, 0x1 +/* 2F28 80002328 ADE00008 */ sw $zero, 0x8($t7) +/* 2F2C 8000232C 8CB80028 */ lw $t8, 0x28($a1) +/* 2F30 80002330 AF00000C */ sw $zero, 0xC($t8) +/* 2F34 80002334 8CB90024 */ lw $t9, 0x24($a1) +/* 2F38 80002338 ACB9002C */ sw $t9, 0x2C($a1) +/* 2F3C 8000233C AF200000 */ sw $zero, 0x0($t9) +/* 2F40 80002340 8CA9002C */ lw $t1, 0x2C($a1) +/* 2F44 80002344 AD200004 */ sw $zero, 0x4($t1) +/* 2F48 80002348 8CAA0028 */ lw $t2, 0x28($a1) +/* 2F4C 8000234C AD400008 */ sw $zero, 0x8($t2) +/* 2F50 80002350 8CAB0028 */ lw $t3, 0x28($a1) +/* 2F54 80002354 0C0178E8 */ jal osCreateMesgQueue +/* 2F58 80002358 AD60000C */ sw $zero, 0xC($t3) +/* 2F5C 8000235C 3C04800A */ lui $a0, %hi(D_800A6074) +/* 2F60 80002360 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 2F64 80002364 00002825 */ or $a1, $zero, $zero +/* 2F68 80002368 0C015A30 */ jal osSendMesg +/* 2F6C 8000236C 00003025 */ or $a2, $zero, $zero +/* 2F70 80002370 8FBF0014 */ lw $ra, 0x14($sp) +/* 2F74 80002374 27BD0018 */ addiu $sp, $sp, 0x18 +/* 2F78 80002378 03E00008 */ jr $ra +/* 2F7C 8000237C 00000000 */ nop + diff --git a/src/nonmatchings/intro_loader/func_80002380.s b/src/nonmatchings/intro_loader/func_80002380.s new file mode 100644 index 0000000..c441206 --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002380.s @@ -0,0 +1,49 @@ +.section .text +glabel func_80002380 +/* 2F80 80002380 2484000F */ addiu $a0, $a0, 0xF +/* 2F84 80002384 2401FFF0 */ addiu $at, $zero, -0x10 +/* 2F88 80002388 00812024 */ and $a0, $a0, $at +/* 2F8C 8000238C 24840010 */ addiu $a0, $a0, 0x10 +/* 2F90 80002390 10800025 */ beqz $a0, .L80002428 +/* 2F94 80002394 00001825 */ or $v1, $zero, $zero +/* 2F98 80002398 3C07800A */ lui $a3, %hi(D_800A6070) +/* 2F9C 8000239C 24E76070 */ addiu $a3, $a3, %lo(D_800A6070) +/* 2FA0 800023A0 8CE2001C */ lw $v0, 0x1C($a3) +/* 2FA4 800023A4 0044082B */ sltu $at, $v0, $a0 +/* 2FA8 800023A8 1420001F */ bnez $at, .L80002428 +/* 2FAC 800023AC 00000000 */ nop +/* 2FB0 800023B0 14A0000F */ bnez $a1, .L800023F0 +/* 2FB4 800023B4 24010001 */ addiu $at, $zero, 0x1 +/* 2FB8 800023B8 8CE60028 */ lw $a2, 0x28($a3) +/* 2FBC 800023BC 00447023 */ subu $t6, $v0, $a0 +/* 2FC0 800023C0 ACEE001C */ sw $t6, 0x1C($a3) +/* 2FC4 800023C4 00C42821 */ addu $a1, $a2, $a0 +/* 2FC8 800023C8 ACC50004 */ sw $a1, 0x4($a2) +/* 2FCC 800023CC 8CEF0028 */ lw $t7, 0x28($a3) +/* 2FD0 800023D0 ACA00004 */ sw $zero, 0x4($a1) +/* 2FD4 800023D4 ACA00008 */ sw $zero, 0x8($a1) +/* 2FD8 800023D8 ACA0000C */ sw $zero, 0xC($a1) +/* 2FDC 800023DC ACAF0000 */ sw $t7, 0x0($a1) +/* 2FE0 800023E0 8CE30028 */ lw $v1, 0x28($a3) +/* 2FE4 800023E4 ACE50028 */ sw $a1, 0x28($a3) +/* 2FE8 800023E8 03E00008 */ jr $ra +/* 2FEC 800023EC 24620010 */ addiu $v0, $v1, 0x10 +.L800023F0: +/* 2FF0 800023F0 14A1000D */ bne $a1, $at, .L80002428 +/* 2FF4 800023F4 00000000 */ nop +/* 2FF8 800023F8 8CE6002C */ lw $a2, 0x2C($a3) +/* 2FFC 800023FC 0044C023 */ subu $t8, $v0, $a0 +/* 3000 80002400 ACF8001C */ sw $t8, 0x1C($a3) +/* 3004 80002404 00C42823 */ subu $a1, $a2, $a0 +/* 3008 80002408 ACC50000 */ sw $a1, 0x0($a2) +/* 300C 8000240C 8CF9002C */ lw $t9, 0x2C($a3) +/* 3010 80002410 ACA00000 */ sw $zero, 0x0($a1) +/* 3014 80002414 ACA00008 */ sw $zero, 0x8($a1) +/* 3018 80002418 ACA0000C */ sw $zero, 0xC($a1) +/* 301C 8000241C ACB90004 */ sw $t9, 0x4($a1) +/* 3020 80002420 ACE5002C */ sw $a1, 0x2C($a3) +/* 3024 80002424 24A30010 */ addiu $v1, $a1, 0x10 +.L80002428: +/* 3028 80002428 03E00008 */ jr $ra +/* 302C 8000242C 00601025 */ or $v0, $v1, $zero + diff --git a/src/nonmatchings/intro_loader/func_80002430.s b/src/nonmatchings/intro_loader/func_80002430.s new file mode 100644 index 0000000..aa46605 --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002430.s @@ -0,0 +1,81 @@ +.section .text +glabel func_80002430 +/* 3030 80002430 27BDFFD8 */ addiu $sp, $sp, -0x28 +/* 3034 80002434 AFB10018 */ sw $s1, 0x18($sp) +/* 3038 80002438 3C11800A */ lui $s1, %hi(D_800A6070) +/* 303C 8000243C 26316070 */ addiu $s1, $s1, %lo(D_800A6070) +/* 3040 80002440 8E220028 */ lw $v0, 0x28($s1) +/* 3044 80002444 2483FFF0 */ addiu $v1, $a0, -0x10 +/* 3048 80002448 AFB30020 */ sw $s3, 0x20($sp) +/* 304C 8000244C AFB2001C */ sw $s2, 0x1C($sp) +/* 3050 80002450 0062082B */ sltu $at, $v1, $v0 +/* 3054 80002454 00A09825 */ or $s3, $a1, $zero +/* 3058 80002458 AFBF0024 */ sw $ra, 0x24($sp) +/* 305C 8000245C AFB00014 */ sw $s0, 0x14($sp) +/* 3060 80002460 10200016 */ beqz $at, .L800024BC +/* 3064 80002464 00609025 */ or $s2, $v1, $zero +/* 3068 80002468 8C4E0000 */ lw $t6, 0x0($v0) +.L8000246C: +/* 306C 8000246C 12600007 */ beqz $s3, .L8000248C +/* 3070 80002470 AE2E0028 */ sw $t6, 0x28($s1) +/* 3074 80002474 8DC30008 */ lw $v1, 0x8($t6) +/* 3078 80002478 25C40010 */ addiu $a0, $t6, 0x10 +/* 307C 8000247C 50600004 */ beql $v1, $zero, .L80002490 +/* 3080 80002480 8E220028 */ lw $v0, 0x28($s1) +/* 3084 80002484 0060F809 */ jalr $v1 +/* 3088 80002488 8DC5000C */ lw $a1, 0xC($t6) +.L8000248C: +/* 308C 8000248C 8E220028 */ lw $v0, 0x28($s1) +.L80002490: +/* 3090 80002490 8E2F001C */ lw $t7, 0x1C($s1) +/* 3094 80002494 8C580004 */ lw $t8, 0x4($v0) +/* 3098 80002498 01F8C821 */ addu $t9, $t7, $t8 +/* 309C 8000249C 03224023 */ subu $t0, $t9, $v0 +/* 30A0 800024A0 AE28001C */ sw $t0, 0x1C($s1) +/* 30A4 800024A4 AC400004 */ sw $zero, 0x4($v0) +/* 30A8 800024A8 8E220028 */ lw $v0, 0x28($s1) +/* 30AC 800024AC 5642FFEF */ bnel $s2, $v0, .L8000246C +/* 30B0 800024B0 8C4E0000 */ lw $t6, 0x0($v0) +/* 30B4 800024B4 1000001C */ b .L80002528 +/* 30B8 800024B8 00000000 */ nop +.L800024BC: +/* 30BC 800024BC 8E30002C */ lw $s0, 0x2C($s1) +/* 30C0 800024C0 0070082B */ sltu $at, $v1, $s0 +/* 30C4 800024C4 14200018 */ bnez $at, .L80002528 +/* 30C8 800024C8 0070082B */ sltu $at, $v1, $s0 +/* 30CC 800024CC 14200016 */ bnez $at, .L80002528 +/* 30D0 800024D0 00000000 */ nop +.L800024D4: +/* 30D4 800024D4 52600009 */ beql $s3, $zero, .L800024FC +/* 30D8 800024D8 8E090004 */ lw $t1, 0x4($s0) +/* 30DC 800024DC 8E020008 */ lw $v0, 0x8($s0) +/* 30E0 800024E0 26040010 */ addiu $a0, $s0, 0x10 +/* 30E4 800024E4 50400005 */ beql $v0, $zero, .L800024FC +/* 30E8 800024E8 8E090004 */ lw $t1, 0x4($s0) +/* 30EC 800024EC 0040F809 */ jalr $v0 +/* 30F0 800024F0 8E05000C */ lw $a1, 0xC($s0) +/* 30F4 800024F4 8E30002C */ lw $s0, 0x2C($s1) +/* 30F8 800024F8 8E090004 */ lw $t1, 0x4($s0) +.L800024FC: +/* 30FC 800024FC 8E2A001C */ lw $t2, 0x1C($s1) +/* 3100 80002500 AE29002C */ sw $t1, 0x2C($s1) +/* 3104 80002504 8D2C0000 */ lw $t4, 0x0($t1) +/* 3108 80002508 01495821 */ addu $t3, $t2, $t1 +/* 310C 8000250C 016C6823 */ subu $t5, $t3, $t4 +/* 3110 80002510 AE2D001C */ sw $t5, 0x1C($s1) +/* 3114 80002514 AD200000 */ sw $zero, 0x0($t1) +/* 3118 80002518 8E30002C */ lw $s0, 0x2C($s1) +/* 311C 8000251C 0250082B */ sltu $at, $s2, $s0 +/* 3120 80002520 1020FFEC */ beqz $at, .L800024D4 +/* 3124 80002524 00000000 */ nop +.L80002528: +/* 3128 80002528 0C0009D9 */ jal func_80002764 +/* 312C 8000252C 00000000 */ nop +/* 3130 80002530 8FBF0024 */ lw $ra, 0x24($sp) +/* 3134 80002534 8FB00014 */ lw $s0, 0x14($sp) +/* 3138 80002538 8FB10018 */ lw $s1, 0x18($sp) +/* 313C 8000253C 8FB2001C */ lw $s2, 0x1C($sp) +/* 3140 80002540 8FB30020 */ lw $s3, 0x20($sp) +/* 3144 80002544 03E00008 */ jr $ra +/* 3148 80002548 27BD0028 */ addiu $sp, $sp, 0x28 + diff --git a/src/nonmatchings/intro_loader/func_8000254C.s b/src/nonmatchings/intro_loader/func_8000254C.s new file mode 100644 index 0000000..bc5bbbb --- /dev/null +++ b/src/nonmatchings/intro_loader/func_8000254C.s @@ -0,0 +1,34 @@ +.section .text +glabel func_8000254C +/* 314C 8000254C 27BDFFE0 */ addiu $sp, $sp, -0x20 +/* 3150 80002550 AFA40020 */ sw $a0, 0x20($sp) +/* 3154 80002554 AFBF0014 */ sw $ra, 0x14($sp) +/* 3158 80002558 AFA50024 */ sw $a1, 0x24($sp) +/* 315C 8000255C AFA60028 */ sw $a2, 0x28($sp) +/* 3160 80002560 3C04800A */ lui $a0, %hi(D_800A6074) +/* 3164 80002564 AFA7002C */ sw $a3, 0x2C($sp) +/* 3168 80002568 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 316C 8000256C 24060001 */ addiu $a2, $zero, 0x1 +/* 3170 80002570 0C015AB4 */ jal osRecvMesg +/* 3174 80002574 00002825 */ or $a1, $zero, $zero +/* 3178 80002578 8FA40020 */ lw $a0, 0x20($sp) +/* 317C 8000257C 0C0008E0 */ jal func_80002380 +/* 3180 80002580 8FA50024 */ lw $a1, 0x24($sp) +/* 3184 80002584 10400005 */ beqz $v0, .L8000259C +/* 3188 80002588 AFA2001C */ sw $v0, 0x1C($sp) +/* 318C 8000258C 00402025 */ or $a0, $v0, $zero +/* 3190 80002590 8FA50028 */ lw $a1, 0x28($sp) +/* 3194 80002594 0C000A85 */ jal func_80002A14 +/* 3198 80002598 8FA6002C */ lw $a2, 0x2C($sp) +.L8000259C: +/* 319C 8000259C 3C04800A */ lui $a0, %hi(D_800A6074) +/* 31A0 800025A0 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 31A4 800025A4 00002825 */ or $a1, $zero, $zero +/* 31A8 800025A8 0C015A30 */ jal osSendMesg +/* 31AC 800025AC 00003025 */ or $a2, $zero, $zero +/* 31B0 800025B0 8FBF0014 */ lw $ra, 0x14($sp) +/* 31B4 800025B4 8FA2001C */ lw $v0, 0x1C($sp) +/* 31B8 800025B8 27BD0020 */ addiu $sp, $sp, 0x20 +/* 31BC 800025BC 03E00008 */ jr $ra +/* 31C0 800025C0 00000000 */ nop + diff --git a/src/nonmatchings/intro_loader/func_800025C4.s b/src/nonmatchings/intro_loader/func_800025C4.s new file mode 100644 index 0000000..b239caf --- /dev/null +++ b/src/nonmatchings/intro_loader/func_800025C4.s @@ -0,0 +1,26 @@ +.section .text +glabel func_800025C4 +/* 31C4 800025C4 27BDFFE0 */ addiu $sp, $sp, -0x20 +/* 31C8 800025C8 AFA40020 */ sw $a0, 0x20($sp) +/* 31CC 800025CC AFBF0014 */ sw $ra, 0x14($sp) +/* 31D0 800025D0 AFA50024 */ sw $a1, 0x24($sp) +/* 31D4 800025D4 3C04800A */ lui $a0, %hi(D_800A6074) +/* 31D8 800025D8 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 31DC 800025DC 00002825 */ or $a1, $zero, $zero +/* 31E0 800025E0 0C015AB4 */ jal osRecvMesg +/* 31E4 800025E4 24060001 */ addiu $a2, $zero, 0x1 +/* 31E8 800025E8 8FA40020 */ lw $a0, 0x20($sp) +/* 31EC 800025EC 0C0008E0 */ jal func_80002380 +/* 31F0 800025F0 8FA50024 */ lw $a1, 0x24($sp) +/* 31F4 800025F4 3C04800A */ lui $a0, %hi(D_800A6074) +/* 31F8 800025F8 AFA2001C */ sw $v0, 0x1C($sp) +/* 31FC 800025FC 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 3200 80002600 00002825 */ or $a1, $zero, $zero +/* 3204 80002604 0C015A30 */ jal osSendMesg +/* 3208 80002608 00003025 */ or $a2, $zero, $zero +/* 320C 8000260C 8FBF0014 */ lw $ra, 0x14($sp) +/* 3210 80002610 8FA2001C */ lw $v0, 0x1C($sp) +/* 3214 80002614 27BD0020 */ addiu $sp, $sp, 0x20 +/* 3218 80002618 03E00008 */ jr $ra +/* 321C 8000261C 00000000 */ nop + diff --git a/src/nonmatchings/intro_loader/func_80002620.s b/src/nonmatchings/intro_loader/func_80002620.s new file mode 100644 index 0000000..1a02282 --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002620.s @@ -0,0 +1,28 @@ +.section .text +glabel func_80002620 +/* 3220 80002620 27BDFFE8 */ addiu $sp, $sp, -0x18 +/* 3224 80002624 AFBF0014 */ sw $ra, 0x14($sp) +/* 3228 80002628 1080000F */ beqz $a0, .L80002668 +/* 322C 8000262C 00803825 */ or $a3, $a0, $zero +/* 3230 80002630 3C04800A */ lui $a0, %hi(D_800A6074) +/* 3234 80002634 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 3238 80002638 00002825 */ or $a1, $zero, $zero +/* 323C 8000263C 24060001 */ addiu $a2, $zero, 0x1 +/* 3240 80002640 0C015AB4 */ jal osRecvMesg +/* 3244 80002644 AFA70018 */ sw $a3, 0x18($sp) +/* 3248 80002648 8FA40018 */ lw $a0, 0x18($sp) +/* 324C 8000264C 0C00090C */ jal func_80002430 +/* 3250 80002650 24050001 */ addiu $a1, $zero, 0x1 +/* 3254 80002654 3C04800A */ lui $a0, %hi(D_800A6074) +/* 3258 80002658 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 325C 8000265C 00002825 */ or $a1, $zero, $zero +/* 3260 80002660 0C015A30 */ jal osSendMesg +/* 3264 80002664 00003025 */ or $a2, $zero, $zero +.L80002668: +/* 3268 80002668 0C0009D9 */ jal func_80002764 +/* 326C 8000266C 00000000 */ nop +/* 3270 80002670 8FBF0014 */ lw $ra, 0x14($sp) +/* 3274 80002674 27BD0018 */ addiu $sp, $sp, 0x18 +/* 3278 80002678 03E00008 */ jr $ra +/* 327C 8000267C 00000000 */ nop + diff --git a/src/nonmatchings/intro_loader/func_80002680.s b/src/nonmatchings/intro_loader/func_80002680.s new file mode 100644 index 0000000..122209b --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002680.s @@ -0,0 +1,62 @@ +.section .text +glabel func_80002680 +/* 3280 80002680 27BDFFD0 */ addiu $sp, $sp, -0x30 +/* 3284 80002684 AFA40030 */ sw $a0, 0x30($sp) +/* 3288 80002688 AFBF0014 */ sw $ra, 0x14($sp) +/* 328C 8000268C 00A03825 */ or $a3, $a1, $zero +/* 3290 80002690 3C04800A */ lui $a0, %hi(D_800A6074) +/* 3294 80002694 AFA00028 */ sw $zero, 0x28($sp) +/* 3298 80002698 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 329C 8000269C AFA70034 */ sw $a3, 0x34($sp) +/* 32A0 800026A0 00002825 */ or $a1, $zero, $zero +/* 32A4 800026A4 0C015AB4 */ jal osRecvMesg +/* 32A8 800026A8 24060001 */ addiu $a2, $zero, 0x1 +/* 32AC 800026AC 8FA60030 */ lw $a2, 0x30($sp) +/* 32B0 800026B0 3C05800A */ lui $a1, %hi(D_800A6070) +/* 32B4 800026B4 24A56070 */ addiu $a1, $a1, %lo(D_800A6070) +/* 32B8 800026B8 24C3FFF0 */ addiu $v1, $a2, -0x10 +/* 32BC 800026BC 8C640004 */ lw $a0, 0x4($v1) +/* 32C0 800026C0 8CAE0028 */ lw $t6, 0x28($a1) +/* 32C4 800026C4 8FA70034 */ lw $a3, 0x34($sp) +/* 32C8 800026C8 00861023 */ subu $v0, $a0, $a2 +/* 32CC 800026CC 15C4001B */ bne $t6, $a0, .L8000273C +/* 32D0 800026D0 24E7000F */ addiu $a3, $a3, 0xF +/* 32D4 800026D4 2401FFF0 */ addiu $at, $zero, -0x10 +/* 32D8 800026D8 00E13824 */ and $a3, $a3, $at +/* 32DC 800026DC 0047082B */ sltu $at, $v0, $a3 +/* 32E0 800026E0 50200007 */ beql $at, $zero, .L80002700 +/* 32E4 800026E4 8C79000C */ lw $t9, 0xC($v1) +/* 32E8 800026E8 8CAF001C */ lw $t7, 0x1C($a1) +/* 32EC 800026EC 00E2C023 */ subu $t8, $a3, $v0 +/* 32F0 800026F0 01F8082B */ sltu $at, $t7, $t8 +/* 32F4 800026F4 14200011 */ bnez $at, .L8000273C +/* 32F8 800026F8 00000000 */ nop +/* 32FC 800026FC 8C79000C */ lw $t9, 0xC($v1) +.L80002700: +/* 3300 80002700 00C02025 */ or $a0, $a2, $zero +/* 3304 80002704 00002825 */ or $a1, $zero, $zero +/* 3308 80002708 AFB90020 */ sw $t9, 0x20($sp) +/* 330C 8000270C 8C680008 */ lw $t0, 0x8($v1) +/* 3310 80002710 AFA70034 */ sw $a3, 0x34($sp) +/* 3314 80002714 0C00090C */ jal func_80002430 +/* 3318 80002718 AFA8001C */ sw $t0, 0x1C($sp) +/* 331C 8000271C 8FA40034 */ lw $a0, 0x34($sp) +/* 3320 80002720 0C0008E0 */ jal func_80002380 +/* 3324 80002724 00002825 */ or $a1, $zero, $zero +/* 3328 80002728 AFA20028 */ sw $v0, 0x28($sp) +/* 332C 8000272C 00402025 */ or $a0, $v0, $zero +/* 3330 80002730 8FA50020 */ lw $a1, 0x20($sp) +/* 3334 80002734 0C000A85 */ jal func_80002A14 +/* 3338 80002738 8FA6001C */ lw $a2, 0x1C($sp) +.L8000273C: +/* 333C 8000273C 3C04800A */ lui $a0, %hi(D_800A6074) +/* 3340 80002740 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 3344 80002744 00002825 */ or $a1, $zero, $zero +/* 3348 80002748 0C015A30 */ jal osSendMesg +/* 334C 8000274C 00003025 */ or $a2, $zero, $zero +/* 3350 80002750 8FBF0014 */ lw $ra, 0x14($sp) +/* 3354 80002754 8FA20028 */ lw $v0, 0x28($sp) +/* 3358 80002758 27BD0030 */ addiu $sp, $sp, 0x30 +/* 335C 8000275C 03E00008 */ jr $ra +/* 3360 80002760 00000000 */ nop + diff --git a/src/nonmatchings/intro_loader/func_80002764.s b/src/nonmatchings/intro_loader/func_80002764.s new file mode 100644 index 0000000..78094ef --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002764.s @@ -0,0 +1,12 @@ +.section .text +glabel func_80002764 +/* 3364 80002764 3C03800A */ lui $v1, %hi(D_800A608C) +/* 3368 80002768 8C63608C */ lw $v1, %lo(D_800A608C)($v1) +/* 336C 8000276C 2463FFF0 */ addiu $v1, $v1, -0x10 +/* 3370 80002770 04610002 */ bgez $v1, .L8000277C +/* 3374 80002774 00000000 */ nop +/* 3378 80002778 00001825 */ or $v1, $zero, $zero +.L8000277C: +/* 337C 8000277C 03E00008 */ jr $ra +/* 3380 80002780 00601025 */ or $v0, $v1, $zero + diff --git a/src/nonmatchings/intro_loader/func_80002784.s b/src/nonmatchings/intro_loader/func_80002784.s new file mode 100644 index 0000000..78d54ec --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002784.s @@ -0,0 +1,49 @@ +.section .text +glabel func_80002784 +/* 3384 80002784 27BDFFD8 */ addiu $sp, $sp, -0x28 +/* 3388 80002788 AFA40028 */ sw $a0, 0x28($sp) +/* 338C 8000278C AFBF0014 */ sw $ra, 0x14($sp) +/* 3390 80002790 3C04800A */ lui $a0, %hi(D_800A6074) +/* 3394 80002794 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 3398 80002798 00002825 */ or $a1, $zero, $zero +/* 339C 8000279C 0C015AB4 */ jal osRecvMesg +/* 33A0 800027A0 24060001 */ addiu $a2, $zero, 0x1 +/* 33A4 800027A4 3C03800A */ lui $v1, %hi(D_800A6070) +/* 33A8 800027A8 24636070 */ addiu $v1, $v1, %lo(D_800A6070) +/* 33AC 800027AC 8C6E001C */ lw $t6, 0x1C($v1) +/* 33B0 800027B0 8C6F0028 */ lw $t7, 0x28($v1) +/* 33B4 800027B4 8C78002C */ lw $t8, 0x2C($v1) +/* 33B8 800027B8 24040010 */ addiu $a0, $zero, 0x10 +/* 33BC 800027BC 00002825 */ or $a1, $zero, $zero +/* 33C0 800027C0 AFAE0018 */ sw $t6, 0x18($sp) +/* 33C4 800027C4 AFAF0020 */ sw $t7, 0x20($sp) +/* 33C8 800027C8 0C0008E0 */ jal func_80002380 +/* 33CC 800027CC AFB8001C */ sw $t8, 0x1C($sp) +/* 33D0 800027D0 3C03800A */ lui $v1, %hi(D_800A6070) +/* 33D4 800027D4 1040000D */ beqz $v0, .L8000280C +/* 33D8 800027D8 24636070 */ addiu $v1, $v1, %lo(D_800A6070) +/* 33DC 800027DC 8FB90028 */ lw $t9, 0x28($sp) +/* 33E0 800027E0 3C01800A */ lui $at, %hi(D_800A60A0) +/* 33E4 800027E4 AC59FFFC */ sw $t9, -0x4($v0) +/* 33E8 800027E8 8C680030 */ lw $t0, 0x30($v1) +/* 33EC 800027EC AC48000C */ sw $t0, 0xC($v0) +/* 33F0 800027F0 8FA90018 */ lw $t1, 0x18($sp) +/* 33F4 800027F4 AC490000 */ sw $t1, 0x0($v0) +/* 33F8 800027F8 8FAA0020 */ lw $t2, 0x20($sp) +/* 33FC 800027FC AC4A0004 */ sw $t2, 0x4($v0) +/* 3400 80002800 8FAB001C */ lw $t3, 0x1C($sp) +/* 3404 80002804 AC4B0008 */ sw $t3, 0x8($v0) +/* 3408 80002808 AC2260A0 */ sw $v0, %lo(D_800A60A0)($at) +.L8000280C: +/* 340C 8000280C 3C04800A */ lui $a0, %hi(D_800A6074) +/* 3410 80002810 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 3414 80002814 00002825 */ or $a1, $zero, $zero +/* 3418 80002818 0C015A30 */ jal osSendMesg +/* 341C 8000281C 00003025 */ or $a2, $zero, $zero +/* 3420 80002820 0C0009D9 */ jal func_80002764 +/* 3424 80002824 00000000 */ nop +/* 3428 80002828 8FBF0014 */ lw $ra, 0x14($sp) +/* 342C 8000282C 27BD0028 */ addiu $sp, $sp, 0x28 +/* 3430 80002830 03E00008 */ jr $ra +/* 3434 80002834 00000000 */ nop + diff --git a/src/nonmatchings/intro_loader/func_80002838.s b/src/nonmatchings/intro_loader/func_80002838.s new file mode 100644 index 0000000..61998e8 --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002838.s @@ -0,0 +1,86 @@ +.section .text +glabel func_80002838 +/* 3438 80002838 27BDFFD8 */ addiu $sp, $sp, -0x28 +/* 343C 8000283C AFB00014 */ sw $s0, 0x14($sp) +/* 3440 80002840 00808025 */ or $s0, $a0, $zero +/* 3444 80002844 AFBF0024 */ sw $ra, 0x24($sp) +/* 3448 80002848 3C04800A */ lui $a0, %hi(D_800A6074) +/* 344C 8000284C AFB30020 */ sw $s3, 0x20($sp) +/* 3450 80002850 AFB2001C */ sw $s2, 0x1C($sp) +/* 3454 80002854 AFB10018 */ sw $s1, 0x18($sp) +/* 3458 80002858 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 345C 8000285C 00002825 */ or $a1, $zero, $zero +/* 3460 80002860 0C015AB4 */ jal osRecvMesg +/* 3464 80002864 24060001 */ addiu $a2, $zero, 0x1 +/* 3468 80002868 3C03800A */ lui $v1, %hi(D_800A60A0) +/* 346C 8000286C 3C11800A */ lui $s1, %hi(D_800A6070) +/* 3470 80002870 26316070 */ addiu $s1, $s1, %lo(D_800A6070) +/* 3474 80002874 8C6360A0 */ lw $v1, %lo(D_800A60A0)($v1) +.L80002878: +/* 3478 80002878 8C6E0000 */ lw $t6, 0x0($v1) +/* 347C 8000287C 8C720004 */ lw $s2, 0x4($v1) +/* 3480 80002880 8C730008 */ lw $s3, 0x8($v1) +/* 3484 80002884 AE2E001C */ sw $t6, 0x1C($s1) +/* 3488 80002888 8C6F000C */ lw $t7, 0xC($v1) +/* 348C 8000288C 2462FFF0 */ addiu $v0, $v1, -0x10 +/* 3490 80002890 12000006 */ beqz $s0, .L800028AC +/* 3494 80002894 AE2F0030 */ sw $t7, 0x30($s1) +/* 3498 80002898 8C58000C */ lw $t8, 0xC($v0) +/* 349C 8000289C 52180004 */ beql $s0, $t8, .L800028B0 +/* 34A0 800028A0 8E30002C */ lw $s0, 0x2C($s1) +/* 34A4 800028A4 15E0FFF4 */ bnez $t7, .L80002878 +/* 34A8 800028A8 01E01825 */ or $v1, $t7, $zero +.L800028AC: +/* 34AC 800028AC 8E30002C */ lw $s0, 0x2C($s1) +.L800028B0: +/* 34B0 800028B0 0213082B */ sltu $at, $s0, $s3 +/* 34B4 800028B4 5020000C */ beql $at, $zero, .L800028E8 +/* 34B8 800028B8 8E390028 */ lw $t9, 0x28($s1) +/* 34BC 800028BC 8E020008 */ lw $v0, 0x8($s0) +.L800028C0: +/* 34C0 800028C0 26040010 */ addiu $a0, $s0, 0x10 +/* 34C4 800028C4 50400004 */ beql $v0, $zero, .L800028D8 +/* 34C8 800028C8 8E100004 */ lw $s0, 0x4($s0) +/* 34CC 800028CC 0040F809 */ jalr $v0 +/* 34D0 800028D0 8E05000C */ lw $a1, 0xC($s0) +/* 34D4 800028D4 8E100004 */ lw $s0, 0x4($s0) +.L800028D8: +/* 34D8 800028D8 0213082B */ sltu $at, $s0, $s3 +/* 34DC 800028DC 5420FFF8 */ bnel $at, $zero, .L800028C0 +/* 34E0 800028E0 8E020008 */ lw $v0, 0x8($s0) +/* 34E4 800028E4 8E390028 */ lw $t9, 0x28($s1) +.L800028E8: +/* 34E8 800028E8 8F300000 */ lw $s0, 0x0($t9) +/* 34EC 800028EC 0212082B */ sltu $at, $s0, $s2 +/* 34F0 800028F0 1420000B */ bnez $at, .L80002920 +/* 34F4 800028F4 00000000 */ nop +/* 34F8 800028F8 8E020008 */ lw $v0, 0x8($s0) +.L800028FC: +/* 34FC 800028FC 26040010 */ addiu $a0, $s0, 0x10 +/* 3500 80002900 50400004 */ beql $v0, $zero, .L80002914 +/* 3504 80002904 8E100000 */ lw $s0, 0x0($s0) +/* 3508 80002908 0040F809 */ jalr $v0 +/* 350C 8000290C 8E05000C */ lw $a1, 0xC($s0) +/* 3510 80002910 8E100000 */ lw $s0, 0x0($s0) +.L80002914: +/* 3514 80002914 0212082B */ sltu $at, $s0, $s2 +/* 3518 80002918 5020FFF8 */ beql $at, $zero, .L800028FC +/* 351C 8000291C 8E020008 */ lw $v0, 0x8($s0) +.L80002920: +/* 3520 80002920 3C04800A */ lui $a0, %hi(D_800A6074) +/* 3524 80002924 AE320028 */ sw $s2, 0x28($s1) +/* 3528 80002928 AE33002C */ sw $s3, 0x2C($s1) +/* 352C 8000292C 24846074 */ addiu $a0, $a0, %lo(D_800A6074) +/* 3530 80002930 00002825 */ or $a1, $zero, $zero +/* 3534 80002934 0C015A30 */ jal osSendMesg +/* 3538 80002938 00003025 */ or $a2, $zero, $zero +/* 353C 8000293C 0C0009D9 */ jal func_80002764 +/* 3540 80002940 00000000 */ nop +/* 3544 80002944 8FBF0024 */ lw $ra, 0x24($sp) +/* 3548 80002948 8FB00014 */ lw $s0, 0x14($sp) +/* 354C 8000294C 8FB10018 */ lw $s1, 0x18($sp) +/* 3550 80002950 8FB2001C */ lw $s2, 0x1C($sp) +/* 3554 80002954 8FB30020 */ lw $s3, 0x20($sp) +/* 3558 80002958 03E00008 */ jr $ra +/* 355C 8000295C 27BD0028 */ addiu $sp, $sp, 0x28 + diff --git a/src/nonmatchings/intro_loader/func_80002960.s b/src/nonmatchings/intro_loader/func_80002960.s new file mode 100644 index 0000000..320a647 --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002960.s @@ -0,0 +1,58 @@ +.section .text +glabel func_80002960 +/* 3560 80002960 3C07800A */ lui $a3, %hi(D_800A6070) +/* 3564 80002964 24E76070 */ addiu $a3, $a3, %lo(D_800A6070) +/* 3568 80002968 8CEE0028 */ lw $t6, 0x28($a3) +/* 356C 8000296C 00A03025 */ or $a2, $a1, $zero +/* 3570 80002970 8DC20000 */ lw $v0, 0x0($t6) +/* 3574 80002974 10400010 */ beqz $v0, .L800029B8 +/* 3578 80002978 24430010 */ addiu $v1, $v0, 0x10 +.L8000297C: +/* 357C 8000297C 0083082B */ sltu $at, $a0, $v1 +/* 3580 80002980 1420000A */ bnez $at, .L800029AC +/* 3584 80002984 8C450004 */ lw $a1, 0x4($v0) +/* 3588 80002988 0085082B */ sltu $at, $a0, $a1 +/* 358C 8000298C 50200008 */ beql $at, $zero, .L800029B0 +/* 3590 80002990 8C420000 */ lw $v0, 0x0($v0) +/* 3594 80002994 10C00003 */ beqz $a2, .L800029A4 +/* 3598 80002998 00000000 */ nop +/* 359C 8000299C 8C4F000C */ lw $t7, 0xC($v0) +/* 35A0 800029A0 ACCF0000 */ sw $t7, 0x0($a2) +.L800029A4: +/* 35A4 800029A4 03E00008 */ jr $ra +/* 35A8 800029A8 00601025 */ or $v0, $v1, $zero +.L800029AC: +/* 35AC 800029AC 8C420000 */ lw $v0, 0x0($v0) +.L800029B0: +/* 35B0 800029B0 5440FFF2 */ bnel $v0, $zero, .L8000297C +/* 35B4 800029B4 24430010 */ addiu $v1, $v0, 0x10 +.L800029B8: +/* 35B8 800029B8 8CE2002C */ lw $v0, 0x2C($a3) +/* 35BC 800029BC 8C450004 */ lw $a1, 0x4($v0) +/* 35C0 800029C0 10A00011 */ beqz $a1, .L80002A08 +/* 35C4 800029C4 24430010 */ addiu $v1, $v0, 0x10 +.L800029C8: +/* 35C8 800029C8 0083082B */ sltu $at, $a0, $v1 +/* 35CC 800029CC 1420000A */ bnez $at, .L800029F8 +/* 35D0 800029D0 00A03825 */ or $a3, $a1, $zero +/* 35D4 800029D4 0087082B */ sltu $at, $a0, $a3 +/* 35D8 800029D8 50200008 */ beql $at, $zero, .L800029FC +/* 35DC 800029DC 00A01025 */ or $v0, $a1, $zero +/* 35E0 800029E0 10C00003 */ beqz $a2, .L800029F0 +/* 35E4 800029E4 00000000 */ nop +/* 35E8 800029E8 8C58000C */ lw $t8, 0xC($v0) +/* 35EC 800029EC ACD80000 */ sw $t8, 0x0($a2) +.L800029F0: +/* 35F0 800029F0 03E00008 */ jr $ra +/* 35F4 800029F4 00601025 */ or $v0, $v1, $zero +.L800029F8: +/* 35F8 800029F8 00A01025 */ or $v0, $a1, $zero +.L800029FC: +/* 35FC 800029FC 8CA50004 */ lw $a1, 0x4($a1) +/* 3600 80002A00 54A0FFF1 */ bnel $a1, $zero, .L800029C8 +/* 3604 80002A04 24430010 */ addiu $v1, $v0, 0x10 +.L80002A08: +/* 3608 80002A08 00001025 */ or $v0, $zero, $zero +/* 360C 80002A0C 03E00008 */ jr $ra +/* 3610 80002A10 00000000 */ nop + diff --git a/src/nonmatchings/intro_loader/func_80002A14.s b/src/nonmatchings/intro_loader/func_80002A14.s new file mode 100644 index 0000000..101616d --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002A14.s @@ -0,0 +1,7 @@ +.section .text +glabel func_80002A14 +/* 3614 80002A14 2482FFF0 */ addiu $v0, $a0, -0x10 +/* 3618 80002A18 AC460008 */ sw $a2, 0x8($v0) +/* 361C 80002A1C 03E00008 */ jr $ra +/* 3620 80002A20 AC45000C */ sw $a1, 0xC($v0) + diff --git a/src/nonmatchings/intro_loader/func_80002A24.s b/src/nonmatchings/intro_loader/func_80002A24.s new file mode 100644 index 0000000..ce0d247 --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002A24.s @@ -0,0 +1,6 @@ +.section .text +glabel func_80002A24 +/* 3624 80002A24 8C8EFFF4 */ lw $t6, -0xC($a0) +/* 3628 80002A28 03E00008 */ jr $ra +/* 362C 80002A2C 01C41023 */ subu $v0, $t6, $a0 + diff --git a/src/nonmatchings/intro_loader/func_80002A30.s b/src/nonmatchings/intro_loader/func_80002A30.s new file mode 100644 index 0000000..0cd313d --- /dev/null +++ b/src/nonmatchings/intro_loader/func_80002A30.s @@ -0,0 +1,6 @@ +.section .text +glabel func_80002A30 +/* 3630 80002A30 3C02800A */ lui $v0, %hi(D_800A6070) +/* 3634 80002A34 03E00008 */ jr $ra +/* 3638 80002A38 24426070 */ addiu $v0, $v0, %lo(D_800A6070) +/* 363C 80002A3C 00000000 */ nop From b941b0c9ecfd46752b29ce31ef328bbd2fe1cb3c Mon Sep 17 00:00:00 2001 From: tehzz Date: Sun, 1 Jan 2023 13:14:11 -0500 Subject: [PATCH 03/10] update diff setting --- diff_settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diff_settings.py b/diff_settings.py index cc62fa5..7b9d48b 100644 --- a/diff_settings.py +++ b/diff_settings.py @@ -2,6 +2,6 @@ def apply(config, args): config['baseimg'] = 'baserom.z64' - config['myimg'] = 'pokemonstadium.z64' - config['mapfile'] = 'build/pokemonstadium.map' + config['myimg'] = 'build/pokestadium.z64' + config['mapfile'] = 'build/pokestadium.map' config['source_directories'] = ['.'] From ad5e633e72845cdc3734c69bbb6fe9a1b95fa858 Mon Sep 17 00:00:00 2001 From: tehzz Date: Sun, 1 Jan 2023 13:14:39 -0500 Subject: [PATCH 04/10] add asmproc make dep files --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d6510c5..dc36526 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,9 @@ O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.c.o)) \ $(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.s.o)) \ $(foreach file,$(DATA_FILES),$(BUILD_DIR)/$(file:.bin=.bin.o)) \ -DEP_FILES := $(O_FILES:.o=.d) +DECOMP_C_OBJS := $(filter %.c.o,$(filter-out $(BUILD_DIR)/src/libultra%,$(O_FILES))) + +DEP_FILES := $(O_FILES:.o=.d) $(DECOMP_C_OBJS:.o=.asmproc.d) SPLAT_YAML := splat.yaml SPLAT = $(PYTHON) tools/n64splat/split.py $(SPLAT_YAML) @@ -245,7 +247,6 @@ build/src/libultra/io/gbpakreadwrite.c.o: CC := $(CC_OLD) build/src/libultra/io/gbpakselectbank.c.o: CC := $(CC_OLD) # run ASM-processor on non-libultra source files -DECOMP_C_OBJS := $(filter %.c.o,$(filter-out $(BUILD_DIR)/src/libultra%,$(O_FILES))) $(DECOMP_C_OBJS): CC := $(ASMPROC) $(ASMPROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- # turn off syntax checking errors for libultra From 6378b31f002ee19efe6ad6f03d8fecb5c28a7fe0 Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 5 Jan 2023 20:15:54 -0500 Subject: [PATCH 05/10] decomp function in intro_loader --- .gitignore | 3 + src/intro_loader.c | 371 +++++++++++++++--- src/nonmatchings/intro_loader/func_800022C0.s | 51 --- src/nonmatchings/intro_loader/func_80002380.s | 49 --- src/nonmatchings/intro_loader/func_8000254C.s | 34 -- src/nonmatchings/intro_loader/func_800025C4.s | 26 -- src/nonmatchings/intro_loader/func_80002620.s | 28 -- src/nonmatchings/intro_loader/func_80002764.s | 12 - src/nonmatchings/intro_loader/func_80002784.s | 49 --- src/nonmatchings/intro_loader/func_80002838.s | 86 ---- src/nonmatchings/intro_loader/func_80002A14.s | 7 - src/nonmatchings/intro_loader/func_80002A24.s | 6 - src/nonmatchings/intro_loader/func_80002A30.s | 6 - 13 files changed, 326 insertions(+), 402 deletions(-) delete mode 100644 src/nonmatchings/intro_loader/func_800022C0.s delete mode 100644 src/nonmatchings/intro_loader/func_80002380.s delete mode 100644 src/nonmatchings/intro_loader/func_8000254C.s delete mode 100644 src/nonmatchings/intro_loader/func_800025C4.s delete mode 100644 src/nonmatchings/intro_loader/func_80002620.s delete mode 100644 src/nonmatchings/intro_loader/func_80002764.s delete mode 100644 src/nonmatchings/intro_loader/func_80002784.s delete mode 100644 src/nonmatchings/intro_loader/func_80002838.s delete mode 100644 src/nonmatchings/intro_loader/func_80002A14.s delete mode 100644 src/nonmatchings/intro_loader/func_80002A24.s delete mode 100644 src/nonmatchings/intro_loader/func_80002A30.s diff --git a/.gitignore b/.gitignore index 066f646..7415e30 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ undefined_syms_auto.txt # qemu-irix compilers tools/ido5.3_compiler/ tools/ido7.1_compiler/ + +# diffing directory +expected/ diff --git a/src/intro_loader.c b/src/intro_loader.c index 3d9a0de..4abbd51 100644 --- a/src/intro_loader.c +++ b/src/intro_loader.c @@ -1,75 +1,350 @@ -#include +#include +#include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunknown-pragmas" -#ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_800022C0.s") -#endif +struct UnkNodeThing { + /* 0x00 */ struct UnkNodeThing *unk00; + /* 0x04 */ struct UnkNodeThing *unk04; + // this looks like it can be any type of pointer? + // or are there multiple list node types in a union? + /* 0x08 */ void (*unk08)(struct UnkNodeThing *, s32); + /* 0x0C */ s32 unk0C; +}; // sizeof == 0x10 -#ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002380.s") -#endif +// "known" types for +08 and +0C: +// fn pointer +// void (*unk08)(struct UnkNodeThing *, s32 +// s32 unk0C +// more nodes +// struct UnkNodeThing *unk08 +// struct UnkNodeThing *unk0C + +struct Unk800A6070 { + /* 0x00 */ OSMesg msgs[1]; + /* 0x04 */ OSMesgQueue queue; + /* 0x1C */ uintptr_t unk1C; + // these pointers are all probably to a 4 member struct? + /* 0x20 */ struct UnkNodeThing *unk20; + /* 0x24 */ struct UnkNodeThing *unk24; + /* 0x28 */ struct UnkNodeThing *unk28; + /* 0x2C */ struct UnkNodeThing *unk2C; + /* 0x30 */ struct UnkNodeThing *unk30; +}; // sizeof >= 0x34 + +extern struct Unk800A6070 D_800A6070; +// D_800A6074 is 0x04 queue; +// D_800A608C is field 0x1C of above; + + +void func_800022C0(void *arg0, void *arg1) { + D_800A6070.unk20 = (void *)(ALIGN16((uintptr_t)arg0) + 0x10); + D_800A6070.unk24 = (void *)(((uintptr_t)arg1 & ~0xF) - 0x10); + D_800A6070.unk1C = (uintptr_t)D_800A6070.unk24 - (uintptr_t)D_800A6070.unk20; + D_800A6070.unk30 = NULL; + + D_800A6070.unk28 = D_800A6070.unk20 - 1; + D_800A6070.unk28->unk00 = NULL; + D_800A6070.unk28->unk04 = NULL; + D_800A6070.unk28->unk08 = NULL; + D_800A6070.unk28->unk0C = 0; + + D_800A6070.unk2C = D_800A6070.unk24; + D_800A6070.unk2C->unk00 = NULL; + D_800A6070.unk2C->unk04 = NULL; + D_800A6070.unk28->unk08 = NULL; + D_800A6070.unk28->unk0C = 0; + + osCreateMesgQueue(&D_800A6070.queue, D_800A6070.msgs, ARRAY_COUNT(D_800A6070.msgs)); + osSendMesg(&D_800A6070.queue, NULL, OS_MESG_NOBLOCK); +} + +struct UnkNodeThing *func_80002380(u32 arg0, s32 arg1) { + struct UnkNodeThing *node; + struct UnkNodeThing *ret; + + arg0 = ALIGN16(arg0) + sizeof(struct UnkNodeThing); + ret = NULL; + if ((arg0 != 0) && (D_800A6070.unk1C >= (uintptr_t)arg0)) { + if (arg1 == 0) { + D_800A6070.unk1C -= (uintptr_t)arg0; + node = (void *)((uintptr_t)D_800A6070.unk28 + (uintptr_t)arg0); + D_800A6070.unk28->unk04 = node; + node->unk00 = D_800A6070.unk28; + node->unk04 = NULL; + node->unk08 = 0; + node->unk0C = 0; + ret = D_800A6070.unk28; + D_800A6070.unk28 = node; + ret = ret + 1; + } else if (arg1 == 1) { + D_800A6070.unk1C -= (uintptr_t)arg0; + node = (void *)((uintptr_t)D_800A6070.unk2C - (uintptr_t)arg0); + D_800A6070.unk2C->unk00 = node; + node->unk04 = D_800A6070.unk2C; + node->unk00 = NULL; + node->unk08 = 0; + node->unk0C = 0; + D_800A6070.unk2C = node; + ret = node + 1; + } + } + return ret; +} + +uintptr_t func_80002764(void); +uintptr_t func_80002430(struct UnkNodeThing *arg0, s32 arg1); + +#ifdef NON_MATCHING +uintptr_t func_80002430(struct UnkNodeThing *arg0, s32 arg1) { + // struct UnkNodeThing *node; + struct UnkNodeThing *otherNode; + struct UnkNodeThing *prev; + uintptr_t priorAddr; + + priorAddr = (uintptr_t)(arg0 - 1); // v1 + + if (priorAddr < (uintptr_t)D_800A6070.unk28) { + do { + prev = D_800A6070.unk28->unk00; // t6 + D_800A6070.unk28 = prev; + if (arg1) { + if (prev->unk08 != NULL) { + prev->unk08(prev + 1, prev->unk0C); + } + } + D_800A6070.unk1C = D_800A6070.unk1C + (uintptr_t)D_800A6070.unk28->unk04 - (uintptr_t)D_800A6070.unk28; + D_800A6070.unk28->unk04 = NULL; + } while (priorAddr != (uintptr_t)D_800A6070.unk28); + } else { + otherNode = D_800A6070.unk2C; + if (priorAddr >= (uintptr_t)otherNode && priorAddr >= (uintptr_t)otherNode) { + do { + if (arg1) { + if (otherNode->unk08 != NULL) { + otherNode->unk08(otherNode + 1, otherNode->unk0C); + otherNode = D_800A6070.unk2C; + } + } + prev = otherNode->unk04; + D_800A6070.unk2C = prev; + D_800A6070.unk1C = D_800A6070.unk1C + (uintptr_t)prev - (uintptr_t)prev->unk00; + prev->unk00 = NULL; + otherNode = D_800A6070.unk2C; + } while (priorAddr >= (uintptr_t)otherNode); + } + } + + return func_80002764(); +} -#ifdef MIPS_TO_C #else #pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002430.s") #endif -#ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_8000254C.s") -#endif +void func_80002A14(struct UnkNodeThing *, s32, void *); -#ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_800025C4.s") -#endif +struct UnkNodeThing *func_8000254C(u32 arg0, s32 arg1, s32 arg2, void *arg3) { + struct UnkNodeThing *node; -#ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002620.s") -#endif + osRecvMesg(&D_800A6070.queue, NULL, OS_MESG_BLOCK); + node = func_80002380(arg0, arg1); + if (node != NULL) { + func_80002A14(node, arg2, arg3); + } + osSendMesg(&D_800A6070.queue, NULL, OS_MESG_NOBLOCK); + + return node; +} -#ifdef MIPS_TO_C +struct UnkNodeThing *func_800025C4(u32 arg0, s32 arg1) { + struct UnkNodeThing *node; + + osRecvMesg(&D_800A6070.queue, NULL, OS_MESG_BLOCK); + node = func_80002380(arg0, arg1); + osSendMesg(&D_800A6070.queue, NULL, OS_MESG_NOBLOCK); + return node; +} + +void func_80002620(struct UnkNodeThing *arg0) { + if (arg0 != NULL) { + osRecvMesg(&D_800A6070.queue, NULL, OS_MESG_BLOCK); + func_80002430(arg0, 1); + osSendMesg(&D_800A6070.queue, NULL, OS_MESG_NOBLOCK); + } + func_80002764(); +} + +struct UnkNodeThing *func_80002680(struct UnkNodeThing *arg0, uintptr_t arg1); +#ifdef NON_MATCHING +struct UnkNodeThing *func_80002680(struct UnkNodeThing *arg0, uintptr_t arg1) { + uintptr_t diff; + struct UnkNodeThing *sp28; + struct UnkNodeThing *prior; + struct UnkNodeThing *priorPrev; + s32 sp20; + void *sp1C; + + + sp28 = NULL; + osRecvMesg(&D_800A6070.queue, NULL, OS_MESG_BLOCK); + // temp_v1 = arg0 - 0x10; + prior = arg0 - 1; + // temp_a0 = temp_v1->unk4; + priorPrev = prior->unk04; + // temp_v0 = temp_a0 - arg0; + diff = (uintptr_t)priorPrev - (uintptr_t)arg0; + + if (D_800A6070.unk28 == priorPrev) { + // uintptr_t aligned; + + // temp_a3 = (arg1 + 0xF) & ~0xF; + // aligned = ALIGN16(arg1); + arg1 = ALIGN16(arg1); + // if (temp_v0 < temp_a3) { + if (diff >= arg1 || D_800A6070.unk1C >= (arg1 - diff)) { + sp20 = prior->unk0C; + sp1C = prior->unk08; + func_80002430(arg0, 0); + sp28 = func_80002380(arg1, 0); + func_80002A14(sp28, sp20, sp1C); + } + } + osSendMesg(&D_800A6070.queue, NULL, OS_MESG_NOBLOCK); + return sp28; +} #else #pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002680.s") #endif -#ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002764.s") -#endif +// this is a weird type, so maybe it should be cast into UnkNodeThing? +uintptr_t func_80002764(void) { + s32 val = (s32)D_800A6070.unk1C - sizeof(struct UnkNodeThing); + + if (val < 0) { + val = 0; + } + + return val; +} + +void func_80002784(s32 arg0) { + struct UnkNodeThing *node; + struct UnkNodeThing *sp20; // prev? + struct UnkNodeThing *sp1C; // data? + uintptr_t sp18; // next? + + osRecvMesg(&D_800A6070.queue, NULL, OS_MESG_BLOCK); + sp18 = D_800A6070.unk1C; + sp20 = D_800A6070.unk28; + sp1C = D_800A6070.unk2C; + node = func_80002380(0x10, 0); + if (node != NULL) { + (node-1)->unk0C = arg0; + node->unk0C = (uintptr_t)D_800A6070.unk30; + node->unk00 = (struct UnkNodeThing *) sp18; + node->unk04 = sp20; + node->unk08 = (void *) sp1C; + D_800A6070.unk30 = node; + } + osSendMesg(&D_800A6070.queue, NULL, OS_MESG_NOBLOCK); + func_80002764(); +} + +void func_80002838(struct UnkNodeThing *arg0) { + struct UnkNodeThing *node; + struct UnkNodeThing *s0; + void *s2, *s3; + + s0 = arg0; + osRecvMesg(&D_800A6070.queue, NULL, OS_MESG_BLOCK); + while (TRUE) { + node = D_800A6070.unk30; + s2 = node->unk04; + s3 = node->unk08; + D_800A6070.unk1C = (uintptr_t)node->unk00; + D_800A6070.unk30 = INT2VOID(node->unk0C); + + if (s0 == NULL) { break; } + // odd non-matching, but it works + node = node - 1; + if ((uintptr_t)s0 == (uintptr_t)node->unk0C) { break; } + if (D_800A6070.unk30 == NULL) { break; } + } + + s0 = D_800A6070.unk2C; + while ((uintptr_t)s3 > (uintptr_t)s0) { + if (s0->unk08 != NULL) { + s0->unk08(s0 + 1, s0->unk0C); + } + s0 = s0->unk04; + } + + s0 = D_800A6070.unk28->unk00; + while ((uintptr_t)s2 <= (uintptr_t)s0) { + if (s0->unk08 != NULL) { + s0->unk08(s0 + 1, s0->unk0C); + } + s0 = s0->unk00; + } + + D_800A6070.unk28 = s2; + D_800A6070.unk2C = s3; + osSendMesg(&D_800A6070.queue, NULL, OS_MESG_NOBLOCK); + func_80002764(); +} #ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002784.s") -#endif +struct UnkNodeThing *func_80002960(uintptr_t arg0, s32 *arg1) { + struct UnkNodeThing *node; // v0? + struct UnkNodeThing *otherNode; -#ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002838.s") -#endif - -#ifdef MIPS_TO_C + node = D_800A6070.unk28->unk00; + while (node != NULL) { + otherNode = node->unk04; + if (arg0 >= (uintptr_t)(node + 1) && arg0 < (uintptr_t)otherNode) { + if (arg1 != NULL) { + *arg1 = node->unk0C; + } + return (node + 1); + } + node = node->unk00; + } + // L800029B8 + node = D_800A6070.unk2C; + otherNode = node->unk04; + while (otherNode != NULL) { + if (arg0 >= (uintptr_t)(node + 1) && arg0 < (uintptr_t)otherNode) { + if (arg1 != NULL) { + *arg1 = node->unk0C; + } + return node + 1; + } + node = otherNode; + otherNode = otherNode->unk04; + } + // L80002A08 + return NULL; +} #else #pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002960.s") #endif -#ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002A14.s") -#endif +void func_80002A14(struct UnkNodeThing *arg0, s32 arg1, void *arg2) { + struct UnkNodeThing *node = INT2VOID((uintptr_t)arg0 - sizeof(struct UnkNodeThing)); + node->unk08 = arg2; + node->unk0C = arg1; +} -#ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002A24.s") -#endif +uintptr_t func_80002A24(struct UnkNodeThing *arg0) { + struct UnkNodeThing *prior = arg0 - 1; + + return (uintptr_t)prior->unk04 - (uintptr_t)arg0; +} + +struct Unk800A6070 *func_80002A30(void) { + return &D_800A6070; +} -#ifdef MIPS_TO_C -#else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002A30.s") -#endif #pragma GCC diagnostic pop diff --git a/src/nonmatchings/intro_loader/func_800022C0.s b/src/nonmatchings/intro_loader/func_800022C0.s deleted file mode 100644 index 7fabc0a..0000000 --- a/src/nonmatchings/intro_loader/func_800022C0.s +++ /dev/null @@ -1,51 +0,0 @@ -.section .text -glabel func_800022C0 -/* 2EC0 800022C0 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 2EC4 800022C4 AFA5001C */ sw $a1, 0x1C($sp) -/* 2EC8 800022C8 8FB9001C */ lw $t9, 0x1C($sp) -/* 2ECC 800022CC 3C05800A */ lui $a1, %hi(D_800A6070) -/* 2ED0 800022D0 24A56070 */ addiu $a1, $a1, %lo(D_800A6070) -/* 2ED4 800022D4 2403FFF0 */ addiu $v1, $zero, -0x10 -/* 2ED8 800022D8 248E000F */ addiu $t6, $a0, 0xF -/* 2EDC 800022DC 01C37824 */ and $t7, $t6, $v1 -/* 2EE0 800022E0 25F80010 */ addiu $t8, $t7, 0x10 -/* 2EE4 800022E4 03234024 */ and $t0, $t9, $v1 -/* 2EE8 800022E8 2509FFF0 */ addiu $t1, $t0, -0x10 -/* 2EEC 800022EC 01385823 */ subu $t3, $t1, $t8 -/* 2EF0 800022F0 270CFFF0 */ addiu $t4, $t8, -0x10 -/* 2EF4 800022F4 AFBF0014 */ sw $ra, 0x14($sp) -/* 2EF8 800022F8 ACB80020 */ sw $t8, 0x20($a1) -/* 2EFC 800022FC ACA90024 */ sw $t1, 0x24($a1) -/* 2F00 80002300 ACAB001C */ sw $t3, 0x1C($a1) -/* 2F04 80002304 ACA00030 */ sw $zero, 0x30($a1) -/* 2F08 80002308 ACAC0028 */ sw $t4, 0x28($a1) -/* 2F0C 8000230C AD800000 */ sw $zero, 0x0($t4) -/* 2F10 80002310 8CAE0028 */ lw $t6, 0x28($a1) -/* 2F14 80002314 3C04800A */ lui $a0, %hi(D_800A6074) -/* 2F18 80002318 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 2F1C 8000231C ADC00004 */ sw $zero, 0x4($t6) -/* 2F20 80002320 8CAF0028 */ lw $t7, 0x28($a1) -/* 2F24 80002324 24060001 */ addiu $a2, $zero, 0x1 -/* 2F28 80002328 ADE00008 */ sw $zero, 0x8($t7) -/* 2F2C 8000232C 8CB80028 */ lw $t8, 0x28($a1) -/* 2F30 80002330 AF00000C */ sw $zero, 0xC($t8) -/* 2F34 80002334 8CB90024 */ lw $t9, 0x24($a1) -/* 2F38 80002338 ACB9002C */ sw $t9, 0x2C($a1) -/* 2F3C 8000233C AF200000 */ sw $zero, 0x0($t9) -/* 2F40 80002340 8CA9002C */ lw $t1, 0x2C($a1) -/* 2F44 80002344 AD200004 */ sw $zero, 0x4($t1) -/* 2F48 80002348 8CAA0028 */ lw $t2, 0x28($a1) -/* 2F4C 8000234C AD400008 */ sw $zero, 0x8($t2) -/* 2F50 80002350 8CAB0028 */ lw $t3, 0x28($a1) -/* 2F54 80002354 0C0178E8 */ jal osCreateMesgQueue -/* 2F58 80002358 AD60000C */ sw $zero, 0xC($t3) -/* 2F5C 8000235C 3C04800A */ lui $a0, %hi(D_800A6074) -/* 2F60 80002360 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 2F64 80002364 00002825 */ or $a1, $zero, $zero -/* 2F68 80002368 0C015A30 */ jal osSendMesg -/* 2F6C 8000236C 00003025 */ or $a2, $zero, $zero -/* 2F70 80002370 8FBF0014 */ lw $ra, 0x14($sp) -/* 2F74 80002374 27BD0018 */ addiu $sp, $sp, 0x18 -/* 2F78 80002378 03E00008 */ jr $ra -/* 2F7C 8000237C 00000000 */ nop - diff --git a/src/nonmatchings/intro_loader/func_80002380.s b/src/nonmatchings/intro_loader/func_80002380.s deleted file mode 100644 index c441206..0000000 --- a/src/nonmatchings/intro_loader/func_80002380.s +++ /dev/null @@ -1,49 +0,0 @@ -.section .text -glabel func_80002380 -/* 2F80 80002380 2484000F */ addiu $a0, $a0, 0xF -/* 2F84 80002384 2401FFF0 */ addiu $at, $zero, -0x10 -/* 2F88 80002388 00812024 */ and $a0, $a0, $at -/* 2F8C 8000238C 24840010 */ addiu $a0, $a0, 0x10 -/* 2F90 80002390 10800025 */ beqz $a0, .L80002428 -/* 2F94 80002394 00001825 */ or $v1, $zero, $zero -/* 2F98 80002398 3C07800A */ lui $a3, %hi(D_800A6070) -/* 2F9C 8000239C 24E76070 */ addiu $a3, $a3, %lo(D_800A6070) -/* 2FA0 800023A0 8CE2001C */ lw $v0, 0x1C($a3) -/* 2FA4 800023A4 0044082B */ sltu $at, $v0, $a0 -/* 2FA8 800023A8 1420001F */ bnez $at, .L80002428 -/* 2FAC 800023AC 00000000 */ nop -/* 2FB0 800023B0 14A0000F */ bnez $a1, .L800023F0 -/* 2FB4 800023B4 24010001 */ addiu $at, $zero, 0x1 -/* 2FB8 800023B8 8CE60028 */ lw $a2, 0x28($a3) -/* 2FBC 800023BC 00447023 */ subu $t6, $v0, $a0 -/* 2FC0 800023C0 ACEE001C */ sw $t6, 0x1C($a3) -/* 2FC4 800023C4 00C42821 */ addu $a1, $a2, $a0 -/* 2FC8 800023C8 ACC50004 */ sw $a1, 0x4($a2) -/* 2FCC 800023CC 8CEF0028 */ lw $t7, 0x28($a3) -/* 2FD0 800023D0 ACA00004 */ sw $zero, 0x4($a1) -/* 2FD4 800023D4 ACA00008 */ sw $zero, 0x8($a1) -/* 2FD8 800023D8 ACA0000C */ sw $zero, 0xC($a1) -/* 2FDC 800023DC ACAF0000 */ sw $t7, 0x0($a1) -/* 2FE0 800023E0 8CE30028 */ lw $v1, 0x28($a3) -/* 2FE4 800023E4 ACE50028 */ sw $a1, 0x28($a3) -/* 2FE8 800023E8 03E00008 */ jr $ra -/* 2FEC 800023EC 24620010 */ addiu $v0, $v1, 0x10 -.L800023F0: -/* 2FF0 800023F0 14A1000D */ bne $a1, $at, .L80002428 -/* 2FF4 800023F4 00000000 */ nop -/* 2FF8 800023F8 8CE6002C */ lw $a2, 0x2C($a3) -/* 2FFC 800023FC 0044C023 */ subu $t8, $v0, $a0 -/* 3000 80002400 ACF8001C */ sw $t8, 0x1C($a3) -/* 3004 80002404 00C42823 */ subu $a1, $a2, $a0 -/* 3008 80002408 ACC50000 */ sw $a1, 0x0($a2) -/* 300C 8000240C 8CF9002C */ lw $t9, 0x2C($a3) -/* 3010 80002410 ACA00000 */ sw $zero, 0x0($a1) -/* 3014 80002414 ACA00008 */ sw $zero, 0x8($a1) -/* 3018 80002418 ACA0000C */ sw $zero, 0xC($a1) -/* 301C 8000241C ACB90004 */ sw $t9, 0x4($a1) -/* 3020 80002420 ACE5002C */ sw $a1, 0x2C($a3) -/* 3024 80002424 24A30010 */ addiu $v1, $a1, 0x10 -.L80002428: -/* 3028 80002428 03E00008 */ jr $ra -/* 302C 8000242C 00601025 */ or $v0, $v1, $zero - diff --git a/src/nonmatchings/intro_loader/func_8000254C.s b/src/nonmatchings/intro_loader/func_8000254C.s deleted file mode 100644 index bc5bbbb..0000000 --- a/src/nonmatchings/intro_loader/func_8000254C.s +++ /dev/null @@ -1,34 +0,0 @@ -.section .text -glabel func_8000254C -/* 314C 8000254C 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 3150 80002550 AFA40020 */ sw $a0, 0x20($sp) -/* 3154 80002554 AFBF0014 */ sw $ra, 0x14($sp) -/* 3158 80002558 AFA50024 */ sw $a1, 0x24($sp) -/* 315C 8000255C AFA60028 */ sw $a2, 0x28($sp) -/* 3160 80002560 3C04800A */ lui $a0, %hi(D_800A6074) -/* 3164 80002564 AFA7002C */ sw $a3, 0x2C($sp) -/* 3168 80002568 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 316C 8000256C 24060001 */ addiu $a2, $zero, 0x1 -/* 3170 80002570 0C015AB4 */ jal osRecvMesg -/* 3174 80002574 00002825 */ or $a1, $zero, $zero -/* 3178 80002578 8FA40020 */ lw $a0, 0x20($sp) -/* 317C 8000257C 0C0008E0 */ jal func_80002380 -/* 3180 80002580 8FA50024 */ lw $a1, 0x24($sp) -/* 3184 80002584 10400005 */ beqz $v0, .L8000259C -/* 3188 80002588 AFA2001C */ sw $v0, 0x1C($sp) -/* 318C 8000258C 00402025 */ or $a0, $v0, $zero -/* 3190 80002590 8FA50028 */ lw $a1, 0x28($sp) -/* 3194 80002594 0C000A85 */ jal func_80002A14 -/* 3198 80002598 8FA6002C */ lw $a2, 0x2C($sp) -.L8000259C: -/* 319C 8000259C 3C04800A */ lui $a0, %hi(D_800A6074) -/* 31A0 800025A0 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 31A4 800025A4 00002825 */ or $a1, $zero, $zero -/* 31A8 800025A8 0C015A30 */ jal osSendMesg -/* 31AC 800025AC 00003025 */ or $a2, $zero, $zero -/* 31B0 800025B0 8FBF0014 */ lw $ra, 0x14($sp) -/* 31B4 800025B4 8FA2001C */ lw $v0, 0x1C($sp) -/* 31B8 800025B8 27BD0020 */ addiu $sp, $sp, 0x20 -/* 31BC 800025BC 03E00008 */ jr $ra -/* 31C0 800025C0 00000000 */ nop - diff --git a/src/nonmatchings/intro_loader/func_800025C4.s b/src/nonmatchings/intro_loader/func_800025C4.s deleted file mode 100644 index b239caf..0000000 --- a/src/nonmatchings/intro_loader/func_800025C4.s +++ /dev/null @@ -1,26 +0,0 @@ -.section .text -glabel func_800025C4 -/* 31C4 800025C4 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 31C8 800025C8 AFA40020 */ sw $a0, 0x20($sp) -/* 31CC 800025CC AFBF0014 */ sw $ra, 0x14($sp) -/* 31D0 800025D0 AFA50024 */ sw $a1, 0x24($sp) -/* 31D4 800025D4 3C04800A */ lui $a0, %hi(D_800A6074) -/* 31D8 800025D8 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 31DC 800025DC 00002825 */ or $a1, $zero, $zero -/* 31E0 800025E0 0C015AB4 */ jal osRecvMesg -/* 31E4 800025E4 24060001 */ addiu $a2, $zero, 0x1 -/* 31E8 800025E8 8FA40020 */ lw $a0, 0x20($sp) -/* 31EC 800025EC 0C0008E0 */ jal func_80002380 -/* 31F0 800025F0 8FA50024 */ lw $a1, 0x24($sp) -/* 31F4 800025F4 3C04800A */ lui $a0, %hi(D_800A6074) -/* 31F8 800025F8 AFA2001C */ sw $v0, 0x1C($sp) -/* 31FC 800025FC 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 3200 80002600 00002825 */ or $a1, $zero, $zero -/* 3204 80002604 0C015A30 */ jal osSendMesg -/* 3208 80002608 00003025 */ or $a2, $zero, $zero -/* 320C 8000260C 8FBF0014 */ lw $ra, 0x14($sp) -/* 3210 80002610 8FA2001C */ lw $v0, 0x1C($sp) -/* 3214 80002614 27BD0020 */ addiu $sp, $sp, 0x20 -/* 3218 80002618 03E00008 */ jr $ra -/* 321C 8000261C 00000000 */ nop - diff --git a/src/nonmatchings/intro_loader/func_80002620.s b/src/nonmatchings/intro_loader/func_80002620.s deleted file mode 100644 index 1a02282..0000000 --- a/src/nonmatchings/intro_loader/func_80002620.s +++ /dev/null @@ -1,28 +0,0 @@ -.section .text -glabel func_80002620 -/* 3220 80002620 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 3224 80002624 AFBF0014 */ sw $ra, 0x14($sp) -/* 3228 80002628 1080000F */ beqz $a0, .L80002668 -/* 322C 8000262C 00803825 */ or $a3, $a0, $zero -/* 3230 80002630 3C04800A */ lui $a0, %hi(D_800A6074) -/* 3234 80002634 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 3238 80002638 00002825 */ or $a1, $zero, $zero -/* 323C 8000263C 24060001 */ addiu $a2, $zero, 0x1 -/* 3240 80002640 0C015AB4 */ jal osRecvMesg -/* 3244 80002644 AFA70018 */ sw $a3, 0x18($sp) -/* 3248 80002648 8FA40018 */ lw $a0, 0x18($sp) -/* 324C 8000264C 0C00090C */ jal func_80002430 -/* 3250 80002650 24050001 */ addiu $a1, $zero, 0x1 -/* 3254 80002654 3C04800A */ lui $a0, %hi(D_800A6074) -/* 3258 80002658 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 325C 8000265C 00002825 */ or $a1, $zero, $zero -/* 3260 80002660 0C015A30 */ jal osSendMesg -/* 3264 80002664 00003025 */ or $a2, $zero, $zero -.L80002668: -/* 3268 80002668 0C0009D9 */ jal func_80002764 -/* 326C 8000266C 00000000 */ nop -/* 3270 80002670 8FBF0014 */ lw $ra, 0x14($sp) -/* 3274 80002674 27BD0018 */ addiu $sp, $sp, 0x18 -/* 3278 80002678 03E00008 */ jr $ra -/* 327C 8000267C 00000000 */ nop - diff --git a/src/nonmatchings/intro_loader/func_80002764.s b/src/nonmatchings/intro_loader/func_80002764.s deleted file mode 100644 index 78094ef..0000000 --- a/src/nonmatchings/intro_loader/func_80002764.s +++ /dev/null @@ -1,12 +0,0 @@ -.section .text -glabel func_80002764 -/* 3364 80002764 3C03800A */ lui $v1, %hi(D_800A608C) -/* 3368 80002768 8C63608C */ lw $v1, %lo(D_800A608C)($v1) -/* 336C 8000276C 2463FFF0 */ addiu $v1, $v1, -0x10 -/* 3370 80002770 04610002 */ bgez $v1, .L8000277C -/* 3374 80002774 00000000 */ nop -/* 3378 80002778 00001825 */ or $v1, $zero, $zero -.L8000277C: -/* 337C 8000277C 03E00008 */ jr $ra -/* 3380 80002780 00601025 */ or $v0, $v1, $zero - diff --git a/src/nonmatchings/intro_loader/func_80002784.s b/src/nonmatchings/intro_loader/func_80002784.s deleted file mode 100644 index 78d54ec..0000000 --- a/src/nonmatchings/intro_loader/func_80002784.s +++ /dev/null @@ -1,49 +0,0 @@ -.section .text -glabel func_80002784 -/* 3384 80002784 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 3388 80002788 AFA40028 */ sw $a0, 0x28($sp) -/* 338C 8000278C AFBF0014 */ sw $ra, 0x14($sp) -/* 3390 80002790 3C04800A */ lui $a0, %hi(D_800A6074) -/* 3394 80002794 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 3398 80002798 00002825 */ or $a1, $zero, $zero -/* 339C 8000279C 0C015AB4 */ jal osRecvMesg -/* 33A0 800027A0 24060001 */ addiu $a2, $zero, 0x1 -/* 33A4 800027A4 3C03800A */ lui $v1, %hi(D_800A6070) -/* 33A8 800027A8 24636070 */ addiu $v1, $v1, %lo(D_800A6070) -/* 33AC 800027AC 8C6E001C */ lw $t6, 0x1C($v1) -/* 33B0 800027B0 8C6F0028 */ lw $t7, 0x28($v1) -/* 33B4 800027B4 8C78002C */ lw $t8, 0x2C($v1) -/* 33B8 800027B8 24040010 */ addiu $a0, $zero, 0x10 -/* 33BC 800027BC 00002825 */ or $a1, $zero, $zero -/* 33C0 800027C0 AFAE0018 */ sw $t6, 0x18($sp) -/* 33C4 800027C4 AFAF0020 */ sw $t7, 0x20($sp) -/* 33C8 800027C8 0C0008E0 */ jal func_80002380 -/* 33CC 800027CC AFB8001C */ sw $t8, 0x1C($sp) -/* 33D0 800027D0 3C03800A */ lui $v1, %hi(D_800A6070) -/* 33D4 800027D4 1040000D */ beqz $v0, .L8000280C -/* 33D8 800027D8 24636070 */ addiu $v1, $v1, %lo(D_800A6070) -/* 33DC 800027DC 8FB90028 */ lw $t9, 0x28($sp) -/* 33E0 800027E0 3C01800A */ lui $at, %hi(D_800A60A0) -/* 33E4 800027E4 AC59FFFC */ sw $t9, -0x4($v0) -/* 33E8 800027E8 8C680030 */ lw $t0, 0x30($v1) -/* 33EC 800027EC AC48000C */ sw $t0, 0xC($v0) -/* 33F0 800027F0 8FA90018 */ lw $t1, 0x18($sp) -/* 33F4 800027F4 AC490000 */ sw $t1, 0x0($v0) -/* 33F8 800027F8 8FAA0020 */ lw $t2, 0x20($sp) -/* 33FC 800027FC AC4A0004 */ sw $t2, 0x4($v0) -/* 3400 80002800 8FAB001C */ lw $t3, 0x1C($sp) -/* 3404 80002804 AC4B0008 */ sw $t3, 0x8($v0) -/* 3408 80002808 AC2260A0 */ sw $v0, %lo(D_800A60A0)($at) -.L8000280C: -/* 340C 8000280C 3C04800A */ lui $a0, %hi(D_800A6074) -/* 3410 80002810 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 3414 80002814 00002825 */ or $a1, $zero, $zero -/* 3418 80002818 0C015A30 */ jal osSendMesg -/* 341C 8000281C 00003025 */ or $a2, $zero, $zero -/* 3420 80002820 0C0009D9 */ jal func_80002764 -/* 3424 80002824 00000000 */ nop -/* 3428 80002828 8FBF0014 */ lw $ra, 0x14($sp) -/* 342C 8000282C 27BD0028 */ addiu $sp, $sp, 0x28 -/* 3430 80002830 03E00008 */ jr $ra -/* 3434 80002834 00000000 */ nop - diff --git a/src/nonmatchings/intro_loader/func_80002838.s b/src/nonmatchings/intro_loader/func_80002838.s deleted file mode 100644 index 61998e8..0000000 --- a/src/nonmatchings/intro_loader/func_80002838.s +++ /dev/null @@ -1,86 +0,0 @@ -.section .text -glabel func_80002838 -/* 3438 80002838 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 343C 8000283C AFB00014 */ sw $s0, 0x14($sp) -/* 3440 80002840 00808025 */ or $s0, $a0, $zero -/* 3444 80002844 AFBF0024 */ sw $ra, 0x24($sp) -/* 3448 80002848 3C04800A */ lui $a0, %hi(D_800A6074) -/* 344C 8000284C AFB30020 */ sw $s3, 0x20($sp) -/* 3450 80002850 AFB2001C */ sw $s2, 0x1C($sp) -/* 3454 80002854 AFB10018 */ sw $s1, 0x18($sp) -/* 3458 80002858 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 345C 8000285C 00002825 */ or $a1, $zero, $zero -/* 3460 80002860 0C015AB4 */ jal osRecvMesg -/* 3464 80002864 24060001 */ addiu $a2, $zero, 0x1 -/* 3468 80002868 3C03800A */ lui $v1, %hi(D_800A60A0) -/* 346C 8000286C 3C11800A */ lui $s1, %hi(D_800A6070) -/* 3470 80002870 26316070 */ addiu $s1, $s1, %lo(D_800A6070) -/* 3474 80002874 8C6360A0 */ lw $v1, %lo(D_800A60A0)($v1) -.L80002878: -/* 3478 80002878 8C6E0000 */ lw $t6, 0x0($v1) -/* 347C 8000287C 8C720004 */ lw $s2, 0x4($v1) -/* 3480 80002880 8C730008 */ lw $s3, 0x8($v1) -/* 3484 80002884 AE2E001C */ sw $t6, 0x1C($s1) -/* 3488 80002888 8C6F000C */ lw $t7, 0xC($v1) -/* 348C 8000288C 2462FFF0 */ addiu $v0, $v1, -0x10 -/* 3490 80002890 12000006 */ beqz $s0, .L800028AC -/* 3494 80002894 AE2F0030 */ sw $t7, 0x30($s1) -/* 3498 80002898 8C58000C */ lw $t8, 0xC($v0) -/* 349C 8000289C 52180004 */ beql $s0, $t8, .L800028B0 -/* 34A0 800028A0 8E30002C */ lw $s0, 0x2C($s1) -/* 34A4 800028A4 15E0FFF4 */ bnez $t7, .L80002878 -/* 34A8 800028A8 01E01825 */ or $v1, $t7, $zero -.L800028AC: -/* 34AC 800028AC 8E30002C */ lw $s0, 0x2C($s1) -.L800028B0: -/* 34B0 800028B0 0213082B */ sltu $at, $s0, $s3 -/* 34B4 800028B4 5020000C */ beql $at, $zero, .L800028E8 -/* 34B8 800028B8 8E390028 */ lw $t9, 0x28($s1) -/* 34BC 800028BC 8E020008 */ lw $v0, 0x8($s0) -.L800028C0: -/* 34C0 800028C0 26040010 */ addiu $a0, $s0, 0x10 -/* 34C4 800028C4 50400004 */ beql $v0, $zero, .L800028D8 -/* 34C8 800028C8 8E100004 */ lw $s0, 0x4($s0) -/* 34CC 800028CC 0040F809 */ jalr $v0 -/* 34D0 800028D0 8E05000C */ lw $a1, 0xC($s0) -/* 34D4 800028D4 8E100004 */ lw $s0, 0x4($s0) -.L800028D8: -/* 34D8 800028D8 0213082B */ sltu $at, $s0, $s3 -/* 34DC 800028DC 5420FFF8 */ bnel $at, $zero, .L800028C0 -/* 34E0 800028E0 8E020008 */ lw $v0, 0x8($s0) -/* 34E4 800028E4 8E390028 */ lw $t9, 0x28($s1) -.L800028E8: -/* 34E8 800028E8 8F300000 */ lw $s0, 0x0($t9) -/* 34EC 800028EC 0212082B */ sltu $at, $s0, $s2 -/* 34F0 800028F0 1420000B */ bnez $at, .L80002920 -/* 34F4 800028F4 00000000 */ nop -/* 34F8 800028F8 8E020008 */ lw $v0, 0x8($s0) -.L800028FC: -/* 34FC 800028FC 26040010 */ addiu $a0, $s0, 0x10 -/* 3500 80002900 50400004 */ beql $v0, $zero, .L80002914 -/* 3504 80002904 8E100000 */ lw $s0, 0x0($s0) -/* 3508 80002908 0040F809 */ jalr $v0 -/* 350C 8000290C 8E05000C */ lw $a1, 0xC($s0) -/* 3510 80002910 8E100000 */ lw $s0, 0x0($s0) -.L80002914: -/* 3514 80002914 0212082B */ sltu $at, $s0, $s2 -/* 3518 80002918 5020FFF8 */ beql $at, $zero, .L800028FC -/* 351C 8000291C 8E020008 */ lw $v0, 0x8($s0) -.L80002920: -/* 3520 80002920 3C04800A */ lui $a0, %hi(D_800A6074) -/* 3524 80002924 AE320028 */ sw $s2, 0x28($s1) -/* 3528 80002928 AE33002C */ sw $s3, 0x2C($s1) -/* 352C 8000292C 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 3530 80002930 00002825 */ or $a1, $zero, $zero -/* 3534 80002934 0C015A30 */ jal osSendMesg -/* 3538 80002938 00003025 */ or $a2, $zero, $zero -/* 353C 8000293C 0C0009D9 */ jal func_80002764 -/* 3540 80002940 00000000 */ nop -/* 3544 80002944 8FBF0024 */ lw $ra, 0x24($sp) -/* 3548 80002948 8FB00014 */ lw $s0, 0x14($sp) -/* 354C 8000294C 8FB10018 */ lw $s1, 0x18($sp) -/* 3550 80002950 8FB2001C */ lw $s2, 0x1C($sp) -/* 3554 80002954 8FB30020 */ lw $s3, 0x20($sp) -/* 3558 80002958 03E00008 */ jr $ra -/* 355C 8000295C 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/src/nonmatchings/intro_loader/func_80002A14.s b/src/nonmatchings/intro_loader/func_80002A14.s deleted file mode 100644 index 101616d..0000000 --- a/src/nonmatchings/intro_loader/func_80002A14.s +++ /dev/null @@ -1,7 +0,0 @@ -.section .text -glabel func_80002A14 -/* 3614 80002A14 2482FFF0 */ addiu $v0, $a0, -0x10 -/* 3618 80002A18 AC460008 */ sw $a2, 0x8($v0) -/* 361C 80002A1C 03E00008 */ jr $ra -/* 3620 80002A20 AC45000C */ sw $a1, 0xC($v0) - diff --git a/src/nonmatchings/intro_loader/func_80002A24.s b/src/nonmatchings/intro_loader/func_80002A24.s deleted file mode 100644 index ce0d247..0000000 --- a/src/nonmatchings/intro_loader/func_80002A24.s +++ /dev/null @@ -1,6 +0,0 @@ -.section .text -glabel func_80002A24 -/* 3624 80002A24 8C8EFFF4 */ lw $t6, -0xC($a0) -/* 3628 80002A28 03E00008 */ jr $ra -/* 362C 80002A2C 01C41023 */ subu $v0, $t6, $a0 - diff --git a/src/nonmatchings/intro_loader/func_80002A30.s b/src/nonmatchings/intro_loader/func_80002A30.s deleted file mode 100644 index 0cd313d..0000000 --- a/src/nonmatchings/intro_loader/func_80002A30.s +++ /dev/null @@ -1,6 +0,0 @@ -.section .text -glabel func_80002A30 -/* 3630 80002A30 3C02800A */ lui $v0, %hi(D_800A6070) -/* 3634 80002A34 03E00008 */ jr $ra -/* 3638 80002A38 24426070 */ addiu $v0, $v0, %lo(D_800A6070) -/* 363C 80002A3C 00000000 */ nop From 430b28e070430d5f27d419d7ed21527896d72ee0 Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 5 Jan 2023 20:16:02 -0500 Subject: [PATCH 06/10] comment macro --- include/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/macros.h b/include/macros.h index b1558f1..d304614 100644 --- a/include/macros.h +++ b/include/macros.h @@ -28,7 +28,7 @@ // global typings typedef unsigned long uintptr_t; - +// cast thru uintptr_t for integer to pointer casts #define INT2VOID(i) ((void *)(uintptr_t)(i)) #define SCREEN_WIDTH 320 From 5d21c97879fed5c117fdb39ff60c2e339cf9c73d Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 5 Jan 2023 20:49:43 -0500 Subject: [PATCH 07/10] create header for intro_loader --- src/intro_loader.c | 51 +++++++++------------------------------------- src/intro_loader.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 41 deletions(-) create mode 100644 src/intro_loader.h diff --git a/src/intro_loader.c b/src/intro_loader.c index 4abbd51..03f4eee 100644 --- a/src/intro_loader.c +++ b/src/intro_loader.c @@ -1,43 +1,14 @@ #include #include +#include "intro_loader.h" + +// local to this file +extern struct Unk800A6070 D_800A6070; + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunknown-pragmas" -struct UnkNodeThing { - /* 0x00 */ struct UnkNodeThing *unk00; - /* 0x04 */ struct UnkNodeThing *unk04; - // this looks like it can be any type of pointer? - // or are there multiple list node types in a union? - /* 0x08 */ void (*unk08)(struct UnkNodeThing *, s32); - /* 0x0C */ s32 unk0C; -}; // sizeof == 0x10 - -// "known" types for +08 and +0C: -// fn pointer -// void (*unk08)(struct UnkNodeThing *, s32 -// s32 unk0C -// more nodes -// struct UnkNodeThing *unk08 -// struct UnkNodeThing *unk0C - -struct Unk800A6070 { - /* 0x00 */ OSMesg msgs[1]; - /* 0x04 */ OSMesgQueue queue; - /* 0x1C */ uintptr_t unk1C; - // these pointers are all probably to a 4 member struct? - /* 0x20 */ struct UnkNodeThing *unk20; - /* 0x24 */ struct UnkNodeThing *unk24; - /* 0x28 */ struct UnkNodeThing *unk28; - /* 0x2C */ struct UnkNodeThing *unk2C; - /* 0x30 */ struct UnkNodeThing *unk30; -}; // sizeof >= 0x34 - -extern struct Unk800A6070 D_800A6070; -// D_800A6074 is 0x04 queue; -// D_800A608C is field 0x1C of above; - - void func_800022C0(void *arg0, void *arg1) { D_800A6070.unk20 = (void *)(ALIGN16((uintptr_t)arg0) + 0x10); D_800A6070.unk24 = (void *)(((uintptr_t)arg1 & ~0xF) - 0x10); @@ -93,7 +64,7 @@ struct UnkNodeThing *func_80002380(u32 arg0, s32 arg1) { return ret; } -uintptr_t func_80002764(void); + uintptr_t func_80002430(struct UnkNodeThing *arg0, s32 arg1); #ifdef NON_MATCHING @@ -140,11 +111,9 @@ uintptr_t func_80002430(struct UnkNodeThing *arg0, s32 arg1) { } #else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002430.s") +#pragma GLOBAL_ASM("asm/nonmatchings/intro_loader/func_80002430.s") #endif -void func_80002A14(struct UnkNodeThing *, s32, void *); - struct UnkNodeThing *func_8000254C(u32 arg0, s32 arg1, s32 arg2, void *arg3) { struct UnkNodeThing *node; @@ -176,7 +145,6 @@ void func_80002620(struct UnkNodeThing *arg0) { func_80002764(); } -struct UnkNodeThing *func_80002680(struct UnkNodeThing *arg0, uintptr_t arg1); #ifdef NON_MATCHING struct UnkNodeThing *func_80002680(struct UnkNodeThing *arg0, uintptr_t arg1) { uintptr_t diff; @@ -215,7 +183,7 @@ struct UnkNodeThing *func_80002680(struct UnkNodeThing *arg0, uintptr_t arg1) { return sp28; } #else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002680.s") +#pragma GLOBAL_ASM("asm/nonmatchings/intro_loader/func_80002680.s") #endif // this is a weird type, so maybe it should be cast into UnkNodeThing? @@ -296,6 +264,7 @@ void func_80002838(struct UnkNodeThing *arg0) { } #ifdef MIPS_TO_C +// unused function? struct UnkNodeThing *func_80002960(uintptr_t arg0, s32 *arg1) { struct UnkNodeThing *node; // v0? struct UnkNodeThing *otherNode; @@ -328,7 +297,7 @@ struct UnkNodeThing *func_80002960(uintptr_t arg0, s32 *arg1) { return NULL; } #else -#pragma GLOBAL_ASM("src/nonmatchings/intro_loader/func_80002960.s") +#pragma GLOBAL_ASM("asm/nonmatchings/intro_loader/func_80002960.s") #endif void func_80002A14(struct UnkNodeThing *arg0, s32 arg1, void *arg2) { diff --git a/src/intro_loader.h b/src/intro_loader.h new file mode 100644 index 0000000..e5c9dd9 --- /dev/null +++ b/src/intro_loader.h @@ -0,0 +1,51 @@ +#ifndef _SRC_INTRO_LOADER_H_ +#define _SRC_INTRO_LOADER_H_ + +#include +#include +#include + +struct UnkNodeThing { + /* 0x00 */ struct UnkNodeThing *unk00; + /* 0x04 */ struct UnkNodeThing *unk04; + // this looks like it can be any type of pointer? + // or are there multiple list node types in a union? + /* 0x08 */ void (*unk08)(struct UnkNodeThing *, s32); + /* 0x0C */ s32 unk0C; +}; // sizeof == 0x10 + +// "known" types for +08 and +0C: +// fn pointer +// void (*unk08)(struct UnkNodeThing *, s32 +// s32 unk0C +// more nodes +// struct UnkNodeThing *unk08 +// struct UnkNodeThing *unk0C + +struct Unk800A6070 { + /* 0x00 */ OSMesg msgs[1]; + /* 0x04 */ OSMesgQueue queue; + /* 0x1C */ uintptr_t unk1C; + // these pointers might be to different variants of this struct + // or, they could be to different lists... + /* 0x20 */ struct UnkNodeThing *unk20; + /* 0x24 */ struct UnkNodeThing *unk24; + /* 0x28 */ struct UnkNodeThing *unk28; + /* 0x2C */ struct UnkNodeThing *unk2C; + /* 0x30 */ struct UnkNodeThing *unk30; +}; // sizeof >= 0x34 + +// functions +void func_800022C0(void *arg0, void *arg1); +struct UnkNodeThing *func_8000254C(u32 arg0, s32 arg1, s32 arg2, void *arg3); +struct UnkNodeThing *func_800025C4(u32 arg0, s32 arg1); +void func_80002620(struct UnkNodeThing *arg0); +struct UnkNodeThing *func_80002680(struct UnkNodeThing *arg0, uintptr_t arg1); +uintptr_t func_80002764(void); +void func_80002784(s32 arg0); +void func_80002838(struct UnkNodeThing *arg0); +void func_80002A14(struct UnkNodeThing *, s32, void *); +uintptr_t func_80002A24(struct UnkNodeThing *arg0); +struct Unk800A6070 *func_80002A30(void); + +#endif /* _SRC_INTRO_LOADER_H_ */ From 6c66f518209ec9385a5d95f5510c66933b0ced6b Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 5 Jan 2023 20:52:29 -0500 Subject: [PATCH 08/10] use splat nonmatching asm files --- src/nonmatchings/intro_loader/func_80002430.s | 81 ------------------- src/nonmatchings/intro_loader/func_80002680.s | 62 -------------- src/nonmatchings/intro_loader/func_80002960.s | 58 ------------- utils/split_asm.py | 7 +- 4 files changed, 3 insertions(+), 205 deletions(-) delete mode 100644 src/nonmatchings/intro_loader/func_80002430.s delete mode 100644 src/nonmatchings/intro_loader/func_80002680.s delete mode 100644 src/nonmatchings/intro_loader/func_80002960.s diff --git a/src/nonmatchings/intro_loader/func_80002430.s b/src/nonmatchings/intro_loader/func_80002430.s deleted file mode 100644 index aa46605..0000000 --- a/src/nonmatchings/intro_loader/func_80002430.s +++ /dev/null @@ -1,81 +0,0 @@ -.section .text -glabel func_80002430 -/* 3030 80002430 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 3034 80002434 AFB10018 */ sw $s1, 0x18($sp) -/* 3038 80002438 3C11800A */ lui $s1, %hi(D_800A6070) -/* 303C 8000243C 26316070 */ addiu $s1, $s1, %lo(D_800A6070) -/* 3040 80002440 8E220028 */ lw $v0, 0x28($s1) -/* 3044 80002444 2483FFF0 */ addiu $v1, $a0, -0x10 -/* 3048 80002448 AFB30020 */ sw $s3, 0x20($sp) -/* 304C 8000244C AFB2001C */ sw $s2, 0x1C($sp) -/* 3050 80002450 0062082B */ sltu $at, $v1, $v0 -/* 3054 80002454 00A09825 */ or $s3, $a1, $zero -/* 3058 80002458 AFBF0024 */ sw $ra, 0x24($sp) -/* 305C 8000245C AFB00014 */ sw $s0, 0x14($sp) -/* 3060 80002460 10200016 */ beqz $at, .L800024BC -/* 3064 80002464 00609025 */ or $s2, $v1, $zero -/* 3068 80002468 8C4E0000 */ lw $t6, 0x0($v0) -.L8000246C: -/* 306C 8000246C 12600007 */ beqz $s3, .L8000248C -/* 3070 80002470 AE2E0028 */ sw $t6, 0x28($s1) -/* 3074 80002474 8DC30008 */ lw $v1, 0x8($t6) -/* 3078 80002478 25C40010 */ addiu $a0, $t6, 0x10 -/* 307C 8000247C 50600004 */ beql $v1, $zero, .L80002490 -/* 3080 80002480 8E220028 */ lw $v0, 0x28($s1) -/* 3084 80002484 0060F809 */ jalr $v1 -/* 3088 80002488 8DC5000C */ lw $a1, 0xC($t6) -.L8000248C: -/* 308C 8000248C 8E220028 */ lw $v0, 0x28($s1) -.L80002490: -/* 3090 80002490 8E2F001C */ lw $t7, 0x1C($s1) -/* 3094 80002494 8C580004 */ lw $t8, 0x4($v0) -/* 3098 80002498 01F8C821 */ addu $t9, $t7, $t8 -/* 309C 8000249C 03224023 */ subu $t0, $t9, $v0 -/* 30A0 800024A0 AE28001C */ sw $t0, 0x1C($s1) -/* 30A4 800024A4 AC400004 */ sw $zero, 0x4($v0) -/* 30A8 800024A8 8E220028 */ lw $v0, 0x28($s1) -/* 30AC 800024AC 5642FFEF */ bnel $s2, $v0, .L8000246C -/* 30B0 800024B0 8C4E0000 */ lw $t6, 0x0($v0) -/* 30B4 800024B4 1000001C */ b .L80002528 -/* 30B8 800024B8 00000000 */ nop -.L800024BC: -/* 30BC 800024BC 8E30002C */ lw $s0, 0x2C($s1) -/* 30C0 800024C0 0070082B */ sltu $at, $v1, $s0 -/* 30C4 800024C4 14200018 */ bnez $at, .L80002528 -/* 30C8 800024C8 0070082B */ sltu $at, $v1, $s0 -/* 30CC 800024CC 14200016 */ bnez $at, .L80002528 -/* 30D0 800024D0 00000000 */ nop -.L800024D4: -/* 30D4 800024D4 52600009 */ beql $s3, $zero, .L800024FC -/* 30D8 800024D8 8E090004 */ lw $t1, 0x4($s0) -/* 30DC 800024DC 8E020008 */ lw $v0, 0x8($s0) -/* 30E0 800024E0 26040010 */ addiu $a0, $s0, 0x10 -/* 30E4 800024E4 50400005 */ beql $v0, $zero, .L800024FC -/* 30E8 800024E8 8E090004 */ lw $t1, 0x4($s0) -/* 30EC 800024EC 0040F809 */ jalr $v0 -/* 30F0 800024F0 8E05000C */ lw $a1, 0xC($s0) -/* 30F4 800024F4 8E30002C */ lw $s0, 0x2C($s1) -/* 30F8 800024F8 8E090004 */ lw $t1, 0x4($s0) -.L800024FC: -/* 30FC 800024FC 8E2A001C */ lw $t2, 0x1C($s1) -/* 3100 80002500 AE29002C */ sw $t1, 0x2C($s1) -/* 3104 80002504 8D2C0000 */ lw $t4, 0x0($t1) -/* 3108 80002508 01495821 */ addu $t3, $t2, $t1 -/* 310C 8000250C 016C6823 */ subu $t5, $t3, $t4 -/* 3110 80002510 AE2D001C */ sw $t5, 0x1C($s1) -/* 3114 80002514 AD200000 */ sw $zero, 0x0($t1) -/* 3118 80002518 8E30002C */ lw $s0, 0x2C($s1) -/* 311C 8000251C 0250082B */ sltu $at, $s2, $s0 -/* 3120 80002520 1020FFEC */ beqz $at, .L800024D4 -/* 3124 80002524 00000000 */ nop -.L80002528: -/* 3128 80002528 0C0009D9 */ jal func_80002764 -/* 312C 8000252C 00000000 */ nop -/* 3130 80002530 8FBF0024 */ lw $ra, 0x24($sp) -/* 3134 80002534 8FB00014 */ lw $s0, 0x14($sp) -/* 3138 80002538 8FB10018 */ lw $s1, 0x18($sp) -/* 313C 8000253C 8FB2001C */ lw $s2, 0x1C($sp) -/* 3140 80002540 8FB30020 */ lw $s3, 0x20($sp) -/* 3144 80002544 03E00008 */ jr $ra -/* 3148 80002548 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/src/nonmatchings/intro_loader/func_80002680.s b/src/nonmatchings/intro_loader/func_80002680.s deleted file mode 100644 index 122209b..0000000 --- a/src/nonmatchings/intro_loader/func_80002680.s +++ /dev/null @@ -1,62 +0,0 @@ -.section .text -glabel func_80002680 -/* 3280 80002680 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 3284 80002684 AFA40030 */ sw $a0, 0x30($sp) -/* 3288 80002688 AFBF0014 */ sw $ra, 0x14($sp) -/* 328C 8000268C 00A03825 */ or $a3, $a1, $zero -/* 3290 80002690 3C04800A */ lui $a0, %hi(D_800A6074) -/* 3294 80002694 AFA00028 */ sw $zero, 0x28($sp) -/* 3298 80002698 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 329C 8000269C AFA70034 */ sw $a3, 0x34($sp) -/* 32A0 800026A0 00002825 */ or $a1, $zero, $zero -/* 32A4 800026A4 0C015AB4 */ jal osRecvMesg -/* 32A8 800026A8 24060001 */ addiu $a2, $zero, 0x1 -/* 32AC 800026AC 8FA60030 */ lw $a2, 0x30($sp) -/* 32B0 800026B0 3C05800A */ lui $a1, %hi(D_800A6070) -/* 32B4 800026B4 24A56070 */ addiu $a1, $a1, %lo(D_800A6070) -/* 32B8 800026B8 24C3FFF0 */ addiu $v1, $a2, -0x10 -/* 32BC 800026BC 8C640004 */ lw $a0, 0x4($v1) -/* 32C0 800026C0 8CAE0028 */ lw $t6, 0x28($a1) -/* 32C4 800026C4 8FA70034 */ lw $a3, 0x34($sp) -/* 32C8 800026C8 00861023 */ subu $v0, $a0, $a2 -/* 32CC 800026CC 15C4001B */ bne $t6, $a0, .L8000273C -/* 32D0 800026D0 24E7000F */ addiu $a3, $a3, 0xF -/* 32D4 800026D4 2401FFF0 */ addiu $at, $zero, -0x10 -/* 32D8 800026D8 00E13824 */ and $a3, $a3, $at -/* 32DC 800026DC 0047082B */ sltu $at, $v0, $a3 -/* 32E0 800026E0 50200007 */ beql $at, $zero, .L80002700 -/* 32E4 800026E4 8C79000C */ lw $t9, 0xC($v1) -/* 32E8 800026E8 8CAF001C */ lw $t7, 0x1C($a1) -/* 32EC 800026EC 00E2C023 */ subu $t8, $a3, $v0 -/* 32F0 800026F0 01F8082B */ sltu $at, $t7, $t8 -/* 32F4 800026F4 14200011 */ bnez $at, .L8000273C -/* 32F8 800026F8 00000000 */ nop -/* 32FC 800026FC 8C79000C */ lw $t9, 0xC($v1) -.L80002700: -/* 3300 80002700 00C02025 */ or $a0, $a2, $zero -/* 3304 80002704 00002825 */ or $a1, $zero, $zero -/* 3308 80002708 AFB90020 */ sw $t9, 0x20($sp) -/* 330C 8000270C 8C680008 */ lw $t0, 0x8($v1) -/* 3310 80002710 AFA70034 */ sw $a3, 0x34($sp) -/* 3314 80002714 0C00090C */ jal func_80002430 -/* 3318 80002718 AFA8001C */ sw $t0, 0x1C($sp) -/* 331C 8000271C 8FA40034 */ lw $a0, 0x34($sp) -/* 3320 80002720 0C0008E0 */ jal func_80002380 -/* 3324 80002724 00002825 */ or $a1, $zero, $zero -/* 3328 80002728 AFA20028 */ sw $v0, 0x28($sp) -/* 332C 8000272C 00402025 */ or $a0, $v0, $zero -/* 3330 80002730 8FA50020 */ lw $a1, 0x20($sp) -/* 3334 80002734 0C000A85 */ jal func_80002A14 -/* 3338 80002738 8FA6001C */ lw $a2, 0x1C($sp) -.L8000273C: -/* 333C 8000273C 3C04800A */ lui $a0, %hi(D_800A6074) -/* 3340 80002740 24846074 */ addiu $a0, $a0, %lo(D_800A6074) -/* 3344 80002744 00002825 */ or $a1, $zero, $zero -/* 3348 80002748 0C015A30 */ jal osSendMesg -/* 334C 8000274C 00003025 */ or $a2, $zero, $zero -/* 3350 80002750 8FBF0014 */ lw $ra, 0x14($sp) -/* 3354 80002754 8FA20028 */ lw $v0, 0x28($sp) -/* 3358 80002758 27BD0030 */ addiu $sp, $sp, 0x30 -/* 335C 8000275C 03E00008 */ jr $ra -/* 3360 80002760 00000000 */ nop - diff --git a/src/nonmatchings/intro_loader/func_80002960.s b/src/nonmatchings/intro_loader/func_80002960.s deleted file mode 100644 index 320a647..0000000 --- a/src/nonmatchings/intro_loader/func_80002960.s +++ /dev/null @@ -1,58 +0,0 @@ -.section .text -glabel func_80002960 -/* 3560 80002960 3C07800A */ lui $a3, %hi(D_800A6070) -/* 3564 80002964 24E76070 */ addiu $a3, $a3, %lo(D_800A6070) -/* 3568 80002968 8CEE0028 */ lw $t6, 0x28($a3) -/* 356C 8000296C 00A03025 */ or $a2, $a1, $zero -/* 3570 80002970 8DC20000 */ lw $v0, 0x0($t6) -/* 3574 80002974 10400010 */ beqz $v0, .L800029B8 -/* 3578 80002978 24430010 */ addiu $v1, $v0, 0x10 -.L8000297C: -/* 357C 8000297C 0083082B */ sltu $at, $a0, $v1 -/* 3580 80002980 1420000A */ bnez $at, .L800029AC -/* 3584 80002984 8C450004 */ lw $a1, 0x4($v0) -/* 3588 80002988 0085082B */ sltu $at, $a0, $a1 -/* 358C 8000298C 50200008 */ beql $at, $zero, .L800029B0 -/* 3590 80002990 8C420000 */ lw $v0, 0x0($v0) -/* 3594 80002994 10C00003 */ beqz $a2, .L800029A4 -/* 3598 80002998 00000000 */ nop -/* 359C 8000299C 8C4F000C */ lw $t7, 0xC($v0) -/* 35A0 800029A0 ACCF0000 */ sw $t7, 0x0($a2) -.L800029A4: -/* 35A4 800029A4 03E00008 */ jr $ra -/* 35A8 800029A8 00601025 */ or $v0, $v1, $zero -.L800029AC: -/* 35AC 800029AC 8C420000 */ lw $v0, 0x0($v0) -.L800029B0: -/* 35B0 800029B0 5440FFF2 */ bnel $v0, $zero, .L8000297C -/* 35B4 800029B4 24430010 */ addiu $v1, $v0, 0x10 -.L800029B8: -/* 35B8 800029B8 8CE2002C */ lw $v0, 0x2C($a3) -/* 35BC 800029BC 8C450004 */ lw $a1, 0x4($v0) -/* 35C0 800029C0 10A00011 */ beqz $a1, .L80002A08 -/* 35C4 800029C4 24430010 */ addiu $v1, $v0, 0x10 -.L800029C8: -/* 35C8 800029C8 0083082B */ sltu $at, $a0, $v1 -/* 35CC 800029CC 1420000A */ bnez $at, .L800029F8 -/* 35D0 800029D0 00A03825 */ or $a3, $a1, $zero -/* 35D4 800029D4 0087082B */ sltu $at, $a0, $a3 -/* 35D8 800029D8 50200008 */ beql $at, $zero, .L800029FC -/* 35DC 800029DC 00A01025 */ or $v0, $a1, $zero -/* 35E0 800029E0 10C00003 */ beqz $a2, .L800029F0 -/* 35E4 800029E4 00000000 */ nop -/* 35E8 800029E8 8C58000C */ lw $t8, 0xC($v0) -/* 35EC 800029EC ACD80000 */ sw $t8, 0x0($a2) -.L800029F0: -/* 35F0 800029F0 03E00008 */ jr $ra -/* 35F4 800029F4 00601025 */ or $v0, $v1, $zero -.L800029F8: -/* 35F8 800029F8 00A01025 */ or $v0, $a1, $zero -.L800029FC: -/* 35FC 800029FC 8CA50004 */ lw $a1, 0x4($a1) -/* 3600 80002A00 54A0FFF1 */ bnel $a1, $zero, .L800029C8 -/* 3604 80002A04 24430010 */ addiu $v1, $v0, 0x10 -.L80002A08: -/* 3608 80002A08 00001025 */ or $v0, $zero, $zero -/* 360C 80002A0C 03E00008 */ jr $ra -/* 3610 80002A10 00000000 */ nop - diff --git a/utils/split_asm.py b/utils/split_asm.py index 965c6f4..7283e59 100755 --- a/utils/split_asm.py +++ b/utils/split_asm.py @@ -8,7 +8,7 @@ import sys from pathlib import Path if len(sys.argv) != 4: - print(f"Usage: {sys.argv[0]} ") + print(f"Usage: {sys.argv[0]} ") exit() def fail(msg): @@ -74,11 +74,10 @@ def write_split_files(nm_dir, c_out, routines): def main(): s_in = Path(sys.argv[1]) - s_out_base = Path(sys.argv[2]) - c_out_dir = Path(sys.argv[3]) + c_out_dir = Path(sys.argv[2]) input_filename = s_in.stem - s_out_dir = s_out_base / Path(*c_out_dir.parts[1:]) / input_filename + s_out_dir = Path('asm/nonmatchings') / Path(*c_out_dir.parts[2:]) / input_filename c_out_file = c_out_dir / s_in.with_suffix('.c').name s_out_dir.relative_to From ca50041d830deb25da6b2b7ec6098c27401395ff Mon Sep 17 00:00:00 2001 From: tehzz Date: Fri, 6 Jan 2023 17:51:42 -0500 Subject: [PATCH 09/10] use splat to transition ASM files to C --- utils/split_asm.py | 96 ---------------------------------------------- 1 file changed, 96 deletions(-) delete mode 100755 utils/split_asm.py diff --git a/utils/split_asm.py b/utils/split_asm.py deleted file mode 100755 index 7283e59..0000000 --- a/utils/split_asm.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env python3 - -''' Split an asm (.s) file into a series of function.s files - and a GLOBAL_ASM .c file that imports those funcion.s files -''' - -import sys -from pathlib import Path - -if len(sys.argv) != 4: - print(f"Usage: {sys.argv[0]} ") - exit() - -def fail(msg): - print(msg, file=sys.stderr) - exit(1) - - -def assert_is_dir(p): - if not p.is_dir(): - fail(f"Path <{p}> is not a directory") - -def is_routine_glabel(line): - return "glabel" in line and "D_" not in line and "jtgt" not in line and "L8" not in line - -def id_routines(input): - # routine name => String - routines = dict() - def store_routine(state): - if state is not None: - routines[state[0]] = state[1] - state = None - - with open(input, 'r') as f: - # (name, textbuf) - state = None - text_section = False - for line in f: - if line.startswith(".section"): - text_section = line.split()[1] in [".text", ".text,"] - store_routine(state) - elif is_routine_glabel(line) and text_section: - name = line.split()[-1] - # store "completed" prior routine - store_routine(state) - # and start collecting the next routine - state = (name, line) - elif state is not None and text_section: - state = (state[0], state[1] + line) - - # output final routine - store_routine(state) - - return routines - -def write_split_files(nm_dir, c_out, routines): - # routineName => routineNonMatchingFile - with open(c_out, "w+") as cf: - cf.write("#include \n\n") - cf.write('#pragma GCC diagnostic push\n') - cf.write('#pragma GCC diagnostic ignored "-Wunknown-pragmas"\n') - - for (routine, text) in routines.items(): - nm_out = nm_dir / Path(routine).with_suffix('.s') - - f = open(nm_out, "w") - f.write(".section .text\n") - f.write(text) - f.close() - - cf.write(f'\n#ifdef MIPS_TO_C\n#else\n#pragma GLOBAL_ASM("{nm_out}")\n#endif\n') - - cf.write('#pragma GCC diagnostic pop\n') - -def main(): - s_in = Path(sys.argv[1]) - c_out_dir = Path(sys.argv[2]) - - input_filename = s_in.stem - s_out_dir = Path('asm/nonmatchings') / Path(*c_out_dir.parts[2:]) / input_filename - c_out_file = c_out_dir / s_in.with_suffix('.c').name - - s_out_dir.relative_to - - s_out_dir.mkdir(parents=True, exist_ok=True) - c_out_dir.mkdir(parents=True, exist_ok=True) - assert_is_dir(s_out_dir) - assert_is_dir(c_out_dir) - - routines = id_routines(s_in) - write_split_files(s_out_dir, c_out_file, routines) - # print(routines) - - -if __name__ == '__main__': - main() From 4bcaa5be7ca4df696072c71fe3cc7fa0341eee26 Mon Sep 17 00:00:00 2001 From: tehzz Date: Fri, 6 Jan 2023 17:52:25 -0500 Subject: [PATCH 10/10] add script to generate context for m2c/decomp.me --- utils/m2ctx.py | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 utils/m2ctx.py diff --git a/utils/m2ctx.py b/utils/m2ctx.py new file mode 100755 index 0000000..e7d93b3 --- /dev/null +++ b/utils/m2ctx.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 +import argparse +import os +import shutil +import sys +import subprocess +from pathlib import Path + +# Project-specific +# assuming that this is in tools +SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) +ROOT_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "..")) +CPP_FLAGS = [ + "-undef", + "-D__sgi", + "-D_LANGUAGE_C", + "-DF3DEX_GBI_2", + "-DNDEBUG", + "-D_MIPS_SZLONG=32", + "-DSCRIPT(...)={}" + "-D__attribute__(...)=", + "-D__asm__(...)=", + "-DGLOBAL_ASM(...)=", + "-ffreestanding", + "-nostdinc", + "-Iinclude", + "-Iinclude/PR", + "-Iinclude/audio", + "-Isrc" +] + +def import_c_file(in_file) -> str: + in_file = os.path.relpath(in_file, ROOT_DIR) + # Prefer clang as C preprocessor if installed on the system + if shutil.which('clang') is not None: + cpp = ['clang', '-E', '-P', '-x', 'c', '-Wno-trigraphs'] + else: + cpp = ['gcc', '-E', '-P'] + + cpp_getdefines = [*cpp, "-dM", *CPP_FLAGS, in_file] + cpp_procfile = [*cpp, *CPP_FLAGS, in_file] + + out_text = "" + try: + out_text += subprocess.check_output(cpp_getdefines, cwd=ROOT_DIR, encoding="utf-8") + out_text += subprocess.check_output(cpp_procfile, cwd=ROOT_DIR, encoding="utf-8") + except subprocess.CalledProcessError: + print( + "Failed to preprocess input file, when running command:\n", + cpp_getdefines, + file=sys.stderr, + ) + sys.exit(1) + + if not out_text: + print("Output is empty - aborting") + sys.exit(1) + return out_text + +def main(): + parser = argparse.ArgumentParser( + description="Create a context file which can be used for m2c" + ) + parser.add_argument( + "c_file", + help="File from which to create context", + ) + parser.add_argument( + "ctx_file", + nargs='?', + help="save context to file if present, otherwise print to stdout" + ) + args = parser.parse_args() + + output = import_c_file(args.c_file) + + if args.ctx_file is not None: + with open(os.path.join(ROOT_DIR, args.ctx_file), "w", encoding="UTF-8") as f: + f.write(output) + else: + print(output) + +if __name__ == "__main__": + main() \ No newline at end of file