From cef186304e119f3e98321950094d9e76848c80f3 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Wed, 6 Sep 2023 20:39:16 -0600 Subject: [PATCH] Math (#402) * Math math_util * fix asm files --- .../{menus => code_800AF9B0}/func_800AFC54.s | 0 .../{menus => code_800AF9B0}/func_800AFE00.s | 0 .../{menus => code_800AF9B0}/func_800B0004.s | 0 .../{menus => code_800B45E0}/func_800B5218.s | 0 .../{menus => code_800B45E0}/func_800B559C.s | 0 .../{menus => code_800B45E0}/func_800B578C.s | 0 .../{menus => code_800B45E0}/func_800B6014.s | 0 .../{menus => code_800B45E0}/func_800B60E8.s | 0 .../{menus => code_800B45E0}/func_800B6178.s | 0 .../{menus => code_800B45E0}/func_800B65F4.s | 0 .../{menus => code_800B45E0}/func_800B6828.s | 0 .../{menus => code_800B45E0}/func_800B68F4.s | 0 .../{menus => code_800B45E0}/func_800B69BC.s | 0 asm/non_matchings/math_util/func_802B6540.s | 259 --------- asm/non_matchings/math_util/func_802B68F8.s | 120 ---- asm/non_matchings/math_util/func_802B6A84.s | 80 --- asm/non_matchings/math_util/func_802B75F8.s | 105 ---- asm/non_matchings/math_util/func_802B80D0.s | 227 -------- .../math_util/func_802B4F60.s | 0 .../math_util/func_802B5B14.s | 0 .../math_util/func_802B8614.s | 0 progress.py | 2 +- src/code_800AF9B0.c | 6 +- src/code_800B45E0.c | 18 +- src/math_util.c | 545 ++++++------------ src/math_util.h | 3 +- 26 files changed, 196 insertions(+), 1169 deletions(-) rename asm/non_matchings/{menus => code_800AF9B0}/func_800AFC54.s (100%) rename asm/non_matchings/{menus => code_800AF9B0}/func_800AFE00.s (100%) rename asm/non_matchings/{menus => code_800AF9B0}/func_800B0004.s (100%) rename asm/non_matchings/{menus => code_800B45E0}/func_800B5218.s (100%) rename asm/non_matchings/{menus => code_800B45E0}/func_800B559C.s (100%) rename asm/non_matchings/{menus => code_800B45E0}/func_800B578C.s (100%) rename asm/non_matchings/{menus => code_800B45E0}/func_800B6014.s (100%) rename asm/non_matchings/{menus => code_800B45E0}/func_800B60E8.s (100%) rename asm/non_matchings/{menus => code_800B45E0}/func_800B6178.s (100%) rename asm/non_matchings/{menus => code_800B45E0}/func_800B65F4.s (100%) rename asm/non_matchings/{menus => code_800B45E0}/func_800B6828.s (100%) rename asm/non_matchings/{menus => code_800B45E0}/func_800B68F4.s (100%) rename asm/non_matchings/{menus => code_800B45E0}/func_800B69BC.s (100%) delete mode 100644 asm/non_matchings/math_util/func_802B6540.s delete mode 100644 asm/non_matchings/math_util/func_802B68F8.s delete mode 100644 asm/non_matchings/math_util/func_802B6A84.s delete mode 100644 asm/non_matchings/math_util/func_802B75F8.s delete mode 100644 asm/non_matchings/math_util/func_802B80D0.s rename asm/{non_matchings => unused}/math_util/func_802B4F60.s (100%) rename asm/{non_matchings => unused}/math_util/func_802B5B14.s (100%) rename asm/{non_matchings => unused}/math_util/func_802B8614.s (100%) diff --git a/asm/non_matchings/menus/func_800AFC54.s b/asm/non_matchings/code_800AF9B0/func_800AFC54.s similarity index 100% rename from asm/non_matchings/menus/func_800AFC54.s rename to asm/non_matchings/code_800AF9B0/func_800AFC54.s diff --git a/asm/non_matchings/menus/func_800AFE00.s b/asm/non_matchings/code_800AF9B0/func_800AFE00.s similarity index 100% rename from asm/non_matchings/menus/func_800AFE00.s rename to asm/non_matchings/code_800AF9B0/func_800AFE00.s diff --git a/asm/non_matchings/menus/func_800B0004.s b/asm/non_matchings/code_800AF9B0/func_800B0004.s similarity index 100% rename from asm/non_matchings/menus/func_800B0004.s rename to asm/non_matchings/code_800AF9B0/func_800B0004.s diff --git a/asm/non_matchings/menus/func_800B5218.s b/asm/non_matchings/code_800B45E0/func_800B5218.s similarity index 100% rename from asm/non_matchings/menus/func_800B5218.s rename to asm/non_matchings/code_800B45E0/func_800B5218.s diff --git a/asm/non_matchings/menus/func_800B559C.s b/asm/non_matchings/code_800B45E0/func_800B559C.s similarity index 100% rename from asm/non_matchings/menus/func_800B559C.s rename to asm/non_matchings/code_800B45E0/func_800B559C.s diff --git a/asm/non_matchings/menus/func_800B578C.s b/asm/non_matchings/code_800B45E0/func_800B578C.s similarity index 100% rename from asm/non_matchings/menus/func_800B578C.s rename to asm/non_matchings/code_800B45E0/func_800B578C.s diff --git a/asm/non_matchings/menus/func_800B6014.s b/asm/non_matchings/code_800B45E0/func_800B6014.s similarity index 100% rename from asm/non_matchings/menus/func_800B6014.s rename to asm/non_matchings/code_800B45E0/func_800B6014.s diff --git a/asm/non_matchings/menus/func_800B60E8.s b/asm/non_matchings/code_800B45E0/func_800B60E8.s similarity index 100% rename from asm/non_matchings/menus/func_800B60E8.s rename to asm/non_matchings/code_800B45E0/func_800B60E8.s diff --git a/asm/non_matchings/menus/func_800B6178.s b/asm/non_matchings/code_800B45E0/func_800B6178.s similarity index 100% rename from asm/non_matchings/menus/func_800B6178.s rename to asm/non_matchings/code_800B45E0/func_800B6178.s diff --git a/asm/non_matchings/menus/func_800B65F4.s b/asm/non_matchings/code_800B45E0/func_800B65F4.s similarity index 100% rename from asm/non_matchings/menus/func_800B65F4.s rename to asm/non_matchings/code_800B45E0/func_800B65F4.s diff --git a/asm/non_matchings/menus/func_800B6828.s b/asm/non_matchings/code_800B45E0/func_800B6828.s similarity index 100% rename from asm/non_matchings/menus/func_800B6828.s rename to asm/non_matchings/code_800B45E0/func_800B6828.s diff --git a/asm/non_matchings/menus/func_800B68F4.s b/asm/non_matchings/code_800B45E0/func_800B68F4.s similarity index 100% rename from asm/non_matchings/menus/func_800B68F4.s rename to asm/non_matchings/code_800B45E0/func_800B68F4.s diff --git a/asm/non_matchings/menus/func_800B69BC.s b/asm/non_matchings/code_800B45E0/func_800B69BC.s similarity index 100% rename from asm/non_matchings/menus/func_800B69BC.s rename to asm/non_matchings/code_800B45E0/func_800B69BC.s diff --git a/asm/non_matchings/math_util/func_802B6540.s b/asm/non_matchings/math_util/func_802B6540.s deleted file mode 100644 index 9f2535063..000000000 --- a/asm/non_matchings/math_util/func_802B6540.s +++ /dev/null @@ -1,259 +0,0 @@ -.section .late_rodata - -glabel D_802B9FB8 -.double 3.141592653589793 - -glabel D_802B9FC0 -.double 360.0 - -.section .text - -glabel func_802B6540 -/* 11FB50 802B6540 27BDFF50 */ addiu $sp, $sp, -0xb0 -/* 11FB54 802B6544 AFB00020 */ sw $s0, 0x20($sp) -/* 11FB58 802B6548 00808025 */ move $s0, $a0 -/* 11FB5C 802B654C 97A400C2 */ lhu $a0, 0xc2($sp) -/* 11FB60 802B6550 AFBF0024 */ sw $ra, 0x24($sp) -/* 11FB64 802B6554 AFA500B4 */ sw $a1, 0xb4($sp) -/* 11FB68 802B6558 AFA600B8 */ sw $a2, 0xb8($sp) -/* 11FB6C 802B655C AFA700BC */ sw $a3, 0xbc($sp) -/* 11FB70 802B6560 0C0AE006 */ jal sins -/* 11FB74 802B6564 AFA40038 */ sw $a0, 0x38($sp) -/* 11FB78 802B6568 8FA40038 */ lw $a0, 0x38($sp) -/* 11FB7C 802B656C 0C0AE00E */ jal coss -/* 11FB80 802B6570 E7A00040 */ swc1 $f0, 0x40($sp) -/* 11FB84 802B6574 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 11FB88 802B6578 44816000 */ mtc1 $at, $f12 -/* 11FB8C 802B657C C7A600B8 */ lwc1 $f6, 0xb8($sp) -/* 11FB90 802B6580 44807000 */ mtc1 $zero, $f14 -/* 11FB94 802B6584 C7A20040 */ lwc1 $f2, 0x40($sp) -/* 11FB98 802B6588 460C3032 */ c.eq.s $f6, $f12 -/* 11FB9C 802B658C E7A0008C */ swc1 $f0, 0x8c($sp) -/* 11FBA0 802B6590 46001107 */ neg.s $f4, $f2 -/* 11FBA4 802B6594 E7A000AC */ swc1 $f0, 0xac($sp) -/* 11FBA8 802B6598 E7A40094 */ swc1 $f4, 0x94($sp) -/* 11FBAC 802B659C E7AC009C */ swc1 $f12, 0x9c($sp) -/* 11FBB0 802B65A0 E7AE00A8 */ swc1 $f14, 0xa8($sp) -/* 11FBB4 802B65A4 E7AE00A0 */ swc1 $f14, 0xa0($sp) -/* 11FBB8 802B65A8 E7A200A4 */ swc1 $f2, 0xa4($sp) -/* 11FBBC 802B65AC E7AE0098 */ swc1 $f14, 0x98($sp) -/* 11FBC0 802B65B0 45000018 */ bc1f .L802B6614 -/* 11FBC4 802B65B4 E7AE0090 */ swc1 $f14, 0x90($sp) -/* 11FBC8 802B65B8 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 11FBCC 802B65BC 44810000 */ mtc1 $at, $f0 -/* 11FBD0 802B65C0 44801000 */ mtc1 $zero, $f2 -/* 11FBD4 802B65C4 00002025 */ move $a0, $zero -/* 11FBD8 802B65C8 27A70068 */ addiu $a3, $sp, 0x68 -/* 11FBDC 802B65CC 24090003 */ li $t1, 3 -/* 11FBE0 802B65D0 2406000C */ li $a2, 12 -.L802B65D4: -/* 11FBE4 802B65D4 00042880 */ sll $a1, $a0, 2 -/* 11FBE8 802B65D8 00001025 */ move $v0, $zero -/* 11FBEC 802B65DC 00E01825 */ move $v1, $a3 -.L802B65E0: -/* 11FBF0 802B65E0 54A20004 */ bnel $a1, $v0, .L802B65F4 -/* 11FBF4 802B65E4 E4620000 */ swc1 $f2, ($v1) -/* 11FBF8 802B65E8 10000002 */ b .L802B65F4 -/* 11FBFC 802B65EC E4600000 */ swc1 $f0, ($v1) -/* 11FC00 802B65F0 E4620000 */ swc1 $f2, ($v1) -.L802B65F4: -/* 11FC04 802B65F4 24420004 */ addiu $v0, $v0, 4 -/* 11FC08 802B65F8 1446FFF9 */ bne $v0, $a2, .L802B65E0 -/* 11FC0C 802B65FC 24630004 */ addiu $v1, $v1, 4 -/* 11FC10 802B6600 24840001 */ addiu $a0, $a0, 1 -/* 11FC14 802B6604 1489FFF3 */ bne $a0, $t1, .L802B65D4 -/* 11FC18 802B6608 24E7000C */ addiu $a3, $a3, 0xc -/* 11FC1C 802B660C 10000041 */ b .L802B6714 -/* 11FC20 802B6610 C7AA008C */ lwc1 $f10, 0x8c($sp) -.L802B6614: -/* 11FC24 802B6614 3C01BF80 */ li $at, 0xBF800000 # -1.000000 -/* 11FC28 802B6618 44816000 */ mtc1 $at, $f12 -/* 11FC2C 802B661C C7A800B8 */ lwc1 $f8, 0xb8($sp) -/* 11FC30 802B6620 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 11FC34 802B6624 00002025 */ move $a0, $zero -/* 11FC38 802B6628 460C4032 */ c.eq.s $f8, $f12 -/* 11FC3C 802B662C 27A70068 */ addiu $a3, $sp, 0x68 -/* 11FC40 802B6630 24090003 */ li $t1, 3 -/* 11FC44 802B6634 45000014 */ bc1f .L802B6688 -/* 11FC48 802B6638 00000000 */ nop -/* 11FC4C 802B663C 44801000 */ mtc1 $zero, $f2 -/* 11FC50 802B6640 44810000 */ mtc1 $at, $f0 -/* 11FC54 802B6644 2406000C */ li $a2, 12 -.L802B6648: -/* 11FC58 802B6648 00001025 */ move $v0, $zero -/* 11FC5C 802B664C 00E01825 */ move $v1, $a3 -/* 11FC60 802B6650 00042880 */ sll $a1, $a0, 2 -.L802B6654: -/* 11FC64 802B6654 54A20004 */ bnel $a1, $v0, .L802B6668 -/* 11FC68 802B6658 E4620000 */ swc1 $f2, ($v1) -/* 11FC6C 802B665C 10000002 */ b .L802B6668 -/* 11FC70 802B6660 E4600000 */ swc1 $f0, ($v1) -/* 11FC74 802B6664 E4620000 */ swc1 $f2, ($v1) -.L802B6668: -/* 11FC78 802B6668 24420004 */ addiu $v0, $v0, 4 -/* 11FC7C 802B666C 1446FFF9 */ bne $v0, $a2, .L802B6654 -/* 11FC80 802B6670 24630004 */ addiu $v1, $v1, 4 -/* 11FC84 802B6674 24840001 */ addiu $a0, $a0, 1 -/* 11FC88 802B6678 1489FFF3 */ bne $a0, $t1, .L802B6648 -/* 11FC8C 802B667C 24E7000C */ addiu $a3, $a3, 0xc -/* 11FC90 802B6680 10000023 */ b .L802B6710 -/* 11FC94 802B6684 E7AC0078 */ swc1 $f12, 0x78($sp) -.L802B6688: -/* 11FC98 802B6688 0C0ADF3A */ jal func_802B7CE8 -/* 11FC9C 802B668C C7AC00B8 */ lwc1 $f12, 0xb8($sp) -/* 11FCA0 802B6690 3C014334 */ li $at, 0x43340000 # 180.000000 -/* 11FCA4 802B6694 44815000 */ mtc1 $at, $f10 -/* 11FCA8 802B6698 3C01802C */ lui $at, %hi(D_802B9FB8) -/* 11FCAC 802B669C D4269FB8 */ ldc1 $f6, %lo(D_802B9FB8)($at) -/* 11FCB0 802B66A0 460A0482 */ mul.s $f18, $f0, $f10 -/* 11FCB4 802B66A4 C7AC00B4 */ lwc1 $f12, 0xb4($sp) -/* 11FCB8 802B66A8 3C01802C */ lui $at, %hi(D_802B9FC0) -/* 11FCBC 802B66AC D42A9FC0 */ ldc1 $f10, %lo(D_802B9FC0)($at) -/* 11FCC0 802B66B0 C7B000BC */ lwc1 $f16, 0xbc($sp) -/* 11FCC4 802B66B4 44807000 */ mtc1 $zero, $f14 -/* 11FCC8 802B66B8 27A40068 */ addiu $a0, $sp, 0x68 -/* 11FCCC 802B66BC 46009121 */ cvt.d.s $f4, $f18 -/* 11FCD0 802B66C0 44077000 */ mfc1 $a3, $f14 -/* 11FCD4 802B66C4 46262203 */ div.d $f8, $f4, $f6 -/* 11FCD8 802B66C8 460C6182 */ mul.s $f6, $f12, $f12 -/* 11FCDC 802B66CC 46285481 */ sub.d $f18, $f10, $f8 -/* 11FCE0 802B66D0 46108282 */ mul.s $f10, $f16, $f16 -/* 11FCE4 802B66D4 46209107 */ neg.d $f4, $f18 -/* 11FCE8 802B66D8 46008487 */ neg.s $f18, $f16 -/* 11FCEC 802B66DC 462020A0 */ cvt.s.d $f2, $f4 -/* 11FCF0 802B66E0 460A3000 */ add.s $f0, $f6, $f10 -/* 11FCF4 802B66E4 4600120D */ trunc.w.s $f8, $f2 -/* 11FCF8 802B66E8 46000004 */ sqrt.s $f0, $f0 -/* 11FCFC 802B66EC 44054000 */ mfc1 $a1, $f8 -/* 11FD00 802B66F0 00000000 */ nop -/* 11FD04 802B66F4 00057C00 */ sll $t7, $a1, 0x10 -/* 11FD08 802B66F8 000F2C03 */ sra $a1, $t7, 0x10 -/* 11FD0C 802B66FC 46009103 */ div.s $f4, $f18, $f0 -/* 11FD10 802B6700 46006183 */ div.s $f6, $f12, $f0 -/* 11FD14 802B6704 44062000 */ mfc1 $a2, $f4 -/* 11FD18 802B6708 0C0ADAA1 */ jal func_802B6A84 -/* 11FD1C 802B670C E7A60010 */ swc1 $f6, 0x10($sp) -.L802B6710: -/* 11FD20 802B6710 C7AA008C */ lwc1 $f10, 0x8c($sp) -.L802B6714: -/* 11FD24 802B6714 C7A80068 */ lwc1 $f8, 0x68($sp) -/* 11FD28 802B6718 C7A40090 */ lwc1 $f4, 0x90($sp) -/* 11FD2C 802B671C C7A60074 */ lwc1 $f6, 0x74($sp) -/* 11FD30 802B6720 46085482 */ mul.s $f18, $f10, $f8 -/* 11FD34 802B6724 00000000 */ nop -/* 11FD38 802B6728 46062282 */ mul.s $f10, $f4, $f6 -/* 11FD3C 802B672C C7A60094 */ lwc1 $f6, 0x94($sp) -/* 11FD40 802B6730 C7A40080 */ lwc1 $f4, 0x80($sp) -/* 11FD44 802B6734 460A9200 */ add.s $f8, $f18, $f10 -/* 11FD48 802B6738 46062482 */ mul.s $f18, $f4, $f6 -/* 11FD4C 802B673C 46089280 */ add.s $f10, $f18, $f8 -/* 11FD50 802B6740 E60A0000 */ swc1 $f10, ($s0) -/* 11FD54 802B6744 C7A40098 */ lwc1 $f4, 0x98($sp) -/* 11FD58 802B6748 C7A60068 */ lwc1 $f6, 0x68($sp) -/* 11FD5C 802B674C C7A8009C */ lwc1 $f8, 0x9c($sp) -/* 11FD60 802B6750 C7AA0074 */ lwc1 $f10, 0x74($sp) -/* 11FD64 802B6754 46062482 */ mul.s $f18, $f4, $f6 -/* 11FD68 802B6758 00000000 */ nop -/* 11FD6C 802B675C 460A4102 */ mul.s $f4, $f8, $f10 -/* 11FD70 802B6760 C7AA00A0 */ lwc1 $f10, 0xa0($sp) -/* 11FD74 802B6764 C7A80080 */ lwc1 $f8, 0x80($sp) -/* 11FD78 802B6768 46049180 */ add.s $f6, $f18, $f4 -/* 11FD7C 802B676C 460A4482 */ mul.s $f18, $f8, $f10 -/* 11FD80 802B6770 46069100 */ add.s $f4, $f18, $f6 -/* 11FD84 802B6774 E604000C */ swc1 $f4, 0xc($s0) -/* 11FD88 802B6778 C7A800A4 */ lwc1 $f8, 0xa4($sp) -/* 11FD8C 802B677C C7AA0068 */ lwc1 $f10, 0x68($sp) -/* 11FD90 802B6780 C7A600A8 */ lwc1 $f6, 0xa8($sp) -/* 11FD94 802B6784 C7A40074 */ lwc1 $f4, 0x74($sp) -/* 11FD98 802B6788 460A4482 */ mul.s $f18, $f8, $f10 -/* 11FD9C 802B678C 00000000 */ nop -/* 11FDA0 802B6790 46043202 */ mul.s $f8, $f6, $f4 -/* 11FDA4 802B6794 C7A400AC */ lwc1 $f4, 0xac($sp) -/* 11FDA8 802B6798 C7A60080 */ lwc1 $f6, 0x80($sp) -/* 11FDAC 802B679C 46089280 */ add.s $f10, $f18, $f8 -/* 11FDB0 802B67A0 46043482 */ mul.s $f18, $f6, $f4 -/* 11FDB4 802B67A4 460A9200 */ add.s $f8, $f18, $f10 -/* 11FDB8 802B67A8 E6080018 */ swc1 $f8, 0x18($s0) -/* 11FDBC 802B67AC C7A6008C */ lwc1 $f6, 0x8c($sp) -/* 11FDC0 802B67B0 C7A4006C */ lwc1 $f4, 0x6c($sp) -/* 11FDC4 802B67B4 C7AA0090 */ lwc1 $f10, 0x90($sp) -/* 11FDC8 802B67B8 C7A80078 */ lwc1 $f8, 0x78($sp) -/* 11FDCC 802B67BC 46043482 */ mul.s $f18, $f6, $f4 -/* 11FDD0 802B67C0 00000000 */ nop -/* 11FDD4 802B67C4 46085182 */ mul.s $f6, $f10, $f8 -/* 11FDD8 802B67C8 C7A80094 */ lwc1 $f8, 0x94($sp) -/* 11FDDC 802B67CC C7AA0084 */ lwc1 $f10, 0x84($sp) -/* 11FDE0 802B67D0 46069100 */ add.s $f4, $f18, $f6 -/* 11FDE4 802B67D4 46085482 */ mul.s $f18, $f10, $f8 -/* 11FDE8 802B67D8 46049180 */ add.s $f6, $f18, $f4 -/* 11FDEC 802B67DC E6060004 */ swc1 $f6, 4($s0) -/* 11FDF0 802B67E0 C7AA0098 */ lwc1 $f10, 0x98($sp) -/* 11FDF4 802B67E4 C7A8006C */ lwc1 $f8, 0x6c($sp) -/* 11FDF8 802B67E8 C7A4009C */ lwc1 $f4, 0x9c($sp) -/* 11FDFC 802B67EC C7A60078 */ lwc1 $f6, 0x78($sp) -/* 11FE00 802B67F0 46085482 */ mul.s $f18, $f10, $f8 -/* 11FE04 802B67F4 00000000 */ nop -/* 11FE08 802B67F8 46062282 */ mul.s $f10, $f4, $f6 -/* 11FE0C 802B67FC C7A600A0 */ lwc1 $f6, 0xa0($sp) -/* 11FE10 802B6800 C7A40084 */ lwc1 $f4, 0x84($sp) -/* 11FE14 802B6804 460A9200 */ add.s $f8, $f18, $f10 -/* 11FE18 802B6808 46062482 */ mul.s $f18, $f4, $f6 -/* 11FE1C 802B680C 46089280 */ add.s $f10, $f18, $f8 -/* 11FE20 802B6810 E60A0010 */ swc1 $f10, 0x10($s0) -/* 11FE24 802B6814 C7A400A4 */ lwc1 $f4, 0xa4($sp) -/* 11FE28 802B6818 C7A6006C */ lwc1 $f6, 0x6c($sp) -/* 11FE2C 802B681C C7A800A8 */ lwc1 $f8, 0xa8($sp) -/* 11FE30 802B6820 C7AA0078 */ lwc1 $f10, 0x78($sp) -/* 11FE34 802B6824 46062482 */ mul.s $f18, $f4, $f6 -/* 11FE38 802B6828 00000000 */ nop -/* 11FE3C 802B682C 460A4102 */ mul.s $f4, $f8, $f10 -/* 11FE40 802B6830 C7AA00AC */ lwc1 $f10, 0xac($sp) -/* 11FE44 802B6834 C7A80084 */ lwc1 $f8, 0x84($sp) -/* 11FE48 802B6838 46049180 */ add.s $f6, $f18, $f4 -/* 11FE4C 802B683C 460A4482 */ mul.s $f18, $f8, $f10 -/* 11FE50 802B6840 46069100 */ add.s $f4, $f18, $f6 -/* 11FE54 802B6844 E604001C */ swc1 $f4, 0x1c($s0) -/* 11FE58 802B6848 C7AA0070 */ lwc1 $f10, 0x70($sp) -/* 11FE5C 802B684C C7A8008C */ lwc1 $f8, 0x8c($sp) -/* 11FE60 802B6850 C7A4007C */ lwc1 $f4, 0x7c($sp) -/* 11FE64 802B6854 C7A60090 */ lwc1 $f6, 0x90($sp) -/* 11FE68 802B6858 460A4482 */ mul.s $f18, $f8, $f10 -/* 11FE6C 802B685C 00000000 */ nop -/* 11FE70 802B6860 46043202 */ mul.s $f8, $f6, $f4 -/* 11FE74 802B6864 C7A40094 */ lwc1 $f4, 0x94($sp) -/* 11FE78 802B6868 C7A60088 */ lwc1 $f6, 0x88($sp) -/* 11FE7C 802B686C 46089280 */ add.s $f10, $f18, $f8 -/* 11FE80 802B6870 46043482 */ mul.s $f18, $f6, $f4 -/* 11FE84 802B6874 460A9200 */ add.s $f8, $f18, $f10 -/* 11FE88 802B6878 E6080008 */ swc1 $f8, 8($s0) -/* 11FE8C 802B687C C7A40070 */ lwc1 $f4, 0x70($sp) -/* 11FE90 802B6880 C7A60098 */ lwc1 $f6, 0x98($sp) -/* 11FE94 802B6884 C7A8007C */ lwc1 $f8, 0x7c($sp) -/* 11FE98 802B6888 C7AA009C */ lwc1 $f10, 0x9c($sp) -/* 11FE9C 802B688C 46043482 */ mul.s $f18, $f6, $f4 -/* 11FEA0 802B6890 00000000 */ nop -/* 11FEA4 802B6894 46085182 */ mul.s $f6, $f10, $f8 -/* 11FEA8 802B6898 C7A800A0 */ lwc1 $f8, 0xa0($sp) -/* 11FEAC 802B689C C7AA0088 */ lwc1 $f10, 0x88($sp) -/* 11FEB0 802B68A0 46069100 */ add.s $f4, $f18, $f6 -/* 11FEB4 802B68A4 46085482 */ mul.s $f18, $f10, $f8 -/* 11FEB8 802B68A8 46049180 */ add.s $f6, $f18, $f4 -/* 11FEBC 802B68AC E6060014 */ swc1 $f6, 0x14($s0) -/* 11FEC0 802B68B0 C7A80070 */ lwc1 $f8, 0x70($sp) -/* 11FEC4 802B68B4 C7AA00A4 */ lwc1 $f10, 0xa4($sp) -/* 11FEC8 802B68B8 C7A6007C */ lwc1 $f6, 0x7c($sp) -/* 11FECC 802B68BC C7A400A8 */ lwc1 $f4, 0xa8($sp) -/* 11FED0 802B68C0 46085482 */ mul.s $f18, $f10, $f8 -/* 11FED4 802B68C4 00000000 */ nop -/* 11FED8 802B68C8 46062282 */ mul.s $f10, $f4, $f6 -/* 11FEDC 802B68CC C7A600AC */ lwc1 $f6, 0xac($sp) -/* 11FEE0 802B68D0 C7A40088 */ lwc1 $f4, 0x88($sp) -/* 11FEE4 802B68D4 460A9200 */ add.s $f8, $f18, $f10 -/* 11FEE8 802B68D8 46062482 */ mul.s $f18, $f4, $f6 -/* 11FEEC 802B68DC 46089280 */ add.s $f10, $f18, $f8 -/* 11FEF0 802B68E0 E60A0020 */ swc1 $f10, 0x20($s0) -/* 11FEF4 802B68E4 8FBF0024 */ lw $ra, 0x24($sp) -/* 11FEF8 802B68E8 8FB00020 */ lw $s0, 0x20($sp) -/* 11FEFC 802B68EC 27BD00B0 */ addiu $sp, $sp, 0xb0 -/* 11FF00 802B68F0 03E00008 */ jr $ra -/* 11FF04 802B68F4 00000000 */ nop diff --git a/asm/non_matchings/math_util/func_802B68F8.s b/asm/non_matchings/math_util/func_802B68F8.s deleted file mode 100644 index e6d542219..000000000 --- a/asm/non_matchings/math_util/func_802B68F8.s +++ /dev/null @@ -1,120 +0,0 @@ -.section .late_rodata - -glabel D_802B9FC8 -.double 3.141592653589793 - -glabel D_802B9FD0 -.double 360.0 - -.section .text - -glabel func_802B68F8 -/* 11FF08 802B68F8 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 11FF0C 802B68FC 44866000 */ mtc1 $a2, $f12 -/* 11FF10 802B6900 44812000 */ mtc1 $at, $f4 -/* 11FF14 802B6904 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 11FF18 802B6908 44857000 */ mtc1 $a1, $f14 -/* 11FF1C 802B690C 46046032 */ c.eq.s $f12, $f4 -/* 11FF20 802B6910 AFBF001C */ sw $ra, 0x1c($sp) -/* 11FF24 802B6914 AFA40020 */ sw $a0, 0x20($sp) -/* 11FF28 802B6918 AFA7002C */ sw $a3, 0x2c($sp) -/* 11FF2C 802B691C 45000018 */ bc1f .L802B6980 -/* 11FF30 802B6920 3C01BF80 */ li $at, 0xBF800000 # -1.000000 -/* 11FF34 802B6924 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 11FF38 802B6928 44810000 */ mtc1 $at, $f0 -/* 11FF3C 802B692C 44801000 */ mtc1 $zero, $f2 -/* 11FF40 802B6930 00002025 */ move $a0, $zero -/* 11FF44 802B6934 8FA70020 */ lw $a3, 0x20($sp) -/* 11FF48 802B6938 24090003 */ li $t1, 3 -/* 11FF4C 802B693C 2406000C */ li $a2, 12 -.L802B6940: -/* 11FF50 802B6940 00042880 */ sll $a1, $a0, 2 -/* 11FF54 802B6944 00001025 */ move $v0, $zero -/* 11FF58 802B6948 00E01825 */ move $v1, $a3 -.L802B694C: -/* 11FF5C 802B694C 54A20004 */ bnel $a1, $v0, .L802B6960 -/* 11FF60 802B6950 E4620000 */ swc1 $f2, ($v1) -/* 11FF64 802B6954 10000002 */ b .L802B6960 -/* 11FF68 802B6958 E4600000 */ swc1 $f0, ($v1) -/* 11FF6C 802B695C E4620000 */ swc1 $f2, ($v1) -.L802B6960: -/* 11FF70 802B6960 24420004 */ addiu $v0, $v0, 4 -/* 11FF74 802B6964 1446FFF9 */ bne $v0, $a2, .L802B694C -/* 11FF78 802B6968 24630004 */ addiu $v1, $v1, 4 -/* 11FF7C 802B696C 24840001 */ addiu $a0, $a0, 1 -/* 11FF80 802B6970 1489FFF3 */ bne $a0, $t1, .L802B6940 -/* 11FF84 802B6974 24E7000C */ addiu $a3, $a3, 0xc -/* 11FF88 802B6978 1000003F */ b .L802B6A78 -/* 11FF8C 802B697C 8FBF001C */ lw $ra, 0x1c($sp) -.L802B6980: -/* 11FF90 802B6980 44818000 */ mtc1 $at, $f16 -/* 11FF94 802B6984 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 11FF98 802B6988 00002025 */ move $a0, $zero -/* 11FF9C 802B698C 46106032 */ c.eq.s $f12, $f16 -/* 11FFA0 802B6990 8FA70020 */ lw $a3, 0x20($sp) -/* 11FFA4 802B6994 24090003 */ li $t1, 3 -/* 11FFA8 802B6998 45000015 */ bc1f .L802B69F0 -/* 11FFAC 802B699C 00000000 */ nop -/* 11FFB0 802B69A0 44801000 */ mtc1 $zero, $f2 -/* 11FFB4 802B69A4 44810000 */ mtc1 $at, $f0 -/* 11FFB8 802B69A8 2406000C */ li $a2, 12 -.L802B69AC: -/* 11FFBC 802B69AC 00001025 */ move $v0, $zero -/* 11FFC0 802B69B0 00E01825 */ move $v1, $a3 -/* 11FFC4 802B69B4 00042880 */ sll $a1, $a0, 2 -.L802B69B8: -/* 11FFC8 802B69B8 54A20004 */ bnel $a1, $v0, .L802B69CC -/* 11FFCC 802B69BC E4620000 */ swc1 $f2, ($v1) -/* 11FFD0 802B69C0 10000002 */ b .L802B69CC -/* 11FFD4 802B69C4 E4600000 */ swc1 $f0, ($v1) -/* 11FFD8 802B69C8 E4620000 */ swc1 $f2, ($v1) -.L802B69CC: -/* 11FFDC 802B69CC 24420004 */ addiu $v0, $v0, 4 -/* 11FFE0 802B69D0 1446FFF9 */ bne $v0, $a2, .L802B69B8 -/* 11FFE4 802B69D4 24630004 */ addiu $v1, $v1, 4 -/* 11FFE8 802B69D8 24840001 */ addiu $a0, $a0, 1 -/* 11FFEC 802B69DC 1489FFF3 */ bne $a0, $t1, .L802B69AC -/* 11FFF0 802B69E0 24E7000C */ addiu $a3, $a3, 0xc -/* 11FFF4 802B69E4 8FAE0020 */ lw $t6, 0x20($sp) -/* 11FFF8 802B69E8 10000022 */ b .L802B6A74 -/* 11FFFC 802B69EC E5D00010 */ swc1 $f16, 0x10($t6) -.L802B69F0: -/* 120000 802B69F0 0C0ADF3A */ jal func_802B7CE8 -/* 120004 802B69F4 E7AE0024 */ swc1 $f14, 0x24($sp) -/* 120008 802B69F8 3C014334 */ li $at, 0x43340000 # 180.000000 -/* 12000C 802B69FC 44813000 */ mtc1 $at, $f6 -/* 120010 802B6A00 3C01802C */ lui $at, %hi(D_802B9FC8) -/* 120014 802B6A04 D4329FC8 */ ldc1 $f18, %lo(D_802B9FC8)($at) -/* 120018 802B6A08 46060202 */ mul.s $f8, $f0, $f6 -/* 12001C 802B6A0C C7AE0024 */ lwc1 $f14, 0x24($sp) -/* 120020 802B6A10 3C01802C */ lui $at, %hi(D_802B9FD0) -/* 120024 802B6A14 D4269FD0 */ ldc1 $f6, %lo(D_802B9FD0)($at) -/* 120028 802B6A18 C7AC002C */ lwc1 $f12, 0x2c($sp) -/* 12002C 802B6A1C 8FA40020 */ lw $a0, 0x20($sp) -/* 120030 802B6A20 24070000 */ li $a3, 0 -/* 120034 802B6A24 460042A1 */ cvt.d.s $f10, $f8 -/* 120038 802B6A28 46325103 */ div.d $f4, $f10, $f18 -/* 12003C 802B6A2C 460E7482 */ mul.s $f18, $f14, $f14 -/* 120040 802B6A30 46243201 */ sub.d $f8, $f6, $f4 -/* 120044 802B6A34 460C6182 */ mul.s $f6, $f12, $f12 -/* 120048 802B6A38 46204287 */ neg.d $f10, $f8 -/* 12004C 802B6A3C 46006207 */ neg.s $f8, $f12 -/* 120050 802B6A40 462050A0 */ cvt.s.d $f2, $f10 -/* 120054 802B6A44 46069000 */ add.s $f0, $f18, $f6 -/* 120058 802B6A48 4600110D */ trunc.w.s $f4, $f2 -/* 12005C 802B6A4C 46000004 */ sqrt.s $f0, $f0 -/* 120060 802B6A50 44052000 */ mfc1 $a1, $f4 -/* 120064 802B6A54 00000000 */ nop -/* 120068 802B6A58 0005C400 */ sll $t8, $a1, 0x10 -/* 12006C 802B6A5C 00182C03 */ sra $a1, $t8, 0x10 -/* 120070 802B6A60 46004283 */ div.s $f10, $f8, $f0 -/* 120074 802B6A64 46007483 */ div.s $f18, $f14, $f0 -/* 120078 802B6A68 44065000 */ mfc1 $a2, $f10 -/* 12007C 802B6A6C 0C0ADAA1 */ jal func_802B6A84 -/* 120080 802B6A70 E7B20010 */ swc1 $f18, 0x10($sp) -.L802B6A74: -/* 120084 802B6A74 8FBF001C */ lw $ra, 0x1c($sp) -.L802B6A78: -/* 120088 802B6A78 27BD0020 */ addiu $sp, $sp, 0x20 -/* 12008C 802B6A7C 03E00008 */ jr $ra -/* 120090 802B6A80 00000000 */ nop diff --git a/asm/non_matchings/math_util/func_802B6A84.s b/asm/non_matchings/math_util/func_802B6A84.s deleted file mode 100644 index 801085e23..000000000 --- a/asm/non_matchings/math_util/func_802B6A84.s +++ /dev/null @@ -1,80 +0,0 @@ -glabel func_802B6A84 -/* 120094 802B6A84 27BDFFA8 */ addiu $sp, $sp, -0x58 -/* 120098 802B6A88 F7B40010 */ sdc1 $f20, 0x10($sp) -/* 12009C 802B6A8C 4486A000 */ mtc1 $a2, $f20 -/* 1200A0 802B6A90 00803025 */ move $a2, $a0 -/* 1200A4 802B6A94 F7B60018 */ sdc1 $f22, 0x18($sp) -/* 1200A8 802B6A98 AFA40058 */ sw $a0, 0x58($sp) -/* 1200AC 802B6A9C 4487B000 */ mtc1 $a3, $f22 -/* 1200B0 802B6AA0 AFBF0024 */ sw $ra, 0x24($sp) -/* 1200B4 802B6AA4 30A4FFFF */ andi $a0, $a1, 0xffff -/* 1200B8 802B6AA8 AFA5005C */ sw $a1, 0x5c($sp) -/* 1200BC 802B6AAC AFA40034 */ sw $a0, 0x34($sp) -/* 1200C0 802B6AB0 0C0AE006 */ jal sins -/* 1200C4 802B6AB4 AFA60058 */ sw $a2, 0x58($sp) -/* 1200C8 802B6AB8 8FA40034 */ lw $a0, 0x34($sp) -/* 1200CC 802B6ABC 0C0AE00E */ jal coss -/* 1200D0 802B6AC0 E7A00054 */ swc1 $f0, 0x54($sp) -/* 1200D4 802B6AC4 4614A302 */ mul.s $f12, $f20, $f20 -/* 1200D8 802B6AC8 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 1200DC 802B6ACC 44812000 */ mtc1 $at, $f4 -/* 1200E0 802B6AD0 8FA60058 */ lw $a2, 0x58($sp) -/* 1200E4 802B6AD4 C7B20054 */ lwc1 $f18, 0x54($sp) -/* 1200E8 802B6AD8 460C2181 */ sub.s $f6, $f4, $f12 -/* 1200EC 802B6ADC 44812000 */ mtc1 $at, $f4 -/* 1200F0 802B6AE0 46003202 */ mul.s $f8, $f6, $f0 -/* 1200F4 802B6AE4 46002181 */ sub.s $f6, $f4, $f0 -/* 1200F8 802B6AE8 460C4280 */ add.s $f10, $f8, $f12 -/* 1200FC 802B6AEC E4CA0000 */ swc1 $f10, ($a2) -/* 120100 802B6AF0 C7A80068 */ lwc1 $f8, 0x68($sp) -/* 120104 802B6AF4 E7A60034 */ swc1 $f6, 0x34($sp) -/* 120108 802B6AF8 4608B282 */ mul.s $f10, $f22, $f8 -/* 12010C 802B6AFC 00000000 */ nop -/* 120110 802B6B00 46065082 */ mul.s $f2, $f10, $f6 -/* 120114 802B6B04 44815000 */ mtc1 $at, $f10 -/* 120118 802B6B08 4612A382 */ mul.s $f14, $f20, $f18 -/* 12011C 802B6B0C 00000000 */ nop -/* 120120 802B6B10 4616B402 */ mul.s $f16, $f22, $f22 -/* 120124 802B6B14 460E1101 */ sub.s $f4, $f2, $f14 -/* 120128 802B6B18 46105181 */ sub.s $f6, $f10, $f16 -/* 12012C 802B6B1C E4C4001C */ swc1 $f4, 0x1c($a2) -/* 120130 802B6B20 46027200 */ add.s $f8, $f14, $f2 -/* 120134 802B6B24 46003102 */ mul.s $f4, $f6, $f0 -/* 120138 802B6B28 E4C80014 */ swc1 $f8, 0x14($a2) -/* 12013C 802B6B2C 4612B282 */ mul.s $f10, $f22, $f18 -/* 120140 802B6B30 46102200 */ add.s $f8, $f4, $f16 -/* 120144 802B6B34 E4C80010 */ swc1 $f8, 0x10($a2) -/* 120148 802B6B38 C7A60068 */ lwc1 $f6, 0x68($sp) -/* 12014C 802B6B3C C7A80034 */ lwc1 $f8, 0x34($sp) -/* 120150 802B6B40 E7AA002C */ swc1 $f10, 0x2c($sp) -/* 120154 802B6B44 46143102 */ mul.s $f4, $f6, $f20 -/* 120158 802B6B48 C7A6002C */ lwc1 $f6, 0x2c($sp) -/* 12015C 802B6B4C 46082282 */ mul.s $f10, $f4, $f8 -/* 120160 802B6B50 460A3100 */ add.s $f4, $f6, $f10 -/* 120164 802B6B54 E7AA0030 */ swc1 $f10, 0x30($sp) -/* 120168 802B6B58 E4C40018 */ swc1 $f4, 0x18($a2) -/* 12016C 802B6B5C C7B00068 */ lwc1 $f16, 0x68($sp) -/* 120170 802B6B60 C7A6002C */ lwc1 $f6, 0x2c($sp) -/* 120174 802B6B64 C7A80030 */ lwc1 $f8, 0x30($sp) -/* 120178 802B6B68 46108302 */ mul.s $f12, $f16, $f16 -/* 12017C 802B6B6C 44812000 */ mtc1 $at, $f4 -/* 120180 802B6B70 46064281 */ sub.s $f10, $f8, $f6 -/* 120184 802B6B74 E4CA0008 */ swc1 $f10, 8($a2) -/* 120188 802B6B78 460C2201 */ sub.s $f8, $f4, $f12 -/* 12018C 802B6B7C 46004182 */ mul.s $f6, $f8, $f0 -/* 120190 802B6B80 460C3280 */ add.s $f10, $f6, $f12 -/* 120194 802B6B84 4616A102 */ mul.s $f4, $f20, $f22 -/* 120198 802B6B88 E4CA0020 */ swc1 $f10, 0x20($a2) -/* 12019C 802B6B8C C7A80034 */ lwc1 $f8, 0x34($sp) -/* 1201A0 802B6B90 46082082 */ mul.s $f2, $f4, $f8 -/* 1201A4 802B6B94 00000000 */ nop -/* 1201A8 802B6B98 46128382 */ mul.s $f14, $f16, $f18 -/* 1201AC 802B6B9C 460E1181 */ sub.s $f6, $f2, $f14 -/* 1201B0 802B6BA0 46027280 */ add.s $f10, $f14, $f2 -/* 1201B4 802B6BA4 E4C6000C */ swc1 $f6, 0xc($a2) -/* 1201B8 802B6BA8 E4CA0004 */ swc1 $f10, 4($a2) -/* 1201BC 802B6BAC 8FBF0024 */ lw $ra, 0x24($sp) -/* 1201C0 802B6BB0 D7B60018 */ ldc1 $f22, 0x18($sp) -/* 1201C4 802B6BB4 D7B40010 */ ldc1 $f20, 0x10($sp) -/* 1201C8 802B6BB8 03E00008 */ jr $ra -/* 1201CC 802B6BBC 27BD0058 */ addiu $sp, $sp, 0x58 diff --git a/asm/non_matchings/math_util/func_802B75F8.s b/asm/non_matchings/math_util/func_802B75F8.s deleted file mode 100644 index c6c3ff39d..000000000 --- a/asm/non_matchings/math_util/func_802B75F8.s +++ /dev/null @@ -1,105 +0,0 @@ -glabel func_802B75F8 -/* 120C08 802B75F8 3C014780 */ li $at, 0x47800000 # 65536.000000 -/* 120C0C 802B75FC 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 120C10 802B7600 00801025 */ move $v0, $a0 -/* 120C14 802B7604 24830020 */ addiu $v1, $a0, 0x20 -/* 120C18 802B7608 00A03025 */ move $a2, $a1 -/* 120C1C 802B760C 44810000 */ mtc1 $at, $f0 -/* 120C20 802B7610 24050010 */ li $a1, 16 -/* 120C24 802B7614 27A40014 */ addiu $a0, $sp, 0x14 -/* 120C28 802B7618 00003825 */ move $a3, $zero -/* 120C2C 802B761C C4D00000 */ lwc1 $f16, ($a2) -/* 120C30 802B7620 24E70004 */ addiu $a3, $a3, 4 -/* 120C34 802B7624 46008482 */ mul.s $f18, $f16, $f0 -/* 120C38 802B7628 50E5002F */ beql $a3, $a1, .L802B76E8 -/* 120C3C 802B762C 4600940D */ trunc.w.s $f16, $f18 -/* 120C40 802B7630 4600940D */ trunc.w.s $f16, $f18 -.L802B7634: -/* 120C44 802B7634 24E70004 */ addiu $a3, $a3, 4 -/* 120C48 802B7638 24C60010 */ addiu $a2, $a2, 0x10 -/* 120C4C 802B763C 24420008 */ addiu $v0, $v0, 8 -/* 120C50 802B7640 440F8000 */ mfc1 $t7, $f16 -/* 120C54 802B7644 24630008 */ addiu $v1, $v1, 8 -/* 120C58 802B7648 AFAF0014 */ sw $t7, 0x14($sp) -/* 120C5C 802B764C 84980000 */ lh $t8, ($a0) -/* 120C60 802B7650 A458FFF8 */ sh $t8, -8($v0) -/* 120C64 802B7654 84990002 */ lh $t9, 2($a0) -/* 120C68 802B7658 A479FFF8 */ sh $t9, -8($v1) -/* 120C6C 802B765C C4D0FFF4 */ lwc1 $f16, -0xc($a2) -/* 120C70 802B7660 46008402 */ mul.s $f16, $f16, $f0 -/* 120C74 802B7664 4600840D */ trunc.w.s $f16, $f16 -/* 120C78 802B7668 44098000 */ mfc1 $t1, $f16 -/* 120C7C 802B766C 00000000 */ nop -/* 120C80 802B7670 AFA90014 */ sw $t1, 0x14($sp) -/* 120C84 802B7674 848A0000 */ lh $t2, ($a0) -/* 120C88 802B7678 A44AFFFA */ sh $t2, -6($v0) -/* 120C8C 802B767C 848B0002 */ lh $t3, 2($a0) -/* 120C90 802B7680 A46BFFFA */ sh $t3, -6($v1) -/* 120C94 802B7684 C4D0FFF8 */ lwc1 $f16, -8($a2) -/* 120C98 802B7688 46008402 */ mul.s $f16, $f16, $f0 -/* 120C9C 802B768C 4600840D */ trunc.w.s $f16, $f16 -/* 120CA0 802B7690 440D8000 */ mfc1 $t5, $f16 -/* 120CA4 802B7694 00000000 */ nop -/* 120CA8 802B7698 AFAD0014 */ sw $t5, 0x14($sp) -/* 120CAC 802B769C 848E0000 */ lh $t6, ($a0) -/* 120CB0 802B76A0 A44EFFFC */ sh $t6, -4($v0) -/* 120CB4 802B76A4 848F0002 */ lh $t7, 2($a0) -/* 120CB8 802B76A8 A46FFFFC */ sh $t7, -4($v1) -/* 120CBC 802B76AC C4D0FFFC */ lwc1 $f16, -4($a2) -/* 120CC0 802B76B0 46008402 */ mul.s $f16, $f16, $f0 -/* 120CC4 802B76B4 4600840D */ trunc.w.s $f16, $f16 -/* 120CC8 802B76B8 44198000 */ mfc1 $t9, $f16 -/* 120CCC 802B76BC 00000000 */ nop -/* 120CD0 802B76C0 AFB90014 */ sw $t9, 0x14($sp) -/* 120CD4 802B76C4 84880000 */ lh $t0, ($a0) -/* 120CD8 802B76C8 A448FFFE */ sh $t0, -2($v0) -/* 120CDC 802B76CC 84890002 */ lh $t1, 2($a0) -/* 120CE0 802B76D0 A469FFFE */ sh $t1, -2($v1) -/* 120CE4 802B76D4 C4D00000 */ lwc1 $f16, ($a2) -/* 120CE8 802B76D8 46008482 */ mul.s $f18, $f16, $f0 -/* 120CEC 802B76DC 54E5FFD5 */ bnel $a3, $a1, .L802B7634 -/* 120CF0 802B76E0 4600940D */ trunc.w.s $f16, $f18 -/* 120CF4 802B76E4 4600940D */ trunc.w.s $f16, $f18 -.L802B76E8: -/* 120CF8 802B76E8 24C60010 */ addiu $a2, $a2, 0x10 -/* 120CFC 802B76EC 24420008 */ addiu $v0, $v0, 8 -/* 120D00 802B76F0 24630008 */ addiu $v1, $v1, 8 -/* 120D04 802B76F4 440F8000 */ mfc1 $t7, $f16 -/* 120D08 802B76F8 00000000 */ nop -/* 120D0C 802B76FC AFAF0014 */ sw $t7, 0x14($sp) -/* 120D10 802B7700 84980000 */ lh $t8, ($a0) -/* 120D14 802B7704 A458FFF8 */ sh $t8, -8($v0) -/* 120D18 802B7708 84990002 */ lh $t9, 2($a0) -/* 120D1C 802B770C A479FFF8 */ sh $t9, -8($v1) -/* 120D20 802B7710 C4D0FFF4 */ lwc1 $f16, -0xc($a2) -/* 120D24 802B7714 46008402 */ mul.s $f16, $f16, $f0 -/* 120D28 802B7718 4600840D */ trunc.w.s $f16, $f16 -/* 120D2C 802B771C 44098000 */ mfc1 $t1, $f16 -/* 120D30 802B7720 00000000 */ nop -/* 120D34 802B7724 AFA90014 */ sw $t1, 0x14($sp) -/* 120D38 802B7728 848A0000 */ lh $t2, ($a0) -/* 120D3C 802B772C A44AFFFA */ sh $t2, -6($v0) -/* 120D40 802B7730 848B0002 */ lh $t3, 2($a0) -/* 120D44 802B7734 A46BFFFA */ sh $t3, -6($v1) -/* 120D48 802B7738 C4D0FFF8 */ lwc1 $f16, -8($a2) -/* 120D4C 802B773C 46008402 */ mul.s $f16, $f16, $f0 -/* 120D50 802B7740 4600840D */ trunc.w.s $f16, $f16 -/* 120D54 802B7744 440D8000 */ mfc1 $t5, $f16 -/* 120D58 802B7748 00000000 */ nop -/* 120D5C 802B774C AFAD0014 */ sw $t5, 0x14($sp) -/* 120D60 802B7750 848E0000 */ lh $t6, ($a0) -/* 120D64 802B7754 A44EFFFC */ sh $t6, -4($v0) -/* 120D68 802B7758 848F0002 */ lh $t7, 2($a0) -/* 120D6C 802B775C A46FFFFC */ sh $t7, -4($v1) -/* 120D70 802B7760 C4D0FFFC */ lwc1 $f16, -4($a2) -/* 120D74 802B7764 46008402 */ mul.s $f16, $f16, $f0 -/* 120D78 802B7768 4600840D */ trunc.w.s $f16, $f16 -/* 120D7C 802B776C 44198000 */ mfc1 $t9, $f16 -/* 120D80 802B7770 00000000 */ nop -/* 120D84 802B7774 AFB90014 */ sw $t9, 0x14($sp) -/* 120D88 802B7778 84880000 */ lh $t0, ($a0) -/* 120D8C 802B777C A448FFFE */ sh $t0, -2($v0) -/* 120D90 802B7780 84890002 */ lh $t1, 2($a0) -/* 120D94 802B7784 A469FFFE */ sh $t1, -2($v1) -/* 120D98 802B7788 03E00008 */ jr $ra -/* 120D9C 802B778C 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/non_matchings/math_util/func_802B80D0.s b/asm/non_matchings/math_util/func_802B80D0.s deleted file mode 100644 index 97bcfcc7b..000000000 --- a/asm/non_matchings/math_util/func_802B80D0.s +++ /dev/null @@ -1,227 +0,0 @@ -glabel func_802B80D0 -/* 1216E0 802B80D0 27BDFFA0 */ addiu $sp, $sp, -0x60 -/* 1216E4 802B80D4 AFBF001C */ sw $ra, 0x1c($sp) -/* 1216E8 802B80D8 F7B40010 */ sdc1 $f20, 0x10($sp) -/* 1216EC 802B80DC AFA60068 */ sw $a2, 0x68($sp) -/* 1216F0 802B80E0 C4860000 */ lwc1 $f6, ($a0) -/* 1216F4 802B80E4 C4A40000 */ lwc1 $f4, ($a1) -/* 1216F8 802B80E8 C7AC0074 */ lwc1 $f12, 0x74($sp) -/* 1216FC 802B80EC 44877000 */ mtc1 $a3, $f14 -/* 121700 802B80F0 46062001 */ sub.s $f0, $f4, $f6 -/* 121704 802B80F4 97A7006A */ lhu $a3, 0x6a($sp) -/* 121708 802B80F8 3C01BF80 */ li $at, 0xBF800000 # -1.000000 -/* 12170C 802B80FC 46000002 */ mul.s $f0, $f0, $f0 -/* 121710 802B8100 4600603C */ c.lt.s $f12, $f0 -/* 121714 802B8104 00000000 */ nop -/* 121718 802B8108 45020005 */ bc1fl .L802B8120 -/* 12171C 802B810C C4A80008 */ lwc1 $f8, 8($a1) -/* 121720 802B8110 44810000 */ mtc1 $at, $f0 -/* 121724 802B8114 100000BB */ b .L802B8404 -/* 121728 802B8118 8FBF001C */ lw $ra, 0x1c($sp) -/* 12172C 802B811C C4A80008 */ lwc1 $f8, 8($a1) -.L802B8120: -/* 121730 802B8120 C48A0008 */ lwc1 $f10, 8($a0) -/* 121734 802B8124 3C01BF80 */ li $at, 0xBF800000 # -1.000000 -/* 121738 802B8128 460A4081 */ sub.s $f2, $f8, $f10 -/* 12173C 802B812C 46021082 */ mul.s $f2, $f2, $f2 -/* 121740 802B8130 4602603C */ c.lt.s $f12, $f2 -/* 121744 802B8134 00000000 */ nop -/* 121748 802B8138 45020005 */ bc1fl .L802B8150 -/* 12174C 802B813C 46020500 */ add.s $f20, $f0, $f2 -/* 121750 802B8140 44810000 */ mtc1 $at, $f0 -/* 121754 802B8144 100000AF */ b .L802B8404 -/* 121758 802B8148 8FBF001C */ lw $ra, 0x1c($sp) -/* 12175C 802B814C 46020500 */ add.s $f20, $f0, $f2 -.L802B8150: -/* 121760 802B8150 460EA03C */ c.lt.s $f20, $f14 -/* 121764 802B8154 00000000 */ nop -/* 121768 802B8158 45020004 */ bc1fl .L802B816C -/* 12176C 802B815C 4614603C */ c.lt.s $f12, $f20 -/* 121770 802B8160 100000A7 */ b .L802B8400 -/* 121774 802B8164 4600A006 */ mov.s $f0, $f20 -/* 121778 802B8168 4614603C */ c.lt.s $f12, $f20 -.L802B816C: -/* 12177C 802B816C 3C01BF80 */ li $at, 0xBF800000 # -1.000000 -/* 121780 802B8170 45020005 */ bc1fl .L802B8188 -/* 121784 802B8174 A7A7006A */ sh $a3, 0x6a($sp) -/* 121788 802B8178 44810000 */ mtc1 $at, $f0 -/* 12178C 802B817C 100000A1 */ b .L802B8404 -/* 121790 802B8180 8FBF001C */ lw $ra, 0x1c($sp) -/* 121794 802B8184 A7A7006A */ sh $a3, 0x6a($sp) -.L802B8188: -/* 121798 802B8188 0C0AD489 */ jal func_802B5224 -/* 12179C 802B818C E7AE006C */ swc1 $f14, 0x6c($sp) -/* 1217A0 802B8190 C7AE006C */ lwc1 $f14, 0x6c($sp) -/* 1217A4 802B8194 44808000 */ mtc1 $zero, $f16 -/* 1217A8 802B8198 97A7006A */ lhu $a3, 0x6a($sp) -/* 1217AC 802B819C 3046FFFF */ andi $a2, $v0, 0xffff -/* 1217B0 802B81A0 46107032 */ c.eq.s $f14, $f16 -/* 1217B4 802B81A4 C7B20070 */ lwc1 $f18, 0x70($sp) -/* 1217B8 802B81A8 C7A60070 */ lwc1 $f6, 0x70($sp) -/* 1217BC 802B81AC 24030001 */ li $v1, 1 -/* 1217C0 802B81B0 4502003C */ bc1fl .L802B82A4 -/* 1217C4 802B81B4 444AF800 */ cfc1 $t2, $31 -/* 1217C8 802B81B8 444EF800 */ cfc1 $t6, $31 -/* 1217CC 802B81BC 24030001 */ li $v1, 1 -/* 1217D0 802B81C0 44C3F800 */ ctc1 $v1, $31 -/* 1217D4 802B81C4 00E01025 */ move $v0, $a3 -/* 1217D8 802B81C8 3C014F00 */ li $at, 0x4F000000 # 2147483648.000000 -/* 1217DC 802B81CC 46009124 */ cvt.w.s $f4, $f18 -/* 1217E0 802B81D0 4443F800 */ cfc1 $v1, $31 -/* 1217E4 802B81D4 00000000 */ nop -/* 1217E8 802B81D8 30630078 */ andi $v1, $v1, 0x78 -/* 1217EC 802B81DC 50600013 */ beql $v1, $zero, .L802B822C -/* 1217F0 802B81E0 44032000 */ mfc1 $v1, $f4 -/* 1217F4 802B81E4 44812000 */ mtc1 $at, $f4 -/* 1217F8 802B81E8 24030001 */ li $v1, 1 -/* 1217FC 802B81EC 46049101 */ sub.s $f4, $f18, $f4 -/* 121800 802B81F0 44C3F800 */ ctc1 $v1, $31 -/* 121804 802B81F4 00000000 */ nop -/* 121808 802B81F8 46002124 */ cvt.w.s $f4, $f4 -/* 12180C 802B81FC 4443F800 */ cfc1 $v1, $31 -/* 121810 802B8200 00000000 */ nop -/* 121814 802B8204 30630078 */ andi $v1, $v1, 0x78 -/* 121818 802B8208 14600005 */ bnez $v1, .L802B8220 -/* 12181C 802B820C 00000000 */ nop -/* 121820 802B8210 44032000 */ mfc1 $v1, $f4 -/* 121824 802B8214 3C018000 */ lui $at, 0x8000 -/* 121828 802B8218 10000007 */ b .L802B8238 -/* 12182C 802B821C 00611825 */ or $v1, $v1, $at -.L802B8220: -/* 121830 802B8220 10000005 */ b .L802B8238 -/* 121834 802B8224 2403FFFF */ li $v1, -1 -/* 121838 802B8228 44032000 */ mfc1 $v1, $f4 -.L802B822C: -/* 12183C 802B822C 00000000 */ nop -/* 121840 802B8230 0460FFFB */ bltz $v1, .L802B8220 -/* 121844 802B8234 00000000 */ nop -.L802B8238: -/* 121848 802B8238 00607825 */ move $t7, $v1 -/* 12184C 802B823C 000FC080 */ sll $t8, $t7, 2 -/* 121850 802B8240 030FC023 */ subu $t8, $t8, $t7 -/* 121854 802B8244 0018C0C0 */ sll $t8, $t8, 3 -/* 121858 802B8248 030FC023 */ subu $t8, $t8, $t7 -/* 12185C 802B824C 0018C080 */ sll $t8, $t8, 2 -/* 121860 802B8250 030FC023 */ subu $t8, $t8, $t7 -/* 121864 802B8254 0018C040 */ sll $t8, $t8, 1 -/* 121868 802B8258 3303FFFF */ andi $v1, $t8, 0xffff -/* 12186C 802B825C 00432021 */ addu $a0, $v0, $v1 -/* 121870 802B8260 00432823 */ subu $a1, $v0, $v1 -/* 121874 802B8264 30A9FFFF */ andi $t1, $a1, 0xffff -/* 121878 802B8268 3088FFFF */ andi $t0, $a0, 0xffff -/* 12187C 802B826C 44CEF800 */ ctc1 $t6, $31 -/* 121880 802B8270 01002025 */ move $a0, $t0 -/* 121884 802B8274 0C0AE016 */ jal func_802B8058 -/* 121888 802B8278 01202825 */ move $a1, $t1 -/* 12188C 802B827C 24010001 */ li $at, 1 -/* 121890 802B8280 54410004 */ bnel $v0, $at, .L802B8294 -/* 121894 802B8284 3C01BF80 */ lui $at, 0xbf80 -/* 121898 802B8288 1000005D */ b .L802B8400 -/* 12189C 802B828C 4600A006 */ mov.s $f0, $f20 -/* 1218A0 802B8290 3C01BF80 */ li $at, 0xBF800000 # -1.000000 -.L802B8294: -/* 1218A4 802B8294 44810000 */ mtc1 $at, $f0 -/* 1218A8 802B8298 1000005A */ b .L802B8404 -/* 1218AC 802B829C 8FBF001C */ lw $ra, 0x1c($sp) -/* 1218B0 802B82A0 444AF800 */ cfc1 $t2, $31 -.L802B82A4: -/* 1218B4 802B82A4 44C3F800 */ ctc1 $v1, $31 -/* 1218B8 802B82A8 00E01025 */ move $v0, $a3 -/* 1218BC 802B82AC 3C014F00 */ li $at, 0x4F000000 # 2147483648.000000 -/* 1218C0 802B82B0 46003224 */ cvt.w.s $f8, $f6 -/* 1218C4 802B82B4 4443F800 */ cfc1 $v1, $31 -/* 1218C8 802B82B8 00000000 */ nop -/* 1218CC 802B82BC 30630078 */ andi $v1, $v1, 0x78 -/* 1218D0 802B82C0 50600013 */ beql $v1, $zero, .L802B8310 -/* 1218D4 802B82C4 44034000 */ mfc1 $v1, $f8 -/* 1218D8 802B82C8 44814000 */ mtc1 $at, $f8 -/* 1218DC 802B82CC 24030001 */ li $v1, 1 -/* 1218E0 802B82D0 46083201 */ sub.s $f8, $f6, $f8 -/* 1218E4 802B82D4 44C3F800 */ ctc1 $v1, $31 -/* 1218E8 802B82D8 00000000 */ nop -/* 1218EC 802B82DC 46004224 */ cvt.w.s $f8, $f8 -/* 1218F0 802B82E0 4443F800 */ cfc1 $v1, $31 -/* 1218F4 802B82E4 00000000 */ nop -/* 1218F8 802B82E8 30630078 */ andi $v1, $v1, 0x78 -/* 1218FC 802B82EC 14600005 */ bnez $v1, .L802B8304 -/* 121900 802B82F0 00000000 */ nop -/* 121904 802B82F4 44034000 */ mfc1 $v1, $f8 -/* 121908 802B82F8 3C018000 */ lui $at, 0x8000 -/* 12190C 802B82FC 10000007 */ b .L802B831C -/* 121910 802B8300 00611825 */ or $v1, $v1, $at -.L802B8304: -/* 121914 802B8304 10000005 */ b .L802B831C -/* 121918 802B8308 2403FFFF */ li $v1, -1 -/* 12191C 802B830C 44034000 */ mfc1 $v1, $f8 -.L802B8310: -/* 121920 802B8310 00000000 */ nop -/* 121924 802B8314 0460FFFB */ bltz $v1, .L802B8304 -/* 121928 802B8318 00000000 */ nop -.L802B831C: -/* 12192C 802B831C 00605825 */ move $t3, $v1 -/* 121930 802B8320 000B6080 */ sll $t4, $t3, 2 -/* 121934 802B8324 018B6023 */ subu $t4, $t4, $t3 -/* 121938 802B8328 000C60C0 */ sll $t4, $t4, 3 -/* 12193C 802B832C 018B6023 */ subu $t4, $t4, $t3 -/* 121940 802B8330 000C6080 */ sll $t4, $t4, 2 -/* 121944 802B8334 018B6023 */ subu $t4, $t4, $t3 -/* 121948 802B8338 000C6040 */ sll $t4, $t4, 1 -/* 12194C 802B833C 3183FFFF */ andi $v1, $t4, 0xffff -/* 121950 802B8340 00432021 */ addu $a0, $v0, $v1 -/* 121954 802B8344 00432823 */ subu $a1, $v0, $v1 -/* 121958 802B8348 30AFFFFF */ andi $t7, $a1, 0xffff -/* 12195C 802B834C 308EFFFF */ andi $t6, $a0, 0xffff -/* 121960 802B8350 44CAF800 */ ctc1 $t2, $31 -/* 121964 802B8354 01C02025 */ move $a0, $t6 -/* 121968 802B8358 AFAE0024 */ sw $t6, 0x24($sp) -/* 12196C 802B835C 01E02825 */ move $a1, $t7 -/* 121970 802B8360 AFAF0020 */ sw $t7, 0x20($sp) -/* 121974 802B8364 A7A6005E */ sh $a2, 0x5e($sp) -/* 121978 802B8368 0C0AE016 */ jal func_802B8058 -/* 12197C 802B836C E7AE006C */ swc1 $f14, 0x6c($sp) -/* 121980 802B8370 24010001 */ li $at, 1 -/* 121984 802B8374 14410003 */ bne $v0, $at, .L802B8384 -/* 121988 802B8378 C7AE006C */ lwc1 $f14, 0x6c($sp) -/* 12198C 802B837C 10000020 */ b .L802B8400 -/* 121990 802B8380 4600A006 */ mov.s $f0, $f20 -.L802B8384: -/* 121994 802B8384 0C0ADF2A */ jal func_802B7CA8 -/* 121998 802B8388 46147303 */ div.s $f12, $f14, $f20 -/* 12199C 802B838C 97A7005E */ lhu $a3, 0x5e($sp) -/* 1219A0 802B8390 A7A2005A */ sh $v0, 0x5a($sp) -/* 1219A4 802B8394 97A40026 */ lhu $a0, 0x26($sp) -/* 1219A8 802B8398 00E23021 */ addu $a2, $a3, $v0 -/* 1219AC 802B839C 30D9FFFF */ andi $t9, $a2, 0xffff -/* 1219B0 802B83A0 03203025 */ move $a2, $t9 -/* 1219B4 802B83A4 97A50022 */ lhu $a1, 0x22($sp) -/* 1219B8 802B83A8 0C0AE016 */ jal func_802B8058 -/* 1219BC 802B83AC AFA70028 */ sw $a3, 0x28($sp) -/* 1219C0 802B83B0 24010001 */ li $at, 1 -/* 1219C4 802B83B4 14410003 */ bne $v0, $at, .L802B83C4 -/* 1219C8 802B83B8 8FA70028 */ lw $a3, 0x28($sp) -/* 1219CC 802B83BC 10000010 */ b .L802B8400 -/* 1219D0 802B83C0 4600A006 */ mov.s $f0, $f20 -.L802B83C4: -/* 1219D4 802B83C4 97A8005A */ lhu $t0, 0x5a($sp) -/* 1219D8 802B83C8 97A40026 */ lhu $a0, 0x26($sp) -/* 1219DC 802B83CC 97A50022 */ lhu $a1, 0x22($sp) -/* 1219E0 802B83D0 00E83023 */ subu $a2, $a3, $t0 -/* 1219E4 802B83D4 30C9FFFF */ andi $t1, $a2, 0xffff -/* 1219E8 802B83D8 0C0AE016 */ jal func_802B8058 -/* 1219EC 802B83DC 01203025 */ move $a2, $t1 -/* 1219F0 802B83E0 24010001 */ li $at, 1 -/* 1219F4 802B83E4 54410004 */ bnel $v0, $at, .L802B83F8 -/* 1219F8 802B83E8 3C01BF80 */ lui $at, 0xbf80 -/* 1219FC 802B83EC 10000004 */ b .L802B8400 -/* 121A00 802B83F0 4600A006 */ mov.s $f0, $f20 -/* 121A04 802B83F4 3C01BF80 */ li $at, 0xBF800000 # -1.000000 -.L802B83F8: -/* 121A08 802B83F8 44810000 */ mtc1 $at, $f0 -/* 121A0C 802B83FC 00000000 */ nop -.L802B8400: -/* 121A10 802B8400 8FBF001C */ lw $ra, 0x1c($sp) -.L802B8404: -/* 121A14 802B8404 D7B40010 */ ldc1 $f20, 0x10($sp) -/* 121A18 802B8408 27BD0060 */ addiu $sp, $sp, 0x60 -/* 121A1C 802B840C 03E00008 */ jr $ra -/* 121A20 802B8410 00000000 */ nop diff --git a/asm/non_matchings/math_util/func_802B4F60.s b/asm/unused/math_util/func_802B4F60.s similarity index 100% rename from asm/non_matchings/math_util/func_802B4F60.s rename to asm/unused/math_util/func_802B4F60.s diff --git a/asm/non_matchings/math_util/func_802B5B14.s b/asm/unused/math_util/func_802B5B14.s similarity index 100% rename from asm/non_matchings/math_util/func_802B5B14.s rename to asm/unused/math_util/func_802B5B14.s diff --git a/asm/non_matchings/math_util/func_802B8614.s b/asm/unused/math_util/func_802B8614.s similarity index 100% rename from asm/non_matchings/math_util/func_802B8614.s rename to asm/unused/math_util/func_802B8614.s diff --git a/progress.py b/progress.py index 68f24fed3..7a4cfce99 100644 --- a/progress.py +++ b/progress.py @@ -80,7 +80,7 @@ mainSegFiles2 = [ "asm/non_matchings/menus", ] seg2Files2 = [ - "asm/non_matchings/math_util", + ] audioFiles2 = [ "asm/non_matchings/audio" diff --git a/src/code_800AF9B0.c b/src/code_800AF9B0.c index b53ddeed2..cc24a725e 100644 --- a/src/code_800AF9B0.c +++ b/src/code_800AF9B0.c @@ -123,7 +123,7 @@ void func_800AFC54(Vtx *arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4[3]) { arg4[2] = f18 * (f32)(1.0 / res) * 120.0f; } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800AFC54.s") +GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800AFC54.s") #endif void func_800AFE00(Vtx *arg0, s16 (*arg1)[3], s32 arg2, s32 arg3); @@ -179,7 +179,7 @@ void func_800AFE00(Vtx *arg0, s16 (*arg1)[3], s32 arg2, s32 arg3) { } } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800AFE00.s") +GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800AFE00.s") #endif void func_800AFF58(Vtx *arg0) { @@ -244,5 +244,5 @@ void func_800B0004(void) { gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800B0004.s") +GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B0004.s") #endif diff --git a/src/code_800B45E0.c b/src/code_800B45E0.c index 010f47696..55af0d64b 100644 --- a/src/code_800B45E0.c +++ b/src/code_800B45E0.c @@ -387,7 +387,7 @@ s32 func_800B5218(void) { return var_v0; } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800B5218.s") +GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B5218.s") #endif void func_800B536C(s32 arg0) { @@ -531,7 +531,7 @@ void func_800B559C(s32 course) { osEepromLongWrite(&gSIEventMesgQueue, ((u32) (temp_s2_2 - &gSaveData) >> 3) & 0xFF, temp_s2_2->bestThreelaps[0], 0x00000038); } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800B559C.s") +GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B559C.s") #endif #ifdef MIPS_TO_C @@ -576,7 +576,7 @@ loop_2: return (var_v1 % 256) & 0xFF; } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800B578C.s") +GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B578C.s") #endif s32 func_800B5888(s32 arg0) { @@ -837,7 +837,7 @@ u8 func_800B60E8(s32 arg0) } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800B60E8.s") +GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B60E8.s") #endif #ifdef MIPS_TO_C @@ -927,7 +927,7 @@ s32 func_800B6178(s32 arg0) { return var_v1; } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800B6178.s") +GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B6178.s") #endif s32 func_800B6348(s32 arg0) { @@ -1061,7 +1061,7 @@ block_9: return sp34; } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800B65F4.s") +GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B65F4.s") #endif void func_800B6708(void) { @@ -1126,7 +1126,7 @@ u8 func_800B6828(s32 arg0) { return var_v1 & 0xFF; } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800B6828.s") +GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B6828.s") #endif #ifdef MIPS_TO_C @@ -1156,7 +1156,7 @@ s32 func_800B68F4(s32 arg0) { return temp_a1 & 0xFF; } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800B68F4.s") +GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B68F4.s") #endif #ifdef NON_MATCHING @@ -1180,7 +1180,7 @@ s32 func_800B69BC(s32 arg0) { return osPfsReadWriteFile(&gControllerPak1FileHandle, gControllerPak1FileNote, PFS_WRITE, offset, sizeof(struct_8018EE10_entry), (u8 *)plz); } #else -GLOBAL_ASM("asm/non_matchings/menus/func_800B69BC.s") +GLOBAL_ASM("asm/non_matchings/code_800B45E0/func_800B69BC.s") #endif s32 func_800B6A68(void) { diff --git a/src/math_util.c b/src/math_util.c index 679e569d9..2c39d1b25 100644 --- a/src/math_util.c +++ b/src/math_util.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -31,7 +32,7 @@ UNUSED s32 func_802B4F60(UNUSED s32 arg0, Vec3f arg1, UNUSED s32 arg2, UNUSED f3 return 1; } #else -GLOBAL_ASM("asm/non_matchings/math_util/func_802B4F60.s") +GLOBAL_ASM("asm/unused/math_util/func_802B4F60.s") #endif UNUSED void func_802B4FF0() { @@ -42,7 +43,7 @@ s32 func_802B4FF8(Mat4 arg0, s32 arg1) { if (D_80150112 >= 0x80) { return 0; } - func_802B75F8(&gGfxPool->mtxPool[D_80150112 + 0x32B], arg0); + mtxf_to_mtx(&gGfxPool->mtxPool[D_80150112 + 0x32B], arg0); switch (arg1) { /* irregular */ case 0: gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_80150112 + 0x32B]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -384,7 +385,7 @@ UNUSED void func_802B5B14(Vec3f arg0, Vec3s arg1) { arg0->unk8 = (f32) ((sp70 * sp40) + ((sp3C * sp68) + (sp40 * sp6C))); } #else -GLOBAL_ASM("asm/non_matchings/math_util/func_802B5B14.s") +GLOBAL_ASM("asm/unused/math_util/func_802B5B14.s") #endif void func_802B5CAC(s16 arg0, s16 arg1, Vec3f arg2) { @@ -403,20 +404,17 @@ void func_802B5D30(s16 arg0, s16 arg1, s32 arg2) { } void func_802B5D64(uintptr_t arg0, s16 arg1, s16 arg2, s32 arg3) { - s32 stackPadding0; - s32 stackPadding1; - s32 stackPadding2; + UNUSED s32 pad[3]; f32 sp48; f32 sp44; f32 sp40; - s32 stackPadding3; - s32 stackPadding4; + UNUSED s32 pad2[2]; f32 temp_f10; s32 var_v0; s8 sp2C[3]; Lights1 *var_s0; - var_s0 = VIRTUAL_TO_PHYSICAL2(gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF)); + var_s0 = (Lights1 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF)); sp48 = sins(arg2); sp44 = coss(arg2); sp40 = sins(arg1); @@ -594,227 +592,135 @@ void func_802B64C4(Vec3f arg0, s16 arg1) { arg0[2] = sp2C * temp1 + (temp_f0 * temp3); } -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -void func_802B6A84(f32, ?, f32 *, s16, f32, ?, f32); /* extern */ -static f64 D_802B9FB8 = 3.141592653589793; -static f64 D_802B9FC0 = 360.0; +void func_802B6540(Mat3 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4) { + Mat3 mtx2; + Mat3 matrix; + s32 i, j; + f32 a; + f32 b; + f32 c; + f32 d; + UNUSED s32 pad[3]; + f32 sinValue; + f32 cossValue; -void func_802B6540(f32 (*arg0)[4], f32 arg1, f32 arg2, f32 arg3, u16 arg4) { - f32 spAC; - f32 spA8; - f32 spA4; - f32 spA0; - f32 sp9C; - f32 sp98; - f32 sp94; - f32 sp90; - f32 sp8C; - f32 sp78; - f32 sp68; - f32 sp40; - s32 sp38; - f32 *var_a3; - f32 *var_a3_2; - f32 *var_v1; - f32 *var_v1_2; - f32 temp_f0; - f32 temp_f0_2; - s32 var_a0; - s32 var_a0_2; - s32 var_v0; - s32 var_v0_2; + sinValue = sins(arg4); + cossValue = coss(arg4); + mtx2[0][0] = cossValue; + mtx2[2][1] = 0; + mtx2[1][2] = 0; + + mtx2[1][1] = 1; + mtx2[2][0] = sinValue; + mtx2[0][2] = -sinValue; + + mtx2[2][2] = cossValue; + mtx2[1][0] = 0; + mtx2[0][1] = 0; - sp38 = (s32) arg4; - sp40 = sins(arg4); - temp_f0 = coss(arg4); - sp8C = temp_f0; - spAC = temp_f0; - sp94 = -sp40; - sp9C = 1.0f; - spA8 = 0.0f; - spA0 = 0.0f; - spA4 = sp40; - sp98 = 0.0f; - sp90 = 0.0f; - if (arg2 == 1.0f) { - var_a0 = 0; - var_a3 = &sp68; - do { - var_v0 = 0; - var_v1 = var_a3; -loop_3: - if ((var_a0 * 4) == var_v0) { - *var_v1 = 1.0f; - } else { - *var_v1 = 0.0f; + if (arg2 == 1) { + + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) { + matrix[i][j] = (i == j) ? 1.0f : 0.0f; } - var_v0 += 4; - var_v1 += 4; - if (var_v0 != 0xC) { - goto loop_3; - } - var_a0 += 1; - var_a3 += 0xC; - } while (var_a0 != 3); - } else { - var_a0_2 = 0; - var_a3_2 = &sp68; - if (arg2 == -1.0f) { - do { - var_v0_2 = 0; - var_v1_2 = var_a3_2; -loop_12: - if ((var_a0_2 * 4) == var_v0_2) { - *var_v1_2 = 1.0f; - } else { - *var_v1_2 = 0.0f; - } - var_v0_2 += 4; - var_v1_2 += 4; - if (var_v0_2 != 0xC) { - goto loop_12; - } - var_a0_2 += 1; - var_a3_2 += 0xC; - } while (var_a0_2 != 3); - sp78 = -1.0f; - } else { - temp_f0_2 = sqrtf((arg1 * arg1) + (arg3 * arg3)); - func_802B6A84(arg1, 0, &sp68, (s16) (s32) (f32) -(D_802B9FC0 - ((f64) (func_802B7CE8(arg2) * 180.0f) / D_802B9FB8)), -arg3 / temp_f0_2, 0, arg1 / temp_f0_2); } + + } else if (arg2 == -1) { + + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) { + matrix[i][j] = (i == j) ? 1.0f : 0.0f; + } + } + + matrix[1][1] = -1; + + } else { + a = (f32) -(360.0 - ((f64) (func_802B7CE8(arg2) * 180.0f) / 3.141592653589793)); + b = -arg3 / sqrtf((arg1 * arg1) + (arg3 * arg3)); + c = 0; + d = arg1 / sqrtf((arg1 * arg1) + (arg3 * arg3)); + func_802B6A84(matrix, a, b, c, d); + } - arg0[0][0] = (sp80 * sp94) + ((sp8C * sp68) + (sp90 * sp74)); - arg0[0][3] = (sp80 * spA0) + ((sp98 * sp68) + (sp9C * sp74)); - arg0->unk18 = (f32) ((sp80 * spAC) + ((spA4 * sp68) + (spA8 * sp74))); - arg0[0][1] = (sp84 * sp94) + ((sp8C * sp6C) + (sp90 * sp78)); - arg0->unk10 = (f32) ((sp84 * spA0) + ((sp98 * sp6C) + (sp9C * sp78))); - arg0->unk1C = (f32) ((sp84 * spAC) + ((spA4 * sp6C) + (spA8 * sp78))); - arg0[0][2] = (sp88 * sp94) + ((sp8C * sp70) + (sp90 * sp7C)); - arg0->unk14 = (f32) ((sp88 * spA0) + ((sp98 * sp70) + (sp9C * sp7C))); - arg0->unk20 = (f32) ((sp88 * spAC) + ((spA4 * sp70) + (spA8 * sp7C))); + arg0[0][0] = (mtx2[0][0] * matrix[0][0]) + (mtx2[0][1] * matrix[1][0]) + (mtx2[0][2] * matrix[2][0]); + arg0[1][0] = (mtx2[1][0] * matrix[0][0]) + (mtx2[1][1] * matrix[1][0]) + (mtx2[1][2] * matrix[2][0]); + arg0[2][0] = (mtx2[2][0] * matrix[0][0]) + (mtx2[2][1] * matrix[1][0]) + (mtx2[2][2] * matrix[2][0]); + + arg0[0][1] = (mtx2[0][0] * matrix[0][1]) + (mtx2[0][1] * matrix[1][1]) + (mtx2[0][2] * matrix[2][1]); + arg0[1][1] = (mtx2[1][0] * matrix[0][1]) + (mtx2[1][1] * matrix[1][1]) + (mtx2[1][2] * matrix[2][1]); + arg0[2][1] = (mtx2[2][0] * matrix[0][1]) + (mtx2[2][1] * matrix[1][1]) + (mtx2[2][2] * matrix[2][1]); + + arg0[0][2] = (mtx2[0][0] * matrix[0][2]) + (mtx2[0][1] * matrix[1][2]) + (mtx2[0][2] * matrix[2][2]); + arg0[1][2] = (mtx2[1][0] * matrix[0][2]) + (mtx2[1][1] * matrix[1][2]) + (mtx2[1][2] * matrix[2][2]); + arg0[2][2] = (mtx2[2][0] * matrix[0][2]) + (mtx2[2][1] * matrix[1][2]) + (mtx2[2][2] * matrix[2][2]); + } -#else -GLOBAL_ASM("asm/non_matchings/math_util/func_802B6540.s") -#endif -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -void func_802B6A84(f32, f32, f32 (*)[4], s16, f32, ?, f32); /* extern */ -static f64 D_802B9FC8 = 3.141592653589793; -static f64 D_802B9FD0 = 360.0; +UNUSED void func_802B68F8(Mat3 matrix, f32 arg1, f32 arg2, f32 arg3) { + s32 i, j; + f32 a; + f32 b; + f32 c; + f32 d; + UNUSED f32 pad; -void func_802B68F8(f32 (*arg0)[4], f32 arg1, f32 arg2, f32 arg3) { - f32 (*var_a3)[4]; - f32 (*var_a3_2)[4]; - f32 (*var_v1)[4]; - f32 (*var_v1_2)[4]; - f32 temp_f0; - s32 var_a0; - s32 var_a0_2; - s32 var_v0; - s32 var_v0_2; - - if (arg2 == 1.0f) { - var_a0 = 0; - var_a3 = arg0; - do { - var_v0 = 0; - var_v1 = var_a3; -loop_3: - if ((var_a0 * 4) == var_v0) { - var_v1[0][0] = 1.0f; - } else { - var_v1[0][0] = 0.0f; + if (arg2 == 1) { + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) { + matrix[i][j] = (i == j) ? 1.0f : 0.0f; } - var_v0 += 4; - var_v1 += 4; - if (var_v0 != 0xC) { - goto loop_3; + } + } else if (arg2 == -1) { + for (i = 0; i < 3; i++) { + for (j = 0; j < 3; j++) { + matrix[i][j] = (i == j) ? 1.0f : 0.0f; } - var_a0 += 1; - var_a3 += 0xC; - } while (var_a0 != 3); - return; + } + matrix[1][1] = -1.0f; + } else { + a = (f32) -(360.0 - ((f64) (func_802B7CE8(arg2) * 180.0f) / 3.141592653589793)); + b = -arg3 / sqrtf((arg1 * arg1) + (arg3 * arg3)); + c = 0; + d = arg1 / sqrtf((arg1 * arg1) + (arg3 * arg3)); + func_802B6A84(matrix, a, b, c, d); } - var_a0_2 = 0; - var_a3_2 = arg0; - if (arg2 == -1.0f) { - do { - var_v0_2 = 0; - var_v1_2 = var_a3_2; -loop_12: - if ((var_a0_2 * 4) == var_v0_2) { - var_v1_2[0][0] = 1.0f; - } else { - var_v1_2[0][0] = 0.0f; - } - var_v0_2 += 4; - var_v1_2 += 4; - if (var_v0_2 != 0xC) { - goto loop_12; - } - var_a0_2 += 1; - var_a3_2 += 0xC; - } while (var_a0_2 != 3); - arg0->unk10 = -1.0f; - return; - } - temp_f0 = sqrtf((arg1 * arg1) + (arg3 * arg3)); - func_802B6A84(arg3, arg1, arg0, (s16) (s32) (f32) -(D_802B9FD0 - ((f64) (func_802B7CE8(arg2) * 180.0f) / D_802B9FC8)), -arg3 / temp_f0, 0, arg1 / temp_f0); } -#else -GLOBAL_ASM("asm/non_matchings/math_util/func_802B68F8.s") -#endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_802B6A84(Mat4 arg0, s16 arg1, f32 arg2, f32 arg3, f32 arg4) { - f32 sp54; - s32 sp34; /* compiler-managed */ - f32 sp30; - f32 sp2C; - f32 temp_f0; - f32 temp_f10; +void func_802B6A84(Mat3 arg0, s16 arg1, f32 arg2, f32 arg3, f32 arg4) { + f32 sinValue; + f32 cossValue; f32 temp_f12; - f32 temp_f12_2; - f32 temp_f14; - f32 temp_f14_2; - f32 temp_f16; + f32 temp_f10; f32 temp_f2; - f32 temp_f2_2; - f32 temp_f6; - s32 temp_a0; + f32 temp; + UNUSED s32 pad[2]; + + sinValue = sins((u16) arg1); + cossValue = coss((u16) arg1); + + temp_f12 = 1.0f - cossValue; + + temp_f10 = (arg4 * arg2) * temp_f12; + temp_f2 = (arg3 * arg4) * temp_f12; + temp = ((arg2 * arg3) * temp_f12); - temp_a0 = arg1 & 0xFFFF; - sp34 = temp_a0; - sp54 = sins((u16) temp_a0); - temp_f0 = coss((u16) temp_a0); temp_f12 = arg2 * arg2; - temp_f6 = 1.0f - temp_f0; - arg0[0][0] = ((1.0f - temp_f12) * temp_f0) + temp_f12; - sp34 = temp_f6; - temp_f2 = arg3 * arg4 * temp_f6; - temp_f14 = arg2 * sp54; - temp_f16 = arg3 * arg3; - arg0->unk1C = (f32) (temp_f2 - temp_f14); - arg0->unk14 = (f32) (temp_f14 + temp_f2); - arg0->unk10 = (f32) (((1.0f - temp_f16) * temp_f0) + temp_f16); - sp2C = arg3 * sp54; - temp_f10 = arg4 * arg2 * sp34; - sp30 = temp_f10; - arg0->unk18 = (f32) (sp2C + temp_f10); - temp_f12_2 = arg4 * arg4; - arg0[0][2] = sp30 - sp2C; - arg0->unk20 = (f32) (((1.0f - temp_f12_2) * temp_f0) + temp_f12_2); - temp_f2_2 = arg2 * arg3 * sp34; - temp_f14_2 = arg4 * sp54; - arg0[0][3] = temp_f2_2 - temp_f14_2; - arg0[0][1] = temp_f14_2 + temp_f2_2; + arg0[0][0] = ((1.0f - temp_f12) * cossValue) + temp_f12; + arg0[2][1] = temp_f2 - (arg2 * sinValue); + arg0[1][2] = temp_f2 + (arg2 * sinValue); + + temp_f12 = arg3 * arg3; + arg0[1][1] = (((1.0f - temp_f12) * cossValue) + temp_f12); + arg0[2][0] = temp_f10 + (arg3 * sinValue); + arg0[0][2] = temp_f10 - (arg3 * sinValue); + + temp_f12 = arg4 * arg4; + arg0[2][2] = (((1.0f - temp_f12) * cossValue) + temp_f12); + arg0[1][0] = temp - (arg4 * sinValue); + arg0[0][1] = temp + (arg4 * sinValue); } -#else -GLOBAL_ASM("asm/non_matchings/math_util/func_802B6A84.s") -#endif void func_802B6BC0(Mat4 arg0, s16 arg1, f32 arg2, f32 arg3, f32 arg4) { f32 sine; @@ -906,64 +812,34 @@ void func_802B71CC(Mat4 arg0, Mat4 arg1, Mat4 arg2) { func_802B5398((s32 *)arg0, (s32 *)product, 0x10); } -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -void func_802B75F8(Mtx *arg0, Mat4 arg1) { - s32 sp14; - Mtx *var_v0; - f32 (*temp_a2)[4]; - f32 (*var_a2)[4]; - f32 var_f18; - s32 *temp_v0; - s32 *temp_v1; - s32 *var_v1; - s32 var_a3; - - var_v0 = arg0; - var_v1 = arg0->m[2]; - var_a2 = arg1; - var_a3 = 4; - var_f18 = var_a2[0][0] * 65536.0f; - if (4 != 0x10) { - do { - var_a3 += 4; - var_a2 += 0x10; - var_v0 += 8; - var_v1 += 8; - sp14 = (s32) var_f18; - var_v0->unk-8 = (s16) sp14.unk0; - var_v1->unk-8 = (s16) sp14.unk2; - sp14 = (s32) (var_a2->unk-C * 65536.0f); - var_v0->unk-6 = (s16) sp14.unk0; - var_v1->unk-6 = (s16) sp14.unk2; - sp14 = (s32) (var_a2->unk-8 * 65536.0f); - var_v0->unk-4 = (s16) sp14.unk0; - var_v1->unk-4 = (s16) sp14.unk2; - sp14 = (s32) (var_a2->unk-4 * 65536.0f); - var_v0->unk-2 = (s16) sp14.unk0; - var_v1->unk-2 = (s16) sp14.unk2; - var_f18 = var_a2[0][0] * 65536.0f; - } while (var_a3 != 0x10); - } - temp_a2 = var_a2 + 0x10; - temp_v0 = &var_v0->m[0][2]; - temp_v1 = var_v1 + 8; - sp14 = (s32) var_f18; - temp_v0->unk-8 = (s16) sp14.unk0; - temp_v1->unk-8 = (s16) sp14.unk2; - sp14 = (s32) (temp_a2->unk-C * 65536.0f); - temp_v0->unk-6 = (s16) sp14.unk0; - temp_v1->unk-6 = (s16) sp14.unk2; - sp14 = (s32) (temp_a2->unk-8 * 65536.0f); - temp_v0->unk-4 = (s16) sp14.unk0; - temp_v1->unk-4 = (s16) sp14.unk2; - sp14 = (s32) (temp_a2->unk-4 * 65536.0f); - temp_v0->unk-2 = (s16) sp14.unk0; - temp_v1->unk-2 = (s16) sp14.unk2; -} +/** + * Convert float matrix 'src' to fixed point matrix 'dest'. + * The float matrix may not contain entries larger than 65536 or the console + * crashes. The fixed point matrix has entries with a 16-bit integer part, so + * the floating point numbers are multiplied by 2^16 before being cast to a s32 + * integer. If this doesn't fit, the N64 and iQue consoles will throw an + * exception. On Wii and Wii U Virtual Console the value will simply be clamped + * and no crashes occur. + */ +void mtxf_to_mtx(Mtx *dest, Mat4 src) { +#ifdef AVOID_UB + // Avoid type-casting which is technically UB by calling the equivalent + // guMtxF2L function. This helps little-endian systems, as well. + guMtxF2L(src, dest); #else -GLOBAL_ASM("asm/non_matchings/math_util/func_802B75F8.s") + s32 asFixedPoint; + register s32 i; + register s16 *a3 = (s16 *) dest; // all integer parts stored in first 16 bytes + register s16 *t0 = (s16 *) dest + 16; // all fraction parts stored in last 16 bytes + register f32 *t1 = (f32 *) src; + + for (i = 0; i < 16; i++) { + asFixedPoint = *t1++ * (1 << 16); //! float-to-integer conversion responsible for PU crashes + *a3++ = GET_HIGH_S16_OF_32(asFixedPoint); // integer part + *t0++ = GET_LOW_S16_OF_32(asFixedPoint); // fraction part + } #endif +} /** * Comment from sm64 unverified. mk64 verison is modified @@ -1040,7 +916,7 @@ f32 func_802B79B8(f32 arg0, f32 arg1) { f32 func_802B79F0(f32 arg0, f32 arg1) { f64 halfpi; f32 temp_f0; - f32 temp_f16; + UNUSED f32 pad; f32 temp_f2; f32 var_f16; f32 var_f2; @@ -1174,91 +1050,80 @@ s32 func_802B8058(u16 arg0, u16 arg1, u16 arg2) { return 1; } -#ifdef MIPS_TO_C //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de f32 func_802B80D0(Vec3f arg0, Vec3f arg1, u16 arg2, f32 arg3, f32 arg4, f32 arg5) { - u16 sp5E; - s16 sp5A; - s32 sp28; - s32 sp24; - s32 sp20; + u16 temp_a2; + UNUSED u16 pad; + u16 temp_v0; f32 temp_f0; - f32 temp_f0_2; f32 temp_f20; f32 temp_f2; - f32 temp_f2_2; - s16 temp_v0; s32 temp_t6; s32 temp_t7; - s32 temp_v1; - s32 temp_v1_2; - u16 temp_a2; + u16 temp; + UNUSED s32 pad2[3]; + u16 temp_v1 = ((u16) arg4 * 0xB6); - temp_f0 = arg1->unk0 - arg0->unk0; - temp_f0_2 = temp_f0 * temp_f0; - if (arg5 < temp_f0_2) { + temp_f0 = arg1[0] - arg0[0]; + temp_f0 = temp_f0 * temp_f0; + if (arg5 < temp_f0) { return -1.0f; } - temp_f2 = arg1->unk8 - arg0->unk8; - temp_f2_2 = temp_f2 * temp_f2; - if (arg5 < temp_f2_2) { + + temp_f2 = arg1[2] - arg0[2]; + temp_f2 = temp_f2 * temp_f2; + if (arg5 < temp_f2) { return -1.0f; } - temp_f20 = temp_f0_2 + temp_f2_2; + + temp_f20 = temp_f0 + temp_f2; if (temp_f20 < arg3) { return temp_f20; } - if (arg5 < temp_f20) { + + if (temp_f20 > arg5) { return -1.0f; } - arg2 = arg2; - temp_a2 = func_802B5224(arg0, arg1) & 0xFFFF; + + temp_a2 = func_802B5224(arg0, arg1); + temp_t7 = (arg2 - temp_v1); + temp_t6 = (arg2 + temp_v1); + if (arg3 == 0.0f) { - temp_v1 = ((u32) arg4 * 0xB6) & 0xFFFF; - if (func_802B8058((arg2 + temp_v1) & 0xFFFF, (arg2 - temp_v1) & 0xFFFF, temp_a2) == 1) { + if (func_802B8058((arg2 + temp_v1), (arg2 - temp_v1), temp_a2) == 1) { return temp_f20; } return -1.0f; } - temp_v1_2 = ((u32) arg4 * 0xB6) & 0xFFFF; - temp_t7 = (arg2 - temp_v1_2) & 0xFFFF; - temp_t6 = (arg2 + temp_v1_2) & 0xFFFF; - sp24 = temp_t6; - sp20 = temp_t7; - sp5E = temp_a2; + if (func_802B8058((u16) temp_t6, (u16) temp_t7, temp_a2) == 1) { return temp_f20; } temp_v0 = func_802B7CA8(arg3 / temp_f20); - sp5A = temp_v0; - sp28 = (s32) sp5E; - if (func_802B8058(unksp26, unksp22, (sp5E + temp_v0) & 0xFFFF) == 1) { + temp = temp_a2 + temp_v0; + + if (func_802B8058(temp_t6, temp_t7, temp) == 1) { return temp_f20; } - if (func_802B8058(unksp26, unksp22, (sp5E - (u16) sp5A) & 0xFFFF) == 1) { + + temp = temp_a2 - temp_v0; + if (func_802B8058(temp_t6, temp_t7, temp) == 1) { return temp_f20; } return -1.0f; } -#else -GLOBAL_ASM("asm/non_matchings/math_util/func_802B80D0.s") -#endif // No idea if arg1 is actually a Mat4 or not, but since this function is unused // its impossible to know with certainty either way -void func_802B8414(uintptr_t arg0, Mat4 arg1, s16 arg2, s16 arg3, s32 arg4) { - s32 stackPadding0; - s32 stackPadding1; - s32 stackPadding2; +UNUSED void func_802B8414(uintptr_t arg0, Mat4 arg1, s16 arg2, s16 arg3, s32 arg4) { + UNUSED s32 pad[3]; Vec3f sp40; s8 sp3C[3]; s32 var_v0; - s32 stackPadding3; - s32 stackPadding4; - s32 stackPadding5; + UNUSED s32 pad2[3]; Lights1 *var_s0; - var_s0 = VIRTUAL_TO_PHYSICAL2(gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF)); + var_s0 = (Lights1 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF)); sins(arg3); coss(arg3); sins(arg2); @@ -1276,53 +1141,5 @@ void func_802B8414(uintptr_t arg0, Mat4 arg1, s16 arg2, s16 arg3, s32 arg4) { } } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 792017ad9d422c2467bd42686f383a5c41f41c75 -UNUSED void func_802B8614(Player *player) { - f64 sp78; - f64 sp70; - f64 sp68; - f64 sp58; - f64 sp50; - f64 sp48; - f64 sp40; - f64 sp38; - f64 temp_f12; - f64 temp_f14; - f64 temp_f16; - f64 temp_f18; - f64 temp_f20; - f64 temp_f2; - f64 temp_f30; - f64 temp_f4; - f64 temp_f6; - - temp_f6 = (f64) player->boundingBoxCorners[1].cornerPos[0]; - sp70 = (f64) player->boundingBoxCorners[1].cornerGroundY; - sp68 = (f64) player->boundingBoxCorners[1].cornerPos[2]; - temp_f30 = (f64) player->boundingBoxCorners[0].cornerPos[0]; - sp58 = (f64) player->boundingBoxCorners[0].cornerGroundY; - sp50 = (f64) player->boundingBoxCorners[0].cornerPos[2]; - sp48 = (f64) player->boundingBoxCorners[3].cornerPos[0]; - sp40 = (f64) player->boundingBoxCorners[3].cornerGroundY; - temp_f4 = (f64) player->boundingBoxCorners[3].cornerPos[2]; - temp_f2 = sp58 - sp70; - sp38 = temp_f4; - temp_f12 = temp_f4 - sp50; - temp_f14 = sp50 - sp68; - temp_f16 = sp40 - sp58; - temp_f18 = sp48 - temp_f30; - temp_f20 = temp_f30 - temp_f6; - if (0.0 == 0.0) { - player->unk_058 = 0.0f; - player->unk_060 = 0.0f; - player->unk_05C = 1.0f; - return; - } - player->unk_058 = (f32) ((f64) (f32) ((temp_f2 * temp_f12) - (temp_f14 * temp_f16)) / 0.0); - player->unk_05C = (f32) ((f64) (f32) ((temp_f14 * temp_f18) - (temp_f20 * temp_f12)) / 0.0); - player->unk_060 = (f32) ((f64) (f32) ((temp_f20 * temp_f16) - (temp_f2 * temp_f18)) / 0.0); -} -#else -GLOBAL_ASM("asm/non_matchings/math_util/func_802B8614.s") -#endif +// unused +GLOBAL_ASM("asm/unused/math_util/func_802B8614.s") diff --git a/src/math_util.h b/src/math_util.h index 61786561b..e388c0e0f 100644 --- a/src/math_util.h +++ b/src/math_util.h @@ -16,6 +16,7 @@ // Here to appease the pragma gods double fabs(double x); +void func_802B6A84(Mat3, s16, f32, f32, f32); void func_802B4FF0(void); void func_802B5794(Mat4, Vec3f, Vec3f); s32 func_802B4FF8(Mat4, s32); @@ -53,7 +54,7 @@ void func_802B6540(Mat3, f32, f32, f32, s16); void func_802B6BC0(Mat4, s16, f32, f32, f32); void func_802B6D58(Mat4, Vec3f, Vec3f); void func_802B71CC(Mat4, Mat4, Mat4); -void func_802B75F8(Mtx*, Mat4); +void mtxf_to_mtx(Mtx*, Mat4); u16 atan2_lookup(f32, f32); u16 atan2s(f32, f32); f32 func_802B79B8(f32, f32);