papermario/ver/us/asm/nonmatchings/os/44b40_len_a90/osRepairPackId.s
Ethan Roseman 3315d6010f
Splat refactor (#257)
* all non-world rodata migrated

* data disasm

* kinda working

* updated yaml

* bloop

* linker header

* configure 2.0

* bin

* mass rename to remove code_

* pause rename

* battle partner stuff

* whew

* more renames

* more renames

* more renaming

* it builds!

* updates

* remove main prefix

* one more thing

* crc, yay0

* .data, .rodata, .bss

* img

* dead_atan2

* it buildsgit add -A

* split battle/partner/6FAD10

* rm &s on sleepy_sheep syms

* sha1sum ninja rule description

* OK but commented out PaperMarioMapFS and PaperMarioNpcSprites

* uncomment

* fix mapfs

* match func_8003CFB4

* .

* clean up and name npc_iter_no_op

* npc.c

* enable cc warnings

* name npc_find_near

* use singular options.asset_path

* smores

* cc_dsl only when needed

* kinda fix configure for splat refactor2

* ok!

* new msg format

* remove old msg format docs

* slight bug fixes, splat adjustment

* git subrepo pull (merge) --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "cfc140bb76"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "cfc140bb76"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* git subrepo pull (merge) --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "85349befcd"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "85349befcd"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* Update symbol addrs

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "a44631e194"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "a44631e194"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

Co-authored-by: Alex Bates <hi@imalex.xyz>
2021-04-13 16:47:52 +09:00

206 lines
10 KiB
ArmAsm

.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel osRepairPackId
/* 44BB8 800697B8 27BDFF80 */ addiu $sp, $sp, -0x80
/* 44BBC 800697BC AFB10064 */ sw $s1, 0x64($sp)
/* 44BC0 800697C0 00808821 */ addu $s1, $a0, $zero
/* 44BC4 800697C4 AFB50074 */ sw $s5, 0x74($sp)
/* 44BC8 800697C8 00A0A821 */ addu $s5, $a1, $zero
/* 44BCC 800697CC AFB3006C */ sw $s3, 0x6c($sp)
/* 44BD0 800697D0 00C09821 */ addu $s3, $a2, $zero
/* 44BD4 800697D4 2402FFFF */ addiu $v0, $zero, -1
/* 44BD8 800697D8 AFBF007C */ sw $ra, 0x7c($sp)
/* 44BDC 800697DC AFB60078 */ sw $s6, 0x78($sp)
/* 44BE0 800697E0 AFB40070 */ sw $s4, 0x70($sp)
/* 44BE4 800697E4 AFB20068 */ sw $s2, 0x68($sp)
/* 44BE8 800697E8 AFB00060 */ sw $s0, 0x60($sp)
/* 44BEC 800697EC 0C019680 */ jal osGetCount
/* 44BF0 800697F0 AE620000 */ sw $v0, ($s3)
/* 44BF4 800697F4 AE620004 */ sw $v0, 4($s3)
/* 44BF8 800697F8 8EA20008 */ lw $v0, 8($s5)
/* 44BFC 800697FC 8EA3000C */ lw $v1, 0xc($s5)
/* 44C00 80069800 AE620008 */ sw $v0, 8($s3)
/* 44C04 80069804 AE63000C */ sw $v1, 0xc($s3)
/* 44C08 80069808 8EA20010 */ lw $v0, 0x10($s5)
/* 44C0C 8006980C 8EA30014 */ lw $v1, 0x14($s5)
/* 44C10 80069810 AE620010 */ sw $v0, 0x10($s3)
/* 44C14 80069814 AE630014 */ sw $v1, 0x14($s3)
/* 44C18 80069818 92220065 */ lbu $v0, 0x65($s1)
/* 44C1C 8006981C 10400006 */ beqz $v0, .L80069838
/* 44C20 80069820 00009021 */ addu $s2, $zero, $zero
/* 44C24 80069824 02202021 */ addu $a0, $s1, $zero
/* 44C28 80069828 0C01A5B4 */ jal osPfsSelectBank
/* 44C2C 8006982C 00002821 */ addu $a1, $zero, $zero
/* 44C30 80069830 14400092 */ bnez $v0, .L80069A7C
/* 44C34 80069834 00000000 */ nop
.L80069838:
/* 44C38 80069838 27B40018 */ addiu $s4, $sp, 0x18
/* 44C3C 8006983C 27B60038 */ addiu $s6, $sp, 0x38
/* 44C40 80069840 02202021 */ addu $a0, $s1, $zero
.L80069844:
/* 44C44 80069844 0C01A5B4 */ jal osPfsSelectBank
/* 44C48 80069848 324500FF */ andi $a1, $s2, 0xff
/* 44C4C 8006984C 1440008B */ bnez $v0, .L80069A7C
/* 44C50 80069850 00003021 */ addu $a2, $zero, $zero
/* 44C54 80069854 8E240004 */ lw $a0, 4($s1)
/* 44C58 80069858 8E250008 */ lw $a1, 8($s1)
/* 44C5C 8006985C 0C01A874 */ jal osContRamRead
/* 44C60 80069860 27A70018 */ addiu $a3, $sp, 0x18
/* 44C64 80069864 14400085 */ bnez $v0, .L80069A7C
/* 44C68 80069868 26830001 */ addiu $v1, $s4, 1
/* 44C6C 8006986C 36420080 */ ori $v0, $s2, 0x80
/* 44C70 80069870 A3A20018 */ sb $v0, 0x18($sp)
/* 44C74 80069874 26840020 */ addiu $a0, $s4, 0x20
.L80069878:
/* 44C78 80069878 90620000 */ lbu $v0, ($v1)
/* 44C7C 8006987C 00021027 */ nor $v0, $zero, $v0
/* 44C80 80069880 A0620000 */ sb $v0, ($v1)
/* 44C84 80069884 24630001 */ addiu $v1, $v1, 1
/* 44C88 80069888 0064102A */ slt $v0, $v1, $a0
/* 44C8C 8006988C 1440FFFA */ bnez $v0, .L80069878
/* 44C90 80069890 00003021 */ addu $a2, $zero, $zero
/* 44C94 80069894 AFA00010 */ sw $zero, 0x10($sp)
/* 44C98 80069898 8E240004 */ lw $a0, 4($s1)
/* 44C9C 8006989C 8E250008 */ lw $a1, 8($s1)
/* 44CA0 800698A0 0C01A8F0 */ jal osContRamWrite
/* 44CA4 800698A4 27A70018 */ addiu $a3, $sp, 0x18
/* 44CA8 800698A8 14400074 */ bnez $v0, .L80069A7C
/* 44CAC 800698AC 00003021 */ addu $a2, $zero, $zero
/* 44CB0 800698B0 8E240004 */ lw $a0, 4($s1)
/* 44CB4 800698B4 8E250008 */ lw $a1, 8($s1)
/* 44CB8 800698B8 0C01A874 */ jal osContRamRead
/* 44CBC 800698BC 27A70038 */ addiu $a3, $sp, 0x38
/* 44CC0 800698C0 1440006E */ bnez $v0, .L80069A7C
/* 44CC4 800698C4 00008021 */ addu $s0, $zero, $zero
/* 44CC8 800698C8 02802821 */ addu $a1, $s4, $zero
/* 44CCC 800698CC 02C02021 */ addu $a0, $s6, $zero
.L800698D0:
/* 44CD0 800698D0 90830000 */ lbu $v1, ($a0)
/* 44CD4 800698D4 90A20000 */ lbu $v0, ($a1)
/* 44CD8 800698D8 14620007 */ bne $v1, $v0, .L800698F8
/* 44CDC 800698DC 24020020 */ addiu $v0, $zero, 0x20
/* 44CE0 800698E0 24A50001 */ addiu $a1, $a1, 1
/* 44CE4 800698E4 26100001 */ addiu $s0, $s0, 1
/* 44CE8 800698E8 2A020020 */ slti $v0, $s0, 0x20
/* 44CEC 800698EC 1440FFF8 */ bnez $v0, .L800698D0
/* 44CF0 800698F0 24840001 */ addiu $a0, $a0, 1
/* 44CF4 800698F4 24020020 */ addiu $v0, $zero, 0x20
.L800698F8:
/* 44CF8 800698F8 16020015 */ bne $s0, $v0, .L80069950
/* 44CFC 800698FC 00000000 */ nop
/* 44D00 80069900 1A40000F */ blez $s2, .L80069940
/* 44D04 80069904 02202021 */ addu $a0, $s1, $zero
/* 44D08 80069908 0C01A5B4 */ jal osPfsSelectBank
/* 44D0C 8006990C 00002821 */ addu $a1, $zero, $zero
/* 44D10 80069910 1440005A */ bnez $v0, .L80069A7C
/* 44D14 80069914 00003021 */ addu $a2, $zero, $zero
/* 44D18 80069918 8E240004 */ lw $a0, 4($s1)
/* 44D1C 8006991C 8E250008 */ lw $a1, 8($s1)
/* 44D20 80069920 0C01A874 */ jal osContRamRead
/* 44D24 80069924 02803821 */ addu $a3, $s4, $zero
/* 44D28 80069928 14400054 */ bnez $v0, .L80069A7C
/* 44D2C 8006992C 00000000 */ nop
/* 44D30 80069930 93A30018 */ lbu $v1, 0x18($sp)
/* 44D34 80069934 24020080 */ addiu $v0, $zero, 0x80
/* 44D38 80069938 14620005 */ bne $v1, $v0, .L80069950
/* 44D3C 8006993C 00000000 */ nop
.L80069940:
/* 44D40 80069940 26520001 */ addiu $s2, $s2, 1
/* 44D44 80069944 2A42003E */ slti $v0, $s2, 0x3e
/* 44D48 80069948 1440FFBE */ bnez $v0, .L80069844
/* 44D4C 8006994C 02202021 */ addu $a0, $s1, $zero
.L80069950:
/* 44D50 80069950 92220065 */ lbu $v0, 0x65($s1)
/* 44D54 80069954 10400005 */ beqz $v0, .L8006996C
/* 44D58 80069958 02202021 */ addu $a0, $s1, $zero
/* 44D5C 8006995C 0C01A5B4 */ jal osPfsSelectBank
/* 44D60 80069960 00002821 */ addu $a1, $zero, $zero
/* 44D64 80069964 14400045 */ bnez $v0, .L80069A7C
/* 44D68 80069968 00000000 */ nop
.L8006996C:
/* 44D6C 8006996C 96A20018 */ lhu $v0, 0x18($s5)
/* 44D70 80069970 2666001E */ addiu $a2, $s3, 0x1e
/* 44D74 80069974 02602021 */ addu $a0, $s3, $zero
/* 44D78 80069978 0012182A */ slt $v1, $zero, $s2
/* 44D7C 8006997C A272001A */ sb $s2, 0x1a($s3)
/* 44D80 80069980 3042FFFE */ andi $v0, $v0, 0xfffe
/* 44D84 80069984 00621825 */ or $v1, $v1, $v0
/* 44D88 80069988 A6630018 */ sh $v1, 0x18($s3)
/* 44D8C 8006998C 92A2001B */ lbu $v0, 0x1b($s5)
/* 44D90 80069990 2665001C */ addiu $a1, $s3, 0x1c
/* 44D94 80069994 00A03821 */ addu $a3, $a1, $zero
/* 44D98 80069998 A660001E */ sh $zero, 0x1e($s3)
/* 44D9C 8006999C A660001C */ sh $zero, 0x1c($s3)
/* 44DA0 800699A0 A262001B */ sb $v0, 0x1b($s3)
.L800699A4:
/* 44DA4 800699A4 94830000 */ lhu $v1, ($a0)
/* 44DA8 800699A8 94A20000 */ lhu $v0, ($a1)
/* 44DAC 800699AC 00431021 */ addu $v0, $v0, $v1
/* 44DB0 800699B0 A4A20000 */ sh $v0, ($a1)
/* 44DB4 800699B4 94C20000 */ lhu $v0, ($a2)
/* 44DB8 800699B8 24840002 */ addiu $a0, $a0, 2
/* 44DBC 800699BC 00031827 */ nor $v1, $zero, $v1
/* 44DC0 800699C0 00431021 */ addu $v0, $v0, $v1
/* 44DC4 800699C4 A4C20000 */ sh $v0, ($a2)
/* 44DC8 800699C8 0087102B */ sltu $v0, $a0, $a3
/* 44DCC 800699CC 1440FFF5 */ bnez $v0, .L800699A4
/* 44DD0 800699D0 00008021 */ addu $s0, $zero, $zero
/* 44DD4 800699D4 24140001 */ addiu $s4, $zero, 1
/* 44DD8 800699D8 27B20018 */ addiu $s2, $sp, 0x18
/* 44DDC 800699DC 24020001 */ addiu $v0, $zero, 1
/* 44DE0 800699E0 A7A20058 */ sh $v0, 0x58($sp)
/* 44DE4 800699E4 24020003 */ addiu $v0, $zero, 3
/* 44DE8 800699E8 A7A2005A */ sh $v0, 0x5a($sp)
/* 44DEC 800699EC 24020004 */ addiu $v0, $zero, 4
/* 44DF0 800699F0 A7A2005C */ sh $v0, 0x5c($sp)
/* 44DF4 800699F4 24020006 */ addiu $v0, $zero, 6
/* 44DF8 800699F8 A7A2005E */ sh $v0, 0x5e($sp)
.L800699FC:
/* 44DFC 800699FC 96460040 */ lhu $a2, 0x40($s2)
/* 44E00 80069A00 AFB40010 */ sw $s4, 0x10($sp)
/* 44E04 80069A04 8E240004 */ lw $a0, 4($s1)
/* 44E08 80069A08 8E250008 */ lw $a1, 8($s1)
/* 44E0C 80069A0C 0C01A8F0 */ jal osContRamWrite
/* 44E10 80069A10 02603821 */ addu $a3, $s3, $zero
/* 44E14 80069A14 14400019 */ bnez $v0, .L80069A7C
/* 44E18 80069A18 26100001 */ addiu $s0, $s0, 1
/* 44E1C 80069A1C 2A020004 */ slti $v0, $s0, 4
/* 44E20 80069A20 1440FFF6 */ bnez $v0, .L800699FC
/* 44E24 80069A24 26520002 */ addiu $s2, $s2, 2
/* 44E28 80069A28 8E240004 */ lw $a0, 4($s1)
/* 44E2C 80069A2C 8E250008 */ lw $a1, 8($s1)
/* 44E30 80069A30 24060001 */ addiu $a2, $zero, 1
/* 44E34 80069A34 0C01A874 */ jal osContRamRead
/* 44E38 80069A38 27A70018 */ addiu $a3, $sp, 0x18
/* 44E3C 80069A3C 10400005 */ beqz $v0, .L80069A54
/* 44E40 80069A40 02603021 */ addu $a2, $s3, $zero
/* 44E44 80069A44 0801A69F */ j .L80069A7C
/* 44E48 80069A48 00000000 */ nop
.L80069A4C:
/* 44E4C 80069A4C 0801A69F */ j .L80069A7C
/* 44E50 80069A50 2402000B */ addiu $v0, $zero, 0xb
.L80069A54:
/* 44E54 80069A54 27A40018 */ addiu $a0, $sp, 0x18
/* 44E58 80069A58 24C50020 */ addiu $a1, $a2, 0x20
.L80069A5C:
/* 44E5C 80069A5C 90830000 */ lbu $v1, ($a0)
/* 44E60 80069A60 90C20000 */ lbu $v0, ($a2)
/* 44E64 80069A64 1462FFF9 */ bne $v1, $v0, .L80069A4C
/* 44E68 80069A68 24C60001 */ addiu $a2, $a2, 1
/* 44E6C 80069A6C 00C5102A */ slt $v0, $a2, $a1
/* 44E70 80069A70 1440FFFA */ bnez $v0, .L80069A5C
/* 44E74 80069A74 24840001 */ addiu $a0, $a0, 1
/* 44E78 80069A78 00001021 */ addu $v0, $zero, $zero
.L80069A7C:
/* 44E7C 80069A7C 8FBF007C */ lw $ra, 0x7c($sp)
/* 44E80 80069A80 8FB60078 */ lw $s6, 0x78($sp)
/* 44E84 80069A84 8FB50074 */ lw $s5, 0x74($sp)
/* 44E88 80069A88 8FB40070 */ lw $s4, 0x70($sp)
/* 44E8C 80069A8C 8FB3006C */ lw $s3, 0x6c($sp)
/* 44E90 80069A90 8FB20068 */ lw $s2, 0x68($sp)
/* 44E94 80069A94 8FB10064 */ lw $s1, 0x64($sp)
/* 44E98 80069A98 8FB00060 */ lw $s0, 0x60($sp)
/* 44E9C 80069A9C 03E00008 */ jr $ra
/* 44EA0 80069AA0 27BD0080 */ addiu $sp, $sp, 0x80