diff --git a/n64splitter b/n64splitter index 99e0932f89..678acb2ea0 160000 --- a/n64splitter +++ b/n64splitter @@ -1 +1 @@ -Subproject commit 99e0932f8917371cf4b44b1abbdacb444bd21f02 +Subproject commit 678acb2ea026162039be6700486499db526dfba6 diff --git a/papermario/asm/header.s b/papermario/asm/header.s index e701087db3..53557ca634 100644 --- a/papermario/asm/header.s +++ b/papermario/asm/header.s @@ -14,5 +14,3 @@ .ascii "E" # country .byte 0x00 # version - - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/add_fortress_keys.s b/papermario/asm/nonmatchings/code_80850_len_3060/add_fortress_keys.s deleted file mode 100644 index 5f0bb0b11e..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/add_fortress_keys.s +++ /dev/null @@ -1,15 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel add_fortress_keys -/* 083848 800EA398 3C038011 */ lui $v1, 0x8011 -/* 08384C 800EA39C 2463F290 */ addiu $v1, $v1, -0xd70 -/* 083850 800EA3A0 9062000E */ lbu $v0, 0xe($v1) -/* 083854 800EA3A4 00441021 */ addu $v0, $v0, $a0 -/* 083858 800EA3A8 A062000E */ sb $v0, 0xe($v1) -/* 08385C 800EA3AC 00021600 */ sll $v0, $v0, 0x18 -/* 083860 800EA3B0 03E00008 */ jr $ra -/* 083864 800EA3B4 00021603 */ sra $v0, $v0, 0x18 - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/get_fortress_key_count.s b/papermario/asm/nonmatchings/code_80850_len_3060/get_fortress_key_count.s deleted file mode 100644 index 35cf66462b..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/get_fortress_key_count.s +++ /dev/null @@ -1,14 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel get_fortress_key_count -/* 083894 800EA3E4 3C028011 */ lui $v0, 0x8011 -/* 083898 800EA3E8 8042F29E */ lb $v0, -0xd62($v0) -/* 08389C 800EA3EC 03E00008 */ jr $ra -/* 0838A0 800EA3F0 00000000 */ nop - -/* 0838A4 800EA3F4 00000000 */ nop -/* 0838A8 800EA3F8 00000000 */ nop -/* 0838AC 800EA3FC 00000000 */ nop diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/get_player_data.s b/papermario/asm/nonmatchings/code_80850_len_3060/get_player_data.s deleted file mode 100644 index ee3bbb4044..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/get_player_data.s +++ /dev/null @@ -1,11 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel get_player_data -/* 080A14 800E7564 3C028011 */ lui $v0, 0x8011 -/* 080A18 800E7568 2442F290 */ addiu $v0, $v0, -0xd70 -/* 080A1C 800E756C 03E00008 */ jr $ra -/* 080A20 800E7570 00000000 */ nop - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/get_stored_empty_count.s b/papermario/asm/nonmatchings/code_80850_len_3060/get_stored_empty_count.s deleted file mode 100644 index 689d98a709..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/get_stored_empty_count.s +++ /dev/null @@ -1,16 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel get_stored_empty_count -/* 080CF8 800E7848 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 080CFC 800E784C AFBF0010 */ sw $ra, 0x10($sp) -/* 080D00 800E7850 0C039E05 */ jal get_stored_count -/* 080D04 800E7854 00000000 */ nop -/* 080D08 800E7858 24030020 */ addiu $v1, $zero, 0x20 -/* 080D0C 800E785C 8FBF0010 */ lw $ra, 0x10($sp) -/* 080D10 800E7860 00621023 */ subu $v0, $v1, $v0 -/* 080D14 800E7864 03E00008 */ jr $ra -/* 080D18 800E7868 27BD0018 */ addiu $sp, $sp, 0x18 - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/subtract_fortress_keys.s b/papermario/asm/nonmatchings/code_80850_len_3060/subtract_fortress_keys.s deleted file mode 100644 index 6d0303058f..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/subtract_fortress_keys.s +++ /dev/null @@ -1,19 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel subtract_fortress_keys -/* 083868 800EA3B8 3C038011 */ lui $v1, 0x8011 -/* 08386C 800EA3BC 2463F290 */ addiu $v1, $v1, -0xd70 -/* 083870 800EA3C0 9062000E */ lbu $v0, 0xe($v1) -/* 083874 800EA3C4 00441023 */ subu $v0, $v0, $a0 -/* 083878 800EA3C8 A062000E */ sb $v0, 0xe($v1) -/* 08387C 800EA3CC 00021600 */ sll $v0, $v0, 0x18 -/* 083880 800EA3D0 04410002 */ bgez $v0, .L800EA3DC -/* 083884 800EA3D4 0060202D */ daddu $a0, $v1, $zero -/* 083888 800EA3D8 A060000E */ sb $zero, 0xe($v1) -.L800EA3DC: -/* 08388C 800EA3DC 03E00008 */ jr $ra -/* 083890 800EA3E0 8082000E */ lb $v0, 0xe($a0) - diff --git a/papermario/diff.py b/papermario/diff.py index d65388eec3..e586a6a8d6 100755 --- a/papermario/diff.py +++ b/papermario/diff.py @@ -448,7 +448,7 @@ if arch == "mips": re_large_imm = re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}") re_imm = re.compile(r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(sp)|%(lo|hi)\([^)]*\)") forbidden = set(string.ascii_letters + "_") - arch_flags = ["-m", "mips:4300", "-Mno-aliases"] + arch_flags = ["-m", "mips:4300"] branch_likely_instructions = { "beql", "bnel", diff --git a/papermario/src/code_80850_len_3060.c b/papermario/src/code_80850_len_3060.c index 45f1448998..a3ee402ca4 100644 --- a/papermario/src/code_80850_len_3060.c +++ b/papermario/src/code_80850_len_3060.c @@ -2,7 +2,9 @@ INCLUDE_ASM(code_80850_len_3060, clear_player_data); -INCLUDE_ASM(code_80850_len_3060, get_player_data); +player_data* get_player_data(void) { + return &gPlayerData; +} INCLUDE_ASM(code_80850_len_3060, add_item); @@ -20,7 +22,9 @@ INCLUDE_ASM(code_80850_len_3060, store_item); INCLUDE_ASM(code_80850_len_3060, get_stored_count); -INCLUDE_ASM(code_80850_len_3060, get_stored_empty_count); +s32 get_stored_empty_count(void) { + return 32 - get_stored_count(); +} INCLUDE_ASM(code_80850_len_3060, enforce_hpfp_limits); @@ -147,19 +151,19 @@ s8 add_fortress_keys(s32 amt) { return playerData->fortressKeyCount; } -/* -s8 subtract_fortress_keys(s32 amt) { +s8 subtract_fortress_keys(s8 amt) { player_data* playerData = &gPlayerData; - //player_data* new_var = playerData; + player_data* playerData2 = &gPlayerData; // required to match playerData->fortressKeyCount -= amt; if (playerData->fortressKeyCount < 0) { playerData->fortressKeyCount = 0; } - return playerData->fortressKeyCount; + + return playerData2->fortressKeyCount; // required to use playerData2 here to match } -*/ -INCLUDE_ASM(code_80850_len_3060, subtract_fortress_keys); +s8 get_fortress_key_count(void) { + return gPlayerData.fortressKeyCount; +} -INCLUDE_ASM(code_80850_len_3060, get_fortress_key_count);