From 4ab558d628e0265ce8000ecfb5b0c7b537fd5bb3 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Mon, 23 Mar 2020 17:33:12 -0400 Subject: [PATCH 1/8] Almost done --- .../ovl_Bg_Spot09_Obj/BgSpot09Obj_Destroy.s | 19 -- .../ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s | 18 ++ .../ovl_Bg_Spot09_Obj/BgSpot09Obj_Init.s | 57 ------ .../ovl_Bg_Spot09_Obj/BgSpot09Obj_Update.s | 6 - .../actors/ovl_Bg_Spot09_Obj/func_808B1BA0.s | 26 --- .../actors/ovl_Bg_Spot09_Obj/func_808B1BEC.s | 40 ----- .../actors/ovl_Bg_Spot09_Obj/func_808B1C70.s | 37 ---- .../actors/ovl_Bg_Spot09_Obj/func_808B1CEC.s | 15 -- .../actors/ovl_Bg_Spot09_Obj/func_808B1D18.s | 15 -- .../actors/ovl_Bg_Spot09_Obj/func_808B1D44.s | 21 --- data/overlays/actors/z_bg_spot09_obj.data.s | 28 --- data/overlays/actors/z_bg_spot09_obj.rodata.s | 38 ---- spec | 2 - .../ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 164 ++++++++++++++++-- .../ovl_Bg_Spot09_Obj/z_bg_spot09_obj.h | 4 +- undefined_syms.txt | 3 + 16 files changed, 175 insertions(+), 318 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Destroy.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Init.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Update.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BA0.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BEC.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1C70.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1CEC.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D18.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D44.s delete mode 100644 data/overlays/actors/z_bg_spot09_obj.data.s delete mode 100644 data/overlays/actors/z_bg_spot09_obj.rodata.s diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Destroy.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Destroy.s deleted file mode 100644 index 2201d2e723..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Destroy.s +++ /dev/null @@ -1,19 +0,0 @@ -glabel BgSpot09Obj_Destroy -/* 0035C 808B1E3C 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00360 808B1E40 AFBF0014 */ sw $ra, 0x0014($sp) -/* 00364 808B1E44 AFA40018 */ sw $a0, 0x0018($sp) -/* 00368 808B1E48 848F001C */ lh $t7, 0x001C($a0) ## 0000001C -/* 0036C 808B1E4C 00807025 */ or $t6, $a0, $zero ## $t6 = 00000000 -/* 00370 808B1E50 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00374 808B1E54 11E00003 */ beq $t7, $zero, .L808B1E64 -/* 00378 808B1E58 24A50810 */ addiu $a1, $a1, 0x0810 ## $a1 = 00000810 -/* 0037C 808B1E5C 0C00FB56 */ jal DynaPolyInfo_Free - ## DynaPolyInfo_delReserve -/* 00380 808B1E60 8DC6014C */ lw $a2, 0x014C($t6) ## 0000014C -.L808B1E64: -/* 00384 808B1E64 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00388 808B1E68 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 0038C 808B1E6C 03E00008 */ jr $ra -/* 00390 808B1E70 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s index f87970d293..a6c32f3d69 100644 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s +++ b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s @@ -1,3 +1,21 @@ +.rdata + +glabel D_808B207C + + .asciz "../z_bg_spot09_obj.c" + .balign 4 + +glabel D_808B2094 + + .asciz "../z_bg_spot09_obj.c" + .balign 4 + +glabel D_808B20AC + .asciz "../z_bg_spot09_obj.c" + .balign 4 + +.text + glabel BgSpot09Obj_Draw /* 003A0 808B1E80 27BDFFC0 */ addiu $sp, $sp, 0xFFC0 ## $sp = FFFFFFC0 /* 003A4 808B1E84 AFB00014 */ sw $s0, 0x0014($sp) diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Init.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Init.s deleted file mode 100644 index cef88b2b9d..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Init.s +++ /dev/null @@ -1,57 +0,0 @@ -glabel BgSpot09Obj_Init -/* 002A4 808B1D84 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0 -/* 002A8 808B1D88 AFB00018 */ sw $s0, 0x0018($sp) -/* 002AC 808B1D8C 3C068016 */ lui $a2, 0x8016 ## $a2 = 80160000 -/* 002B0 808B1D90 94C6F546 */ lhu $a2, -0x0ABA($a2) ## 8015F546 -/* 002B4 808B1D94 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 002B8 808B1D98 AFBF001C */ sw $ra, 0x001C($sp) -/* 002BC 808B1D9C AFA50024 */ sw $a1, 0x0024($sp) -/* 002C0 808B1DA0 3C04808B */ lui $a0, %hi(D_808B1FE0) ## $a0 = 808B0000 -/* 002C4 808B1DA4 24841FE0 */ addiu $a0, $a0, %lo(D_808B1FE0) ## $a0 = 808B1FE0 -/* 002C8 808B1DA8 8605001C */ lh $a1, 0x001C($s0) ## 0000001C -/* 002CC 808B1DAC 0C00084C */ jal osSyncPrintf - -/* 002D0 808B1DB0 30C6000F */ andi $a2, $a2, 0x000F ## $a2 = 00000000 -/* 002D4 808B1DB4 860E001C */ lh $t6, 0x001C($s0) ## 0000001C -/* 002D8 808B1DB8 3C04808B */ lui $a0, %hi(D_808B2018) ## $a0 = 808B0000 -/* 002DC 808B1DBC 3C05808B */ lui $a1, %hi(D_808B2064) ## $a1 = 808B0000 -/* 002E0 808B1DC0 31CF00FF */ andi $t7, $t6, 0x00FF ## $t7 = 00000000 -/* 002E4 808B1DC4 A60F001C */ sh $t7, 0x001C($s0) ## 0000001C -/* 002E8 808B1DC8 8607001C */ lh $a3, 0x001C($s0) ## 0000001C -/* 002EC 808B1DCC 24A52064 */ addiu $a1, $a1, %lo(D_808B2064) ## $a1 = 808B2064 -/* 002F0 808B1DD0 24842018 */ addiu $a0, $a0, %lo(D_808B2018) ## $a0 = 808B2018 -/* 002F4 808B1DD4 04E00003 */ bltz $a3, .L808B1DE4 -/* 002F8 808B1DD8 28E10005 */ slti $at, $a3, 0x0005 -/* 002FC 808B1DDC 54200004 */ bnel $at, $zero, .L808B1DF0 -/* 00300 808B1DE0 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -.L808B1DE4: -/* 00304 808B1DE4 0C00084C */ jal osSyncPrintf - -/* 00308 808B1DE8 24060142 */ addiu $a2, $zero, 0x0142 ## $a2 = 00000142 -/* 0030C 808B1DEC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -.L808B1DF0: -/* 00310 808B1DF0 0C22C71C */ jal func_808B1C70 -/* 00314 808B1DF4 8FA50024 */ lw $a1, 0x0024($sp) -/* 00318 808B1DF8 14400005 */ bne $v0, $zero, .L808B1E10 -/* 0031C 808B1DFC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00320 808B1E00 0C00B55C */ jal Actor_Kill - -/* 00324 808B1E04 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00328 808B1E08 10000008 */ beq $zero, $zero, .L808B1E2C -/* 0032C 808B1E0C 8FBF001C */ lw $ra, 0x001C($sp) -.L808B1E10: -/* 00330 808B1E10 0C22C751 */ jal func_808B1D44 -/* 00334 808B1E14 8FA50024 */ lw $a1, 0x0024($sp) -/* 00338 808B1E18 54400004 */ bnel $v0, $zero, .L808B1E2C -/* 0033C 808B1E1C 8FBF001C */ lw $ra, 0x001C($sp) -/* 00340 808B1E20 0C00B55C */ jal Actor_Kill - -/* 00344 808B1E24 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00348 808B1E28 8FBF001C */ lw $ra, 0x001C($sp) -.L808B1E2C: -/* 0034C 808B1E2C 8FB00018 */ lw $s0, 0x0018($sp) -/* 00350 808B1E30 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000 -/* 00354 808B1E34 03E00008 */ jr $ra -/* 00358 808B1E38 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Update.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Update.s deleted file mode 100644 index 04fa8a39b9..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Update.s +++ /dev/null @@ -1,6 +0,0 @@ -glabel BgSpot09Obj_Update -/* 00394 808B1E74 AFA40000 */ sw $a0, 0x0000($sp) -/* 00398 808B1E78 03E00008 */ jr $ra -/* 0039C 808B1E7C AFA50004 */ sw $a1, 0x0004($sp) - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BA0.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BA0.s deleted file mode 100644 index 21df73bd41..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BA0.s +++ /dev/null @@ -1,26 +0,0 @@ -glabel func_808B1BA0 -/* 000C0 808B1BA0 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 000C4 808B1BA4 AFBF0014 */ sw $ra, 0x0014($sp) -/* 000C8 808B1BA8 AFA5001C */ sw $a1, 0x001C($sp) -/* 000CC 808B1BAC 848E001C */ lh $t6, 0x001C($a0) ## 0000001C -/* 000D0 808B1BB0 24010003 */ addiu $at, $zero, 0x0003 ## $at = 00000003 -/* 000D4 808B1BB4 3C053DCC */ lui $a1, 0x3DCC ## $a1 = 3DCC0000 -/* 000D8 808B1BB8 15C10005 */ bne $t6, $at, .L808B1BD0 -/* 000DC 808B1BBC 00000000 */ nop -/* 000E0 808B1BC0 0C00B58B */ jal Actor_SetScale - -/* 000E4 808B1BC4 34A5CCCD */ ori $a1, $a1, 0xCCCD ## $a1 = 3DCCCCCD -/* 000E8 808B1BC8 10000004 */ beq $zero, $zero, .L808B1BDC -/* 000EC 808B1BCC 8FBF0014 */ lw $ra, 0x0014($sp) -.L808B1BD0: -/* 000F0 808B1BD0 0C00B58B */ jal Actor_SetScale - -/* 000F4 808B1BD4 3C053F80 */ lui $a1, 0x3F80 ## $a1 = 3F800000 -/* 000F8 808B1BD8 8FBF0014 */ lw $ra, 0x0014($sp) -.L808B1BDC: -/* 000FC 808B1BDC 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00100 808B1BE0 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001 -/* 00104 808B1BE4 03E00008 */ jr $ra -/* 00108 808B1BE8 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BEC.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BEC.s deleted file mode 100644 index 56294c2b08..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BEC.s +++ /dev/null @@ -1,40 +0,0 @@ -glabel func_808B1BEC -/* 0010C 808B1BEC 27BDFFD0 */ addiu $sp, $sp, 0xFFD0 ## $sp = FFFFFFD0 -/* 00110 808B1BF0 AFBF001C */ sw $ra, 0x001C($sp) -/* 00114 808B1BF4 AFB00018 */ sw $s0, 0x0018($sp) -/* 00118 808B1BF8 AFA50034 */ sw $a1, 0x0034($sp) -/* 0011C 808B1BFC AFA00028 */ sw $zero, 0x0028($sp) -/* 00120 808B1C00 848E001C */ lh $t6, 0x001C($a0) ## 0000001C -/* 00124 808B1C04 3C18808B */ lui $t8, %hi(D_808B1F90) ## $t8 = 808B0000 -/* 00128 808B1C08 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 0012C 808B1C0C 000E7880 */ sll $t7, $t6, 2 -/* 00130 808B1C10 030FC021 */ addu $t8, $t8, $t7 -/* 00134 808B1C14 8F181F90 */ lw $t8, %lo(D_808B1F90)($t8) -/* 00138 808B1C18 53000011 */ beql $t8, $zero, .L808B1C60 -/* 0013C 808B1C1C 8FBF001C */ lw $ra, 0x001C($sp) -/* 00140 808B1C20 0C010D20 */ jal DynaPolyInfo_SetActorMove - -/* 00144 808B1C24 00002825 */ or $a1, $zero, $zero ## $a1 = 00000000 -/* 00148 808B1C28 8619001C */ lh $t9, 0x001C($s0) ## 0000001C -/* 0014C 808B1C2C 3C04808B */ lui $a0, %hi(D_808B1F90) ## $a0 = 808B0000 -/* 00150 808B1C30 27A50028 */ addiu $a1, $sp, 0x0028 ## $a1 = FFFFFFF8 -/* 00154 808B1C34 00194080 */ sll $t0, $t9, 2 -/* 00158 808B1C38 00882021 */ addu $a0, $a0, $t0 -/* 0015C 808B1C3C 0C010620 */ jal DynaPolyInfo_Alloc - -/* 00160 808B1C40 8C841F90 */ lw $a0, %lo(D_808B1F90)($a0) -/* 00164 808B1C44 8FA40034 */ lw $a0, 0x0034($sp) -/* 00168 808B1C48 02003025 */ or $a2, $s0, $zero ## $a2 = 00000000 -/* 0016C 808B1C4C 8FA70028 */ lw $a3, 0x0028($sp) -/* 00170 808B1C50 0C00FA9D */ jal DynaPolyInfo_RegisterActor - ## DynaPolyInfo_setActor -/* 00174 808B1C54 24850810 */ addiu $a1, $a0, 0x0810 ## $a1 = 00000810 -/* 00178 808B1C58 AE02014C */ sw $v0, 0x014C($s0) ## 0000014C -/* 0017C 808B1C5C 8FBF001C */ lw $ra, 0x001C($sp) -.L808B1C60: -/* 00180 808B1C60 8FB00018 */ lw $s0, 0x0018($sp) -/* 00184 808B1C64 27BD0030 */ addiu $sp, $sp, 0x0030 ## $sp = 00000000 -/* 00188 808B1C68 03E00008 */ jr $ra -/* 0018C 808B1C6C 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001 - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1C70.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1C70.s deleted file mode 100644 index 9606370b3d..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1C70.s +++ /dev/null @@ -1,37 +0,0 @@ -glabel func_808B1C70 -/* 00190 808B1C70 27BDFFD8 */ addiu $sp, $sp, 0xFFD8 ## $sp = FFFFFFD8 -/* 00194 808B1C74 AFB30020 */ sw $s3, 0x0020($sp) -/* 00198 808B1C78 AFB00014 */ sw $s0, 0x0014($sp) -/* 0019C 808B1C7C AFB2001C */ sw $s2, 0x001C($sp) -/* 001A0 808B1C80 AFB10018 */ sw $s1, 0x0018($sp) -/* 001A4 808B1C84 3C10808B */ lui $s0, %hi(D_808B1FA4) ## $s0 = 808B0000 -/* 001A8 808B1C88 3C13808B */ lui $s3, %hi(D_808B1FB0) ## $s3 = 808B0000 -/* 001AC 808B1C8C 00808825 */ or $s1, $a0, $zero ## $s1 = 00000000 -/* 001B0 808B1C90 00A09025 */ or $s2, $a1, $zero ## $s2 = 00000000 -/* 001B4 808B1C94 AFBF0024 */ sw $ra, 0x0024($sp) -/* 001B8 808B1C98 26731FB0 */ addiu $s3, $s3, %lo(D_808B1FB0) ## $s3 = 808B1FB0 -/* 001BC 808B1C9C 26101FA4 */ addiu $s0, $s0, %lo(D_808B1FA4) ## $s0 = 808B1FA4 -/* 001C0 808B1CA0 8E190000 */ lw $t9, 0x0000($s0) ## 808B1FA4 -.L808B1CA4: -/* 001C4 808B1CA4 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 001C8 808B1CA8 02402825 */ or $a1, $s2, $zero ## $a1 = 00000000 -/* 001CC 808B1CAC 0320F809 */ jalr $ra, $t9 -/* 001D0 808B1CB0 00000000 */ nop -/* 001D4 808B1CB4 14400003 */ bne $v0, $zero, .L808B1CC4 -/* 001D8 808B1CB8 26100004 */ addiu $s0, $s0, 0x0004 ## $s0 = 808B1FA8 -/* 001DC 808B1CBC 10000004 */ beq $zero, $zero, .L808B1CD0 -/* 001E0 808B1CC0 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000 -.L808B1CC4: -/* 001E4 808B1CC4 5613FFF7 */ bnel $s0, $s3, .L808B1CA4 -/* 001E8 808B1CC8 8E190000 */ lw $t9, 0x0000($s0) ## 808B1FA8 -/* 001EC 808B1CCC 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001 -.L808B1CD0: -/* 001F0 808B1CD0 8FBF0024 */ lw $ra, 0x0024($sp) -/* 001F4 808B1CD4 8FB00014 */ lw $s0, 0x0014($sp) -/* 001F8 808B1CD8 8FB10018 */ lw $s1, 0x0018($sp) -/* 001FC 808B1CDC 8FB2001C */ lw $s2, 0x001C($sp) -/* 00200 808B1CE0 8FB30020 */ lw $s3, 0x0020($sp) -/* 00204 808B1CE4 03E00008 */ jr $ra -/* 00208 808B1CE8 27BD0028 */ addiu $sp, $sp, 0x0028 ## $sp = 00000000 - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1CEC.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1CEC.s deleted file mode 100644 index dd9f40be3f..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1CEC.s +++ /dev/null @@ -1,15 +0,0 @@ -glabel func_808B1CEC -/* 0020C 808B1CEC 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00210 808B1CF0 AFA5001C */ sw $a1, 0x001C($sp) -/* 00214 808B1CF4 AFBF0014 */ sw $ra, 0x0014($sp) -/* 00218 808B1CF8 3C05808B */ lui $a1, %hi(D_808B1FB0) ## $a1 = 808B0000 -/* 0021C 808B1CFC 0C01E037 */ jal Actor_ProcessInitChain - -/* 00220 808B1D00 24A51FB0 */ addiu $a1, $a1, %lo(D_808B1FB0) ## $a1 = 808B1FB0 -/* 00224 808B1D04 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00228 808B1D08 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 0022C 808B1D0C 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001 -/* 00230 808B1D10 03E00008 */ jr $ra -/* 00234 808B1D14 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D18.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D18.s deleted file mode 100644 index 379052251e..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D18.s +++ /dev/null @@ -1,15 +0,0 @@ -glabel func_808B1D18 -/* 00238 808B1D18 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 0023C 808B1D1C AFA5001C */ sw $a1, 0x001C($sp) -/* 00240 808B1D20 AFBF0014 */ sw $ra, 0x0014($sp) -/* 00244 808B1D24 3C05808B */ lui $a1, %hi(D_808B1FBC) ## $a1 = 808B0000 -/* 00248 808B1D28 0C01E037 */ jal Actor_ProcessInitChain - -/* 0024C 808B1D2C 24A51FBC */ addiu $a1, $a1, %lo(D_808B1FBC) ## $a1 = 808B1FBC -/* 00250 808B1D30 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00254 808B1D34 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00258 808B1D38 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001 -/* 0025C 808B1D3C 03E00008 */ jr $ra -/* 00260 808B1D40 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D44.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D44.s deleted file mode 100644 index 702a22028d..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D44.s +++ /dev/null @@ -1,21 +0,0 @@ -glabel func_808B1D44 -/* 00264 808B1D44 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00268 808B1D48 AFBF0014 */ sw $ra, 0x0014($sp) -/* 0026C 808B1D4C 848E001C */ lh $t6, 0x001C($a0) ## 0000001C -/* 00270 808B1D50 24010003 */ addiu $at, $zero, 0x0003 ## $at = 00000003 -/* 00274 808B1D54 15C10005 */ bne $t6, $at, .L808B1D6C -/* 00278 808B1D58 00000000 */ nop -/* 0027C 808B1D5C 0C22C746 */ jal func_808B1D18 -/* 00280 808B1D60 00000000 */ nop -/* 00284 808B1D64 10000004 */ beq $zero, $zero, .L808B1D78 -/* 00288 808B1D68 8FBF0014 */ lw $ra, 0x0014($sp) -.L808B1D6C: -/* 0028C 808B1D6C 0C22C73B */ jal func_808B1CEC -/* 00290 808B1D70 00000000 */ nop -/* 00294 808B1D74 8FBF0014 */ lw $ra, 0x0014($sp) -.L808B1D78: -/* 00298 808B1D78 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 0029C 808B1D7C 03E00008 */ jr $ra -/* 002A0 808B1D80 00000000 */ nop - - diff --git a/data/overlays/actors/z_bg_spot09_obj.data.s b/data/overlays/actors/z_bg_spot09_obj.data.s deleted file mode 100644 index d139abbb9e..0000000000 --- a/data/overlays/actors/z_bg_spot09_obj.data.s +++ /dev/null @@ -1,28 +0,0 @@ -.include "macro.inc" - - # assembler directives - .set noat # allow manual use of $at - .set noreorder # don't insert nops after branches - .set gp=64 # allow use of 64-bit general purposee registers - -.section .data - -glabel Bg_Spot09_Obj_InitVars - .word 0x00B80100, 0x00000000, 0x00AE0000, 0x00000168 -.word BgSpot09Obj_Init -.word BgSpot09Obj_Destroy -.word BgSpot09Obj_Update -.word BgSpot09Obj_Draw -glabel D_808B1F90 - .word 0x00000000, 0x06005520, 0x0600283C, 0x06008458, 0x06007580 -glabel D_808B1FA4 - .word func_808B1BEC -.word func_808B1AE0 -.word func_808B1BA0 -glabel D_808B1FB0 - .word 0xB0F41C20, 0xB0F80BB8, 0x30FC1C20 -glabel D_808B1FBC - .word 0xB0F41C20, 0xB0F80320, 0x30FC05DC -glabel D_808B1FC8 - .word 0x06000100, 0x06003970, 0x06001120, 0x06007D40, 0x06006210, 0x00000000 - diff --git a/data/overlays/actors/z_bg_spot09_obj.rodata.s b/data/overlays/actors/z_bg_spot09_obj.rodata.s deleted file mode 100644 index 5fa755b4eb..0000000000 --- a/data/overlays/actors/z_bg_spot09_obj.rodata.s +++ /dev/null @@ -1,38 +0,0 @@ -.include "macro.inc" - - # assembler directives - .set noat # allow manual use of $at - .set noreorder # don't insert nops after branches - .set gp=64 # allow use of 64-bit general purposee registers - -.section .rodata - -glabel D_808B1FE0 - - .asciz "Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n" - .balign 4 - -glabel D_808B2018 - - .asciz "Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n" - .balign 4 - -glabel D_808B2064 - - .asciz "../z_bg_spot09_obj.c" - .balign 4 - -glabel D_808B207C - - .asciz "../z_bg_spot09_obj.c" - .balign 4 - -glabel D_808B2094 - - .asciz "../z_bg_spot09_obj.c" - .balign 4 - -glabel D_808B20AC - .word 0x2E2E2F7A, 0x5F62675F, 0x73706F74, 0x30395F6F, 0x626A2E63, 0x00000000, 0x00000000, 0x00000000, 0x00000000 - - diff --git a/spec b/spec index 1c5e4ba705..48a72b0d71 100644 --- a/spec +++ b/spec @@ -1458,8 +1458,6 @@ endseg beginseg name "ovl_Bg_Spot09_Obj" include "build/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.o" - include "build/data/overlays/actors/z_bg_spot09_obj.data.o" - include "build/data/overlays/actors/z_bg_spot09_obj.rodata.o" include "build/data/overlays/actors/z_bg_spot09_obj.reloc.o" endseg diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index 7518d97c4e..c121558bcd 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -8,7 +8,10 @@ void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx); void BgSpot09Obj_Update(BgSpot09Obj* this, GlobalContext* globalCtx); void BgSpot09Obj_Draw(BgSpot09Obj* this, GlobalContext* globalCtx); -/* +s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx); +s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx); +s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx); + const ActorInit Bg_Spot09_Obj_InitVars = { ACTOR_BG_SPOT09_OBJ, @@ -22,25 +25,162 @@ const ActorInit Bg_Spot09_Obj_InitVars = (ActorFunc)BgSpot09Obj_Update, (ActorFunc)BgSpot09Obj_Draw, }; -*/ + +u32 D_808B1F90[] = { + 0x00000000, 0x06005520, 0x0600283C, 0x06008458, 0x06007580 +}; + +typedef s32 (*ActorFuncRet)(struct Actor*, struct GlobalContext*); +ActorFuncRet D_808B1FA4[] = { + (ActorFuncRet)func_808B1BEC, (ActorFuncRet)func_808B1AE0, (ActorFuncRet)func_808B1BA0, +}; + +InitChainEntry initChain1[] = { + ICHAIN_F32(unk_F4, 7200, ICHAIN_CONTINUE), + ICHAIN_F32(unk_F8, 3000, ICHAIN_CONTINUE), + ICHAIN_F32(unk_FC, 7200, ICHAIN_STOP), +}; + +InitChainEntry initChain2[] = { + ICHAIN_F32(unk_F4, 7200, ICHAIN_CONTINUE), + ICHAIN_F32(unk_F8, 800, ICHAIN_CONTINUE), + ICHAIN_F32(unk_FC, 1500, ICHAIN_STOP), +}; + +u32 dists[] = { + 0x06000100, 0x06003970, 0x06001120, 0x06007D40, 0x06006210, +}; + +extern UNK_TYPE D_06008010; + #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1AE0.s") +/*void func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { + u16 temp_v1; + s32 phi_v0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BA0.s") + if (gSaveContext->unk1360 >= 4) { + return (u32) arg0->unk1C < 1U; + } + temp_v1 = (u32) ((gSaveContext->unkEE6 & 0xF) ^ 0xF) < 1U; + if (gSaveContext->unk4 != 0) { + phi_v0 = 5; + } else { + phi_v0 = 0x11; + } + if (phi_v0 == 0x11) { + if (arg0->unk1C == 0) { + return (u16)0; + } + if (arg0->unk1C == 1) { + return temp_v1 < 1U; + } + if (arg0->unk1C == 3) { + return (u16)1; + } + if (arg0->unk1C == 4) { + return temp_v1; + } + return (u16)0; + } + return (u32) (arg0->unk1C ^ 2) < 1U; +}*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BEC.s") +s32 func_808B1BA0(BgSpot09Obj *this, GlobalContext *globalCtx) { + Actor* thisx = &this->dyna.actor; + if (thisx->params == 3) { + Actor_SetScale(thisx, 0.1f); + } else { + Actor_SetScale(thisx, 1.0f); + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1C70.s") +s32 func_808B1BEC(BgSpot09Obj *this, GlobalContext *globalCtx) { + Actor* thisx = &this->dyna.actor; + s32 localC = 0; + s32 pad[2]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1CEC.s") + if (D_808B1F90[thisx->params] != 0) { + DynaPolyInfo_SetActorMove(thisx, 0); + DynaPolyInfo_Alloc(D_808B1F90[thisx->params], &localC); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localC); + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D18.s") +s32 func_808B1C70(BgSpot09Obj *this, GlobalContext *globalCtx) { + s32 i; + for (i = 0; i < ARRAY_COUNT(D_808B1FA4); i++) { + if (!D_808B1FA4[i](this, globalCtx)) { + return 0; + } + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D44.s") +s32 func_808B1CEC(BgSpot09Obj* this, GlobalContext* globalCtx) { + Actor_ProcessInitChain(&this->dyna.actor, &initChain1); + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Init.s") +s32 func_808B1D18(BgSpot09Obj* this, GlobalContext* globalCtx) { + Actor_ProcessInitChain(&this->dyna.actor, &initChain2); + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Destroy.s") +s32 func_808B1D44(BgSpot09Obj* this, GlobalContext* globalCtx) { + if (this->dyna.actor.params == 3) { + return func_808B1D18(this, globalCtx); + } else { + return func_808B1CEC(this, globalCtx); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Update.s") +void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s") + osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", thisx->params, + gSaveContext.event_chk_inf[9] & 0xF); + thisx->params &= 0xFF; + if ((thisx->params < 0) || (thisx->params >= 5)) { + osSyncPrintf("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n", + "../z_bg_spot09_obj.c", 322, thisx->params); + } + + if (!func_808B1C70(this, globalCtx)) { + Actor_Kill(thisx); + } else if (!func_808B1D44(this, globalCtx)) { + Actor_Kill(thisx); + } +} + +void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx) { + DynaCollisionContext* dynaColCtx = &globalCtx->colCtx.dyna; + Actor* thisx = &this->dyna.actor; + + if (thisx->params != 0) { + DynaPolyInfo_Free(globalCtx, dynaColCtx, this->dyna.dynaPolyId); + } +} + +void BgSpot09Obj_Update(BgSpot09Obj* this, GlobalContext* globalCtx) { + +} + +void BgSpot09Obj_Draw(BgSpot09Obj* this, GlobalContext* globalCtx) { + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + Gfx* gfxArr[3]; + Actor* thisx = &this->dyna.actor; + + Draw_DListOpa(globalCtx, dists[thisx->params]); + if (thisx->params == 3) { + func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 388); + func_80093D84(globalCtx->state.gfxCtx); + + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 391), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfxCtx->polyXlu.p++, &D_06008010); + + func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 396); + } +} diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.h b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.h index 55bbe8dce9..5537972197 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.h +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.h @@ -5,8 +5,8 @@ #include typedef struct { - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x1C]; + /* 0x0000 */ DynaPolyActor dyna; + /* 0x0164 */ char unk_164[0x04]; } BgSpot09Obj; // size = 0x0168 extern const ActorInit Bg_Spot09_Obj_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index 7980357d0d..3281176fe7 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -149,6 +149,9 @@ DL_VASE = 0x06000000; // z_door_toki DOOR_TOKI_COLLISION_DATA = 0x06007888; +// z_bg_spot09_obj +D_06008010 = 0x06008010; + // z_bg_spot18_futa DL_SPOT18_FUTA = 0x06000368; DL_SPOT18_FUTA2 = 0x06000150; From c4bb9bed4cf97603a4cc8112e46538b9ca291bed Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Tue, 24 Mar 2020 00:16:01 -0400 Subject: [PATCH 2/8] Done --- .../ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s | 82 -------------- .../actors/ovl_Bg_Spot09_Obj/func_808B1AE0.s | 62 ----------- data/overlays/actors/z_bg_spot09_obj.reloc.s | 11 -- diff.py | 45 +++++++- spec | 2 +- .../ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 105 +++++++++--------- 6 files changed, 94 insertions(+), 213 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1AE0.s delete mode 100644 data/overlays/actors/z_bg_spot09_obj.reloc.s diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s deleted file mode 100644 index a6c32f3d69..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s +++ /dev/null @@ -1,82 +0,0 @@ -.rdata - -glabel D_808B207C - - .asciz "../z_bg_spot09_obj.c" - .balign 4 - -glabel D_808B2094 - - .asciz "../z_bg_spot09_obj.c" - .balign 4 - -glabel D_808B20AC - .asciz "../z_bg_spot09_obj.c" - .balign 4 - -.text - -glabel BgSpot09Obj_Draw -/* 003A0 808B1E80 27BDFFC0 */ addiu $sp, $sp, 0xFFC0 ## $sp = FFFFFFC0 -/* 003A4 808B1E84 AFB00014 */ sw $s0, 0x0014($sp) -/* 003A8 808B1E88 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 003AC 808B1E8C AFBF001C */ sw $ra, 0x001C($sp) -/* 003B0 808B1E90 AFB10018 */ sw $s1, 0x0018($sp) -/* 003B4 808B1E94 860E001C */ lh $t6, 0x001C($s0) ## 0000001C -/* 003B8 808B1E98 00A08825 */ or $s1, $a1, $zero ## $s1 = 00000000 -/* 003BC 808B1E9C 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 003C0 808B1EA0 3C05808B */ lui $a1, %hi(D_808B1FC8) ## $a1 = 808B0000 -/* 003C4 808B1EA4 000E7880 */ sll $t7, $t6, 2 -/* 003C8 808B1EA8 00AF2821 */ addu $a1, $a1, $t7 -/* 003CC 808B1EAC 0C00D498 */ jal Draw_DListOpa - -/* 003D0 808B1EB0 8CA51FC8 */ lw $a1, %lo(D_808B1FC8)($a1) -/* 003D4 808B1EB4 8618001C */ lh $t8, 0x001C($s0) ## 0000001C -/* 003D8 808B1EB8 24010003 */ addiu $at, $zero, 0x0003 ## $at = 00000003 -/* 003DC 808B1EBC 27A4002C */ addiu $a0, $sp, 0x002C ## $a0 = FFFFFFEC -/* 003E0 808B1EC0 17010024 */ bne $t8, $at, .L808B1F54 -/* 003E4 808B1EC4 3C06808B */ lui $a2, %hi(D_808B207C) ## $a2 = 808B0000 -/* 003E8 808B1EC8 8E250000 */ lw $a1, 0x0000($s1) ## 00000000 -/* 003EC 808B1ECC 24C6207C */ addiu $a2, $a2, %lo(D_808B207C) ## $a2 = 808B207C -/* 003F0 808B1ED0 24070184 */ addiu $a3, $zero, 0x0184 ## $a3 = 00000184 -/* 003F4 808B1ED4 0C031AB1 */ jal func_800C6AC4 -/* 003F8 808B1ED8 00A08025 */ or $s0, $a1, $zero ## $s0 = 00000000 -/* 003FC 808B1EDC 0C024F61 */ jal func_80093D84 -/* 00400 808B1EE0 8E240000 */ lw $a0, 0x0000($s1) ## 00000000 -/* 00404 808B1EE4 8E0202D0 */ lw $v0, 0x02D0($s0) ## 000002D0 -/* 00408 808B1EE8 3C08DA38 */ lui $t0, 0xDA38 ## $t0 = DA380000 -/* 0040C 808B1EEC 35080003 */ ori $t0, $t0, 0x0003 ## $t0 = DA380003 -/* 00410 808B1EF0 24590008 */ addiu $t9, $v0, 0x0008 ## $t9 = 00000008 -/* 00414 808B1EF4 AE1902D0 */ sw $t9, 0x02D0($s0) ## 000002D0 -/* 00418 808B1EF8 AC480000 */ sw $t0, 0x0000($v0) ## 00000000 -/* 0041C 808B1EFC 8E240000 */ lw $a0, 0x0000($s1) ## 00000000 -/* 00420 808B1F00 3C05808B */ lui $a1, %hi(D_808B2094) ## $a1 = 808B0000 -/* 00424 808B1F04 24A52094 */ addiu $a1, $a1, %lo(D_808B2094) ## $a1 = 808B2094 -/* 00428 808B1F08 24060187 */ addiu $a2, $zero, 0x0187 ## $a2 = 00000187 -/* 0042C 808B1F0C 0C0346A2 */ jal Matrix_NewMtx -/* 00430 808B1F10 AFA20028 */ sw $v0, 0x0028($sp) -/* 00434 808B1F14 8FA30028 */ lw $v1, 0x0028($sp) -/* 00438 808B1F18 3C0B0601 */ lui $t3, 0x0601 ## $t3 = 06010000 -/* 0043C 808B1F1C 256B8010 */ addiu $t3, $t3, 0x8010 ## $t3 = 06008010 -/* 00440 808B1F20 AC620004 */ sw $v0, 0x0004($v1) ## 00000004 -/* 00444 808B1F24 8E0202D0 */ lw $v0, 0x02D0($s0) ## 000002D0 -/* 00448 808B1F28 3C0ADE00 */ lui $t2, 0xDE00 ## $t2 = DE000000 -/* 0044C 808B1F2C 3C06808B */ lui $a2, %hi(D_808B20AC) ## $a2 = 808B0000 -/* 00450 808B1F30 24490008 */ addiu $t1, $v0, 0x0008 ## $t1 = 00000008 -/* 00454 808B1F34 AE0902D0 */ sw $t1, 0x02D0($s0) ## 000002D0 -/* 00458 808B1F38 AC4B0004 */ sw $t3, 0x0004($v0) ## 00000004 -/* 0045C 808B1F3C AC4A0000 */ sw $t2, 0x0000($v0) ## 00000000 -/* 00460 808B1F40 8E250000 */ lw $a1, 0x0000($s1) ## 00000000 -/* 00464 808B1F44 24C620AC */ addiu $a2, $a2, %lo(D_808B20AC) ## $a2 = 808B20AC -/* 00468 808B1F48 27A4002C */ addiu $a0, $sp, 0x002C ## $a0 = FFFFFFEC -/* 0046C 808B1F4C 0C031AD5 */ jal func_800C6B54 -/* 00470 808B1F50 2407018C */ addiu $a3, $zero, 0x018C ## $a3 = 0000018C -.L808B1F54: -/* 00474 808B1F54 8FBF001C */ lw $ra, 0x001C($sp) -/* 00478 808B1F58 8FB00014 */ lw $s0, 0x0014($sp) -/* 0047C 808B1F5C 8FB10018 */ lw $s1, 0x0018($sp) -/* 00480 808B1F60 03E00008 */ jr $ra -/* 00484 808B1F64 27BD0040 */ addiu $sp, $sp, 0x0040 ## $sp = 00000000 -/* 00488 808B1F68 00000000 */ nop -/* 0048C 808B1F6C 00000000 */ nop - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1AE0.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1AE0.s deleted file mode 100644 index 70aba536af..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1AE0.s +++ /dev/null @@ -1,62 +0,0 @@ -glabel func_808B1AE0 -/* 00000 808B1AE0 3C028016 */ lui $v0, 0x8016 ## $v0 = 80160000 -/* 00004 808B1AE4 2442E660 */ addiu $v0, $v0, 0xE660 ## $v0 = 8015E660 -/* 00008 808B1AE8 8C4E1360 */ lw $t6, 0x1360($v0) ## 8015F9C0 -/* 0000C 808B1AEC AFA50004 */ sw $a1, 0x0004($sp) -/* 00010 808B1AF0 29C10004 */ slti $at, $t6, 0x0004 -/* 00014 808B1AF4 54200005 */ bnel $at, $zero, .L808B1B0C -/* 00018 808B1AF8 94430EE6 */ lhu $v1, 0x0EE6($v0) ## 8015F546 -/* 0001C 808B1AFC 8482001C */ lh $v0, 0x001C($a0) ## 0000001C -/* 00020 808B1B00 03E00008 */ jr $ra -/* 00024 808B1B04 2C420001 */ sltiu $v0, $v0, 0x0001 -.L808B1B08: -/* 00028 808B1B08 94430EE6 */ lhu $v1, 0x0EE6($v0) ## 8015F546 -.L808B1B0C: -/* 0002C 808B1B0C 8C4F0004 */ lw $t7, 0x0004($v0) ## 8015E664 -/* 00030 808B1B10 24010011 */ addiu $at, $zero, 0x0011 ## $at = 00000011 -/* 00034 808B1B14 3063000F */ andi $v1, $v1, 0x000F ## $v1 = 00000000 -/* 00038 808B1B18 3863000F */ xori $v1, $v1, 0x000F ## $v1 = 0000000F -/* 0003C 808B1B1C 11E00003 */ beq $t7, $zero, .L808B1B2C -/* 00040 808B1B20 2C630001 */ sltiu $v1, $v1, 0x0001 -/* 00044 808B1B24 10000002 */ beq $zero, $zero, .L808B1B30 -/* 00048 808B1B28 24020005 */ addiu $v0, $zero, 0x0005 ## $v0 = 00000005 -.L808B1B2C: -/* 0004C 808B1B2C 24020011 */ addiu $v0, $zero, 0x0011 ## $v0 = 00000011 -.L808B1B30: -/* 00050 808B1B30 54410016 */ bnel $v0, $at, .L808B1B8C -/* 00054 808B1B34 8482001C */ lh $v0, 0x001C($a0) ## 0000001C -/* 00058 808B1B38 8482001C */ lh $v0, 0x001C($a0) ## 0000001C -/* 0005C 808B1B3C 24010001 */ addiu $at, $zero, 0x0001 ## $at = 00000001 -/* 00060 808B1B40 10400009 */ beq $v0, $zero, .L808B1B68 -/* 00064 808B1B44 00000000 */ nop -/* 00068 808B1B48 10410009 */ beq $v0, $at, .L808B1B70 -/* 0006C 808B1B4C 24010003 */ addiu $at, $zero, 0x0003 ## $at = 00000003 -/* 00070 808B1B50 1041000B */ beq $v0, $at, .L808B1B80 -/* 00074 808B1B54 24010004 */ addiu $at, $zero, 0x0004 ## $at = 00000004 -/* 00078 808B1B58 10410007 */ beq $v0, $at, .L808B1B78 -/* 0007C 808B1B5C 00000000 */ nop -/* 00080 808B1B60 1000000D */ beq $zero, $zero, .L808B1B98 -/* 00084 808B1B64 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000 -.L808B1B68: -/* 00088 808B1B68 03E00008 */ jr $ra -/* 0008C 808B1B6C 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000 -.L808B1B70: -/* 00090 808B1B70 03E00008 */ jr $ra -/* 00094 808B1B74 2C620001 */ sltiu $v0, $v1, 0x0001 -.L808B1B78: -/* 00098 808B1B78 03E00008 */ jr $ra -/* 0009C 808B1B7C 00601025 */ or $v0, $v1, $zero ## $v0 = 0000000F -.L808B1B80: -/* 000A0 808B1B80 03E00008 */ jr $ra -/* 000A4 808B1B84 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001 -.L808B1B88: -/* 000A8 808B1B88 8482001C */ lh $v0, 0x001C($a0) ## 0000001C -.L808B1B8C: -/* 000AC 808B1B8C 38420002 */ xori $v0, $v0, 0x0002 ## $v0 = 00000003 -/* 000B0 808B1B90 03E00008 */ jr $ra -/* 000B4 808B1B94 2C420001 */ sltiu $v0, $v0, 0x0001 -.L808B1B98: -/* 000B8 808B1B98 03E00008 */ jr $ra -/* 000BC 808B1B9C 00000000 */ nop - - diff --git a/data/overlays/actors/z_bg_spot09_obj.reloc.s b/data/overlays/actors/z_bg_spot09_obj.reloc.s deleted file mode 100644 index bd2caa08ac..0000000000 --- a/data/overlays/actors/z_bg_spot09_obj.reloc.s +++ /dev/null @@ -1,11 +0,0 @@ -.include "macro.inc" - - # assembler directives - .set noat # allow manual use of $at - .set noreorder # don't insert nops after branches - .set gp=64 # allow use of 64-bit general purposee registers - -.section .rodata -glabel D_808B20D0 - -.incbin "baserom/ovl_Bg_Spot09_Obj", 0x5F0, 0x000000B0 diff --git a/diff.py b/diff.py index 5ba345632b..446dfb56be 100755 --- a/diff.py +++ b/diff.py @@ -16,14 +16,16 @@ def fail(msg): print(msg, file=sys.stderr) sys.exit(1) +MISSING_PREREQUISITES = "Missing prerequisite python module {}. " \ + "Run `python3 -m pip install --user colorama ansiwrap attrs watchdog python-Levenshtein` to install prerequisites (python-Levenshtein only needed for --algorithm=levenshtein)." + try: import attr from colorama import Fore, Style, Back import ansiwrap import watchdog except ModuleNotFoundError as e: - fail(f"Missing prerequisite python module {e.name}. " - "Run `python3 -m pip install --user colorama ansiwrap attrs watchdog` to install prerequisites.") + fail(MISSING_PREREQUISITES.format(e.name)) # Prefer to use diff_settings.py from the current working directory sys.path.insert(0, '.') @@ -66,6 +68,8 @@ parser.add_argument('-w', '--watch', dest='watch', action='store_true', "Recommended in combination with -m.") parser.add_argument('--width', dest='column_width', type=int, default=50, help="Sets the width of the left and right view column.") +parser.add_argument('--algorithm', dest='algorithm', default='difflib', + choices=['levenshtein', 'difflib'], help="Diff algorithm to use.") # Project-specific flags, e.g. different versions/make arguments. if hasattr(diff_settings, "add_custom_arguments"): @@ -106,6 +110,12 @@ FS_WATCH_EXTENSIONS = ['.c', '.h'] # ==== LOGIC ==== +if args.algorithm == 'levenshtein': + try: + import Levenshtein + except ModuleNotFoundError as e: + fail(MISSING_PREREQUISITES.format(e.name)) + binutils_prefix = None for binutils_cand in ['mips-linux-gnu-', 'mips64-elf-']: @@ -449,6 +459,32 @@ def color_branch_imms(br1, br2): br2 = f'{Fore.LIGHTBLUE_EX}{br2}{Style.RESET_ALL}' return br1, br2 +def diff_sequences_difflib(seq1, seq2): + differ = difflib.SequenceMatcher(a=seq1, b=seq2, autojunk=False) + return differ.get_opcodes() + +def diff_sequences(seq1, seq2): + if (args.algorithm != 'levenshtein' or len(seq1) * len(seq2) > 4 * 10**8 or + len(seq1) + len(seq2) >= 0x110000): + return diff_sequences_difflib(seq1, seq2) + + # The Levenshtein library assumes that we compare strings, not lists. Convert. + # (Per the check above we know we have fewer than 0x110000 unique elements, so chr() works.) + remapping = {} + def remap(seq): + seq = seq[:] + for i in range(len(seq)): + val = remapping.get(seq[i]) + if val is None: + val = chr(len(remapping)) + remapping[seq[i]] = val + seq[i] = val + return ''.join(seq) + + seq1 = remap(seq1) + seq2 = remap(seq2) + return Levenshtein.opcodes(seq1, seq2) + def do_diff(basedump, mydump): asm_lines1 = basedump.split('\n') asm_lines2 = mydump.split('\n') @@ -477,8 +513,7 @@ def do_diff(basedump, mydump): btset.add(bt + ":") sc.color_symbol(bt + ":") - differ: difflib.SequenceMatcher = difflib.SequenceMatcher(a=mnemonics1, b=mnemonics2, autojunk=False) - for (tag, i1, i2, j1, j2) in differ.get_opcodes(): + for (tag, i1, i2, j1, j2) in diff_sequences(mnemonics1, mnemonics2): lines1 = asm_lines1[i1:i2] lines2 = asm_lines2[j1:j2] @@ -791,7 +826,7 @@ def main(): display.progress("Building...") ret = run_make(make_target, capture_output=True) if ret.returncode != 0: - display.update(ret.stderr.decode() or ret.stdout.decode(), error=True) + display.update(ret.stderr.decode('utf-8-sig', 'replace') or ret.stdout.decode('utf-8-sig', 'replace'), error=True) continue mydump = run_objdump(mycmd) display.update(mydump, error=False) diff --git a/spec b/spec index 48a72b0d71..1e62dbf547 100644 --- a/spec +++ b/spec @@ -1458,7 +1458,7 @@ endseg beginseg name "ovl_Bg_Spot09_Obj" include "build/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.o" - include "build/data/overlays/actors/z_bg_spot09_obj.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index c121558bcd..a1e7d546bf 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -3,14 +3,14 @@ #define ROOM 0x00 #define FLAGS 0x00000000 -void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx); -void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx); -void BgSpot09Obj_Update(BgSpot09Obj* this, GlobalContext* globalCtx); -void BgSpot09Obj_Draw(BgSpot09Obj* this, GlobalContext* globalCtx); +static void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx); +static void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx); +static void BgSpot09Obj_Update(BgSpot09Obj* this, GlobalContext* globalCtx); +static void BgSpot09Obj_Draw(BgSpot09Obj* this, GlobalContext* globalCtx); -s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx); -s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx); -s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx); +static s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx); +static s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx); +static s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx); const ActorInit Bg_Spot09_Obj_InitVars = { @@ -26,66 +26,66 @@ const ActorInit Bg_Spot09_Obj_InitVars = (ActorFunc)BgSpot09Obj_Draw, }; -u32 D_808B1F90[] = { +static u32 D_808B1F90[] = { 0x00000000, 0x06005520, 0x0600283C, 0x06008458, 0x06007580 }; typedef s32 (*ActorFuncRet)(struct Actor*, struct GlobalContext*); -ActorFuncRet D_808B1FA4[] = { +static ActorFuncRet D_808B1FA4[] = { (ActorFuncRet)func_808B1BEC, (ActorFuncRet)func_808B1AE0, (ActorFuncRet)func_808B1BA0, }; -InitChainEntry initChain1[] = { +static InitChainEntry initChain1[] = { ICHAIN_F32(unk_F4, 7200, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 3000, ICHAIN_CONTINUE), ICHAIN_F32(unk_FC, 7200, ICHAIN_STOP), }; -InitChainEntry initChain2[] = { +static InitChainEntry initChain2[] = { ICHAIN_F32(unk_F4, 7200, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 800, ICHAIN_CONTINUE), ICHAIN_F32(unk_FC, 1500, ICHAIN_STOP), }; -u32 dists[] = { +static u32 dlists[] = { 0x06000100, 0x06003970, 0x06001120, 0x06007D40, 0x06006210, }; extern UNK_TYPE D_06008010; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1AE0.s") -/*void func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { - u16 temp_v1; - s32 phi_v0; +static s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { + s32 temp_v1; + s32 linkAge; + Actor* thisx = &this->dyna.actor; - if (gSaveContext->unk1360 >= 4) { - return (u32) arg0->unk1C < 1U; + if (gSaveContext.scene_setup_index >= 4) { + return thisx->params == 0; } - temp_v1 = (u32) ((gSaveContext->unkEE6 & 0xF) ^ 0xF) < 1U; - if (gSaveContext->unk4 != 0) { - phi_v0 = 5; + temp_v1 = (gSaveContext.event_chk_inf[9] & 0xF) == 0xF; + if (LINK_IS_CHILD) { + linkAge = YEARS_CHILD; } else { - phi_v0 = 0x11; + linkAge = YEARS_ADULT; } - if (phi_v0 == 0x11) { - if (arg0->unk1C == 0) { - return (u16)0; - } - if (arg0->unk1C == 1) { - return temp_v1 < 1U; - } - if (arg0->unk1C == 3) { - return (u16)1; - } - if (arg0->unk1C == 4) { - return temp_v1; - } - return (u16)0; - } - return (u32) (arg0->unk1C ^ 2) < 1U; -}*/ -s32 func_808B1BA0(BgSpot09Obj *this, GlobalContext *globalCtx) { + if (linkAge == YEARS_ADULT) { + switch (thisx->params) { + case 0: + return 0; + case 1: + return !temp_v1; + case 4: + return temp_v1; + case 3: + return 1; + } + } else { + return thisx->params == 2; + } + return 0; +} + +static s32 func_808B1BA0(BgSpot09Obj *this, GlobalContext *globalCtx) { Actor* thisx = &this->dyna.actor; if (thisx->params == 3) { Actor_SetScale(thisx, 0.1f); @@ -95,7 +95,7 @@ s32 func_808B1BA0(BgSpot09Obj *this, GlobalContext *globalCtx) { return 1; } -s32 func_808B1BEC(BgSpot09Obj *this, GlobalContext *globalCtx) { +static s32 func_808B1BEC(BgSpot09Obj *this, GlobalContext *globalCtx) { Actor* thisx = &this->dyna.actor; s32 localC = 0; s32 pad[2]; @@ -108,7 +108,7 @@ s32 func_808B1BEC(BgSpot09Obj *this, GlobalContext *globalCtx) { return 1; } -s32 func_808B1C70(BgSpot09Obj *this, GlobalContext *globalCtx) { +static s32 func_808B1C70(BgSpot09Obj *this, GlobalContext *globalCtx) { s32 i; for (i = 0; i < ARRAY_COUNT(D_808B1FA4); i++) { if (!D_808B1FA4[i](this, globalCtx)) { @@ -118,17 +118,17 @@ s32 func_808B1C70(BgSpot09Obj *this, GlobalContext *globalCtx) { return 1; } -s32 func_808B1CEC(BgSpot09Obj* this, GlobalContext* globalCtx) { +static s32 func_808B1CEC(BgSpot09Obj* this, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, &initChain1); return 1; } -s32 func_808B1D18(BgSpot09Obj* this, GlobalContext* globalCtx) { +static s32 func_808B1D18(BgSpot09Obj* this, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, &initChain2); return 1; } -s32 func_808B1D44(BgSpot09Obj* this, GlobalContext* globalCtx) { +static s32 func_808B1D44(BgSpot09Obj* this, GlobalContext* globalCtx) { if (this->dyna.actor.params == 3) { return func_808B1D18(this, globalCtx); } else { @@ -136,7 +136,7 @@ s32 func_808B1D44(BgSpot09Obj* this, GlobalContext* globalCtx) { } } -void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx) { +static void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", thisx->params, @@ -154,7 +154,7 @@ void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx) { } } -void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx) { +static void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx) { DynaCollisionContext* dynaColCtx = &globalCtx->colCtx.dyna; Actor* thisx = &this->dyna.actor; @@ -163,17 +163,18 @@ void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx) { } } -void BgSpot09Obj_Update(BgSpot09Obj* this, GlobalContext* globalCtx) { +static void BgSpot09Obj_Update(BgSpot09Obj* this, GlobalContext* globalCtx) { } -void BgSpot09Obj_Draw(BgSpot09Obj* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* gfxArr[3]; +static void BgSpot09Obj_Draw(BgSpot09Obj* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; + GraphicsContext* gfxCtx; + Gfx* gfxArr[3]; - Draw_DListOpa(globalCtx, dists[thisx->params]); + Draw_DListOpa(globalCtx, dlists[thisx->params]); if (thisx->params == 3) { + gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 388); func_80093D84(globalCtx->state.gfxCtx); From a8b19baf6ed34dc375bb104cffc38d878959a079 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Tue, 24 Mar 2020 00:16:35 -0400 Subject: [PATCH 3/8] Format --- .../actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index a1e7d546bf..81079813cd 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -12,8 +12,7 @@ static s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx); static s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx); static s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx); -const ActorInit Bg_Spot09_Obj_InitVars = -{ +const ActorInit Bg_Spot09_Obj_InitVars = { ACTOR_BG_SPOT09_OBJ, ACTORTYPE_BG, ROOM, @@ -26,13 +25,13 @@ const ActorInit Bg_Spot09_Obj_InitVars = (ActorFunc)BgSpot09Obj_Draw, }; -static u32 D_808B1F90[] = { - 0x00000000, 0x06005520, 0x0600283C, 0x06008458, 0x06007580 -}; +static u32 D_808B1F90[] = { 0x00000000, 0x06005520, 0x0600283C, 0x06008458, 0x06007580 }; typedef s32 (*ActorFuncRet)(struct Actor*, struct GlobalContext*); static ActorFuncRet D_808B1FA4[] = { - (ActorFuncRet)func_808B1BEC, (ActorFuncRet)func_808B1AE0, (ActorFuncRet)func_808B1BA0, + (ActorFuncRet)func_808B1BEC, + (ActorFuncRet)func_808B1AE0, + (ActorFuncRet)func_808B1BA0, }; static InitChainEntry initChain1[] = { @@ -85,7 +84,7 @@ static s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { return 0; } -static s32 func_808B1BA0(BgSpot09Obj *this, GlobalContext *globalCtx) { +static s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; if (thisx->params == 3) { Actor_SetScale(thisx, 0.1f); @@ -95,7 +94,7 @@ static s32 func_808B1BA0(BgSpot09Obj *this, GlobalContext *globalCtx) { return 1; } -static s32 func_808B1BEC(BgSpot09Obj *this, GlobalContext *globalCtx) { +static s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; s32 localC = 0; s32 pad[2]; @@ -108,7 +107,7 @@ static s32 func_808B1BEC(BgSpot09Obj *this, GlobalContext *globalCtx) { return 1; } -static s32 func_808B1C70(BgSpot09Obj *this, GlobalContext *globalCtx) { +static s32 func_808B1C70(BgSpot09Obj* this, GlobalContext* globalCtx) { s32 i; for (i = 0; i < ARRAY_COUNT(D_808B1FA4); i++) { if (!D_808B1FA4[i](this, globalCtx)) { @@ -164,7 +163,6 @@ static void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx) { } static void BgSpot09Obj_Update(BgSpot09Obj* this, GlobalContext* globalCtx) { - } static void BgSpot09Obj_Draw(BgSpot09Obj* this, GlobalContext* globalCtx) { From ba31478e23536d46ae35b54f9ebcb28875845802 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Tue, 24 Mar 2020 00:18:33 -0400 Subject: [PATCH 4/8] Spacing --- src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index 81079813cd..b364db5451 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -60,7 +60,9 @@ static s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { if (gSaveContext.scene_setup_index >= 4) { return thisx->params == 0; } + temp_v1 = (gSaveContext.event_chk_inf[9] & 0xF) == 0xF; + if (LINK_IS_CHILD) { linkAge = YEARS_CHILD; } else { @@ -81,6 +83,7 @@ static s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { } else { return thisx->params == 2; } + return 0; } From 4b7f998b20cdc606fdedea04934257671453896c Mon Sep 17 00:00:00 2001 From: dark-samus Date: Tue, 24 Mar 2020 16:53:09 -0400 Subject: [PATCH 5/8] match final non-matching in sys_cfb.c --- asm/non_matchings/code/sys_cfb/SysCfb_Init.s | 123 ------------------- src/code/sys_cfb.c | 19 ++- 2 files changed, 9 insertions(+), 133 deletions(-) delete mode 100644 asm/non_matchings/code/sys_cfb/SysCfb_Init.s diff --git a/asm/non_matchings/code/sys_cfb/SysCfb_Init.s b/asm/non_matchings/code/sys_cfb/SysCfb_Init.s deleted file mode 100644 index b963aaa53a..0000000000 --- a/asm/non_matchings/code/sys_cfb/SysCfb_Init.s +++ /dev/null @@ -1,123 +0,0 @@ -.rdata -glabel D_801462D0 - .asciz "8Mバイト以上のメモリが搭載されています\n" - # EUC-JP: 8Mバイト以上のメモリが搭載されています | 8MB or more memory is installed - .balign 4 - -glabel D_801462FC - .asciz "RAM 8M mode (N64DD対応)\n" - # EUC-JP: 対応 | Correspondence - .balign 4 - -glabel D_80146318 - .asciz "このバージョンのマージンは %dK バイトです\n" - # EUC-JP: このバージョンのマージンは %dK バイトです | The margin for this version is% dK bytes - .balign 4 - -glabel D_80146344 - .asciz "RAM4M mode\n" - .balign 4 - -glabel D_80146350 - .asciz "../sys_cfb.c" - .balign 4 - -glabel D_80146360 - .asciz "システムが使用する最終アドレスは %08x です\n" - # EUC-JP: システムが使用する最終アドレスは %08x です | The final address used by the system is% 08x - .balign 4 - -glabel D_8014638C - .asciz "フレームバッファのアドレスは %08x と %08x です\n" - # EUC-JP: フレームバッファのアドレスは %08x と %08x です | Frame buffer addresses are% 08x and% 08x - .balign 4 - -.text -glabel SysCfb_Init -/* B41540 800CA3A0 3C028000 */ lui $v0, %hi(osMemSize) # $v0, 0x8000 -/* B41544 800CA3A4 8C420318 */ lw $v0, %lo(osMemSize)($v0) -/* B41548 800CA3A8 3C010080 */ lui $at, 0x80 -/* B4154C 800CA3AC 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* B41550 800CA3B0 0041082B */ sltu $at, $v0, $at -/* B41554 800CA3B4 AFBF0014 */ sw $ra, 0x14($sp) -/* B41558 800CA3B8 1420001C */ bnez $at, .L800CA42C -/* B4155C 800CA3BC AFA40018 */ sw $a0, 0x18($sp) -/* B41560 800CA3C0 3C048014 */ lui $a0, %hi(D_801462D0) # $a0, 0x8014 -/* B41564 800CA3C4 0C00084C */ jal osSyncPrintf -/* B41568 800CA3C8 248462D0 */ addiu $a0, %lo(D_801462D0) # addiu $a0, $a0, 0x62d0 -/* B4156C 800CA3CC 8FAE0018 */ lw $t6, 0x18($sp) -/* B41570 800CA3D0 24010001 */ li $at, 1 -/* B41574 800CA3D4 3C048014 */ lui $a0, %hi(D_801462FC) # $a0, 0x8014 -/* B41578 800CA3D8 15C10009 */ bne $t6, $at, .L800CA400 -/* B4157C 800CA3DC 00000000 */ nop -/* B41580 800CA3E0 0C00084C */ jal osSyncPrintf -/* B41584 800CA3E4 248462FC */ addiu $a0, %lo(D_801462FC) # addiu $a0, $a0, 0x62fc -/* B41588 800CA3E8 3C028017 */ lui $v0, %hi(sSysCfbEnd) # $v0, 0x8017 -/* B4158C 800CA3EC 3C0F805F */ lui $t7, (0x805FB000 >> 16) # lui $t7, 0x805f -/* B41590 800CA3F0 2442A598 */ addiu $v0, %lo(sSysCfbEnd) # addiu $v0, $v0, -0x5a68 -/* B41594 800CA3F4 35EFB000 */ ori $t7, (0x805FB000 & 0xFFFF) # ori $t7, $t7, 0xb000 -/* B41598 800CA3F8 1000001E */ b .L800CA474 -/* B4159C 800CA3FC AC4F0000 */ sw $t7, ($v0) -.L800CA400: -/* B415A0 800CA400 3C048014 */ lui $a0, %hi(D_80146318) # $a0, 0x8014 -/* B415A4 800CA404 24846318 */ addiu $a0, %lo(D_80146318) # addiu $a0, $a0, 0x6318 -/* B415A8 800CA408 0C00084C */ jal osSyncPrintf -/* B415AC 800CA40C 2405012F */ li $a1, 303 -/* B415B0 800CA410 3C188044 */ lui $t8, (0x8044BE80 >> 16) # lui $t8, 0x8044 -/* B415B4 800CA414 3718BE80 */ ori $t8, (0x8044BE80 & 0xFFFF) # ori $t8, $t8, 0xbe80 -/* B415B8 800CA418 3C018017 */ lui $at, %hi(sSysCfbEnd) # $at, 0x8017 -/* B415BC 800CA41C 3C028017 */ lui $v0, %hi(sSysCfbEnd) # $v0, 0x8017 -/* B415C0 800CA420 2442A598 */ addiu $v0, %lo(sSysCfbEnd) # addiu $v0, $v0, -0x5a68 -/* B415C4 800CA424 10000013 */ b .L800CA474 -/* B415C8 800CA428 AC38A598 */ sw $t8, %lo(sSysCfbEnd)($at) -.L800CA42C: -/* B415CC 800CA42C 3C010040 */ lui $at, 0x40 -/* B415D0 800CA430 0041082B */ sltu $at, $v0, $at -/* B415D4 800CA434 1420000A */ bnez $at, .L800CA460 -/* B415D8 800CA438 3C048014 */ lui $a0, %hi(D_80146350) -/* B415DC 800CA43C 3C048014 */ lui $a0, %hi(D_80146344) # $a0, 0x8014 -/* B415E0 800CA440 0C00084C */ jal osSyncPrintf -/* B415E4 800CA444 24846344 */ addiu $a0, %lo(D_80146344) # addiu $a0, $a0, 0x6344 -/* B415E8 800CA448 3C198040 */ lui $t9, 0x8040 -/* B415EC 800CA44C 3C018017 */ lui $at, %hi(sSysCfbEnd) # $at, 0x8017 -/* B415F0 800CA450 3C028017 */ lui $v0, %hi(sSysCfbEnd) # $v0, 0x8017 -/* B415F4 800CA454 2442A598 */ addiu $v0, %lo(sSysCfbEnd) # addiu $v0, $v0, -0x5a68 -/* B415F8 800CA458 10000006 */ b .L800CA474 -/* B415FC 800CA45C AC39A598 */ sw $t9, %lo(sSysCfbEnd)($at) -.L800CA460: -/* B41600 800CA460 24846350 */ addiu $a0, %lo(D_80146350) -/* B41604 800CA464 0C000B94 */ jal LogUtils_HungupThread -/* B41608 800CA468 24050162 */ li $a1, 354 -/* B4160C 800CA46C 3C028017 */ lui $v0, %hi(sSysCfbEnd) # $v0, 0x8017 -/* B41610 800CA470 2442A598 */ addiu $v0, %lo(sSysCfbEnd) # addiu $v0, $v0, -0x5a68 -.L800CA474: -/* B41614 800CA474 8C480000 */ lw $t0, ($v0) -/* B41618 800CA478 2401FFC0 */ li $at, -64 -/* B4161C 800CA47C 3C048014 */ lui $a0, %hi(D_80146360) # $a0, 0x8014 -/* B41620 800CA480 01012824 */ and $a1, $t0, $at -/* B41624 800CA484 AC450000 */ sw $a1, ($v0) -/* B41628 800CA488 0C00084C */ jal osSyncPrintf -/* B4162C 800CA48C 24846360 */ addiu $a0, %lo(D_80146360) # addiu $a0, $a0, 0x6360 -/* B41630 800CA490 3C028017 */ lui $v0, %hi(sSysCfbEnd) # $v0, 0x8017 -/* B41634 800CA494 8C42A598 */ lw $v0, %lo(sSysCfbEnd)($v0) -/* B41638 800CA498 3C01FFFB */ lui $at, (0xFFFB5000 >> 16) # lui $at, 0xfffb -/* B4163C 800CA49C 34215000 */ ori $at, (0xFFFB5000 & 0xFFFF) # ori $at, $at, 0x5000 -/* B41640 800CA4A0 00415021 */ addu $t2, $v0, $at -/* B41644 800CA4A4 3C018017 */ lui $at, %hi(sSysCfbFbPtr) # $at, 0x8017 -/* B41648 800CA4A8 AC2AA590 */ sw $t2, %lo(sSysCfbFbPtr)($at) -/* B4164C 800CA4AC 3C01FFFD */ lui $at, (0xFFFDA800 >> 16) # lui $at, 0xfffd -/* B41650 800CA4B0 3421A800 */ ori $at, (0xFFFDA800 & 0xFFFF) # ori $at, $at, 0xa800 -/* B41654 800CA4B4 00415821 */ addu $t3, $v0, $at -/* B41658 800CA4B8 3C038017 */ lui $v1, %hi(sSysCfbFbPtr) # $v1, 0x8017 -/* B4165C 800CA4BC 3C018017 */ lui $at, %hi(sSysCfbFbPtr+4) # $at, 0x8017 -/* B41660 800CA4C0 2463A590 */ addiu $v1, %lo(sSysCfbFbPtr) # addiu $v1, $v1, -0x5a70 -/* B41664 800CA4C4 AC2BA594 */ sw $t3, %lo(sSysCfbFbPtr+4)($at) -/* B41668 800CA4C8 3C048014 */ lui $a0, %hi(D_8014638C) # $a0, 0x8014 -/* B4166C 800CA4CC 2484638C */ addiu $a0, %lo(D_8014638C) # addiu $a0, $a0, 0x638c -/* B41670 800CA4D0 8C660004 */ lw $a2, 4($v1) -/* B41674 800CA4D4 0C00084C */ jal osSyncPrintf -/* B41678 800CA4D8 8C650000 */ lw $a1, ($v1) -/* B4167C 800CA4DC 8FBF0014 */ lw $ra, 0x14($sp) -/* B41680 800CA4E0 27BD0018 */ addiu $sp, $sp, 0x18 -/* B41684 800CA4E4 03E00008 */ jr $ra -/* B41688 800CA4E8 00000000 */ nop diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 454b63a58d..421037c383 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -1,14 +1,15 @@ #include -volatile u32 sSysCfbFbPtr[2]; // may not be volatile but it currently gets SysCfb_Init closer from matching +u32 sSysCfbFbPtr[2]; u32 sSysCfbEnd; -// small reaordering -#ifdef NON_MATCHING void SysCfb_Init(s32 n64dd) { + u32 screenSize; + u32 tmpFbEnd; if (osMemSize >= 0x800000U) { // 8MB or more memory is installed osSyncPrintf("8Mバイト以上のメモリが搭載されています\n"); + tmpFbEnd = 0x8044BE80; if (n64dd == 1) { // RAM 8M mode (N64DD compatible) osSyncPrintf("RAM 8M mode (N64DD対応)\n"); @@ -16,26 +17,24 @@ void SysCfb_Init(s32 n64dd) { } else { // The margin for this version is% dK bytes osSyncPrintf("このバージョンのマージンは %dK バイトです\n", (0x4BC00 / 1024)); - sSysCfbEnd = 0x8044BE80; + sSysCfbEnd = tmpFbEnd; } } else if (osMemSize >= 0x400000U) { - sSysCfbEnd = 0x80400000; osSyncPrintf("RAM4M mode\n"); + sSysCfbEnd = 0x80400000; } else { LogUtils_HungupThread("../sys_cfb.c", 0x162); } + screenSize = SCREEN_WIDTH * SCREEN_HEIGHT; sSysCfbEnd &= ~0x3f; // The final address used by the system is% 08x osSyncPrintf("システムが使用する最終アドレスは %08x です\n", sSysCfbEnd); - sSysCfbFbPtr[0] = sSysCfbEnd - (SCREEN_WIDTH * SCREEN_HEIGHT * 4); - sSysCfbFbPtr[1] = sSysCfbEnd - (SCREEN_WIDTH * SCREEN_HEIGHT * 2); + sSysCfbFbPtr[0] = sSysCfbEnd - (screenSize * 4); + sSysCfbFbPtr[1] = sSysCfbEnd - (screenSize * 2); // Frame buffer addresses are% 08x and% 08x osSyncPrintf("フレームバッファのアドレスは %08x と %08x です\n", sSysCfbFbPtr[0], sSysCfbFbPtr[1]); } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cfb/SysCfb_Init.s") -#endif void SysCfb_Reset() { sSysCfbFbPtr[0] = 0; From 05122ec2f8c08990d12cb916be88626229e6ac8a Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Tue, 24 Mar 2020 17:07:52 -0400 Subject: [PATCH 6/8] PR suggestions --- .../ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index b364db5451..9ac414e844 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -1,3 +1,9 @@ +/* + * File: z_bg_spot09_obj.c + * Overlay: ovl_Bg_Spot09_Obj + * Description: + */ + #include "z_bg_spot09_obj.h" #define ROOM 0x00 @@ -27,11 +33,10 @@ const ActorInit Bg_Spot09_Obj_InitVars = { static u32 D_808B1F90[] = { 0x00000000, 0x06005520, 0x0600283C, 0x06008458, 0x06007580 }; -typedef s32 (*ActorFuncRet)(struct Actor*, struct GlobalContext*); -static ActorFuncRet D_808B1FA4[] = { - (ActorFuncRet)func_808B1BEC, - (ActorFuncRet)func_808B1AE0, - (ActorFuncRet)func_808B1BA0, +static s32 (*D_808B1FA4[])(BgSpot09Obj* this, GlobalContext* globalCtx) = { + func_808B1BEC, + func_808B1AE0, + func_808B1BA0, }; static InitChainEntry initChain1[] = { @@ -46,37 +51,28 @@ static InitChainEntry initChain2[] = { ICHAIN_F32(unk_FC, 1500, ICHAIN_STOP), }; -static u32 dlists[] = { - 0x06000100, 0x06003970, 0x06001120, 0x06007D40, 0x06006210, -}; +static u32 dlists[] = { 0x06000100, 0x06003970, 0x06001120, 0x06007D40, 0x06006210 }; extern UNK_TYPE D_06008010; static s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) { - s32 temp_v1; - s32 linkAge; + s32 carpentersRescued; Actor* thisx = &this->dyna.actor; if (gSaveContext.scene_setup_index >= 4) { return thisx->params == 0; } - temp_v1 = (gSaveContext.event_chk_inf[9] & 0xF) == 0xF; + carpentersRescued = (gSaveContext.event_chk_inf[9] & 0xF) == 0xF; - if (LINK_IS_CHILD) { - linkAge = YEARS_CHILD; - } else { - linkAge = YEARS_ADULT; - } - - if (linkAge == YEARS_ADULT) { + if (LINK_AGE_IN_YEARS == YEARS_ADULT) { switch (thisx->params) { case 0: return 0; case 1: - return !temp_v1; + return !carpentersRescued; case 4: - return temp_v1; + return carpentersRescued; case 3: return 1; } From f0c033ce701a5064a9b943a163be4462724bf70d Mon Sep 17 00:00:00 2001 From: JoshDuMan Date: Tue, 24 Mar 2020 19:52:07 -0400 Subject: [PATCH 7/8] Match func_809C1CAC --- .../actors/ovl_En_Bird/func_809C1CAC.s | 53 ------------------- src/code/z_sample.c | 5 +- src/overlays/actors/ovl_En_Bird/z_en_bird.c | 10 ++-- 3 files changed, 6 insertions(+), 62 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Bird/func_809C1CAC.s diff --git a/asm/non_matchings/overlays/actors/ovl_En_Bird/func_809C1CAC.s b/asm/non_matchings/overlays/actors/ovl_En_Bird/func_809C1CAC.s deleted file mode 100644 index 2b110bf08e..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Bird/func_809C1CAC.s +++ /dev/null @@ -1,53 +0,0 @@ -glabel func_809C1CAC -/* 000FC 809C1CAC 27BDFFD0 */ addiu $sp, $sp, 0xFFD0 ## $sp = FFFFFFD0 -/* 00100 809C1CB0 AFA40030 */ sw $a0, 0x0030($sp) -/* 00104 809C1CB4 AFBF0024 */ sw $ra, 0x0024($sp) -/* 00108 809C1CB8 3C040600 */ lui $a0, 0x0600 ## $a0 = 06000000 -/* 0010C 809C1CBC AFA50034 */ sw $a1, 0x0034($sp) -/* 00110 809C1CC0 0C028800 */ jal SkelAnime_GetFrameCount - -/* 00114 809C1CC4 2484006C */ addiu $a0, $a0, 0x006C ## $a0 = 0600006C -/* 00118 809C1CC8 8FAE0030 */ lw $t6, 0x0030($sp) -/* 0011C 809C1CCC 44822000 */ mtc1 $v0, $f4 ## $f4 = 0.00 -/* 00120 809C1CD0 3C013F80 */ lui $at, 0x3F80 ## $at = 3F800000 -/* 00124 809C1CD4 85CF019C */ lh $t7, 0x019C($t6) ## 0000019C -/* 00128 809C1CD8 24040005 */ addiu $a0, $zero, 0x0005 ## $a0 = 00000005 -/* 0012C 809C1CDC 24050023 */ addiu $a1, $zero, 0x0023 ## $a1 = 00000023 -/* 00130 809C1CE0 11E00004 */ beq $t7, $zero, .L809C1CF4 -/* 00134 809C1CE4 468020A0 */ cvt.s.w $f2, $f4 -/* 00138 809C1CE8 44800000 */ mtc1 $zero, $f0 ## $f0 = 0.00 -/* 0013C 809C1CEC 10000004 */ beq $zero, $zero, .L809C1D00 -/* 00140 809C1CF0 E7A00028 */ swc1 $f0, 0x0028($sp) -.L809C1CF4: -/* 00144 809C1CF4 44810000 */ mtc1 $at, $f0 ## $f0 = 1.00 -/* 00148 809C1CF8 00000000 */ nop -/* 0014C 809C1CFC E7A00028 */ swc1 $f0, 0x0028($sp) -.L809C1D00: -/* 00150 809C1D00 0C01DF64 */ jal Math_Rand_S16Offset - -/* 00154 809C1D04 E7A2002C */ swc1 $f2, 0x002C($sp) -/* 00158 809C1D08 8FA30030 */ lw $v1, 0x0030($sp) -/* 0015C 809C1D0C C7A00028 */ lwc1 $f0, 0x0028($sp) -/* 00160 809C1D10 44806000 */ mtc1 $zero, $f12 ## $f12 = 0.00 -/* 00164 809C1D14 C7A2002C */ lwc1 $f2, 0x002C($sp) -/* 00168 809C1D18 AC620198 */ sw $v0, 0x0198($v1) ## 00000198 -/* 0016C 809C1D1C 3C050600 */ lui $a1, 0x0600 ## $a1 = 06000000 -/* 00170 809C1D20 44060000 */ mfc1 $a2, $f0 -/* 00174 809C1D24 44076000 */ mfc1 $a3, $f12 -/* 00178 809C1D28 24A5006C */ addiu $a1, $a1, 0x006C ## $a1 = 0600006C -/* 0017C 809C1D2C AFA00014 */ sw $zero, 0x0014($sp) -/* 00180 809C1D30 2464014C */ addiu $a0, $v1, 0x014C ## $a0 = 0000014C -/* 00184 809C1D34 E7AC0018 */ swc1 $f12, 0x0018($sp) -/* 00188 809C1D38 0C029468 */ jal SkelAnime_ChangeAnimation - -/* 0018C 809C1D3C E7A20010 */ swc1 $f2, 0x0010($sp) -/* 00190 809C1D40 3C05809C */ lui $a1, %hi(func_809C1D60) ## $a1 = 809C0000 -/* 00194 809C1D44 24A51D60 */ addiu $a1, $a1, %lo(func_809C1D60) ## $a1 = 809C1D60 -/* 00198 809C1D48 0C2706EC */ jal EnBird_SetNewUpdate -/* 0019C 809C1D4C 8FA40030 */ lw $a0, 0x0030($sp) -/* 001A0 809C1D50 8FBF0024 */ lw $ra, 0x0024($sp) -/* 001A4 809C1D54 27BD0030 */ addiu $sp, $sp, 0x0030 ## $sp = 00000000 -/* 001A8 809C1D58 03E00008 */ jr $ra -/* 001AC 809C1D5C 00000000 */ nop - - diff --git a/src/code/z_sample.c b/src/code/z_sample.c index 2f4f3fc6fb..9b9fa95593 100644 --- a/src/code/z_sample.c +++ b/src/code/z_sample.c @@ -34,10 +34,11 @@ void Sample_Draw(SampleContext* this) { gfxCtx->polyOpa.p = func_80093708(gfxCtx->polyOpa.p, 0xFF, 0xFF, 0xFF, 0, 0, 0); func_80093D18(gfxCtx); - + gDPSetCycleType(gfxCtx->polyOpa.p++, G_CYC_1CYCLE); gDPSetRenderMode(gfxCtx->polyOpa.p++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2); - gDPSetCombineLERP(gfxCtx->polyOpa.p++, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE); + gDPSetCombineLERP(gfxCtx->polyOpa.p++, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, + PRIMITIVE); gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 0xFF, 0xFF, 0x00, 0x00); func_800C6B54(gfxArr, gfxCtx, "../z_sample.c", 111); diff --git a/src/overlays/actors/ovl_En_Bird/z_en_bird.c b/src/overlays/actors/ovl_En_Bird/z_en_bird.c index 93c0645966..c7d839ff31 100644 --- a/src/overlays/actors/ovl_En_Bird/z_en_bird.c +++ b/src/overlays/actors/ovl_En_Bird/z_en_bird.c @@ -86,19 +86,15 @@ void EnBird_Init(EnBird* this, GlobalContext* globalCtx) { void EnBird_Destroy(EnBird* this, GlobalContext* globalCtx) { } -#ifdef NON_MATCHING -// D_0600006C address is reused when it shouldn't be -// also minor ordering differences void func_809C1CAC(EnBird* this, s16 params) { f32 frameCount = SkelAnime_GetFrameCount(&D_0600006C); f32 playbackSpeed = this->unk_19C ? 0.0f : 1.0f; + u32* anim = &D_0600006C; + this->unk_198 = Math_Rand_S16Offset(5, 0x23); - SkelAnime_ChangeAnimation(&this->skelAnime, &D_0600006C, playbackSpeed, 0.0f, frameCount, 0, 0.0f); + SkelAnime_ChangeAnimation(&this->skelAnime, anim, playbackSpeed, 0.0f, frameCount, 0, 0.0f); EnBird_SetNewUpdate(this, func_809C1D60); } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Bird/func_809C1CAC.s") -#endif void func_809C1D60(EnBird* this, GlobalContext* globalCtx) { f32 fVar2 = sinf(this->unk_1B4); From 7376fe5cad441ab6635d05dd017a7f3ce79e3916 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Tue, 24 Mar 2020 21:42:07 -0400 Subject: [PATCH 8/8] Decompiled ovl_Bg_Spot12_Gate --- .../ovl_Bg_Spot12_Gate/BgSpot12Gate_Destroy.s | 16 --- .../ovl_Bg_Spot12_Gate/BgSpot12Gate_Draw.s | 17 --- .../ovl_Bg_Spot12_Gate/BgSpot12Gate_Init.s | 37 ----- .../ovl_Bg_Spot12_Gate/BgSpot12Gate_Update.s | 17 --- .../actors/ovl_Bg_Spot12_Gate/func_808B2F90.s | 42 ------ .../actors/ovl_Bg_Spot12_Gate/func_808B30C0.s | 9 -- .../actors/ovl_Bg_Spot12_Gate/func_808B30D8.s | 28 ---- .../actors/ovl_Bg_Spot12_Gate/func_808B3134.s | 9 -- .../actors/ovl_Bg_Spot12_Gate/func_808B314C.s | 16 --- .../actors/ovl_Bg_Spot12_Gate/func_808B317C.s | 7 - .../actors/ovl_Bg_Spot12_Gate/func_808B318C.s | 66 --------- .../actors/ovl_Bg_Spot12_Gate/func_808B3274.s | 12 -- .../actors/ovl_Bg_Spot12_Gate/func_808B3298.s | 6 - data/overlays/actors/z_bg_spot12_gate.data.s | 18 --- data/overlays/actors/z_bg_spot12_gate.reloc.s | 11 -- .../overlays/actors/z_bg_spot12_gate.rodata.s | 17 --- spec | 4 +- .../ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c | 136 +++++++++++++++--- .../ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h | 5 +- undefined_syms.txt | 4 + 20 files changed, 125 insertions(+), 352 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Destroy.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Draw.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Init.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Update.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B2F90.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30C0.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30D8.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3134.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B314C.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B317C.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B318C.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3274.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3298.s delete mode 100644 data/overlays/actors/z_bg_spot12_gate.data.s delete mode 100644 data/overlays/actors/z_bg_spot12_gate.reloc.s delete mode 100644 data/overlays/actors/z_bg_spot12_gate.rodata.s diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Destroy.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Destroy.s deleted file mode 100644 index 34d4e0f551..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Destroy.s +++ /dev/null @@ -1,16 +0,0 @@ -glabel BgSpot12Gate_Destroy -/* 00100 808B3090 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00104 808B3094 AFA40018 */ sw $a0, 0x0018($sp) -/* 00108 808B3098 8FAE0018 */ lw $t6, 0x0018($sp) -/* 0010C 808B309C AFBF0014 */ sw $ra, 0x0014($sp) -/* 00110 808B30A0 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00114 808B30A4 24A50810 */ addiu $a1, $a1, 0x0810 ## $a1 = 00000810 -/* 00118 808B30A8 0C00FB56 */ jal DynaPolyInfo_Free - ## DynaPolyInfo_delReserve -/* 0011C 808B30AC 8DC6014C */ lw $a2, 0x014C($t6) ## 0000014C -/* 00120 808B30B0 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00124 808B30B4 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00128 808B30B8 03E00008 */ jr $ra -/* 0012C 808B30BC 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Draw.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Draw.s deleted file mode 100644 index 34a49ac654..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Draw.s +++ /dev/null @@ -1,17 +0,0 @@ -glabel BgSpot12Gate_Draw -/* 00348 808B32D8 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 0034C 808B32DC AFA40018 */ sw $a0, 0x0018($sp) -/* 00350 808B32E0 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00354 808B32E4 AFBF0014 */ sw $ra, 0x0014($sp) -/* 00358 808B32E8 3C050600 */ lui $a1, 0x0600 ## $a1 = 06000000 -/* 0035C 808B32EC 0C00D498 */ jal Draw_DListOpa - -/* 00360 808B32F0 24A51080 */ addiu $a1, $a1, 0x1080 ## $a1 = 06001080 -/* 00364 808B32F4 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00368 808B32F8 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 0036C 808B32FC 03E00008 */ jr $ra -/* 00370 808B3300 00000000 */ nop -/* 00374 808B3304 00000000 */ nop -/* 00378 808B3308 00000000 */ nop -/* 0037C 808B330C 00000000 */ nop - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Init.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Init.s deleted file mode 100644 index f77f5a919c..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Init.s +++ /dev/null @@ -1,37 +0,0 @@ -glabel BgSpot12Gate_Init -/* 00088 808B3018 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0 -/* 0008C 808B301C AFBF001C */ sw $ra, 0x001C($sp) -/* 00090 808B3020 AFB00018 */ sw $s0, 0x0018($sp) -/* 00094 808B3024 3C060600 */ lui $a2, 0x0600 ## $a2 = 06000000 -/* 00098 808B3028 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 0009C 808B302C AFA50024 */ sw $a1, 0x0024($sp) -/* 000A0 808B3030 24C611EC */ addiu $a2, $a2, 0x11EC ## $a2 = 060011EC -/* 000A4 808B3034 0C22CBE4 */ jal func_808B2F90 -/* 000A8 808B3038 00003825 */ or $a3, $zero, $zero ## $a3 = 00000000 -/* 000AC 808B303C 3C05808B */ lui $a1, %hi(D_808B3330) ## $a1 = 808B0000 -/* 000B0 808B3040 24A53330 */ addiu $a1, $a1, %lo(D_808B3330) ## $a1 = 808B3330 -/* 000B4 808B3044 0C01E037 */ jal Actor_ProcessInitChain - -/* 000B8 808B3048 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 000BC 808B304C 8605001C */ lh $a1, 0x001C($s0) ## 0000001C -/* 000C0 808B3050 8FA40024 */ lw $a0, 0x0024($sp) -/* 000C4 808B3054 0C00B2D0 */ jal Flags_GetSwitch - -/* 000C8 808B3058 30A5003F */ andi $a1, $a1, 0x003F ## $a1 = 00000000 -/* 000CC 808B305C 10400005 */ beq $v0, $zero, .L808B3074 -/* 000D0 808B3060 00000000 */ nop -/* 000D4 808B3064 0C22CC9D */ jal func_808B3274 -/* 000D8 808B3068 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 000DC 808B306C 10000004 */ beq $zero, $zero, .L808B3080 -/* 000E0 808B3070 8FBF001C */ lw $ra, 0x001C($sp) -.L808B3074: -/* 000E4 808B3074 0C22CC30 */ jal func_808B30C0 -/* 000E8 808B3078 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 000EC 808B307C 8FBF001C */ lw $ra, 0x001C($sp) -.L808B3080: -/* 000F0 808B3080 8FB00018 */ lw $s0, 0x0018($sp) -/* 000F4 808B3084 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000 -/* 000F8 808B3088 03E00008 */ jr $ra -/* 000FC 808B308C 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Update.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Update.s deleted file mode 100644 index 275228c3e3..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Update.s +++ /dev/null @@ -1,17 +0,0 @@ -glabel BgSpot12Gate_Update -/* 00314 808B32A4 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00318 808B32A8 AFBF0014 */ sw $ra, 0x0014($sp) -/* 0031C 808B32AC 84820168 */ lh $v0, 0x0168($a0) ## 00000168 -/* 00320 808B32B0 18400002 */ blez $v0, .L808B32BC -/* 00324 808B32B4 244EFFFF */ addiu $t6, $v0, 0xFFFF ## $t6 = FFFFFFFF -/* 00328 808B32B8 A48E0168 */ sh $t6, 0x0168($a0) ## 00000168 -.L808B32BC: -/* 0032C 808B32BC 8C990164 */ lw $t9, 0x0164($a0) ## 00000164 -/* 00330 808B32C0 0320F809 */ jalr $ra, $t9 -/* 00334 808B32C4 00000000 */ nop -/* 00338 808B32C8 8FBF0014 */ lw $ra, 0x0014($sp) -/* 0033C 808B32CC 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00340 808B32D0 03E00008 */ jr $ra -/* 00344 808B32D4 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B2F90.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B2F90.s deleted file mode 100644 index b4aa10b68f..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B2F90.s +++ /dev/null @@ -1,42 +0,0 @@ -glabel func_808B2F90 -/* 00000 808B2F90 27BDFFC8 */ addiu $sp, $sp, 0xFFC8 ## $sp = FFFFFFC8 -/* 00004 808B2F94 AFBF0024 */ sw $ra, 0x0024($sp) -/* 00008 808B2F98 AFB00020 */ sw $s0, 0x0020($sp) -/* 0000C 808B2F9C AFA5003C */ sw $a1, 0x003C($sp) -/* 00010 808B2FA0 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 00014 808B2FA4 AFA60040 */ sw $a2, 0x0040($sp) -/* 00018 808B2FA8 AFA00030 */ sw $zero, 0x0030($sp) -/* 0001C 808B2FAC 0C010D20 */ jal DynaPolyInfo_SetActorMove - -/* 00020 808B2FB0 00E02825 */ or $a1, $a3, $zero ## $a1 = 00000000 -/* 00024 808B2FB4 8FA40040 */ lw $a0, 0x0040($sp) -/* 00028 808B2FB8 0C010620 */ jal DynaPolyInfo_Alloc - -/* 0002C 808B2FBC 27A50030 */ addiu $a1, $sp, 0x0030 ## $a1 = FFFFFFF8 -/* 00030 808B2FC0 8FA4003C */ lw $a0, 0x003C($sp) -/* 00034 808B2FC4 02003025 */ or $a2, $s0, $zero ## $a2 = 00000000 -/* 00038 808B2FC8 8FA70030 */ lw $a3, 0x0030($sp) -/* 0003C 808B2FCC 0C00FA9D */ jal DynaPolyInfo_RegisterActor - ## DynaPolyInfo_setActor -/* 00040 808B2FD0 24850810 */ addiu $a1, $a0, 0x0810 ## $a1 = 00000810 -/* 00044 808B2FD4 24010032 */ addiu $at, $zero, 0x0032 ## $at = 00000032 -/* 00048 808B2FD8 1441000A */ bne $v0, $at, .L808B3004 -/* 0004C 808B2FDC AE02014C */ sw $v0, 0x014C($s0) ## 0000014C -/* 00050 808B2FE0 860E001C */ lh $t6, 0x001C($s0) ## 0000001C -/* 00054 808B2FE4 3C04808B */ lui $a0, %hi(D_808B3340) ## $a0 = 808B0000 -/* 00058 808B2FE8 3C05808B */ lui $a1, %hi(D_808B3380) ## $a1 = 808B0000 -/* 0005C 808B2FEC 86070000 */ lh $a3, 0x0000($s0) ## 00000000 -/* 00060 808B2FF0 24A53380 */ addiu $a1, $a1, %lo(D_808B3380) ## $a1 = 808B3380 -/* 00064 808B2FF4 24843340 */ addiu $a0, $a0, %lo(D_808B3340) ## $a0 = 808B3340 -/* 00068 808B2FF8 24060091 */ addiu $a2, $zero, 0x0091 ## $a2 = 00000091 -/* 0006C 808B2FFC 0C00084C */ jal osSyncPrintf - -/* 00070 808B3000 AFAE0010 */ sw $t6, 0x0010($sp) -.L808B3004: -/* 00074 808B3004 8FBF0024 */ lw $ra, 0x0024($sp) -/* 00078 808B3008 8FB00020 */ lw $s0, 0x0020($sp) -/* 0007C 808B300C 27BD0038 */ addiu $sp, $sp, 0x0038 ## $sp = 00000000 -/* 00080 808B3010 03E00008 */ jr $ra -/* 00084 808B3014 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30C0.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30C0.s deleted file mode 100644 index 661b051144..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30C0.s +++ /dev/null @@ -1,9 +0,0 @@ -glabel func_808B30C0 -/* 00130 808B30C0 C484000C */ lwc1 $f4, 0x000C($a0) ## 0000000C -/* 00134 808B30C4 3C0E808B */ lui $t6, %hi(func_808B30D8) ## $t6 = 808B0000 -/* 00138 808B30C8 25CE30D8 */ addiu $t6, $t6, %lo(func_808B30D8) ## $t6 = 808B30D8 -/* 0013C 808B30CC AC8E0164 */ sw $t6, 0x0164($a0) ## 00000164 -/* 00140 808B30D0 03E00008 */ jr $ra -/* 00144 808B30D4 E4840028 */ swc1 $f4, 0x0028($a0) ## 00000028 - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30D8.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30D8.s deleted file mode 100644 index da55ab1c17..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30D8.s +++ /dev/null @@ -1,28 +0,0 @@ -glabel func_808B30D8 -/* 00148 808B30D8 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0 -/* 0014C 808B30DC AFA40020 */ sw $a0, 0x0020($sp) -/* 00150 808B30E0 8FAE0020 */ lw $t6, 0x0020($sp) -/* 00154 808B30E4 AFBF001C */ sw $ra, 0x001C($sp) -/* 00158 808B30E8 AFA50024 */ sw $a1, 0x0024($sp) -/* 0015C 808B30EC 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00160 808B30F0 85C5001C */ lh $a1, 0x001C($t6) ## 0000001C -/* 00164 808B30F4 0C00B2D0 */ jal Flags_GetSwitch - -/* 00168 808B30F8 30A5003F */ andi $a1, $a1, 0x003F ## $a1 = 00000000 -/* 0016C 808B30FC 5040000A */ beql $v0, $zero, .L808B3128 -/* 00170 808B3100 8FBF001C */ lw $ra, 0x001C($sp) -/* 00174 808B3104 0C22CC4D */ jal func_808B3134 -/* 00178 808B3108 8FA40020 */ lw $a0, 0x0020($sp) -/* 0017C 808B310C 8FA40024 */ lw $a0, 0x0024($sp) -/* 00180 808B3110 24051040 */ addiu $a1, $zero, 0x1040 ## $a1 = 00001040 -/* 00184 808B3114 2406FF9D */ addiu $a2, $zero, 0xFF9D ## $a2 = FFFFFF9D -/* 00188 808B3118 8FA70020 */ lw $a3, 0x0020($sp) -/* 0018C 808B311C 0C02003E */ jal func_800800F8 -/* 00190 808B3120 AFA00010 */ sw $zero, 0x0010($sp) -/* 00194 808B3124 8FBF001C */ lw $ra, 0x001C($sp) -.L808B3128: -/* 00198 808B3128 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000 -/* 0019C 808B312C 03E00008 */ jr $ra -/* 001A0 808B3130 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3134.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3134.s deleted file mode 100644 index 0d71903ec2..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3134.s +++ /dev/null @@ -1,9 +0,0 @@ -glabel func_808B3134 -/* 001A4 808B3134 3C0E808B */ lui $t6, %hi(func_808B314C) ## $t6 = 808B0000 -/* 001A8 808B3138 25CE314C */ addiu $t6, $t6, %lo(func_808B314C) ## $t6 = 808B314C -/* 001AC 808B313C 240F0028 */ addiu $t7, $zero, 0x0028 ## $t7 = 00000028 -/* 001B0 808B3140 AC8E0164 */ sw $t6, 0x0164($a0) ## 00000164 -/* 001B4 808B3144 03E00008 */ jr $ra -/* 001B8 808B3148 A48F0168 */ sh $t7, 0x0168($a0) ## 00000168 - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B314C.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B314C.s deleted file mode 100644 index a6831e2823..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B314C.s +++ /dev/null @@ -1,16 +0,0 @@ -glabel func_808B314C -/* 001BC 808B314C 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 001C0 808B3150 AFBF0014 */ sw $ra, 0x0014($sp) -/* 001C4 808B3154 AFA5001C */ sw $a1, 0x001C($sp) -/* 001C8 808B3158 848E0168 */ lh $t6, 0x0168($a0) ## 00000168 -/* 001CC 808B315C 5DC00004 */ bgtzl $t6, .L808B3170 -/* 001D0 808B3160 8FBF0014 */ lw $ra, 0x0014($sp) -/* 001D4 808B3164 0C22CC5F */ jal func_808B317C -/* 001D8 808B3168 00000000 */ nop -/* 001DC 808B316C 8FBF0014 */ lw $ra, 0x0014($sp) -.L808B3170: -/* 001E0 808B3170 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 001E4 808B3174 03E00008 */ jr $ra -/* 001E8 808B3178 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B317C.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B317C.s deleted file mode 100644 index 2fd18e3ea3..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B317C.s +++ /dev/null @@ -1,7 +0,0 @@ -glabel func_808B317C -/* 001EC 808B317C 3C0E808B */ lui $t6, %hi(func_808B318C) ## $t6 = 808B0000 -/* 001F0 808B3180 25CE318C */ addiu $t6, $t6, %lo(func_808B318C) ## $t6 = 808B318C -/* 001F4 808B3184 03E00008 */ jr $ra -/* 001F8 808B3188 AC8E0164 */ sw $t6, 0x0164($a0) ## 00000164 - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B318C.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B318C.s deleted file mode 100644 index 143ee7731f..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B318C.s +++ /dev/null @@ -1,66 +0,0 @@ -glabel func_808B318C -/* 001FC 808B318C 27BDFFC8 */ addiu $sp, $sp, 0xFFC8 ## $sp = FFFFFFC8 -/* 00200 808B3190 AFB00020 */ sw $s0, 0x0020($sp) -/* 00204 808B3194 AFA5003C */ sw $a1, 0x003C($sp) -/* 00208 808B3198 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 0020C 808B319C AFBF0024 */ sw $ra, 0x0024($sp) -/* 00210 808B31A0 3C053FCC */ lui $a1, 0x3FCC ## $a1 = 3FCC0000 -/* 00214 808B31A4 3C063CF5 */ lui $a2, 0x3CF5 ## $a2 = 3CF50000 -/* 00218 808B31A8 34C6C28F */ ori $a2, $a2, 0xC28F ## $a2 = 3CF5C28F -/* 0021C 808B31AC 34A5CCCD */ ori $a1, $a1, 0xCCCD ## $a1 = 3FCCCCCD -/* 00220 808B31B0 0C01DE80 */ jal Math_ApproxF - -/* 00224 808B31B4 24840060 */ addiu $a0, $a0, 0x0060 ## $a0 = 00000060 -/* 00228 808B31B8 3C014348 */ lui $at, 0x4348 ## $at = 43480000 -/* 0022C 808B31BC 44813000 */ mtc1 $at, $f6 ## $f6 = 200.00 -/* 00230 808B31C0 C604000C */ lwc1 $f4, 0x000C($s0) ## 0000000C -/* 00234 808B31C4 26040028 */ addiu $a0, $s0, 0x0028 ## $a0 = 00000028 -/* 00238 808B31C8 8E060060 */ lw $a2, 0x0060($s0) ## 00000060 -/* 0023C 808B31CC 46062200 */ add.s $f8, $f4, $f6 -/* 00240 808B31D0 44054000 */ mfc1 $a1, $f8 -/* 00244 808B31D4 0C01DE80 */ jal Math_ApproxF - -/* 00248 808B31D8 00000000 */ nop -/* 0024C 808B31DC 1040001E */ beq $v0, $zero, .L808B3258 -/* 00250 808B31E0 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00254 808B31E4 0C22CC9D */ jal func_808B3274 -/* 00258 808B31E8 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 0025C 808B31EC 8FA2003C */ lw $v0, 0x003C($sp) -/* 00260 808B31F0 24050003 */ addiu $a1, $zero, 0x0003 ## $a1 = 00000003 -/* 00264 808B31F4 844E07A0 */ lh $t6, 0x07A0($v0) ## 000007A0 -/* 00268 808B31F8 000E7880 */ sll $t7, $t6, 2 -/* 0026C 808B31FC 004FC021 */ addu $t8, $v0, $t7 -/* 00270 808B3200 0C024BE2 */ jal func_80092F88 -/* 00274 808B3204 8F040790 */ lw $a0, 0x0790($t8) ## 00000790 -/* 00278 808B3208 00022400 */ sll $a0, $v0, 16 -/* 0027C 808B320C AFA20030 */ sw $v0, 0x0030($sp) -/* 00280 808B3210 00042403 */ sra $a0, $a0, 16 -/* 00284 808B3214 0C024B6B */ jal func_80092DAC -/* 00288 808B3218 2405C350 */ addiu $a1, $zero, 0xC350 ## $a1 = FFFFC350 -/* 0028C 808B321C 87A40032 */ lh $a0, 0x0032($sp) -/* 00290 808B3220 24050003 */ addiu $a1, $zero, 0x0003 ## $a1 = 00000003 -/* 00294 808B3224 00003025 */ or $a2, $zero, $zero ## $a2 = 00000000 -/* 00298 808B3228 00003825 */ or $a3, $zero, $zero ## $a3 = 00000000 -/* 0029C 808B322C AFA00010 */ sw $zero, 0x0010($sp) -/* 002A0 808B3230 0C024B9C */ jal func_80092E70 -/* 002A4 808B3234 AFA4002C */ sw $a0, 0x002C($sp) -/* 002A8 808B3238 8FA4002C */ lw $a0, 0x002C($sp) -/* 002AC 808B323C 0C024B7C */ jal func_80092DF0 -/* 002B0 808B3240 2405000C */ addiu $a1, $zero, 0x000C ## $a1 = 0000000C -/* 002B4 808B3244 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 002B8 808B3248 0C00BE0A */ jal Audio_PlayActorSound2 - -/* 002BC 808B324C 2405280E */ addiu $a1, $zero, 0x280E ## $a1 = 0000280E -/* 002C0 808B3250 10000004 */ beq $zero, $zero, .L808B3264 -/* 002C4 808B3254 8FBF0024 */ lw $ra, 0x0024($sp) -.L808B3258: -/* 002C8 808B3258 0C00BE5D */ jal func_8002F974 -/* 002CC 808B325C 24052067 */ addiu $a1, $zero, 0x2067 ## $a1 = 00002067 -/* 002D0 808B3260 8FBF0024 */ lw $ra, 0x0024($sp) -.L808B3264: -/* 002D4 808B3264 8FB00020 */ lw $s0, 0x0020($sp) -/* 002D8 808B3268 27BD0038 */ addiu $sp, $sp, 0x0038 ## $sp = 00000000 -/* 002DC 808B326C 03E00008 */ jr $ra -/* 002E0 808B3270 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3274.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3274.s deleted file mode 100644 index 12c439236c..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3274.s +++ /dev/null @@ -1,12 +0,0 @@ -glabel func_808B3274 -/* 002E4 808B3274 3C014348 */ lui $at, 0x4348 ## $at = 43480000 -/* 002E8 808B3278 44813000 */ mtc1 $at, $f6 ## $f6 = 200.00 -/* 002EC 808B327C C484000C */ lwc1 $f4, 0x000C($a0) ## 0000000C -/* 002F0 808B3280 3C0E808B */ lui $t6, %hi(func_808B3298) ## $t6 = 808B0000 -/* 002F4 808B3284 25CE3298 */ addiu $t6, $t6, %lo(func_808B3298) ## $t6 = 808B3298 -/* 002F8 808B3288 46062200 */ add.s $f8, $f4, $f6 -/* 002FC 808B328C AC8E0164 */ sw $t6, 0x0164($a0) ## 00000164 -/* 00300 808B3290 03E00008 */ jr $ra -/* 00304 808B3294 E4880028 */ swc1 $f8, 0x0028($a0) ## 00000028 - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3298.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3298.s deleted file mode 100644 index e019848f93..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3298.s +++ /dev/null @@ -1,6 +0,0 @@ -glabel func_808B3298 -/* 00308 808B3298 AFA40000 */ sw $a0, 0x0000($sp) -/* 0030C 808B329C 03E00008 */ jr $ra -/* 00310 808B32A0 AFA50004 */ sw $a1, 0x0004($sp) - - diff --git a/data/overlays/actors/z_bg_spot12_gate.data.s b/data/overlays/actors/z_bg_spot12_gate.data.s deleted file mode 100644 index 8eda552b04..0000000000 --- a/data/overlays/actors/z_bg_spot12_gate.data.s +++ /dev/null @@ -1,18 +0,0 @@ -.include "macro.inc" - - # assembler directives - .set noat # allow manual use of $at - .set noreorder # don't insert nops after branches - .set gp=64 # allow use of 64-bit general purposee registers - -.section .data - -glabel Bg_Spot12_Gate_InitVars - .word 0x01900100, 0x00000000, 0x01620000, 0x0000016C -.word BgSpot12Gate_Init -.word BgSpot12Gate_Destroy -.word BgSpot12Gate_Update -.word BgSpot12Gate_Draw -glabel D_808B3330 - .word 0xC8500064, 0xB0F409C4, 0xB0F801F4, 0x30FC04B0 - diff --git a/data/overlays/actors/z_bg_spot12_gate.reloc.s b/data/overlays/actors/z_bg_spot12_gate.reloc.s deleted file mode 100644 index 978444c5bd..0000000000 --- a/data/overlays/actors/z_bg_spot12_gate.reloc.s +++ /dev/null @@ -1,11 +0,0 @@ -.include "macro.inc" - - # assembler directives - .set noat # allow manual use of $at - .set noreorder # don't insert nops after branches - .set gp=64 # allow use of 64-bit general purposee registers - -.section .rodata -glabel D_808B33A0 - -.incbin "baserom/ovl_Bg_Spot12_Gate", 0x410, 0x00000080 diff --git a/data/overlays/actors/z_bg_spot12_gate.rodata.s b/data/overlays/actors/z_bg_spot12_gate.rodata.s deleted file mode 100644 index cd8c467d28..0000000000 --- a/data/overlays/actors/z_bg_spot12_gate.rodata.s +++ /dev/null @@ -1,17 +0,0 @@ -.include "macro.inc" - - # assembler directives - .set noat # allow manual use of $at - .set noreorder # don't insert nops after branches - .set gp=64 # allow use of 64-bit general purposee registers - -.section .rodata - -glabel D_808B3340 - .asciz "Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n" - .balign 4 - -glabel D_808B3380 - .word 0x2E2E2F7A, 0x5F62675F, 0x73706F74, 0x31325F67, 0x6174652E, 0x63000000, 0x00000000, 0x00000000 - - diff --git a/spec b/spec index 7ec58264da..774a935a27 100644 --- a/spec +++ b/spec @@ -1478,9 +1478,7 @@ endseg beginseg name "ovl_Bg_Spot12_Gate" include "build/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.o" - include "build/data/overlays/actors/z_bg_spot12_gate.data.o" - include "build/data/overlays/actors/z_bg_spot12_gate.rodata.o" - include "build/data/overlays/actors/z_bg_spot12_gate.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index 65f8e8ef02..f8a190be0b 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -1,14 +1,28 @@ +/* + * File: z_bg_spot12_gate.c + * Overlay: Bg_Spot12_Gate + * Description: + */ + #include "z_bg_spot12_gate.h" #define ROOM 0x00 #define FLAGS 0x00000000 -void BgSpot12Gate_Init(BgSpot12Gate* this, GlobalContext* globalCtx); -void BgSpot12Gate_Destroy(BgSpot12Gate* this, GlobalContext* globalCtx); -void BgSpot12Gate_Update(BgSpot12Gate* this, GlobalContext* globalCtx); -void BgSpot12Gate_Draw(BgSpot12Gate* this, GlobalContext* globalCtx); +static void BgSpot12Gate_Init(BgSpot12Gate* this, GlobalContext* globalCtx); +static void BgSpot12Gate_Destroy(BgSpot12Gate* this, GlobalContext* globalCtx); +static void BgSpot12Gate_Update(BgSpot12Gate* this, GlobalContext* globalCtx); +static void BgSpot12Gate_Draw(BgSpot12Gate* this, GlobalContext* globalCtx); + +static void func_808B30C0(BgSpot12Gate* this); +static void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx); +static void func_808B3134(BgSpot12Gate* this); +static void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx); +static void func_808B317C(BgSpot12Gate* this); +static void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx); +static void func_808B3274(BgSpot12Gate* this); +static void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx); -/* const ActorInit Bg_Spot12_Gate_InitVars = { ACTOR_BG_SPOT12_GATE, ACTORTYPE_BG, @@ -21,29 +35,113 @@ const ActorInit Bg_Spot12_Gate_InitVars = { (ActorFunc)BgSpot12Gate_Update, (ActorFunc)BgSpot12Gate_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B2F90.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Init.s") +static InitChainEntry initChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), + ICHAIN_F32(unk_F4, 2500, ICHAIN_CONTINUE), + ICHAIN_F32(unk_F8, 500, ICHAIN_CONTINUE), + ICHAIN_F32(unk_FC, 1200, ICHAIN_STOP), +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Destroy.s") +extern UNK_TYPE D_06001080; +extern UNK_TYPE D_060011EC; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30C0.s") +static void func_808B2F90(BgSpot12Gate* this, GlobalContext* globalCtx, UNK_TYPE collision, DynaPolyMoveFlag flags) { + Actor* thisx = &this->dyna.actor; + s32 localC = 0; + s32 pad[2]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30D8.s") + DynaPolyInfo_SetActorMove(thisx, flags); + DynaPolyInfo_Alloc(collision, &localC); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localC); + if (this->dyna.dynaPolyId == 0x32) { + osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145, + thisx->id, thisx->params); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3134.s") +static void BgSpot12Gate_Init(BgSpot12Gate* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B314C.s") + func_808B2F90(this, globalCtx, &D_060011EC, 0); + Actor_ProcessInitChain(thisx, initChain); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B317C.s") + if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + func_808B3274(this); + } else { + func_808B30C0(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B318C.s") +static void BgSpot12Gate_Destroy(BgSpot12Gate* this, GlobalContext* globalCtx) { + DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3274.s") +static void func_808B30C0(BgSpot12Gate* this) { + Actor* thisx = &this->dyna.actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3298.s") + this->actionFunc = (ActorFunc)func_808B30D8; + thisx->posRot.pos.y = thisx->initPosRot.pos.y; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Update.s") +static void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Draw.s") + if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + func_808B3134(this); + func_800800F8(globalCtx, 0x1040, -0x63, thisx, 0); + } +} + +static void func_808B3134(BgSpot12Gate* this) { + this->actionFunc = (ActorFunc)func_808B314C; + this->unk_168 = 0x28; +} + +static void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx) { + if (this->unk_168 <= 0) { + func_808B317C(this); + } +} + +static void func_808B317C(BgSpot12Gate* this) { + this->actionFunc = (ActorFunc)func_808B318C; +} + +static void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; + s32 var; + + Math_ApproxF(&thisx->velocity.y, 1.6f, 0.03f); + if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y + 200.0f, thisx->velocity.y)) { + func_808B3274(this); + var = func_80092F88(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], 3); + func_80092DAC(var, -0x3CB0); + func_80092E70(var, 3, 0, 0, 0); + func_80092DF0(var, 0xC); + Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP); + } else { + func_8002F974(thisx, 0x2067); + } +} + +static void func_808B3274(BgSpot12Gate* this) { + Actor* thisx = &this->dyna.actor; + + this->actionFunc = (ActorFunc)func_808B3298; + thisx->posRot.pos.y = thisx->initPosRot.pos.y + 200.0f; +} + +static void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx) { +} + +static void BgSpot12Gate_Update(BgSpot12Gate* this, GlobalContext* globalCtx) { + if (this->unk_168 > 0) { + this->unk_168 -= 1; + } + this->actionFunc(this, globalCtx); +} + +static void BgSpot12Gate_Draw(BgSpot12Gate* this, GlobalContext* globalCtx) { + Draw_DListOpa(globalCtx, &D_06001080); +} diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h index 3a6d11ba25..9ba6dc086d 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h @@ -5,8 +5,9 @@ #include typedef struct { - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x20]; + /* 0x0000 */ DynaPolyActor dyna; + /* 0x0164 */ ActorFunc actionFunc; + /* 0x0168 */ s16 unk_168; } BgSpot12Gate; // size = 0x016C extern const ActorInit Bg_Spot12_Gate_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index 80c6aaebd7..c90f13470b 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -152,6 +152,10 @@ DOOR_TOKI_COLLISION_DATA = 0x06007888; // z_bg_spot09_obj D_06008010 = 0x06008010; +// z_bg_spot12_gate +D_06001080 = 0x06001080; +D_060011EC = 0x060011EC; + // z_bg_spot18_futa DL_SPOT18_FUTA = 0x06000368; DL_SPOT18_FUTA2 = 0x06000150;