From edbd75a2b6a83ac8e05c6623784e3543ecfbabfb Mon Sep 17 00:00:00 2001 From: David Benepe Date: Sat, 8 Aug 2020 21:42:39 -0500 Subject: [PATCH] (7.22%) Decompiled 9 functions in unknown_0B8920 --- .../unknown_0B8920/func_800C3400.s | 19 - .../unknown_0B8920/func_800C4384.s | 20 - .../unknown_0B8920/func_800C43CC.s | 32 -- .../unknown_0B8920/func_800C55F4.s | 13 - .../unknown_0B8920/func_800C5620.s | 49 --- .../unknown_0B8920/func_800C56D0.s | 13 - .../unknown_0B8920/func_800C56FC.s | 75 ---- .../unknown_0B8920/func_800C5AA0.s | 52 --- .../unknown_0B8920/func_800C5F60.s | 46 --- src/unknown_0B8920.c | 355 +++++++++++++++++- 10 files changed, 343 insertions(+), 331 deletions(-) delete mode 100644 asm/non_matchings/unknown_0B8920/func_800C3400.s delete mode 100644 asm/non_matchings/unknown_0B8920/func_800C4384.s delete mode 100644 asm/non_matchings/unknown_0B8920/func_800C43CC.s delete mode 100644 asm/non_matchings/unknown_0B8920/func_800C55F4.s delete mode 100644 asm/non_matchings/unknown_0B8920/func_800C5620.s delete mode 100644 asm/non_matchings/unknown_0B8920/func_800C56D0.s delete mode 100644 asm/non_matchings/unknown_0B8920/func_800C56FC.s delete mode 100644 asm/non_matchings/unknown_0B8920/func_800C5AA0.s delete mode 100644 asm/non_matchings/unknown_0B8920/func_800C5F60.s diff --git a/asm/non_matchings/unknown_0B8920/func_800C3400.s b/asm/non_matchings/unknown_0B8920/func_800C3400.s deleted file mode 100644 index 7ba06977..00000000 --- a/asm/non_matchings/unknown_0B8920/func_800C3400.s +++ /dev/null @@ -1,19 +0,0 @@ -glabel func_800C3400 -/* 0C4000 800C3400 3C0E800E */ lui $t6, %hi(D_800E3670) # $t6, 0x800e -/* 0C4004 800C3404 81CE3670 */ lb $t6, %lo(D_800E3670)($t6) -/* 0C4008 800C3408 00001825 */ move $v1, $zero -/* 0C400C 800C340C 11C0000A */ beqz $t6, .L800C3438 -/* 0C4010 800C3410 3C0F8013 */ lui $t7, %hi(D_8012A789) # $t7, 0x8013 -/* 0C4014 800C3414 91EFA789 */ lbu $t7, %lo(D_8012A789)($t7) -/* 0C4018 800C3418 3C188013 */ lui $t8, %hi(D_8012A788) # $t8, 0x8013 -/* 0C401C 800C341C 11E00006 */ beqz $t7, .L800C3438 -/* 0C4020 800C3420 00000000 */ nop -/* 0C4024 800C3424 8318A788 */ lb $t8, %lo(D_8012A788)($t8) -/* 0C4028 800C3428 24030001 */ li $v1, 1 -/* 0C402C 800C342C 13000002 */ beqz $t8, .L800C3438 -/* 0C4030 800C3430 00000000 */ nop -/* 0C4034 800C3434 24030002 */ li $v1, 2 -.L800C3438: -/* 0C4038 800C3438 03E00008 */ jr $ra -/* 0C403C 800C343C 00601025 */ move $v0, $v1 - diff --git a/asm/non_matchings/unknown_0B8920/func_800C4384.s b/asm/non_matchings/unknown_0B8920/func_800C4384.s deleted file mode 100644 index eb373a72..00000000 --- a/asm/non_matchings/unknown_0B8920/func_800C4384.s +++ /dev/null @@ -1,20 +0,0 @@ -glabel func_800C4384 -/* 0C4F84 800C4384 3C028013 */ lui $v0, %hi(D_8012A7E8) # $v0, 0x8013 -/* 0C4F88 800C4388 2442A7E8 */ addiu $v0, %lo(D_8012A7E8) # addiu $v0, $v0, -0x5818 -/* 0C4F8C 800C438C 8C4E0000 */ lw $t6, ($v0) -/* 0C4F90 800C4390 00000000 */ nop -/* 0C4F94 800C4394 A1C40014 */ sb $a0, 0x14($t6) -/* 0C4F98 800C4398 8C4F0000 */ lw $t7, ($v0) -/* 0C4F9C 800C439C 00000000 */ nop -/* 0C4FA0 800C43A0 A1E50015 */ sb $a1, 0x15($t7) -/* 0C4FA4 800C43A4 8C580000 */ lw $t8, ($v0) -/* 0C4FA8 800C43A8 00000000 */ nop -/* 0C4FAC 800C43AC A3060016 */ sb $a2, 0x16($t8) -/* 0C4FB0 800C43B0 8C590000 */ lw $t9, ($v0) -/* 0C4FB4 800C43B4 00000000 */ nop -/* 0C4FB8 800C43B8 A3270017 */ sb $a3, 0x17($t9) -/* 0C4FBC 800C43BC 8C490000 */ lw $t1, ($v0) -/* 0C4FC0 800C43C0 8FA80010 */ lw $t0, 0x10($sp) -/* 0C4FC4 800C43C4 03E00008 */ jr $ra -/* 0C4FC8 800C43C8 A128001C */ sb $t0, 0x1c($t1) - diff --git a/asm/non_matchings/unknown_0B8920/func_800C43CC.s b/asm/non_matchings/unknown_0B8920/func_800C43CC.s deleted file mode 100644 index b170e3f9..00000000 --- a/asm/non_matchings/unknown_0B8920/func_800C43CC.s +++ /dev/null @@ -1,32 +0,0 @@ -glabel func_800C43CC -/* 0C4FCC 800C43CC 3C028013 */ lui $v0, %hi(D_8012A7E8) # $v0, 0x8013 -/* 0C4FD0 800C43D0 2442A7E8 */ addiu $v0, %lo(D_8012A7E8) # addiu $v0, $v0, -0x5818 -/* 0C4FD4 800C43D4 8C4E0000 */ lw $t6, ($v0) -/* 0C4FD8 800C43D8 00000000 */ nop -/* 0C4FDC 800C43DC A1C40018 */ sb $a0, 0x18($t6) -/* 0C4FE0 800C43E0 8C4F0000 */ lw $t7, ($v0) -/* 0C4FE4 800C43E4 00000000 */ nop -/* 0C4FE8 800C43E8 A1E50019 */ sb $a1, 0x19($t7) -/* 0C4FEC 800C43EC 8C580000 */ lw $t8, ($v0) -/* 0C4FF0 800C43F0 00000000 */ nop -/* 0C4FF4 800C43F4 A306001A */ sb $a2, 0x1a($t8) -/* 0C4FF8 800C43F8 8C590000 */ lw $t9, ($v0) -/* 0C4FFC 800C43FC 03E00008 */ jr $ra -/* 0C5000 800C4400 A327001B */ sb $a3, 0x1b($t9) - -/* 0C5004 800C4404 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0C5008 800C4408 00C03825 */ move $a3, $a2 -/* 0C500C 800C440C 00A03025 */ move $a2, $a1 -/* 0C5010 800C4410 AFA50024 */ sw $a1, 0x24($sp) -/* 0C5014 800C4414 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 0C5018 800C4418 44812000 */ mtc1 $at, $f4 -/* 0C501C 800C441C 3C058013 */ lui $a1, %hi(D_8012A7E8) # $a1, 0x8013 -/* 0C5020 800C4420 AFBF001C */ sw $ra, 0x1c($sp) -/* 0C5024 800C4424 8CA5A7E8 */ lw $a1, %lo(D_8012A7E8)($a1) -/* 0C5028 800C4428 0C031169 */ jal func_800C45A4 -/* 0C502C 800C442C E7A40010 */ swc1 $f4, 0x10($sp) -/* 0C5030 800C4430 8FBF001C */ lw $ra, 0x1c($sp) -/* 0C5034 800C4434 27BD0020 */ addiu $sp, $sp, 0x20 -/* 0C5038 800C4438 03E00008 */ jr $ra -/* 0C503C 800C443C 00000000 */ nop - diff --git a/asm/non_matchings/unknown_0B8920/func_800C55F4.s b/asm/non_matchings/unknown_0B8920/func_800C55F4.s deleted file mode 100644 index d53b7230..00000000 --- a/asm/non_matchings/unknown_0B8920/func_800C55F4.s +++ /dev/null @@ -1,13 +0,0 @@ -glabel func_800C55F4 -/* 0C61F4 800C55F4 3C0E8013 */ lui $t6, %hi(D_8012A7E8) # $t6, 0x8013 -/* 0C61F8 800C55F8 00047880 */ sll $t7, $a0, 2 -/* 0C61FC 800C55FC 8DCEA7E8 */ lw $t6, %lo(D_8012A7E8)($t6) -/* 0C6200 800C5600 01E47821 */ addu $t7, $t7, $a0 -/* 0C6204 800C5604 000F78C0 */ sll $t7, $t7, 3 -/* 0C6208 800C5608 01CF1021 */ addu $v0, $t6, $t7 -/* 0C620C 800C560C 9458001E */ lhu $t8, 0x1e($v0) -/* 0C6210 800C5610 00000000 */ nop -/* 0C6214 800C5614 37198000 */ ori $t9, $t8, 0x8000 -/* 0C6218 800C5618 03E00008 */ jr $ra -/* 0C621C 800C561C A459001E */ sh $t9, 0x1e($v0) - diff --git a/asm/non_matchings/unknown_0B8920/func_800C5620.s b/asm/non_matchings/unknown_0B8920/func_800C5620.s deleted file mode 100644 index 6e7fe1e5..00000000 --- a/asm/non_matchings/unknown_0B8920/func_800C5620.s +++ /dev/null @@ -1,49 +0,0 @@ -glabel func_800C5620 -/* 0C6220 800C5620 3C0E8013 */ lui $t6, %hi(D_8012A7E8) # $t6, 0x8013 -/* 0C6224 800C5624 00047880 */ sll $t7, $a0, 2 -/* 0C6228 800C5628 8DCEA7E8 */ lw $t6, %lo(D_8012A7E8)($t6) -/* 0C622C 800C562C 01E47821 */ addu $t7, $t7, $a0 -/* 0C6230 800C5630 000F78C0 */ sll $t7, $t7, 3 -/* 0C6234 800C5634 01CF1021 */ addu $v0, $t6, $t7 -/* 0C6238 800C5638 9458001E */ lhu $t8, 0x1e($v0) -/* 0C623C 800C563C 00000000 */ nop -/* 0C6240 800C5640 33197FFF */ andi $t9, $t8, 0x7fff -/* 0C6244 800C5644 03E00008 */ jr $ra -/* 0C6248 800C5648 A459001E */ sh $t9, 0x1e($v0) - -/* 0C624C 800C564C 3C0E8013 */ lui $t6, %hi(D_8012A7E8) # $t6, 0x8013 -/* 0C6250 800C5650 00047880 */ sll $t7, $a0, 2 -/* 0C6254 800C5654 8DCEA7E8 */ lw $t6, %lo(D_8012A7E8)($t6) -/* 0C6258 800C5658 01E47821 */ addu $t7, $t7, $a0 -/* 0C625C 800C565C 000F78C0 */ sll $t7, $t7, 3 -/* 0C6260 800C5660 01CF1021 */ addu $v0, $t6, $t7 -/* 0C6264 800C5664 9458001E */ lhu $t8, 0x1e($v0) -/* 0C6268 800C5668 00000000 */ nop -/* 0C626C 800C566C 37190001 */ ori $t9, $t8, 1 -/* 0C6270 800C5670 03E00008 */ jr $ra -/* 0C6274 800C5674 A459001E */ sh $t9, 0x1e($v0) - -/* 0C6278 800C5678 3C0E8013 */ lui $t6, %hi(D_8012A7E8) # $t6, 0x8013 -/* 0C627C 800C567C 00047880 */ sll $t7, $a0, 2 -/* 0C6280 800C5680 8DCEA7E8 */ lw $t6, %lo(D_8012A7E8)($t6) -/* 0C6284 800C5684 01E47821 */ addu $t7, $t7, $a0 -/* 0C6288 800C5688 000F78C0 */ sll $t7, $t7, 3 -/* 0C628C 800C568C 01CF1021 */ addu $v0, $t6, $t7 -/* 0C6290 800C5690 9458001E */ lhu $t8, 0x1e($v0) -/* 0C6294 800C5694 00000000 */ nop -/* 0C6298 800C5698 3319FFFE */ andi $t9, $t8, 0xfffe -/* 0C629C 800C569C 03E00008 */ jr $ra -/* 0C62A0 800C56A0 A459001E */ sh $t9, 0x1e($v0) - -/* 0C62A4 800C56A4 3C0E8013 */ lui $t6, %hi(D_8012A7E8) # $t6, 0x8013 -/* 0C62A8 800C56A8 00047880 */ sll $t7, $a0, 2 -/* 0C62AC 800C56AC 8DCEA7E8 */ lw $t6, %lo(D_8012A7E8)($t6) -/* 0C62B0 800C56B0 01E47821 */ addu $t7, $t7, $a0 -/* 0C62B4 800C56B4 000F78C0 */ sll $t7, $t7, 3 -/* 0C62B8 800C56B8 01CF1021 */ addu $v0, $t6, $t7 -/* 0C62BC 800C56BC 9458001E */ lhu $t8, 0x1e($v0) -/* 0C62C0 800C56C0 00000000 */ nop -/* 0C62C4 800C56C4 37194000 */ ori $t9, $t8, 0x4000 -/* 0C62C8 800C56C8 03E00008 */ jr $ra -/* 0C62CC 800C56CC A459001E */ sh $t9, 0x1e($v0) - diff --git a/asm/non_matchings/unknown_0B8920/func_800C56D0.s b/asm/non_matchings/unknown_0B8920/func_800C56D0.s deleted file mode 100644 index 8a228db4..00000000 --- a/asm/non_matchings/unknown_0B8920/func_800C56D0.s +++ /dev/null @@ -1,13 +0,0 @@ -glabel func_800C56D0 -/* 0C62D0 800C56D0 3C0E8013 */ lui $t6, %hi(D_8012A7E8) # $t6, 0x8013 -/* 0C62D4 800C56D4 00047880 */ sll $t7, $a0, 2 -/* 0C62D8 800C56D8 8DCEA7E8 */ lw $t6, %lo(D_8012A7E8)($t6) -/* 0C62DC 800C56DC 01E47821 */ addu $t7, $t7, $a0 -/* 0C62E0 800C56E0 000F78C0 */ sll $t7, $t7, 3 -/* 0C62E4 800C56E4 01CF1021 */ addu $v0, $t6, $t7 -/* 0C62E8 800C56E8 9458001E */ lhu $t8, 0x1e($v0) -/* 0C62EC 800C56EC 00000000 */ nop -/* 0C62F0 800C56F0 3319BFFF */ andi $t9, $t8, 0xbfff -/* 0C62F4 800C56F4 03E00008 */ jr $ra -/* 0C62F8 800C56F8 A459001E */ sh $t9, 0x1e($v0) - diff --git a/asm/non_matchings/unknown_0B8920/func_800C56FC.s b/asm/non_matchings/unknown_0B8920/func_800C56FC.s deleted file mode 100644 index 6c8ab16c..00000000 --- a/asm/non_matchings/unknown_0B8920/func_800C56FC.s +++ /dev/null @@ -1,75 +0,0 @@ -glabel func_800C56FC -/* 0C62FC 800C56FC 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 0C6300 800C5700 AFB00018 */ sw $s0, 0x18($sp) -/* 0C6304 800C5704 3C10800E */ lui $s0, %hi(D_800E36E8) # $s0, 0x800e -/* 0C6308 800C5708 261036E8 */ addiu $s0, %lo(D_800E36E8) # addiu $s0, $s0, 0x36e8 -/* 0C630C 800C570C 820E0000 */ lb $t6, ($s0) -/* 0C6310 800C5710 AFB60030 */ sw $s6, 0x30($sp) -/* 0C6314 800C5714 AFB5002C */ sw $s5, 0x2c($sp) -/* 0C6318 800C5718 AFB20020 */ sw $s2, 0x20($sp) -/* 0C631C 800C571C 00809025 */ move $s2, $a0 -/* 0C6320 800C5720 00A0A825 */ move $s5, $a1 -/* 0C6324 800C5724 00C0B025 */ move $s6, $a2 -/* 0C6328 800C5728 AFBF0034 */ sw $ra, 0x34($sp) -/* 0C632C 800C572C AFB40028 */ sw $s4, 0x28($sp) -/* 0C6330 800C5730 AFB30024 */ sw $s3, 0x24($sp) -/* 0C6334 800C5734 11C0000E */ beqz $t6, .L800C5770 -/* 0C6338 800C5738 AFB1001C */ sw $s1, 0x1c($sp) -/* 0C633C 800C573C 3C028013 */ lui $v0, %hi(D_8012A7F4) # $v0, 0x8013 -/* 0C6340 800C5740 2442A7F4 */ addiu $v0, %lo(D_8012A7F4) # addiu $v0, $v0, -0x580c -/* 0C6344 800C5744 804F0000 */ lb $t7, ($v0) -/* 0C6348 800C5748 00000000 */ nop -/* 0C634C 800C574C 25F8FFFF */ addiu $t8, $t7, -1 -/* 0C6350 800C5750 A0580000 */ sb $t8, ($v0) -/* 0C6354 800C5754 80590000 */ lb $t9, ($v0) -/* 0C6358 800C5758 00000000 */ nop -/* 0C635C 800C575C 17200004 */ bnez $t9, .L800C5770 -/* 0C6360 800C5760 00000000 */ nop -/* 0C6364 800C5764 0C027A6A */ jal func_8009E9A8 -/* 0C6368 800C5768 00000000 */ nop -/* 0C636C 800C576C A2000000 */ sb $zero, ($s0) -.L800C5770: -/* 0C6370 800C5770 3C138013 */ lui $s3, %hi(D_8012A7E8) # $s3, 0x8013 -/* 0C6374 800C5774 2673A7E8 */ addiu $s3, %lo(D_8012A7E8) # addiu $s3, $s3, -0x5818 -/* 0C6378 800C5778 24100001 */ li $s0, 1 -/* 0C637C 800C577C 24110028 */ li $s1, 40 -/* 0C6380 800C5780 24140008 */ li $s4, 8 -.L800C5784: -/* 0C6384 800C5784 8E680000 */ lw $t0, ($s3) -/* 0C6388 800C5788 00000000 */ nop -/* 0C638C 800C578C 01114821 */ addu $t1, $t0, $s1 -/* 0C6390 800C5790 9522001E */ lhu $v0, 0x1e($t1) -/* 0C6394 800C5794 00000000 */ nop -/* 0C6398 800C5798 304A8000 */ andi $t2, $v0, 0x8000 -/* 0C639C 800C579C 1140000E */ beqz $t2, .L800C57D8 -/* 0C63A0 800C57A0 304B4000 */ andi $t3, $v0, 0x4000 -/* 0C63A4 800C57A4 11600008 */ beqz $t3, .L800C57C8 -/* 0C63A8 800C57A8 02402025 */ move $a0, $s2 -/* 0C63AC 800C57AC 02402025 */ move $a0, $s2 -/* 0C63B0 800C57B0 02A02825 */ move $a1, $s5 -/* 0C63B4 800C57B4 02C03025 */ move $a2, $s6 -/* 0C63B8 800C57B8 0C0316D6 */ jal func_800C5B58 -/* 0C63BC 800C57BC 02003825 */ move $a3, $s0 -/* 0C63C0 800C57C0 10000006 */ b .L800C57DC -/* 0C63C4 800C57C4 26100001 */ addiu $s0, $s0, 1 -.L800C57C8: -/* 0C63C8 800C57C8 00002825 */ move $a1, $zero -/* 0C63CC 800C57CC 00003025 */ move $a2, $zero -/* 0C63D0 800C57D0 0C0316D6 */ jal func_800C5B58 -/* 0C63D4 800C57D4 02003825 */ move $a3, $s0 -.L800C57D8: -/* 0C63D8 800C57D8 26100001 */ addiu $s0, $s0, 1 -.L800C57DC: -/* 0C63DC 800C57DC 1614FFE9 */ bne $s0, $s4, .L800C5784 -/* 0C63E0 800C57E0 26310028 */ addiu $s1, $s1, 0x28 -/* 0C63E4 800C57E4 8FBF0034 */ lw $ra, 0x34($sp) -/* 0C63E8 800C57E8 8FB00018 */ lw $s0, 0x18($sp) -/* 0C63EC 800C57EC 8FB1001C */ lw $s1, 0x1c($sp) -/* 0C63F0 800C57F0 8FB20020 */ lw $s2, 0x20($sp) -/* 0C63F4 800C57F4 8FB30024 */ lw $s3, 0x24($sp) -/* 0C63F8 800C57F8 8FB40028 */ lw $s4, 0x28($sp) -/* 0C63FC 800C57FC 8FB5002C */ lw $s5, 0x2c($sp) -/* 0C6400 800C5800 8FB60030 */ lw $s6, 0x30($sp) -/* 0C6404 800C5804 03E00008 */ jr $ra -/* 0C6408 800C5808 27BD0038 */ addiu $sp, $sp, 0x38 - diff --git a/asm/non_matchings/unknown_0B8920/func_800C5AA0.s b/asm/non_matchings/unknown_0B8920/func_800C5AA0.s deleted file mode 100644 index b36dd42d..00000000 --- a/asm/non_matchings/unknown_0B8920/func_800C5AA0.s +++ /dev/null @@ -1,52 +0,0 @@ -glabel func_800C5AA0 -/* 0C66A0 800C5AA0 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0C66A4 800C5AA4 AFBF0014 */ sw $ra, 0x14($sp) -/* 0C66A8 800C5AA8 AFA40018 */ sw $a0, 0x18($sp) -/* 0C66AC 800C5AAC AFA70024 */ sw $a3, 0x24($sp) -/* 0C66B0 800C5AB0 AFA5001C */ sw $a1, 0x1c($sp) -/* 0C66B4 800C5AB4 0C01E948 */ jal func_8007A520 -/* 0C66B8 800C5AB8 AFA60020 */ sw $a2, 0x20($sp) -/* 0C66BC 800C5ABC 8FA70024 */ lw $a3, 0x24($sp) -/* 0C66C0 800C5AC0 8FA5001C */ lw $a1, 0x1c($sp) -/* 0C66C4 800C5AC4 8FA60020 */ lw $a2, 0x20($sp) -/* 0C66C8 800C5AC8 8FA80018 */ lw $t0, 0x18($sp) -/* 0C66CC 800C5ACC 04E0001E */ bltz $a3, .L800C5B48 -/* 0C66D0 800C5AD0 304EFFFF */ andi $t6, $v0, 0xffff -/* 0C66D4 800C5AD4 00AE082B */ sltu $at, $a1, $t6 -/* 0C66D8 800C5AD8 1020001C */ beqz $at, .L800C5B4C -/* 0C66DC 800C5ADC 8FBF0014 */ lw $ra, 0x14($sp) -/* 0C66E0 800C5AE0 8FA40028 */ lw $a0, 0x28($sp) -/* 0C66E4 800C5AE4 00027C02 */ srl $t7, $v0, 0x10 -/* 0C66E8 800C5AE8 04800017 */ bltz $a0, .L800C5B48 -/* 0C66EC 800C5AEC 00CF082B */ sltu $at, $a2, $t7 -/* 0C66F0 800C5AF0 10200015 */ beqz $at, .L800C5B48 -/* 0C66F4 800C5AF4 30F903FF */ andi $t9, $a3, 0x3ff -/* 0C66F8 800C5AF8 04A10002 */ bgez $a1, .L800C5B04 -/* 0C66FC 800C5AFC 00194B80 */ sll $t1, $t9, 0xe -/* 0C6700 800C5B00 00002825 */ move $a1, $zero -.L800C5B04: -/* 0C6704 800C5B04 04C10002 */ bgez $a2, .L800C5B10 -/* 0C6708 800C5B08 3C01F600 */ lui $at, 0xf600 -/* 0C670C 800C5B0C 00003025 */ move $a2, $zero -.L800C5B10: -/* 0C6710 800C5B10 8D030000 */ lw $v1, ($t0) -/* 0C6714 800C5B14 01215025 */ or $t2, $t1, $at -/* 0C6718 800C5B18 24780008 */ addiu $t8, $v1, 8 -/* 0C671C 800C5B1C AD180000 */ sw $t8, ($t0) -/* 0C6720 800C5B20 30D803FF */ andi $t8, $a2, 0x3ff -/* 0C6724 800C5B24 308B03FF */ andi $t3, $a0, 0x3ff -/* 0C6728 800C5B28 30AE03FF */ andi $t6, $a1, 0x3ff -/* 0C672C 800C5B2C 000E7B80 */ sll $t7, $t6, 0xe -/* 0C6730 800C5B30 000B6080 */ sll $t4, $t3, 2 -/* 0C6734 800C5B34 0018C880 */ sll $t9, $t8, 2 -/* 0C6738 800C5B38 01F94825 */ or $t1, $t7, $t9 -/* 0C673C 800C5B3C 014C6825 */ or $t5, $t2, $t4 -/* 0C6740 800C5B40 AC6D0000 */ sw $t5, ($v1) -/* 0C6744 800C5B44 AC690004 */ sw $t1, 4($v1) -.L800C5B48: -/* 0C6748 800C5B48 8FBF0014 */ lw $ra, 0x14($sp) -.L800C5B4C: -/* 0C674C 800C5B4C 27BD0018 */ addiu $sp, $sp, 0x18 -/* 0C6750 800C5B50 03E00008 */ jr $ra -/* 0C6754 800C5B54 00000000 */ nop - diff --git a/asm/non_matchings/unknown_0B8920/func_800C5F60.s b/asm/non_matchings/unknown_0B8920/func_800C5F60.s deleted file mode 100644 index 84286eef..00000000 --- a/asm/non_matchings/unknown_0B8920/func_800C5F60.s +++ /dev/null @@ -1,46 +0,0 @@ -glabel func_800C5F60 -/* 0C6B60 800C5F60 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0C6B64 800C5F64 AFBF0024 */ sw $ra, 0x24($sp) -/* 0C6B68 800C5F68 AFB30020 */ sw $s3, 0x20($sp) -/* 0C6B6C 800C5F6C AFB2001C */ sw $s2, 0x1c($sp) -/* 0C6B70 800C5F70 AFB10018 */ sw $s1, 0x18($sp) -/* 0C6B74 800C5F74 AFB00014 */ sw $s0, 0x14($sp) -/* 0C6B78 800C5F78 AFA5002C */ sw $a1, 0x2c($sp) -/* 0C6B7C 800C5F7C 90820000 */ lbu $v0, ($a0) -/* 0C6B80 800C5F80 00808025 */ move $s0, $a0 -/* 0C6B84 800C5F84 10400014 */ beqz $v0, .L800C5FD8 -/* 0C6B88 800C5F88 00C09825 */ move $s3, $a2 -/* 0C6B8C 800C5F8C 27B2002C */ addiu $s2, $sp, 0x2c -/* 0C6B90 800C5F90 2411007E */ li $s1, 126 -.L800C5F94: -/* 0C6B94 800C5F94 16220005 */ bne $s1, $v0, .L800C5FAC -/* 0C6B98 800C5F98 02402025 */ move $a0, $s2 -/* 0C6B9C 800C5F9C 0C031603 */ jal func_800C580C -/* 0C6BA0 800C5FA0 02602825 */ move $a1, $s3 -/* 0C6BA4 800C5FA4 10000008 */ b .L800C5FC8 -/* 0C6BA8 800C5FA8 26100001 */ addiu $s0, $s0, 1 -.L800C5FAC: -/* 0C6BAC 800C5FAC 8FAE002C */ lw $t6, 0x2c($sp) -/* 0C6BB0 800C5FB0 26100001 */ addiu $s0, $s0, 1 -/* 0C6BB4 800C5FB4 A1C20000 */ sb $v0, ($t6) -/* 0C6BB8 800C5FB8 8FAF002C */ lw $t7, 0x2c($sp) -/* 0C6BBC 800C5FBC 00000000 */ nop -/* 0C6BC0 800C5FC0 25F80001 */ addiu $t8, $t7, 1 -/* 0C6BC4 800C5FC4 AFB8002C */ sw $t8, 0x2c($sp) -.L800C5FC8: -/* 0C6BC8 800C5FC8 92020000 */ lbu $v0, ($s0) -/* 0C6BCC 800C5FCC 00000000 */ nop -/* 0C6BD0 800C5FD0 1440FFF0 */ bnez $v0, .L800C5F94 -/* 0C6BD4 800C5FD4 00000000 */ nop -.L800C5FD8: -/* 0C6BD8 800C5FD8 8FB9002C */ lw $t9, 0x2c($sp) -/* 0C6BDC 800C5FDC 00000000 */ nop -/* 0C6BE0 800C5FE0 A3200000 */ sb $zero, ($t9) -/* 0C6BE4 800C5FE4 8FBF0024 */ lw $ra, 0x24($sp) -/* 0C6BE8 800C5FE8 8FB30020 */ lw $s3, 0x20($sp) -/* 0C6BEC 800C5FEC 8FB2001C */ lw $s2, 0x1c($sp) -/* 0C6BF0 800C5FF0 8FB10018 */ lw $s1, 0x18($sp) -/* 0C6BF4 800C5FF4 8FB00014 */ lw $s0, 0x14($sp) -/* 0C6BF8 800C5FF8 03E00008 */ jr $ra -/* 0C6BFC 800C5FFC 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/src/unknown_0B8920.c b/src/unknown_0B8920.c index 00d6d051..8b0d9eb9 100644 --- a/src/unknown_0B8920.c +++ b/src/unknown_0B8920.c @@ -32,18 +32,56 @@ extern s32* D_800E3188; extern s32* D_800E3190; extern s32* D_800E3194; extern s32 D_800E31A0; +extern s8 D_800E3670; extern s16 D_800E3674; extern s32 D_800E3678; extern s32 D_800E3680; +extern s8 D_800E36E8; extern u8* D_800E3760; extern u8* D_800E3764; extern u8* gzip_inflate_input; extern u8* gzip_inflate_output; extern s32 D_8012A0D8; extern s32 D_8012A0DC; +extern s8 D_8012A788; +extern u8 D_8012A789; extern u16 D_8012A7B6; extern s32* D_8012A7C8; +extern s32 D_8012A7E0; + +/* Size: 0x28 bytes */ +typedef struct unk8012A7E8 { + s16 unk0; + s16 unk2; + s16 unk4; + s16 unk6; + s16 unk8; + s16 unkA; + s16 unkC; + s16 unkE; + s8 unk10; + s8 unk11; + s8 unk12; + s8 unk13; + s8 unk14; + s8 unk15; + s8 unk16; + s8 unk17; + s8 unk18; + s8 unk19; + s8 unk1A; + s8 unk1B; + s8 unk1C; + s8 unk1D; + u16 unk1E; + s16 unk20; + s16 unk22; + u8 pad24[0x4]; +} unk8012A7E8; + +extern unk8012A7E8 *D_8012A7E8[8]; extern s32 D_8012A7F0; +extern s8 D_8012A7F4; extern s32 D_8012AAD8; extern u32 gzip_num_bits; extern u32 gzip_bit_buffer; @@ -130,7 +168,6 @@ GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800BA4B8.s") GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800BA8E4.s") GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800BB2F4.s") -//GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800BBDDC.s") void func_800BBE08(void); void func_800BBF78(s32 arg0); @@ -211,7 +248,21 @@ void func_800C314C(void) { GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C3158.s") GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C31EC.s") -GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C3400.s") + +s32 func_800C3400(void) { + s32 result = 0; + if (D_800E3670 != 0) { + if (D_8012A789 != 0) { + result = 1; + if (D_8012A788 != 0) { + result = 2; + } + } + } + return result; +} + + GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C3440.s") GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C3564.s") GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C38B4.s") @@ -224,26 +275,307 @@ void func_800C4164(s32 arg0) { GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C4170.s") GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C422C.s") GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C42EC.s") -GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C4384.s") -GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C43CC.s") + +void func_800C4384(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + (*D_8012A7E8)[0].unk14 = arg0; + (*D_8012A7E8)[0].unk15 = arg1; + (*D_8012A7E8)[0].unk16 = arg2; + (*D_8012A7E8)[0].unk17 = arg3; + (*D_8012A7E8)[0].unk1C = arg4; +} + +void func_800C43CC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + (*D_8012A7E8)[0].unk18 = arg0; + (*D_8012A7E8)[0].unk19 = arg1; + (*D_8012A7E8)[0].unk1A = arg2; + (*D_8012A7E8)[0].unk1B = arg3; +} + +void func_800C45A4(s32, unk8012A7E8*, s32, s32, f32); + +// Unused? +void func_800C4404(s32 arg0, s32 arg1, s32 arg2) { + func_800C45A4(arg0, *D_8012A7E8, arg1, arg2, 1.0f); +} + +#if 1 GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C4440.s") +#else +// This function is OK +void func_800C4440(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + unk8012A7E8 *temp = &(*D_8012A7E8)[0]; + temp->unk0 = (arg1 == -0x8000) ? temp->unkC >> 1 : arg1; + temp->unk2 = (arg2 == -0x8000) ? temp->unkE >> 1 : arg2; + func_800C45A4(arg0, temp, arg3, arg4, 1.0f); +} + +// Unused? +void func_800C44C0(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { + if (arg1 >= 0 && arg1 < 8) { + unk8012A7E8 *temp = &(*D_8012A7E8)[arg1]; // Issue with temp + func_800C45A4(arg0, temp, arg2, arg3, 1.0f); + } +} + +// Unused? +void func_800C4510(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { + if (arg1 >= 0 && arg1 < 8) { + unk8012A7E8 *temp = &(*D_8012A7E8)[arg1]; // Issue with temp + temp->unk0 = (arg2 == -0x8000) ? temp->unkC >> 1 : arg2; + temp->unk2 = (arg3 == -0x8000) ? temp->unkE >> 1 : arg3; + func_800C45A4(arg0, temp, arg4, arg5, 1.0f); + } +} +#endif + +// Has a jump table GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C45A4.s") + GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C4DA0.s") + +#if 1 GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C4EDC.s") +#else +void func_800C4EDC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + if (arg0 > 0 && arg0 < 8) { + // How is temp supposed to be setup for all of these functions? This is driving me nuts. + unk8012A7E8 *temp = &(*D_8012A7E8)[arg0]; // Issue with temp + temp->unk0 = 0; + temp->unk2 = 0; + if (arg1 < arg3) { + temp->unk4 = (s16) arg1; + temp->unk8 = (s16) arg3; + } else { + temp->unk8 = (s16) arg1; + temp->unk4 = (s16) arg3; + } + if (arg2 < arg4) { + temp->unk6 = (s16) arg2; + temp->unkA = (s16) arg4; + } else { + temp->unkA = (s16) arg2; + temp->unk6 = (s16) arg4; + } + temp->unkC = (temp->unk8 - temp->unk4) + 1; + temp->unkE = (temp->unkA - temp->unk6) + 1; + } +} +#endif + +#if 1 GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C4F7C.s") +#else +void func_800C4F7C(s32 arg0, s32 arg1) { + if (arg0 >= 0 && arg0 < 8) { + unk8012A7E8 *temp = &(*D_8012A7E8)[arg0]; // Issue with temp + if (arg1 < D_8012A7E0) { + temp->unk1D = arg1; + } + } +} +#endif + +#if 1 GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C4FBC.s") +#else +void func_800C4FBC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + if (arg0 > 0 && arg0 < 8) { + unk8012A7E8 *temp = &(*D_8012A7E8[arg0]); // Issue with temp + temp->unk10 = arg1; + temp->unk11 = arg2; + temp->unk12 = arg3; + temp->unk13 = arg4; + } +} +#endif + +#if 1 GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C5000.s") +#else +void func_800C5000(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5) { + unk8012A7E8 *temp; + if (arg0 <= 0 || arg0 >= 8) { + return; + } + temp = &(*D_8012A7E8)[arg0]; // Issue with temp + temp->unk14 = arg1; + temp->unk15 = arg2; + temp->unk16 = arg3; + temp->unk17 = arg4; + temp->unk1C = arg5; +} +#endif + +#if 1 GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C5050.s") +#else +void func_800C5050(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + unk8012A7E8 *temp; + if (arg0 <= 0 || arg0 >= 8) { + return; + } + temp = &(*D_8012A7E8)[arg0]; // Issue with temp + temp->unk18 = arg1; + temp->unk19 = arg2; + temp->unk1A = arg3; + temp->unk1B = arg4; +} + +// Unused? +void func_800C5094(s32 arg0, s32 arg1, s32 arg2) { + unk8012A7E8 *temp; + if (arg0 <= 0 || arg0 >= 8) { + return; + } + temp = &(*D_8012A7E8)[arg0]; // Issue with temp + temp->unk20 += arg1; + temp->unk22 += arg2; +} + +// Unused? +void func_800C50D8(s32 arg0) { + unk8012A7E8 *temp; + if (arg0 <= 0 || arg0 >= 8) { + return; + } + temp = &(*D_8012A7E8)[arg0]; // Issue with temp + temp->unk20 = 0; + temp->unk22 = 0; +} + +// Unused? +// This function is OK +void func_800C510C(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { + func_800C5168(arg0, (*D_8012A7E8)[arg0].unk0, (*D_8012A7E8)[arg0].unk2, arg1, arg2, arg3); +} +#endif + GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C5168.s") GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C5494.s") -GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C55F4.s") -GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C5620.s") -GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C56D0.s") -GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C56FC.s") + +void func_800C55F4(s32 arg0) { + (*D_8012A7E8)[arg0].unk1E |= 0x8000; +} + +void func_800C5620(s32 arg0) { + (*D_8012A7E8)[arg0].unk1E &= 0x7FFF; +} + +// Unused? +void func_800C564C(s32 arg0) { + (*D_8012A7E8)[arg0].unk1E |= 0x0001; +} + +// Unused? +void func_800C5678(s32 arg0) { + (*D_8012A7E8)[arg0].unk1E &= 0xFFFE; +} + +// Unused? +void func_800C56A4(s32 arg0) { + (*D_8012A7E8)[arg0].unk1E |= 0x4000; +} + +void func_800C56D0(s32 arg0) { + (*D_8012A7E8)[arg0].unk1E &= 0xBFFF; +} + +void func_800C56FC(s32 arg0, s32 arg1, s32 arg2) { + s32 i; + + if (D_800E36E8 != 0) { + D_8012A7F4--; + if (D_8012A7F4 == 0) { + func_8009E9A8(); + D_800E36E8 = 0; + } + } + + for(i = 1; i < 8; i++) { + if ((*D_8012A7E8)[i].unk1E & 0x8000) { + if ((*D_8012A7E8)[i].unk1E & 0x4000) { + func_800C5B58(arg0, arg1, arg2, i); + } else { + func_800C5B58(arg0, 0, 0, i); + } + } + } +} + +#if 1 GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C580C.s") -GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C5AA0.s") +#else + +extern s32 D_800E36EC[9]; // Descending powers of 10; starting from 1000000. + +// sprintf like function, but only for decimal integers (%d). +void func_800C580C(char** outString, s32 number) { + char digit; + s32 i; + s32 hasDigit; // boolean + s32 div; + + // Check for a negative number + if (number < 0) { + **outString = '-'; + number = -number; + (*outString)++; + } + + // Loop through digit places. + for(i = 0; i < 9; i++){ + hasDigit = 0; + digit = '0'; + if (number >= D_800E36EC[i]) { + div = number / D_800E36EC[i]; + hasDigit = 1; + digit = '0' + div; + number -= div * D_800E36EC[i]; + } + if (hasDigit) { + **outString = digit; + (*outString)++; + } + } + + // One's digit place + **outString = '0' + number; + (*outString)++; +} +#endif + +//GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C5AA0.s") +void func_800C5AA0(Gfx **dlist, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + u32 temp_v0 = func_8007A520(); + if (arg3 >= 0 && arg1 < (temp_v0 & 0xFFFF) && arg4 >= 0 && arg2 < (temp_v0 >> 16)) { + if (arg1 < 0) { + arg1 = 0; + } + if (arg2 < 0) { + arg2 = 0; + } + gDPFillRectangle((*dlist)++, arg1, arg2, arg3, arg4); + } +} + GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C5B58.s") -GLOBAL_ASM("asm/non_matchings/unknown_0B8920/func_800C5F60.s") + +void func_800C580C(char**, s32); + +void func_800C5F60(unsigned char *input, char *output, s32 number) { + while (*input != '\0') { + if ('~' == *input) { // ~ is equivalent to a %d. + // output the number as part of the string + func_800C580C(&output, number); + input++; + } else { + *output = *input; + input++; + output++; + } + } + *output = '\0'; // null terminator +} void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt) { @@ -307,8 +639,7 @@ s32 func_800C61DC(s32 arg0, s32 arg1) { s32 gzip_inflate_block(void); u8* func_800C6218(u8* arg0, u8* arg1) { - // The compression header is 5 bytes. Maybe this is part of the decompression routine? - gzip_inflate_input = arg0 + 5; + gzip_inflate_input = arg0 + 5; // The compression header is 5 bytes. gzip_inflate_output = arg1; gzip_num_bits = 0; gzip_bit_buffer = 0;