From 3faaeafffe12a53fc525d6b9950e97d1ccd4cbad Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 20 Jan 2018 19:23:21 -0500 Subject: [PATCH] through sub_8011090 --- asm/link_rfu.s | 216 ------------------------------------------------- src/link_rfu.c | 71 ++++++++++++++++ 2 files changed, 71 insertions(+), 216 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index a55ae2d401..d7389616e4 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,222 +5,6 @@ .text - thumb_func_start sub_8010F1C -sub_8010F1C: @ 8010F1C - push {r4,lr} - movs r4, 0 - ldr r1, =gUnknown_03005000 - adds r0, r1, 0 - adds r0, 0xEF - ldrb r0, [r0] - cmp r0, 0 - bne _08010F3C - ldrb r0, [r1, 0xC] - cmp r0, 0x1 - bne _08010F38 - bl sub_800F1E0 - adds r4, r0, 0 -_08010F38: - bl sub_8010DB4 -_08010F3C: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8010F1C - - thumb_func_start sub_8010F48 -sub_8010F48: @ 8010F48 - push {lr} - ldr r0, =gUnknown_02022B14 + 0xE - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010F48 - - thumb_func_start sub_8010F60 -sub_8010F60: @ 8010F60 - push {r4,lr} - ldr r4, =gUnknown_02022B14 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0xD - bl memset - adds r0, r4, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_800DD94 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010F60 - - thumb_func_start sub_8010F84 -sub_8010F84: @ 8010F84 - push {r4,lr} - adds r4, r0, 0 - adds r3, r1, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_02022B14 - adds r1, r4, 0 - bl sub_800DD94 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010F84 - - thumb_func_start sub_8010FA0 -sub_8010FA0: @ 8010FA0 - push {r4,r5,lr} - ldr r5, =gUnknown_02022B14 - movs r4, 0x1 - ands r0, r4 - lsls r0, 4 - ldrb r3, [r5] - movs r2, 0x11 - negs r2, r2 - ands r2, r3 - orrs r2, r0 - ands r1, r4 - lsls r1, 5 - movs r0, 0x21 - negs r0, r0 - ands r2, r0 - orrs r2, r1 - strb r2, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010FA0 - - thumb_func_start sub_8010FCC -sub_8010FCC: @ 8010FCC - push {r4,r5,lr} - ldr r5, =gUnknown_02022B14 - lsls r0, 2 - ldrb r4, [r5, 0x9] - movs r3, 0x3 - ands r3, r4 - orrs r3, r0 - strb r3, [r5, 0x9] - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r1, r0 - ldrh r3, [r5, 0x8] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r1 - strh r0, [r5, 0x8] - lsls r2, 1 - ldrb r1, [r5, 0xB] - movs r0, 0x1 - ands r0, r1 - orrs r0, r2 - strb r0, [r5, 0xB] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8010FCC - - thumb_func_start sub_801100C -sub_801100C: @ 801100C - push {r4,lr} - movs r4, 0x80 - ldr r3, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r0, r1, r3 - ldrb r2, [r0, 0x13] - lsls r2, 3 - orrs r2, r4 - adds r3, 0x4 - adds r1, r3 - ldr r0, [r1] - movs r1, 0x7 - ands r0, r1 - orrs r0, r2 - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801100C - - thumb_func_start sub_801103C -sub_801103C: @ 801103C - push {r4,r5,lr} - ldr r5, =gUnknown_02022B14 - movs r4, 0x1 - b _08011054 - .pool -_08011048: - adds r0, r4, 0 - bl sub_801100C - adds r1, r5, r4 - strb r0, [r1, 0x3] - adds r4, 0x1 -_08011054: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _08011048 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801103C - - thumb_func_start sub_8011068 -sub_8011068: @ 8011068 - push {lr} - lsls r0, 24 - ldr r2, =gUnknown_02022B14 - lsrs r0, 17 - ldrb r3, [r2, 0xA] - movs r1, 0x7F - ands r1, r3 - orrs r1, r0 - strb r1, [r2, 0xA] - ldr r3, =gUnknown_02022B14 + 0xE - movs r0, 0 - movs r1, 0x2 - bl rfu_REQ_configGameData - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011068 - - thumb_func_start sub_8011090 -sub_8011090: @ 8011090 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _0801109E - bl sub_8010F84 -_0801109E: - ldr r2, =gUnknown_02022B14 - ldr r3, =gUnknown_02022B14 + 0xE - movs r0, 0 - movs r1, 0x2 - bl rfu_REQ_configGameData - pop {r0} - bx r0 - .pool - thumb_func_end sub_8011090 - thumb_func_start sub_80110B8 sub_80110B8: @ 80110B8 push {r4-r7,lr} diff --git a/src/link_rfu.c b/src/link_rfu.c index a6883a3042..6e8d99c0dc 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -4477,3 +4477,74 @@ bool32 sub_8010EC0(void) } return retval; } + +bool32 sub_8010F1C(void) +{ + bool32 retval = FALSE; + if (gUnknown_03005000.unk_ef == 0) + { + if (gUnknown_03005000.unk_0c == 1) + retval = sub_800F1E0(); + sub_8010DB4(); + } + return retval; +} + +void sub_8010F48(void) +{ + StringCopy(gUnknown_02022B22, gSaveBlock2Ptr->playerName); +} + +void sub_8010F60(void) +{ + gUnknown_02022B14 = (struct UnkLinkRfuStruct_02022B14){}; + sub_800DD94(&gUnknown_02022B14, 0, 0, 0); +} + +void sub_8010F84(u8 a0, u32 a1, u32 a2) +{ + sub_800DD94(&gUnknown_02022B14, a0, a2, a1); +} + +void sub_8010FA0(bool32 a0, bool32 a1) +{ + gUnknown_02022B14.unk_00_4 = a0; + gUnknown_02022B14.unk_00_5 = a1; +} + +void sub_8010FCC(u32 a0, u32 a1, u32 a2) +{ + gUnknown_02022B14.unk_09_2 = a0; + gUnknown_02022B14.unk_08_0 = a1; + gUnknown_02022B14.unk_0b_1 = a2; +} + +u8 sub_801100C(int a0) +{ + u8 retval = 0x80; + retval |= (gLinkPlayers[a0].gender << 3); + retval |= (gLinkPlayers[a0].trainerId & 7); + return retval; +} + +void sub_801103C(void) +{ + struct UnkLinkRfuStruct_02022B14 *r5 = &gUnknown_02022B14; + int i; + + for (i = 1; i < GetLinkPlayerCount(); i++) + r5->unk_04[i - 1] = sub_801100C(i); +} + +void sub_8011068(u8 a0) +{ + gUnknown_02022B14.unk_0a_7 = a0; + rfu_REQ_configGameData(0, 2, &gUnknown_02022B14, gUnknown_02022B22); +} + +void sub_8011090(u8 a0, u32 a1, u32 a2) +{ + if (a0) + sub_8010F84(a0, a1, a2); + rfu_REQ_configGameData(0, 2, &gUnknown_02022B14, gUnknown_02022B22); +}