From 82e3e13378686b0254449ebf834c6d7ed2cf0230 Mon Sep 17 00:00:00 2001 From: PonderMan Date: Fri, 12 Feb 2021 07:11:41 -0600 Subject: [PATCH 1/6] Match 80240040 --- .../code_EF2650/func_80240040_EF2650.s | 16 ---------------- src/code_EF2650.c | 7 ++++++- 2 files changed, 6 insertions(+), 17 deletions(-) delete mode 100644 asm/nonmatchings/code_EF2650/func_80240040_EF2650.s diff --git a/asm/nonmatchings/code_EF2650/func_80240040_EF2650.s b/asm/nonmatchings/code_EF2650/func_80240040_EF2650.s deleted file mode 100644 index 14d8a4a504..0000000000 --- a/asm/nonmatchings/code_EF2650/func_80240040_EF2650.s +++ /dev/null @@ -1,16 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80240040_EF2650 -/* EF2650 80240040 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* EF2654 80240044 AFBF0010 */ sw $ra, 0x10($sp) -/* EF2658 80240048 8C82000C */ lw $v0, 0xc($a0) -/* EF265C 8024004C 3C068017 */ lui $a2, %hi(D_80169B16) -/* EF2660 80240050 84C69B16 */ lh $a2, %lo(D_80169B16)($a2) -/* EF2664 80240054 0C0B551A */ jal func_802D5468 -/* EF2668 80240058 8C450000 */ lw $a1, ($v0) -/* EF266C 8024005C 8FBF0010 */ lw $ra, 0x10($sp) -/* EF2670 80240060 24020002 */ addiu $v0, $zero, 2 -/* EF2674 80240064 03E00008 */ jr $ra -/* EF2678 80240068 27BD0018 */ addiu $sp, $sp, 0x18 -/* EF267C 8024006C 00000000 */ nop diff --git a/src/code_EF2650.c b/src/code_EF2650.c index 9909ad6690..01717331f7 100644 --- a/src/code_EF2650.c +++ b/src/code_EF2650.c @@ -1,3 +1,8 @@ #include "common.h" -INCLUDE_ASM(s32, "code_EF2650", func_80240040_EF2650); +extern s16 D_80169B16; + +ApiStatus func_80240040_EF2650(ScriptInstance* script, s32 isInitialCall) { + func_802D5468(script,*script->ptrReadPos, D_80169B16); + return 2; +} From 0ca39b161b0a9f5552e5bd5de96ddf1aa5110a18 Mon Sep 17 00:00:00 2001 From: PonderMan Date: Fri, 12 Feb 2021 07:23:23 -0600 Subject: [PATCH 2/6] Fixed Syntax --- src/code_EF2650.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/code_EF2650.c b/src/code_EF2650.c index 01717331f7..0a2b0e3851 100644 --- a/src/code_EF2650.c +++ b/src/code_EF2650.c @@ -3,6 +3,6 @@ extern s16 D_80169B16; ApiStatus func_80240040_EF2650(ScriptInstance* script, s32 isInitialCall) { - func_802D5468(script,*script->ptrReadPos, D_80169B16); - return 2; + func_802D5468(script, *script->ptrReadPos, D_80169B16); + return ApiStatus_DONE2; } From 5f91533980818e091c20dbb7262217300d44bb53 Mon Sep 17 00:00:00 2001 From: PonderMan Date: Fri, 12 Feb 2021 11:17:49 -0600 Subject: [PATCH 3/6] 80238028 Part 1 --- .../code_714CF0/func_80238000_714CF0.s | 16 ---------------- include/common_structs.h | 2 +- src/battle/partner/twink_714CF0.c | 11 +++++++++-- 3 files changed, 10 insertions(+), 19 deletions(-) delete mode 100644 asm/nonmatchings/code_714CF0/func_80238000_714CF0.s diff --git a/asm/nonmatchings/code_714CF0/func_80238000_714CF0.s b/asm/nonmatchings/code_714CF0/func_80238000_714CF0.s deleted file mode 100644 index d19fa4d381..0000000000 --- a/asm/nonmatchings/code_714CF0/func_80238000_714CF0.s +++ /dev/null @@ -1,16 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80238000_714CF0 -/* 714CF0 80238000 3C02800E */ lui $v0, %hi(gBattleStatus+0x4) -/* 714CF4 80238004 8C42C074 */ lw $v0, %lo(gBattleStatus+0x4)($v0) -/* 714CF8 80238008 30420040 */ andi $v0, $v0, 0x40 -/* 714CFC 8023800C 10400003 */ beqz $v0, .L8023801C -/* 714D00 80238010 24020001 */ addiu $v0, $zero, 1 -/* 714D04 80238014 0808E008 */ j .L80238020 -/* 714D08 80238018 AC820084 */ sw $v0, 0x84($a0) -.L8023801C: -/* 714D0C 8023801C AC800084 */ sw $zero, 0x84($a0) -.L80238020: -/* 714D10 80238020 03E00008 */ jr $ra -/* 714D14 80238024 24020002 */ addiu $v0, $zero, 2 diff --git a/include/common_structs.h b/include/common_structs.h index 8f712bd2bd..0f59aa8b7b 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -123,7 +123,7 @@ typedef struct Npc { /* 0x078 */ s32 shadowIndex; /* 0x07C */ f32 shadowScale; /* 0x080 */ s32 unk_80; - /* 0x084 */ char unk_84[4]; + /* 0x084 */ s32 unk_84; /* 0x088 */ s16 isFacingAway; /* 0x08A */ s16 yawCamOffset; /* 0x08C */ s16 unk_8C; diff --git a/src/battle/partner/twink_714CF0.c b/src/battle/partner/twink_714CF0.c index 84df7c87e0..281485b231 100644 --- a/src/battle/partner/twink_714CF0.c +++ b/src/battle/partner/twink_714CF0.c @@ -1,5 +1,12 @@ #include "common.h" -INCLUDE_ASM(s32, "battle/partner/twink_714CF0", func_80238000_714CF0); - +ApiStatus func_80238000_714CF0(ScriptInstance *arg0) { + BattleStatus* battleStatus = BATTLE_STATUS; + if ((battleStatus->flags2 & 0x40) != 0) { + arg0->varTable[0] = 1; + } else { + arg0->varTable[0] = 0; + } + return ApiStatus_DONE2; +} INCLUDE_ASM(s32, "battle/partner/twink_714CF0", func_80238028_714D18); From 8f8eb69b3a902d1106fdb64ac214d9fabbec4bbd Mon Sep 17 00:00:00 2001 From: PonderMan Date: Fri, 12 Feb 2021 11:43:59 -0600 Subject: [PATCH 4/6] 80238000 Part 1 Update --- include/common_structs.h | 2 +- src/battle/partner/twink_714CF0.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/common_structs.h b/include/common_structs.h index 0f59aa8b7b..8f712bd2bd 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -123,7 +123,7 @@ typedef struct Npc { /* 0x078 */ s32 shadowIndex; /* 0x07C */ f32 shadowScale; /* 0x080 */ s32 unk_80; - /* 0x084 */ s32 unk_84; + /* 0x084 */ char unk_84[4]; /* 0x088 */ s16 isFacingAway; /* 0x08A */ s16 yawCamOffset; /* 0x08C */ s16 unk_8C; diff --git a/src/battle/partner/twink_714CF0.c b/src/battle/partner/twink_714CF0.c index 281485b231..dcff298056 100644 --- a/src/battle/partner/twink_714CF0.c +++ b/src/battle/partner/twink_714CF0.c @@ -1,12 +1,14 @@ #include "common.h" -ApiStatus func_80238000_714CF0(ScriptInstance *arg0) { +ApiStatus func_80238000_714CF0(ScriptInstance* script, s32 isInitialCall) { BattleStatus* battleStatus = BATTLE_STATUS; - if ((battleStatus->flags2 & 0x40) != 0) { - arg0->varTable[0] = 1; + + if (battleStatus->flags2 & 0x40) { + script->varTable[0] = 1; } else { - arg0->varTable[0] = 0; + script->varTable[0] = 0; } return ApiStatus_DONE2; } + INCLUDE_ASM(s32, "battle/partner/twink_714CF0", func_80238028_714D18); From de2861de818b28a4bff366a9fe46b0635807d87c Mon Sep 17 00:00:00 2001 From: PonderMan Date: Fri, 12 Feb 2021 11:49:38 -0600 Subject: [PATCH 5/6] Removed asm file --- .../partner/twink_714CF0/func_80238000_714CF0.s | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 asm/nonmatchings/battle/partner/twink_714CF0/func_80238000_714CF0.s diff --git a/asm/nonmatchings/battle/partner/twink_714CF0/func_80238000_714CF0.s b/asm/nonmatchings/battle/partner/twink_714CF0/func_80238000_714CF0.s deleted file mode 100644 index d19fa4d381..0000000000 --- a/asm/nonmatchings/battle/partner/twink_714CF0/func_80238000_714CF0.s +++ /dev/null @@ -1,16 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80238000_714CF0 -/* 714CF0 80238000 3C02800E */ lui $v0, %hi(gBattleStatus+0x4) -/* 714CF4 80238004 8C42C074 */ lw $v0, %lo(gBattleStatus+0x4)($v0) -/* 714CF8 80238008 30420040 */ andi $v0, $v0, 0x40 -/* 714CFC 8023800C 10400003 */ beqz $v0, .L8023801C -/* 714D00 80238010 24020001 */ addiu $v0, $zero, 1 -/* 714D04 80238014 0808E008 */ j .L80238020 -/* 714D08 80238018 AC820084 */ sw $v0, 0x84($a0) -.L8023801C: -/* 714D0C 8023801C AC800084 */ sw $zero, 0x84($a0) -.L80238020: -/* 714D10 80238020 03E00008 */ jr $ra -/* 714D14 80238024 24020002 */ addiu $v0, $zero, 2 From b7ead7f4f62dae5460e9003de8fed81ced0e389c Mon Sep 17 00:00:00 2001 From: PonderMan Date: Fri, 12 Feb 2021 11:54:33 -0600 Subject: [PATCH 6/6] space before return --- src/battle/partner/twink_714CF0.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/battle/partner/twink_714CF0.c b/src/battle/partner/twink_714CF0.c index dcff298056..a3c8f8ee37 100644 --- a/src/battle/partner/twink_714CF0.c +++ b/src/battle/partner/twink_714CF0.c @@ -8,6 +8,7 @@ ApiStatus func_80238000_714CF0(ScriptInstance* script, s32 isInitialCall) { } else { script->varTable[0] = 0; } + return ApiStatus_DONE2; }