summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/link.s31
-rw-r--r--include/librfu.h38
-rw-r--r--include/link_rfu.h2
-rw-r--r--src/librfu_rfu.c26
-rw-r--r--src/link.c20
5 files changed, 59 insertions, 58 deletions
diff --git a/asm/link.s b/asm/link.s
index 38629bff9..5abaef5b1 100644
--- a/asm/link.s
+++ b/asm/link.s
@@ -7,37 +7,6 @@
// RFU; bss indicates that no file boundary exists here
- thumb_func_start rfu_REQ_sendData_wrapper
-rfu_REQ_sendData_wrapper: @ 800BF0C
- push {lr}
- lsls r0, 24
- lsrs r2, r0, 24
- ldr r0, =gUnknown_03007890
- ldr r0, [r0]
- ldrb r0, [r0]
- cmp r0, 0
- bne _0800BF34
- ldr r0, =gUnknown_03004140
- ldrb r0, [r0, 0x2]
- movs r2, 0
- cmp r0, 0x1
- bne _0800BF3C
- movs r2, 0x1
- b _0800BF3C
- .pool
-_0800BF34:
- ldr r0, =gUnknown_03004140
- ldrb r1, [r0, 0x3]
- movs r1, 0
- strb r1, [r0, 0x3]
-_0800BF3C:
- adds r0, r2, 0
- bl rfu_REQ_sendData
- pop {r0}
- bx r0
- .pool
- thumb_func_end rfu_REQ_sendData_wrapper
-
thumb_func_start sub_800BF4C
sub_800BF4C: @ 800BF4C
push {r4-r6,lr}
diff --git a/include/librfu.h b/include/librfu.h
index 609fffea2..4e3c82ac3 100644
--- a/include/librfu.h
+++ b/include/librfu.h
@@ -103,9 +103,47 @@ struct RfuIntrStruct
u8 block2[0x30];
};
+struct RfuUnk1
+{
+ u8 unk_0[0x14];
+ u32 unk_14;
+ u32 unk_18;
+ struct RfuIntrStruct unk_1c;
+};
+
+struct RfuUnk2
+{
+ u8 unk_0[0x68];
+ u32 unk_68;
+ u32 unk_6c;
+ u8 unk_70[0x70];
+};
+
+struct RfuUnk3
+{
+ u32 unk_0;
+ u32 unk_4;
+ u8 unk_8[0xD4];
+ u32 unk_dc;
+};
+
+struct RfuUnk5
+{
+ u8 unk_00;
+};
+
extern struct RfuStruct *gRfuState;
+extern struct RfuUnk5 *gUnknown_03007890;
+extern u32 *gUnknown_03007894;
+extern struct RfuUnk3* gUnknown_03007898;
+extern struct RfuUnk2* gUnknown_03007880[4];
+extern struct RfuUnk1* gUnknown_03007870[4];
+extern void* sub_82E53F4;
+extern void rfu_STC_clearAPIVariables(void);
+
void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam);
void rfu_REQ_stopMode(void);
void rfu_waitREQComplete(void);
u32 rfu_REQBN_softReset_and_checkID(void);
+void rfu_REQ_sendData(u8);
diff --git a/include/link_rfu.h b/include/link_rfu.h
index a395119fa..8929973d8 100644
--- a/include/link_rfu.h
+++ b/include/link_rfu.h
@@ -7,7 +7,7 @@ struct UnkRfuStruct_1 {
u8 unk_00;
u8 unk_01;
u8 unk_02;
- u8 unk_03;
+ vu8 unk_03;
u8 unk_04;
u8 unk_05;
u8 unk_06;
diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c
index cf3fe12ad..2169f4578 100644
--- a/src/librfu_rfu.c
+++ b/src/librfu_rfu.c
@@ -3,31 +3,7 @@
#include "librfu.h"
-struct RfuUnk1
-{
- u8 unk_0[0x14];
- u32 unk_14;
- u32 unk_18;
- struct RfuIntrStruct unk_1c;
-};
-
-struct RfuUnk2
-{
- u8 unk_0[0x68];
- u32 unk_68;
- u32 unk_6c;
- u8 unk_70[0x70];
-};
-
-struct RfuUnk3
-{
- u32 unk_0;
- u32 unk_4;
- u8 unk_8[0xD4];
- u32 unk_dc;
-};
-
-extern u32 *gUnknown_03007890;
+extern struct RfuUnk5 *gUnknown_03007890;
extern u32 *gUnknown_03007894;
extern struct RfuUnk3* gUnknown_03007898;
extern struct RfuUnk2* gUnknown_03007880[4];
diff --git a/src/link.c b/src/link.c
index 645fcc182..fc9e14b68 100644
--- a/src/link.c
+++ b/src/link.c
@@ -2447,7 +2447,6 @@ void ResetRecvBuffer(void)
u32 sub_800BEC0(void)
{
u32 r4;
- u8 r2;
r4 = rfu_REQBN_softReset_and_checkID();
if (r4 == 0x8001)
@@ -2467,3 +2466,22 @@ u32 sub_800BEC0(void)
sub_800D610();
return r4;
}
+
+void rfu_REQ_sendData_wrapper(u8 r2)
+{
+ u8 val;
+ if (!gUnknown_03007890->unk_00)
+ {
+ val = gUnknown_03004140.unk_02;
+ r2 = 0;
+ if (val == 1)
+ {
+ r2 = 1;
+ }
+ }
+ else
+ {
+ gUnknown_03004140.unk_03 = 0;
+ }
+ rfu_REQ_sendData(r2);
+}