From 36c5bde3768b540b63fd5f0d2b142543089cbe0a Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sat, 26 Sep 2020 21:02:29 -0400 Subject: [PATCH] more goods --- asm/nonmatchings/code_167570/func_80247D14.s | 6 - asm/nonmatchings/code_167570/func_80247D1C.s | 9 -- asm/nonmatchings/code_7E2AA0/func_80281C20.s | 29 ----- asm/nonmatchings/code_7E2AA0/func_80281C84.s | 14 --- asm/nonmatchings/code_7E2AA0/func_80282314.s | 8 -- asm/nonmatchings/code_7E2AA0/func_80282324.s | 9 -- asm/nonmatchings/code_7E2AA0/func_80282338.s | 17 --- asm/nonmatchings/code_7E2AA0/func_802825FC.s | 9 -- asm/nonmatchings/code_7E2AA0/func_80282610.s | 9 -- asm/nonmatchings/code_7E2AA0/func_80282624.s | 8 -- asm/nonmatchings/code_7E2AA0/func_802827CC.s | 43 ------- asm/nonmatchings/code_7E2AA0/func_80282868.s | 10 -- include/functions.h | 3 + include/variables.h | 7 +- src/code_167570.c | 6 +- src/code_7E2AA0.c | 116 +++++++++++++++++-- src/code_838b0_len_5900.c | 2 +- src/code_e92d0_len_5da0.c | 27 ++++- tools/asm_sizes.py | 45 +++++++ undefined_syms.txt | 4 + 20 files changed, 195 insertions(+), 186 deletions(-) delete mode 100644 asm/nonmatchings/code_167570/func_80247D14.s delete mode 100644 asm/nonmatchings/code_167570/func_80247D1C.s delete mode 100644 asm/nonmatchings/code_7E2AA0/func_80281C20.s delete mode 100644 asm/nonmatchings/code_7E2AA0/func_80281C84.s delete mode 100644 asm/nonmatchings/code_7E2AA0/func_80282314.s delete mode 100644 asm/nonmatchings/code_7E2AA0/func_80282324.s delete mode 100644 asm/nonmatchings/code_7E2AA0/func_80282338.s delete mode 100644 asm/nonmatchings/code_7E2AA0/func_802825FC.s delete mode 100644 asm/nonmatchings/code_7E2AA0/func_80282610.s delete mode 100644 asm/nonmatchings/code_7E2AA0/func_80282624.s delete mode 100644 asm/nonmatchings/code_7E2AA0/func_802827CC.s delete mode 100644 asm/nonmatchings/code_7E2AA0/func_80282868.s create mode 100755 tools/asm_sizes.py diff --git a/asm/nonmatchings/code_167570/func_80247D14.s b/asm/nonmatchings/code_167570/func_80247D14.s deleted file mode 100644 index a906255385..0000000000 --- a/asm/nonmatchings/code_167570/func_80247D14.s +++ /dev/null @@ -1,6 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80247D14 -/* 168574 80247D14 03E00008 */ jr $ra -/* 168578 80247D18 00000000 */ nop diff --git a/asm/nonmatchings/code_167570/func_80247D1C.s b/asm/nonmatchings/code_167570/func_80247D1C.s deleted file mode 100644 index c0728180e1..0000000000 --- a/asm/nonmatchings/code_167570/func_80247D1C.s +++ /dev/null @@ -1,9 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80247D1C -/* 16857C 80247D1C 03E00008 */ jr $ra -/* 168580 80247D20 00000000 */ nop -/* 168584 80247D24 00000000 */ nop -/* 168588 80247D28 00000000 */ nop -/* 16858C 80247D2C 00000000 */ nop diff --git a/asm/nonmatchings/code_7E2AA0/func_80281C20.s b/asm/nonmatchings/code_7E2AA0/func_80281C20.s deleted file mode 100644 index 626342815c..0000000000 --- a/asm/nonmatchings/code_7E2AA0/func_80281C20.s +++ /dev/null @@ -1,29 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80281C20 -/* 7E2AA0 80281C20 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 7E2AA4 80281C24 AFB10014 */ sw $s1, 0x14($sp) -/* 7E2AA8 80281C28 0080882D */ daddu $s1, $a0, $zero -/* 7E2AAC 80281C2C AFBF0018 */ sw $ra, 0x18($sp) -/* 7E2AB0 80281C30 AFB00010 */ sw $s0, 0x10($sp) -/* 7E2AB4 80281C34 8E30000C */ lw $s0, 0xc($s1) -/* 7E2AB8 80281C38 8E050000 */ lw $a1, ($s0) -/* 7E2ABC 80281C3C 0C0B1EAF */ jal get_variable -/* 7E2AC0 80281C40 26100004 */ addiu $s0, $s0, 4 -/* 7E2AC4 80281C44 0220202D */ daddu $a0, $s1, $zero -/* 7E2AC8 80281C48 8E050000 */ lw $a1, ($s0) -/* 7E2ACC 80281C4C 0C0B1EAF */ jal get_variable -/* 7E2AD0 80281C50 0040802D */ daddu $s0, $v0, $zero -/* 7E2AD4 80281C54 0200202D */ daddu $a0, $s0, $zero -/* 7E2AD8 80281C58 0C03BD05 */ jal func_800EF414 -/* 7E2ADC 80281C5C 0040282D */ daddu $a1, $v0, $zero -/* 7E2AE0 80281C60 44806000 */ mtc1 $zero, $f12 -/* 7E2AE4 80281C64 0C03BCE5 */ jal func_800EF394 -/* 7E2AE8 80281C68 00000000 */ nop -/* 7E2AEC 80281C6C 8FBF0018 */ lw $ra, 0x18($sp) -/* 7E2AF0 80281C70 8FB10014 */ lw $s1, 0x14($sp) -/* 7E2AF4 80281C74 8FB00010 */ lw $s0, 0x10($sp) -/* 7E2AF8 80281C78 24020002 */ addiu $v0, $zero, 2 -/* 7E2AFC 80281C7C 03E00008 */ jr $ra -/* 7E2B00 80281C80 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/asm/nonmatchings/code_7E2AA0/func_80281C84.s b/asm/nonmatchings/code_7E2AA0/func_80281C84.s deleted file mode 100644 index b8f5019d0e..0000000000 --- a/asm/nonmatchings/code_7E2AA0/func_80281C84.s +++ /dev/null @@ -1,14 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80281C84 -/* 7E2B04 80281C84 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 7E2B08 80281C88 AFBF0010 */ sw $ra, 0x10($sp) -/* 7E2B0C 80281C8C 0C03BCF9 */ jal func_800EF3E4 -/* 7E2B10 80281C90 00000000 */ nop -/* 7E2B14 80281C94 0C03BCE9 */ jal func_800EF3A4 -/* 7E2B18 80281C98 00000000 */ nop -/* 7E2B1C 80281C9C 8FBF0010 */ lw $ra, 0x10($sp) -/* 7E2B20 80281CA0 24020002 */ addiu $v0, $zero, 2 -/* 7E2B24 80281CA4 03E00008 */ jr $ra -/* 7E2B28 80281CA8 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/code_7E2AA0/func_80282314.s b/asm/nonmatchings/code_7E2AA0/func_80282314.s deleted file mode 100644 index 648480369d..0000000000 --- a/asm/nonmatchings/code_7E2AA0/func_80282314.s +++ /dev/null @@ -1,8 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80282314 -/* 7E3194 80282314 8C820088 */ lw $v0, 0x88($a0) -/* 7E3198 80282318 AC820074 */ sw $v0, 0x74($a0) -/* 7E319C 8028231C 03E00008 */ jr $ra -/* 7E31A0 80282320 24020002 */ addiu $v0, $zero, 2 diff --git a/asm/nonmatchings/code_7E2AA0/func_80282324.s b/asm/nonmatchings/code_7E2AA0/func_80282324.s deleted file mode 100644 index 957cfd660d..0000000000 --- a/asm/nonmatchings/code_7E2AA0/func_80282324.s +++ /dev/null @@ -1,9 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80282324 -/* 7E31A4 80282324 8C820074 */ lw $v0, 0x74($a0) -/* 7E31A8 80282328 8C420000 */ lw $v0, ($v0) -/* 7E31AC 8028232C AC820084 */ sw $v0, 0x84($a0) -/* 7E31B0 80282330 03E00008 */ jr $ra -/* 7E31B4 80282334 24020002 */ addiu $v0, $zero, 2 diff --git a/asm/nonmatchings/code_7E2AA0/func_80282338.s b/asm/nonmatchings/code_7E2AA0/func_80282338.s deleted file mode 100644 index a10ba2b7f1..0000000000 --- a/asm/nonmatchings/code_7E2AA0/func_80282338.s +++ /dev/null @@ -1,17 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80282338 -/* 7E31B8 80282338 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 7E31BC 8028233C AFBF0014 */ sw $ra, 0x14($sp) -/* 7E31C0 80282340 AFB00010 */ sw $s0, 0x10($sp) -/* 7E31C4 80282344 8C82000C */ lw $v0, 0xc($a0) -/* 7E31C8 80282348 8C450000 */ lw $a1, ($v0) -/* 7E31CC 8028234C 0C0B1EAF */ jal get_variable -/* 7E31D0 80282350 8C900074 */ lw $s0, 0x74($a0) -/* 7E31D4 80282354 AE020000 */ sw $v0, ($s0) -/* 7E31D8 80282358 8FBF0014 */ lw $ra, 0x14($sp) -/* 7E31DC 8028235C 8FB00010 */ lw $s0, 0x10($sp) -/* 7E31E0 80282360 24020002 */ addiu $v0, $zero, 2 -/* 7E31E4 80282364 03E00008 */ jr $ra -/* 7E31E8 80282368 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/code_7E2AA0/func_802825FC.s b/asm/nonmatchings/code_7E2AA0/func_802825FC.s deleted file mode 100644 index 71d8d42587..0000000000 --- a/asm/nonmatchings/code_7E2AA0/func_802825FC.s +++ /dev/null @@ -1,9 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802825FC -/* 7E347C 802825FC 24020001 */ addiu $v0, $zero, 1 -/* 7E3480 80282600 3C018015 */ lui $at, 0x8015 -/* 7E3484 80282604 AC221310 */ sw $v0, 0x1310($at) -/* 7E3488 80282608 03E00008 */ jr $ra -/* 7E348C 8028260C 24020002 */ addiu $v0, $zero, 2 diff --git a/asm/nonmatchings/code_7E2AA0/func_80282610.s b/asm/nonmatchings/code_7E2AA0/func_80282610.s deleted file mode 100644 index b445ffe24d..0000000000 --- a/asm/nonmatchings/code_7E2AA0/func_80282610.s +++ /dev/null @@ -1,9 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80282610 -/* 7E3490 80282610 24020002 */ addiu $v0, $zero, 2 -/* 7E3494 80282614 3C018015 */ lui $at, 0x8015 -/* 7E3498 80282618 AC221310 */ sw $v0, 0x1310($at) -/* 7E349C 8028261C 03E00008 */ jr $ra -/* 7E34A0 80282620 00000000 */ nop diff --git a/asm/nonmatchings/code_7E2AA0/func_80282624.s b/asm/nonmatchings/code_7E2AA0/func_80282624.s deleted file mode 100644 index d80647a547..0000000000 --- a/asm/nonmatchings/code_7E2AA0/func_80282624.s +++ /dev/null @@ -1,8 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80282624 -/* 7E34A4 80282624 3C018015 */ lui $at, 0x8015 -/* 7E34A8 80282628 AC201310 */ sw $zero, 0x1310($at) -/* 7E34AC 8028262C 03E00008 */ jr $ra -/* 7E34B0 80282630 24020002 */ addiu $v0, $zero, 2 diff --git a/asm/nonmatchings/code_7E2AA0/func_802827CC.s b/asm/nonmatchings/code_7E2AA0/func_802827CC.s deleted file mode 100644 index 04d85f1b98..0000000000 --- a/asm/nonmatchings/code_7E2AA0/func_802827CC.s +++ /dev/null @@ -1,43 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802827CC -/* 7E364C 802827CC 8C830074 */ lw $v1, 0x74($a0) -/* 7E3650 802827D0 8C620004 */ lw $v0, 4($v1) -/* 7E3654 802827D4 AC82008C */ sw $v0, 0x8c($a0) -/* 7E3658 802827D8 C460000C */ lwc1 $f0, 0xc($v1) -/* 7E365C 802827DC 4600008D */ trunc.w.s $f2, $f0 -/* 7E3660 802827E0 E4820090 */ swc1 $f2, 0x90($a0) -/* 7E3664 802827E4 C4600010 */ lwc1 $f0, 0x10($v1) -/* 7E3668 802827E8 4600008D */ trunc.w.s $f2, $f0 -/* 7E366C 802827EC E4820094 */ swc1 $f2, 0x94($a0) -/* 7E3670 802827F0 C4600014 */ lwc1 $f0, 0x14($v1) -/* 7E3674 802827F4 4600008D */ trunc.w.s $f2, $f0 -/* 7E3678 802827F8 E4820098 */ swc1 $f2, 0x98($a0) -/* 7E367C 802827FC C4600018 */ lwc1 $f0, 0x18($v1) -/* 7E3680 80282800 4600008D */ trunc.w.s $f2, $f0 -/* 7E3684 80282804 E482009C */ swc1 $f2, 0x9c($a0) -/* 7E3688 80282808 C460001C */ lwc1 $f0, 0x1c($v1) -/* 7E368C 8028280C 4600008D */ trunc.w.s $f2, $f0 -/* 7E3690 80282810 E48200A0 */ swc1 $f2, 0xa0($a0) -/* 7E3694 80282814 C4600020 */ lwc1 $f0, 0x20($v1) -/* 7E3698 80282818 4600008D */ trunc.w.s $f2, $f0 -/* 7E369C 8028281C E48200A4 */ swc1 $f2, 0xa4($a0) -/* 7E36A0 80282820 C4600024 */ lwc1 $f0, 0x24($v1) -/* 7E36A4 80282824 4600008D */ trunc.w.s $f2, $f0 -/* 7E36A8 80282828 E48200A8 */ swc1 $f2, 0xa8($a0) -/* 7E36AC 8028282C C4600028 */ lwc1 $f0, 0x28($v1) -/* 7E36B0 80282830 4600008D */ trunc.w.s $f2, $f0 -/* 7E36B4 80282834 E48200AC */ swc1 $f2, 0xac($a0) -/* 7E36B8 80282838 8C62002C */ lw $v0, 0x2c($v1) -/* 7E36BC 8028283C AC8200B0 */ sw $v0, 0xb0($a0) -/* 7E36C0 80282840 8C620030 */ lw $v0, 0x30($v1) -/* 7E36C4 80282844 AC8200B4 */ sw $v0, 0xb4($a0) -/* 7E36C8 80282848 8C620034 */ lw $v0, 0x34($v1) -/* 7E36CC 8028284C AC8200B8 */ sw $v0, 0xb8($a0) -/* 7E36D0 80282850 8C620038 */ lw $v0, 0x38($v1) -/* 7E36D4 80282854 AC8200BC */ sw $v0, 0xbc($a0) -/* 7E36D8 80282858 8C62003C */ lw $v0, 0x3c($v1) -/* 7E36DC 8028285C AC8200C0 */ sw $v0, 0xc0($a0) -/* 7E36E0 80282860 03E00008 */ jr $ra -/* 7E36E4 80282864 24020002 */ addiu $v0, $zero, 2 diff --git a/asm/nonmatchings/code_7E2AA0/func_80282868.s b/asm/nonmatchings/code_7E2AA0/func_80282868.s deleted file mode 100644 index 88a0202882..0000000000 --- a/asm/nonmatchings/code_7E2AA0/func_80282868.s +++ /dev/null @@ -1,10 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80282868 -/* 7E36E8 80282868 8C820074 */ lw $v0, 0x74($a0) -/* 7E36EC 8028286C AC820088 */ sw $v0, 0x88($a0) -/* 7E36F0 80282870 03E00008 */ jr $ra -/* 7E36F4 80282874 24020002 */ addiu $v0, $zero, 2 -/* 7E36F8 80282878 00000000 */ nop -/* 7E36FC 8028287C 00000000 */ nop diff --git a/include/functions.h b/include/functions.h index 88f6ecd129..c933af98b7 100644 --- a/include/functions.h +++ b/include/functions.h @@ -47,6 +47,9 @@ s32 func_800554A4(s32, s32); s32 func_800554E8(s32, s32); s32 func_800555E4(s32); s32 osGetId(); + +s32 func_800EF394(f32); + void func_8011B7C0(u16, s32, s32); void func_80137D88(s32, f32); void func_80137DA4(s32, f32); diff --git a/include/variables.h b/include/variables.h index ae18f03897..e2e71a94f4 100644 --- a/include/variables.h +++ b/include/variables.h @@ -62,6 +62,8 @@ extern Npc* gPlayerNpcPtr; extern s8 D_800A0900; extern EncounterStatus gCurrentEncounter; +extern s16 D_80151308; +extern s32 D_80151310; extern s16* D_80151328; extern s16 D_8010CD10; extern s16 D_8010CD12; @@ -88,7 +90,6 @@ extern u16 gMapTransitionAlpha; extern u16 D_800A0942; extern s16 D_800A0944; -extern s16 D_80151308; extern s32 gGameState; extern s32 D_8009A650[1]; @@ -105,7 +106,11 @@ extern s8 D_8010EBB0; extern SaveData gCurrentSaveFile; +extern s32 D_802D9CA4; extern u32* gMapFlags; extern u32* gMapVars; +extern s32 gNumScripts; + +extern f32 D_80286540; #endif diff --git a/src/code_167570.c b/src/code_167570.c index 45758bacc5..befd8c64eb 100644 --- a/src/code_167570.c +++ b/src/code_167570.c @@ -8,6 +8,8 @@ INCLUDE_ASM(s32, "code_167570", func_80247198); INCLUDE_ASM(s32, "code_167570", func_802471EC); -INCLUDE_ASM(s32, "code_167570", func_80247D14); +void func_80247D14(void) { +} -INCLUDE_ASM(s32, "code_167570", func_80247D1C); +void func_80247D1C(void) { +} diff --git a/src/code_7E2AA0.c b/src/code_7E2AA0.c index 668652e8e6..d5a46e5337 100644 --- a/src/code_7E2AA0.c +++ b/src/code_7E2AA0.c @@ -1,18 +1,59 @@ #include "common.h" -INCLUDE_ASM(s32, "code_7E2AA0", func_80281C20); +typedef struct { +/* 0x00 */ s32 unk_00; +/* 0x04 */ s32 unk_04; +/* 0x08 */ s16 unk_08; +/* 0x0A */ s16 unk_0A; +/* 0x0C */ f32 unk_0C; +/* 0x10 */ f32 unk_10; +/* 0x14 */ f32 unk_14; +/* 0x18 */ f32 unk_18; +/* 0x1C */ f32 unk_1C; +/* 0x20 */ f32 unk_20; +/* 0x24 */ f32 unk_24; +/* 0x28 */ f32 unk_28; +/* 0x2C */ s32* unk_2C; +/* 0x30 */ s32* unk_30; +/* 0x34 */ s32 unk_34; +/* 0x38 */ s32* unk_38; +/* 0x3C */ s32 unk_3C; +} DoorStuff; -INCLUDE_ASM(s32, "code_7E2AA0", func_80281C84); +ApiStatus func_80281C20(ScriptInstance* script, s32 isInitialCall) { + Bytecode* thisPos = script->ptrReadPos; + + func_800EF414(get_variable(script, *thisPos++), get_variable(script, *thisPos++)); + func_800EF394(0.0f); + return ApiStatus_DONE2; +} + +ApiStatus func_80281C84(ScriptInstance* script, s32 isInitialCall) { + func_800EF3E4(); + func_800EF3A4(); + return ApiStatus_DONE2; +} INCLUDE_ASM(s32, "code_7E2AA0", MakeDoorAdvanced); INCLUDE_ASM(s32, "code_7E2AA0", func_802822A8); -INCLUDE_ASM(s32, "code_7E2AA0", func_80282314); +ApiStatus func_80282314(ScriptInstance* script, s32 isInitialCall) { + script->functionTemp[1] = script->varTable[1]; + return ApiStatus_DONE2; +} -INCLUDE_ASM(s32, "code_7E2AA0", func_80282324); +ApiStatus func_80282324(ScriptInstance* script, s32 isInitialCall) { + script->varTable[0] = *(UNK_TYPE*)script->functionTemp[1]; + return ApiStatus_DONE2; +} -INCLUDE_ASM(s32, "code_7E2AA0", func_80282338); +ApiStatus func_80282338(ScriptInstance* script, s32 isInitialCall) { + UNK_TYPE* temp_s0 = script->functionTemp[1]; + + *temp_s0 = get_variable(script, *script->ptrReadPos); + return ApiStatus_DONE2; +} INCLUDE_ASM(s32, "code_7E2AA0", func_8028236C); @@ -20,13 +61,43 @@ INCLUDE_ASM(s32, "code_7E2AA0", func_802823B0); INCLUDE_ASM(s32, "code_7E2AA0", func_80282414); +#ifdef NON_MATCHING +ApiStatus func_80282594(ScriptInstance* script, s32 isInitialCall) { + Camera* camera; + Camera* camera2; + f32 temp_f0; + + temp_f0 = get_float_variable(script, *script->ptrReadPos); + camera = &gCameras[0]; + camera2 = &gCameras[0]; + + if (temp_f0 >= 0.0f) { + D_80286540 = camera->moveSpeed; + camera2->moveSpeed = temp_f0; + } else { + camera2->moveSpeed = D_80286540; + } + + return ApiStatus_DONE2; +} +#else INCLUDE_ASM(s32, "code_7E2AA0", func_80282594); +#endif -INCLUDE_ASM(s32, "code_7E2AA0", func_802825FC); +ApiStatus func_802825FC(ScriptInstance* script, s32 isInitialCall) { + D_80151310 = 1; + return ApiStatus_DONE2; +} -INCLUDE_ASM(s32, "code_7E2AA0", func_80282610); +ApiStatus func_80282610(ScriptInstance* script, s32 isInitialCall) { + D_80151310 = 2; + return ApiStatus_DONE2; +} -INCLUDE_ASM(s32, "code_7E2AA0", func_80282624); +ApiStatus func_80282624(ScriptInstance* script, s32 isInitialCall) { + D_80151310 = 0; + return ApiStatus_DONE2; +} INCLUDE_ASM(s32, "code_7E2AA0", func_80282634); @@ -35,7 +106,32 @@ INCLUDE_ASM(s32, "code_7E2AA0", func_80282700); INCLUDE_ASM(s32, "code_7E2AA0", func_80282774); INCLUDE_ASM(s32, "code_7E2AA0", func_802827A8); +/*ApiStatus func_802827A8(ScriptInstance* script, s32 isInitialCall) { + func_80134230(script->functionTemp[1]->unkA); + return ApiStatus_DONE2; +}*/ -INCLUDE_ASM(s32, "code_7E2AA0", func_802827CC); +ApiStatus func_802827CC(ScriptInstance* script, s32 isInitialCall) { + DoorStuff* temp = script->functionTemp[1]; -INCLUDE_ASM(s32, "code_7E2AA0", func_80282868); + script->varTable[2] = temp->unk_04; + script->varTable[3] = temp->unk_0C; + script->varTable[4] = temp->unk_10; + script->varTable[5] = temp->unk_14; + script->varTable[6] = temp->unk_18; + script->varTable[7] = temp->unk_1C; + script->varTable[8] = temp->unk_20; + script->varTable[9] = temp->unk_24; + script->varTable[10] = temp->unk_28; + script->varTable[11] = temp->unk_2C; + script->varTable[12] = temp->unk_30; + script->varTable[13] = temp->unk_34; + script->varTable[14] = temp->unk_38; + script->varTable[15] = temp->unk_3C; + return ApiStatus_DONE2; +} + +ApiStatus func_80282868(ScriptInstance* script, s32 isInitialCall) { + script->varTable[1] = script->functionTemp[1]; + return ApiStatus_DONE2; +} diff --git a/src/code_838b0_len_5900.c b/src/code_838b0_len_5900.c index e82bb3cc25..e339d49871 100644 --- a/src/code_838b0_len_5900.c +++ b/src/code_838b0_len_5900.c @@ -85,7 +85,7 @@ INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF314); INCLUDE_ASM(s32, "code_838b0_len_5900", enable_partner_ai); -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF394); +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF394, f32 arg0); INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF3A4); diff --git a/src/code_e92d0_len_5da0.c b/src/code_e92d0_len_5da0.c index ea34b8800b..75ec46b6a5 100644 --- a/src/code_e92d0_len_5da0.c +++ b/src/code_e92d0_len_5da0.c @@ -9,8 +9,9 @@ s32 si_goto_end_case(ScriptInstance* script); f32 fixed_var_to_float(s32 scriptVar) { if (scriptVar <= -220000000) { return (scriptVar + 230000000) * (1 / 1024.0f); + } else { + return scriptVar; } - return scriptVar; } s32 float_to_fixed_var(f32 value) { @@ -1064,7 +1065,31 @@ ApiStatus func_802C94A0(ScriptInstance* script, s32 isInitialCall) { return ApiStatus_DONE2; } +#ifdef NON_MATCHING +/*ApiStatus SetModelFlags(ScriptInstance* script, s32 isInitialCall) { + Bytecode* thisPos = script->ptrReadPos; + s32 listIndex; + Bytecode zvar; + Bytecode avar; + Bytecode flag; + Model* model; + + listIndex = get_model_list_index_from_tree_index(get_variable(script, *thisPos++)); + zvar = thisPos[1]; + avar = thisPos[0]; + flag = get_variable(script, zvar); + model = get_model_from_list_index(listIndex); + + if (flag != 0) { + model->flags |= avar; + } else { + model->flags &= ~avar; + } + return ApiStatus_DONE2; +}*/ +#else INCLUDE_ASM(s32, "code_e92d0_len_5da0", SetModelFlags, ScriptInstance* script, s32 isInitialCall); +#endif INCLUDE_ASM(s32, "code_e92d0_len_5da0", func_802C95A0); diff --git a/tools/asm_sizes.py b/tools/asm_sizes.py new file mode 100755 index 0000000000..37728164bf --- /dev/null +++ b/tools/asm_sizes.py @@ -0,0 +1,45 @@ +import glob +import os +import re + +sizes = {} + +def calc_insns(f_path): + ret = 0 + with open(f_path) as f: + f_lines = f.readlines() + for line in f_lines: + if line.startswith("/* "): + ret += 1 + return ret + +def do_dir(root, dir): + max = 0 + min = None + total = 0 + + files = glob.glob(os.path.join(root, dir) + "/*.s") + + for f in files: + amt = calc_insns(f) + if amt > max: + max = amt + if min is None or amt < min: + min = amt + total += amt + + avg = 0 if len(files) == 0 else total / len(files) + + sizes[dir] = ((min, max, total, avg)) + + +script_dir = os.path.dirname(os.path.realpath(__file__)) +asm_dir = script_dir + "/../asm/nonmatchings" + +for root, dirs, files in os.walk(asm_dir): + for asm_dir in dirs: + 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])) diff --git a/undefined_syms.txt b/undefined_syms.txt index 7c139b24dd..a346d77a78 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -66,6 +66,7 @@ D_802E0D90 = 0x802E0D90; D_802EB3D0 = 0x802EB3D0; D_80268000 = 0x80268000; +D_80286540 = 0x80286540; D_802FB800 = 0x802FB800; D_803DA800 = 0x803DA800; @@ -78,6 +79,7 @@ D_00316F30 = 0x00316F30; D_8010D000 = 0x8010D000; D_8014F140 = 0x8014F140; D_80151308 = 0x80151308; +D_80151310 = 0x80151310; D_80151328 = 0x80151328; gCurrentDoorSoundsSet = 0x80151340; @@ -125,8 +127,10 @@ gScriptListCount = 0x802DAC98; gCurrentSaveFile = 0x800DACC0; +D_802D9CA4 = 0x802D9CA4; gMapFlags = 0x802DA480; gMapVars = 0x802DA484; +gNumScripts = 0x802DA488; func_802A91F8 = 0x802A91F8; func_802A9208 = 0x802A9208;