From a054b244ab150b3823aa513cc215c81dc426c796 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 17 Nov 2017 08:33:25 -0500 Subject: [PATCH] sub_800BF4C --- asm/link.s | 36 ------------------------------------ include/librfu.h | 2 ++ include/link_rfu.h | 3 +++ src/link.c | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 36 deletions(-) diff --git a/asm/link.s b/asm/link.s index 5abaef5b16..93005de351 100644 --- a/asm/link.s +++ b/asm/link.s @@ -7,42 +7,6 @@ // RFU; bss indicates that no file boundary exists here - thumb_func_start sub_800BF4C -sub_800BF4C: @ 800BF4C - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - cmp r5, 0 - beq _0800BF94 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r4, =gUnknown_03004140 - ldr r2, =0x01000024 - mov r0, sp - adds r1, r4, 0 - bl CpuSet - movs r0, 0xFF - strb r0, [r4, 0x6] - str r5, [r4, 0x40] - str r6, [r4, 0x44] - ldr r0, =sub_800CEB0 - bl rfu_setMSCCallback - ldr r0, =sub_800C7B4 - bl rfu_setREQCallback - movs r0, 0 - b _0800BF96 - .pool -_0800BF94: - movs r0, 0x4 -_0800BF96: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_800BF4C - thumb_func_start sub_800BFA0 sub_800BFA0: @ 800BFA0 push {r4,lr} diff --git a/include/librfu.h b/include/librfu.h index 4e3c82ac37..9b82de0b76 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -147,3 +147,5 @@ void rfu_REQ_stopMode(void); void rfu_waitREQComplete(void); u32 rfu_REQBN_softReset_and_checkID(void); void rfu_REQ_sendData(u8); +void rfu_setMSCCallback(void (*func)(u16)); +void rfu_setREQCallback(void (*func)(u16, u16)); diff --git a/include/link_rfu.h b/include/link_rfu.h index 8929973d85..24bddbe570 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -15,6 +15,9 @@ struct UnkRfuStruct_1 { u8 unk_08; u8 filler_09[4]; u8 unk_0d; + u8 filler_0e[0x32]; + void (*unk_40)(u8); + void (*unk_44)(void); }; // Exported RAM declarations diff --git a/src/link.c b/src/link.c index fc9e14b682..963ef603ea 100644 --- a/src/link.c +++ b/src/link.c @@ -170,6 +170,8 @@ static void StopTimer(void); static void SendRecvDone(void); void sub_800D610(void); +void sub_800CEB0(u16 unk0); +void sub_800C7B4(u16 unk0, u16 unk1); // .rodata @@ -2485,3 +2487,18 @@ void rfu_REQ_sendData_wrapper(u8 r2) } rfu_REQ_sendData(r2); } + +int sub_800BF4C(void (*func1)(u8), void (*func2)(void)) +{ + if (func1 == NULL) + { + return 4; + } + CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140)); + gUnknown_03004140.unk_06 = -1; + gUnknown_03004140.unk_40 = func1; + gUnknown_03004140.unk_44 = func2; + rfu_setMSCCallback(sub_800CEB0); + rfu_setREQCallback(sub_800C7B4); + return 0; +}