diff --git a/asm/link_rfu.s b/asm/link_rfu.s deleted file mode 100644 index 4060c4959..000000000 --- a/asm/link_rfu.s +++ /dev/null @@ -1,520 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - thumb_func_start sub_801209C -sub_801209C: @ 801209C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - mov r8, r5 - ldr r6, =gUnknown_03005000 - adds r0, r6, 0 - adds r0, 0xF1 - ldrb r0, [r0] - cmp r0, 0x4 - bne _080120BA - adds r0, r5, 0 - bl DestroyTask -_080120BA: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - lsls r0, 16 - movs r1, 0x96 - lsls r1, 17 - cmp r0, r1 - ble _080120E4 - movs r1, 0xE0 - lsls r1, 7 - movs r0, 0x2 - bl sub_8011A64 - adds r0, r5, 0 - bl DestroyTask -_080120E4: - ldr r1, =0x00000ccd - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0801217C - ldr r0, =gUnknown_03004140 - ldrb r0, [r0, 0x6] - cmp r0, 0 - bne _0801217C - movs r2, 0x86 - lsls r2, 1 - adds r0, r6, r2 - bl ReadU16 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldr r2, =0x00000119 - adds r0, r6, r2 - bl sub_8011CE4 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _0801217C - movs r1, 0xA - ldrsh r0, [r4, r1] - ldr r7, =gUnknown_03007890 - lsls r4, r2, 5 - adds r2, r4, 0 - adds r2, 0x14 - ldr r1, [r7] - adds r1, r2 - adds r1, 0x6 - bl sub_801200C - cmp r0, 0 - bne _0801216C - ldr r0, [r7] - adds r1, r0, r4 - ldrb r0, [r1, 0x16] - cmp r0, 0xFF - beq _0801217C - ldrh r0, [r1, 0x14] - movs r1, 0x5A - bl sub_800C12C - lsls r0, 24 - cmp r0, 0 - bne _0801217C - movs r0, 0xA - strh r0, [r6, 0x4] - adds r0, r5, 0 - bl DestroyTask - b _0801217C - .pool -_0801216C: - movs r1, 0xE0 - lsls r1, 7 - movs r0, 0x2 - bl sub_8011A64 - mov r0, r8 - bl DestroyTask -_0801217C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801209C - - thumb_func_start sub_8012188 -sub_8012188: @ 8012188 - push {r4-r7,lr} - adds r3, r0, 0 - adds r5, r1, 0 - lsls r4, r2, 24 - lsrs r4, 24 - ldr r6, =gUnknown_03005000 - ldr r1, =0x00000ccf - adds r0, r6, r1 - movs r7, 0 - strb r7, [r0] - adds r0, r6, 0 - adds r0, 0xF1 - strb r7, [r0] - ldr r1, =0x00000119 - adds r0, r6, r1 - adds r1, r3, 0 - bl StringCopy - movs r1, 0x85 - lsls r1, 1 - adds r0, r6, r1 - adds r1, r5, 0 - movs r2, 0xD - bl memcpy - bl sub_800D658 - ldr r0, =sub_801209C - movs r1, 0x2 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - strh r4, [r1, 0xA] - ldr r0, =sub_800EB44 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r1, r0, 24 - adds r2, r1, 0 - cmp r4, 0x45 - bne _08012210 - cmp r1, 0xFF - beq _0801221E - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - movs r1, 0x1 - strh r1, [r0, 0x16] - b _0801221E - .pool -_08012210: - cmp r2, 0xFF - beq _0801221E - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r5 - strh r7, [r0, 0x16] -_0801221E: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8012188 - - thumb_func_start sub_8012224 -sub_8012224: @ 8012224 - push {lr} - ldr r0, =gUnknown_03005000 - adds r0, 0xF0 - ldrb r0, [r0] - cmp r0, 0x1 - beq _08012238 - movs r0, 0 - b _0801223A - .pool -_08012238: - movs r0, 0x1 -_0801223A: - pop {r1} - bx r1 - thumb_func_end sub_8012224 - - thumb_func_start sub_8012240 -sub_8012240: @ 8012240 - push {r4,lr} - movs r1, 0 - ldr r0, =gUnknown_03004140 - ldrb r2, [r0] - ldr r4, =gUnknown_03005000+0xCD1 - movs r3, 0x1 -_0801224C: - adds r0, r2, 0 - asrs r0, r1 - ands r0, r3 - cmp r0, 0 - beq _0801226C - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _0801226C - movs r0, 0 - b _08012274 - .pool -_0801226C: - adds r1, 0x1 - cmp r1, 0x3 - ble _0801224C - movs r0, 0x1 -_08012274: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8012240 - - thumb_func_start sub_801227C -sub_801227C: @ 801227C - push {r4,lr} - movs r4, 0 -_08012280: - lsls r2, r4, 24 - lsrs r2, 24 - ldr r0, =gUnknown_082ED82C - movs r1, 0 - bl nullsub_5 - adds r4, 0x1 - cmp r4, 0x13 - ble _08012280 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801227C - - thumb_func_start sub_801229C -sub_801229C: @ 801229C - push {r4-r7,lr} - mov r7, r8 - push {r7} - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1C - movs r2, 0x13 - movs r3, 0x2 - bl nullsub_13 - ldr r4, =gUnknown_03007890 - ldr r0, [r4] - ldrb r0, [r0, 0x2] - movs r1, 0x14 - movs r2, 0x1 - movs r3, 0x1 - bl nullsub_13 - ldr r0, [r4] - ldrb r0, [r0, 0x3] - movs r1, 0x17 - movs r2, 0x1 - movs r3, 0x1 - bl nullsub_13 - ldr r0, =gUnknown_03005000 - ldrb r0, [r0, 0xC] - cmp r0, 0x1 - bne _08012378 - movs r6, 0 - adds r7, r4, 0 - movs r5, 0x14 -_080122E0: - ldr r2, [r7] - ldrb r0, [r2, 0x7] - asrs r0, r6 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801231E - lsls r0, r6, 5 - adds r0, r2, r0 - ldrh r0, [r0, 0x18] - adds r4, r6, 0x3 - lsls r4, 24 - lsrs r4, 24 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, [r7] - adds r0, r5 - adds r0, 0x6 - movs r1, 0x6 - adds r2, r4, 0 - bl nullsub_5 - ldr r0, [r7] - adds r0, r5 - adds r0, 0x15 - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 -_0801231E: - adds r5, 0x20 - adds r6, 0x1 - cmp r6, 0x3 - ble _080122E0 - movs r6, 0 - ldr r0, =gUnknown_03005000 - mov r8, r0 -_0801232C: - movs r5, 0 - adds r7, r6, 0x1 - lsls r0, r6, 3 - adds r2, r6, 0 - adds r2, 0xB - subs r0, r6 - lsls r0, 1 - mov r1, r8 - adds r1, 0x14 - adds r4, r0, r1 - lsls r6, r2, 24 -_08012342: - ldrb r0, [r4] - lsls r1, r5, 25 - lsrs r1, 24 - lsrs r2, r6, 24 - movs r3, 0x2 - bl nullsub_13 - adds r4, 0x1 - adds r5, 0x1 - cmp r5, 0xD - ble _08012342 - adds r6, r7, 0 - cmp r6, 0x3 - ble _0801232C - ldr r0, =gUnknown_082ED868 - movs r1, 0x1 - movs r2, 0xF - bl nullsub_5 - b _080124AA - .pool -_08012378: - ldr r1, [r4] - ldrb r0, [r1, 0x2] - cmp r0, 0 - beq _08012414 - ldrb r0, [r1, 0x7] - cmp r0, 0 - beq _08012414 - movs r6, 0 - movs r5, 0xC0 - lsls r5, 18 -_0801238C: - lsrs r4, r5, 24 - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, =gUnknown_082ED84B - movs r1, 0x6 - adds r2, r4, 0 - bl nullsub_5 - ldr r0, =gUnknown_082ED85B - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 - movs r1, 0x80 - lsls r1, 17 - adds r5, r1 - adds r6, 0x1 - cmp r6, 0x3 - ble _0801238C - ldr r5, =gUnknown_03007890 - ldr r1, [r5] - ldr r4, =gUnknown_03005000 - ldr r0, =0x00000c3e - adds r4, r0 - ldrb r0, [r4] - lsls r0, 5 - adds r1, r0 - ldrh r0, [r1, 0x18] - movs r1, 0x1 - movs r2, 0x3 - movs r3, 0x4 - bl nullsub_13 - ldrb r1, [r4] - lsls r1, 5 - adds r1, 0x14 - ldr r0, [r5] - adds r0, r1 - adds r0, 0x6 - movs r1, 0x6 - movs r2, 0x3 - bl nullsub_5 - ldrb r1, [r4] - lsls r1, 5 - adds r1, 0x14 - ldr r0, [r5] - adds r0, r1 - adds r0, 0x15 - movs r1, 0x16 - movs r2, 0x3 - bl nullsub_5 - b _080124AA - .pool -_08012414: - movs r6, 0 - ldr r1, =gUnknown_03007890 - ldr r0, [r1] - ldrb r0, [r0, 0x8] - cmp r6, r0 - bge _08012470 - adds r7, r1, 0 - movs r1, 0x14 - mov r8, r1 -_08012426: - ldr r0, [r7] - lsls r5, r6, 5 - adds r1, r0, r5 - ldrb r0, [r1, 0x16] - cmp r0, 0xFF - beq _08012462 - ldrh r0, [r1, 0x18] - adds r4, r6, 0x3 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, [r7] - adds r0, r5 - ldrh r0, [r0, 0x14] - movs r1, 0x6 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, [r7] - add r0, r8 - adds r0, 0x15 - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 -_08012462: - movs r0, 0x20 - add r8, r0 - adds r6, 0x1 - ldr r0, [r7] - ldrb r0, [r0, 0x8] - cmp r6, r0 - blt _08012426 -_08012470: - cmp r6, 0x3 - bgt _080124AA - lsls r0, r6, 24 - movs r1, 0xC0 - lsls r1, 18 - adds r5, r0, r1 -_0801247C: - lsrs r4, r5, 24 - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x4 - bl nullsub_13 - ldr r0, =gUnknown_082ED84B - movs r1, 0x6 - adds r2, r4, 0 - bl nullsub_5 - ldr r0, =gUnknown_082ED85B - movs r1, 0x16 - adds r2, r4, 0 - bl nullsub_5 - movs r0, 0x80 - lsls r0, 17 - adds r5, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0801247C -_080124AA: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801229C - - thumb_func_start sub_80124C0 -sub_80124C0: @ 80124C0 - ldr r0, =gUnknown_03005000 - ldr r1, =0x00000c1a - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80124C0 - - thumb_func_start sub_80124D4 -sub_80124D4: @ 80124D4 - ldr r0, =gUnknown_03005000 - ldr r1, =0x000009e6 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80124D4 - - .align 2, 0 @ don't pad with nop diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index a52c2bc88..7e0099a9c 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -5,1857 +5,6 @@ .text - thumb_func_start sub_80156E0 -sub_80156E0: @ 80156E0 - push {r4-r7,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r4, r0, 24 - movs r5, 0 - ldr r0, =gUnknown_02022C30 - ldr r6, [r0] - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - ldrb r0, [r6, 0x14] - cmp r0, 0x38 - bls _08015702 - bl _08016878 -_08015702: - lsls r0, 2 - ldr r1, =_08015718 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08015718: - .4byte _080157FC - .4byte _08015854 - .4byte _08015878 - .4byte _080158C8 - .4byte _080159A6 - .4byte _08015E5C - .4byte _08015C54 - .4byte _08015E5C - .4byte _08016864 - .4byte _080161C8 - .4byte _080162D4 - .4byte _080160AC - .4byte _080160C6 - .4byte _08016324 - .4byte _08016348 - .4byte _08016350 - .4byte _08016360 - .4byte _0801638E - .4byte _080163A2 - .4byte _08015F32 - .4byte _08015FB8 - .4byte _08015FD6 - .4byte _0801604A - .4byte _08015ADA - .4byte _08015B00 - .4byte _08015B78 - .4byte _08016838 - .4byte _08015D4C - .4byte _08015D34 - .4byte _08015DD0 - .4byte _08015C2A - .4byte _08015DA6 - .4byte _08015D9C - .4byte _08016158 - .4byte _08016178 - .4byte _080161B8 - .4byte _080162DC - .4byte _08016318 - .4byte _08015BF4 - .4byte _08016104 - .4byte _08015E94 - .4byte _08015EC4 - .4byte _080163CC - .4byte _0801645C - .4byte _080165A8 - .4byte _08016610 - .4byte _0801662C - .4byte _08016478 - .4byte _08016634 - .4byte _08016738 - .4byte _0801676C - .4byte _080167F4 - .4byte _0801652C - .4byte _080164E0 - .4byte _080164F4 - .4byte _0801658C - .4byte _080165DC -_080157FC: - movs r0, 0x70 - bl AllocZeroed - str r0, [r6, 0x4] - movs r0, 0x70 - bl AllocZeroed - str r0, [r6, 0xC] - movs r0, 0x80 - lsls r0, 1 - bl AllocZeroed - str r0, [r6] - movs r0, 0x20 - bl AllocZeroed - str r0, [r6, 0x8] - ldr r0, [r6] - movs r1, 0x8 - bl sub_8017580 - ldr r1, =gUnknown_02022C2C - movs r0, 0x40 - strb r0, [r1] - ldr r0, [r6, 0xC] - ldr r1, [r6, 0x4] - movs r2, 0x9 - bl sub_8016DF0 - adds r1, r6, 0 - adds r1, 0x20 - strb r0, [r1] - adds r0, r6, 0 - adds r0, 0xA0 - bl sub_8019BA8 - bl sub_8019F2C - movs r0, 0x1 - bl _08016876 - .pool -_08015854: - adds r0, r6, 0 - adds r0, 0x21 - movs r2, 0 - ldrsh r1, [r7, r2] - bl sub_8019E70 - ldrh r0, [r7] - adds r0, 0x1 - strh r0, [r7] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - beq _08015872 - bl _08016878 -_08015872: - movs r0, 0x2 - bl _08016876 -_08015878: - movs r0, 0x40 - movs r1, 0 - movs r2, 0 - bl sub_8010F84 - ldr r2, =gUnknown_02022C40 - ldrh r0, [r2, 0x2] - ldrh r1, [r2, 0xA] - ldrh r2, [r2, 0xC] - bl sub_8010FCC - bl sub_800B488 - bl OpenLink - bl sub_8011C84 - ldr r0, [r6, 0x8] - movs r1, 0x1 - bl sub_8017580 - ldr r0, [r6, 0x4] - movs r1, 0x4 - bl sub_80175EC - ldr r0, [r6, 0xC] - movs r1, 0x4 - bl sub_80175EC - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - movs r0, 0x3 - bl _08016876 - .pool -_080158C8: - bl sub_81B1360 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x8 - beq _080158E0 - bl sub_81B1360 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x9 - bne _080159A0 -_080158E0: - ldr r4, =gUnknown_02022C40 - ldrh r0, [r4] - cmp r0, 0 - beq _080159A0 - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r5, r0, 24 - ldrh r0, [r4] - cmp r0, 0x1 - beq _08015900 - cmp r0, 0x2 - beq _08015950 - b _0801598E - .pool -_08015900: - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - cmp r5, 0x5 - bls _0801592C - adds r0, r4, 0 - bl sub_801807C - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - ldr r0, =gUnknown_082EF4FC - bl sub_801568C - b _0801598E - .pool -_0801592C: - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_80180A0 - cmp r0, 0 - bne _0801594C - ldr r1, =gUnknown_082EF47C - movs r0, 0x34 - bl sub_8015664 - b _0801598E - .pool -_0801594C: - movs r0, 0x37 - b _0801598C -_08015950: - adds r0, r6, 0 - bl sub_80156C8 - ldrb r0, [r4, 0x8] - strh r0, [r7, 0x2] - cmp r5, 0x5 - bls _0801596C - ldr r0, =gUnknown_082EF544 - bl sub_801568C - b _0801598E - .pool -_0801596C: - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - ldr r1, =gUnknown_02022C2C - movs r0, 0x44 - strb r0, [r1] - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_80180E8 - movs r0, 0x33 -_0801598C: - strb r0, [r6, 0x14] -_0801598E: - ldr r1, =gUnknown_02022C40 - movs r0, 0 - strh r0, [r1] - bl _08016878 - .pool -_080159A0: - movs r0, 0x4 - bl _08016876 -_080159A6: - ldr r4, =gSpecialVar_Result - ldrh r0, [r4] - cmp r0, 0 - beq _08015A0A - cmp r0, 0x9 - bne _080159E0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r0, 0x2 - bl PlaySE - ldr r0, =gStringVar1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - movs r1, 0 - movs r0, 0x2A - b _08015A02 - .pool -_080159E0: - cmp r0, 0xB - bne _080159F4 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r1, 0 - movs r0, 0x17 - b _08015A02 -_080159F4: - movs r0, 0 - strh r0, [r7] - ldrh r0, [r4] - subs r0, 0x1 - strh r0, [r7, 0x2] - movs r1, 0 - movs r0, 0x18 -_08015A02: - strb r0, [r6, 0x14] - strh r1, [r4] - bl _08016878 -_08015A0A: - bl ScriptContext2_IsEnabled - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08015A1A - bl _08016878 -_08015A1A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08015A80 - ldr r0, [r6] - adds r2, r7, 0x2 - adds r3, r6, 0 - adds r3, 0x21 - adds r1, r7, 0 - bl sub_801A2A8 - cmp r0, 0 - beq _08015A4C - movs r0, 0x5 - bl PlaySE - bl sub_80181CC - movs r0, 0x18 - bl _08016876 - .pool -_08015A4C: - bl sub_8017940 - cmp r0, 0 - beq _08015A80 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r0, 0x2 - bl PlaySE - bl sub_80181CC - ldr r0, =gStringVar1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - movs r0, 0x2D - bl _08016876 - .pool -_08015A80: - bl sub_8016B00 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _08015AA2 - cmp r0, 0x2 - bgt _08015A96 - cmp r0, 0x1 - beq _08015A9C - b _08015AD0 -_08015A96: - cmp r0, 0x4 - beq _08015AAA - b _08015AD0 -_08015A9C: - movs r0, 0x2 - bl PlaySE -_08015AA2: - adds r0, r6, 0 - bl sub_801A274 - b _08015AD0 -_08015AAA: - movs r0, 0xB - strb r0, [r6, 0x14] - bl sub_80181CC - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - adds r0, r6, 0 - bl sub_80181DC - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x53 - movs r2, 0 - bl sub_8011090 -_08015AD0: - adds r0, r6, 0 - bl sub_801A284 - bl _08016878 -_08015ADA: - ldr r0, =sub_809FA34 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08015AEA - bl _08016878 -_08015AEA: - movs r0, 0x40 - movs r1, 0 - movs r2, 0 - bl sub_8011090 - movs r0, 0x4 - bl _08016876 - .pool -_08015B00: - bl sub_801704C - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - ldr r0, [r6] - ldrb r1, [r7] - ldrb r2, [r7, 0x2] - adds r3, r4, 0 - bl sub_80179D4 - cmp r0, 0x1 - beq _08015B44 - cmp r0, 0x1 - bgt _08015B36 - cmp r0, 0 - beq _08015B3E - bl _08016878 -_08015B36: - cmp r0, 0x2 - beq _08015B68 - bl _08016878 -_08015B3E: - movs r0, 0x1A - bl _08016876 -_08015B44: - movs r1, 0x2 - ldrsh r0, [r7, r1] - lsls r0, 5 - ldr r1, [r6] - adds r1, r0 - adds r0, r1, 0 - adds r0, 0x10 - ldr r2, =gUnknown_02022C2C - ldrb r2, [r2] - bl sub_8012188 - strh r5, [r6, 0x12] - movs r0, 0x19 - bl _08016876 - .pool -_08015B68: - ldr r1, =gStringVar4 - movs r0, 0x13 - bl sub_8015664 - bl _08016878 - .pool -_08015B78: - bl sub_801704C - bl sub_8011A74 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1 - blt _08015BBE - cmp r4, 0x2 - ble _08015B9A - cmp r4, 0x4 - bne _08015BBE - movs r0, 0x1 - bl sub_801818C - strb r4, [r6, 0x14] - b _08015BBE -_08015B9A: - bl sub_8011B90 - cmp r0, 0x1 - bne _08015BB0 - ldr r0, =gUnknown_082EE6C8 - bl sub_801568C - b _08015BB8 - .pool -_08015BB0: - ldr r1, =gUnknown_082EE6C8 - movs r0, 0x1E - bl sub_8015664 -_08015BB8: - ldr r1, =gUnknown_02022C2C - movs r0, 0x40 - strb r0, [r1] -_08015BBE: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08015BCA - bl _08016878 -_08015BCA: - ldr r0, =gBlockSendBuffer - movs r1, 0x1 - bl sub_80143E4 - ldr r0, =sub_80140E0 - movs r1, 0x5 - bl CreateTask - movs r0, 0x26 - bl _08016876 - .pool -_08015BF4: - ldr r0, =sub_80140E0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08015C04 - bl _08016878 -_08015C04: - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x44 - bne _08015C24 - ldr r1, =gUnknown_082EE004 - movs r0, 0x1F - bl sub_8015664 - bl _08016878 - .pool -_08015C24: - movs r0, 0x5 - bl _08016876 -_08015C2A: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08015C36 - bl _08016878 -_08015C36: - movs r0, 0 - bl sub_801818C - movs r2, 0 - ldrsh r0, [r7, r2] - movs r3, 0x2 - ldrsh r1, [r7, r3] - ldr r2, [r6] - bl sub_801A3D0 - movs r0, 0x2 - bl _08016876 - .pool -_08015C54: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1B - adds r2, r6, 0 - adds r2, 0x1C - ldr r3, =gUnknown_082F021C - ldr r4, =gUnknown_082F0244 - str r4, [sp] - bl sub_8017178 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _08015C78 - bl _08016878 -_08015C78: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08015C94 - movs r0, 0x1C - bl _08016876 - .pool -_08015C94: - adds r1, r6, 0 - adds r1, 0x98 - movs r0, 0 - strh r0, [r1] - movs r2, 0x2 - ldrsh r0, [r7, r2] - ldr r1, [r6] - bl sub_8017CF8 - movs r0, 0x2 - negs r0, r0 - cmp r5, r0 - beq _08015CB2 - cmp r5, 0x40 - bne _08015CE4 -_08015CB2: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x40 - strh r1, [r0] - bl sub_800FE50 - ldr r0, =gStringVar4 - ldr r2, =gUnknown_082EEB80 - ldr r1, =gLinkPlayers - ldrb r1, [r1, 0x13] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - movs r0, 0x20 - bl _08016876 - .pool -_08015CE4: - ldr r0, =gUnknown_02022C2C - strb r5, [r0] - ldr r1, =gUnknown_02022C2D - lsrs r0, r5, 8 - strb r0, [r1] - lsls r0, r5, 24 - lsrs r0, 24 - cmp r0, 0x41 - bne _08015D18 - bl sub_8018024 - cmp r0, 0 - bne _08015D18 - ldr r1, =gUnknown_082EEBD0 - movs r0, 0x5 - bl sub_8015664 - bl _08016878 - .pool -_08015D18: - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - movs r1, 0x40 - orrs r1, r0 - adds r0, r6, 0 - adds r0, 0x4C - strh r1, [r0] - bl sub_800FE50 - movs r0, 0x1B - bl _08016876 - .pool -_08015D34: - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EEB88 - bl StringCopy - movs r0, 0x24 - bl _08016876 - .pool -_08015D4C: - adds r0, r6, 0 - bl sub_8017FD8 - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - adds r0, r6, 0 - adds r0, 0x4C - ldrh r1, [r0] - movs r0, 0x3F - ands r0, r1 - bl sub_8017984 - adds r5, r0, 0 - adds r0, r6, 0 - adds r0, 0x16 - ldr r3, =gUnknown_082EE82C - lsls r1, r5, 2 - lsls r2, r4, 4 - adds r1, r2 - adds r1, r3 - ldr r1, [r1] - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _08015D8C - bl _08016878 -_08015D8C: - movs r0, 0 - strh r0, [r7, 0x6] - movs r0, 0x1D - bl _08016876 - .pool -_08015D9C: - bl sub_800AC34 - movs r0, 0x24 - bl _08016876 -_08015DA6: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x44 - strh r1, [r0] - ldr r2, =gUnknown_02022C40 - ldrh r1, [r2, 0xE] - adds r3, r6, 0 - adds r3, 0x4E - strh r1, [r3] - ldrh r2, [r2, 0x10] - adds r1, r6, 0 - adds r1, 0x50 - strh r2, [r1] - bl sub_800FE50 - movs r0, 0x1D - bl _08016876 - .pool -_08015DD0: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08015DF4 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EEB88 - bl StringCopy - movs r0, 0x1C - bl _08016876 - .pool -_08015DF4: - adds r0, r6, 0 - bl sub_8017FD8 - adds r0, r6, 0 - adds r0, 0x98 - ldrh r0, [r0] - cmp r0, 0x51 - bne _08015E2A - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x8 - bne _08015E24 - ldr r0, =gStringVar4 - adds r1, r6, 0 - movs r2, 0 - bl sub_8018220 - movs r0, 0x28 - bl _08016876 - .pool -_08015E24: - movs r0, 0xD - bl _08016876 -_08015E2A: - cmp r0, 0x52 - beq _08015E32 - bl _08016878 -_08015E32: - movs r5, 0 - movs r0, 0x20 - strb r0, [r6, 0x14] - ldr r0, =gStringVar4 - ldr r4, =gUnknown_02022C2C - ldrb r2, [r4] - movs r1, 0x40 - orrs r1, r2 - ldr r2, =gLinkPlayers - ldrb r2, [r2, 0x13] - bl sub_8017D9C - strb r5, [r4] - bl _08016878 - .pool -_08015E5C: - movs r0, 0x2 - ldrsh r1, [r7, r0] - lsls r1, 5 - ldr r0, [r6] - adds r0, r1 - bl sub_80179AC - adds r5, r0, 0 - movs r1, 0x2 - ldrsh r0, [r7, r1] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - ldr r2, =gUnknown_082EE24C - lsls r0, r4, 2 - lsls r1, r5, 3 - adds r0, r1 - adds r0, r2 - ldr r1, [r0] - movs r0, 0x6 - bl sub_8015664 - bl _08016878 - .pool -_08015E94: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _08015EA8 - bl _08016878 -_08015EA8: - movs r4, 0 - movs r0, 0x29 - strb r0, [r6, 0x14] - bl sub_800ADF8 - adds r0, r6, 0 - adds r0, 0x98 - strh r4, [r0] - adds r0, 0x2 - strh r4, [r0] - bl _08016878 - .pool -_08015EC4: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08015ED2 - bl _08016878 -_08015ED2: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _08015F2C - ldr r5, =gStringVar1 - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r4, =gLinkPlayers + 8 - adds r1, r4 - adds r0, r5, 0 - bl StringCopy - ldrh r0, [r4, 0x18] - adds r4, 0x1C - adds r1, r4, 0 - bl sub_800E540 - adds r5, r0, 0 - ldr r0, =gStringVar4 - ldr r2, =gUnknown_082EE378 - lsls r1, r5, 2 - adds r1, r2 - ldr r1, [r1] - bl StringExpandPlaceholders - movs r0, 0x21 - bl _08016876 - .pool -_08015F2C: - movs r0, 0x7 - bl _08016876 -_08015F32: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r5, r0, 24 - cmp r5, 0 - beq _08015F5C - cmp r5, 0 - bgt _08015F54 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - beq _08015F98 - bl _08016878 -_08015F54: - cmp r5, 0x1 - beq _08015F98 - bl _08016878 -_08015F5C: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r4, =gUnknown_02022C2C - movs r0, 0x45 - strb r0, [r4] - movs r0, 0x45 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r2, 0x2 - ldrsh r0, [r7, r2] - lsls r0, 5 - ldr r1, [r6] - adds r1, r0 - adds r0, r1, 0 - adds r0, 0x10 - ldrb r2, [r4] - bl sub_8012188 - ldrh r0, [r7, 0x2] - strh r0, [r6, 0x12] - movs r0, 0x14 - strb r0, [r6, 0x14] - strh r5, [r7, 0x6] - bl _08016878 - .pool -_08015F98: - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - ldr r1, =gUnknown_082EEC9C - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - bl sub_801568C - bl _08016878 - .pool -_08015FB8: - ldrh r0, [r7, 0x4] - adds r0, 0x1 - strh r0, [r7, 0x4] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3C - bgt _08015FCA - bl _08016878 -_08015FCA: - movs r1, 0 - movs r0, 0x15 - strb r0, [r6, 0x14] - strh r1, [r7, 0x4] - bl _08016878 -_08015FD6: - bl sub_8011A74 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - beq _0801603C - cmp r4, 0x3 - ble _08015FF4 - cmp r4, 0x4 - bne _08016040 - movs r0, 0x1 - bl sub_801818C - strb r4, [r6, 0x14] - b _08016040 -_08015FF4: - cmp r4, 0x1 - blt _08016040 - movs r1, 0x2 - ldrsh r0, [r7, r1] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - bl sub_8011B90 - cmp r0, 0x1 - bne _08016028 - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r0, [r1] - bl sub_801568C - b _08016040 - .pool -_08016028: - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r1, [r1] - movs r0, 0x1E - bl sub_8015664 - b _08016040 - .pool -_0801603C: - movs r0, 0x16 - strb r0, [r6, 0x14] -_08016040: - ldrh r0, [r7, 0x6] - adds r0, 0x1 - strh r0, [r7, 0x6] - bl _08016878 -_0801604A: - bl sub_8011A80 - cmp r0, 0 - beq _08016092 - movs r2, 0x2 - ldrsh r0, [r7, r2] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - bl sub_8011B90 - cmp r0, 0x1 - bne _08016084 - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r0, [r1] - bl sub_801568C - b _08016092 - .pool -_08016084: - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r1, [r1] - movs r0, 0x1E - bl sub_8015664 -_08016092: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801609E - bl _08016878 -_0801609E: - movs r0, 0x10 - bl _08016876 - .pool -_080160AC: - movs r0, 0x49 - bl PlaySE - bl sub_800EF7C - movs r0, 0 - movs r1, 0xC - strb r1, [r6, 0x14] - adds r1, r6, 0 - adds r1, 0x9A - strh r0, [r1] - bl _08016878 -_080160C6: - bl sub_8011A80 - cmp r0, 0 - beq _080160DA - movs r0, 0 - bl sub_801818C - movs r0, 0x2 - bl _08016876 -_080160DA: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _080160E4 - b _08016878 -_080160E4: - ldr r0, =gBlockSendBuffer - movs r1, 0x1 - bl sub_80143E4 - ldr r0, =sub_80140E0 - movs r1, 0x5 - bl CreateTask - movs r0, 0x27 - b _08016876 - .pool -_08016104: - adds r0, r6, 0 - bl sub_801689C - ldr r0, =sub_80140E0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08016118 - b _08016878 -_08016118: - movs r0, 0x21 - strb r0, [r6, 0x14] - ldr r0, =gStringVar1 - ldr r4, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name - adds r1, r4, 0 - bl StringCopy - adds r0, r4, 0 - subs r0, 0x24 - ldrh r0, [r0, 0x20] - adds r1, r4, 0 - bl sub_800E540 - adds r5, r0, 0 - ldr r0, =gStringVar4 - ldr r2, =gUnknown_082EE324 - lsls r1, r5, 2 - adds r1, r2 - ldr r1, [r1] - bl StringExpandPlaceholders - b _08016878 - .pool -_08016158: - adds r0, r6, 0 - bl sub_801689C - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _08016170 - b _08016878 -_08016170: - movs r0, 0x22 - b _08016876 - .pool -_08016178: - adds r0, r6, 0 - bl sub_801689C - adds r0, r6, 0 - bl sub_80168DC - cmp r0, 0 - bne _0801618A - b _08016878 -_0801618A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08016198 - b _08016878 -_08016198: - movs r0, 0x1 - bl sub_8011DE0 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EE598 - bl StringCopy - movs r0, 0x24 - b _08016876 - .pool -_080161B8: - ldr r1, =gStringVar4 - movs r0, 0x9 - bl sub_8015664 - b _08016878 - .pool -_080161C8: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080161EE - cmp r1, 0 - bgt _080161E8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080162AE - b _08016878 -_080161E8: - cmp r1, 0x1 - beq _080162AE - b _08016878 -_080161EE: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x51 - strh r1, [r0] - ldr r1, =gUnknown_02022C2C - ldrb r1, [r1] - adds r5, r0, 0 - cmp r1, 0x45 - bne _08016220 - movs r4, 0x40 - orrs r4, r1 - movs r0, 0x1 - bl sub_801100C - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - movs r2, 0 - bl sub_8011090 - b _0801623E - .pool -_08016220: - movs r0, 0x40 - adds r4, r1, 0 - orrs r4, r0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl sub_801100C - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - movs r2, 0x1 - bl sub_8011090 -_0801623E: - ldr r1, [r6, 0x8] - movs r0, 0 - strb r0, [r1, 0x1B] - strh r0, [r7, 0x6] - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x41 - bne _08016286 - bl sub_8018024 - cmp r0, 0 - bne _0801627C - movs r0, 0x52 - strh r0, [r5] - adds r0, r5, 0 - bl sub_800FE50 - movs r0, 0xA - strb r0, [r6, 0x14] - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EEC14 - bl StringCopy - b _08016878 - .pool -_0801627C: - adds r0, r5, 0 - bl sub_800FE50 - movs r0, 0xD - b _08016876 -_08016286: - cmp r0, 0x48 - bne _080162A4 - adds r0, r5, 0 - bl sub_800FE50 - ldr r0, =gStringVar4 - adds r1, r6, 0 - movs r2, 0x1 - bl sub_8018220 - movs r0, 0x28 - b _08016876 - .pool -_080162A4: - adds r0, r5, 0 - bl sub_800FE50 - movs r0, 0xD - b _08016876 -_080162AE: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x52 - strh r1, [r0] - bl sub_800FE50 - movs r0, 0xA - strb r0, [r6, 0x14] - ldr r0, =gStringVar4 - ldr r1, =gUnknown_02022C2C - ldrb r1, [r1] - bl sub_8013078 - b _08016878 - .pool -_080162D4: - bl sub_800AC34 - movs r0, 0x24 - b _08016876 -_080162DC: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r4, [r0] - cmp r4, 0 - beq _080162E6 - b _08016878 -_080162E6: - ldr r1, =gUnknown_02022C2C - movs r0, 0x40 - strb r0, [r1] - ldr r1, =gStringVar4 - movs r0, 0x25 - bl sub_8015664 - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0 - movs r2, 0xC - bl memset - adds r0, r6, 0 - adds r0, 0x9A - strh r4, [r0] - subs r0, 0x2 - strh r4, [r0] - b _08016878 - .pool -_08016318: - movs r0, 0x2 - strb r0, [r6, 0x14] - movs r0, 0 - bl sub_801818C - b _08016878 -_08016324: - ldr r4, =gStringVar4 - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - movs r1, 0x40 - orrs r1, r0 - adds r0, r4, 0 - bl sub_8017E00 - movs r0, 0xE - adds r1, r4, 0 - bl sub_8015664 - b _08016878 - .pool -_08016348: - bl sub_800ADF8 - movs r0, 0xF - b _08016876 -_08016350: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _0801635C - b _08016878 -_0801635C: - movs r0, 0x10 - b _08016876 -_08016360: - ldr r0, [r6, 0x8] - bl Free - ldr r0, [r6] - bl Free - ldr r0, [r6, 0xC] - bl Free - ldr r0, [r6, 0x4] - bl Free - adds r0, r6, 0 - adds r0, 0x20 - ldrb r0, [r0] - bl DestroyTask - adds r0, r6, 0 - adds r0, 0x21 - bl sub_8019F04 - movs r0, 0x11 - b _08016876 -_0801638E: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - movs r0, 0x12 - b _08016876 -_080163A2: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _080163AE - b _08016878 -_080163AE: - bl sub_8019E3C - adds r0, r4, 0 - bl DestroyTask - ldr r0, =gUnknown_02022C30 - ldr r0, [r0] - bl Free - bl sub_80149D8 - b _08016878 - .pool -_080163CC: - bl sub_800F7DC - ldrh r1, [r0, 0x8] - ldr r4, =0x000003ff - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - bne _080163E4 - movs r0, 0x2B - b _08016876 - .pool -_080163E4: - bl sub_800F7DC - ldrh r1, [r0, 0x8] - adds r0, r4, 0 - ands r0, r1 - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - bne _08016408 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EF590 - bl StringCopy - b _0801643E - .pool -_08016408: - ldr r4, =gStringVar1 - bl sub_800F7DC - ldrh r0, [r0, 0x8] - lsls r0, 22 - lsrs r0, 22 - movs r1, 0xB - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - ldr r4, =gStringVar2 - bl sub_800F7DC - ldrb r1, [r0, 0xB] - lsrs r1, 1 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EF564 - bl StringExpandPlaceholders -_0801643E: - ldr r1, =gStringVar4 - movs r0, 0x2C - bl sub_8015664 - b _08016878 - .pool -_0801645C: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF20C - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _0801646E - b _08016878 -_0801646E: - movs r0, 0x2F - b _08016876 - .pool -_08016478: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1D - adds r2, r6, 0 - adds r2, 0x1E - ldr r3, =gUnknown_082F025C - ldr r4, =gUnknown_082F027C - str r4, [sp] - bl sub_8017178 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _0801649A - b _08016878 -_0801649A: - subs r0, 0x1 - cmp r5, r0 - beq _080164A4 - cmp r5, 0x3 - bne _080164B8 -_080164A4: - movs r0, 0x4 - strb r0, [r6, 0x14] - movs r0, 0x1 - bl sub_801818C - b _08016878 - .pool -_080164B8: - cmp r5, 0x1 - beq _080164C2 - cmp r5, 0x2 - beq _080164D0 - b _08016878 -_080164C2: - ldr r1, =gUnknown_082EF4C4 - movs r0, 0x35 - bl sub_8015664 - b _08016878 - .pool -_080164D0: - ldr r1, =gUnknown_082EF298 - movs r0, 0x2F - bl sub_8015664 - b _08016878 - .pool -_080164E0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - movs r0, 0x36 - b _08016876 -_080164F4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08016502 - b _08016878 -_08016502: - ldr r1, =gUnknown_02022C40 - movs r0, 0x1 - strh r0, [r1] - ldr r1, =gFieldCallback - ldr r0, =sub_80AF128 - str r0, [r1] - ldr r1, =CB2_ReturnToField - movs r0, 0x8 - bl sub_81B8904 - b _08016878 - .pool -_0801652C: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1D - adds r2, r6, 0 - adds r2, 0x1E - ldr r3, =gUnknown_082F0294 - ldr r4, =gUnknown_082F032C - str r4, [sp] - bl sub_8017178 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _0801654E - b _08016878 -_0801654E: - subs r0, 0x1 - cmp r5, r0 - beq _08016558 - cmp r5, 0x12 - bne _08016580 -_08016558: - ldr r0, =gUnknown_02022C40 - bl sub_801807C - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - ldr r0, =gUnknown_082EF4FC - bl sub_801568C - b _08016878 - .pool -_08016580: - ldr r0, =gUnknown_02022C40 - strh r5, [r0, 0x2] - movs r0, 0x37 - b _08016876 - .pool -_0801658C: - ldr r2, =gUnknown_02022C40 - ldrh r0, [r2, 0x2] - ldrh r1, [r2, 0xA] - ldrh r2, [r2, 0xC] - bl sub_8010FCC - ldr r0, =gUnknown_082EF520 - bl sub_801568C - b _08016878 - .pool -_080165A8: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080165CE - cmp r1, 0 - bgt _080165C8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080165D2 - b _08016878 -_080165C8: - cmp r1, 0x1 - beq _080165D2 - b _08016878 -_080165CE: - movs r0, 0x38 - b _08016876 -_080165D2: - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 -_080165DC: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF5B8 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _080165EE - b _08016878 -_080165EE: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - ldr r0, =gUnknown_02022C40 - bl sub_801807C - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 - .pool -_08016610: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF1EC - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _08016622 - b _08016878 -_08016622: - movs r0, 0x2E - b _08016876 - .pool -_0801662C: - bl sub_80173B0 - movs r0, 0x30 - b _08016876 -_08016634: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1D - adds r2, r6, 0 - adds r2, 0x4A - adds r3, r6, 0 - adds r3, 0x1E - ldr r4, =gUnknown_082F034C - str r4, [sp] - ldr r4, =gUnknown_082F03A4 - str r4, [sp, 0x4] - ldr r4, [r6] - str r4, [sp, 0x8] - bl sub_80172A0 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _08016660 - b _08016878 -_08016660: - subs r0, 0x1 - cmp r5, r0 - beq _0801666A - cmp r5, 0x8 - bne _0801667C -_0801666A: - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 - .pool -_0801667C: - bl sub_80173B0 - ldr r1, [r6] - lsls r4, r5, 5 - adds r1, r4 - ldrb r0, [r1, 0x9] - lsrs r0, 2 - ldrh r1, [r1, 0x8] - lsls r1, 22 - lsrs r1, 22 - bl sub_8017D04 - cmp r0, 0x1 - beq _080166C8 - cmp r0, 0x1 - bgt _080166A2 - cmp r0, 0 - beq _080166A8 - b _08016878 -_080166A2: - cmp r0, 0x2 - beq _080166FC - b _08016878 -_080166A8: - ldr r0, =gStringVar1 - ldr r1, [r6] - adds r1, r4 - bl sub_8018404 - ldr r1, =gUnknown_082EF65C - movs r0, 0x31 - bl sub_8015664 - strh r5, [r7, 0x2] - b _08016878 - .pool -_080166C8: - ldr r0, =gStringVar1 - ldr r1, [r6] - adds r1, r4 - bl sub_8018404 - ldr r0, =gStringVar2 - ldr r1, [r6] - adds r1, r4 - ldrb r2, [r1, 0x9] - lsrs r2, 2 - lsls r1, r2, 3 - subs r1, r2 - ldr r2, =gTypeNames - adds r1, r2 - bl StringCopy - ldr r1, =gUnknown_082EF6E4 - b _0801671E - .pool -_080166FC: - ldr r0, =gStringVar1 - ldr r1, [r6] - adds r1, r4 - bl sub_8018404 - ldr r0, =gStringVar2 - ldr r1, [r6] - adds r1, r4 - ldrb r2, [r1, 0x9] - lsrs r2, 2 - lsls r1, r2, 3 - subs r1, r2 - ldr r2, =gTypeNames - adds r1, r2 - bl StringCopy - ldr r1, =gUnknown_082EF718 -_0801671E: - movs r0, 0x2E - bl sub_8015664 - b _08016878 - .pool -_08016738: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0801675E - cmp r1, 0 - bgt _08016758 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08016762 - b _08016878 -_08016758: - cmp r1, 0x1 - beq _08016762 - b _08016878 -_0801675E: - movs r0, 0x32 - b _08016876 -_08016762: - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 -_0801676C: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF4C4 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _0801677E - b _08016878 -_0801677E: - ldr r4, =gUnknown_02022C40 - movs r0, 0x2 - strh r0, [r4] - ldr r2, =gUnknown_02022C38 - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - lsls r0, 5 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - ldr r2, =gUnknown_02022C3E - ldr r1, [r6] - movs r3, 0x2 - ldrsh r0, [r7, r3] - lsls r0, 5 - adds r1, r0 - ldrb r0, [r1, 0x9] - lsrs r0, 2 - strb r0, [r2] - ldr r2, =gUnknown_02022C3C - ldr r1, [r6] - movs r3, 0x2 - ldrsh r0, [r7, r3] - lsls r0, 5 - adds r1, r0 - ldrh r0, [r1, 0x8] - lsls r0, 22 - lsrs r0, 22 - strh r0, [r2] - ldr r1, =gFieldCallback - ldr r0, =sub_80AF128 - str r0, [r1] - ldr r1, =CB2_ReturnToField - movs r0, 0x9 - bl sub_81B8904 - adds r0, r6, 0 - bl sub_80156B0 - ldrh r0, [r7, 0x2] - strb r0, [r4, 0x8] - b _08016878 - .pool -_080167F4: - ldr r1, =gUnknown_02022C2C - movs r0, 0x44 - strb r0, [r1] - movs r1, 0x2 - ldrsh r0, [r7, r1] - lsls r0, 5 - ldr r1, [r6] - adds r1, r0 - adds r0, r1, 0 - adds r0, 0x10 - movs r2, 0x44 - bl sub_8012188 - ldr r0, =gStringVar1 - movs r3, 0x2 - ldrsh r2, [r7, r3] - lsls r2, 5 - ldr r1, [r6] - adds r1, r2 - bl sub_8018404 - ldr r0, =gUnknown_082EE17C - ldr r0, [r0, 0x8] - bl sub_8017020 - movs r0, 0x19 - b _08016876 - .pool -_08016838: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - beq _08016878 - movs r0, 0x1 - bl sub_801818C - movs r1, 0 - ldrsh r0, [r7, r1] - movs r2, 0x2 - ldrsh r1, [r7, r2] - ldr r2, [r6] - bl sub_801A3D0 - movs r0, 0x4 - b _08016876 - .pool -_08016864: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - beq _08016878 - ldrb r0, [r6, 0x15] -_08016876: - strb r0, [r6, 0x14] -_08016878: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80156E0 - - thumb_func_start var_800D_set_xB -var_800D_set_xB: @ 8016884 - push {lr} - bl InUnionRoom - cmp r0, 0x1 - bne _08016894 - ldr r1, =gSpecialVar_Result - movs r0, 0xB - strh r0, [r1] -_08016894: - pop {r0} - bx r0 - .pool -thumb_func_end var_800D_set_xB - thumb_func_start sub_801689C sub_801689C: @ 801689C push {r4,r5,lr} diff --git a/include/librfu.h b/include/librfu.h index ba6e535d4..49df42541 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -1,3 +1,6 @@ +#ifndef GUARD_LIBRFU_H +#define GUARD_LIBRFU_H + #include "main.h" enum @@ -253,3 +256,5 @@ void rfu_UNI_readySendData(u8 a0); void rfu_UNI_clearRecvNewDataFlag(u8 a0); void rfu_REQ_PARENT_resumeRetransmitAndChange(void); void rfu_NI_setSendData(u8, u8, u8 *, u8); + +#endif // GUARD_LIBRFU_H diff --git a/include/link_rfu.h b/include/link_rfu.h index eb24addbe..4398ca690 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -1,6 +1,8 @@ #ifndef GUARD_LINK_RFU_H #define GUARD_LINK_RFU_H +#include "librfu.h" + // Exported type declarations struct UnkLinkRfuStruct_02022B2C @@ -158,7 +160,8 @@ struct UnkRfuStruct_2 /* 0x102 */ u8 unk_102; /* 0x103 */ u8 filler_103[0x10A - 0x103]; /* 0x10A */ struct UnkLinkRfuStruct_02022B14 unk_10A; - u8 filler_120[12]; + u8 filler_; + u8 playerName[PLAYER_NAME_LENGTH + 1]; /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124; /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8; /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c; @@ -193,7 +196,8 @@ struct UnkRfuStruct_2 /* 0xcee */ u8 unk_cee[4]; }; // size = 0xcf4 -struct UnkRfuStruct_8010A14 { +struct UnkRfuStruct_8010A14 +{ char unk_00[15]; u8 unk_0f; u8 unk_10[4]; @@ -266,7 +270,7 @@ void sub_8010FA0(bool32 a0, bool32 a1); void sub_8010F60(void); void sub_8010FCC(u32 a0, u32 a1, u32 a2); void sub_8011C84(void); -void sub_8012188(const u8 *a0, struct UnkLinkRfuStruct_02022B14 *arg1, u8 arg2); +void sub_8012188(const u8 *name, struct UnkLinkRfuStruct_02022B14 *structPtr, u8 a2); bool32 sub_8011B90(void); void sub_800FE50(u16 *a0); bool32 sub_800E540(u16 id, u8 *name); diff --git a/ld_script.txt b/ld_script.txt index 628475264..86562a541 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -54,7 +54,6 @@ SECTIONS { src/string_util.o(.text); src/link.o(.text); src/link_rfu.o(.text); - asm/link_rfu.o(.text); src/rom_8011DC0.o(.text); asm/rom_8011DC0.o(.text); src/rtc.o(.text); diff --git a/src/link_rfu.c b/src/link_rfu.c index f026ca3c3..7809842f4 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -1,20 +1,20 @@ #include "global.h" -#include "malloc.h" #include "battle.h" #include "berry_blender.h" -#include "task.h" -#include "random.h" #include "decompress.h" -#include "text.h" -#include "string_util.h" #include "event_data.h" -#include "overworld.h" -#include "link.h" -#include "librfu.h" -#include "rom_8011DC0.h" -#include "link_rfu.h" -#include "palette.h" #include "gpu_regs.h" +#include "librfu.h" +#include "link.h" +#include "link_rfu.h" +#include "malloc.h" +#include "overworld.h" +#include "random.h" +#include "palette.h" +#include "rom_8011DC0.h" +#include "string_util.h" +#include "task.h" +#include "text.h" #include "constants/species.h" extern u16 gUnknown_03005DA8; @@ -65,7 +65,7 @@ static void rfufunc_80FA020(void); bool32 sub_8010454(u32 a0); static void sub_8010528(void); void sub_8010750(void); -int sub_80107A0(void); +s32 sub_80107A0(void); void sub_801084C(u8 taskId); void sub_80109E8(u16 a0); void sub_8010A70(void *a0); @@ -75,7 +75,7 @@ void sub_80115EC(s32 a0); u8 sub_8011CE4(const u8 *a0, u16 a1); void sub_8011D6C(u32 a0); void sub_8011E94(u32 a0, u32 a1); -u8 sub_8012224(void); +bool8 sub_8012224(void); void sub_801227C(void); void sub_801209C(u8 taskId); void sub_8011BF8(void); @@ -308,6 +308,11 @@ const char gUnknown_082ED7EC[] = "PokemonSioInfo"; const char gUnknown_082ED7FC[] = "LINK LOSS DISCONNECT!"; const char gUnknown_082ED814[] = "LINK LOSS RECOVERY NOW"; +extern const char gUnknown_082ED82C[]; +extern const char gUnknown_082ED84B[]; +extern const char gUnknown_082ED85B[]; +extern const char gUnknown_082ED868[]; + // .text u32 sub_800BEC0(void) @@ -352,7 +357,7 @@ void rfu_REQ_sendData_wrapper(u8 r2) rfu_REQ_sendData(r2); } -int sub_800BF4C(void (*func1)(u8, u8), void (*func2)(u16)) +s32 sub_800BF4C(void (*func1)(u8, u8), void (*func2)(u16)) { if (func1 == NULL) { @@ -1684,8 +1689,8 @@ void sub_800D658(void) void sub_800D6C8(struct UnkRfuStruct_2_Sub_124 *ptr) { - int i; - int j; + s32 i; + s32 j; for (i = 0; i < 32; i++) { @@ -1702,8 +1707,8 @@ void sub_800D6C8(struct UnkRfuStruct_2_Sub_124 *ptr) void sub_800D724(struct UnkRfuStruct_2_Sub_9e8 *ptr) { - int i; - int j; + s32 i; + s32 j; for (i = 0; i < 40; i++) { @@ -1720,8 +1725,8 @@ void sub_800D724(struct UnkRfuStruct_2_Sub_9e8 *ptr) void sub_800D780(struct UnkRfuStruct_Sub_Unused *ptr) { - int i; - int j; + s32 i; + s32 j; for (i = 0; i < 2; i++) { @@ -1738,7 +1743,7 @@ void sub_800D780(struct UnkRfuStruct_Sub_Unused *ptr) void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2) { - int i; + s32 i; u16 imeBak; u8 count; @@ -1778,7 +1783,7 @@ void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2) void sub_800D888(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2) { - int i; + s32 i; u16 imeBak; if (q1->unk_232 < 40) @@ -1817,7 +1822,7 @@ void sub_800D888(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2) bool8 sub_800D934(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2) { u16 imeBak; - int i; + s32 i; imeBak = REG_IME; REG_IME = 0; @@ -1843,7 +1848,7 @@ bool8 sub_800D934(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2) bool8 sub_800D9DC(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2) { - int i; + s32 i; u16 imeBak; if (q1->unk_230 == q1->unk_231 || q1->unk_233 != 0) @@ -1865,7 +1870,7 @@ bool8 sub_800D9DC(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2) void sub_800DA68(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2) { - int i; + s32 i; if (q2[1] == 0) { @@ -1892,7 +1897,7 @@ void sub_800DA68(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2) static bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2) { - int i; + s32 i; if (q1->unk_1e == 0) { @@ -1913,7 +1918,7 @@ static bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2) void sub_800DB18(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2) { - int i; + s32 i; if (q1->unk_202 < 2) { @@ -1933,7 +1938,7 @@ void sub_800DB18(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2) bool8 sub_800DB84(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2) { - int i; + s32 i; if (q1->unk_200 == q1->unk_201 || q1->unk_203) { @@ -1951,7 +1956,7 @@ bool8 sub_800DB84(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2) void sub_800DBF8(u8 *q1, u8 mode) { - int i; + s32 i; u8 rval; u16 r5 = 0; switch (mode) @@ -1995,7 +2000,7 @@ void sub_800DBF8(u8 *q1, u8 mode) void PkmnStrToASCII(u8 *q1, const u8 *q2) { - int i; + s32 i; for (i = 0; q2[i] != EOS; i++) { @@ -2006,7 +2011,7 @@ void PkmnStrToASCII(u8 *q1, const u8 *q2) void ASCIIToPkmnStr(u8 *q1, const u8 *q2) { - int i; + s32 i; for (i = 0; q2[i] != 0; i++) { @@ -2114,9 +2119,9 @@ NAKED u8 sub_800DD1C(u8 maxFlags) } #endif -void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, int r3) +void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, s32 r3) { - int i; + s32 i; for (i = 0; i < 2; i++) { @@ -2260,7 +2265,7 @@ u8 sub_800E124(void) return 0; } -void sub_800E15C(struct Sprite *sprite, int signalStrengthAnimNum) +void sub_800E15C(struct Sprite *sprite, s32 signalStrengthAnimNum) { if (sprite->data[2] != signalStrengthAnimNum) { @@ -2350,7 +2355,7 @@ void sub_800E378(struct UnkSaveSubstruct_3b98 *dest, u32 trainerId, const u8 *na bool32 sub_800E388(const u8 *name) { - int i; + s32 i; for (i = 0; i < 8; i++) { @@ -2366,10 +2371,10 @@ void sub_800E3A8(void) { if (gWirelessCommType != 0) { - int i; - int j; - int cnt; - int sp0[5]; + s32 i; + s32 j; + s32 cnt; + s32 sp0[5]; struct UnkSaveSubstruct_3b98 *sp14 = calloc(20, sizeof(struct UnkSaveSubstruct_3b98)); for (i = 0; i < GetLinkPlayerCount(); i++) { @@ -2413,7 +2418,7 @@ void sub_800E3A8(void) bool32 sub_800E540(u16 id, u8 *name) { - int i; + s32 i; for (i = 0; i < 20; i++) { @@ -2431,7 +2436,7 @@ bool32 sub_800E540(u16 id, u8 *name) void sub_800E5AC(void) { - int i; + s32 i; for (i = 0; i < 20; i++) { @@ -2445,14 +2450,14 @@ void nullsub_5(const char *unused_0, u8 unused_1, u8 unused_2) // debug? } -void nullsub_13(u8 unused_0, u8 unused_1, u8 unused_2, u8 unused_3) +void nullsub_13(u16 unused_0, u8 unused_1, u8 unused_2, u8 unused_3) { } void sub_800E604(void) { - int i; + s32 i; u8 unk_ee_bak = gUnknown_03005000.unk_ee; CpuFill16(0, &gUnknown_03005000, sizeof gUnknown_03005000); gUnknown_03005000.unk_ee = unk_ee_bak; @@ -2541,12 +2546,12 @@ s32 sub_800E87C(u8 idx) return gUnknown_082ED6A5[idx]; } -void sub_800E88C(int r2, int r5) +void sub_800E88C(s32 r2, s32 r5) { u8 i; u8 r4 = 1; - int r1 = r2; - int r6 = 0; + s32 r1 = r2; + s32 r6 = 0; if (r5 == -1) { for (i = 0; i < 4; r2 >>= 1, i++) @@ -2737,7 +2742,7 @@ void sub_800ED28(void) void sub_800ED34(u16 unused) { - int i; + s32 i; for (i = 0; i < 14; i++) { @@ -2879,7 +2884,7 @@ void sub_800EF88(u8 a0) // FIXME: gRecvCmds should be in r6 and r7 void sub_800EFB0(void) { - int i, j; + s32 i, j; for (i = 0; i < 5; i++) { for (j = 0; j < 7; j++) @@ -2941,7 +2946,7 @@ NAKED void sub_800EFB0(void) void sub_800F014(void) { - int i; + s32 i; for (i = 0; i < 7; i++) { gRecvCmds[0][i] = gSendCmd[i]; @@ -2975,8 +2980,8 @@ static void sub_800F048(void) bool32 sub_800F0B8(void) { - int i; - int j; + s32 i; + s32 j; if (gUnknown_03007890->unk_06 == 0) { @@ -3131,7 +3136,7 @@ bool32 sub_800F1E0(void) void sub_800F498(u16 *a0, u8 *a1) { - int i; + s32 i; if (a0[0]) { @@ -3199,7 +3204,7 @@ bool32 sub_800F4F0(void) void sub_800F638(u8 unused, u32 flags) { - int i, j; + s32 i, j; const u8 *r10 = gUnknown_03005000.unk_6c.unk_04; for (i = 0; i < gUnknown_03005000.unk_6c.unk_02; i++) @@ -3404,7 +3409,7 @@ static void sub_800F86C(u8 unused) bool8 sub_800FC60(void) { - int i; + s32 i; for (i = 0; i < 5; i++) { @@ -3416,7 +3421,7 @@ bool8 sub_800FC60(void) bool8 sub_800FC88(void) { - int i; + s32 i; for (i = 0; i < gUnknown_03005000.playerCount; i++) { @@ -3440,7 +3445,7 @@ static void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data) u8 sub_800FCD8(void) { u8 flags = 0; - int i; + s32 i; for (i = 0; i < 5; i++) { @@ -3560,7 +3565,7 @@ static void rfufunc_80F9F44(void) static void sub_800FFB0(void) { - int i; + s32 i; const u8 *src = gUnknown_03005000.unk_6c.unk_04; gSendCmd[0] = 0x8900 | gUnknown_03005000.unk_6c.unk_00; for (i = 0; i < 7; i++) @@ -3577,7 +3582,7 @@ static void rfufunc_80FA020(void) { const u8 *src = gUnknown_03005000.unk_6c.unk_04; u8 mpId = GetMultiplayerId(); - int i; + s32 i; if (gUnknown_03005000.unk_0c == 0) { gSendCmd[0] = (~0x76ff) | (gUnknown_03005000.unk_6c.unk_02 - 1); @@ -3641,9 +3646,9 @@ void sub_8010198(void) void sub_80101CC(void) { - int i; + s32 i; u8 playerCount = gUnknown_03005000.playerCount; - int count = 0; + s32 count = 0; for (i = 0; i < MAX_RFU_PLAYERS; i++) { @@ -3770,7 +3775,7 @@ void sub_8010434(void) bool32 sub_8010454(u32 a0) { - int i; + s32 i; for (i = 0; gUnknown_082ED6E0[i] != a0; i++) { if (gUnknown_082ED6E0[i] == 0xffff) @@ -3820,7 +3825,7 @@ static void sub_8010528(void) bool8 sub_8010540(void) { - int i; + s32 i; bool8 retval = FALSE; for (i = 0; i < 4; i++) { @@ -3851,7 +3856,7 @@ bool8 sub_8010540(void) bool32 sub_80105EC(void) { u8 flags = 0; - int i; + s32 i; for (i = 0; i < 4; i++) { if (gUnknown_03005000.unk_cd5[i] == 11) @@ -3910,7 +3915,7 @@ u32 sub_8010714(u16 a0, const u8 *a1) void sub_8010750(void) { - int i; + s32 i; sub_8010540(); for (i = 0; i < 4; i++) @@ -3924,9 +3929,9 @@ void sub_8010750(void) } } -int sub_80107A0(void) +s32 sub_80107A0(void) { - int retval = 0; + s32 retval = 0; if (gUnknown_03005000.unk_c85 == 8) { if (gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_0 == 0x26 || gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_0 == 0x27) @@ -3948,7 +3953,7 @@ int sub_80107A0(void) void sub_801084C(u8 taskId) { - int i; + s32 i; if (gUnknown_03005000.unk_f1 == 1 || gUnknown_03005000.unk_f1 == 2) { @@ -4032,7 +4037,7 @@ void sub_801084C(u8 taskId) void sub_80109E8(u16 a0) { - int i; + s32 i; for (i = 0; i < 4; i++) { @@ -4043,7 +4048,7 @@ void sub_80109E8(u16 a0) void sub_8010A14(const struct UnkRfuStruct_8010A14 *a0) { - int i; + s32 i; gUnknown_03005000.playerCount = a0->unk_0f; for (i = 0; i < 4; i++) gUnknown_03005000.unk_cde[i] = a0->unk_10[i]; @@ -4066,7 +4071,7 @@ void sub_8010A70(void *a0) void sub_8010AAC(u8 taskId) { - int i; + s32 i; struct LinkPlayerBlock *r2; struct UnkRfuStruct_8010A14 *r5; u8 r4 = gUnknown_03005000.unk_cde[gUnknown_082ED68C[gUnknown_03005000.unk_ce9]]; @@ -4267,7 +4272,7 @@ void sub_8010FCC(u32 a0, u32 a1, u32 a2) gUnknown_02022B14.unk_0b_1 = a2; } -u8 sub_801100C(int a0) +u8 sub_801100C(s32 a0) { u8 retval = 0x80; retval |= (gLinkPlayers[a0].gender << 3); @@ -4278,7 +4283,7 @@ u8 sub_801100C(int a0) void sub_801103C(void) { struct UnkLinkRfuStruct_02022B14 *r5 = &gUnknown_02022B14; - int i; + s32 i; for (i = 1; i < GetLinkPlayerCount(); i++) r5->unk_04[i - 1] = sub_801100C(i); @@ -4299,10 +4304,10 @@ void sub_8011090(u8 a0, u32 a1, u32 a2) void sub_80110B8(u32 a0) { - int i; + s32 i; u32 r5; u32 r7; - int r8; + s32 r8; if (sub_800F7DC()->unk_0a_0 == 0x45) { @@ -4962,7 +4967,7 @@ void sub_8011FC8(const u8 *src, u16 trainerId) data[8] = trainerId; } -bool32 sub_801200C(u16 a1, struct UnkLinkRfuStruct_02022B14 *structPtr) +bool32 sub_801200C(s16 a1, struct UnkLinkRfuStruct_02022B14 *structPtr) { if (sub_800F7DC()->unk_0a_0 == 0x45) { @@ -4993,3 +4998,159 @@ bool32 sub_801200C(u16 a1, struct UnkLinkRfuStruct_02022B14 *structPtr) return FALSE; } + +void sub_801209C(u8 taskId) +{ + if (gUnknown_03005000.unk_f1 == 4) + DestroyTask(taskId); + + if (++gTasks[taskId].data[0] > 300) + { + sub_8011A64(2, 0x7000); + DestroyTask(taskId); + } + + if (gUnknown_03005000.unk_ccd != 0 && gUnknown_03004140.unk_06 == 0) + { + u16 trainerId = ReadU16(gUnknown_03005000.unk_10A.unk_00.playerTrainerId); + u8 id = sub_8011CE4(gUnknown_03005000.playerName, trainerId); + if (id != 0xFF) + { + if (!sub_801200C(gTasks[taskId].data[1], &gUnknown_03007890->unk_14[id].unk_06)) + { + if (gUnknown_03007890->unk_14[id].unk_02 != 0xFF && !sub_800C12C(gUnknown_03007890->unk_14[id].unk_00, 0x5A)) + { + gUnknown_03005000.unk_04 = 0xA; + DestroyTask(taskId); + } + } + else + { + sub_8011A64(2, 0x7000); + DestroyTask(taskId); + } + } + } +} + +void sub_8012188(const u8 *name, struct UnkLinkRfuStruct_02022B14 *structPtr, u8 a2) +{ + u8 taskId, taskId2; + + gUnknown_03005000.unk_ccf = 0; + gUnknown_03005000.unk_f1 = 0; + StringCopy(gUnknown_03005000.playerName, name); + memcpy(&gUnknown_03005000.unk_10A, structPtr, 0xD); + sub_800D658(); + taskId = CreateTask(sub_801209C, 2); + gTasks[taskId].data[1] = a2; + taskId2 = FindTaskIdByFunc(sub_800EB44); + if (a2 == 0x45) + { + if (taskId2 != 0xFF) + gTasks[taskId2].data[7] = 1; + } + else + { + if (taskId2 != 0xFF) + gTasks[taskId2].data[7] = 0; + } +} + +bool8 sub_8012224(void) +{ + if (gUnknown_03005000.unk_f0 == 1) + return TRUE; + else + return FALSE; +} + +bool32 sub_8012240(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + { + if ((gUnknown_03004140.unk_00 >> i) & 1 && gUnknown_03005000.unk_cd1[i] == 0) + return FALSE; + } + + return TRUE; +} + +void sub_801227C(void) +{ + s32 i; + + for (i = 0; i < 20; i++) + nullsub_5(gUnknown_082ED82C, 0, i); +} + +void sub_801229C(void) +{ + s32 i, j; + + nullsub_13(GetBlockReceivedStatus(), 0x1C, 0x13, 2); + nullsub_13(gUnknown_03007890->unk_02, 0x14, 1, 1); + nullsub_13(gUnknown_03007890->unk_03, 0x17, 1, 1); + if (gUnknown_03005000.unk_0c == 1) + { + for (i = 0; i < 4; i++) + { + if ((gUnknown_03007890->unk_07 >> i) & 1) + { + nullsub_13(gUnknown_03007890->unk_14[i].unk_04, 1, i + 3, 4); + nullsub_5((void*) &gUnknown_03007890->unk_14[i].unk_06, 6, i + 3); + nullsub_5(gUnknown_03007890->unk_14[i].playerName, 0x16, i + 3); + } + } + for (i = 0; i < 4; i++) + { + for (j = 0; j < 14; j++) + { + nullsub_13(gUnknown_03005000.unk_14[i][j], j * 2, i + 11, 2); + } + } + nullsub_5(gUnknown_082ED868, 1, 0xF); + } + else if (gUnknown_03007890->unk_02 != 0 && gUnknown_03007890->unk_07 != 0) + { + for (i = 0; i < 4; i++) + { + nullsub_13(0, 1, i + 3, 4); + nullsub_5(gUnknown_082ED84B, 6, i + 3); + nullsub_5(gUnknown_082ED85B, 0x16, i + 3); + } + nullsub_13(gUnknown_03007890->unk_14[gUnknown_03005000.unk_c3e].unk_04, 1, 3, 4); + nullsub_5((void*) &gUnknown_03007890->unk_14[gUnknown_03005000.unk_c3e].unk_06, 6, 3); + nullsub_5(gUnknown_03007890->unk_14[gUnknown_03005000.unk_c3e].playerName, 0x16, 3); + } + else + { + for (i = 0; i < gUnknown_03007890->unk_08; i++) + { + if (gUnknown_03007890->unk_14[i].unk_02 != 0xFF) + { + nullsub_13(gUnknown_03007890->unk_14[i].unk_04, 1, i + 3, 4); + nullsub_13(gUnknown_03007890->unk_14[i].unk_00, 6, i + 3, 4); + nullsub_5(gUnknown_03007890->unk_14[i].playerName, 0x16, i + 3); + } + } + for (; i < 4; i++) + { + nullsub_13(0, 1, i + 3, 4); + nullsub_5(gUnknown_082ED84B, 6, i + 3); + nullsub_5(gUnknown_082ED85B, 0x16, i + 3); + } + } +} + +u32 sub_80124C0(void) +{ + return gUnknown_03005000.unk_9e8.unk_232; +} + +u32 sub_80124D4(void) +{ + return gUnknown_03005000.unk_124.unk_8c2; +} diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c index b7ca087fd..250f80c4c 100644 --- a/src/rom_8011DC0.c +++ b/src/rom_8011DC0.c @@ -39,7 +39,7 @@ extern void HealPlayerParty(void); struct UnkStruct_Shared { struct UnkLinkRfuStruct_02022B14 field_0; - u8 needingPadding[3]; + u8 needingPadding[2]; u8 playerName[PLAYER_NAME_LENGTH + 1]; }; @@ -265,7 +265,7 @@ void sub_801689C(struct UnkStruct_URoom *arg0); u8 sub_80181DC(struct UnkStruct_URoom *arg0); bool32 sub_80168DC(struct UnkStruct_URoom *arg0); bool32 sub_801704C(void); -u32 sub_8017CF8(u32 arg1, struct UnkStruct_Main0 *arg0); +s32 sub_8017CF8(s32 arg1, struct UnkStruct_Main0 *arg0); s32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 playerGender); void sub_801818C(bool32 arg0); void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2); @@ -2510,13 +2510,11 @@ void sub_80156C8(struct UnkStruct_URoom *data) memcpy(data->field_0, &gDecompressionBuffer[0x3F00], 0x100); } -// Cannot match, please fix later. -/* void sub_80156E0(u8 taskId) { u32 id = 0; s32 var5 = 0; - u32 playerGender = 0; + s32 playerGender = 0; struct UnkStruct_URoom *data = gUnknown_02022C30.uRoom; s16 *taskData = gTasks[taskId].data; @@ -2679,7 +2677,7 @@ void sub_80156E0(u8 taskId) break; case 1: sub_8012188(data->field_0->arr[taskData[1]].unk.playerName, &data->field_0->arr[taskData[1]].unk.field_0, gUnknown_02022C2C); - data->field_12 = id; + data->field_12 = id; // Should be just 0, but won't match any other way. data->state = 25; break; case 2: @@ -2730,6 +2728,11 @@ void sub_80156E0(u8 taskId) data->state = 2; } break; + case 5: + id = sub_80179AC(&data->field_0->arr[taskData[1]]); + playerGender = sub_8017CF8(taskData[1], data->field_0); + sub_8015664(6, gUnknown_082EE24C[id][playerGender]); + break; case 6: var5 = sub_8017178(&data->textState, &data->field_1B, &data->field_1C, &gUnknown_082F021C, &gUnknown_082F0244); if (var5 != -1) @@ -2742,16 +2745,15 @@ void sub_80156E0(u8 taskId) { data->field_98 = 0; playerGender = sub_8017CF8(taskData[1], data->field_0); - switch (var5) + if (var5 == -2 || var5 == 0x40) { - case -2: - case 0x40: data->field_4C[0] = 0x40; sub_800FE50(data->field_4C); StringCopy(gStringVar4, gUnknown_082EEB80[gLinkPlayers[0].gender]); data->state = 32; - break; - default: + } + else + { gUnknown_02022C2C = var5; gUnknown_02022C2D = (u32)(var5) >> 8; if (gUnknown_02022C2C == 0x41 && !sub_8018024()) @@ -2764,7 +2766,6 @@ void sub_80156E0(u8 taskId) sub_800FE50(data->field_4C); data->state = 27; } - break; } } } @@ -2823,7 +2824,7 @@ void sub_80156E0(u8 taskId) } } break; - case 5: + case 7: id = sub_80179AC(&data->field_0->arr[taskData[1]]); playerGender = sub_8017CF8(taskData[1], data->field_0); @@ -3261,5 +3262,3 @@ void var_800D_set_xB(void) if (InUnionRoom() == TRUE) gSpecialVar_Result = 11; } - -*/