papermario/ver/us/asm/nonmatchings/code_182B30/func_80259AAC.s
Ethan Roseman e4480c0f59
Some map funcs, 16C8E0 segment rodata migration, 16F740 funcs, etc (#217)
* Misc early code decomp

* Make expected script

* fix m2ctx

* gOverrideFlags & set/unset macros

* update symbol addrs

* Cleanup and PR comments

* oops

* UnkNpcAIFunc16

* UnkNpcAIFunc17

* UnkNpcAIFunc18

* symbol_addrs

* area_mac data/rodata disassembly

* 16C8E0 segment rodata migration

* delete_actor

* 16F740 funcs

* symbol_addrs
2021-03-20 03:17:02 +09:00

224 lines
10 KiB
ArmAsm

.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.section .rodata
glabel D_8029D3E8
.double 0.2
glabel D_8029D3F0
.double 0.4
glabel D_8029D3F8
.double 0.7
.section .text
glabel func_80259AAC
/* 18838C 80259AAC 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 188390 80259AB0 AFB20018 */ sw $s2, 0x18($sp)
/* 188394 80259AB4 0080902D */ daddu $s2, $a0, $zero
/* 188398 80259AB8 AFB10014 */ sw $s1, 0x14($sp)
/* 18839C 80259ABC 00A0882D */ daddu $s1, $a1, $zero
/* 1883A0 80259AC0 AFBF0024 */ sw $ra, 0x24($sp)
/* 1883A4 80259AC4 AFB40020 */ sw $s4, 0x20($sp)
/* 1883A8 80259AC8 AFB3001C */ sw $s3, 0x1c($sp)
/* 1883AC 80259ACC AFB00010 */ sw $s0, 0x10($sp)
/* 1883B0 80259AD0 8E3000C0 */ lw $s0, 0xc0($s1)
/* 1883B4 80259AD4 00C0982D */ daddu $s3, $a2, $zero
/* 1883B8 80259AD8 820206C1 */ lb $v0, 0x6c1($s0)
/* 1883BC 80259ADC 1040002E */ beqz $v0, .L80259B98
/* 1883C0 80259AE0 00E0A02D */ daddu $s4, $a3, $zero
/* 1883C4 80259AE4 16400016 */ bnez $s2, .L80259B40
/* 1883C8 80259AE8 00000000 */ nop
/* 1883CC 80259AEC 0C0B7830 */ jal func_802DE0C0
/* 1883D0 80259AF0 96240088 */ lhu $a0, 0x88($s1)
/* 1883D4 80259AF4 AE0206D0 */ sw $v0, 0x6d0($s0)
/* 1883D8 80259AF8 0040202D */ daddu $a0, $v0, $zero
/* 1883DC 80259AFC A20006CD */ sb $zero, 0x6cd($s0)
/* 1883E0 80259B00 8C830000 */ lw $v1, ($a0)
/* 1883E4 80259B04 2402FFFF */ addiu $v0, $zero, -1
/* 1883E8 80259B08 10620021 */ beq $v1, $v0, .L80259B90
/* 1883EC 80259B0C 0080182D */ daddu $v1, $a0, $zero
/* 1883F0 80259B10 0040202D */ daddu $a0, $v0, $zero
.L80259B14:
/* 1883F4 80259B14 920206CD */ lbu $v0, 0x6cd($s0)
/* 1883F8 80259B18 24420001 */ addiu $v0, $v0, 1
/* 1883FC 80259B1C A20206CD */ sb $v0, 0x6cd($s0)
/* 188400 80259B20 00021600 */ sll $v0, $v0, 0x18
/* 188404 80259B24 00021583 */ sra $v0, $v0, 0x16
/* 188408 80259B28 00431021 */ addu $v0, $v0, $v1
/* 18840C 80259B2C 8C420000 */ lw $v0, ($v0)
/* 188410 80259B30 1444FFF8 */ bne $v0, $a0, .L80259B14
/* 188414 80259B34 00000000 */ nop
/* 188418 80259B38 080966E5 */ j .L80259B94
/* 18841C 80259B3C A20006C2 */ sb $zero, 0x6c2($s0)
.L80259B40:
/* 188420 80259B40 96240088 */ lhu $a0, 0x88($s1)
/* 188424 80259B44 0C0B7A90 */ jal func_802DEA40
/* 188428 80259B48 00000000 */ nop
/* 18842C 80259B4C AE0206D0 */ sw $v0, 0x6d0($s0)
/* 188430 80259B50 0040202D */ daddu $a0, $v0, $zero
/* 188434 80259B54 A20006CD */ sb $zero, 0x6cd($s0)
/* 188438 80259B58 8C830000 */ lw $v1, ($a0)
/* 18843C 80259B5C 2402FFFF */ addiu $v0, $zero, -1
/* 188440 80259B60 1062000B */ beq $v1, $v0, .L80259B90
/* 188444 80259B64 0080182D */ daddu $v1, $a0, $zero
/* 188448 80259B68 0040202D */ daddu $a0, $v0, $zero
.L80259B6C:
/* 18844C 80259B6C 920206CD */ lbu $v0, 0x6cd($s0)
/* 188450 80259B70 24420001 */ addiu $v0, $v0, 1
/* 188454 80259B74 A20206CD */ sb $v0, 0x6cd($s0)
/* 188458 80259B78 00021600 */ sll $v0, $v0, 0x18
/* 18845C 80259B7C 00021583 */ sra $v0, $v0, 0x16
/* 188460 80259B80 00431021 */ addu $v0, $v0, $v1
/* 188464 80259B84 8C420000 */ lw $v0, ($v0)
/* 188468 80259B88 1444FFF8 */ bne $v0, $a0, .L80259B6C
/* 18846C 80259B8C 00000000 */ nop
.L80259B90:
/* 188470 80259B90 A20006C2 */ sb $zero, 0x6c2($s0)
.L80259B94:
/* 188474 80259B94 A20006C1 */ sb $zero, 0x6c1($s0)
.L80259B98:
/* 188478 80259B98 820206CD */ lb $v0, 0x6cd($s0)
/* 18847C 80259B9C 18400067 */ blez $v0, .L80259D3C
/* 188480 80259BA0 0000502D */ daddu $t2, $zero, $zero
/* 188484 80259BA4 3C0B8000 */ lui $t3, 0x8000
/* 188488 80259BA8 0200602D */ daddu $t4, $s0, $zero
/* 18848C 80259BAC 3C01802A */ lui $at, %hi(D_8029D3E8)
/* 188490 80259BB0 D428D3E8 */ ldc1 $f8, %lo(D_8029D3E8)($at)
/* 188494 80259BB4 3C0141E0 */ lui $at, 0x41e0
/* 188498 80259BB8 44811800 */ mtc1 $at, $f3
/* 18849C 80259BBC 44801000 */ mtc1 $zero, $f2
/* 1884A0 80259BC0 3C01802A */ lui $at, %hi(D_8029D3F0)
/* 1884A4 80259BC4 D426D3F0 */ ldc1 $f6, %lo(D_8029D3F0)($at)
/* 1884A8 80259BC8 3C01802A */ lui $at, %hi(D_8029D3F8)
/* 1884AC 80259BCC D424D3F8 */ ldc1 $f4, %lo(D_8029D3F8)($at)
.L80259BD0:
/* 1884B0 80259BD0 8E0206D0 */ lw $v0, 0x6d0($s0)
/* 1884B4 80259BD4 000A1880 */ sll $v1, $t2, 2
/* 1884B8 80259BD8 00621821 */ addu $v1, $v1, $v0
/* 1884BC 80259BDC 000A1140 */ sll $v0, $t2, 5
/* 1884C0 80259BE0 8C670000 */ lw $a3, ($v1)
/* 1884C4 80259BE4 02024021 */ addu $t0, $s0, $v0
/* 1884C8 80259BE8 10E0004F */ beqz $a3, .L80259D28
/* 1884CC 80259BEC AD8806D4 */ sw $t0, 0x6d4($t4)
/* 1884D0 80259BF0 0000482D */ daddu $t1, $zero, $zero
.L80259BF4:
/* 1884D4 80259BF4 94E30000 */ lhu $v1, ($a3)
/* 1884D8 80259BF8 000312C2 */ srl $v0, $v1, 0xb
/* 1884DC 80259BFC 44820000 */ mtc1 $v0, $f0
/* 1884E0 80259C00 00000000 */ nop
/* 1884E4 80259C04 46800021 */ cvt.d.w $f0, $f0
/* 1884E8 80259C08 46280002 */ mul.d $f0, $f0, $f8
/* 1884EC 80259C0C 00000000 */ nop
/* 1884F0 80259C10 90E40001 */ lbu $a0, 1($a3)
/* 1884F4 80259C14 24E70002 */ addiu $a3, $a3, 2
/* 1884F8 80259C18 00031182 */ srl $v0, $v1, 6
/* 1884FC 80259C1C 3042001F */ andi $v0, $v0, 0x1f
/* 188500 80259C20 00031842 */ srl $v1, $v1, 1
/* 188504 80259C24 3066001F */ andi $a2, $v1, 0x1f
/* 188508 80259C28 4620103E */ c.le.d $f2, $f0
/* 18850C 80259C2C 00000000 */ nop
/* 188510 80259C30 45010005 */ bc1t .L80259C48
/* 188514 80259C34 30840001 */ andi $a0, $a0, 1
/* 188518 80259C38 4620028D */ trunc.w.d $f10, $f0
/* 18851C 80259C3C 44035000 */ mfc1 $v1, $f10
/* 188520 80259C40 08096718 */ j .L80259C60
/* 188524 80259C44 304200FF */ andi $v0, $v0, 0xff
.L80259C48:
/* 188528 80259C48 46220001 */ sub.d $f0, $f0, $f2
/* 18852C 80259C4C 4620028D */ trunc.w.d $f10, $f0
/* 188530 80259C50 44035000 */ mfc1 $v1, $f10
/* 188534 80259C54 00000000 */ nop
/* 188538 80259C58 006B1825 */ or $v1, $v1, $t3
/* 18853C 80259C5C 304200FF */ andi $v0, $v0, 0xff
.L80259C60:
/* 188540 80259C60 44820000 */ mtc1 $v0, $f0
/* 188544 80259C64 00000000 */ nop
/* 188548 80259C68 46800021 */ cvt.d.w $f0, $f0
/* 18854C 80259C6C 46260002 */ mul.d $f0, $f0, $f6
/* 188550 80259C70 00000000 */ nop
/* 188554 80259C74 4620103E */ c.le.d $f2, $f0
/* 188558 80259C78 00000000 */ nop
/* 18855C 80259C7C 45030005 */ bc1tl .L80259C94
/* 188560 80259C80 46220001 */ sub.d $f0, $f0, $f2
/* 188564 80259C84 4620028D */ trunc.w.d $f10, $f0
/* 188568 80259C88 44055000 */ mfc1 $a1, $f10
/* 18856C 80259C8C 0809672A */ j .L80259CA8
/* 188570 80259C90 30C200FF */ andi $v0, $a2, 0xff
.L80259C94:
/* 188574 80259C94 4620028D */ trunc.w.d $f10, $f0
/* 188578 80259C98 44055000 */ mfc1 $a1, $f10
/* 18857C 80259C9C 00000000 */ nop
/* 188580 80259CA0 00AB2825 */ or $a1, $a1, $t3
/* 188584 80259CA4 30C200FF */ andi $v0, $a2, 0xff
.L80259CA8:
/* 188588 80259CA8 44820000 */ mtc1 $v0, $f0
/* 18858C 80259CAC 00000000 */ nop
/* 188590 80259CB0 46800021 */ cvt.d.w $f0, $f0
/* 188594 80259CB4 46240002 */ mul.d $f0, $f0, $f4
/* 188598 80259CB8 00000000 */ nop
/* 18859C 80259CBC 4620103E */ c.le.d $f2, $f0
/* 1885A0 80259CC0 00000000 */ nop
/* 1885A4 80259CC4 45010005 */ bc1t .L80259CDC
/* 1885A8 80259CC8 00A0102D */ daddu $v0, $a1, $zero
/* 1885AC 80259CCC 4620028D */ trunc.w.d $f10, $f0
/* 1885B0 80259CD0 44055000 */ mfc1 $a1, $f10
/* 1885B4 80259CD4 0809673D */ j .L80259CF4
/* 1885B8 80259CD8 306300FF */ andi $v1, $v1, 0xff
.L80259CDC:
/* 1885BC 80259CDC 46220001 */ sub.d $f0, $f0, $f2
/* 1885C0 80259CE0 4620028D */ trunc.w.d $f10, $f0
/* 1885C4 80259CE4 44055000 */ mfc1 $a1, $f10
/* 1885C8 80259CE8 00000000 */ nop
/* 1885CC 80259CEC 00AB2825 */ or $a1, $a1, $t3
/* 1885D0 80259CF0 306300FF */ andi $v1, $v1, 0xff
.L80259CF4:
/* 1885D4 80259CF4 00031AC0 */ sll $v1, $v1, 0xb
/* 1885D8 80259CF8 304200FF */ andi $v0, $v0, 0xff
/* 1885DC 80259CFC 00021180 */ sll $v0, $v0, 6
/* 1885E0 80259D00 00621825 */ or $v1, $v1, $v0
/* 1885E4 80259D04 30A200FF */ andi $v0, $a1, 0xff
/* 1885E8 80259D08 00021040 */ sll $v0, $v0, 1
/* 1885EC 80259D0C 00621825 */ or $v1, $v1, $v0
/* 1885F0 80259D10 00831825 */ or $v1, $a0, $v1
/* 1885F4 80259D14 A5030000 */ sh $v1, ($t0)
/* 1885F8 80259D18 25290001 */ addiu $t1, $t1, 1
/* 1885FC 80259D1C 29220010 */ slti $v0, $t1, 0x10
/* 188600 80259D20 1440FFB4 */ bnez $v0, .L80259BF4
/* 188604 80259D24 25080002 */ addiu $t0, $t0, 2
.L80259D28:
/* 188608 80259D28 820206CD */ lb $v0, 0x6cd($s0)
/* 18860C 80259D2C 254A0001 */ addiu $t2, $t2, 1
/* 188610 80259D30 0142102A */ slt $v0, $t2, $v0
/* 188614 80259D34 1440FFA6 */ bnez $v0, .L80259BD0
/* 188618 80259D38 258C0004 */ addiu $t4, $t4, 4
.L80259D3C:
/* 18861C 80259D3C 820306C2 */ lb $v1, 0x6c2($s0)
/* 188620 80259D40 28620002 */ slti $v0, $v1, 2
/* 188624 80259D44 1040000D */ beqz $v0, .L80259D7C
/* 188628 80259D48 00000000 */ nop
/* 18862C 80259D4C 0460000B */ bltz $v1, .L80259D7C
/* 188630 80259D50 00000000 */ nop
/* 188634 80259D54 16400006 */ bnez $s2, .L80259D70
/* 188638 80259D58 0220202D */ daddu $a0, $s1, $zero
/* 18863C 80259D5C 0260282D */ daddu $a1, $s3, $zero
/* 188640 80259D60 0C096657 */ jal func_8025995C
/* 188644 80259D64 0280302D */ daddu $a2, $s4, $zero
/* 188648 80259D68 0809675F */ j .L80259D7C
/* 18864C 80259D6C 00000000 */ nop
.L80259D70:
/* 188650 80259D70 0260282D */ daddu $a1, $s3, $zero
/* 188654 80259D74 0C0965B0 */ jal func_802596C0
/* 188658 80259D78 0280302D */ daddu $a2, $s4, $zero
.L80259D7C:
/* 18865C 80259D7C 8FBF0024 */ lw $ra, 0x24($sp)
/* 188660 80259D80 8FB40020 */ lw $s4, 0x20($sp)
/* 188664 80259D84 8FB3001C */ lw $s3, 0x1c($sp)
/* 188668 80259D88 8FB20018 */ lw $s2, 0x18($sp)
/* 18866C 80259D8C 8FB10014 */ lw $s1, 0x14($sp)
/* 188670 80259D90 8FB00010 */ lw $s0, 0x10($sp)
/* 188674 80259D94 03E00008 */ jr $ra
/* 188678 80259D98 27BD0028 */ addiu $sp, $sp, 0x28