diff --git a/Makefile b/Makefile index 5489fa072..f3c70801c 100644 --- a/Makefile +++ b/Makefile @@ -506,6 +506,7 @@ $(BUILD_DIR)/src/os/osSyncPrintf.o: OPT_FLAGS := -O3 ifeq ($(COMPILER),ido) $(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -use_readwrite_const $(BUILD_DIR)/src/audio/port_eu.o: OPT_FLAGS := -O2 -framepointer + $(BUILD_DIR)/src/audio/external.o: OPT_FLAGS := -O2 -framepointer endif #################### Compile course vertex to mio0 ##################### diff --git a/asm/bss_main_audio.s b/asm/bss_main_audio.s index 294a18e14..9b875079f 100644 --- a/asm/bss_main_audio.s +++ b/asm/bss_main_audio.s @@ -32,22 +32,19 @@ glabel D_8018FC08 glabel D_8018FC10 .skip 16 -glabel D_8018FC20 +glabel sSoundRequests .skip 6144 -glabel D_80191420 -.skip 36 +glabel sSoundBanks +.skip 5760 -glabel D_80191444 -.skip 5724 - -glabel D_80192AA0 +glabel sSoundBankUsedListBack .skip 8 -glabel D_80192AA8 +glabel sSoundBankFreeListFront .skip 8 -glabel D_80192AB0 +glabel sNumSoundsInBank .skip 8 glabel D_80192AB8 @@ -56,7 +53,7 @@ glabel D_80192AB8 glabel D_80192C38 .skip 4 -glabel D_80192C3C +glabel sSoundBankDisabled .skip 12 glabel D_80192C48 diff --git a/asm/bss_sptask_audio.s b/asm/bss_sptask_audio.s index 31d6f7e0a..2d30b567e 100644 --- a/asm/bss_sptask_audio.s +++ b/asm/bss_sptask_audio.s @@ -164,7 +164,7 @@ glabel D_803B718C glabel D_803B7192 .skip 2 -glabel D_803B7194 +glabel gAudioRandom .skip 4 glabel gAudioErrorFlags diff --git a/asm/non_matchings/audio/external/func_800C13F0.s b/asm/non_matchings/audio/external/func_800C13F0.s deleted file mode 100644 index 796bb947a..000000000 --- a/asm/non_matchings/audio/external/func_800C13F0.s +++ /dev/null @@ -1,4 +0,0 @@ -glabel func_800C13F0 -/* 0C1FF0 800C13F0 27BDFFF0 */ addiu $sp, $sp, -0x10 -/* 0C1FF4 800C13F4 03E00008 */ jr $ra -/* 0C1FF8 800C13F8 27BD0010 */ addiu $sp, $sp, 0x10 diff --git a/asm/non_matchings/audio/external/func_800C1480.s b/asm/non_matchings/audio/external/func_800C1480.s deleted file mode 100644 index f0bccdd3e..000000000 --- a/asm/non_matchings/audio/external/func_800C1480.s +++ /dev/null @@ -1,93 +0,0 @@ -glabel func_800C1480 -/* 0C2080 800C1480 308E00FF */ andi $t6, $a0, 0xff -/* 0C2084 800C1484 30AF00FF */ andi $t7, $a1, 0xff -/* 0C2088 800C1488 000FC880 */ sll $t9, $t7, 2 -/* 0C208C 800C148C 000EC100 */ sll $t8, $t6, 4 -/* 0C2090 800C1490 030EC023 */ subu $t8, $t8, $t6 -/* 0C2094 800C1494 032FC823 */ subu $t9, $t9, $t7 -/* 0C2098 800C1498 27ADFFF0 */ addiu $t5, $sp, -0x10 -/* 0C209C 800C149C 0019C900 */ sll $t9, $t9, 4 -/* 0C20A0 800C14A0 0018C180 */ sll $t8, $t8, 6 -/* 0C20A4 800C14A4 3C098019 */ lui $t1, %hi(D_80191420) # $t1, 0x8019 -/* 0C20A8 800C14A8 25291420 */ addiu $t1, %lo(D_80191420) # addiu $t1, $t1, 0x1420 -/* 0C20AC 800C14AC 03194021 */ addu $t0, $t8, $t9 -/* 0C20B0 800C14B0 ADA40010 */ sw $a0, 0x10($t5) -/* 0C20B4 800C14B4 ADA50014 */ sw $a1, 0x14($t5) -/* 0C20B8 800C14B8 01091021 */ addu $v0, $t0, $t1 -/* 0C20BC 800C14BC 8C430024 */ lw $v1, 0x24($v0) -/* 0C20C0 800C14C0 3C0144FA */ li $at, 0x44FA0000 # 2000.000000 -/* 0C20C4 800C14C4 01A0E825 */ move $sp, $t5 -/* 0C20C8 800C14C8 00035240 */ sll $t2, $v1, 9 -/* 0C20CC 800C14CC 05430006 */ bgezl $t2, .L800C14E8 -/* 0C20D0 800C14D0 44817000 */ mtc1 $at, $f14 -/* 0C20D4 800C14D4 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 0C20D8 800C14D8 44810000 */ mtc1 $at, $f0 -/* 0C20DC 800C14DC 1000003A */ b .L800C15C8 -/* 0C20E0 800C14E0 00000000 */ nop -/* 0C20E4 800C14E4 44817000 */ mtc1 $at, $f14 -.L800C14E8: -/* 0C20E8 800C14E8 C440001C */ lwc1 $f0, 0x1c($v0) -/* 0C20EC 800C14EC 3C040003 */ lui $a0, 3 -/* 0C20F0 800C14F0 00641024 */ and $v0, $v1, $a0 -/* 0C20F4 800C14F4 4600703C */ c.lt.s $f14, $f0 -/* 0C20F8 800C14F8 3C010001 */ lui $at, 1 -/* 0C20FC 800C14FC 45000004 */ bc1f .L800C1510 -/* 0C2100 800C1500 00000000 */ nop -/* 0C2104 800C1504 44801000 */ mtc1 $zero, $f2 -/* 0C2108 800C1508 1000002F */ b .L800C15C8 -/* 0C210C 800C150C 46001006 */ mov.s $f0, $f2 -.L800C1510: -/* 0C2110 800C1510 10410007 */ beq $v0, $at, .L800C1530 -/* 0C2114 800C1514 3C010002 */ lui $at, 2 -/* 0C2118 800C1518 10410007 */ beq $v0, $at, .L800C1538 -/* 0C211C 800C151C 00000000 */ nop -/* 0C2120 800C1520 50440008 */ beql $v0, $a0, .L800C1544 -/* 0C2124 800C1524 240203E8 */ li $v0, 1000 -/* 0C2128 800C1528 10000006 */ b .L800C1544 -/* 0C212C 800C152C 24020190 */ li $v0, 400 -.L800C1530: -/* 0C2130 800C1530 10000004 */ b .L800C1544 -/* 0C2134 800C1534 240201F4 */ li $v0, 500 -.L800C1538: -/* 0C2138 800C1538 10000002 */ b .L800C1544 -/* 0C213C 800C153C 2402029A */ li $v0, 666 -/* 0C2140 800C1540 240203E8 */ li $v0, 1000 -.L800C1544: -/* 0C2144 800C1544 44822000 */ mtc1 $v0, $f4 -/* 0C2148 800C1548 00000000 */ nop -/* 0C214C 800C154C 46802320 */ cvt.s.w $f12, $f4 -/* 0C2150 800C1550 460C003C */ c.lt.s $f0, $f12 -/* 0C2154 800C1554 00000000 */ nop -/* 0C2158 800C1558 4502000C */ bc1fl .L800C158C -/* 0C215C 800C155C 460C0181 */ sub.s $f6, $f0, $f12 -/* 0C2160 800C1560 46006181 */ sub.s $f6, $f12, $f0 -/* 0C2164 800C1564 3C013FE0 */ li $at, 0x3FE00000 # 1.750000 -/* 0C2168 800C1568 44818800 */ mtc1 $at, $f17 -/* 0C216C 800C156C 44808000 */ mtc1 $zero, $f16 -/* 0C2170 800C1570 460C3203 */ div.s $f8, $f6, $f12 -/* 0C2174 800C1574 460042A1 */ cvt.d.s $f10, $f8 -/* 0C2178 800C1578 46305482 */ mul.d $f18, $f10, $f16 -/* 0C217C 800C157C 46309100 */ add.d $f4, $f18, $f16 -/* 0C2180 800C1580 1000000E */ b .L800C15BC -/* 0C2184 800C1584 462020A0 */ cvt.s.d $f2, $f4 -/* 0C2188 800C1588 460C0181 */ sub.s $f6, $f0, $f12 -.L800C158C: -/* 0C218C 800C158C 3C013FE0 */ li $at, 0x3FE00000 # 1.750000 -/* 0C2190 800C1590 44818800 */ mtc1 $at, $f17 -/* 0C2194 800C1594 460C7201 */ sub.s $f8, $f14, $f12 -/* 0C2198 800C1598 3C013FF0 */ li $at, 0x3FF00000 # 1.875000 -/* 0C219C 800C159C 44812800 */ mtc1 $at, $f5 -/* 0C21A0 800C15A0 44802000 */ mtc1 $zero, $f4 -/* 0C21A4 800C15A4 46083283 */ div.s $f10, $f6, $f8 -/* 0C21A8 800C15A8 44808000 */ mtc1 $zero, $f16 -/* 0C21AC 800C15AC 460054A1 */ cvt.d.s $f18, $f10 -/* 0C21B0 800C15B0 46322181 */ sub.d $f6, $f4, $f18 -/* 0C21B4 800C15B4 46303202 */ mul.d $f8, $f6, $f16 -/* 0C21B8 800C15B8 462040A0 */ cvt.s.d $f2, $f8 -.L800C15BC: -/* 0C21BC 800C15BC 46021082 */ mul.s $f2, $f2, $f2 -/* 0C21C0 800C15C0 00000000 */ nop -/* 0C21C4 800C15C4 46001006 */ mov.s $f0, $f2 -.L800C15C8: -/* 0C21C8 800C15C8 03E00008 */ jr $ra -/* 0C21CC 800C15CC 25BD0010 */ addiu $sp, $t5, 0x10 diff --git a/asm/non_matchings/audio/external/func_800C15D0.s b/asm/non_matchings/audio/external/func_800C15D0.s deleted file mode 100644 index 35eaac695..000000000 --- a/asm/non_matchings/audio/external/func_800C15D0.s +++ /dev/null @@ -1,75 +0,0 @@ -glabel func_800C15D0 -/* 0C21D0 800C15D0 308E00FF */ andi $t6, $a0, 0xff -/* 0C21D4 800C15D4 30AF00FF */ andi $t7, $a1, 0xff -/* 0C21D8 800C15D8 000F4080 */ sll $t0, $t7, 2 -/* 0C21DC 800C15DC 000EC900 */ sll $t9, $t6, 4 -/* 0C21E0 800C15E0 27ADFFF0 */ addiu $t5, $sp, -0x10 -/* 0C21E4 800C15E4 032EC823 */ subu $t9, $t9, $t6 -/* 0C21E8 800C15E8 010F4023 */ subu $t0, $t0, $t7 -/* 0C21EC 800C15EC 00084100 */ sll $t0, $t0, 4 -/* 0C21F0 800C15F0 0019C980 */ sll $t9, $t9, 6 -/* 0C21F4 800C15F4 3C0A8019 */ lui $t2, %hi(D_80191420) # $t2, 0x8019 -/* 0C21F8 800C15F8 254A1420 */ addiu $t2, %lo(D_80191420) # addiu $t2, $t2, 0x1420 -/* 0C21FC 800C15FC 03284821 */ addu $t1, $t9, $t0 -/* 0C2200 800C1600 ADA40010 */ sw $a0, 0x10($t5) -/* 0C2204 800C1604 ADA50014 */ sw $a1, 0x14($t5) -/* 0C2208 800C1608 ADA60018 */ sw $a2, 0x18($t5) -/* 0C220C 800C160C 012A3821 */ addu $a3, $t1, $t2 -/* 0C2210 800C1610 8CEB0024 */ lw $t3, 0x24($a3) -/* 0C2214 800C1614 30D800FF */ andi $t8, $a2, 0xff -/* 0C2218 800C1618 03003025 */ move $a2, $t8 -/* 0C221C 800C161C 000B6280 */ sll $t4, $t3, 0xa -/* 0C2220 800C1620 00001025 */ move $v0, $zero -/* 0C2224 800C1624 05800014 */ bltz $t4, .L800C1678 -/* 0C2228 800C1628 00001825 */ move $v1, $zero -/* 0C222C 800C162C 3C0143FA */ li $at, 0x43FA0000 # 500.000000 -/* 0C2230 800C1630 44811000 */ mtc1 $at, $f2 -/* 0C2234 800C1634 C4E0001C */ lwc1 $f0, 0x1c($a3) -/* 0C2238 800C1638 2402000A */ li $v0, 10 -/* 0C223C 800C163C 4602003C */ c.lt.s $f0, $f2 -/* 0C2240 800C1640 00000000 */ nop -/* 0C2244 800C1644 4500000C */ bc1f .L800C1678 -/* 0C2248 800C1648 00000000 */ nop -/* 0C224C 800C164C 46020103 */ div.s $f4, $f0, $f2 -/* 0C2250 800C1650 3C014120 */ li $at, 0x41200000 # 10.000000 -/* 0C2254 800C1654 44813000 */ mtc1 $at, $f6 -/* 0C2258 800C1658 00000000 */ nop -/* 0C225C 800C165C 46062202 */ mul.s $f8, $f4, $f6 -/* 0C2260 800C1660 4600428D */ trunc.w.s $f10, $f8 -/* 0C2264 800C1664 44025000 */ mfc1 $v0, $f10 -/* 0C2268 800C1668 00000000 */ nop -/* 0C226C 800C166C 00027E00 */ sll $t7, $v0, 0x18 -/* 0C2270 800C1670 10000001 */ b .L800C1678 -/* 0C2274 800C1674 000F1603 */ sra $v0, $t7, 0x18 -.L800C1678: -/* 0C2278 800C1678 0006C880 */ sll $t9, $a2, 2 -/* 0C227C 800C167C 3C04803B */ lui $a0, %hi(D_803B17D0) # 0x803b -/* 0C2280 800C1680 00992021 */ addu $a0, $a0, $t9 -/* 0C2284 800C1684 8C8417D0 */ lw $a0, %lo(D_803B17D0)($a0) # 0x17d0($a0) -/* 0C2288 800C1688 3C08803B */ lui $t0, %hi(gSequenceChannelNone) # $t0, 0x803b -/* 0C228C 800C168C 25085EF0 */ addiu $t0, %lo(gSequenceChannelNone) # addiu $t0, $t0, 0x5ef0 -/* 0C2290 800C1690 11040002 */ beq $t0, $a0, .L800C169C -/* 0C2294 800C1694 2401FFFF */ li $at, -1 -/* 0C2298 800C1698 8083005E */ lb $v1, 0x5e($a0) -.L800C169C: -/* 0C229C 800C169C 14610002 */ bne $v1, $at, .L800C16A8 -/* 0C22A0 800C16A0 01A0E825 */ move $sp, $t5 -/* 0C22A4 800C16A4 00001825 */ move $v1, $zero -.L800C16A8: -/* 0C22A8 800C16A8 8CE90018 */ lw $t1, 0x18($a3) -/* 0C22AC 800C16AC 3C0E8019 */ lui $t6, %hi(D_8018EF10) # $t6, 0x8019 -/* 0C22B0 800C16B0 81CEEF10 */ lb $t6, %lo(D_8018EF10)($t6) -/* 0C22B4 800C16B4 812A0000 */ lb $t2, ($t1) -/* 0C22B8 800C16B8 25BD0010 */ addiu $sp, $t5, 0x10 -/* 0C22BC 800C16BC 01425821 */ addu $t3, $t2, $v0 -/* 0C22C0 800C16C0 01636021 */ addu $t4, $t3, $v1 -/* 0C22C4 800C16C4 018E2021 */ addu $a0, $t4, $t6 -/* 0C22C8 800C16C8 28810080 */ slti $at, $a0, 0x80 -/* 0C22CC 800C16CC 54200003 */ bnel $at, $zero, .L800C16DC -/* 0C22D0 800C16D0 00041600 */ sll $v0, $a0, 0x18 -/* 0C22D4 800C16D4 2404007F */ li $a0, 127 -/* 0C22D8 800C16D8 00041600 */ sll $v0, $a0, 0x18 -.L800C16DC: -/* 0C22DC 800C16DC 00027E03 */ sra $t7, $v0, 0x18 -/* 0C22E0 800C16E0 03E00008 */ jr $ra -/* 0C22E4 800C16E4 01E01025 */ move $v0, $t7 diff --git a/asm/non_matchings/audio/external/func_800C1934.s b/asm/non_matchings/audio/external/func_800C1934.s deleted file mode 100644 index 276936224..000000000 --- a/asm/non_matchings/audio/external/func_800C1934.s +++ /dev/null @@ -1,42 +0,0 @@ -glabel func_800C1934 -/* 0C2534 800C1934 308E00FF */ andi $t6, $a0, 0xff -/* 0C2538 800C1938 30AF00FF */ andi $t7, $a1, 0xff -/* 0C253C 800C193C 000FC880 */ sll $t9, $t7, 2 -/* 0C2540 800C1940 000EC100 */ sll $t8, $t6, 4 -/* 0C2544 800C1944 030EC023 */ subu $t8, $t8, $t6 -/* 0C2548 800C1948 032FC823 */ subu $t9, $t9, $t7 -/* 0C254C 800C194C 27ADFFF0 */ addiu $t5, $sp, -0x10 -/* 0C2550 800C1950 0019C900 */ sll $t9, $t9, 4 -/* 0C2554 800C1954 0018C180 */ sll $t8, $t8, 6 -/* 0C2558 800C1958 03194021 */ addu $t0, $t8, $t9 -/* 0C255C 800C195C 3C098019 */ lui $t1, %hi(D_80191444) # 0x8019 -/* 0C2560 800C1960 ADA40010 */ sw $a0, 0x10($t5) -/* 0C2564 800C1964 ADA50014 */ sw $a1, 0x14($t5) -/* 0C2568 800C1968 01284821 */ addu $t1, $t1, $t0 -/* 0C256C 800C196C 8D291444 */ lw $t1, %lo(D_80191444)($t1) # 0x1444($t1) -/* 0C2570 800C1970 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 0C2574 800C1974 44810000 */ mtc1 $at, $f0 -/* 0C2578 800C1978 00095200 */ sll $t2, $t1, 8 -/* 0C257C 800C197C 05410010 */ bgez $t2, .L800C19C0 -/* 0C2580 800C1980 46000086 */ mov.s $f2, $f0 -/* 0C2584 800C1984 3C0B803B */ lui $t3, %hi(D_803B7194) # $t3, 0x803b -/* 0C2588 800C1988 8D6B7194 */ lw $t3, %lo(D_803B7194)($t3) -/* 0C258C 800C198C 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 0C2590 800C1990 316C000F */ andi $t4, $t3, 0xf -/* 0C2594 800C1994 448C2000 */ mtc1 $t4, $f4 -/* 0C2598 800C1998 05810004 */ bgez $t4, .L800C19AC -/* 0C259C 800C199C 468021A0 */ cvt.s.w $f6, $f4 -/* 0C25A0 800C19A0 44814000 */ mtc1 $at, $f8 -/* 0C25A4 800C19A4 00000000 */ nop -/* 0C25A8 800C19A8 46083180 */ add.s $f6, $f6, $f8 -.L800C19AC: -/* 0C25AC 800C19AC 3C014340 */ li $at, 0x43400000 # 192.000000 -/* 0C25B0 800C19B0 44815000 */ mtc1 $at, $f10 -/* 0C25B4 800C19B4 00000000 */ nop -/* 0C25B8 800C19B8 460A3403 */ div.s $f16, $f6, $f10 -/* 0C25BC 800C19BC 46100081 */ sub.s $f2, $f0, $f16 -.L800C19C0: -/* 0C25C0 800C19C0 01A0E825 */ move $sp, $t5 -/* 0C25C4 800C19C4 25BD0010 */ addiu $sp, $t5, 0x10 -/* 0C25C8 800C19C8 03E00008 */ jr $ra -/* 0C25CC 800C19CC 46001006 */ mov.s $f0, $f2 diff --git a/asm/non_matchings/audio/external/func_800C19D0.s b/asm/non_matchings/audio/external/func_800C19D0.s index 8d56ee743..07b56dff3 100644 --- a/asm/non_matchings/audio/external/func_800C19D0.s +++ b/asm/non_matchings/audio/external/func_800C19D0.s @@ -32,8 +32,8 @@ glabel L800C1A34 /* 0C2644 800C1A44 01284823 */ subu $t1, $t1, $t0 /* 0C2648 800C1A48 00094900 */ sll $t1, $t1, 4 /* 0C264C 800C1A4C 0019C980 */ sll $t9, $t9, 6 -/* 0C2650 800C1A50 3C0B8019 */ lui $t3, %hi(D_80191420) # $t3, 0x8019 -/* 0C2654 800C1A54 256B1420 */ addiu $t3, %lo(D_80191420) # addiu $t3, $t3, 0x1420 +/* 0C2650 800C1A50 3C0B8019 */ lui $t3, %hi(sSoundBanks) # $t3, 0x8019 +/* 0C2654 800C1A54 256B1420 */ addiu $t3, %lo(sSoundBanks) # addiu $t3, $t3, 0x1420 /* 0C2658 800C1A58 03295021 */ addu $t2, $t9, $t1 /* 0C265C 800C1A5C 014B8021 */ addu $s0, $t2, $t3 /* 0C2660 800C1A60 C60C001C */ lwc1 $f12, 0x1c($s0) diff --git a/asm/non_matchings/audio/external/func_800C1DA4.s b/asm/non_matchings/audio/external/func_800C1DA4.s deleted file mode 100644 index 28d2aa425..000000000 --- a/asm/non_matchings/audio/external/func_800C1DA4.s +++ /dev/null @@ -1,35 +0,0 @@ -glabel func_800C1DA4 -/* 0C29A4 800C1DA4 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 0C29A8 800C1DA8 AFBF002C */ sw $ra, 0x2c($sp) -/* 0C29AC 800C1DAC AFBE0028 */ sw $fp, 0x28($sp) -/* 0C29B0 800C1DB0 AFA5003C */ sw $a1, 0x3c($sp) -/* 0C29B4 800C1DB4 8CCE0000 */ lw $t6, ($a2) -/* 0C29B8 800C1DB8 8CCF0008 */ lw $t7, 8($a2) -/* 0C29BC 800C1DBC C4840000 */ lwc1 $f4, ($a0) -/* 0C29C0 800C1DC0 C4880008 */ lwc1 $f8, 8($a0) -/* 0C29C4 800C1DC4 C5C60000 */ lwc1 $f6, ($t6) -/* 0C29C8 800C1DC8 C5EA0000 */ lwc1 $f10, ($t7) -/* 0C29CC 800C1DCC 00C03825 */ move $a3, $a2 -/* 0C29D0 800C1DD0 46062301 */ sub.s $f12, $f4, $f6 -/* 0C29D4 800C1DD4 94A60002 */ lhu $a2, 2($a1) -/* 0C29D8 800C1DD8 03A0F025 */ move $fp, $sp -/* 0C29DC 800C1DDC 460A4381 */ sub.s $f14, $f8, $f10 -/* 0C29E0 800C1DE0 E7AC0034 */ swc1 $f12, 0x34($sp) -/* 0C29E4 800C1DE4 AFA70040 */ sw $a3, 0x40($sp) -/* 0C29E8 800C1DE8 0C0105B6 */ jal func_800416D8 -/* 0C29EC 800C1DEC E7AE0030 */ swc1 $f14, 0x30($sp) -/* 0C29F0 800C1DF0 8FD90040 */ lw $t9, 0x40($fp) -/* 0C29F4 800C1DF4 C7CC0034 */ lwc1 $f12, 0x34($fp) -/* 0C29F8 800C1DF8 C7CE0030 */ lwc1 $f14, 0x30($fp) -/* 0C29FC 800C1DFC E7200018 */ swc1 $f0, 0x18($t9) -/* 0C2A00 800C1E00 8FC8003C */ lw $t0, 0x3c($fp) -/* 0C2A04 800C1E04 0C0105C9 */ jal func_80041724 -/* 0C2A08 800C1E08 95060002 */ lhu $a2, 2($t0) -/* 0C2A0C 800C1E0C 8FC90040 */ lw $t1, 0x40($fp) -/* 0C2A10 800C1E10 03C0E825 */ move $sp, $fp -/* 0C2A14 800C1E14 E5200020 */ swc1 $f0, 0x20($t1) -/* 0C2A18 800C1E18 8FDF002C */ lw $ra, 0x2c($fp) -/* 0C2A1C 800C1E1C 8FDE0028 */ lw $fp, 0x28($fp) -/* 0C2A20 800C1E20 27BD0038 */ addiu $sp, $sp, 0x38 -/* 0C2A24 800C1E24 03E00008 */ jr $ra -/* 0C2A28 800C1E28 00000000 */ nop diff --git a/asm/non_matchings/audio/external/func_800C4084.s b/asm/non_matchings/audio/external/func_800C4084.s deleted file mode 100644 index 6277f56a1..000000000 --- a/asm/non_matchings/audio/external/func_800C4084.s +++ /dev/null @@ -1,31 +0,0 @@ -glabel func_800C4084 -/* 0C4C84 800C4084 27ADFFF0 */ addiu $t5, $sp, -0x10 -/* 0C4C88 800C4088 ADA40010 */ sw $a0, 0x10($t5) -/* 0C4C8C 800C408C 308EFFFF */ andi $t6, $a0, 0xffff -/* 0C4C90 800C4090 3C058019 */ lui $a1, %hi(D_80192C3C) # $a1, 0x8019 -/* 0C4C94 800C4094 01C02025 */ move $a0, $t6 -/* 0C4C98 800C4098 24A52C3C */ addiu $a1, %lo(D_80192C3C) # addiu $a1, $a1, 0x2c3c -/* 0C4C9C 800C409C 00001025 */ move $v0, $zero -/* 0C4CA0 800C40A0 24060001 */ li $a2, 1 -.L800C40A4: -/* 0C4CA4 800C40A4 308F0001 */ andi $t7, $a0, 1 -/* 0C4CA8 800C40A8 11E00004 */ beqz $t7, .L800C40BC -/* 0C4CAC 800C40AC 00801825 */ move $v1, $a0 -/* 0C4CB0 800C40B0 00A2C021 */ addu $t8, $a1, $v0 -/* 0C4CB4 800C40B4 10000003 */ b .L800C40C4 -/* 0C4CB8 800C40B8 A3060000 */ sb $a2, ($t8) -.L800C40BC: -/* 0C4CBC 800C40BC 00A2C821 */ addu $t9, $a1, $v0 -/* 0C4CC0 800C40C0 A3200000 */ sb $zero, ($t9) -.L800C40C4: -/* 0C4CC4 800C40C4 24420001 */ addiu $v0, $v0, 1 -/* 0C4CC8 800C40C8 304900FF */ andi $t1, $v0, 0xff -/* 0C4CCC 800C40CC 00032043 */ sra $a0, $v1, 1 -/* 0C4CD0 800C40D0 29210006 */ slti $at, $t1, 6 -/* 0C4CD4 800C40D4 3088FFFF */ andi $t0, $a0, 0xffff -/* 0C4CD8 800C40D8 01201025 */ move $v0, $t1 -/* 0C4CDC 800C40DC 1420FFF1 */ bnez $at, .L800C40A4 -/* 0C4CE0 800C40E0 01002025 */ move $a0, $t0 -/* 0C4CE4 800C40E4 01A0E825 */ move $sp, $t5 -/* 0C4CE8 800C40E8 03E00008 */ jr $ra -/* 0C4CEC 800C40EC 25BD0010 */ addiu $sp, $t5, 0x10 diff --git a/asm/non_matchings/audio/external/func_800C41CC.s b/asm/non_matchings/audio/external/func_800C41CC.s index 036f82d28..10b3a9f99 100644 --- a/asm/non_matchings/audio/external/func_800C41CC.s +++ b/asm/non_matchings/audio/external/func_800C41CC.s @@ -1,10 +1,10 @@ glabel func_800C41CC /* 0C4DCC 800C41CC 27ADFFF0 */ addiu $t5, $sp, -0x10 /* 0C4DD0 800C41D0 ADA40010 */ sw $a0, 0x10($t5) -/* 0C4DD4 800C41D4 3C07800F */ lui $a3, %hi(D_800EA1B8) # $a3, 0x800f -/* 0C4DD8 800C41D8 24E7A1B8 */ addiu $a3, %lo(D_800EA1B8) # addiu $a3, $a3, -0x5e48 -/* 0C4DDC 800C41DC 3C02800F */ lui $v0, %hi(D_800EA1BC) # $v0, 0x800f -/* 0C4DE0 800C41E0 9042A1BC */ lbu $v0, %lo(D_800EA1BC)($v0) +/* 0C4DD4 800C41D4 3C07800F */ lui $a3, %hi(sSoundRequestCount) # $a3, 0x800f +/* 0C4DD8 800C41D8 24E7A1B8 */ addiu $a3, %lo(sSoundRequestCount) # addiu $a3, $a3, -0x5e48 +/* 0C4DDC 800C41DC 3C02800F */ lui $v0, %hi(sNumProcessedSoundRequests) # $v0, 0x800f +/* 0C4DE0 800C41E0 9042A1BC */ lbu $v0, %lo(sNumProcessedSoundRequests)($v0) /* 0C4DE4 800C41E4 90EF0000 */ lbu $t7, ($a3) /* 0C4DE8 800C41E8 308E00FF */ andi $t6, $a0, 0xff /* 0C4DEC 800C41EC 00A03025 */ move $a2, $a1 @@ -12,8 +12,8 @@ glabel func_800C41CC /* 0C4DF4 800C41F4 01C02825 */ move $a1, $t6 /* 0C4DF8 800C41F8 3C01800F */ lui $at, %hi(D_800F3648) # $at, 0x800f /* 0C4DFC 800C41FC 3C0B800F */ lui $t3, %hi(D_800EA1C8) # $t3, 0x800f -/* 0C4E00 800C4200 3C098019 */ lui $t1, %hi(D_8018FC20) # $t1, 0x8019 -/* 0C4E04 800C4204 2529FC20 */ addiu $t1, %lo(D_8018FC20) # addiu $t1, $t1, -0x3e0 +/* 0C4E00 800C4200 3C098019 */ lui $t1, %hi(sSoundRequests) # $t1, 0x8019 +/* 0C4E04 800C4204 2529FC20 */ addiu $t1, %lo(sSoundRequests) # addiu $t1, $t1, -0x3e0 /* 0C4E08 800C4208 256BA1C8 */ addiu $t3, %lo(D_800EA1C8) # addiu $t3, $t3, -0x5e38 /* 0C4E0C 800C420C C4203648 */ lwc1 $f0, %lo(D_800F3648)($at) /* 0C4E10 800C4210 240A0018 */ li $t2, 24 diff --git a/asm/non_matchings/audio/external/func_800C4398.s b/asm/non_matchings/audio/external/func_800C4398.s index 8126e5702..15f1b0b89 100644 --- a/asm/non_matchings/audio/external/func_800C4398.s +++ b/asm/non_matchings/audio/external/func_800C4398.s @@ -1,12 +1,12 @@ glabel func_800C4398 -/* 0C4F98 800C4398 3C0E800F */ lui $t6, %hi(D_800EA1BC) # $t6, 0x800f -/* 0C4F9C 800C439C 91CEA1BC */ lbu $t6, %lo(D_800EA1BC)($t6) +/* 0C4F98 800C4398 3C0E800F */ lui $t6, %hi(sNumProcessedSoundRequests) # $t6, 0x800f +/* 0C4F9C 800C439C 91CEA1BC */ lbu $t6, %lo(sNumProcessedSoundRequests)($t6) /* 0C4FA0 800C43A0 27BDFFB0 */ addiu $sp, $sp, -0x50 -/* 0C4FA4 800C43A4 3C188019 */ lui $t8, %hi(D_8018FC20) # $t8, 0x8019 +/* 0C4FA4 800C43A4 3C188019 */ lui $t8, %hi(sSoundRequests) # $t8, 0x8019 /* 0C4FA8 800C43A8 000E7880 */ sll $t7, $t6, 2 /* 0C4FAC 800C43AC 01EE7823 */ subu $t7, $t7, $t6 /* 0C4FB0 800C43B0 000F78C0 */ sll $t7, $t7, 3 -/* 0C4FB4 800C43B4 2718FC20 */ addiu $t8, %lo(D_8018FC20) # addiu $t8, $t8, -0x3e0 +/* 0C4FB4 800C43B4 2718FC20 */ addiu $t8, %lo(sSoundRequests) # addiu $t8, $t8, -0x3e0 /* 0C4FB8 800C43B8 AFBF002C */ sw $ra, 0x2c($sp) /* 0C4FBC 800C43BC AFBE0028 */ sw $fp, 0x28($sp) /* 0C4FC0 800C43C0 AFB00024 */ sw $s0, 0x24($sp) @@ -21,8 +21,8 @@ glabel func_800C4398 /* 0C4FE4 800C43E4 332E00FF */ andi $t6, $t9, 0xff /* 0C4FE8 800C43E8 000E7900 */ sll $t7, $t6, 4 /* 0C4FEC 800C43EC 01EE7823 */ subu $t7, $t7, $t6 -/* 0C4FF0 800C43F0 3C188019 */ lui $t8, %hi(D_80191420) # $t8, 0x8019 -/* 0C4FF4 800C43F4 27181420 */ addiu $t8, %lo(D_80191420) # addiu $t8, $t8, 0x1420 +/* 0C4FF0 800C43F0 3C188019 */ lui $t8, %hi(sSoundBanks) # $t8, 0x8019 +/* 0C4FF4 800C43F4 27181420 */ addiu $t8, %lo(sSoundBanks) # addiu $t8, $t8, 0x1420 /* 0C4FF8 800C43F8 000F7980 */ sll $t7, $t7, 6 /* 0C4FFC 800C43FC 01F8C821 */ addu $t9, $t7, $t8 /* 0C5000 800C4400 9323002B */ lbu $v1, 0x2b($t9) @@ -160,16 +160,16 @@ glabel func_800C4398 /* 0C51E8 800C45E8 AFCB003C */ sw $t3, 0x3c($fp) /* 0C51EC 800C45EC A3CA0043 */ sb $t2, 0x43($fp) .L800C45F0: -/* 0C51F0 800C45F0 3C0E8019 */ lui $t6, %hi(D_80192AA8) # $t6, 0x8019 -/* 0C51F4 800C45F4 25CE2AA8 */ addiu $t6, %lo(D_80192AA8) # addiu $t6, $t6, 0x2aa8 +/* 0C51F0 800C45F0 3C0E8019 */ lui $t6, %hi(sSoundBankFreeListFront) # $t6, 0x8019 +/* 0C51F4 800C45F4 25CE2AA8 */ addiu $t6, %lo(sSoundBankFreeListFront) # addiu $t6, $t6, 0x2aa8 /* 0C51F8 800C45F8 01AE3821 */ addu $a3, $t5, $t6 /* 0C51FC 800C45FC 90E50000 */ lbu $a1, ($a3) /* 0C5200 800C4600 240C0030 */ li $t4, 48 /* 0C5204 800C4604 000D7900 */ sll $t7, $t5, 4 /* 0C5208 800C4608 00AC0019 */ multu $a1, $t4 /* 0C520C 800C460C 01ED7823 */ subu $t7, $t7, $t5 -/* 0C5210 800C4610 3C198019 */ lui $t9, %hi(D_80191420) # $t9, 0x8019 -/* 0C5214 800C4614 27391420 */ addiu $t9, %lo(D_80191420) # addiu $t9, $t9, 0x1420 +/* 0C5210 800C4610 3C198019 */ lui $t9, %hi(sSoundBanks) # $t9, 0x8019 +/* 0C5214 800C4614 27391420 */ addiu $t9, %lo(sSoundBanks) # addiu $t9, $t9, 0x1420 /* 0C5218 800C4618 000F7980 */ sll $t7, $t7, 6 /* 0C521C 800C461C 01F94821 */ addu $t1, $t7, $t9 /* 0C5220 800C4620 0000C012 */ mflo $t8 @@ -206,8 +206,8 @@ glabel func_800C4398 /* 0C529C 800C469C 240E0002 */ li $t6, 2 /* 0C52A0 800C46A0 A20E0029 */ sb $t6, 0x29($s0) /* 0C52A4 800C46A4 03017824 */ and $t7, $t8, $at -/* 0C52A8 800C46A8 3C188019 */ lui $t8, %hi(D_80192AA0) # $t8, 0x8019 -/* 0C52AC 800C46AC 27182AA0 */ addiu $t8, %lo(D_80192AA0) # addiu $t8, $t8, 0x2aa0 +/* 0C52A8 800C46A8 3C188019 */ lui $t8, %hi(sSoundBankUsedListBack) # $t8, 0x8019 +/* 0C52AC 800C46AC 27182AA0 */ addiu $t8, %lo(sSoundBankUsedListBack) # addiu $t8, $t8, 0x2aa0 /* 0C52B0 800C46B0 01B81021 */ addu $v0, $t5, $t8 /* 0C52B4 800C46B4 90440000 */ lbu $a0, ($v0) /* 0C52B8 800C46B8 000FCE02 */ srl $t9, $t7, 0x18 diff --git a/asm/non_matchings/audio/external/func_800C473C.s b/asm/non_matchings/audio/external/func_800C473C.s index 2e5ca1624..e13c6cfe3 100644 --- a/asm/non_matchings/audio/external/func_800C473C.s +++ b/asm/non_matchings/audio/external/func_800C473C.s @@ -5,8 +5,8 @@ glabel func_800C473C /* 0C5348 800C4748 308700FF */ andi $a3, $a0, 0xff /* 0C534C 800C474C 00077900 */ sll $t7, $a3, 4 /* 0C5350 800C4750 01E77823 */ subu $t7, $t7, $a3 -/* 0C5354 800C4754 3C188019 */ lui $t8, %hi(D_80191420) # $t8, 0x8019 -/* 0C5358 800C4758 27181420 */ addiu $t8, %lo(D_80191420) # addiu $t8, $t8, 0x1420 +/* 0C5354 800C4754 3C188019 */ lui $t8, %hi(sSoundBanks) # $t8, 0x8019 +/* 0C5358 800C4758 27181420 */ addiu $t8, %lo(sSoundBanks) # addiu $t8, $t8, 0x1420 /* 0C535C 800C475C 000F7980 */ sll $t7, $t7, 6 /* 0C5360 800C4760 01F83021 */ addu $a2, $t7, $t8 /* 0C5364 800C4764 27BDFFC0 */ addiu $sp, $sp, -0x40 @@ -43,8 +43,8 @@ glabel func_800C473C /* 0C53DC 800C47DC 93C70043 */ lbu $a3, 0x43($fp) /* 0C53E0 800C47E0 24080030 */ li $t0, 48 .L800C47E4: -/* 0C53E4 800C47E4 3C0E8019 */ lui $t6, %hi(D_80192AA0) # $t6, 0x8019 -/* 0C53E8 800C47E8 25CE2AA0 */ addiu $t6, %lo(D_80192AA0) # addiu $t6, $t6, 0x2aa0 +/* 0C53E4 800C47E4 3C0E8019 */ lui $t6, %hi(sSoundBankUsedListBack) # $t6, 0x8019 +/* 0C53E8 800C47E8 25CE2AA0 */ addiu $t6, %lo(sSoundBankUsedListBack) # addiu $t6, $t6, 0x2aa0 /* 0C53EC 800C47EC 00EE1821 */ addu $v1, $a3, $t6 /* 0C53F0 800C47F0 906F0000 */ lbu $t7, ($v1) /* 0C53F4 800C47F4 54AF0005 */ bnel $a1, $t7, .L800C480C @@ -62,9 +62,9 @@ glabel func_800C473C .L800C4820: /* 0C5420 800C4820 904D002A */ lbu $t5, 0x2a($v0) /* 0C5424 800C4824 904C002B */ lbu $t4, 0x2b($v0) -/* 0C5428 800C4828 3C188019 */ lui $t8, %hi(D_80192AA8) # $t8, 0x8019 +/* 0C5428 800C4828 3C188019 */ lui $t8, %hi(sSoundBankFreeListFront) # $t8, 0x8019 /* 0C542C 800C482C 01A80019 */ multu $t5, $t0 -/* 0C5430 800C4830 27182AA8 */ addiu $t8, %lo(D_80192AA8) # addiu $t8, $t8, 0x2aa8 +/* 0C5430 800C4830 27182AA8 */ addiu $t8, %lo(sSoundBankFreeListFront) # addiu $t8, $t8, 0x2aa8 /* 0C5434 800C4834 00F81821 */ addu $v1, $a3, $t8 /* 0C5438 800C4838 240A00FF */ li $t2, 255 /* 0C543C 800C483C 00007012 */ mflo $t6 diff --git a/asm/non_matchings/audio/external/func_800C4888.s b/asm/non_matchings/audio/external/func_800C4888.s index 66d1c8fbb..5247e4913 100644 --- a/asm/non_matchings/audio/external/func_800C4888.s +++ b/asm/non_matchings/audio/external/func_800C4888.s @@ -30,9 +30,9 @@ glabel func_800C4888 /* 0C54F4 800C48F4 1420FFF8 */ bnez $at, .L800C48D8 /* 0C54F8 800C48F8 A0F40004 */ sb $s4, 4($a3) /* 0C54FC 800C48FC 0015C100 */ sll $t8, $s5, 4 -/* 0C5500 800C4900 3C1F8019 */ lui $ra, %hi(D_80191420) # $ra, 0x8019 +/* 0C5500 800C4900 3C1F8019 */ lui $ra, %hi(sSoundBanks) # $ra, 0x8019 /* 0C5504 800C4904 0315C023 */ subu $t8, $t8, $s5 -/* 0C5508 800C4908 27FF1420 */ addiu $ra, %lo(D_80191420) # addiu $ra, $ra, 0x1420 +/* 0C5508 800C4908 27FF1420 */ addiu $ra, %lo(sSoundBanks) # addiu $ra, $ra, 0x1420 /* 0C550C 800C490C 0018C180 */ sll $t8, $t8, 6 /* 0C5510 800C4910 03F8C821 */ addu $t9, $ra, $t8 /* 0C5514 800C4914 9333002B */ lbu $s3, 0x2b($t9) @@ -69,8 +69,8 @@ glabel func_800C4888 /* 0C5588 800C4988 91580028 */ lbu $t8, 0x28($t2) /* 0C558C 800C498C 0C0311CF */ jal func_800C473C /* 0C5590 800C4990 326500FF */ andi $a1, $s3, 0xff -/* 0C5594 800C4994 3C1F8019 */ lui $ra, %hi(D_80191420) # $ra, 0x8019 -/* 0C5598 800C4998 27FF1420 */ addiu $ra, %lo(D_80191420) # addiu $ra, $ra, 0x1420 +/* 0C5594 800C4994 3C1F8019 */ lui $ra, %hi(sSoundBanks) # $ra, 0x8019 +/* 0C5598 800C4998 27FF1420 */ addiu $ra, %lo(sSoundBanks) # addiu $ra, $ra, 0x1420 /* 0C559C 800C499C 240D0001 */ li $t5, 1 /* 0C55A0 800C49A0 100000D0 */ b .L800C4CE4 /* 0C55A4 800C49A4 3C020800 */ lui $v0, 0x800 @@ -223,8 +223,8 @@ glabel func_800C4888 /* 0C57C4 800C4BC4 0C032EFA */ jal func_800CBBE8 /* 0C57C8 800C4BC8 03012025 */ or $a0, $t8, $at /* 0C57CC 800C4BCC 8FCA0068 */ lw $t2, 0x68($fp) -/* 0C57D0 800C4BD0 3C1F8019 */ lui $ra, %hi(D_80191420) # $ra, 0x8019 -/* 0C57D4 800C4BD4 27FF1420 */ addiu $ra, %lo(D_80191420) # addiu $ra, $ra, 0x1420 +/* 0C57D0 800C4BD0 3C1F8019 */ lui $ra, %hi(sSoundBanks) # $ra, 0x8019 +/* 0C57D4 800C4BD4 27FF1420 */ addiu $ra, %lo(sSoundBanks) # addiu $ra, $ra, 0x1420 /* 0C57D8 800C4BD8 8D4F0024 */ lw $t7, 0x24($t2) /* 0C57DC 800C4BDC 240D0001 */ li $t5, 1 /* 0C57E0 800C4BE0 32A400FF */ andi $a0, $s5, 0xff @@ -233,8 +233,8 @@ glabel func_800C4888 /* 0C57EC 800C4BEC 327000FF */ andi $s0, $s3, 0xff /* 0C57F0 800C4BF0 0C0311CF */ jal func_800C473C /* 0C57F4 800C4BF4 326500FF */ andi $a1, $s3, 0xff -/* 0C57F8 800C4BF8 3C1F8019 */ lui $ra, %hi(D_80191420) # $ra, 0x8019 -/* 0C57FC 800C4BFC 27FF1420 */ addiu $ra, %lo(D_80191420) # addiu $ra, $ra, 0x1420 +/* 0C57F8 800C4BF8 3C1F8019 */ lui $ra, %hi(sSoundBanks) # $ra, 0x8019 +/* 0C57FC 800C4BFC 27FF1420 */ addiu $ra, %lo(sSoundBanks) # addiu $ra, $ra, 0x1420 /* 0C5800 800C4C00 240D0001 */ li $t5, 1 /* 0C5804 800C4C04 10000035 */ b .L800C4CDC /* 0C5808 800C4C08 321300FF */ andi $s3, $s0, 0xff @@ -396,8 +396,8 @@ glabel func_800C4888 /* 0C5A34 800C4E34 A3C900CE */ sb $t1, 0xce($fp) /* 0C5A38 800C4E38 0C0311CF */ jal func_800C473C /* 0C5A3C 800C4E3C A3CB00CC */ sb $t3, 0xcc($fp) -/* 0C5A40 800C4E40 3C1F8019 */ lui $ra, %hi(D_80191420) # $ra, 0x8019 -/* 0C5A44 800C4E44 27FF1420 */ addiu $ra, %lo(D_80191420) # addiu $ra, $ra, 0x1420 +/* 0C5A40 800C4E40 3C1F8019 */ lui $ra, %hi(sSoundBanks) # $ra, 0x8019 +/* 0C5A44 800C4E44 27FF1420 */ addiu $ra, %lo(sSoundBanks) # addiu $ra, $ra, 0x1420 /* 0C5A48 800C4E48 8FC60070 */ lw $a2, 0x70($fp) /* 0C5A4C 800C4E4C 8FC80060 */ lw $t0, 0x60($fp) /* 0C5A50 800C4E50 93C900CE */ lbu $t1, 0xce($fp) diff --git a/asm/non_matchings/audio/external/func_800C4FE4.s b/asm/non_matchings/audio/external/func_800C4FE4.s index 4eeae41b0..5909f4c70 100644 --- a/asm/non_matchings/audio/external/func_800C4FE4.s +++ b/asm/non_matchings/audio/external/func_800C4FE4.s @@ -50,9 +50,9 @@ glabel func_800C4FE4 /* 0C5CA0 800C50A0 01F17823 */ subu $t7, $t7, $s1 /* 0C5CA4 800C50A4 000F7900 */ sll $t7, $t7, 4 /* 0C5CA8 800C50A8 000E7180 */ sll $t6, $t6, 6 -/* 0C5CAC 800C50AC 3C198019 */ lui $t9, %hi(D_80191420) # $t9, 0x8019 +/* 0C5CAC 800C50AC 3C198019 */ lui $t9, %hi(sSoundBanks) # $t9, 0x8019 /* 0C5CB0 800C50B0 92460000 */ lbu $a2, ($s2) -/* 0C5CB4 800C50B4 27391420 */ addiu $t9, %lo(D_80191420) # addiu $t9, $t9, 0x1420 +/* 0C5CB4 800C50B4 27391420 */ addiu $t9, %lo(sSoundBanks) # addiu $t9, $t9, 0x1420 /* 0C5CB8 800C50B8 01CFC021 */ addu $t8, $t6, $t7 /* 0C5CBC 800C50BC 03198021 */ addu $s0, $t8, $t9 /* 0C5CC0 800C50C0 92020028 */ lbu $v0, 0x28($s0) diff --git a/asm/non_matchings/audio/external/func_800C5278.s b/asm/non_matchings/audio/external/func_800C5278.s index 4ee95a51c..7560b8789 100644 --- a/asm/non_matchings/audio/external/func_800C5278.s +++ b/asm/non_matchings/audio/external/func_800C5278.s @@ -4,9 +4,9 @@ glabel func_800C5278 /* 0C5E80 800C5280 309700FF */ andi $s7, $a0, 0xff /* 0C5E84 800C5284 00177100 */ sll $t6, $s7, 4 /* 0C5E88 800C5288 01D77023 */ subu $t6, $t6, $s7 -/* 0C5E8C 800C528C 3C0F8019 */ lui $t7, %hi(D_80191420) # $t7, 0x8019 +/* 0C5E8C 800C528C 3C0F8019 */ lui $t7, %hi(sSoundBanks) # $t7, 0x8019 /* 0C5E90 800C5290 AFB20030 */ sw $s2, 0x30($sp) -/* 0C5E94 800C5294 25EF1420 */ addiu $t7, %lo(D_80191420) # addiu $t7, $t7, 0x1420 +/* 0C5E94 800C5294 25EF1420 */ addiu $t7, %lo(sSoundBanks) # addiu $t7, $t7, 0x1420 /* 0C5E98 800C5298 000E7180 */ sll $t6, $t6, 6 /* 0C5E9C 800C529C AFB1002C */ sw $s1, 0x2c($sp) /* 0C5EA0 800C52A0 01CF9021 */ addu $s2, $t6, $t7 diff --git a/asm/non_matchings/audio/external/func_800C5384.s b/asm/non_matchings/audio/external/func_800C5384.s index 382cd18a1..4cc421c4f 100644 --- a/asm/non_matchings/audio/external/func_800C5384.s +++ b/asm/non_matchings/audio/external/func_800C5384.s @@ -4,8 +4,8 @@ glabel func_800C5384 /* 0C5F8C 800C538C 309500FF */ andi $s5, $a0, 0xff /* 0C5F90 800C5390 00157100 */ sll $t6, $s5, 4 /* 0C5F94 800C5394 01D57023 */ subu $t6, $t6, $s5 -/* 0C5F98 800C5398 3C0F8019 */ lui $t7, %hi(D_80191420) # $t7, 0x8019 -/* 0C5F9C 800C539C 25EF1420 */ addiu $t7, %lo(D_80191420) # addiu $t7, $t7, 0x1420 +/* 0C5F98 800C5398 3C0F8019 */ lui $t7, %hi(sSoundBanks) # $t7, 0x8019 +/* 0C5F9C 800C539C 25EF1420 */ addiu $t7, %lo(sSoundBanks) # addiu $t7, $t7, 0x1420 /* 0C5FA0 800C53A0 000E7180 */ sll $t6, $t6, 6 /* 0C5FA4 800C53A4 AFBF004C */ sw $ra, 0x4c($sp) /* 0C5FA8 800C53A8 AFBE0048 */ sw $fp, 0x48($sp) diff --git a/asm/non_matchings/audio/external/func_800C5578.s b/asm/non_matchings/audio/external/func_800C5578.s index 3415a30e7..7f142457d 100644 --- a/asm/non_matchings/audio/external/func_800C5578.s +++ b/asm/non_matchings/audio/external/func_800C5578.s @@ -6,8 +6,8 @@ glabel func_800C5578 /* 0C6188 800C5588 31F800FF */ andi $t8, $t7, 0xff /* 0C618C 800C558C 0018C900 */ sll $t9, $t8, 4 /* 0C6190 800C5590 0338C823 */ subu $t9, $t9, $t8 -/* 0C6194 800C5594 3C088019 */ lui $t0, %hi(D_80191420) # $t0, 0x8019 -/* 0C6198 800C5598 25081420 */ addiu $t0, %lo(D_80191420) # addiu $t0, $t0, 0x1420 +/* 0C6194 800C5594 3C088019 */ lui $t0, %hi(sSoundBanks) # $t0, 0x8019 +/* 0C6198 800C5598 25081420 */ addiu $t0, %lo(sSoundBanks) # addiu $t0, $t0, 0x1420 /* 0C619C 800C559C 0019C980 */ sll $t9, $t9, 6 /* 0C61A0 800C55A0 AFBF004C */ sw $ra, 0x4c($sp) /* 0C61A4 800C55A4 AFBE0048 */ sw $fp, 0x48($sp) diff --git a/asm/non_matchings/audio/external/func_800C56F0.s b/asm/non_matchings/audio/external/func_800C56F0.s index 4d1677726..f75cf216d 100644 --- a/asm/non_matchings/audio/external/func_800C56F0.s +++ b/asm/non_matchings/audio/external/func_800C56F0.s @@ -6,8 +6,8 @@ glabel func_800C56F0 /* 0C6300 800C5700 31F800FF */ andi $t8, $t7, 0xff /* 0C6304 800C5704 0018C900 */ sll $t9, $t8, 4 /* 0C6308 800C5708 0338C823 */ subu $t9, $t9, $t8 -/* 0C630C 800C570C 3C088019 */ lui $t0, %hi(D_80191420) # $t0, 0x8019 -/* 0C6310 800C5710 25081420 */ addiu $t0, %lo(D_80191420) # addiu $t0, $t0, 0x1420 +/* 0C630C 800C570C 3C088019 */ lui $t0, %hi(sSoundBanks) # $t0, 0x8019 +/* 0C6310 800C5710 25081420 */ addiu $t0, %lo(sSoundBanks) # addiu $t0, $t0, 0x1420 /* 0C6314 800C5714 0019C980 */ sll $t9, $t9, 6 /* 0C6318 800C5718 AFBF004C */ sw $ra, 0x4c($sp) /* 0C631C 800C571C AFBE0048 */ sw $fp, 0x48($sp) diff --git a/asm/non_matchings/audio/external/func_800C5848.s b/asm/non_matchings/audio/external/func_800C5848.s deleted file mode 100644 index a95a674f3..000000000 --- a/asm/non_matchings/audio/external/func_800C5848.s +++ /dev/null @@ -1,31 +0,0 @@ -glabel func_800C5848 -/* 0C6448 800C5848 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 0C644C 800C584C AFB1002C */ sw $s1, 0x2c($sp) -/* 0C6450 800C5850 AFB00028 */ sw $s0, 0x28($sp) -/* 0C6454 800C5854 3C10800F */ lui $s0, %hi(D_800EA1BC) # $s0, 0x800f -/* 0C6458 800C5858 3C11800F */ lui $s1, %hi(D_800EA1B8) # $s1, 0x800f -/* 0C645C 800C585C 2631A1B8 */ addiu $s1, %lo(D_800EA1B8) # addiu $s1, $s1, -0x5e48 -/* 0C6460 800C5860 2610A1BC */ addiu $s0, %lo(D_800EA1BC) # addiu $s0, $s0, -0x5e44 -/* 0C6464 800C5864 920E0000 */ lbu $t6, ($s0) -/* 0C6468 800C5868 922F0000 */ lbu $t7, ($s1) -/* 0C646C 800C586C AFBE0030 */ sw $fp, 0x30($sp) -/* 0C6470 800C5870 03A0F025 */ move $fp, $sp -/* 0C6474 800C5874 11CF0009 */ beq $t6, $t7, .L800C589C -/* 0C6478 800C5878 AFBF0034 */ sw $ra, 0x34($sp) -.L800C587C: -/* 0C647C 800C587C 0C0310E6 */ jal func_800C4398 -/* 0C6480 800C5880 00000000 */ nop -/* 0C6484 800C5884 92180000 */ lbu $t8, ($s0) -/* 0C6488 800C5888 92290000 */ lbu $t1, ($s1) -/* 0C648C 800C588C 27190001 */ addiu $t9, $t8, 1 -/* 0C6490 800C5890 332800FF */ andi $t0, $t9, 0xff -/* 0C6494 800C5894 1509FFF9 */ bne $t0, $t1, .L800C587C -/* 0C6498 800C5898 A2190000 */ sb $t9, ($s0) -.L800C589C: -/* 0C649C 800C589C 8FDF0034 */ lw $ra, 0x34($fp) -/* 0C64A0 800C58A0 03C0E825 */ move $sp, $fp -/* 0C64A4 800C58A4 8FD00028 */ lw $s0, 0x28($fp) -/* 0C64A8 800C58A8 8FD1002C */ lw $s1, 0x2c($fp) -/* 0C64AC 800C58AC 8FDE0030 */ lw $fp, 0x30($fp) -/* 0C64B0 800C58B0 03E00008 */ jr $ra -/* 0C64B4 800C58B4 27BD0038 */ addiu $sp, $sp, 0x38 diff --git a/asm/non_matchings/audio/external/func_800C5A3C.s b/asm/non_matchings/audio/external/func_800C5A3C.s index cc329a97e..8f82aaf8f 100644 --- a/asm/non_matchings/audio/external/func_800C5A3C.s +++ b/asm/non_matchings/audio/external/func_800C5A3C.s @@ -1,22 +1,22 @@ glabel func_800C5A3C -/* 0C663C 800C5A3C 3C01800F */ lui $at, %hi(D_800EA1B8) # $at, 0x800f -/* 0C6640 800C5A40 A020A1B8 */ sb $zero, %lo(D_800EA1B8)($at) -/* 0C6644 800C5A44 3C01800F */ lui $at, %hi(D_800EA1BC) # $at, 0x800f -/* 0C6648 800C5A48 A020A1BC */ sb $zero, %lo(D_800EA1BC)($at) +/* 0C663C 800C5A3C 3C01800F */ lui $at, %hi(sSoundRequestCount) # $at, 0x800f +/* 0C6640 800C5A40 A020A1B8 */ sb $zero, %lo(sSoundRequestCount)($at) +/* 0C6644 800C5A44 3C01800F */ lui $at, %hi(sNumProcessedSoundRequests) # $at, 0x800f +/* 0C6648 800C5A48 A020A1BC */ sb $zero, %lo(sNumProcessedSoundRequests)($at) /* 0C664C 800C5A4C 3C01800F */ lui $at, %hi(D_800EA1C4) # $at, 0x800f /* 0C6650 800C5A50 A420A1C4 */ sh $zero, %lo(D_800EA1C4)($at) /* 0C6654 800C5A54 3C013F80 */ li $at, 0x3F800000 # 1.000000 /* 0C6658 800C5A58 3C098019 */ lui $t1, %hi(D_80192C48) # $t1, 0x8019 -/* 0C665C 800C5A5C 3C088019 */ lui $t0, %hi(D_80192C3C) # $t0, 0x8019 -/* 0C6660 800C5A60 3C078019 */ lui $a3, %hi(D_80192AB0) # $a3, 0x8019 -/* 0C6664 800C5A64 3C058019 */ lui $a1, %hi(D_80192AA8) # $a1, 0x8019 -/* 0C6668 800C5A68 3C048019 */ lui $a0, %hi(D_80192AA0) # $a0, 0x8019 +/* 0C665C 800C5A5C 3C088019 */ lui $t0, %hi(sSoundBankDisabled) # $t0, 0x8019 +/* 0C6660 800C5A60 3C078019 */ lui $a3, %hi(sNumSoundsInBank) # $a3, 0x8019 +/* 0C6664 800C5A64 3C058019 */ lui $a1, %hi(sSoundBankFreeListFront) # $a1, 0x8019 +/* 0C6668 800C5A68 3C048019 */ lui $a0, %hi(sSoundBankUsedListBack) # $a0, 0x8019 /* 0C666C 800C5A6C 44810000 */ mtc1 $at, $f0 /* 0C6670 800C5A70 27ADFFF0 */ addiu $t5, $sp, -0x10 -/* 0C6674 800C5A74 24842AA0 */ addiu $a0, %lo(D_80192AA0) # addiu $a0, $a0, 0x2aa0 -/* 0C6678 800C5A78 24A52AA8 */ addiu $a1, %lo(D_80192AA8) # addiu $a1, $a1, 0x2aa8 -/* 0C667C 800C5A7C 24E72AB0 */ addiu $a3, %lo(D_80192AB0) # addiu $a3, $a3, 0x2ab0 -/* 0C6680 800C5A80 25082C3C */ addiu $t0, %lo(D_80192C3C) # addiu $t0, $t0, 0x2c3c +/* 0C6674 800C5A74 24842AA0 */ addiu $a0, %lo(sSoundBankUsedListBack) # addiu $a0, $a0, 0x2aa0 +/* 0C6678 800C5A78 24A52AA8 */ addiu $a1, %lo(sSoundBankFreeListFront) # addiu $a1, $a1, 0x2aa8 +/* 0C667C 800C5A7C 24E72AB0 */ addiu $a3, %lo(sNumSoundsInBank) # addiu $a3, $a3, 0x2ab0 +/* 0C6680 800C5A80 25082C3C */ addiu $t0, %lo(sSoundBankDisabled) # addiu $t0, $t0, 0x2c3c /* 0C6684 800C5A84 25292C48 */ addiu $t1, %lo(D_80192C48) # addiu $t1, $t1, 0x2c48 /* 0C6688 800C5A88 00001025 */ move $v0, $zero /* 0C668C 800C5A8C 24060001 */ li $a2, 1 @@ -60,8 +60,8 @@ glabel func_800C5A3C /* 0C6718 800C5B18 29810006 */ slti $at, $t4, 6 /* 0C671C 800C5B1C 1420FFEF */ bnez $at, .L800C5ADC /* 0C6720 800C5B20 01801025 */ move $v0, $t4 -/* 0C6724 800C5B24 3C088019 */ lui $t0, %hi(D_80191420) # $t0, 0x8019 -/* 0C6728 800C5B28 25081420 */ addiu $t0, %lo(D_80191420) # addiu $t0, $t0, 0x1420 +/* 0C6724 800C5B24 3C088019 */ lui $t0, %hi(sSoundBanks) # $t0, 0x8019 +/* 0C6728 800C5B28 25081420 */ addiu $t0, %lo(sSoundBanks) # addiu $t0, $t0, 0x1420 /* 0C672C 800C5B2C 00001025 */ move $v0, $zero /* 0C6730 800C5B30 240A0030 */ li $t2, 48 /* 0C6734 800C5B34 240903C0 */ li $t1, 960 diff --git a/asm/non_matchings/audio/external/func_800C86D8.s b/asm/non_matchings/audio/external/func_800C86D8.s deleted file mode 100644 index 12165e53b..000000000 --- a/asm/non_matchings/audio/external/func_800C86D8.s +++ /dev/null @@ -1,41 +0,0 @@ -glabel func_800C86D8 -/* 0C92D8 800C86D8 308E00FF */ andi $t6, $a0, 0xff -/* 0C92DC 800C86DC 000E78C0 */ sll $t7, $t6, 3 -/* 0C92E0 800C86E0 01EE7823 */ subu $t7, $t7, $t6 -/* 0C92E4 800C86E4 000F7900 */ sll $t7, $t7, 4 -/* 0C92E8 800C86E8 01EE7823 */ subu $t7, $t7, $t6 -/* 0C92EC 800C86EC 000F7880 */ sll $t7, $t7, 2 -/* 0C92F0 800C86F0 01EE7823 */ subu $t7, $t7, $t6 -/* 0C92F4 800C86F4 3C18800F */ lui $t8, %hi(gPlayers) # $t8, 0x800f -/* 0C92F8 800C86F8 27186990 */ addiu $t8, %lo(gPlayers) # addiu $t8, $t8, 0x6990 -/* 0C92FC 800C86FC 000F78C0 */ sll $t7, $t7, 3 -/* 0C9300 800C8700 01F81021 */ addu $v0, $t7, $t8 -/* 0C9304 800C8704 8C5900BC */ lw $t9, 0xbc($v0) -/* 0C9308 800C8708 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 0C930C 800C870C 3C034000 */ lui $v1, 0x4000 -/* 0C9310 800C8710 AFBE0028 */ sw $fp, 0x28($sp) -/* 0C9314 800C8714 AFA40030 */ sw $a0, 0x30($sp) -/* 0C9318 800C8718 03234024 */ and $t0, $t9, $v1 -/* 0C931C 800C871C 01C02025 */ move $a0, $t6 -/* 0C9320 800C8720 03A0F025 */ move $fp, $sp -/* 0C9324 800C8724 1068000D */ beq $v1, $t0, .L800C875C -/* 0C9328 800C8728 AFBF002C */ sw $ra, 0x2c($sp) -/* 0C932C 800C872C 3C09800F */ lui $t1, %hi(D_800E9F24) -/* 0C9330 800C8730 012E4821 */ addu $t1, $t1, $t6 -/* 0C9334 800C8734 91299F24 */ lbu $t1, %lo(D_800E9F24)($t1) -/* 0C9338 800C8738 24010001 */ li $at, 1 -/* 0C933C 800C873C 55210008 */ bnel $t1, $at, .L800C8760 -/* 0C9340 800C8740 8FDF002C */ lw $ra, 0x2c($fp) -/* 0C9344 800C8744 94450254 */ lhu $a1, 0x254($v0) -/* 0C9348 800C8748 3C012900 */ lui $at, (0x29008008 >> 16) # lui $at, 0x2900 -/* 0C934C 800C874C 34218008 */ ori $at, (0x29008008 & 0xFFFF) # ori $at, $at, 0x8008 -/* 0C9350 800C8750 00055100 */ sll $t2, $a1, 4 -/* 0C9354 800C8754 0C03243D */ jal func_800C90F4 -/* 0C9358 800C8758 01412821 */ addu $a1, $t2, $at -.L800C875C: -/* 0C935C 800C875C 8FDF002C */ lw $ra, 0x2c($fp) -.L800C8760: -/* 0C9360 800C8760 03C0E825 */ move $sp, $fp -/* 0C9364 800C8764 8FDE0028 */ lw $fp, 0x28($fp) -/* 0C9368 800C8768 03E00008 */ jr $ra -/* 0C936C 800C876C 27BD0030 */ addiu $sp, $sp, 0x30 diff --git a/asm/non_matchings/audio/external/func_800C9250.s b/asm/non_matchings/audio/external/func_800C9250.s index b4726ac3c..037791edb 100644 --- a/asm/non_matchings/audio/external/func_800C9250.s +++ b/asm/non_matchings/audio/external/func_800C9250.s @@ -9,8 +9,8 @@ glabel func_800C9250 /* 0C9E6C 800C926C 000F78C0 */ sll $t7, $t7, 3 /* 0C9E70 800C9270 3C18800F */ lui $t8, %hi(gPlayers+0x254) /* 0C9E74 800C9274 030FC021 */ addu $t8, $t8, $t7 -/* 0C9E78 800C9278 3C08803B */ lui $t0, %hi(D_803B7194) # $t0, 0x803b -/* 0C9E7C 800C927C 8D087194 */ lw $t0, %lo(D_803B7194)($t0) +/* 0C9E78 800C9278 3C08803B */ lui $t0, %hi(gAudioRandom) # $t0, 0x803b +/* 0C9E7C 800C927C 8D087194 */ lw $t0, %lo(gAudioRandom)($t0) /* 0C9E80 800C9280 97186BE4 */ lhu $t8, %lo(gPlayers+0x254)($t8) /* 0C9E84 800C9284 27BDFFD0 */ addiu $sp, $sp, -0x30 /* 0C9E88 800C9288 3C012900 */ lui $at, (0x29008001 >> 16) # lui $at, 0x2900 diff --git a/asm/non_matchings/audio/external/func_800CA2E4.s b/asm/non_matchings/audio/external/func_800CA2E4.s deleted file mode 100644 index 05bac992c..000000000 --- a/asm/non_matchings/audio/external/func_800CA2E4.s +++ /dev/null @@ -1,11 +0,0 @@ -glabel func_800CA2E4 -/* 0CAEE4 800CA2E4 27BDFFF0 */ addiu $sp, $sp, -0x10 -/* 0CAEE8 800CA2E8 308E00FF */ andi $t6, $a0, 0xff -/* 0CAEEC 800CA2EC 000EC900 */ sll $t9, $t6, 4 -/* 0CAEF0 800CA2F0 3C01800F */ lui $at, %hi(D_800EA06C + 0xc) -/* 0CAEF4 800CA2F4 AFA40010 */ sw $a0, 0x10($sp) -/* 0CAEF8 800CA2F8 AFA50014 */ sw $a1, 0x14($sp) -/* 0CAEFC 800CA2FC 00390821 */ addu $at, $at, $t9 -/* 0CAF00 800CA300 A025A078 */ sb $a1, %lo(D_800EA06C + 0xc)($at) -/* 0CAF04 800CA304 03E00008 */ jr $ra -/* 0CAF08 800CA308 27BD0010 */ addiu $sp, $sp, 0x10 diff --git a/asm/non_matchings/audio/external/func_800CA30C.s b/asm/non_matchings/audio/external/func_800CA30C.s deleted file mode 100644 index e7d42e554..000000000 --- a/asm/non_matchings/audio/external/func_800CA30C.s +++ /dev/null @@ -1,10 +0,0 @@ -glabel func_800CA30C -/* 0CAF0C 800CA30C 308E00FF */ andi $t6, $a0, 0xff -/* 0CAF10 800CA310 27BDFFF0 */ addiu $sp, $sp, -0x10 -/* 0CAF14 800CA314 000E7900 */ sll $t7, $t6, 4 -/* 0CAF18 800CA318 3C01800F */ lui $at, %hi(D_800EA06C + 0xc) -/* 0CAF1C 800CA31C AFA40010 */ sw $a0, 0x10($sp) -/* 0CAF20 800CA320 002F0821 */ addu $at, $at, $t7 -/* 0CAF24 800CA324 A020A078 */ sb $zero, %lo(D_800EA06C + 0xc)($at) -/* 0CAF28 800CA328 03E00008 */ jr $ra -/* 0CAF2C 800CA32C 27BD0010 */ addiu $sp, $sp, 0x10 diff --git a/asm/non_matchings/audio/external/play_sound.s b/asm/non_matchings/audio/external/play_sound.s deleted file mode 100644 index 7915fa026..000000000 --- a/asm/non_matchings/audio/external/play_sound.s +++ /dev/null @@ -1,35 +0,0 @@ -glabel play_sound -/* 0C4D48 800C4148 00047F02 */ srl $t7, $a0, 0x1c -/* 0C4D4C 800C414C 31F800FF */ andi $t8, $t7, 0xff -/* 0C4D50 800C4150 3C198019 */ lui $t9, %hi(D_80192C3C) # 0x8019 -/* 0C4D54 800C4154 0338C821 */ addu $t9, $t9, $t8 -/* 0C4D58 800C4158 93392C3C */ lbu $t9, %lo(D_80192C3C)($t9) # 0x2c3c($t9) -/* 0C4D5C 800C415C 27BDFFF0 */ addiu $sp, $sp, -0x10 -/* 0C4D60 800C4160 03A06825 */ move $t5, $sp -/* 0C4D64 800C4164 AFA60018 */ sw $a2, 0x18($sp) -/* 0C4D68 800C4168 17200015 */ bnez $t9, .L800C41C0 -/* 0C4D6C 800C416C 30CE00FF */ andi $t6, $a2, 0xff -/* 0C4D70 800C4170 3C03800F */ lui $v1, %hi(D_800EA1B8) # $v1, 0x800f -/* 0C4D74 800C4174 2463A1B8 */ addiu $v1, %lo(D_800EA1B8) # addiu $v1, $v1, -0x5e48 -/* 0C4D78 800C4178 90680000 */ lbu $t0, ($v1) -/* 0C4D7C 800C417C 3C0A8019 */ lui $t2, %hi(D_8018FC20) # $t2, 0x8019 -/* 0C4D80 800C4180 254AFC20 */ addiu $t2, %lo(D_8018FC20) # addiu $t2, $t2, -0x3e0 -/* 0C4D84 800C4184 00084880 */ sll $t1, $t0, 2 -/* 0C4D88 800C4188 01284823 */ subu $t1, $t1, $t0 -/* 0C4D8C 800C418C 000948C0 */ sll $t1, $t1, 3 -/* 0C4D90 800C4190 012A1021 */ addu $v0, $t1, $t2 -/* 0C4D94 800C4194 AC440000 */ sw $a0, ($v0) -/* 0C4D98 800C4198 AC450004 */ sw $a1, 4($v0) -/* 0C4D9C 800C419C A04E0008 */ sb $t6, 8($v0) -/* 0C4DA0 800C41A0 AC47000C */ sw $a3, 0xc($v0) -/* 0C4DA4 800C41A4 8FAB0020 */ lw $t3, 0x20($sp) -/* 0C4DA8 800C41A8 AC4B0010 */ sw $t3, 0x10($v0) -/* 0C4DAC 800C41AC 8FAC0024 */ lw $t4, 0x24($sp) -/* 0C4DB0 800C41B0 AC4C0014 */ sw $t4, 0x14($v0) -/* 0C4DB4 800C41B4 906E0000 */ lbu $t6, ($v1) -/* 0C4DB8 800C41B8 25CF0001 */ addiu $t7, $t6, 1 -/* 0C4DBC 800C41BC A06F0000 */ sb $t7, ($v1) -.L800C41C0: -/* 0C4DC0 800C41C0 01A0E825 */ move $sp, $t5 -/* 0C4DC4 800C41C4 03E00008 */ jr $ra -/* 0C4DC8 800C41C8 25BD0010 */ addiu $sp, $t5, 0x10 diff --git a/asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s b/asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s index d3ad9945c..78e72eb91 100644 --- a/asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s +++ b/asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s @@ -253,10 +253,10 @@ glabel create_next_audio_frame_task /* 0CC2C8 800CB6C8 86270000 */ lh $a3, ($s1) /* 0CC2CC 800CB6CC 0C034468 */ jal osGetCount /* 0CC2D0 800CB6D0 AE020000 */ sw $v0, ($s0) -/* 0CC2D4 800CB6D4 3C04803B */ lui $a0, %hi(D_803B7194) # $a0, 0x803b +/* 0CC2D4 800CB6D4 3C04803B */ lui $a0, %hi(gAudioRandom) # $a0, 0x803b /* 0CC2D8 800CB6D8 3C07803B */ lui $a3, %hi(D_803B70B8) # $a3, 0x803b /* 0CC2DC 800CB6DC 24E770B8 */ addiu $a3, %lo(D_803B70B8) # addiu $a3, $a3, 0x70b8 -/* 0CC2E0 800CB6E0 24847194 */ addiu $a0, %lo(D_803B7194) # addiu $a0, $a0, 0x7194 +/* 0CC2E0 800CB6E0 24847194 */ addiu $a0, %lo(gAudioRandom) # addiu $a0, $a0, 0x7194 /* 0CC2E4 800CB6E4 8C8A0000 */ lw $t2, ($a0) /* 0CC2E8 800CB6E8 8CEB0000 */ lw $t3, ($a3) /* 0CC2EC 800CB6EC 8CF80000 */ lw $t8, ($a3) diff --git a/data/data_0DD0A0_2_1_1.s b/data/data_0DD0A0_2_1_1.s index 694cc10ff..ed4dbe2a1 100644 --- a/data/data_0DD0A0_2_1_1.s +++ b/data/data_0DD0A0_2_1_1.s @@ -324,10 +324,10 @@ glabel D_800EA1A0 .byte 0x04, 0x01, 0x01, 0x02, 0x02, 0x01, 0x03, 0x01 .byte 0x01, 0x02, 0x02, 0x01, 0x03, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x01, 0x01, 0x00, 0x01, 0x01 -glabel D_800EA1B8 +glabel sSoundRequestCount .word 0x00000000 -glabel D_800EA1BC +glabel sNumProcessedSoundRequests .word 0x00000000 glabel D_800EA1C0 @@ -370,7 +370,9 @@ glabel D_800EA1F4 .balign 4 glabel D_800EA244 -.byte 0x00, 0x00, 0x00, 0x00 +.byte 0x00 + +.byte 0x00, 0x00, 0x00 .asciiz "entryout !!! %d\n" .balign 4 @@ -409,6 +411,8 @@ glabel D_800EA244 .word 0x00000000, 0x00000000, 0x00000000 +# Begin port_eu.c data + glabel D_800EA3A0 .byte 0x00, 0x00, 0x00, 0x00 diff --git a/data/rodata_audio_2.s b/data/rodata_audio_2.s index bcbf7b4a6..4182f7845 100644 --- a/data/rodata_audio_2.s +++ b/data/rodata_audio_2.s @@ -162,14 +162,20 @@ glabel jpt_800F35C4 .word L800C1A34, L800C1A34, L800C1A34, L800C1A34 .word L800C1AEC, L800C1A34 +# begin func_800C1E2C glabel D_800F35DC .float 0.1 +# end func_800C1E2C +#begin func_800C1F8C glabel D_800F35E0 .float 100000.0 +#end func_800C1F8C +#begin func_800C21E8 glabel D_800F35E4 .float 100000.0 +#end func_800C21E8 glabel D_800F35E8 .float 0.85 @@ -261,6 +267,7 @@ glabel D_800F3728 glabel D_800F372C .float 0.9 +# begin func_800C6758 glabel D_800F3730 .float 0.6 @@ -269,6 +276,7 @@ glabel D_800F3734 glabel D_800F3738 .float 0.95 +# end func_800C6758 glabel jpt_800F373C .word L800C69C8, L800C6A0C, L800C6910, L800C6C74 @@ -305,6 +313,7 @@ glabel jpt_800F3868 .word L800C7514, L800C75C8, L800C74D4, L800C75C4 .word L800C75C8, L800C75B4, L800C75BC +# begin func_800C8770 glabel D_800F3894 .float 0.7 @@ -322,6 +331,7 @@ glabel D_800F38A4 glabel D_800F38A8 .float 0.03 +# end func_800C8770 glabel D_800F38AC .float 0.012000 @@ -438,6 +448,7 @@ glabel D_800F3958 glabel D_800F395C .float 4805.0 +# start func_800C9A88 data glabel jpt_800F3960 .word L800C9B3C, L800C9B3C, L800C9B68, L800C9B94 .word L800C9BC0, L800C9BEC, L800C9B68, L800C9BEC @@ -471,6 +482,7 @@ glabel D_800F39A0 glabel D_800F39A4 .float 1922.0 +# end func_800C9A88 data glabel D_800F39A8 .float 0.55 diff --git a/src/audio/data.h b/src/audio/data.h index dd87947a4..34f6f8727 100644 --- a/src/audio/data.h +++ b/src/audio/data.h @@ -31,5 +31,6 @@ extern s32 gUnknownData_800F6290[32]; extern f32 gHeadsetPanVolume[128]; extern f32 gStereoPanVolume[128]; extern f32 gDefaultPanVolume[128]; +extern u32 gAudioRandom; #endif diff --git a/src/audio/external.c b/src/audio/external.c index 5bfc5e105..fdb0b1069 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -1,9 +1,16 @@ #include #include #include +#include "camera.h" +#include "math_util_2.h" +#include "variables.h" #include "audio/external.h" +#include "audio/load.h" +#include "audio/data.h" -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C13F0.s") +// REQUIRES void in the argument list to match properly +void func_800C13F0(void) { +} #ifdef MIPS_TO_C @@ -25,36 +32,21 @@ void func_800C13FC(void *arg0) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C13FC.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -extern ? D_80191420; - -f32 func_800C1480(s32 arg0, s32 arg1) { +f32 func_800C1480(u8 bank, u8 soundId) { f32 temp_f0; - f32 temp_f12; f32 var_f2; - f32 var_f2_2; - s32 temp_v0_2; - s32 temp_v1; s32 var_v0; - void *temp_v0; + struct Unk_80191420 *temp_v0; - unksp-10.unk10 = arg0; - unksp-10.unk14 = arg1; - temp_v0 = ((arg0 & 0xFF) * 0x3C0) + ((arg1 & 0xFF) * 0x30) + &D_80191420; - temp_v1 = temp_v0->unk24; - if (temp_v1 & 0x400000) { + temp_v0 = &sSoundBanks[bank][soundId]; + if (temp_v0->soundBits & 0x400000) { return 1.0f; } - temp_f0 = temp_v0->unk1C; - temp_v0_2 = temp_v1 & 0x30000; + temp_f0 = temp_v0->distance; if (temp_f0 > 2000.0f) { var_f2 = 0.0f; } else { - switch (temp_v0_2) { /* irregular */ - default: - var_v0 = 0x190; - break; + switch (temp_v0->soundBits & 0x30000) { /* irregular */ case 0x10000: var_v0 = 0x1F4; break; @@ -64,188 +56,134 @@ f32 func_800C1480(s32 arg0, s32 arg1) { case 0x30000: var_v0 = 0x3E8; break; + default: + var_v0 = 0x190; + break; } - temp_f12 = (f32) var_v0; - if (temp_f0 < temp_f12) { - var_f2_2 = (f32) (((f64) ((temp_f12 - temp_f0) / temp_f12) * 0.5) + 0.5); + if (temp_f0 < var_v0) { + var_f2 = (((var_v0 - temp_f0) / var_v0) * 0.5) + 0.5; } else { - var_f2_2 = (f32) ((1.0 - (f64) ((temp_f0 - temp_f12) / (2000.0f - temp_f12))) * 0.5); + var_f2 = (1.0 - ((temp_f0 - var_v0) / (2000.0f - var_v0))) * 0.5; } - var_f2 = var_f2_2 * var_f2_2; + var_f2 *= var_f2; } return var_f2; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C1480.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern s8 D_8018EF10; -extern ? D_80191420; -extern s32 D_803B17D0; -extern ? gSequenceChannelNone; +s8 func_800C15D0(u8 bank, u8 soundId, u8 channel) { + s32 var_a0; + s8 var_v0; + s8 var_v1; -s8 func_800C15D0(s32 arg0, s32 arg1, s32 arg2) { - ? sp-10; - f32 temp_f0; - s32 temp_a0_2; - void *temp_a0; - void *temp_a3; - s8 phi_v1; - s8 phi_v0; - s8 phi_v1_2; - s8 phi_a0; - - sp-10.unk10 = arg0; - sp-10.unk14 = arg1; - sp-10.unk18 = arg2; - temp_a3 = ((arg0 & 0xFF) * 0x3C0) + ((arg1 & 0xFF) * 0x30) + &D_80191420; - phi_v1 = 0; - phi_v0 = 0; - phi_v1_2 = 0; - if ((temp_a3->unk24 << 0xA) >= 0) { - temp_f0 = temp_a3->unk1C; - phi_v0 = 0xA; - if (temp_f0 < 500.0f) { - phi_v0 = (temp_f0 / 500.0f) * 10.0f; + var_v0 = 0; + var_v1 = 0; + if (!(sSoundBanks[bank][soundId].soundBits & 0x200000)) { + if (sSoundBanks[bank][soundId].distance < 500.0f) { + var_v0 = (sSoundBanks[bank][soundId].distance / 500.0f) * 10.0f; + } else { + var_v0 = 0x0A; } } - temp_a0 = *(&D_803B17D0 + ((arg2 & 0xFF) * 4)); - if (&gSequenceChannelNone != temp_a0) { - phi_v1 = temp_a0->unk5E; + if (IS_SEQUENCE_CHANNEL_VALID(gSequencePlayers[2].channels[channel])) { + var_v1 = gSequencePlayers[2].channels[channel]->soundScriptIO[6]; } - phi_v1_2 = phi_v1; - if (phi_v1 == -1) { - + if (var_v1 == -1) { + var_v1 = 0; } - temp_a0_2 = *temp_a3->unk18 + phi_v0 + phi_v1_2 + D_8018EF10; - phi_a0 = temp_a0_2; - if (temp_a0_2 >= 0x80) { - phi_a0 = 0x7F; + var_a0 = *sSoundBanks[bank][soundId].unk18 + var_v0 + var_v1 + D_8018EF10; + if (var_a0 >= 0x80) { + var_a0 = 0x7F; } - return phi_a0; + return var_a0; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C15D0.s") -#endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern u8 D_800EA0F4; -extern u8 D_800EA1C0; -extern f32 D_800F35C0; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +s8 D_800EA0F4 = 0; /* const */ +u8 D_800EA1C0 = 0; /* const */ -s8 func_800C16E8(f32 arg0, f32 arg1, s32 arg2) { - ? sp-18; +s8 func_800C16E8(f32 arg0, f32 arg1, u8 arg2) { f32 temp_f6; - f32 phi_f2; - f32 phi_f20; - f32 phi_f0; - f32 phi_f0_2; - f32 phi_f20_2; - f32 phi_f2_2; - f32 phi_f2_3; - f32 phi_f2_4; - f32 phi_f14; - f32 phi_f16; - f32 phi_f18; + f32 var_f0; + f32 var_f14; + f32 var_f16; + f32 var_f18; + f32 var_f20; + f32 var_f2; + f32 var_f2_2; - sp-18.unk10 = saved_reg_f20; - sp-18.unk1C = arg1; - sp-18.unk20 = arg2; + unksp-18.unk10 = (f64) saved_reg_f20; + unksp-18.unk1C = arg1; + unksp-18.unk20 = (s32) arg2; if (D_800EA1C0 == 0) { - if (D_800EA0F4 != 0) { - phi_f2 = 10.0f; - phi_f14 = 20.0f; - phi_f16 = 10.0f; - phi_f18 = 2.5f; + if ((u8) D_800EA0F4 != 0) { + var_f16 = 10.0f; + var_f14 = 20.0f; + var_f18 = 2.5f; + var_f2_2 = 10.0f; } else { - phi_f2 = 100.0f; - phi_f14 = 200.0f; - phi_f16 = 5.0f; - phi_f18 = D_800F35C0; + var_f2_2 = 100.0f; + var_f14 = 200.0f; + var_f16 = 5.0f; + var_f18 = 3.3333333f; } if (arg0 < 0.0f) { - phi_f20 = -arg0; + var_f20 = -arg0; } else { - phi_f20 = arg0; + var_f20 = arg0; } - phi_f20_2 = phi_f20; - if (phi_f2 < phi_f20) { - phi_f20_2 = phi_f2; + if (var_f2_2 < var_f20) { + var_f20 = var_f2_2; } - temp_f6 = sp-18.unk1C; + temp_f6 = unksp-18.unk1C; if (temp_f6 < 0.0f) { - phi_f0 = -temp_f6; + var_f0 = -temp_f6; } else { - phi_f0 = sp-18.unk1C; + var_f0 = unksp-18.unk1C; } - phi_f0_2 = phi_f0; - if (phi_f2 < phi_f0) { - phi_f0_2 = phi_f2; + if (var_f2_2 < var_f0) { + var_f0 = var_f2_2; } - if ((arg0 == 0.0f) && (sp-18.unk1C == 0.0f)) { - phi_f2_2 = 0.5f; - } else if ((arg0 >= 0.0f) && (phi_f0_2 <= phi_f20_2)) { - phi_f2_2 = 1.0f - ((phi_f14 - phi_f20_2) / (phi_f16 * (phi_f14 - phi_f0_2))); - } else if ((arg0 < 0.0f) && (phi_f0_2 <= phi_f20_2)) { - phi_f2_2 = (phi_f14 - phi_f20_2) / (phi_f16 * (phi_f14 - phi_f0_2)); + if ((arg0 == 0.0f) && (unksp-18.unk1C == 0.0f)) { + var_f2 = 0.5f; + } else if ((arg0 >= 0.0f) && (var_f0 <= var_f20)) { + var_f2 = 1.0f - ((var_f14 - var_f20) / (var_f16 * (var_f14 - var_f0))); + } else if ((arg0 < 0.0f) && (var_f0 <= var_f20)) { + var_f2 = (var_f14 - var_f20) / (var_f16 * (var_f14 - var_f0)); } else { - phi_f2_2 = (arg0 / (phi_f18 * phi_f0_2)) + 0.5f; + var_f2 = (arg0 / (var_f18 * var_f0)) + 0.5f; } - phi_f2_3 = phi_f2_2; - if (phi_f2_2 > 1.0f) { - phi_f2_3 = 1.0f; + if (var_f2 > 1.0f) { + var_f2 = 1.0f; } - phi_f2_4 = phi_f2_3; - if (phi_f2_3 < 0.0f) { - phi_f2_4 = 0.0f; + if (var_f2 < 0.0f) { + var_f2 = 0.0f; } - return (phi_f2_4 * 127.0f) + 0.5f; + return (s8) (s32) ((var_f2 * 127.0f) + 0.5f); } - return (arg2 & 0xFF & 1) * 0x7F; + return (s8) ((arg2 & 0xFF & 1) * 0x7F); } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C16E8.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_80191444; -extern s32 D_803B7194; - -f32 func_800C1934(s32 arg0, s32 arg1) { - ? sp-10; - f32 temp_f6; - s32 temp_t4; +f32 func_800C1934(u8 bank, u8 soundId) { f32 phi_f2; - f32 phi_f6; - sp-10.unk10 = arg0; - sp-10.unk14 = arg1; phi_f2 = 1.0f; - if (*(&D_80191444 + (((arg0 & 0xFF) * 0x3C0) + ((arg1 & 0xFF) * 0x30))) & 0x800000) { - temp_t4 = D_803B7194 & 0xF; - temp_f6 = temp_t4; - phi_f6 = temp_f6; - if (temp_t4 < 0) { - phi_f6 = temp_f6 + 4294967296.0f; - } - phi_f2 = 1.0f - (phi_f6 / 192.0f); + if (sSoundBanks[bank][soundId].soundBits & 0x800000) { + phi_f2 -= ((gAudioRandom & 0xF) / 192.0f); } return phi_f2; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C1934.s") -#endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void func_800CBB88(s32, f32); /* extern */ -void func_800CBBE8(s32, s8); /* extern */ +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +s8 func_800C15D0(u8, u8, u8); /* extern */ +s8 func_800C16E8(f32, f32, u8); /* extern */ +? func_800CBB88(s32, f32); /* extern */ +? func_800CBBE8(s32, s8); /* extern */ extern ? D_8018EF18; -extern ? D_80191420; extern ? D_80192C48; void func_800C19D0(u8 arg0, u8 arg1, u8 arg2) { @@ -253,7 +191,7 @@ void func_800C19D0(u8 arg0, u8 arg1, u8 arg2) { s8 sp3B; f32 sp34; s8 sp33; - u32 temp_t6; + u8 temp_t6; void *temp_s0; void *temp_s0_2; @@ -268,9 +206,9 @@ void func_800C19D0(u8 arg0, u8 arg1, u8 arg2) { case 2: case 3: case 5: - temp_s0 = (temp_t6 * 0x3C0) + (arg1 * 0x30) + &D_80191420; + temp_s0 = (temp_t6 * 0x3C0) + (arg1 * 0x30) + sSoundBanks; arg0 = temp_t6; - temp_s0->unk1C = sqrtf(temp_s0->unk1C, arg1); + temp_s0->unk1C = sqrtf(temp_s0->unk1C); sp3C = *(&D_80192C48 + (arg0 * 0x10)) * (func_800C1480(arg0, arg1) * *temp_s0->unk14); sp3B = func_800C15D0(arg0, arg1, arg2); sp34 = *temp_s0->unk10 * func_800C1934(arg0, arg1); @@ -279,19 +217,19 @@ void func_800C19D0(u8 arg0, u8 arg1, u8 arg2) { } temp_s0_2 = (arg2 * 0xC) + &D_8018EF18; if (sp3C != temp_s0_2->unk0) { - func_800CBBE8(((arg2 & 0xFF) << 8) | 0x6020000 | 3, sp3C * 127.0f); + func_800CBBE8(((arg2 & 0xFF) << 8) | 0x06020000 | 3, (s8) (u32) (sp3C * 127.0f)); temp_s0_2->unk0 = sp3C; } if (sp3B != temp_s0_2->unk8) { - func_800CBBE8((arg2 << 8) | 0x5020000, sp3B); + func_800CBBE8((arg2 << 8) | 0x05020000, sp3B); temp_s0_2->unk8 = sp3B; } if (sp34 != temp_s0_2->unk4) { - func_800CBB88((arg2 << 8) | 0x4020000, sp34); + func_800CBB88((arg2 << 8) | 0x04020000, sp34); temp_s0_2->unk4 = sp34; } if (sp33 != temp_s0_2->unk9) { - func_800CBBE8((arg2 << 8) | 0x3020000, sp33); + func_800CBBE8((arg2 << 8) | 0x03020000, sp33); temp_s0_2->unk9 = sp33; } } @@ -300,41 +238,37 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C19D0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_8018EFD8; -extern u8 D_8018FB90; -extern u8 D_8018FB91; - -void *func_800C1C88(u8 arg0, s32 arg1, s32 arg2, s32 arg3, u8 arg4, s32 arg5) { +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +struct Unk_8018EFD8 *func_800C1C88(u8 arg0, f32 *position, f32 *velocity, f32 *arg3, u8 arg4, u32 soundBits) { + struct Unk_8018EFD8 *temp_a1; + struct Unk_8018EFD8 *temp_v1; u8 temp_a2; u8 temp_t7; u8 temp_v0; - void *temp_a1; - void *temp_v1; temp_v0 = D_8018FB90; - temp_v1 = &D_8018EFD8 + (temp_v0 * 0x3C); - if (temp_v1->unk2A != 0xFF) { + temp_v1 = &D_8018EFD8[temp_v0]; + if (temp_v1->next != 0xFF) { temp_a2 = D_8018FB91; - temp_a1 = &D_8018EFD8 + ((temp_v0 & 0xFF) * 0x3C); - temp_a1->unk29 = temp_a2; - (&D_8018EFD8 + (temp_a2 * 0x3C))->unk2A = temp_v0; - temp_t7 = temp_v1->unk2A; + temp_a1 = &D_8018EFD8[temp_v0 & 0xFF]; + temp_a1->prev = temp_a2; + D_8018EFD8[temp_a2].next = temp_v0; + temp_t7 = temp_v1->next; D_8018FB91 = temp_v0; D_8018FB90 = temp_t7; - (&D_8018EFD8 + ((temp_t7 & 0xFF) * 0x3C))->unk29 = 0xFF; - temp_a1->unk4 = arg1 + 4; - temp_a1->unk0 = arg1; - temp_a1->unk8 = arg1 + 8; - temp_a1->unkC = arg2; - temp_a1->unk10 = arg2 + 4; - temp_a1->unk2A = 0xFF; - temp_a1->unk14 = arg2 + 8; + D_8018EFD8[temp_t7 & 0xFF].prev = 0xFF; + temp_a1->posY = position + 4; + temp_a1->posX = position; + temp_a1->posZ = position + 8; + temp_a1->velX = velocity; + temp_a1->velY = velocity + 4; + temp_a1->next = 0xFF; + temp_a1->velZ = velocity + 8; temp_a1->unk24 = arg3; - temp_a1->unk1C = 0.0f; + temp_a1->unk18[1] = 0.0f; temp_a1->unk28 = arg4; temp_a1->unk30 = arg0; - temp_a1->unk38 = arg5; + temp_a1->soundBits = soundBits; return temp_a1; } return NULL; @@ -343,293 +277,218 @@ void *func_800C1C88(u8 arg0, s32 arg1, s32 arg2, s32 arg3, u8 arg4, s32 arg5) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C1C88.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -f32 func_800416D8(f32, f32, u16, void *); // extern -f32 func_80041724(f32, f32, u16); // extern - -void func_800C1DA4(void *arg0, void *arg1, void *arg2) { - f32 sp34; - f32 sp30; +void func_800C1DA4(Camera *arg0, Vec3s arg1, struct Unk_8018EFD8 *arg2) { f32 temp_f12; f32 temp_f14; - void *temp_a3; - temp_a3 = arg2; - temp_f12 = arg0->unk0 - *arg2->unk0; - temp_f14 = arg0->unk8 - *arg2->unk8; - sp34 = temp_f12; - arg2 = temp_a3; - sp30 = temp_f14; - arg2->unk18 = func_800416D8(temp_f12, temp_f14, arg1->unk2, temp_a3); - arg2->unk20 = func_80041724(temp_f12, temp_f14, arg1->unk2); + temp_f12 = arg0->pos[0] - *arg2->posX; + temp_f14 = arg0->pos[2] - *arg2->posZ; + arg2->unk18[0] = func_800416D8(temp_f12, temp_f14, arg1[1]); + arg2->unk18[2] = func_80041724(temp_f12, temp_f14, arg1[1]); } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C1DA4.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800E9F34; -extern ? D_800EA06C; -extern f32 D_800F35DC; - -void func_800C1E2C(void *arg0, void *arg1, void *arg2) { +#ifdef NEEDS_RODATA +extern f32 D_800F35DC;// = 0.1f +void func_800C1E2C(Camera *camera, Vec3f arg1, struct Unk_8018EFD8 *arg2) { f32 sp44; - f32 sp40; - f32 sp3C; - f32 sp38; - f32 sp34; - f32 temp_f0; - f32 temp_f14; - f32 temp_f14_2; + f32 temp_f6; f32 temp_f16; f32 temp_f18; + f32 dist0; + f32 dist1; + f32 thing0; + f32 thing1; f32 temp_f2; - f32 temp_f2_2; - f32 temp_f6; - u8 temp_v0; - void *temp_v1; - temp_f16 = *arg2->unk0 - arg0->unk0; - temp_f18 = *arg2->unk8 - arg0->unk8; - sp44 = *arg2->unkC - arg1->unk0; - sp38 = temp_f18; - sp3C = temp_f16; - temp_f6 = *arg2->unk14 - arg1->unk8; - sp40 = temp_f6; - temp_f2 = temp_f16 + sp44; - sp34 = sqrtf((temp_f16 * temp_f16) + (temp_f18 * temp_f18)); - temp_f14 = temp_f18 + temp_f6; - temp_f14_2 = D_800F35DC; - temp_f2_2 = 1.0f / (1.0f - ((sp34 - sqrtf((temp_f2 * temp_f2) + (temp_f14 * temp_f14))) / arg2->unk34)); - if (temp_f14_2 < temp_f2_2) { - arg2->unk2C = temp_f2_2; + temp_f16 = (*arg2->posX) - camera->pos[0]; + temp_f18 = (*arg2->posZ) - camera->pos[2]; + + sp44 = (*arg2->velX) - arg1[0]; + temp_f6 = (*arg2->velZ) - arg1[2]; + + thing0 = temp_f16 + sp44; + thing1 = temp_f18 + temp_f6; + + dist0 = sqrtf((temp_f16 * temp_f16) + (temp_f18 * temp_f18)); + dist1 = sqrtf((thing0 * thing0) + (thing1 * thing1)); + + temp_f2 = 1.0f / (1.0f - ((dist0 - dist1) / arg2->unk34)); + + if (temp_f2 > 0.1f) { + arg2->unk2C = temp_f2; } else { - arg2->unk2C = temp_f14_2; + arg2->unk2C = 0.1f; } - temp_f0 = *arg2->unk24; - if (temp_f0 != 0.0f) { - temp_v0 = arg2->unk30; - temp_v1 = (temp_v0 * 0x10) + &D_800EA06C; - arg2->unk2C = arg2->unk2C * ((temp_f0 / temp_v1->unk4) + temp_v1->unk0 + *(&D_800E9F34 + (temp_v0 * 4))); + + if ((*arg2->unk24) != 0.0f) { + arg2->unk2C *= (((*arg2->unk24) / D_800EA06C[arg2->unk30].unk00[1]) + D_800EA06C[arg2->unk30].unk00[0]) + D_800E9F34[arg2->unk30]; } } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C1E2C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C1DA4(s32, s32, void *); // extern -void func_800C1E2C(s32, ? *, void *); // extern -extern u8 D_800EA1C0; -extern ? D_800EA1C8; -extern u8 D_800EA244; -extern f32 D_800F35E0; -extern ? D_8018EFD8; -extern u8 D_8018FB90; -extern u8 D_8018FB91; -extern ? D_8018FB98; -extern ? D_8018FBA8; -extern ? D_8018FBD8; - +#ifdef NEEDS_RODATA +// data/rodata_audio_2.s +extern f32 D_800F35E0;// = 100000.0f; void func_800C1F8C(void) { - s32 *temp_s2; - s32 temp_a0; - s32 temp_a1_2; - s32 temp_lo; - s32 temp_t0; - s32 temp_t9; - u8 temp_s1; - u8 temp_s1_2; - u8 temp_v0_2; - void *temp_a1; - void *temp_s0; - void *temp_v0; - void *temp_v1; - s32 phi_s1; - u8 phi_s1_2; - u8 phi_v0; - void *phi_a0; - s32 phi_a1; + u8 var_s1; + u8 var_a1; + u8 cameraId; + Camera **camera; - temp_t0 = (D_800EA1C0 + 1) & 0xFF; - phi_s1 = 0; - if (temp_t0 > 0) { - do { - temp_lo = phi_s1 * 0xC; - temp_v0 = *(&D_8018FB98 + (phi_s1 * 4)); - temp_t9 = (phi_s1 + 1) & 0xFF; - temp_v1 = &D_8018FBD8 + temp_lo; - temp_a1 = &D_8018FBA8 + temp_lo; - temp_a1->unk0 = temp_v0->unk0 - temp_v1->unk0; - temp_a1->unk8 = temp_v0->unk8 - temp_v1->unk8; - temp_v1->unk0 = temp_v0->unk0; - temp_v1->unk8 = temp_v0->unk8; - phi_s1 = temp_t9; - } while (temp_t9 < temp_t0); + var_a1 = D_800EA1C0 + 1; + for (var_s1 = 0; var_s1 < var_a1; var_s1++) { + D_8018FBA8[var_s1][0] = D_8018FB98[var_s1]->pos[0] - D_8018FBD8[var_s1][0]; + D_8018FBA8[var_s1][2] = D_8018FB98[var_s1]->pos[2] - D_8018FBD8[var_s1][2]; + D_8018FBD8[var_s1][0] = D_8018FB98[var_s1]->pos[0]; + D_8018FBD8[var_s1][2] = D_8018FB98[var_s1]->pos[2]; } - temp_s1 = D_8018EFD8.unk2A; - phi_s1_2 = temp_s1; - phi_v0 = temp_s1; - phi_a1 = 0; - if (temp_s1 != 0xFF) { - do { - temp_s0 = &D_8018EFD8 + (phi_s1_2 * 0x3C); - if (D_800F35E0 == temp_s0->unk1C) { - phi_a0 = &D_8018EFD8 + (phi_a1 * 0x3C); - if (phi_v0 == D_8018FB91) { - D_8018FB91 = temp_s0->unk29; - } else { - (&D_8018EFD8 + (temp_s0->unk2A * 0x3C))->unk29 = temp_s0->unk29; - } - (&D_8018EFD8 + (temp_s0->unk29 * 0x3C))->unk2A = temp_s0->unk2A; - temp_v0_2 = D_8018FB90; - temp_s0->unk29 = 0xFF; - temp_s0->unk2A = temp_v0_2; - (&D_8018EFD8 + (temp_v0_2 * 0x3C))->unk29 = phi_s1_2; - D_8018FB90 = phi_s1_2; + + var_a1 = 0; + var_s1 = D_8018EFD8[0].next; + while (var_s1 != 0xFF) { + if (D_8018EFD8[var_s1].unk18[1] == 100000.0f) { + if (D_8018FB91 == var_s1) { + D_8018FB91 = D_8018EFD8[var_s1].prev; } else { - temp_s2 = (temp_s0->unk28 * 4) + &D_8018FB98; - temp_a0 = *temp_s2; - func_800C1DA4(temp_a0, temp_a0 + 0x24, temp_s0); - if (&D_800EA1C8 != temp_s0->unkC) { - func_800C1E2C(*temp_s2, &D_8018FBA8, temp_s0); - } - temp_a1_2 = phi_s1_2 & 0xFF; - phi_a0 = &D_8018EFD8 + (temp_a1_2 * 0x3C); - phi_a1 = temp_a1_2; + D_8018EFD8[D_8018EFD8[var_s1].next].prev = D_8018EFD8[var_s1].prev; } - temp_s1_2 = phi_a0->unk2A; - phi_s1_2 = temp_s1_2; - phi_v0 = temp_s1_2; - if ((temp_s1_2 != 0xFF) && (D_800EA244 < temp_s1_2)) { - D_800EA244 = temp_s1_2; + D_8018EFD8[D_8018EFD8[var_s1].prev].next = D_8018EFD8[var_s1].next; + D_8018EFD8[var_s1].prev = 0xFF; + D_8018EFD8[var_s1].next = D_8018FB90; + D_8018EFD8[D_8018FB90].prev = var_s1; + D_8018FB90 = var_s1; + } else { + cameraId = D_8018EFD8[var_s1].cameraId; + // Why? Why would you do it this way? For what possible reason? + camera = &D_8018FB98[cameraId]; + func_800C1DA4(*camera, (*camera)->rot, &D_8018EFD8[var_s1]); + if (D_800EA1C8 != D_8018EFD8[var_s1].velX) { + func_800C1E2C(*camera, D_8018FBA8[0], &D_8018EFD8[var_s1]); } - } while (temp_s1_2 != 0xFF); + var_a1 = var_s1; + } + var_s1 = D_8018EFD8[var_a1].next; + if ((var_s1 != 0xFF) && (D_800EA244 < var_s1)) { + D_800EA244 = var_s1; + } } } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C1F8C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f32 D_800F35E4; -extern ? D_8018EFD8; +#ifdef NEEDS_RODATA +// data/rodata_audio_2.s +extern f32 D_800F35E4;// = 100000.0f; +f32 *func_800C21E8(f32 *arg0, u32 arg1) { + u8 var_v0; + f32 *ret; + // Only here to force a match + f32 *thing = arg0; + struct Unk_8018EFD8 *temp_a1; -void *func_800C21E8(s32 arg0, s32 arg1) { - ? sp-10; - u8 temp_v0; - void *temp_a1; - u8 phi_v0; - u8 phi_v0_2; - void *phi_v1; - void *phi_v1_2; - - temp_v0 = D_8018EFD8.unk2A; - phi_v0 = temp_v0; - phi_v1 = NULL; - phi_v1_2 = NULL; - if (temp_v0 != 0xFF) { - do { - temp_a1 = &D_8018EFD8 + (phi_v0 * 0x3C); - if ((arg0 == temp_a1->unk0) && (arg1 == temp_a1->unk38) && (phi_v0_2 = 0xFF, (D_800F35E4 != temp_a1->unk1C))) { - phi_v1_2 = temp_a1 + 0x18; + ret = 0; + var_v0 = D_8018EFD8[0].next; + while (var_v0 != 0xFF) { + temp_a1 = &D_8018EFD8[var_v0]; + // It doesn't matter what you set var_v0 to here actually + var_v0 = D_8018EFD8[0].next; + if ((arg0 == temp_a1->posX) && (arg1 == temp_a1->soundBits)) { + // I suspect all this weirdness here is a result of someone not knowing the 'break' keyword + var_v0 = 0xFF; + if (temp_a1->unk18[1] != 100000.0f) { + ret = temp_a1->unk18; } else { - phi_v0_2 = temp_a1->unk2A; + goto test; } - phi_v0 = phi_v0_2; - phi_v1 = phi_v1_2; - } while (phi_v0_2 != 0xFF); + } else { + test: + var_v0 = temp_a1->next; + } } - return phi_v1; + return ret; } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C21E8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_8001AAAC(s16, s16, s16); // extern -void func_800CBBE8(s32, ?, s32, s32); // extern +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_8001AAAC(s16, s16, s16); /* extern */ +? func_800CBBE8(s32, ?, s32, s32); /* extern */ extern ? D_8018FC10; -extern u32 gSequencePlayers; -void func_800C2274(s32 arg0) { +void func_800C2274(s32 player) { s16 sp46; s16 sp44; s16 sp42; s16 temp_a1; - s16 temp_t7; + s16 temp_t2; + s16 var_s0; + s16 var_s1; s32 temp_a3; - s32 temp_t2; s32 temp_v0; + s32 var_a2; + struct SequenceChannel *temp_v0_2; u8 temp_s0; void *temp_s1; - void *temp_v0_2; void *temp_v0_3; void *temp_v0_4; - s32 phi_a2; - s16 phi_s1; - s16 phi_s0; - temp_a3 = arg0 & 0xFF; - phi_a2 = 0xF; - if ((*(&gSequencePlayers + (temp_a3 * 0x148)) >> 0x1F) != 0) { - temp_v0 = D_800DC530; - if (temp_v0 != 0) { - if (temp_v0 != 1) { - if (temp_v0 != 3) { - - } else { - phi_a2 = 0xC; - if (gPlayerCountSelection1 == 3) { - phi_a2 = 0xD; - } - } - } else { - phi_a2 = 0xE; + temp_a3 = player & 0xFF; + var_a2 = 0xF; + if (((u32) gSequencePlayers[temp_a3] >> 0x1F) != 0) { + temp_v0 = gScreenModeSelection; + switch (temp_v0) { /* irregular */ + case 0: + break; + case 1: + var_a2 = 0xE; + break; + case 3: + var_a2 = 0xC; + if (gPlayerCountSelection1 == 3) { + var_a2 = 0xD; } + break; } - temp_v0_2 = (&gSequencePlayers + (temp_a3 * 0x148) + (phi_a2 * 4))->unk30; - temp_s0 = temp_v0_2->unk58; - if (temp_s0 != 0xFF) { - sp46 = temp_v0_2->unk59 & 3; - temp_t7 = temp_v0_2->unk5A & 0xF; - phi_s1 = temp_t7; - if (temp_t7 >= 0xA) { - phi_s1 = 9; + temp_v0_2 = gSequencePlayers[temp_a3].channels[var_a2]; + temp_s0 = (u8) temp_v0_2->soundScriptIO[0]; + if (temp_s0 != (u8) 0x00FF) { + sp46 = temp_v0_2->soundScriptIO[1] & 3; + var_s1 = temp_v0_2->soundScriptIO[2] & 0xF; + if (var_s1 >= 0xA) { + var_s1 = 9; } - sp42 = temp_v0_2->unk5B & 7; - func_800CBBE8(((temp_a3 & 0xFF) << 0x10) | 0x6000000 | ((phi_a2 & 0xFF) << 8), -1, phi_a2, temp_a3); - sp44 = phi_s1; + sp42 = temp_v0_2->soundScriptIO[3] & 7; + func_800CBBE8(((temp_a3 & 0xFF) << 0x10) | 0x06000000 | ((var_a2 & 0xFF) << 8), -1, var_a2, temp_a3); + sp44 = var_s1; } - if (temp_s0 != 1) { - if (temp_s0 != 2) { - return; - } + switch (temp_s0) { /* switch 1; irregular */ + case 1: /* switch 1 */ temp_v0_3 = &D_8018FC10 + (sp46 * 4); temp_v0_3->unk0 = sp44; + var_s0 = 0; temp_v0_3->unk2 = sp42; - // Duplicate return node #21. Try simplifying control flow for better match + do { + temp_s1 = &D_8018FC10 + (var_s0 * 4); + temp_a1 = temp_s1->unk0; + if (temp_a1 != 0x00FF) { + func_8001AAAC(var_s0, temp_a1, temp_s1->unk2); + temp_s1->unk0 = 0x00FF; + } + temp_t2 = (var_s0 + 1) & 0xFF; + var_s0 = temp_t2; + } while (temp_t2 < 4); return; + case 2: /* switch 1 */ + temp_v0_4 = &D_8018FC10 + (sp46 * 4); + temp_v0_4->unk0 = sp44; + temp_v0_4->unk2 = sp42; + break; } - temp_v0_4 = &D_8018FC10 + (sp46 * 4); - temp_v0_4->unk0 = sp44; - temp_v0_4->unk2 = sp42; - phi_s0 = 0; - do { - temp_s1 = &D_8018FC10 + (phi_s0 * 4); - temp_a1 = temp_s1->unk0; - if (temp_a1 != 0xFF) { - func_8001AAAC(phi_s0, temp_a1, temp_s1->unk2); - temp_s1->unk0 = 0xFF; - } - temp_t2 = (phi_s0 + 1) & 0xFF; - phi_s0 = temp_t2; - } while (temp_t2 < 4); } } #else @@ -637,76 +496,80 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C2274.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800CBBB8(?, ?); // extern -extern ? D_800E9DB4; -extern ? D_800E9DF4; -extern ? D_800E9E74; -extern ? D_800E9E84; -extern ? D_800E9E94; -extern ? D_800E9EA4; -extern ? D_800E9F24; -extern ? D_800E9F2C; -extern ? D_800E9F34; -extern ? D_800E9F54; -extern ? D_800E9F74; -extern ? D_800E9F78; -extern ? D_800E9F7C; -extern ? D_800EA06C; -extern ? D_800EA0EC; -extern s8 D_800EA0F0; -extern s8 D_800EA0F4; -extern s8 D_800EA104; -extern s8 D_800EA108; -extern ? D_800EA10C; -extern ? D_800EA130; -extern s16 D_800EA15C; -extern s16 D_800EA160; -extern s8 D_800EA164; -extern s8 D_800EA16C; -extern f32 D_800EA178; -extern f32 D_800EA17C; -extern s16 D_800EA180; -extern s16 D_800EA184; -extern f32 D_800F35E8; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +struct _struct_D_800EA06C_0x10 { + /* 0x00 */ char pad0[0xC]; + /* 0x0C */ s8 unkC; /* inferred */ + /* 0x0D */ char padD[3]; /* maybe part of unkC[4]? */ +}; /* size = 0x10 */ + +? func_800CBBB8(?, ?); /* extern */ extern s8 D_8018EF10; extern ? D_8018EF18; -extern ? D_8018EFD8; -extern s8 D_8018FB90; -extern s8 D_8018FB91; extern ? D_8018FB98; extern ? D_8018FBA8; extern ? D_8018FBD8; extern s8 D_8018FC08; extern ? D_8018FC10; -extern Player gPlayers; +static s32 D_800E9DB4[4] = { 0, 0, 0, 0 }; /* const */ +static ?32 D_800E9DF4[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; /* const */ +static s32 D_800E9E74[4] = { 0, 0, 0, 0 }; /* const */ +static s32 D_800E9E84[4] = { 0, 0, 0, 0 }; /* const */ +static s32 D_800E9E94[4] = { 0, 0, 0, 0 }; /* const */ +static s32 D_800E9EA4[4] = { 0, 0, 0, 0 }; /* const */ +static ? D_800E9F24; /* unable to generate initializer; const */ +static ? D_800E9F2C; /* unable to generate initializer; const */ +static f32 D_800E9F34[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static f32 D_800E9F54[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static ? D_800E9F74; /* unable to generate initializer; const */ +static ? D_800E9F78; /* unable to generate initializer; const */ +static ? D_800E9F7C; /* unable to generate initializer; const */ +static struct _struct_D_800EA06C_0x10 D_800EA06C[0]; /* unable to generate initializer; const */ +static ? D_800EA0EC; /* unable to generate initializer; const */ +static s8 D_800EA0F0 = 0; /* const */ +static s8 D_800EA104 = 0; /* const */ +static ? D_800EA10C; /* unable to generate initializer; const */ +static f32 D_800EA130[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static s16 D_800EA15C = 0; /* const */ +static s16 D_800EA160 = 0; /* const */ +static s8 D_800EA164 = 0; /* const */ +static s8 D_800EA16C = 0; /* const */ +static s16 D_800EA180 = 0; /* const */ +static s16 D_800EA184 = 0; /* const */ +s8 D_800EA0F4 = 0; /* const */ +s8 D_800EA108 = 0; /* const */ void func_800C2474(void) { + Player *temp_a2; + Player *temp_t7; + s32 temp_at; + s32 temp_at_2; s32 temp_lo; + s32 temp_lo_2; + s32 temp_lo_3; s32 temp_t6; s32 temp_t6_2; s32 temp_t6_3; s32 temp_t8; - s32 temp_v1; - s32 temp_v1_2; + s32 var_v0; + s32 var_v0_2; + s32 var_v0_3; + s32 var_v0_4; + s32 var_v1; + s8 temp_t8_2; + s8 temp_t9; + struct Unk_8018EFD8 *temp_a0_4; void *temp_a0; void *temp_a0_2; void *temp_a0_3; - void *temp_a0_4; void *temp_a1; - void *temp_a2; - void *temp_v1_3; - s32 phi_v0; - s32 phi_v0_2; - s32 phi_v0_3; - s32 phi_v1; - s32 phi_v0_4; + void *temp_v1; D_8018EF10 = 0; - D_8018FB98.unk0 = camera1; - D_8018FB98.unk4 = camera2; - D_8018FB98.unk8 = camera3; - D_8018FB98.unkC = camera4; + D_8018FB98.unk0 = (Camera *) camera1; + D_8018FB98.unk4 = (Camera *) camera2; + D_8018FB98.unk8 = (Camera *) camera3; + D_8018FB98.unkC = (Camera *) camera4; D_8018FB91 = 0; D_8018FB90 = 1; D_800EA0F4 = 0; @@ -721,19 +584,16 @@ void func_800C2474(void) { D_800EA160 = 0; D_800EA164 = 0; D_800EA178 = 1.0f; - D_800EA17C = D_800F35E8; + D_800EA17C = 0.85f; D_800EA180 = 0; D_800EA184 = 0; - phi_v0 = 0; - phi_v0_2 = 0; - phi_v0_3 = 0; + var_v0 = 0; do { - temp_lo = phi_v0 * 0xC; - temp_v1 = phi_v0 * 4; - *(&D_800E9DB4 + temp_v1) = 0; - *(&D_800E9DF4 + temp_v1) = 0.0f; - *(&D_800EA0EC + phi_v0) = 0; - *(&D_800E9EA4 + temp_v1) = 0; + temp_lo = var_v0 * 0xC; + D_800E9DB4[var_v0] = 0; + D_800E9DF4[var_v0] = 0; + *(&D_800EA0EC + var_v0) = 0; + D_800E9EA4[var_v0] = 0; temp_a0 = &D_8018FBA8 + temp_lo; temp_a1 = &D_8018FBD8 + temp_lo; temp_a0->unk0 = 0.0f; @@ -742,63 +602,71 @@ void func_800C2474(void) { temp_a1->unk0 = 0.0f; temp_a1->unk4 = 0.0f; temp_a1->unk8 = 0.0f; - temp_a0_2 = &D_8018FC10 + temp_v1; - (&D_800E9F7C + (phi_v0 * 0x3C))->unk14 = 0; - *(&D_800E9E74 + temp_v1) = 0; - *(&D_800E9E84 + temp_v1) = 0; - *(&D_800E9E94 + temp_v1) = 0; - temp_a2 = &gPlayers + (phi_v0 * 0xDD8); - temp_a2->unk1D4 = 0; - temp_a2->unk1EC = 0; - temp_a2->unkBC = 0; - temp_a2->unk20C = 0.0f; - temp_a2->unkC0 = 0; - temp_a2->unk98 = 0.0f; - temp_a2->unkDE = 0; - temp_a0_2->unk0 = 0xFF; + temp_a0_2 = &D_8018FC10 + (var_v0 * 4); + (&D_800E9F7C + (var_v0 * 0x3C))->unk14 = 0; + D_800E9E74[var_v0] = 0; + D_800E9E84[var_v0] = 0; + D_800E9E94[var_v0] = 0; + temp_a2 = &gPlayers[var_v0]; + temp_a2->boundingBoxCorners[2].surfaceType = 0; + temp_a2->boundingBoxCorners[3].surfaceType = 0; + temp_a2->unk_0BC = 0; + temp_a2->unk_20C = 0.0f; + temp_a2->unk_0C0 = 0; + temp_a2->unk_098 = 0.0f; + temp_a2->unk_0DE = 0; + temp_a0_2->unk0 = 0x00FF; temp_a0_2->unk2 = 0; - *(&D_800EA10C + phi_v0) = 0; - *(&D_800E9F74 + phi_v0) = 0; - temp_t6 = (phi_v0 + 1) & 0xFF; - *(&D_800E9F78 + phi_v0) = 0; - phi_v0 = temp_t6; + *(&D_800EA10C + var_v0) = 0; + *(&D_800E9F74 + var_v0) = 0; + temp_t6 = (var_v0 + 1) & 0xFF; + *(&D_800E9F78 + var_v0) = 0; + var_v0 = temp_t6; } while (temp_t6 < 4); + var_v0_2 = 0; do { - *(&D_800E9F24 + phi_v0_2) = 0; - temp_v1_2 = phi_v0_2 * 4; - *(&D_800E9F2C + phi_v0_2) = 0; - *(&D_800E9F34 + temp_v1_2) = 0.0f; - *(&D_800E9F54 + temp_v1_2) = 0.0f; - *(&D_800EA130 + temp_v1_2) = 0.0f; - temp_t8 = (phi_v0_2 + 1) & 0xFF; - (&D_800EA06C + (phi_v0_2 * 0x10))->unkC = 0; - (&gPlayers + (phi_v0_2 * 0xDD8))->unkBC = 0; - phi_v0_2 = temp_t8; - } while (temp_t8 < 8); + *(&D_800E9F24 + var_v0_2) = 0; + *(&D_800E9F2C + var_v0_2) = 0; + D_800E9F34[var_v0_2] = 0.0f; + D_800E9F54[var_v0_2] = 0.0f; + D_800EA130[var_v0_2] = 0.0f; + temp_t8 = (var_v0_2 + 1) & 0xFF; + temp_at = temp_t8 < 8; + D_800EA06C[var_v0_2].unkC = 0; + temp_t7 = &gPlayers[var_v0_2]; + var_v0_2 = temp_t8; + temp_t7->unk_0BC = 0; + } while (temp_at != 0); + var_v0_3 = 0; do { - temp_t6_2 = (phi_v0_3 + 1) & 0xFF; - temp_v1_3 = &D_8018EF18 + (phi_v0_3 * 0xC); - temp_v1_3->unk0 = 1.0f; - temp_v1_3->unk4 = 1.0f; - temp_v1_3->unk8 = 0; - temp_v1_3->unk9 = 0x40; - phi_v0_3 = temp_t6_2; - } while (temp_t6_2 < 0x10); - D_8018EFD8.unk29 = 0xFF; - D_8018EFD8.unk2A = 0xFF; - phi_v1 = 1; - phi_v0_4 = 1; + temp_lo_2 = var_v0_3 * 0xC; + temp_t6_2 = (var_v0_3 + 1) & 0xFF; + temp_at_2 = temp_t6_2 < 0x10; + var_v0_3 = temp_t6_2; + temp_v1 = &D_8018EF18 + temp_lo_2; + temp_v1->unk0 = 1.0f; + temp_v1->unk4 = 1.0f; + temp_v1->unk8 = 0; + temp_v1->unk9 = 0x40; + } while (temp_at_2 != 0); + D_8018EFD8->prev = 0xFF; + D_8018EFD8->next = 0xFF; + var_v0_4 = 1; + var_v1 = 1; do { - temp_t6_3 = (phi_v0_4 + 1) & 0xFF; - temp_a0_3 = &D_8018EFD8 + (phi_v0_4 * 0x3C); - temp_a0_3->unk29 = phi_v1 - 1; - temp_a0_3->unk2A = phi_v1 + 1; - phi_v1 = temp_t6_3; - phi_v0_4 = temp_t6_3; + temp_lo_3 = var_v0_4 * 0x3C; + temp_t6_3 = (var_v0_4 + 1) & 0xFF; + temp_t8_2 = var_v1 - 1; + temp_t9 = var_v1 + 1; + var_v1 = temp_t6_3; + var_v0_4 = temp_t6_3; + temp_a0_3 = D_8018EFD8 + temp_lo_3; + temp_a0_3->unk29 = temp_t8_2; + temp_a0_3->unk2A = temp_t9; } while (temp_t6_3 < 0x31); - temp_a0_4 = &D_8018EFD8 + (temp_t6_3 * 0x3C); - temp_a0_4->unk29 = temp_t6_3 - 1; - temp_a0_4->unk2A = 0xFF; + temp_a0_4 = &D_8018EFD8[temp_t6_3]; + temp_a0_4->prev = temp_t6_3 - 1; + temp_a0_4->next = 0xFF; } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C2474.s") @@ -871,19 +739,22 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C29B4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void func_800C13FC(s32, s32); /* extern */ -void func_800C284C(u8, u8, u8, u32); /* extern */ -void func_800C29B4(u8, s32); /* extern */ -void func_800C5C40(); /* extern */ -void func_800CBBB8(?, u8); /* extern */ -void func_800CBBE8(s32, s8, s8, s32); /* extern */ +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C13FC(s32, s32); /* extern */ +? func_800C284C(u8, u8, u8, u32); /* extern */ +? func_800C29B4(u8, s32); /* extern */ +? func_800C5C40(); /* extern */ +? func_800CBBB8(?, u8); /* extern */ +? func_800CBBE8(s32, s8, s8, s32); /* extern */ extern ? D_80192CA8; extern ? D_80192CC6; extern ? D_801930D0; +static s8 D_800EA1C0 = 0; /* const */ +static s8 D_800EA1EC = 0; /* const */ static ? D_800EA1F0; /* unable to generate initializer; const */ +static s8 D_800EA1F4[0x4]; /* const */ -void func_800C2A2C(u32 arg0, void *arg2) { +void func_800C2A2C(u16 arg0, void *arg2) { u8 sp5B; u32 sp4C; s32 sp48; @@ -893,9 +764,12 @@ void func_800C2A2C(u32 arg0, void *arg2) { f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; - f32 temp_f16; f32 temp_f2; - f32 temp_f8; + f32 temp_f4; + f32 var_f16; + f32 var_f8; + s16 var_a1; + s16 var_a1_3; s32 temp_a0; s32 temp_a0_4; s32 temp_a0_5; @@ -904,7 +778,8 @@ void func_800C2A2C(u32 arg0, void *arg2) { s32 temp_a2_4; s32 temp_a3; s32 temp_a3_3; - s32 temp_t0; + s32 temp_at; + s32 temp_at_2; s32 temp_t6_2; s32 temp_t7_2; s32 temp_t8_2; @@ -913,15 +788,21 @@ void func_800C2A2C(u32 arg0, void *arg2) { s32 temp_t8_5; s32 temp_t8_6; s32 temp_t8_8; - s32 temp_v0; - s32 temp_v0_10; - s32 temp_v0_2; - s32 temp_v0_4; + s32 temp_v0_7; s32 temp_v1; s32 temp_v1_2; s32 temp_v1_3; - s32 temp_v1_4; + s32 var_a3; + s32 var_t0; + s32 var_v0; + s32 var_v0_2; + s32 var_v1; + s32 var_v1_2; + s32 var_v1_3; + s32 var_v1_4; + s32 var_v1_5; s8 temp_a2_5; + s8 var_a2; u32 temp_a3_2; u32 temp_t6; u32 temp_t6_3; @@ -929,328 +810,301 @@ void func_800C2A2C(u32 arg0, void *arg2) { u32 temp_t8; u32 temp_t8_7; u32 temp_t9_2; + u32 var_a0; + u32 var_a1_2; u8 *temp_t4; u8 *temp_t4_2; - u8 temp_t0_2; + u8 temp_t0; u8 temp_t1; u8 temp_t1_2; u8 temp_t9; + u8 var_t0_2; + u8 var_t3; + u8 var_v1_6; void *temp_a0_2; void *temp_a0_3; void *temp_a1_2; void *temp_a1_3; void *temp_a2; void *temp_a2_2; - void *temp_v0_11; + void *temp_v0; + void *temp_v0_2; void *temp_v0_3; + void *temp_v0_4; void *temp_v0_5; void *temp_v0_6; - void *temp_v0_7; void *temp_v0_8; - void *temp_v0_9; - void *temp_v1_5; - s32 phi_v1; - s32 phi_v1_2; - s32 phi_v1_3; - s32 phi_t0; - u8 phi_t3; - s32 phi_v0; - s32 phi_v1_4; - s32 phi_v1_5; - s32 phi_v1_6; - s32 phi_t0_2; - s32 phi_v0_2; - s32 phi_v1_7; - s32 phi_a1; - f32 phi_f8; - s32 phi_v1_8; - u32 phi_a1_2; - s32 phi_a1_3; - f32 phi_f16; - s32 phi_a3; - u32 phi_a0; - u8 phi_v1_9; - s8 phi_a2; - s32 phi_t0_3; - s32 phi_t0_4; + void *temp_v1_4; temp_t8 = (arg0 >> 0x1C) & 0xFF; - temp_t6 = (arg0 & 0xF000000) >> 0x18; + temp_t6 = (u32) (arg0 & 0x0F000000) >> 0x18; temp_a1 = temp_t6 & 0xFF; switch (temp_t8) { case 0: - func_800C284C(temp_t6 & 0xFF, arg0 & 0xFF, ((arg0 & 0xFF00) >> 8) & 0xFF, ((arg0 & 0xFF0000) >> 0xD) & 0xFFFF); + func_800C284C(temp_t6 & 0xFF, arg0 & 0xFF, ((u32) (arg0 & 0xFF00) >> 8) & 0xFF, ((u32) (arg0 & 0xFF0000) >> 0xD) & 0xFFFF); return; case 1: - func_800C29B4(temp_t6 & 0xFF, ((arg0 & 0xFF0000) >> 0xD) & 0xFFFF); + func_800C29B4(temp_t6 & 0xFF, ((u32) (arg0 & 0xFF0000) >> 0xD) & 0xFFFF); return; case 2: temp_t8_2 = temp_t6 & 0xFF; temp_t4 = &D_80192CC6 + temp_t8_2; sp3C = temp_t8_2; temp_t1 = *temp_t4; - phi_v1 = 0; - phi_t3 = temp_t1; - if (temp_t1 > 0) { + var_v1 = 0; + var_t3 = temp_t1; + if ((s32) temp_t1 > 0) { temp_a0 = arg0 & 0xFF; sp48 = temp_a0; loop_6: - if (temp_a0 == *((temp_t8_2 * 0xA) + &D_80192CA8 + (phi_v1 * 2))) { - if (phi_v1 == 0) { - func_800C284C(unksp3F, unksp4B, ((arg0 & 0xFF00) >> 8) & 0xFF, ((arg0 & 0xFF0000) >> 0xD) & 0xFFFF); + if (temp_a0 == *((temp_t8_2 * 0xA) + &D_80192CA8 + (var_v1 * 2))) { + if (var_v1 == 0) { + func_800C284C(unksp3F, unksp4B, ((u32) (arg0 & 0xFF00) >> 8) & 0xFF, ((u32) (arg0 & 0xFF0000) >> 0xD) & 0xFFFF); return; } - /* Duplicate return node #76. Try simplifying control flow for better match */ + } else { + temp_t6_2 = (var_v1 + 1) & 0xFF; + var_v1 = temp_t6_2; + if (temp_t6_2 >= (s32) *(&D_80192CC6 + temp_a1)) { + var_v1 = 0; + goto block_11; + } + goto loop_6; + } + } else { +block_11: + var_t0 = temp_t1 & 0xFF; + if ((s32) var_t3 > 0) { + do { + if ((((u32) (arg0 & 0xFF00) >> 8) & 0xFF) >= (s32) ((sp3C * 0xA) + &D_80192CA8 + (var_v1 * 2))->unk1) { + var_t0 = var_v1 & 0xFF; + var_v1 = temp_t1 & 0xFF; + } + temp_t8_3 = (var_v1 + 1) & 0xFF; + var_v1 = temp_t8_3; + } while (temp_t8_3 < (s32) *(&D_80192CC6 + temp_a1)); + } + if ((var_t0 != var_t3) || (var_t0 == 0)) { + temp_a2 = (sp3C * 0xA) + &D_80192CA8; + if ((s32) var_t3 < 5) { + temp_t9 = temp_t1 + 1; + *temp_t4 = temp_t9; + var_t3 = temp_t9 & 0xFF; + } + var_v0 = (var_t3 - 1) & 0xFF; + var_v1_2 = var_v0; + if (var_t0 != var_v0) { + do { + temp_a1_2 = temp_a2 + (var_v0 * 2); + temp_a0_2 = temp_a2 + (var_v1_2 * 2); + temp_a0_2->unk1 = (u8) temp_a1_2->unk-1; + var_v0 = (var_v1_2 - 1) & 0xFF; + var_v1_2 = var_v0; + temp_a0_2->unk0 = (u8) temp_a1_2->unk-2; + } while (var_t0 != var_v0); + } + temp_v0 = temp_a2 + (var_t0 * 2); + temp_v0->unk1 = (s8) (((u32) (arg0 & 0xFF00) >> 8) & 0xFF); + temp_v0->unk0 = (s8) (arg0 & 0xFF); + } + if (var_t0 == 0) { + func_800C284C(unksp3F, arg0 & 0xFF, ((u32) (arg0 & 0xFF00) >> 8) & 0xFF, ((u32) (arg0 & 0xFF0000) >> 0xD) & 0xFFFF); return; } - temp_t6_2 = (phi_v1 + 1) & 0xFF; - phi_v1 = temp_t6_2; - if (temp_t6_2 >= *(&D_80192CC6 + temp_a1)) { - goto block_11; - } - goto loop_6; - } -block_11: - temp_t0 = temp_t1 & 0xFF; - phi_v1_2 = 0; - phi_t0 = temp_t0; - phi_t0_3 = temp_t0; - if (temp_t1 > 0) { - do { - phi_v1_3 = phi_v1_2; - if ((((arg0 & 0xFF00) >> 8) & 0xFF) >= ((sp3C * 0xA) + &D_80192CA8 + (phi_v1_2 * 2))->unk1) { - phi_v1_3 = temp_t1 & 0xFF; - phi_t0_3 = phi_v1_2 & 0xFF; - } - temp_t8_3 = (phi_v1_3 + 1) & 0xFF; - phi_v1_2 = temp_t8_3; - phi_t0 = phi_t0_3; - } while (temp_t8_3 < *(&D_80192CC6 + temp_a1)); - } - if ((phi_t0 != temp_t1) || (phi_t0 == 0)) { - temp_a2 = (sp3C * 0xA) + &D_80192CA8; - if (temp_t1 < 5) { - temp_t9 = temp_t1 + 1; - *temp_t4 = temp_t9; - phi_t3 = temp_t9 & 0xFF; - } - temp_v0 = (phi_t3 - 1) & 0xFF; - phi_v0 = temp_v0; - phi_v1_4 = temp_v0; - if (phi_t0 != temp_v0) { - do { - temp_a1_2 = temp_a2 + (phi_v0 * 2); - temp_a0_2 = temp_a2 + (phi_v1_4 * 2); - temp_a0_2->unk1 = temp_a1_2->unk-1; - temp_v0_2 = (phi_v1_4 - 1) & 0xFF; - temp_a0_2->unk0 = temp_a1_2->unk-2; - phi_v0 = temp_v0_2; - phi_v1_4 = temp_v0_2; - } while (phi_t0 != temp_v0_2); - } - temp_v0_3 = temp_a2 + (phi_t0 * 2); - temp_v0_3->unk1 = ((arg0 & 0xFF00) >> 8) & 0xFF; - temp_v0_3->unk0 = arg0 & 0xFF; - } - if (phi_t0 == 0) { - func_800C284C(unksp3F, arg0 & 0xFF, ((arg0 & 0xFF00) >> 8) & 0xFF, ((arg0 & 0xFF0000) >> 0xD) & 0xFFFF); + default: return; } - default: - return; + break; case 3: temp_t8_4 = temp_t6 & 0xFF; temp_t4_2 = &D_80192CC6 + temp_t8_4; sp3C = temp_t8_4; temp_t1_2 = *temp_t4_2; - phi_v1_5 = 0; - phi_t0_2 = temp_t1_2; - phi_t0_4 = temp_t1_2; - if (temp_t1_2 > 0) { + var_v1_3 = 0; + var_t0_2 = temp_t1_2; + if ((s32) temp_t1_2 > 0) { do { - phi_v1_6 = phi_v1_5; - if ((arg0 & 0xFF) == *((temp_t8_4 * 0xA) + &D_80192CA8 + (phi_v1_5 * 2))) { - phi_v1_6 = temp_t1_2 & 0xFF; - phi_t0_4 = phi_v1_5 & 0xFF; + if ((arg0 & 0xFF) == *((temp_t8_4 * 0xA) + &D_80192CA8 + (var_v1_3 * 2))) { + var_t0_2 = var_v1_3 & 0xFF; + var_v1_3 = temp_t1_2 & 0xFF; } - temp_t8_5 = (phi_v1_6 + 1) & 0xFF; - phi_v1_5 = temp_t8_5; - phi_t0_2 = phi_t0_4; - } while (temp_t8_5 < *(&D_80192CC6 + temp_a1)); + temp_t8_5 = (var_v1_3 + 1) & 0xFF; + var_v1_3 = temp_t8_5; + } while (temp_t8_5 < (s32) *(&D_80192CC6 + temp_a1)); } - if (phi_t0_2 != temp_t1_2) { + if (var_t0_2 != temp_t1_2) { temp_a3 = temp_t1_2 - 1; - temp_v1 = phi_t0_2 & 0xFF; - phi_v1_7 = temp_v1; - if (phi_t0_2 < temp_a3) { + var_v1_4 = var_t0_2 & 0xFF; + if ((s32) var_t0_2 < temp_a3) { temp_a2_2 = (sp3C * 0xA) + &D_80192CA8; - phi_v0_2 = temp_v1; + var_v0_2 = var_v1_4; do { - temp_a1_3 = temp_a2_2 + (phi_v0_2 * 2); - temp_a0_3 = temp_a2_2 + (phi_v1_7 * 2); - temp_a0_3->unk1 = temp_a1_3->unk3; - temp_v0_4 = (phi_v1_7 + 1) & 0xFF; - temp_a0_3->unk0 = temp_a1_3->unk2; - phi_v0_2 = temp_v0_4; - phi_v1_7 = temp_v0_4; - } while (temp_v0_4 < temp_a3); + temp_a1_3 = temp_a2_2 + (var_v0_2 * 2); + temp_a0_3 = temp_a2_2 + (var_v1_4 * 2); + temp_a0_3->unk1 = (u8) temp_a1_3->unk3; + var_v0_2 = (var_v1_4 + 1) & 0xFF; + var_v1_4 = var_v0_2; + temp_a0_3->unk0 = (u8) temp_a1_3->unk2; + } while (var_v0_2 < temp_a3); } *temp_t4_2 = temp_t1_2 - 1; } - if ((phi_t0_2 == 0) && (temp_a3_2 = ((arg0 & 0xFF0000) >> 0xD) & 0xFFFF, sp4C = temp_a3_2, sp34 = temp_t4_2, func_800C29B4(unksp3F, temp_a3_2 & 0xFFFF), (*temp_t4_2 != 0))) { - temp_v0_5 = (sp3C * 0xA) + &D_80192CA8; - func_800C284C(sp3C, temp_v0_5->unk0, temp_v0_5->unk1, temp_a3_2); - return; - } - /* Duplicate return node #76. Try simplifying control flow for better match */ - return; - case 4: - temp_t9_2 = (arg0 & 0xFF0000) >> 0xF; - temp_v1_2 = temp_t9_2 & 0xFF; - phi_a1 = temp_t9_2 & 0xFF; - if (temp_v1_2 == 0) { - phi_a1 = (temp_v1_2 + 1) & 0xFF; - } - temp_v0_6 = &D_801930D0 + ((temp_t6 & 0xFF) * 0x24C); - temp_f2 = temp_v0_6->unk0; - temp_f0 = (arg0 & 0xFF) / 127.0f; - temp_v0_6->unk4 = temp_f0; - if (temp_f2 != temp_f0) { - temp_f8 = phi_a1; - phi_f8 = temp_f8; - if (phi_a1 < 0) { - phi_f8 = temp_f8 + 4294967296.0f; + if (var_t0_2 == 0) { + temp_a3_2 = ((u32) (arg0 & 0xFF0000) >> 0xD) & 0xFFFF; + sp4C = temp_a3_2; + sp34 = temp_t4_2; + func_800C29B4(unksp3F, temp_a3_2 & 0xFFFF); + if (*temp_t4_2 != 0) { + temp_v0_2 = (sp3C * 0xA) + &D_80192CA8; + func_800C284C((u8) sp3C, temp_v0_2->unk0, temp_v0_2->unk1, temp_a3_2); + return; } - temp_v0_6->unkC = phi_a1; - temp_v0_6->unk8 = (temp_f2 - temp_v0_6->unk4) / phi_f8; + } + break; + case 4: + temp_t9_2 = (u32) (arg0 & 0xFF0000) >> 0xF; + temp_v1 = temp_t9_2 & 0xFF; + var_a1 = temp_t9_2 & 0xFF; + if (temp_v1 == 0) { + var_a1 = (temp_v1 + 1) & 0xFF; + } + temp_v0_3 = &D_801930D0 + ((temp_t6 & 0xFF) * 0x24C); + temp_f2 = temp_v0_3->unk0; + temp_f0 = (f32) (arg0 & 0xFF) / 127.0f; + temp_v0_3->unk4 = temp_f0; + if (temp_f2 != temp_f0) { + var_f8 = (f32) var_a1; + if (var_a1 < 0) { + var_f8 += 4294967296.0f; + } + temp_v0_3->unkC = var_a1; + temp_v0_3->unk8 = (f32) ((temp_f2 - temp_v0_3->unk4) / var_f8); return; } - /* Duplicate return node #76. Try simplifying control flow for better match */ - return; + break; case 5: - temp_t7 = (arg0 & 0xFF0000) >> 0xF; - temp_v1_3 = temp_t7 & 0xFF; - phi_a1_2 = temp_t7 & 0xFF; - if (temp_v1_3 == 0) { - phi_a1_2 = (temp_v1_3 + 1) & 0xFF; + temp_t7 = (u32) (arg0 & 0xFF0000) >> 0xF; + temp_v1_2 = temp_t7 & 0xFF; + var_a1_2 = temp_t7 & 0xFF; + if (temp_v1_2 == 0) { + var_a1_2 = (temp_v1_2 + 1) & 0xFF; } + var_v1_5 = 0; temp_a2_3 = temp_t6 & 0xFF; - temp_f0_2 = (arg0 & 0xFFFF) / 1000.0f; - phi_v1_8 = 0; + temp_f0_2 = (f32) (arg0 & 0xFFFF) / 1000.0f; do { - temp_v0_7 = (temp_a2_3 * 0x24C) + &D_801930D0 + (phi_v1_8 << 5); - temp_t8_6 = (phi_v1_8 + 1) & 0xFF; - temp_v0_7->unk58 = temp_f0_2; - temp_v0_7->unk60 = phi_a1_2; - temp_v0_7->unk5C = (temp_v0_7->unk54 - temp_f0_2) / phi_a1_2; - phi_v1_8 = temp_t8_6; - } while (temp_t8_6 < 0x10); + temp_v0_4 = (temp_a2_3 * 0x24C) + &D_801930D0 + (var_v1_5 << 5); + temp_t8_6 = (var_v1_5 + 1) & 0xFF; + temp_f4 = temp_v0_4->unk54 - temp_f0_2; + temp_at = temp_t8_6 < 0x10; + var_v1_5 = temp_t8_6; + temp_v0_4->unk58 = temp_f0_2; + temp_v0_4->unk60 = (s16) var_a1_2; + temp_v0_4->unk5C = (f32) (temp_f4 / (f32) var_a1_2); + } while (temp_at != 0); (&D_801930D0 + (temp_a2_3 * 0x24C))->unk244 = 0xFFFF; return; case 6: - temp_t8_7 = (arg0 & 0xFF0000) >> 0xF; - temp_v1_4 = temp_t8_7 & 0xFF; - phi_a1_3 = temp_t8_7 & 0xFF; - if (temp_v1_4 == 0) { - phi_a1_3 = (temp_v1_4 + 1) & 0xFF; + temp_t8_7 = (u32) (arg0 & 0xFF0000) >> 0xF; + temp_v1_3 = temp_t8_7 & 0xFF; + var_a1_3 = temp_t8_7 & 0xFF; + if (temp_v1_3 == 0) { + var_a1_3 = (temp_v1_3 + 1) & 0xFF; } temp_a3_3 = temp_t6 & 0xFF; - temp_a2_4 = ((arg0 & 0xF00) >> 8) & 0xFF; + temp_a2_4 = ((u32) (arg0 & 0xF00) >> 8) & 0xFF; temp_a0_4 = temp_a2_4 << 5; - temp_v0_8 = &D_801930D0 + (temp_a3_3 * 0x24C) + temp_a0_4; - temp_f0_3 = (arg0 & 0xFF) / 127.0f; - temp_v0_8->unk48 = temp_f0_3; - if (temp_v0_8->unk44 != temp_f0_3) { - temp_v0_9 = &D_801930D0 + (temp_a3_3 * 0x24C); - temp_v1_5 = temp_v0_9 + temp_a0_4; - temp_f16 = phi_a1_3; - phi_f16 = temp_f16; - if (phi_a1_3 < 0) { - phi_f16 = temp_f16 + 4294967296.0f; + temp_v0_5 = &D_801930D0 + (temp_a3_3 * 0x24C) + temp_a0_4; + temp_f0_3 = (f32) (arg0 & 0xFF) / 127.0f; + temp_v0_5->unk48 = temp_f0_3; + if (temp_v0_5->unk44 != temp_f0_3) { + temp_v0_6 = &D_801930D0 + (temp_a3_3 * 0x24C); + temp_v1_4 = temp_v0_6 + temp_a0_4; + var_f16 = (f32) var_a1_3; + if (var_a1_3 < 0) { + var_f16 += 4294967296.0f; } - temp_v1_5->unk50 = phi_a1_3; - temp_v1_5->unk4C = (temp_v1_5->unk44 - temp_v1_5->unk48) / phi_f16; - temp_v0_9->unk244 = temp_v0_9->unk244 | (1 << temp_a2_4); + temp_v1_4->unk50 = var_a1_3; + temp_v1_4->unk4C = (f32) ((temp_v1_4->unk44 - temp_v1_4->unk48) / var_f16); + temp_v0_6->unk244 = (u16) (temp_v0_6->unk244 | (1 << temp_a2_4)); return; } - /* Duplicate return node #76. Try simplifying control flow for better match */ - return; + break; case 7: - func_800CBBE8(((temp_t6 & 0xFF) << 0x10) | 0x46000000 | ((((arg0 & 0xFF0000) >> 0x10) & 0xFF) << 8), arg0); + func_800CBBE8(((temp_t6 & 0xFF) << 0x10) | 0x46000000 | ((((u32) (arg0 & 0xFF0000) >> 0x10) & 0xFF) << 8), (s8) arg0); return; case 8: - temp_v0_10 = temp_t6 & 0xFF; - temp_a2_5 = ((arg0 & 0xF00) >> 8) & 0xFF; - if (((&D_801930D0 + (temp_v0_10 * 0x24C))->unk24A & (1 << temp_a2_5)) == 0) { - func_800CBBE8(((temp_v0_10 & 0xFF) << 0x10) | 0x6000000 | ((temp_a2_5 & 0xFF) << 8) | (((arg0 & 0xFF0000) >> 0x10) & 0xFF), arg0, temp_a2_5); + temp_v0_7 = temp_t6 & 0xFF; + temp_a2_5 = ((u32) (arg0 & 0xF00) >> 8) & 0xFF; + if (!((&D_801930D0 + (temp_v0_7 * 0x24C))->unk24A & (1 << temp_a2_5))) { + func_800CBBE8(((temp_v0_7 & 0xFF) << 0x10) | 0x06000000 | ((temp_a2_5 & 0xFF) << 8) | (((u32) (arg0 & 0xFF0000) >> 0x10) & 0xFF), (s8) arg0, temp_a2_5); return; } - /* Duplicate return node #76. Try simplifying control flow for better match */ - return; + break; case 9: (&D_801930D0 + ((temp_t6 & 0xFF) * 0x24C))->unk24A = arg0; return; case 10: - sp48 = ((temp_t6 & 0xFF) << 0x10) | 0x8000000; - phi_a3 = arg0 & 0xFFFF; - phi_a0 = 1; - phi_v1_9 = 0; + var_a0 = 1; + sp48 = ((temp_t6 & 0xFF) << 0x10) | 0x08000000; + var_a3 = arg0 & 0xFFFF; + var_v1_6 = 0; do { - if ((phi_a3 & phi_a0) != 0) { - phi_a2 = 1; + if (var_a3 & var_a0) { + var_a2 = 1; } else { - phi_a2 = 0; + var_a2 = 0; } - sp4C = phi_a0; - sp5B = phi_v1_9; - sp44 = phi_a3; - func_800CBBE8(sp48 | ((phi_v1_9 & 0xFF) << 8), phi_a2, phi_a2, phi_a3); - temp_t8_8 = (phi_v1_9 + 1) & 0xFF; - phi_a0 = (phi_a0 * 2) & 0xFFFF; - phi_v1_9 = temp_t8_8; - } while (temp_t8_8 < 0x10); + sp4C = var_a0; + sp5B = var_v1_6; + sp44 = var_a3; + func_800CBBE8(sp48 | ((var_v1_6 & 0xFF) << 8), var_a2, var_a2, var_a3); + temp_t8_8 = (var_v1_6 + 1) & 0xFF; + temp_at_2 = temp_t8_8 < 0x10; + var_v1_6 = (u8) temp_t8_8; + var_a0 = (var_a0 * 2) & 0xFFFF; + } while (temp_at_2 != 0); return; case 11: - (&D_801930D0 + ((temp_t6 & 0xFF) * 0x24C))->unk14 = arg0; + (&D_801930D0 + ((temp_t6 & 0xFF) * 0x24C))->unk14 = (s32) arg0; return; case 12: - if ((((arg0 & 0xF00000) >> 0x14) & 0xFF) != 0xF) { - temp_v0_11 = &D_801930D0 + ((temp_t6 & 0xFF) * 0x24C); - temp_t0_2 = temp_v0_11->unk41; - temp_v0_11->unk41 = temp_t0_2 + 1; - if (temp_t0_2 < 5) { - (temp_v0_11 + (temp_t0_2 * 4))->unk2C = arg0; - temp_v0_11->unk40 = 2; + if ((((u32) (arg0 & 0xF00000) >> 0x14) & 0xFF) != 0xF) { + temp_v0_8 = &D_801930D0 + ((temp_t6 & 0xFF) * 0x24C); + temp_t0 = temp_v0_8->unk41; + temp_v0_8->unk41 = (u8) (temp_t0 + 1); + if ((s32) temp_t0 < 5) { + (temp_v0_8 + (temp_t0 * 4))->unk2C = (s32) arg0; + temp_v0_8->unk40 = 2; return; } - /* Duplicate return node #76. Try simplifying control flow for better match */ + } else { + (&D_801930D0 + ((temp_t6 & 0xFF) * 0x24C))->unk41 = 0; return; } - (&D_801930D0 + ((temp_t6 & 0xFF) * 0x24C))->unk41 = 0; - return; + break; case 14: - temp_t7_2 = ((arg0 & 0xF00) >> 8) & 0xFF; - if (temp_t7_2 != 0) { - if (temp_t7_2 != 1) { - return; - } + temp_t7_2 = ((u32) (arg0 & 0xF00) >> 8) & 0xFF; + switch (temp_t7_2) { /* switch 1; irregular */ + case 0: /* switch 1 */ + func_800CBBB8(0xF0000000, *(&D_800EA1F0 + (arg0 & 0xFF))); + return; + case 1: /* switch 1 */ D_800EA1EC = arg0 & 1; return; } - func_800CBBB8(0xF0000000, *(&D_800EA1F0 + (arg0 & 0xFF))); - return; + break; case 15: - temp_t6_3 = (arg0 & 0xFF00) >> 8; - D_800EA1C0 = temp_t6_3; + temp_t6_3 = (u32) (arg0 & 0xFF00) >> 8; + D_800EA1C0 = (s8) temp_t6_3; temp_a0_5 = arg0 & 0xFF; sp48 = temp_a0_5; sp4C = temp_t6_3; func_800C13FC(temp_a0_5, temp_a1); - *D_800EA1F4 = sp48; - func_800CBBE8(0x46020000, sp4C); + *D_800EA1F4 = (s8) sp48; + func_800CBBE8(0x46020000, (s8) sp4C); func_800C5C40(); - /* Duplicate return node #76. Try simplifying control flow for better match */ - return; + break; } } #else @@ -1293,18 +1147,16 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3478.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c extern ? D_80193318; -extern u32 gSequencePlayers; -u16 func_800C3508(s32 arg0) { - ? sp-10; +u16 func_800C3508(s32 player) { s32 temp_t6; - temp_t6 = arg0 & 0xFF; - sp-10.unk10 = arg0; - if ((*(&gSequencePlayers + (temp_t6 * 0x148)) >> 0x1F) == 0) { - return 0xFFFF; + temp_t6 = player & 0xFF; + unksp-10.unk10 = player; + if (((u32) gSequencePlayers[temp_t6] >> 0x1F) == 0) { + return 0xFFFFU; } return *(&D_80193318 + (temp_t6 * 0x24C)); } @@ -1416,57 +1268,63 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C36C4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void func_800C3448(s32, s8, s32); /* extern */ -void func_800C36C4(s32, ?, ?, ?); /* extern */ -void func_800CBB88(s32, f32, s32); /* extern */ -void func_800CBBB8(s32, s32); /* extern */ +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C3448(s32, s8, s32); /* extern */ +? func_800C36C4(s32, ?, ?, ?); /* extern */ +? func_800CBB88(s32, f32, s32); /* extern */ +? func_800CBBB8(s32, s32); /* extern */ extern ? D_801930D0; -extern u32 gSequencePlayers; void func_800C3724(void) { - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f16; f32 temp_f2; - f32 temp_f6; - f32 temp_f8; + f32 var_f0; + f32 var_f0_2; + f32 var_f16; + f32 var_f6; + f32 var_f8; + s16 temp_t7_2; + s16 var_t0; s32 temp_a0; s32 temp_a0_2; s32 temp_a0_3; s32 temp_a1; s32 temp_a2; s32 temp_a2_2; - s32 temp_a2_3; s32 temp_a3; s32 temp_a3_2; + s32 temp_at; s32 temp_lo; s32 temp_s1; s32 temp_t2_3; s32 temp_t3; s32 temp_t4_2; - s32 temp_t5_3; - s32 temp_t7_2; + s32 temp_t5_2; + s32 temp_t7; s32 temp_t7_3; s32 temp_t9_2; s32 temp_v0_7; s32 temp_v1; + s32 var_a2; + s32 var_s0; + s32 var_s0_2; + s32 var_s2; + s32 var_s2_2; + s32 var_s5; s8 temp_a1_3; + struct SequencePlayer *temp_a1_2; u16 temp_t2_2; u16 temp_t4; u16 temp_t5; - u16 temp_t7; u16 temp_v0; u16 temp_v0_2; u16 temp_v0_3; u16 temp_v1_2; u16 temp_v1_4; - u32 temp_t5_2; + u32 temp_t5_3; u32 temp_t9; u8 temp_t2; u8 temp_v0_6; u8 temp_v1_6; - void *temp_a1_2; void *temp_s0; void *temp_s0_2; void *temp_s0_3; @@ -1475,239 +1333,215 @@ void func_800C3724(void) { void *temp_v0_5; void *temp_v1_3; void *temp_v1_5; - s32 phi_s5; - s32 phi_s2; - f32 phi_f0; - f32 phi_f6; - s32 phi_a2; - s32 phi_a2_2; - f32 phi_f0_2; - s32 phi_t0; - f32 phi_f8; - s32 phi_s0; - s32 phi_s0_2; - s32 phi_s2_2; - s32 phi_v1; - f32 phi_f16; - phi_s5 = 0; + var_s5 = 0; do { - temp_s3 = &D_801930D0 + (phi_s5 * 0x24C); + temp_s3 = &D_801930D0 + (var_s5 * 0x24C); if (temp_s3->unk12 != 0) { - phi_s2 = 0; - phi_f0 = 1.0f; + var_f0 = 1.0f; + var_s2 = 0; do { - temp_t2 = (&D_801930D0 + (phi_s5 * 0x24C) + phi_s2)->unkE; - temp_f6 = temp_t2; - phi_f6 = temp_f6; - if (temp_t2 < 0) { - phi_f6 = temp_f6 + 4294967296.0f; + temp_t2 = (&D_801930D0 + (var_s5 * 0x24C) + var_s2)->unkE; + var_f6 = (f32) temp_t2; + if ((s32) temp_t2 < 0) { + var_f6 += 4294967296.0f; } - temp_t3 = (phi_s2 + 1) & 0xFF; - temp_f0 = phi_f0 * (phi_f6 / 127.0f); - phi_s2 = temp_t3; - phi_f0 = temp_f0; - } while (temp_t3 < 3); - func_800C3448((temp_s3->unk11 << 0x10) | 0x40000000 | (phi_s5 << 0x18) | ((temp_f0 * 127.0f) & 0xFF)); - temp_s3->unk12 = 0; + temp_t3 = (var_s2 + 1) & 0xFF; + temp_at = temp_t3 < 3; + var_s2 = temp_t3; + var_f0 *= var_f6 / 127.0f; + } while (temp_at != 0); + func_800C3448((temp_s3->unk11 << 0x10) | 0x40000000 | (var_s5 << 0x18) | ((u32) (var_f0 * 127.0f) & 0xFF)); + temp_s3->unk12 = 0U; } temp_v0 = temp_s3->unkC; temp_t4 = temp_v0 - 1; if (temp_v0 != 0) { temp_s3->unkC = temp_t4; - if ((temp_t4 & 0xFFFF) != 0) { - temp_s3->unk0 = temp_s3->unk0 - temp_s3->unk8; + if (temp_t4 & 0xFFFF) { + temp_s3->unk0 = (f32) (temp_s3->unk0 - temp_s3->unk8); } else { - temp_s3->unk0 = temp_s3->unk4; + temp_s3->unk0 = (f32) temp_s3->unk4; } - func_800CBB88(((phi_s5 & 0xFF) << 0x10) | 0x41000000, temp_s3->unk0); + func_800CBB88(((var_s5 & 0xFF) << 0x10) | 0x41000000, temp_s3->unk0); } temp_a1 = temp_s3->unk14; if (temp_a1 != 0) { - temp_t9 = (temp_a1 & 0xFF0000) >> 0xF; + temp_t9 = (u32) (temp_a1 & 0xFF0000) >> 0xF; temp_a0 = temp_a1 & 0xFFF; temp_a3 = temp_t9 & 0xFF; - temp_a2 = temp_a0 & 0xFFFF; - phi_a2 = temp_a2; - phi_t0 = temp_t9 & 0xFF; - phi_a2 = temp_a2; + var_t0 = temp_t9 & 0xFF; + var_a2 = temp_a0 & 0xFFFF; if (temp_a3 == 0) { - phi_t0 = (temp_a3 + 1) & 0xFF; + var_t0 = (temp_a3 + 1) & 0xFF; } - temp_a1_2 = (phi_s5 * 0x148) + &gSequencePlayers; - if ((temp_a1_2->unk0 >> 0x1F) != 0) { - temp_t9_2 = ((temp_a1 & 0xF000) >> 0xC) & 0xFF; - temp_lo = temp_a1_2->unk8 / 48; + temp_a1_2 = &gSequencePlayers[var_s5]; + if (((u32) temp_a1_2->unk0 >> 0x1F) != 0) { + temp_t9_2 = ((u32) (temp_a1 & 0xF000) >> 0xC) & 0xFF; + temp_lo = (s32) temp_a1_2->tempo / 48; temp_a3_2 = temp_lo & 0xFFFF; if (temp_t9_2 != 1) { temp_v1 = temp_a0 & 0xFFFF; - if (temp_t9_2 != 2) { - if (temp_t9_2 != 3) { - if (temp_t9_2 != 4) { - - } else { - temp_v0_2 = temp_s3->unk18; - phi_a2 = temp_a3_2 & 0xFFFF; - if (temp_v0_2 != 0) { - phi_a2 = temp_v0_2 & 0xFFFF; - } - } - } else { - temp_f16 = temp_a3_2; - phi_f16 = temp_f16; - if (temp_a3_2 < 0) { - phi_f16 = temp_f16 + 4294967296.0f; - } - phi_a2 = (phi_f16 * ((temp_a0 & 0xFFFF) / 100.0f)) & 0xFFFF; + switch (temp_t9_2) { /* switch 1; irregular */ + case 2: /* switch 1 */ + if (temp_v1 < temp_a3_2) { + var_a2 = (temp_a3_2 - temp_v1) & 0xFFFF; } - } else if (temp_v1 < temp_a3_2) { - phi_a2 = (temp_a3_2 - temp_v1) & 0xFFFF; + break; + case 3: /* switch 1 */ + var_f16 = (f32) temp_a3_2; + if (temp_a3_2 < 0) { + var_f16 += 4294967296.0f; + } + var_a2 = (u32) (var_f16 * ((f32) (temp_a0 & 0xFFFF) / 100.0f)) & 0xFFFF; + break; + case 4: /* switch 1 */ + temp_v0_2 = temp_s3->unk18; + var_a2 = temp_a3_2 & 0xFFFF; + if (temp_v0_2 != 0) { + var_a2 = temp_v0_2 & 0xFFFF; + } + break; } } else { - phi_a2 = (temp_a0 + temp_a3_2) & 0xFFFF; + var_a2 = (temp_a0 + temp_a3_2) & 0xFFFF; } - temp_f2 = temp_lo; - phi_a2_2 = phi_a2; - if (phi_a2 >= 0x12D) { - phi_a2_2 = 0x12C; + temp_f2 = (f32) temp_lo; + if (var_a2 >= 0x12D) { + var_a2 = 0x12C; } if (temp_s3->unk18 == 0) { - temp_s3->unk18 = temp_a3_2; + temp_s3->unk18 = (u16) temp_a3_2; } - temp_f0_2 = phi_a2_2; - phi_f0_2 = temp_f0_2; - if (phi_a2_2 < 0) { - phi_f0_2 = temp_f0_2 + 4294967296.0f; + var_f0_2 = (f32) var_a2; + if (var_a2 < 0) { + var_f0_2 += 4294967296.0f; } - temp_s3->unk20 = phi_f0_2; + temp_s3->unk20 = var_f0_2; temp_s3->unk1C = temp_f2; - temp_f8 = phi_t0; - phi_f8 = temp_f8; - if (phi_t0 < 0) { - phi_f8 = temp_f8 + 4294967296.0f; + var_f8 = (f32) var_t0; + if (var_t0 < 0) { + var_f8 += 4294967296.0f; } - temp_s3->unk28 = phi_t0; - temp_s3->unk24 = (temp_f2 - phi_f0_2) / phi_f8; + temp_s3->unk28 = var_t0; + temp_s3->unk24 = (f32) ((temp_f2 - var_f0_2) / var_f8); } temp_s3->unk14 = 0; } - temp_v0_3 = temp_s3->unk28; - temp_t7 = temp_v0_3 - 1; + temp_v0_3 = (u16) temp_s3->unk28; + temp_t7_2 = temp_v0_3 - 1; if (temp_v0_3 != 0) { - temp_s3->unk28 = temp_t7; - if ((temp_t7 & 0xFFFF) != 0) { - temp_s3->unk1C = temp_s3->unk1C - temp_s3->unk24; + temp_s3->unk28 = temp_t7_2; + if (temp_t7_2 & 0xFFFF) { + temp_s3->unk1C = (f32) (temp_s3->unk1C - temp_s3->unk24); } else { - temp_s3->unk1C = temp_s3->unk20; + temp_s3->unk1C = (f32) temp_s3->unk20; } - func_800CBBB8(((phi_s5 & 0xFF) << 0x10) | 0x47000000, temp_s3->unk1C); + func_800CBBB8(((var_s5 & 0xFF) << 0x10) | 0x47000000, (s32) temp_s3->unk1C); } if (temp_s3->unk246 != 0) { - phi_s0 = 0; + var_s0 = 0; do { - temp_a0_2 = phi_s0 << 5; - temp_v0_4 = &D_801930D0 + (phi_s5 * 0x24C) + temp_a0_2; + temp_a0_2 = var_s0 << 5; + temp_v0_4 = &D_801930D0 + (var_s5 * 0x24C) + temp_a0_2; temp_v1_2 = temp_v0_4->unk50; temp_t5 = temp_v1_2 - 1; if (temp_v1_2 != 0) { temp_v0_4->unk50 = temp_t5; - temp_a2_2 = ((phi_s5 & 0xFF) << 0x10) | 0x1000000; - if ((temp_t5 & 0xFFFF) != 0) { - temp_v0_4->unk44 = temp_v0_4->unk44 - temp_v0_4->unk4C; + temp_a2 = ((var_s5 & 0xFF) << 0x10) | 0x01000000; + if (temp_t5 & 0xFFFF) { + temp_v0_4->unk44 = (f32) (temp_v0_4->unk44 - temp_v0_4->unk4C); } else { temp_v1_3 = temp_s3 + temp_a0_2; - temp_v1_3->unk44 = temp_v1_3->unk48; - temp_s3->unk246 = temp_s3->unk246 ^ (1 << phi_s0); + temp_v1_3->unk44 = (f32) temp_v1_3->unk48; + temp_s3->unk246 = (u16) (temp_s3->unk246 ^ (1 << var_s0)); } - func_800CBB88(temp_a2_2 | ((phi_s0 & 0xFF) << 8), temp_v0_4->unk44, temp_a2_2); + func_800CBB88(temp_a2 | ((var_s0 & 0xFF) << 8), temp_v0_4->unk44, temp_a2); } - temp_t7_2 = (phi_s0 + 1) & 0xFF; - phi_s0 = temp_t7_2; - } while (temp_t7_2 < 0x10); + temp_t7_3 = (var_s0 + 1) & 0xFF; + var_s0 = temp_t7_3; + } while (temp_t7_3 < 0x10); } if (temp_s3->unk244 != 0) { - phi_s0_2 = 0; + var_s0_2 = 0; do { - temp_a0_3 = phi_s0_2 << 5; - temp_v0_5 = &D_801930D0 + (phi_s5 * 0x24C) + temp_a0_3; + temp_a0_3 = var_s0_2 << 5; + temp_v0_5 = &D_801930D0 + (var_s5 * 0x24C) + temp_a0_3; temp_v1_4 = temp_v0_5->unk60; temp_t2_2 = temp_v1_4 - 1; if (temp_v1_4 != 0) { temp_v0_5->unk60 = temp_t2_2; - temp_a2_3 = ((phi_s5 & 0xFF) << 0x10) | 0x4000000; - if ((temp_t2_2 & 0xFFFF) != 0) { - temp_v0_5->unk54 = temp_v0_5->unk54 - temp_v0_5->unk5C; + temp_a2_2 = ((var_s5 & 0xFF) << 0x10) | 0x04000000; + if (temp_t2_2 & 0xFFFF) { + temp_v0_5->unk54 = (f32) (temp_v0_5->unk54 - temp_v0_5->unk5C); } else { temp_v1_5 = temp_s3 + temp_a0_3; - temp_v1_5->unk54 = temp_v1_5->unk58; - temp_s3->unk244 = temp_s3->unk244 ^ (1 << phi_s0_2); + temp_v1_5->unk54 = (f32) temp_v1_5->unk58; + temp_s3->unk244 = (u16) (temp_s3->unk244 ^ (1 << var_s0_2)); } - func_800CBB88(temp_a2_3 | ((phi_s0_2 & 0xFF) << 8), temp_v0_5->unk54, temp_a2_3); + func_800CBB88(temp_a2_2 | ((var_s0_2 & 0xFF) << 8), temp_v0_5->unk54, temp_a2_2); } - temp_t4_2 = (phi_s0_2 + 1) & 0xFF; - phi_s0_2 = temp_t4_2; + temp_t4_2 = (var_s0_2 + 1) & 0xFF; + var_s0_2 = temp_t4_2; } while (temp_t4_2 < 0x10); } temp_v0_6 = temp_s3->unk41; if (temp_v0_6 != 0) { temp_v1_6 = temp_s3->unk40; if (temp_v1_6 != 0) { - temp_s3->unk40 = temp_v1_6 - 1; + temp_s3->unk40 = (u8) (temp_v1_6 - 1); } else { - phi_s2_2 = 0; - if ((*(&gSequencePlayers + (phi_s5 * 0x148)) >> 0x1F) == 0) { - phi_v1 = temp_v0_6; - if (temp_v0_6 > 0) { + var_s2_2 = 0; + if (((u32) gSequencePlayers[var_s5].unk0 >> 0x1F) == 0) { + if ((s32) temp_v0_6 > 0) { do { - temp_v0_7 = (&D_801930D0 + (phi_s5 * 0x24C) + (phi_s2_2 * 4))->unk2C; - temp_t5_2 = ((temp_v0_7 & 0xF00000) >> 0x14) & 0xFF; + temp_v0_7 = (&D_801930D0 + (var_s5 * 0x24C) + (var_s2_2 * 4))->unk2C; + temp_t5_3 = ((u32) (temp_v0_7 & 0xF00000) >> 0x14) & 0xFF; temp_t2_3 = temp_v0_7 & 0xFF; - temp_s1 = ((temp_v0_7 & 0xF0000) >> 0x10) & 0xFF; - temp_a1_3 = ((temp_v0_7 & 0xFF00) >> 8) & 0xFF; - switch (temp_t5_2) { + temp_s1 = ((u32) (temp_v0_7 & 0xF0000) >> 0x10) & 0xFF; + temp_a1_3 = ((u32) (temp_v0_7 & 0xFF00) >> 8) & 0xFF; + switch (temp_t5_3) { case 0: temp_s0 = &D_801930D0 + (temp_s1 * 0x24C); temp_s0->unk12 = 1; temp_s0->unkF = 0x7F; -block_76: - phi_v1 = temp_s3->unk41; break; case 1: - func_800C3448(temp_s3->unk248 | 0x30000000 | (phi_s5 << 0x18), temp_a1_3, temp_t2_3); - goto block_76; + func_800C3448(temp_s3->unk248 | 0x30000000 | (var_s5 << 0x18), temp_a1_3, temp_t2_3); + break; case 2: temp_s0_2 = &D_801930D0 + (temp_s1 * 0x24C); func_800C3448(temp_s0_2->unk248 | (temp_s1 << 0x18) | 0x10000, temp_a1_3, temp_t2_3); temp_s0_2->unk12 = 1; temp_s0_2->unkF = 0x7F; - goto block_76; + break; case 3: func_800C3448((temp_s1 << 0x18) | 0xB0003000 | (temp_a1_3 << 0x10) | temp_t2_3, temp_a1_3, temp_t2_3); - goto block_76; + break; case 4: func_800C3448((temp_s1 << 0x18) | 0xB0004000 | (temp_t2_3 << 0x10), temp_a1_3, temp_t2_3); - goto block_76; + break; case 5: temp_s0_3 = &D_801930D0 + (temp_s1 * 0x24C); func_800C3448((temp_s0_3->unk42 << 0x10) | (temp_s1 << 0x18) | (temp_v0_7 & 0xFFFF), temp_a1_3, temp_t2_3); func_800C36C4(temp_s1 & 0xFF, 1, 0x7F, 0); - temp_s0_3->unk42 = 0; - goto block_76; + temp_s0_3->unk42 = 0U; + break; case 6: temp_s3->unk42 = temp_a1_3; - goto block_76; + break; } - temp_t5_3 = (phi_s2_2 + 1) & 0xFF; - phi_s2_2 = temp_t5_3; - } while (temp_t5_3 < phi_v1); + temp_t5_2 = (var_s2_2 + 1) & 0xFF; + var_s2_2 = temp_t5_2; + } while (temp_t5_2 < (s32) temp_s3->unk41); } - temp_s3->unk41 = 0; + temp_s3->unk41 = 0U; } } } - temp_t7_3 = (phi_s5 + 1) & 0xFF; - phi_s5 = temp_t7_3; - } while (temp_t7_3 < 3); + temp_t7 = (var_s5 + 1) & 0xFF; + var_s5 = temp_t7; + } while (temp_t7 < 3); } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3724.s") @@ -1783,31 +1617,19 @@ void func_800C400C(void) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C400C.s") #endif -#ifdef MIPS_TO_C -UNUSED void func_800C4084(s32 arg0) { - s32 temp_at; - s32 temp_t1; - s32 var_a0; - s32 var_v0; +// Appears to be an unused combo of sound_banks_enable and sound_banks_disable +void func_800C4084(u16 bankMask) { + u8 bank; - unksp-10.unk10 = arg0; - var_a0 = arg0 & 0xFFFF; - var_v0 = 0; - do { - if ((var_a0 & 1) != 0) { - *(&D_80192C3C + var_v0) = 1; + for (bank = 0; bank < SOUND_BANK_COUNT; bank++) { + if (bankMask & 1) { + sSoundBankDisabled[bank] = TRUE; } else { - *(&D_80192C3C + var_v0) = 0; + sSoundBankDisabled[bank] = FALSE; } - temp_t1 = (var_v0 + 1) & 0xFF; - temp_at = temp_t1 < 6; - var_v0 = temp_t1; - var_a0 = (var_a0 >> 1) & 0xFFFF; - } while (temp_at != 0); + bankMask = bankMask >> 1; + } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4084.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -1830,102 +1652,77 @@ void func_800C40F0(s32 arg0) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C40F0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern u8 D_800EA1B8; -extern ? D_8018FC20; -extern ? D_80192C3C; +void play_sound(u32 soundBits, f32 *position, u8 arg2, f32 *arg3, f32 *arg4, u8 *arg5) { + u8 bank; + struct Unk_8018FC20 *temp_v0; -void play_sound(u32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { - void *temp_v0; - - if (*(&D_80192C3C + ((arg0 >> 0x1C) & 0xFF)) == 0) { - temp_v0 = (D_800EA1B8 * 0x18) + &D_8018FC20; - temp_v0->unk0 = arg0; - temp_v0->unk4 = arg1; - temp_v0->unk8 = arg2 & 0xFF; - temp_v0->unkC = arg3; + bank = soundBits >> 0x1C; + if (sSoundBankDisabled[bank] == FALSE) { + temp_v0 = &sSoundRequests[sSoundRequestCount]; + temp_v0->soundBits = soundBits; + temp_v0->position = position; + temp_v0->cameraId = arg2; + temp_v0->unk0C = arg3; temp_v0->unk10 = arg4; temp_v0->unk14 = arg5; - D_800EA1B8 = D_800EA1B8 + 1; + sSoundRequestCount += 1; } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/play_sound.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -extern ? D_8018FC20; -static u8 D_800EA1B8 = 0; /* const */ -static ? D_800EA1C8; /* unable to generate initializer; const */ +#ifdef NEEDS_RODATA +// data/rodata_audio_2.s +extern f32 D_800F3648;// = 100000.0f; +// jpt_800F364C +// data_0DD0A0_2_1_1.s +// Plain data +extern Vec3f D_800EA1C8;// = { 0.0f, 0.0f, 0.0f, }; -void func_800C41CC(s32 arg0, void *arg1) { - u32 temp_t6; - u8 temp_t8; - u8 temp_v0; - void *temp_a0; - void *temp_a0_2; - void *temp_a0_3; - void *temp_a0_4; - void *temp_v1; - u8 phi_v0; - s32 phi_v1; +void func_800C41CC(u8 arg0, struct Unk_80191420 *arg1) { + s32 found; + u8 soundId; + struct Unk_8018FC20 *sound; - unksp-10.unk10 = arg0; - temp_v0 = D_800EA1BC; - temp_t6 = arg0 & 0xFF; - phi_v0 = temp_v0; - if (D_800EA1B8 != temp_v0) { - do { - phi_v1 = 0; - switch (temp_t6) { - case 0: - if ((arg1->unk24 & 0xF0000000) == (*(&D_8018FC20 + (phi_v0 * 0x18)) & 0xF0000000)) { -block_18: - phi_v1 = 1; - } - break; - case 1: - temp_a0 = &D_8018FC20 + (phi_v0 * 0x18); - if (((arg1->unk24 & 0xF0000000) == (temp_a0->unk0 & 0xF0000000)) && (arg1->unk0 == temp_a0->unk4)) { - goto block_18; - } - break; - case 2: - if (arg1->unk0 == (&D_8018FC20 + (phi_v0 * 0x18))->unk4) { - goto block_18; - } - break; - case 3: - temp_a0_2 = &D_8018FC20 + (phi_v0 * 0x18); - if ((arg1->unk0 == temp_a0_2->unk4) && (arg1->unk24 == temp_a0_2->unk0)) { - goto block_18; - } - break; - case 4: - temp_a0_3 = &D_8018FC20 + (phi_v0 * 0x18); - if ((arg1->unkC == temp_a0_3->unk8) && (arg1->unk24 == temp_a0_3->unk0)) { - goto block_18; - } - break; - case 5: - if (arg1->unk24 == *(&D_8018FC20 + (phi_v0 * 0x18))) { - goto block_18; - } - break; + for (soundId = sNumProcessedSoundRequests; soundId != sSoundRequestCount; soundId++) { + found = FALSE; + sound = &sSoundRequests[soundId]; + switch (arg0) { + case 0: + if ((sound->soundBits & 0xF0000000) == (arg1->soundBits & 0xF0000000)) { + found = TRUE; } - if (phi_v1 != 0) { - temp_a0_4 = &D_8018FC20 + (phi_v0 * 0x18); - temp_v1 = temp_a0_4->unk4; - temp_a0_4->unk0 = 0; - if (&D_800EA1C8 != temp_v1) { - temp_v1->unk4 = 100000.0f; - } + break; + case 1: + if (((sound->soundBits & 0xF0000000) == (arg1->soundBits & 0xF0000000)) && (sound->position == arg1->unk00)) { + found = TRUE; } - temp_t8 = (phi_v0 + 1) & 0xFF; - phi_v0 = temp_t8; - } while (D_800EA1B8 != temp_t8); + break; + case 2: + if (sound->position == arg1->unk00) { + found = TRUE; + } + break; + case 3: + if ((sound->position == arg1->unk00) && (sound->soundBits == arg1->soundBits)) { + found = TRUE; + } + break; + case 4: + if ((sound->cameraId == arg1->cameraId) && (sound->soundBits == arg1->soundBits)) { + found = TRUE; + } + break; + case 5: + if (sound->soundBits == arg1->soundBits) { + found = TRUE; + } + break; + } + if (found) { + sound->soundBits = 0; + if (sound->position != D_800EA1C8) { + sound->position[1] = 100000.0f; + } + } } } #else @@ -1933,248 +1730,158 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C41CC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C40F0(u8, s32, s32 *, u8); // extern -extern ? D_800EA1A0; -extern u8 D_800EA1BC; -extern u8 D_800EA1C0; -extern ? D_800EA1C8; -extern f32 D_800F3664; -extern ? D_8018FC20; -extern ? D_80191420; -extern ? D_80192AA0; -extern ? D_80192AA8; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C40F0(u8, s32, struct Unk_8018FC20 *, u8); /* extern */ +static ? D_800EA1A0; /* unable to generate initializer; const */ +static u8 D_800EA1C0 = 0; /* const */ +static ? D_800EA1C8; /* unable to generate initializer; const */ +u8 sNumProcessedSoundRequests = 0; /* const */ void func_800C4398(void) { u8 sp4F; u8 sp4D; - s32 *sp48; + struct Unk_8018FC20 *sp48; u8 sp43; - s32 sp3C; - void *sp30; - s32 *temp_a2; + u32 sp3C; + struct Unk_80191420 *sp30; + f32 *temp_v0_3; s32 temp_a1; s32 temp_a1_2; - s32 temp_v0; - u8 *temp_a3_2; - u8 *temp_v0_3; + struct Unk_8018FC20 *var_a2; + struct Unk_80191420 *temp_s0; + struct Unk_80191420 *temp_s0_2; + struct Unk_80191420 *temp_s0_3; + struct Unk_80191420 *temp_t0; + struct Unk_80191420 *temp_t1; + struct Unk_80191420 *var_t1; + u32 temp_v0; + u32 var_t3; + u8 *temp_a3; + u8 *temp_v0_2; u8 temp_a0; u8 temp_a0_2; u8 temp_a1_3; - u8 temp_a3; u8 temp_t6; u8 temp_t6_2; - u8 temp_v0_2; u8 temp_v1; - u8 temp_v1_2; - u8 temp_v1_3; - void *temp_s0; - void *temp_s0_2; - void *temp_s0_3; - void *temp_t0; - void *temp_t1; - void *temp_v0_4; - s32 *phi_a2; - void *phi_t1; - u8 phi_v1; - s32 phi_t4; - u8 phi_a3; - s32 phi_t3; - u8 phi_t5; - s32 phi_t3_2; - u8 phi_v0; - u8 phi_t2; - u8 phi_v1_2; - s32 phi_t3_3; - u8 phi_a3_2; - u8 phi_v1_3; - s32 phi_ra; - u8 phi_v0_2; - s32 phi_t3_4; - u8 phi_t2_2; - s32 phi_ra_2; - u8 phi_t5_2; - u8 phi_v0_3; - s32 *phi_a2_2; - s32 *phi_a2_3; - void *phi_t1_2; - s32 phi_t4_2; - u8 phi_t5_3; - u8 phi_t2_3; - u8 phi_t2_4; - s32 phi_ra_3; + u8 var_a3; + u8 var_t2; + u8 var_t5; + u8 var_v0; + u8 var_v0_2; + u8 var_v1; - temp_a2 = (D_800EA1BC * 0x18) + &D_8018FC20; - temp_a1 = *temp_a2; - phi_a2 = temp_a2; - phi_ra_2 = 0xFF; - phi_a2_2 = temp_a2; - phi_ra_3 = 0xFF; - phi_ra = 0xFF; + var_a2 = &sSoundRequests[sNumProcessedSoundRequests]; + temp_a1 = var_a2->soundBits; if (temp_a1 != 0) { - temp_t6 = ((temp_a1 & 0xF0000000) >> 0x1C) & 0xFF; - temp_v1 = ((temp_t6 * 0x3C0) + &D_80191420)->unk2B; - phi_v1 = temp_v1; - phi_a3 = 0; - phi_t5 = temp_t6; - phi_t5_2 = temp_t6; - phi_v0_3 = temp_v1; - if ((temp_v1 != 0xFF) && (temp_v1 != 0)) { - phi_t1 = (temp_t6 * 0x3C0) + &D_80191420; - phi_t4 = 0x30; - phi_t3 = sp3C; - phi_t2_3 = sp43; - phi_t4_2 = 0x30; + temp_t6 = ((u32) (temp_a1 & 0xF0000000) >> 0x1C) & 0xFF; + var_v1 = sSoundBanks[temp_t6]->next; + var_t5 = temp_t6; + var_a3 = 0; + var_v0 = var_v1; + if ((var_v1 != 0xFF) && (var_v1 != 0)) { + var_t1 = sSoundBanks[temp_t6]; + var_t3 = sp3C; + var_t2 = sp43; loop_4: - temp_s0 = phi_t1 + (phi_v1 * phi_t4); - phi_t3_2 = phi_t3; - phi_t2 = phi_t2_3; - phi_v1_2 = phi_v1; - phi_t3_3 = phi_t3; - phi_v1_3 = phi_v1; - phi_ra = phi_ra_3; - phi_t3_4 = phi_t3; - phi_t2_2 = phi_t2_3; - phi_a2_3 = phi_a2; - phi_t1_2 = phi_t1; - phi_t4_2 = phi_t4; - phi_t5_3 = phi_t5; - phi_t2_4 = phi_t2_3; - phi_ra = phi_ra_3; - phi_a2_3 = phi_a2; - phi_t1_2 = phi_t1; - phi_t4_2 = phi_t4; - phi_t5_3 = phi_t5; - phi_ra = phi_ra_3; - phi_t4_2 = phi_t4; - if (phi_a2->unk4 == temp_s0->unk0) { - temp_a1_2 = phi_a2->unk0; - temp_v0 = temp_s0->unk24; - temp_a0 = *(&D_800EA1A0 + ((D_800EA1C0 * 6) + phi_t5)); + temp_s0 = &var_t1[var_v1]; + if (var_a2->position == temp_s0->unk00) { + temp_a1_2 = var_a2->soundBits; + temp_v0 = temp_s0->soundBits; + temp_a0 = *(&D_800EA1A0 + ((D_800EA1C0 * 6) + var_t5)); if (temp_a1_2 == temp_v0) { - temp_a3 = temp_a0 & 0xFF; - phi_v0 = temp_a3; - phi_a3_2 = temp_a3; + var_a3 = temp_a0 & 0xFF; + var_v0_2 = var_a3; } else { - if (phi_a3 == 0) { - phi_t2_4 = phi_v1 & 0xFF; + if (var_a3 == 0) { + var_t2 = var_v1 & 0xFF; goto block_11; } - if ((temp_v0 & 0xFF00) < (phi_t3 & 0xFF00)) { - phi_t2_4 = phi_v1 & 0xFF; + if ((u32) (temp_v0 & 0xFF00) < (u32) (var_t3 & 0xFF00)) { + var_t2 = var_v1 & 0xFF; block_11: - phi_t3_2 = temp_v0; + var_t3 = temp_v0; } - temp_v0_2 = (phi_a3 + 1) & 0xFF; - phi_v0 = temp_v0_2; - phi_t2 = phi_t2_4; - phi_t3_3 = phi_t3_2; - phi_a3_2 = temp_v0_2; - if (temp_v0_2 == temp_a0) { - phi_v1_2 = 0; - if ((temp_a1_2 & 0xFF00) >= (phi_t3_2 & 0xFF00)) { - phi_v1_2 = phi_t2_4 & 0xFF; + var_v0_2 = (var_a3 + 1) & 0xFF; + var_a3 = var_v0_2; + if (var_v0_2 == temp_a0) { + var_v1 = 0; + if ((u32) (temp_a1_2 & 0xFF00) >= (u32) (var_t3 & 0xFF00)) { + var_v1 = var_t2 & 0xFF; } } } - phi_v1_3 = phi_v1_2; - phi_t3_4 = phi_t3_3; - phi_t2_2 = phi_t2; - phi_a3 = phi_a3_2; - phi_t3_4 = phi_t3_3; - phi_t2_2 = phi_t2; - phi_a3 = phi_a3_2; - if (phi_v0 == temp_a0) { - if (((temp_a1_2 * 0x10) < 0) || ((temp_a1_2 << 0xD) < 0) || (phi_t2 == phi_v1_2)) { - temp_s0_2 = phi_t1 + (phi_v1_2 * phi_t4); - if ((temp_s0_2->unk24 & 0x80000) && (temp_s0_2->unk28 != 1)) { - sp4F = phi_t5; - sp3C = phi_t3_3; - sp43 = phi_t2; - sp30 = phi_t1; - sp4D = phi_a3_2; - sp48 = phi_a2; - func_800C40F0(temp_s0_2->unk2C, temp_a1_2, phi_a2, phi_a3_2); + if (var_v0_2 == temp_a0) { + if ((temp_a1_2 & 0x08000000) || (temp_a1_2 & 0x40000) || (var_t2 == var_v1)) { + temp_s0_2 = &var_t1[var_v1]; + if ((temp_s0_2->soundBits & 0x80000) && (temp_s0_2->soundStatus != 1)) { + sp4F = var_t5; + sp3C = var_t3; + sp43 = var_t2; + sp30 = var_t1; + sp4D = var_a3; + sp48 = var_a2; + func_800C40F0(temp_s0_2->unk2C, temp_a1_2, var_a2, var_a3); } - temp_s0_2->unkC = phi_a2->unk8; - temp_s0_2->unk24 = phi_a2->unk0; - temp_s0_2->unk29 = 2; - temp_s0_2->unk28 = (phi_a2->unk0 & 0x1000000) >> 0x18; - temp_s0_2->unk10 = phi_a2->unkC; - temp_s0_2->unk14 = phi_a2->unk10; - temp_s0_2->unk18 = phi_a2->unk14; - phi_t3_4 = phi_t3_3; - phi_t2_2 = phi_t2; - phi_a2_3 = phi_a2; - phi_t1_2 = phi_t1; - phi_a3 = phi_a3_2; - phi_t5_3 = phi_t5; + temp_s0_2->unk0C = var_a2->cameraId; + temp_s0_2->soundBits = (u32) var_a2->soundBits; + temp_s0_2->freshness = 2; + temp_s0_2->soundStatus = (u8) ((u32) (var_a2->soundBits & 0x01000000) >> 0x18); + temp_s0_2->unk10 = var_a2->unk0C; + temp_s0_2->unk14 = var_a2->unk10; + temp_s0_2->unk18 = var_a2->unk14; } - phi_v1_3 = 0; + var_v1 = 0; } } - phi_a2 = phi_a2_3; - phi_t1 = phi_t1_2; - phi_t4 = phi_t4_2; - phi_t3 = phi_t3_4; - phi_t5 = phi_t5_3; - phi_v0_2 = phi_v1_3; - phi_ra_2 = phi_ra; - phi_t5_2 = phi_t5_3; - phi_a2_2 = phi_a2_3; - phi_v1 = phi_v1_3; - phi_t2_3 = phi_t2_2; - phi_ra_3 = phi_ra; - if (phi_v1_3 != 0) { - temp_v1_2 = (phi_t1_2 + (phi_v1_3 * phi_t4_2))->unk2B; - phi_v0_2 = temp_v1_2; - phi_v1 = temp_v1_2; + var_v0 = var_v1; + if (var_v1 != 0) { + var_v1 = var_t1[var_v1].next; + var_v0 = var_v1; } - phi_v0_3 = phi_v0_2; - if (phi_ra != phi_v0_2) { - if (phi_v0_2 == 0) { - sp3C = phi_t3_4; - sp43 = phi_t2_2; + if (var_v0 != 0xFF) { + if (var_v0 == 0) { + sp3C = var_t3; + sp43 = var_t2; } else { goto loop_4; } } } - temp_a3_2 = phi_t5_2 + &D_80192AA8; - temp_a1_3 = *temp_a3_2; - temp_t1 = (phi_t5_2 * 0x3C0) + &D_80191420; - temp_t0 = temp_t1 + (temp_a1_3 * 0x30); - temp_v1_3 = temp_t0->unk2B; - if ((phi_ra_2 != temp_v1_3) && (phi_v0_3 != 0)) { - temp_s0_3 = temp_t1 + ((temp_a1_3 & 0xFF) * 0x30); - temp_s0_3->unk0 = phi_a2_2->unk4; - temp_s0_3->unk4 = phi_a2_2->unk4 + 4; - temp_s0_3->unk8 = phi_a2_2->unk4 + 8; - temp_s0_3->unkC = phi_a2_2->unk8; - temp_s0_3->unk10 = phi_a2_2->unkC; - temp_s0_3->unk14 = phi_a2_2->unk10; - temp_s0_3->unk18 = phi_a2_2->unk14; - temp_s0_3->unk24 = phi_a2_2->unk0; - temp_s0_3->unk29 = 2; - temp_v0_3 = phi_t5_2 + &D_80192AA0; - temp_a0_2 = *temp_v0_3; - temp_s0_3->unk28 = (phi_a2_2->unk0 & 0x1000000) >> 0x18; - temp_s0_3->unk2A = temp_a0_2; - (temp_t1 + (temp_a0_2 * 0x30))->unk2B = temp_a1_3; - temp_t6_2 = temp_t0->unk2B; - *temp_v0_3 = temp_a1_3; - *temp_a3_2 = temp_t6_2; - (temp_t1 + ((temp_t6_2 & 0xFF) * 0x30))->unk2A = 0xFF; - temp_s0_3->unk2B = 0xFF; + temp_a3 = &sSoundBankFreeListFront[var_t5]; + temp_a1_3 = *temp_a3; + temp_t1 = sSoundBanks[var_t5]; + temp_t0 = &temp_t1[temp_a1_3]; + temp_v1 = temp_t0->next; + if ((temp_v1 != 0xFF) && (var_v0 != 0)) { + temp_s0_3 = &temp_t1[temp_a1_3 & 0xFF]; + temp_s0_3->unk00 = var_a2->position; + temp_s0_3->unk04 = var_a2->position + 4; + temp_s0_3->unk08 = var_a2->position + 8; + temp_s0_3->unk0C = var_a2->cameraId; + temp_s0_3->unk10 = var_a2->unk0C; + temp_s0_3->unk14 = var_a2->unk10; + temp_s0_3->unk18 = var_a2->unk14; + temp_s0_3->soundBits = (u32) var_a2->soundBits; + temp_s0_3->freshness = 2; + temp_v0_2 = &sSoundBankUsedListBack[var_t5]; + temp_a0_2 = *temp_v0_2; + temp_s0_3->soundStatus = (u8) ((u32) (var_a2->soundBits & 0x01000000) >> 0x18); + temp_s0_3->prev = temp_a0_2; + temp_t1[temp_a0_2].next = temp_a1_3; + temp_t6_2 = temp_t0->next; + *temp_v0_2 = temp_a1_3; + *temp_a3 = temp_t6_2; + temp_t1[temp_t6_2 & 0xFF].prev = 0xFF; + temp_s0_3->next = 0xFF; return; } - if (phi_ra_2 == temp_v1_3) { - temp_v0_4 = phi_a2_2->unk4; - if (&D_800EA1C8 != temp_v0_4) { - temp_v0_4->unk4 = D_800F3664; + if (temp_v1 == 0xFF) { + temp_v0_3 = var_a2->position; + if (&D_800EA1C8 != temp_v0_3) { + temp_v0_3->unk4 = 100000.0f; } } - // Duplicate return node #35. Try simplifying control flow for better match } } #else @@ -2182,91 +1889,81 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4398.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C40F0(u8, u8, void *, u8); // extern -extern ? D_800EA1C8; -extern f32 D_800F3668; -extern ? D_80191420; -extern ? D_80192AA0; -extern ? D_80192AA8; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C40F0(u8, u8, struct Unk_80191420 *, u8); /* extern */ +static ? D_800EA1C8; /* unable to generate initializer; const */ -void func_800C473C(u8 arg0, u8 arg1) { - void *sp34; - void *sp30; - s32 temp_lo; - s32 temp_t7; +// delete_sound_from_bank? Very similar, but has some extra stuff +void func_800C473C(u8 bankId, u8 soundId) { + struct Unk_80191420 *sp34; + struct Unk_80191420 *sp30; + struct Unk_80191420 *temp_a2; + struct Unk_80191420 *temp_v0; u8 *temp_v1; u8 *temp_v1_2; - u8 temp_a3; u8 temp_t6; - void *temp_a2; - void *temp_v0; - u8 phi_a1; - u8 phi_a3; + u8 var_a1; + u8 var_a3; - temp_t6 = arg1 & 0xFF; - temp_lo = temp_t6 * 0x30; - temp_a3 = arg0 & 0xFF; - temp_t7 = temp_a3 * 0x3C0; - temp_a2 = temp_t7 + &D_80191420; - temp_v0 = temp_a2 + temp_lo; - phi_a1 = temp_t6; - phi_a3 = temp_a3; - if (&D_800EA1C8 != temp_v0->unk0) { - *temp_v0->unk4 = D_800F3668; + temp_t6 = soundId & 0xFF; + var_a3 = bankId & 0xFF; + temp_a2 = sSoundBanks[var_a3]; + temp_v0 = &temp_a2[temp_t6]; + var_a1 = temp_t6; + if (&D_800EA1C8 != temp_v0->unk00) { + *temp_v0->unk04 = 100000.0f; } - if (temp_v0->unk24 & 0x80000) { - arg0 = temp_a3; + if (temp_v0->soundBits & 0x80000) { + bankId = var_a3; sp34 = temp_a2; - arg1 = temp_t6; + soundId = var_a1; sp30 = temp_v0; - func_800C40F0(temp_v0->unk2C, temp_t6, temp_a2, temp_a3); - phi_a1 = arg1; - phi_a3 = arg0; + func_800C40F0(temp_v0->unk2C, var_a1, temp_a2, var_a3); + var_a1 = soundId; + var_a3 = bankId; } - temp_v1 = phi_a3 + &D_80192AA0; - if (phi_a1 == *temp_v1) { - *temp_v1 = (temp_a2 + temp_lo)->unk2A; + temp_v1 = &sSoundBankUsedListBack[var_a3]; + if (var_a1 == *temp_v1) { + *temp_v1 = temp_v0->prev; } else { - (temp_t7 + &D_80191420 + ((temp_a2 + temp_lo)->unk2B * 0x30))->unk2A = (temp_a2 + temp_lo)->unk2A; + temp_a2[temp_v0->next].prev = temp_v0->prev; } - temp_v1_2 = phi_a3 + &D_80192AA8; - (temp_t7 + &D_80191420 + ((temp_a2 + temp_lo)->unk2A * 0x30))->unk2B = (temp_a2 + temp_lo)->unk2B; - (temp_a2 + temp_lo)->unk2A = 0xFF; - (temp_a2 + temp_lo)->unk2B = *temp_v1_2; - (temp_t7 + &D_80191420 + (*temp_v1_2 * 0x30))->unk2A = phi_a1; - *temp_v1_2 = phi_a1; - (temp_a2 + temp_lo)->unk28 = 0; + temp_v1_2 = &sSoundBankFreeListFront[var_a3]; + temp_a2[temp_v0->prev].next = temp_v0->next; + temp_v0->prev = 0xFF; + temp_v0->next = *temp_v1_2; + temp_a2[*temp_v1_2].prev = var_a1; + *temp_v1_2 = var_a1; + temp_v0->soundStatus = 0; } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C473C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C473C(s32, u8, void *, u8); // extern -void func_800CBBE8(s32, ?); // extern -extern ? D_800EA188; -extern u8 D_800EA1C0; -extern ? D_800EA1C8; -extern f32 D_800F366C; -extern f32 D_800F3670; -extern ? D_80191420; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C473C(s32, u8, void *, u8); /* extern */ +? func_800CBBE8(s32, ?); /* extern */ extern ? D_80192AB8; +static ? D_800EA188; /* unable to generate initializer; const */ +static u8 D_800EA1C0 = 0; /* const */ +static ? D_800EA1C8; /* unable to generate initializer; const */ void func_800C4888(s32 arg0) { u8 spCE; u8 spCC; ? sp7C; void *sp70; - void *sp6C; - void *sp68; + struct Unk_80191420 *sp6C; + struct Unk_80191420 *sp68; s32 sp60; f32 *temp_v0; f32 temp_f0; f32 temp_f0_2; f32 temp_f2; - s32 temp_a1; + f32 var_f0; + s32 temp_a2; + s32 temp_at; s32 temp_s5; s32 temp_t6; s32 temp_t6_2; @@ -2277,323 +1974,237 @@ void func_800C4888(s32 arg0) { s32 temp_t8_3; s32 temp_t8_4; s32 temp_t9; - s32 temp_v0_2; s32 temp_v0_3; s32 temp_v0_4; s32 temp_v0_5; - s32 temp_v1; + s32 var_a1; + s32 var_a1_2; + s32 var_a1_3; + s32 var_s0; + s32 var_s0_2; + s32 var_s2; + s32 var_t3; + s32 var_t3_2; + s32 var_t3_3; + s32 var_v1; + struct Unk_80191420 *temp_a0_2; + struct Unk_80191420 *temp_t2; + struct Unk_80191420 *temp_v0_7; u32 temp_t8_2; - u8 temp_a1_2; + u32 temp_v0_2; + u8 temp_a1; u8 temp_a3_3; u8 temp_a3_4; - u8 temp_s3; - u8 temp_s3_2; - u8 temp_t1; u8 temp_t4; - u8 temp_v1_2; + u8 temp_v1; + u8 var_s3; + u8 var_t0; + u8 var_t1; + u8 var_t2; + u8 var_v1_2; void *temp_a0; - void *temp_a0_2; void *temp_a0_3; void *temp_a0_4; void *temp_a3; void *temp_a3_2; - void *temp_s3_3; - void *temp_t2; + void *temp_s3; void *temp_v0_6; - void *temp_v0_7; - s32 phi_t3; - s32 phi_t5; - u8 phi_s3; - s32 phi_v0; - f32 phi_f0; - s32 phi_t3_2; - s32 phi_s2; - s32 phi_v1; - s32 phi_a1; - s32 phi_t3_3; - s32 phi_s0; - s32 phi_s2_2; - ? *phi_ra; - s32 phi_t3_4; - void *phi_a2; - u8 phi_t3_5; - ? *phi_ra_2; - s32 phi_t0; - u8 phi_t1; - s32 phi_a1_2; - s32 phi_a1_3; - s32 phi_t5_2; - s32 phi_v1_2; - s32 phi_a1_4; - s32 phi_t4; - ? *phi_ra_3; - s32 phi_s0_2; - s32 phi_s0_3; - s32 phi_t2; - s32 phi_a1_5; - s32 phi_a1_6; - s32 phi_s2_3; - s32 phi_s2_4; - s32 phi_s0_4; - s32 phi_s2_5; - ? *phi_ra_4; - s32 phi_t2_2; - s32 phi_v1_3; - u8 phi_s3_2; - ? *phi_ra_5; - s32 phi_v1_4; + void *var_a2; temp_s5 = arg0 & 0xFF; - phi_t3 = 0; - phi_t3_2 = 0; - phi_s2_2 = 0; - phi_t3_4 = 0; - phi_s2_3 = 0; + var_s2 = 0; + var_t3 = 0; do { - temp_t7 = (phi_t3 + 1) & 0xFF; - temp_a3 = &sp7C + (phi_t3 * 8); + temp_t7 = (var_t3 + 1) & 0xFF; + temp_at = temp_t7 < 8; + temp_a3 = &sp7C + (var_t3 * 8); + var_t3 = temp_t7; temp_a3->unk0 = 0x7FFFFFFF; - temp_a3->unk4 = 0xFF; - phi_t3 = temp_t7; - } while (temp_t7 < 8); - temp_s3 = (&D_80191420 + (temp_s5 * 0x3C0))->unk2B; - phi_s3 = temp_s3; - phi_ra = &D_80191420; - phi_s0_2 = 0; - phi_s0_4 = 0; - phi_ra_5 = &D_80191420; - if (temp_s3 != 0xFF) { - sp6C = &D_80191420 + (temp_s5 * 0x3C0); - phi_t5 = 1; - phi_v0 = 0x8000000; - phi_v0 = 0x8000000; - phi_t5 = 1; - phi_t5 = 1; + temp_a3->unk4 = 0xFFU; + } while (temp_at != 0); + var_s3 = sSoundBanks[temp_s5]->next; + var_s0 = 0; + if (var_s3 != 0xFF) { + sp6C = sSoundBanks[temp_s5]; do { - temp_t2 = sp6C + (phi_s3 * 0x30); - phi_s2 = phi_s2_3; - phi_s0 = phi_s0_4; - phi_s0 = phi_s0_4; - phi_s2_5 = phi_s2_3; - phi_ra_4 = phi_ra_5; - phi_s3_2 = phi_s3; - phi_s2_5 = phi_s2_3; - phi_s2_5 = phi_s2_3; - phi_ra_4 = phi_ra_5; - if ((phi_t5 == temp_t2->unk28) && (phi_v0 == (temp_t2->unk24 & phi_v0))) { - temp_t2->unk29 = temp_t2->unk29 - 1; + temp_t2 = &sp6C[var_s3]; + if ((temp_t2->soundStatus == 1) && ((temp_t2->soundBits & 0x08000000) == 0x08000000)) { + temp_t2->freshness -= 1; } - if (temp_t2->unk29 == 0) { - func_800C473C(temp_s5 & 0xFF, phi_s3 & 0xFF); - phi_ra_4 = &D_80191420; - goto block_35; - } - if (temp_t2->unk28 != 0) { - temp_v0 = temp_t2->unk0; + if (temp_t2->freshness == 0) { + func_800C473C(temp_s5 & 0xFF, var_s3 & 0xFF); + } else if (temp_t2->soundStatus != 0) { + temp_v0 = temp_t2->unk00; if (&D_800EA1C8 == temp_v0) { - temp_t2->unk1C = 0.0f; + temp_t2->distance = 0.0f; } else { temp_f2 = *temp_v0; - temp_f0 = *temp_t2->unk8; - temp_t2->unk1C = (temp_f0 * temp_f0) + (temp_f2 * temp_f2); + temp_f0 = *temp_t2->unk08; + temp_t2->distance = (temp_f0 * temp_f0) + (temp_f2 * temp_f2); } - temp_v0_2 = temp_t2->unk24; - temp_t8 = ((temp_v0_2 & 0xFF00) >> 8) & 0xFF; + temp_v0_2 = temp_t2->soundBits; + temp_t8 = ((u32) (temp_v0_2 & 0xFF00) >> 8) & 0xFF; if (temp_v0_2 & 0x100000) { - temp_v0_3 = 0xFF - temp_t8; - temp_t2->unk20 = temp_v0_3 * temp_v0_3 * 0x5A4; + temp_v0_3 = 0xFFU - temp_t8; + temp_t2->priority = temp_v0_3 * temp_v0_3 * 0x5A4; } else { - temp_v0_4 = 0xFF - temp_t8; - temp_t8_2 = temp_t2->unk1C + (temp_v0_4 * temp_v0_4 * 0x5A4); - temp_t2->unk20 = temp_t8_2; - temp_f0_2 = *temp_t2->unk8; + temp_v0_4 = 0xFFU - temp_t8; + temp_t8_2 = (u32) temp_t2->distance + (temp_v0_4 * temp_v0_4 * 0x5A4); + temp_t2->priority = temp_t8_2; + temp_f0_2 = *temp_t2->unk08; if (temp_f0_2 > 0.0f) { - temp_t2->unk20 = temp_t8_2 + (temp_f0_2 * 6.0f); + temp_t2->priority = temp_t8_2 + (s32) (temp_f0_2 * 6.0f); } } - temp_t8_3 = ((temp_t2->unk24 & 0x30000) >> 0x10) & 0xFF; + temp_t8_3 = ((u32) (temp_t2->soundBits & 0x30000) >> 0x10) & 0xFF; if (temp_t8_3 != 0) { - phi_f0 = D_800F366C / (temp_t8_3 * temp_t8_3); + var_f0 = 4000000.0f / (f32) (temp_t8_3 * temp_t8_3); } else { - phi_f0 = D_800F3670; + var_f0 = 1e10f; } - if (phi_f0 < temp_t2->unk1C) { - if (temp_t2->unk28 == 4) { + if (var_f0 < temp_t2->distance) { + if (temp_t2->soundStatus == 4) { sp68 = temp_t2; - func_800CBBE8((temp_t2->unk2C << 8) | 0x6020000, 0); - phi_ra_4 = &D_80191420; - if ((temp_t2->unk24 * 0x10) < 0) { - func_800C473C(temp_s5 & 0xFF, phi_s3 & 0xFF); - phi_s3_2 = phi_s0_4 & 0xFF; - phi_ra_4 = &D_80191420; + func_800CBBE8((temp_t2->unk2C << 8) | 0x06020000, 0); + if (temp_t2->soundBits & 0x08000000) { + func_800C473C(temp_s5 & 0xFF, var_s3 & 0xFF); + var_s3 = var_s0 & 0xFF; } } } else { + var_t3_2 = 0; temp_t4 = *(&D_800EA188 + ((D_800EA1C0 * 6) + temp_s5)); - if (temp_t4 > 0) { + if ((s32) temp_t4 > 0) { do { - temp_a3_2 = &sp7C + (phi_t3_2 * 8); + temp_a3_2 = &sp7C + (var_t3_2 * 8); temp_v0_5 = temp_t4 - 1; - temp_a1 = temp_v0_5 & 0xFF; - phi_a1 = temp_a1; - phi_t3_3 = phi_t3_2; - phi_s2_4 = phi_s2; - phi_s2_4 = phi_s2; - if (temp_a3_2->unk0 >= temp_t2->unk20) { - if (phi_s2 < temp_t4) { - phi_s2_4 = (phi_s2 + 1) & 0xFF; + var_a1 = temp_v0_5 & 0xFF; + temp_a2 = var_t3_2; + if ((u32) temp_a3_2->unk0 >= (u32) temp_t2->priority) { + if (var_s2 < (s32) temp_t4) { + var_s2 = (var_s2 + 1) & 0xFF; } - phi_t3_3 = temp_t4 & 0xFF; - if (phi_t3_2 < (temp_v0_5 & 0xFF)) { - phi_v1 = temp_a1; + var_t3_2 = temp_t4 & 0xFF; + if (temp_a2 < (temp_v0_5 & 0xFF)) { + var_v1 = var_a1; do { - temp_v0_6 = &sp7C + (phi_v1 * 8); - temp_a0 = &sp7C + (phi_a1 * 8); - temp_a0->unk0 = temp_v0_6->unk-8; - temp_v1 = (phi_a1 - 1) & 0xFF; - temp_a0->unk4 = temp_v0_6->unk-4; - phi_v1 = temp_v1; - phi_a1 = temp_v1; - } while (phi_t3_2 < temp_v1); + temp_v0_6 = &sp7C + (var_v1 * 8); + temp_a0 = &sp7C + (var_a1 * 8); + temp_a0->unk0 = (s32) temp_v0_6->unk-8; + var_v1 = (var_a1 - 1) & 0xFF; + var_a1 = var_v1; + temp_a0->unk4 = (u8) temp_v0_6->unk-4; + } while (temp_a2 < var_v1); } - temp_a3_2->unk0 = temp_t2->unk20; - temp_a3_2->unk4 = phi_s3; + temp_a3_2->unk0 = temp_t2->priority; + temp_a3_2->unk4 = var_s3; } - temp_t9 = (phi_t3_3 + 1) & 0xFF; - phi_t3_2 = temp_t9; - phi_s2 = phi_s2_4; - phi_s2_5 = phi_s2_4; - } while (temp_t9 < temp_t4); + temp_t9 = (var_t3_2 + 1) & 0xFF; + var_t3_2 = temp_t9; + } while (temp_t9 < (s32) temp_t4); } } - phi_s0 = phi_s3_2 & 0xFF; -block_35: + var_s0 = var_s3 & 0xFF; } - temp_s3_2 = (sp6C + (phi_s0 * 0x30))->unk2B; - phi_s3 = temp_s3_2; - phi_s2_2 = phi_s2_5; - phi_ra = phi_ra_4; - phi_s2_3 = phi_s2_5; - phi_s0_4 = phi_s0; - phi_ra_5 = phi_ra_4; - } while (temp_s3_2 != 0xFF); + var_s3 = sp6C[var_s0].next; + } while (var_s3 != 0xFF); } - temp_t1 = *(&D_800EA188 + ((D_800EA1C0 * 6) + temp_s5)); - phi_ra_2 = phi_ra; - phi_t1 = temp_t1; - phi_t5_2 = 1; - phi_t5_2 = 1; - if (phi_s2_2 > 0) { - sp6C = phi_ra + (temp_s5 * 0x3C0); + var_t1 = *(&D_800EA188 + ((D_800EA1C0 * 6) + temp_s5)); + var_t3_3 = 0; + if (var_s2 > 0) { + sp6C = sSoundBanks[temp_s5]; do { - temp_t7_2 = (phi_t3_4 + 1) & 0xFF; - temp_v0_7 = sp6C + ((&sp7C + (phi_t3_4 * 8))->unk4 * 0x30); - temp_v1_2 = temp_v0_7->unk28; - if (temp_v1_2 == 1) { - temp_v0_7->unk28 = 2; - } else if (temp_v1_2 == 4) { - temp_v0_7->unk28 = 3; + temp_t7_2 = (var_t3_3 + 1) & 0xFF; + temp_v0_7 = &sp6C[(&sp7C + (var_t3_3 * 8))->unk4]; + temp_v1 = temp_v0_7->soundStatus; + if (temp_v1 == 1) { + temp_v0_7->soundStatus = 2; + } else if (temp_v1 == 4) { + temp_v0_7->soundStatus = 3; } - phi_t3_4 = temp_t7_2; - } while (temp_t7_2 < phi_s2_2); + var_t3_3 = temp_t7_2; + } while (temp_t7_2 < var_s2); + var_t3_3 = 0; } - phi_t3_5 = 0; - phi_t0 = temp_t1; - if (temp_t1 > 0) { - phi_a2 = (temp_s5 << 6) + &D_80192AB8; - phi_t4 = 3; - phi_t4 = 3; + var_t0 = var_t1; + if ((s32) var_t1 > 0) { + var_a2 = (temp_s5 << 6) + &D_80192AB8; do { - temp_s3_3 = phi_a2 + (phi_t3_5 * 8); - temp_a1_2 = temp_s3_3->unk4; - phi_v1_2 = 0; - phi_ra_3 = phi_ra_2; - phi_v1_3 = 0; - if (temp_a1_2 == 0xFF) { - phi_v1_2 = 1; + temp_s3 = var_a2 + (var_t3_3 * 8); + temp_a1 = temp_s3->unk4; + var_v1_2 = 0; + if (temp_a1 == 0xFF) { + var_v1_2 = 1; } else { - temp_a0_2 = phi_ra_2 + (temp_s5 * 0x3C0) + (temp_a1_2 * 0x30); - temp_a3_3 = temp_a0_2->unk28; + temp_a0_2 = &sSoundBanks[temp_s5][temp_a1]; + temp_a3_3 = temp_a0_2->soundStatus; if (temp_a3_3 == 4) { - if ((temp_a0_2->unk24 * 0x10) < 0) { - sp70 = phi_a2; - sp60 = phi_t0; - spCE = phi_t1; - spCC = phi_t3_5; - func_800C473C(temp_s5 & 0xFF, temp_a1_2, phi_a2, temp_a3_3); - phi_v1_2 = 1; - phi_ra_3 = &D_80191420; + if (temp_a0_2->soundBits & 0x08000000) { + sp70 = var_a2; + sp60 = (s32) var_t0; + spCE = var_t1; + spCC = (u8) var_t3_3; + func_800C473C(temp_s5 & 0xFF, temp_a1, var_a2, temp_a3_3); + var_v1_2 = 1; } else { - temp_a0_2->unk28 = 1; - phi_v1_2 = 1; + temp_a0_2->soundStatus = 1; + var_v1_2 = 1; } } else if (temp_a3_3 == 0) { - temp_s3_3->unk4 = 0xFF; - phi_v1_2 = 1; + temp_s3->unk4 = 0xFFU; + var_v1_2 = 1; } else { - phi_a1_2 = 0; - if (phi_t0 > 0) { + var_a1_2 = 0; + if ((s32) var_t0 > 0) { do { - temp_a0_3 = &sp7C + (phi_a1_2 * 8); - phi_a1_3 = phi_a1_2; - if (temp_a1_2 == temp_a0_3->unk4) { - temp_a0_3->unk4 = 0xFF; - phi_a1_3 = phi_t1 & 0xFF; + temp_a0_3 = &sp7C + (var_a1_2 * 8); + if (temp_a1 == temp_a0_3->unk4) { + temp_a0_3->unk4 = 0xFFU; + var_a1_2 = var_t1 & 0xFF; } - temp_t7_3 = (phi_a1_3 + 1) & 0xFF; - phi_a1_2 = temp_t7_3; - } while (temp_t7_3 < phi_t0); + temp_t7_3 = (var_a1_2 + 1) & 0xFF; + var_a1_2 = temp_t7_3; + } while (temp_t7_3 < (s32) var_t0); } } } - phi_a2 = phi_a2; - phi_ra_2 = phi_ra_3; - phi_t0 = phi_t0; - phi_t1 = phi_t1; - phi_t2_2 = phi_v1_2; - phi_v1_4 = phi_v1_2; - if (phi_t5_2 == phi_v1_2) { - phi_a1_4 = 0; - phi_a1_6 = 0; - if (phi_t0 > 0) { + var_t2 = var_v1_2; + if (var_v1_2 == 1) { + var_a1_3 = 0; + if ((s32) var_t0 > 0) { do { - temp_a0_4 = &sp7C + (phi_a1_4 * 8); + temp_a0_4 = &sp7C + (var_a1_3 * 8); temp_a3_4 = temp_a0_4->unk4; - phi_t2 = phi_t2_2; - phi_a1_5 = phi_a1_4; - phi_v1_3 = phi_v1_4; - if ((temp_a3_4 != 0xFF) && (phi_t4 != (phi_ra_3 + (temp_s5 * 0x3C0) + (temp_a3_4 * 0x30))->unk28)) { - if (phi_t0 > 0) { + if ((temp_a3_4 != 0xFF) && (sSoundBanks[temp_s5][temp_a3_4].soundStatus != 3)) { + var_s0_2 = 0; + if ((s32) var_t0 > 0) { do { - phi_s0_3 = phi_s0_2; - if (temp_a3_4 == (phi_a2 + (phi_s0_2 * 8))->unk4) { - phi_s0_3 = phi_t1 & 0xFF; + if (temp_a3_4 == (var_a2 + (var_s0_2 * 8))->unk4) { + var_v1_2 = 0; + var_s0_2 = var_t1 & 0xFF; } - temp_t6 = (phi_s0_3 + 1) & 0xFF; - phi_s0_2 = temp_t6; - phi_v1_4 = phi_v1_3; - } while (temp_t6 < phi_t0); - phi_t2 = phi_v1_3; + temp_t6_2 = (var_s0_2 + 1) & 0xFF; + var_s0_2 = temp_t6_2; + } while (temp_t6_2 < (s32) var_t0); + var_t2 = var_v1_2; } - phi_t2_2 = phi_t2; - if (phi_t5_2 == phi_t2) { - temp_s3_3->unk4 = temp_a3_4; - temp_a0_4->unk4 = 0xFF; - phi_a1_5 = (phi_t0 + 1) & 0xFF; + if (var_t2 == 1) { + temp_s3->unk4 = temp_a3_4; + temp_a0_4->unk4 = 0xFFU; + var_a1_3 = (var_t0 + 1) & 0xFF; } } - temp_t8_4 = (phi_a1_5 + 1) & 0xFF; - phi_a1_4 = temp_t8_4; - phi_a1_6 = temp_t8_4; - } while (temp_t8_4 < phi_t0); + temp_t8_4 = (var_a1_3 + 1) & 0xFF; + var_a1_3 = temp_t8_4; + } while (temp_t8_4 < (s32) var_t0); } - if (phi_t0 == phi_a1_6) { - temp_s3_3->unk4 = 0xFF; + if (var_t0 == var_a1_3) { + temp_s3->unk4 = 0xFFU; } } - temp_t6_2 = (phi_t3_5 + 1) & 0xFF; - phi_t3_5 = temp_t6_2; - } while (temp_t6_2 < phi_t0); + temp_t6 = (var_t3_3 + 1) & 0xFF; + var_t3_3 = temp_t6; + } while (temp_t6 < (s32) var_t0); } } #else @@ -2608,7 +2219,7 @@ void func_800CBBE8(s32, s8, u8); // extern extern ? D_800EA188; extern u8 D_800EA1C0; extern u16 D_800EA1C4; -extern ? D_80191420; +extern ? sSoundBanks; extern ? D_80192AB8; extern u8 D_80192C38; extern ? D_801930D0; @@ -2637,7 +2248,7 @@ void func_800C4FE4(s32 arg0) { temp_s1 = (sp50 + (phi_s4 * 8))->unk4; if (temp_s1 != 0xFF) { temp_a2 = D_80192C38; - temp_s0 = (temp_s3 * 0x3C0) + (temp_s1 * 0x30) + &D_80191420; + temp_s0 = (temp_s3 * 0x3C0) + (temp_s1 * 0x30) + &sSoundBanks; temp_v0 = temp_s0->unk28; if (temp_v0 == 2) { temp_s0->unk2C = temp_a2; @@ -2678,78 +2289,68 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4FE4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C41CC(?, ? *); // extern -void func_800C473C(s32, s32); // extern -void func_800CBBE8(s32, ?); // extern -extern ? D_80191420; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C473C(s32, s32); /* extern */ +? func_800CBBE8(s32, ?); /* extern */ -void func_800C5278(s32 arg0) { - s32 sp84; - ? sp60; +void func_800C5278(u8 bank) { + struct Unk_80191420 sp60; s32 temp_s7; - void *temp_s0; - void *temp_s2; + struct Unk_80191420 *temp_s0; + struct Unk_80191420 *temp_s2; - temp_s7 = arg0 & 0xFF; - temp_s2 = (temp_s7 * 0x3C0) + &D_80191420; - if (temp_s2->unk2B != 0xFF) { + temp_s7 = bank & 0xFF; + temp_s2 = sSoundBanks[temp_s7]; + if (temp_s2->next != 0xFF) { do { - temp_s0 = (temp_s7 * 0x3C0) + &D_80191420 + (temp_s2->unk2B * 0x30); - if (temp_s0->unk28 >= 3) { - func_800CBBE8((temp_s0->unk2C << 8) | 0x6020000, 0); + temp_s0 = &sSoundBanks[temp_s7][temp_s2->next]; + if ((s32) temp_s0->soundStatus >= 3) { + func_800CBBE8((temp_s0->unk2C << 8) | 0x06020000, 0); } - if (temp_s0->unk28 != 0) { - func_800C473C(temp_s7 & 0xFF, temp_s2->unk2B & 0xFF); + if (temp_s0->soundStatus != 0) { + func_800C473C(temp_s7 & 0xFF, temp_s2->next & 0xFF); } - } while (temp_s2->unk2B != 0xFF); + } while (temp_s2->next != 0xFF); } - sp84 = temp_s7 << 0x1C; - func_800C41CC(0, &sp60); + sp60.soundBits = temp_s7 << 0x1C; + func_800C41CC(0U, &sp60); } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5278.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C473C(s32, s32); // extern -void func_800CBBE8(s32, ?); // extern -extern ? D_80191420; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C473C(s32, s32); /* extern */ +? func_800CBBE8(s32, ?); /* extern */ void func_800C5384(s32 arg0, s32 arg1) { - s32 temp_s2; s32 temp_s5; - u8 temp_s1; - void *temp_s0; - void *temp_s3; - u8 phi_s1; - u8 phi_s1_2; - s32 phi_s2; + s32 var_s2; + struct Unk_80191420 *temp_s0; + struct Unk_80191420 *temp_s3; + u8 var_s1; temp_s5 = arg0 & 0xFF; - temp_s1 = ((temp_s5 * 0x3C0) + &D_80191420)->unk2B; - phi_s1 = temp_s1; - phi_s2 = 0; - if (temp_s1 != 0xFF) { - temp_s3 = (temp_s5 * 0x3C0) + &D_80191420; + var_s1 = sSoundBanks[temp_s5]->next; + var_s2 = 0; + if (var_s1 != 0xFF) { + temp_s3 = sSoundBanks[temp_s5]; do { - temp_s0 = temp_s3 + (phi_s1 * 0x30); - if (arg1 == temp_s0->unk0) { - if (temp_s0->unk28 >= 3) { - func_800CBBE8((temp_s0->unk2C << 8) | 0x6020000, 0); + temp_s0 = &temp_s3[var_s1]; + if (arg1 == temp_s0->unk00) { + if ((s32) temp_s0->soundStatus >= 3) { + func_800CBBE8((temp_s0->unk2C << 8) | 0x06020000, 0); } - if (temp_s0->unk28 != 0) { - func_800C473C(temp_s5 & 0xFF, phi_s1 & 0xFF); + if (temp_s0->soundStatus != 0) { + func_800C473C(temp_s5 & 0xFF, var_s1 & 0xFF); } - phi_s1_2 = (temp_s3 + (phi_s2 * 0x30))->unk2B; + var_s1 = temp_s3[var_s2].next; } else { - temp_s2 = phi_s1 & 0xFF; - phi_s1_2 = (temp_s3 + (temp_s2 * 0x30))->unk2B; - phi_s2 = temp_s2; + var_s2 = var_s1 & 0xFF; + var_s1 = temp_s3[var_s2].next; } - phi_s1 = phi_s1_2; - } while (phi_s1_2 != 0xFF); + } while (var_s1 != 0xFF); } } #else @@ -2757,14 +2358,17 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5384.s") #endif #ifdef MIPS_TO_C -UNUSED void func_800C54B8(u8 arg0, s32 arg1) { - s32 sp54; - s32 sp30; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C5384(u8); /* extern */ - func_800C5384(arg0); - sp54 = arg0 << 0x1C; +void func_800C54B8(u8 bank, struct Unk_80191420 *arg1) { + s32 sp54; + struct Unk_80191420 *sp30; + + func_800C5384(bank); + sp54 = bank << 0x1C; sp30 = arg1; - func_800C41CC(1, &sp30); + func_800C41CC(1U, (struct Unk_80191420 *) &sp30); } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C54B8.s") @@ -2794,107 +2398,90 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C550C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C41CC(?, s32 *); // extern -void func_800C473C(s32, s32); // extern -void func_800CBBE8(s32, ?); // extern -extern ? D_80191420; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C41CC(?, s32 *); /* extern */ +? func_800C473C(s32, s32); /* extern */ +? func_800CBBE8(s32, ?); /* extern */ void func_800C5578(s32 arg0, s32 arg1) { s32 sp84; s32 sp60; - s32 *temp_a1; s32 temp_t8; - u8 temp_s1; - u8 temp_s1_2; - void *temp_s0; - void *temp_s4; - u8 phi_s1; - u8 phi_v0; - u8 phi_v0_2; - s32 phi_s3; + s32 var_s3; + struct Unk_80191420 *temp_s0; + struct Unk_80191420 *temp_s4; + u8 var_s1; + u8 var_v0; - temp_t8 = ((arg1 & 0xF0000000) >> 0x1C) & 0xFF; - temp_s1 = ((temp_t8 * 0x3C0) + &D_80191420)->unk2B; - phi_s1 = temp_s1; - phi_v0 = temp_s1; - phi_s3 = 0; - if (temp_s1 != 0xFF) { - temp_s4 = (temp_t8 * 0x3C0) + &D_80191420; + temp_t8 = ((u32) (arg1 & 0xF0000000) >> 0x1C) & 0xFF; + var_s1 = sSoundBanks[temp_t8]->next; + var_s3 = 0; + var_v0 = var_s1; + if (var_s1 != 0xFF) { + temp_s4 = sSoundBanks[temp_t8]; do { - temp_s0 = temp_s4 + (phi_s1 * 0x30); - if ((arg0 == temp_s0->unk0) && (arg1 == temp_s0->unk24)) { - if (temp_s0->unk28 >= 3) { - func_800CBBE8((temp_s0->unk2C << 8) | 0x6020000, 0); + temp_s0 = &temp_s4[var_s1]; + if ((arg0 == temp_s0->unk00) && (arg1 == temp_s0->soundBits)) { + if ((s32) temp_s0->soundStatus >= 3) { + func_800CBBE8((temp_s0->unk2C << 8) | 0x06020000, 0); } - if (temp_s0->unk28 != 0) { - func_800C473C(temp_t8 & 0xFF, phi_s1 & 0xFF); + if (temp_s0->soundStatus != 0) { + func_800C473C(temp_t8 & 0xFF, var_s1 & 0xFF); } - phi_v0 = 0xFF; - phi_s1 = 0xFF; + var_s1 = 0xFF; + var_v0 = 0xFF; } else { - phi_s3 = phi_s1 & 0xFF; + var_s3 = var_s1 & 0xFF; } - phi_v0_2 = phi_v0; - if (phi_v0 != 0xFF) { - temp_s1_2 = (temp_s4 + (phi_s3 * 0x30))->unk2B; - phi_v0_2 = temp_s1_2; - phi_s1 = temp_s1_2; + if (var_v0 != 0xFF) { + var_s1 = temp_s4[var_s3].next; + var_v0 = var_s1; } - phi_v0 = phi_v0_2; - } while (phi_v0_2 != 0xFF); + } while (var_v0 != 0xFF); } - temp_a1 = &sp60; sp60 = arg0; sp84 = arg1; - func_800C41CC(3, temp_a1); + func_800C41CC(3, &sp60); } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5578.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C41CC(?, ? *); // extern -void func_800C473C(s32, s32); // extern -void func_800CBBE8(s32, ?); // extern -extern ? D_80191420; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C41CC(?, ? *); /* extern */ +? func_800C473C(s32, s32); /* extern */ +? func_800CBBE8(s32, ?); /* extern */ void func_800C56F0(s32 arg0) { s32 sp8C; ? sp68; - s32 temp_s2; s32 temp_t8; - u8 temp_s1; - void *temp_s0; - void *temp_s3; - u8 phi_s1; - u8 phi_s1_2; - s32 phi_s2; + s32 var_s2; + struct Unk_80191420 *temp_s0; + struct Unk_80191420 *temp_s3; + u8 var_s1; - temp_t8 = ((arg0 & 0xF0000000) >> 0x1C) & 0xFF; - temp_s1 = ((temp_t8 * 0x3C0) + &D_80191420)->unk2B; - phi_s1 = temp_s1; - phi_s2 = 0; - if (temp_s1 != 0xFF) { - temp_s3 = (temp_t8 * 0x3C0) + &D_80191420; + temp_t8 = ((u32) (arg0 & 0xF0000000) >> 0x1C) & 0xFF; + var_s1 = sSoundBanks[temp_t8]->next; + var_s2 = 0; + if (var_s1 != 0xFF) { + temp_s3 = sSoundBanks[temp_t8]; do { - temp_s0 = temp_s3 + (phi_s1 * 0x30); - if (arg0 == temp_s0->unk24) { - if (temp_s0->unk28 >= 3) { - func_800CBBE8((temp_s0->unk2C << 8) | 0x6020000, 0); + temp_s0 = &temp_s3[var_s1]; + if (arg0 == temp_s0->soundBits) { + if ((s32) temp_s0->soundStatus >= 3) { + func_800CBBE8((temp_s0->unk2C << 8) | 0x06020000, 0); } - if (temp_s0->unk28 != 0) { - func_800C473C(temp_t8 & 0xFF, phi_s1 & 0xFF); + if (temp_s0->soundStatus != 0) { + func_800C473C(temp_t8 & 0xFF, var_s1 & 0xFF); } - phi_s1_2 = (temp_s3 + (phi_s2 * 0x30))->unk2B; + var_s1 = temp_s3[var_s2].next; } else { - temp_s2 = phi_s1 & 0xFF; - phi_s1_2 = (temp_s3 + (temp_s2 * 0x30))->unk2B; - phi_s2 = temp_s2; + var_s2 = var_s1 & 0xFF; + var_s1 = temp_s3[var_s2].next; } - phi_s1 = phi_s1_2; - } while (phi_s1_2 != 0xFF); + } while (var_s1 != 0xFF); } sp8C = arg0; func_800C41CC(5, &sp68); @@ -2903,26 +2490,13 @@ void func_800C56F0(s32 arg0) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C56F0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C4398(); // extern -extern u8 D_800EA1B8; -extern u8 D_800EA1BC; - +// Might be process_all_sound_requests void func_800C5848(void) { - u8 temp_t9; - - if (D_800EA1BC != D_800EA1B8) { - do { - func_800C4398(); - temp_t9 = D_800EA1BC + 1; - D_800EA1BC = temp_t9; - } while ((temp_t9 & 0xFF) != D_800EA1B8); + while (sSoundRequestCount != sNumProcessedSoundRequests) { + func_800C4398(); + sNumProcessedSoundRequests++; } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5848.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -3018,89 +2592,99 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C59C4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern s8 D_800EA1B8; -extern s8 D_800EA1BC; -extern s16 D_800EA1C4; -extern ? D_80191420; -extern ? D_80192AA0; -extern ? D_80192AA8; -extern ? D_80192AB0; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c extern ? D_80192AB8; -extern ? D_80192C3C; extern ? D_80192C48; +static s16 D_800EA1C4 = 0; /* const */ +u8 sNumProcessedSoundRequests = 0; /* const */ +u8 sSoundRequestCount = 0; /* const */ +// Looks EXTEREMELY similar to sound_init from SM64 +// Its not quite the same but some very similar loops are found in each void func_800C5A3C(void) { - ? sp-10; + s32 temp_at; + s32 temp_at_2; + s32 temp_at_3; + s32 temp_lo; s32 temp_t3; s32 temp_t4; s32 temp_t4_2; s32 temp_t4_3; s32 temp_t8; - void *temp_a1; + s32 var_a0; + s32 var_v0; + s32 var_v0_2; + s32 var_v0_3; + s32 var_v1; + s32 var_v1_2; + s8 temp_t3_2; + s8 temp_t9_2; + struct Unk_80191420 *temp_a1; + struct Unk_80191420 *temp_a1_3; + struct Unk_80191420 *temp_a2; void *temp_a1_2; - void *temp_a1_3; - void *temp_a2; + void *temp_t9; void *temp_v1; - s32 phi_v0; - s32 phi_v0_2; - s32 phi_v1; - s32 phi_v0_3; - s32 phi_a0; - s32 phi_v1_2; - D_800EA1B8 = 0; - D_800EA1BC = 0; + sSoundRequestCount = 0; + sNumProcessedSoundRequests = 0; D_800EA1C4 = 0; - phi_v0 = 0; - phi_v0_2 = 0; - phi_v0_3 = 0; + var_v0 = 0; do { - *(&D_80192AA0 + phi_v0) = 0; - *(&D_80192AA8 + phi_v0) = 1; - temp_t4 = (phi_v0 + 1) & 0xFF; - *(&D_80192AB0 + phi_v0) = 0; - *(&D_80192C3C + phi_v0) = 0; - temp_v1 = &D_80192C48 + (phi_v0 * 0x10); + sSoundBankUsedListBack[var_v0] = 0; + sSoundBankFreeListFront[var_v0] = 1; + temp_t4 = (var_v0 + 1) & 0xFF; + sNumSoundsInBank[var_v0] = 0; + temp_at = temp_t4 < 6; + sSoundBankDisabled[var_v0] = 0; + temp_v1 = &D_80192C48 + (var_v0 * 0x10); + var_v0 = temp_t4; temp_v1->unk0 = 1.0f; temp_v1->unkC = 0; - phi_v0 = temp_t4; - } while (temp_t4 < 6); + } while (temp_at != 0); + var_v0_2 = 0; do { - phi_v1 = 0; + var_v1 = 0; loop_4: - temp_t3 = (phi_v1 + 1) & 0xFF; - ((phi_v0_2 << 6) + &D_80192AB8 + (phi_v1 * 8))->unk4 = 0xFF; - phi_v1 = temp_t3; - if (temp_t3 < 8) { + temp_t3 = (var_v1 + 1) & 0xFF; + temp_at_2 = temp_t3 < 8; + temp_t9 = (var_v0_2 << 6) + &D_80192AB8 + (var_v1 * 8); + var_v1 = temp_t3; + temp_t9->unk4 = 0xFFU; + if (temp_at_2 != 0) { goto loop_4; } - temp_t4_2 = (phi_v0_2 + 1) & 0xFF; - phi_v0_2 = temp_t4_2; + temp_t4_2 = (var_v0_2 + 1) & 0xFF; + var_v0_2 = temp_t4_2; } while (temp_t4_2 < 6); + var_v0_3 = 0; do { - temp_a2 = &D_80191420 + (phi_v0_3 * 0x3C0); - temp_a1 = &D_80191420 + (phi_v0_3 * 0x3C0); - temp_a1->unk2A = 0xFF; - temp_a1->unk2B = 0xFF; - phi_a0 = 1; - phi_v1_2 = 1; + temp_a2 = sSoundBanks[var_v0_3]; + var_v1_2 = 1; + var_a0 = 1; + temp_a1 = sSoundBanks[var_v0_3]; + temp_a1->prev = 0xFF; + temp_a1->next = 0xFF; loop_8: - temp_t4_3 = (phi_v1_2 + 1) & 0xFF; - temp_a1_2 = temp_a2 + (phi_v1_2 * 0x30); - temp_a1_2->unk2A = phi_a0 - 1; - temp_a1_2->unk2B = phi_a0 + 1; - phi_a0 = temp_t4_3; - phi_v1_2 = temp_t4_3; + temp_lo = var_v1_2 * 0x30; + temp_t4_3 = (var_v1_2 + 1) & 0xFF; + temp_t9_2 = var_a0 - 1; + temp_t3_2 = var_a0 + 1; + var_a0 = temp_t4_3; + var_v1_2 = temp_t4_3; + temp_a1_2 = temp_a2 + temp_lo; + temp_a1_2->unk2A = temp_t9_2; + temp_a1_2->unk2B = temp_t3_2; if (temp_t4_3 < 0x13) { goto loop_8; } - temp_t8 = (phi_v0_3 + 1) & 0xFF; - temp_a1_3 = temp_a2 + (temp_t4_3 * 0x30); - temp_a1_3->unk2A = temp_t4_3 - 1; - temp_a1_3->unk2B = 0xFF; - phi_v0_3 = temp_t8; - } while (temp_t8 < 6); + temp_t8 = (var_v0_3 + 1) & 0xFF; + temp_at_3 = temp_t8 < 6; + var_v0_3 = temp_t8; + temp_a1_3 = &temp_a2[temp_t4_3]; + temp_a1_3->prev = temp_t4_3 - 1; + temp_a1_3->next = 0xFF; + } while (temp_at_3 != 0); } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5A3C.s") @@ -3172,68 +2756,58 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5CB8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C94A4(u8); // extern -void func_800C97C4(s32, u8); // extern -extern ? D_800E9E24; -extern ? D_800E9E34; -extern ? D_800EA0EC; -extern u8 D_800EA16C; -extern Player gPlayers; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C94A4(u8); /* extern */ +? func_800C97C4(s32, u8); /* extern */ +static s32 D_800E9E24[4] = { 0, 0, 0, 0 }; /* const */ +static s32 D_800E9E34[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; /* const */ +static ? D_800EA0EC; /* unable to generate initializer; const */ +static u8 D_800EA16C = 0; /* const */ void func_800C5D04(u8 arg0) { s32 *temp_a0; - s32 *temp_v1_3; + s32 *temp_v1_2; s32 temp_a0_2; s32 temp_t1; - s32 temp_v0; - s32 temp_v0_3; - s32 temp_v1; - u8 *temp_v1_2; + s32 var_v1; + u8 *temp_v1; u8 temp_a1; - u8 temp_v0_2; - s32 phi_v1; + u8 temp_v0; temp_a1 = arg0 & 0xFF; - if ((*(&gPlayers + 0x44 + (temp_a1 * 0xDD8)) & 0x20) == 0x20) { - temp_v0 = temp_a1 * 4; - *(&D_800E9E34 + temp_v0) = 0; - temp_a0 = temp_v0 + &D_800E9E24; - temp_v1 = *temp_a0; - phi_v1 = temp_v1; - if (temp_v1 < 0x4E20) { - temp_t1 = temp_v1 + 1; + if ((*(&gPlayers->unk_044 + (temp_a1 * 0xDD8)) & 0x20) == 0x20) { + D_800E9E34[temp_a1] = 0; + temp_a0 = &D_800E9E24[temp_a1]; + var_v1 = *temp_a0; + if (var_v1 < 0x4E20) { + temp_t1 = var_v1 + 1; if (D_800EA16C == 0) { *temp_a0 = temp_t1; - phi_v1 = temp_t1; + var_v1 = temp_t1; } } - temp_v1_2 = temp_a1 + &D_800EA0EC; - if (phi_v1 == 1) { - temp_v0_2 = *temp_v1_2; - if (temp_v0_2 != 0) { - if (temp_v0_2 == 2) { - *temp_v1_2 = 1; + temp_v1 = temp_a1 + &D_800EA0EC; + if (var_v1 == 1) { + temp_v0 = *temp_v1; + if (temp_v0 != 0) { + if (temp_v0 == 2) { + *temp_v1 = 1; goto block_8; } - // Duplicate return node #12. Try simplifying control flow for better match - return; - } + } else { block_8: - arg0 = temp_a1; - func_800C97C4(temp_a1 & 0xFF, temp_a1); - func_800C94A4(arg0); - return; + arg0 = temp_a1; + func_800C97C4(temp_a1 & 0xFF, temp_a1); + func_800C94A4(arg0); + } + } + } else { + D_800E9E24[temp_a1] = 0; + temp_v1_2 = &D_800E9E34[temp_a1]; + temp_a0_2 = *temp_v1_2; + if ((temp_a0_2 < 0x4E20) && (D_800EA16C == 0)) { + *temp_v1_2 = temp_a0_2 + 1; } - // Duplicate return node #12. Try simplifying control flow for better match - return; - } - temp_v0_3 = temp_a1 * 4; - *(&D_800E9E24 + temp_v0_3) = 0; - temp_v1_3 = temp_v0_3 + &D_800E9E34; - temp_a0_2 = *temp_v1_3; - if ((temp_a0_2 < 0x4E20) && (D_800EA16C == 0)) { - *temp_v1_3 = temp_a0_2 + 1; } } #else @@ -3241,106 +2815,91 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5D04.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C9018(s32, ?, u8, void *); // extern -void play_sound(?, void *, u8, void *, void *, void *); // extern -extern ? D_800E9DC4; -extern ? D_800E9DD4; -extern ? D_800E9E14; -extern ? D_800E9E24; -extern ? D_800E9E34; -extern ? D_800E9F04; -extern ? D_800E9F54; -extern ? D_800E9F74; -extern ? D_800E9F7C; -extern ? D_800E9F8C; -extern ? D_800EA0EC; -extern u8 D_800EA108; -extern ? D_800EA130; -extern u8 D_800EA16C; -extern u8 D_800EA1C0; -extern f32 D_800F3674; -extern Player gPlayers; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C9018(s32, ?, u8, Player *); /* extern */ +? play_sound(?, void *, u8, void *, s32 *, void *); /* extern */ +static ?32 D_800E9DC4[4] = { 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000 }; /* const */ +static ?32 D_800E9DD4[4] = { 0, 0, 0, 0 }; /* const */ +static s32 D_800E9E14[4] = { 0, 0, 0, 0 }; /* const */ +static s32 D_800E9E24[4] = { 0, 0, 0, 0 }; /* const */ +static s32 D_800E9E34[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; /* const */ +static s32 D_800E9F04[4] = { 0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000 }; /* const */ +static f32 D_800E9F54[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static ? D_800E9F74; /* unable to generate initializer; const */ +static ? D_800E9F7C; /* unable to generate initializer; const */ +static ? D_800E9F8C; /* unable to generate initializer; const */ +static ? D_800EA0EC; /* unable to generate initializer; const */ +static ? D_800EA130; /* unable to generate initializer; const */ +static u8 D_800EA16C = 0; /* const */ +static u8 D_800EA1C0 = 0; /* const */ +s8 D_800EA108 = 0; /* const */ -void func_800C5E38(u8 arg0) { +void func_800C5E38(u8 playerId) { s32 sp3C; + Player *temp_a3; f32 temp_f0; f32 temp_f2; s32 temp_v0; - s32 temp_v0_2; u8 *temp_t0; - u8 temp_a2; u8 temp_v1; + u8 var_a2; void *temp_a1; void *temp_a1_2; - void *temp_a3; - s32 phi_v0; - u8 phi_a2; - temp_a2 = arg0 & 0xFF; - phi_a2 = temp_a2; - if (D_800EA108 == 0) { - temp_a3 = (temp_a2 * 0xDD8) + &gPlayers; - temp_v0 = temp_a2 * 4; - phi_v0 = temp_v0; - if (((temp_a3->unk44 & 0x20) != 0x20) && (temp_t0 = temp_a2 + &D_800EA0EC, (temp_a3->unk98 > 400.0f))) { - temp_v0_2 = temp_a2 * 4; - *(&D_800E9E14 + temp_v0_2) = 1; + var_a2 = playerId & 0xFF; + if ((u8) D_800EA108 == 0) { + temp_a3 = &gPlayers[var_a2]; + temp_v0 = var_a2 * 4; + if (((temp_a3->unk_044 & 0x20) != 0x20) && (temp_t0 = var_a2 + &D_800EA0EC, (temp_a3->unk_098 > 400.0f))) { + D_800E9E14[var_a2] = 1; temp_v1 = *temp_t0; if (temp_v1 == 0) { - *(&D_800E9F8C + (temp_a2 * 0x3C)) = D_800F3674 - *(&D_800E9F54 + temp_v0_2); + *(&D_800E9F8C + (var_a2 * 0x3C)) = 0.6f - D_800E9F54[var_a2]; } - temp_a1 = (temp_a2 * 0x3C) + &D_800E9F7C; - *(&D_800E9DC4 + temp_v0_2) = temp_a1->unk30; - *(&D_800E9DD4 + temp_v0_2) = temp_a1->unk24; - if ((*(&D_800E9E34 + temp_v0_2) == 1) && (D_800EA16C == 0)) { + temp_a1 = (var_a2 * 0x3C) + &D_800E9F7C; + D_800E9DC4[var_a2] = temp_a1->unk30; + D_800E9DD4[var_a2] = temp_a1->unk24; + if ((D_800E9E34[var_a2] == 1) && (D_800EA16C == 0)) { if (temp_v1 != 0) { if (temp_v1 == 2) { *temp_t0 = 1; goto block_10; } - // Duplicate return node #23. Try simplifying control flow for better match - return; - } + } else { block_10: - if ((*(&D_800E9F74 + temp_a2) == 0) && (temp_a3->unk254 != 3)) { - if (D_800EA1C0 < 2) { - play_sound(0x100F926, temp_a1, temp_a2, temp_a1 + 0x38, temp_v0_2 + &D_800E9F04, temp_a1 + 0x14); - return; + if ((*(&D_800E9F74 + var_a2) == 0) && (temp_a3->characterId != 3)) { + if ((s32) D_800EA1C0 < 2) { + play_sound(0x0100F926, temp_a1, var_a2, temp_a1 + 0x38, &D_800E9F04[var_a2], temp_a1 + 0x14); + return; + } + play_sound(0x01008026, temp_a1, var_a2, temp_a1 + 0x38, &D_800E9F04[var_a2], temp_a1 + 0x14); } - play_sound(0x1008026, temp_a1, temp_a2, temp_a1 + 0x38, temp_v0_2 + &D_800E9F04, temp_a1 + 0x14); - return; } - // Duplicate return node #23. Try simplifying control flow for better match - return; } - // Duplicate return node #23. Try simplifying control flow for better match - return; - } - if (*(&D_800E9E24 + temp_v0) == 0xA) { - if (D_800EA1C0 < 2) { - sp3C = temp_v0; - arg0 = temp_a2; - func_800C9018(temp_a2 & 0xFF, 0x100F926, temp_a2, temp_a3); - } else { - sp3C = temp_v0; - arg0 = temp_a2; - func_800C9018(temp_a2 & 0xFF, 0x1008026, temp_a2, temp_a3); + } else { + if (D_800E9E24[var_a2] == 0x0000000A) { + if ((s32) D_800EA1C0 < 2) { + sp3C = temp_v0; + playerId = var_a2; + func_800C9018(var_a2 & 0xFF, 0x0100F926, var_a2, temp_a3); + } else { + sp3C = temp_v0; + playerId = var_a2; + func_800C9018(var_a2 & 0xFF, 0x01008026, var_a2, temp_a3); + } + var_a2 = playerId; } - phi_v0 = temp_a2 * 4; - phi_a2 = arg0; + *(D_800E9E14 + temp_v0) = 0; + temp_f0 = 1.0f - *(D_800E9F54 + temp_v0); + temp_f2 = *(&D_800EA130 + temp_v0); + temp_a1_2 = (var_a2 * 0x3C) + &D_800E9F7C; + temp_a1_2->unk10 = (f32) (temp_f0 - temp_f2); + if (temp_f0 < temp_f2) { + temp_a1_2->unk10 = 0.0f; + } + *(D_800E9DC4 + temp_v0) = temp_a1_2->unk2C; + *(D_800E9DD4 + temp_v0) = temp_a1_2->unk20; } - *(&D_800E9E14 + phi_v0) = 0; - temp_f0 = 1.0f - *(&D_800E9F54 + phi_v0); - temp_f2 = *(&D_800EA130 + phi_v0); - temp_a1_2 = (phi_a2 * 0x3C) + &D_800E9F7C; - temp_a1_2->unk10 = temp_f0 - temp_f2; - if (temp_f0 < temp_f2) { - temp_a1_2->unk10 = 0.0f; - } - *(&D_800E9DC4 + phi_v0) = temp_a1_2->unk2C; - *(&D_800E9DD4 + phi_v0) = temp_a1_2->unk20; - // Duplicate return node #23. Try simplifying control flow for better match } } #else @@ -3348,190 +2907,158 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5E38.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800E9DC4; -extern ? D_800E9DD4; -extern ? D_800E9DE4; -extern ? D_800E9DF4; -extern ? D_800E9E54; -extern ? D_800E9E64; -extern ? D_800E9EB4; -extern ? D_800E9EC4; -extern ? D_800E9ED4; -extern ? D_800E9EE4; -extern ? D_800E9F34; -extern ? D_800E9F74; -extern ? D_800E9F78; -extern ? D_800E9F7C; -extern f32 D_800F3678; -extern f32 D_800F367C; -extern f32 D_800F3680; -extern f32 D_800F3684; -extern f32 D_800F3688; -extern f32 D_800F368C; -extern f32 D_800F3690; -extern Player gPlayers; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +static f32 D_800E9DC4[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */ +static f32 D_800E9DD4[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static f32 D_800E9DE4[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static f32 D_800E9DF4[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static f32 D_800E9E54[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static f32 D_800E9E64[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static f32 D_800E9EB4[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static f32 D_800E9EC4[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static f32 D_800E9ED4[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static f32 D_800E9EE4[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static f32 D_800E9F34[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static ? D_800E9F74; /* unable to generate initializer; const */ +static ? D_800E9F78; /* unable to generate initializer; const */ +static ? D_800E9F7C; /* unable to generate initializer; const */ -void func_800C6108(s32 arg0) { - ? sp-10; - f32 *temp_a0; +void func_800C6108(s32 playerId) { + Player *temp_v1; f32 *temp_a2_2; f32 *temp_a3; f32 *temp_t0; - f32 *temp_t0_2; - f32 *temp_t2; - f32 *temp_t2_2; f32 *temp_v1_3; f32 *temp_v1_4; f32 *temp_v1_5; + f32 *var_a0; + f32 *var_t0; + f32 *var_t2; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; f32 temp_f0_4; f32 temp_f12; f32 temp_f2; - f32 temp_f2_2; s16 temp_t1; s32 temp_a2; - s32 temp_v0; u8 *temp_a3_2; - u8 temp_t0_3; + u8 temp_t0_2; u8 temp_v1_2; void *temp_a1; void *temp_a1_2; - void *temp_v1; - f32 *phi_t0; - f32 *phi_a0; - f32 *phi_t2; - temp_a2 = arg0 & 0xFF; - temp_v0 = temp_a2 * 4; - sp-10.unk10 = arg0; - temp_v1 = (temp_a2 * 0xDD8) + &gPlayers; - temp_f0 = temp_v1->unk98; - temp_a3 = temp_v0 + &D_800E9E64; - *temp_a3 = *(&D_800E9DD4 + temp_v0) + (temp_f0 / *(&D_800E9DC4 + temp_v0)); - if ((temp_f0 < 1800.0f) && ((temp_v1->unk44 & 0x20) != 0x20)) { + temp_a2 = playerId & 0xFF; + unksp-10.unk10 = playerId; + temp_v1 = &gPlayers[temp_a2]; + temp_f0 = temp_v1->unk_098; + temp_a3 = &D_800E9E64[temp_a2]; + *temp_a3 = D_800E9DD4[temp_a2] + (temp_f0 / D_800E9DC4[temp_a2]); + if ((temp_f0 < 1800.0f) && ((temp_v1->unk_044 & 0x20) != 0x20)) { temp_a1 = (temp_a2 * 0x3C) + &D_800E9F7C; *temp_a3 = temp_a1->unk28 + (temp_f0 / temp_a1->unk34); } temp_a1_2 = (temp_a2 * 0x3C) + &D_800E9F7C; - if (temp_v1->unk94 > 4.75f) { - temp_a0 = temp_v0 + &D_800E9EB4; - temp_t0 = temp_v0 + &D_800E9DE4; - phi_a0 = temp_a0; - if (*temp_a0 < (temp_a1_2->unk18 + D_800F3678)) { - *temp_t0 = *temp_t0 + D_800F367C; + if (temp_v1->unk_094 > 4.75f) { + var_a0 = &D_800E9EB4[temp_a2]; + temp_t0 = &D_800E9DE4[temp_a2]; + if (*var_a0 < (temp_a1_2->unk18 + 0.4f)) { + *temp_t0 += 0.005f; } - phi_t0 = temp_v0 + &D_800E9DE4; + var_t0 = &D_800E9DE4[temp_a2]; } else { - temp_t0_2 = temp_v0 + &D_800E9DE4; - *temp_t0_2 = 0.0f; - phi_t0 = temp_t0_2; - phi_a0 = temp_v0 + &D_800E9EB4; + var_t0 = &D_800E9DE4[temp_a2]; + var_a0 = &D_800E9EB4[temp_a2]; + *var_t0 = 0.0f; } - temp_t1 = temp_v1->unkC0; + temp_t1 = temp_v1->unk_0C0; if (temp_t1 > 0) { - temp_t2 = temp_v0 + &D_800E9E54; - *temp_t2 = temp_t1; - phi_t2 = temp_t2; + var_t2 = &D_800E9E54[temp_a2]; + *var_t2 = (f32) temp_t1; } else { - temp_t2_2 = temp_v0 + &D_800E9E54; - *temp_t2_2 = -temp_t1; - phi_t2 = temp_t2_2; + var_t2 = &D_800E9E54[temp_a2]; + *var_t2 = (f32) -temp_t1; } - if ((temp_v1->unkBC & 0x10) == 0x10) { - *phi_a0 = *phi_t0 + *temp_a3; + if ((temp_v1->unk_0BC & 0x10) == 0x10) { + *var_a0 = *var_t0 + *temp_a3; } else { - temp_f2 = D_800F3680; - temp_f0_2 = (*temp_a3 + *phi_t0) - (*phi_t2 / D_800F3684); - *phi_a0 = temp_f0_2; - if (temp_f0_2 < temp_f2) { - *phi_a0 = temp_f2; + temp_f0_2 = (*temp_a3 + *var_t0) - (*var_t2 / 12000.0f); + *var_a0 = temp_f0_2; + if (temp_f0_2 < 0.01f) { + *var_a0 = 0.01f; } } temp_v1_2 = *(&D_800E9F74 + temp_a2); temp_a3_2 = temp_a2 + &D_800E9F78; if ((temp_v1_2 != 0) || (*(&D_800E9F78 + temp_a2) != 0)) { - temp_t0_3 = *temp_a3_2; + temp_t0_2 = *temp_a3_2; if (temp_v1_2 != 0) { - if (temp_t0_3 < 0xF) { - *temp_a3_2 = temp_t0_3 + 1; - temp_v1_3 = temp_v0 + &D_800E9DF4; - *temp_v1_3 = *temp_v1_3 + D_800F3688; + if ((s32) temp_t0_2 < 0xF) { + *temp_a3_2 = temp_t0_2 + 1; + temp_v1_3 = &D_800E9DF4[temp_a2]; + *temp_v1_3 += 0.03f; } - } else if (temp_t0_3 != 0) { - *temp_a3_2 = temp_t0_3 - 1; - temp_v1_4 = temp_v0 + &D_800E9DF4; - *temp_v1_4 = *temp_v1_4 - D_800F368C; + } else if (temp_t0_2 != 0) { + *temp_a3_2 = temp_t0_2 - 1; + temp_v1_4 = &D_800E9DF4[temp_a2]; + *temp_v1_4 -= 0.03f; } - *phi_a0 = *phi_a0 - *(&D_800E9DF4 + temp_v0); + *var_a0 -= D_800E9DF4[temp_a2]; } - temp_a2_2 = temp_v0 + &D_800E9EC4; - temp_f2_2 = *temp_a2_2; - temp_f0_3 = *phi_a0; - temp_f12 = temp_f0_3 - temp_f2_2; - temp_v1_5 = temp_v0 + &D_800E9EE4; + temp_a2_2 = &D_800E9EC4[temp_a2]; + temp_f2 = *temp_a2_2; + temp_f0_3 = *var_a0; + temp_f12 = temp_f0_3 - temp_f2; + temp_v1_5 = &D_800E9EE4[temp_a2]; *temp_v1_5 = temp_f12; if ((temp_f12 > 0.5f) || (*temp_v1_5 < 0.5f)) { temp_f0_4 = *temp_v1_5 * 0.25f; - *(&D_800E9ED4 + temp_v0) = temp_f0_4; - temp_a1_2->unkC = *(&D_800E9F34 + temp_v0) + (temp_f2_2 + temp_f0_4); + D_800E9ED4[temp_a2] = temp_f0_4; + temp_a1_2->unkC = (f32) (D_800E9F34[temp_a2] + (temp_f2 + temp_f0_4)); } else { - temp_a1_2->unkC = *(&D_800E9F34 + temp_v0) + temp_f0_3; + temp_a1_2->unkC = (f32) (D_800E9F34[temp_a2] + temp_f0_3); } if (temp_a1_2->unkC > 4.0f) { temp_a1_2->unkC = 4.0f; } *temp_a2_2 = temp_a1_2->unkC; - temp_a1_2->unk38 = (temp_a1_2->unkC / 1.5f) + D_800F3690; + temp_a1_2->unk38 = (f32) ((temp_a1_2->unkC / 1.5f) + 0.4f); } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C6108.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -static ? D_800E9E24; /* unable to generate initializer; const */ -static ? D_800E9E34; /* unable to generate initializer; const */ -static ? D_800E9E54; /* unable to generate initializer; const */ -static ? D_800E9E74; /* unable to generate initializer; const */ -static ? D_800E9EF4; /* unable to generate initializer; const */ -static ? D_800E9F04; /* unable to generate initializer; const */ +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +static s32 D_800E9E24[4] = { 0, 0, 0, 0 }; /* const */ +static s32 D_800E9E34[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; /* const */ +static f32 D_800E9E54[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static s32 D_800E9E74[4] = { 0, 0, 0, 0 }; /* const */ +static f32 D_800E9EF4[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */ +static f32 D_800E9F04[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */ static ? D_800E9F24; /* unable to generate initializer; const */ void func_800C64A0(s32 playerId) { - f32 *temp_v1; - f32 *temp_v1_2; - f32 *temp_v1_3; - f32 *temp_v1_4; + f32 *var_v1; + f32 *var_v1_2; + f32 var_f16; s32 temp_t6; s32 temp_t7; - s32 temp_v0; - f32 *phi_v1; - Player *phi_a1; - f32 phi_f16; - f32 *phi_v1_2; temp_t6 = playerId & 0xFF; - temp_v0 = temp_t6 * 4; unksp-10.unk10 = playerId; - temp_t7 = *(&D_800E9E74 + temp_v0); + temp_t7 = D_800E9E74[temp_t6]; switch (temp_t7) { case 3: - temp_v1 = temp_v0 + &D_800E9EF4; - *temp_v1 = (gPlayers[temp_t6].unk_094 / 5.0f) + 0.2f; - phi_v1 = temp_v1; - phi_a1 = &gPlayers[temp_t6]; + var_v1 = &D_800E9EF4[temp_t6]; + *var_v1 = (gPlayers[temp_t6].unk_094 / 5.0f) + 0.2f; break; case 1: case 13: case 14: case 17: - temp_v1_2 = temp_v0 + &D_800E9EF4; - *temp_v1_2 = ((*(&D_800E9E54 + temp_v0) - 3500.0f) / 3000.0f) + 0.4f; - phi_v1 = temp_v1_2; - phi_a1 = &gPlayers[temp_t6]; + var_v1 = &D_800E9EF4[temp_t6]; + *var_v1 = ((D_800E9E54[temp_t6] - 3500.0f) / 3000.0f) + 0.4f; break; case 4: case 5: @@ -3548,241 +3075,219 @@ void func_800C64A0(s32 playerId) { case 29: case 30: case 31: - temp_v1_3 = temp_v0 + &D_800E9EF4; - *temp_v1_3 = (gPlayers[temp_t6].unk_094 / 5.0f) + 0.2f; - phi_v1 = temp_v1_3; - phi_a1 = &gPlayers[temp_t6]; + var_v1 = &D_800E9EF4[temp_t6]; + *var_v1 = (gPlayers[temp_t6].unk_094 / 5.0f) + 0.2f; break; default: - temp_v1_4 = temp_v0 + &D_800E9EF4; - *temp_v1_4 = 1.0f; - phi_v1 = temp_v1_4; - phi_a1 = &gPlayers[temp_t6]; + var_v1 = &D_800E9EF4[temp_t6]; + *var_v1 = 1.0f; break; } - if (*phi_v1 > 1.0f) { - *phi_v1 = 1.0f; + if (*var_v1 > 1.0f) { + *var_v1 = 1.0f; } - if (*phi_v1 < 0.0f) { - *phi_v1 = 0.0f; + if (*var_v1 < 0.0f) { + *var_v1 = 0.0f; } - if ((phi_a1->unk_044 & 0x20) == 0x20) { - phi_f16 = 0.56f - (*(&D_800E9E24 + temp_v0) * 0.06f); - phi_v1_2 = temp_v0 + &D_800E9F04; + if ((gPlayers[temp_t6].unk_044 & 0x20) == 0x20) { + var_v1_2 = &D_800E9F04[temp_t6]; + var_f16 = 0.56f - ((f32) D_800E9E24[temp_t6] * 0.06f); } else { - phi_f16 = (*(&D_800E9E34 + temp_v0) / 50.0f) + 0.25f; - phi_v1_2 = temp_v0 + &D_800E9F04; + var_v1_2 = &D_800E9F04[temp_t6]; + var_f16 = ((f32) D_800E9E34[temp_t6] / 50.0f) + 0.25f; } - *phi_v1_2 = phi_f16; + *var_v1_2 = var_f16; if (*(&D_800E9F24 + temp_t6) != 0) { - *phi_v1_2 = 0.0f; + *var_v1_2 = 0.0f; } - if (*phi_v1_2 > 0.9f) { - *phi_v1_2 = 0.9f; + if (*var_v1_2 > 0.9f) { + *var_v1_2 = 0.9f; } } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C64A0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800E9E54; -extern ? D_800E9E74; -extern ? D_800E9F14; -extern f32 D_800F3730; -extern f32 D_800F3734; -extern f32 D_800F3738; -extern Player gPlayers; +#ifdef NEEDS_RODATA +// data/rodata_audio_2.s +extern f32 D_800F3730;// = 0.6f; +extern f32 D_800F3734;// = 13000.0f; +extern f32 D_800F3738;// = 0.95f -void func_800C6758(s32 arg0) { - ? sp-10; - s32 temp_t6; - s32 temp_v0; - s32 temp_v1; - - temp_t6 = arg0 & 0xFF; - temp_v1 = temp_t6 * 4; - sp-10.unk10 = arg0; - temp_v0 = *(&D_800E9E74 + temp_v1); - if (temp_v0 != 2) { - if (temp_v0 != 3) { - if ((temp_v0 != 0xD) && (temp_v0 != 0x11)) { - *(&D_800E9F14 + temp_v1) = 1.0f; - return; - } - goto block_6; - } - *(&D_800E9F14 + temp_v1) = (*(&gPlayers + 0x94 + (temp_t6 * 0xDD8)) / 9.0f) + D_800F3730; - return; +void func_800C6758(u8 playerId) { + switch (D_800E9E74[playerId]) { /* irregular */ + case 3: + D_800E9F14[playerId] = (gPlayers[playerId].unk_094 / 9.0f) + 0.6f; + break; + case 2: + case 13: + case 17: + D_800E9F14[playerId] = (D_800E9E54[playerId] / 13000.0f) + 0.95f; + break; + default: + D_800E9F14[playerId] = 1.0f; + break; } -block_6: - *(&D_800E9F14 + temp_v1) = (*(&D_800E9E54 + temp_v1) / D_800F3734) + D_800F3738; } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C6758.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void func_800C5578(void *, s32, u8); /* extern */ -void play_sound(?, void *, u8, ? *, ? *, void *); /* extern */ -static ? D_800E9E74; /* unable to generate initializer; const */ -static ? D_800E9E84; /* unable to generate initializer; const */ -static ? D_800E9E94; /* unable to generate initializer; const */ -static ? D_800E9EF4; /* unable to generate initializer; const */ -static ? D_800E9F14; /* unable to generate initializer; const */ +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C5578(f32 *, s32, u8); /* extern */ +static s32 D_800E9E84[4] = { 0, 0, 0, 0 }; /* const */ +static s32 D_800E9E94[4] = { 0, 0, 0, 0 }; /* const */ +static f32 D_800E9EF4[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */ static ? D_800E9F7C; /* unable to generate initializer; const */ static ? D_800EA0EC; /* unable to generate initializer; const */ -static ? D_800EA1D4; /* unable to generate initializer; const */ +s32 D_800E9E74[4] = { 0, 0, 0, 0 }; /* const */ +f32 D_800E9F14[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */ +u8 D_800EA108 = 0; /* const */ void func_800C683C(u8 arg0) { s32 sp4C; s32 *sp40; + f32 *temp_s0; s32 *temp_s1; s32 *temp_s2; s32 *temp_t0; s32 temp_t6; - s32 temp_v0; u8 temp_a2; - void *temp_s0; temp_a2 = arg0 & 0xFF; - if (D_800EA108 == 0) { - temp_v0 = temp_a2 * 4; - if (*(&D_800EA0EC + temp_a2) == 0) { - temp_t0 = temp_v0 + &D_800E9E84; - sp40 = temp_t0; - temp_s2 = temp_v0 + &D_800E9E74; - if (*temp_s2 != *temp_t0) { - temp_s0 = (temp_a2 * 0x3C) + &D_800E9F7C; - temp_s1 = temp_v0 + &D_800E9E94; - sp4C = temp_v0; - arg0 = temp_a2; - func_800C5578(temp_s0, *temp_s1, temp_a2); - temp_t6 = *temp_s2; - switch (temp_t6) { - case 3: - play_sound(0x100F908, temp_s0, arg0, temp_v0 + &D_800E9F14, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F908; - break; - case 18: - play_sound(0x100F81D, temp_s0, arg0, &D_800EA1D4, &D_800EA1D4, temp_s0 + 0x14); - *temp_s1 = 0x100F81D; - break; - case 19: - play_sound(0x100F822, temp_s0, arg0, &D_800EA1D4, &D_800EA1D4, temp_s0 + 0x14); - *temp_s1 = 0x100F822; - break; - case 1: - play_sound(0x100F009, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F009; - break; - case 2: - play_sound(0x100F40A, temp_s0, arg0, temp_v0 + &D_800E9F14, &D_800EA1D4, temp_s0 + 0x14); - *temp_s1 = 0x100F40A; - break; - case 17: - play_sound(0x100F01E, temp_s0, arg0, temp_v0 + &D_800E9F14, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F01E; - break; - case 15: - play_sound(0x100F01F, temp_s0, arg0, temp_v0 + &D_800E9F14, &D_800EA1D4, temp_s0 + 0x14); - *temp_s1 = 0x100F01F; - break; - case 16: - play_sound(0x100F021, temp_s0, arg0, temp_v0 + &D_800E9F14, &D_800EA1D4, temp_s0 + 0x14); - *temp_s1 = 0x100F021; - break; - case 20: - play_sound(0x100F027, temp_s0, arg0, temp_v0 + &D_800E9F14, &D_800EA1D4, temp_s0 + 0x14); - *temp_s1 = 0x100F027; - break; - case 25: - play_sound(0x100F020, temp_s0, arg0, temp_v0 + &D_800E9F14, &D_800EA1D4, temp_s0 + 0x14); - *temp_s1 = 0x100F020; - break; - case 26: - play_sound(0x100F023, temp_s0, arg0, temp_v0 + &D_800E9F14, &D_800EA1D4, temp_s0 + 0x14); - *temp_s1 = 0x100F023; - break; - case 27: - play_sound(0x1008046, temp_s0, arg0, temp_v0 + &D_800E9F14, &D_800EA1D4, temp_s0 + 0x14); - *temp_s1 = 0x1008046; - break; - case 28: - play_sound(0x100F025, temp_s0, arg0, temp_v0 + &D_800E9F14, &D_800EA1D4, temp_s0 + 0x14); - *temp_s1 = 0x100F025; - break; - case 4: - play_sound(0x100F00B, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F00B; - break; - case 5: - play_sound(0x100F00C, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F00C; - break; - case 6: - play_sound(0x100F00D, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F00D; - break; - case 7: - play_sound(0x100F00E, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F00E; - break; - case 8: - play_sound(0x100F00F, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F00F; - break; - case 9: - play_sound(0x100F010, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F010; - break; - case 10: - case 14: - play_sound(0x100F011, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F011; - break; - case 11: - play_sound(0x100F012, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F012; - break; - case 12: - play_sound(0x100F013, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F013; - break; - case 29: - play_sound(0x100F048, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F048; - break; - case 30: - play_sound(0x100F049, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F049; - break; - case 31: - play_sound(0x100F04A, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F04A; - break; - case 13: - case 22: - play_sound(0x100F029, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F029; - break; - case 23: - play_sound(0x100F02A, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F02A; - break; - case 24: - play_sound(0x100F02B, temp_s0, arg0, &D_800EA1D4, temp_v0 + &D_800E9EF4, temp_s0 + 0x14); - *temp_s1 = 0x100F02B; - break; - default: - func_800C5578(temp_s0, *temp_s1, arg0); - break; - } + if ((D_800EA108 == 0) && (*(&D_800EA0EC + temp_a2) == 0)) { + temp_t0 = &D_800E9E84[temp_a2]; + sp40 = temp_t0; + temp_s2 = &D_800E9E74[temp_a2]; + if (*temp_s2 != *temp_t0) { + temp_s0 = (temp_a2 * 0x3C) + &D_800E9F7C; + temp_s1 = &D_800E9E94[temp_a2]; + sp4C = temp_a2 * 4; + arg0 = temp_a2; + func_800C5578(temp_s0, *temp_s1, temp_a2); + temp_t6 = *temp_s2; + switch (temp_t6) { + case 3: + play_sound(0x0100F908U, temp_s0, arg0, &D_800E9F14[temp_a2], &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F908; + break; + case 18: + play_sound(0x0100F81DU, temp_s0, arg0, &D_800EA1D4, &D_800EA1D4, (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F81D; + break; + case 19: + play_sound(0x0100F822U, temp_s0, arg0, &D_800EA1D4, &D_800EA1D4, (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F822; + break; + case 1: + play_sound(0x0100F009U, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F009; + break; + case 2: + play_sound(0x0100F40AU, temp_s0, arg0, &D_800E9F14[temp_a2], &D_800EA1D4, (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F40A; + break; + case 17: + play_sound(0x0100F01EU, temp_s0, arg0, &D_800E9F14[temp_a2], &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F01E; + break; + case 15: + play_sound(0x0100F01FU, temp_s0, arg0, &D_800E9F14[temp_a2], &D_800EA1D4, (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F01F; + break; + case 16: + play_sound(0x0100F021U, temp_s0, arg0, &D_800E9F14[temp_a2], &D_800EA1D4, (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F021; + break; + case 20: + play_sound(0x0100F027U, temp_s0, arg0, &D_800E9F14[temp_a2], &D_800EA1D4, (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F027; + break; + case 25: + play_sound(0x0100F020U, temp_s0, arg0, &D_800E9F14[temp_a2], &D_800EA1D4, (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F020; + break; + case 26: + play_sound(0x0100F023U, temp_s0, arg0, &D_800E9F14[temp_a2], &D_800EA1D4, (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F023; + break; + case 27: + play_sound(0x01008046U, temp_s0, arg0, &D_800E9F14[temp_a2], &D_800EA1D4, (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x01008046; + break; + case 28: + play_sound(0x0100F025U, temp_s0, arg0, &D_800E9F14[temp_a2], &D_800EA1D4, (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F025; + break; + case 4: + play_sound(0x0100F00BU, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F00B; + break; + case 5: + play_sound(0x0100F00CU, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F00C; + break; + case 6: + play_sound(0x0100F00DU, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F00D; + break; + case 7: + play_sound(0x0100F00EU, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F00E; + break; + case 8: + play_sound(0x0100F00FU, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F00F; + break; + case 9: + play_sound(0x0100F010U, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F010; + break; + case 10: + case 14: + play_sound(0x0100F011U, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F011; + break; + case 11: + play_sound(0x0100F012U, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F012; + break; + case 12: + play_sound(0x0100F013U, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F013; + break; + case 29: + play_sound(0x0100F048U, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F048; + break; + case 30: + play_sound(0x0100F049U, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F049; + break; + case 31: + play_sound(0x0100F04AU, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F04A; + break; + case 13: + case 22: + play_sound(0x0100F029U, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F029; + break; + case 23: + play_sound(0x0100F02AU, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F02A; + break; + case 24: + play_sound(0x0100F02BU, temp_s0, arg0, &D_800EA1D4, &D_800E9EF4[temp_a2], (u8 *) (temp_s0 + 0x14)); + *temp_s1 = 0x0100F02B; + break; + default: + func_800C5578(temp_s0, *temp_s1, arg0); + break; } - *sp40 = *temp_s2; } + *sp40 = *temp_s2; } } #else @@ -3790,99 +3295,94 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C683C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -static ? D_800E9E54; /* unable to generate initializer; const */ -static ? D_800E9E74; /* unable to generate initializer; const */ -static ? D_800E9F74; /* unable to generate initializer; const */ -static ? D_800EA0EC; /* unable to generate initializer; const */ +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +static f32 D_800E9E54[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +static s32 D_800E9E74[4] = { 0, 0, 0, 0 }; /* const */ +static u8 D_800E9F74; /* unable to generate initializer; const */ +static u8 D_800EA0EC; /* unable to generate initializer; const */ +static u8 D_800EA1C0 = 0; /* const */ void func_800C70A8(s32 playerId) { + Player *temp_v1; s32 *temp_v0; - s32 temp_a0; - s32 temp_a0_2; s32 temp_a1; - s32 temp_t1; - s32 temp_v1; + s32 var_a0; + s32 var_t1; u8 temp_t2; u8 temp_t7; u8 temp_t9; - s32 phi_t1; - Player *phi_v1; - s32 phi_a0; temp_a1 = playerId & 0xFF; unksp-10.unk10 = playerId; - temp_v1 = temp_a1 * 4; if (*(&D_800EA0EC + temp_a1) == 0) { - temp_v0 = temp_v1 + &D_800E9E74; + temp_v0 = &D_800E9E74[temp_a1]; *temp_v0 = 0; - if ((*(&D_800E9E54 + temp_v1) > 3500.0f) || (temp_a0 = gPlayers[temp_a1].unk_0BC, temp_t1 = temp_a0 & 0x10, phi_t1 = temp_t1, phi_v1 = &gPlayers[temp_a1], phi_a0 = temp_a0, (temp_t1 == 0x10))) { - temp_t7 = gPlayers[temp_a1].unk_1D4; - temp_a0_2 = gPlayers[temp_a1].unk_0BC; + if ((D_800E9E54[temp_a1] > 3500.0f) || (var_a0 = gPlayers[temp_a1].unk_0BC, var_t1 = var_a0 & 0x10, (var_t1 == 0x10))) { + temp_v1 = &gPlayers[temp_a1]; + temp_t7 = temp_v1->boundingBoxCorners[2].surfaceType; + var_a0 = temp_v1->unk_0BC; *temp_v0 = 1; - phi_t1 = temp_a0_2 & 0x10; - phi_v1 = &gPlayers[temp_a1]; - phi_a0 = temp_a0_2; + var_t1 = var_a0 & 0x10; switch (temp_t7) { /* switch 1 */ case 2: /* switch 1 */ - *temp_v0 = 0xD; + *temp_v0 = 0x0000000D; break; case 3: /* switch 1 */ - *temp_v0 = 0xE; + *temp_v0 = 0x0000000E; break; case 6: /* switch 1 */ - *temp_v0 = 0x11; + *temp_v0 = 0x00000011; break; case 4: /* switch 1 */ - *temp_v0 = 0xF; + *temp_v0 = 0x0000000F; break; case 5: /* switch 1 */ - *temp_v0 = 0x10; + *temp_v0 = 0x00000010; break; case 9: /* switch 1 */ - *temp_v0 = 0x14; + *temp_v0 = 0x00000014; break; case 16: /* switch 1 */ - *temp_v0 = 0x19; + *temp_v0 = 0x00000019; break; case 17: /* switch 1 */ - *temp_v0 = 0x1A; + *temp_v0 = 0x0000001A; break; case 14: /* switch 1 */ - *temp_v0 = 0x1B; + *temp_v0 = 0x0000001B; break; } } - temp_t2 = phi_v1->unk_1D4; - if (phi_t1 == 0x10) { + temp_t2 = gPlayers[temp_a1].boundingBoxCorners[2].surfaceType; + if (var_t1 == 0x10) { *temp_v0 = 2; switch (temp_t2) { /* switch 2 */ case 2: /* switch 2 */ - *temp_v0 = 0xD; + *temp_v0 = 0x0000000D; break; case 3: /* switch 2 */ - *temp_v0 = 0xE; + *temp_v0 = 0x0000000E; break; case 6: /* switch 2 */ - *temp_v0 = 0x11; + *temp_v0 = 0x00000011; break; case 4: /* switch 2 */ - *temp_v0 = 0xF; + *temp_v0 = 0x0000000F; break; case 5: /* switch 2 */ - *temp_v0 = 0x10; + *temp_v0 = 0x00000010; break; case 9: /* switch 2 */ - *temp_v0 = 0x14; + *temp_v0 = 0x00000014; break; case 16: /* switch 2 */ - *temp_v0 = 0x19; + *temp_v0 = 0x00000019; break; case 17: /* switch 2 */ - *temp_v0 = 0x1A; + *temp_v0 = 0x0000001A; break; case 14: /* switch 2 */ - *temp_v0 = 0x1B; + *temp_v0 = 0x0000001B; break; } } @@ -3897,30 +3397,30 @@ void func_800C70A8(s32 playerId) { } break; case 7: /* switch 3 */ - if (*temp_v0 == 0xC) { - *temp_v0 = 0xA; + if (*temp_v0 == 0x0000000C) { + *temp_v0 = 0x0000000A; } else if (D_800EA1C0 == 0) { - *temp_v0 = 0xB; + *temp_v0 = 0x0000000B; } else { - *temp_v0 = 0xA; + *temp_v0 = 0x0000000A; } break; case 13: /* switch 3 */ - if (*temp_v0 == 0x18) { - *temp_v0 = 0x16; + if (*temp_v0 == 0x00000018) { + *temp_v0 = 0x00000016; } else if (D_800EA1C0 == 0) { - *temp_v0 = 0x17; + *temp_v0 = 0x00000017; } else { - *temp_v0 = 0x16; + *temp_v0 = 0x00000016; } break; case 11: /* switch 3 */ - if (*temp_v0 == 0x1F) { - *temp_v0 = 0x1D; + if (*temp_v0 == 0x0000001F) { + *temp_v0 = 0x0000001D; } else if (D_800EA1C0 == 0) { - *temp_v0 = 0x1E; + *temp_v0 = 0x0000001E; } else { - *temp_v0 = 0x1D; + *temp_v0 = 0x0000001D; } break; case 10: /* switch 3 */ @@ -3933,20 +3433,20 @@ void func_800C70A8(s32 playerId) { *temp_v0 = 7; } } else { - *temp_v0 = 0x1C; + *temp_v0 = 0x0000001C; } break; case 16: /* switch 3 */ - *temp_v0 = 0x19; + *temp_v0 = 0x00000019; break; case 17: /* switch 3 */ - *temp_v0 = 0x1A; + *temp_v0 = 0x0000001A; break; case 14: /* switch 3 */ - *temp_v0 = 0x1B; + *temp_v0 = 0x0000001B; break; } - temp_t9 = phi_v1->unk_1EC; + temp_t9 = gPlayers[temp_a1].boundingBoxCorners[3].surfaceType; switch (temp_t9) { /* switch 4 */ case 8: /* switch 4 */ if (*temp_v0 == 5) { @@ -3958,30 +3458,30 @@ void func_800C70A8(s32 playerId) { } break; case 7: /* switch 4 */ - if (*temp_v0 == 0xB) { - *temp_v0 = 0xA; + if (*temp_v0 == 0x0000000B) { + *temp_v0 = 0x0000000A; } else if (D_800EA1C0 == 0) { - *temp_v0 = 0xC; + *temp_v0 = 0x0000000C; } else { - *temp_v0 = 0xA; + *temp_v0 = 0x0000000A; } break; case 13: /* switch 4 */ - if (*temp_v0 == 0x17) { - *temp_v0 = 0x16; + if (*temp_v0 == 0x00000017) { + *temp_v0 = 0x00000016; } else if (D_800EA1C0 == 0) { - *temp_v0 = 0x18; + *temp_v0 = 0x00000018; } else { - *temp_v0 = 0x16; + *temp_v0 = 0x00000016; } break; case 11: /* switch 4 */ - if (*temp_v0 == 0x1E) { - *temp_v0 = 0x1D; + if (*temp_v0 == 0x0000001E) { + *temp_v0 = 0x0000001D; } else if (D_800EA1C0 == 0) { - *temp_v0 = 0x1F; + *temp_v0 = 0x0000001F; } else { - *temp_v0 = 0x1D; + *temp_v0 = 0x0000001D; } break; case 10: /* switch 4 */ @@ -3994,29 +3494,29 @@ void func_800C70A8(s32 playerId) { *temp_v0 = 7; } } else { - *temp_v0 = 0x1C; + *temp_v0 = 0x0000001C; } break; case 16: /* switch 4 */ - *temp_v0 = 0x19; + *temp_v0 = 0x00000019; break; case 17: /* switch 4 */ - *temp_v0 = 0x1A; + *temp_v0 = 0x0000001A; break; case 14: /* switch 4 */ - *temp_v0 = 0x1B; + *temp_v0 = 0x0000001B; break; } - if (((phi_v1->unk_094 < 0.5f) || ((phi_a0 & 8) == 8)) && (*temp_v0 != 0x1C)) { + if (((gPlayers[temp_a1].unk_094 < 0.5f) || ((var_a0 & 8) == 8)) && (*temp_v0 != 0x0000001C)) { *temp_v0 = 0; } - if ((((phi_a0 & 0x4000) == 0x4000) && ((phi_v1->unk_000 & 0x2000) != 0x2000)) || ((phi_a0 & 0x800) == 0x800) || ((phi_a0 & 0x80) == 0x80) || ((phi_a0 & 0x40) == 0x40) || ((phi_v1->unk_044 & 0x4000) == 0x4000)) { - *temp_v0 = 0x12; + if ((((var_a0 & 0x4000) == 0x4000) && ((gPlayers[temp_a1].unk_000 & 0x2000) != 0x2000)) || ((var_a0 & 0x800) == 0x800) || ((var_a0 & 0x80) == 0x80) || ((var_a0 & 0x40) == 0x40) || ((gPlayers[temp_a1].unk_044 & 0x4000) == 0x4000)) { + *temp_v0 = 0x00000012; } - if ((((phi_a0 & 0x20) == 0x20) && ((phi_v1->unk_000 & 0x2000) != 0x2000)) || ((phi_a0 & 0x800) == 0x800)) { - *temp_v0 = 0x13; + if ((((var_a0 & 0x20) == 0x20) && ((gPlayers[temp_a1].unk_000 & 0x2000) != 0x2000)) || ((var_a0 & 0x800) == 0x800)) { + *temp_v0 = 0x00000013; } - if (phi_v1->unk_20C != 0.0f) { + if (gPlayers[temp_a1].unk_20C != 0.0f) { *temp_v0 = 3; } } @@ -4026,227 +3526,104 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C70A8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C3448(?, ?); // extern -s32 func_800C3508(?); // extern -void func_800C5278(?); // extern -void func_800C5578(void *, s32); // extern -void func_800C8EF8(?); // extern -void func_800C9018(u8, ?); // extern -void func_800C9060(u8, ?); // extern -void func_800C90F4(u8, s32, s8 *, s32); // extern -void func_800C97C4(u8); // extern -void func_800C9A88(u8); // extern -void func_800C9D0C(u8); // extern -void func_800CA414(?, ?); // extern -extern s32 gPlayerWinningIndex; -extern ? D_800E9E74; -extern ? D_800E9E94; -extern ? D_800E9EA4; -extern ? D_800E9F7C; -extern ? D_800EA0EC; -extern u8 D_800EA0ED; -extern u8 D_800EA0EE; -extern u8 D_800EA0EF; -extern s8 D_800EA0F0; -extern u8 D_800EA104; -extern ? D_800EA130; -extern u8 D_800EA1C0; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C3448(?, ?); /* extern */ +s32 func_800C3508(?); /* extern */ +? func_800C5278(?); /* extern */ +? func_800C5578(void *, s32); /* extern */ +? func_800C9018(u8, ?); /* extern */ +? func_800C97C4(u8); /* extern */ +? func_800C9A88(u8); /* extern */ +? func_800C9D0C(u8); /* extern */ +? func_800CA414(?, ?); /* extern */ extern s8 D_801657E5; extern u8 D_8018ED90; -extern Player gPlayers; +extern s32 gPlayerWinningIndex; +static ? D_800E9E74; /* unable to generate initializer; const */ +static ? D_800E9E94; /* unable to generate initializer; const */ +static s32 D_800E9EA4[4] = { 0, 0, 0, 0 }; /* const */ +static ? D_800E9F7C; /* unable to generate initializer; const */ +static ? D_800EA0EC; /* unable to generate initializer; const */ +static u8 D_800EA0ED = 0; /* const */ +static u8 D_800EA0EE = 0; /* const */ +static u8 D_800EA0EF = 0; /* const */ +static s8 D_800EA0F0 = 0; /* const */ +static u8 D_800EA104 = 0; /* const */ +static ? D_800EA130; /* unable to generate initializer; const */ +static u8 D_800EA1C0 = 0; /* const */ -void func_800C76C0(u8 arg0) { +void func_800C76C0(u8 playerId) { s32 sp38; s32 *sp34; u8 *sp30; + Player *temp_v1; + Player *temp_v1_2; + f32 *var_at; + f32 var_f10; + s16 temp_v0_11; s16 temp_v0_12; - s16 temp_v0_13; - s16 temp_v0_8; - s16 temp_v0_9; + s16 temp_v0_3; + s16 temp_v0_4; s32 *temp_t0; s32 temp_t1; - s32 temp_t7; s32 temp_v0; - s32 temp_v0_11; - s32 temp_v1; + s32 temp_v0_10; + s32 temp_v1_3; s32 temp_v1_4; s32 temp_v1_5; s32 temp_v1_6; - s32 temp_v1_7; + s32 var_v1; s8 *temp_a2; - u8 *temp_v0_3; - u8 *temp_v0_7; - u8 temp_a0; + u8 *temp_v0_2; + u8 *temp_v0_5; u8 temp_t6; - u8 temp_v0_10; - u8 temp_v0_2; - u8 temp_v0_4; - u8 temp_v0_5; u8 temp_v0_6; - void *temp_v1_2; - void *temp_v1_3; - s32 phi_v1; - u8 phi_v0; - s32 phi_v1_2; - s32 phi_v0_2; - s32 phi_a3; - u8 phi_a0; - f32 phi_f10; - f32 *phi_at; + u8 temp_v0_7; + u8 temp_v0_8; + u8 temp_v0_9; + u8 var_a0; + u8 var_v0; - temp_t6 = arg0 & 0xFF; - temp_t7 = temp_t6 * 4; - temp_t0 = temp_t7 + &D_800E9EA4; + temp_t6 = playerId & 0xFF; + temp_t0 = &D_800E9EA4[temp_t6]; sp34 = temp_t0; - sp38 = temp_t7; - temp_v1 = *temp_t0; - phi_v1 = temp_v1; - if (temp_v1 != 0) { - temp_t1 = temp_v1 + 1; - if (temp_v1 < 0x2BC) { + sp38 = temp_t6 * 4; + var_v1 = *temp_t0; + if (var_v1 != 0) { + temp_t1 = var_v1 + 1; + if (var_v1 < 0x2BC) { *temp_t0 = temp_t1; - phi_v1 = temp_t1; + var_v1 = temp_t1; } - arg0 = temp_t6; - phi_v1_2 = phi_v1; - if (phi_v1 == 2) { - arg0 = temp_t6; - func_800C9018(temp_t6, 0x100FA28); - func_800C9018(arg0, 0x100FF2C); - func_800C9018(arg0, 0x100FA4C); - func_800C5578((arg0 * 0x3C) + &D_800E9F7C, *(&D_800E9E94 + sp38)); + playerId = temp_t6; + if (var_v1 == 2) { + playerId = temp_t6; + func_800C9018(temp_t6, 0x0100FA28); + func_800C9018(playerId, 0x0100FF2C); + func_800C9018(playerId, 0x0100FA4C); + func_800C5578((playerId * 0x3C) + &D_800E9F7C, *(&D_800E9E94 + sp38)); temp_v0 = gModeSelection; *(&D_800E9E74 + sp38) = 0; - if (temp_v0 != GRAND_PRIX) { - if (temp_v0 != TIME_TRIALS) { - if (temp_v0 != VERSUS) { - if (temp_v0 != BATTLE) { - - } else { - temp_v0_2 = D_800EA1C0; - if (temp_v0_2 != 1) { - if (temp_v0_2 != 2) { - if (temp_v0_2 != 3) { - - } else if ((D_800EA0EC.unk0 == 1) && (D_800EA0ED == 1) && (D_800EA0EE == 1) && (D_800EA0EF == 1)) { - func_800C5278(5); - func_800C9018(arg0, 0x1008026); - func_800C8EF8(0x17); - *(&D_800EA0EC + arg0) = 2; - func_800C90F4(arg0, (*(&gPlayers + 0x254 + (gPlayerWinningIndex * 0xDD8)) * 0x10) + 0x2900800D); - } - } else if ((D_800EA0EC.unk0 == 1) && (D_800EA0EC.unk1 == 1) && (D_800EA0EC.unk2 == 1)) { - func_800C5278(5); - func_800C9018(arg0, 0x1008026); - func_800C8EF8(0x17); - *(&D_800EA0EC + arg0) = 2; - func_800C90F4(arg0, (*(&gPlayers + 0x254 + (gPlayerWinningIndex * 0xDD8)) * 0x10) + 0x2900800D); - } - } else { - func_800C3448(0x100100FF); - func_800C3448(0x110100FF); - func_800C5278(5); - func_800C9018(arg0, 0x100F926); - func_800C8EF8(0x17); - *(&D_800EA0EC + arg0) = 2; - func_800C90F4(arg0, (*(&gPlayers + 0x254 + (gPlayerWinningIndex * 0xDD8)) * 0x10) + 0x2900800D); - } - } - } else { - temp_v0_3 = arg0 + &D_800EA0EC; - *temp_v0_3 = 2; - sp30 = temp_v0_3; - func_800C9060(arg0, 0x1900F103); - temp_v0_4 = D_800EA1C0; - if (temp_v0_4 != 1) { - if (temp_v0_4 != 2) { - if (temp_v0_4 != 3) { - - } else { - temp_v0_5 = D_800EA104; - if ((temp_v0_5 == 0) && (*sp30 == 1)) { - func_800C3448(0x100100FF); - func_800C3448(0x110100FF); - func_800C8EF8(0xD); - D_800EA104 = 1; - } else if ((temp_v0_5 == 1) && (*sp30 == 1)) { - if (func_800C3508(1) != 0xD) { - D_800EA104 = 0; - func_800C8EF8(0xE); - } - D_800EA104 = 2; - } else if ((temp_v0_5 == 2) && (*sp30 == 1)) { - func_800C5278(5); - if (func_800C3508(1) != 0xE) { - D_800EA104 = 0; - func_800CA414(0xE, 0x17); - } - D_800EA104 = 3; - } - } - } else { - temp_v0_6 = D_800EA104; - if ((temp_v0_6 == 0) && (*sp30 == 1)) { - func_800C3448(0x100100FF); - func_800C3448(0x110100FF); - func_800CA414(0xD, 0x17); - D_800EA104 = 1; - } else if ((temp_v0_6 == 1) && (*sp30 == 1)) { - func_800C5278(5); - if (func_800C3508(1) != 0xD) { - D_800EA104 = 0; - func_800CA414(0xE, 0x17); - } - D_800EA104 = 2; - } - } - } else { - func_800C3448(0x100100FF); - func_800C3448(0x110100FF); - func_800C97C4(arg0); - D_800EA0F0 = 2; - func_800C9A88(arg0); - func_800CA414(0xD, 0x17); - } - } - phi_v1_2 = *sp34; - } else { - func_800C3448(0x100100FF); - func_800C3448(0x110100FF); - func_800C97C4(arg0); - D_800EA0F0 = 2; - func_800C9A88(0); - *(&D_800EA0EC + arg0) = 2; - func_800C9060(arg0, 0x1900F103); - if (D_801657E5 == 1) { - func_800CA414(0xD, 0x10); - } else if (D_8018ED90 == 1) { - func_800CA414(0xE, 0x10); - } else { - func_800C3448(0x1640010, 0x10); - } - phi_v1_2 = *sp34; - } - } else { - temp_v0_7 = arg0 + &D_800EA0EC; - *temp_v0_7 = 2; - sp30 = temp_v0_7; - func_800C9060(arg0, 0x1900F103); + switch (temp_v0) { /* irregular */ + case 0: + temp_v0_2 = playerId + &D_800EA0EC; + *temp_v0_2 = 2; + sp30 = temp_v0_2; + func_800C9060(playerId, 0x1900F103U); if (D_800EA1C0 == 0) { func_800C3448(0x100100FF); func_800C3448(0x110100FF); func_800C5278(5); - temp_v0_8 = *(&gPlayers + 4 + (arg0 * 0xDD8)); - if (temp_v0_8 == 0) { - func_800C97C4(arg0); + temp_v0_3 = *(&gPlayers->currentRank + (playerId * 0xDD8)); + if (temp_v0_3 == 0) { + func_800C97C4(playerId); D_800EA0F0 = 2; - func_800C9A88(arg0); + func_800C9A88(playerId); func_800CA414(0xD, 0x10); - } else if (temp_v0_8 < 4) { - func_800C97C4(arg0); + } else if (temp_v0_3 < 4) { + func_800C97C4(playerId); D_800EA0F0 = 2; - func_800C9A88(arg0); + func_800C9A88(playerId); func_800CA414(0xE, 0x10); } else { func_800C3448(0xC1606400); @@ -4254,201 +3631,283 @@ void func_800C76C0(u8 arg0) { } } else { *sp30 = 2; - func_800C9060(arg0, 0x1900F103); - temp_v0_9 = *(&gPlayers + 4 + (arg0 * 0xDD8)); - if (temp_v0_9 == 0) { + func_800C9060(playerId, 0x1900F103U); + temp_v0_4 = *(&gPlayers->currentRank + (playerId * 0xDD8)); + if (temp_v0_4 == 0) { func_800C3448(0x100100FF); func_800C3448(0x110100FF); - func_800C97C4(arg0); + func_800C97C4(playerId); D_800EA0F0 = 2; - func_800C9A88(arg0); + func_800C9A88(playerId); func_800CA414(0xD, 0x10); goto block_23; } - if (temp_v0_9 < 4) { + if (temp_v0_4 < 4) { if (D_800EA104 == 0) { func_800C3448(0x100100FF); func_800C3448(0x110100FF); } - func_800C97C4(arg0); + func_800C97C4(playerId); D_800EA0F0 = 2; - func_800C9A88(arg0); + func_800C9A88(playerId); func_800CA414(0xE, 0x10); goto block_23; } - temp_v0_10 = D_800EA104; - phi_v0 = temp_v0_10; - if (temp_v0_10 == 0) { + var_v0 = D_800EA104; + if (var_v0 == 0) { func_800C3448(0x100100FF); func_800C3448(0x110100FF); func_800C3448(0xC1606400); func_800CA414(0xF, 0x18); block_23: - phi_v0 = D_800EA104; + var_v0 = D_800EA104; } - if ((phi_v0 != 0) || (*sp30 != 1)) { + if ((var_v0 != 0) || (*sp30 != 1)) { func_800C5278(5); } } - phi_v1_2 = *sp34; + var_v1 = *sp34; + break; + case 1: + func_800C3448(0x100100FF); + func_800C3448(0x110100FF); + func_800C97C4(playerId); + D_800EA0F0 = 2; + func_800C9A88(0U); + *(&D_800EA0EC + playerId) = 2; + func_800C9060(playerId, 0x1900F103U); + if (D_801657E5 == 1) { + func_800CA414(0xD, 0x10); + } else if (D_8018ED90 == 1) { + func_800CA414(0xE, 0x10); + } else { + func_800C3448(0x01640010, 0x10); + } + var_v1 = *sp34; + break; + case 2: + temp_v0_5 = playerId + &D_800EA0EC; + *temp_v0_5 = 2; + sp30 = temp_v0_5; + func_800C9060(playerId, 0x1900F103U); + temp_v0_6 = D_800EA1C0; + switch (temp_v0_6) { /* switch 1; irregular */ + case 1: /* switch 1 */ + func_800C3448(0x100100FF); + func_800C3448(0x110100FF); + func_800C97C4(playerId); + D_800EA0F0 = 2; + func_800C9A88(playerId); + func_800CA414(0xD, 0x17); + break; + case 2: /* switch 1 */ + temp_v0_7 = D_800EA104; + if ((temp_v0_7 == 0) && (*sp30 == 1)) { + func_800C3448(0x100100FF); + func_800C3448(0x110100FF); + func_800CA414(0xD, 0x17); + D_800EA104 = 1; + } else if ((temp_v0_7 == 1) && (*sp30 == 1)) { + func_800C5278(5); + if (func_800C3508(1) != 0xD) { + D_800EA104 = 0; + func_800CA414(0xE, 0x17); + } + D_800EA104 = 2; + } + break; + case 3: /* switch 1 */ + temp_v0_8 = D_800EA104; + if ((temp_v0_8 == 0) && (*sp30 == 1)) { + func_800C3448(0x100100FF); + func_800C3448(0x110100FF); + func_800C8EF8(0xD); + D_800EA104 = 1; + } else if ((temp_v0_8 == 1) && (*sp30 == 1)) { + if (func_800C3508(1) != 0xD) { + D_800EA104 = 0; + func_800C8EF8(0xE); + } + D_800EA104 = 2; + } else if ((temp_v0_8 == 2) && (*sp30 == 1)) { + func_800C5278(5); + if (func_800C3508(1) != 0xE) { + D_800EA104 = 0; + func_800CA414(0xE, 0x17); + } + D_800EA104 = 3; + } + break; + } + default: +block_76: + var_v1 = *sp34; + break; + case 3: + temp_v0_9 = D_800EA1C0; + switch (temp_v0_9) { /* switch 2; irregular */ + case 1: /* switch 2 */ + func_800C3448(0x100100FF); + func_800C3448(0x110100FF); + func_800C5278(5); + func_800C9018(playerId, 0x0100F926); + func_800C8EF8(0x17); + *(&D_800EA0EC + playerId) = 2; + func_800C90F4(playerId, (*(&gPlayers->characterId + (gPlayerWinningIndex * 0xDD8)) * 0x10) + 0x2900800D); + break; + case 2: /* switch 2 */ + if ((D_800EA0EC.unk0 == 1) && (D_800EA0EC.unk1 == 1) && (D_800EA0EC.unk2 == 1)) { + func_800C5278(5); + func_800C9018(playerId, 0x01008026); + func_800C8EF8(0x17); + *(&D_800EA0EC + playerId) = 2; + func_800C90F4(playerId, (*(&gPlayers->characterId + (gPlayerWinningIndex * 0xDD8)) * 0x10) + 0x2900800D); + } + break; + case 3: /* switch 2 */ + if ((D_800EA0EC.unk0 == 1) && (D_800EA0ED == 1) && (D_800EA0EE == 1) && (D_800EA0EF == 1)) { + func_800C5278(5); + func_800C9018(playerId, 0x01008026); + func_800C8EF8(0x17); + *(&D_800EA0EC + playerId) = 2; + func_800C90F4(playerId, (*(&gPlayers->characterId + (gPlayerWinningIndex * 0xDD8)) * 0x10) + 0x2900800D); + } + break; + } + goto block_76; } } - temp_a0 = arg0; - temp_v0_11 = gModeSelection; - phi_v0_2 = temp_v0_11; - phi_a3 = 1; - phi_a0 = temp_a0; - phi_v0_2 = temp_v0_11; - phi_a3 = 1; - phi_v0_2 = temp_v0_11; - if (phi_v1_2 == 0x1E) { - if (temp_v0_11 != GRAND_PRIX) { - if (temp_v0_11 != TIME_TRIALS) { - if (temp_v0_11 != VERSUS) { - if (temp_v0_11 != BATTLE) { - - } - } else { - temp_v1_2 = (temp_a0 * 0xDD8) + &gPlayers; - arg0 = temp_a0; - if (temp_v1_2->unk4 == 0) { - *(&D_800EA0EC + temp_a0) = 2; - arg0 = temp_a0; - func_800C90F4(temp_a0, (temp_v1_2->unk254 * 0x10) + 0x2900800D); - phi_v0_2 = gModeSelection; - } - phi_a3 = 1; - goto block_97; + var_a0 = playerId; + temp_v0_10 = gModeSelection; + if (var_v1 == 0x0000001E) { + switch (temp_v0_10) { /* switch 3; irregular */ + case 3: /* switch 3 */ + break; + case 0: /* switch 3 */ + temp_v1 = &gPlayers[var_a0]; + temp_v0_11 = temp_v1->currentRank; + temp_a2 = var_a0 + &D_800EA0EC; + if (temp_v0_11 == 0) { + *temp_a2 = 2; + playerId = var_a0; + func_800C90F4(var_a0, (temp_v1->characterId * 0x10) + 0x29008007); + } else if (temp_v0_11 < 4) { + *temp_a2 = 2; + playerId = var_a0; + func_800C90F4(var_a0, (temp_v1->characterId * 0x10) + 0x2900800D); + } else { + *temp_a2 = 2; + playerId = var_a0; + func_800C90F4(var_a0, (temp_v1->characterId * 0x10) + 0x29008003); + } +block_97: + var_a0 = playerId; + break; + case 2: /* switch 3 */ + temp_v1_2 = &gPlayers[var_a0]; + playerId = var_a0; + if (temp_v1_2->currentRank == 0) { + *(&D_800EA0EC + var_a0) = 2; + playerId = var_a0; + func_800C90F4(var_a0, (temp_v1_2->characterId * 0x10) + 0x2900800D); + } + goto block_97; + case 1: /* switch 3 */ + if (D_801657E5 == 1) { + *(&D_800EA0EC + var_a0) = 2; + playerId = var_a0; + func_800C90F4(var_a0, (*(&gPlayers->characterId + (var_a0 * 0xDD8)) * 0x10) + 0x29008007); + } else { + playerId = var_a0; + if (D_8018ED90 == (u8) 1) { + *(&D_800EA0EC + var_a0) = 2; + playerId = var_a0; + func_800C90F4(var_a0, (*(&gPlayers->characterId + (var_a0 * 0xDD8)) * 0x10) + 0x2900800D); + } + } + goto block_97; + } + } + switch (gModeSelection) { /* switch 4; irregular */ + case 0: /* switch 4 */ + temp_v0_12 = *(&gPlayers->currentRank + (var_a0 * 0xDD8)); + temp_v1_3 = *sp34; + if (temp_v0_12 == 0) { + if (temp_v1_3 >= 0x15F) { + if (temp_v1_3 == 0x0000015F) { + func_800C9D0C(var_a0); + return; } } else { - if (D_801657E5 == 1) { - *(&D_800EA0EC + temp_a0) = 2; - arg0 = temp_a0; - func_800C90F4(temp_a0, (*(&gPlayers + 0x254 + (temp_a0 * 0xDD8)) * 0x10) + 0x29008007); - phi_v0_2 = gModeSelection; - goto block_96; + var_at = &D_800EA130 + sp38; + var_f10 = (f32) temp_v1_3 / 400.0f; +block_134: + *var_at = var_f10; + } + } else if (temp_v0_12 < 4) { + if (temp_v1_3 >= 0x15F) { + if (temp_v1_3 == 0x0000015F) { + func_800C9D0C(var_a0); + return; } - arg0 = temp_a0; - if (D_8018ED90 == 1) { - *(&D_800EA0EC + temp_a0) = 2; - arg0 = temp_a0; - func_800C90F4(temp_a0, (*(&gPlayers + 0x254 + (temp_a0 * 0xDD8)) * 0x10) + 0x2900800D); - phi_v0_2 = gModeSelection; -block_96: - } - goto block_97; + } else { + *(&D_800EA130 + sp38) = (f32) temp_v1_3 / 400.0f; + return; + } + } else if (temp_v1_3 >= 0x12D) { + if (temp_v1_3 == 0x0000012D) { + func_800C97C4(var_a0); + return; } } else { - temp_v1_3 = (temp_a0 * 0xDD8) + &gPlayers; - temp_v0_12 = temp_v1_3->unk4; - temp_a2 = temp_a0 + &D_800EA0EC; - if (temp_v0_12 == 0) { - *temp_a2 = 2; - arg0 = temp_a0; - func_800C90F4(temp_a0, (temp_v1_3->unk254 * 0x10) + 0x29008007, temp_a2, 1); - } else if (temp_v0_12 < 4) { - *temp_a2 = 2; - arg0 = temp_a0; - func_800C90F4(temp_a0, (temp_v1_3->unk254 * 0x10) + 0x2900800D, temp_a2, 1); - } else { - *temp_a2 = 2; - arg0 = temp_a0; - func_800C90F4(temp_a0, (temp_v1_3->unk254 * 0x10) + 0x29008003, temp_a2, 1); - } - phi_v0_2 = gModeSelection; -block_97: - phi_a0 = arg0; + *(&D_800EA130 + sp38) = (f32) temp_v1_3 / 330.0f; + return; } - } - if (phi_v0_2 != 0) { - if (phi_v0_2 != phi_a3) { - if (phi_v0_2 != 2) { - if (phi_v0_2 != 3) { - return; - } - temp_v1_4 = *sp34; - if (temp_v1_4 >= 0x65) { - if (temp_v1_4 == 0x65) { - func_800C97C4(phi_a0); - return; - } - // Duplicate return node #135. Try simplifying control flow for better match - return; - } - phi_f10 = temp_v1_4 / 120.0f; - phi_at = &D_800EA130 + sp38; - goto block_134; - } - temp_v1_5 = *sp34; - if (phi_a3 == D_800EA1C0) { - if (temp_v1_5 >= 0x65) { - if (temp_v1_5 == 0x65) { - func_800C9D0C(phi_a0); - } - } else { - *(&D_800EA130 + sp38) = temp_v1_5 / 120.0f; - } - } else if (temp_v1_5 >= 0x65) { - if (temp_v1_5 == 0x65) { - func_800C97C4(phi_a0); + break; + case 2: /* switch 4 */ + temp_v1_4 = *sp34; + if (D_800EA1C0 == (u8) 1) { + if (temp_v1_4 >= 0x65) { + if (temp_v1_4 == 0x00000065) { + func_800C9D0C(var_a0); } } else { - *(&D_800EA130 + sp38) = temp_v1_5 / 120.0f; + *(&D_800EA130 + sp38) = (f32) temp_v1_4 / 120.0f; } - goto block_126; + } else if (temp_v1_4 >= 0x65) { + if (temp_v1_4 == 0x00000065) { + func_800C97C4(var_a0); + } + } else { + *(&D_800EA130 + sp38) = (f32) temp_v1_4 / 120.0f; } -block_126: + /* fallthrough */ + case 1: /* switch 4 */ + temp_v1_5 = *sp34; + if (temp_v1_5 >= 0x12D) { + if (temp_v1_5 == 0x0000012D) { + func_800C9D0C(0U); + return; + } + } else { + *(&D_800EA130 + sp38) = (f32) temp_v1_5 / 350.0f; + return; + } + break; + case 3: /* switch 4 */ temp_v1_6 = *sp34; - if (temp_v1_6 >= 0x12D) { - if (temp_v1_6 == 0x12D) { - func_800C9D0C(0); + if (temp_v1_6 >= 0x65) { + if (temp_v1_6 == 0x00000065) { + func_800C97C4(var_a0); return; } - // Duplicate return node #135. Try simplifying control flow for better match - return; + } else { + var_at = &D_800EA130 + sp38; + var_f10 = (f32) temp_v1_6 / 120.0f; + goto block_134; } - *(&D_800EA130 + sp38) = temp_v1_6 / 350.0f; - return; + break; } - temp_v0_13 = *(&gPlayers + 4 + (phi_a0 * 0xDD8)); - temp_v1_7 = *sp34; - if (temp_v0_13 == 0) { - if (temp_v1_7 >= 0x15F) { - if (temp_v1_7 == 0x15F) { - func_800C9D0C(phi_a0); - return; - } - // Duplicate return node #135. Try simplifying control flow for better match - return; - } - phi_f10 = temp_v1_7 / 400.0f; - phi_at = &D_800EA130 + sp38; -block_134: - *phi_at = phi_f10; - // Duplicate return node #135. Try simplifying control flow for better match - return; - } - if (temp_v0_13 < 4) { - if (temp_v1_7 >= 0x15F) { - if (temp_v1_7 == 0x15F) { - func_800C9D0C(phi_a0); - return; - } - // Duplicate return node #135. Try simplifying control flow for better match - return; - } - *(&D_800EA130 + sp38) = temp_v1_7 / 400.0f; - return; - } - if (temp_v1_7 >= 0x12D) { - if (temp_v1_7 == 0x12D) { - func_800C97C4(phi_a0); - return; - } - // Duplicate return node #135. Try simplifying control flow for better match - return; - } - *(&D_800EA130 + sp38) = temp_v1_7 / 330.0f; } } #else @@ -4456,68 +3915,64 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C76C0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C9018(s32, ?); // extern -void func_800C94A4(s32); // extern -void func_800C97C4(s32); // extern -void play_sound(s32, void *, s32, ? *, ? *, void *); // extern -extern ? D_800E9F74; -extern ? D_800E9F7C; -extern ? D_800EA0EC; -extern u8 D_800EA1C0; -extern ? D_800EA1D4; -extern Player gPlayers; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C9018(s32, ?); /* extern */ +? func_800C94A4(s32); /* extern */ +? func_800C97C4(s32); /* extern */ +? play_sound(s32, void *, s32, ? *, ? *, void *); /* extern */ +static ? D_800E9F74; /* unable to generate initializer; const */ +static ? D_800E9F7C; /* unable to generate initializer; const */ +static ? D_800EA0EC; /* unable to generate initializer; const */ +static u8 D_800EA1C0 = 0; /* const */ +static ? D_800EA1D4; /* unable to generate initializer; const */ +s16 gCurrentCourseId; /* unable to generate initializer */ -void func_800C847C(s32 arg0) { - void *sp3C; +void func_800C847C(s32 playerId) { + Player *sp3C; u8 *sp38; + Player *temp_t8; s16 temp_v0_2; s32 temp_s0; u8 *temp_v0; u8 *temp_v0_3; void *temp_a1; void *temp_a1_2; - void *temp_t8; - temp_s0 = arg0 & 0xFF; - temp_t8 = (temp_s0 * 0xDD8) + &gPlayers; + temp_s0 = playerId & 0xFF; + temp_t8 = &gPlayers[temp_s0]; sp3C = temp_t8; - if ((temp_t8->unkDE & 1) == 1) { + if ((temp_t8->unk_0DE & 1) == 1) { temp_v0 = temp_s0 + &D_800E9F74; if (*temp_v0 == 0) { - if (D_800EA1C0 < 2) { + if ((s32) D_800EA1C0 < 2) { sp38 = temp_v0; - func_800C9018(temp_s0 & 0xFF, 0x100F926); + func_800C9018(temp_s0 & 0xFF, 0x0100F926); } else { sp38 = temp_v0; - func_800C9018(temp_s0 & 0xFF, 0x1008026); + func_800C9018(temp_s0 & 0xFF, 0x01008026); } sp38 = sp38; func_800C97C4(temp_s0 & 0xFF); *sp38 = 1; func_800C94A4(temp_s0 & 0xFF); temp_v0_2 = gCurrentCourseId; - if (((temp_v0_2 == 1) || (temp_v0_2 == 2) || (temp_v0_2 == 3) || (temp_v0_2 == 4) || (temp_v0_2 == 5) || (temp_v0_2 == 6) || (temp_v0_2 == 7) || (temp_v0_2 == 0xC) || (temp_v0_2 == 0x12) || (temp_v0_2 == 0x13)) && (*(&D_800EA0EC + temp_s0) == 0)) { + if (((temp_v0_2 == 1) || (temp_v0_2 == 2) || (temp_v0_2 == 3) || (temp_v0_2 == 4) || (temp_v0_2 == 5) || (temp_v0_2 == 6) || (temp_v0_2 == 7) || (temp_v0_2 == 0x000C) || (temp_v0_2 == 0x0012) || (temp_v0_2 == 0x0013)) && (*(&D_800EA0EC + temp_s0) == 0)) { temp_a1 = (temp_s0 * 0x3C) + &D_800E9F7C; - play_sound((sp3C->unk254 * 0x10) + 0x29008005, temp_a1, temp_s0 & 0xFF, &D_800EA1D4, &D_800EA1D4, temp_a1 + 0x14); - return; + play_sound((sp3C->characterId * 0x10) + 0x29008005, temp_a1, temp_s0 & 0xFF, &D_800EA1D4, &D_800EA1D4, temp_a1 + 0x14); } - // Duplicate return node #21. Try simplifying control flow for better match - return; } - // Duplicate return node #21. Try simplifying control flow for better match - return; - } - temp_v0_3 = temp_s0 + &D_800E9F74; - if (*temp_v0_3 == 1) { - sp38 = temp_v0_3; - func_800C97C4(temp_s0 & 0xFF); - *temp_v0_3 = 2; - func_800C94A4(temp_s0 & 0xFF); - *temp_v0_3 = 0; - if ((gCurrentCourseId == 6) && (*(&D_800EA0EC + temp_s0) == 0)) { - temp_a1_2 = (temp_s0 * 0x3C) + &D_800E9F7C; - play_sound((sp3C->unk254 * 0x10) + 0x29008008, temp_a1_2, temp_s0 & 0xFF, &D_800EA1D4, &D_800EA1D4, temp_a1_2 + 0x14); + } else { + temp_v0_3 = temp_s0 + &D_800E9F74; + if (*temp_v0_3 == 1) { + sp38 = temp_v0_3; + func_800C97C4(temp_s0 & 0xFF); + *temp_v0_3 = 2; + func_800C94A4(temp_s0 & 0xFF); + *temp_v0_3 = 0; + if ((gCurrentCourseId == 6) && (*(&D_800EA0EC + temp_s0) == 0)) { + temp_a1_2 = (temp_s0 * 0x3C) + &D_800E9F7C; + play_sound((sp3C->characterId * 0x10) + 0x29008008, temp_a1_2, temp_s0 & 0xFF, &D_800EA1D4, &D_800EA1D4, temp_a1_2 + 0x14); + } } } } @@ -4525,108 +3980,50 @@ void func_800C847C(s32 arg0) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C847C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_800C90F4(s32, s32); // extern -extern ? D_800E9F24; -extern Player gPlayers; - -void func_800C86D8(s32 arg0) { - s32 temp_t6; - void *temp_v0; - - temp_t6 = arg0 & 0xFF; - temp_v0 = (temp_t6 * 0xDD8) + &gPlayers; - if (((temp_v0->unkBC & 0x40000000) != 0x40000000) && (*(&D_800E9F24 + temp_t6) == 1)) { - func_800C90F4(temp_t6, (temp_v0->unk254 * 0x10) + 0x29008008); +void func_800C86D8(u8 playerId) { + if (((gPlayers[playerId].unk_0BC & 0x40000000) != 0x40000000) && (D_800E9F24[playerId] == 1)) { + func_800C90F4(playerId, (gPlayers[playerId].characterId * 0x10) + 0x29008008); } } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800C86D8.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800E9F24; -extern ? D_800E9F2C; -extern ? D_800E9F34; -extern ? D_800E9F54; -extern f32 D_800F3894; -extern f32 D_800F3898; -extern f32 D_800F389C; -extern f32 D_800F38A0; -extern f32 D_800F38A4; -extern f32 D_800F38A8; -extern Player gPlayers; +#ifdef NEEDS_RODATA +// data/rodata_audio_2.s +extern f32 D_800F3894;// = 0.7f; +extern f32 D_800F3898;// = 0.1f; +extern f32 D_800F389C;// = 0.03f; +extern f32 D_800F38A0;// = 0.16f; +extern f32 D_800F38A4;// = 0.15f; +extern f32 D_800F38A8;// = 0.03f; -void func_800C8770(s32 arg0) { - ? sp-10; - f32 *temp_a1_2; - f32 *temp_a1_3; - f32 *temp_v0_3; - f32 *temp_v0_4; - f32 temp_f0; - f32 temp_f0_2; - s32 temp_t6; - s32 temp_v1_3; - s32 temp_v1_4; - u8 *temp_v0; - u8 *temp_v0_2; - u8 *temp_v1; - u8 temp_a1; - u8 temp_v1_2; - u8 phi_v1; - u8 *phi_v0; - - temp_t6 = arg0 & 0xFF; - sp-10.unk10 = arg0; - if ((*(&gPlayers + 0xBC + (temp_t6 * 0xDD8)) & 0x40000000) == 0x40000000) { - temp_v1 = temp_t6 + &D_800E9F2C; - temp_a1 = *temp_v1; - temp_v0 = temp_t6 + &D_800E9F24; - *temp_v0 = 1; - phi_v0 = temp_v0; - if (temp_a1 < 0xFA) { - *temp_v1 = temp_a1 + 1; +void func_800C8770(u8 playerId) { + if ((gPlayers[playerId].unk_0BC & 0x40000000) == 0x40000000) { + D_800E9F24[playerId] = 1; + if (D_800E9F2C[playerId] < 0xFA) { + D_800E9F2C[playerId]++; } - phi_v1 = *temp_v0; } else { - *(&D_800E9F2C + temp_t6) = 0; - temp_v0_2 = temp_t6 + &D_800E9F24; - temp_v1_2 = *temp_v0_2; - phi_v1 = temp_v1_2; - phi_v0 = temp_v0_2; - if (temp_v1_2 == 1) { - *temp_v0_2 = 2; - phi_v1 = 2 & 0xFF; + D_800E9F2C[playerId] = 0; + if (D_800E9F24[playerId] == 1) { + D_800E9F24[playerId] = 2; } } - if (phi_v1 != 1) { - if (phi_v1 != 2) { - return; + switch (D_800E9F24[playerId]) { /* irregular */ + case 1: + if (D_800E9F34[playerId] < 0.7f) { + D_800E9F34[playerId] += 0.1f; + D_800E9F54[playerId] += 0.03f; } - temp_v1_3 = temp_t6 * 4; - temp_a1_2 = temp_v1_3 + &D_800E9F34; - temp_f0 = *temp_a1_2; - if (D_800F38A0 < temp_f0) { - temp_v0_3 = temp_v1_3 + &D_800E9F54; - *temp_a1_2 = temp_f0 - D_800F38A4; - *temp_v0_3 = *temp_v0_3 - D_800F38A8; - return; + break; + case 2: + if (D_800E9F34[playerId] > 0.16f) { + D_800E9F34[playerId] -= 0.15f; + D_800E9F54[playerId] -= 0.03f; + } else { + D_800E9F34[playerId] = 0.0f; + D_800E9F54[playerId] = 0.0f; + D_800E9F24[playerId] = 0; } - *temp_a1_2 = 0.0f; - *(&D_800E9F54 + temp_v1_3) = 0.0f; - *phi_v0 = 0; - // Duplicate return node #14. Try simplifying control flow for better match - return; - } - temp_v1_4 = temp_t6 * 4; - temp_a1_3 = temp_v1_4 + &D_800E9F34; - temp_f0_2 = *temp_a1_3; - if (temp_f0_2 < D_800F3894) { - temp_v0_4 = temp_v1_4 + &D_800E9F54; - *temp_a1_3 = temp_f0_2 + D_800F3898; - *temp_v0_4 = *temp_v0_4 + D_800F389C; + break; } } #else @@ -4648,48 +4045,30 @@ void func_800C8920(void) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C8920.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f32 D_800EA178; -extern f32 D_800EA17C; -extern u16 D_800EA180; -extern f32 D_800F38AC; -extern f32 D_800F38B0; +#ifdef NEEDS_RODATA +// data/rodata_audio_2.s +extern f32 D_800F38AC;// = 0.012f; +extern f32 D_800F38B0;// = 0.85f; void func_800C89E4(void) { - ? sp-10; - f32 temp_f6; - s32 temp_v0_2; - u16 temp_t6; - u16 temp_v0; - f32 phi_f6; - - temp_v0 = D_800EA180; - temp_t6 = temp_v0 + 1; - if (temp_v0 != 0) { - temp_v0_2 = temp_t6 & 0xFFFF; - D_800EA180 = temp_t6; - if (temp_v0_2 == 2) { + if (D_800EA180 != 0) { + D_800EA180++; + if (D_800EA180 == 2) { D_800EA17C = 1.0f; } - if (temp_v0_2 < 0xF) { - temp_f6 = temp_v0_2; - phi_f6 = temp_f6; - if (temp_v0_2 < 0) { - phi_f6 = temp_f6 + 4294967296.0f; - } - D_800EA178 = 1.0f - (phi_f6 * D_800F38AC); + if (D_800EA180 < 0xF) { + D_800EA178 = 1.0f - (D_800EA180 * 0.012f); } - if ((temp_v0_2 >= 0x33) && (temp_v0_2 < 0x96)) { - D_800EA17C = 1.0f - ((temp_v0_2 - 0x32) / 110.0f); + if ((D_800EA180 >= 0x33) && (D_800EA180 < 0x96)) { + D_800EA17C = 1.0f - ((D_800EA180 - 0x32) / 110.0f); } - if (temp_v0_2 == 0x12D) { + if (D_800EA180 == 0x12D) { D_800EA17C = 0.0f; } - if (temp_v0_2 == 0x321) { + if (D_800EA180 == 0x321) { D_800EA178 = 1.0f; + D_800EA17C = 0.85f; D_800EA180 = 0; - D_800EA17C = D_800F38B0; } } } @@ -4698,74 +4077,62 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C89E4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800E9F7C; -extern u8 D_800EA16C; -extern f32 D_800EA17C; -extern u16 D_800EA184; -extern u8 D_800EA1C0; -extern f32 D_800F38B4; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +static ? D_800E9F7C; /* unable to generate initializer; const */ +static u8 D_800EA16C = 0; /* const */ +static u16 D_800EA184 = 0; /* const */ +static u8 D_800EA1C0 = 0; /* const */ +s16 gCurrentCourseId; /* unable to generate initializer */ void func_800C8AE4(void) { - ? sp-10; u16 temp_t8; - u16 temp_v0; - u8 temp_v0_2; - u16 phi_v0; + u16 var_v0; + u8 temp_v0; if (gCurrentCourseId == 8) { - temp_v0 = D_800EA184; - phi_v0 = temp_v0; - if (temp_v0 != 0) { - temp_t8 = temp_v0 + 1; + var_v0 = D_800EA184; + if (var_v0 != 0) { + temp_t8 = var_v0 + 1; if (D_800EA16C == 0) { D_800EA184 = temp_t8; - phi_v0 = temp_t8 & 0xFFFF; + var_v0 = temp_t8 & 0xFFFF; } - if (phi_v0 == 0x12C) { - D_800EA17C = D_800F38B4; + if (var_v0 == 0x012C) { + D_800EA17C = 0.85f; D_800EA184 = 0; - return; } - // Duplicate return node #26. Try simplifying control flow for better match - return; - } - temp_v0_2 = D_800EA1C0; - if (temp_v0_2 != 0) { - if (temp_v0_2 != 1) { - if (temp_v0_2 != 2) { - if (temp_v0_2 != 3) { - return; - } - if ((D_800E9F7C.unk14 != 0) || (D_800E9F7C.unk50 != 0) || (D_800E9F7C.unk8C != 0) || (D_800E9F7C.unkC8 != 0)) { - D_800EA17C = 0.0f; - goto block_25; - } - // Duplicate return node #26. Try simplifying control flow for better match + } else { + temp_v0 = D_800EA1C0; + switch (temp_v0) { /* irregular */ + case 0: + if (D_800E9F7C.unk14 != 0) { + D_800EA17C = 0.0f; + D_800EA184 = 1; return; } + break; + case 1: + if ((D_800E9F7C.unk14 != 0) || (D_800E9F7C.unk50 != 0)) { + D_800EA17C = 0.0f; +block_25: + D_800EA184 = 1; + } + break; + case 2: if ((D_800E9F7C.unk14 != 0) || (D_800E9F7C.unk50 != 0) || (D_800E9F7C.unk8C != 0)) { D_800EA17C = 0.0f; D_800EA184 = 1; return; } - // Duplicate return node #26. Try simplifying control flow for better match - return; + break; + case 3: + if ((D_800E9F7C.unk14 != 0) || (D_800E9F7C.unk50 != 0) || (D_800E9F7C.unk8C != 0) || (D_800E9F7C.unkC8 != 0)) { + D_800EA17C = 0.0f; + goto block_25; + } + break; } - if ((D_800E9F7C.unk14 != 0) || (D_800E9F7C.unk50 != 0)) { - D_800EA17C = 0.0f; -block_25: - D_800EA184 = 1; - } - // Duplicate return node #26. Try simplifying control flow for better match - return; } - if (D_800E9F7C.unk14 != 0) { - D_800EA17C = 0.0f; - D_800EA184 = 1; - return; - } - // Duplicate return node #26. Try simplifying control flow for better match } } #else @@ -5064,66 +4431,60 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C90F4.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 void func_800C90F4(s32, s32); // extern -extern s32 D_803B7194; +extern s32 gAudioRandom; extern Player gPlayers; void func_800C9250(s32 arg0) { s32 temp_t6; temp_t6 = arg0 & 0xFF; - func_800C90F4(temp_t6, (*(&gPlayers + 0x254 + (temp_t6 * 0xDD8)) * 0x10) + (D_803B7194 & 1) + 0x29008001); + func_800C90F4(temp_t6, (*(&gPlayers + 0x254 + (temp_t6 * 0xDD8)) * 0x10) + (gAudioRandom & 1) + 0x29008001); } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C9250.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_800C1C88(s32, void *, void *, ? *, s32, s32); // extern -void play_sound(s32, void *, s32, ? *, ? *, void *); // extern -extern ? D_800E9F2C; -extern ? D_800EA06C; -extern u8 D_800EA0F0; -extern u8 D_800EA108; -extern ? D_800EA150; -extern u8 D_800EA1C0; -extern ? D_800EA1C8; -extern ? D_800EA1D4; -extern Player gPlayers; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +static ? D_800E9F2C; /* unable to generate initializer; const */ +static ? D_800EA06C; /* unable to generate initializer; const */ +static u8 D_800EA0F0 = 0; /* const */ +static u8 D_800EA1C0 = 0; /* const */ +s8 D_800EA108 = 0; /* const */ -void func_800C92CC(s32 arg0, s32 arg1) { - void *sp68; - void *sp64; +void func_800C92CC(s32 playerId, u32 soundBits) { + f32 *sp68; + f32 *sp64; + Player *temp_s1; + f32 *temp_t0; s32 temp_s4; s32 temp_t3; + s32 var_s0; + struct Unk_8018EFD8 *temp_v0_2; u8 temp_v0; - void *temp_s1; - void *temp_t0; - void *temp_v0_2; - s32 phi_s0; - temp_s4 = arg0 & 0xFF; - if ((D_800EA108 == 0) && (D_800EA0F0 == 0)) { + temp_s4 = playerId & 0xFF; + if (((u8) D_800EA108 == 0) && (D_800EA0F0 == 0)) { temp_v0 = D_800EA1C0; - if (temp_v0 < 2) { - phi_s0 = 0; - if (temp_v0 >= 0) { - temp_s1 = (temp_s4 * 0xDD8) + &gPlayers; - sp64 = temp_s1 + 0x34; - sp68 = temp_s1 + 0x14; + if ((s32) temp_v0 < 2) { + var_s0 = 0; + if ((s32) temp_v0 >= 0) { + temp_s1 = &gPlayers[temp_s4]; + sp64 = temp_s1->unk_034; + sp68 = temp_s1->pos; do { - temp_v0_2 = func_800C1C88(temp_s4 & 0xFF, sp68, sp64, &D_800EA1C8, phi_s0, arg1); - if (temp_v0_2 != 0) { + temp_v0_2 = func_800C1C88(temp_s4 & 0xFF, sp68, sp64, &D_800EA1C8, (u8) var_s0, soundBits); + if (temp_v0_2 != NULL) { temp_v0_2->unk34 = 170.0f; temp_t0 = (temp_s4 * 0x10) + 0xC + &D_800EA06C; - if (((temp_s1->unkBC & 0x40000000) == 0x40000000) && (*(&D_800E9F2C + temp_s4) >= 0x1F)) { - play_sound((temp_s1->unk254 * 0x10) + arg1, temp_v0_2 + 0x18, phi_s0 & 0xFF, &D_800EA150, &D_800EA1D4, temp_t0); + if (((temp_s1->unk_0BC & 0x40000000) == 0x40000000) && ((s32) *(&D_800E9F2C + temp_s4) >= 0x1F)) { + play_sound((temp_s1->characterId * 0x10) + soundBits, temp_v0_2->unk18, var_s0 & 0xFF, &D_800EA150, &D_800EA1D4, temp_t0); } else { - play_sound((temp_s1->unk254 * 0x10) + arg1, temp_v0_2 + 0x18, phi_s0 & 0xFF, temp_v0_2 + 0x2C, &D_800EA1D4, temp_t0); + play_sound((temp_s1->characterId * 0x10) + soundBits, temp_v0_2->unk18, var_s0 & 0xFF, &temp_v0_2->unk2C, &D_800EA1D4, temp_t0); } } - temp_t3 = (phi_s0 + 1) & 0xFF; - phi_s0 = temp_t3; + temp_t3 = (var_s0 + 1) & 0xFF; + var_s0 = temp_t3; } while (temp_t3 < (D_800EA1C0 + 1)); } } @@ -5134,22 +4495,22 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C92CC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void play_sound(s32, void *, s32, void *, void *, void *); /* extern */ +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c static ? D_800E9F74; /* unable to generate initializer; const */ static ? D_800E9F7C; /* unable to generate initializer; const */ static ? D_800EA0EC; /* unable to generate initializer; const */ +u8 D_800EA108 = 0; /* const */ +u8 D_800EA1C0 = 0; /* const */ -void func_800C94A4(s32 playerId) { - s32 temp_a0; - s32 temp_a2; +void func_800C94A4(u8 playerId) { + f32 *temp_a1; + f32 var_f6; u16 temp_v1_2; + u32 var_a0; u8 *temp_v1; + u8 temp_a2; u8 temp_v0; u8 temp_v0_2; - void *temp_a1; - f32 phi_f6; - s32 phi_a0; temp_a2 = playerId & 0xFF; if (D_800EA108 == 0) { @@ -5176,9 +4537,9 @@ block_4: temp_a1->unk24 = -0.8f; temp_a1->unk2C = 1568.9796f; temp_a1->unk30 = 1067.7778f; - phi_f6 = 2766.065f; + var_f6 = 2766.065f; block_11: - temp_a1->unk34 = phi_f6; + temp_a1->unk34 = var_f6; break; case 2: case 6: @@ -5189,7 +4550,7 @@ block_11: temp_a1->unk24 = -1.7f; temp_a1->unk2C = 1478.4615f; temp_a1->unk30 = 784.4898f; - phi_f6 = 12813.335f; + var_f6 = 12813.335f; goto block_11; case 3: temp_a1->unk18 = 2.8f; @@ -5199,7 +4560,7 @@ block_11: temp_a1->unk24 = -0.6f; temp_a1->unk2C = 1747.2728f; temp_a1->unk30 = 1130.5883f; - phi_f6 = 3844.001f; + var_f6 = 3844.001f; goto block_11; case 4: temp_a1->unk18 = 2.0f; @@ -5209,7 +4570,7 @@ block_11: temp_a1->unk24 = -0.4f; temp_a1->unk2C = 2135.5557f; temp_a1->unk30 = 1601.6666f; - phi_f6 = 3203.333f; + var_f6 = 3203.333f; goto block_11; case 5: case 7: @@ -5220,28 +4581,29 @@ block_11: temp_a1->unk24 = -0.8f; temp_a1->unk2C = 1922.0f; temp_a1->unk30 = 1201.25f; - phi_f6 = 4805.0f; + var_f6 = 4805.0f; goto block_11; } temp_v0_2 = *(&D_800E9F74 + temp_a2); - temp_a0 = temp_v1_2 + 0x104FF00; - phi_a0 = temp_a0; - if (temp_v0_2 != 0) { - if (temp_v0_2 != 1) { - if (temp_v0_2 != 2) { - - } else if (D_800EA1C0 == 0) { - phi_a0 = temp_a0 + 0x36; - } else { - phi_a0 = temp_a0 + 0x3E; - } - } else { - phi_a0 = temp_a0 + 0x2E; + var_a0 = temp_v1_2 + 0x0104FF00; + switch (temp_v0_2) { /* switch 1; irregular */ + case 0: /* switch 1 */ + if (D_800EA1C0 != 0) { + var_a0 += 0x14; } - } else if (D_800EA1C0 != 0) { - phi_a0 = temp_a0 + 0x14; + break; + case 1: /* switch 1 */ + var_a0 += 0x2E; + break; + case 2: /* switch 1 */ + if (D_800EA1C0 == 0) { + var_a0 += 0x36; + } else { + var_a0 += 0x3E; + } + break; } - play_sound(phi_a0, temp_a1, temp_a2, temp_a1 + 0xC, temp_a1 + 0x10, temp_a1 + 0x14); + play_sound(var_a0, temp_a1, temp_a2, temp_a1 + 0xC, temp_a1 + 0x10, temp_a1 + 0x14); } } } @@ -5274,33 +4636,29 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C97C4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_800C1C88(?, s32, ?, ? *, s32, s32); // extern -void play_sound(s32, void *, s32, void *, ? *, ? *); // extern -extern u8 D_800EA0F0; -extern u8 D_800EA108; -extern u8 D_800EA1C0; -extern ? D_800EA1C8; -extern ? D_800EA1D4; -extern ? D_800EA1DC; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +static u8 D_800EA1DC = 0; /* const */ +u8 D_800EA0F0 = 0; /* const */ +u8 D_800EA108 = 0; /* const */ +u8 D_800EA1C0 = 0; /* const */ +f32 D_800EA1C8[3] = { 0.0f, 0.0f, 0.0f }; /* const */ -// Precursor to play_sound -void func_800C98B8(Vec3f arg0, Vec3f arg1, u32 arg2) { +void func_800C98B8(f32 *position, f32 *velocity, u32 soundBits) { s32 temp_t0; - void *temp_v0; - s32 phi_s0; + s32 var_s0; + struct Unk_8018EFD8 *temp_v0; if ((D_800EA108 == 0) && (D_800EA0F0 == 0)) { - phi_s0 = 0; + var_s0 = 0; if ((D_800EA1C0 + 1) > 0) { do { - temp_v0 = func_800C1C88(0, arg0, arg1, &D_800EA1C8, phi_s0, arg2); - if (temp_v0 != 0) { + temp_v0 = func_800C1C88(0U, position, velocity, D_800EA1C8, (u8) var_s0, soundBits); + if (temp_v0 != NULL) { temp_v0->unk34 = 170.0f; - play_sound(arg2, temp_v0 + 0x18, phi_s0 & 0xFF, temp_v0 + 0x2C, &D_800EA1D4, &D_800EA1DC); + play_sound(soundBits, temp_v0->unk18, var_s0 & 0xFF, &temp_v0->unk2C, &D_800EA1D4, &D_800EA1DC); } - temp_t0 = (phi_s0 + 1) & 0xFF; - phi_s0 = temp_t0; + temp_t0 = (var_s0 + 1) & 0xFF; + var_s0 = temp_t0; } while (temp_t0 < (D_800EA1C0 + 1)); } } @@ -5339,93 +4697,69 @@ void func_800C99E0(Vec3f arg0, s32 arg1) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800C99E0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 -void play_sound(s32, void *, s32, void *, void *, void *); /* extern */ -static ? D_800EA06C; /* unable to generate initializer; const */ +#ifdef NEEDS_RODATA +// data/rodata_audio_2.s +// jpt_800F3960 +extern f32 D_800F3980;// = 0.35f +extern f32 D_800F3984;// = 1568.979614f +extern f32 D_800F3988;// = 0.6f +extern f32 D_800F398C;// = 1478.461548f +extern f32 D_800F3990;// = 0.6f +extern f32 D_800F3994;// = 1747.272827f +extern f32 D_800F3998;// = 0.2f +extern f32 D_800F399C;// = 2135.555664f +extern f32 D_800F39A0;// = 0.4f +extern f32 D_800F39A4;// = 1922.0f -void func_800C9A88(s32 playerId) { - void *sp64; - f32 *temp_v0_3; - f32 *temp_v0_6; - s32 temp_s1; - s32 temp_s3; - s32 temp_t6; - u16 temp_t0; - u8 temp_v0; - u8 temp_v0_7; - void *temp_v0_2; - void *temp_v0_4; - void *temp_v0_5; - void *temp_v0_8; - void *temp_v0_9; - f32 phi_f10; - f32 *phi_v0; - s32 phi_s0; - temp_s3 = playerId & 0xFF; +void func_800C9A88(u8 playerId) { + u8 var_s0; + u32 soundBits; + struct Unk_8018EFD8 *temp_v0_6; + if (D_800EA108 == 0) { - temp_v0 = D_800EA0F0; - if (temp_v0 != 0) { - if (temp_v0 == 2) { - D_800EA0F0 = 1; - goto block_4; - } - } else { -block_4: - temp_t0 = gPlayers[temp_s3].characterId; - switch (temp_t0) { + switch(D_800EA0F0) { + case 2: + D_800EA0F0 = 1; + /* fallthrough */ + case 0: + switch (gPlayers[playerId].characterId) { case 0: case 1: - temp_v0_2 = (temp_s3 * 0x10) + &D_800EA06C; - temp_v0_2->unk0 = 0.35f; - temp_v0_2->unk4 = 1568.9796f; + D_800EA06C[playerId].unk00[0] = 0.35f; + D_800EA06C[playerId].unk00[1] = 1568.9796f; break; case 2: case 6: - temp_v0_3 = (temp_s3 * 0x10) + &D_800EA06C; - *temp_v0_3 = 0.6f; - phi_f10 = 1478.4615f; - phi_v0 = temp_v0_3; -block_11: - phi_v0->unk4 = phi_f10; + D_800EA06C[playerId].unk00[0] = 0.6f; + D_800EA06C[playerId].unk00[1] = 1478.4615f; break; case 3: - temp_v0_4 = (temp_s3 * 0x10) + &D_800EA06C; - temp_v0_4->unk0 = 0.6f; - temp_v0_4->unk4 = 1747.2728f; + D_800EA06C[playerId].unk00[0] = 0.6f; + D_800EA06C[playerId].unk00[1] = 1747.2728f; break; case 4: - temp_v0_5 = (temp_s3 * 0x10) + &D_800EA06C; - temp_v0_5->unk0 = 0.2f; - temp_v0_5->unk4 = 2135.5557f; + D_800EA06C[playerId].unk00[0] = 0.2f; + D_800EA06C[playerId].unk00[1] = 2135.5557f; break; case 5: case 7: - temp_v0_6 = (temp_s3 * 0x10) + &D_800EA06C; - *temp_v0_6 = 0.4f; - phi_f10 = 1922.0f; - phi_v0 = temp_v0_6; - goto block_11; + D_800EA06C[playerId].unk00[0] = 0.4f; + D_800EA06C[playerId].unk00[1] = 1922.0f; } - temp_v0_7 = D_800EA1C0; - if (temp_v0_7 < 2) { - phi_s0 = 0; - if (temp_v0_7 >= 0) { - sp64 = &gPlayers[temp_s3]; - do { - temp_s1 = sp64->unk254 + 0x31028000; - temp_v0_8 = func_800C1C88(temp_s3 & 0xFF, &gPlayers[temp_s3].posX, &gPlayers[temp_s3].unk_034, &gPlayers[temp_s3].unk_098, phi_s0, temp_s1); - if (temp_v0_8 != 0) { - temp_v0_8->unk34 = 40.0f; - temp_v0_9 = (temp_s3 * 0x10) + &D_800EA06C; - play_sound(temp_s1, temp_v0_8 + 0x18, phi_s0 & 0xFF, temp_v0_8 + 0x2C, temp_v0_9 + 8, temp_v0_9 + 0xC); - } - temp_t6 = (phi_s0 + 1) & 0xFF; - phi_s0 = temp_t6; - } while (temp_t6 < (D_800EA1C0 + 1)); + if (D_800EA1C0 < 2) { + for (var_s0 = 0; var_s0 < D_800EA1C0 + 1; var_s0++) { + soundBits = gPlayers[playerId].characterId + 0x31028000; + temp_v0_6 = func_800C1C88(playerId, gPlayers[playerId].pos, gPlayers[playerId].unk_034, &gPlayers[playerId].unk_098, var_s0, soundBits); + if (temp_v0_6 != NULL) { + temp_v0_6->unk34 = 40.0f; + play_sound(soundBits, temp_v0_6->unk18, var_s0, &temp_v0_6->unk2C, &D_800EA06C[playerId].unk00[2], &D_800EA06C[playerId].unk0C); + } } } + break; + default: + break; } } } @@ -5434,59 +4768,48 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C9A88.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800C21E8(void *, s32, s32); // extern -void func_800C550C(s32); // extern -extern Player gPlayers; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C550C(f32 *); /* extern */ -void func_800C9D0C(s32 arg0) { - s32 temp_a2; - void *temp_v0; +void func_800C9D0C(s32 playerId) { + Player *temp_v0; - temp_a2 = arg0 & 0xFF; - temp_v0 = (temp_a2 * 0xDD8) + &gPlayers; - func_800C550C(func_800C21E8(temp_v0 + 0x14, temp_v0->unk254 + 0x31028000, temp_a2)); + temp_v0 = &gPlayers[playerId & 0xFF]; + func_800C550C(func_800C21E8(temp_v0->pos, temp_v0->characterId + 0x31028000)); } #else GLOBAL_ASM("asm/non_matchings/audio/external/func_800C9D0C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_800C1C88(?, s32, s32, ? *, s32, s32); // extern -void play_sound(s32, void *, s32, ? *, ? *, ? *); // extern -extern u8 D_800EA0F0; -extern u8 D_800EA108; -extern f32 D_800EA178; -extern f32 D_800EA17C; -extern u8 D_800EA1C0; -extern ? D_800EA1C8; -extern ? D_800EA1D4; -extern ? D_800EA1DC; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +static u8 D_800EA0F0 = 0; /* const */ +static u8 D_800EA1C0 = 0; /* const */ +s8 D_800EA108 = 0; /* const */ -void func_800C9D80(s32 arg0, s32 arg1, s32 arg2) { +void func_800C9D80(Vec3f position, Vec3f velocity, u32 soundBits) { s32 temp_t8; + s32 var_s0; + struct Unk_8018EFD8 *temp_v0_2; u8 temp_v0; - void *temp_v0_2; - s32 phi_s0; - if ((D_800EA108 == 0) && (D_800EA0F0 == 0)) { + if (((u8) D_800EA108 == 0) && (D_800EA0F0 == 0)) { temp_v0 = D_800EA1C0; - if (temp_v0 < 4) { - phi_s0 = 0; - if (temp_v0 >= 0) { + if ((s32) temp_v0 < 4) { + var_s0 = 0; + if ((s32) temp_v0 >= 0) { do { - temp_v0_2 = func_800C1C88(0, arg0, arg1, &D_800EA1C8, phi_s0, arg2); - if (temp_v0_2 != 0) { + temp_v0_2 = func_800C1C88(0U, position, velocity, &D_800EA1C8, (u8) var_s0, soundBits); + if (temp_v0_2 != NULL) { temp_v0_2->unk34 = 170.0f; - if (arg2 == 0x5103700B) { - play_sound(arg2, temp_v0_2 + 0x18, phi_s0 & 0xFF, &D_800EA178, &D_800EA17C, &D_800EA1DC); + if (soundBits == 0x5103700B) { + play_sound(soundBits, temp_v0_2->unk18, var_s0 & 0xFF, &D_800EA178, &D_800EA17C, &D_800EA1DC); } else { - play_sound(arg2, temp_v0_2 + 0x18, phi_s0 & 0xFF, temp_v0_2 + 0x2C, &D_800EA1D4, &D_800EA1DC); + play_sound(soundBits, temp_v0_2->unk18, var_s0 & 0xFF, &temp_v0_2->unk2C, &D_800EA1D4, &D_800EA1DC); } } - temp_t8 = (phi_s0 + 1) & 0xFF; - phi_s0 = temp_t8; + temp_t8 = (var_s0 + 1) & 0xFF; + var_s0 = temp_t8; } while (temp_t8 < (D_800EA1C0 + 1)); } } @@ -5568,21 +4891,17 @@ void func_800CA008(u8 arg0, u8 arg1) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800CA008.s") #endif -void func_800CA0A0(void) { - s32 pad; - if (pad){}; +// With -framepointer active, you CANNOT put void +// in the argument list, causes a minor stack difference +void func_800CA0A0() { D_800EA108 = 1; } -void func_800CA0B8(void) { - s32 pad; - if (pad){}; +void func_800CA0B8() { D_800EA108 = 0; } -void func_800CA0CC(void) { - s32 pad; - if (pad){}; +void func_800CA0CC() { D_800EA108 = 1; } @@ -5687,9 +5006,7 @@ void func_800CA24C(s32 arg0) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800CA24C.s") #endif -void func_800CA270(void) { - s32 pad; - if (pad){}; +void func_800CA270() { D_800EA0F4 = 1; } @@ -5715,27 +5032,13 @@ void func_800CA2B8(s32 arg0) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800CA2B8.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800EA06C; - -void func_800CA2E4(s32 arg0, s8 arg1) { - *(&D_800EA06C + 0xC + ((arg0 & 0xFF) * 0x10)) = arg1; +void func_800CA2E4(u8 arg0, s8 arg1) { + D_800EA06C[arg0].unk0C = arg1; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800CA2E4.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? D_800EA06C; - -void func_800CA30C(s32 arg0) { - *(&D_800EA06C + 0xC + ((arg0 & 0xFF) * 0x10)) = 0; +void func_800CA30C(u8 arg0) { + D_800EA06C[arg0].unk0C = 0; } -#else -GLOBAL_ASM("asm/non_matchings/audio/external/func_800CA30C.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -5956,36 +5259,30 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800CA730.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800C1C88(s32, void *, ? *, void *, s32, s32); // extern -void play_sound(s32, s32, s32, ? *, ? *, ? *); // extern -extern u8 D_800EA0F0; -extern u8 D_800EA108; -extern u8 D_800EA1C0; -extern ? D_800EA1C8; -extern ? D_800EA1D4; -extern ? D_800EA1DC; -extern Player gPlayers; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +static u8 D_800EA0F0 = 0; /* const */ +static u8 D_800EA1C0 = 0; /* const */ +s8 D_800EA108 = 0; /* const */ void func_800CA984(s32 arg0) { + Player *temp_v0; s32 temp_s5; s32 temp_t2; - s32 temp_v0_2; - void *temp_v0; - s32 phi_s0; + s32 var_s0; + struct Unk_8018EFD8 *temp_v0_2; temp_s5 = arg0 & 0xFF; - if ((D_800EA108 == 0) && (D_800EA0F0 == 0)) { - phi_s0 = 0; + if (((u8) D_800EA108 == 0) && (D_800EA0F0 == 0)) { + var_s0 = 0; if ((D_800EA1C0 + 1) > 0) { - temp_v0 = (temp_s5 * 0xDD8) + &gPlayers; + temp_v0 = &gPlayers[temp_s5]; do { - temp_v0_2 = func_800C1C88(temp_s5 & 0xFF, temp_v0 + 0x14, &D_800EA1C8, temp_v0 + 0x98, phi_s0, 0x31029008); - if (temp_v0_2 != 0) { - play_sound(0x31029008, temp_v0_2 + 0x18, phi_s0 & 0xFF, &D_800EA1D4, &D_800EA1D4, &D_800EA1DC); + temp_v0_2 = func_800C1C88(temp_s5 & 0xFF, temp_v0->pos, &D_800EA1C8, &temp_v0->unk_098, (u8) var_s0, 0x31029008U); + if (temp_v0_2 != NULL) { + play_sound(0x31029008U, temp_v0_2->unk18, var_s0 & 0xFF, &D_800EA1D4, &D_800EA1D4, &D_800EA1DC); } - temp_t2 = (phi_s0 + 1) & 0xFF; - phi_s0 = temp_t2; + temp_t2 = (var_s0 + 1) & 0xFF; + var_s0 = temp_t2; } while (temp_t2 < (D_800EA1C0 + 1)); } } @@ -5995,18 +5292,13 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800CA984.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_800C21E8(void *, ?, s32); // extern -void func_800C5578(s32, ?); // extern -extern u8 D_800EA108; -extern Player gPlayers; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_800C5578(f32 *, ?); /* extern */ +s8 D_800EA108 = 0; /* const */ -void func_800CAACC(s32 arg0) { - s32 temp_a2; - - temp_a2 = arg0 & 0xFF; - if (D_800EA108 == 0) { - func_800C5578(func_800C21E8((temp_a2 * 0xDD8) + 0x14 + &gPlayers, 0x31029008, temp_a2), 0x31029008); +void func_800CAACC(s32 playerId) { + if ((u8) D_800EA108 == 0) { + func_800C5578(func_800C21E8(((playerId & 0xFF) * 0xDD8) + 0x14 + gPlayers, 0x31029008U), 0x31029008); } } #else @@ -6284,9 +5576,7 @@ void func_800CB064(u8 arg0) { GLOBAL_ASM("asm/non_matchings/audio/external/func_800CB064.s") #endif -void func_800CB134(void) { - s32 pad; - if (pad){}; +void func_800CB134() { D_800EA174 = 1; } diff --git a/src/audio/external.h b/src/audio/external.h index 34569e33b..b6de6ca09 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -2,6 +2,7 @@ #define AUDIO_EXTERNAL_H #include "common_structs.h" +#include "camera.h" // Sequence arguments, passed to seq_player_play_sequence. seqId may be bit-OR'ed with // SEQ_VARIATION; this will load the same sequence, but set a variation @@ -16,6 +17,95 @@ #define SEQ_PLAYER_ENV 1 // Misc music like the puzzle jingle #define SEQ_PLAYER_SFX 2 // Sound effects +#define SOUND_BANK_UNK0 0 +#define SOUND_BANK_UNK1 1 +#define SOUND_BANK_UNK2 2 +#define SOUND_BANK_UNK3 3 +#define SOUND_BANK_UNK4 4 +#define SOUND_BANK_UNK5 5 +#define SOUND_BANK_COUNT 6 + +// Almost certainly an expanded version of struct Sound from SM64 +struct Unk_8018FC20 { + /* 0x00 */ u32 soundBits; + /* 0x04 */ f32 *position; + /* 0x08 */ u8 cameraId; // playerId? some indicator of "who" the sound is desitned for + /* 0x09 */ // u8 compilerPadding0[3]; + /* 0x0C */ f32 *unk0C; + /* 0x10 */ f32 *unk10; + /* 0x14 */ u8 *unk14; +}; // size = 0x18 + +// I'm speculating that this struct has something to do with +// the doppler effect that happens to some sounds +struct Unk_8018EFD8 { + // Pointers to a position + /* 0x00 */ f32 *posX; + /* 0x04 */ f32 *posY; + /* 0x08 */ f32 *posZ; + // Pointers to a velocity + /* 0x0C */ f32 *velX; + /* 0x10 */ f32 *velY; + /* 0x14 */ f32 *velZ; + /* 0x18 */ Vec3f unk18; + /* 0x24 */ f32 *unk24; // Some type of multiplier/scalar + // Indexes in D_8018EFD8, not really sure what they're for though + /* 0x28 */ u8 cameraId; // playerId? some indicator of "who" the sound is desitned for + /* 0x29 */ u8 prev; + /* 0x2A */ u8 next; + /* 0x2B */ // u8 compilerPadding00; + /* 0x2C */ f32 unk2C; + /* 0x30 */ u8 unk30; + /* 0x31 */ // u8 compilerPadding01[3]; + /* 0x34 */ f32 unk34; + /* 0x38 */ u32 soundBits; +}; // size = 0x3C + +// This is almost certainly an expanded version of SoundCharacteristics from SM64 +struct Unk_80191420 { + // These f32 pointers appear to point to the `Vec3f unk18` members in a struct Unk_8018EFD8 + /* 0x00 */ f32 *unk00; + /* 0x04 */ f32 *unk04; + /* 0x08 */ f32 *unk08; + /* 0x0C */ u8 cameraId; // playerId? some indicator of "who" the sound is desitned for + /* 0x0D */ // u8 compilerPadding0[3]; + /* 0x10 */ f32 *unk10; + /* 0x14 */ f32 *unk14; + /* 0x18 */ s8 *unk18; + /* 0x1C */ f32 distance; // XZ distance from the camera + /* 0x20 */ u32 priority; + /* 0x24 */ u32 soundBits; + /* 0x28 */ u8 soundStatus; + /* 0x29 */ u8 freshness; + /* 0x2A */ u8 prev; + /* 0x2B */ u8 next; + /* 0x2C */ s32 unk2C; +}; // size = 0x30 + +struct Unk_800EA06C { + /* 0x00 */ Vec3f unk00; + /* 0x0C */ u8 unk0C; + /* 0x0D */ // u8 compilerPadding0[3]; +} ; + +void func_800C13F0(); +f32 func_800C1480(u8, u8); +s8 func_800C15D0(u8, u8, u8); +f32 func_800C1934(u8, u8); +struct Unk_8018EFD8 *func_800C1C88(u8, Vec3f, Vec3f, f32*, u8, u32); +void func_800C1DA4(Camera*, Vec3s, struct Unk_8018EFD8*); +void func_800C1E2C(Camera*, Vec3f, struct Unk_8018EFD8*); +void func_800C1F8C(); +f32 *func_800C21E8(f32*, u32); +void func_800C4084(u16); +void play_sound(u32, f32*, u8, f32*, f32*, u8*); +void func_800C41CC(u8, struct Unk_80191420*); +void func_800C4398(); +void func_800C5848(); +void func_800C6758(u8); +void func_800C86D8(u8); +void func_800C8770(u8); +void func_800C89E4(); void play_sound2(s32); void func_800C8EAC(u16); void func_800C8EF8(); @@ -27,6 +117,8 @@ void func_800CA0B8(); void func_800CA0CC(); void func_800CA118(); void func_800CA270(); +void func_800CA2E4(u8, s8); +void func_800CA30C(u8); void func_800CA330(); void func_800CA330(s32); void func_800CA388(); @@ -35,11 +127,48 @@ void func_800CA49C(); void func_800CB134(); void func_800CB2C4(void); -extern s8 D_800EA0F4; -extern s8 D_800EA108; -extern s16 D_800EA174; - // Based on SM64, this should be part of data.c's BSS section. Somehow. extern s32 gAudioErrorFlags; +extern s8 D_8018EF10; +extern struct Unk_8018EFD8 D_8018EFD8[]; +// These are indexes for D_8018EFD8, but their purpose is unknown +extern u8 D_8018FB90; +extern u8 D_8018FB91; +extern Camera *D_8018FB98[4]; +extern Vec3f D_8018FBA8[4]; +extern Vec3f D_8018FBD8[4]; + +extern struct Unk_80191420 sSoundBanks[SOUND_BANK_COUNT][20]; +extern u8 sSoundBankUsedListBack[SOUND_BANK_COUNT]; +extern u8 sSoundBankFreeListFront[SOUND_BANK_COUNT]; +extern u8 sNumSoundsInBank[SOUND_BANK_COUNT]; +extern u8 sSoundBankDisabled[12]; // size?? +extern u8 sNumProcessedSoundRequests; +extern u8 sSoundRequestCount; +extern struct Unk_8018FC20 sSoundRequests[0x100]; + +// Data entries +extern f32 D_800E9E54[4];// = { 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +extern s32 D_800E9E74[4];// = { 0, 0, 0, 0 }; /* const */ +extern f32 D_800E9F14[4];// = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */ +extern u8 D_800E9F24[8];// = { 0, 0, 0, 0, 0, 0, 0, 0 }; +extern f32 D_800E9F34[8];// = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; /* const */ +extern f32 D_800E9F54[4];// = { 1.0f, 1.0f, 1.0f, 1.0f }; /* const */ +extern u8 D_800E9F2C[8];// = { 0, 0, 0, 0, 0, 0, 0, 0 }; +extern struct Unk_800EA06C D_800EA06C[8]; +extern u8 D_800EA0F0;// = 0; +extern u8 D_800EA0F4; +extern u8 D_800EA108;// = 0; +extern s16 D_800EA174;// = 0; +extern f32 D_800EA178; +extern f32 D_800EA17C; +extern u16 D_800EA180;// = 0; /* const */ +extern u8 D_800EA1C0;// = 0; +// Most similar to gGlobalSoundSource from SM64, but I don't know if its really +// a sound source, its usage makes it look like a 0'd Vec3f for general usage +extern Vec3f D_800EA1C8;// = {0.0f, 0.0f, 0.0f} +extern u8 D_800EA1DC;// = 0; +extern u8 D_800EA244; + #endif diff --git a/src/audio/port_eu.c b/src/audio/port_eu.c index 35bdf86fa..95a12753e 100644 --- a/src/audio/port_eu.c +++ b/src/audio/port_eu.c @@ -29,7 +29,7 @@ extern void *D_803B70D4; extern ? D_803B70D8; extern ? D_803B7180; extern ? D_803B718C; -extern s32 D_803B7194; +extern s32 gAudioRandom; extern ? aspMainDataEnd; extern ? aspMainDataStart; extern ? aspMainTextStart; @@ -148,8 +148,8 @@ void *create_next_audio_frame_task(void) { func_800CBCB0(sp54); } D_803B70D0 = func_800B70EC(D_803B70D0, &sp70, sp60, *temp_s1_3); - D_803B7194 = osGetCount() * (D_803B7194 + D_803B70B8); - D_803B7194 = *(*sp40 + ((D_803B70B8 & 0xFF) * 2)) + D_803B7194; + gAudioRandom = osGetCount() * (gAudioRandom + D_803B70B8); + gAudioRandom = *(*sp40 + ((D_803B70B8 & 0xFF) * 2)) + gAudioRandom; D_803B70D4->unk40 = 0; D_803B70D4->unk44 = 0; temp_v1_2 = D_803B70D4;