From 39e8ee477f66e49169297ffa8a1fac396a082fde Mon Sep 17 00:00:00 2001 From: dark-samus Date: Tue, 21 Jul 2020 04:42:21 -0400 Subject: [PATCH] split giantchunk.s in yaml, fix diff.py for some situations, fix some structs and include commented source for fishy matching --- PAPER_MARIO.u.yaml | 16 +++++++++++---- papermario/diff.py | 2 +- papermario/include/common_structs.h | 2 ++ papermario/src/code_dd930_len_1c0.c | 30 +++++++++++++++++++++++++++-- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/PAPER_MARIO.u.yaml b/PAPER_MARIO.u.yaml index 1ed254ff36..f8e0537b0f 100644 --- a/PAPER_MARIO.u.yaml +++ b/PAPER_MARIO.u.yaml @@ -173,9 +173,17 @@ ranges: - [0x4a1f0, 0x4a360, "asm", "code_4a1f0_len_170", 0x8006edf0] - [0x4a360, 0x4ac90, "asm", "code_4a360_len_930", 0x8006ef60] - [0x4ac90, 0x4e5a0, "asm", "code_4ac90_len_3910", 0x8006f890] - - [0x4E5A0, 0x759B0, "bin", "bin_759b0_len_27410"] - - [0x759b0, 0x90FE0, "asm", "giantchunk", 0x800DC500] - - [0x90FE0, 0xa5dd0, "bin", "giantchunk_bin", 0x800F7B30] + - [0x4E5A0, 0x759B0, "bin", "bin_4e5a0_len_27410"] + - [0x759b0, 0x7bb60, "asm", "code_759b0_len_61b0", 0x800DC500] + - [0x7bb60, 0x7fd10, "asm", "code_7bb60_len_41b0", 0x800E26B0] + - [0x7fd10, 0x80850, "asm", "code_7fd10_len_b40", 0x800E6860] + - [0x80850, 0x838b0, "asm", "code_80850_len_3060", 0x800E73A0] + - [0x838b0, 0x891b0, "asm", "code_838b0_len_5900", 0x800EA400] + - [0x891b0, 0x8a160, "asm", "code_891b0_len_fb0", 0x800EFD00] + - [0x8a160, 0x8a860, "asm", "code_8a160_len_700", 0x800F0CB0] + - [0x8a860, 0x8e790, "asm", "code_8a860_len_3f30", 0x800F13B0] + - [0x8e790, 0x90fe0, "asm", "code_8e790_len_2850", 0x800F52E0] + - [0x90fe0, 0xa5dd0, "bin", "bin_90fe0_len_14df0", 0x800F7B30] - [0xa5dd0, 0xb72b0, "asm", "code_a5dd0_len_114e0", 0x8010f6d0] - [0xb72b0, 0xcd180, "asm", "code_b72b0_len_15ed0", 0x80120bb0] - [0xcd180, 0xd0a70, "asm", "code_cd180_len_38f0", 0x80136a80] @@ -188,7 +196,7 @@ ranges: - [0xddaf0, 0xde740, "asm", "code_ddaf0_len_c50", 0x801473f0] - [0xde740, 0xe0b30, "asm", "code_de740_len_23f0", 0x80148040] - [0xe0b30, 0xe16b0, "asm", "code_e0b30_len_b80", 0x8014a430] - - [0xe16b0, 0xe79b0, "bin", "bin_e5dd0"] + - [0xe16b0, 0xe79b0, "bin", "bin_e5dd0_len_6300"] - [0xe79b0, 0xe92d0, "asm", "code_e79b0_len_1920", 0x802c3000] - [0xe92d0, 0xef070, "asm", "code_e92d0_len_5da0", 0x802c4920] - [0xef070, 0xf2470, "asm", "code_ef070_len_3400", 0x802ca6c0] diff --git a/papermario/diff.py b/papermario/diff.py index 7da3a26505..b12e81ec4a 100755 --- a/papermario/diff.py +++ b/papermario/diff.py @@ -506,7 +506,7 @@ def process_reloc(row, prev): if imm != "0": if before.strip() == "jal" and not imm.startswith("0x"): imm = "0x" + imm - repl += "+" + imm if int(imm, 0) > 0 else imm + repl += "+" + imm if int(imm, 16) > 0 else imm if "R_MIPS_LO16" in row: repl = f"%lo({repl})" elif "R_MIPS_HI16" in row: diff --git a/papermario/include/common_structs.h b/papermario/include/common_structs.h index ebba118170..d671436bb5 100644 --- a/papermario/include/common_structs.h +++ b/papermario/include/common_structs.h @@ -10,6 +10,8 @@ typedef struct { /* 0x6B */ s8 demoStickY; /* 0x6C */ char unk_6C[0x5]; /* 0x71 */ s8 demoState; + /* 0x72 */ char unk_72[8]; + /* 0x7A */ s8 audio_unk; } game_status; typedef struct { diff --git a/papermario/src/code_dd930_len_1c0.c b/papermario/src/code_dd930_len_1c0.c index b274791efb..f76bb604c5 100644 --- a/papermario/src/code_dd930_len_1c0.c +++ b/papermario/src/code_dd930_len_1c0.c @@ -1,7 +1,8 @@ #include "common.h" typedef struct { - s32 unk0; + s16 unk0; + s16 unk2; s32 unk4; s32 unk8; s32 unkC; @@ -16,4 +17,29 @@ void func_80147230(void) { INCLUDE_ASM(code_dd930_len_1c0, UpdateMusicPlayers); -INCLUDE_ASM(code_dd930_len_1c0, play_ambient_sounds); \ No newline at end of file +INCLUDE_ASM(code_dd930_len_1c0, play_ambient_sounds); + +// matches, but clearly isn't correct. Investigate later. +/*int play_ambient_sounds(int a0, int a1) +{ + struct_80147230 *temp2 = &D_8015C7C0; + struct_80147230 **temp3 = &temp2; + + if ((*gGameStatusPtr)->audio_unk == 0) + { + func_800554A4(temp2->unk8); + temp2->unk0 &= ~1; + return 1; + } + + + if (temp2->unk8 == a0) + { + return 2; + } + + temp2->unk8 = a0; + temp2->unk4 = a1; + temp2->unk2 = 1; + return 1; +}*/ \ No newline at end of file