diff --git a/asm/code_800B5F0.s b/asm/code_800B5F0.s deleted file mode 100644 index bcad95ab..00000000 --- a/asm/code_800B5F0.s +++ /dev/null @@ -1,230 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start sub_800B720 -sub_800B720: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - str r1, [sp] - lsls r0, 16 - asrs r0, 16 - str r0, [sp, 0xC] - bl DisableInterrupts - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - ldr r0, _0800B780 - mov r8, r0 - ldr r1, _0800B784 - mov r10, r1 - ldr r2, _0800B788 - mov r9, r2 - ldr r5, _0800B78C - mov r12, r5 -_0800B74E: - movs r7, 0 - str r7, [sp, 0x10] - movs r4, 0 - ldr r3, _0800B784 - mov r1, r8 - movs r2, 0 - ldrsh r0, [r1, r2] - ldr r6, _0800B78C - ldr r5, [sp, 0xC] - lsls r5, 16 - str r5, [sp, 0x8] - cmp r4, r0 - bge _0800B7BA - movs r7, 0 - ldrsh r1, [r3, r7] - ldrh r2, [r6] - movs r5, 0 - ldrsh r0, [r6, r5] - cmp r1, r0 - bne _0800B790 - adds r0, r2, 0x1 - mov r7, r9 - ands r0, r7 - strh r0, [r6] - b _0800B74E - .align 2, 0 -_0800B780: .4byte gUnknown_203B0AA -_0800B784: .4byte gUnknown_202D608 -_0800B788: .4byte 0x00007fff -_0800B78C: .4byte gUnknown_203B0A8 -_0800B790: - adds r4, 0x1 - adds r3, 0x8 - mov r1, r8 - movs r2, 0 - ldrsh r0, [r1, r2] - cmp r4, r0 - bge _0800B7BA - movs r5, 0 - ldrsh r1, [r3, r5] - mov r7, r12 - ldrh r2, [r7] - movs r5, 0 - ldrsh r0, [r7, r5] - cmp r1, r0 - bne _0800B790 - adds r0, r2, 0x1 - mov r7, r9 - ands r0, r7 - strh r0, [r6] - movs r0, 0x1 - str r0, [sp, 0x10] -_0800B7BA: - ldr r1, [sp, 0x10] - cmp r1, 0 - bne _0800B74E - movs r4, 0 - mov r3, r10 - ldr r2, _0800B84C - movs r5, 0 - ldrsh r1, [r2, r5] - cmp r4, r1 - bge _0800B7EA - movs r7, 0x2 - ldrsh r0, [r3, r7] - ldr r2, [sp, 0xC] - cmp r0, r2 - bgt _0800B7EA -_0800B7D8: - adds r4, 0x1 - adds r3, 0x8 - cmp r4, r1 - bge _0800B7EA - movs r5, 0x2 - ldrsh r0, [r3, r5] - ldr r7, [sp, 0xC] - cmp r0, r7 - ble _0800B7D8 -_0800B7EA: - ldr r1, _0800B84C - movs r2, 0 - ldrsh r0, [r1, r2] - subs r2, r0, 0x1 - lsls r0, r2, 3 - mov r5, r10 - adds r3, r0, r5 - lsls r5, r4, 3 - cmp r2, r4 - blt _0800B80E -_0800B7FE: - ldr r0, [r3] - ldr r1, [r3, 0x4] - str r0, [r3, 0x8] - str r1, [r3, 0xC] - subs r2, 0x1 - subs r3, 0x8 - cmp r2, r4 - bge _0800B7FE -_0800B80E: - ldr r7, _0800B84C - ldrh r0, [r7] - adds r0, 0x1 - strh r0, [r7] - mov r0, r10 - adds r1, r5, r0 - ldrh r0, [r6] - strh r0, [r1] - ldr r2, [sp, 0x8] - lsrs r0, r2, 16 - strh r0, [r1, 0x2] - mov r0, r10 - adds r0, 0x4 - adds r0, r5, r0 - ldr r5, [sp] - str r5, [r0] - ldr r7, [sp, 0x4] - cmp r7, 0 - beq _0800B838 - bl EnableInterrupts -_0800B838: - movs r1, 0 - ldrsh r0, [r6, r1] - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_0800B84C: .4byte gUnknown_203B0AA - thumb_func_end sub_800B720 - - thumb_func_start sub_800B850 -sub_800B850: - push {r4-r7,lr} - lsls r0, 16 - asrs r6, r0, 16 - bl DisableInterrupts - lsls r0, 24 - lsrs r5, r0, 24 - movs r2, 0 - ldr r4, _0800B8A0 - ldr r3, _0800B8A4 - movs r1, 0 - ldrsh r0, [r3, r1] - cmp r2, r0 - bge _0800B8B4 - adds r1, r3, 0 -_0800B86E: - movs r7, 0 - ldrsh r0, [r4, r7] - cmp r0, r6 - bne _0800B8A8 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - movs r3, 0 - ldrsh r0, [r1, r3] - cmp r2, r0 - bge _0800B896 - ldr r3, _0800B8A4 -_0800B886: - ldr r0, [r4, 0x8] - ldr r1, [r4, 0xC] - stm r4!, {r0,r1} - adds r2, 0x1 - movs r7, 0 - ldrsh r0, [r3, r7] - cmp r2, r0 - blt _0800B886 -_0800B896: - cmp r5, 0 - beq _0800B8BC - bl EnableInterrupts - b _0800B8BC - .align 2, 0 -_0800B8A0: .4byte gUnknown_202D608 -_0800B8A4: .4byte gUnknown_203B0AA -_0800B8A8: - adds r2, 0x1 - adds r4, 0x8 - movs r7, 0 - ldrsh r0, [r3, r7] - cmp r2, r0 - blt _0800B86E -_0800B8B4: - cmp r5, 0 - beq _0800B8BC - bl EnableInterrupts -_0800B8BC: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800B850 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/code_801C620.s b/asm/code_801C620.s deleted file mode 100644 index 787cee98..00000000 --- a/asm/code_801C620.s +++ /dev/null @@ -1,207 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start sub_801D220 -sub_801D220: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r4, _0801D248 - ldr r0, [r4] - adds r0, 0xB8 - bl sub_8006518 - ldr r0, [r4] - ldr r0, [r0, 0x10] - cmp r0, 0 - beq _0801D250 - cmp r0, 0x1 - beq _0801D2C0 - movs r2, 0 - adds r7, r4, 0 - ldr r3, _0801D24C - b _0801D368 - .align 2, 0 -_0801D248: .4byte gUnknown_203B250 -_0801D24C: .4byte gUnknown_80DBE7C -_0801D250: - bl sub_801D4C0 - ldr r0, [r4] - ldr r0, [r0] - cmp r0, 0 - beq _0801D290 - adds r7, r4, 0 - ldr r0, _0801D288 - mov r9, r0 - mov r12, r7 - ldr r2, _0801D28C - mov r8, r2 - movs r3, 0 - movs r2, 0x3 -_0801D26C: - mov r4, r12 - ldr r1, [r4] - adds r1, r3 - adds r1, 0xB8 - mov r0, r8 - ldm r0!, {r4-r6} - stm r1!, {r4-r6} - ldm r0!, {r4-r6} - stm r1!, {r4-r6} - adds r3, 0x18 - subs r2, 0x1 - cmp r2, 0 - bge _0801D26C - b _0801D2F6 - .align 2, 0 -_0801D288: .4byte gUnknown_80DBE98 -_0801D28C: .4byte gUnknown_80DBE7C -_0801D290: - adds r7, r4, 0 - mov r8, r7 - ldr r6, _0801D2BC - mov r9, r6 - movs r3, 0 - movs r2, 0x3 -_0801D29C: - mov r0, r8 - ldr r1, [r0] - adds r1, r3 - adds r1, 0xB8 - mov r0, r9 - ldm r0!, {r4-r6} - stm r1!, {r4-r6} - ldm r0!, {r4-r6} - stm r1!, {r4-r6} - movs r0, 0x18 - add r9, r0 - adds r3, 0x18 - subs r2, 0x1 - cmp r2, 0 - bge _0801D29C - b _0801D34E - .align 2, 0 -_0801D2BC: .4byte gUnknown_80DBEB0 -_0801D2C0: - bl sub_801D4C0 - ldr r0, [r4] - ldr r0, [r0] - cmp r0, 0 - beq _0801D324 - adds r7, r4, 0 - ldr r2, _0801D31C - mov r9, r2 - mov r8, r7 - ldr r3, _0801D320 - mov r12, r3 - movs r3, 0 - movs r2, 0x3 -_0801D2DC: - mov r4, r8 - ldr r1, [r4] - adds r1, r3 - adds r1, 0xB8 - mov r0, r12 - ldm r0!, {r4-r6} - stm r1!, {r4-r6} - ldm r0!, {r4-r6} - stm r1!, {r4-r6} - adds r3, 0x18 - subs r2, 0x1 - cmp r2, 0 - bge _0801D2DC -_0801D2F6: - ldr r1, [r7] - adds r1, 0xB8 - mov r0, r9 - ldm r0!, {r2,r5,r6} - stm r1!, {r2,r5,r6} - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldr r1, [r7] - adds r0, r1, 0 - adds r0, 0xB8 - adds r1, 0x68 - bl sub_8012CAC - ldr r0, [r7] - adds r0, 0xC4 - movs r1, 0x9 - strh r1, [r0] - b _0801D384 - .align 2, 0 -_0801D31C: .4byte gUnknown_80DBE98 -_0801D320: .4byte gUnknown_80DBE7C -_0801D324: - adds r7, r4, 0 - mov r8, r7 - ldr r6, _0801D364 - mov r9, r6 - movs r3, 0 - movs r2, 0x3 -_0801D330: - mov r0, r8 - ldr r1, [r0] - adds r1, r3 - adds r1, 0xB8 - mov r0, r9 - ldm r0!, {r4-r6} - stm r1!, {r4-r6} - ldm r0!, {r4-r6} - stm r1!, {r4-r6} - movs r0, 0x18 - add r9, r0 - adds r3, 0x18 - subs r2, 0x1 - cmp r2, 0 - bge _0801D330 -_0801D34E: - ldr r1, [r7] - adds r0, r1, 0 - adds r0, 0xB8 - adds r1, 0x68 - bl sub_8012CAC - ldr r0, [r7] - adds r0, 0xC4 - movs r1, 0x8 - strh r1, [r0] - b _0801D384 - .align 2, 0 -_0801D364: .4byte gUnknown_80DBEB0 -_0801D368: - ldr r0, [r7] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 3 - adds r0, r1 - adds r0, 0xB8 - adds r1, r3, 0 - ldm r1!, {r4-r6} - stm r0!, {r4-r6} - ldm r1!, {r4-r6} - stm r0!, {r4-r6} - adds r2, 0x1 - cmp r2, 0x3 - ble _0801D368 -_0801D384: - bl ResetUnusedInputStruct - ldr r0, _0801D3A4 - ldr r0, [r0] - adds r0, 0xB8 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0801D3A4: .4byte gUnknown_203B250 - thumb_func_end sub_801D220 - - .align 2,0 diff --git a/asm/debug_menu_1.s b/asm/debug_menu_1.s deleted file mode 100644 index 82f71635..00000000 --- a/asm/debug_menu_1.s +++ /dev/null @@ -1,57 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start sub_803ABC8 -sub_803ABC8: - push {r4-r6,lr} - movs r5, 0 - movs r6, 0x1 -_0803ABCE: - ldr r2, _0803AC08 - movs r0, 0x58 - adds r1, r5, 0 - muls r1, r0 - ldr r0, [r2] - adds r2, r0, r1 - ldrh r1, [r2] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _0803AC10 - lsrs r0, r1, 1 - ands r0, r6 - cmp r0, 0 - beq _0803AC10 - ldr r0, _0803AC0C - ldr r4, [r0] - movs r1, 0x8 - ldrsh r0, [r2, r1] - bl GetFriendArea - ldrb r1, [r4, 0x4] - lsls r0, 24 - lsrs r0, 24 - cmp r1, r0 - bne _0803AC10 - movs r0, 0 - b _0803AC1C - .align 2, 0 -_0803AC08: .4byte gRecruitedPokemonRef -_0803AC0C: .4byte gUnknown_203B3F4 -_0803AC10: - adds r5, 0x1 - movs r0, 0xCE - lsls r0, 1 - cmp r5, r0 - ble _0803ABCE - movs r0, 0x1 -_0803AC1C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_803ABC8 - - .align 2,0 diff --git a/asm/text.s b/asm/text.s index e444bc20..52f0074c 100644 --- a/asm/text.s +++ b/asm/text.s @@ -5,3099 +5,6 @@ .text - thumb_func_start sub_800677C -sub_800677C: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r6, r0, 0 - adds r4, r1, 0 - str r2, [sp] - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - movs r1, 0 - ldrsh r0, [r6, r1] - subs r3, r0, 0x1 - cmp r4, 0x1C - ble _080067A0 - b _080069AE -_080067A0: - cmp r4, 0 - bge _080067A6 - b _080069AE -_080067A6: - ldr r0, [r6, 0xC] - cmp r0, 0x7 - bls _080067AE - b _080069AE -_080067AE: - lsls r0, 2 - ldr r1, _080067B8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_080067B8: .4byte _080067BC - .align 2, 0 -_080067BC: - .4byte _080069AE - .4byte _080069AE - .4byte _080069AE - .4byte _080067DC - .4byte _0800689C - .4byte _08006920 - .4byte _080069AE - .4byte _0800696C -_080067DC: - lsls r1, r3, 1 - lsls r2, r4, 6 - ldr r4, [sp] - adds r0, r2, r4 - adds r1, r0 - ldr r7, _08006800 - adds r0, r7, 0 - strh r0, [r1] - adds r5, r2, 0 - mov r0, r9 - cmp r0, 0 - beq _08006808 - movs r2, 0x80 - lsls r2, 4 - adds r1, r2 - ldr r4, _08006804 - adds r0, r4, 0 - b _08006812 - .align 2, 0 -_08006800: .4byte 0x0000f2d8 -_08006804: .4byte 0x0000f293 -_08006808: - movs r7, 0x80 - lsls r7, 4 - adds r1, r7 - ldr r2, _08006878 - adds r0, r2, 0 -_08006812: - strh r0, [r1] - adds r3, 0x1 - movs r4, 0 - movs r7, 0x4 - ldrsh r0, [r6, r7] - cmp r4, r0 - bge _08006856 - ldr r0, _0800687C - mov r8, r0 - lsls r0, r3, 1 - ldr r2, [sp] - movs r7, 0x80 - lsls r7, 4 - adds r1, r2, r7 - adds r1, r5, r1 - adds r2, r0, r1 - ldr r7, [sp] - adds r1, r5, r7 - adds r1, r0, r1 - ldr r0, _08006878 - mov r12, r0 -_0800683C: - mov r7, r8 - strh r7, [r1] - mov r0, r12 - strh r0, [r2] - adds r2, 0x2 - adds r1, 0x2 - adds r3, 0x1 - adds r4, 0x1 - movs r0, 0x4 - ldrsh r7, [r6, r0] - mov r10, r7 - cmp r4, r10 - blt _0800683C -_08006856: - lsls r0, r3, 1 - ldr r2, [sp] - adds r1, r5, r2 - adds r1, r0, r1 - ldr r4, _08006880 - adds r0, r4, 0 - strh r0, [r1] - mov r7, r9 - cmp r7, 0 - beq _08006888 - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - ldr r2, _08006884 - adds r0, r2, 0 - strh r0, [r1] - b _080069AE - .align 2, 0 -_08006878: .4byte 0x0000f2db -_0800687C: .4byte 0x0000f2d9 -_08006880: .4byte 0x0000f6d8 -_08006884: .4byte 0x0000f693 -_08006888: - movs r4, 0x80 - lsls r4, 4 - adds r1, r4 - ldr r7, _08006898 - adds r0, r7, 0 - strh r0, [r1] - b _080069AE - .align 2, 0 -_08006898: .4byte 0x0000f2db -_0800689C: - lsls r1, r3, 1 - lsls r2, r4, 6 - ldr r0, [sp] - adds r0, r2 - mov r12, r0 - add r1, r12 - ldr r4, _08006910 - adds r0, r4, 0 - strh r0, [r1] - movs r7, 0x80 - lsls r7, 4 - mov r8, r7 - add r1, r8 - ldr r0, _08006914 - mov r9, r0 - strh r0, [r1] - adds r3, 0x1 - movs r4, 0 - movs r1, 0x4 - ldrsh r0, [r6, r1] - adds r5, r2, 0 - cmp r4, r0 - bge _080068F6 - ldr r2, _08006918 - mov r10, r2 - lsls r1, r3, 1 - ldr r0, [sp] - add r0, r8 - adds r0, r5, r0 - adds r2, r1, r0 - add r1, r12 - mov r12, r9 -_080068DC: - mov r7, r10 - strh r7, [r1] - mov r0, r12 - strh r0, [r2] - adds r2, 0x2 - adds r1, 0x2 - adds r3, 0x1 - adds r4, 0x1 - movs r0, 0x4 - ldrsh r7, [r6, r0] - mov r8, r7 - cmp r4, r8 - blt _080068DC -_080068F6: - lsls r0, r3, 1 - ldr r2, [sp] - adds r1, r5, r2 - adds r0, r1 - ldr r4, _0800691C - adds r1, r4, 0 - strh r1, [r0] - movs r7, 0x80 - lsls r7, 4 - adds r0, r7 - ldr r2, _08006914 - adds r1, r2, 0 - b _080069AC - .align 2, 0 -_08006910: .4byte 0x0000f2e8 -_08006914: .4byte 0x0000f2db -_08006918: .4byte 0x0000f2e9 -_0800691C: .4byte 0x0000f6e8 -_08006920: - lsls r0, r3, 1 - lsls r2, r4, 6 - ldr r4, [sp] - adds r4, r2 - mov r12, r4 - add r0, r12 - ldr r7, _08006960 - adds r1, r7, 0 - strh r1, [r0] - adds r3, 0x1 - movs r1, 0x4 - ldrsh r0, [r6, r1] - adds r5, r2, 0 - cmp r0, 0 - ble _08006954 - ldr r2, _08006964 - adds r1, r2, 0 - adds r4, r0, 0 - lsls r0, r3, 1 - add r0, r12 -_08006948: - strh r1, [r0] - adds r0, 0x2 - adds r3, 0x1 - subs r4, 0x1 - cmp r4, 0 - bne _08006948 -_08006954: - lsls r0, r3, 1 - ldr r4, [sp] - adds r1, r5, r4 - adds r0, r1 - ldr r7, _08006968 - b _080069AA - .align 2, 0 -_08006960: .4byte 0x0000f2dc -_08006964: .4byte 0x0000f2dd -_08006968: .4byte 0x0000f6dc -_0800696C: - lsls r0, r3, 1 - lsls r2, r4, 6 - ldr r1, [sp] - adds r1, r2 - mov r12, r1 - add r0, r12 - ldr r4, _080069C0 - adds r1, r4, 0 - strh r1, [r0] - adds r3, 0x1 - movs r7, 0x4 - ldrsh r0, [r6, r7] - adds r5, r2, 0 - cmp r0, 0 - ble _080069A0 - ldr r2, _080069C4 - adds r1, r2, 0 - adds r4, r0, 0 - lsls r0, r3, 1 - add r0, r12 -_08006994: - strh r1, [r0] - adds r0, 0x2 - adds r3, 0x1 - subs r4, 0x1 - cmp r4, 0 - bne _08006994 -_080069A0: - lsls r0, r3, 1 - ldr r4, [sp] - adds r1, r5, r4 - adds r0, r1 - ldr r7, _080069C8 -_080069AA: - adds r1, r7, 0 -_080069AC: - strh r1, [r0] -_080069AE: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_080069C0: .4byte 0x0000f293 -_080069C4: .4byte 0x0000f297 -_080069C8: .4byte 0x0000f693 - thumb_func_end sub_800677C - - thumb_func_start sub_80069CC -sub_80069CC: - push {r4-r6,lr} - adds r6, r0, 0 - adds r4, r1, 0 - adds r5, r3, 0 - ldr r3, [sp, 0x10] - cmp r2, 0x1C - bgt _08006ABA - cmp r2, 0 - blt _08006ABA - ldr r0, [r6, 0xC] - cmp r0, 0x7 - bhi _08006ABA - lsls r0, 2 - ldr r1, _080069F0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_080069F0: .4byte _080069F4 - .align 2, 0 -_080069F4: - .4byte _08006A14 - .4byte _08006ABA - .4byte _08006ABA - .4byte _08006A60 - .4byte _08006A7C - .4byte _08006A9C - .4byte _08006A60 - .4byte _08006AAC -_08006A14: - cmp r5, 0 - bne _08006A34 - lsls r1, r4, 1 - lsls r0, r2, 6 - adds r0, r3 - adds r1, r0 - ldr r2, _08006A30 - adds r0, r2, 0 - strh r0, [r1] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - adds r2, 0x44 - b _08006A92 - .align 2, 0 -_08006A30: .4byte 0x0000f297 -_08006A34: - movs r1, 0x6 - ldrsh r0, [r6, r1] - subs r0, 0x1 - cmp r5, r0 - bne _08006A60 - lsls r1, r4, 1 - lsls r0, r2, 6 - adds r0, r3 - adds r1, r0 - ldr r2, _08006A58 - adds r0, r2, 0 - strh r0, [r1] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - ldr r2, _08006A5C - b _08006A92 - .align 2, 0 -_08006A58: .4byte 0x0000fa97 -_08006A5C: .4byte 0x0000f2db -_08006A60: - lsls r1, r4, 1 - lsls r0, r2, 6 - adds r0, r3 - adds r1, r0 - ldr r2, _08006A78 - adds r0, r2, 0 - strh r0, [r1] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - adds r2, 0x1 - b _08006A92 - .align 2, 0 -_08006A78: .4byte 0x0000f2da -_08006A7C: - lsls r1, r4, 1 - lsls r0, r2, 6 - adds r0, r3 - adds r1, r0 - ldr r2, _08006A98 - adds r0, r2, 0 - strh r0, [r1] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - subs r2, 0xF -_08006A92: - adds r0, r2, 0 - strh r0, [r1] - b _08006ABA - .align 2, 0 -_08006A98: .4byte 0x0000f2ea -_08006A9C: - lsls r0, r4, 1 - lsls r1, r2, 6 - adds r1, r3 - adds r0, r1 - ldr r2, _08006AA8 - b _08006AB6 - .align 2, 0 -_08006AA8: .4byte 0x0000f2de -_08006AAC: - lsls r0, r4, 1 - lsls r1, r2, 6 - adds r1, r3 - adds r0, r1 - ldr r2, _08006AC0 -_08006AB6: - adds r1, r2, 0 - strh r1, [r0] -_08006ABA: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_08006AC0: .4byte 0x0000f2b6 - thumb_func_end sub_80069CC - - thumb_func_start sub_8006AC4 -sub_8006AC4: - push {r4,r5,lr} - adds r4, r1, 0 - ldr r5, [sp, 0xC] - cmp r2, 0x1C - bgt _08006B64 - cmp r2, 0 - blt _08006B64 - ldr r0, [r0, 0xC] - cmp r0, 0x7 - bhi _08006B64 - lsls r0, 2 - ldr r1, _08006AE4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08006AE4: .4byte _08006AE8 - .align 2, 0 -_08006AE8: - .4byte _08006B2C - .4byte _08006B2C - .4byte _08006B08 - .4byte _08006B2C - .4byte _08006B2C - .4byte _08006B54 - .4byte _08006B2C - .4byte _08006B54 -_08006B08: - lsls r1, r4, 1 - lsls r0, r2, 6 - adds r0, r5 - adds r1, r0 - ldr r2, _08006B24 - adds r0, r2, 0 - orrs r3, r0 - strh r3, [r1] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - ldr r2, _08006B28 - b _08006B44 - .align 2, 0 -_08006B24: .4byte 0xfffff000 -_08006B28: .4byte 0x0000f278 -_08006B2C: - lsls r1, r4, 1 - lsls r0, r2, 6 - adds r0, r5 - adds r1, r0 - ldr r2, _08006B4C - adds r0, r2, 0 - orrs r3, r0 - strh r3, [r1] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - ldr r2, _08006B50 -_08006B44: - adds r0, r2, 0 - strh r0, [r1] - b _08006B64 - .align 2, 0 -_08006B4C: .4byte 0xfffff000 -_08006B50: .4byte 0x0000f2db -_08006B54: - lsls r0, r4, 1 - lsls r1, r2, 6 - adds r1, r5 - adds r0, r1 - ldr r2, _08006B6C - adds r1, r2, 0 - orrs r3, r1 - strh r3, [r0] -_08006B64: - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_08006B6C: .4byte 0xfffff000 - thumb_func_end sub_8006AC4 - - thumb_func_start sub_8006B70 -sub_8006B70: - push {r4-r6,lr} - adds r6, r0, 0 - adds r4, r1, 0 - adds r5, r3, 0 - ldr r3, [sp, 0x10] - cmp r2, 0x1C - bgt _08006C3A - cmp r2, 0 - blt _08006C3A - ldr r0, [r6, 0xC] - cmp r0, 0x7 - bhi _08006C3A - lsls r0, 2 - ldr r1, _08006B94 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08006B94: .4byte _08006B98 - .align 2, 0 -_08006B98: - .4byte _08006BB8 - .4byte _08006C3A - .4byte _08006C3A - .4byte _08006BE8 - .4byte _08006BF8 - .4byte _08006C1C - .4byte _08006BE8 - .4byte _08006C2C -_08006BB8: - cmp r5, 0 - bne _08006BCC - lsls r1, r4, 1 - lsls r0, r2, 6 - adds r0, r3 - adds r1, r0 - ldr r2, _08006BC8 - b _08006C02 - .align 2, 0 -_08006BC8: .4byte 0x0000f697 -_08006BCC: - movs r1, 0x6 - ldrsh r0, [r6, r1] - subs r0, 0x1 - cmp r5, r0 - bne _08006BE8 - lsls r1, r4, 1 - lsls r0, r2, 6 - adds r0, r3 - adds r1, r0 - ldr r2, _08006BE4 - b _08006C02 - .align 2, 0 -_08006BE4: .4byte 0x0000fe97 -_08006BE8: - lsls r1, r4, 1 - lsls r0, r2, 6 - adds r0, r3 - adds r1, r0 - ldr r2, _08006BF4 - b _08006C02 - .align 2, 0 -_08006BF4: .4byte 0x0000f6da -_08006BF8: - lsls r1, r4, 1 - lsls r0, r2, 6 - adds r0, r3 - adds r1, r0 - ldr r2, _08006C14 -_08006C02: - adds r0, r2, 0 - strh r0, [r1] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - ldr r2, _08006C18 - adds r0, r2, 0 - strh r0, [r1] - b _08006C3A - .align 2, 0 -_08006C14: .4byte 0x0000f6ea -_08006C18: .4byte 0x0000f2db -_08006C1C: - lsls r0, r4, 1 - lsls r1, r2, 6 - adds r1, r3 - adds r0, r1 - ldr r2, _08006C28 - b _08006C36 - .align 2, 0 -_08006C28: .4byte 0x0000f6de -_08006C2C: - lsls r0, r4, 1 - lsls r1, r2, 6 - adds r1, r3 - adds r0, r1 - ldr r2, _08006C40 -_08006C36: - adds r1, r2, 0 - strh r1, [r0] -_08006C3A: - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_08006C40: .4byte 0x0000f6b6 - thumb_func_end sub_8006B70 - - thumb_func_start sub_8006C44 -sub_8006C44: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r6, r0, 0 - adds r4, r1, 0 - str r2, [sp] - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - movs r1, 0 - ldrsh r0, [r6, r1] - subs r3, r0, 0x1 - cmp r4, 0x1C - ble _08006C68 - b _08006E76 -_08006C68: - cmp r4, 0 - bge _08006C6E - b _08006E76 -_08006C6E: - ldr r0, [r6, 0xC] - cmp r0, 0x7 - bls _08006C76 - b _08006E76 -_08006C76: - lsls r0, 2 - ldr r1, _08006C80 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08006C80: .4byte _08006C84 - .align 2, 0 -_08006C84: - .4byte _08006E76 - .4byte _08006E76 - .4byte _08006E76 - .4byte _08006CA4 - .4byte _08006D64 - .4byte _08006DE8 - .4byte _08006CA4 - .4byte _08006E34 -_08006CA4: - lsls r1, r3, 1 - lsls r2, r4, 6 - ldr r4, [sp] - adds r0, r2, r4 - adds r1, r0 - ldr r7, _08006CC8 - adds r0, r7, 0 - strh r0, [r1] - adds r5, r2, 0 - mov r0, r9 - cmp r0, 0 - beq _08006CD0 - movs r2, 0x80 - lsls r2, 4 - adds r1, r2 - ldr r4, _08006CCC - adds r0, r4, 0 - b _08006CDA - .align 2, 0 -_08006CC8: .4byte 0x0000fad8 -_08006CCC: .4byte 0x0000fa93 -_08006CD0: - movs r7, 0x80 - lsls r7, 4 - adds r1, r7 - ldr r2, _08006D40 - adds r0, r2, 0 -_08006CDA: - strh r0, [r1] - adds r3, 0x1 - movs r4, 0 - movs r7, 0x4 - ldrsh r0, [r6, r7] - cmp r4, r0 - bge _08006D1E - ldr r0, _08006D44 - mov r8, r0 - lsls r0, r3, 1 - ldr r2, [sp] - movs r7, 0x80 - lsls r7, 4 - adds r1, r2, r7 - adds r1, r5, r1 - adds r2, r0, r1 - ldr r7, [sp] - adds r1, r5, r7 - adds r1, r0, r1 - ldr r0, _08006D40 - mov r12, r0 -_08006D04: - mov r7, r8 - strh r7, [r1] - mov r0, r12 - strh r0, [r2] - adds r2, 0x2 - adds r1, 0x2 - adds r3, 0x1 - adds r4, 0x1 - movs r0, 0x4 - ldrsh r7, [r6, r0] - mov r10, r7 - cmp r4, r10 - blt _08006D04 -_08006D1E: - lsls r0, r3, 1 - ldr r2, [sp] - adds r1, r5, r2 - adds r1, r0, r1 - ldr r4, _08006D48 - adds r0, r4, 0 - strh r0, [r1] - mov r7, r9 - cmp r7, 0 - beq _08006D50 - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - ldr r2, _08006D4C - adds r0, r2, 0 - strh r0, [r1] - b _08006E76 - .align 2, 0 -_08006D40: .4byte 0x0000f2db -_08006D44: .4byte 0x0000fad9 -_08006D48: .4byte 0x0000fed8 -_08006D4C: .4byte 0x0000fe93 -_08006D50: - movs r4, 0x80 - lsls r4, 4 - adds r1, r4 - ldr r7, _08006D60 - adds r0, r7, 0 - strh r0, [r1] - b _08006E76 - .align 2, 0 -_08006D60: .4byte 0x0000f2db -_08006D64: - lsls r1, r3, 1 - lsls r2, r4, 6 - ldr r0, [sp] - adds r0, r2 - mov r12, r0 - add r1, r12 - ldr r4, _08006DD8 - adds r0, r4, 0 - strh r0, [r1] - movs r7, 0x80 - lsls r7, 4 - mov r8, r7 - add r1, r8 - ldr r0, _08006DDC - mov r9, r0 - strh r0, [r1] - adds r3, 0x1 - movs r4, 0 - movs r1, 0x4 - ldrsh r0, [r6, r1] - adds r5, r2, 0 - cmp r4, r0 - bge _08006DBE - ldr r2, _08006DE0 - mov r10, r2 - lsls r1, r3, 1 - ldr r0, [sp] - add r0, r8 - adds r0, r5, r0 - adds r2, r1, r0 - add r1, r12 - mov r12, r9 -_08006DA4: - mov r7, r10 - strh r7, [r1] - mov r0, r12 - strh r0, [r2] - adds r2, 0x2 - adds r1, 0x2 - adds r3, 0x1 - adds r4, 0x1 - movs r0, 0x4 - ldrsh r7, [r6, r0] - mov r8, r7 - cmp r4, r8 - blt _08006DA4 -_08006DBE: - lsls r0, r3, 1 - ldr r2, [sp] - adds r1, r5, r2 - adds r0, r1 - ldr r4, _08006DE4 - adds r1, r4, 0 - strh r1, [r0] - movs r7, 0x80 - lsls r7, 4 - adds r0, r7 - ldr r2, _08006DDC - adds r1, r2, 0 - b _08006E74 - .align 2, 0 -_08006DD8: .4byte 0x0000fae8 -_08006DDC: .4byte 0x0000f2db -_08006DE0: .4byte 0x0000fae9 -_08006DE4: .4byte 0x0000fee8 -_08006DE8: - lsls r0, r3, 1 - lsls r2, r4, 6 - ldr r4, [sp] - adds r4, r2 - mov r12, r4 - add r0, r12 - ldr r7, _08006E28 - adds r1, r7, 0 - strh r1, [r0] - adds r3, 0x1 - movs r1, 0x4 - ldrsh r0, [r6, r1] - adds r5, r2, 0 - cmp r0, 0 - ble _08006E1C - ldr r2, _08006E2C - adds r1, r2, 0 - adds r4, r0, 0 - lsls r0, r3, 1 - add r0, r12 -_08006E10: - strh r1, [r0] - adds r0, 0x2 - adds r3, 0x1 - subs r4, 0x1 - cmp r4, 0 - bne _08006E10 -_08006E1C: - lsls r0, r3, 1 - ldr r4, [sp] - adds r1, r5, r4 - adds r0, r1 - ldr r7, _08006E30 - b _08006E72 - .align 2, 0 -_08006E28: .4byte 0x0000fadc -_08006E2C: .4byte 0x0000fadd -_08006E30: .4byte 0x0000fedc -_08006E34: - lsls r0, r3, 1 - lsls r2, r4, 6 - ldr r1, [sp] - adds r1, r2 - mov r12, r1 - add r0, r12 - ldr r4, _08006E88 - adds r1, r4, 0 - strh r1, [r0] - adds r3, 0x1 - movs r7, 0x4 - ldrsh r0, [r6, r7] - adds r5, r2, 0 - cmp r0, 0 - ble _08006E68 - ldr r2, _08006E8C - adds r1, r2, 0 - adds r4, r0, 0 - lsls r0, r3, 1 - add r0, r12 -_08006E5C: - strh r1, [r0] - adds r0, 0x2 - adds r3, 0x1 - subs r4, 0x1 - cmp r4, 0 - bne _08006E5C -_08006E68: - lsls r0, r3, 1 - ldr r4, [sp] - adds r1, r5, r4 - adds r0, r1 - ldr r7, _08006E90 -_08006E72: - adds r1, r7, 0 -_08006E74: - strh r1, [r0] -_08006E76: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08006E88: .4byte 0x0000fa93 -_08006E8C: .4byte 0x0000fa97 -_08006E90: .4byte 0x0000fe93 - thumb_func_end sub_8006C44 - - thumb_func_start sub_8006E94 -sub_8006E94: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x30 - str r0, [sp] - adds r4, r1, 0 - adds r7, r2, 0 - str r3, [sp, 0x4] - movs r1, 0 - ldrsh r0, [r0, r1] - mov r10, r0 - movs r2, 0x1 - negs r2, r2 - add r2, r10 - movs r3, 0 - str r3, [sp, 0x8] - cmp r4, 0x1C - ble _08006EBE - b _080072FE -_08006EBE: - cmp r4, 0 - bge _08006EC4 - b _080072FE -_08006EC4: - lsls r1, r2, 1 - lsls r4, 6 - ldr r6, [sp, 0x50] - adds r5, r4, r6 - adds r1, r5 - ldr r0, _08006F9C - adds r3, r0, 0 - strh r3, [r1] - movs r2, 0x80 - lsls r2, 4 - adds r0, r1, r2 - ldr r6, _08006FA0 - adds r2, r6, 0 - strh r2, [r0] - adds r0, r1, 0 - adds r0, 0x40 - strh r3, [r0] - movs r0, 0x84 - lsls r0, 4 - adds r0, r1, r0 - strh r2, [r0] - adds r2, r1, 0 - adds r2, 0x80 - ldr r3, _08006FA4 - adds r0, r3, 0 - strh r0, [r2] - movs r6, 0x88 - lsls r6, 4 - adds r1, r6 - ldr r2, _08006FA8 - adds r0, r2, 0 - strh r0, [r1] - mov r12, r10 - movs r3, 0 - str r4, [sp, 0x18] - ldr r4, [sp, 0x4] - ldrb r4, [r4] - cmp r3, r4 - blt _08006F14 - b _08007238 -_08006F14: - adds r2, r5, 0 - mov r5, r12 - lsls r1, r5, 1 - ldr r0, [sp, 0x50] - adds r0, 0x80 - ldr r6, [sp, 0x18] - adds r0, r6, r0 - adds r0, r1 - mov r9, r0 - ldr r0, [sp, 0x50] - adds r0, 0x40 - adds r0, r6, r0 - adds r0, r1 - mov r8, r0 - ldr r4, [sp, 0x50] - movs r5, 0x80 - lsls r5, 4 - adds r0, r4, r5 - adds r0, r6, r0 - adds r0, r1, r0 - str r0, [sp, 0x20] - movs r6, 0x84 - lsls r6, 4 - adds r0, r4, r6 - ldr r4, [sp, 0x18] - adds r0, r4, r0 - adds r0, r1 - mov r10, r0 - adds r4, r1, r2 - ldr r5, [sp, 0x18] - str r5, [sp, 0x10] - str r2, [sp, 0x1C] - str r1, [sp, 0x24] -_08006F56: - ldr r6, [sp, 0x4] - ldrb r6, [r6, 0x1] - cmp r3, r6 - bne _08006F60 - b _080070C8 -_08006F60: - ldr r0, [sp, 0x8] - cmp r0, 0 - bne _08007008 - ldr r1, [sp, 0x4] - ldrb r0, [r1, 0x3] - asrs r0, r3 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08006FB8 - movs r1, 0x1F - cmp r3, 0 - bne _08006F7C - movs r1, 0x1B -_08006F7C: - movs r2, 0x9E - lsls r2, 2 - adds r0, r1, r2 - ldr r5, _08006FAC - adds r1, r5, 0 - orrs r0, r1 - strh r0, [r4] - ldr r6, _08006FB0 - adds r0, r6, 0 - mov r1, r8 - strh r0, [r1] - ldr r5, _08006FB4 - mov r2, r9 - strh r5, [r2] - b _08006FDC - .align 2, 0 -_08006F9C: .4byte 0x0000f278 -_08006FA0: .4byte 0x0000f27a -_08006FA4: .4byte 0x0000f2d8 -_08006FA8: .4byte 0x0000f2db -_08006FAC: .4byte 0xfffff400 -_08006FB0: .4byte 0x0000f2b6 -_08006FB4: .4byte 0x0000f2d9 -_08006FB8: - movs r1, 0x6B - cmp r3, 0 - bne _08006FC0 - movs r1, 0x67 -_08006FC0: - movs r6, 0x9E - lsls r6, 2 - adds r0, r1, r6 - ldr r2, _08006FF4 - adds r1, r2, 0 - orrs r0, r1 - strh r0, [r4] - ldr r5, _08006FF8 - adds r0, r5, 0 - mov r6, r8 - strh r0, [r6] - ldr r1, _08006FFC - mov r0, r9 - strh r1, [r0] -_08006FDC: - ldr r2, _08007000 - adds r0, r2, 0 - ldr r5, [sp, 0x20] - strh r0, [r5] - ldr r0, _08007004 - mov r6, r10 - strh r0, [r6] - movs r1, 0x88 - lsls r1, 4 - adds r0, r4, r1 - adds r2, 0x61 - b _0800708E - .align 2, 0 -_08006FF4: .4byte 0xfffff400 -_08006FF8: .4byte 0x0000f2ef -_08006FFC: .4byte 0x0000f2d9 -_08007000: .4byte 0x0000f27a -_08007004: .4byte 0x0000f2db -_08007008: - ldr r5, [sp, 0x4] - ldrb r0, [r5, 0x3] - asrs r0, r3 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0800704C - ldrb r0, [r5] - subs r0, 0x1 - movs r1, 0x1F - cmp r3, r0 - bne _08007022 - movs r1, 0x1B -_08007022: - movs r6, 0x9E - lsls r6, 2 - adds r0, r1, r6 - ldr r2, _08007040 - adds r1, r2, 0 - orrs r0, r1 - strh r0, [r4] - ldr r5, _08007044 - adds r0, r5, 0 - mov r6, r8 - strh r0, [r6] - ldr r1, _08007048 - mov r0, r9 - strh r1, [r0] - b _08007076 - .align 2, 0 -_08007040: .4byte 0xfffff000 -_08007044: .4byte 0x0000f6b6 -_08007048: .4byte 0x0000f2d9 -_0800704C: - ldr r2, [sp, 0x4] - ldrb r0, [r2] - subs r0, 0x1 - movs r1, 0x6B - cmp r3, r0 - bne _0800705A - movs r1, 0x67 -_0800705A: - movs r5, 0x9E - lsls r5, 2 - adds r0, r1, r5 - ldr r6, _080070B0 - adds r1, r6, 0 - orrs r0, r1 - strh r0, [r4] - ldr r1, _080070B4 - adds r0, r1, 0 - mov r2, r8 - strh r0, [r2] - ldr r6, _080070B8 - mov r5, r9 - strh r6, [r5] -_08007076: - ldr r1, _080070BC - adds r0, r1, 0 - ldr r2, [sp, 0x20] - strh r0, [r2] - ldr r5, _080070C0 - adds r0, r5, 0 - mov r6, r10 - strh r0, [r6] - movs r1, 0x88 - lsls r1, 4 - adds r0, r4, r1 - ldr r2, _080070C4 -_0800708E: - strh r2, [r0] - movs r5, 0x2 - add r9, r5 - add r8, r5 - ldr r6, [sp, 0x20] - adds r6, 0x2 - str r6, [sp, 0x20] - add r10, r5 - adds r4, 0x2 - ldr r0, [sp, 0x24] - adds r0, 0x2 - str r0, [sp, 0x24] - movs r1, 0x1 - add r12, r1 - adds r3, 0x1 - str r3, [sp, 0x14] - b _08007226 - .align 2, 0 -_080070B0: .4byte 0xfffff000 -_080070B4: .4byte 0x0000f6ef -_080070B8: .4byte 0x0000f2d9 -_080070BC: .4byte 0x0000f27a -_080070C0: .4byte 0x0000f6db -_080070C4: .4byte 0x0000f2db -_080070C8: - movs r2, 0x1 - str r2, [sp, 0x8] - ldr r5, _08007128 - adds r0, r5, 0 - strh r0, [r4] - ldr r6, _0800712C - adds r0, r6, 0 - ldr r1, [sp, 0x20] - strh r0, [r1] - ldr r2, _08007130 - adds r0, r2, 0 - mov r5, r8 - strh r0, [r5] - ldr r0, _08007134 - mov r6, r10 - strh r0, [r6] - ldr r1, _08007138 - adds r0, r1, 0 - mov r2, r9 - strh r0, [r2] - movs r5, 0x88 - lsls r5, 4 - adds r0, r4, r5 - ldr r6, _08007134 - strh r6, [r0] - movs r0, 0x2 - add r9, r0 - add r8, r0 - ldr r1, [sp, 0x20] - adds r1, 0x2 - str r1, [sp, 0x20] - add r10, r0 - adds r4, 0x2 - ldr r2, [sp, 0x24] - adds r2, 0x2 - str r2, [sp, 0x24] - movs r5, 0x1 - add r12, r5 - cmp r7, 0 - beq _0800713C - adds r7, 0x1 - cmp r7, 0 - beq _0800713C - ldr r6, [sp] - movs r1, 0x4 - ldrsh r0, [r6, r1] - adds r2, r7, r0 - b _0800713E - .align 2, 0 -_08007128: .4byte 0x0000f2e0 -_0800712C: .4byte 0x0000f2e2 -_08007130: .4byte 0x0000f2da -_08007134: .4byte 0x0000f2db -_08007138: .4byte 0x0000f6e7 -_0800713C: - movs r2, 0 -_0800713E: - movs r5, 0 - str r5, [sp, 0xC] - adds r3, 0x1 - str r3, [sp, 0x14] - ldr r6, [sp, 0x4] - ldrb r6, [r6, 0x2] - cmp r5, r6 - bge _080071E0 - ldr r0, [sp, 0x50] - adds r0, 0x80 - ldr r1, [sp, 0x10] - adds r0, r1, r0 - ldr r3, [sp, 0x24] - adds r0, r3, r0 - str r0, [sp, 0x2C] - ldr r0, [sp, 0x50] - adds r0, 0x40 - adds r0, r1, r0 - adds r5, r3, r0 - ldr r6, [sp, 0x1C] - adds r3, r6 -_08007168: - ldr r1, _08007310 - adds r0, r1, 0 - strh r0, [r3] - movs r6, 0x80 - lsls r6, 4 - adds r6, r3, r6 - str r6, [sp, 0x28] - adds r1, 0x1 - adds r0, r1, 0 - strh r0, [r6] - adds r0, r7, 0 - ldr r6, _08007314 - orrs r0, r6 - strh r0, [r5] - movs r1, 0x84 - lsls r1, 4 - adds r0, r3, r1 - ldr r6, _08007318 - strh r6, [r0] - adds r0, r2, 0 - ldr r1, _08007314 - orrs r0, r1 - ldr r6, [sp, 0x2C] - strh r0, [r6] - movs r1, 0x88 - lsls r1, 4 - adds r0, r3, r1 - ldr r6, _08007318 - strh r6, [r0] - ldr r0, [sp, 0x2C] - adds r0, 0x2 - str r0, [sp, 0x2C] - adds r5, 0x2 - adds r3, 0x2 - movs r1, 0x2 - add r9, r1 - add r8, r1 - ldr r6, [sp, 0x20] - adds r6, 0x2 - str r6, [sp, 0x20] - add r10, r1 - adds r4, 0x2 - ldr r0, [sp, 0x24] - adds r0, 0x2 - str r0, [sp, 0x24] - movs r1, 0x1 - add r12, r1 - cmp r7, 0 - beq _080071CC - adds r7, 0x1 -_080071CC: - cmp r2, 0 - beq _080071D2 - adds r2, 0x1 -_080071D2: - ldr r6, [sp, 0xC] - adds r6, 0x1 - str r6, [sp, 0xC] - ldr r0, [sp, 0x4] - ldrb r0, [r0, 0x2] - cmp r6, r0 - blt _08007168 -_080071E0: - ldr r1, _0800731C - adds r0, r1, 0 - strh r0, [r4] - ldr r2, _08007320 - adds r0, r2, 0 - ldr r3, [sp, 0x20] - strh r0, [r3] - ldr r5, _08007324 - adds r0, r5, 0 - mov r6, r8 - strh r0, [r6] - ldr r1, _08007318 - mov r0, r10 - strh r1, [r0] - adds r2, 0x5 - adds r0, r2, 0 - mov r3, r9 - strh r0, [r3] - movs r5, 0x88 - lsls r5, 4 - adds r0, r4, r5 - strh r1, [r0] - movs r6, 0x2 - add r9, r6 - add r8, r6 - ldr r0, [sp, 0x20] - adds r0, 0x2 - str r0, [sp, 0x20] - add r10, r6 - adds r4, 0x2 - ldr r1, [sp, 0x24] - adds r1, 0x2 - str r1, [sp, 0x24] - movs r2, 0x1 - add r12, r2 -_08007226: - cmp r7, 0 - beq _0800722C - adds r7, 0x1 -_0800722C: - ldr r3, [sp, 0x14] - ldr r5, [sp, 0x4] - ldrb r5, [r5] - cmp r3, r5 - bge _08007238 - b _08006F56 -_08007238: - ldr r6, [sp] - movs r0, 0 - ldrsh r1, [r6, r0] - movs r2, 0x4 - ldrsh r0, [r6, r2] - adds r0, r1, r0 - cmp r12, r0 - bge _080072BC - ldr r3, _08007328 - adds r4, r3, 0 - mov r8, r0 - mov r5, r12 - lsls r1, r5, 1 - ldr r0, [sp, 0x50] - adds r0, 0x80 - ldr r6, [sp, 0x18] - adds r0, r6, r0 - adds r5, r1, r0 - ldr r0, [sp, 0x50] - adds r0, 0x40 - adds r0, r6, r0 - adds r3, r1, r0 - ldr r0, [sp, 0x50] - adds r6, r0 - adds r2, r1, r6 - movs r1, 0x80 - lsls r1, 4 - mov r10, r1 - movs r6, 0x84 - lsls r6, 4 - mov r9, r6 - mov r0, r8 - mov r1, r12 - subs r0, r1 - mov r12, r0 -_0800727E: - strh r4, [r2] - mov r6, r10 - adds r0, r2, r6 - ldr r1, _0800732C - strh r1, [r0] - strh r4, [r3] - mov r6, r9 - adds r0, r2, r6 - strh r1, [r0] - adds r1, 0x5F - adds r0, r1, 0 - strh r0, [r5] - movs r6, 0x88 - lsls r6, 4 - adds r1, r2, r6 - ldr r6, _08007318 - adds r0, r6, 0 - strh r0, [r1] - adds r5, 0x2 - adds r3, 0x2 - adds r2, 0x2 - movs r0, 0x1 - negs r0, r0 - add r12, r0 - cmp r7, 0 - beq _080072B4 - adds r7, 0x1 -_080072B4: - mov r1, r12 - cmp r1, 0 - bne _0800727E - mov r12, r8 -_080072BC: - mov r2, r12 - lsls r1, r2, 1 - ldr r3, [sp, 0x18] - ldr r4, [sp, 0x50] - adds r0, r3, r4 - adds r1, r0 - ldr r5, _08007328 - adds r3, r5, 0 - strh r3, [r1] - movs r6, 0x80 - lsls r6, 4 - adds r0, r1, r6 - ldr r4, _0800732C - adds r2, r4, 0 - strh r2, [r0] - adds r0, r1, 0 - adds r0, 0x40 - strh r3, [r0] - movs r5, 0x84 - lsls r5, 4 - adds r0, r1, r5 - strh r2, [r0] - adds r2, r1, 0 - adds r2, 0x80 - ldr r6, _08007330 - adds r0, r6, 0 - strh r0, [r2] - movs r0, 0x88 - lsls r0, 4 - adds r1, r0 - ldr r2, _08007318 - adds r0, r2, 0 - strh r0, [r1] -_080072FE: - add sp, 0x30 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08007310: .4byte 0x0000f2e1 -_08007314: .4byte 0xfffff000 -_08007318: .4byte 0x0000f2db -_0800731C: .4byte 0x0000f6e0 -_08007320: .4byte 0x0000f2e2 -_08007324: .4byte 0x0000f6da -_08007328: .4byte 0x0000f278 -_0800732C: .4byte 0x0000f27a -_08007330: .4byte 0x0000f6d8 - thumb_func_end sub_8006E94 - - thumb_func_start sub_8007334 -sub_8007334: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 3 - ldr r0, _080073AC - adds r3, r1, r0 - ldr r5, [r3, 0x14] - movs r0, 0x2 - ldrsh r6, [r3, r0] - movs r2, 0 - movs r1, 0x6 - ldrsh r0, [r3, r1] - cmp r2, r0 - bge _080073A0 - ldr r7, _080073B0 - mov r9, r7 -_0800735A: - movs r0, 0 - ldrsh r1, [r3, r0] - movs r4, 0 - movs r7, 0x4 - ldrsh r0, [r3, r7] - adds r7, r6, 0x1 - adds r2, 0x1 - mov r12, r2 - cmp r4, r0 - bge _08007394 - movs r0, 0xFC - lsls r0, 8 - mov r8, r0 - lsls r1, 1 - lsls r0, r6, 6 - add r0, r9 - adds r2, r1, r0 -_0800737C: - ldrh r0, [r2] - mov r1, r8 - ands r1, r0 - orrs r1, r5 - strh r1, [r2] - adds r2, 0x2 - adds r5, 0x1 - adds r4, 0x1 - movs r1, 0x4 - ldrsh r0, [r3, r1] - cmp r4, r0 - blt _0800737C -_08007394: - adds r6, r7, 0 - mov r2, r12 - movs r7, 0x6 - ldrsh r0, [r3, r7] - cmp r2, r0 - blt _0800735A -_080073A0: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_080073AC: .4byte gUnknown_2027370 -_080073B0: .4byte gUnknown_202B038 - thumb_func_end sub_8007334 - - thumb_func_start nullsub_154 -nullsub_154: - bx lr - thumb_func_end nullsub_154 - - thumb_func_start sub_80073B8 -sub_80073B8: - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 3 - ldr r0, _080073D8 - adds r1, r0 - ldr r0, [r1, 0x2C] - lsrs r0, 2 - lsls r0, 2 - ldr r2, [r1, 0x1C] - adds r0, r2, r0 - str r0, [r1, 0x3C] - str r2, [r1, 0x40] - adds r1, 0x46 - movs r0, 0x1 - strb r0, [r1] - bx lr - .align 2, 0 -_080073D8: .4byte gUnknown_2027370 - thumb_func_end sub_80073B8 - - thumb_func_start nullsub_155 -nullsub_155: - bx lr - thumb_func_end nullsub_155 - - thumb_func_start sub_80073E0 -sub_80073E0: - push {r4,lr} - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 3 - ldr r0, _08007434 - adds r3, r1, r0 - adds r0, r3, 0 - adds r0, 0x44 - ldrb r4, [r0] - cmp r4, 0 - bne _08007424 - ldr r2, [r3, 0x3C] - ldr r0, [r3, 0x1C] - subs r0, r2, r0 - asrs r0, 2 - lsls r0, 2 - ldr r1, [r3, 0x28] - adds r1, r0 - str r1, [r3, 0x30] - str r2, [r3, 0x34] - ldr r0, [r3, 0x40] - subs r0, r2 - asrs r0, 2 - adds r0, 0x1 - lsls r0, 2 - str r0, [r3, 0x38] - ldr r1, [r3, 0x2C] - cmp r0, r1 - blt _0800741C - str r1, [r3, 0x38] -_0800741C: - ldr r0, [r3, 0x38] - cmp r0, 0 - bge _08007424 - str r4, [r3, 0x38] -_08007424: - adds r1, r3, 0 - adds r1, 0x46 - movs r0, 0 - strb r0, [r1] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08007434: .4byte gUnknown_2027370 - thumb_func_end sub_80073E0 - - thumb_func_start nullsub_156 -nullsub_156: - bx lr - thumb_func_end nullsub_156 - - thumb_func_start xxx_call_draw_char -xxx_call_draw_char: - push {r4-r6,lr} - sub sp, 0x8 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r1, [sp, 0x18] - ldr r0, _08007460 - str r3, [sp] - str r1, [sp, 0x4] - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl xxx_draw_char - add sp, 0x8 - pop {r4-r6} - pop {r1} - bx r1 - .align 2, 0 -_08007460: .4byte gUnknown_2027370 - thumb_func_end xxx_call_draw_char - - thumb_func_start sub_8007464 -sub_8007464: - movs r0, 0 - bx lr - thumb_func_end sub_8007464 - - thumb_func_start xxx_draw_char -xxx_draw_char: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - adds r6, r1, 0 - mov r10, r2 - adds r4, r3, 0 - ldr r2, [sp, 0x48] - ldr r3, [sp, 0x4C] - lsls r1, r3, 3 - adds r1, r3 - lsls r1, 3 - adds r5, r0, r1 - ldr r1, _080074B8 - movs r0, 0xF - ands r2, r0 - lsls r2, 2 - adds r2, r1 - ldr r2, [r2] - str r2, [sp, 0x18] - ldr r0, _080074BC - ldr r0, [r0] - cmp r0, 0x1 - bne _080074CC - cmp r4, 0x70 - beq _080074B0 - cmp r4, 0x6A - beq _080074B0 - cmp r4, 0x71 - beq _080074B0 - cmp r4, 0x79 - beq _080074B0 - cmp r4, 0x67 - bne _080074C0 -_080074B0: - movs r0, 0x2 - add r10, r0 - b _080074CC - .align 2, 0 -_080074B8: .4byte gUnknown_80B853C -_080074BC: .4byte gCurrentCharmap -_080074C0: - ldr r0, _080074F8 - cmp r4, r0 - bne _080074CC - movs r1, 0x2 - negs r1, r1 - add r10, r1 -_080074CC: - adds r0, r4, 0 - bl GetCharacter - str r0, [sp] - ldr r2, [r0] - str r2, [sp, 0x4] - str r2, [sp, 0xC] - adds r3, r2, 0 - subs r3, 0x6 - str r3, [sp, 0x8] - ldr r0, _080074FC - ldrb r0, [r0] - cmp r0, 0 - beq _08007500 - ldr r4, [sp] - ldrb r1, [r4, 0xA] - lsrs r7, r1, 1 - movs r0, 0x1 - adds r2, r7, 0 - ands r2, r0 - str r2, [sp, 0x1C] - b _08007508 - .align 2, 0 -_080074F8: .4byte 0x00008199 -_080074FC: .4byte gUnknown_202B034 -_08007500: - movs r3, 0 - str r3, [sp, 0x1C] - ldr r4, [sp] - ldrb r1, [r4, 0xA] -_08007508: - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08007512 - b _08007670 -_08007512: - mov r0, r10 - cmp r0, 0 - bge _0800751A - adds r0, 0x7 -_0800751A: - asrs r4, r0, 3 - movs r7, 0x4 - ldrsh r0, [r5, r7] - muls r0, r4 - adds r2, r6, 0 - cmp r6, 0 - bge _0800752A - adds r2, r6, 0x7 -_0800752A: - asrs r2, 3 - adds r0, r2 - lsls r0, 5 - ldr r1, [r5, 0x18] - adds r3, r1, r0 - lsls r0, r4, 3 - mov r1, r10 - subs r0, r1, r0 - lsls r0, 2 - adds r3, r0 - lsls r0, r2, 3 - subs r0, r6, r0 - lsls r0, 4 - ldr r1, _08007664 - adds r0, r1 - mov r12, r0 - mov r9, r2 - str r4, [sp, 0x14] - movs r2, 0x8 - ldrsh r0, [r5, r2] - cmp r4, r0 - blt _08007558 - b _0800786C -_08007558: - movs r4, 0 - str r4, [sp, 0x10] - ldr r2, _08007668 - ldr r1, _0800766C - ldr r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - cmp r4, r0 - blt _0800756E - b _0800786C -_0800756E: - adds r4, r2, 0 -_08007570: - ldr r6, [sp, 0x4] - ldrh r0, [r6, 0x2] - lsls r2, r0, 16 - ldrh r0, [r6] - orrs r2, r0 - cmp r2, 0 - beq _080075CC - movs r7, 0x4 - ldrsh r0, [r5, r7] - cmp r9, r0 - bge _080075A6 - mov r0, r12 - ldr r1, [r0] - ands r1, r2 - ldr r0, [r0, 0x8] - lsls r1, r0 - ldr r0, [r3] - orrs r0, r1 - str r0, [r3] - ldr r0, [r5, 0x3C] - cmp r0, r3 - bls _0800759E - str r3, [r5, 0x3C] -_0800759E: - ldr r0, [r5, 0x40] - cmp r0, r3 - bcs _080075A6 - str r3, [r5, 0x40] -_080075A6: - movs r1, 0x4 - ldrsh r0, [r5, r1] - subs r0, 0x1 - cmp r9, r0 - bge _080075CC - adds r3, 0x20 - mov r6, r12 - ldr r0, [r6, 0x4] - ands r2, r0 - ldr r0, [r6, 0xC] - lsrs r2, r0 - ldr r0, [r3] - orrs r0, r2 - str r0, [r3] - ldr r0, [r5, 0x40] - cmp r0, r3 - bcs _080075CA - str r3, [r5, 0x40] -_080075CA: - subs r3, 0x20 -_080075CC: - ldr r7, [sp, 0x4] - ldrh r2, [r7, 0x4] - cmp r2, 0 - beq _08007620 - movs r1, 0x4 - ldrsh r0, [r5, r1] - subs r0, 0x1 - cmp r9, r0 - bge _080075FA - adds r3, 0x20 - mov r6, r12 - ldr r1, [r6] - ands r1, r2 - ldr r0, [r6, 0x8] - lsls r1, r0 - ldr r0, [r3] - orrs r0, r1 - str r0, [r3] - ldr r0, [r5, 0x40] - cmp r0, r3 - bcs _080075F8 - str r3, [r5, 0x40] -_080075F8: - subs r3, 0x20 -_080075FA: - movs r7, 0x4 - ldrsh r0, [r5, r7] - subs r0, 0x2 - cmp r9, r0 - bge _08007620 - adds r3, 0x40 - mov r1, r12 - ldr r0, [r1, 0x4] - ands r2, r0 - ldr r0, [r1, 0xC] - lsrs r2, r0 - ldr r0, [r3] - orrs r0, r2 - str r0, [r3] - ldr r0, [r5, 0x40] - cmp r0, r3 - bcs _0800761E - str r3, [r5, 0x40] -_0800761E: - subs r3, 0x40 -_08007620: - ldr r2, [sp, 0x4] - adds r2, 0x6 - str r2, [sp, 0x4] - adds r3, 0x4 - movs r6, 0x1 - add r10, r6 - movs r0, 0x7 - mov r7, r10 - ands r0, r7 - cmp r0, 0 - bne _0800764E - ldr r0, [r5, 0x20] - lsls r0, 2 - adds r3, r0 - ldr r0, [sp, 0x14] - adds r0, 0x1 - str r0, [sp, 0x14] - movs r1, 0x8 - ldrsh r0, [r5, r1] - ldr r2, [sp, 0x14] - cmp r2, r0 - blt _0800764E - b _0800786C -_0800764E: - ldr r6, [sp, 0x10] - adds r6, 0x1 - str r6, [sp, 0x10] - ldr r7, _0800766C - ldr r0, [r7] - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - cmp r6, r0 - blt _08007570 - b _0800786C - .align 2, 0 -_08007664: .4byte gUnknown_80B85DC -_08007668: .4byte gUnknown_202B028 -_0800766C: .4byte gCurrentCharmap -_08007670: - movs r0, 0 - str r0, [sp, 0x20] - mov r0, r10 - cmp r0, 0 - bge _0800767C - adds r0, 0x7 -_0800767C: - asrs r4, r0, 3 - movs r1, 0x4 - ldrsh r0, [r5, r1] - adds r1, r4, 0 - muls r1, r0 - adds r0, r6, 0 - cmp r6, 0 - bge _0800768E - adds r0, r6, 0x7 -_0800768E: - asrs r2, r0, 3 - adds r0, r1, r2 - lsls r0, 5 - ldr r1, [r5, 0x18] - adds r3, r1, r0 - lsls r0, r4, 3 - mov r7, r10 - subs r0, r7, r0 - lsls r0, 2 - adds r3, r0 - lsls r0, r2, 3 - subs r0, r6, r0 - lsls r0, 4 - ldr r1, _0800788C - adds r0, r1 - mov r12, r0 - mov r9, r2 - str r4, [sp, 0x14] - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r4, r0 - blt _080076BC - b _0800786C -_080076BC: - movs r2, 0 - str r2, [sp, 0x10] - ldr r2, _08007890 - ldr r1, _08007894 - ldr r0, [r1] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldr r4, [sp, 0x10] - cmp r4, r0 - blt _080076D4 - b _0800786C -_080076D4: - ldr r6, [sp, 0x4] - ldrh r0, [r6, 0x2] - lsls r4, r0, 16 - ldrh r0, [r6] - orrs r4, r0 - ldr r1, _08007898 - ands r1, r4 - ldr r0, [sp, 0x18] - ands r0, r4 - adds r2, r1, r0 - ldr r7, [sp, 0x1C] - cmp r7, 0 - beq _08007724 - ldr r1, [sp, 0xC] - ldrh r0, [r1, 0x2] - lsls r0, 16 - ldrh r1, [r1] - orrs r0, r1 - lsls r1, r0, 4 - mvns r6, r4 - mov r8, r6 - bics r1, r4 - ldr r7, _0800789C - ldr r6, [r7] - ands r1, r6 - orrs r2, r1 - ldr r0, [sp, 0x20] - cmp r0, 0 - beq _08007724 - ldr r1, [sp, 0x8] - ldrh r0, [r1, 0x2] - lsls r0, 16 - ldrh r1, [r1] - orrs r0, r1 - lsls r1, r0, 4 - eors r1, r4 - mov r4, r8 - ands r1, r4 - ands r1, r6 - orrs r2, r1 -_08007724: - cmp r2, 0 - beq _08007776 - movs r6, 0x4 - ldrsh r0, [r5, r6] - cmp r9, r0 - bge _08007750 - mov r7, r12 - ldr r1, [r7] - ands r1, r2 - ldr r0, [r7, 0x8] - lsls r1, r0 - ldr r0, [r3] - orrs r0, r1 - str r0, [r3] - ldr r0, [r5, 0x3C] - cmp r0, r3 - bls _08007748 - str r3, [r5, 0x3C] -_08007748: - ldr r0, [r5, 0x40] - cmp r0, r3 - bcs _08007750 - str r3, [r5, 0x40] -_08007750: - movs r1, 0x4 - ldrsh r0, [r5, r1] - subs r0, 0x1 - cmp r9, r0 - bge _08007776 - adds r3, 0x20 - mov r4, r12 - ldr r0, [r4, 0x4] - ands r2, r0 - ldr r0, [r4, 0xC] - lsrs r2, r0 - ldr r0, [r3] - orrs r0, r2 - str r0, [r3] - ldr r0, [r5, 0x40] - cmp r0, r3 - bcs _08007774 - str r3, [r5, 0x40] -_08007774: - subs r3, 0x20 -_08007776: - ldr r6, [sp, 0x4] - ldrh r4, [r6, 0x4] - ldr r1, _08007898 - ands r1, r4 - ldr r0, [sp, 0x18] - ands r0, r4 - adds r2, r1, r0 - ldr r7, [sp, 0x1C] - cmp r7, 0 - beq _080077CC - ldr r1, [sp, 0xC] - ldrh r0, [r1, 0x4] - lsls r1, r0, 4 - ldr r6, [sp, 0xC] - ldrh r0, [r6, 0x2] - movs r7, 0xF - mov r8, r7 - lsrs r0, 12 - orrs r1, r0 - mvns r0, r4 - str r0, [sp, 0x24] - bics r1, r4 - ldr r7, _0800789C - ldr r6, [r7] - ands r1, r6 - orrs r2, r1 - ldr r0, [sp, 0x20] - cmp r0, 0 - beq _080077CC - ldr r1, [sp, 0x8] - ldrh r0, [r1, 0x4] - lsls r1, r0, 4 - ldr r7, [sp, 0x8] - ldrh r0, [r7, 0x2] - lsrs r0, 12 - mov r7, r8 - ands r0, r7 - orrs r1, r0 - eors r1, r4 - ldr r0, [sp, 0x24] - ands r1, r0 - ands r1, r6 - orrs r2, r1 -_080077CC: - cmp r2, 0 - beq _0800781C - movs r1, 0x4 - ldrsh r0, [r5, r1] - subs r0, 0x1 - cmp r9, r0 - bge _080077F6 - adds r3, 0x20 - mov r4, r12 - ldr r1, [r4] - ands r1, r2 - ldr r0, [r4, 0x8] - lsls r1, r0 - ldr r0, [r3] - orrs r0, r1 - str r0, [r3] - ldr r0, [r5, 0x40] - cmp r0, r3 - bcs _080077F4 - str r3, [r5, 0x40] -_080077F4: - subs r3, 0x20 -_080077F6: - movs r6, 0x4 - ldrsh r0, [r5, r6] - subs r0, 0x2 - cmp r9, r0 - bge _0800781C - adds r3, 0x40 - mov r7, r12 - ldr r0, [r7, 0x4] - ands r2, r0 - ldr r0, [r7, 0xC] - lsrs r2, r0 - ldr r0, [r3] - orrs r0, r2 - str r0, [r3] - ldr r0, [r5, 0x40] - cmp r0, r3 - bcs _0800781A - str r3, [r5, 0x40] -_0800781A: - subs r3, 0x40 -_0800781C: - movs r0, 0x1 - str r0, [sp, 0x20] - ldr r1, [sp, 0x4] - adds r1, 0x6 - str r1, [sp, 0x4] - ldr r2, [sp, 0x8] - adds r2, 0x6 - str r2, [sp, 0x8] - ldr r4, [sp, 0xC] - adds r4, 0x6 - str r4, [sp, 0xC] - adds r3, 0x4 - add r10, r0 - movs r0, 0x7 - mov r6, r10 - ands r0, r6 - cmp r0, 0 - bne _08007854 - ldr r0, [r5, 0x20] - lsls r0, 2 - adds r3, r0 - ldr r7, [sp, 0x14] - adds r7, 0x1 - str r7, [sp, 0x14] - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r7, r0 - bge _0800786C -_08007854: - ldr r2, [sp, 0x10] - adds r2, 0x1 - str r2, [sp, 0x10] - ldr r4, _08007894 - ldr r0, [r4] - lsls r0, 2 - ldr r6, _08007890 - adds r0, r6 - ldr r0, [r0] - cmp r2, r0 - bge _0800786C - b _080076D4 -_0800786C: - ldr r7, [sp] - movs r1, 0x6 - ldrsh r0, [r7, r1] - ldr r2, _080078A0 - movs r3, 0 - ldrsh r1, [r2, r3] - adds r0, r1 - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .align 2, 0 -_0800788C: .4byte gUnknown_80B85DC -_08007890: .4byte gUnknown_202B028 -_08007894: .4byte gCurrentCharmap -_08007898: .4byte 0x11111111 -_0800789C: .4byte gUnknown_202B030 -_080078A0: .4byte gCharacterSpacing - thumb_func_end xxx_draw_char - - thumb_func_start sub_80078A4 -sub_80078A4: - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - adds r4, r2, 0 - mov r8, r3 - ldr r0, [sp, 0x18] - str r0, [sp] - adds r0, r5, 0 - bl sub_800792C - adds r4, 0x1 - ldr r0, _080078E4 - ldr r0, [r0] - movs r1, 0xF - ands r0, r1 - str r0, [sp] - adds r0, r5, 0 - adds r1, r6, 0 - adds r2, r4, 0 - mov r3, r8 - bl sub_800792C - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_080078E4: .4byte gUnknown_202B030 - thumb_func_end sub_80078A4 - - thumb_func_start sub_80078E8 -sub_80078E8: - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - adds r4, r2, 0 - mov r8, r3 - ldr r0, [sp, 0x18] - str r0, [sp] - adds r0, r5, 0 - bl nullsub_129 - adds r4, 0x1 - ldr r0, _08007928 - ldr r0, [r0] - movs r1, 0xF - ands r0, r1 - str r0, [sp] - adds r0, r5, 0 - adds r1, r6, 0 - adds r2, r4, 0 - mov r3, r8 - bl nullsub_129 - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_08007928: .4byte gUnknown_202B030 - thumb_func_end sub_80078E8 - - thumb_func_start sub_800792C -sub_800792C: - push {r4-r6,lr} - sub sp, 0x8 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r1, [sp, 0x18] - ldr r0, _08007950 - str r3, [sp] - str r1, [sp, 0x4] - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_8007958 - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_08007950: .4byte gUnknown_2027370 - thumb_func_end sub_800792C - - thumb_func_start nullsub_129 -nullsub_129: - bx lr - thumb_func_end nullsub_129 - - thumb_func_start sub_8007958 -sub_8007958: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x24 - mov r8, r2 - adds r7, r3, 0 - ldr r2, [sp, 0x40] - mov r12, r2 - ldr r3, [sp, 0x44] - lsls r2, r1, 3 - adds r2, r1 - lsls r2, 3 - adds r5, r0, r2 - ldr r1, _08007A68 - movs r0, 0xF - ands r3, r0 - lsls r3, 2 - adds r3, r1 - ldr r3, [r3] - mov r9, r3 - adds r0, r7, 0 - cmp r7, 0 - bge _0800798A - adds r0, r7, 0x7 -_0800798A: - asrs r4, r0, 3 - movs r1, 0x4 - ldrsh r0, [r5, r1] - muls r0, r4 - mov r2, r8 - cmp r2, 0 - bge _0800799A - adds r2, 0x7 -_0800799A: - asrs r2, 3 - adds r0, r2 - lsls r0, 5 - ldr r1, [r5, 0x18] - adds r3, r1, r0 - lsls r0, r4, 3 - subs r0, r7, r0 - lsls r0, 2 - adds r3, r0 - adds r6, r2, 0 - movs r2, 0x8 - ldrsh r0, [r5, r2] - cmp r4, r0 - bge _08007A58 - mov r1, sp - ldr r0, _08007A6C - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} - ldm r0!, {r2,r4,r7} - stm r1!, {r2,r4,r7} - mov r4, r12 - cmp r4, 0 - ble _08007A58 - ldr r7, _08007A70 -_080079CE: - mov r1, r12 - cmp r1, 0x7 - ble _080079D6 - movs r1, 0x8 -_080079D6: - mov r0, r8 - cmp r0, 0 - bge _080079DE - adds r0, 0x7 -_080079DE: - asrs r0, 3 - lsls r0, 3 - mov r2, r8 - subs r0, r2, r0 - lsls r0, 4 - adds r4, r0, r7 - lsls r0, r1, 2 - add r0, sp - ldr r2, [r0] - ldr r1, _08007A74 - ands r1, r2 - mov r0, r9 - ands r0, r2 - adds r2, r1, r0 - cmp r2, 0 - beq _08007A48 - movs r1, 0x4 - ldrsh r0, [r5, r1] - cmp r6, r0 - bge _08007A24 - ldr r1, [r4] - ands r1, r2 - ldr r0, [r4, 0x8] - lsls r1, r0 - ldr r0, [r3] - orrs r0, r1 - str r0, [r3] - ldr r0, [r5, 0x3C] - cmp r0, r3 - bls _08007A1C - str r3, [r5, 0x3C] -_08007A1C: - ldr r0, [r5, 0x40] - cmp r0, r3 - bcs _08007A24 - str r3, [r5, 0x40] -_08007A24: - movs r1, 0x4 - ldrsh r0, [r5, r1] - subs r0, 0x1 - cmp r6, r0 - bge _08007A48 - adds r3, 0x20 - ldr r0, [r4, 0x4] - ands r2, r0 - ldr r0, [r4, 0xC] - lsrs r2, r0 - ldr r0, [r3] - orrs r0, r2 - str r0, [r3] - ldr r0, [r5, 0x40] - cmp r0, r3 - bcs _08007A46 - str r3, [r5, 0x40] -_08007A46: - subs r3, 0x20 -_08007A48: - adds r6, 0x1 - adds r3, 0x20 - movs r2, 0x8 - negs r2, r2 - add r12, r2 - mov r4, r12 - cmp r4, 0 - bgt _080079CE -_08007A58: - add sp, 0x24 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08007A68: .4byte gUnknown_80B853C -_08007A6C: .4byte gUnknown_80B8824 -_08007A70: .4byte gUnknown_80B85DC -_08007A74: .4byte 0x11111111 - thumb_func_end sub_8007958 - - thumb_func_start sub_8007A78 -sub_8007A78: - push {r4-r6,lr} - sub sp, 0x8 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r1, [sp, 0x18] - ldr r0, _08007A9C - str r3, [sp] - str r1, [sp, 0x4] - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_8007AA4 - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_08007A9C: .4byte gUnknown_2027370 - thumb_func_end sub_8007A78 - - thumb_func_start nullsub_157 -nullsub_157: - bx lr - thumb_func_end nullsub_157 - - thumb_func_start sub_8007AA4 -sub_8007AA4: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x20 - mov r9, r2 - adds r5, r3, 0 - ldr r7, [sp, 0x3C] - ldr r3, [sp, 0x40] - lsls r2, r1, 3 - adds r2, r1 - lsls r2, 3 - adds r4, r0, r2 - ldr r1, _08007B28 - movs r0, 0xF - ands r3, r0 - lsls r3, 2 - adds r3, r1 - ldr r0, [r3] - ldr r1, _08007B2C - adds r1, r0 - mov r12, r1 - mov r1, sp - ldr r0, _08007B30 - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - ldm r0!, {r2,r3} - stm r1!, {r2,r3} - adds r0, r5, 0 - cmp r5, 0 - bge _08007AE8 - adds r0, r5, 0x7 -_08007AE8: - asrs r3, r0, 3 - movs r0, 0x4 - ldrsh r6, [r4, r0] - mov r8, r6 - mov r0, r8 - muls r0, r3 - mov r2, r9 - cmp r2, 0 - bge _08007AFC - adds r2, 0x7 -_08007AFC: - asrs r2, 3 - adds r0, r2 - lsls r0, 5 - ldr r1, [r4, 0x18] - adds r1, r0 - lsls r0, r3, 3 - subs r0, r5, r0 - lsls r0, 2 - adds r1, r0 - movs r0, 0x7 - mov r6, r9 - ands r0, r6 - lsls r0, 2 - add r0, sp - ldr r0, [r0] - mov r6, r12 - ands r6, r0 - mov r12, r6 - cmp r2, r8 - bge _08007B6E - b _08007B48 - .align 2, 0 -_08007B28: .4byte gUnknown_80B853C -_08007B2C: .4byte 0x11111111 -_08007B30: .4byte gUnknown_80B8848 -_08007B34: - adds r5, 0x1 - adds r1, 0x4 - movs r0, 0x7 - ands r0, r5 - cmp r0, 0 - bne _08007B46 - ldr r0, [r4, 0x20] - lsls r0, 2 - adds r1, r0 -_08007B46: - subs r7, 0x1 -_08007B48: - cmp r7, 0 - ble _08007B6E - movs r2, 0x8 - ldrsh r0, [r4, r2] - cmp r3, r0 - bge _08007B6E - ldr r0, [r1] - mov r6, r12 - orrs r0, r6 - str r0, [r1] - ldr r0, [r4, 0x3C] - cmp r0, r1 - bls _08007B64 - str r1, [r4, 0x3C] -_08007B64: - ldr r0, [r4, 0x40] - cmp r0, r1 - bcs _08007B34 - str r1, [r4, 0x40] - b _08007B34 -_08007B6E: - add sp, 0x20 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8007AA4 - - thumb_func_start sub_8007B7C -sub_8007B7C: - push {r4-r6,lr} - sub sp, 0x8 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r1, [sp, 0x18] - ldr r0, _08007BA0 - str r3, [sp] - str r1, [sp, 0x4] - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_8007BA8 - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_08007BA0: .4byte gUnknown_2027370 - thumb_func_end sub_8007B7C - - thumb_func_start nullsub_158 -nullsub_158: - bx lr - thumb_func_end nullsub_158 - - thumb_func_start sub_8007BA8 -sub_8007BA8: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - str r2, [sp] - lsls r2, r1, 3 - adds r2, r1 - lsls r2, 3 - adds r0, r2 - mov r12, r0 - adds r0, r3, 0 - cmp r3, 0 - bge _08007BC8 - adds r0, r3, 0x7 -_08007BC8: - asrs r0, 3 - str r0, [sp, 0x8] - mov r1, r12 - movs r2, 0x8 - ldrsh r0, [r1, r2] - ldr r4, [sp, 0x8] - cmp r4, r0 - bge _08007CC4 - movs r7, 0x4 - ldrsh r0, [r1, r7] - adds r1, r4, 0 - muls r1, r0 - ldr r0, [sp] - cmp r0, 0 - bge _08007BE8 - adds r0, 0x7 -_08007BE8: - asrs r0, 3 - adds r0, r1, r0 - lsls r0, 5 - mov r2, r12 - ldr r1, [r2, 0x18] - adds r4, r1, r0 - ldr r7, [sp, 0x8] - lsls r0, r7, 3 - subs r0, r3, r0 - lsls r0, 2 - adds r4, r0 - movs r0, 0 - str r0, [sp, 0x4] - ldr r1, [sp, 0x44] - cmp r0, r1 - bge _08007CC4 -_08007C08: - adds r2, r4, 0 - ldr r0, [sp] - cmp r0, 0 - bge _08007C12 - adds r0, 0x7 -_08007C12: - asrs r1, r0, 3 - movs r7, 0 - mov r8, r7 - adds r3, 0x1 - str r3, [sp, 0xC] - adds r4, 0x4 - str r4, [sp, 0x14] - ldr r0, [sp, 0x40] - cmp r8, r0 - bge _08007C94 -_08007C26: - mov r3, r12 - movs r4, 0x4 - ldrsh r0, [r3, r4] - cmp r1, r0 - bge _08007C94 - movs r6, 0xF0 - lsls r6, 24 - movs r5, 0xE0 - lsls r5, 24 - movs r7, 0 - str r7, [sp, 0x1C] - ldr r4, [r2] - adds r3, r4, 0 - mov r0, r12 - ldr r0, [r0, 0x3C] - mov r9, r0 - mov r7, r12 - ldr r7, [r7, 0x40] - mov r10, r7 - adds r1, 0x1 - str r1, [sp, 0x10] - adds r0, r2, 0 - adds r0, 0x20 - str r0, [sp, 0x18] - movs r1, 0x8 - add r8, r1 - movs r1, 0x7 -_08007C5C: - adds r0, r4, 0 - ands r0, r6 - cmp r0, 0 - bne _08007C6A - ldr r7, [sp, 0x1C] - orrs r7, r5 - str r7, [sp, 0x1C] -_08007C6A: - lsrs r6, 4 - lsrs r5, 4 - subs r1, 0x1 - cmp r1, 0 - bge _08007C5C - ldr r0, [sp, 0x1C] - orrs r3, r0 - str r3, [r2] - cmp r9, r2 - bls _08007C82 - mov r1, r12 - str r2, [r1, 0x3C] -_08007C82: - cmp r10, r2 - bcs _08007C8A - mov r3, r12 - str r2, [r3, 0x40] -_08007C8A: - ldr r1, [sp, 0x10] - ldr r2, [sp, 0x18] - ldr r4, [sp, 0x40] - cmp r8, r4 - blt _08007C26 -_08007C94: - ldr r3, [sp, 0xC] - ldr r4, [sp, 0x14] - movs r0, 0x7 - ands r0, r3 - cmp r0, 0 - bne _08007CB8 - mov r7, r12 - ldr r0, [r7, 0x20] - lsls r0, 2 - adds r4, r0 - ldr r0, [sp, 0x8] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r1, 0x8 - ldrsh r0, [r7, r1] - ldr r2, [sp, 0x8] - cmp r2, r0 - bge _08007CC4 -_08007CB8: - ldr r7, [sp, 0x4] - adds r7, 0x1 - str r7, [sp, 0x4] - ldr r0, [sp, 0x44] - cmp r7, r0 - blt _08007C08 -_08007CC4: - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8007BA8 - - thumb_func_start sub_8007CD4 -sub_8007CD4: - push {r4-r6,lr} - sub sp, 0x8 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r1, [sp, 0x18] - ldr r0, _08007CF8 - str r3, [sp] - str r1, [sp, 0x4] - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_8007D00 - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_08007CF8: .4byte gUnknown_2027370 - thumb_func_end sub_8007CD4 - - thumb_func_start nullsub_159 -nullsub_159: - bx lr - thumb_func_end nullsub_159 - - thumb_func_start sub_8007D00 -sub_8007D00: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - str r2, [sp] - lsls r2, r1, 3 - adds r2, r1 - lsls r2, 3 - adds r0, r2 - mov r12, r0 - adds r0, r3, 0 - cmp r3, 0 - bge _08007D20 - adds r0, r3, 0x7 -_08007D20: - asrs r0, 3 - str r0, [sp, 0x8] - mov r1, r12 - movs r2, 0x8 - ldrsh r0, [r1, r2] - ldr r4, [sp, 0x8] - cmp r4, r0 - bge _08007E0E - movs r5, 0x4 - ldrsh r0, [r1, r5] - adds r1, r4, 0 - muls r1, r0 - ldr r0, [sp] - cmp r0, 0 - bge _08007D40 - adds r0, 0x7 -_08007D40: - asrs r0, 3 - adds r0, r1, r0 - lsls r0, 5 - mov r2, r12 - ldr r1, [r2, 0x18] - adds r4, r1, r0 - ldr r5, [sp, 0x8] - lsls r0, r5, 3 - subs r0, r3, r0 - lsls r0, 2 - adds r4, r0 - movs r0, 0 - b _08007E06 -_08007D5A: - adds r2, r4, 0 - ldr r0, [sp] - cmp r0, 0 - bge _08007D64 - adds r0, 0x7 -_08007D64: - asrs r1, r0, 3 - movs r5, 0 - mov r8, r5 - adds r3, 0x1 - str r3, [sp, 0xC] - adds r4, 0x4 - str r4, [sp, 0x14] - ldr r0, [sp, 0x40] - cmp r8, r0 - bge _08007DE0 -_08007D78: - mov r3, r12 - movs r4, 0x4 - ldrsh r0, [r3, r4] - cmp r1, r0 - bge _08007DE0 - movs r4, 0xF0 - lsls r4, 24 - movs r6, 0xE0 - lsls r6, 24 - movs r7, 0 - ldr r5, [r2] - str r5, [sp, 0x1C] - adds r3, r5, 0 - mov r0, r12 - ldr r0, [r0, 0x3C] - mov r9, r0 - mov r5, r12 - ldr r5, [r5, 0x40] - mov r10, r5 - adds r1, 0x1 - str r1, [sp, 0x10] - adds r0, r2, 0 - adds r0, 0x20 - str r0, [sp, 0x18] - movs r1, 0x8 - add r8, r1 - movs r1, 0x7 -_08007DAE: - ldr r0, [sp, 0x1C] - ands r0, r4 - cmp r0, r6 - bne _08007DB8 - orrs r7, r4 -_08007DB8: - lsrs r4, 4 - lsrs r6, 4 - subs r1, 0x1 - cmp r1, 0 - bge _08007DAE - bics r3, r7 - str r3, [r2] - cmp r9, r2 - bls _08007DCE - mov r3, r12 - str r2, [r3, 0x3C] -_08007DCE: - cmp r10, r2 - bcs _08007DD6 - mov r4, r12 - str r2, [r4, 0x40] -_08007DD6: - ldr r1, [sp, 0x10] - ldr r2, [sp, 0x18] - ldr r5, [sp, 0x40] - cmp r8, r5 - blt _08007D78 -_08007DE0: - ldr r3, [sp, 0xC] - ldr r4, [sp, 0x14] - movs r0, 0x7 - ands r0, r3 - cmp r0, 0 - bne _08007E02 - mov r1, r12 - ldr r0, [r1, 0x20] - lsls r0, 2 - adds r4, r0 - ldr r2, [sp, 0x8] - adds r2, 0x1 - str r2, [sp, 0x8] - movs r5, 0x8 - ldrsh r0, [r1, r5] - cmp r2, r0 - bge _08007E0E -_08007E02: - ldr r0, [sp, 0x4] - adds r0, 0x1 -_08007E06: - str r0, [sp, 0x4] - ldr r1, [sp, 0x44] - cmp r0, r1 - blt _08007D5A -_08007E0E: - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8007D00 - - thumb_func_start sub_8007E20 -sub_8007E20: - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x14 - mov r8, r0 - mov r9, r1 - ldr r4, [sp, 0x2C] - ldr r5, [sp, 0x30] - ldr r6, [sp, 0x34] - ldr r0, _08007E58 - ldr r1, _08007E5C - str r2, [sp] - str r3, [sp, 0x4] - str r4, [sp, 0x8] - str r5, [sp, 0xC] - str r6, [sp, 0x10] - mov r2, r8 - mov r3, r9 - bl sub_8007E64 - add sp, 0x14 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .align 2, 0 -_08007E58: .4byte gUnknown_2027370 -_08007E5C: .4byte gUnknown_202B038 - thumb_func_end sub_8007E20 - - thumb_func_start nullsub_160 -nullsub_160: - bx lr - thumb_func_end nullsub_160 - thumb_func_start sub_8007E64 sub_8007E64: push {r4-r7,lr} diff --git a/data/data.s b/data/data.s index 6218960f..363c7662 100644 --- a/data/data.s +++ b/data/data.s @@ -1823,12 +1823,15 @@ gUnknown_80B853C: @ 80B853C .global gUnknown_80B857C gUnknown_80B857C: @ 80B857C - .4byte 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0 + @ Type: UnkTextStruct2[4] + .4byte 0, 3, 0, 0, 0, 0 + .4byte 0, 3, 0, 0, 0, 0 + .4byte 0, 3, 0, 0, 0, 0 + .4byte 0, 3, 0, 0, 0, 0 .global gUnknown_80B85DC gUnknown_80B85DC: @ 80B85DC - @ Some kind of bit shifting and masking table - @ byte1, byte2, shift_left, shift_right + @ Type: unkShiftData[8] .4byte 0xFFFFFFFF, 0x00000000, 0x00, 0x20 .4byte 0x0FFFFFFF, 0xF0000000, 0x04, 0x1C .4byte 0x00FFFFFF, 0xFF000000, 0x08, 0x18 @@ -1911,6 +1914,7 @@ gUnknown_80B8814: @ 80B8814 .global gUnknown_80B8824 gUnknown_80B8824: @ 80B8824 + @ Type: unkStruct_80B8824 .byte 0x00, 0x00, 0x00, 0x00 .byte 0x0f, 0x00, 0x00, 0x00 .byte 0xff, 0x00, 0x00, 0x00 @@ -1923,6 +1927,7 @@ gUnknown_80B8824: @ 80B8824 .global gUnknown_80B8848 gUnknown_80B8848: @ 80B8848 + @ Type: unkStruct_80B8848 .byte 0x0F, 0x00, 0x00, 0x00 .byte 0xF0, 0x00, 0x00, 0x00 .byte 0x00, 0x0F, 0x00, 0x00 diff --git a/include/bg_palette_buffer.h b/include/bg_palette_buffer.h new file mode 100644 index 00000000..4995ec62 --- /dev/null +++ b/include/bg_palette_buffer.h @@ -0,0 +1,6 @@ +#ifndef GUARD_BG_PALETTE_BUFFER_H +#define GUARD_BG_PALETTE_BUFFER_H + +void InitBGPaletteBuffer(void); + +#endif // GUARD_BG_PALETTE_BUFFER_H \ No newline at end of file diff --git a/include/code_800B540.h b/include/code_800B540.h deleted file mode 100644 index 3e6be1f5..00000000 --- a/include/code_800B540.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef GUARD_CODE_800B540_H -#define GUARD_CODE_800B540_H - -void sub_800CDA8(int a0); - -#endif //GUARD_CODE_800B540_H diff --git a/include/code_8012A18_1.h b/include/code_8012A18_1.h new file mode 100644 index 00000000..8752a5d4 --- /dev/null +++ b/include/code_8012A18_1.h @@ -0,0 +1,8 @@ +#ifndef GUARD_CODE_8012A18_H +#define GUARD_CODE_8012A18_H + +u32 sub_801602C(u32, u8 *); +u32 sub_8016080(void); +void sub_80160D8(void); + +#endif // GUARD_CODE_8012A18_H \ No newline at end of file diff --git a/include/code_80130A8.h b/include/code_80130A8.h new file mode 100644 index 00000000..26c0a2cf --- /dev/null +++ b/include/code_80130A8.h @@ -0,0 +1,16 @@ +#ifndef GUARD_CODE_80130A8_H +#define GUARD_CODE_80130A8_H + +#include "file_system.h" +#include "menu.h" + +// code_80130A8.s +extern void sub_8013AA0(u32 *); +extern u32 sub_8013BBC(u32 *); +extern void sub_8013C68(u32 *); +extern void sub_80141B4(const u8 *, u32, struct OpenedFile **, u32); +extern void sub_8014248(const u8 *, u32, u32, const struct MenuItem *, void *, u32, u32, struct OpenedFile **, u32); +extern s32 sub_80144A4(s32 *); +extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32); + +#endif // GUARD_CODE_80130A8_H \ No newline at end of file diff --git a/include/code_801B3C0.h b/include/code_801B3C0.h new file mode 100644 index 00000000..7c2d58bb --- /dev/null +++ b/include/code_801B3C0.h @@ -0,0 +1,28 @@ +#ifndef GUARD_CODE_801B3C0_H +#define GUARD_CODE_801B3C0_H + +#include "input.h" +#include "item.h" +#include "subStruct_203B240.h" +#include "text.h" + +// size: 0x94 +struct unkStruct_203B230 +{ + s32 state; + struct Item item; + s32 unk8; + s32 unkC; + struct subStruct_203B240 *unk10[2]; + u8 fill18[0x20 - 0x18]; + u32 unk20; + u32 unk24; + struct UnkTextStruct2 unk28[4]; + struct MenuInputStructSub unk88; +}; + +u32 sub_801B3C0(struct Item *); +u32 sub_801B410(void); +void sub_801B450(void); + +#endif // GUARD_CODE_801B3C0_H \ No newline at end of file diff --git a/include/code_801C620.h b/include/code_801C620.h new file mode 100644 index 00000000..0be8b965 --- /dev/null +++ b/include/code_801C620.h @@ -0,0 +1,18 @@ +#ifndef GUARD_CODE_801C620_H +#define GUARD_CODE_801C620_H + +#include "text.h" + +bool8 sub_801C8C4(s32, s32, struct UnkTextStruct2_sub *, u32); +extern u32 sub_801CA08(bool8); +u8 sub_801CB24(void); +void sub_801CB5C(bool8); +void sub_801CBB8(void); +void sub_801CCD8(void); +bool8 sub_801CF14(s32); +bool8 sub_801CF50(s32); +void sub_801CF94(void); +s32 sub_801CFB8(void); +u32 sub_801CFE0(u8); + +#endif // GUARD_CODE_801C620_H \ No newline at end of file diff --git a/include/code_801EE10.h b/include/code_801EE10.h index 10c8d773..9c8173a1 100644 --- a/include/code_801EE10.h +++ b/include/code_801EE10.h @@ -1,6 +1,10 @@ #ifndef CODE_801EE10_H #define CODE_801EE10_H +#include "input.h" +#include "pokemon.h" +#include "text.h" + struct unkStruct_203B270 { // size 0xBC diff --git a/include/code_801EE10_1.h b/include/code_801EE10_1.h new file mode 100644 index 00000000..9e2c798a --- /dev/null +++ b/include/code_801EE10_1.h @@ -0,0 +1,12 @@ +#ifndef GUARD_CODE_801EE10_1_H +#define GUARD_CODE_801EE10_1_H + +// code_801EE10_1.s +extern void sub_8023868(u32, u32, u32, u32); +extern u32 sub_8023A94(bool8); +extern s16 sub_8023B44(void); +extern void sub_8023B7C(u32); +extern void sub_8023C60(void); +extern void sub_8023DA4(void); + +#endif // GUARD_CODE_801EE10_1_H \ No newline at end of file diff --git a/include/code_801EE10_mid.h b/include/code_801EE10_mid.h new file mode 100644 index 00000000..0d18ee35 --- /dev/null +++ b/include/code_801EE10_mid.h @@ -0,0 +1,7 @@ +#ifndef GUARD_CODE_801EE10_MID_H +#define GUARD_CODE_801EE10_MID_H + +// code_801EE10_mid.s +extern void sub_8021494(void); + +#endif // GUARD_CODE_801EE10_MID_H \ No newline at end of file diff --git a/include/code_8021774.h b/include/code_8021774.h new file mode 100644 index 00000000..8a123147 --- /dev/null +++ b/include/code_8021774.h @@ -0,0 +1,8 @@ +#ifndef GUARD_CODE_8021774_H +#define GUARD_CODE_8021774_H + +bool8 sub_8021774(u8, u8, s32); +u32 sub_80217EC(void); +void sub_8021830(void); + +#endif // GUARD_CODE_8021774_H \ No newline at end of file diff --git a/include/code_8021774_pre.h b/include/code_8021774_pre.h new file mode 100644 index 00000000..a5559eeb --- /dev/null +++ b/include/code_8021774_pre.h @@ -0,0 +1,10 @@ +#ifndef GUARD_CODE_8021774_PRE_H +#define GUARD_CODE_8021774_PRE_H + +bool8 sub_80211AC(u32, u32); +u32 sub_8021274(bool8); +u8 sub_802132C(void); +void sub_8021354(bool8); +void sub_80213A0(void); + +#endif // GUARD_CODE_8021774_PRE_H \ No newline at end of file diff --git a/include/code_8094F88.h b/include/code_8094F88.h index 96a87dc1..fd796329 100644 --- a/include/code_8094F88.h +++ b/include/code_8094F88.h @@ -67,5 +67,4 @@ s32 GetFirstIndexofMailType(u8 mailType); void sub_8095824(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b); void sub_8095774(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b); - -#endif +#endif \ No newline at end of file diff --git a/include/code_8097670.h b/include/code_8097670.h new file mode 100644 index 00000000..2d8d118c --- /dev/null +++ b/include/code_8097670.h @@ -0,0 +1,25 @@ +#ifndef GUARD_CODE_8097670_H +#define GUARD_CODE_8097670_H + +#include "dungeon_global_data.h" + +// size: 0xC4 +struct unkStruct_203B494 +{ + u32 unk0; // 32 bit bitfield, I think + /* 0x4 */ s32 numAdventures; + s32 unk8; + s32 unkC; + /* 0x10 */ struct DungeonLocation dungeonLocation; + s16 unk14; + s16 unk16; + s16 unk18; + u32 unk1C[14]; + u32 unk54[14]; + u32 unk8C[13]; + s32 unkC0; +}; + +void sub_80976F8(u8); + +#endif // GUARD_CODE_8097670_H \ No newline at end of file diff --git a/include/cpu.h b/include/cpu.h new file mode 100644 index 00000000..0d5676e2 --- /dev/null +++ b/include/cpu.h @@ -0,0 +1,8 @@ +#ifndef GUARD_CPU_H +#define GUARD_CPU_H + +void VBlank_CB(void); + +void sub_800CDA8(u32); + +#endif //GUARD_CPU_H diff --git a/include/debug_menu.h b/include/debug_menu.h deleted file mode 100644 index f91e0836..00000000 --- a/include/debug_menu.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef GUARD_DEBUG_MENU_H -#define GUARD_DEBUG_MENU_H - -#include "text.h" -#include "menu.h" -#include "menu_input.h" - -enum DebugMenuOptions -{ - MENU_DEBUG_MENU_DUNGEONS = 0, - MENU_DEBUG_MENU_FIELD, - MENU_DEBUG_MENU_FIELD_MAP, - MENU_DEBUG_MENU_FIELD_SCRIPT, - MENU_DEBUG_MENU_DEBUG_MENU, - MENU_DEBUG_MENU_UNKNOWN_1, - MENU_DEBUG_MENU_STORAGE, - MENU_DEBUG_MENU_H_OPEN = 9, -}; - -struct DebugMenu -{ - // size: 0x1A4 - struct MenuStruct unk0[4]; - /* 0x140 */ struct UnkTextStruct2 unk140[4]; - u32 fill1A0; -}; - - -struct unkStruct_203B3F8 -{ - // size: 0x140 - u32 state; - s16 unk4; - u16 unk6; - struct PokemonStruct *pokemon; - u32 menuAction; - struct MenuStruct unk10; - u32 unk60; - u32 unk64; - u32 unk68; - u32 unk6C; - u32 unk70; - u32 unk74; - struct UnkTextStruct2 *unk78; - u32 unk7C; - u32 unk80; - u8 fill84[0x90 - 0x84]; - struct MenuItem unk90[8]; - u16 unkD0[8]; - struct UnkTextStruct2 unkE0[4]; -}; - - -void CreateDebugMenu(void); -void DeleteDebugMenu(void); -u32 UpdateDebugMenu(void); -void SetDebugMenuItems(void); -void sub_803A3A0(void); - -#endif diff --git a/include/debug_menu1.h b/include/debug_menu1.h new file mode 100644 index 00000000..f23ed3f5 --- /dev/null +++ b/include/debug_menu1.h @@ -0,0 +1,31 @@ +#ifndef GUARD_DEBUG_MENU1_H +#define GUARD_DEBUG_MENU1_H + +#include "menu.h" +#include "text.h" + +// size: 0x1A4 +struct DebugMenu +{ + struct MenuStruct unk0[4]; + struct UnkTextStruct2 unk140[4]; + u32 fill1A0; +}; + +enum DebugMenuOptions +{ + MENU_DEBUG_MENU_DUNGEONS = 0, + MENU_DEBUG_MENU_FIELD, + MENU_DEBUG_MENU_FIELD_MAP, + MENU_DEBUG_MENU_FIELD_SCRIPT, + MENU_DEBUG_MENU_DEBUG_MENU, + MENU_DEBUG_MENU_UNKNOWN_1, + MENU_DEBUG_MENU_STORAGE, + MENU_DEBUG_MENU_H_OPEN = 9, +}; + +void CreateDebugMenu(void); +void DeleteDebugMenu(void); +u32 UpdateDebugMenu(void); + +#endif // GUARD_DEBUG_MENU1_H \ No newline at end of file diff --git a/include/debug_menu2.h b/include/debug_menu2.h new file mode 100644 index 00000000..c2ef67d8 --- /dev/null +++ b/include/debug_menu2.h @@ -0,0 +1,28 @@ +#ifndef GUARD_DEBUG_MENU2_H +#define GUARD_DEBUG_MENU2_H + +#include "menu.h" +#include "text.h" + +// size: 0x138 +struct unkStruct_203B3F0 +{ + /* 0x0 */ u32 state; + /* 0x4 */ u8 id; + /* 0x8 */ u32 menuAction; + /* 0xC */ struct MenuItem menuItems[8]; + struct MenuStruct unk4C; + u32 unk9C; + u32 unkA0; + u32 unkA4; + u32 unkA8; + u32 unkAC; + u32 unkB0; + struct UnkTextStruct2 *unkB4; + u32 unkB8; + u32 unkBC; + u8 fill4[0xD8 - 0xC0]; + struct UnkTextStruct2 unkD8[4]; +}; + +#endif // GUARD_DEBUG_MENU2_H \ No newline at end of file diff --git a/include/debug_menu3.h b/include/debug_menu3.h new file mode 100644 index 00000000..2a822e36 --- /dev/null +++ b/include/debug_menu3.h @@ -0,0 +1,18 @@ +#ifndef GUARD_DEBUG_MENU3_H +#define GUARD_DEBUG_MENU3_H + +#include "menu.h" +#include "text.h" + +// size: 0xFC +struct unkStruct_203B3F4 +{ + /* 0x0 */ u32 state; + /* 0x4 */ u8 friendArea; + /* 0x8 */ u32 menuAction; + /* 0xC */ struct MenuItem menuItems[8]; + struct MenuStruct unk4C; + struct UnkTextStruct2 unk9C[4]; +}; + +#endif // GUARD_DEBUG_MENU3_H \ No newline at end of file diff --git a/include/debug_menu4.h b/include/debug_menu4.h new file mode 100644 index 00000000..2fe92244 --- /dev/null +++ b/include/debug_menu4.h @@ -0,0 +1,32 @@ +#ifndef GUARD_DEBUG_MENU4_H +#define GUARD_DEBUG_MENU4_H + +#include "pokemon.h" +#include "menu.h" +#include "text.h" + +// size: 0x140 +struct unkStruct_203B3F8 +{ + /* 0x0 */ u32 state; + s16 unk4; + u16 unk6; + /* 0x8 */ struct PokemonStruct *pokemon; + /* 0xC */ u32 menuAction; + struct MenuStruct unk10; + u32 unk60; + u32 unk64; + u32 unk68; + u32 unk6C; + u32 unk70; + u32 unk74; + struct UnkTextStruct2 *unk78; + u32 unk7C; + u32 unk80; + u8 fill84[0x90 - 0x84]; + struct MenuItem unk90[8]; + u16 unkD0[8]; + struct UnkTextStruct2 unkE0[4]; +}; + +#endif // GUARD_DEBUG_MENU4_H \ No newline at end of file diff --git a/include/file_system.h b/include/file_system.h index 976c6ce9..83b7c5d6 100644 --- a/include/file_system.h +++ b/include/file_system.h @@ -32,6 +32,7 @@ struct UnkFileStruct1 /* 0x4 */ u32 unk4; }; +void InitFileSystem(void); struct OpenedFile *OpenFile(const char *filename, const struct FileArchive *arc); u8 *GetFileDataPtr(struct OpenedFile *openedFile, int unused); struct OpenedFile *OpenFileAndGetFileDataPtr(const char *filename, const struct FileArchive *arc); diff --git a/include/friend_area.h b/include/friend_area.h index 2a6bb36d..b9430be0 100644 --- a/include/friend_area.h +++ b/include/friend_area.h @@ -17,6 +17,8 @@ struct unkStruct_8092638 s32 unk8; }; +extern bool8 *gFriendAreas; + void LoadFriendAreas(void); bool8 *GetBoughtFriendAreas(void); void InitializeFriendAreas(void); @@ -28,6 +30,7 @@ u8 *GetFriendAreaDescription(u8 index); u8 GetFriendAreaUnlockCondition(u8 index); s32 GetFriendAreaPrice(u8 index); const char *GetFriendAreaName(u8 index); +void sub_809249C(u8 friendArea, u8 clear); void sub_8092638(u8 friendArea, struct unkStruct_8092638 *param_2, u8 param_3, u8 param_4); u32 SaveFriendAreas(u8 *r0, u32 r1); diff --git a/include/input.h b/include/input.h index e85046f3..b71030c1 100644 --- a/include/input.h +++ b/include/input.h @@ -1,5 +1,5 @@ #ifndef GUARD_INPUT_H -#define GUARD_INPUT_H +#define GUARD_INPUT_H // size: 0x10 struct Inputs diff --git a/include/main.h b/include/main.h new file mode 100644 index 00000000..7a3bde46 --- /dev/null +++ b/include/main.h @@ -0,0 +1,12 @@ +#ifndef GUARD_MAIN_H +#define GUARD_MAIN_H + +typedef void (*IntrCallback)(void); + +extern IntrCallback gIntrCallbacks[6]; + +void AckInterrupt(u16); +bool8 EnableInterrupts(void); +bool8 DisableInterrupts(void); + +#endif // GUARD_MAIN_H \ No newline at end of file diff --git a/include/main_menu.h b/include/main_menu.h index 3bcc5033..7167e81d 100644 --- a/include/main_menu.h +++ b/include/main_menu.h @@ -1,6 +1,9 @@ #ifndef GUARD_MAIN_MENU_H #define GUARD_MAIN_MENU_H +#include "menu.h" +#include "text.h" + enum MainMenuScreens { MENU_MAIN_SCREEN = 1, @@ -30,12 +33,12 @@ enum MainMenuScreens MENU_DEBUG_FIELD_SCRIPT, MENU_DEBUG_DEBUG_MENU, MENU_DEBUG_UNKNOWN_1, - MENU_NO_SCREEN_CHANGE = 0xffdc + MENU_NO_SCREEN_CHANGE = 65500 }; +// size: 0x8 struct unkStruct_8035D94 { - union { u8 itemIndex_u8; u32 itemIndex_u32; @@ -43,6 +46,7 @@ struct unkStruct_8035D94 s32 numItems; }; +// size: 0x4 struct MainMenuSub { u8 unk2C; @@ -50,6 +54,7 @@ struct MainMenuSub u8 unk2E; }; +// size: 0x40 struct MainMenu { /* 0x0 */ s32 currMenu; @@ -57,23 +62,24 @@ struct MainMenu /* 0x8 */ s32 lastMenu; u8 padding[0x20]; /* 0x2C */ struct MainMenuSub sub; - /* 0x30 */ struct unkStruct_8035D94 unk30; + struct unkStruct_8035D94 unk30; s16 unk38; u8 unk3A; u8 unk3B; s32 unk3C; }; - - -void InitMainMenu(void); -void DeleteMainMenu(void); -void SetUpMenu(void); -s32 UpdateMenu(void); void CleanUpMenu(void); -bool8 sub_80363E0(void); +void DeleteMainMenu(void); +struct MainMenu *GetMainMenu(void); +void InitMainMenu(void); +void SetMenuItems(struct MenuStruct *, struct UnkTextStruct2 *, s32, const struct UnkTextStruct2 *, const struct MenuItem *, u8, u32, u32); +void SetUpMenu(void); +void sub_8035CC0(struct UnkTextStruct2 *, u32); +void sub_8035CF4(struct MenuStruct*, u32, bool8); struct unkStruct_8035D94 *sub_8035D94(void); void sub_8035DA0(void); -struct MainMenu *GetMainMenu(void); +bool8 sub_80363E0(void); +s32 UpdateMenu(void); #endif // GUARD_MAIN_MENU_H diff --git a/include/menu_input.h b/include/menu_input.h index a23d14cf..dd7b60f5 100644 --- a/include/menu_input.h +++ b/include/menu_input.h @@ -1,4 +1,8 @@ +#ifndef GUARD_MENU_INPUT_H +#define GUARD_MENU_INPUT_H + #include "menu.h" +#include "text.h" u32 sub_8012A64(struct MenuInputStructSub *r0, s32 r1); s32 GetKeyPress(struct MenuInputStruct *r0); @@ -36,3 +40,5 @@ bool8 sub_8013938(struct MenuInputStruct *param_1); void sub_8013984(struct MenuInputStruct * param_1); void sub_8013A54(struct MenuInputStruct *param_1); void sub_8013A7C(struct MenuInputStruct *param_1); + +#endif // GUARD_MENU_INPUT_H \ No newline at end of file diff --git a/include/pokemon.h b/include/pokemon.h index a6d12d40..40875244 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -242,5 +242,8 @@ void SavePokemonStruct(struct unkStruct_8094924* a1, struct PokemonStruct* pokem void RestorePokemonStruct(struct unkStruct_8094924*, struct PokemonStruct*); s32 sub_808E218(struct unkStruct_808E218_arg* a1, struct PokemonStruct* pokemon); +// pokemon.s +extern void sub_808CFD0(u8 *, s16, u8 *, u8, u32 *, u16 *); +extern u32 sub_808D1DC(u8 *); #endif // GUARD_POKEMON_H diff --git a/include/reg_control.h b/include/reg_control.h new file mode 100644 index 00000000..9276eb8c --- /dev/null +++ b/include/reg_control.h @@ -0,0 +1,22 @@ +#ifndef GUARD_CODE_800B5F0_H +#define GUARD_CODE_800B5F0_H + +#include "main.h" + +// size: 0x8 +struct unkStruct_202D648 +{ + s16 unk0; + s16 unk2; // Vcount?? + IntrCallback unk4; // some function... just making it IntrCallback for now +}; + +extern s16 gUnknown_203B0A8; +extern s16 gUnknown_203B0AA; +extern s16 gUnknown_203B0AC; +extern s16 gUnknown_203B0AE; + +void nullsub_17(void); +void xxx_update_bg_sound_input(void); + +#endif // GUARD_CODE_800B5F0_H \ No newline at end of file diff --git a/include/sprite.h b/include/sprite.h new file mode 100644 index 00000000..7790e87e --- /dev/null +++ b/include/sprite.h @@ -0,0 +1,11 @@ +#ifndef GUARD_SPRITE_H +#define GUARD_SPRITE_H + +void InitSprites(void); + +// sprite.s +extern void BlinkSavingIcon(void); +extern void ResetSprites(bool32); +extern void SetSavingIconCoords(u32); + +#endif // GUARD_SPRITE_H \ No newline at end of file diff --git a/include/team_inventory.h b/include/team_inventory.h index a447aafd..d213d1fd 100644 --- a/include/team_inventory.h +++ b/include/team_inventory.h @@ -4,6 +4,8 @@ #define MAX_KECLEON_ITEM_SHOP_ITEMS 8 #define MAX_KECLEON_WARE_SHOP_ITEMS 4 +#include "item.h" + // size: 0x268 struct TeamInventory { @@ -15,6 +17,7 @@ struct TeamInventory /* 0x264 */ s32 teamSavings; }; +// Declared in items.c extern struct TeamInventory *gTeamInventoryRef; #define MAX_TEAM_MONEY 99999 diff --git a/include/text.h b/include/text.h index 5f92a7d9..71203121 100644 --- a/include/text.h +++ b/include/text.h @@ -12,16 +12,18 @@ struct UnkTextStruct1 u32 unkC; u32 unk10; u32 unk14; - u8 *unk18; - u8 *unk1C; + u32 *unk18; + u32 *unk1C; s32 unk20; s32 unk24; - void *unk28; // Somewhere in VRAM + u32 *unk28; // Somewhere in VRAM s32 unk2C; - s32 unk30; - s32 unk34; + u32 *unk30; // Somewhere in VRAM? + u32 *unk34; s32 unk38; - u8 fill3C[0x45 - 0x3C]; + u32 *unk3C; + u32 *unk40; + u8 unk44; bool8 unk45; u8 unk46; }; @@ -32,7 +34,7 @@ struct UnkTextStruct2_sub // I haven't found a func that reads these separately yet, but simply making an arr[2] will cause assignments to break. // Some funcs only match with this union for some reason even though they don't access the variables separately... // The first func to break is currently sub_801A5D8 in kecleon_bros.c - // The first func I matched that uses the array is sub_8006554 in text_1.c (using the separated fields doesn't match or get even close) + // The first func I matched that uses the array is sub_8006554 in text2.c (using the separated fields doesn't match or get even close) union { struct { s16 unk0; @@ -56,17 +58,4 @@ struct UnkTextStruct2 const u8 *unk14; }; -void LoadCharmaps(void); -void SelectCharmap(u32); -u32 xxx_update_some_bg_tiles(u32 a0); -void sub_800641C(struct UnkTextStruct2 *a0, u8 a1, u8 a2); -void sub_8006438(const struct UnkTextStruct2 *, u8, u8, struct UnkTextStruct2_sub *); -void sub_8006518(struct UnkTextStruct2 *); -void sub_8006554(struct UnkTextStruct1 *, void *, u8 *, u16 *, u32, const struct UnkTextStruct2 *, u8, u32, struct UnkTextStruct2_sub *, u8); -void sub_800898C(void); -void sub_80089AC(const struct UnkTextStruct2 *, struct UnkTextStruct2_sub *); -void sub_8009388(void); - -extern void xxx_call_draw_string(s32 x, u32 y, const u8 *str, u32 , u32); - #endif \ No newline at end of file diff --git a/include/text1.h b/include/text1.h new file mode 100644 index 00000000..f6c5f833 --- /dev/null +++ b/include/text1.h @@ -0,0 +1,17 @@ +#ifndef GUARD_TEXT1_H +#define GUARD_TEXT1_H + +#include "text.h" + +extern struct UnkTextStruct1 gUnknown_2027370[4]; +extern struct UnkTextStruct2 gUnknown_202AFC0[4]; +extern u32 gUnknown_202B030; +extern u16 gUnknown_202B038[4][32][32]; + +void LoadCharmaps(void); +void SelectCharmap(u32); +u32 xxx_update_some_bg_tiles(u32 a0); + +void sub_800641C(struct UnkTextStruct2 *a0, u8 a1, u8 a2); + +#endif // GUARD_TEXT1_H \ No newline at end of file diff --git a/include/text2.h b/include/text2.h new file mode 100644 index 00000000..e499efaa --- /dev/null +++ b/include/text2.h @@ -0,0 +1,53 @@ +#ifndef GUARD_TEXT2_H +#define GUARD_TEXT2_H + +#include "text.h" + +// size: 0x10 +struct unkShiftData +{ + u32 bytesA; + u32 bytesB; + u32 shift_left; + u32 shift_right; +}; + +// size: 0x8 +struct unkChar +{ + u32 *unk0; + s16 unk4; + s16 unk6; +}; + +struct unkStruct_80B8824 +{ + u32 arr[9]; +}; +struct unkStruct_80B8848 +{ + u32 arr[8]; +}; + +u32 xxx_call_draw_char(s32, s32, u32, u32, u32); + +void sub_8006518(struct UnkTextStruct2 *); +void sub_8006554(struct UnkTextStruct1 *, u32 *, u32 *, u16 *, u32, const struct UnkTextStruct2 *, u8, u32, struct UnkTextStruct2_sub *, u8); +void sub_80073B8(s32); +void sub_80073E0(s32); +void sub_80078A4(u32, s32, s32, s32, u32); +void sub_800792C(u32, s32, s32, s32, u32); +void sub_8007A78(u32, s32, s32, s32, u32); +void sub_8007B7C(u32, s32, s32, s32, u32); +void sub_8007E20(u32, u32, u32, u32, u32, u8 *, u32); + +// text.s +extern struct unkChar *GetCharacter(u32); +extern void InitGraphics(void); +extern void sub_800898C(void); +extern void sub_80089AC(const struct UnkTextStruct2 *, struct UnkTextStruct2_sub *); +extern void sub_8008C54(u32); +extern void sub_8009388(void); +extern void xxx_call_draw_string(s32 x, u32 y, const u8 *str, u32 , u32); + +#endif // GUARD_TEXT2_H \ No newline at end of file diff --git a/include/wigglytuff_shop.h b/include/wigglytuff_shop.h index 5d1c7f1b..1bf1dcdc 100644 --- a/include/wigglytuff_shop.h +++ b/include/wigglytuff_shop.h @@ -1,9 +1,13 @@ #ifndef GUARD_WIGGLYTUFF_SHOP_H #define GUARD_WIGGLYTUFF_SHOP_H -struct WigglytuffShop +#include "file_system.h" +#include "menu.h" +#include "text.h" + +// size: 0x138 +struct WigglytuffShop { - // size: 0x138 bool32 isAsleep; s32 state; s32 fallbackState; @@ -23,14 +27,12 @@ struct WigglytuffShop u8 unkC9; u8 unkCA; u8 fillCB; - u8 *unkCC; + struct OpenedFile **unkCC; struct UnkTextStruct2 unkD0[4]; u32 unk130; u32 unk134; }; -extern struct WigglytuffShop *gWigglytuffShop; - enum WigglytuffStates { WIGGLYTUFF_INIT = 0, diff --git a/ld_script.txt b/ld_script.txt index 410f02de..38bdeda6 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -67,15 +67,15 @@ SECTIONS { asm/code_8005838.o(.text); src/code_800558C.o(.text); src/random.o(.text); - src/text.o(.text); - src/text_1.o(.text); + src/text1.o(.text); + src/text2.o(.text); asm/text.o(.text); src/code_8009804.o(.text); asm/code_8009804.o(.text); src/file_system.o(.text); src/main.o(.text); - asm/code_800B5F0.o(.text); - src/code_800B5F0.o(.text); + src/unused_vblank.o(.text); + src/reg_control.o(.text); src/music.o(.text); src/code_800C9CC.o(.text); src/bg_control.o(.text); @@ -101,7 +101,6 @@ SECTIONS { src/code_801AFA4.o(.text); src/code_801B3C0.o(.text); src/code_801C620.o(.text); - asm/code_801C620.o(.text); src/code_801D760.o(.text); asm/code_801D760.o(.text); src/options_menu.o(.text); @@ -160,10 +159,10 @@ SECTIONS { src/load_screen.o(.text); src/wonder_mail_main_menu.o(.text); src/ds_menus.o(.text); - src/debug_menu.o(.text); - src/debug_menu_mid.o(.text); - asm/debug_menu_1.o(.text); - src/debug_menu_1.o(.text); + src/debug_menu1.o(.text); + src/debug_menu2.o(.text); + src/debug_menu3.o(.text); + src/debug_menu4.o(.text); asm/code_803B050.o(.text); src/code_803B050.o(.text); src/pokemon_mail.o(.text); @@ -428,9 +427,10 @@ SECTIONS { src/rescue_password_menu.o(.rodata); src/load_screen.o(.rodata); src/wonder_mail_main_menu.o(.rodata); - src/debug_menu.o(.rodata); - src/debug_menu_mid.o(.rodata); - src/debug_menu_1.o(.rodata); + src/debug_menu1.o(.rodata); + src/debug_menu2.o(.rodata); + src/debug_menu3.o(.rodata); + src/debug_menu4.o(.rodata); data/data_80E7D40.o(.rodata); src/pokemon_mail.o(.rodata); data/personality_test.o(.rodata); diff --git a/src/adventure_log.c b/src/adventure_log.c index f3ca0fd1..fa883a64 100644 --- a/src/adventure_log.c +++ b/src/adventure_log.c @@ -1,9 +1,10 @@ #include "global.h" +#include "code_80130A8.h" #include "constants/input.h" -#include "input.h" #include "memory.h" -#include "text.h" #include "menu_input.h" +#include "text1.h" +#include "text2.h" struct AdventureLog { @@ -50,10 +51,6 @@ extern s16 sub_8097838(); extern s16 sub_8097870(); extern s32 sub_80977B8(); extern s32 sub_80977F8(); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); -extern void xxx_format_and_draw(u32, u32, const char *, u32, u32); const u8 *GetAdventureLogLine(u8 index); extern u32 gUnknown_202DE30; diff --git a/src/adventure_log_menu.c b/src/adventure_log_menu.c index 0f9e9a7a..ea0b921e 100644 --- a/src/adventure_log_menu.c +++ b/src/adventure_log_menu.c @@ -1,12 +1,12 @@ #include "global.h" +#include "adventure_log.h" #include "input.h" #include "main_menu.h" -#include "adventure_log.h" -#include "text.h" +#include "text1.h" extern void CreateAdventureLogScreen(u32); extern u32 HandleAdventureLogInput(u32); -extern void CleanAdventureLogScreen(); +extern void CleanAdventureLogScreen(void); void CreateAdventureLogMenu(void) { @@ -24,8 +24,7 @@ u32 UpdateAdventureLogMenu(void) u32 nextMenu; nextMenu = MENU_NO_SCREEN_CHANGE; - switch(HandleAdventureLogInput(1)) - { + switch (HandleAdventureLogInput(1)) { case 0: case 1: break; @@ -37,4 +36,4 @@ u32 UpdateAdventureLogMenu(void) break; } return nextMenu; -} +} \ No newline at end of file diff --git a/src/bg_palette_buffer.c b/src/bg_palette_buffer.c index e15280d3..ceee4969 100644 --- a/src/bg_palette_buffer.c +++ b/src/bg_palette_buffer.c @@ -1,4 +1,5 @@ #include "global.h" +#include "bg_palette_buffer.h" #define BG_PALETTE_BUFFER_SIZE 512 #define BG_PALETTE_BUFFER_CHUNK_SIZE 16 diff --git a/src/code_2.c b/src/code_2.c index 198ea8bd..3572246f 100644 --- a/src/code_2.c +++ b/src/code_2.c @@ -12,11 +12,14 @@ #include "play_time.h" #include "save.h" #include "game_options.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "exclusive_pokemon.h" #include "pokemon.h" #include "rescue_team_info.h" +#include "cpu.h" #include "code_8094F88.h" +#include "sprite.h" extern void sub_801180C(void); extern void NDS_LoadOverlay_GroundMain(void); @@ -29,15 +32,12 @@ extern void LoadMailInfo(void); extern void sub_800CD64(u32, u32); extern void SetWindowTitle(char *); extern void sub_800DAAC(void); -extern void SetSavingIconCoords(u32); extern void sub_800135C(void); extern void xxx_script_related_8001334(u32); extern void sub_80015C0(u32, u32); extern u32 sub_8001658(u32, u32); extern void sub_800A8F8(u32); -extern void ResetSprites(u32); extern void sub_80097B0(void); -extern void sub_800CDA8(u32); extern void LoadTitleScreen(void); extern void SetBGPaletteBufferColorRGB(s32, u8 *, s32, u8 *); extern void sub_80095CC(u32, u32); @@ -112,7 +112,7 @@ void GameLoop(void) while (1) { gUnknown_203B03C = 0; // ??? sub_800A8F8(2); - ResetSprites(1); + ResetSprites(TRUE); xxx_update_some_bg_tiles(0); sub_80097B0(); sub_800CDA8(2); @@ -211,5 +211,5 @@ void xxx_update_stuff(u32 r0) xxx_call_update_bg_vram(); sub_8009908(); xxx_call_update_bg_sound_input(); - ResetSprites(0); + ResetSprites(FALSE); } diff --git a/src/code_8009804.c b/src/code_8009804.c index 98364c50..e3cdf570 100644 --- a/src/code_8009804.c +++ b/src/code_8009804.c @@ -1,9 +1,9 @@ #include "global.h" #include "file_system.h" +#include "text1.h" extern u8 gUnknown_202D238[4]; extern s32 gUnknown_202D23C; -extern u16 gUnknown_202B038[4][32][32]; extern u8 gUnknown_80B88CC[]; extern struct FileArchive gSystemFileArchive; diff --git a/src/code_800C9CC.c b/src/code_800C9CC.c index 5da46b6d..fc207e29 100644 --- a/src/code_800C9CC.c +++ b/src/code_800C9CC.c @@ -1,9 +1,9 @@ #include "global.h" #include "input.h" #include "random.h" +#include "reg_control.h" void sub_800BA5C(); -void xxx_update_bg_sound_input(); extern u32 gUnknown_203B0B8; extern u16 gRawKeyInput; diff --git a/src/code_80118A4.c b/src/code_80118A4.c index 5e4a285a..444a3ca8 100644 --- a/src/code_80118A4.c +++ b/src/code_80118A4.c @@ -8,6 +8,7 @@ #include "input.h" #include "config.h" #include "game_options.h" +#include "sprite.h" void xxx_call_stop_bgm(void); @@ -47,7 +48,6 @@ extern void sub_8005180(void); extern void sub_80060EC(void); extern void sub_8011860(void); extern void sub_800CB20(void); -extern void ResetSprites(u32); extern void sub_8004AF0(u8, u32 *r1, u32, u32, u32 *r2, u32); extern u8 sub_80111C4(); extern void sub_8010F28(); @@ -75,7 +75,7 @@ void sub_801169C(void) sub_8009908(); xxx_call_update_bg_sound_input(); sub_8011860(); - ResetSprites(0); + ResetSprites(FALSE); } void sub_8011760(void) diff --git a/src/code_8012A18.c b/src/code_8012A18.c index 4da7efc1..e20b728a 100644 --- a/src/code_8012A18.c +++ b/src/code_8012A18.c @@ -2,6 +2,7 @@ #include "code_800558C.h" #include "input.h" #include "game_options.h" +#include "sprite.h" extern void sub_8011860(); extern void xxx_draw_string_80144C4(); @@ -14,7 +15,6 @@ extern void TransferBGPaletteBuffer(); extern void xxx_call_update_bg_vram(); extern void sub_8009908(); extern void xxx_call_update_bg_sound_input(); -extern void ResetSprites(u8 r0); extern struct GameOptions *gGameOptionsRef; @@ -34,6 +34,6 @@ void sub_8012A18() xxx_call_update_bg_vram(); sub_8009908(); xxx_call_update_bg_sound_input(); - ResetSprites(0); + ResetSprites(FALSE); } diff --git a/src/code_8012A18_1.c b/src/code_8012A18_1.c index dc3031d9..8bfc38cb 100644 --- a/src/code_8012A18_1.c +++ b/src/code_8012A18_1.c @@ -1,9 +1,10 @@ #include "global.h" -#include "menu.h" -#include "file_system.h" +#include "code_8012A18_1.h" +#include "code_80130A8.h" #include "memory.h" #include "input.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "text_util.h" struct unkStruct_203B200 @@ -25,10 +26,6 @@ extern const char gUnknown_80DB6BC; extern const char gUnknown_80DB688; extern u8 gAvailablePokemonNames[0x58]; -extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32); -extern void sub_8014248(const char *r0, u32, u32, const struct MenuItem *r4, u32, u32, u32, struct OpenedFile **r5, u32); - -extern s32 sub_80144A4(s32 *); extern void sub_80151C0(u32, u8 *); extern void CreateConfirmNameMenu(void); extern void sub_80160F4(u32); @@ -53,15 +50,6 @@ enum extern u32 ReturnIntFromChar2(u8); -struct unkChar -{ - u32 unk0; - s16 unk4; - s16 unk6; -}; - -struct unkChar *GetCharacter(u32); - s32 sub_8015FEC(u8 *buffer, s32 size) { diff --git a/src/code_801AFA4.c b/src/code_801AFA4.c index f8ce4a76..f4716c5e 100644 --- a/src/code_801AFA4.c +++ b/src/code_801AFA4.c @@ -6,6 +6,7 @@ #include "menu.h" #include "pokemon.h" #include "gulpin_shop.h" +#include "code_80130A8.h" extern void sub_8092C84(u8 *, u16); extern void sub_8099690(u32); @@ -19,9 +20,9 @@ extern void sub_801B2D8(void); extern void nullsub_37(); extern void sub_801B080(); -extern u32 gUnknown_80DB9BC; -extern u32 gUnknown_80DB9E4; -extern u32 gUnknown_80DBA0C; +extern const u8 gUnknown_80DB9BC[]; +extern const u8 gUnknown_80DB9E4[]; +extern const u8 gUnknown_80DBA0C[]; extern u8 gUnknown_202E1C8[0x50]; extern u8 gAvailablePokemonNames[0x50]; @@ -33,10 +34,7 @@ extern bool8 IsHMItem(u8); extern void sub_801B178(void); extern void sub_8094060(void *, struct Move *); extern void PlaySound(u32); -extern void sub_80141B4(u32 *, u32, u32 ,u32); -extern void sub_8014248(u32 *, u32, u32, struct MenuItem *, u32, u32, u32, u32, u32); extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); -extern s32 sub_80144A4(s32 *); extern u32 sub_801E8C0(void); extern bool8 CanMonLearnMove(u16 moveID, s16 _species); @@ -126,7 +124,7 @@ void sub_801B080(void) sub_801B178(); // {CENTER_ALIGN}Who will learn the move // {CENTER_ALIGN}{COLOR_1 CYAN}{ARG_POKEMON_7}{END_COLOR_TEXT_1}? - sub_8014248(&gUnknown_80DB9BC, 0, gUnknown_203B22C->unk60, gUnknown_203B22C->menuItems, 0, 4, 0, 0, 0x20); + sub_8014248(gUnknown_80DB9BC, 0, gUnknown_203B22C->unk60, gUnknown_203B22C->menuItems, 0, 4, 0, 0, 0x20); break; case 1: CreateGulpinShop(2, gUnknown_203B22C->chosenPokemon, gUnknown_203B22C->moves); @@ -141,12 +139,12 @@ void sub_801B080(void) PlaySound(0x9C << 1); // {CENTER_ALIGN}CM{ARG_POKEMON_8}{END_COLOR_TEXT_1} learned // {CENTER_ALIGN}the move {COLOR_1 CYAN}{ARG_POKEMON_7}{END_COLOR_TEXT_1}! - sub_80141B4(&gUnknown_80DB9E4, 0, 0, 0x121); + sub_80141B4(gUnknown_80DB9E4, 0, 0, 0x121); break; case 3: // {CENTER_ALIGN}No one in the current team // {CENTER_ALIGN}can learn this move. - sub_80141B4(&gUnknown_80DBA0C, 0, 0, 0x121); + sub_80141B4(gUnknown_80DBA0C, 0, 0, 0x121); break; default: case 4: diff --git a/src/code_801B3C0.c b/src/code_801B3C0.c index 234baf06..c2860279 100644 --- a/src/code_801B3C0.c +++ b/src/code_801B3C0.c @@ -1,31 +1,17 @@ #include "global.h" +#include "code_801B3C0.h" #include "constants/colors.h" -#include "text.h" -#include "input.h" +#include "text1.h" +#include "text2.h" #include "item.h" #include "memory.h" -#include "menu.h" #include "pokemon.h" #include "team_inventory.h" #include "menu_input.h" -#include "subStruct_203B240.h" #include "kecleon_bros.h" +#include "sprite.h" +#include "code_80130A8.h" -// based off of 203B240.. -struct unkStruct_203B230 -{ - // size: 0x94 - s32 state; - struct Item item; - s32 unk8; - s32 unkC; - struct subStruct_203B240 *unk10[2]; - u8 fill14[0x20 - 0x18]; - u32 unk20; - u32 unk24; - struct UnkTextStruct2 unk28[4]; - struct MenuInputStructSub unk88; -}; extern struct unkStruct_203B230 *gUnknown_203B230; struct unkStruct_203B234 @@ -72,7 +58,6 @@ extern u8 gUnknown_202DEA8[]; extern u8 *gUnknown_80D4920[]; extern u8 *gUnknown_80D4928[]; -extern s32 sub_80144A4(s32 *); extern void sub_8099690(u32); extern struct UnkTextStruct2 gUnknown_80DBA58; @@ -82,18 +67,11 @@ extern struct UnkTextStruct2 gUnknown_80DBA70; extern void sub_801BB5C(void); extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern void sub_801B748(u32); -extern void sub_8008C54(u32); -extern void sub_80073E0(u32); -extern void sub_80073B8(u32); -extern void xxx_format_and_draw(u32, u32, u8 *, u32, u32); extern void PlayMenuSoundEffect(u32); extern void sub_8013F84(void); extern s32 sub_80913E0(struct Item *, u32, struct subStruct_203B240 **); -extern void sub_80141B4(u8 *, u32, u32 *, u32); -extern void sub_8014248(const char *, u32, u32, struct MenuItem *, u32, u32, u32, u32, u32); extern void sub_80140B4(struct UnkTextStruct2 *); extern void sub_801B46C(u32); -extern void ResetSprites(u32); extern void sub_801BC64(void); extern void sub_801BC94(void); extern void sub_801BCCC(void); @@ -117,7 +95,7 @@ void sub_801BC24(void); u32 sub_801B3C0(struct Item *item) { - ResetSprites(1); + ResetSprites(TRUE); gUnknown_203B230 = MemoryAlloc(sizeof(struct unkStruct_203B230),8); gUnknown_203B230->item = *item; sub_801317C(&gUnknown_203B230->unk88); diff --git a/src/code_801C620.c b/src/code_801C620.c index 17cb70e1..e8c56b67 100644 --- a/src/code_801C620.c +++ b/src/code_801C620.c @@ -1,15 +1,18 @@ -#include "constants/item.h" #include "global.h" +#include "code_801C620.h" +#include "constants/item.h" #include "constants/iq_skill.h" -#include "input.h" #include "item.h" #include "memory.h" #include "pokemon.h" #include "pokemon_3.h" #include "team_inventory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "subStruct_203B240.h" #include "menu_input.h" +#include "sprite.h" +#include "code_80130A8.h" struct unkStruct_203B238 { @@ -27,28 +30,28 @@ struct unkStruct_203B238 struct UnkTextStruct2 unkC4[4]; }; +// size: 0xC4 struct unkStruct_203B23C -{ - // size: 0xC4 +{ /* 0x0 */ s16 species; /* 0x4 */ struct PokemonStruct *pokeStruct; /* 0x8 */ u8 iqSkills[NUM_IQ_SKILLS]; /* 0x20 */ s32 numIQSkills; /* 0x24 */ struct MenuInputStruct input; u32 unk58; - /* 0x5C */ struct UnkTextStruct2 *unk5C; - /* 0x60 */ struct UnkTextStruct2 unk60[4]; + struct UnkTextStruct2 *unk5C; + struct UnkTextStruct2 unk60[4]; u8 unkC0; u8 unkC1; u8 unkC2; u8 unkC3; }; +// size: 0x94 struct unkStruct_203B240 { - // size: 0x94 - s32 state; - u8 chosenIQSkill; + /* 0x0 */ s32 state; + /* 0x4 */ u8 chosenIQSkill; s32 unk8; s32 unkC; struct subStruct_203B240 *unk10[2]; @@ -59,30 +62,31 @@ struct unkStruct_203B240 struct MenuInputStructSub unk88; }; +// size: 0x554 struct unkStruct_203B244 { - // size: 0x554 u32 unk0; - u8 itemIDs[NUMBER_OF_ITEM_IDS]; + /* 0x4 */ u8 itemIDs[NUMBER_OF_ITEM_IDS]; u32 unkF4[NUMBER_OF_ITEM_IDS]; - struct MenuInputStruct input; + /* 0x4B4 */ struct MenuInputStruct input; u32 unk4E8; struct UnkTextStruct2 * unk4EC; struct UnkTextStruct2 unk4F0[4]; u8 unk550[4]; }; +// size: 118 struct unk_203B250 { - struct PokemonStruct *pokeStruct; - s16 index; + /* 0x0 */ struct PokemonStruct *pokeStruct; + /* 0x4 */ s16 index; /* 0x6 */ u8 currFriendAreaLocation; // 0 when not in a friend area u8 unk7; u8 unk8; u8 unk9; struct PokemonStruct *unkC; - u32 state; - u32 menuAction; + /* 0x10 */ u32 state; + /* 0x14 */ u32 menuAction; struct MenuStruct unk18; struct MenuItem unk68[8]; u16 unkA8[8]; @@ -96,6 +100,7 @@ extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern u8 sub_8002658(s16); extern s16 sub_80A5728(void); extern void sub_801D208(u32); +extern void sub_801D4C0(void); extern void sub_801D680(void); extern void sub_801D760(void); extern void sub_801D77C(void); @@ -110,11 +115,14 @@ s16 sub_80A7AE8(s32); extern struct PokemonStruct *sub_808D3F8(void); extern const struct UnkTextStruct2 gUnknown_80DBE54; -extern struct UnkTextStruct2 gUnknown_80DBDD8; -extern struct UnkTextStruct2 gUnknown_80DBDF0; -extern struct UnkTextStruct2 gUnknown_80DBDB0; -extern struct UnkTextStruct2 gUnknown_80DBD98; -extern struct UnkTextStruct2 gUnknown_80DBE3C; +extern const struct UnkTextStruct2 gUnknown_80DBDD8; +extern const struct UnkTextStruct2 gUnknown_80DBDF0; +extern const struct UnkTextStruct2 gUnknown_80DBDB0; +extern const struct UnkTextStruct2 gUnknown_80DBD98; +extern const struct UnkTextStruct2 gUnknown_80DBE3C; +extern const struct UnkTextStruct2 gUnknown_80DBE7C; +extern const struct UnkTextStruct2 gUnknown_80DBE98; +extern const struct UnkTextStruct2 gUnknown_80DBEB0[4]; extern struct unkStruct_203B238 *gUnknown_203B238; extern struct unkStruct_203B23C *gUnknown_203B23C; @@ -139,22 +147,15 @@ extern char gUnknown_80DBE30[]; // {ARG_POKEMON_0} extern u8 gUnknown_80DBDC8[]; extern u8 *gUnknown_80D4970[]; -extern void sub_8007B7C(s32, s32, s32, s32, s32); extern u32 sub_801CE58(void); extern void sub_801CC38(void); -extern void ResetSprites(u32); extern void sub_80140B4(struct UnkTextStruct2 *); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern u32 sub_8097DF0(char *, struct subStruct_203B240 **); extern void sub_8013F84(void); extern void PlayMenuSoundEffect(u32); extern char * GetIQSkillDescription(u8 r0); extern s32 GetNumAvailableIQSkills(u8 *param_1, s32 pokeIQ); -extern void sub_8013C68(u32 *); extern char * GetIQSkillName(u8 r0); -extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32); extern u32 sub_80095E4(s16, u32); extern void sub_801C440(void); extern void sub_801C4C8(void); @@ -167,9 +168,6 @@ void sub_801C6D0(s32); void sub_801C7D4(void); void sub_801C6E4(void); void sub_801C848(void); -void sub_801CCD8(void); -bool8 sub_801CF14(s32); -void sub_801CF94(void); u32 sub_801C308(u8); extern void PlaySound(u32); @@ -187,11 +185,8 @@ void sub_801C03C(void); void sub_801C118(void); void sub_801C1A0(void); void sub_801C228(void); -u8 sub_801CB24(void); -u32 sub_801CFE0(u8); -s32 sub_801CFB8(void); -extern void sub_801D220(void); +void sub_801D220(void); extern void sub_801D3A8(void); @@ -618,7 +613,7 @@ bool8 HasNoAvailIQSkills(s16 species) u32 sub_801C620(u8 iqSkill) { - ResetSprites(1); + ResetSprites(TRUE); gUnknown_203B240 = MemoryAlloc(sizeof(struct unkStruct_203B240),8); gUnknown_203B240->chosenIQSkill = iqSkill; sub_801317C(&gUnknown_203B240->unk88); @@ -788,13 +783,13 @@ bool8 sub_801C8C4(s32 param_1, s32 param_2, struct UnkTextStruct2_sub *param_3, } } -bool8 sub_801CA08(u8 param_1) +u32 sub_801CA08(bool8 param_1) { u32 index; u32 temp; u32 flag; - if (param_1 == 0) { + if (param_1 == FALSE) { sub_8013660(&gUnknown_203B244->input); return 0; } @@ -843,7 +838,7 @@ u8 sub_801CB24(void) { return gUnknown_203B244->itemIDs[(gUnknown_203B244->input.unk1E * gUnknown_203B244->input.unk1C) + gUnknown_203B244->input.menuIndex]; } -void sub_801CB5C(u8 r0) { +void sub_801CB5C(bool8 r0) { ResetUnusedInputStruct(); sub_800641C(gUnknown_203B244->unk4F0, 0, 0); gUnknown_203B244->input.unk22 = sub_801CE58(); @@ -1218,3 +1213,58 @@ void sub_801D208(u32 newState) sub_801D220(); sub_801D3A8(); } + +void sub_801D220(void) +{ + s32 i; + + sub_8006518(gUnknown_203B250->unkB8); + + switch (gUnknown_203B250->state) { + case 0: + sub_801D4C0(); + + if (gUnknown_203B250->pokeStruct != NULL) { + for (i = 0; i < 4; i++) + gUnknown_203B250->unkB8[i] = gUnknown_80DBE7C; + + gUnknown_203B250->unkB8[0] = gUnknown_80DBE98; + sub_8012CAC(gUnknown_203B250->unkB8, gUnknown_203B250->unk68); + gUnknown_203B250->unkB8[0].unkC = 9; + } + else { + for (i = 0; i < 4; i++) + gUnknown_203B250->unkB8[i] = gUnknown_80DBEB0[i]; + + sub_8012CAC(gUnknown_203B250->unkB8, gUnknown_203B250->unk68); + gUnknown_203B250->unkB8[0].unkC = 8; + } + break; + case 1: + sub_801D4C0(); + + if (gUnknown_203B250->pokeStruct != NULL) { + for (i = 0; i < 4; i++) + gUnknown_203B250->unkB8[i] = gUnknown_80DBE7C; + + gUnknown_203B250->unkB8[0] = gUnknown_80DBE98; + sub_8012CAC(gUnknown_203B250->unkB8, gUnknown_203B250->unk68); + gUnknown_203B250->unkB8[0].unkC = 9; + } + else { + for (i = 0; i < 4; i++) + gUnknown_203B250->unkB8[i] = gUnknown_80DBEB0[i]; + + sub_8012CAC(gUnknown_203B250->unkB8, gUnknown_203B250->unk68); + gUnknown_203B250->unkB8[0].unkC = 8; + } + break; + default: + for (i = 0; i < 4; i++) + gUnknown_203B250->unkB8[i] = gUnknown_80DBE7C; + break; + } + + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B250->unkB8, 1, 1); +} \ No newline at end of file diff --git a/src/code_801D760.c b/src/code_801D760.c index 09e02546..c63394b0 100644 --- a/src/code_801D760.c +++ b/src/code_801D760.c @@ -10,10 +10,12 @@ #include "team_inventory.h" #include "memory.h" #include "input.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "rescue_team_info.h" #include "code_800D090.h" #include "menu_input.h" +#include "code_8021774.h" struct unkStruct_203B258 { @@ -38,8 +40,6 @@ extern void sub_801BF98(void); extern void sub_801D208(u8); extern u32 sub_801DCE8(void); extern void sub_801DD50(void); -extern u32 sub_80217EC(void); -extern void sub_8021830(void); extern u32 sub_8022860(); extern void sub_8022908(); extern u32 sub_80244E4(void); @@ -56,12 +56,8 @@ extern void InitializeJobListMenu(u32); extern const char *sub_8098FB4(); extern void xxx_format_string(const char *, u8 *, u32 **, u32); extern s32 sub_8008ED0(u8 *); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); void LoadTeamRankBadge(u32, u32, u32); extern void SetBGPaletteBufferColorArray(s32 index, u8 *colorArray); -extern void sub_8007E20(u32, u32, u32, u32, u32, u8 *, u32); extern struct FileArchive gTitleMenuFileArchive; extern const char gTeamRankBadgeFileName; @@ -113,7 +109,6 @@ extern u32 sub_8027074(void); extern void sub_80227B8(struct PokemonStruct *); extern bool8 sub_8024458(s16, u32); extern bool8 sub_801BEEC(s16); -extern void sub_8021774(u8, u32, u32); void sub_801D894(void); u32 sub_8025EF4(struct PokemonStruct *); diff --git a/src/code_801EE10.c b/src/code_801EE10.c index b230640c..82b4b6ca 100644 --- a/src/code_801EE10.c +++ b/src/code_801EE10.c @@ -1,8 +1,7 @@ #include "global.h" -#include "pokemon.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "memory.h" -#include "input.h" #include "code_801EE10.h" #include "menu_input.h" diff --git a/src/code_801EE10_1.c b/src/code_801EE10_1.c index 5055072a..0c2e4fa4 100644 --- a/src/code_801EE10_1.c +++ b/src/code_801EE10_1.c @@ -4,7 +4,8 @@ #include "pokemon.h" #include "input.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "text_util.h" #include "menu_input.h" diff --git a/src/code_801EE10_mid.c b/src/code_801EE10_mid.c index e59f6821..57157508 100644 --- a/src/code_801EE10_mid.c +++ b/src/code_801EE10_mid.c @@ -1,13 +1,16 @@ #include "global.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "pokemon.h" -#include "input.h" #include "code_800D090.h" #include "moves.h" #include "code_801EE10.h" #include "menu_input.h" #include "subStruct_203B240.h" +#include "sprite.h" +#include "code_80130A8.h" +#include "code_801EE10_mid.h" extern struct unkStruct_203B270 *gUnknown_203B270; @@ -54,10 +57,6 @@ extern u8 gUnknown_80DC310[]; extern u8 gUnknown_80DC2DC[]; extern void PlayMenuSoundEffect(u32); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); -extern void ResetSprites(u32); extern void sub_80140B4(struct UnkTextStruct2 *); extern void sub_801F918(s32); extern void sub_801FA58(void); @@ -65,7 +64,6 @@ extern void sub_801FAD4(void); extern void sub_801F930(void); extern void sub_801F9A4(void); int unk_MoveIDPrintMoveDescription(int a1, u16 moveID, int a3, struct subStruct_203B240** a4); -extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32); void sub_8013F84(void); @@ -259,7 +257,7 @@ bool8 sub_801F808(u16 *moveIDs) { s32 index; - ResetSprites(1); + ResetSprites(TRUE); gUnknown_203B278 = MemoryAlloc(sizeof(struct unkStruct_203B278), 8); gUnknown_203B278->unk5C = 0; gUnknown_203B278->unk60 = gUnknown_203B278->unk64; diff --git a/src/code_8021774.c b/src/code_8021774.c index 072e52ed..d7a39a3b 100644 --- a/src/code_8021774.c +++ b/src/code_8021774.c @@ -2,12 +2,14 @@ #include "global.h" #include "input.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "pokemon.h" #include "exclusive_pokemon.h" #include "friend_area.h" #include "code_800D090.h" #include "menu_input.h" +#include "code_8021774.h" struct unkStruct_203B28C { @@ -48,18 +50,13 @@ extern u8 gUnknown_80DC4F0[]; extern u8 *gUnknown_80D49BC[]; extern u8 gUnknown_80DC524[]; extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern void sub_8092578(u8 *buffer, u8 index, u8 r2); -void sub_800792C(u32, u32, u32, u32, u32); -void sub_8007A78(u32, u32, u32, u32, u32); extern void sub_8021878(void); extern void sub_8021894(void); extern void PlayMenuSoundEffect(u32); extern void sub_8021A60(void); void sub_8021820(void); -extern u8 *gFriendAreas; u8 sub_80023E4(u32); s32 sub_8021664(void) diff --git a/src/code_8021774_pre.c b/src/code_8021774_pre.c index dbaf054f..72ceb676 100644 --- a/src/code_8021774_pre.c +++ b/src/code_8021774_pre.c @@ -1,14 +1,18 @@ #include "global.h" +#include "code_801EE10_mid.h" +#include "code_8021774_pre.h" #include "constants/friend_area.h" #include "constants/input.h" #include "friend_area.h" #include "input.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "item.h" #include "team_inventory.h" #include "menu_input.h" +// size: 0xE0 struct unkStruct_203B280 { u8 unk0[NUM_FRIEND_AREAS]; @@ -19,6 +23,7 @@ struct unkStruct_203B280 struct UnkTextStruct2 unk7C[4]; u8 unkDC[4]; }; + extern struct unkStruct_203B280 *gUnknown_203B280; extern u32 gUnknown_203B284; extern u16 gUnknown_203B288; @@ -29,9 +34,7 @@ extern struct UnkTextStruct2 gUnknown_80DC464; u8 sub_8021700(u32 mode); s32 sub_8021664(void); -extern u8 sub_802132C(void); extern void sub_8021410(void); -extern void sub_8021494(void); extern void PlayMenuSoundEffect(u32); bool8 sub_80211AC(u32 param_1, u32 param_2) @@ -63,7 +66,7 @@ bool8 sub_80211AC(u32 param_1, u32 param_2) } } -u32 sub_8021274(u8 param_1) +u32 sub_8021274(bool8 param_1) { if (param_1 == 0) { sub_8013660(&gUnknown_203B280->unk40); @@ -104,7 +107,7 @@ u8 sub_802132C(void) return gUnknown_203B280->unk0[gUnknown_203B280->unk40.unk1E * gUnknown_203B280->unk40.unk1C + gUnknown_203B280->unk40.menuIndex]; } -void sub_8021354(u8 param_1) +void sub_8021354(bool8 param_1) { ResetUnusedInputStruct(); sub_800641C(gUnknown_203B280->unk7C,0,0); diff --git a/src/code_8023144.c b/src/code_8023144.c index 4dd4bd27..b2ebdb39 100644 --- a/src/code_8023144.c +++ b/src/code_8023144.c @@ -3,18 +3,19 @@ #include "constants/input.h" #include "constants/iq_skill.h" #include "memory.h" -#include "menu.h" #include "pokemon.h" #include "pokemon_3.h" #include "team_inventory.h" -#include "text.h" -#include "input.h" +#include "text1.h" +#include "text2.h" #include "item.h" #include "menu_input.h" #include "code_8023144.h" #include "code_800D090.h" #include "friend_area.h" #include "kecleon_bros.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" struct unkStruct_3001B5C { @@ -61,11 +62,8 @@ extern u8 gUnknown_80DC8F8[]; extern u8 *gUnknown_80D4940[]; extern u8 *gUnknown_80D4970[]; extern void sub_8022924(s32); -extern s32 sub_80144A4(s32 *); extern u32 sub_801B00C(void); extern void sub_801B048(void); -extern u32 sub_801B410(void); -extern void sub_801B450(void); void GetGummiItemStatBoost(struct PokemonStruct* pokemon, u8 id, bool8 checkBoostFlags, struct Gummi* gummi); @@ -462,9 +460,6 @@ void sub_8023420(void) extern u8 gUnknown_80DC934[]; -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); bool8 HasRecruitedMon(s16 species_); extern u8 gUnknown_80DC93C[]; diff --git a/src/code_8023144_pre.c b/src/code_8023144_pre.c index 738f1e45..459abe44 100644 --- a/src/code_8023144_pre.c +++ b/src/code_8023144_pre.c @@ -7,12 +7,12 @@ #include "pokemon.h" #include "pokemon_3.h" #include "team_inventory.h" -#include "text.h" +#include "text1.h" #include "input.h" #include "item.h" #include "menu_input.h" #include "code_8023144.h" -#include "text.h" +#include "text2.h" struct unkStruct_203B294 *gUnknown_203B294; extern u8 gAvailablePokemonNames[]; diff --git a/src/code_8031D70.c b/src/code_8031D70.c index a6c8e8ab..1bde2d79 100644 --- a/src/code_8031D70.c +++ b/src/code_8031D70.c @@ -3,7 +3,8 @@ #include "constants/colors.h" #include "input.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "dungeon_global_data.h" #include "pokemon.h" #include "code_8094F88.h" @@ -46,10 +47,6 @@ const struct UnkTextStruct2 gUnknown_80E1FC4 = { ALIGNED(4) const u8 gUnknown_80E1FDC[] = "Password"; ALIGNED(4) static const u8 fill0[] = "pksdir0"; -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); -extern void sub_80078A4(u32, u32, u32, u32, u32); extern void sub_803D2C0(u8 *, struct unkStruct_203B480 *); extern void PlayMenuSoundEffect(u32); diff --git a/src/code_8057824_1.c b/src/code_8057824_1.c index 7dd0d461..7301385f 100644 --- a/src/code_8057824_1.c +++ b/src/code_8057824_1.c @@ -359,7 +359,6 @@ void LugiaScreenFlash2(); extern void sub_80861B8(struct Entity *, u32, u32); void nullsub_99(); -extern bool8 *gFriendAreas; extern void sub_8049884(); extern void sub_8049B8C(); diff --git a/src/code_809447C.c b/src/code_809447C.c index 71795e65..77b3fefb 100644 --- a/src/code_809447C.c +++ b/src/code_809447C.c @@ -1,10 +1,12 @@ #include "global.h" +#include "code_80130A8.h" #include "code_8092334.h" #include "code_809447C.h" #include "item.h" #include "moves.h" #include "dungeon_global_data.h" #include "text_util.h" +#include "text2.h" struct unkStruct_8113080 { @@ -39,10 +41,7 @@ extern struct unkStruct_8113080 gUnknown_8113080[]; void sub_80928C0(u8 *buffer, struct Move *move, struct unkStruct_80928C0 *param_3); extern void xxx_format_string(const char *, u8 *, void *, u32); void PrintYellowDungeonNametoBuffer(u8 *buffer, struct DungeonLocation *dungeonLocation); -extern void sub_80073B8(u32); -extern void xxx_format_and_draw(s32, s32, const u8 *, ...); extern s32 sub_8008ED0(u8 *); -extern void sub_80073E0(u32); void sub_809447C(struct unkStruct_8094924 *r0, u8 *r1) { diff --git a/src/code_80958E8_1.c b/src/code_80958E8_1.c index eba9be96..055bd9a3 100644 --- a/src/code_80958E8_1.c +++ b/src/code_80958E8_1.c @@ -19,7 +19,6 @@ extern u8 IsJobSlotEmpty(u8); extern struct WonderMail * GetJobSlotInfo(u8); extern bool8 IsValidWonderMail(struct WonderMail *WonderMailData); extern u8 sub_8095E38(struct WonderMail *, u8, u8, bool8); -extern void sub_808CFD0(s32, s16, u8, u8, u32 *, u32); extern void ResetJobSlot(u8); extern void sub_8096C80(void); extern void sub_8096D24(void); @@ -212,7 +211,7 @@ s32 CountJobsinDungeon(u8 dungeon) return count; } -bool8 sub_8096A08(u8 dungeon, s32 param_2) +bool8 sub_8096A08(u8 dungeon, u8 *param_2) { struct WonderMail *mail; s32 index; @@ -236,7 +235,7 @@ bool8 sub_8096A08(u8 dungeon, s32 param_2) temp = 0x100; local_14 |= temp; - sub_808CFD0(param_2,mail->clientSpecies,0,0,&local_14,0); + sub_808CFD0(param_2,mail->clientSpecies,NULL,0,&local_14,NULL); return TRUE; } } diff --git a/src/code_80958E8_mid.c b/src/code_80958E8_mid.c index ae4b6cae..99179886 100644 --- a/src/code_80958E8_mid.c +++ b/src/code_80958E8_mid.c @@ -7,7 +7,6 @@ #include "friend_area.h" #include "code_80958E8.h" -extern u8 *gFriendAreas; bool8 sub_8095E38(struct WonderMail *mail, u8 dungeon, u32 floor, u8 param_4); extern s32 sub_80A29B0(u8 *param_1); extern s32 GetDungeonFloorCount(u8); diff --git a/src/code_8097670.c b/src/code_8097670.c index 8cbb9883..e2976bd5 100644 --- a/src/code_8097670.c +++ b/src/code_8097670.c @@ -1,27 +1,12 @@ #include "global.h" +#include "code_8097670.h" #include "pokemon.h" - -struct unkStruct_203B494 -{ - // size: 0xC4 - u32 unk0; // 32 bit bitfield, I think - s32 numAdventures; - s32 unk8; - s32 unkC; - struct DungeonLocation dungeonLocation; - s16 unk14; - s16 unk16; - s16 unk18; - u32 unk1C[0xE]; - u32 unk54[0xE]; - u32 unk8C[0xD]; - s32 unkC0; -}; +#include "pokemon_3.h" EWRAM_DATA_2 struct unkStruct_203B494 *gUnknown_203B494 = {0}; EWRAM_DATA struct unkStruct_203B494 gUnknown_2039778 = {0}; + extern const u8 *gAdventureLogText[]; -s16 GetBaseSpeciesNoUnown(s16 index); void sub_8097670(void) { diff --git a/src/code_8272724.c b/src/code_8272724.c index 945be97b..a02b0335 100644 --- a/src/code_8272724.c +++ b/src/code_8272724.c @@ -1,17 +1,16 @@ #include "global.h" +#include "text1.h" -extern void sub_8272774(u32 *r0, u32 r1); -extern void sub_8272884(u32 *r0, u32 r1); - -extern u32 gUnknown_2027370; // TODO defined in text.c and join later +extern void sub_8272774(struct UnkTextStruct1 *r0, u32 r1); +extern void sub_8272884(struct UnkTextStruct1 *r0, u32 r1); void sub_8272760(u32 r0) { - sub_8272774(&gUnknown_2027370, r0); + sub_8272774(gUnknown_2027370, r0); } // TODO once sub_8272774 is decomped //void sub_8272870(u32 r0) //{ -// sub_8272884(&gUnknown_2027370, r0); +// sub_8272884(gUnknown_2027370, r0); //} diff --git a/src/cpu.c b/src/cpu.c index 7a508013..772d4ecc 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -1,4 +1,5 @@ #include "global.h" +#include "cpu.h" extern u32 gUnknown_202D800; extern u16 gBldCnt; // used to update Blend Count Reg diff --git a/src/credits.c b/src/credits.c index 3a69a2c9..ba24cc11 100644 --- a/src/credits.c +++ b/src/credits.c @@ -1,7 +1,8 @@ #include "global.h" #include "input.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" // size: 0x6C struct unkCreditsStruct_203B340 @@ -39,8 +40,6 @@ extern u16 gUnknown_80E5990[]; extern void sub_80015C0(u32, u32); extern s32 sub_8001658(u32, u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern void sub_8099690(u32); extern void sub_8099A5C(u32, u32, u32); extern void sub_8099AFC(u32, u32, u32); diff --git a/src/debug_menu.c b/src/debug_menu.c deleted file mode 100644 index 81c3dc77..00000000 --- a/src/debug_menu.c +++ /dev/null @@ -1,197 +0,0 @@ -#include "global.h" -#include "constants/friend_area.h" -#include "debug_menu.h" -#include "friend_area.h" -#include "input.h" -#include "main_menu.h" -#include "menu.h" -#include "memory.h" -#include "pokemon.h" -#include "save.h" -#include "text_util.h" -#include "menu_input.h" - -EWRAM_DATA_2 struct DebugMenu *gUnknown_203B3EC = {0}; - -const struct UnkTextStruct2 gUnknown_80E7D40 = -{ - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80E7D58 = -{ - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x02, 0x02, - 0x09, 0x0b, - 0x0b, 0x00, - NULL -}; - -const struct MenuItem gDebugMenuItems[8] = -{ - {"Dungeons", MENU_DEBUG_MENU_DUNGEONS}, - {"Field", MENU_DEBUG_MENU_FIELD}, - {"Field Map", MENU_DEBUG_MENU_FIELD_MAP}, - {"Field Script", MENU_DEBUG_MENU_FIELD_SCRIPT}, - {"Debug Menu", MENU_DEBUG_MENU_DEBUG_MENU}, - {"Storage", MENU_DEBUG_MENU_STORAGE}, - {"h-open", MENU_DEBUG_MENU_H_OPEN}, - {NULL, 10}, -}; - -ALIGNED(4) static const char debug_menu_fill0[] = "pksdir0"; -ALIGNED(4) static const char debug_menu_fill1[] = "pksdir0"; -ALIGNED(4) static const char debug_menu_fill2[] = "pksdir0"; -ALIGNED(4) static const char debug_menu_fill3[] = "pksdir0"; -ALIGNED(4) static const char debug_menu_fill4[] = "pksdir0"; -ALIGNED(4) static const char debug_menu_fill5[] = "pksdir0"; -ALIGNED(4) static const char debug_menu_fill6[] = "pksdir0"; - - - -extern void sub_80976F8(u8); -extern void sub_803A3BC(void); -extern void sub_803A3A0(void); - -extern void SetMenuItems(struct MenuStruct *menu, struct UnkTextStruct2 *, u32, const struct UnkTextStruct2 *, const struct MenuItem *entries, u32, u32, u32); -extern void sub_8035CF4(struct MenuStruct*, u32, u32); -extern void sub_8035CC0(struct UnkTextStruct2 *, u32); -extern void sub_808D1DC(u8 *); -extern void sub_808CFD0(u8 *, s32, u8 *, u32, u32 *, u16 *); - -void CreateDebugMenu(void) -{ - int index; - - if (gUnknown_203B3EC == NULL) { - gUnknown_203B3EC = MemoryAlloc(sizeof(struct DebugMenu), 8); - MemoryFill8((u8 *)gUnknown_203B3EC, 0, sizeof(struct DebugMenu)); - } - for(index = 0; index < 4; index++){ - gUnknown_203B3EC->unk140[index] = gUnknown_80E7D40; - } - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B3EC->unk140, 1, 1); - SetDebugMenuItems(); -} - -void DeleteDebugMenu(void) -{ - ResetUnusedInputStruct(); - sub_800641C(NULL, 1, 1); - if(gUnknown_203B3EC != NULL) - { - MemoryFree(gUnknown_203B3EC); - gUnknown_203B3EC = NULL; - } -} - -u32 UpdateDebugMenu(void) -{ - u32 nextMenu; - s32 counter; - s32 debugMenuAction; - - nextMenu = MENU_NO_SCREEN_CHANGE; - debugMenuAction = 11; - - if (sub_8012FD8(&gUnknown_203B3EC->unk0[0]) == 0) { - sub_8013114(&gUnknown_203B3EC->unk0[0], &debugMenuAction); - } - - switch(debugMenuAction) { - case MENU_DEBUG_MENU_DUNGEONS: - nextMenu = MENU_DEBUG_DUNGEON; - break; - case MENU_DEBUG_MENU_FIELD: - nextMenu = MENU_DEBUG_FIELD; - break; - case MENU_DEBUG_MENU_FIELD_MAP: - nextMenu = MENU_DEBUG_FIELD_MAP; - break; - case MENU_DEBUG_MENU_FIELD_SCRIPT: - nextMenu = MENU_DEBUG_FIELD_SCRIPT; - break; - case MENU_DEBUG_MENU_DEBUG_MENU: - nextMenu = MENU_DEBUG_DEBUG_MENU; - break; - case MENU_DEBUG_MENU_UNKNOWN_1: // No option that correponds to this one - nextMenu = MENU_DEBUG_UNKNOWN_1; - break; - case MENU_DEBUG_MENU_STORAGE: - sub_803A3BC(); - nextMenu = MENU_MAIN_SCREEN; - break; - case MENU_DEBUG_MENU_H_OPEN: - for(counter = 0; counter < 0x20; counter++){ - sub_80976F8(counter); - } - nextMenu = MENU_MAIN_SCREEN; - break; - case 10: - sub_803A3A0(); - nextMenu = MENU_MAIN_SCREEN; - break; - case 11: - nextMenu = MENU_NO_SCREEN_CHANGE; - } - return nextMenu; -} - -void SetDebugMenuItems(void) -{ - SetMenuItems(gUnknown_203B3EC->unk0, gUnknown_203B3EC->unk140, 0, &gUnknown_80E7D58, gDebugMenuItems, 1, 0xd, 0); - sub_8035CF4(gUnknown_203B3EC->unk0,0,1); -} - -void sub_803A3A0(void) -{ - sub_8035CC0(gUnknown_203B3EC->unk140, 0); -} - -void sub_803A3BC(void) -{ - s32 speciesIndex; - u8 sp_0x8 [88]; - u16 r7 [4]; // r7 - u8 buffer [20]; // r6 - u32 sp_0x7C; - s32 sp_0x80; - -#ifndef NONMATCHING - register s32 index asm("r5"); - register u32 r9 asm("r9"); -#else - s32 index; - u32 r9; -#endif - - index = 1; - do { - UnlockFriendArea(index); - index++; - } while (index < NUM_FRIEND_AREAS); - - index = 0; - do { - r9 = 0; - sp_0x7C = 0x1006; - index = index + 1; - speciesIndex = index * 0x10000 >> 0x10; // dumb way to force s16 - memset(r7,0,8); - r7[0] = 0x27; - CopyMonsterNametoBuffer(buffer, speciesIndex); - CopyStringtoBuffer(buffer, buffer); - buffer[0] = 0x40; - sub_808CFD0(sp_0x8,speciesIndex,buffer,0x43,&sp_0x7C,r7); - sub_808D1DC(sp_0x8); - } while (index < 300); - sp_0x80 = r9; - WriteSavetoPak(&sp_0x80,1); -} diff --git a/src/debug_menu1.c b/src/debug_menu1.c new file mode 100644 index 00000000..684a5eee --- /dev/null +++ b/src/debug_menu1.c @@ -0,0 +1,190 @@ +#include "global.h" +#include "code_8097670.h" +#include "constants/friend_area.h" +#include "debug_menu1.h" +#include "friend_area.h" +#include "main_menu.h" +#include "memory.h" +#include "menu_input.h" +#include "pokemon.h" +#include "save.h" +#include "text_util.h" +#include "text1.h" + +EWRAM_DATA_2 static struct DebugMenu *sDebugMenu = {0}; + +static const struct UnkTextStruct2 sUnknown_80E7D40 = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + NULL +}; + +static const struct UnkTextStruct2 sUnknown_80E7D58 = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x02, 0x02, + 0x09, 0x0b, + 0x0b, 0x00, + NULL +}; + +static const struct MenuItem sDebugMenuItems[8] = +{ + {"Dungeons", MENU_DEBUG_MENU_DUNGEONS}, + {"Field", MENU_DEBUG_MENU_FIELD}, + {"Field Map", MENU_DEBUG_MENU_FIELD_MAP}, + {"Field Script", MENU_DEBUG_MENU_FIELD_SCRIPT}, + {"Debug Menu", MENU_DEBUG_MENU_DEBUG_MENU}, + {"Storage", MENU_DEBUG_MENU_STORAGE}, + {"h-open", MENU_DEBUG_MENU_H_OPEN}, + {NULL, 10}, +}; + +ALIGNED(4) static const u8 sDebugMenuFill1[] = "pksdir0"; +ALIGNED(4) static const u8 sDebugMenuFill2[] = "pksdir0"; +ALIGNED(4) static const u8 sDebugMenuFill3[] = "pksdir0"; +ALIGNED(4) static const u8 sDebugMenuFill4[] = "pksdir0"; +ALIGNED(4) static const u8 sDebugMenuFill5[] = "pksdir0"; +ALIGNED(4) static const u8 sDebugMenuFill6[] = "pksdir0"; +ALIGNED(4) static const u8 sDebugMenuFill7[] = "pksdir0"; + +void SetDebugMenuItems(void); +void sub_803A3A0(void); +void sub_803A3BC(void); + +void CreateDebugMenu(void) +{ + s32 i; + + if (sDebugMenu == NULL) { + sDebugMenu = MemoryAlloc(sizeof(struct DebugMenu), 8); + MemoryFill8((u8 *)sDebugMenu, 0, sizeof(struct DebugMenu)); + } + + for (i = 0; i < 4; i++) + sDebugMenu->unk140[i] = sUnknown_80E7D40; + + ResetUnusedInputStruct(); + sub_800641C(sDebugMenu->unk140, 1, 1); + SetDebugMenuItems(); +} + +void DeleteDebugMenu(void) +{ + ResetUnusedInputStruct(); + sub_800641C(NULL, 1, 1); + if (sDebugMenu != NULL) { + MemoryFree(sDebugMenu); + sDebugMenu = NULL; + } +} + +u32 UpdateDebugMenu(void) +{ + u32 nextMenu; + s32 counter; + s32 debugMenuAction; + + nextMenu = MENU_NO_SCREEN_CHANGE; + debugMenuAction = 11; + + if (sub_8012FD8(&sDebugMenu->unk0[0]) == 0) + sub_8013114(&sDebugMenu->unk0[0], &debugMenuAction); + + switch (debugMenuAction) { + case MENU_DEBUG_MENU_DUNGEONS: + nextMenu = MENU_DEBUG_DUNGEON; + break; + case MENU_DEBUG_MENU_FIELD: + nextMenu = MENU_DEBUG_FIELD; + break; + case MENU_DEBUG_MENU_FIELD_MAP: + nextMenu = MENU_DEBUG_FIELD_MAP; + break; + case MENU_DEBUG_MENU_FIELD_SCRIPT: + nextMenu = MENU_DEBUG_FIELD_SCRIPT; + break; + case MENU_DEBUG_MENU_DEBUG_MENU: + nextMenu = MENU_DEBUG_DEBUG_MENU; + break; + case MENU_DEBUG_MENU_UNKNOWN_1: // No option that correponds to this one + nextMenu = MENU_DEBUG_UNKNOWN_1; + break; + case MENU_DEBUG_MENU_STORAGE: + sub_803A3BC(); + nextMenu = MENU_MAIN_SCREEN; + break; + case MENU_DEBUG_MENU_H_OPEN: + for (counter = 0; counter < 0x20; counter++) + sub_80976F8(counter); + + nextMenu = MENU_MAIN_SCREEN; + break; + case 10: + sub_803A3A0(); + nextMenu = MENU_MAIN_SCREEN; + break; + case 11: + nextMenu = MENU_NO_SCREEN_CHANGE; + break; + } + return nextMenu; +} + +void SetDebugMenuItems(void) +{ + SetMenuItems(sDebugMenu->unk0, sDebugMenu->unk140, 0, &sUnknown_80E7D58, sDebugMenuItems, 1, 13, 0); + sub_8035CF4(sDebugMenu->unk0, 0, 1); +} + +void sub_803A3A0(void) +{ + sub_8035CC0(sDebugMenu->unk140, 0); +} + +void sub_803A3BC(void) +{ + s32 speciesIndex; + u8 sp_0x8 [88]; + u16 r7 [4]; // r7 + u8 buffer [20]; // r6 + u32 sp_0x7C; + s32 sp_0x80; + + #ifndef NONMATCHING + register s32 index asm("r5"); + register u32 r9 asm("r9"); + #else + s32 index; + u32 r9; + #endif + + index = 1; + do { + UnlockFriendArea(index); + index++; + } while (index < NUM_FRIEND_AREAS); + + index = 0; + do { + r9 = 0; + sp_0x7C = 0x1006; + index++; + speciesIndex = index * 0x10000 >> 0x10; // dumb way to force s16 + memset(r7, 0, 8); + r7[0] = 0x27; + CopyMonsterNametoBuffer(buffer, speciesIndex); + CopyStringtoBuffer(buffer, buffer); + buffer[0] = 0x40; + sub_808CFD0(sp_0x8, speciesIndex, buffer, 0x43, &sp_0x7C, r7); + sub_808D1DC(sp_0x8); + } while (index < 300); + + sp_0x80 = r9; + WriteSavetoPak(&sp_0x80, 1); +} \ No newline at end of file diff --git a/src/debug_menu2.c b/src/debug_menu2.c new file mode 100644 index 00000000..47d68953 --- /dev/null +++ b/src/debug_menu2.c @@ -0,0 +1,274 @@ +#include "global.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" +#include "code_801C620.h" +#include "debug_menu2.h" +#include "memory.h" +#include "menu_input.h" +#include "team_inventory.h" +#include "text1.h" +#include "text2.h" + +EWRAM_DATA_2 static struct unkStruct_203B3F0 *sUnknown_203B3F0 = {0}; + +static const struct UnkTextStruct2 sUnknown_80E7E34 = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + NULL +}; +static const struct UnkTextStruct2 sUnknown_80E7E4C = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x14, 0x04, + 0x06, 0x03, + 0x03, 0x00, + NULL +}; +static const struct UnkTextStruct2 sUnknown_80E7E64 = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x14, 0x0e, + 0x06, 0x04, + 0x04, 0x00, + NULL +}; + +ALIGNED(4) static const u8 sNumberPrompt[] = "Number?"; +ALIGNED(4) static const u8 sFill[] = "pksdir0"; + +// data_80D47B8.s +extern const u8 *gUnknown_80D4970[]; + +void sub_803A504(u32); +void sub_803A51C(void); +void sub_803A5A0(void); +void sub_803A690(void); +void sub_803A6F0(void); +void sub_803A740(void); +void sub_803A7B0(void); +void sub_803A810(void); +void sub_803A86C(void); + +// Unused +u32 sub_803A45C(void) +{ + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sUnknown_203B3F0 = MemoryAlloc(sizeof(struct unkStruct_203B3F0), 8); + sub_803A504(0); + return 1; +} + +// Unused +u32 sub_803A48C(void) +{ + switch (sUnknown_203B3F0->state) { + case 0: + case 1: + sub_803A740(); + break; + case 2: + sub_803A7B0(); + break; + case 3: + sub_803A810(); + break; + case 4: + sub_803A86C(); + break; + case 5: + return 3; + } + return 0; +} + +// Unused +void sub_803A4E8(void) +{ + if (sUnknown_203B3F0 != NULL) { + MemoryFree(sUnknown_203B3F0); + sUnknown_203B3F0 = NULL; + } +} + +void sub_803A504(u32 newState) +{ + sUnknown_203B3F0->state = newState; + sub_803A51C(); + sub_803A5A0(); +} + +void sub_803A51C(void) +{ + s32 i; + + sub_8006518(sUnknown_203B3F0->unkD8); + + switch (sUnknown_203B3F0->state) { + case 3: + sUnknown_203B3F0->unkD8[1] = sUnknown_80E7E64; + break; + case 2: + sUnknown_203B3F0->unkD8[2] = sUnknown_80E7E4C; + break; + default: + for (i = 0; i < 4; i++) + sUnknown_203B3F0->unkD8[i] = sUnknown_80E7E34; + break; + } + + ResetUnusedInputStruct(); + sub_800641C(sUnknown_203B3F0->unkD8, 1, 1); +} + +void sub_803A5A0(void) +{ + struct Item item; + + switch (sUnknown_203B3F0->state) { + case 0: + sub_801C8C4(2, 3, 0, 10); + break; + case 1: + sub_801CB5C(TRUE); + break; + case 2: + sub_801CCD8(); + sub_803A6F0(); + sub_8012D60(&sUnknown_203B3F0->unk4C, sUnknown_203B3F0->menuItems, 0, 0, sUnknown_203B3F0->menuAction, 2); + break; + case 3: + sUnknown_203B3F0->unkAC = 3; + sUnknown_203B3F0->unkA4 = 0; + sUnknown_203B3F0->unkA8 = 999; + sUnknown_203B3F0->unkA0 = gTeamInventoryRef->teamStorage[sUnknown_203B3F0->id]; + sUnknown_203B3F0->unkB0 = 1; + sUnknown_203B3F0->unkB4 = &sUnknown_203B3F0->unkD8[1]; + sUnknown_203B3F0->unkB8 = 44; + sUnknown_203B3F0->unkBC = 18; + sub_8013AA0(&sUnknown_203B3F0->unk9C); + sub_803A690(); + break; + case 4: + xxx_init_itemslot_8090A8C(&item, sUnknown_203B3F0->id, 0); + sub_801B3C0(&item); + break; + case 5: + break; + } +} + +void sub_803A690(void) +{ + sub_8008C54(sUnknown_203B3F0->unkB0); + sub_80073B8(sUnknown_203B3F0->unkB0); + xxx_call_draw_string(4, 0, sNumberPrompt, sUnknown_203B3F0->unkB0, 0); + sub_8013C68(&sUnknown_203B3F0->unk9C); + sub_80073E0(sUnknown_203B3F0->unkB0); + sub_801CCD8(); + sub_8012EA4(&sUnknown_203B3F0->unk4C, 0); +} + +void sub_803A6F0(void) +{ + s32 loopMax = 0; + + sUnknown_203B3F0->menuItems[loopMax].text = sNumberPrompt; + sUnknown_203B3F0->menuItems[loopMax].menuAction = 2; + sUnknown_203B3F0->menuAction = 2; + if (!IsNotMoneyOrUsedTMItem(sUnknown_203B3F0->id)) { + sUnknown_203B3F0->menuItems[loopMax].menuAction = -1; + sUnknown_203B3F0->menuAction = 3; + } + + loopMax += 1; + sUnknown_203B3F0->menuItems[loopMax].text = *gUnknown_80D4970; + sUnknown_203B3F0->menuItems[loopMax].menuAction = 3; + + loopMax += 1; + sUnknown_203B3F0->menuItems[loopMax].text = NULL; + sUnknown_203B3F0->menuItems[loopMax].menuAction = 1; +} + +void sub_803A740(void) +{ + switch (sub_801CA08(TRUE)) { + case 0: + case 1: + break; + case 3: + sUnknown_203B3F0->id = sub_801CB24(); + sub_803A504(2); + break; + case 4: + sUnknown_203B3F0->id = sub_801CB24(); + sub_803A504(4); + break; + case 2: + sub_801CBB8(); + sub_803A504(5); + break; + } +} + +void sub_803A7B0(void) +{ + s32 menuAction; + + menuAction = 0; + + sub_801CA08(FALSE); + + if (sub_8012FD8(&sUnknown_203B3F0->unk4C) == 0) + sub_8013114(&sUnknown_203B3F0->unk4C, &menuAction); + + switch (menuAction) { + case 2: + sub_803A504(3); + break; + case 3: + sub_803A504(4); + break; + case 1: + sub_803A504(1); + break; + } +} + +void sub_803A810(void) +{ + sub_801CA08(FALSE); + sub_8012FD8(&sUnknown_203B3F0->unk4C); + + switch (sub_8013BBC(&sUnknown_203B3F0->unk9C)) { + case 3: + gTeamInventoryRef->teamStorage[sUnknown_203B3F0->id] = sUnknown_203B3F0->unk9C; + // Fallthrough needed to match + case 2: + sub_803A504(1); + break; + case 1: + sub_803A690(); + break; + } +} + +void sub_803A86C(void) +{ + switch (sub_801B410()) { + case 1: + case 0: + break; + case 2: + case 3: + sub_801B450(); + sub_803A504(1); + break; + } +} \ No newline at end of file diff --git a/src/debug_menu3.c b/src/debug_menu3.c new file mode 100644 index 00000000..44435c43 --- /dev/null +++ b/src/debug_menu3.c @@ -0,0 +1,254 @@ +#include "global.h" +#include "code_801EE10_mid.h" +#include "code_8021774.h" +#include "code_8021774_pre.h" +#include "debug_menu3.h" +#include "friend_area.h" +#include "memory.h" +#include "menu_input.h" +#include "pokemon.h" +#include "text1.h" +#include "text2.h" + +EWRAM_DATA_2 static struct unkStruct_203B3F4 *sUnknown_203B3F4 = {0}; + +static const struct UnkTextStruct2 sUnknown_80E7E8C = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + NULL +}; +static const struct UnkTextStruct2 sUnknown_80E7EA4 = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x15, 0x04, + 0x06, 0x03, + 0x03, 0x00, + NULL +}; + +ALIGNED(4) static const u8 sClose[] = "CLOSE"; +ALIGNED(4) static const u8 sOpen[] = "OPEN"; +ALIGNED(4) static const u8 sFill[] = "pksdir0"; + +// data_80D47B8.s +extern const u8 *gUnknown_80D4970[]; + +void sub_803A924(u32); +void sub_803A93C(void); +void sub_803A9AC(void); +void sub_803AA34(void); +void sub_803AAC4(void); +void sub_803AB34(void); +void sub_803ABAC(void); +bool8 sub_803ABC8(void); + +// Unused +u32 sub_803A888(void) +{ + ResetUnusedInputStruct(); + sub_800641C(0, 1, 1); + sUnknown_203B3F4 = MemoryAlloc(sizeof(struct unkStruct_203B3F4), 8); + sub_803A924(0); + return 1; +} + +// Unused +u32 sub_803A8B8(void) +{ + switch (sUnknown_203B3F4->state) { + case 0: + case 1: + sub_803AAC4(); + break; + case 2: + sub_803AB34(); + break; + case 3: + sub_803ABAC(); + break; + case 4: + return 3; + } + return 0; +} + +// Unused +void sub_803A908(void) +{ + if (sUnknown_203B3F4 != NULL) { + MemoryFree(sUnknown_203B3F4); + sUnknown_203B3F4 = NULL; + } +} + +void sub_803A924(u32 newState) +{ + sUnknown_203B3F4->state = newState; + sub_803A93C(); + sub_803A9AC(); +} + +void sub_803A93C(void) +{ + s32 i; + + sub_8006518(sUnknown_203B3F4->unk9C); + + if (sUnknown_203B3F4->state == 2) + sUnknown_203B3F4->unk9C[2] = sUnknown_80E7EA4; + else { + for(i = 0; i < 4; i++) + sUnknown_203B3F4->unk9C[i] = sUnknown_80E7E8C; + } + + ResetUnusedInputStruct(); + sub_800641C(sUnknown_203B3F4->unk9C, 1, 1); +} + +void sub_803A9AC(void) +{ + switch (sUnknown_203B3F4->state) { + case 0: + sub_80211AC(0, 3); + break; + case 1: + sub_8021354(TRUE); + break; + case 2: + sub_8021494(); + sub_803AA34(); + sub_8012D60(&sUnknown_203B3F4->unk4C, sUnknown_203B3F4->menuItems, 0, 0, sUnknown_203B3F4->menuAction, 2); + break; + case 3: + sub_8021774(sUnknown_203B3F4->friendArea, 1, 0); + break; + case 4: + break; + } +} + +void sub_803AA34(void) +{ + s32 index; + u8 *FriendAreas; + + index = 0; + + // So dumb that it matches... + FriendAreas = gFriendAreas; + + if (FriendAreas[sUnknown_203B3F4->friendArea]) { + sUnknown_203B3F4->menuItems[0].text = sClose; + + if (sub_803ABC8()) + sUnknown_203B3F4->menuItems[0].menuAction = 3; + else + sUnknown_203B3F4->menuItems[0].menuAction = -1; + } + else { + sUnknown_203B3F4->menuItems[0].text = sOpen; + sUnknown_203B3F4->menuItems[0].menuAction = 2; + } + + index++; + sUnknown_203B3F4->menuItems[index].text = *gUnknown_80D4970; + sUnknown_203B3F4->menuItems[index].menuAction = 4; + + index++; + sUnknown_203B3F4->menuItems[index].text = NULL; + sUnknown_203B3F4->menuItems[index].menuAction = 1; + + sUnknown_203B3F4->menuAction = sUnknown_203B3F4->menuItems[0].menuAction; +} + +void sub_803AAC4(void) +{ + switch (sub_8021274(TRUE)) { + case 0: + case 1: + break; + case 3: + sUnknown_203B3F4->friendArea = sub_802132C(); + sub_803A924(2); + break; + case 4: + sUnknown_203B3F4->friendArea = sub_802132C(); + sub_803A924(3); + break; + case 2: + sub_80213A0(); + sub_803A924(4); + break; + } +} + +void sub_803AB34(void) +{ + s32 menuAction; + + menuAction = 0; + + sub_8021274(0); + + if (!sub_8012FD8(&sUnknown_203B3F4->unk4C)) + sub_8013114(&sUnknown_203B3F4->unk4C, &menuAction); + + switch (menuAction) { + case 2: + UnlockFriendArea(sUnknown_203B3F4->friendArea); + sub_803A924(1); + break; + case 3: + sub_809249C(sUnknown_203B3F4->friendArea, 1); + sub_803A924(1); + break; + case 4: + sub_803A924(3); + break; + case 1: + sub_803A924(1); + break; + } +} + +void sub_803ABAC(void) +{ + switch (sub_80217EC()) { + case 2: + case 3: + sub_8021830(); + sub_803A924(1); + break; + case 0: + case 1: + break; + } +} + +bool8 sub_803ABC8(void) +{ + struct PokemonStruct *mon; + s32 i; + s32 mask; + + for (i = 0, mask = 1; i < NUM_MONSTERS; i++) { + // Some check was optimized out. Needed for matching. Thanks kaz + if (i) { + u8 unk = -unk; + } + + mon = &gRecruitedPokemonRef->pokemon[i]; + + if ((mask & mon->unk0) != 0 + && ((mon->unk0 >> 1) & mask) != 0 + && sUnknown_203B3F4->friendArea == GetFriendArea(mon->speciesNum)) + return FALSE; + + } + return TRUE; +} \ No newline at end of file diff --git a/src/debug_menu4.c b/src/debug_menu4.c new file mode 100644 index 00000000..17d180b2 --- /dev/null +++ b/src/debug_menu4.c @@ -0,0 +1,279 @@ +#include "global.h" +#include "code_8012A18_1.h" +#include "code_80130A8.h" +#include "code_801EE10_1.h" +#include "debug_menu4.h" +#include "memory.h" +#include "menu_input.h" +#include "text1.h" +#include "text2.h" + +EWRAM_DATA_2 static struct unkStruct_203B3F8 *sUnknown_203B3F8 = {0}; + +static const struct UnkTextStruct2 sUnknown_80E7ED4 = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + NULL +}; +static const struct UnkTextStruct2 sUnknown_80E7EEC = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x13, 0x04, + 0x09, 0x03, + 0x03, 0x00, + NULL +}; +static const struct UnkTextStruct2 sUnknown_80E7F04 = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x13, 0x0e, + 0x06, 0x04, + 0x04, 0x00, + NULL +}; +ALIGNED(4) static const u8 sNumberPrompt[] = "Number?"; +ALIGNED(4) static const u8 sLevel[] = "LEVEL"; +ALIGNED(4) static const u8 sName[] = "Name"; +static const u8 sFill[] = "pksdir0"; + +void sub_803ACD0(u32); +void sub_803ACE8(void); +void sub_803AD88(void); +void sub_803AE58(void); +void sub_803AEB0(void); +void sub_803AF38(void); +void sub_803AF88(void); +void sub_803AFE8(void); +void sub_803B034(void); + +// Unused +u32 sub_803AC24(void) +{ + sUnknown_203B3F8 = MemoryAlloc(sizeof(struct unkStruct_203B3F8), 8); + sub_803ACD0(0); + return 1; +} + +// Unused +u32 sub_803AC48(void) +{ + switch (sUnknown_203B3F8->state) { + case 0: + sub_803ACD0(1); + break; + case 1: + case 2: + sub_803AF38(); + break; + case 3: + sub_803AF88(); + break; + case 5: + sub_803AFE8(); + break; + case 6: + sub_803B034(); + break; + case 4: + case 7: + default: + return 3; + } + return 0; +} + +// Unused +void sub_803ACB4(void) +{ + if (sUnknown_203B3F8 != NULL) { + MemoryFree(sUnknown_203B3F8); + sUnknown_203B3F8 = NULL; + } +} + +void sub_803ACD0(u32 newState) +{ + sUnknown_203B3F8->state = newState; + sub_803ACE8(); + sub_803AD88(); +} + +void sub_803ACE8(void) +{ + s32 i; + + sub_8006518(sUnknown_203B3F8->unkE0); + + switch (sUnknown_203B3F8->state) { + case 3: + sub_803AEB0(); + sUnknown_203B3F8->unkE0[2] = sUnknown_80E7EEC; + sub_8012CAC(&sUnknown_203B3F8->unkE0[2], sUnknown_203B3F8->unk90); + break; + case 5: + sUnknown_203B3F8->unkE0[3] = sUnknown_80E7F04; + break; + default: + for (i = 0; i < 4; i++) + sUnknown_203B3F8->unkE0[i] = sUnknown_80E7ED4; + break; + } + + ResetUnusedInputStruct(); + sub_800641C(sUnknown_203B3F8->unkE0, 1, 1); +} + +void sub_803AD88(void) +{ + switch (sUnknown_203B3F8->state) { + case 1: + sub_8023868(1, 0, 0, 10); + break; + case 2: + sub_8023B7C(1); + break; + case 3: + sub_8023DA4(); + sub_8012D60(&sUnknown_203B3F8->unk10, sUnknown_203B3F8->unk90, 0, sUnknown_203B3F8->unkD0, sUnknown_203B3F8->menuAction, 2); + break; + case 5: + sUnknown_203B3F8->unk70 = 3; + sUnknown_203B3F8->unk68 = 1; + sUnknown_203B3F8->unk6C = 100; + sUnknown_203B3F8->unk64 = sUnknown_203B3F8->pokemon->unkHasNextStage; + sUnknown_203B3F8->unk74 = 3; + sUnknown_203B3F8->unk78 = &sUnknown_203B3F8->unkE0[3]; + sUnknown_203B3F8->unk7C = 44; + sUnknown_203B3F8->unk80 = 18; + sub_8013AA0(&sUnknown_203B3F8->unk60); + sub_803AE58(); + break; + case 6: + sub_801602C(2, sUnknown_203B3F8->pokemon->name); + case 0: + case 4: + case 7: + default: + break; + + } +} + +void sub_803AE58(void) +{ + sub_8008C54(sUnknown_203B3F8->unk74); + sub_80073B8(sUnknown_203B3F8->unk74); + xxx_call_draw_string(4, 0, sNumberPrompt, sUnknown_203B3F8->unk74, 0); + sub_8013C68(&sUnknown_203B3F8->unk60); + sub_80073E0(sUnknown_203B3F8->unk74); + sub_8023DA4(); + sub_8012EA4(&sUnknown_203B3F8->unk10, 0); +} + +void sub_803AEB0(void) +{ + s32 i; + s32 loopMax; + + MemoryFill16(sUnknown_203B3F8->unkD0, 0, sizeof(sUnknown_203B3F8->unkD0)); + + loopMax = 0; + sUnknown_203B3F8->unk90[loopMax].text = sLevel; + sUnknown_203B3F8->unk90[loopMax].menuAction = 4; + + loopMax++; + sUnknown_203B3F8->unk90[loopMax].text = sName; + sUnknown_203B3F8->unk90[loopMax].menuAction = 5; + + loopMax++; + sUnknown_203B3F8->unk90[loopMax].text = NULL; + sUnknown_203B3F8->unk90[loopMax].menuAction = 1; + + for (i = 0; i < loopMax; i++) { + if (sUnknown_203B3F8->unkD0[i] == 0) { + sUnknown_203B3F8->menuAction = sUnknown_203B3F8->unk90[i].menuAction; + break; + } + } +} + +void sub_803AF38(void) +{ + switch (sub_8023A94(TRUE)) { + case 3: + sUnknown_203B3F8->unk4 = sub_8023B44(); + sUnknown_203B3F8->pokemon = &gRecruitedPokemonRef->pokemon[sUnknown_203B3F8->unk4]; + sub_803ACD0(3); + break; + case 2: + sub_8023C60(); + sub_803ACD0(7); + break; + case 1: + case 0: + break; + } +} + +void sub_803AF88(void) +{ + s32 menuAction; + + menuAction = 0; + + sub_8023A94(FALSE); + + if (sub_8012FD8(&sUnknown_203B3F8->unk10) == 0) + sub_8013114(&sUnknown_203B3F8->unk10, &menuAction); + + switch (menuAction) { + case 4: + sub_803ACD0(5); + break; + case 5: + sub_803ACD0(6); + break; + case 1: + sub_803ACD0(2); + break; + default: + break; + } +} + +void sub_803AFE8(void) +{ + sub_8023A94(FALSE); + sub_8012FD8(&sUnknown_203B3F8->unk10); + + switch (sub_8013BBC(&sUnknown_203B3F8->unk60)) { + default: + break; + case 3: + sUnknown_203B3F8->pokemon->unkHasNextStage = sUnknown_203B3F8->unk60; + // Fallthrough is needed to match + case 2: + sub_803ACD0(2); + break; + case 1: + sub_803AE58(); + break; + } +} + +void sub_803B034(void) +{ + switch (sub_8016080()) { + case 2: + case 3: + sub_80160D8(); + sub_803ACD0(2); + break; + } +} \ No newline at end of file diff --git a/src/debug_menu_1.c b/src/debug_menu_1.c deleted file mode 100644 index 025950d9..00000000 --- a/src/debug_menu_1.c +++ /dev/null @@ -1,291 +0,0 @@ -#include "global.h" -#include "pokemon.h" -#include "debug_menu.h" -#include "memory.h" -#include "text.h" -#include "input.h" -#include "menu.h" -#include "menu_input.h" - -extern struct unkStruct_203B3F8 *gUnknown_203B3F8; - -const struct UnkTextStruct2 gUnknown_80E7ED4 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - NULL -}; -const struct UnkTextStruct2 gUnknown_80E7EEC = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x13, 0x04, - 0x09, 0x03, - 0x03, 0x00, - NULL -}; -const struct UnkTextStruct2 gUnknown_80E7F04 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x13, 0x0e, - 0x06, 0x04, - 0x04, 0x00, - NULL -}; -ALIGNED(4) const u8 gDebug_NumberText2[] = "Number?"; -ALIGNED(4) const u8 gDebug_LevelText[] = "LEVEL"; -ALIGNED(4) const u8 gDebug_Name[] = "Name"; -static const u8 fill0[] = "pksdir0"; - -extern u32 sub_8013BBC(u32 *); -extern void sub_803AE58(void); -extern u32 sub_8016080(void); -extern void sub_803ACD0(u32); -extern void sub_80160D8(void); -extern u32 sub_8023A94(u32); -extern s16 sub_8023B44(void); -extern void sub_8023C60(void); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_8013C68(u32 *); -extern void sub_80073E0(u32); -extern void sub_8023DA4(void); -extern void sub_803ACE8(); -extern void sub_803AD88(); -extern void sub_803AF38(); -extern void sub_803AF88(); -extern void sub_803AFE8(); -extern void sub_803B034(); -extern void sub_8023868(u32, u32, u32, u32); -extern void sub_8023B7C(u32); -extern void sub_8013AA0(u32 *); -extern void sub_801602C(u32, u8 *); -extern void sub_803AEB0(); - -u32 sub_803AC24(void) -{ - gUnknown_203B3F8 = MemoryAlloc(sizeof(struct unkStruct_203B3F8), 8); - sub_803ACD0(0); - return 1; -} - -u32 sub_803AC48(void) -{ - switch(gUnknown_203B3F8->state) - { - case 0: - sub_803ACD0(1); - break; - case 1: - case 2: - sub_803AF38(); - break; - case 3: - sub_803AF88(); - break; - case 5: - sub_803AFE8(); - break; - case 6: - sub_803B034(); - break; - case 4: - case 7: - default: - return 3; - } - return 0; -} - -void sub_803ACB4(void) -{ - if(gUnknown_203B3F8 != NULL) - { - MemoryFree(gUnknown_203B3F8); - gUnknown_203B3F8 = NULL; - } -} - -void sub_803ACD0(u32 newState) -{ - gUnknown_203B3F8->state = newState; - sub_803ACE8(); - sub_803AD88(); -} - -void sub_803ACE8(void) -{ - s32 index; - sub_8006518(gUnknown_203B3F8->unkE0); - switch(gUnknown_203B3F8->state) - { - case 3: - sub_803AEB0(); - gUnknown_203B3F8->unkE0[2] = gUnknown_80E7EEC; - sub_8012CAC(&gUnknown_203B3F8->unkE0[2], gUnknown_203B3F8->unk90); - break; - case 5: - gUnknown_203B3F8->unkE0[3] = gUnknown_80E7F04; - break; - default: - for(index = 0; index < 4; index++) - { - gUnknown_203B3F8->unkE0[index] = gUnknown_80E7ED4; - } - break; - } - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B3F8->unkE0, 1, 1); -} - -void sub_803AD88(void) -{ - switch(gUnknown_203B3F8->state) - { - case 1: - sub_8023868(1, 0, 0, 10); - break; - case 2: - sub_8023B7C(1); - break; - case 3: - sub_8023DA4(); - sub_8012D60(&gUnknown_203B3F8->unk10, gUnknown_203B3F8->unk90, 0, gUnknown_203B3F8->unkD0, gUnknown_203B3F8->menuAction, 2); - break; - case 5: - gUnknown_203B3F8->unk70 = 3; - gUnknown_203B3F8->unk68 = 1; - gUnknown_203B3F8->unk6C = 0x64; - gUnknown_203B3F8->unk64 = gUnknown_203B3F8->pokemon->unkHasNextStage; - gUnknown_203B3F8->unk74 = 3; - gUnknown_203B3F8->unk78 = &gUnknown_203B3F8->unkE0[3]; - gUnknown_203B3F8->unk7C = 0x2C; - gUnknown_203B3F8->unk80 = 0x12; - sub_8013AA0(&gUnknown_203B3F8->unk60); - sub_803AE58(); - break; - case 6: - sub_801602C(2, gUnknown_203B3F8->pokemon->name); - case 0: - case 4: - case 7: - default: - break; - - } -} - -void sub_803AE58(void) -{ - sub_8008C54(gUnknown_203B3F8->unk74); - sub_80073B8(gUnknown_203B3F8->unk74); - xxx_call_draw_string(4, 0, gDebug_NumberText2, gUnknown_203B3F8->unk74, 0); - sub_8013C68(&gUnknown_203B3F8->unk60); - sub_80073E0(gUnknown_203B3F8->unk74); - sub_8023DA4(); - sub_8012EA4(&gUnknown_203B3F8->unk10, 0); -} - -void sub_803AEB0(void) -{ - s32 index; - s32 loopMax; - - MemoryFill16(gUnknown_203B3F8->unkD0,0,sizeof(gUnknown_203B3F8->unkD0)); - loopMax = 0; - - gUnknown_203B3F8->unk90[loopMax].text = gDebug_LevelText; - gUnknown_203B3F8->unk90[loopMax].menuAction = 4; - loopMax += 1; - gUnknown_203B3F8->unk90[loopMax].text = gDebug_Name; - gUnknown_203B3F8->unk90[loopMax].menuAction = 5; - loopMax += 1; - gUnknown_203B3F8->unk90[loopMax].text = NULL; - gUnknown_203B3F8->unk90[loopMax].menuAction = 1; - - for(index = 0; index < loopMax; index++) - { - if (gUnknown_203B3F8->unkD0[index] == 0) - { - gUnknown_203B3F8->menuAction = gUnknown_203B3F8->unk90[index].menuAction; - break; - } - } -} - -void sub_803AF38(void) -{ - switch(sub_8023A94(1)) - { - case 3: - gUnknown_203B3F8->unk4 = sub_8023B44(); - gUnknown_203B3F8->pokemon = &gRecruitedPokemonRef->pokemon[gUnknown_203B3F8->unk4]; - sub_803ACD0(3); - break; - case 2: - sub_8023C60(); - sub_803ACD0(7); - break; - case 1: - case 0: - break; - } -} - -void sub_803AF88(void) -{ - s32 menuAction; - - menuAction = 0; - sub_8023A94(0); - if (sub_8012FD8(&gUnknown_203B3F8->unk10) == 0) { - sub_8013114(&gUnknown_203B3F8->unk10, &menuAction); - } - switch(menuAction) - { - case 4: - sub_803ACD0(5); - break; - case 5: - sub_803ACD0(6); - break; - case 1: - sub_803ACD0(2); - break; - default: - break; - } -} - -void sub_803AFE8(void) -{ - sub_8023A94(0); - sub_8012FD8(&gUnknown_203B3F8->unk10); - switch(sub_8013BBC(&gUnknown_203B3F8->unk60)) - { - default: - break; - case 3: - gUnknown_203B3F8->pokemon->unkHasNextStage = gUnknown_203B3F8->unk60; - // Fallthrough is needed to match - case 2: - sub_803ACD0(2); - break; - case 1: - sub_803AE58(); - break; - } -} - -void sub_803B034(void) -{ - switch(sub_8016080()) - { - case 2: - case 3: - sub_80160D8(); - sub_803ACD0(2); - break; - } -} diff --git a/src/debug_menu_mid.c b/src/debug_menu_mid.c deleted file mode 100644 index 183336a2..00000000 --- a/src/debug_menu_mid.c +++ /dev/null @@ -1,544 +0,0 @@ -#include "global.h" -#include "input.h" -#include "item.h" -#include "team_inventory.h" -#include "memory.h" -#include "menu.h" -#include "text.h" -#include "menu_input.h" -#include "friend_area.h" - -struct unkStruct_203B3F0 -{ - // size: 0x138 - u32 state; - u8 id; - u32 menuAction; - struct MenuItem menuItems[8]; - struct MenuStruct unk4C; - u32 unk9C; - u32 unkA0; - u32 unkA4; - u32 unkA8; - u32 unkAC; - u32 unkB0; - struct UnkTextStruct2 *unkB4; - u32 unkB8; - u32 unkBC; - u8 fill4[0xD8 - 0xC0]; - struct UnkTextStruct2 unkD8[4]; -}; - -extern struct unkStruct_203B3F0 *gUnknown_203B3F0; - -struct unkStruct_203B3F4 -{ - // size: 0xFC - u32 state; - u8 friendArea; - u8 fill5[0x8 - 5]; - u32 menuAction; - struct MenuItem menuItems[8]; - struct MenuStruct unk4C; - struct UnkTextStruct2 unk9C[4]; -}; - -extern struct unkStruct_203B3F4 *gUnknown_203B3F4; - - - -const struct UnkTextStruct2 gUnknown_80E7E34 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - NULL -}; -const struct UnkTextStruct2 gUnknown_80E7E4C = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x14, 0x04, - 0x06, 0x03, - 0x03, 0x00, - NULL -}; -const struct UnkTextStruct2 gUnknown_80E7E64 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x14, 0x0e, - 0x06, 0x04, - 0x04, 0x00, - NULL -}; -ALIGNED(4) const char gDebug_NumberText[] = "Number?"; -ALIGNED(4) static const u8 fill0[] = "pksdir0"; -const struct UnkTextStruct2 gUnknown_80E7E8C = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - NULL -}; -const struct UnkTextStruct2 gUnknown_80E7EA4 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x15, 0x04, - 0x06, 0x03, - 0x03, 0x00, - NULL -}; -ALIGNED(4) const u8 gDebug_CloseText[] = "CLOSE"; -ALIGNED(4) const u8 gDebug_OpenText[] = "OPEN"; -ALIGNED(4) static const u8 fill1[] = "pksdir0"; -extern bool8 *gFriendAreas; -extern const char *gUnknown_80D4970[]; - -extern void sub_801B3C0(struct Item *); -extern void sub_8013AA0(u32 *); -extern void sub_801C8C4(u32, u32, u32, u32); -extern void sub_801CB5C(u32); -extern void sub_801CCD8(); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); -extern void sub_8013C68(u32 *); -extern u32 sub_801CA08(u32); -extern u8 sub_801CB24(); -extern void sub_801CBB8(); -extern u32 sub_8013BBC(u32 *); -extern u32 sub_801B410(); -extern void sub_801B450(); -extern void sub_80211AC(u32, u32); -extern void sub_8021354(u32); -extern void sub_8021494(); -extern void sub_803AA34(); -extern void sub_8021774(u8,u32, u32); -extern void sub_809249C(u8, u32); -extern void sub_8021830(void); -extern u32 sub_80217EC(void); -extern u8 sub_803ABC8(void); -extern u32 sub_8021274(u32); -extern u8 sub_802132C(void); -extern void sub_80213A0(void); -extern void sub_803AAC4(); -extern void sub_803AB34(); -extern void sub_803ABAC(); - -void sub_803A924(u32); -void sub_803A93C(); -void sub_803A9AC(); - -void sub_803A504(u32); -void sub_803A51C(); -void sub_803A5A0(); -void sub_803A690(); -void sub_803A6F0(); -void sub_803A740(); -void sub_803A7B0(); -void sub_803A810(); -void sub_803A86C(); - - -u32 sub_803A45C(void) -{ - ResetUnusedInputStruct(); - sub_800641C(0,1,1); - gUnknown_203B3F0 = MemoryAlloc(sizeof(struct unkStruct_203B3F0), 8); - sub_803A504(0); - return 1; -} - -u32 sub_803A48C(void) -{ - switch(gUnknown_203B3F0->state) { - case 0: - case 1: - sub_803A740(); - break; - case 2: - sub_803A7B0(); - break; - case 3: - sub_803A810(); - break; - case 4: - sub_803A86C(); - break; - case 5: - return 3; - } - return 0; -} - -void sub_803A4E8(void) -{ - if(gUnknown_203B3F0 != NULL) - { - MemoryFree(gUnknown_203B3F0); - gUnknown_203B3F0 = NULL; - } -} - -void sub_803A504(u32 newState) -{ - gUnknown_203B3F0->state = newState; - sub_803A51C(); - sub_803A5A0(); -} - -void sub_803A51C(void) -{ - s32 index; - - sub_8006518(gUnknown_203B3F0->unkD8); - switch(gUnknown_203B3F0->state) - { - case 3: - gUnknown_203B3F0->unkD8[1] = gUnknown_80E7E64; - break; - case 2: - gUnknown_203B3F0->unkD8[2] = gUnknown_80E7E4C; - break; - default: - for(index = 0; index < 4; index++) - { - gUnknown_203B3F0->unkD8[index] = gUnknown_80E7E34; - } - break; - } - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B3F0->unkD8, 1, 1); -} - -void sub_803A5A0(void) -{ - struct Item item; - - switch(gUnknown_203B3F0->state) { - case 0: - sub_801C8C4(2,3,0,10); - break; - case 1: - sub_801CB5C(1); - break; - case 2: - sub_801CCD8(); - sub_803A6F0(); - sub_8012D60(&gUnknown_203B3F0->unk4C, gUnknown_203B3F0->menuItems, 0, 0, gUnknown_203B3F0->menuAction, 2); - break; - case 3: - gUnknown_203B3F0->unkAC = 3; - gUnknown_203B3F0->unkA4 = 0; - gUnknown_203B3F0->unkA8 = 0x3e7; - gUnknown_203B3F0->unkA0 = gTeamInventoryRef->teamStorage[gUnknown_203B3F0->id]; - gUnknown_203B3F0->unkB0 = 1; - gUnknown_203B3F0->unkB4 = &gUnknown_203B3F0->unkD8[1]; - gUnknown_203B3F0->unkB8 = 0x2C; - gUnknown_203B3F0->unkBC = 0x12; - sub_8013AA0(&gUnknown_203B3F0->unk9C); - sub_803A690(); - break; - case 4: - xxx_init_itemslot_8090A8C(&item,gUnknown_203B3F0->id,0); - sub_801B3C0(&item); - break; - case 5: - break; - } -} - -void sub_803A690(void) -{ - sub_8008C54(gUnknown_203B3F0->unkB0); - sub_80073B8(gUnknown_203B3F0->unkB0); - xxx_call_draw_string(4, 0, gDebug_NumberText, gUnknown_203B3F0->unkB0, 0); - sub_8013C68(&gUnknown_203B3F0->unk9C); - sub_80073E0(gUnknown_203B3F0->unkB0); - sub_801CCD8(); - sub_8012EA4(&gUnknown_203B3F0->unk4C,0); -} - -void sub_803A6F0(void) -{ - s32 loopMax = 0; - - gUnknown_203B3F0->menuItems[loopMax].text = gDebug_NumberText; - gUnknown_203B3F0->menuItems[loopMax].menuAction = 2; - gUnknown_203B3F0->menuAction = 2; - if (!IsNotMoneyOrUsedTMItem(gUnknown_203B3F0->id)) { - gUnknown_203B3F0->menuItems[loopMax].menuAction = -1; - gUnknown_203B3F0->menuAction = 3; - } - loopMax += 1; - gUnknown_203B3F0->menuItems[loopMax].text = *gUnknown_80D4970; - gUnknown_203B3F0->menuItems[loopMax].menuAction = 3; - loopMax += 1; - gUnknown_203B3F0->menuItems[loopMax].text = NULL; - gUnknown_203B3F0->menuItems[loopMax].menuAction = 1; -} - -void sub_803A740(void) -{ - switch(sub_801CA08(1)) { - case 0: - case 1: - break; - case 3: - gUnknown_203B3F0->id = sub_801CB24(); - sub_803A504(2); - break; - case 4: - gUnknown_203B3F0->id = sub_801CB24(); - sub_803A504(4); - break; - case 2: - sub_801CBB8(); - sub_803A504(5); - break; - } -} - -void sub_803A7B0(void) -{ - s32 menuAction; - - menuAction = 0; - sub_801CA08(0); - if (sub_8012FD8(&gUnknown_203B3F0->unk4C) == '\0') { - sub_8013114(&gUnknown_203B3F0->unk4C,&menuAction); - } - switch(menuAction) - { - case 2: - sub_803A504(3); - break; - case 3: - sub_803A504(4); - break; - case 1: - sub_803A504(1); - break; - - } -} - -void sub_803A810(void) -{ - sub_801CA08(0); - sub_8012FD8(&gUnknown_203B3F0->unk4C); - switch(sub_8013BBC(&gUnknown_203B3F0->unk9C)) - { - case 3: - gTeamInventoryRef->teamStorage[gUnknown_203B3F0->id] = gUnknown_203B3F0->unk9C; - // Fallthrough needed to match - case 2: - sub_803A504(1); - break; - case 1: - sub_803A690(); - break; - } -} - -void sub_803A86C(void) -{ - switch(sub_801B410()) - { - case 1: - case 0: - break; - case 2: - case 3: - sub_801B450(); - sub_803A504(1); - break; - } -} - -////////////////////////////////////////// - -u32 sub_803A888(void) -{ - ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - gUnknown_203B3F4 = MemoryAlloc(sizeof(struct unkStruct_203B3F4), 8); - sub_803A924(0); - return 1; -} - -u32 sub_803A8B8(void) -{ - switch(gUnknown_203B3F4->state) { - case 0: - case 1: - sub_803AAC4(); - break; - case 2: - sub_803AB34(); - break; - case 3: - sub_803ABAC(); - break; - case 4: - return 3; - } - return 0; -} - -void sub_803A908(void) -{ - if(gUnknown_203B3F4 != NULL) - { - MemoryFree(gUnknown_203B3F4); - gUnknown_203B3F4 = NULL; - } -} - -void sub_803A924(u32 newState) -{ - gUnknown_203B3F4->state = newState; - sub_803A93C(); - sub_803A9AC(); -} - -void sub_803A93C(void) -{ - s32 index; - sub_8006518(gUnknown_203B3F4->unk9C); - if(gUnknown_203B3F4->state == 2) - { - gUnknown_203B3F4->unk9C[2] = gUnknown_80E7EA4; - } - else - { - for(index = 0; index < 4; index++) - { - gUnknown_203B3F4->unk9C[index] = gUnknown_80E7E8C; - } - } - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B3F4->unk9C, 1, 1); -} - -void sub_803A9AC(void) -{ - switch(gUnknown_203B3F4->state) { - case 0: - sub_80211AC(0,3); - break; - case 1: - sub_8021354(1); - break; - case 2: - sub_8021494(); - sub_803AA34(); - sub_8012D60(&gUnknown_203B3F4->unk4C,gUnknown_203B3F4->menuItems,0,0,gUnknown_203B3F4->menuAction,2); - break; - case 3: - sub_8021774(gUnknown_203B3F4->friendArea,1,0); - break; - case 4: - break; - } -} - -void sub_803AA34(void) -{ - s32 index; - u8 *FriendAreas; - - - index = 0; - - // So dumb that it matches... - FriendAreas = gFriendAreas; - - if(FriendAreas[gUnknown_203B3F4->friendArea]) - { - gUnknown_203B3F4->menuItems[0].text = gDebug_CloseText; - if(sub_803ABC8()) - gUnknown_203B3F4->menuItems[0].menuAction = 3; - else - gUnknown_203B3F4->menuItems[0].menuAction = -1; - } - else - { - gUnknown_203B3F4->menuItems[0].text = gDebug_OpenText; - gUnknown_203B3F4->menuItems[0].menuAction = 2; - } - - index++; - gUnknown_203B3F4->menuItems[index].text = *gUnknown_80D4970; - gUnknown_203B3F4->menuItems[index].menuAction = 4; - - index++; - gUnknown_203B3F4->menuItems[index].text = NULL; - gUnknown_203B3F4->menuItems[index].menuAction = 1; - - gUnknown_203B3F4->menuAction = gUnknown_203B3F4->menuItems[0].menuAction; -} - -void sub_803AAC4(void) -{ - switch(sub_8021274(1)) - { - case 0: - case 1: - break; - case 3: - gUnknown_203B3F4->friendArea = sub_802132C(); - sub_803A924(2); - break; - case 4: - gUnknown_203B3F4->friendArea = sub_802132C(); - sub_803A924(3); - break; - case 2: - sub_80213A0(); - sub_803A924(4); - break; - } -} - -void sub_803AB34(void) -{ - s32 menuAction; - menuAction = 0; - sub_8021274(0); - if(!sub_8012FD8(&gUnknown_203B3F4->unk4C)) - sub_8013114(&gUnknown_203B3F4->unk4C, &menuAction); - switch(menuAction) - { - case 2: - UnlockFriendArea(gUnknown_203B3F4->friendArea); - sub_803A924(1); - break; - case 3: - sub_809249C(gUnknown_203B3F4->friendArea, 1); - sub_803A924(1); - break; - case 4: - sub_803A924(3); - break; - case 1: - sub_803A924(1); - break; - } -} - -void sub_803ABAC(void) -{ - switch(sub_80217EC()) - { - case 2: - case 3: - sub_8021830(); - sub_803A924(1); - break; - case 0: - case 1: - break; - } -} diff --git a/src/ds_menus.c b/src/ds_menus.c index 42c4d135..db9855c4 100644 --- a/src/ds_menus.c +++ b/src/ds_menus.c @@ -1,6 +1,6 @@ #include "global.h" #include "input.h" -#include "text.h" +#include "text1.h" u32 CreateDualSlotMenu(void) { diff --git a/src/dungeon_map_access_1.c b/src/dungeon_map_access_1.c index e318adf4..cd2279c9 100644 --- a/src/dungeon_map_access_1.c +++ b/src/dungeon_map_access_1.c @@ -1,13 +1,11 @@ #include "global.h" #include "dungeon_map_access.h" - #include "dungeon_global_data.h" #include "file_system.h" #include "tile_types.h" #include "random.h" #include "dungeon_engine.h" - -extern u16 gUnknown_202B038[4][32][32]; +#include "text1.h" extern void sub_80402AC(s32, s32); extern void sub_80098F8(u32); diff --git a/src/event_flag.c b/src/event_flag.c index 186ed329..e7e7d18c 100644 --- a/src/event_flag.c +++ b/src/event_flag.c @@ -10,7 +10,7 @@ #include "other_random.h" #include "friend_area.h" #include "team_inventory.h" - +#include "code_8097670.h" extern u8 gUnknown_2000A88[0x400]; @@ -52,7 +52,6 @@ extern void sub_80018D8(u32, u32, u32); extern void sub_809733C(u32, u32); extern void sub_80973A8(u32, u32); extern u8 HasRecruitedMon(u32); -extern void sub_80976F8(u32); extern void sub_800199C(u32, s32, u32, s32); extern s32 sub_8001784(u32, s32, u16); diff --git a/src/felicity_bank.c b/src/felicity_bank.c index b55bb173..f48c8f97 100644 --- a/src/felicity_bank.c +++ b/src/felicity_bank.c @@ -1,12 +1,12 @@ #include "global.h" -#include "pokemon.h" -#include "file_system.h" -#include "input.h" +#include "code_80130A8.h" #include "felicity_bank.h" #include "memory.h" -#include "team_inventory.h" -#include "text.h" #include "menu_input.h" +#include "pokemon.h" +#include "team_inventory.h" +#include "text1.h" +#include "text2.h" EWRAM_DATA_2 struct FelicityBankWork *gFelicityBankWork = {0}; @@ -29,15 +29,6 @@ extern u8 gFelicityMoney[]; extern u8 gUnknown_80DB738; extern void PlaySound(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); -extern void sub_8008C54(u32); -extern void sub_8013AA0(u32 *); -extern u32 sub_8013BBC(u32 *); -extern void sub_8013C68(u32 *); -extern void sub_80141B4(const u8 *, u32, struct OpenedFile **, u32); -extern void sub_8014248(const u8 *, u32, u32, const struct MenuItem *, void *, u32, u32, struct OpenedFile **, u32); -extern s32 sub_80144A4(s32 *); extern void sub_801645C(); extern void sub_80169BC(); extern void sub_8016B00(); diff --git a/src/friend_area_1.c b/src/friend_area_1.c index c7dee3f7..4b3d495f 100644 --- a/src/friend_area_1.c +++ b/src/friend_area_1.c @@ -1,8 +1,7 @@ #include "global.h" #include "constants/friend_area.h" #include "code_8092334.h" - -extern bool8 *gFriendAreas; +#include "friend_area.h" u32 SaveFriendAreas(u8 *r0, u32 size) { diff --git a/src/friend_area_action_menu.c b/src/friend_area_action_menu.c index 34880e9c..c4c8adb2 100644 --- a/src/friend_area_action_menu.c +++ b/src/friend_area_action_menu.c @@ -1,35 +1,31 @@ #include "global.h" #include "memory.h" -#include "text.h" -#include "input.h" -#include "menu.h" +#include "text1.h" +#include "text2.h" #include "item.h" #include "pokemon.h" #include "team_inventory.h" #include "friend_area_action_menu.h" #include "menu_input.h" #include "kecleon_bros.h" +#include "sprite.h" +#include "code_80130A8.h" +#include "code_801EE10_1.h" +#include "code_801B3C0.h" extern struct unkStruct_203B2BC *gUnknown_203B2BC; -extern void sub_80141B4(const char *r0, u32, u32 *r1, u32); -extern void sub_8014248(const char *r0, u32, u32, struct MenuItem *r4, u32, u32, u32, u32 *r5, u32); extern void sub_8027D40(u32, struct BulkItem *); -extern void sub_8023868(u32, u32, u32, u32); -extern void sub_8023B7C(u32); -extern void sub_8023DA4(); extern void sub_8024458(s16, u32); extern void sub_801BEEC(s16); extern void GetLinkedSequence(u32, struct Move *, u16*); extern void sub_801F808(u16*); extern void sub_8027794(); extern void sub_801F1B0(u32, u32); -extern void sub_801B3C0(struct Item *); extern void unk_CopyMoves4To8(struct Move *, struct Move *); extern void sub_801EE10(u32, s16, struct Move *, u32, u32, u32); extern void SetFriendAreaActionMenuState(u32); -extern void ResetSprites(u8 ); extern void sub_802719C(); extern void sub_8027274(); extern void sub_80277FC(); @@ -123,7 +119,7 @@ ALIGNED(4) const u8 gUnknown_80DD8D0[] = _( u32 sub_8027074(void) { - ResetSprites(0); + ResetSprites(FALSE); gUnknown_203B2BC = MemoryAlloc(sizeof(struct unkStruct_203B2BC), 8); gUnknown_203B2BC->menuAction1 = 0; gUnknown_203B2BC->menuAction2 = 0; diff --git a/src/friend_area_action_menu_1.c b/src/friend_area_action_menu_1.c index 7af07dd8..46df1c08 100644 --- a/src/friend_area_action_menu_1.c +++ b/src/friend_area_action_menu_1.c @@ -1,21 +1,20 @@ #include "global.h" #include "constants/dungeon.h" #include "memory.h" -#include "text.h" -#include "input.h" -#include "menu.h" +#include "text2.h" #include "item.h" #include "team_inventory.h" #include "pokemon.h" #include "friend_area_action_menu.h" #include "menu_input.h" #include "kecleon_bros.h" +#include "code_80130A8.h" +#include "code_801EE10_1.h" +#include "code_801B3C0.h" extern struct unkStruct_203B2BC *gUnknown_203B2BC; extern struct TeamInventory *gTeamInventoryRef; -extern u32 sub_801B410(); -extern void sub_801B450(); extern u32 sub_801EF38(u8 r0); extern void sub_801F214(); @@ -24,7 +23,6 @@ extern void PlaySound(u32); extern void nullsub_104(); extern void sub_8099690(u32); -extern s32 sub_80144A4(s32 *); extern void sub_8027EB8(); extern void sub_808D31C(struct PokemonStruct *); extern bool8 sub_80023E4(u32); @@ -32,10 +30,6 @@ extern struct PokemonStruct *sub_808D3F8(void); extern struct PokemonStruct *sub_808D3BC(void); extern u32 sub_801F890(void); extern void sub_801F8D0(void); -extern void xxx_format_and_draw(u32, u32, const u8 *, ...); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern u8 gUnknown_202DE58[]; extern u32 sub_801F194(void); @@ -47,12 +41,9 @@ extern void sub_801BF98(void); extern u32 sub_80244E4(void); extern void sub_802453C(void); -extern u32 sub_8023A94(u32); extern bool8 sub_808D750(s16 index_); extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern void sub_808ED00(); -extern s16 sub_8023B44(void); -extern void sub_8023C60(void); ALIGNED(4) const u8 gFriendActionStandby[] = "Stand By"; ALIGNED(4) const u8 gFriendActionMakeLeader[] = "Make Leader"; @@ -130,7 +121,7 @@ void sub_80277FC(void) { struct PokemonStruct *pokeStruct; - switch(sub_8023A94(1)) { + switch(sub_8023A94(TRUE)) { case 0: case 1: break; @@ -165,7 +156,7 @@ void sub_80278B4(void) u32 menuAction; menuAction = 0; - sub_8023A94(0); + sub_8023A94(FALSE); if ((sub_8012FD8(&gUnknown_203B2BC->unk7C) == 0) && (sub_8013114(&gUnknown_203B2BC->unk7C,&menuAction), menuAction != 1)) { gUnknown_203B2BC->menuAction1 = menuAction; } diff --git a/src/friend_list_menu.c b/src/friend_list_menu.c index 07134ece..2959a375 100644 --- a/src/friend_list_menu.c +++ b/src/friend_list_menu.c @@ -1,15 +1,18 @@ #include "global.h" #include "constants/dungeon.h" #include "memory.h" -#include "text.h" -#include "input.h" -#include "menu.h" +#include "text1.h" +#include "text2.h" #include "item.h" #include "pokemon.h" #include "moves.h" #include "menu_input.h" #include "team_inventory.h" #include "kecleon_bros.h" +#include "code_80130A8.h" +#include "code_801EE10_1.h" +#include "code_8012A18_1.h" +#include "code_801B3C0.h" // there might be more overlap with unkStruct_203B2BC // I was working on the moves and put the data that seemed to correspond to that @@ -112,46 +115,28 @@ ALIGNED(4) const u8 gFriendListCheckIQ[] = "Check IQ"; ALIGNED(4) const u8 gFriendListItem[] = _("Item: {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} "); ALIGNED(4) static const u8 fill0[] = "pksdir0"; -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); -extern void xxx_format_and_draw(s32, s32, const u8 *, ...); -extern u32 sub_8023A94(u32); -extern s16 sub_8023B44(void); -extern void sub_8023C60(void); -extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32); extern s16 sub_80A5728(void); extern u8 sub_8002658(s16); extern bool8 sub_8024108(u32); -extern u32 sub_801B3C0(struct Item *param_1); -extern void sub_8023868(u32, u32, u32, u32); extern void sub_801F1B0(u32, u32); extern void PlaySound(u32); extern void sub_8024458(s16, u32); extern void sub_801BEEC(s16); -extern void sub_8023B7C(u32); -extern void sub_8023DA4(void); extern void nullsub_104(void); extern void sub_808ED00(void); extern u32 sub_80244E4(void); extern void sub_802453C(void); extern u32 sub_801BF48(void); extern void sub_801BF98(void); -extern void sub_801B450(void); -extern u32 sub_801B410(void); extern u32 sub_801EF38(u32); extern u32 sub_801F194(void); extern void sub_801F214(void); extern void sub_801EE10(u32, s16, struct Move *, u32, u32, u32); extern void sub_801F808(u16 *); -extern u32 sub_801602C(u32 r0, u8 *name); extern void sub_8099690(u32); extern void sub_801F8D0(void); extern u32 sub_801F890(void); -extern void sub_80160D8(void); -extern u32 sub_8016080(void); -extern s32 sub_80144A4(s32 *); extern bool8 sub_80023E4(u32); void sub_8025434(s32); @@ -493,7 +478,7 @@ void sub_802591C(void) void sub_80259F0(void) { - switch(sub_8023A94(1)) + switch(sub_8023A94(TRUE)) { case 3: gUnknown_203B2B4->species = sub_8023B44(); @@ -518,7 +503,7 @@ void sub_8025A84(void) { s32 menuAction = 0; - sub_8023A94(0); + sub_8023A94(FALSE); if(!sub_8012FD8(&gUnknown_203B2B4->unk78)) { sub_8013114(&gUnknown_203B2B4->unk78, &menuAction); diff --git a/src/friend_rescue.c b/src/friend_rescue.c index 654a17b8..2b0327f7 100644 --- a/src/friend_rescue.c +++ b/src/friend_rescue.c @@ -2,23 +2,26 @@ #include "constants/communication_error_codes.h" #include "constants/monster.h" #include "constants/wonder_mail.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "text_util.h" -#include "input.h" #include "item.h" #include "team_inventory.h" #include "pokemon.h" #include "friend_rescue.h" #include "memory.h" #include "save.h" -#include "menu.h" #include "rescue_password_menu.h" #include "menu_input.h" #include "code_8094F88.h" +#include "code_80130A8.h" +#include "main_menu.h" +#include "code_801EE10_1.h" +#include "code_801C620.h" +#include "code_801B3C0.h" extern void SetFriendRescueMenuState(u32); extern struct PokemonStruct *GetPlayerPokemonStruct(void); -extern s32 sub_80144A4(s32 *); extern void sub_802F2C0(); extern u32 sub_802F298(); @@ -251,15 +254,6 @@ extern void sub_8034848(void); extern u32 sub_80154F0(); extern void sub_80155F0(); -extern u32 sub_801CA08(u32); -extern void sub_801CBB8(void); -extern void sub_801CB5C(u32); -extern void sub_8035CC0(struct UnkTextStruct2 *, u32); -extern void sub_801B3C0(struct Item *); -extern u32 sub_801B410(void); -extern void sub_801B450(void); -extern void sub_8035CF4(struct MenuStruct *, u32, u32); -extern u8 sub_801CB24(void); extern u32 sub_8030DA0(void); extern void sub_8030DE4(void); extern void sub_803092C(void); @@ -275,45 +269,26 @@ extern u8 sub_8024108(u32); extern void sub_802452C(void); extern u32 sub_80244E4(void); extern void sub_802453C(void); -extern void sub_8023B7C(u32); -extern u32 sub_8023A94(u32); -extern void sub_8023C60(void); extern void sub_8024458(s16, u32); -extern void sub_8023DA4(void); extern void sub_8035D1C(void); -extern u16 sub_8023B44(void); extern u32 sub_8039068(u32, u8 *passwordBuffer, struct unkStruct_203B480 *r0); -extern bool8 sub_801CF14(s32); extern void sub_803084C(void); extern void sub_8031E10(void); -extern void sub_8023C60(void); extern void sub_80155F0(void); -extern void sub_801CBB8(void); extern void sub_802F2C0(void); extern void sub_8030DE4(void); extern void sub_802453C(void); -extern void sub_801B450(void); -extern void sub_800641C(struct UnkTextStruct2 *a0, u8 a1, u8 a2); -extern void sub_8006518(struct UnkTextStruct2 *); extern u8 sub_800D588(void); extern void sub_8011830(void); -extern void sub_80141B4(const u8 *, u32, struct OpenedFile **, u32); -extern void sub_8014248(const u8 *, u32, u32, const struct MenuItem *, void *, u32, u32, struct OpenedFile **, u32); extern void sub_80151C0(u32, u8 *); -extern void sub_801C8C4(u32, u32, s32 * , u32); -extern void sub_801CCD8(void); extern u32 sub_801D008(void); -extern void sub_8023868(u32, u32, u32, u32); -extern void sub_8023C60(void); extern u32 sub_8023CE8(void); -extern void sub_8023DA4(void); extern void sub_802F204(struct unkStruct_802F204 *, u32); extern u32 sub_80306A8(u32 wonderMailType, u32, struct UnkTextStruct2_sub *, u32); extern u32 sub_8030894(void); extern void sub_803092C(void); extern bool8 sub_8031D70(u32 mailIndex, s32); -extern void sub_8035CF4(struct MenuStruct *, u32, u32); extern s32 sub_8037B28(u32); extern s32 sub_8037D64(u32, void *, void *); extern s32 sub_80381F4(u32, void *, void *); @@ -327,7 +302,6 @@ extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern void MemoryFill8(u8 *dest, u8 value, s32 size); extern void nullsub_23(u32); extern void ResetUnusedInputStruct(void); -extern void SetMenuItems(struct MenuStruct *param_1, struct UnkTextStruct2 *unkData, s32 index, const struct UnkTextStruct2 *param_4, const struct MenuItem *menuItems, u8 param_6, u32 menuAction, u32 unused_8); extern void sprintfStatic(char *buffer, const char *text, ...); extern void xxx_call_start_bg_music(void); @@ -1096,8 +1070,8 @@ void sub_8032828(void) ResetUnusedInputStruct(); sub_800641C(0,1,1); { - struct {u16 a; u16 b;} local_x = {3, 2}; - sub_801C8C4(0, 1, (s32 *)&local_x, 9); + struct UnkTextStruct2_sub local_x = {3, 2}; + sub_801C8C4(0, 1, &local_x, 9); } } break; @@ -1872,7 +1846,7 @@ void sub_8034130(void) void sub_803418C(void) { - switch(sub_8023A94(1)) + switch(sub_8023A94(TRUE)) { case 2: sub_8023C60(); @@ -1904,7 +1878,7 @@ void sub_8034254(void) s32 menuAction; menuAction = -1; - sub_8023A94(0); + sub_8023A94(FALSE); if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); switch(menuAction) @@ -2477,7 +2451,7 @@ void sub_8034B88(void) gUnknown_203B33C->item.id = ITEM_NOTHING; gUnknown_203B33C->item.quantity = 1; gUnknown_203B33C->item.flags = 0; - switch(sub_801CA08(1)) + switch(sub_801CA08(TRUE)) { case 2: sub_801CBB8(); @@ -2508,7 +2482,7 @@ void sub_8034C38(void) sub_801B450(); ResetUnusedInputStruct(); sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); - sub_801CB5C(1); + sub_801CB5C(TRUE); if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) { sub_8035CF4(gUnknown_203B33C->unk21C, 3, 1); @@ -2528,7 +2502,7 @@ void sub_8034C98(void) s32 menuAction; menuAction = -1; - sub_801CA08(0); + sub_801CA08(FALSE); if(!sub_8012FD8(&gUnknown_203B33C->unk21C[3])) sub_8013114(&gUnknown_203B33C->unk21C[3], &menuAction); switch(menuAction) @@ -2548,7 +2522,7 @@ void sub_8034C98(void) case 5: case 8: sub_8035CC0(gUnknown_203B33C->unk35C, 3); - sub_801CB5C(0x1); + sub_801CB5C(TRUE); SetFriendRescueMenuState(0x5F); break; } @@ -2788,7 +2762,7 @@ void sub_80350F4(void) switch(menuAction) { case 0x15: - if(sub_801CF14(0) != 0) + if(sub_801CF14(0)) SetFriendRescueMenuState(0x56); else SetFriendRescueMenuState(0x57); diff --git a/src/gulpin_shop.c b/src/gulpin_shop.c index f0d500d3..71e8c2c5 100644 --- a/src/gulpin_shop.c +++ b/src/gulpin_shop.c @@ -1,11 +1,10 @@ #include "global.h" -#include "file_system.h" +#include "code_80130A8.h" #include "pokemon.h" #include "memory.h" #include "moves.h" -#include "text.h" -#include "input.h" -#include "menu.h" +#include "text1.h" +#include "text2.h" #include "gulpin_shop.h" #include "menu_input.h" @@ -22,8 +21,6 @@ extern const u8 gUnknown_80DC230[]; extern u8 gAvailablePokemonNames[0x50 * 2]; extern const u8 *gGulpinDialogue[2][25]; -extern void sub_8014248(const u8 *, u32, u32, const struct MenuItem *, void *, u32, u32, struct OpenedFile **, u32); -extern u32 sub_80144A4(s32 *); void sub_801EC7C(void); void sub_801ECBC(void); void sub_801ED28(void); diff --git a/src/gulpin_shop_1.c b/src/gulpin_shop_1.c index 33104cf5..8ea2ebf1 100644 --- a/src/gulpin_shop_1.c +++ b/src/gulpin_shop_1.c @@ -1,16 +1,16 @@ #include "global.h" #include "memory.h" -#include "menu.h" #include "pokemon.h" #include "pokemon_3.h" -#include "file_system.h" -#include "input.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "team_inventory.h" #include "menu_input.h" #include "gulpin_shop.h" #include "moves.h" #include "felicity_bank.h" +#include "code_80130A8.h" +#include "code_801EE10_1.h" // size: 0x1E0 struct unkStruct_203B27C @@ -84,22 +84,16 @@ extern u8 gUnknown_80DC438[]; extern u8 gUnknown_80DC448[]; extern u8 gUnknown_202E128[]; -extern s32 sub_80144A4(s32 *); void PlayMenuSoundEffect(u32); void PlaySound(u32); bool8 sub_8021178(void); void CreateGulpinShopMenu(void); -extern void sub_8014248(const u8 *, u32, u32, const struct MenuItem *, void *, u32, u32, struct OpenedFile **, u32); -extern void sub_80141B4(const u8 *, u32, struct OpenedFile **, u32); void sub_8020950(void); void sub_8020900(void); bool8 sub_801F808(u16 *moveIDs); void sub_801F700(void); bool8 sub_801F428(s16 index, s32 param_2); void sub_801F5F0(u8 r0); -extern void sub_8023DA4(void); -extern void sub_8023868(u32, u32, u32, u32); -extern void sub_8023B7C(u32); extern void sub_801F1B0(u32, u32); extern void sub_801F280(u32); void sub_8024458(u32, u32); @@ -128,9 +122,6 @@ extern void sub_80209FC(void); extern void sub_8020A34(void); extern void sub_801FDC0(void); extern void sub_801FF28(void); -u32 sub_8023A94(u32); -void sub_8023C60(void); -extern s16 sub_8023B44(void); extern u32 sub_80244E4(void); extern u32 sub_801BF48(void); extern void sub_802453C(void); @@ -763,7 +754,7 @@ void sub_8020A34(void) void sub_8020A80(void) { - switch(sub_8023A94(1)) + switch(sub_8023A94(TRUE)) { case 3: gUnknown_203B27C->speciesNum = sub_8023B44(); @@ -794,7 +785,7 @@ void sub_8020B38(void) s32 menuAction; menuAction = 0; - sub_8023A94(0); + sub_8023A94(FALSE); if (!sub_8012FD8(&gUnknown_203B27C->unkCC)) { sub_8013114(&gUnknown_203B27C->unkCC,&menuAction); if (menuAction != 1) { diff --git a/src/hints_menu.c b/src/hints_menu.c index 112e926c..a9e4a625 100644 --- a/src/hints_menu.c +++ b/src/hints_menu.c @@ -1,6 +1,7 @@ #include "global.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "input.h" #include "menu_input.h" @@ -47,9 +48,6 @@ extern void PlayMenuSoundEffect(u32); extern void sub_801E714(void); extern void sub_801E76C(void); extern void DisplayChosenHint(void); -extern void sub_80073E0(u32); -extern void sub_80073B8(u32); -extern void sub_8008C54(u32); void DrawHintSelectionMenu(void); void sub_801E594(void); diff --git a/src/items.c b/src/items.c index ae765bd5..d672be9a 100644 --- a/src/items.c +++ b/src/items.c @@ -1,6 +1,5 @@ #include "global.h" #include "constants/colors.h" -#include "file_system.h" #include "item.h" #include "moves.h" #include "team_inventory.h" @@ -11,7 +10,8 @@ #include "team_inventory.h" #include "code_800D090.h" #include "text_util.h" - +#include "text2.h" +#include "code_80130A8.h" #include extern struct FileArchive gSystemFileArchive; @@ -39,11 +39,7 @@ EWRAM_DATA struct TeamInventory gTeamInventory = {0}; EWRAM_DATA_2 struct TeamInventory *gTeamInventoryRef = {0}; extern s32 sub_8090FEC(s32 a1, u8* a2, u8 a3); -extern void sub_80073B8(u32); extern u32 sub_8097DF0(char *, struct subStruct_203B240 **); -extern void sub_80078A4(u32, u32, u32, u32, u32); -extern void sub_80073E0(u32); -extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32); extern s32 sub_8091E94(s32 a1, s32 a2, s32 a3); extern void SortKecleonShopInventory(); bool8 AddKecleonWareItem(u8); diff --git a/src/kangaskhan_storage.c b/src/kangaskhan_storage.c index 3791191b..404c6df3 100644 --- a/src/kangaskhan_storage.c +++ b/src/kangaskhan_storage.c @@ -1,5 +1,7 @@ #include "global.h" -#include "input.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" +#include "code_801C620.h" #include "item.h" #include "kangaskhan_storage.h" #include "kecleon_bros.h" @@ -7,6 +9,8 @@ #include "menu_input.h" #include "pokemon.h" #include "team_inventory.h" +#include "text1.h" +#include "text2.h" extern u8 gUnknown_202DE58[]; extern u8 gUnknown_202E1C8[]; @@ -35,35 +39,6 @@ extern const u8 gUnknown_80DB830[]; // "Number?\0" extern const u8 *gKangaskhanStorageDialogue[2][20]; -// text.s -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); -extern void sub_8008C54(u32); -// code_80130A8.s -extern void sub_8013AA0(u32 *); -extern u32 sub_8013BBC(u32 *); -extern void sub_8013C68(u32 *); -extern void sub_80141B4(const u8 *r0, u32, struct OpenedFile **r1, u32); -extern void sub_8014248(const u8 *r0, u32, u32, const struct MenuItem *r4, u16 *, u32, u32, struct OpenedFile **r5, u32); -extern s32 sub_80144A4(s32 *); -// code_801B3C0.c -extern void sub_801B3C0(struct Item *); -extern u32 sub_801B410(void); -extern void sub_801B450(void); -extern void sub_801BB20(void); -extern void sub_801BC24(void); -// code_801C620.c -extern void sub_801C8C4(u32, u32, u32, u32); -extern u32 sub_801CA08(u32); -extern u8 sub_801CB24(void); -extern void sub_801CB5C(u32); -extern void sub_801CBB8(void); -extern void sub_801CCD8(void); -extern bool8 sub_801CF14(u32); -extern bool8 sub_801CF50(u32); -extern void sub_801CF94(void); -extern u32 sub_801CFB8(void); -extern u32 sub_801CFE0(u8); // code_8098BDC.s extern void sub_8099690(u32); @@ -360,7 +335,7 @@ void sub_8016FF8(void) sub_801AD34(0); break; case 23: - sub_801CB5C(1); + sub_801CB5C(TRUE); sub_801AD34(0); break; case 24: @@ -728,7 +703,7 @@ void sub_8017AF8(void) void sub_8017B88(void) { - switch (sub_801CA08(1)) { + switch (sub_801CA08(TRUE)) { case 3: if (sub_801CFB8() != 0) UpdateKangaskhanStorageState(28); @@ -757,7 +732,7 @@ void sub_8017B88(void) void sub_8017C28(void) { - sub_801CA08(0); + sub_801CA08(FALSE); sub_8012FD8(&gKangaskhanStorageWork->unk58); switch (sub_8013BBC(&gKangaskhanStorageWork->unkA8)) { @@ -814,7 +789,7 @@ void sub_8017D24(void) s32 menuAction; menuAction = 0; - sub_801CA08(0); + sub_801CA08(FALSE); if (sub_8012FD8(&gKangaskhanStorageWork->unk58) == 0) { sub_8013114(&gKangaskhanStorageWork->unk58, &menuAction); if (menuAction != 1) @@ -1014,7 +989,7 @@ void sub_8018100(void) sub_801AD34(0); break; case 11: - sub_801CB5C(1); + sub_801CB5C(TRUE); sub_801AD34(0); break; case 12: @@ -1253,7 +1228,7 @@ void sub_80186F8(void) struct BulkItem item; s32 itemID; - switch (sub_801CA08(1)) { + switch (sub_801CA08(TRUE)) { case 3: if (sub_801CFB8() != 0) { for (itemID = 0; itemID < NUMBER_OF_ITEM_IDS; itemID++) { @@ -1311,7 +1286,7 @@ void sub_8018854(void) { struct BulkItem item; - sub_801CA08(0); + sub_801CA08(FALSE); sub_8012FD8(&gUnknown_203B20C->unk70); switch (sub_8013BBC(&gUnknown_203B20C->unkC0)) { @@ -1398,7 +1373,7 @@ void sub_80189C8(void) menuAction = 0; - sub_801CA08(0); + sub_801CA08(FALSE); if (sub_8012FD8(&gUnknown_203B20C->unk70) == 0) { sub_8013114(&gUnknown_203B20C->unk70, &menuAction); if (menuAction != 1) diff --git a/src/kecleon_bros.c b/src/kecleon_bros.c index bea2cca4..5d8fab94 100644 --- a/src/kecleon_bros.c +++ b/src/kecleon_bros.c @@ -1,5 +1,7 @@ #include "global.h" #include "code_800D090.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" #include "constants/input.h" #include "felicity_bank.h" #include "kecleon_bros.h" @@ -7,6 +9,8 @@ #include "menu_input.h" #include "pokemon.h" #include "team_inventory.h" +#include "text1.h" +#include "text2.h" extern struct KecleonBrosWork *gKecleonBrosWork; extern struct unkStruct_203B214 *gUnknown_203B214; @@ -51,27 +55,12 @@ extern const u8 *gKecleonShopDialogue[KECLEON_BROS_MODE_COUNT][23]; extern const u8 gTeamToolboxA[]; extern const u8 gTeamToolboxB[]; -// text.s -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); -extern void sub_8007B7C(s32, s32, s32, s32, s32); -extern void sub_8008C54(u32); -// code_80130A8.s -extern void sub_80141B4(const u8 *, u32, struct OpenedFile **, u32); -extern void sub_8014248(const u8 *, u32, u32, const struct MenuItem *, void *, u32, u32, struct OpenedFile **, u32); -extern s32 sub_80144A4(s32 *); -// code_801B3C0.c -extern u32 sub_801B3C0(struct Item *); -extern u32 sub_801B410(void); -extern void sub_801B450(void); // code_8098BDC.s extern void sub_8099690(u32); // code_80118A4.c extern void PlayMenuSoundEffect(u32); extern void PlaySound(u16 songIndex); -// code_80130A8.s -extern void xxx_format_and_draw(u32, u32, u8 *, u32, u32); void sub_8018D30(void); void sub_80194F8(void); diff --git a/src/load_screen.c b/src/load_screen.c index ffb725e3..4dbfa17f 100644 --- a/src/load_screen.c +++ b/src/load_screen.c @@ -6,7 +6,8 @@ #include "file_system.h" #include "memory.h" #include "menu.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "text_util.h" #include "pokemon.h" #include "save.h" @@ -41,9 +42,6 @@ u8 IsQuickSave(void); void DrawLoadScreenText(void); void sub_80397B4(void); -extern void sub_8035CF4(struct MenuStruct *, u32, u32); -extern void SetMenuItems(struct MenuStruct *, struct UnkTextStruct2 *, u32, const struct UnkTextStruct2 *, const struct MenuItem *, u32, u32, u32); - extern void sub_80920D8(u8 *); extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern bool8 sub_80023E4(u32); @@ -52,14 +50,10 @@ extern u8 *GetDungeonLocationInfo(void); extern u32 GetNumAdventures(void); extern void PrintDungeonLocationtoBuffer(u8 *, u8 *); extern u32 sub_8001658(u32, u32); -extern void sub_80073E0(u32); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); extern void xxx_format_string(u8 *, u8 *, u8 *, u32); extern void SetBGPaletteBufferColorArray(s32, s32); -extern void sub_8007E20(s32, s32, s32, u32, u32, s32, u32); const struct UnkTextStruct2 gUnknown_80E75F8 = { 0x00, 0x00, 0x00, 0x00, @@ -398,8 +392,7 @@ void sub_80397B4(void) for(index = 0; index < 12; index++) { if (sub_80023E4(gUnknown_203B3B8[index])) { - sub_8007E20(0,x,y,0x10,0x10,*(int *)(clmkFile->data) + index * 0x80, - gUnknown_203B388[index]); + sub_8007E20(0,x,y,0x10,0x10,(u8 *)(*((s32*)clmkFile->data) + index * 0x80), gUnknown_203B388[index]); x += 16; } } diff --git a/src/luminous_cave.c b/src/luminous_cave.c index e587241e..1e8d92f4 100644 --- a/src/luminous_cave.c +++ b/src/luminous_cave.c @@ -1,17 +1,19 @@ #include "global.h" #include "constants/bg_music.h" #include "constants/colors.h" -#include "input.h" #include "item.h" #include "memory.h" -#include "menu.h" #include "pokemon.h" #include "random.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "text_util.h" #include "team_inventory.h" #include "menu_input.h" #include "kecleon_bros.h" +#include "code_80130A8.h" +#include "code_8012A18_1.h" +#include "code_801B3C0.h" struct unkStruct_203B2B0 { @@ -184,8 +186,6 @@ extern void LuminousCave_AdvancetoFallbackState(void); extern void sub_8024804(void); extern void UpdateLuminousCaveDialogue(void); -extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32); -extern void sub_8014248(const char *r0, u32, u32, struct MenuItem *r4, u16 *, u32, u32, struct OpenedFile **r5, u32); void xxx_call_fade_out_bgm(u16 speed); void xxx_call_stop_fanfare_se(u16 songIndex); void xxx_call_fade_in_new_bgm(u16 songIndex, u16 speed); @@ -194,20 +194,13 @@ void PlaySound(u32); void sub_8024CFC(void); void sub_8025254(void); void sub_8024D48(void); -extern void sub_801B3C0(struct Item *); extern void nullsub_104(); void sub_8024DBC(void); void sub_8024E30(void); void sub_801AEE4(u32, u32); void sub_808F734(struct PokemonStruct *, s16); -u32 sub_801602C(u32 r0, u8 *name); -extern s32 sub_80144A4(s32 *); extern void sub_8099690(u32); extern void PlayMenuSoundEffect(u32); -extern u32 sub_801B410(void); -extern void sub_801B450(void); -extern u32 sub_8016080(void); -extern void sub_80160D8(void); extern void sub_808F468(struct PokemonStruct *, u8 *, u32); bool8 LuminousCave_HasOnly1Member(void); diff --git a/src/mailbox.c b/src/mailbox.c index b604e77a..3b271c27 100644 --- a/src/mailbox.c +++ b/src/mailbox.c @@ -1,6 +1,7 @@ #include "global.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "menu.h" #include "input.h" #include "mailbox.h" @@ -86,9 +87,6 @@ extern void InitializeJobListMenu(u32); extern void sub_802B640(u32, u32, u32); extern void sub_802B7D0(u32); extern void sub_802B9FC(u8); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern u32 sub_802BA8C(void); extern void sub_802BACC(void); extern u8 GetPokemonNewsIndex(void); diff --git a/src/main.c b/src/main.c index a8c90c3b..b19eee06 100644 --- a/src/main.c +++ b/src/main.c @@ -1,66 +1,61 @@ #include "global.h" +#include "bg_palette_buffer.h" +#include "cpu.h" #include "crt0.h" -#include "random.h" +#include "file_system.h" #include "flash.h" -#include "text.h" - -extern char ewram_start[]; - -typedef void (*IntrCallback)(void); +#include "input.h" +#include "main.h" +#include "random.h" +#include "reg_control.h" +#include "sprite.h" +#include "text1.h" +#include "text2.h" EWRAM_DATA u8 IntrMain_Buffer[0x120] = {0}; EWRAM_DATA IntrCallback gIntrTable[6] = {0}; EWRAM_DATA IntrCallback gIntrCallbacks[6] = {0}; + +extern char ewram_start[]; extern u16 gBldCnt; extern u8 gUnknown_202D7FE; -EWRAM_DATA_2 u8 gInterruptsEnabled = {0}; -extern u16 gUnknown_203B0AC; -extern s16 gUnknown_203B0AE; - - extern char alt_203B038[]; - extern char gTitlePaletteFile[]; extern char gUnknown_203BC04[]; - extern char iwram_start[]; - extern char alt_3001B58[]; - +extern char unk_code[]; extern char unk_code_ram[]; extern char unk_code_ram_end[]; -extern u8 gUnknown_80B9BF1[]; -extern IntrCallback gInitialIntrTable[6]; +EWRAM_DATA_2 u8 gInterruptsEnabled = {0}; -extern char gUnknown_8270000[]; +// data_8270000.s +extern const char gUnknown_8270000[]; +// data_80B9BB8.s +extern const u8 gUnknown_80B9BF1[]; +extern const IntrCallback gInitialIntrTable[6]; -extern char unk_code[]; - -extern void sub_800CDA8(int); -extern void sub_800B540(void); -extern void InitSprites(void); +// code_800558C_1.c extern void nullsub_9(void); -extern void nullsub_6(void); -extern void InitInput(void); -extern void InitBGPaletteBuffer(void); extern void sub_80057E8(void); -extern void InitFileSystem(void); +// code_8009804.c extern void sub_80098A0(void); -extern void InitGraphics(void); +// code_2.c extern void GameLoop(void); +// code_800D090.c extern void Hang(void); -extern void VBlank_CB(void); - -extern void nullsub_17(void); -extern void InitMusic(void); // music initializer extern void sub_800D6AC(void); extern void sub_800D7D0(void); +// music.c +extern void InitMusic(void); // music initializer +// code_8004AA0.s +extern void nullsub_6(void); -bool8 EnableInterrupts(void); void InitIntrTable(const IntrCallback *interrupt_table); IntrCallback SetInterruptCallback(u32 index, IntrCallback new_callback); +void sub_800B540(void); void AgbMain(void) { @@ -77,8 +72,7 @@ void AgbMain(void) if (gUnknown_203BC04 - gTitlePaletteFile > 0) CpuCopy32(gUnknown_8270000, gTitlePaletteFile, gUnknown_203BC04 - gTitlePaletteFile); - if (alt_203B038 - ewram_start > 0) - { + if (alt_203B038 - ewram_start > 0) { memset(value, 0, 4); CpuSet(&value, ewram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((alt_203B038 - ewram_start) / 4) & 0x1FFFFF)); } @@ -86,8 +80,7 @@ void AgbMain(void) if (unk_code_ram_end - unk_code_ram > 0) CpuCopy32(unk_code, unk_code_ram, unk_code_ram_end - unk_code_ram); - if (alt_3001B58 - iwram_start > 0) - { + if (alt_3001B58 - iwram_start > 0) { memset(value, 0, 4); CpuSet(&value, iwram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((alt_3001B58 - iwram_start) / 4) & 0x1FFFFF)); } @@ -121,7 +114,7 @@ void AgbMain(void) LoadCharmaps(); sub_80098A0(); InitGraphics(); - SetInterruptCallback(1, (IntrCallback)VBlank_CB); + SetInterruptCallback(1, VBlank_CB); REG_DISPCNT = DISPCNT_WIN1_ON | DISPCNT_WIN0_ON | DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP; // 32576 GameLoop(); Hang(); @@ -130,14 +123,14 @@ void AgbMain(void) void sub_800B540(void) { s32 i; - for (i = 0; i < 6; i++) { + + for (i = 0; i < 6; i++) gIntrCallbacks[i] = NULL; - } nullsub_17(); InitMusic(); // initialize music and stop DMAs - while(REG_VCOUNT < 160){} + while (REG_VCOUNT < 160){} REG_IE ^= INTR_FLAG_TIMER3 | INTR_FLAG_VBLANK | INTR_FLAG_VCOUNT; // 0x45 @@ -161,64 +154,43 @@ void sub_800B540(void) bool8 EnableInterrupts(void) { - if(!gInterruptsEnabled) - { + if (!gInterruptsEnabled) return FALSE; - } - if(REG_IME & 1) - { + if (REG_IME & 1) return FALSE; - } - else - { - REG_IME = 1; - return TRUE; - } + + REG_IME = 1; + return TRUE; } bool8 DisableInterrupts(void) { - if(!gInterruptsEnabled) - { + if (!gInterruptsEnabled) return FALSE; - } - if(!(REG_IME & 1)) - { + if (!(REG_IME & 1)) return FALSE; - } - else - { - REG_IME = 0; - return TRUE; - } + REG_IME = 0; + return TRUE; } bool8 sub_800B650(void) { - if(!gInterruptsEnabled) - { + if (!gInterruptsEnabled) return FALSE; - } - if(REG_IME & 1) - { + if (REG_IME & 1) return FALSE; - } - else - { - return TRUE; - } + + return TRUE; } void AckInterrupt(u16 flag) { - if(!gInterruptsEnabled) - { + if (!gInterruptsEnabled) return; - } REG_IME = 0; INTR_CHECK |= flag; @@ -227,8 +199,8 @@ void AckInterrupt(u16 flag) void InitIntrTable(const IntrCallback *interrupt_table) { - CpuCopy32(interrupt_table, gIntrTable, sizeof(gIntrTable)); // 0x18 = 0x6 * 4 (0x4f00 is 32 bits) - CpuCopy32(IntrMain, IntrMain_Buffer, sizeof(IntrMain_Buffer)); // 0x120 = 0x48 * 4 (0x4f00 is 32 bits) + CpuCopy32(interrupt_table, gIntrTable, sizeof(gIntrTable)); // 0x18 = 0x6 * 4 (0x4F00 is 32 bits) + CpuCopy32(IntrMain, IntrMain_Buffer, sizeof(IntrMain_Buffer)); // 0x120 = 0x48 * 4 (0x4F00 is 32 bits) INTR_VECTOR = IntrMain_Buffer; } @@ -245,9 +217,9 @@ IntrCallback SetInterruptCallback(u32 index, IntrCallback new_callback) interrupt_var = DisableInterrupts(); old_callback = gIntrCallbacks[index]; gIntrCallbacks[index] = new_callback; - if(interrupt_var){ - EnableInterrupts(); - } - return old_callback; -} + if (interrupt_var) + EnableInterrupts(); + + return old_callback; +} \ No newline at end of file diff --git a/src/main_menu.c b/src/main_menu.c index cfe61e2a..64160981 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -1,11 +1,9 @@ #include "global.h" -#include "text.h" -#include "menu.h" -#include "input.h" +#include "text1.h" +#include "text2.h" #include "menu_input.h" - #include "adventure_log.h" -#include "debug_menu.h" +#include "debug_menu1.h" #include "ds_menus.h" #include "pokemon.h" #include "friend_rescue.h" @@ -17,12 +15,12 @@ #include "trade_items_menu.h" #include "constants/wonder_mail.h" -// NOTE: 0x13 and 0x14 +// NOTE: 0x13 and 0x14 // Communication Screen? // Got Communication warning when I wrote them to the struct // NOTE: 0x29, 0x2A, 0x2B, 0x2C -// Triggers a save +// Triggers a save // NOTE: 0x2D // Triggers a save and then goes to 0x13 (comms warning) @@ -622,8 +620,8 @@ void sub_8035C1C(void) gMainMenu->sub.unk2D = 0; } -void -SetMenuItems(struct MenuStruct *param_1, struct UnkTextStruct2 *unkData, s32 index, const struct UnkTextStruct2 *param_4, const struct MenuItem *menuItems, u8 param_6 ,u32 menuAction, u32 unused_8) +void SetMenuItems(struct MenuStruct *param_1, struct UnkTextStruct2 *unkData, s32 index, + const struct UnkTextStruct2 *param_4, const struct MenuItem *menuItems, u8 param_6, u32 menuAction, u32 unused_8) { unkData[index] = *param_4; ResetUnusedInputStruct(); @@ -777,10 +775,10 @@ void DrawMainMenu(void) if(SetMainMenuText()) { - sub_8035CF4(gUnknown_203B34C->unk4,2,0); + sub_8035CF4(gUnknown_203B34C->unk4,2,FALSE); } - sub_8035CF4(gUnknown_203B34C->unk4,0,1); + sub_8035CF4(gUnknown_203B34C->unk4,0,TRUE); gUnknown_203B34C->unk0 = 1; } @@ -807,8 +805,8 @@ u32 UpdateMainMenu(void) if(SetMainMenuText()) { - sub_8035CF4(gUnknown_203B34C->unk4, 0, 1); - sub_8035CF4(gUnknown_203B34C->unk4, 2, 0); + sub_8035CF4(gUnknown_203B34C->unk4, 0, TRUE); + sub_8035CF4(gUnknown_203B34C->unk4, 2, FALSE); } switch(nextMenu) { @@ -819,8 +817,8 @@ u32 UpdateMainMenu(void) gUnknown_203B34C->unk0 = 1; nextMenu = MENU_NO_SCREEN_CHANGE; ResetUnusedInputStruct(); - sub_8035CF4(gUnknown_203B34C->unk4, 0, 1); - sub_8035CF4(gUnknown_203B34C->unk4, 2, 0); + sub_8035CF4(gUnknown_203B34C->unk4, 0, TRUE); + sub_8035CF4(gUnknown_203B34C->unk4, 2, FALSE); break; case MENU_TRADE_ITEMS: sub_8035DA0(); @@ -949,9 +947,9 @@ void sub_803623C(void) SetMainMenuItems(); gUnknown_203B34C->currMenuChoice = -1; if (SetMainMenuText()) { - sub_8035CF4(gUnknown_203B34C->unk4,2,0); + sub_8035CF4(gUnknown_203B34C->unk4,2,FALSE); } - sub_8035CF4(gUnknown_203B34C->unk4,0,1); + sub_8035CF4(gUnknown_203B34C->unk4,0,TRUE); } void SetMainMenuItems(void) diff --git a/src/makuhita_dojo.c b/src/makuhita_dojo.c index d8ba66db..959554fc 100644 --- a/src/makuhita_dojo.c +++ b/src/makuhita_dojo.c @@ -1,12 +1,15 @@ #include "global.h" +#include "code_800D090.h" +#include "code_80130A8.h" #include "constants/colors.h" #include "constants/input.h" -#include "code_800D090.h" #include "dungeon.h" #include "makuhita_dojo.h" #include "memory.h" #include "menu_input.h" #include "pokemon.h" +#include "text1.h" +#include "text2.h" extern u8 gUnknown_202E5D8[]; extern u8 gUnknown_202E1C8[]; @@ -64,13 +67,7 @@ ALIGNED(4) const u8 gUnknown_80E0824[] = _("{STAR_BULLET}"); ALIGNED(4) const u8 gMakuhitaCoursePlaceholder[] = _("{COLOR_2}%c%s{END_COLOR_TEXT_2}"); static const u8 makuhita_dojo_fill3[] = "pksdir0"; -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); -extern void sub_8008C54(u32); extern u32 sub_80095E4(s16, u32); -extern void sub_80141B4(const u8 *, u32, struct OpenedFile **, u32); -extern void sub_8014248(const u8 *, u32, u32, const struct MenuItem *, void *, u32, u32, struct OpenedFile **, u32); -extern s32 sub_80144A4(s32 *); extern u32 sub_801B60C(u32, u8, u8); extern u32 sub_801B6AC(void); extern void sub_801B72C(void); diff --git a/src/menu_input.c b/src/menu_input.c index 6f76eb01..f9ee9da8 100644 --- a/src/menu_input.c +++ b/src/menu_input.c @@ -1,33 +1,22 @@ #include "global.h" #include "constants/colors.h" #include "constants/input.h" -#include "menu.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "util.h" #include "code_800D090.h" #include "menu_input.h" +#include "code_80130A8.h" -struct unkChar -{ - u32 unk0; - s16 unk4; - s16 unk6; -}; -extern struct UnkTextStruct1 gUnknown_2027370[4]; extern u8 gUnknown_80D4828[]; extern void PlayMenuSoundEffect(u32); -extern void sub_80073B8(u32); extern s32 sub_8008ED0(const u8 *); -extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32); -extern void sub_80073E0(u32); void AddMenuCursorSprite_(struct MenuInputStruct *, u32); void sub_8012EBC(struct MenuStruct *param_1); extern void sub_8013134(struct MenuInputStruct *, u32, u32); extern s16 sub_8009614(u32, u32); extern u32 ReturnIntFromChar2(u8); -struct unkChar *GetCharacter(u32); -extern void xxx_call_draw_char(u32, u32, u32, u32, u32); extern void nullsub_7(u16 *); extern void nullsub_34(struct MenuInputStructSub *r0); diff --git a/src/menu_input_1.c b/src/menu_input_1.c index f8eaebf3..002e74b3 100644 --- a/src/menu_input_1.c +++ b/src/menu_input_1.c @@ -1,10 +1,9 @@ #include "global.h" #include "constants/input.h" #include "input.h" -#include "text.h" +#include "text1.h" #include "menu_input.h" -extern struct UnkTextStruct1 gUnknown_2027370[4]; extern void PlayMenuSoundEffect(u32); void sub_801332C(u16 *); diff --git a/src/moves.c b/src/moves.c index 0ece9474..01ece9c5 100644 --- a/src/moves.c +++ b/src/moves.c @@ -6,11 +6,11 @@ #include "subStruct_203B240.h" #include "code_809447C.h" #include "text_util.h" - +#include "text2.h" #include "constants/colors.h" #include "constants/monster.h" -#include "file_system.h" #include "code_800D090.h" +#include "code_80130A8.h" struct MoveLearnset { u8 *levelUpMoves; @@ -57,14 +57,10 @@ bool8 DoesMoveCharge(u16 move); int unk_PrintMoveDescription(int, struct Move*, int, struct subStruct_203B240**); -extern void sub_80073B8(u32); void sub_80928C0(u8 *buffer, struct Move *move, struct unkStruct_80928C0 *param_3); -extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32); extern void unk_MovePrintData(struct Move*, int); // print something -extern void sub_80073E0(u32); extern u32 sub_8097DF0(char *, struct subStruct_203B240 **); -extern void sub_80078A4(u32, u32, u32, u32, u32); extern u8 sub_8092B00(struct Move*); extern u32 sub_8092BC0(struct Move*); extern u32 gUnknown_202DE30; diff --git a/src/music.c b/src/music.c index 07edf2fd..24b1b209 100644 --- a/src/music.c +++ b/src/music.c @@ -1,7 +1,8 @@ #include "global.h" -#include "m4a.h" -#include "music.h" #include "constants/bg_music.h" +#include "m4a.h" +#include "main.h" +#include "music.h" EWRAM_DATA u16 gBGMusicPlayerState = {0}; EWRAM_DATA u16 gCurrentBGSong = {0}; @@ -14,8 +15,6 @@ EWRAM_DATA bool8 gRestartBGM = {0}; IWRAM_DATA struct PMDMusicPlayer gBGMusicPlayers[NUM_BG_PLAYERS] = {0}; IWRAM_DATA struct PMDMusicPlayer gSEMusicPlayers[NUM_SE_PLAYERS] = {0}; -extern bool8 EnableInterrupts(void); -extern bool8 DisableInterrupts(void); void nullsub_21(u16); void InitMusic(void) diff --git a/src/options_menu.c b/src/options_menu.c index 8cf77c91..9008e8ed 100644 --- a/src/options_menu.c +++ b/src/options_menu.c @@ -1,11 +1,12 @@ #include "global.h" -#include "constants/input.h" +#include "code_80130A8.h" #include "constants/colors.h" -#include "input.h" -#include "memory.h" -#include "text.h" +#include "constants/input.h" #include "game_options.h" +#include "memory.h" #include "menu_input.h" +#include "text1.h" +#include "text2.h" struct unkStruct_203B25C { @@ -51,12 +52,8 @@ extern const char gOthers_Hints[]; extern const char *gUnknown_80D4920[]; extern const char *gUnknown_80D4928[]; -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern s32 sub_8008ED0(u8 *); extern void CreateOthersMenu(void); -extern void sub_80078A4(u32, u32, u32, u32, u32); void PlayMenuSoundEffect(u32); void CreateOptionsMenu(void); void nullsub_38(void); @@ -69,7 +66,6 @@ extern void HandleChangeSettingsMenu(); extern void sub_801DD84(); extern void sub_801DED0(); extern bool8 sub_801E198(struct GameOptions *); -extern void sub_8014248(const char *, u32, u32, struct MenuItem *, u32, u32, u32, u32, u32); extern void CreateHintDisplayScreen(u32); extern void sub_801E3F0(u32); extern void CreateHintSelectionScreen(u32); @@ -81,7 +77,6 @@ extern u32 HandleHintDisplayScreenInput(void); extern void DestroyHintDisplayScreen(void); extern u32 sub_801E218(void); extern void sub_801E2C4(void); -extern s32 sub_80144A4(s32 *); extern void SetWindowBGColor(void); extern void sub_8099690(u32); diff --git a/src/other_menus.c b/src/other_menus.c index ca6f2bc9..74b84f95 100644 --- a/src/other_menus.c +++ b/src/other_menus.c @@ -6,11 +6,12 @@ #include "team_inventory.h" #include "menu.h" #include "memory.h" -#include "text.h" +#include "text1.h" #include "menu_input.h" #include "dungeon_global_data.h" #include "pokemon.h" #include "code_8094F88.h" +#include "sprite.h" struct unkSprite { @@ -446,10 +447,7 @@ static const u8 fill3[] = "pksdir0"; static const u8 fill4[] = "pksdir0"; extern void sub_8037400(void); -extern void ResetSprites(u32); -extern void sub_8035CF4(struct MenuStruct *,u32, u32); extern void sub_80376CC(); -extern void sub_8035CC0(struct UnkTextStruct2 *, u32); extern u32 sub_8037C10(u32); extern void sub_8037748(void); @@ -457,7 +455,6 @@ extern void sub_80371B8(void); extern void sub_8037900(void); extern void PlayMenuSoundEffect(u32); extern u32 sub_8037798(void); -extern void SetMenuItems(struct MenuStruct *, void *, u32, const struct UnkTextStruct2 *, const struct MenuItem *, u32, u32, u32); extern void sub_8005838(u32, u32); extern void sub_80060EC(); extern void sub_800CB20(); @@ -483,7 +480,7 @@ void sub_8036FDC(s32 param_1) ResetUnusedInputStruct(); sub_800641C(0,1,1); - ResetSprites(0); + ResetSprites(FALSE); if (gUnknown_203B35C == NULL) { gUnknown_203B35C = MemoryAlloc(0x504,8); MemoryFill8((u8 *)gUnknown_203B35C,0,0x504); @@ -503,7 +500,7 @@ void sub_8036FDC(s32 param_1) ResetUnusedInputStruct(); sub_800641C(gUnknown_203B35C->unk15C,1,1); SetMenuItems(gUnknown_203B35C->unk1C,gUnknown_203B35C->unk15C,0,&gUnknown_80E6CD0,gUnknown_80E6CE8,0,6,0); - sub_8035CF4(gUnknown_203B35C->unk1C,0,1); + sub_8035CF4(gUnknown_203B35C->unk1C,0,TRUE); sub_80376CC(); } @@ -579,7 +576,7 @@ void sub_80371B8(void) // The item exchange with your friend // went through successfully SetMenuItems(gUnknown_203B35C->unk1C, gUnknown_203B35C->unk15C, 0, &gUnknown_80E6C50, gUnknown_80E6C68, 0, 6, 0); - sub_8035CF4(gUnknown_203B35C->unk1C, 0, 1); + sub_8035CF4(gUnknown_203B35C->unk1C, 0, TRUE); } } else { @@ -639,7 +636,7 @@ void sub_80371B8(void) break; } SetMenuItems(gUnknown_203B35C->unk1C, gUnknown_203B35C->unk15C, 0, puVar5, MenuItems, 0, 6, 0); - sub_8035CF4(gUnknown_203B35C->unk1C, 0, 1); + sub_8035CF4(gUnknown_203B35C->unk1C, 0, TRUE); if ((gUnknown_203B35C->linkStatus != COMMS_GOOD) && (gUnknown_203B35C->unk0 == 0) && (item = sub_8035D94(), item->itemIndex.itemIndex_u8 != ITEM_NOTHING) && (item->numItems != 0)) { gTeamInventoryRef->teamStorage[item->itemIndex.itemIndex_u8] += item->numItems; @@ -657,7 +654,7 @@ void sub_80373C4(void) xxx_call_update_bg_vram(); sub_8009908(); xxx_call_update_bg_sound_input(); - ResetSprites(0); + ResetSprites(FALSE); } // Unused diff --git a/src/party_list_menu.c b/src/party_list_menu.c index acf6ddc0..6399ab55 100644 --- a/src/party_list_menu.c +++ b/src/party_list_menu.c @@ -1,11 +1,10 @@ #include "global.h" #include "constants/dungeon.h" #include "item.h" -#include "input.h" -#include "menu.h" #include "memory.h" #include "pokemon.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "text_util.h" #include "team_inventory.h" #include "constants/move.h" @@ -13,6 +12,8 @@ #include "menu_input.h" #include "moves.h" #include "kecleon_bros.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" struct unkStruct_203B2B8 { @@ -170,16 +171,9 @@ extern struct PokemonStruct *sub_808D3BC(void); extern void sub_801F214(void); extern u32 sub_801F194(void); extern u32 sub_801EF38(u32); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern s32 sub_8008ED0(u8 *); -extern void xxx_format_and_draw(s32, s32, const u8 *, ...); -extern s32 sub_80144A4(s32 *); extern u32 sub_801F890(void); extern void sub_801F8D0(void); -extern u32 sub_801B410(void); -extern void sub_801B450(void); extern void nullsub_104(void); extern void sub_8099690(u32); extern u32 sub_8022860(void); @@ -194,8 +188,6 @@ extern struct PokemonStruct *GetPlayerPokemonStruct(void); bool8 sub_8026E88(struct PokemonStruct *r0); bool8 HasGummiItem(); bool8 sub_8026EB8(struct PokemonStruct *r0); -extern void sub_801BB20(void); -extern void sub_801BC24(void); extern void sub_8024458(s16, u32); void sub_8026E08(u32 r0); void sub_8026DAC(u32 r0, struct BulkItem *item); @@ -204,11 +196,8 @@ void sub_8026FA4(void); void sub_8026878(void); extern void sub_801F808(u16*); extern void sub_80227B8(struct PokemonStruct *); -extern void sub_801B3C0(struct Item *); extern void sub_801EE10(u32, s16, struct Move *, u32, u32, u32); extern void sub_801F1B0(u32, u32); -extern void sub_8014248(const char *r0, u32, u32, const struct MenuItem *r4, u32, u32, u32, void *r5, u32); -extern void sub_80141B4(const u8 *, u32, u32 *, u32); extern void sub_808D31C(struct PokemonStruct *); void sub_802678C(void); diff --git a/src/pelipper_board.c b/src/pelipper_board.c index dbf80c22..73fa6745 100644 --- a/src/pelipper_board.c +++ b/src/pelipper_board.c @@ -3,7 +3,8 @@ #include "pokemon.h" #include "item.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "menu.h" #include "input.h" #include "wonder_mail.h" @@ -12,7 +13,6 @@ #include "pelipper_board.h" EWRAM_DATA_2 struct unkStruct_203B308 *gPelipperBoard = {0}; -extern void SetPelipperBoardState(u32); const struct UnkTextStruct2 gUnknown_80E0330 = { @@ -58,7 +58,7 @@ const u8 gPelipperBoard_BulletinBoard[] = "Bulletin Board"; const u8 gPelipperBoard_JobList[] = "Job List"; const u8 gPelipperBoard_Accepted[] = "Accepted"; const u8 gPelipperStatusSlash[] = "/"; -static const u8 gPelipperfill[] = "pksdir0"; +static const u8 sPelipperfill[] = "pksdir0"; extern void sub_802ECB4(void); extern void nullsub_134(void); @@ -79,9 +79,6 @@ extern void sub_803B35C(struct WonderMail *, struct unkStruct_802C39C *); extern void sub_802DE84(struct unkStruct_802C39C *); extern void InitializeJobListMenu(u32); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern u32 sub_802C898(void); extern void sub_802C8F4(void); extern u32 sub_802DEE0(void); @@ -470,5 +467,4 @@ void CreatePelipperAcceptedStatusBox(u32 r0) xxx_call_draw_string(0x16, 0xD, gPelipperStatusSlash, r0, 0); // "/" sub_8012BC4(0x23, 0xD, MAX_ACCEPTED_JOBS, 2, 7, r0); sub_80073E0(r0); -} - +} \ No newline at end of file diff --git a/src/personality_test.c b/src/personality_test.c index 828749ef..8589aaf7 100644 --- a/src/personality_test.c +++ b/src/personality_test.c @@ -1,19 +1,19 @@ #include "global.h" -#include "input.h" #include "personality_test.h" #include "constants/emotions.h" #include "constants/input.h" #include "constants/type.h" #include "random.h" -#include "file_system.h" #include "pokemon.h" #include "save.h" #include "memory.h" #include "game_options.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "text_util.h" -#include "menu.h" #include "menu_input.h" +#include "code_80130A8.h" +#include "code_8012A18_1.h" enum { @@ -43,20 +43,8 @@ extern s32 sub_8094E4C(void); extern void sub_8094D28(s32); extern void sub_8001044(u32 *); -extern void sub_80141B4(const char *text, u32 r1, u32 r2, u16 r3); -extern void sub_8014248(const char *text, u32, u32, const struct MenuItem *r0, u32, u32, u32, u32, u32); - -extern u32 sub_80144A4(s32 *); - -extern void sub_801602C(u32, char *r0); - -extern u32 sub_8016080(void); -extern void sub_80160D8(void); extern void sub_8099690(u32); -extern void sub_80073E0(u32); -extern void sub_80073B8(u32); -extern void sub_8008C54(u32); extern void sub_800836C(u32, u8 *r0, u32); extern void SetBGPaletteBufferColorArray(s32 index, u8 *colorArray); diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 5b0ba490..963ae5de 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -662,6 +662,7 @@ s32 SaveRecruitedPokemon(u8 *a1, s32 a2) s16 data_s16; s32 count; s32 i; + struct PokemonStruct *pokemon; xxx_init_struct_8094924_save_809486C(&backup, a1, a2); @@ -673,14 +674,13 @@ s32 SaveRecruitedPokemon(u8 *a1, s32 a2) data_s16 = -data_s16; count = 0; for (i = 0; i < NUM_MONSTERS; i++) { -#ifdef NONMATCHING - struct PokemonStruct* pokemon = &gRecruitedPokemonRef->pokemon[i]; -#else - struct PokemonStruct* pokemon; - register struct unkStruct_203B45C** recruited asm("r2") = &gRecruitedPokemonRef; + // Some check was optimized out. Needed for matching. Thanks kaz + if (i) { + u8 unk = -unk; + } + + pokemon = &gRecruitedPokemonRef->pokemon[i]; - pokemon = &(*recruited)->pokemon[i]; -#endif if (pokemon->unk0 & 1) { if (pokemon->unk0 & 2) { buffer[count++] = i; diff --git a/src/pokemon_news.c b/src/pokemon_news.c index 625d4994..c605d89d 100644 --- a/src/pokemon_news.c +++ b/src/pokemon_news.c @@ -1,14 +1,13 @@ #include "constants/input.h" #include "global.h" -#include "file_system.h" -#include "input.h" #include "pokemon.h" #include "pokemon_mail.h" #include "memory.h" -#include "text.h" -#include "menu.h" +#include "text1.h" +#include "text2.h" #include "save.h" #include "menu_input.h" +#include "code_80130A8.h" struct unkStruct_203B2CC { @@ -168,11 +167,7 @@ extern void sub_802BB28(void); extern void sub_8013E54(void); extern char gUnknown_202E5D8[0x50]; extern char gAvailablePokemonNames[0x50]; -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); extern void sub_802BC7C(void); -extern void sub_80073E0(u32); -extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32); extern void sub_803B6B0(u32, u32, u32, u32); extern struct PokemonStruct *sub_808D3BC(void); extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); diff --git a/src/post_office_guide.c b/src/post_office_guide.c index b0a2a6d5..5884fe0e 100644 --- a/src/post_office_guide.c +++ b/src/post_office_guide.c @@ -1,15 +1,14 @@ #include "global.h" #include "pokemon.h" -#include "file_system.h" -#include "input.h" #include "constants/mailbox.h" -#include "menu.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "wonder_mail.h" #include "code_800D090.h" #include "code_8094F88.h" #include "menu_input.h" +#include "code_80130A8.h" struct PostOfficeHelper { @@ -178,8 +177,6 @@ extern u8 gUnknown_202DE58[]; extern u8 gUnknown_202E5D8[]; extern u8 gAvailablePokemonNames[]; -extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32); -extern void sub_8014248(const char *r0, u32, u32, const struct MenuItem *r4, u32, u32, u32, struct OpenedFile **r5, u32); extern void PlayMenuSoundEffect(u32); extern void sub_8031A84(); extern void DisplayMissionObjectives(); @@ -188,8 +185,6 @@ extern u8 *sub_80975DC(u32 r0); extern u8 sub_8099360(u8 *); extern u8 sub_8099394(volatile u8 *); extern struct WonderMail *GetJobSlotInfo(u8); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern void sub_803B6B0(u32, u32, u32, u32); extern s16 sub_80A2688(u8 r0); extern u8 sub_80992E0(s16 *, s16 *); @@ -205,7 +200,6 @@ extern void HandlePostOfficeHelpGoRescueMenuSelection(); extern void ReturntoGoRescueMenu(); extern void HandlePostOfficeHelpGetHelpMenuSelection(); extern void ReturnToGetHelpMenu(); -extern s32 sub_80144A4(s32 *); extern s32 CountJobsinDungeon(u8); u32 CreateHelperPelipperMenu(s16 speciesID) diff --git a/src/code_800B5F0.c b/src/reg_control.c similarity index 83% rename from src/code_800B5F0.c rename to src/reg_control.c index 87dc95d1..f0fcaed1 100644 --- a/src/code_800B5F0.c +++ b/src/reg_control.c @@ -1,68 +1,54 @@ #include "global.h" #include "bg.h" +#include "debug.h" #include "input.h" #include "music.h" -#include "debug.h" +#include "reg_control.h" +#include "sprite.h" -typedef void (*IntrCallback)(void); -extern IntrCallback gIntrCallbacks[]; - -struct unkStruct_202D648 -{ - s16 unk0; - s16 unk2; // Vcount?? - IntrCallback unk4; // some function... just making it IntrCallback for now -}; -extern struct unkStruct_202D648 gUnknown_202D648[8]; extern struct unkStruct_202D648 gUnknown_202D608[8]; +extern struct unkStruct_202D648 gUnknown_202D648[8]; +// bg_control.c extern u8 gUnknown_202D7FE; extern u16 gBldCnt; -EWRAM_DATA u8 gUnknown_203B099; -EWRAM_DATA u8 gUnknown_203B09A; -EWRAM_DATA u8 gUnknown_203B09B; +EWRAM_DATA bool8 gUnknown_203B099; +EWRAM_DATA bool8 gUnknown_203B09A; +EWRAM_DATA bool8 gUnknown_203B09B; EWRAM_DATA u32 gUnknown_203B09C; EWRAM_DATA u32 gUnknown_203B0A0; -EWRAM_DATA u32 gUnknown_203B0A4; -EWRAM_DATA u32 gUnknown_203B0A8; +EWRAM_DATA u32 gUnknown_203B0A4; // Written to but never read +EWRAM_DATA s16 gUnknown_203B0A8; EWRAM_DATA s16 gUnknown_203B0AA; EWRAM_DATA s16 gUnknown_203B0AC; EWRAM_DATA s16 gUnknown_203B0AE; -EWRAM_DATA s16 gUnknown_203B0B0; -EWRAM_DATA s16 gUnknown_203B0B2; - -extern bool8 EnableInterrupts(void); -extern bool8 DisableInterrupts(void); -void xxx_update_bg_sound_input(); -extern void AckInterrupt(u16); -void BlinkSavingIcon(); - -void UnusedIntrFunc(void) -{ -} +EWRAM_DATA s16 gUnknown_203B0B0; // Written to but never read +EWRAM_DATA s16 gUnknown_203B0B2; // Written to but never read void VBlankIntr(void) { - int index; + s32 index; gUnknown_203B0A0++; SoundVSync(); BlinkSavingIcon(); - if (gIntrCallbacks[1] != NULL) { + + if (gIntrCallbacks[1] != NULL) gIntrCallbacks[1](); - } - for(index = 0; index < gUnknown_203B0AA; index++) { + + for (index = 0; index < gUnknown_203B0AA; index++) gUnknown_202D648[index] = gUnknown_202D608[index]; - } + gUnknown_203B0AC = gUnknown_203B0AA; gUnknown_203B0AE = -1; gUnknown_203B0B0 = -1; gUnknown_203B0B2 = -1; REG_DISPSTAT = DISPSTAT_VBLANK_INTR | DISPSTAT_VCOUNT_INTR; - if (gUnknown_203B099 == 0) { + + if (gUnknown_203B099 == 0) UpdateSound(); - } + AckInterrupt(INTR_FLAG_VBLANK); } @@ -214,44 +200,45 @@ void VCountIntr(void) void sub_800BA5C(void) { - if(gUnknown_203B09A != 0) - { + if (gUnknown_203B09A) { gUnknown_203B09C++; xxx_update_bg_sound_input(); } - gUnknown_203B09A = 1; - gUnknown_203B09B = 0; + + gUnknown_203B09A = TRUE; + gUnknown_203B09B = FALSE; gUnknown_203B09C = 0; nullsub_25(); - while(REG_VCOUNT > 159){} + while (REG_VCOUNT >= 160){} - gUnknown_203B099 = 1; + gUnknown_203B099 = TRUE; VBlankIntrWait(); nullsub_18(); } void xxx_update_bg_sound_input(void) { - if(gUnknown_203B09B != 0){ + if (gUnknown_203B09B) gUnknown_203B09C++; - } else { - gUnknown_203B09B = 1; - gUnknown_203B09A = 0; + gUnknown_203B09B = TRUE; + gUnknown_203B09A = FALSE; gUnknown_203B09C = 0; UpdateBGControlRegisters(); - if(gUnknown_203B099 != 0) + + if (gUnknown_203B099) UpdateSound(); + UpdateInput(); - gUnknown_203B099 = 0; + gUnknown_203B099 = FALSE; gUnknown_203B0A4 = gUnknown_203B0A0; } } void Timer3Intr(void) { - if(gIntrCallbacks[4]) + if (gIntrCallbacks[4]) gIntrCallbacks[4](); AckInterrupt(INTR_FLAG_TIMER3); } @@ -273,11 +260,11 @@ void sub_800BB44(void) u16 dispcnt_store; bool8 interrupt_flag; - while(REG_KEYINPUT != KEYS_MASK){} + while (REG_KEYINPUT != KEYS_MASK){} interrupt_flag = DisableInterrupts(); - while(REG_VCOUNT < 160){} + while (REG_VCOUNT < 160){} dispcnt_store = REG_DISPCNT; REG_DISPCNT = DISPCNT_FORCED_BLANK; @@ -300,9 +287,9 @@ void sub_800BB44(void) REG_DISPCNT = dispcnt_store; *(vu16 *)BG_PLTT = RGB_BLACK; - if(interrupt_flag) + if (interrupt_flag) EnableInterrupts(); - while(REG_KEYINPUT != KEYS_MASK){} + while (REG_KEYINPUT != KEYS_MASK){} } void nullsub_17(void) @@ -313,15 +300,13 @@ void UpdateBGControlRegisters(void) { u32 BGCNT_Priority[NUM_BGS]; - if(gUnknown_202D7FE == 1) - { + if (gUnknown_202D7FE == 1) { BGCNT_Priority[BG0] = BGCNT_PRIORITY(1); BGCNT_Priority[BG1] = BGCNT_PRIORITY(2); BGCNT_Priority[BG2] = BGCNT_PRIORITY(0); BGCNT_Priority[BG3] = BGCNT_PRIORITY(3); } - else - { + else { BGCNT_Priority[BG0] = BGCNT_PRIORITY(0); BGCNT_Priority[BG1] = BGCNT_PRIORITY(1); BGCNT_Priority[BG2] = BGCNT_PRIORITY(2); @@ -339,10 +324,10 @@ void UpdateBGControlRegisters(void) REG_BG0CNT = BGCNT_Priority[BG0] | BGCNT_SCREENBASE(12) | BGCNT_CHARBASE(0) | BGCNT_WRAP; // 0x2C00 REG_BG1CNT = BGCNT_Priority[BG1] | BGCNT_SCREENBASE(13) | BGCNT_CHARBASE(0) | BGCNT_WRAP; // 0x2D00 - if(gBG2Control.unk2 == 0x8000) + if (gBG2Control.unk2 == 0x8000) REG_BG2CNT = BGCNT_Priority[BG2] | BGCNT_SCREENBASE(14) | BGCNT_CHARBASE(2) | BGCNT_WRAP; // 0x2E08 else REG_BG2CNT = BGCNT_Priority[BG2] | BGCNT_SCREENBASE(14) | BGCNT_CHARBASE(0) | BGCNT_WRAP; // 0x2E00 REG_BG3CNT = BGCNT_Priority[BG3] | BGCNT_SCREENBASE(15) | BGCNT_CHARBASE(2) | BGCNT_WRAP; REG_BLDCNT = gBldCnt; -} +} \ No newline at end of file diff --git a/src/rescue_password_menu.c b/src/rescue_password_menu.c index 62c50d58..5e9b2749 100644 --- a/src/rescue_password_menu.c +++ b/src/rescue_password_menu.c @@ -5,14 +5,14 @@ #include "menu.h" #include "pokemon.h" #include "save.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "main_menu.h" #include "rescue_password_menu.h" #include "code_8094F88.h" #include "wonder_mail.h" #include "menu_input.h" #include "dungeon.h" -#include "main_menu.h" #define RESCUE_PASSWORD_SIZE 0x36 @@ -250,8 +250,6 @@ extern void sub_8031E10(void); extern u32 sub_80154F0(void); extern u32 sub_8031DCC(void); extern void sub_8031E00(void); -extern void SetMenuItems(struct MenuStruct *, struct UnkTextStruct2 *, u32, const struct UnkTextStruct2 *, const struct MenuItem *, u32, u32, u32); -extern void sub_8035CF4(struct MenuStruct *r0, u32, u32); extern void AddSprite(struct unkSprite *, u32, u32, u32); extern void xxx_draw_string_80144C4(void); @@ -588,7 +586,7 @@ void DisplayRescuePasswordError(u32 passwordError) default: break; } - sub_8035CF4(gRescuePasswordMenu->unk8,0,1); + sub_8035CF4(gRescuePasswordMenu->unk8,0,TRUE); } void DisplayPasswordAcceptScreen(void) @@ -598,7 +596,7 @@ void DisplayPasswordAcceptScreen(void) sub_800641C(0,1,1); sub_80155F0(); SetMenuItems(gRescuePasswordMenu->unk8,gRescuePasswordMenu->unk148,0,&gUnknown_80E7278,gUnknown_80E7290,0,0xd,0); - sub_8035CF4(gRescuePasswordMenu->unk8,0,1); + sub_8035CF4(gRescuePasswordMenu->unk8,0,TRUE); } u32 ConvertMenutoRescuePasswordState(u32 unused) diff --git a/src/save.c b/src/save.c index a6147217..0bf2be77 100644 --- a/src/save.c +++ b/src/save.c @@ -9,7 +9,7 @@ #include "team_inventory.h" #include "exclusive_pokemon.h" #include "game_options.h" - +#include "code_80130A8.h" EWRAM_DATA_2 u32 gUnknown_203B17C = {0}; EWRAM_DATA_2 char *gUnknown_203B180 = {0}; @@ -75,7 +75,6 @@ EWRAM_DATA_2 struct QuickSaveWrite *gQuickSaveWrite = {0}; extern s32 gUnknown_202DE28; -extern bool8 *gFriendAreas; extern u32 *gUnknown_203B488; extern u32 gUnknown_203B494; @@ -145,8 +144,6 @@ extern bool8 sub_800DAB8(void); extern void sub_8011830(void); extern void sub_80140DC(); extern void sub_8014114(); -extern void sub_80141B4(const char *r0, u32 r1, u8 *r2, u16 r3); -extern u32 sub_80144A4(u32 *a); extern u32 SaveRecruitedPokemon(u8 *, u32); extern u32 RestoreRecruitedPokemon(void* a, s32 b); extern u32 SavePokemonStruct2(u8 *, u32); @@ -707,7 +704,7 @@ void PrepareSavePakWrite(s16 PokemonID) { struct OpenedFile *file; s32 id_s32; - u8 *preload_face; + struct OpenedFile **preload_face; id_s32 = PokemonID; // had to cast for asr shift @@ -727,11 +724,11 @@ void PrepareSavePakWrite(s16 PokemonID) gSavePakWrite->unk16 = 8; } if (gSavePakWrite->faceFile != 0) { - preload_face = (u8 *)&gSavePakWrite->faceFile; + preload_face = &gSavePakWrite->faceFile; sub_80141B4(gSavingAdventure,0,preload_face,0x20); } else { - sub_80141B4(gSavingAdventure,0,0,0x20); + sub_80141B4(gSavingAdventure,0,NULL,0x20); } gSavePakWrite->state = 3; } @@ -771,9 +768,9 @@ bool8 WriteSavePak(void) { case SAVE_COMPLETED: if(gSavePakWrite->faceFile != NULL) - sub_80141B4(gSaveCompleted, 0, (u8 *)faceFile, 0x101); + sub_80141B4(gSaveCompleted, 0, faceFile, 0x101); else - sub_80141B4(gSaveCompleted, 0, (u8 *)faceFile, 0x101); + sub_80141B4(gSaveCompleted, 0, faceFile, 0x101); gSavePakWrite->state = 5; break; case SAVE_NOT_WRTTEN: @@ -782,9 +779,9 @@ bool8 WriteSavePak(void) break; default: if(gSavePakWrite->faceFile != NULL) - sub_80141B4(gSaveFailed, 0, (u8 *)faceFile, 0x101); + sub_80141B4(gSaveFailed, 0, faceFile, 0x101); else - sub_80141B4(gSaveFailed, 0, (u8 *)faceFile, 0x101); + sub_80141B4(gSaveFailed, 0, faceFile, 0x101); gSavePakWrite->state = 5; break; } diff --git a/src/save_menu.c b/src/save_menu.c index 13281deb..a7ffb072 100644 --- a/src/save_menu.c +++ b/src/save_menu.c @@ -1,11 +1,11 @@ #include "global.h" -#include "input.h" -#include "menu.h" #include "main_menu.h" #include "memory.h" -#include "text.h" +#include "text1.h" #include "save.h" #include "menu_input.h" +#include "sprite.h" +#include "code_80130A8.h" struct unkSprite { @@ -132,17 +132,12 @@ ALIGNED(4) const u8 gUnknown_80E7178[] = _("{CENTER_ALIGN}The data could not be ALIGNED(4) static const u8 save_menu_fill0[] = "pksdir0"; -extern void ResetSprites(u32); extern void sub_8038440(); -extern void sub_8035CF4(struct MenuStruct *, u32, u32); -extern void SetMenuItems(struct MenuStruct *, struct UnkTextStruct2 *, u32, const struct UnkTextStruct2 *, const struct MenuItem *, u32, u32, u32); extern void sub_80384D0(); extern void sub_8038830(); extern void sub_80388C4(void); extern void sub_8014114(); extern void sub_80140F8(void); -extern void sub_8035CC0(struct UnkTextStruct2 *, u32); -extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32); extern void AddSprite(struct unkSprite *, u32, u32, u32); void CreateSaveMenu(s32 currMenu) @@ -169,7 +164,7 @@ void CreateSaveMenu(s32 currMenu) SetMenuItems(gUnknown_203B364->unk8,gUnknown_203B364->unk148,0,&gUnknown_80E6F38,gSavingAdventureMenuItems, 0,6,0); } - sub_8035CF4(gUnknown_203B364->unk8,0,1); + sub_8035CF4(gUnknown_203B364->unk8,0,TRUE); gUnknown_203B364->unk4 = 0; gUnknown_203B364->currMenu = currMenu; sub_8038830(); @@ -224,7 +219,7 @@ s32 UpdateSaveMenu(void) gUnknown_203B364->unk4 = 1; return MENU_COMMUNICATION_1; } - sub_8035CF4(gUnknown_203B364->unk8,0,1); + sub_8035CF4(gUnknown_203B364->unk8,0,TRUE); gUnknown_203B364->unk4 = 1; break; case SAVE_NOT_WRTTEN: @@ -241,7 +236,7 @@ s32 UpdateSaveMenu(void) SetMenuItems(gUnknown_203B364->unk8,gUnknown_203B364->unk148,0,&gUnknown_80E6F38, gAdventureCouldNotBeSavedMenuItems,0,6,0); } - sub_8035CF4(gUnknown_203B364->unk8,0,1); + sub_8035CF4(gUnknown_203B364->unk8,0,TRUE); gUnknown_203B364->unk4 = 1; break; } @@ -338,7 +333,7 @@ void sub_8038830(void) sprite->unk6 = r2; gUnknown_203B364->unk1B0 = r5; - ResetSprites(0); + ResetSprites(FALSE); } void sub_80388C4(void) { diff --git a/src/sprite.c b/src/sprite.c index d741fce6..d890ef40 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -1,10 +1,8 @@ #include "global.h" - -void ResetSprites(bool32); -void SetSavingIconCoords(u32); +#include "sprite.h" void InitSprites(void) { - ResetSprites(1); + ResetSprites(TRUE); SetSavingIconCoords(0); -} +} \ No newline at end of file diff --git a/src/text.c b/src/text1.c similarity index 87% rename from src/text.c rename to src/text1.c index a3b858d5..1cfe932e 100644 --- a/src/text.c +++ b/src/text1.c @@ -1,35 +1,41 @@ #include "global.h" -#include "file_system.h" #include "code_800558C.h" -#include "code_800B540.h" -#include "text.h" - -extern char gUnknown_3000E94[]; +#include "cpu.h" +#include "file_system.h" +#include "text1.h" +#include "text2.h" EWRAM_DATA struct UnkTextStruct1 gUnknown_2027370[4]; EWRAM_DATA u8 *gCharmaps[2]; -EWRAM_DATA u16 gCharacterSpacing; +EWRAM_DATA s16 gCharacterSpacing; EWRAM_DATA u8 gUnknown_20274A5; EWRAM_DATA u32 gCurrentCharmap; EWRAM_DATA vu32 gUnknown_20274B0; -EWRAM_DATA u8 gUnknown_20274B4[0x3b00]; +EWRAM_DATA u32 gUnknown_20274B4[0xEC0]; EWRAM_DATA struct OpenedFile *gCharmapFiles[2]; EWRAM_DATA struct UnkTextStruct2 gUnknown_202AFC0[4]; EWRAM_DATA u32 gUnknown_202B020; EWRAM_DATA u32 gUnknown_202B024; EWRAM_DATA u32 gUnknown_202B028[2]; -EWRAM_DATA u32 gUnknown_202B030; +EWRAM_DATA u32 gUnknown_202B030; // Some text color info is stored; retrieve via "& 0xF" EWRAM_DATA u8 gUnknown_202B034; -EWRAM_DATA u16 gUnknown_202B038[2][32][32]; +EWRAM_DATA u16 gUnknown_202B038[4][32][32]; +// ? +extern char gUnknown_3000E94[]; + +// data.s extern const struct UnkTextStruct2 gUnknown_80B857C[4]; -extern const char gKanjiA_file_string[]; -extern const char gKanjiB_file_string[]; -extern const struct FileArchive gSystemFileArchive; extern const u32 gUnknown_80B87C4[8]; extern const u32 gUnknown_80B87E4[8]; extern const u32 gUnknown_80B8804[4]; -extern u32 gUnknown_80B8814[]; +extern const u32 gUnknown_80B8814[]; +extern const char gKanjiA_file_string[]; +extern const char gKanjiB_file_string[]; +// system_sbin.s +extern const struct FileArchive gSystemFileArchive; + +void sub_8006438(const struct UnkTextStruct2 *, u8, u8, struct UnkTextStruct2_sub *); void LoadCharmaps(void) { @@ -158,7 +164,7 @@ void sub_8006438(const struct UnkTextStruct2 *a0, u8 a1, u8 a2, struct UnkTextSt gUnknown_202AFC0[i] = a0[i]; if (a0[i].unkC) { - sub_8006554(gUnknown_2027370, (void *)VRAM, gUnknown_20274B4, &gUnknown_202B038[0][0][0], gUnknown_80B8804[i], a0 + i, a1, r9, a3, 0); + sub_8006554(gUnknown_2027370, (u32 *)VRAM, gUnknown_20274B4, &gUnknown_202B038[0][0][0], gUnknown_80B8804[i], a0 + i, a1, r9, a3, 0); sub_80089AC(a0 + i, a3); r9 += a0[i].unkC * a0[i].unk10; } diff --git a/src/text2.c b/src/text2.c new file mode 100644 index 00000000..529405e2 --- /dev/null +++ b/src/text2.c @@ -0,0 +1,2483 @@ +#include "global.h" +#include "text1.h" +#include "text2.h" + +// data.s +extern const u32 gUnknown_80B853C[16]; +extern const struct unkShiftData gUnknown_80B85DC[8]; +extern const u32 gUnknown_80B8814[]; +extern const struct unkStruct_80B8824 gUnknown_80B8824; +extern const struct unkStruct_80B8848 gUnknown_80B8848; + +// text.s +extern void sub_8007E64(struct UnkTextStruct1 *, u16 *, u32, u32, u32, u32, u32, u8 *, u32); +extern void sub_8008C6C(struct UnkTextStruct1 *, u32); + +void nullsub_129(u32, s32, s32, s32, u32); +u32 xxx_draw_char(struct UnkTextStruct1 *, s32, s32, u32, u32, u32); + +void sub_800677C(struct UnkTextStruct1 *, s32, u16 *, u8); +void sub_80069CC(struct UnkTextStruct1 *, s32, s32, s32, u16 *); +void sub_8006AC4(struct UnkTextStruct1 *, s32, s32, s32, u16 *); +void sub_8006B70(struct UnkTextStruct1 *, s32, s32, s32, u16 *); +void sub_8006C44(struct UnkTextStruct1 *, s32, u16 *, u8); +void sub_8006E94(struct UnkTextStruct1 *, s32, u32, const u8 *, u16 *); +void sub_8007958(struct UnkTextStruct1 *, u32, s32, s32, s32, u32); +void sub_8007AA4(struct UnkTextStruct1 *, u32, s32, s32, s32, u32); +void sub_8007BA8(struct UnkTextStruct1 *, u32, s32, s32, s32, s32); +void sub_8007D00(struct UnkTextStruct1 *, u32, s32, s32, s32, s32); + +void nullsub_152(void) +{ +} + +void sub_8006518(struct UnkTextStruct2 *unkData) +{ + s32 iVar2; + for (iVar2 = 0; iVar2 < 4; iVar2++) + unkData[iVar2] = gUnknown_202AFC0[iVar2]; +} + +void nullsub_153(void) +{ +} + +u32 sub_8006544(u32 index) +{ + return gUnknown_80B8814[index]; +} + +// a1 is a VRAM pointer +void sub_8006554(struct UnkTextStruct1 *a0, u32 *a1, u32 *a2, u16 *a3, u32 a4, const struct UnkTextStruct2 *a5, u8 a6, u32 a7, struct UnkTextStruct2_sub *a8, u8 a9) +{ + struct UnkTextStruct1 *t1; + s32 iVar3; + s32 iVar5; + s32 iVar6; + s32 numI; + u32 uVar1; + + s32 temp; + s32 i; + s32 j; + + t1 = &a0[a4]; + iVar3 = a5->unk8.unk0.arr[0] + a8->unk0.arr[0]; + iVar5 = a5->unk8.unk0.arr[1] + a8->unk0.arr[1]; + t1->unk0 = iVar3; + t1->unk2 = iVar5; + t1->unk4 = a5->unkC; + t1->unk8 = a5->unk10; + t1->unk6 = a5->unkE; + t1->unkC = a5->unk4; + t1->unk10 = a7; + + if (t1->unkC == 6) + t1->unk14 = a7; + else + t1->unk14 = a7 + a5->unk12 * t1->unk4; + + t1->unk18 = &a2[t1->unk10 * 8]; + t1->unk1C = &a2[t1->unk14 * 8]; + t1->unk24 = a5->unk12; + t1->unk28 = &a1[t1->unk14 * 8]; + + if (t1->unkC == 6) + t1->unk2C = t1->unk4 * (t1->unk6 + a5->unk12) * 32; + else + t1->unk2C = t1->unk4 * t1->unk6 * 32; + + t1->unk30 = 0; + t1->unk34 = 0; + t1->unk38 = 0; + t1->unk20 = (t1->unk4 * 8) - 8; + t1->unk45 = t1->unkC == 0; + + if (t1->unk8 == 0) + return; + + if ((a5->unk0 & 0xA0) != 0x80) { + temp = iVar5 - 1; + + if (t1->unkC == 6) { + uVar1 = (a6 != 0) ? t1->unk14 : 0; + + sub_8006E94(t1, temp, uVar1, a5->unk14, a3); + + temp = iVar5 + 2; + uVar1 = (a6 != 0) ? t1->unk14 + t1->unk4 * (a5->unk12 + 2) : 0; + numI = t1->unk6 - 2; + } + else { + sub_800677C(t1, temp, a3, a9); + + temp = iVar5; + uVar1 = (a6 != 0) ? t1->unk14 : 0; + numI = t1->unk6; + } + + for (i = 0; i < numI; i++) { + iVar6 = iVar3 - 1; + sub_80069CC(t1, iVar6, temp, i, a3); + iVar6 = iVar3; + + for (j = 0; j < t1->unk4; j++) { + sub_8006AC4(t1, iVar6, temp, uVar1, a3); + + iVar6++; + if (a6 != 0) + uVar1++; + } + + sub_8006B70(t1, iVar6, temp, i, a3); + temp++; + } + sub_8006C44(t1, temp, a3, a9); + } + + if ((a5->unk0 & 0x80) == 0) + sub_8008C6C(a0, a4); + + t1->unk46 = 0; +} + +void sub_800677C(struct UnkTextStruct1 *a0, s32 a1, u16 *a2, u8 a3) +{ + s32 iVar5; + s32 i; + + iVar5 = a0->unk0 - 1; + + if (a1 > 28) + return; + if (a1 < 0) + return; + + switch (a0->unkC) { + case 0: + case 1: + case 2: + case 6: + break; + case 3: + (a2 + a1 * 0x20)[iVar5] = 0xF2D8; + if (a3 != 0) + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF293; + else + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + iVar5++; + for (i = 0; i < a0->unk4; i++) { + (a2 + a1 * 0x20)[iVar5] = 0xF2D9; + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + iVar5++; + } + + (a2 + a1 * 0x20)[iVar5] = 0xF6D8; + if (a3 != 0) + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF693; + else + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + break; + case 4: + (a2 + a1 * 0x20)[iVar5] = 0xF2E8; + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + iVar5++; + for (i = 0; i < a0->unk4; i++) { + (a2 + a1 * 0x20)[iVar5] = 0xF2E9; + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + iVar5++; + } + + (a2 + a1 * 0x20)[iVar5] = 0xF6E8; + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + break; + case 5: + (a2 + a1 * 0x20)[iVar5] = 0xF2DC; + iVar5++; + for (i = 0; i < a0->unk4; i++) { + (a2 + a1 * 0x20)[iVar5] = 0xF2DD; + iVar5++; + } + + (a2 + a1 * 0x20)[iVar5] = 0xF6DC; + break; + case 7: + (a2 + a1 * 0x20)[iVar5] = 0xF293; + iVar5++; + for (i = 0; i < a0->unk4; i++) { + (a2 + a1 * 0x20)[iVar5] = 0xF297; + iVar5++; + } + + (a2 + a1 * 0x20)[iVar5] = 0xF693; + break; + } +} + +void sub_80069CC(struct UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) +{ + if (a2 > 28) + return; + if (a2 < 0) + return; + + switch (a0->unkC) { + case 1: + case 2: + break; + case 0: + if (a3 == 0) { + (a4 + a2 * 0x20)[a1] = 0xF297; + (a4 + a2 * 0x20)[a1 + 0x400] = 0xF2DB; + break; + } + if (a3 == a0->unk6 - 1) { + (a4 + a2 * 0x20)[a1] = 0xFA97; + (a4 + a2 * 0x20)[a1 + 0x400] = 0xF2DB; + break; + } + // Fallthrough + case 3: + case 6: + (a4 + a2 * 0x20)[a1] = 0xF2DA; + (a4 + a2 * 0x20)[a1 + 0x400] = 0xF2DB; + break; + case 4: + (a4 + a2 * 0x20)[a1] = 0xF2EA; + (a4 + a2 * 0x20)[a1 + 0x400] = 0xF2DB; + break; + case 5: + (a4 + a2 * 0x20)[a1] = 0xF2DE; + break; + case 7: + (a4 + a2 * 0x20)[a1] = 0xF2B6; + break; + } +} + +void sub_8006AC4(struct UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) +{ + if (a2 > 28) + return; + if (a2 < 0) + return; + + switch (a0->unkC) { + case 2: + (a4 + a2 * 0x20)[a1] = a3 | 0xF000; + (a4 + a2 * 0x20)[a1 + 0x400] = 0xF278; + break; + case 0: + case 1: + case 3: + case 4: + case 6: + (a4 + a2 * 0x20)[a1] = a3 | 0xF000; + (a4 + a2 * 0x20)[a1 + 0x400] = 0xF2DB; + break; + case 5: + case 7: + (a4 + a2 * 0x20)[a1] = a3 | 0xF000; + break; + } +} + +void sub_8006B70(struct UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) +{ + if (a2 > 28) + return; + if (a2 < 0) + return; + + switch (a0->unkC) { + case 1: + case 2: + break; + case 0: + if (a3 == 0) { + (a4 + a2 * 0x20)[a1] = 0xF697; + (a4 + a2 * 0x20)[a1 + 0x400] = 0xF2DB; + break; + } + if (a3 == a0->unk6 - 1) { + (a4 + a2 * 0x20)[a1] = 0xFE97; + (a4 + a2 * 0x20)[a1 + 0x400] = 0xF2DB; + break; + } + // Fallthrough + case 3: + case 6: + (a4 + a2 * 0x20)[a1] = 0xF6DA; + (a4 + a2 * 0x20)[a1 + 0x400] = 0xF2DB; + break; + case 4: + (a4 + a2 * 0x20)[a1] = 0xF6EA; + (a4 + a2 * 0x20)[a1 + 0x400] = 0xF2DB; + break; + case 5: + (a4 + a2 * 0x20)[a1] = 0xF6DE; + break; + case 7: + (a4 + a2 * 0x20)[a1] = 0xF6B6; + break; + } +} + +void sub_8006C44(struct UnkTextStruct1 *a0, s32 a1, u16 *a2, u8 a3) +{ + s32 iVar5; + s32 i; + + iVar5 = a0->unk0 - 1; + + if (a1 > 28) + return; + if (a1 < 0) + return; + + switch (a0->unkC) { + case 0: + case 1: + case 2: + break; + case 3: + case 6: + (a2 + a1 * 0x20)[iVar5] = 0xFAD8; + if (a3 != 0) + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xFA93; + else + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + iVar5++; + for (i = 0; i < a0->unk4; i++) { + (a2 + a1 * 0x20)[iVar5] = 0xFAD9; + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + iVar5++; + } + + (a2 + a1 * 0x20)[iVar5] = 0xFED8; + if (a3 != 0) + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xFE93; + else + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + break; + case 4: + (a2 + a1 * 0x20)[iVar5] = 0xFAE8; + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + iVar5++; + for (i = 0; i < a0->unk4; i++) { + (a2 + a1 * 0x20)[iVar5] = 0xFAE9; + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + iVar5++; + } + + (a2 + a1 * 0x20)[iVar5] = 0xFEE8; + (a2 + a1 * 0x20)[iVar5 + 0x400] = 0xF2DB; + break; + case 5: + (a2 + a1 * 0x20)[iVar5] = 0xFADC; + iVar5++; + for (i = 0; i < a0->unk4; i++) { + (a2 + a1 * 0x20)[iVar5] = 0xFADD; + iVar5++; + } + + (a2 + a1 * 0x20)[iVar5] = 0xFEDC; + break; + case 7: + (a2 + a1 * 0x20)[iVar5] = 0xFA93; + iVar5++; + for (i = 0; i < a0->unk4; i++) { + (a2 + a1 * 0x20)[iVar5] = 0xFA97; + iVar5++; + } + + (a2 + a1 * 0x20)[iVar5] = 0xFE93; + break; + } +} + +#ifdef NONMATCHING +// Not even close but I don't feel like continuing atm https://decomp.me/scratch/F58jg +void sub_8006E94(struct UnkTextStruct1 *a0, s32 a1, u32 a2, const u8 *a3, u16 *a4) +{ + s32 bVar1; + s32 iVar2; + s32 iVar3; + s32 sVar4; + u16 *puVar5; + u16 *puVar6; + u16 *puVar7; + s32 iVar8; + u16 *puVar9; + u16 *puVar10; + u16 *puVar11; + s32 local_44; + u32 local_3c; + u16 *local_30; + s32 local_2c; + u16 *local_24; + + iVar2 = a0->unk0; + bVar1 = -1; + + if (a1 > 28) + return; + if (a1 < 0) + return; + + (a4 + a1 * 0x20)[iVar2 - 1] = 0xF278; + (a4 + a1 * 0x20)[iVar2 - 1 + 0x400] = 0xF27A; + (a4 + a1 * 0x20)[iVar2 - 1 + 0x20] = 0xF278; + (a4 + a1 * 0x20)[iVar2 - 1 + 0x420] = 0xF27A; + (a4 + a1 * 0x20)[iVar2 - 1 + 0x40] = 0xF2D8; + (a4 + a1 * 0x20)[iVar2 - 1 + 0x440] = 0xF2DB; + + local_2c = iVar2 * 2; + puVar5 = a4 + a1 * 0x20 + iVar2 + 0x40; + puVar7 = a4 + a1 * 0x20 + iVar2 + 0x20; + local_30 = a4 + a1 * 0x20 + iVar2 + 0x400; + puVar11 = a4 + a1 * 0x20 + iVar2 + 0x420; + puVar9 = a4 + a1 * 0x20 + iVar2; + iVar8 = a1 * 0x40; + + for (local_3c = 0; local_3c < a3[0]; local_3c++) { + if (local_3c == a3[1]) { + bVar1 = TRUE; + *puVar9 = 0xF2E0; + *local_30 = 0xF2E2; + *puVar7 = 0xF2DA; + *puVar11 = 0xF2DB; + *puVar5 = 0xF6E7; + puVar9[0x440] = 0xF2DB; + puVar5++; + puVar7++; + local_30++; + puVar11++; + puVar9++; + local_2c += 2; + iVar2++; + + if (a2 == 0 || ++a2 == 0) + iVar3 = 0; + else + iVar3 = a2 + a0->unk4; + + local_24 = a4 + local_2c + iVar8 + 0x80; + puVar10 = a4 + local_2c + iVar8 + 0x40; + puVar6 = a4 + local_2c + iVar8; + + for (local_44 = 0; local_44 < a3[2]; local_44++) { + *puVar6 = 0xF2E1; + puVar6[0x400] = 0xF2E2; + *puVar10 = a2 | 0xF000; + puVar6[0x420] = 0xF2DB; + *local_24 = iVar3 | 0xF000; + puVar6[0x440] = 0xF2DB; + local_24++; + puVar10++; + puVar6++; + puVar5++; + puVar7++; + local_30++; + puVar11++; + puVar9++; + local_2c += 2; + iVar2++; + if (a2 != 0) + a2++; + + if (iVar3 != 0) + iVar3++; + } + + *puVar9 = 0xF6E0; + *local_30 = 0xF2E2; + *puVar7 = 0xF6DA; + *puVar11 = 0xF2DB; + *puVar5 = 0xF2E7; + puVar9[0x440] = 0xF2DB; + } + else { + if (bVar1) { + if ((a3[3] >> (local_3c & 0xFF) & 1) == 0) { + sVar4 = 107; + if (local_3c == a3[0] - 1) + sVar4 = 103; + + *puVar9 = (sVar4 + 0x278) | 0xF000; + *puVar7 = 0xF6EF; + *puVar5 = 0xF2D9; + } + else { + sVar4 = 31; + if (local_3c == a3[0] - 1) + sVar4 = 27; + + *puVar9 = (sVar4 + 0x278) | 0xF000; + *puVar7 = 0xF6B6; + *puVar5 = 0xF2D9; + } + *local_30 = 0xF27A; + *puVar11 = 0xF6DB; + } + else { + if ((a3[3] >> (local_3c & 0xFF) & 1) == 0) { + sVar4 = 107; + if (local_3c == 0) + sVar4 = 103; + + *puVar9 = (sVar4 + 0x278) | 0xF400; + *puVar7 = 0xF2EF; + *puVar5 = 0xF2D9; + } + else { + sVar4 = 31; + if (local_3c == 0) + sVar4 = 27; + + *puVar9 = (sVar4 + 0x278) | 0xF400; + *puVar7 = 0xF2B6; + *puVar5 = 0xF2D9; + } + *local_30 = 0xF27A; + *puVar11 = 0xF2DB; + } + puVar9[0x440] = 0xF2DB; + } + + local_2c += 2; + local_30++; + iVar2++; + puVar11++; + puVar5++; + puVar7++; + puVar9++; + if (a2 != 0) + a2++; + } + + iVar8 = a0->unk0 + a0->unk4; + if (iVar2 < iVar8) { + for (iVar3 = iVar8 - iVar2; iVar3 != 0; iVar3--) { + (a4 + a1 * 0x20)[iVar2 + iVar3] = 0xF278; + (a4 + a1 * 0x20)[iVar2 + 0x400 + iVar3] = 0xF27A; + (a4 + a1 * 0x20)[iVar2 + 0x20 + iVar3] = 0xF278; + (a4 + a1 * 0x20)[iVar2 + 0x420 + iVar3] = 0xF27A; + (a4 + a1 * 0x20)[iVar2 + 0x40 + iVar3] = 0xF2D9; + (a4 + a1 * 0x20)[iVar2 + 0x440 + iVar3] = 0xF2DB; + + if (a2 != 0) + a2++; + + iVar2 = iVar8; + } + } + + (a4 + a1 * 0x20)[iVar2] = 0xF278; + (a4 + a1 * 0x20)[iVar2 + 0x400] = 0xF27A; + (a4 + a1 * 0x20)[iVar2 + 0x20] = 0xF278; + (a4 + a1 * 0x20)[iVar2 + 0x420] = 0xF27A; + (a4 + a1 * 0x20)[iVar2 + 0x40] = 0xF6D8; + (a4 + a1 * 0x20)[iVar2 + 0x440] = 0xF2DB; +} +#else +NAKED +void sub_8006E94(struct UnkTextStruct1 *a0, s32 a1, u32 a2, const u8 *a3, u16 *a4) +{ + asm_unified( + "\tpush {r4-r7,lr}\n" + "\tmov r7, r10\n" + "\tmov r6, r9\n" + "\tmov r5, r8\n" + "\tpush {r5-r7}\n" + "\tsub sp, 0x30\n" + "\tstr r0, [sp]\n" + "\tadds r4, r1, 0\n" + "\tadds r7, r2, 0\n" + "\tstr r3, [sp, 0x4]\n" + "\tmovs r1, 0\n" + "\tldrsh r0, [r0, r1]\n" + "\tmov r10, r0\n" + "\tmovs r2, 0x1\n" + "\tnegs r2, r2\n" + "\tadd r2, r10\n" + "\tmovs r3, 0\n" + "\tstr r3, [sp, 0x8]\n" + "\tcmp r4, 0x1C\n" + "\tble _08006EBE\n" + "\tb _080072FE\n" +"_08006EBE:\n" + "\tcmp r4, 0\n" + "\tbge _08006EC4\n" + "\tb _080072FE\n" +"_08006EC4:\n" + "\tlsls r1, r2, 1\n" + "\tlsls r4, 6\n" + "\tldr r6, [sp, 0x50]\n" + "\tadds r5, r4, r6\n" + "\tadds r1, r5\n" + "\tldr r0, _08006F9C\n" + "\tadds r3, r0, 0\n" + "\tstrh r3, [r1]\n" + "\tmovs r2, 0x80\n" + "\tlsls r2, 4\n" + "\tadds r0, r1, r2\n" + "\tldr r6, _08006FA0\n" + "\tadds r2, r6, 0\n" + "\tstrh r2, [r0]\n" + "\tadds r0, r1, 0\n" + "\tadds r0, 0x40\n" + "\tstrh r3, [r0]\n" + "\tmovs r0, 0x84\n" + "\tlsls r0, 4\n" + "\tadds r0, r1, r0\n" + "\tstrh r2, [r0]\n" + "\tadds r2, r1, 0\n" + "\tadds r2, 0x80\n" + "\tldr r3, _08006FA4\n" + "\tadds r0, r3, 0\n" + "\tstrh r0, [r2]\n" + "\tmovs r6, 0x88\n" + "\tlsls r6, 4\n" + "\tadds r1, r6\n" + "\tldr r2, _08006FA8\n" + "\tadds r0, r2, 0\n" + "\tstrh r0, [r1]\n" + "\tmov r12, r10\n" + "\tmovs r3, 0\n" + "\tstr r4, [sp, 0x18]\n" + "\tldr r4, [sp, 0x4]\n" + "\tldrb r4, [r4]\n" + "\tcmp r3, r4\n" + "\tblt _08006F14\n" + "\tb _08007238\n" +"_08006F14:\n" + "\tadds r2, r5, 0\n" + "\tmov r5, r12\n" + "\tlsls r1, r5, 1\n" + "\tldr r0, [sp, 0x50]\n" + "\tadds r0, 0x80\n" + "\tldr r6, [sp, 0x18]\n" + "\tadds r0, r6, r0\n" + "\tadds r0, r1\n" + "\tmov r9, r0\n" + "\tldr r0, [sp, 0x50]\n" + "\tadds r0, 0x40\n" + "\tadds r0, r6, r0\n" + "\tadds r0, r1\n" + "\tmov r8, r0\n" + "\tldr r4, [sp, 0x50]\n" + "\tmovs r5, 0x80\n" + "\tlsls r5, 4\n" + "\tadds r0, r4, r5\n" + "\tadds r0, r6, r0\n" + "\tadds r0, r1, r0\n" + "\tstr r0, [sp, 0x20]\n" + "\tmovs r6, 0x84\n" + "\tlsls r6, 4\n" + "\tadds r0, r4, r6\n" + "\tldr r4, [sp, 0x18]\n" + "\tadds r0, r4, r0\n" + "\tadds r0, r1\n" + "\tmov r10, r0\n" + "\tadds r4, r1, r2\n" + "\tldr r5, [sp, 0x18]\n" + "\tstr r5, [sp, 0x10]\n" + "\tstr r2, [sp, 0x1C]\n" + "\tstr r1, [sp, 0x24]\n" +"_08006F56:\n" + "\tldr r6, [sp, 0x4]\n" + "\tldrb r6, [r6, 0x1]\n" + "\tcmp r3, r6\n" + "\tbne _08006F60\n" + "\tb _080070C8\n" +"_08006F60:\n" + "\tldr r0, [sp, 0x8]\n" + "\tcmp r0, 0\n" + "\tbne _08007008\n" + "\tldr r1, [sp, 0x4]\n" + "\tldrb r0, [r1, 0x3]\n" + "\tasrs r0, r3\n" + "\tmovs r1, 0x1\n" + "\tands r0, r1\n" + "\tcmp r0, 0\n" + "\tbeq _08006FB8\n" + "\tmovs r1, 0x1F\n" + "\tcmp r3, 0\n" + "\tbne _08006F7C\n" + "\tmovs r1, 0x1B\n" +"_08006F7C:\n" + "\tmovs r2, 0x9E\n" + "\tlsls r2, 2\n" + "\tadds r0, r1, r2\n" + "\tldr r5, _08006FAC\n" + "\tadds r1, r5, 0\n" + "\torrs r0, r1\n" + "\tstrh r0, [r4]\n" + "\tldr r6, _08006FB0\n" + "\tadds r0, r6, 0\n" + "\tmov r1, r8\n" + "\tstrh r0, [r1]\n" + "\tldr r5, _08006FB4\n" + "\tmov r2, r9\n" + "\tstrh r5, [r2]\n" + "\tb _08006FDC\n" + "\t.align 2, 0\n" +"_08006F9C: .4byte 0x0000f278\n" +"_08006FA0: .4byte 0x0000f27a\n" +"_08006FA4: .4byte 0x0000f2d8\n" +"_08006FA8: .4byte 0x0000f2db\n" +"_08006FAC: .4byte 0xfffff400\n" +"_08006FB0: .4byte 0x0000f2b6\n" +"_08006FB4: .4byte 0x0000f2d9\n" +"_08006FB8:\n" + "\tmovs r1, 0x6B\n" + "\tcmp r3, 0\n" + "\tbne _08006FC0\n" + "\tmovs r1, 0x67\n" +"_08006FC0:\n" + "\tmovs r6, 0x9E\n" + "\tlsls r6, 2\n" + "\tadds r0, r1, r6\n" + "\tldr r2, _08006FF4\n" + "\tadds r1, r2, 0\n" + "\torrs r0, r1\n" + "\tstrh r0, [r4]\n" + "\tldr r5, _08006FF8\n" + "\tadds r0, r5, 0\n" + "\tmov r6, r8\n" + "\tstrh r0, [r6]\n" + "\tldr r1, _08006FFC\n" + "\tmov r0, r9\n" + "\tstrh r1, [r0]\n" +"_08006FDC:\n" + "\tldr r2, _08007000\n" + "\tadds r0, r2, 0\n" + "\tldr r5, [sp, 0x20]\n" + "\tstrh r0, [r5]\n" + "\tldr r0, _08007004\n" + "\tmov r6, r10\n" + "\tstrh r0, [r6]\n" + "\tmovs r1, 0x88\n" + "\tlsls r1, 4\n" + "\tadds r0, r4, r1\n" + "\tadds r2, 0x61\n" + "\tb _0800708E\n" + "\t.align 2, 0\n" +"_08006FF4: .4byte 0xfffff400\n" +"_08006FF8: .4byte 0x0000f2ef\n" +"_08006FFC: .4byte 0x0000f2d9\n" +"_08007000: .4byte 0x0000f27a\n" +"_08007004: .4byte 0x0000f2db\n" +"_08007008:\n" + "\tldr r5, [sp, 0x4]\n" + "\tldrb r0, [r5, 0x3]\n" + "\tasrs r0, r3\n" + "\tmovs r1, 0x1\n" + "\tands r0, r1\n" + "\tcmp r0, 0\n" + "\tbeq _0800704C\n" + "\tldrb r0, [r5]\n" + "\tsubs r0, 0x1\n" + "\tmovs r1, 0x1F\n" + "\tcmp r3, r0\n" + "\tbne _08007022\n" + "\tmovs r1, 0x1B\n" +"_08007022:\n" + "\tmovs r6, 0x9E\n" + "\tlsls r6, 2\n" + "\tadds r0, r1, r6\n" + "\tldr r2, _08007040\n" + "\tadds r1, r2, 0\n" + "\torrs r0, r1\n" + "\tstrh r0, [r4]\n" + "\tldr r5, _08007044\n" + "\tadds r0, r5, 0\n" + "\tmov r6, r8\n" + "\tstrh r0, [r6]\n" + "\tldr r1, _08007048\n" + "\tmov r0, r9\n" + "\tstrh r1, [r0]\n" + "\tb _08007076\n" + "\t.align 2, 0\n" +"_08007040: .4byte 0xfffff000\n" +"_08007044: .4byte 0x0000f6b6\n" +"_08007048: .4byte 0x0000f2d9\n" +"_0800704C:\n" + "\tldr r2, [sp, 0x4]\n" + "\tldrb r0, [r2]\n" + "\tsubs r0, 0x1\n" + "\tmovs r1, 0x6B\n" + "\tcmp r3, r0\n" + "\tbne _0800705A\n" + "\tmovs r1, 0x67\n" +"_0800705A:\n" + "\tmovs r5, 0x9E\n" + "\tlsls r5, 2\n" + "\tadds r0, r1, r5\n" + "\tldr r6, _080070B0\n" + "\tadds r1, r6, 0\n" + "\torrs r0, r1\n" + "\tstrh r0, [r4]\n" + "\tldr r1, _080070B4\n" + "\tadds r0, r1, 0\n" + "\tmov r2, r8\n" + "\tstrh r0, [r2]\n" + "\tldr r6, _080070B8\n" + "\tmov r5, r9\n" + "\tstrh r6, [r5]\n" +"_08007076:\n" + "\tldr r1, _080070BC\n" + "\tadds r0, r1, 0\n" + "\tldr r2, [sp, 0x20]\n" + "\tstrh r0, [r2]\n" + "\tldr r5, _080070C0\n" + "\tadds r0, r5, 0\n" + "\tmov r6, r10\n" + "\tstrh r0, [r6]\n" + "\tmovs r1, 0x88\n" + "\tlsls r1, 4\n" + "\tadds r0, r4, r1\n" + "\tldr r2, _080070C4\n" +"_0800708E:\n" + "\tstrh r2, [r0]\n" + "\tmovs r5, 0x2\n" + "\tadd r9, r5\n" + "\tadd r8, r5\n" + "\tldr r6, [sp, 0x20]\n" + "\tadds r6, 0x2\n" + "\tstr r6, [sp, 0x20]\n" + "\tadd r10, r5\n" + "\tadds r4, 0x2\n" + "\tldr r0, [sp, 0x24]\n" + "\tadds r0, 0x2\n" + "\tstr r0, [sp, 0x24]\n" + "\tmovs r1, 0x1\n" + "\tadd r12, r1\n" + "\tadds r3, 0x1\n" + "\tstr r3, [sp, 0x14]\n" + "\tb _08007226\n" + "\t.align 2, 0\n" +"_080070B0: .4byte 0xfffff000\n" +"_080070B4: .4byte 0x0000f6ef\n" +"_080070B8: .4byte 0x0000f2d9\n" +"_080070BC: .4byte 0x0000f27a\n" +"_080070C0: .4byte 0x0000f6db\n" +"_080070C4: .4byte 0x0000f2db\n" +"_080070C8:\n" + "\tmovs r2, 0x1\n" + "\tstr r2, [sp, 0x8]\n" + "\tldr r5, _08007128\n" + "\tadds r0, r5, 0\n" + "\tstrh r0, [r4]\n" + "\tldr r6, _0800712C\n" + "\tadds r0, r6, 0\n" + "\tldr r1, [sp, 0x20]\n" + "\tstrh r0, [r1]\n" + "\tldr r2, _08007130\n" + "\tadds r0, r2, 0\n" + "\tmov r5, r8\n" + "\tstrh r0, [r5]\n" + "\tldr r0, _08007134\n" + "\tmov r6, r10\n" + "\tstrh r0, [r6]\n" + "\tldr r1, _08007138\n" + "\tadds r0, r1, 0\n" + "\tmov r2, r9\n" + "\tstrh r0, [r2]\n" + "\tmovs r5, 0x88\n" + "\tlsls r5, 4\n" + "\tadds r0, r4, r5\n" + "\tldr r6, _08007134\n" + "\tstrh r6, [r0]\n" + "\tmovs r0, 0x2\n" + "\tadd r9, r0\n" + "\tadd r8, r0\n" + "\tldr r1, [sp, 0x20]\n" + "\tadds r1, 0x2\n" + "\tstr r1, [sp, 0x20]\n" + "\tadd r10, r0\n" + "\tadds r4, 0x2\n" + "\tldr r2, [sp, 0x24]\n" + "\tadds r2, 0x2\n" + "\tstr r2, [sp, 0x24]\n" + "\tmovs r5, 0x1\n" + "\tadd r12, r5\n" + "\tcmp r7, 0\n" + "\tbeq _0800713C\n" + "\tadds r7, 0x1\n" + "\tcmp r7, 0\n" + "\tbeq _0800713C\n" + "\tldr r6, [sp]\n" + "\tmovs r1, 0x4\n" + "\tldrsh r0, [r6, r1]\n" + "\tadds r2, r7, r0\n" + "\tb _0800713E\n" + "\t.align 2, 0\n" +"_08007128: .4byte 0x0000f2e0\n" +"_0800712C: .4byte 0x0000f2e2\n" +"_08007130: .4byte 0x0000f2da\n" +"_08007134: .4byte 0x0000f2db\n" +"_08007138: .4byte 0x0000f6e7\n" +"_0800713C:\n" + "\tmovs r2, 0\n" +"_0800713E:\n" + "\tmovs r5, 0\n" + "\tstr r5, [sp, 0xC]\n" + "\tadds r3, 0x1\n" + "\tstr r3, [sp, 0x14]\n" + "\tldr r6, [sp, 0x4]\n" + "\tldrb r6, [r6, 0x2]\n" + "\tcmp r5, r6\n" + "\tbge _080071E0\n" + "\tldr r0, [sp, 0x50]\n" + "\tadds r0, 0x80\n" + "\tldr r1, [sp, 0x10]\n" + "\tadds r0, r1, r0\n" + "\tldr r3, [sp, 0x24]\n" + "\tadds r0, r3, r0\n" + "\tstr r0, [sp, 0x2C]\n" + "\tldr r0, [sp, 0x50]\n" + "\tadds r0, 0x40\n" + "\tadds r0, r1, r0\n" + "\tadds r5, r3, r0\n" + "\tldr r6, [sp, 0x1C]\n" + "\tadds r3, r6\n" +"_08007168:\n" + "\tldr r1, _08007310\n" + "\tadds r0, r1, 0\n" + "\tstrh r0, [r3]\n" + "\tmovs r6, 0x80\n" + "\tlsls r6, 4\n" + "\tadds r6, r3, r6\n" + "\tstr r6, [sp, 0x28]\n" + "\tadds r1, 0x1\n" + "\tadds r0, r1, 0\n" + "\tstrh r0, [r6]\n" + "\tadds r0, r7, 0\n" + "\tldr r6, _08007314\n" + "\torrs r0, r6\n" + "\tstrh r0, [r5]\n" + "\tmovs r1, 0x84\n" + "\tlsls r1, 4\n" + "\tadds r0, r3, r1\n" + "\tldr r6, _08007318\n" + "\tstrh r6, [r0]\n" + "\tadds r0, r2, 0\n" + "\tldr r1, _08007314\n" + "\torrs r0, r1\n" + "\tldr r6, [sp, 0x2C]\n" + "\tstrh r0, [r6]\n" + "\tmovs r1, 0x88\n" + "\tlsls r1, 4\n" + "\tadds r0, r3, r1\n" + "\tldr r6, _08007318\n" + "\tstrh r6, [r0]\n" + "\tldr r0, [sp, 0x2C]\n" + "\tadds r0, 0x2\n" + "\tstr r0, [sp, 0x2C]\n" + "\tadds r5, 0x2\n" + "\tadds r3, 0x2\n" + "\tmovs r1, 0x2\n" + "\tadd r9, r1\n" + "\tadd r8, r1\n" + "\tldr r6, [sp, 0x20]\n" + "\tadds r6, 0x2\n" + "\tstr r6, [sp, 0x20]\n" + "\tadd r10, r1\n" + "\tadds r4, 0x2\n" + "\tldr r0, [sp, 0x24]\n" + "\tadds r0, 0x2\n" + "\tstr r0, [sp, 0x24]\n" + "\tmovs r1, 0x1\n" + "\tadd r12, r1\n" + "\tcmp r7, 0\n" + "\tbeq _080071CC\n" + "\tadds r7, 0x1\n" +"_080071CC:\n" + "\tcmp r2, 0\n" + "\tbeq _080071D2\n" + "\tadds r2, 0x1\n" +"_080071D2:\n" + "\tldr r6, [sp, 0xC]\n" + "\tadds r6, 0x1\n" + "\tstr r6, [sp, 0xC]\n" + "\tldr r0, [sp, 0x4]\n" + "\tldrb r0, [r0, 0x2]\n" + "\tcmp r6, r0\n" + "\tblt _08007168\n" +"_080071E0:\n" + "\tldr r1, _0800731C\n" + "\tadds r0, r1, 0\n" + "\tstrh r0, [r4]\n" + "\tldr r2, _08007320\n" + "\tadds r0, r2, 0\n" + "\tldr r3, [sp, 0x20]\n" + "\tstrh r0, [r3]\n" + "\tldr r5, _08007324\n" + "\tadds r0, r5, 0\n" + "\tmov r6, r8\n" + "\tstrh r0, [r6]\n" + "\tldr r1, _08007318\n" + "\tmov r0, r10\n" + "\tstrh r1, [r0]\n" + "\tadds r2, 0x5\n" + "\tadds r0, r2, 0\n" + "\tmov r3, r9\n" + "\tstrh r0, [r3]\n" + "\tmovs r5, 0x88\n" + "\tlsls r5, 4\n" + "\tadds r0, r4, r5\n" + "\tstrh r1, [r0]\n" + "\tmovs r6, 0x2\n" + "\tadd r9, r6\n" + "\tadd r8, r6\n" + "\tldr r0, [sp, 0x20]\n" + "\tadds r0, 0x2\n" + "\tstr r0, [sp, 0x20]\n" + "\tadd r10, r6\n" + "\tadds r4, 0x2\n" + "\tldr r1, [sp, 0x24]\n" + "\tadds r1, 0x2\n" + "\tstr r1, [sp, 0x24]\n" + "\tmovs r2, 0x1\n" + "\tadd r12, r2\n" +"_08007226:\n" + "\tcmp r7, 0\n" + "\tbeq _0800722C\n" + "\tadds r7, 0x1\n" +"_0800722C:\n" + "\tldr r3, [sp, 0x14]\n" + "\tldr r5, [sp, 0x4]\n" + "\tldrb r5, [r5]\n" + "\tcmp r3, r5\n" + "\tbge _08007238\n" + "\tb _08006F56\n" +"_08007238:\n" + "\tldr r6, [sp]\n" + "\tmovs r0, 0\n" + "\tldrsh r1, [r6, r0]\n" + "\tmovs r2, 0x4\n" + "\tldrsh r0, [r6, r2]\n" + "\tadds r0, r1, r0\n" + "\tcmp r12, r0\n" + "\tbge _080072BC\n" + "\tldr r3, _08007328\n" + "\tadds r4, r3, 0\n" + "\tmov r8, r0\n" + "\tmov r5, r12\n" + "\tlsls r1, r5, 1\n" + "\tldr r0, [sp, 0x50]\n" + "\tadds r0, 0x80\n" + "\tldr r6, [sp, 0x18]\n" + "\tadds r0, r6, r0\n" + "\tadds r5, r1, r0\n" + "\tldr r0, [sp, 0x50]\n" + "\tadds r0, 0x40\n" + "\tadds r0, r6, r0\n" + "\tadds r3, r1, r0\n" + "\tldr r0, [sp, 0x50]\n" + "\tadds r6, r0\n" + "\tadds r2, r1, r6\n" + "\tmovs r1, 0x80\n" + "\tlsls r1, 4\n" + "\tmov r10, r1\n" + "\tmovs r6, 0x84\n" + "\tlsls r6, 4\n" + "\tmov r9, r6\n" + "\tmov r0, r8\n" + "\tmov r1, r12\n" + "\tsubs r0, r1\n" + "\tmov r12, r0\n" +"_0800727E:\n" + "\tstrh r4, [r2]\n" + "\tmov r6, r10\n" + "\tadds r0, r2, r6\n" + "\tldr r1, _0800732C\n" + "\tstrh r1, [r0]\n" + "\tstrh r4, [r3]\n" + "\tmov r6, r9\n" + "\tadds r0, r2, r6\n" + "\tstrh r1, [r0]\n" + "\tadds r1, 0x5F\n" + "\tadds r0, r1, 0\n" + "\tstrh r0, [r5]\n" + "\tmovs r6, 0x88\n" + "\tlsls r6, 4\n" + "\tadds r1, r2, r6\n" + "\tldr r6, _08007318\n" + "\tadds r0, r6, 0\n" + "\tstrh r0, [r1]\n" + "\tadds r5, 0x2\n" + "\tadds r3, 0x2\n" + "\tadds r2, 0x2\n" + "\tmovs r0, 0x1\n" + "\tnegs r0, r0\n" + "\tadd r12, r0\n" + "\tcmp r7, 0\n" + "\tbeq _080072B4\n" + "\tadds r7, 0x1\n" +"_080072B4:\n" + "\tmov r1, r12\n" + "\tcmp r1, 0\n" + "\tbne _0800727E\n" + "\tmov r12, r8\n" +"_080072BC:\n" + "\tmov r2, r12\n" + "\tlsls r1, r2, 1\n" + "\tldr r3, [sp, 0x18]\n" + "\tldr r4, [sp, 0x50]\n" + "\tadds r0, r3, r4\n" + "\tadds r1, r0\n" + "\tldr r5, _08007328\n" + "\tadds r3, r5, 0\n" + "\tstrh r3, [r1]\n" + "\tmovs r6, 0x80\n" + "\tlsls r6, 4\n" + "\tadds r0, r1, r6\n" + "\tldr r4, _0800732C\n" + "\tadds r2, r4, 0\n" + "\tstrh r2, [r0]\n" + "\tadds r0, r1, 0\n" + "\tadds r0, 0x40\n" + "\tstrh r3, [r0]\n" + "\tmovs r5, 0x84\n" + "\tlsls r5, 4\n" + "\tadds r0, r1, r5\n" + "\tstrh r2, [r0]\n" + "\tadds r2, r1, 0\n" + "\tadds r2, 0x80\n" + "\tldr r6, _08007330\n" + "\tadds r0, r6, 0\n" + "\tstrh r0, [r2]\n" + "\tmovs r0, 0x88\n" + "\tlsls r0, 4\n" + "\tadds r1, r0\n" + "\tldr r2, _08007318\n" + "\tadds r0, r2, 0\n" + "\tstrh r0, [r1]\n" +"_080072FE:\n" + "\tadd sp, 0x30\n" + "\tpop {r3-r5}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tmov r10, r5\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.align 2, 0\n" +"_08007310: .4byte 0x0000f2e1\n" +"_08007314: .4byte 0xfffff000\n" +"_08007318: .4byte 0x0000f2db\n" +"_0800731C: .4byte 0x0000f6e0\n" +"_08007320: .4byte 0x0000f2e2\n" +"_08007324: .4byte 0x0000f6da\n" +"_08007328: .4byte 0x0000f278\n" +"_0800732C: .4byte 0x0000f27a\n" +"_08007330: .4byte 0x0000f6d8"); +} +#endif // NONMATCHING + +#ifdef NONMATCHING // https://decomp.me/scratch/zVTOf +void sub_8007334(s32 a0) +{ + s32 r1; + s32 r2; + struct UnkTextStruct1 *r3; + s32 r4; + u32 r5; + s32 r6; + s16 typeCheater; + + r3 = &gUnknown_2027370[a0]; + r5 = r3->unk14; + r6 = r3->unk2; + for (r2 = 0; r2 < r3->unk6; r6++, r2++) { + typeCheater = r3->unk0; + r1 = typeCheater; + for (r4 = 0; r4 < r3->unk4; r4++) { + typeCheater = r1; + gUnknown_202B038[0][r6][typeCheater + r4] &= 0xFC00; + gUnknown_202B038[0][r6][typeCheater + r4] |= r5++; + } + } +} +#else +NAKED +void sub_8007334(s32 a0) +{ + asm_unified( + "\tpush {r4-r7,lr}\n" + "\tmov r7, r9\n" + "\tmov r6, r8\n" + "\tpush {r6,r7}\n" + "\tlsls r1, r0, 3\n" + "\tadds r1, r0\n" + "\tlsls r1, 3\n" + "\tldr r0, _080073AC\n" + "\tadds r3, r1, r0\n" + "\tldr r5, [r3, 0x14]\n" + "\tmovs r0, 0x2\n" + "\tldrsh r6, [r3, r0]\n" + "\tmovs r2, 0\n" + "\tmovs r1, 0x6\n" + "\tldrsh r0, [r3, r1]\n" + "\tcmp r2, r0\n" + "\tbge _080073A0\n" + "\tldr r7, _080073B0\n" + "\tmov r9, r7\n" +"_0800735A:\n" + "\tmovs r0, 0\n" + "\tldrsh r1, [r3, r0]\n" + "\tmovs r4, 0\n" + "\tmovs r7, 0x4\n" + "\tldrsh r0, [r3, r7]\n" + "\tadds r7, r6, 0x1\n" + "\tadds r2, 0x1\n" + "\tmov r12, r2\n" + "\tcmp r4, r0\n" + "\tbge _08007394\n" + "\tmovs r0, 0xFC\n" + "\tlsls r0, 8\n" + "\tmov r8, r0\n" + "\tlsls r1, 1\n" + "\tlsls r0, r6, 6\n" + "\tadd r0, r9\n" + "\tadds r2, r1, r0\n" +"_0800737C:\n" + "\tldrh r0, [r2]\n" + "\tmov r1, r8\n" + "\tands r1, r0\n" + "\torrs r1, r5\n" + "\tstrh r1, [r2]\n" + "\tadds r2, 0x2\n" + "\tadds r5, 0x1\n" + "\tadds r4, 0x1\n" + "\tmovs r1, 0x4\n" + "\tldrsh r0, [r3, r1]\n" + "\tcmp r4, r0\n" + "\tblt _0800737C\n" +"_08007394:\n" + "\tadds r6, r7, 0\n" + "\tmov r2, r12\n" + "\tmovs r7, 0x6\n" + "\tldrsh r0, [r3, r7]\n" + "\tcmp r2, r0\n" + "\tblt _0800735A\n" +"_080073A0:\n" + "\tpop {r3,r4}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.align 2, 0\n" +"_080073AC: .4byte gUnknown_2027370\n" +"_080073B0: .4byte gUnknown_202B038"); +} +#endif // NONMATCHING + +// Unused +void nullsub_154(void) +{ +} + +void sub_80073B8(s32 a0) +{ + struct UnkTextStruct1 *r1; + + r1 = &gUnknown_2027370[a0]; + + r1->unk3C = &r1->unk1C[(u32)r1->unk2C >> 2]; + r1->unk40 = r1->unk1C; + r1->unk46 = 1; +} + +// Unused +void nullsub_155(void) +{ +} + +void sub_80073E0(s32 a0) +{ + struct UnkTextStruct1 *r1; + + r1 = &gUnknown_2027370[a0]; + + if (r1->unk44 == 0) { + r1->unk30 = &r1->unk28[r1->unk3C - r1->unk1C]; + r1->unk34 = r1->unk3C; + r1->unk38 = (r1->unk40 - r1->unk3C + 1) * 4; + + if (r1->unk38 >= r1->unk2C) + r1->unk38 = r1->unk2C; + + if (r1->unk38 < 0) + r1->unk38 = 0; + } + + r1->unk46 = 0; +} + +// Unused +void nullsub_156(void) +{ +} + +u32 xxx_call_draw_char(s32 x, s32 y, u32 a2, u32 color, u32 a4) +{ + return xxx_draw_char(gUnknown_2027370, x, y, a2, color, a4); +} + +// Unused +bool8 sub_8007464(void) +{ + return FALSE; +} + +// https://decomp.me/scratch/F06Ty +NAKED +u32 xxx_draw_char(struct UnkTextStruct1 *a0, s32 x, s32 y, u32 a3, u32 color, u32 a5) +{ + asm_unified( + "push {r4-r7,lr}\n" + "\tmov r7, r10\n" + "\tmov r6, r9\n" + "\tmov r5, r8\n" + "\tpush {r5-r7}\n" + "\tsub sp, 0x28\n" + "\tadds r6, r1, 0\n" + "\tmov r10, r2\n" + "\tadds r4, r3, 0\n" + "\tldr r2, [sp, 0x48]\n" + "\tldr r3, [sp, 0x4C]\n" + "\tlsls r1, r3, 3\n" + "\tadds r1, r3\n" + "\tlsls r1, 3\n" + "\tadds r5, r0, r1\n" + "\tldr r1, _080074B8\n" + "\tmovs r0, 0xF\n" + "\tands r2, r0\n" + "\tlsls r2, 2\n" + "\tadds r2, r1\n" + "\tldr r2, [r2]\n" + "\tstr r2, [sp, 0x18]\n" + "\tldr r0, _080074BC\n" + "\tldr r0, [r0]\n" + "\tcmp r0, 0x1\n" + "\tbne _080074CC\n" + "\tcmp r4, 0x70\n" + "\tbeq _080074B0\n" + "\tcmp r4, 0x6A\n" + "\tbeq _080074B0\n" + "\tcmp r4, 0x71\n" + "\tbeq _080074B0\n" + "\tcmp r4, 0x79\n" + "\tbeq _080074B0\n" + "\tcmp r4, 0x67\n" + "\tbne _080074C0\n" +"_080074B0:\n" + "\tmovs r0, 0x2\n" + "\tadd r10, r0\n" + "\tb _080074CC\n" + "\t.align 2, 0\n" +"_080074B8: .4byte gUnknown_80B853C\n" +"_080074BC: .4byte gCurrentCharmap\n" +"_080074C0:\n" + "\tldr r0, _080074F8\n" + "\tcmp r4, r0\n" + "\tbne _080074CC\n" + "\tmovs r1, 0x2\n" + "\tnegs r1, r1\n" + "\tadd r10, r1\n" +"_080074CC:\n" + "\tadds r0, r4, 0\n" + "\tbl GetCharacter\n" + "\tstr r0, [sp]\n" + "\tldr r2, [r0]\n" + "\tstr r2, [sp, 0x4]\n" + "\tstr r2, [sp, 0xC]\n" + "\tadds r3, r2, 0\n" + "\tsubs r3, 0x6\n" + "\tstr r3, [sp, 0x8]\n" + "\tldr r0, _080074FC\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0\n" + "\tbeq _08007500\n" + "\tldr r4, [sp]\n" + "\tldrb r1, [r4, 0xA]\n" + "\tlsrs r7, r1, 1\n" + "\tmovs r0, 0x1\n" + "\tadds r2, r7, 0\n" + "\tands r2, r0\n" + "\tstr r2, [sp, 0x1C]\n" + "\tb _08007508\n" + "\t.align 2, 0\n" +"_080074F8: .4byte 0x00008199\n" +"_080074FC: .4byte gUnknown_202B034\n" +"_08007500:\n" + "\tmovs r3, 0\n" + "\tstr r3, [sp, 0x1C]\n" + "\tldr r4, [sp]\n" + "\tldrb r1, [r4, 0xA]\n" +"_08007508:\n" + "\tmovs r0, 0x1\n" + "\tands r0, r1\n" + "\tcmp r0, 0\n" + "\tbne _08007512\n" + "\tb _08007670\n" +"_08007512:\n" + "\tmov r0, r10\n" + "\tcmp r0, 0\n" + "\tbge _0800751A\n" + "\tadds r0, 0x7\n" +"_0800751A:\n" + "\tasrs r4, r0, 3\n" + "\tmovs r7, 0x4\n" + "\tldrsh r0, [r5, r7]\n" + "\tmuls r0, r4\n" + "\tadds r2, r6, 0\n" + "\tcmp r6, 0\n" + "\tbge _0800752A\n" + "\tadds r2, r6, 0x7\n" +"_0800752A:\n" + "\tasrs r2, 3\n" + "\tadds r0, r2\n" + "\tlsls r0, 5\n" + "\tldr r1, [r5, 0x18]\n" + "\tadds r3, r1, r0\n" + "\tlsls r0, r4, 3\n" + "\tmov r1, r10\n" + "\tsubs r0, r1, r0\n" + "\tlsls r0, 2\n" + "\tadds r3, r0\n" + "\tlsls r0, r2, 3\n" + "\tsubs r0, r6, r0\n" + "\tlsls r0, 4\n" + "\tldr r1, _08007664\n" + "\tadds r0, r1\n" + "\tmov r12, r0\n" + "\tmov r9, r2\n" + "\tstr r4, [sp, 0x14]\n" + "\tmovs r2, 0x8\n" + "\tldrsh r0, [r5, r2]\n" + "\tcmp r4, r0\n" + "\tblt _08007558\n" + "\tb _0800786C\n" +"_08007558:\n" + "\tmovs r4, 0\n" + "\tstr r4, [sp, 0x10]\n" + "\tldr r2, _08007668\n" + "\tldr r1, _0800766C\n" + "\tldr r0, [r1]\n" + "\tlsls r0, 2\n" + "\tadds r0, r2\n" + "\tldr r0, [r0]\n" + "\tcmp r4, r0\n" + "\tblt _0800756E\n" + "\tb _0800786C\n" +"_0800756E:\n" + "\tadds r4, r2, 0\n" +"_08007570:\n" + "\tldr r6, [sp, 0x4]\n" + "\tldrh r0, [r6, 0x2]\n" + "\tlsls r2, r0, 16\n" + "\tldrh r0, [r6]\n" + "\torrs r2, r0\n" + "\tcmp r2, 0\n" + "\tbeq _080075CC\n" + "\tmovs r7, 0x4\n" + "\tldrsh r0, [r5, r7]\n" + "\tcmp r9, r0\n" + "\tbge _080075A6\n" + "\tmov r0, r12\n" + "\tldr r1, [r0]\n" + "\tands r1, r2\n" + "\tldr r0, [r0, 0x8]\n" + "\tlsls r1, r0\n" + "\tldr r0, [r3]\n" + "\torrs r0, r1\n" + "\tstr r0, [r3]\n" + "\tldr r0, [r5, 0x3C]\n" + "\tcmp r0, r3\n" + "\tbls _0800759E\n" + "\tstr r3, [r5, 0x3C]\n" +"_0800759E:\n" + "\tldr r0, [r5, 0x40]\n" + "\tcmp r0, r3\n" + "\tbcs _080075A6\n" + "\tstr r3, [r5, 0x40]\n" +"_080075A6:\n" + "\tmovs r1, 0x4\n" + "\tldrsh r0, [r5, r1]\n" + "\tsubs r0, 0x1\n" + "\tcmp r9, r0\n" + "\tbge _080075CC\n" + "\tadds r3, 0x20\n" + "\tmov r6, r12\n" + "\tldr r0, [r6, 0x4]\n" + "\tands r2, r0\n" + "\tldr r0, [r6, 0xC]\n" + "\tlsrs r2, r0\n" + "\tldr r0, [r3]\n" + "\torrs r0, r2\n" + "\tstr r0, [r3]\n" + "\tldr r0, [r5, 0x40]\n" + "\tcmp r0, r3\n" + "\tbcs _080075CA\n" + "\tstr r3, [r5, 0x40]\n" +"_080075CA:\n" + "\tsubs r3, 0x20\n" +"_080075CC:\n" + "\tldr r7, [sp, 0x4]\n" + "\tldrh r2, [r7, 0x4]\n" + "\tcmp r2, 0\n" + "\tbeq _08007620\n" + "\tmovs r1, 0x4\n" + "\tldrsh r0, [r5, r1]\n" + "\tsubs r0, 0x1\n" + "\tcmp r9, r0\n" + "\tbge _080075FA\n" + "\tadds r3, 0x20\n" + "\tmov r6, r12\n" + "\tldr r1, [r6]\n" + "\tands r1, r2\n" + "\tldr r0, [r6, 0x8]\n" + "\tlsls r1, r0\n" + "\tldr r0, [r3]\n" + "\torrs r0, r1\n" + "\tstr r0, [r3]\n" + "\tldr r0, [r5, 0x40]\n" + "\tcmp r0, r3\n" + "\tbcs _080075F8\n" + "\tstr r3, [r5, 0x40]\n" +"_080075F8:\n" + "\tsubs r3, 0x20\n" +"_080075FA:\n" + "\tmovs r7, 0x4\n" + "\tldrsh r0, [r5, r7]\n" + "\tsubs r0, 0x2\n" + "\tcmp r9, r0\n" + "\tbge _08007620\n" + "\tadds r3, 0x40\n" + "\tmov r1, r12\n" + "\tldr r0, [r1, 0x4]\n" + "\tands r2, r0\n" + "\tldr r0, [r1, 0xC]\n" + "\tlsrs r2, r0\n" + "\tldr r0, [r3]\n" + "\torrs r0, r2\n" + "\tstr r0, [r3]\n" + "\tldr r0, [r5, 0x40]\n" + "\tcmp r0, r3\n" + "\tbcs _0800761E\n" + "\tstr r3, [r5, 0x40]\n" +"_0800761E:\n" + "\tsubs r3, 0x40\n" +"_08007620:\n" + "\tldr r2, [sp, 0x4]\n" + "\tadds r2, 0x6\n" + "\tstr r2, [sp, 0x4]\n" + "\tadds r3, 0x4\n" + "\tmovs r6, 0x1\n" + "\tadd r10, r6\n" + "\tmovs r0, 0x7\n" + "\tmov r7, r10\n" + "\tands r0, r7\n" + "\tcmp r0, 0\n" + "\tbne _0800764E\n" + "\tldr r0, [r5, 0x20]\n" + "\tlsls r0, 2\n" + "\tadds r3, r0\n" + "\tldr r0, [sp, 0x14]\n" + "\tadds r0, 0x1\n" + "\tstr r0, [sp, 0x14]\n" + "\tmovs r1, 0x8\n" + "\tldrsh r0, [r5, r1]\n" + "\tldr r2, [sp, 0x14]\n" + "\tcmp r2, r0\n" + "\tblt _0800764E\n" + "\tb _0800786C\n" +"_0800764E:\n" + "\tldr r6, [sp, 0x10]\n" + "\tadds r6, 0x1\n" + "\tstr r6, [sp, 0x10]\n" + "\tldr r7, _0800766C\n" + "\tldr r0, [r7]\n" + "\tlsls r0, 2\n" + "\tadds r0, r4\n" + "\tldr r0, [r0]\n" + "\tcmp r6, r0\n" + "\tblt _08007570\n" + "\tb _0800786C\n" + "\t.align 2, 0\n" +"_08007664: .4byte gUnknown_80B85DC\n" +"_08007668: .4byte gUnknown_202B028\n" +"_0800766C: .4byte gCurrentCharmap\n" +"_08007670:\n" + "\tmovs r0, 0\n" + "\tstr r0, [sp, 0x20]\n" + "\tmov r0, r10\n" + "\tcmp r0, 0\n" + "\tbge _0800767C\n" + "\tadds r0, 0x7\n" +"_0800767C:\n" + "\tasrs r4, r0, 3\n" + "\tmovs r1, 0x4\n" + "\tldrsh r0, [r5, r1]\n" + "\tadds r1, r4, 0\n" + "\tmuls r1, r0\n" + "\tadds r0, r6, 0\n" + "\tcmp r6, 0\n" + "\tbge _0800768E\n" + "\tadds r0, r6, 0x7\n" +"_0800768E:\n" + "\tasrs r2, r0, 3\n" + "\tadds r0, r1, r2\n" + "\tlsls r0, 5\n" + "\tldr r1, [r5, 0x18]\n" + "\tadds r3, r1, r0\n" + "\tlsls r0, r4, 3\n" + "\tmov r7, r10\n" + "\tsubs r0, r7, r0\n" + "\tlsls r0, 2\n" + "\tadds r3, r0\n" + "\tlsls r0, r2, 3\n" + "\tsubs r0, r6, r0\n" + "\tlsls r0, 4\n" + "\tldr r1, _0800788C\n" + "\tadds r0, r1\n" + "\tmov r12, r0\n" + "\tmov r9, r2\n" + "\tstr r4, [sp, 0x14]\n" + "\tmovs r1, 0x8\n" + "\tldrsh r0, [r5, r1]\n" + "\tcmp r4, r0\n" + "\tblt _080076BC\n" + "\tb _0800786C\n" +"_080076BC:\n" + "\tmovs r2, 0\n" + "\tstr r2, [sp, 0x10]\n" + "\tldr r2, _08007890\n" + "\tldr r1, _08007894\n" + "\tldr r0, [r1]\n" + "\tlsls r0, 2\n" + "\tadds r0, r2\n" + "\tldr r0, [r0]\n" + "\tldr r4, [sp, 0x10]\n" + "\tcmp r4, r0\n" + "\tblt _080076D4\n" + "\tb _0800786C\n" +"_080076D4:\n" + "\tldr r6, [sp, 0x4]\n" + "\tldrh r0, [r6, 0x2]\n" + "\tlsls r4, r0, 16\n" + "\tldrh r0, [r6]\n" + "\torrs r4, r0\n" + "\tldr r1, _08007898\n" + "\tands r1, r4\n" + "\tldr r0, [sp, 0x18]\n" + "\tands r0, r4\n" + "\tadds r2, r1, r0\n" + "\tldr r7, [sp, 0x1C]\n" + "\tcmp r7, 0\n" + "\tbeq _08007724\n" + "\tldr r1, [sp, 0xC]\n" + "\tldrh r0, [r1, 0x2]\n" + "\tlsls r0, 16\n" + "\tldrh r1, [r1]\n" + "\torrs r0, r1\n" + "\tlsls r1, r0, 4\n" + "\tmvns r6, r4\n" + "\tmov r8, r6\n" + "\tbics r1, r4\n" + "\tldr r7, _0800789C\n" + "\tldr r6, [r7]\n" + "\tands r1, r6\n" + "\torrs r2, r1\n" + "\tldr r0, [sp, 0x20]\n" + "\tcmp r0, 0\n" + "\tbeq _08007724\n" + "\tldr r1, [sp, 0x8]\n" + "\tldrh r0, [r1, 0x2]\n" + "\tlsls r0, 16\n" + "\tldrh r1, [r1]\n" + "\torrs r0, r1\n" + "\tlsls r1, r0, 4\n" + "\teors r1, r4\n" + "\tmov r4, r8\n" + "\tands r1, r4\n" + "\tands r1, r6\n" + "\torrs r2, r1\n" +"_08007724:\n" + "\tcmp r2, 0\n" + "\tbeq _08007776\n" + "\tmovs r6, 0x4\n" + "\tldrsh r0, [r5, r6]\n" + "\tcmp r9, r0\n" + "\tbge _08007750\n" + "\tmov r7, r12\n" + "\tldr r1, [r7]\n" + "\tands r1, r2\n" + "\tldr r0, [r7, 0x8]\n" + "\tlsls r1, r0\n" + "\tldr r0, [r3]\n" + "\torrs r0, r1\n" + "\tstr r0, [r3]\n" + "\tldr r0, [r5, 0x3C]\n" + "\tcmp r0, r3\n" + "\tbls _08007748\n" + "\tstr r3, [r5, 0x3C]\n" +"_08007748:\n" + "\tldr r0, [r5, 0x40]\n" + "\tcmp r0, r3\n" + "\tbcs _08007750\n" + "\tstr r3, [r5, 0x40]\n" +"_08007750:\n" + "\tmovs r1, 0x4\n" + "\tldrsh r0, [r5, r1]\n" + "\tsubs r0, 0x1\n" + "\tcmp r9, r0\n" + "\tbge _08007776\n" + "\tadds r3, 0x20\n" + "\tmov r4, r12\n" + "\tldr r0, [r4, 0x4]\n" + "\tands r2, r0\n" + "\tldr r0, [r4, 0xC]\n" + "\tlsrs r2, r0\n" + "\tldr r0, [r3]\n" + "\torrs r0, r2\n" + "\tstr r0, [r3]\n" + "\tldr r0, [r5, 0x40]\n" + "\tcmp r0, r3\n" + "\tbcs _08007774\n" + "\tstr r3, [r5, 0x40]\n" +"_08007774:\n" + "\tsubs r3, 0x20\n" +"_08007776:\n" + "\tldr r6, [sp, 0x4]\n" + "\tldrh r4, [r6, 0x4]\n" + "\tldr r1, _08007898\n" + "\tands r1, r4\n" + "\tldr r0, [sp, 0x18]\n" + "\tands r0, r4\n" + "\tadds r2, r1, r0\n" + "\tldr r7, [sp, 0x1C]\n" + "\tcmp r7, 0\n" + "\tbeq _080077CC\n" + "\tldr r1, [sp, 0xC]\n" + "\tldrh r0, [r1, 0x4]\n" + "\tlsls r1, r0, 4\n" + "\tldr r6, [sp, 0xC]\n" + "\tldrh r0, [r6, 0x2]\n" + "\tmovs r7, 0xF\n" + "\tmov r8, r7\n" + "\tlsrs r0, 12\n" + "\torrs r1, r0\n" + "\tmvns r0, r4\n" + "\tstr r0, [sp, 0x24]\n" + "\tbics r1, r4\n" + "\tldr r7, _0800789C\n" + "\tldr r6, [r7]\n" + "\tands r1, r6\n" + "\torrs r2, r1\n" + "\tldr r0, [sp, 0x20]\n" + "\tcmp r0, 0\n" + "\tbeq _080077CC\n" + "\tldr r1, [sp, 0x8]\n" + "\tldrh r0, [r1, 0x4]\n" + "\tlsls r1, r0, 4\n" + "\tldr r7, [sp, 0x8]\n" + "\tldrh r0, [r7, 0x2]\n" + "\tlsrs r0, 12\n" + "\tmov r7, r8\n" + "\tands r0, r7\n" + "\torrs r1, r0\n" + "\teors r1, r4\n" + "\tldr r0, [sp, 0x24]\n" + "\tands r1, r0\n" + "\tands r1, r6\n" + "\torrs r2, r1\n" +"_080077CC:\n" + "\tcmp r2, 0\n" + "\tbeq _0800781C\n" + "\tmovs r1, 0x4\n" + "\tldrsh r0, [r5, r1]\n" + "\tsubs r0, 0x1\n" + "\tcmp r9, r0\n" + "\tbge _080077F6\n" + "\tadds r3, 0x20\n" + "\tmov r4, r12\n" + "\tldr r1, [r4]\n" + "\tands r1, r2\n" + "\tldr r0, [r4, 0x8]\n" + "\tlsls r1, r0\n" + "\tldr r0, [r3]\n" + "\torrs r0, r1\n" + "\tstr r0, [r3]\n" + "\tldr r0, [r5, 0x40]\n" + "\tcmp r0, r3\n" + "\tbcs _080077F4\n" + "\tstr r3, [r5, 0x40]\n" +"_080077F4:\n" + "\tsubs r3, 0x20\n" +"_080077F6:\n" + "\tmovs r6, 0x4\n" + "\tldrsh r0, [r5, r6]\n" + "\tsubs r0, 0x2\n" + "\tcmp r9, r0\n" + "\tbge _0800781C\n" + "\tadds r3, 0x40\n" + "\tmov r7, r12\n" + "\tldr r0, [r7, 0x4]\n" + "\tands r2, r0\n" + "\tldr r0, [r7, 0xC]\n" + "\tlsrs r2, r0\n" + "\tldr r0, [r3]\n" + "\torrs r0, r2\n" + "\tstr r0, [r3]\n" + "\tldr r0, [r5, 0x40]\n" + "\tcmp r0, r3\n" + "\tbcs _0800781A\n" + "\tstr r3, [r5, 0x40]\n" +"_0800781A:\n" + "\tsubs r3, 0x40\n" +"_0800781C:\n" + "\tmovs r0, 0x1\n" + "\tstr r0, [sp, 0x20]\n" + "\tldr r1, [sp, 0x4]\n" + "\tadds r1, 0x6\n" + "\tstr r1, [sp, 0x4]\n" + "\tldr r2, [sp, 0x8]\n" + "\tadds r2, 0x6\n" + "\tstr r2, [sp, 0x8]\n" + "\tldr r4, [sp, 0xC]\n" + "\tadds r4, 0x6\n" + "\tstr r4, [sp, 0xC]\n" + "\tadds r3, 0x4\n" + "\tadd r10, r0\n" + "\tmovs r0, 0x7\n" + "\tmov r6, r10\n" + "\tands r0, r6\n" + "\tcmp r0, 0\n" + "\tbne _08007854\n" + "\tldr r0, [r5, 0x20]\n" + "\tlsls r0, 2\n" + "\tadds r3, r0\n" + "\tldr r7, [sp, 0x14]\n" + "\tadds r7, 0x1\n" + "\tstr r7, [sp, 0x14]\n" + "\tmovs r1, 0x8\n" + "\tldrsh r0, [r5, r1]\n" + "\tcmp r7, r0\n" + "\tbge _0800786C\n" +"_08007854:\n" + "\tldr r2, [sp, 0x10]\n" + "\tadds r2, 0x1\n" + "\tstr r2, [sp, 0x10]\n" + "\tldr r4, _08007894\n" + "\tldr r0, [r4]\n" + "\tlsls r0, 2\n" + "\tldr r6, _08007890\n" + "\tadds r0, r6\n" + "\tldr r0, [r0]\n" + "\tcmp r2, r0\n" + "\tbge _0800786C\n" + "\tb _080076D4\n" +"_0800786C:\n" + "\tldr r7, [sp]\n" + "\tmovs r1, 0x6\n" + "\tldrsh r0, [r7, r1]\n" + "\tldr r2, _080078A0\n" + "\tmovs r3, 0\n" + "\tldrsh r1, [r2, r3]\n" + "\tadds r0, r1\n" + "\tadd sp, 0x28\n" + "\tpop {r3-r5}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tmov r10, r5\n" + "\tpop {r4-r7}\n" + "\tpop {r1}\n" + "\tbx r1\n" + "\t.align 2, 0\n" +"_0800788C: .4byte gUnknown_80B85DC\n" +"_08007890: .4byte gUnknown_202B028\n" +"_08007894: .4byte gCurrentCharmap\n" +"_08007898: .4byte 0x11111111\n" +"_0800789C: .4byte gUnknown_202B030\n" +"_080078A0: .4byte gCharacterSpacing"); +} + +void sub_80078A4(u32 a0, s32 x, s32 y, s32 a3, u32 color) +{ + sub_800792C(a0, x, y, a3, color); + sub_800792C(a0, x, y + 1, a3, gUnknown_202B030 & 0xF); +} + +// Unused +void sub_80078E8(u32 a0, s32 x, s32 y, s32 a3, u32 color) +{ + nullsub_129(a0, x, y, a3, color); + nullsub_129(a0, x, y + 1, a3, gUnknown_202B030 & 0xF); +} + +void sub_800792C(u32 a0, s32 x, s32 y, s32 a3, u32 color) +{ + sub_8007958(gUnknown_2027370, a0, x, y, a3, color); +} + +void nullsub_129(u32 a0, s32 x, s32 y, s32 a3, u32 color) +{ +} + +void sub_8007958(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, u32 color) +{ + u32 uVar4; + u32 *dest; + s32 r4; + const struct unkShiftData *shiftData; + struct UnkTextStruct1 *r5; + s32 r6; + u32 r9; + struct unkStruct_80B8824 dataLOL; + s32 lol; + + r5 = &a0[a1]; + r9 = gUnknown_80B853C[color & 0xF]; + + r4 = y / 8; + + dest = r5->unk18 + (((r5->unk4 * r4) + (x / 8)) * 8); + dest += (r4 * -8) + y; + r6 = x / 8; + + if (y / 8 >= r5->unk8) + return; + + dataLOL = gUnknown_80B8824; + + for (; a4 > 0; a4 -= 8) { + lol = a4; + if (lol > 7) + lol = 8; + + shiftData = &gUnknown_80B85DC[x + (x / 8 * -8)]; + + uVar4 = dataLOL.arr[lol]; + uVar4 = (uVar4 & 0x11111111) + (uVar4 & r9); + + if (uVar4 != 0) { + if (r6 < r5->unk4) { + dest[0] |= (shiftData->bytesA & uVar4) << shiftData->shift_left; + + if (r5->unk3C > dest) + r5->unk3C = dest; + if (r5->unk40 < dest) + r5->unk40 = dest; + } + + if (r6 < r5->unk4 - 1) { + dest += 8; + dest[0] |= (uVar4 & shiftData->bytesB) >> shiftData->shift_right; + + if (r5->unk40 < dest) + r5->unk40 = dest; + dest -= 8; + } + } + + r6++; + dest += 8; + } +} + +void sub_8007A78(u32 a0, s32 x, s32 y, s32 a3, u32 color) +{ + sub_8007AA4(gUnknown_2027370, a0, x, y, a3, color); +} + +// Unused +void nullsub_157(void) +{ +} + +// https://decomp.me/scratch/4tFKb +void sub_8007AA4(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, u32 color) +{ + s32 r2; + s32 r3; + struct UnkTextStruct1 *r4; + u32 ip; + u32 *dest; + struct unkStruct_80B8848 dataLOL; + + r4 = &a0[a1]; + ip = gUnknown_80B853C[color & 0xF] + 0x11111111; + #ifndef NONMATCHING + asm("":::"r8"); + #endif // NONMATCHING + dataLOL = gUnknown_80B8848; + a4++; a4--; + r3 = y / 8; + + dest = r4->unk18 + ((r4->unk4 * r3 + x / 8) * 8); + r2 = x / 8; + dest += r3 * -8 + y; + ip &= dataLOL.arr[x & 7]; + + if (r2 >= r4->unk4) + return; + goto thecheck; +label: + y++; + dest++; + if ((y % 8) == 0) + dest += r4->unk20; + a4--; +thecheck: + if (a4 <= 0 || r3 >= r4->unk8) + return; + + dest[0] |= ip; + + if (r4->unk3C > dest) + r4->unk3C = dest; + if (r4->unk40 < dest) + r4->unk40 = dest; + goto label; +} + +void sub_8007B7C(u32 a0, s32 x, s32 y, s32 a3, u32 color) +{ + sub_8007BA8(gUnknown_2027370, a0, x, y, a3, color); +} + +// Unused +void nullsub_158(void) +{ +} + +#if NONMATCHING // https://decomp.me/scratch/AU1bH +void sub_8007BA8(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color) +{ + s32 iVar1; // r1 + s32 iVar3; + s32 iVar9; // r8? + + u32 *r4; + u32 r5; + u32 r6; + struct UnkTextStruct1 *ip; + s32 sp4; + s32 sp8; + u32 sp1C; // Used correctly + + s32 yeah; + u32 *sp10; // r2? + + ip = &a0[a1]; + + sp8 = y / 8; + + if (sp8 >= ip->unk8) + return; + + yeah = ip->unk4 * sp8; + + r4 = ip->unk18 + ((yeah + x / 8) * 8); + r4 += (sp8 * -8) + y; + + for (sp4 = 0; sp4 < color; sp4++) { + sp10 = r4; + iVar1 = x / 8; + + for (iVar9 = 0; iVar9 < a4; iVar9 += 8) { + if (iVar1 >= ip->unk4) + break; + + r6 = 0xF0000000; + r5 = 0xE0000000; + sp1C = 0; + + for (iVar3 = 0; iVar3 < 8; iVar3++) { + if ((sp10[0] & r6) == 0) + sp1C |= r5; + + r6 >>= 4; + r5 >>= 4; + } + + sp10[0] |= sp1C; + if (ip->unk3C > sp10) + ip->unk3C = sp10; + if (ip->unk40 < sp10) + ip->unk40 = sp10; + sp10 += 8; + iVar1++; + } + + y++; + r4++; + if ((y % 8) == 0) { + r4 += ip->unk20; + sp8++; + if (sp8 >= ip->unk8) + return; + } + + sp4++; + } +} +#else +NAKED +void sub_8007BA8(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color) +{ + asm_unified( + "push {r4-r7,lr}\n" + "\tmov r7, r10\n" + "\tmov r6, r9\n" + "\tmov r5, r8\n" + "\tpush {r5-r7}\n" + "\tsub sp, 0x20\n" + "\tstr r2, [sp]\n" + "\tlsls r2, r1, 3\n" + "\tadds r2, r1\n" + "\tlsls r2, 3\n" + "\tadds r0, r2\n" + "\tmov r12, r0\n" + "\tadds r0, r3, 0\n" + "\tcmp r3, 0\n" + "\tbge _08007BC8\n" + "\tadds r0, r3, 0x7\n" +"_08007BC8:\n" + "\tasrs r0, 3\n" + "\tstr r0, [sp, 0x8]\n" + "\tmov r1, r12\n" + "\tmovs r2, 0x8\n" + "\tldrsh r0, [r1, r2]\n" + "\tldr r4, [sp, 0x8]\n" + "\tcmp r4, r0\n" + "\tbge _08007CC4\n" + "\tmovs r7, 0x4\n" + "\tldrsh r0, [r1, r7]\n" + "\tadds r1, r4, 0\n" + "\tmuls r1, r0\n" + "\tldr r0, [sp]\n" + "\tcmp r0, 0\n" + "\tbge _08007BE8\n" + "\tadds r0, 0x7\n" +"_08007BE8:\n" + "\tasrs r0, 3\n" + "\tadds r0, r1, r0\n" + "\tlsls r0, 5\n" + "\tmov r2, r12\n" + "\tldr r1, [r2, 0x18]\n" + "\tadds r4, r1, r0\n" + "\tldr r7, [sp, 0x8]\n" + "\tlsls r0, r7, 3\n" + "\tsubs r0, r3, r0\n" + "\tlsls r0, 2\n" + "\tadds r4, r0\n" + "\tmovs r0, 0\n" + "\tstr r0, [sp, 0x4]\n" + "\tldr r1, [sp, 0x44]\n" + "\tcmp r0, r1\n" + "\tbge _08007CC4\n" +"_08007C08:\n" + "\tadds r2, r4, 0\n" + "\tldr r0, [sp]\n" + "\tcmp r0, 0\n" + "\tbge _08007C12\n" + "\tadds r0, 0x7\n" +"_08007C12:\n" + "\tasrs r1, r0, 3\n" + "\tmovs r7, 0\n" + "\tmov r8, r7\n" + "\tadds r3, 0x1\n" + "\tstr r3, [sp, 0xC]\n" + "\tadds r4, 0x4\n" + "\tstr r4, [sp, 0x14]\n" + "\tldr r0, [sp, 0x40]\n" + "\tcmp r8, r0\n" + "\tbge _08007C94\n" +"_08007C26:\n" + "\tmov r3, r12\n" + "\tmovs r4, 0x4\n" + "\tldrsh r0, [r3, r4]\n" + "\tcmp r1, r0\n" + "\tbge _08007C94\n" + "\tmovs r6, 0xF0\n" + "\tlsls r6, 24\n" + "\tmovs r5, 0xE0\n" + "\tlsls r5, 24\n" + "\tmovs r7, 0\n" + "\tstr r7, [sp, 0x1C]\n" + "\tldr r4, [r2]\n" + "\tadds r3, r4, 0\n" + "\tmov r0, r12\n" + "\tldr r0, [r0, 0x3C]\n" + "\tmov r9, r0\n" + "\tmov r7, r12\n" + "\tldr r7, [r7, 0x40]\n" + "\tmov r10, r7\n" + "\tadds r1, 0x1\n" + "\tstr r1, [sp, 0x10]\n" + "\tadds r0, r2, 0\n" + "\tadds r0, 0x20\n" + "\tstr r0, [sp, 0x18]\n" + "\tmovs r1, 0x8\n" + "\tadd r8, r1\n" + "\tmovs r1, 0x7\n" +"_08007C5C:\n" + "\tadds r0, r4, 0\n" + "\tands r0, r6\n" + "\tcmp r0, 0\n" + "\tbne _08007C6A\n" + "\tldr r7, [sp, 0x1C]\n" + "\torrs r7, r5\n" + "\tstr r7, [sp, 0x1C]\n" +"_08007C6A:\n" + "\tlsrs r6, 4\n" + "\tlsrs r5, 4\n" + "\tsubs r1, 0x1\n" + "\tcmp r1, 0\n" + "\tbge _08007C5C\n" + "\tldr r0, [sp, 0x1C]\n" + "\torrs r3, r0\n" + "\tstr r3, [r2]\n" + "\tcmp r9, r2\n" + "\tbls _08007C82\n" + "\tmov r1, r12\n" + "\tstr r2, [r1, 0x3C]\n" +"_08007C82:\n" + "\tcmp r10, r2\n" + "\tbcs _08007C8A\n" + "\tmov r3, r12\n" + "\tstr r2, [r3, 0x40]\n" +"_08007C8A:\n" + "\tldr r1, [sp, 0x10]\n" + "\tldr r2, [sp, 0x18]\n" + "\tldr r4, [sp, 0x40]\n" + "\tcmp r8, r4\n" + "\tblt _08007C26\n" +"_08007C94:\n" + "\tldr r3, [sp, 0xC]\n" + "\tldr r4, [sp, 0x14]\n" + "\tmovs r0, 0x7\n" + "\tands r0, r3\n" + "\tcmp r0, 0\n" + "\tbne _08007CB8\n" + "\tmov r7, r12\n" + "\tldr r0, [r7, 0x20]\n" + "\tlsls r0, 2\n" + "\tadds r4, r0\n" + "\tldr r0, [sp, 0x8]\n" + "\tadds r0, 0x1\n" + "\tstr r0, [sp, 0x8]\n" + "\tmovs r1, 0x8\n" + "\tldrsh r0, [r7, r1]\n" + "\tldr r2, [sp, 0x8]\n" + "\tcmp r2, r0\n" + "\tbge _08007CC4\n" +"_08007CB8:\n" + "\tldr r7, [sp, 0x4]\n" + "\tadds r7, 0x1\n" + "\tstr r7, [sp, 0x4]\n" + "\tldr r0, [sp, 0x44]\n" + "\tcmp r7, r0\n" + "\tblt _08007C08\n" +"_08007CC4:\n" + "\tadd sp, 0x20\n" + "\tpop {r3-r5}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tmov r10, r5\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0"); +} +#endif // NONMATCHING + +// Unused +void sub_8007CD4(u32 a0, s32 a1, s32 a2, s32 a3, s32 a4) +{ + sub_8007D00(gUnknown_2027370, a0, a1, a2, a3, a4); +} + +// Unused +void nullsub_159(void) +{ +} + +NAKED // Very similar to sub_8007BA8 +void sub_8007D00(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color) +{ + asm_unified( + "push {r4-r7,lr}\n" + "\tmov r7, r10\n" + "\tmov r6, r9\n" + "\tmov r5, r8\n" + "\tpush {r5-r7}\n" + "\tsub sp, 0x20\n" + "\tstr r2, [sp]\n" + "\tlsls r2, r1, 3\n" + "\tadds r2, r1\n" + "\tlsls r2, 3\n" + "\tadds r0, r2\n" + "\tmov r12, r0\n" + "\tadds r0, r3, 0\n" + "\tcmp r3, 0\n" + "\tbge _08007D20\n" + "\tadds r0, r3, 0x7\n" +"_08007D20:\n" + "\tasrs r0, 3\n" + "\tstr r0, [sp, 0x8]\n" + "\tmov r1, r12\n" + "\tmovs r2, 0x8\n" + "\tldrsh r0, [r1, r2]\n" + "\tldr r4, [sp, 0x8]\n" + "\tcmp r4, r0\n" + "\tbge _08007E0E\n" + "\tmovs r5, 0x4\n" + "\tldrsh r0, [r1, r5]\n" + "\tadds r1, r4, 0\n" + "\tmuls r1, r0\n" + "\tldr r0, [sp]\n" + "\tcmp r0, 0\n" + "\tbge _08007D40\n" + "\tadds r0, 0x7\n" +"_08007D40:\n" + "\tasrs r0, 3\n" + "\tadds r0, r1, r0\n" + "\tlsls r0, 5\n" + "\tmov r2, r12\n" + "\tldr r1, [r2, 0x18]\n" + "\tadds r4, r1, r0\n" + "\tldr r5, [sp, 0x8]\n" + "\tlsls r0, r5, 3\n" + "\tsubs r0, r3, r0\n" + "\tlsls r0, 2\n" + "\tadds r4, r0\n" + "\tmovs r0, 0\n" + "\tb _08007E06\n" +"_08007D5A:\n" + "\tadds r2, r4, 0\n" + "\tldr r0, [sp]\n" + "\tcmp r0, 0\n" + "\tbge _08007D64\n" + "\tadds r0, 0x7\n" +"_08007D64:\n" + "\tasrs r1, r0, 3\n" + "\tmovs r5, 0\n" + "\tmov r8, r5\n" + "\tadds r3, 0x1\n" + "\tstr r3, [sp, 0xC]\n" + "\tadds r4, 0x4\n" + "\tstr r4, [sp, 0x14]\n" + "\tldr r0, [sp, 0x40]\n" + "\tcmp r8, r0\n" + "\tbge _08007DE0\n" +"_08007D78:\n" + "\tmov r3, r12\n" + "\tmovs r4, 0x4\n" + "\tldrsh r0, [r3, r4]\n" + "\tcmp r1, r0\n" + "\tbge _08007DE0\n" + "\tmovs r4, 0xF0\n" + "\tlsls r4, 24\n" + "\tmovs r6, 0xE0\n" + "\tlsls r6, 24\n" + "\tmovs r7, 0\n" + "\tldr r5, [r2]\n" + "\tstr r5, [sp, 0x1C]\n" + "\tadds r3, r5, 0\n" + "\tmov r0, r12\n" + "\tldr r0, [r0, 0x3C]\n" + "\tmov r9, r0\n" + "\tmov r5, r12\n" + "\tldr r5, [r5, 0x40]\n" + "\tmov r10, r5\n" + "\tadds r1, 0x1\n" + "\tstr r1, [sp, 0x10]\n" + "\tadds r0, r2, 0\n" + "\tadds r0, 0x20\n" + "\tstr r0, [sp, 0x18]\n" + "\tmovs r1, 0x8\n" + "\tadd r8, r1\n" + "\tmovs r1, 0x7\n" +"_08007DAE:\n" + "\tldr r0, [sp, 0x1C]\n" + "\tands r0, r4\n" + "\tcmp r0, r6\n" + "\tbne _08007DB8\n" + "\torrs r7, r4\n" +"_08007DB8:\n" + "\tlsrs r4, 4\n" + "\tlsrs r6, 4\n" + "\tsubs r1, 0x1\n" + "\tcmp r1, 0\n" + "\tbge _08007DAE\n" + "\tbics r3, r7\n" + "\tstr r3, [r2]\n" + "\tcmp r9, r2\n" + "\tbls _08007DCE\n" + "\tmov r3, r12\n" + "\tstr r2, [r3, 0x3C]\n" +"_08007DCE:\n" + "\tcmp r10, r2\n" + "\tbcs _08007DD6\n" + "\tmov r4, r12\n" + "\tstr r2, [r4, 0x40]\n" +"_08007DD6:\n" + "\tldr r1, [sp, 0x10]\n" + "\tldr r2, [sp, 0x18]\n" + "\tldr r5, [sp, 0x40]\n" + "\tcmp r8, r5\n" + "\tblt _08007D78\n" +"_08007DE0:\n" + "\tldr r3, [sp, 0xC]\n" + "\tldr r4, [sp, 0x14]\n" + "\tmovs r0, 0x7\n" + "\tands r0, r3\n" + "\tcmp r0, 0\n" + "\tbne _08007E02\n" + "\tmov r1, r12\n" + "\tldr r0, [r1, 0x20]\n" + "\tlsls r0, 2\n" + "\tadds r4, r0\n" + "\tldr r2, [sp, 0x8]\n" + "\tadds r2, 0x1\n" + "\tstr r2, [sp, 0x8]\n" + "\tmovs r5, 0x8\n" + "\tldrsh r0, [r1, r5]\n" + "\tcmp r2, r0\n" + "\tbge _08007E0E\n" +"_08007E02:\n" + "\tldr r0, [sp, 0x4]\n" + "\tadds r0, 0x1\n" +"_08007E06:\n" + "\tstr r0, [sp, 0x4]\n" + "\tldr r1, [sp, 0x44]\n" + "\tcmp r0, r1\n" + "\tblt _08007D5A\n" +"_08007E0E:\n" + "\tadd sp, 0x20\n" + "\tpop {r3-r5}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tmov r10, r5\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0"); +} + +void sub_8007E20(u32 a0, u32 a1, u32 a2, u32 a3, u32 a4, u8 *a5, u32 a6) +{ + sub_8007E64(gUnknown_2027370, &gUnknown_202B038[0][0][0], a0, a1, a2, a3, a4, a5, a6); +} + +// Unused +void nullsub_160(void) +{ +} \ No newline at end of file diff --git a/src/text_1.c b/src/text_1.c deleted file mode 100644 index 657a80ba..00000000 --- a/src/text_1.c +++ /dev/null @@ -1,127 +0,0 @@ -#include "global.h" -#include "text.h" - -extern struct UnkTextStruct2 gUnknown_202AFC0[4]; -extern u32 gUnknown_80B8814[]; - -extern void sub_800677C(struct UnkTextStruct1 *, s32, u16 *, u8); -extern void sub_80069CC(struct UnkTextStruct1 *, s32, s32, s32, u16 *); -extern void sub_8006AC4(struct UnkTextStruct1 *, s32, s32, u32, u16 *); -extern void sub_8006B70(struct UnkTextStruct1 *, s32, s32, s32, u16 *); -extern void sub_8006C44(struct UnkTextStruct1 *, s32, u16 *, u8); -extern void sub_8006E94(struct UnkTextStruct1 *, s32, u32, const u8 *, u16 *); -extern void sub_8008C6C(struct UnkTextStruct1 *, u32); - -void nullsub_152(void) -{ -} - -void sub_8006518(struct UnkTextStruct2 *unkData) -{ - s32 iVar2; - for (iVar2 = 0; iVar2 < 4; iVar2++) - unkData[iVar2] = gUnknown_202AFC0[iVar2]; -} - -void nullsub_153(void) -{ -} - -u32 sub_8006544(u32 index) -{ - return gUnknown_80B8814[index]; -} - -// a1 is a VRAM pointer -void sub_8006554(struct UnkTextStruct1 *a0, void *a1, u8 *a2, u16 *a3, u32 a4, const struct UnkTextStruct2 *a5, u8 a6, u32 a7, struct UnkTextStruct2_sub *a8, u8 a9) -{ - struct UnkTextStruct1 *t1; - s32 iVar3; - s32 iVar5; - s32 iVar6; - s32 numI; - u32 uVar1; - - s32 temp; - s32 i; - s32 j; - - t1 = &a0[a4]; - iVar3 = a5->unk8.unk0.arr[0] + a8->unk0.arr[0]; - iVar5 = a5->unk8.unk0.arr[1] + a8->unk0.arr[1]; - t1->unk0 = iVar3; - t1->unk2 = iVar5; - t1->unk4 = a5->unkC; - t1->unk8 = a5->unk10; - t1->unk6 = a5->unkE; - t1->unkC = a5->unk4; - t1->unk10 = a7; - - if (t1->unkC == 6) - t1->unk14 = a7; - else - t1->unk14 = a7 + a5->unk12 * t1->unk4; - - t1->unk18 = &a2[t1->unk10 * 0x20]; - t1->unk1C = &a2[t1->unk14 * 0x20]; - t1->unk24 = a5->unk12; - t1->unk28 = a1 + (t1->unk14 * 0x20); - - if (t1->unkC == 6) - t1->unk2C = t1->unk4 * (t1->unk6 + a5->unk12) * 32; - else - t1->unk2C = t1->unk4 * t1->unk6 * 32; - - t1->unk30 = 0; - t1->unk34 = 0; - t1->unk38 = 0; - t1->unk20 = (t1->unk4 * 8) - 8; - t1->unk45 = t1->unkC == 0; - - if (t1->unk8 == 0) - return; - - if ((a5->unk0 & 0xA0) != 0x80) { - temp = iVar5 - 1; - - if (t1->unkC == 6) { - uVar1 = (a6 != 0) ? t1->unk14 : 0; - - sub_8006E94(t1, temp, uVar1, a5->unk14, a3); - - temp = iVar5 + 2; - uVar1 = (a6 != 0) ? t1->unk14 + t1->unk4 * (a5->unk12 + 2) : 0; - numI = t1->unk6 - 2; - } - else { - sub_800677C(t1, temp, a3, a9); - - temp = iVar5; - uVar1 = (a6 != 0) ? t1->unk14 : 0; - numI = t1->unk6; - } - - for (i = 0; i < numI; i++) { - iVar6 = iVar3 - 1; - sub_80069CC(t1, iVar6, temp, i, a3); - iVar6 = iVar3; - - for (j = 0; j < t1->unk4; j++) { - sub_8006AC4(t1, iVar6, temp, uVar1, a3); - - iVar6++; - if (a6 != 0) - uVar1++; - } - - sub_8006B70(t1, iVar6, temp, i, a3); - temp++; - } - sub_8006C44(t1, temp, a3, a9); - } - - if ((a5->unk0 & 0x80) == 0) - sub_8008C6C(a0, a4); - - t1->unk46 = 0; -} \ No newline at end of file diff --git a/src/thank_you_wonder_mail.c b/src/thank_you_wonder_mail.c index d2ce2dc6..3efd5c73 100644 --- a/src/thank_you_wonder_mail.c +++ b/src/thank_you_wonder_mail.c @@ -2,19 +2,21 @@ #include "constants/communication_error_codes.h" #include "save.h" #include "pokemon.h" -#include "file_system.h" #include "item.h" #include "code_8094F88.h" #include "wonder_mail.h" #include "memory.h" -#include "menu.h" -#include "input.h" #include "rescue_password_menu.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "text_util.h" #include "team_inventory.h" #include "code_800D090.h" #include "menu_input.h" +#include "code_80130A8.h" +#include "main_menu.h" +#include "code_801C620.h" +#include "code_801B3C0.h" extern struct WonderMailStruct_203B2C4 *gUnknown_203B2C4; @@ -156,14 +158,10 @@ const struct MenuItem gUnknown_80DEEE4[4] = #include "data/thank_you_wonder_mail.h" -extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32); -extern void sub_8014248(const char *r0, u32, u32, const struct MenuItem *r4, u32, u32, u32, struct OpenedFile **r5, u32); -extern void sub_8035CC0(struct UnkTextStruct2 *r0, u32); extern void sub_8030810(u32); extern u32 sub_8031DCC(void); extern void sub_8031E00(void); extern u32 sub_802F298(); -extern u8 sub_801CF14(u32); extern u32 sub_8030768(u32); extern s8 sub_80307EC(void); extern void sub_8030D40(u8, u32); @@ -209,21 +207,16 @@ extern void sub_802A9FC(); extern void sub_802A828(); extern void sub_802A850(); extern void sub_8030DE4(); -extern void sub_801B450(); extern void sub_803084C(); -extern void sub_801CBB8(); extern void sub_80155F0(); extern void sub_8031E10(); extern void sub_802F2C0(); -extern u32 sub_80144A4(s32 *r0); extern void SetThankYouMailMenuState(u32); extern struct PokemonStruct *GetPlayerPokemonStruct(void); -extern void SetMenuItems(struct MenuStruct *menu, struct UnkTextStruct2 *, u32, const struct UnkTextStruct2 *, const struct MenuItem *entries, u32, u32, u32); extern void sub_802F204(struct unkStruct_802F204 *, u32); extern void sub_80151C0(u32, u8 *); extern void xxx_call_start_bg_music(void); extern void sub_803092C(void); -extern void sub_801CCD8(void); extern void sub_8011830(void); extern void nullsub_23(u32); extern s32 sub_8037B28(u32); @@ -232,21 +225,11 @@ extern u32 sub_801D008(void); extern void sub_80306A8(u32, u32, u32, u32); extern s32 sub_8037D64(u32, void *, void *); extern s32 sub_80381F4(u32, void *, void *); -extern void sub_801C8C4(u32, u32, s32 * , u32); extern u8 sub_800D588(void); extern u32 GetDungeonTeamRankPts(struct DungeonLocation *, u32); extern void sub_8031D70(u8, u32); extern void sub_803092C(void); -extern void sub_8035CF4(struct MenuStruct *, u32, u32); -extern u32 sub_801CA08(u32); -extern void sub_801CBB8(void); -extern void sub_801B3C0(struct Item *); -extern u8 sub_801CB24(void); -extern void sub_801B450(void); -extern u32 sub_801B410(void); -extern void sub_801CB5C(u32); -extern void sub_801CCD8(void); extern void sub_8011C28(u32); extern u32 sub_80154F0(void); extern u32 sub_8039068(u32, u8 *r1, struct unkStruct_203B480 *r0); @@ -658,7 +641,7 @@ void sub_802A230(void) sub_800641C(gUnknown_203B2C4->unk3BC, 1, 1); sub_803092C(); if (gUnknown_203B2C4->fallbackState == 0x2b) { - sub_8035CF4(gUnknown_203B2C4->unk21C, 3, 1); + sub_8035CF4(gUnknown_203B2C4->unk21C, 3, TRUE); SetThankYouMailMenuState(0x11); } else { @@ -677,7 +660,7 @@ void sub_802A28C(void) gUnknown_203B2C4->unk41C.quantity = 1; gUnknown_203B2C4->unk41C.flags = 0; - switch(sub_801CA08(1)) + switch(sub_801CA08(TRUE)) { case 2: sub_801CBB8(); @@ -708,9 +691,9 @@ void sub_802A33C(void) sub_801B450(); ResetUnusedInputStruct(); sub_800641C(gUnknown_203B2C4->unk3BC,1,1); - sub_801CB5C(1); + sub_801CB5C(TRUE); if (gUnknown_203B2C4->fallbackState == 0x2b) { - sub_8035CF4(gUnknown_203B2C4->unk21C,3,1); + sub_8035CF4(gUnknown_203B2C4->unk21C,3,TRUE); SetThankYouMailMenuState(0x14); } else { @@ -728,7 +711,7 @@ void sub_802A39C(void) s32 menuAction; menuAction = -1; - sub_801CA08(0); + sub_801CA08(FALSE); if (sub_8012FD8(&gUnknown_203B2C4->unk21C[3]) == 0) { sub_8013114(&gUnknown_203B2C4->unk21C[3], &menuAction); } @@ -1048,7 +1031,7 @@ void sub_802A910(void) switch(menuAction) { case 9: - if(sub_801CF14(0) != 0) + if(sub_801CF14(0)) { SetThankYouMailMenuState(THANK_YOU_MAIL_STORAGE_EMPTY); } @@ -1300,24 +1283,23 @@ void UpdateThankYouMailText(void) sub_8006518(gUnknown_203B2C4->unk35C); SetMenuItems(gUnknown_203B2C4->unk21C,gUnknown_203B2C4->unk35C,3,&gUnknown_80DED60,gUnknown_80DED78,1,0,0); sub_803092C(); - sub_8035CF4(gUnknown_203B2C4->unk21C,3,1); + sub_8035CF4(gUnknown_203B2C4->unk21C,3,TRUE); break; case 0x13: if (sub_801D008() != 0) break; ResetUnusedInputStruct(); sub_800641C(0,1,1); - // TODO: Probably a macro - Pika { - struct {u16 a; u16 b;} local_x = {3, 2}; - sub_801C8C4(0, 1, (s32 *)&local_x, 9); + struct UnkTextStruct2_sub local_x = {3, 2}; + sub_801C8C4(0, 1, &local_x, 9); } break; case 0x14: sub_8006518(gUnknown_203B2C4->unk35C); SetMenuItems(gUnknown_203B2C4->unk21C,gUnknown_203B2C4->unk35C,3,&gUnknown_80DED48,gUnknown_80DED78,1,0,0); sub_801CCD8(); - sub_8035CF4(gUnknown_203B2C4->unk21C,3,1); + sub_8035CF4(gUnknown_203B2C4->unk21C,3,TRUE); break; case THANK_YOU_MAIL_COMMS_FINISHED: gUnknown_203B2C4->linkError = COMMS_GOOD; diff --git a/src/trade_items_menu.c b/src/trade_items_menu.c index 09c6dbcf..d1a7ab5a 100644 --- a/src/trade_items_menu.c +++ b/src/trade_items_menu.c @@ -1,15 +1,17 @@ #include "global.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" +#include "code_801C620.h" #include "constants/communication_error_codes.h" -#include "input.h" #include "item.h" #include "main_menu.h" #include "team_inventory.h" #include "trade_items_menu.h" #include "memory.h" #include "save.h" -#include "menu.h" #include "menu_input.h" -#include "text.h" +#include "text1.h" +#include "text2.h" EWRAM_DATA_2 struct TradeItemsMenu *gTradeItemsMenu = {0}; @@ -81,34 +83,11 @@ const struct MenuItem gUnknown_80E618C[3] = { #include "data/trade_items.h" -extern void sub_8013AA0(u32 *); - extern void sub_8035C1C(); -extern s32 sub_80144A4(s32 *); -extern u32 sub_801CA08(u32); -extern void sub_801CBB8(); -extern u8 sub_801CB24(); -extern void sub_801B3C0(struct Item *); -extern void sub_8035CC0(struct UnkTextStruct2 *, u32); -extern void sub_801CCD8(); -extern u32 sub_801B410(); -extern void sub_801B450(); -extern void sub_801CB5C(u32); -extern void sub_8035CF4(struct MenuStruct *, u32, u32); -extern u32 sub_8013BBC(u32 *); -extern void sub_80141B4(const u8 *, u32, u32, u32); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_8013C68(u32 *); -extern void sub_80073E0(u32); -extern u8 sub_801CF14(u32); extern u32 sub_801D008(); -extern void sub_801C8C4(u32, u32, s32 *, u32); extern s32 sub_8037B28(u32); extern void sub_8011830(void); -extern void sub_8014248(const char *r0, u32, u32, const struct MenuItem *r4, u32, u32, u32, void *r5, u32); -extern void SetMenuItems(struct MenuStruct *menu, struct UnkTextStruct2 *, u32, const struct UnkTextStruct2 *, const struct MenuItem *entries, u32, u32, u32); extern void nullsub_23(u32); extern void xxx_call_start_bg_music(void); extern s32 sub_80381F4(u32, void *, void *); @@ -280,7 +259,7 @@ void sub_80365AC(void) gTradeItemsMenu->itemToSend.id = ITEM_NOTHING; gTradeItemsMenu->itemToSend.quantity = 1; gTradeItemsMenu->itemToSend.flags = 0; - switch(sub_801CA08(1)){ + switch(sub_801CA08(TRUE)){ case 2: // Cancel sub_801CBB8(); @@ -310,7 +289,7 @@ void sub_8036674(void) int menuAction; menuAction = -1; - sub_801CA08(0); + sub_801CA08(FALSE); if (sub_8012FD8(&gTradeItemsMenu->unk44[3]) == '\0') { sub_8013114(&gTradeItemsMenu->unk44[3], &menuAction); } @@ -345,9 +324,9 @@ void sub_8036728(void) sub_801B450(); ResetUnusedInputStruct(); sub_800641C(gTradeItemsMenu->unk1E4, 1, 1); - sub_801CB5C(1); + sub_801CB5C(TRUE); if (gTradeItemsMenu->fallbackState == 0x13) { - sub_8035CF4(gTradeItemsMenu->unk44, 3, 1); + sub_8035CF4(gTradeItemsMenu->unk44, 3, TRUE); SetTradeItemMenu(TRADE_ITEMS_SEND_ITEM_POPUP_MENU); } else { @@ -362,19 +341,19 @@ void sub_8036728(void) void sub_8036788(void) { sub_8012FD8(&gTradeItemsMenu->unk44[3]); - sub_801CA08(0); + sub_801CA08(FALSE); switch(sub_8013BBC(&gTradeItemsMenu->quantityToSend)){ case 1: // When you change the # sub_801CCD8(); - sub_8035CF4(gTradeItemsMenu->unk44, 3, 0); + sub_8035CF4(gTradeItemsMenu->unk44, 3, FALSE); sub_8036F30(); break; case 2: // If you back out of the # selection sub_8035CC0(gTradeItemsMenu->unk184, 2); sub_801CCD8(); - sub_8035CF4(gTradeItemsMenu->unk44, 3, 1); + sub_8035CF4(gTradeItemsMenu->unk44, 3, TRUE); SetTradeItemMenu(TRADE_ITEMS_SEND_ITEM_POPUP_MENU); break; case 3: @@ -602,7 +581,6 @@ void nullsub_52(void) void sub_8036B28(void) { int linkStatus; - s32 local_10; u32 load_2; struct TradeSubStruct *temp; struct TradeSubStruct *temp2; @@ -613,7 +591,7 @@ void sub_8036B28(void) switch(gTradeItemsMenu->currMenu) { case TRADE_ITEMS_MAIN_MENU: - if (sub_801CF14(0) != 0) { + if (sub_801CF14(0)) { sub_8014248(gUnknown_80E61A4,0,1,gUnknown_80E60D4,0,4,0,0,0x101); } else { @@ -627,8 +605,10 @@ void sub_8036B28(void) if (sub_801D008() == 0) { ResetUnusedInputStruct(); sub_800641C(0,1,1); - local_10 = 0x20003; + { + struct UnkTextStruct2_sub local_10 = {3, 2}; sub_801C8C4(0,1,&local_10,9); + } } break; case TRADE_ITEMS_SEND_ITEM_POPUP_MENU: @@ -636,7 +616,7 @@ void sub_8036B28(void) SetMenuItems(gTradeItemsMenu->unk44,gTradeItemsMenu->unk184,3,&gUnknown_80E60EC, gUnknown_80E6104,1,0,0); sub_801CCD8(); - sub_8035CF4(gTradeItemsMenu->unk44,3,1); + sub_8035CF4(gTradeItemsMenu->unk44,3,TRUE); break; case TRADE_ITEMS_SEND_ITEM_NUMBER: sub_8036F74(); @@ -792,7 +772,7 @@ void sub_8036F74(void) sub_8006518(gTradeItemsMenu->unk184); sub_8036ECC(2, gTeamInventoryRef->teamStorage[gTradeItemsMenu->itemToSend.id]); sub_801CCD8(); - sub_8035CF4(gTradeItemsMenu->unk44, 3, 0); + sub_8035CF4(gTradeItemsMenu->unk44, 3, FALSE); sub_8036F30(); } diff --git a/src/unk_menu_203B360.c b/src/unk_menu_203B360.c index deb645bb..aec1f797 100644 --- a/src/unk_menu_203B360.c +++ b/src/unk_menu_203B360.c @@ -3,7 +3,7 @@ #include "main_menu.h" #include "memory.h" #include "menu.h" -#include "text.h" +#include "text1.h" #include "menu_input.h" struct unkSprite @@ -64,8 +64,6 @@ static const u8 fill0[] = "pksdir0"; extern void AddSprite(struct unkSprite *, u32, u32, u32); extern void sub_8038440(); -extern void sub_8035CF4(struct MenuStruct *, u32, u32); -extern void SetMenuItems(struct MenuStruct *, struct UnkTextStruct2 *, u32, const struct UnkTextStruct2 *, const struct MenuItem *, u32, u32, u32); extern void sub_80384D0(); void sub_80382E4(s32 currMenu) @@ -88,7 +86,7 @@ void sub_80382E4(s32 currMenu) SetMenuItems(gUnknown_203B360->unk8,gUnknown_203B360->unk148,0,&gUnknown_80E6E94,gUnknown_80E6EAC, 0,4,0); } - sub_8035CF4(gUnknown_203B360->unk8,0,1); + sub_8035CF4(gUnknown_203B360->unk8,0,TRUE); gUnknown_203B360->currMenu = currMenu; gUnknown_203B360->unk4 = 0; sub_8038440(); diff --git a/src/unused_vblank.c b/src/unused_vblank.c new file mode 100644 index 00000000..33f5ebfc --- /dev/null +++ b/src/unused_vblank.c @@ -0,0 +1,103 @@ +#include "global.h" +#include "reg_control.h" + +extern struct unkStruct_202D648 gUnknown_202D608[8]; +extern struct unkStruct_202D648 gUnknown_202D648[8]; + +// Unused? +s32 sub_800B720(s16 a0, IntrCallback a1) +{ + s32 r2; + struct unkStruct_202D648 *r3; + s32 r4; + bool8 sp4; + s32 spC; + bool32 sp10; + + spC = a0; + sp4 = DisableInterrupts(); + + do { + sp10 = FALSE; + r4 = 0; + r3 = gUnknown_202D608; + if (r4 >= gUnknown_203B0AA) + continue; + if (r3->unk0 == gUnknown_203B0A8) { + gUnknown_203B0A8 = (gUnknown_203B0A8 + 1) & 0x7fff; + sp10 = TRUE; + continue; + } + label: + do { + r4++; + r3++; + if (r4 >= gUnknown_203B0AA) + continue; + if (r3->unk0 == gUnknown_203B0A8) { + gUnknown_203B0A8 = (gUnknown_203B0A8 + 1) & 0x7fff; + sp10 = TRUE; + } + else + goto label; + } while (0); + } while (sp10); + + for (r4 = 0, r3 = gUnknown_202D608; r4 < gUnknown_203B0AA; r4++, r3++) { + if (r3->unk2 > spC) + break; + } + + for (r2 = gUnknown_203B0AA - 1, r3 = &gUnknown_202D608[r2]; r2 >= r4; r2--, r3--) + r3[1] = r3[0]; + + gUnknown_203B0AA++; + gUnknown_202D608[r4].unk0 = gUnknown_203B0A8; +#ifdef NONMATCHING + gUnknown_202D608[r4].unk2 = spC; +#else + gUnknown_202D608[r4].unk2 = ((u32)spC << 0x10 >> 0x10); // fake and may overflow. Unspecified behavior +#endif + gUnknown_202D608[r4].unk4 = a1; + + if (sp4) + EnableInterrupts(); + + return gUnknown_203B0A8; +} + +// Unused? +void sub_800B850(s16 a0) +{ + s32 r2; + struct unkStruct_202D648 *r4; + bool8 r5; + s32 r6; + + r6 = a0; + r5 = DisableInterrupts(); + + r2 = 0; + r4 = &gUnknown_202D608[r2]; + r4++; r4--; + for (; r2 < gUnknown_203B0AA; r2++, r4++) { + if (r4->unk0 != r6) + continue; + + gUnknown_203B0AA--; + for (; r2 < gUnknown_203B0AA; r2++, r4++) + r4[0] = r4[1]; + + if (!r5) + return; + EnableInterrupts(); + return; + } + + if (r5) + EnableInterrupts(); +} + +void UnusedIntrFunc(void) +{ +} \ No newline at end of file diff --git a/src/wigglytuff_shop.c b/src/wigglytuff_shop.c index ba4c3263..7c9cc1ee 100644 --- a/src/wigglytuff_shop.c +++ b/src/wigglytuff_shop.c @@ -1,16 +1,18 @@ #include "global.h" #include "constants/friend_area.h" -#include "file_system.h" -#include "menu.h" #include "pokemon.h" -#include "input.h" #include "team_inventory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "memory.h" #include "menu_input.h" #include "friend_area.h" #include "wigglytuff_shop.h" #include "felicity_bank.h" +#include "code_80130A8.h" +#include "code_8021774_pre.h" +#include "code_801EE10_mid.h" +#include "code_8021774.h" extern struct UnkTextStruct2 gUnknown_80DC534; extern struct UnkTextStruct2 gUnknown_80DC564; @@ -25,32 +27,16 @@ extern u8 gUnknown_202E5D8[]; extern u8 gUnknown_202E1C8[]; extern u8 gAvailablePokemonNames[]; -extern u8 *gWigglytuffDialogue[2][20]; -extern u8 *gWigglytuffCheck[]; -extern u8 *gUnknown_80D4920[]; -extern u8 *gUnknown_80D4928[]; -extern u8 *gUnknown_80D4934[]; -extern u8 *gUnknown_80D4970[]; -extern u8 *gUnknown_80D4978[]; +extern const u8 *gWigglytuffDialogue[2][20]; +extern const u8 *gWigglytuffCheck[]; +extern const u8 *gUnknown_80D4920[]; +extern const u8 *gUnknown_80D4928[]; +extern const u8 *gUnknown_80D4934[]; +extern const u8 *gUnknown_80D4970[]; +extern const u8 *gUnknown_80D4978[]; - -s32 sub_80144A4(s32 *); u8 sub_8021700(u32); void sub_8092578(u8 *buffer, u8 index, u8 r2); -extern void sub_8014248(const char *r0, u32, u32, const struct MenuItem *r4, u16 *, u32, u32,u8 *r5, u32); -extern void sub_80141B4(const u8 *, u32, u8*, u32); -extern void sub_80211AC(u32, u32); -extern void sub_8021354(u32); -extern void sub_8021494(); -extern void sub_803AA34(); -extern void sub_8021774(u8,u32, u32); -extern void sub_809249C(u8, u32); -extern void sub_8021830(void); -extern u32 sub_80217EC(void); -extern u8 sub_803ABC8(void); -extern u32 sub_8021274(u32); -extern u8 sub_802132C(void); -extern void sub_80213A0(void); extern void sub_8022380(void); extern void PlaySound(u32); bool8 sub_8023144(s32 param_1, s32 index, struct UnkTextStruct2_sub *sub, u32 param_4); @@ -98,7 +84,7 @@ bool8 CreateWigglytuffShop(bool32 isAsleep) gWigglytuffShop->unkCC = NULL; } else { - gWigglytuffShop->unkCC = (u8 *)&gWigglytuffShop->faceFile; + gWigglytuffShop->unkCC = &gWigglytuffShop->faceFile; } file = GetDialogueSpriteDataPtr(MONSTER_WIGGLYTUFF); gWigglytuffShop->faceFile = file; @@ -251,7 +237,7 @@ void UpdateWigglytuffDialogue(void) DrawTeamMoneyBox(1); break; case WIGGLYTUFF_UNKA: - sub_8021354(1); + sub_8021354(TRUE); DrawTeamMoneyBox(1); break; case WIGGLYTUFF_UNKB: @@ -493,7 +479,7 @@ void HandleWigglytuffConfirmFriendAreaMenu(void) void sub_8022538(void) { - switch(sub_8021274(1)) + switch(sub_8021274(TRUE)) { case 3: gWigglytuffShop->chosenFriendArea = sub_802132C(); @@ -521,7 +507,7 @@ void sub_8022538(void) void sub_80225C8(void) { s32 menuAction = 0; - sub_8021274(0); + sub_8021274(FALSE); if(sub_8012FD8(&gWigglytuffShop->unk6C) == 0) { sub_8013114(&gWigglytuffShop->unk6C, &menuAction); @@ -590,10 +576,8 @@ void sub_80226CC(void) { s32 temp; - if (sub_80144A4(&temp) == 0) - { + if (sub_80144A4(&temp) == 0) SetWigglytuffState(gWigglytuffShop->fallbackState); - } } void sub_80226F0(void) @@ -632,11 +616,8 @@ void sub_80226F0(void) void sub_8022790(void) { - if(gWigglytuffShop->unk134 != 0) - { + if (gWigglytuffShop->unk134 != 0) gWigglytuffShop->unk134--; - } - else { + else SetWigglytuffState(gWigglytuffShop->fallbackState); - } } diff --git a/src/wonder_mail.c b/src/wonder_mail.c index 0d03b2ae..5dd88796 100644 --- a/src/wonder_mail.c +++ b/src/wonder_mail.c @@ -2,21 +2,21 @@ #include "constants/communication_error_codes.h" #include "save.h" #include "pokemon.h" -#include "file_system.h" #include "item.h" -#include "input.h" #include "wonder_mail.h" #include "memory.h" -#include "menu.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "team_inventory.h" #include "rescue_password_menu.h" #include "menu_input.h" #include "code_8094F88.h" +#include "code_80130A8.h" +#include "main_menu.h" +#include "code_801EE10_1.h" extern struct WonderMailStruct_203B2C0 *gUnknown_203B2C0; -extern u32 sub_80144A4(s32 *r0); extern void sub_8011C28(u32); extern void sub_809927C(u8); @@ -28,7 +28,6 @@ extern bool8 sub_80A2824(u8); extern char gUnknown_202E5D8[0x50]; extern char gAvailablePokemonNames[0x50]; -extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32); extern void nullsub_130(void); extern void sub_8028348(void); extern void sub_803084C(); @@ -36,22 +35,15 @@ extern u32 sub_8030768(u32); extern s8 sub_80307EC(); extern void sub_8030D40(u8, u32); extern void sub_8030810(u32); -extern void sub_8035CC0(struct UnkTextStruct2 *r0, u32); -extern void sub_8035CF4(struct MenuStruct *r0, u32, u32); extern u32 sub_8030DA0(void); extern void sub_8030DE4(void); extern void sub_803092C(void); extern u32 sub_80154F0(); extern u32 sub_8039068(u32, u8 *r1, struct unkStruct_203B480 *r0); -extern void sub_8014248(const char *r0, u32, u32, const struct MenuItem *r4, u32, u32, u32, void *r5, u32); extern void sub_8095274(u32); extern void sub_80155F0(); -extern void sub_8023C60(); -extern u32 sub_8023A94(u32); extern void sub_8024458(s16, u32); -extern u16 sub_8023B44(); -extern void sub_8023B7C(u32); extern u32 sub_80244E4(); extern void sub_802452C(); extern void sub_802453C(); @@ -67,7 +59,6 @@ extern void sub_8030DE4(); extern void nullsub_23(u32); extern s32 sub_8037D64(u32, void *, void *); extern s32 sub_80381F4(u32, void *, void *); -extern void sub_8023868(u32, u32, u32, u32); extern void sub_80306A8(u32, u32, u32, u32); extern s32 sub_8037B28(u32); extern void sub_8011830(void); @@ -77,8 +68,6 @@ extern void xxx_call_start_bg_music(void); extern u32 sub_8023CE8(void); extern u32 sub_8030894(void); extern void sub_8030F58(u32); -extern void sub_8023DA4(void); -extern void SetMenuItems(struct MenuStruct *, struct UnkTextStruct2 *, u32, const struct UnkTextStruct2 *, const struct MenuItem *, u32, u32, u32); extern void sub_8029B34(void); extern void sub_8029AD8(void); extern void sub_8029AF4(void); @@ -131,7 +120,6 @@ extern void sub_8029044(void); extern void sub_8028CFC(void); extern void sub_8028D4C(void); extern void sub_8031E10(void); -extern void sub_8023C60(void); extern void sub_803084C(void); extern void sub_80155F0(void); extern void sub_80310B4(void); @@ -563,7 +551,7 @@ void sub_8028348(void) sub_8006518(gUnknown_203B2C0->unk35C); SetMenuItems(gUnknown_203B2C0->unk21C, gUnknown_203B2C0->unk35C, 3, &gUnknown_80DDAE4, gUnknown_80DDAFC, 1, 0, 0); sub_8023DA4(); - sub_8035CF4(gUnknown_203B2C0->unk21C, 3, 1); + sub_8035CF4(gUnknown_203B2C0->unk21C, 3, TRUE); break; case NO_POKEMON_IN_FRIEND_AREA: sub_8014248(gUnknown_80DDD2C, 0, 0xA, gUnknown_80DDAA0, 0, 4, 0, &gUnknown_203B2C0->faceFile,0xC); @@ -718,7 +706,7 @@ void sub_8028348(void) sub_8006518(gUnknown_203B2C0->unk35C); SetMenuItems(gUnknown_203B2C0->unk21C, gUnknown_203B2C0->unk35C, 3, &gUnknown_80DDACC, gUnknown_80DDAFC, 1, 0, 0); sub_803092C(); - sub_8035CF4(gUnknown_203B2C0->unk21C, 3, 1); + sub_8035CF4(gUnknown_203B2C0->unk21C, 3, TRUE); break; case 0xA: gUnknown_203B2C0->mailCount = CountAllMail(); @@ -1277,7 +1265,7 @@ void sub_80291AC(void) sub_803092C(); if(gUnknown_203B2C0->fallbackState == DEFAULT_FALLBACK_STATE) { - sub_8035CF4(gUnknown_203B2C0->unk21C, 3, 1); + sub_8035CF4(gUnknown_203B2C0->unk21C, 3, TRUE); SetFriendRescueCounterState(0x20); } else @@ -1624,7 +1612,7 @@ void sub_8029740(void) sub_803092C(); if(gUnknown_203B2C0->fallbackState == DEFAULT_FALLBACK_STATE) { - sub_8035CF4(gUnknown_203B2C0->unk21C, 3, 1); + sub_8035CF4(gUnknown_203B2C0->unk21C, 3, TRUE); SetFriendRescueCounterState(0x2B); } else @@ -1657,7 +1645,7 @@ void sub_80297B8(void) void sub_80297D4(void) { - switch(sub_8023A94(1)) + switch(sub_8023A94(TRUE)) { case 2: sub_8023C60(); @@ -1684,7 +1672,7 @@ void sub_8029884(void) { s32 menuAction; menuAction = -1; - sub_8023A94(0); + sub_8023A94(FALSE); if(sub_8012FD8(&(gUnknown_203B2C0->unk21C[3])) == 0) { sub_8013114(&(gUnknown_203B2C0->unk21C[3]), &menuAction); @@ -1733,7 +1721,7 @@ void sub_8029944(void) sub_8023B7C(1); if(gUnknown_203B2C0->fallbackState == DEFAULT_FALLBACK_STATE) { - sub_8035CF4(gUnknown_203B2C0->unk21C, 3, 1); + sub_8035CF4(gUnknown_203B2C0->unk21C, 3, TRUE); SetFriendRescueCounterState(0x34); } else diff --git a/src/wonder_mail_2.c b/src/wonder_mail_2.c index e6102b03..a6de86d4 100644 --- a/src/wonder_mail_2.c +++ b/src/wonder_mail_2.c @@ -1,19 +1,17 @@ #include "global.h" #include "constants/item.h" #include "constants/wonder_mail.h" -#include "file_system.h" -#include "input.h" #include "pokemon.h" #include "pokemon_mail.h" #include "memory.h" -#include "text.h" -#include "menu.h" +#include "text1.h" #include "save.h" #include "game_options.h" #include "wonder_mail.h" #include "code_800D090.h" #include "code_8094F88.h" #include "menu_input.h" +#include "code_80130A8.h" struct unkStruct_203B2C8 { @@ -36,8 +34,6 @@ struct unkStruct_203B2C8 extern struct unkStruct_203B2C8 *gUnknown_203B2C8; -extern void sub_8014248(const char *r0, u32, u32, const struct MenuItem *r4, u32, u32, u32, struct OpenedFile **r5, u32); - extern void sub_80920D8(u8 *buffer); extern void sub_8097790(void); extern char gUnknown_202E5D8[0x50]; @@ -46,7 +42,6 @@ extern u32 sub_802F298(void); extern void sub_802F2C0(void); extern u8 sub_8099394(u8 *); extern void sub_802B548(u32); -extern u32 sub_80144A4(s32 *); extern void sub_802B560(void); extern void sub_802B57C(void); @@ -57,7 +52,6 @@ extern void sub_802B624(void); extern void sub_802F204(struct unkStruct_802F204 *, u32); extern void sub_803C37C(struct DungeonLocation *, u32, u8 *); extern u32 GetDungeonTeamRankPts(struct DungeonLocation *, u32); -extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32); extern bool8 sub_80023E4(u32); ALIGNED(4) const char gRescueTeamNamePlaceholder[] = "????"; diff --git a/src/wonder_mail_2_1.c b/src/wonder_mail_2_1.c index eca3f743..1fd17dd7 100644 --- a/src/wonder_mail_2_1.c +++ b/src/wonder_mail_2_1.c @@ -3,7 +3,8 @@ #include "constants/mailbox.h" #include "input.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "menu.h" #include "code_802C39C.h" #include "menu_input.h" @@ -96,9 +97,6 @@ static const u8 wonder_mail_fill1[] = "pksdir0"; extern void sub_802CAA4(void); extern u8 IsJobSlotEmpty(u8); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern struct WonderMail* GetJobSlotInfo(u8); extern void sub_803B35C(struct WonderMail *, struct unkStruct_802C39C *); extern void CreateRescueTitle(struct unkStruct_802C39C *); diff --git a/src/wonder_mail_2_mid.c b/src/wonder_mail_2_mid.c index 967c3363..e5abb6b3 100644 --- a/src/wonder_mail_2_mid.c +++ b/src/wonder_mail_2_mid.c @@ -4,7 +4,8 @@ #include "code_800D090.h" #include "input.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "pokemon_mail.h" #include "wonder_mail.h" #include "code_802C39C.h" @@ -16,9 +17,6 @@ extern void sub_802C328(void); extern void DrawPelipperBoardJobMenu(void); extern void PlayMenuSoundEffect(u32); extern u8 HasNoPelipperBoardJobs(void); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern struct WonderMail *GetPelipperBoardSlotInfo(u32); extern void sub_803B35C(struct WonderMail *, u32 *); diff --git a/src/wonder_mail_3.c b/src/wonder_mail_3.c index 809e3541..13d3422d 100644 --- a/src/wonder_mail_3.c +++ b/src/wonder_mail_3.c @@ -2,17 +2,16 @@ #include "global.h" #include "constants/dungeon.h" #include "constants/input.h" - #include "memory.h" -#include "text.h" -#include "input.h" +#include "text1.h" +#include "text2.h" #include "mailbox.h" -#include "menu.h" #include "wonder_mail.h" #include "wonder_mail_3.h" #include "menu_input.h" #include "code_80958E8.h" #include "wonder_mail_2_1.h" +#include "code_80130A8.h" const struct UnkTextStruct2 gUnknown_80DFDD4 = { @@ -144,14 +143,9 @@ extern void sub_8097418(u32, u32); extern void sub_802D690(void); extern void sub_8096C80(void); extern void sub_8096D24(void); -extern void sub_80141B4(const u8 *, u32, u32, u32); extern u8 *sub_8096DE8(void); extern void AcceptJob(struct unkSubStruct_203B2F8 *); -extern void sub_8014248(const char *text, u32, u32, struct MenuItem *r0, u32, u32, u32, u32, u32); struct unkStruct_803B344 *sub_803B344(u8); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern void CreateRescueTitle(struct unkStruct_802C39C *); extern u8 gUnknown_80DFDBC[]; extern void sub_802CF5C(void); @@ -834,9 +828,6 @@ void sub_802D73C(void) { gUnknown_203B2F8->menuAction2 = 4; } -extern s32 sub_80144A4(s32 *); - - void sub_802D7D0(void) { s32 menuAction; diff --git a/src/wonder_mail_3_mid.c b/src/wonder_mail_3_mid.c index 920e9a9a..4ce0fa7e 100644 --- a/src/wonder_mail_3_mid.c +++ b/src/wonder_mail_3_mid.c @@ -1,16 +1,16 @@ #include "global.h" #include "constants/input.h" #include "memory.h" -#include "text.h" -#include "input.h" +#include "text1.h" +#include "text2.h" #include "wonder_mail.h" -#include "menu.h" #include "pokemon.h" #include "rescue_team_info.h" #include "friend_area.h" #include "item.h" #include "menu_input.h" #include "code_802C39C.h" +#include "code_80130A8.h" struct unkStruct_803B344 { @@ -107,7 +107,6 @@ extern void sub_802F088(); extern void sub_801B72C(void); extern u32 sub_801B6AC(void); extern void sub_802F108(void); -extern s32 sub_80144A4(s32 *); extern void sub_803B35C(struct WonderMail*, struct unkStruct_802C39C *); extern void sub_802DE84(struct unkStruct_802C39C *); extern void sub_802CDD4(u32); @@ -126,13 +125,9 @@ extern void PlayMenuSoundEffect(u32); extern void sub_802F300(void); extern void PlaySound(u32); extern s32 sub_808D544(u32); -extern void sub_80141B4(const u8 *, u32, struct OpenedFile **, u32); extern u32 sub_801B60C(u32, u8, u8); extern void sub_8092578(u8 *buffer, u8 index, u8 r2); void HandleMissionReward(void); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); const u8 *sub_80974A0(s16 index); const struct UnkTextStruct2 gUnknown_80E03C4 = { diff --git a/src/wonder_mail_4.c b/src/wonder_mail_4.c index 7fd2ae1b..ba0c04fa 100644 --- a/src/wonder_mail_4.c +++ b/src/wonder_mail_4.c @@ -1,6 +1,7 @@ #include "constants/input.h" #include "global.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "input.h" #include "memory.h" #include "item.h" @@ -80,9 +81,6 @@ extern void sub_80308A0(void); extern void sub_803092C(void); extern void PlayMenuSoundEffect(u32); -extern void sub_8008C54(u32); -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern void CreateRescueTitle(struct unkStruct_802C39C *); u32 sub_80306A8(u32 wonderMailType, u32 r1, struct UnkTextStruct2_sub *r2, u32 r3) diff --git a/src/wonder_mail_5.c b/src/wonder_mail_5.c index 3ccf667b..4b4e974d 100644 --- a/src/wonder_mail_5.c +++ b/src/wonder_mail_5.c @@ -1,7 +1,8 @@ #include "global.h" #include "constants/wonder_mail.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "input.h" #include "dungeon.h" #include "pokemon.h" @@ -50,8 +51,6 @@ static const u8 wonder_mail_fill[] = "pksdir0"; extern void sub_8030DD4(void); extern void PlayMenuSoundEffect(u32); extern void CreateRescueDescription(struct unkStruct_802C39C *); -extern void sub_80073E0(u32); -extern void sub_80073B8(u32); void sub_8030E2C(void); void sub_8030E48(void); diff --git a/src/wonder_mail_6.c b/src/wonder_mail_6.c index 6fe9f70b..39647bd6 100644 --- a/src/wonder_mail_6.c +++ b/src/wonder_mail_6.c @@ -1,12 +1,11 @@ #include "global.h" #include "memory.h" -#include "input.h" -#include "file_system.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "pokemon.h" -#include "menu.h" #include "code_8094F88.h" #include "menu_input.h" +#include "code_80130A8.h" extern bool8 HasNoWonderMailType(u32); @@ -79,7 +78,6 @@ ALIGNED(4) const u8 gUnknown_80E0A0C[] = _( const u8 wonder_mail_6_fill[] = "pksdir0"; extern void sub_80306A8(s32, u32, u32, u32); -extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32); extern void sub_8031300(void); extern void sub_803136C(void); extern void sub_80313D8(u32); diff --git a/src/wonder_mail_802DF88.c b/src/wonder_mail_802DF88.c index f90829d7..c316d62f 100644 --- a/src/wonder_mail_802DF88.c +++ b/src/wonder_mail_802DF88.c @@ -1,10 +1,12 @@ #include "global.h" #include "exclusive_pokemon.h" -#include "input.h" #include "memory.h" #include "code_802C39C.h" #include "wonder_mail.h" #include "menu_input.h" +#include "text1.h" +#include "text2.h" +#include "code_80130A8.h" struct unkStruct_203B2FC { @@ -101,17 +103,13 @@ const struct UnkTextStruct2 gUnknown_80E0264 = static const u8 wonder_mail_802DF88_fill1[] = "pksdir0"; -extern void sub_80073B8(u32); -extern void sub_80073E0(u32); extern void CreateRescueDescription(struct unkStruct_802C39C *); extern void PlayMenuSoundEffect(u32); -extern s32 sub_80144A4(s32 *); extern void sub_802DC28(u32); extern void sub_802F2C0(void); extern void sub_802DC28(u32); extern u32 sub_802F298(void); extern void sub_802F204(u32 *, u32); -extern void sub_80141B4(const u8 *r0, u32, struct OpenedFile **r1, u32); extern void sub_802DC40(void); extern void sub_802DC9C(void); struct WonderMail *GetJobSlotInfo(u8); diff --git a/src/wonder_mail_main_menu.c b/src/wonder_mail_main_menu.c index 37ab0ef4..c1d2186b 100644 --- a/src/wonder_mail_main_menu.c +++ b/src/wonder_mail_main_menu.c @@ -3,11 +3,14 @@ #include "constants/communication_error_codes.h" #include "save.h" #include "memory.h" -#include "text.h" +#include "text1.h" +#include "text2.h" #include "input.h" #include "wonder_mail.h" -#include "menu.h" #include "code_8094F88.h" +#include "code_80130A8.h" +#include "code_801C620.h" +#include "code_801B3C0.h" #define SELECT_WONDER_MAIL_MODE_MAIN_SCREEN 0 #define SEND_WONDER_MAIL_MAIN_SCREEN 1 @@ -120,13 +123,10 @@ struct unkStruct_203B3E8 EWRAM_DATA_2 struct unkStruct_203B3E8 *gUnknown_203B3E8 = {0}; -extern u32 sub_80144A4(s32 *); extern u32 sub_8011C1C(void); extern void SetWonderMailMainMenuState(u8); extern void sub_8030DE4(void); -extern void sub_801B450(void); extern void sub_803084C(void); -extern void sub_801CBB8(void); extern void sub_80155F0(void); extern void sub_8031E10(void); @@ -136,7 +136,6 @@ extern s32 sub_80381F4(u32, void *, void *); extern void sub_8011830(void); extern void sub_80151C0(u32, u8 *); extern void xxx_call_start_bg_music(void); -extern void sub_8014248(const char *, u32, u32, const struct MenuItem *, u32, u32, u32, u32, u32); extern void nullsub_23(u32); extern void sub_802EF48(void); extern void sub_802D098(struct WonderMail *); @@ -155,7 +154,6 @@ extern void sub_802D184(); extern s32 sub_80154F0(); extern bool8 DecodeWonderMailPassword(u8 *, struct WonderMail *); extern bool8 IsValidWonderMail(struct WonderMail *WonderMailData); -extern void sub_80141B4(const char *r0, u32, u32 *r1, u32); void PrintWonderMailMainMenuError(u32); void HandleWonderMailMainScreen(void); diff --git a/sym_ewram2.txt b/sym_ewram2.txt index e214d331..6e238b0c 100644 --- a/sym_ewram2.txt +++ b/sym_ewram2.txt @@ -373,16 +373,10 @@ gUnknown_203B328: /* 203B328 */ .include "src/rescue_password_menu.o" .include "src/load_screen.o" .include "src/wonder_mail_main_menu.o" -.include "src/debug_menu.o" - -gUnknown_203B3F0: /* 203B3F0 */ - .space 0x4 - -gUnknown_203B3F4: /* 203B3F4 */ - .space 0x4 - -gUnknown_203B3F8: /* 203B3F8 */ - .space 0x4 +.include "src/debug_menu1.o" +.include "src/debug_menu2.o" +.include "src/debug_menu3.o" +.include "src/debug_menu4.o" gUnknown_203B3FC: /* 203B3FC */ .space 0x4