diff --git a/asm/link.s b/asm/link.s index 93005de35..f0250361f 100644 --- a/asm/link.s +++ b/asm/link.s @@ -7,55 +7,6 @@ // RFU; bss indicates that no file boundary exists here - thumb_func_start sub_800BFA0 -sub_800BFA0: @ 800BFA0 - push {r4,lr} - sub sp, 0x4 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldr r2, =0x01000020 - mov r0, sp - adds r1, r4, 0 - bl CpuSet - movs r0, 0xFF - strb r0, [r4, 0x6] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800BFA0 - - thumb_func_start sub_800BFCC -sub_800BFCC: @ 800BFCC - push {r4,lr} - adds r4, r0, 0 - bl sub_800C000 - ldr r1, =gUnknown_03004140 - movs r2, 0x1 - strb r2, [r1, 0x4] - movs r0, 0x2 - strb r0, [r1, 0x5] - str r4, [r1, 0x3C] - ldrb r0, [r4, 0x11] - strb r0, [r1, 0x9] - ldrh r0, [r4, 0x12] - strh r0, [r1, 0x32] - ldrh r0, [r4, 0x14] - strh r0, [r1, 0x18] - ldrb r0, [r4, 0x10] - cmp r0, 0 - beq _0800BFF4 - strb r2, [r1, 0xB] -_0800BFF4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800BFCC - thumb_func_start sub_800C000 sub_800C000: @ 800C000 push {r4,r5,lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 24bddbe57..88737559f 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -3,6 +3,15 @@ // Exported type declarations +struct UnkLinkRfuStruct_02022B2C +{ + u8 filler_00[16]; + u8 unk_10; + u8 unk_11; + u16 unk_12; + u16 unk_14; +}; + struct UnkRfuStruct_1 { u8 unk_00; u8 unk_01; @@ -13,9 +22,17 @@ struct UnkRfuStruct_1 { u8 unk_06; u8 unk_07; u8 unk_08; - u8 filler_09[4]; + u8 unk_09; + u8 unk_0a; + u8 unk_0b; + u8 unk_0c; u8 unk_0d; - u8 filler_0e[0x32]; + u8 filler_0e[10]; + u16 unk_18; + u8 filler_1a[0x18]; + u16 unk_32; + u8 filler_34[8]; + struct UnkLinkRfuStruct_02022B2C *unk_3c; void (*unk_40)(u8); void (*unk_44)(void); }; diff --git a/src/link.c b/src/link.c index 963ef603e..96234ad04 100644 --- a/src/link.c +++ b/src/link.c @@ -172,6 +172,7 @@ static void SendRecvDone(void); void sub_800D610(void); void sub_800CEB0(u16 unk0); void sub_800C7B4(u16 unk0, u16 unk1); +void sub_800C000(void); // .rodata @@ -2502,3 +2503,24 @@ int sub_800BF4C(void (*func1)(u8), void (*func2)(void)) rfu_setREQCallback(sub_800C7B4); return 0; } + +void sub_800BFA0(void) +{ + CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140) - 2 * sizeof(void *)); + gUnknown_03004140.unk_06 = -1; +} + +void sub_800BFCC(struct UnkLinkRfuStruct_02022B2C *unk0) +{ + sub_800C000(); + gUnknown_03004140.unk_04 = 1; + gUnknown_03004140.unk_05 = 2; + gUnknown_03004140.unk_3c = unk0; + gUnknown_03004140.unk_09 = unk0->unk_11; + gUnknown_03004140.unk_32 = unk0->unk_12; + gUnknown_03004140.unk_18 = unk0->unk_14; + if (unk0->unk_10) + { + gUnknown_03004140.unk_0b = 1; + } +}