From c66cb9f81af898362fdeb4d1d2656757daa76d51 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sat, 12 Dec 2020 17:21:27 +0900 Subject: [PATCH] 3 --- .../code_303c0_len_3e10/func_800551E0.s | 30 ------------- .../code_303c0_len_3e10/func_80055330.s | 44 ------------------- .../code_303c0_len_3e10/func_80056144.s | 10 ----- src/audio.h | 3 +- src/code_2e230_len_2190.c | 7 +-- src/code_303c0_len_3e10.c | 40 +++++++++++++++-- 6 files changed, 42 insertions(+), 92 deletions(-) delete mode 100644 asm/nonmatchings/code_303c0_len_3e10/func_800551E0.s delete mode 100644 asm/nonmatchings/code_303c0_len_3e10/func_80055330.s delete mode 100644 asm/nonmatchings/code_303c0_len_3e10/func_80056144.s diff --git a/asm/nonmatchings/code_303c0_len_3e10/func_800551E0.s b/asm/nonmatchings/code_303c0_len_3e10/func_800551E0.s deleted file mode 100644 index 324d0aab4c..0000000000 --- a/asm/nonmatchings/code_303c0_len_3e10/func_800551E0.s +++ /dev/null @@ -1,30 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_800551E0 -/* 305E0 800551E0 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 305E4 800551E4 0080482D */ daddu $t1, $a0, $zero -/* 305E8 800551E8 00C0402D */ daddu $t0, $a2, $zero -/* 305EC 800551EC 30A500FF */ andi $a1, $a1, 0xff -/* 305F0 800551F0 00051A00 */ sll $v1, $a1, 8 -/* 305F4 800551F4 3C04800A */ lui $a0, %hi(D_8009A640) -/* 305F8 800551F8 8C84A640 */ lw $a0, %lo(D_8009A640)($a0) -/* 305FC 800551FC 0060382D */ daddu $a3, $v1, $zero -/* 30600 80055200 10A00002 */ beqz $a1, .L8005520C -/* 30604 80055204 AFBF0018 */ sw $ra, 0x18($sp) -/* 30608 80055208 346700FF */ ori $a3, $v1, 0xff -.L8005520C: -/* 3060C 8005520C 00061600 */ sll $v0, $a2, 0x18 -/* 30610 80055210 04420001 */ bltzl $v0, .L80055218 -/* 30614 80055214 2408007F */ addiu $t0, $zero, 0x7f -.L80055218: -/* 30618 80055218 310200FF */ andi $v0, $t0, 0xff -/* 3061C 8005521C 00073400 */ sll $a2, $a3, 0x10 -/* 30620 80055220 0120282D */ daddu $a1, $t1, $zero -/* 30624 80055224 00063403 */ sra $a2, $a2, 0x10 -/* 30628 80055228 0000382D */ daddu $a3, $zero, $zero -/* 3062C 8005522C 0C012DB6 */ jal func_8004B6D8 -/* 30630 80055230 AFA20010 */ sw $v0, 0x10($sp) -/* 30634 80055234 8FBF0018 */ lw $ra, 0x18($sp) -/* 30638 80055238 03E00008 */ jr $ra -/* 3063C 8005523C 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/asm/nonmatchings/code_303c0_len_3e10/func_80055330.s b/asm/nonmatchings/code_303c0_len_3e10/func_80055330.s deleted file mode 100644 index 9f994c3fb5..0000000000 --- a/asm/nonmatchings/code_303c0_len_3e10/func_80055330.s +++ /dev/null @@ -1,44 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80055330 -/* 30730 80055330 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 30734 80055334 0080582D */ daddu $t3, $a0, $zero -/* 30738 80055338 00C0502D */ daddu $t2, $a2, $zero -/* 3073C 8005533C 00E0402D */ daddu $t0, $a3, $zero -/* 30740 80055340 0100382D */ daddu $a3, $t0, $zero -/* 30744 80055344 30A500FF */ andi $a1, $a1, 0xff -/* 30748 80055348 00051A00 */ sll $v1, $a1, 8 -/* 3074C 8005534C 3C04800A */ lui $a0, %hi(D_8009A640) -/* 30750 80055350 8C84A640 */ lw $a0, %lo(D_8009A640)($a0) -/* 30754 80055354 0060482D */ daddu $t1, $v1, $zero -/* 30758 80055358 10A00002 */ beqz $a1, .L80055364 -/* 3075C 8005535C AFBF0018 */ sw $ra, 0x18($sp) -/* 30760 80055360 346900FF */ ori $t1, $v1, 0xff -.L80055364: -/* 30764 80055364 00061600 */ sll $v0, $a2, 0x18 -/* 30768 80055368 04420001 */ bltzl $v0, .L80055370 -/* 3076C 8005536C 240A007F */ addiu $t2, $zero, 0x7f -.L80055370: -/* 30770 80055370 00081400 */ sll $v0, $t0, 0x10 -/* 30774 80055374 00021C03 */ sra $v1, $v0, 0x10 -/* 30778 80055378 28620961 */ slti $v0, $v1, 0x961 -/* 3077C 8005537C 14400003 */ bnez $v0, .L8005538C -/* 30780 80055380 2862F6A0 */ slti $v0, $v1, -0x960 -/* 30784 80055384 080154E5 */ j .L80055394 -/* 30788 80055388 24070960 */ addiu $a3, $zero, 0x960 -.L8005538C: -/* 3078C 8005538C 54400001 */ bnel $v0, $zero, .L80055394 -/* 30790 80055390 2407F6A0 */ addiu $a3, $zero, -0x960 -.L80055394: -/* 30794 80055394 314200FF */ andi $v0, $t2, 0xff -/* 30798 80055398 00093400 */ sll $a2, $t1, 0x10 -/* 3079C 8005539C 00073C00 */ sll $a3, $a3, 0x10 -/* 307A0 800553A0 35651000 */ ori $a1, $t3, 0x1000 -/* 307A4 800553A4 00063403 */ sra $a2, $a2, 0x10 -/* 307A8 800553A8 00073C03 */ sra $a3, $a3, 0x10 -/* 307AC 800553AC 0C012DB6 */ jal func_8004B6D8 -/* 307B0 800553B0 AFA20010 */ sw $v0, 0x10($sp) -/* 307B4 800553B4 8FBF0018 */ lw $ra, 0x18($sp) -/* 307B8 800553B8 03E00008 */ jr $ra -/* 307BC 800553BC 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/asm/nonmatchings/code_303c0_len_3e10/func_80056144.s b/asm/nonmatchings/code_303c0_len_3e10/func_80056144.s deleted file mode 100644 index e621946915..0000000000 --- a/asm/nonmatchings/code_303c0_len_3e10/func_80056144.s +++ /dev/null @@ -1,10 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80056144 -/* 31544 80056144 3C02800A */ lui $v0, %hi(D_8009A5C0) -/* 31548 80056148 8C42A5C0 */ lw $v0, %lo(D_8009A5C0)($v0) -/* 3154C 8005614C 00052880 */ sll $a1, $a1, 2 -/* 31550 80056150 00451021 */ addu $v0, $v0, $a1 -/* 31554 80056154 03E00008 */ jr $ra -/* 31558 80056158 AC4400A4 */ sw $a0, 0xa4($v0) diff --git a/src/audio.h b/src/audio.h index 82292e9dbc..f47bb900fe 100644 --- a/src/audio.h +++ b/src/audio.h @@ -229,8 +229,7 @@ typedef struct UnkAl19E0 { /* 0x0098 */ char unk_98[0x4]; /* 0x009C */ s32 unk_9C; /* 0x00A0 */ s32* unk_A0; - /* 0x00A4 */ UnkFuncAl unk_A4; - /* 0x00A8 */ s32 unk_A8; + /* 0x00A4 */ UnkFuncAl unk_A4[2]; /* 0x00AC */ s32* unk_AC; /* 0x00B0 */ char unk_B0[0x3C]; /* 0x00EC */ s32* unk_EC; diff --git a/src/code_2e230_len_2190.c b/src/code_2e230_len_2190.c index 900d30f986..500e99eaa8 100644 --- a/src/code_2e230_len_2190.c +++ b/src/code_2e230_len_2190.c @@ -55,8 +55,9 @@ void func_80052E5C(s32 arg0) { func_80053370(&temp4->unk_08); func_800533A8(&temp4->unk_14); func_8005610C(); - temp4->unk_A4 = 0; - temp4->unk_A8 = 0; + + temp4->unk_A4[0] = NULL; + temp4->unk_A4[1] = NULL; for (i = 0; i < 1; i++) { temp4->unk_6C[i].unk_4 = 0; @@ -262,7 +263,7 @@ void func_800535C0(void) { func_8005610C(); } - D_8009A5E8 = temp_s1->unk_A4; + D_8009A5E8 = temp_s1->unk_A4[0]; if (D_8009A5E8 != NULL) { D_8009A5E8(); } diff --git a/src/code_303c0_len_3e10.c b/src/code_303c0_len_3e10.c index fbac937890..ea51f8b074 100644 --- a/src/code_303c0_len_3e10.c +++ b/src/code_303c0_len_3e10.c @@ -37,7 +37,20 @@ void func_80055110(UnkAlA9C *arg0) { INCLUDE_ASM(s32, "code_303c0_len_3e10", func_8005513C); -INCLUDE_ASM(s32, "code_303c0_len_3e10", func_800551E0); +void func_800551E0(s32 arg0, u8 arg1, s8 arg2) { + UnkAl6CC* sym = D_8009A640; + s16 a1temp = arg1 * 256; + + if (a1temp != 0) { + a1temp |= 0xFF; + } + + if (arg2 < 0) { + arg2 = 0x7F; + } + + func_8004B6D8(sym, arg0, a1temp, 0, arg2); +} void func_80055240(s32 arg0, u8 arg1, s8 arg2, s16 arg3) { UnkAl6CC* sym = D_8009A640; @@ -75,7 +88,26 @@ void func_800552D0(s32 arg0, u8 arg1, s8 arg2) { func_8004B6D8(sym, arg0 | 0x1000, a1temp, 0, arg2); } -INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055330); +void func_80055330(s32 arg0, u8 arg1, s8 arg2, s16 arg3) { + UnkAl6CC* sym = D_8009A640; + s16 a1temp = arg1 * 256; + + if (a1temp != 0) { + a1temp |= 0xFF; + } + + if (arg2 < 0) { + arg2 = 0x7F; + } + + if (arg3 > 0x960) { + arg3 = 0x960; + } else if (arg3 < -0x960) { + arg3 = -0x960; + } + + func_8004B6D8(sym, arg0 | 0x1000, a1temp, arg3, arg2); +} void func_800553C0(s32 arg0) { func_8004B6D8(D_8009A640, arg0 | 0x8000, 0, 0, 0); @@ -360,7 +392,9 @@ INCLUDE_ASM(s32, "code_303c0_len_3e10", func_800560BC); INCLUDE_ASM(void, "code_303c0_len_3e10", func_8005610C, void); -INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80056144); +void func_80056144(UnkFuncAl arg0, s32 arg1) { + D_8009A5C0->unk_A4[arg1] = arg0; +} void func_8005615C(void) { func_80056D5C(1);