donut-decomp/asm/cx/CXSecureUncompression.s
2022-10-17 09:19:59 +01:00

183 lines
8 KiB
ArmAsm

.include "macros.inc"
.section .text, "ax" # 0x80006A00 - 0x80406260 ; 0x003FF860
.global CXSecureUncompressLZ
CXSecureUncompressLZ:
/* 800470D0 00042F10 88 03 00 00 */ lbz r0, 0x0(r3)
/* 800470D4 00042F14 7C A6 2B 78 */ mr r6, r5
/* 800470D8 00042F18 81 03 00 00 */ lwz r8, 0x0(r3)
/* 800470DC 00042F1C 54 07 07 3E */ clrlwi r7, r0, 28
/* 800470E0 00042F20 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 800470E4 00042F24 55 09 46 3E */ srwi r9, r8, 24
/* 800470E8 00042F28 51 09 C4 2E */ rlwimi r9, r8, 24, 16, 23
/* 800470EC 00042F2C 7C 07 00 D0 */ neg r0, r7
/* 800470F0 00042F30 51 09 42 1E */ rlwimi r9, r8, 8, 8, 15
/* 800470F4 00042F34 93 E1 00 0C */ stw r31, 0xc(r1)
/* 800470F8 00042F38 51 09 C0 0E */ rlwimi r9, r8, 24, 0, 7
/* 800470FC 00042F3C 7C 07 3B 78 */ or r7, r0, r7
/* 80047100 00042F40 55 20 06 36 */ rlwinm r0, r9, 0, 24, 27
/* 80047104 00042F44 2C 00 00 10 */ cmpwi r0, 0x10
/* 80047108 00042F48 55 2A C2 3E */ srwi r10, r9, 8
/* 8004710C 00042F4C 55 20 06 3E */ clrlwi r0, r9, 24
/* 80047110 00042F50 54 E8 0F FE */ srwi r8, r7, 31
/* 80047114 00042F54 41 82 00 0C */ beq lbl_80047120
/* 80047118 00042F58 38 60 FF FF */ li r3, -0x1
/* 8004711C 00042F5C 48 00 01 C8 */ b lbl_800472E4
.global lbl_80047120
lbl_80047120:
/* 80047120 00042F60 54 00 07 3F */ clrlwi. r0, r0, 28
/* 80047124 00042F64 41 82 00 14 */ beq lbl_80047138
/* 80047128 00042F68 2C 00 00 01 */ cmpwi r0, 0x1
/* 8004712C 00042F6C 41 82 00 0C */ beq lbl_80047138
/* 80047130 00042F70 38 60 FF FF */ li r3, -0x1
/* 80047134 00042F74 48 00 01 B0 */ b lbl_800472E4
.global lbl_80047138
lbl_80047138:
/* 80047138 00042F78 28 04 00 04 */ cmplwi r4, 0x4
/* 8004713C 00042F7C 41 81 00 0C */ bgt lbl_80047148
/* 80047140 00042F80 38 60 FF FE */ li r3, -0x2
/* 80047144 00042F84 48 00 01 A0 */ b lbl_800472E4
.global lbl_80047148
lbl_80047148:
/* 80047148 00042F88 2C 0A 00 00 */ cmpwi r10, 0x0
/* 8004714C 00042F8C 39 23 00 04 */ addi r9, r3, 0x4
/* 80047150 00042F90 39 64 FF FC */ addi r11, r4, -0x4
/* 80047154 00042F94 40 82 00 34 */ bne lbl_80047188
/* 80047158 00042F98 2C 0B 00 04 */ cmpwi r11, 0x4
/* 8004715C 00042F9C 40 80 00 0C */ bge lbl_80047168
/* 80047160 00042FA0 38 60 FF FE */ li r3, -0x2
/* 80047164 00042FA4 48 00 01 80 */ b lbl_800472E4
.global lbl_80047168
lbl_80047168:
/* 80047168 00042FA8 80 89 00 00 */ lwz r4, 0x0(r9)
/* 8004716C 00042FAC 39 29 00 04 */ addi r9, r9, 0x4
/* 80047170 00042FB0 39 6B FF FC */ addi r11, r11, -0x4
/* 80047174 00042FB4 54 83 42 1E */ rlwinm r3, r4, 8, 8, 15
/* 80047178 00042FB8 54 80 C4 2E */ rlwinm r0, r4, 24, 16, 23
/* 8004717C 00042FBC 50 83 C0 0E */ rlwimi r3, r4, 24, 0, 7
/* 80047180 00042FC0 50 80 46 3E */ rlwimi r0, r4, 8, 24, 31
/* 80047184 00042FC4 7C 6A 03 78 */ or r10, r3, r0
.global lbl_80047188
lbl_80047188:
/* 80047188 00042FC8 38 00 00 08 */ li r0, 0x8
/* 8004718C 00042FCC 48 00 01 34 */ b lbl_800472C0
.global lbl_80047190
lbl_80047190:
/* 80047190 00042FD0 35 6B FF FF */ addic. r11, r11, -0x1
/* 80047194 00042FD4 89 89 00 00 */ lbz r12, 0x0(r9)
/* 80047198 00042FD8 39 29 00 01 */ addi r9, r9, 0x1
/* 8004719C 00042FDC 40 80 00 0C */ bge lbl_800471A8
/* 800471A0 00042FE0 38 60 FF FE */ li r3, -0x2
/* 800471A4 00042FE4 48 00 01 40 */ b lbl_800472E4
.global lbl_800471A8
lbl_800471A8:
/* 800471A8 00042FE8 7C 09 03 A6 */ mtctr r0
/* 800471AC 00042FEC 60 00 00 00 */ nop
.global lbl_800471B0
lbl_800471B0:
/* 800471B0 00042FF0 55 83 06 31 */ rlwinm. r3, r12, 0, 24, 24
/* 800471B4 00042FF4 40 82 00 2C */ bne lbl_800471E0
/* 800471B8 00042FF8 88 69 00 00 */ lbz r3, 0x0(r9)
/* 800471BC 00042FFC 35 6B FF FF */ addic. r11, r11, -0x1
/* 800471C0 00043000 98 66 00 00 */ stb r3, 0x0(r6)
/* 800471C4 00043004 39 29 00 01 */ addi r9, r9, 0x1
/* 800471C8 00043008 38 C6 00 01 */ addi r6, r6, 0x1
/* 800471CC 0004300C 40 80 00 0C */ bge lbl_800471D8
/* 800471D0 00043010 38 60 FF FE */ li r3, -0x2
/* 800471D4 00043014 48 00 01 10 */ b lbl_800472E4
.global lbl_800471D8
lbl_800471D8:
/* 800471D8 00043018 39 4A FF FF */ addi r10, r10, -0x1
/* 800471DC 0004301C 48 00 00 D4 */ b lbl_800472B0
.global lbl_800471E0
lbl_800471E0:
/* 800471E0 00043020 88 E9 00 00 */ lbz r7, 0x0(r9)
/* 800471E4 00043024 2C 08 00 00 */ cmpwi r8, 0x0
/* 800471E8 00043028 7C FF 26 70 */ srawi r31, r7, 4
/* 800471EC 0004302C 40 82 00 0C */ bne lbl_800471F8
/* 800471F0 00043030 3B FF 00 03 */ addi r31, r31, 0x3
/* 800471F4 00043034 48 00 00 54 */ b lbl_80047248
.global lbl_800471F8
lbl_800471F8:
/* 800471F8 00043038 2C 1F 00 01 */ cmpwi r31, 0x1
/* 800471FC 0004303C 40 82 00 28 */ bne lbl_80047224
/* 80047200 00043040 88 89 00 01 */ lbz r4, 0x1(r9)
/* 80047204 00043044 39 6B FF FE */ addi r11, r11, -0x2
/* 80047208 00043048 8C 69 00 02 */ lbzu r3, 0x2(r9)
/* 8004720C 0004304C 54 9F 20 36 */ slwi r31, r4, 4
/* 80047210 00043050 50 FF 64 26 */ rlwimi r31, r7, 12, 16, 19
/* 80047214 00043054 7C 63 26 70 */ srawi r3, r3, 4
/* 80047218 00043058 7F FF 1B 78 */ or r31, r31, r3
/* 8004721C 0004305C 3B FF 01 11 */ addi r31, r31, 0x111
/* 80047220 00043060 48 00 00 28 */ b lbl_80047248
.global lbl_80047224
lbl_80047224:
/* 80047224 00043064 2C 1F 00 00 */ cmpwi r31, 0x0
/* 80047228 00043068 40 82 00 1C */ bne lbl_80047244
/* 8004722C 0004306C 8C 69 00 01 */ lbzu r3, 0x1(r9)
/* 80047230 00043070 39 6B FF FF */ addi r11, r11, -0x1
/* 80047234 00043074 7C 7F 26 70 */ srawi r31, r3, 4
/* 80047238 00043078 50 FF 26 36 */ rlwimi r31, r7, 4, 24, 27
/* 8004723C 0004307C 3B FF 00 11 */ addi r31, r31, 0x11
/* 80047240 00043080 48 00 00 08 */ b lbl_80047248
.global lbl_80047244
lbl_80047244:
/* 80047244 00043084 3B FF 00 01 */ addi r31, r31, 0x1
.global lbl_80047248
lbl_80047248:
/* 80047248 00043088 88 89 00 00 */ lbz r4, 0x0(r9)
/* 8004724C 0004308C 35 6B FF FE */ addic. r11, r11, -0x2
/* 80047250 00043090 88 69 00 01 */ lbz r3, 0x1(r9)
/* 80047254 00043094 39 29 00 02 */ addi r9, r9, 0x2
/* 80047258 00043098 50 83 45 2E */ rlwimi r3, r4, 8, 20, 23
/* 8004725C 0004309C 38 83 00 01 */ addi r4, r3, 0x1
/* 80047260 000430A0 40 80 00 0C */ bge lbl_8004726C
/* 80047264 000430A4 38 60 FF FE */ li r3, -0x2
/* 80047268 000430A8 48 00 00 7C */ b lbl_800472E4
.global lbl_8004726C
lbl_8004726C:
/* 8004726C 000430AC 7C 1F 50 40 */ cmplw r31, r10
/* 80047270 000430B0 40 81 00 0C */ ble lbl_8004727C
/* 80047274 000430B4 38 60 FF FC */ li r3, -0x4
/* 80047278 000430B8 48 00 00 6C */ b lbl_800472E4
.global lbl_8004727C
lbl_8004727C:
/* 8004727C 000430BC 7C 64 30 50 */ subf r3, r4, r6
/* 80047280 000430C0 7C 03 28 40 */ cmplw r3, r5
/* 80047284 000430C4 40 80 00 0C */ bge lbl_80047290
/* 80047288 000430C8 38 60 FF FC */ li r3, -0x4
/* 8004728C 000430CC 48 00 00 58 */ b lbl_800472E4
.global lbl_80047290
lbl_80047290:
/* 80047290 000430D0 7D 5F 50 50 */ subf r10, r31, r10
/* 80047294 000430D4 60 00 00 00 */ nop
.global lbl_80047298
lbl_80047298:
/* 80047298 000430D8 7C 64 30 50 */ subf r3, r4, r6
/* 8004729C 000430DC 37 FF FF FF */ addic. r31, r31, -0x1
/* 800472A0 000430E0 88 63 00 00 */ lbz r3, 0x0(r3)
/* 800472A4 000430E4 98 66 00 00 */ stb r3, 0x0(r6)
/* 800472A8 000430E8 38 C6 00 01 */ addi r6, r6, 0x1
/* 800472AC 000430EC 41 81 FF EC */ bgt lbl_80047298
.global lbl_800472B0
lbl_800472B0:
/* 800472B0 000430F0 2C 0A 00 00 */ cmpwi r10, 0x0
/* 800472B4 000430F4 41 82 00 0C */ beq lbl_800472C0
/* 800472B8 000430F8 55 8C 08 3C */ slwi r12, r12, 1
/* 800472BC 000430FC 42 00 FE F4 */ bdnz lbl_800471B0
.global lbl_800472C0
lbl_800472C0:
/* 800472C0 00043100 2C 0A 00 00 */ cmpwi r10, 0x0
/* 800472C4 00043104 40 82 FE CC */ bne lbl_80047190
/* 800472C8 00043108 38 00 00 20 */ li r0, 0x20
/* 800472CC 0004310C 55 63 0F FE */ srwi r3, r11, 31
/* 800472D0 00043110 7C 0B 00 10 */ subfc r0, r11, r0
/* 800472D4 00043114 38 00 00 00 */ li r0, 0x0
/* 800472D8 00043118 7C 60 19 10 */ subfe r3, r0, r3
/* 800472DC 0004311C 38 00 FF FD */ li r0, -0x3
/* 800472E0 00043120 7C 03 18 38 */ and r3, r0, r3
.global lbl_800472E4
lbl_800472E4:
/* 800472E4 00043124 83 E1 00 0C */ lwz r31, 0xc(r1)
/* 800472E8 00043128 38 21 00 10 */ addi r1, r1, 0x10
/* 800472EC 0004312C 4E 80 00 20 */ blr