From 0191430ec8d23a25b7573f183496b9b24748fbdc Mon Sep 17 00:00:00 2001 From: Zhengwen Jiang Date: Wed, 26 Jun 2024 02:58:20 -0500 Subject: [PATCH] more code_0814A828 --- asm/code_0814A828.s | 1571 --------------------------------------- include/code_0814A828.h | 15 + src/code_0814A828.c | 500 +++++++++++++ 3 files changed, 515 insertions(+), 1571 deletions(-) diff --git a/asm/code_0814A828.s b/asm/code_0814A828.s index a0c805c..2fddc49 100644 --- a/asm/code_0814A828.s +++ b/asm/code_0814A828.s @@ -5,1577 +5,6 @@ .text - thumb_func_start sub_0814C598 -sub_0814C598: @ 0x0814C598 - push {r4, r5, r6, lr} - adds r6, r0, #0 - adds r5, r6, #0 - adds r5, #0x10 - ldr r1, _0814C5E0 @ =gUnk_08387E2C - ldrh r0, [r1] - movs r4, #0 - strh r0, [r5, #0xc] - ldrh r0, [r1, #2] - strb r0, [r5, #0x1a] - adds r0, r5, #0 - bl sub_08155128 - adds r5, #0x28 - ldr r1, _0814C5E4 @ =gUnk_08387EB4 - ldrh r0, [r1] - strh r0, [r5, #0xc] - ldrh r0, [r1, #2] - strb r0, [r5, #0x1a] - adds r0, r5, #0 - bl sub_08155128 - strh r4, [r6, #8] - ldr r0, _0814C5E8 @ =sub_0814E660 - str r0, [r6, #4] - adds r0, r6, #0 - adds r0, #0x10 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814C5E0: .4byte gUnk_08387E2C -_0814C5E4: .4byte gUnk_08387EB4 -_0814C5E8: .4byte sub_0814E660 - - thumb_func_start sub_0814C5EC -sub_0814C5EC: @ 0x0814C5EC - push {r4, r5, r6, r7, lr} - adds r7, r0, #0 - adds r6, r7, #0 - adds r6, #0x10 - ldr r1, _0814C664 @ =gUnk_08387E2C - adds r0, r1, #0 - adds r0, #0x78 - ldrh r0, [r0] - movs r5, #0 - strh r0, [r6, #0xc] - adds r1, #0x7a - ldrh r0, [r1] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - adds r6, #0x28 - ldr r0, _0814C668 @ =gUnk_08387EB4 - adds r1, r0, #0 - adds r1, #0x78 - ldrh r1, [r1] - strh r1, [r6, #0xc] - adds r0, #0x7a - ldrh r0, [r0] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - adds r0, r7, #0 - adds r0, #0x10 - ldr r1, [r0, #8] - movs r4, #0x80 - lsls r4, r4, #3 - eors r1, r4 - str r1, [r0, #8] - bl sub_08155128 - ldr r0, [r6, #8] - eors r0, r4 - str r0, [r6, #8] - adds r0, r6, #0 - bl sub_08155128 - ldr r0, _0814C66C @ =0x0000024E - bl m4aSongNumStart - strh r5, [r7, #8] - ldr r0, _0814C670 @ =sub_0814E690 - str r0, [r7, #4] - adds r0, r7, #0 - adds r0, #0x10 - bl sub_0815604C - adds r0, r6, #0 - bl sub_0815604C - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_0814C664: .4byte gUnk_08387E2C -_0814C668: .4byte gUnk_08387EB4 -_0814C66C: .4byte 0x0000024E -_0814C670: .4byte sub_0814E690 - - thumb_func_start sub_0814C674 -sub_0814C674: @ 0x0814C674 - push {r4, r5, r6, r7, lr} - adds r7, r0, #0 - ldr r0, _0814C718 @ =0xFFFD0000 - str r0, [r7, #0x68] - movs r0, #0xe0 - lsls r0, r0, #5 - str r0, [r7, #0x70] - movs r5, #0 - str r5, [r7, #0x6c] - str r5, [r7, #0x74] - adds r6, r7, #0 - adds r6, #0x10 - ldr r0, _0814C71C @ =gUnk_08387E2C - adds r1, r0, #0 - adds r1, #0x70 - ldrh r1, [r1] - strh r1, [r6, #0xc] - adds r0, #0x72 - ldrh r0, [r0] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - adds r6, #0x28 - ldr r0, _0814C720 @ =gUnk_08387EB4 - adds r1, r0, #0 - adds r1, #0x70 - ldrh r1, [r1] - strh r1, [r6, #0xc] - adds r0, #0x72 - ldrh r0, [r0] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - adds r0, r7, #0 - adds r0, #0x10 - ldr r1, [r0, #8] - movs r4, #0x80 - lsls r4, r4, #3 - eors r1, r4 - str r1, [r0, #8] - bl sub_08155128 - ldr r0, [r6, #8] - eors r0, r4 - str r0, [r6, #8] - adds r0, r6, #0 - bl sub_08155128 - strh r5, [r7, #8] - ldr r0, _0814C724 @ =sub_0814C728 - str r0, [r7, #4] - adds r4, r7, #0 - adds r4, #0x10 - adds r0, r4, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814C6F4 - adds r1, r7, #0 - adds r1, #0x2b - movs r0, #0xff - strb r0, [r1] -_0814C6F4: - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814C706 - adds r1, r7, #0 - adds r1, #0x53 - movs r0, #0xff - strb r0, [r1] -_0814C706: - adds r0, r4, #0 - bl sub_0815604C - adds r0, r6, #0 - bl sub_0815604C - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_0814C718: .4byte 0xFFFD0000 -_0814C71C: .4byte gUnk_08387E2C -_0814C720: .4byte gUnk_08387EB4 -_0814C724: .4byte sub_0814C728 - - thumb_func_start sub_0814C728 -sub_0814C728: @ 0x0814C728 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldrh r0, [r4, #8] - adds r0, #1 - strh r0, [r4, #8] - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #0x1d - ble _0814C73E - ldr r0, _0814C7C4 @ =sub_0814C7CC - str r0, [r4, #4] -_0814C73E: - ldr r0, [r4, #0x68] - ldr r1, [r4, #0x70] - adds r0, r0, r1 - str r0, [r4, #0x68] - ldr r0, [r4, #0x6c] - ldr r1, [r4, #0x74] - adds r0, r0, r1 - str r0, [r4, #0x6c] - ldr r1, _0814C7C8 @ =0x00049FFF - cmp r0, r1 - ble _0814C75E - movs r0, #0x94 - lsls r0, r0, #0xb - str r0, [r4, #0x6c] - movs r0, #0 - str r0, [r4, #0x74] -_0814C75E: - ldr r1, [r4, #0x60] - ldr r0, [r4, #0x68] - adds r1, r1, r0 - str r1, [r4, #0x60] - ldr r0, [r4, #0x64] - ldr r2, [r4, #0x6c] - adds r0, r0, r2 - str r0, [r4, #0x64] - asrs r1, r1, #0x10 - adds r0, r4, #0 - adds r0, #0x48 - strh r1, [r0] - strh r1, [r4, #0x20] - ldr r0, [r4, #0x64] - asrs r0, r0, #0x10 - adds r1, r4, #0 - adds r1, #0x4a - strh r0, [r1] - strh r0, [r4, #0x22] - adds r6, r4, #0 - adds r6, #0x10 - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814C79A - adds r1, r4, #0 - adds r1, #0x2b - movs r0, #0xff - strb r0, [r1] -_0814C79A: - adds r5, r4, #0 - adds r5, #0x38 - adds r0, r5, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814C7B0 - adds r1, r4, #0 - adds r1, #0x53 - movs r0, #0xff - strb r0, [r1] -_0814C7B0: - adds r0, r6, #0 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814C7C4: .4byte sub_0814C7CC -_0814C7C8: .4byte 0x00049FFF - - thumb_func_start sub_0814C7CC -sub_0814C7CC: @ 0x0814C7CC - push {r4, r5, r6, lr} - adds r4, r0, #0 - movs r6, #0 - str r6, [r4, #0x68] - str r6, [r4, #0x70] - str r6, [r4, #0x6c] - adds r5, r4, #0 - adds r5, #0x10 - ldr r0, _0814C888 @ =gUnk_08387E2C - adds r1, r0, #0 - adds r1, #0x74 - ldrh r1, [r1] - strh r1, [r5, #0xc] - adds r0, #0x76 - ldrh r0, [r0] - strb r0, [r5, #0x1a] - adds r0, r5, #0 - bl sub_08155128 - adds r5, #0x28 - ldr r0, _0814C88C @ =gUnk_08387EB4 - adds r1, r0, #0 - adds r1, #0x74 - ldrh r1, [r1] - strh r1, [r5, #0xc] - adds r0, #0x76 - ldrh r0, [r0] - strb r0, [r5, #0x1a] - adds r0, r5, #0 - bl sub_08155128 - adds r1, r4, #0 - adds r1, #0x2c - ldrb r0, [r1] - lsls r0, r0, #1 - strb r0, [r1] - adds r1, #0x28 - ldrb r0, [r1] - lsls r0, r0, #1 - strb r0, [r1] - strh r6, [r4, #8] - ldr r0, _0814C890 @ =sub_0814C898 - str r0, [r4, #4] - ldr r0, [r4, #0x68] - ldr r1, [r4, #0x70] - adds r0, r0, r1 - str r0, [r4, #0x68] - ldr r0, [r4, #0x6c] - ldr r1, [r4, #0x74] - adds r0, r0, r1 - str r0, [r4, #0x6c] - ldr r1, _0814C894 @ =0x00049FFF - cmp r0, r1 - ble _0814C840 - movs r0, #0x94 - lsls r0, r0, #0xb - str r0, [r4, #0x6c] - str r6, [r4, #0x74] -_0814C840: - ldr r1, [r4, #0x60] - ldr r0, [r4, #0x68] - adds r1, r1, r0 - str r1, [r4, #0x60] - ldr r0, [r4, #0x64] - ldr r2, [r4, #0x6c] - adds r0, r0, r2 - str r0, [r4, #0x64] - asrs r1, r1, #0x10 - adds r0, r4, #0 - adds r0, #0x48 - strh r1, [r0] - strh r1, [r4, #0x20] - ldr r0, [r4, #0x64] - asrs r0, r0, #0x10 - adds r1, r4, #0 - adds r1, #0x4a - strh r0, [r1] - strh r0, [r4, #0x22] - adds r4, #0x10 - adds r0, r4, #0 - bl sub_08155128 - adds r0, r5, #0 - bl sub_08155128 - adds r0, r4, #0 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814C888: .4byte gUnk_08387E2C -_0814C88C: .4byte gUnk_08387EB4 -_0814C890: .4byte sub_0814C898 -_0814C894: .4byte 0x00049FFF - - thumb_func_start sub_0814C898 -sub_0814C898: @ 0x0814C898 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldr r0, [r4, #0x68] - ldr r1, [r4, #0x70] - adds r0, r0, r1 - str r0, [r4, #0x68] - ldr r0, [r4, #0x6c] - ldr r1, [r4, #0x74] - adds r0, r0, r1 - str r0, [r4, #0x6c] - ldr r1, _0814C918 @ =0x00049FFF - cmp r0, r1 - ble _0814C8BC - movs r0, #0x94 - lsls r0, r0, #0xb - str r0, [r4, #0x6c] - movs r0, #0 - str r0, [r4, #0x74] -_0814C8BC: - ldr r1, [r4, #0x60] - ldr r0, [r4, #0x68] - adds r1, r1, r0 - str r1, [r4, #0x60] - ldr r0, [r4, #0x64] - ldr r2, [r4, #0x6c] - adds r0, r0, r2 - str r0, [r4, #0x64] - asrs r1, r1, #0x10 - adds r0, r4, #0 - adds r0, #0x48 - strh r1, [r0] - strh r1, [r4, #0x20] - ldr r0, [r4, #0x64] - asrs r0, r0, #0x10 - adds r1, r4, #0 - adds r1, #0x4a - strh r0, [r1] - strh r0, [r4, #0x22] - adds r6, r4, #0 - adds r6, #0x10 - adds r0, r6, #0 - bl sub_08155128 - adds r5, r4, #0 - adds r5, #0x38 - adds r0, r5, #0 - bl sub_08155128 - movs r1, #0 - cmp r0, #0 - bne _0814C8FE - movs r1, #1 -_0814C8FE: - cmp r1, #0 - beq _0814C906 - ldr r0, _0814C91C @ =sub_0814C920 - str r0, [r4, #4] -_0814C906: - adds r0, r6, #0 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814C918: .4byte 0x00049FFF -_0814C91C: .4byte sub_0814C920 - - thumb_func_start sub_0814C920 -sub_0814C920: @ 0x0814C920 - push {r4, r5, r6, r7, lr} - adds r5, r0, #0 - movs r7, #0 - str r7, [r5, #0x68] - str r7, [r5, #0x6c] - movs r0, #0x98 - lsls r0, r0, #6 - str r0, [r5, #0x74] - adds r6, r5, #0 - adds r6, #0x10 - ldr r0, [r6, #8] - movs r4, #0x80 - lsls r4, r4, #3 - eors r0, r4 - str r0, [r6, #8] - adds r0, r6, #0 - bl sub_08155128 - adds r6, #0x28 - ldr r0, [r6, #8] - eors r0, r4 - str r0, [r6, #8] - adds r0, r6, #0 - bl sub_08155128 - adds r1, r5, #0 - adds r1, #0x2c - ldrb r0, [r1] - lsrs r0, r0, #1 - strb r0, [r1] - adds r1, #0x28 - ldrb r0, [r1] - lsrs r0, r0, #1 - strb r0, [r1] - adds r0, r5, #0 - adds r0, #0x10 - ldr r2, _0814C9F4 @ =gUnk_08387E2C - ldrh r1, [r2, #0x34] - strh r1, [r0, #0xc] - ldrh r1, [r2, #0x36] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r1, _0814C9F8 @ =gUnk_08387EB4 - ldrh r0, [r1, #0x34] - strh r0, [r6, #0xc] - ldrh r0, [r1, #0x36] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - strh r7, [r5, #8] - ldr r0, _0814C9FC @ =sub_0814CA04 - str r0, [r5, #4] - ldr r0, [r5, #0x68] - ldr r1, [r5, #0x70] - adds r0, r0, r1 - str r0, [r5, #0x68] - ldr r0, [r5, #0x6c] - ldr r1, [r5, #0x74] - adds r0, r0, r1 - str r0, [r5, #0x6c] - ldr r1, _0814CA00 @ =0x00049FFF - cmp r0, r1 - ble _0814C9AA - movs r0, #0x94 - lsls r0, r0, #0xb - str r0, [r5, #0x6c] - str r7, [r5, #0x74] -_0814C9AA: - ldr r1, [r5, #0x60] - ldr r0, [r5, #0x68] - adds r1, r1, r0 - str r1, [r5, #0x60] - ldr r0, [r5, #0x64] - ldr r2, [r5, #0x6c] - adds r0, r0, r2 - str r0, [r5, #0x64] - asrs r1, r1, #0x10 - adds r0, r5, #0 - adds r0, #0x48 - strh r1, [r0] - strh r1, [r5, #0x20] - ldr r0, [r5, #0x64] - asrs r0, r0, #0x10 - adds r1, r5, #0 - adds r1, #0x4a - strh r0, [r1] - strh r0, [r5, #0x22] - adds r4, r5, #0 - adds r4, #0x10 - adds r0, r4, #0 - bl sub_08155128 - adds r0, r6, #0 - bl sub_08155128 - adds r0, r4, #0 - bl sub_0815604C - adds r0, r6, #0 - bl sub_0815604C - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_0814C9F4: .4byte gUnk_08387E2C -_0814C9F8: .4byte gUnk_08387EB4 -_0814C9FC: .4byte sub_0814CA04 -_0814CA00: .4byte 0x00049FFF - - thumb_func_start sub_0814CA04 -sub_0814CA04: @ 0x0814CA04 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldr r0, [r4, #0x68] - ldr r1, [r4, #0x70] - adds r0, r0, r1 - str r0, [r4, #0x68] - ldr r0, [r4, #0x6c] - ldr r1, [r4, #0x74] - adds r0, r0, r1 - str r0, [r4, #0x6c] - ldr r1, _0814CAA4 @ =0x00049FFF - cmp r0, r1 - ble _0814CA28 - movs r0, #0x94 - lsls r0, r0, #0xb - str r0, [r4, #0x6c] - movs r0, #0 - str r0, [r4, #0x74] -_0814CA28: - ldr r0, [r4, #0x60] - ldr r1, [r4, #0x68] - adds r0, r0, r1 - str r0, [r4, #0x60] - ldr r0, [r4, #0x64] - ldr r1, [r4, #0x6c] - adds r0, r0, r1 - str r0, [r4, #0x64] - ldr r1, _0814CAA8 @ =0x0087FFFF - cmp r0, r1 - ble _0814CA50 - movs r0, #0x88 - lsls r0, r0, #0x10 - str r0, [r4, #0x64] - ldr r0, _0814CAAC @ =sub_0814CAB0 - str r0, [r4, #4] - movs r0, #0x93 - lsls r0, r0, #2 - bl m4aSongNumStart -_0814CA50: - ldr r0, [r4, #0x60] - asrs r0, r0, #0x10 - adds r1, r4, #0 - adds r1, #0x48 - strh r0, [r1] - strh r0, [r4, #0x20] - ldr r0, [r4, #0x64] - asrs r0, r0, #0x10 - adds r1, #2 - strh r0, [r1] - strh r0, [r4, #0x22] - adds r6, r4, #0 - adds r6, #0x10 - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CA7C - adds r1, r4, #0 - adds r1, #0x2b - movs r0, #0xff - strb r0, [r1] -_0814CA7C: - adds r5, r4, #0 - adds r5, #0x38 - adds r0, r5, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CA92 - adds r1, r4, #0 - adds r1, #0x53 - movs r0, #0xff - strb r0, [r1] -_0814CA92: - adds r0, r6, #0 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814CAA4: .4byte 0x00049FFF -_0814CAA8: .4byte 0x0087FFFF -_0814CAAC: .4byte sub_0814CAB0 - - thumb_func_start sub_0814CAB0 -sub_0814CAB0: @ 0x0814CAB0 - push {r4, r5, r6, lr} - adds r5, r0, #0 - adds r6, r5, #0 - adds r6, #0x10 - ldr r1, _0814CB00 @ =gUnk_08387E2C - ldrh r0, [r1, #0x38] - movs r4, #0 - strh r0, [r6, #0xc] - ldrh r0, [r1, #0x3a] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - adds r6, #0x28 - ldr r1, _0814CB04 @ =gUnk_08387EB4 - ldrh r0, [r1, #0x38] - strh r0, [r6, #0xc] - ldrh r0, [r1, #0x3a] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - str r4, [r5, #0x74] - str r4, [r5, #0x6c] - str r4, [r5, #0x70] - str r4, [r5, #0x68] - strh r4, [r5, #8] - ldr r0, _0814CB08 @ =sub_0814E700 - str r0, [r5, #4] - adds r0, r5, #0 - adds r0, #0x10 - bl sub_0815604C - adds r0, r6, #0 - bl sub_0815604C - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814CB00: .4byte gUnk_08387E2C -_0814CB04: .4byte gUnk_08387EB4 -_0814CB08: .4byte sub_0814E700 - - thumb_func_start sub_0814CB0C -sub_0814CB0C: @ 0x0814CB0C - push {r4, r5, r6, lr} - adds r6, r0, #0 - adds r5, r6, #0 - adds r5, #0x10 - ldr r1, _0814CB54 @ =gUnk_08387E2C - ldrh r0, [r1, #0x28] - movs r4, #0 - strh r0, [r5, #0xc] - ldrh r0, [r1, #0x2a] - strb r0, [r5, #0x1a] - adds r0, r5, #0 - bl sub_08155128 - adds r5, #0x28 - ldr r1, _0814CB58 @ =gUnk_08387EB4 - ldrh r0, [r1, #0x28] - strh r0, [r5, #0xc] - ldrh r0, [r1, #0x2a] - strb r0, [r5, #0x1a] - adds r0, r5, #0 - bl sub_08155128 - strh r4, [r6, #8] - ldr r0, _0814CB5C @ =sub_0814E730 - str r0, [r6, #4] - adds r0, r6, #0 - adds r0, #0x10 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814CB54: .4byte gUnk_08387E2C -_0814CB58: .4byte gUnk_08387EB4 -_0814CB5C: .4byte sub_0814E730 - - thumb_func_start sub_0814CB60 -sub_0814CB60: @ 0x0814CB60 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldr r0, [r4, #0x68] - ldr r1, [r4, #0x70] - adds r0, r0, r1 - str r0, [r4, #0x68] - ldr r0, [r4, #0x6c] - ldr r1, [r4, #0x74] - adds r0, r0, r1 - str r0, [r4, #0x6c] - ldr r1, _0814CC00 @ =0x00049FFF - cmp r0, r1 - ble _0814CB84 - movs r0, #0x94 - lsls r0, r0, #0xb - str r0, [r4, #0x6c] - movs r0, #0 - str r0, [r4, #0x74] -_0814CB84: - ldr r0, [r4, #0x60] - ldr r1, [r4, #0x68] - adds r0, r0, r1 - str r0, [r4, #0x60] - ldr r0, [r4, #0x64] - ldr r1, [r4, #0x6c] - adds r2, r0, r1 - str r2, [r4, #0x64] - cmp r1, #0 - blt _0814CBAC - ldr r0, _0814CC04 @ =0x004FFFFF - cmp r2, r0 - ble _0814CBAC - adds r0, #1 - str r0, [r4, #0x64] - movs r0, #0 - str r0, [r4, #0x74] - str r0, [r4, #0x6c] - ldr r0, _0814CC08 @ =sub_0814CC0C - str r0, [r4, #4] -_0814CBAC: - ldr r0, [r4, #0x60] - asrs r0, r0, #0x10 - adds r1, r4, #0 - adds r1, #0x48 - strh r0, [r1] - strh r0, [r4, #0x20] - ldr r0, [r4, #0x64] - asrs r0, r0, #0x10 - adds r1, #2 - strh r0, [r1] - strh r0, [r4, #0x22] - adds r6, r4, #0 - adds r6, #0x10 - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CBD8 - adds r1, r4, #0 - adds r1, #0x2b - movs r0, #0xff - strb r0, [r1] -_0814CBD8: - adds r5, r4, #0 - adds r5, #0x38 - adds r0, r5, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CBEE - adds r1, r4, #0 - adds r1, #0x53 - movs r0, #0xff - strb r0, [r1] -_0814CBEE: - adds r0, r6, #0 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814CC00: .4byte 0x00049FFF -_0814CC04: .4byte 0x004FFFFF -_0814CC08: .4byte sub_0814CC0C - - thumb_func_start sub_0814CC0C -sub_0814CC0C: @ 0x0814CC0C - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldr r0, [r4, #0xc] - adds r0, #0xb8 - ldr r1, [r0] - ldr r0, _0814CC78 @ =sub_0814E4DC - str r0, [r1, #4] - movs r0, #0 - strh r0, [r4, #8] - ldr r0, _0814CC7C @ =sub_0814CC80 - str r0, [r4, #4] - adds r1, r4, #0 - adds r1, #0x2c - ldrb r0, [r1] - cmp r0, #0xfe - bhi _0814CC38 - adds r0, #1 - strb r0, [r1] - adds r1, #0x28 - ldrb r0, [r1] - adds r0, #1 - strb r0, [r1] -_0814CC38: - adds r6, r4, #0 - adds r6, #0x10 - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CC4E - adds r1, r4, #0 - adds r1, #0x2b - movs r0, #0xff - strb r0, [r1] -_0814CC4E: - adds r5, r4, #0 - adds r5, #0x38 - adds r0, r5, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CC64 - adds r1, r4, #0 - adds r1, #0x53 - movs r0, #0xff - strb r0, [r1] -_0814CC64: - adds r0, r6, #0 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814CC78: .4byte sub_0814E4DC -_0814CC7C: .4byte sub_0814CC80 - - thumb_func_start sub_0814CC80 -sub_0814CC80: @ 0x0814CC80 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldrh r0, [r4, #8] - adds r0, #1 - strh r0, [r4, #8] - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #0xe - ble _0814CC96 - ldr r0, _0814CCF8 @ =sub_0814CCFC - str r0, [r4, #4] -_0814CC96: - adds r3, r4, #0 - adds r3, #0x2c - ldrb r2, [r3] - cmp r2, #0xfe - bhi _0814CCB8 - ldrh r1, [r4, #8] - movs r0, #7 - ands r0, r1 - cmp r0, #0 - bne _0814CCB8 - adds r0, r2, #1 - strb r0, [r3] - adds r1, r4, #0 - adds r1, #0x54 - ldrb r0, [r1] - adds r0, #1 - strb r0, [r1] -_0814CCB8: - adds r6, r4, #0 - adds r6, #0x10 - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CCCE - adds r1, r4, #0 - adds r1, #0x2b - movs r0, #0xff - strb r0, [r1] -_0814CCCE: - adds r5, r4, #0 - adds r5, #0x38 - adds r0, r5, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CCE4 - adds r1, r4, #0 - adds r1, #0x53 - movs r0, #0xff - strb r0, [r1] -_0814CCE4: - adds r0, r6, #0 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814CCF8: .4byte sub_0814CCFC - - thumb_func_start sub_0814CCFC -sub_0814CCFC: @ 0x0814CCFC - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldr r2, [r4, #0xc] - adds r0, r2, #0 - adds r0, #0xb8 - ldr r1, [r0] - ldr r0, _0814CD58 @ =sub_0814B908 - str r0, [r1, #4] - movs r0, #0 - strh r0, [r4, #8] - ldr r0, _0814CD5C @ =sub_0814CDE4 - str r0, [r4, #4] - ldr r1, [r2, #4] - cmp r1, #0 - bge _0814CD64 - ldr r0, _0814CD60 @ =sub_0814E7AC - str r0, [r4, #4] - adds r6, r4, #0 - adds r6, #0x10 - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CD34 - adds r1, r4, #0 - adds r1, #0x2b - movs r0, #0xff - strb r0, [r1] -_0814CD34: - adds r5, r4, #0 - adds r5, #0x38 - adds r0, r5, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CD4A - adds r1, r4, #0 - adds r1, #0x53 - movs r0, #0xff - strb r0, [r1] -_0814CD4A: - adds r0, r6, #0 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C - b _0814CDD6 - .align 2, 0 -_0814CD58: .4byte sub_0814B908 -_0814CD5C: .4byte sub_0814CDE4 -_0814CD60: .4byte sub_0814E7AC -_0814CD64: - movs r0, #2 - orrs r1, r0 - str r1, [r2, #4] - ldr r1, _0814CDDC @ =gBldRegs - movs r0, #0xe4 - lsls r0, r0, #2 - strh r0, [r1] - movs r0, #0x10 - strh r0, [r1, #2] - ldr r0, _0814CDE0 @ =0x0000024A - bl m4aSongNumStart - adds r3, r4, #0 - adds r3, #0x2c - ldrb r2, [r3] - cmp r2, #0xfe - bhi _0814CD9E - ldrh r1, [r4, #8] - movs r0, #7 - ands r0, r1 - cmp r0, #0 - bne _0814CD9E - adds r0, r2, #1 - strb r0, [r3] - adds r1, r4, #0 - adds r1, #0x54 - ldrb r0, [r1] - adds r0, #1 - strb r0, [r1] -_0814CD9E: - adds r6, r4, #0 - adds r6, #0x10 - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CDB4 - adds r1, r4, #0 - adds r1, #0x2b - movs r0, #0xff - strb r0, [r1] -_0814CDB4: - adds r5, r4, #0 - adds r5, #0x38 - adds r0, r5, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CDCA - adds r1, r4, #0 - adds r1, #0x53 - movs r0, #0xff - strb r0, [r1] -_0814CDCA: - adds r0, r6, #0 - bl sub_0815604C - adds r0, r5, #0 - bl sub_0815604C -_0814CDD6: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814CDDC: .4byte gBldRegs -_0814CDE0: .4byte 0x0000024A - - thumb_func_start sub_0814CDE4 -sub_0814CDE4: @ 0x0814CDE4 - push {r4, r5, r6, r7, lr} - adds r5, r0, #0 - ldr r0, [r5, #0xc] - adds r6, r0, #0 - adds r6, #0x38 - ldrh r0, [r5, #8] - adds r0, #1 - strh r0, [r5, #8] - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #0x4a - ble _0814CE00 - ldr r0, _0814CEA0 @ =sub_0814E748 - str r0, [r5, #4] -_0814CE00: - ldr r4, _0814CEA4 @ =gBldRegs - movs r1, #8 - ldrsh r0, [r5, r1] - lsls r0, r0, #4 - movs r1, #0x4b - bl __divsi3 - strh r0, [r4, #4] - ldrb r0, [r5, #1] - adds r0, #1 - strb r0, [r5, #1] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - cmp r0, #7 - ble _0814CE28 - movs r0, #0 - strb r0, [r5, #1] - ldr r0, _0814CEA8 @ =0x0000024A - bl m4aSongNumStart -_0814CE28: - adds r4, r5, #0 - adds r4, #0x10 - adds r0, r4, #0 - bl sub_08155128 - adds r7, r4, #0 - cmp r0, #0 - bne _0814CE40 - adds r1, r5, #0 - adds r1, #0x2b - movs r0, #0xff - strb r0, [r1] -_0814CE40: - adds r4, r5, #0 - adds r4, #0x38 - adds r0, r4, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CE56 - adds r1, r5, #0 - adds r1, #0x53 - movs r0, #0xff - strb r0, [r1] -_0814CE56: - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CE64 - movs r0, #0xff - strb r0, [r6, #0x1b] -_0814CE64: - adds r3, r5, #0 - adds r3, #0x2c - ldrb r2, [r3] - cmp r2, #0xfe - bhi _0814CE86 - ldrh r1, [r5, #8] - movs r0, #7 - ands r0, r1 - cmp r0, #0 - bne _0814CE86 - adds r0, r2, #1 - strb r0, [r3] - adds r1, r5, #0 - adds r1, #0x54 - ldrb r0, [r1] - adds r0, #1 - strb r0, [r1] -_0814CE86: - adds r0, r7, #0 - bl sub_0815604C - adds r0, r4, #0 - bl sub_0815604C - adds r0, r6, #0 - bl sub_0815604C - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_0814CEA0: .4byte sub_0814E748 -_0814CEA4: .4byte gBldRegs -_0814CEA8: .4byte 0x0000024A - - thumb_func_start sub_0814CEAC -sub_0814CEAC: @ 0x0814CEAC - push {r4, r5, lr} - adds r3, r0, #0 - ldr r1, [r3, #0xc] - adds r4, r1, #0 - adds r4, #0x38 - ldrh r0, [r3, #8] - adds r0, #1 - movs r5, #0 - strh r0, [r3, #8] - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #9 - ble _0814CEFC - ldr r0, [r1, #4] - cmp r0, #0 - blt _0814CED0 - ldr r0, _0814CEF4 @ =sub_0814E1C0 - str r0, [r1, #8] -_0814CED0: - ldr r2, [r3, #0xc] - ldrb r1, [r3] - lsls r1, r1, #2 - adds r0, r2, #0 - adds r0, #0xa8 - adds r0, r0, r1 - str r5, [r0] - ldrb r0, [r3] - lsls r0, r0, #2 - adds r2, #0xb8 - adds r2, r2, r0 - str r5, [r2] - ldr r0, _0814CEF8 @ =gCurTask - ldr r0, [r0] - bl TaskDestroy - b _0814CF28 - .align 2, 0 -_0814CEF4: .4byte sub_0814E1C0 -_0814CEF8: .4byte gCurTask -_0814CEFC: - ldrb r0, [r3, #1] - adds r0, #1 - strb r0, [r3, #1] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - cmp r0, #7 - ble _0814CF14 - movs r0, #0 - strb r0, [r3, #1] - ldr r0, _0814CF30 @ =0x0000024A - bl m4aSongNumStart -_0814CF14: - adds r0, r4, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814CF22 - movs r0, #0xff - strb r0, [r4, #0x1b] -_0814CF22: - adds r0, r4, #0 - bl sub_0815604C -_0814CF28: - pop {r4, r5} - pop {r0} - bx r0 - .align 2, 0 -_0814CF30: .4byte 0x0000024A - - thumb_func_start sub_0814CF34 -sub_0814CF34: @ 0x0814CF34 - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - sub sp, #0x50 - mov r8, r0 - mov r1, sp - ldr r7, _0814D024 @ =gUnk_08387D8C - adds r0, r7, #0 - adds r0, #0x3c - ldrb r0, [r0] - lsls r0, r0, #5 - ldr r4, _0814D028 @ =0x06012000 - adds r0, r0, r4 - str r0, [sp] - movs r5, #0 - movs r0, #0xff - lsls r0, r0, #6 - strh r0, [r1, #0x14] - ldrh r0, [r7, #0x38] - mov sl, r0 - strh r0, [r1, #0xc] - ldrh r2, [r7, #0x3a] - mov sb, r2 - mov r0, sb - strb r0, [r1, #0x1a] - strh r5, [r1, #0x16] - movs r0, #0xff - strb r0, [r1, #0x1b] - movs r2, #0x10 - strb r2, [r1, #0x1c] - adds r0, r7, #0 - adds r0, #0x3d - ldrb r6, [r0] - strb r6, [r1, #0x1f] - ldr r0, _0814D02C @ =0x0000FFC0 - strh r0, [r1, #0x10] - strh r0, [r1, #0x12] - str r5, [sp, #8] - mov r0, sp - bl sub_08155128 - mov r1, r8 - adds r1, #0xc - adds r0, r7, #0 - adds r0, #0x34 - ldrb r0, [r0] - lsls r0, r0, #5 - adds r0, r0, r4 - mov r2, r8 - str r0, [r2, #0xc] - movs r0, #0xa0 - lsls r0, r0, #2 - strh r0, [r1, #0x14] - ldrh r0, [r7, #0x30] - strh r0, [r1, #0xc] - ldrh r0, [r7, #0x32] - strb r0, [r1, #0x1a] - strh r5, [r1, #0x16] - movs r0, #1 - rsbs r0, r0, #0 - strb r0, [r1, #0x1b] - movs r0, #0x10 - strb r0, [r1, #0x1c] - adds r0, r7, #0 - adds r0, #0x35 - ldrb r0, [r0] - strb r0, [r1, #0x1f] - movs r0, #0x14 - strh r0, [r1, #0x10] - ldr r0, _0814D030 @ =0x0000FFEC - strh r0, [r1, #0x12] - movs r0, #0x80 - lsls r0, r0, #0xb - str r0, [r1, #8] - adds r0, r1, #0 - bl sub_08155128 - add r4, sp, #0x28 - movs r0, #0xc0 - lsls r0, r0, #0x13 - str r0, [sp, #0x28] - mov r2, sl - strh r2, [r4, #0xc] - mov r0, sb - strb r0, [r4, #0x1a] - movs r0, #1 - rsbs r0, r0, #0 - strb r0, [r4, #0x1b] - strh r5, [r4, #0x10] - strh r5, [r4, #0x12] - strh r5, [r4, #0x14] - strh r5, [r4, #0x16] - movs r2, #0x10 - strb r2, [r4, #0x1c] - movs r0, #0xf - ands r0, r6 - strb r0, [r4, #0x1f] - movs r0, #0x80 - lsls r0, r0, #0xc - str r0, [r4, #8] - adds r0, r4, #0 - bl sub_08155128 - ldrb r0, [r4, #0x1f] - lsls r0, r0, #0x1c - lsrs r0, r0, #0x18 - movs r1, #0x10 - bl sub_0803D280 - add sp, #0x50 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_0814D024: .4byte gUnk_08387D8C -_0814D028: .4byte 0x06012000 -_0814D02C: .4byte 0x0000FFC0 -_0814D030: .4byte 0x0000FFEC - - thumb_func_start sub_0814D034 -sub_0814D034: @ 0x0814D034 - push {r4, r5, lr} - adds r4, r0, #0 - ldrb r0, [r4, #7] - cmp r0, #0 - bne _0814D050 - ldr r1, [r4, #0x38] - ldr r0, _0814D0DC @ =0xFFF80000 - cmp r1, r0 - blt _0814D050 - ldr r0, _0814D0E0 @ =0x00000251 - bl m4aSongNumStart - movs r0, #1 - strb r0, [r4, #7] -_0814D050: - ldrh r0, [r4, #4] - adds r0, #1 - strh r0, [r4, #4] - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #0x22 - ble _0814D062 - ldr r0, _0814D0E4 @ =sub_0814D0F4 - str r0, [r4] -_0814D062: - ldr r1, [r4, #0x3c] - ldr r0, [r4, #0x44] - adds r1, r1, r0 - str r1, [r4, #0x3c] - adds r2, r1, #0 - cmp r1, #0 - bge _0814D072 - rsbs r2, r1, #0 -_0814D072: - ldr r0, _0814D0E8 @ =0x00014BFF - cmp r2, r0 - ble _0814D088 - ldr r0, _0814D0EC @ =0xFFFEB400 - cmp r1, #0 - ble _0814D082 - movs r0, #0xa6 - lsls r0, r0, #9 -_0814D082: - str r0, [r4, #0x3c] - movs r0, #0 - str r0, [r4, #0x44] -_0814D088: - ldr r0, [r4, #0x40] - ldr r1, [r4, #0x48] - adds r0, r0, r1 - str r0, [r4, #0x40] - ldr r1, _0814D0F0 @ =0x00027FFF - cmp r0, r1 - ble _0814D0A0 - movs r0, #0xa0 - lsls r0, r0, #0xa - str r0, [r4, #0x40] - movs r0, #0 - str r0, [r4, #0x48] -_0814D0A0: - ldr r2, [r4, #0x34] - ldr r0, [r4, #0x3c] - adds r2, r2, r0 - str r2, [r4, #0x34] - ldr r0, [r4, #0x38] - ldr r1, [r4, #0x40] - adds r0, r0, r1 - str r0, [r4, #0x38] - asrs r2, r2, #0x10 - strh r2, [r4, #0x1c] - asrs r0, r0, #0x10 - strh r0, [r4, #0x1e] - adds r5, r4, #0 - adds r5, #0xc - adds r0, r5, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814D0CE - adds r1, r4, #0 - adds r1, #0x27 - movs r0, #0xff - strb r0, [r1] -_0814D0CE: - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5} - pop {r0} - bx r0 - .align 2, 0 -_0814D0DC: .4byte 0xFFF80000 -_0814D0E0: .4byte 0x00000251 -_0814D0E4: .4byte sub_0814D0F4 -_0814D0E8: .4byte 0x00014BFF -_0814D0EC: .4byte 0xFFFEB400 -_0814D0F0: .4byte 0x00027FFF - - thumb_func_start sub_0814D0F4 -sub_0814D0F4: @ 0x0814D0F4 - push {r4, r5, lr} - adds r4, r0, #0 - adds r0, #0xc - ldr r2, _0814D184 @ =gUnk_08387F3C - ldrh r1, [r2, #0x18] - strh r1, [r0, #0xc] - ldrh r1, [r2, #0x1a] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r1, [r4, #0x3c] - ldr r0, [r4, #0x44] - adds r1, r1, r0 - str r1, [r4, #0x3c] - adds r2, r1, #0 - cmp r1, #0 - bge _0814D118 - rsbs r2, r1, #0 -_0814D118: - ldr r0, _0814D188 @ =0x00014BFF - cmp r2, r0 - ble _0814D12E - ldr r0, _0814D18C @ =0xFFFEB400 - cmp r1, #0 - ble _0814D128 - movs r0, #0xa6 - lsls r0, r0, #9 -_0814D128: - str r0, [r4, #0x3c] - movs r0, #0 - str r0, [r4, #0x44] -_0814D12E: - ldr r0, [r4, #0x40] - ldr r1, [r4, #0x48] - adds r0, r0, r1 - str r0, [r4, #0x40] - ldr r1, _0814D190 @ =0x00027FFF - cmp r0, r1 - ble _0814D146 - movs r0, #0xa0 - lsls r0, r0, #0xa - str r0, [r4, #0x40] - movs r0, #0 - str r0, [r4, #0x48] -_0814D146: - ldr r2, [r4, #0x34] - ldr r0, [r4, #0x3c] - adds r2, r2, r0 - str r2, [r4, #0x34] - ldr r0, [r4, #0x38] - ldr r1, [r4, #0x40] - adds r0, r0, r1 - str r0, [r4, #0x38] - asrs r2, r2, #0x10 - strh r2, [r4, #0x1c] - asrs r0, r0, #0x10 - strh r0, [r4, #0x1e] - ldr r0, _0814D194 @ =sub_0814D198 - str r0, [r4] - adds r5, r4, #0 - adds r5, #0xc - adds r0, r5, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814D178 - adds r1, r4, #0 - adds r1, #0x27 - movs r0, #0xff - strb r0, [r1] -_0814D178: - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5} - pop {r0} - bx r0 - .align 2, 0 -_0814D184: .4byte gUnk_08387F3C -_0814D188: .4byte 0x00014BFF -_0814D18C: .4byte 0xFFFEB400 -_0814D190: .4byte 0x00027FFF -_0814D194: .4byte sub_0814D198 - - thumb_func_start sub_0814D198 -sub_0814D198: @ 0x0814D198 - push {r4, r5, lr} - adds r4, r0, #0 - ldr r1, [r4, #0x3c] - ldr r0, [r4, #0x44] - adds r1, r1, r0 - str r1, [r4, #0x3c] - adds r2, r1, #0 - cmp r1, #0 - bge _0814D1AC - rsbs r2, r1, #0 -_0814D1AC: - ldr r0, _0814D218 @ =0x00014BFF - cmp r2, r0 - ble _0814D1C2 - ldr r0, _0814D21C @ =0xFFFEB400 - cmp r1, #0 - ble _0814D1BC - movs r0, #0xa6 - lsls r0, r0, #9 -_0814D1BC: - str r0, [r4, #0x3c] - movs r0, #0 - str r0, [r4, #0x44] -_0814D1C2: - ldr r0, [r4, #0x40] - ldr r1, [r4, #0x48] - adds r0, r0, r1 - str r0, [r4, #0x40] - ldr r1, _0814D220 @ =0x00027FFF - cmp r0, r1 - ble _0814D1DA - movs r0, #0xa0 - lsls r0, r0, #0xa - str r0, [r4, #0x40] - movs r0, #0 - str r0, [r4, #0x48] -_0814D1DA: - ldr r2, [r4, #0x34] - ldr r0, [r4, #0x3c] - adds r2, r2, r0 - str r2, [r4, #0x34] - ldr r0, [r4, #0x38] - ldr r1, [r4, #0x40] - adds r0, r0, r1 - str r0, [r4, #0x38] - asrs r2, r2, #0x10 - strh r2, [r4, #0x1c] - asrs r0, r0, #0x10 - strh r0, [r4, #0x1e] - adds r5, r4, #0 - adds r5, #0xc - adds r0, r5, #0 - bl sub_08155128 - movs r1, #0 - cmp r0, #0 - bne _0814D204 - movs r1, #1 -_0814D204: - cmp r1, #0 - beq _0814D20C - ldr r0, _0814D224 @ =sub_0814D228 - str r0, [r4] -_0814D20C: - adds r0, r5, #0 - bl sub_0815604C - pop {r4, r5} - pop {r0} - bx r0 - .align 2, 0 -_0814D218: .4byte 0x00014BFF -_0814D21C: .4byte 0xFFFEB400 -_0814D220: .4byte 0x00027FFF -_0814D224: .4byte sub_0814D228 - thumb_func_start sub_0814D228 sub_0814D228: @ 0x0814D228 push {r4, r5, lr} diff --git a/include/code_0814A828.h b/include/code_0814A828.h index 9671fa6..ded8cda 100644 --- a/include/code_0814A828.h +++ b/include/code_0814A828.h @@ -52,4 +52,19 @@ struct Unk_0814A828 { struct Unk_0814E918 *unkC4; }; /* size = 0xC8 */ +struct Unk_0814EACC { + void (*unk0)(struct Unk_0814EACC *); + s16 unk4; + u8 unk6; + u8 unk7; + struct Unk_0814A828 *unk8; + struct Sprite unkC; + s32 unk34; + s32 unk38; + s32 unk3C; + s32 unk40; + s32 unk44; + s32 unk48; +}; /* size = 0x4C */ + #endif diff --git a/src/code_0814A828.c b/src/code_0814A828.c index 3357748..683d782 100644 --- a/src/code_0814A828.c +++ b/src/code_0814A828.c @@ -35,11 +35,25 @@ void sub_0814C31C(struct Unk_0814E394 *); void sub_0814C3C8(struct Unk_0814E394 *); void sub_0814C4F0(struct Unk_0814E394 *); void sub_0814C598(struct Unk_0814E394 *); +void sub_0814C728(struct Unk_0814E394 *); +void sub_0814C7CC(struct Unk_0814E394 *); +void sub_0814C898(struct Unk_0814E394 *); +void sub_0814C920(struct Unk_0814E394 *); +void sub_0814CA04(struct Unk_0814E394 *); +void sub_0814CAB0(struct Unk_0814E394 *); void sub_0814CB60(struct Unk_0814E394 *); +void sub_0814CC0C(struct Unk_0814E394 *); +void sub_0814CC80(struct Unk_0814E394 *); +void sub_0814CCFC(struct Unk_0814E394 *); +void sub_0814CDE4(struct Unk_0814E394 *); +void sub_0814D0F4(struct Unk_0814EACC *); +void sub_0814D198(struct Unk_0814EACC *); +void sub_0814D228(struct Unk_0814EACC *); void nullsub_12(struct Task *); void sub_0814E0B4(struct Unk_0814A828 *); void sub_0814E0E8(struct Unk_0814A828 *); void sub_0814E198(struct Unk_0814A828 *); +void sub_0814E1C0(struct Unk_0814A828 *); void sub_0814E224(struct Unk_0814A828 *); void sub_0814E264(struct Unk_0814A828 *); void sub_0814E290(struct Unk_0814A828 *); @@ -47,9 +61,16 @@ struct Task *sub_0814E394(struct Unk_0814A828 *, u8); void sub_0814E47C(struct Unk_0814E394 *); void sub_0814E4AC(struct Unk_0814E394 *); void sub_0814E4C4(struct Unk_0814E394 *); +void sub_0814E4DC(struct Unk_0814E394 *); void sub_0814E518(struct Unk_0814E394 *); void sub_0814E600(struct Unk_0814E394 *); void sub_0814E630(struct Unk_0814E394 *); +void sub_0814E660(struct Unk_0814E394 *); +void sub_0814E690(struct Unk_0814E394 *); +void sub_0814E700(struct Unk_0814E394 *); +void sub_0814E730(struct Unk_0814E394 *); +void sub_0814E748(struct Unk_0814E394 *); +void sub_0814E7AC(struct Unk_0814E394 *); void sub_0814EA00(struct Unk_0814E918 *); struct Unk_08387D8C { @@ -1247,3 +1268,482 @@ void sub_0814C4F0(struct Unk_0814E394 *a1) { sub_0815604C(&a1->unk10[0]); sub_0815604C(&a1->unk10[1]); } + +void sub_0814C598(struct Unk_0814E394 *a1) { + struct Sprite *sprite; + + sprite = &a1->unk10[0]; + sprite->animId = gUnk_08387E2C[0][0]; + sprite->variant = gUnk_08387E2C[0][1]; + sub_08155128(sprite); + sprite = &a1->unk10[1]; + sprite->animId = gUnk_08387EB4[0][0]; + sprite->variant = gUnk_08387EB4[0][1]; + sub_08155128(sprite); + a1->unk8 = 0; + a1->unk4 = sub_0814E660; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); +} + +void sub_0814C5EC(struct Unk_0814E394 *a1) { + struct Sprite *sprite, *sprite2; + + sprite = &a1->unk10[0]; + sprite->animId = gUnk_08387E2C[0x1E][0]; + sprite->variant = gUnk_08387E2C[0x1E][1]; + sub_08155128(sprite); + sprite = &a1->unk10[1]; + sprite->animId = gUnk_08387EB4[0x1E][0]; + sprite->variant = gUnk_08387EB4[0x1E][1]; + sub_08155128(sprite); + sprite2 = &a1->unk10[0]; + sprite2->unk8 ^= 0x400; + sub_08155128(sprite2); + sprite = &a1->unk10[1]; + sprite->unk8 ^= 0x400; + sub_08155128(sprite); + m4aSongNumStart(590); + a1->unk8 = 0; + a1->unk4 = sub_0814E690; + ++a1; --a1; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(sprite); +} + +void sub_0814C674(struct Unk_0814E394 *a1) { + struct Sprite *sprite, *sprite2; + +#ifndef NONMATCHING + asm("":::"r6"); +#endif + a1->unk68 = -0x30000; + a1->unk70 = 0x1C00; + a1->unk6C = 0; + a1->unk74 = 0; + sprite = &a1->unk10[0]; + sprite->animId = gUnk_08387E2C[0x1C][0]; + sprite->variant = gUnk_08387E2C[0x1C][1]; + sub_08155128(sprite); + sprite = &a1->unk10[1]; + sprite->animId = gUnk_08387EB4[0x1C][0]; + sprite->variant = gUnk_08387EB4[0x1C][1]; + sub_08155128(sprite); + sprite2 = &a1->unk10[0]; + sprite2->unk8 ^= 0x400; + sub_08155128(sprite2); + sprite = &a1->unk10[1]; + sprite->unk8 ^= 0x400; + sub_08155128(sprite); + a1->unk8 = 0; + a1->unk4 = sub_0814C728; + ++a1; --a1; + if (!sub_08155128(&a1->unk10[0])) + a1->unk10[0].unk1B = 0xFF; + if (!sub_08155128(sprite)) + a1->unk10[1].unk1B = 0xFF; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(sprite); +} + +void sub_0814C728(struct Unk_0814E394 *a1) { + if (++a1->unk8 > 0x1D) + a1->unk4 = sub_0814C7CC; + a1->unk68 += a1->unk70; + a1->unk6C += a1->unk74; + if (a1->unk6C >= 0x4A000) { + a1->unk6C = 0x4A000; + a1->unk74 = 0; + } + a1->unk60 += a1->unk68; + a1->unk64 += a1->unk6C; + a1->unk10[0].x = a1->unk10[1].x = a1->unk60 >> 0x10; + a1->unk10[0].y = a1->unk10[1].y = a1->unk64 >> 0x10; + if (!sub_08155128(&a1->unk10[0])) + a1->unk10[0].unk1B = 0xFF; + if (!sub_08155128(&a1->unk10[1])) + a1->unk10[1].unk1B = 0xFF; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); +} + +void sub_0814C7CC(struct Unk_0814E394 *a1) { + struct Sprite *sprite; + + a1->unk68 = 0; + a1->unk70 = 0; + a1->unk6C = 0; + sprite = &a1->unk10[0]; + sprite->animId = gUnk_08387E2C[0x1D][0]; + sprite->variant = gUnk_08387E2C[0x1D][1]; + sub_08155128(sprite); + sprite = &a1->unk10[1]; + sprite->animId = gUnk_08387EB4[0x1D][0]; + sprite->variant = gUnk_08387EB4[0x1D][1]; + sub_08155128(sprite); + a1->unk10[0].unk1C *= 2; + a1->unk10[1].unk1C *= 2; + a1->unk8 = 0; + a1->unk4 = sub_0814C898; + a1->unk68 += a1->unk70; + a1->unk6C += a1->unk74; + if (a1->unk6C >= 0x4A000) { + a1->unk6C = 0x4A000; + a1->unk74 = 0; + } + a1->unk60 += a1->unk68; + a1->unk64 += a1->unk6C; + a1->unk10[0].x = a1->unk10[1].x = a1->unk60 >> 0x10; + a1->unk10[0].y = a1->unk10[1].y = a1->unk64 >> 0x10; + sub_08155128(&a1->unk10[0]); + sub_08155128(&a1->unk10[1]); + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); +} + +void sub_0814C898(struct Unk_0814E394 *a1) { + u32 ret; + + a1->unk68 += a1->unk70; + a1->unk6C += a1->unk74; + if (a1->unk6C >= 0x4A000) { + a1->unk6C = 0x4A000; + a1->unk74 = 0; + } + a1->unk60 += a1->unk68; + a1->unk64 += a1->unk6C; + a1->unk10[0].x = a1->unk10[1].x = a1->unk60 >> 0x10; + a1->unk10[0].y = a1->unk10[1].y = a1->unk64 >> 0x10; + sub_08155128(&a1->unk10[0]); + ret = !sub_08155128(&a1->unk10[1]); + if (ret) + a1->unk4 = sub_0814C920; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); +} + +void sub_0814C920(struct Unk_0814E394 *a1) { + struct Sprite *sprite, *sprite2; + + a1->unk68 = 0; + a1->unk6C = 0; + a1->unk74 = 0x2600; + sprite = &a1->unk10[0]; + sprite->unk8 ^= 0x400; + sub_08155128(sprite); + sprite = &a1->unk10[1]; + sprite->unk8 ^= 0x400; + sub_08155128(sprite); + a1->unk10[0].unk1C >>= 1; + a1->unk10[1].unk1C >>= 1; + sprite2 = &a1->unk10[0]; + sprite2->animId = gUnk_08387E2C[0xD][0]; + sprite2->variant = gUnk_08387E2C[0xD][1]; + sub_08155128(sprite2); + sprite = &a1->unk10[1]; + sprite->animId = gUnk_08387EB4[0xD][0]; + sprite->variant = gUnk_08387EB4[0xD][1]; + sub_08155128(sprite); + a1->unk8 = 0; + a1->unk4 = sub_0814CA04; + a1->unk68 += a1->unk70; + a1->unk6C += a1->unk74; + if (a1->unk6C >= 0x4A000) { + a1->unk6C = 0x4A000; + a1->unk74 = 0; + } + a1->unk60 += a1->unk68; + a1->unk64 += a1->unk6C; + a1->unk10[0].x = a1->unk10[1].x = a1->unk60 >> 0x10; + a1->unk10[0].y = a1->unk10[1].y = a1->unk64 >> 0x10; + ++a1; --a1; + sub_08155128(&a1->unk10[0]); + sub_08155128(sprite); + sub_0815604C(&a1->unk10[0]); + sub_0815604C(sprite); +} + +void sub_0814CA04(struct Unk_0814E394 *a1) { + a1->unk68 += a1->unk70; + a1->unk6C += a1->unk74; + if (a1->unk6C >= 0x4A000) { + a1->unk6C = 0x4A000; + a1->unk74 = 0; + } + a1->unk60 += a1->unk68; + a1->unk64 += a1->unk6C; + if (a1->unk64 >= 0x880000) { + a1->unk64 = 0x880000; + a1->unk4 = sub_0814CAB0; + m4aSongNumStart(588); + } + a1->unk10[0].x = a1->unk10[1].x = a1->unk60 >> 0x10; + a1->unk10[0].y = a1->unk10[1].y = a1->unk64 >> 0x10; + if (!sub_08155128(&a1->unk10[0])) + a1->unk10[0].unk1B = 0xFF; + if (!sub_08155128(&a1->unk10[1])) + a1->unk10[1].unk1B = 0xFF; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); +} + +void sub_0814CAB0(struct Unk_0814E394 *a1) { + struct Sprite *sprite; + + sprite = &a1->unk10[0]; + sprite->animId = gUnk_08387E2C[0xE][0]; + sprite->variant = gUnk_08387E2C[0xE][1]; + sub_08155128(sprite); + sprite = &a1->unk10[1]; + sprite->animId = gUnk_08387EB4[0xE][0]; + sprite->variant = gUnk_08387EB4[0xE][1]; + sub_08155128(sprite); + a1->unk74 = 0; + a1->unk6C = 0; + a1->unk70 = 0; + a1->unk68 = 0; + a1->unk8 = 0; + a1->unk4 = sub_0814E700; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); +} + +void sub_0814CB0C(struct Unk_0814E394 *a1) { + struct Sprite *sprite; + + sprite = &a1->unk10[0]; + sprite->animId = gUnk_08387E2C[0xA][0]; + sprite->variant = gUnk_08387E2C[0xA][1]; + sub_08155128(sprite); + sprite = &a1->unk10[1]; + sprite->animId = gUnk_08387EB4[0xA][0]; + sprite->variant = gUnk_08387EB4[0xA][1]; + sub_08155128(sprite); + a1->unk8 = 0; + a1->unk4 = sub_0814E730; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); +} + +void sub_0814CB60(struct Unk_0814E394 *a1) { + a1->unk68 += a1->unk70; + a1->unk6C += a1->unk74; + if (a1->unk6C >= 0x4A000) { + a1->unk6C = 0x4A000; + a1->unk74 = 0; + } + a1->unk60 += a1->unk68; + a1->unk64 += a1->unk6C; + if (a1->unk6C >= 0 && a1->unk64 >= 0x500000) { + a1->unk64 = 0x500000; + a1->unk74 = 0; + a1->unk6C = 0; + a1->unk4 = sub_0814CC0C; + } + a1->unk10[0].x = a1->unk10[1].x = a1->unk60 >> 0x10; + a1->unk10[0].y = a1->unk10[1].y = a1->unk64 >> 0x10; + if (!sub_08155128(&a1->unk10[0])) + a1->unk10[0].unk1B = 0xFF; + if (!sub_08155128(&a1->unk10[1])) + a1->unk10[1].unk1B = 0xFF; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); +} + +void sub_0814CC0C(struct Unk_0814E394 *a1) { + a1->unkC->unkB8[0]->unk4 = sub_0814E4DC; + a1->unk8 = 0; + a1->unk4 = sub_0814CC80; + if (a1->unk10[0].unk1C < 0xFF) { + ++a1->unk10[0].unk1C; + ++a1->unk10[1].unk1C; + } + if (!sub_08155128(&a1->unk10[0])) + a1->unk10[0].unk1B = 0xFF; + if (!sub_08155128(&a1->unk10[1])) + a1->unk10[1].unk1B = 0xFF; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); +} + +void sub_0814CC80(struct Unk_0814E394 *a1) { + if (++a1->unk8 > 0xE) + a1->unk4 = sub_0814CCFC; + if (a1->unk10[0].unk1C < 0xFF && !(a1->unk8 & 7)) { + ++a1->unk10[0].unk1C; + ++a1->unk10[1].unk1C; + } + if (!sub_08155128(&a1->unk10[0])) + a1->unk10[0].unk1B = 0xFF; + if (!sub_08155128(&a1->unk10[1])) + a1->unk10[1].unk1B = 0xFF; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); +} + +void sub_0814CCFC(struct Unk_0814E394 *a1) { + struct Unk_0814A828 *unkC = a1->unkC; + + unkC->unkB8[0]->unk4 = sub_0814B908; + a1->unk8 = 0; + a1->unk4 = sub_0814CDE4; + if (unkC->unk4 & 0x80000000) { + a1->unk4 = sub_0814E7AC; + if (!sub_08155128(&a1->unk10[0])) + a1->unk10[0].unk1B = 0xFF; + if (!sub_08155128(&a1->unk10[1])) + a1->unk10[1].unk1B = 0xFF; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); + } else { + unkC->unk4 |= 2; + gBldRegs.bldCnt = BLDCNT_TGT1_OBJ | BLDCNT_EFFECT_LIGHTEN | BLDCNT_TGT2_BG0 | BLDCNT_TGT2_BG1; + gBldRegs.bldAlpha = BLDALPHA_BLEND(0x10, 0); + m4aSongNumStart(586); + if (a1->unk10[0].unk1C < 0xFF && !(a1->unk8 & 7)) { + ++a1->unk10[0].unk1C; + ++a1->unk10[1].unk1C; + } + if (!sub_08155128(&a1->unk10[0])) + a1->unk10[0].unk1B = 0xFF; + if (!sub_08155128(&a1->unk10[1])) + a1->unk10[1].unk1B = 0xFF; + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); + } +} + +void sub_0814CDE4(struct Unk_0814E394 *a1) { + struct Sprite *sprite = &a1->unkC->unk38; + + if (++a1->unk8 > 0x4A) + a1->unk4 = sub_0814E748; + gBldRegs.bldY = 0x10 * a1->unk8 / 0x4B; + if (++a1->unk1 > 7) { + a1->unk1 = 0; + m4aSongNumStart(586); + } + if (!sub_08155128(&a1->unk10[0])) + a1->unk10[0].unk1B = 0xFF; + if (!sub_08155128(&a1->unk10[1])) + a1->unk10[1].unk1B = 0xFF; + if (!sub_08155128(sprite)) + sprite->unk1B = 0xFF; + if (a1->unk10[0].unk1C < 0xFF && !(a1->unk8 & 7)) { + ++a1->unk10[0].unk1C; + ++a1->unk10[1].unk1C; + } + sub_0815604C(&a1->unk10[0]); + sub_0815604C(&a1->unk10[1]); + sub_0815604C(sprite); +} + +void sub_0814CEAC(struct Unk_0814E394 *a1) { + struct Sprite *sprite = &a1->unkC->unk38; + + if (++a1->unk8 > 9) { + if (!(a1->unkC->unk4 & 0x80000000)) + a1->unkC->unk8 = sub_0814E1C0; + a1->unkC->unkA8[a1->unk0] = 0; + a1->unkC->unkB8[a1->unk0] = 0; + TaskDestroy(gCurTask); + } else { + if (++a1->unk1 > 7) { + a1->unk1 = 0; + m4aSongNumStart(586); + } + if (!sub_08155128(sprite)) + sprite->unk1B = 0xFF; + sub_0815604C(sprite); + } +} + +void sub_0814CF34(struct Unk_0814EACC *a1) { + struct Sprite local[2]; + struct Sprite *sprite, *sprite2; + + sprite = &local[0]; + SpriteInitNoPointer2(sprite, 0x20 * gUnk_08387D8C[7].unk4 + 0x6012000, 0x3FC0, gUnk_08387D8C[7].animId, gUnk_08387D8C[7].variant, + 0, 0xFF, 0x10, gUnk_08387D8C[7].palId, -0x40, -0x40, 0); + sprite = &a1->unkC; + SpriteInitNoPointer2(sprite, 0x20 * gUnk_08387D8C[6].unk4 + 0x6012000, 0x280, gUnk_08387D8C[6].animId, gUnk_08387D8C[6].variant, + 0, 0xFF, 0x10, gUnk_08387D8C[6].palId, 0x14, -0x14, 0x40000); + sprite2 = &local[1]; + SpriteSomething(sprite2, 0x6000000, gUnk_08387D8C[7].animId, gUnk_08387D8C[7].variant, 0xFF, 0, 0, 0, 0, 0x10, + gUnk_08387D8C[7].palId & 0xF, 0x80000); +} + +void sub_0814D034(struct Unk_0814EACC *a1) { + if (!a1->unk7 && a1->unk38 >= -0x80000) { + m4aSongNumStart(593); + a1->unk7 = 1; + } + if (++a1->unk4 > 0x22) + a1->unk0 = sub_0814D0F4; + a1->unk3C += a1->unk44; + if (abs(a1->unk3C) >= 0x14C00) { + a1->unk3C = a1->unk3C > 0 ? 0x14C00 : -0x14C00; + a1->unk44 = 0; + } + a1->unk40 += a1->unk48; + if (a1->unk40 >= 0x28000) { + a1->unk40 = 0x28000; + a1->unk48 = 0; + } + a1->unk34 += a1->unk3C; + a1->unk38 += a1->unk40; + a1->unkC.x = a1->unk34 >> 0x10; + a1->unkC.y = a1->unk38 >> 0x10; + if (!sub_08155128(&a1->unkC)) + a1->unkC.unk1B = 0xFF; + sub_0815604C(&a1->unkC); +} + +void sub_0814D0F4(struct Unk_0814EACC *a1) { + struct Sprite *sprite = &a1->unkC; + + sprite->animId = gUnk_08387F3C[6][0]; + sprite->variant = gUnk_08387F3C[6][1]; + sub_08155128(sprite); + a1->unk3C += a1->unk44; + if (abs(a1->unk3C) >= 0x14C00) { + a1->unk3C = a1->unk3C > 0 ? 0x14C00 : -0x14C00; + a1->unk44 = 0; + } + a1->unk40 += a1->unk48; + if (a1->unk40 >= 0x28000) { + a1->unk40 = 0x28000; + a1->unk48 = 0; + } + a1->unk34 += a1->unk3C; + a1->unk38 += a1->unk40; + a1->unkC.x = a1->unk34 >> 0x10; + a1->unkC.y = a1->unk38 >> 0x10; + a1->unk0 = sub_0814D198; + if (!sub_08155128(&a1->unkC)) + a1->unkC.unk1B = 0xFF; + sub_0815604C(&a1->unkC); +} + +void sub_0814D198(struct Unk_0814EACC *a1) { + u32 var; + + a1->unk3C += a1->unk44; + if (abs(a1->unk3C) >= 0x14C00) { + a1->unk3C = a1->unk3C > 0 ? 0x14C00 : -0x14C00; + a1->unk44 = 0; + } + a1->unk40 += a1->unk48; + if (a1->unk40 >= 0x28000) { + a1->unk40 = 0x28000; + a1->unk48 = 0; + } + a1->unk34 += a1->unk3C; + a1->unk38 += a1->unk40; + a1->unkC.x = a1->unk34 >> 0x10; + a1->unkC.y = a1->unk38 >> 0x10; + var = !sub_08155128(&a1->unkC); + if (var) + a1->unk0 = sub_0814D228; + sub_0815604C(&a1->unkC); +}