From 9e9ce5bb298e141614bd6e531d08d6506b0b33f7 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Fri, 16 Oct 2020 14:49:18 -0400 Subject: [PATCH] :eyes: --- asm/nonmatchings/code_197F40/SetBattleInputMask.s | 10 ---------- asm/nonmatchings/code_197F40/func_8026E038.s | 10 ---------- include/common_structs.h | 3 ++- src/code_18F340.c | 6 +++--- src/code_1967B0.c | 2 +- src/code_197F40.c | 10 ++++++++-- tools/asm_sizes.py | 4 ++-- 7 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 asm/nonmatchings/code_197F40/SetBattleInputMask.s delete mode 100644 asm/nonmatchings/code_197F40/func_8026E038.s diff --git a/asm/nonmatchings/code_197F40/SetBattleInputMask.s b/asm/nonmatchings/code_197F40/SetBattleInputMask.s deleted file mode 100644 index 707c0c9ec1..0000000000 --- a/asm/nonmatchings/code_197F40/SetBattleInputMask.s +++ /dev/null @@ -1,10 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel SetBattleInputMask -/* 19C930 8026E050 8C82000C */ lw $v0, 0xc($a0) -/* 19C934 8026E054 8C420000 */ lw $v0, ($v0) -/* 19C938 8026E058 3C01800E */ lui $at, 0x800e -/* 19C93C 8026E05C AC22C294 */ sw $v0, -0x3d6c($at) -/* 19C940 8026E060 03E00008 */ jr $ra -/* 19C944 8026E064 24020002 */ addiu $v0, $zero, 2 diff --git a/asm/nonmatchings/code_197F40/func_8026E038.s b/asm/nonmatchings/code_197F40/func_8026E038.s deleted file mode 100644 index 42096ca5bf..0000000000 --- a/asm/nonmatchings/code_197F40/func_8026E038.s +++ /dev/null @@ -1,10 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8026E038 -/* 19C918 8026E038 8C82000C */ lw $v0, 0xc($a0) -/* 19C91C 8026E03C 8C420000 */ lw $v0, ($v0) -/* 19C920 8026E040 3C01800E */ lui $at, 0x800e -/* 19C924 8026E044 AC22C0E4 */ sw $v0, -0x3f1c($at) -/* 19C928 8026E048 03E00008 */ jr $ra -/* 19C92C 8026E04C 24020002 */ addiu $v0, $zero, 2 diff --git a/include/common_structs.h b/include/common_structs.h index ad6649b18a..46ad0bec62 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -531,7 +531,8 @@ typedef struct BattleStatus { /* 0x048 */ u8 currentSubmenu; /* 0x049 */ char unk_49[10]; /* 0x053 */ u8 stratsLastCursorPos; - /* 0x054 */ char unk_54[36]; + /* 0x054 */ char unk_54[32]; + /* 0x074 */ s32 unk_74; /* 0x078 */ u8 totalStarPoints; /* 0x079 */ u8 pendingStarPoints; /* how many to add */ /* 0x07A */ u8 incrementStarPointDelay; /* related to star points, set to 0x28 when they are dropped */ diff --git a/src/code_18F340.c b/src/code_18F340.c index dc8655c260..1b34427f99 100644 --- a/src/code_18F340.c +++ b/src/code_18F340.c @@ -17,10 +17,10 @@ ApiStatus func_80260DB8(ScriptInstance* script, s32 isInitialCall) { ApiStatus func_80260DD8(ScriptInstance* script, s32 isInitialCall) { Actor* player = gBattleStatus.playerActor; - + if (!gPlayerData.hasActionCommands) { s32 var = player->varTable[0]; - + if (var >= rand_int(100)) { script->varTable[0] = 1; } else { @@ -57,7 +57,7 @@ INCLUDE_ASM(s32, "code_18F340", func_8026127C); ApiStatus func_80261388(ScriptInstance* script, s32 isInitialCall) { s32 partnerActorExists = gBattleStatus.partnerActor != NULL; - + script->varTable[0] = FALSE; if (partnerActorExists) { script->varTable[0] = TRUE; diff --git a/src/code_1967B0.c b/src/code_1967B0.c index fd61de6500..28207b3d72 100644 --- a/src/code_1967B0.c +++ b/src/code_1967B0.c @@ -10,7 +10,7 @@ ApiStatus LoadMoveScript(ScriptInstance* script, s32 isInitialCall) { dma_copy(moveScript[0], moveScript[1], moveScript[2]); script->varTable[0] = moveScript[3]; - + deduct_current_move_fp(); if (gBattleStatus.flags2 & 0x8000000) { diff --git a/src/code_197F40.c b/src/code_197F40.c index 214d471a90..c7e6e31d61 100644 --- a/src/code_197F40.c +++ b/src/code_197F40.c @@ -225,9 +225,15 @@ INCLUDE_ASM(s32, "code_197F40", func_8026DF88); INCLUDE_ASM(s32, "code_197F40", func_8026E020); -INCLUDE_ASM(s32, "code_197F40", func_8026E038); +ApiStatus func_8026E038(ScriptInstance* script, s32 isInitialCall) { + gBattleStatus.unk_74 = *script->ptrReadPos; + return ApiStatus_DONE2; +} -INCLUDE_ASM(s32, "code_197F40", SetBattleInputMask); +ApiStatus SetBattleInputMask(ScriptInstance* script, s32 isInitialCall) { + gBattleStatus.inputBitmask = *script->ptrReadPos; + return ApiStatus_DONE2; +} INCLUDE_ASM(s32, "code_197F40", SetBattleInputButtons); diff --git a/tools/asm_sizes.py b/tools/asm_sizes.py index 3031a99835..c2c0995586 100755 --- a/tools/asm_sizes.py +++ b/tools/asm_sizes.py @@ -43,5 +43,5 @@ for root, dirs, files in os.walk(asm_dir): if "/os" not in root: do_dir(root, asm_dir) -for thing in sorted(sizes.keys(), key=lambda x: sizes[x][3]): - print(thing.ljust(25) + str(sizes[thing][3])) +for thing in sorted(sizes.keys(), key=lambda x: sizes[x][2]): + print(thing.ljust(25) + str(sizes[thing][2]))