summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2017-11-13 01:12:34 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2017-11-13 01:12:34 -0500
commitfcb8c8cf32f424bf83c8e95555ac41598e71104c (patch)
tree806159e1ad38b8074724c8b5c43c53a158cf56d8
parent515459d151bcc9b4f046a93a77e8e9412a2f2ca4 (diff)
through sub_800B524
-rw-r--r--asm/link.s57
-rw-r--r--include/link.h42
-rw-r--r--include/link_rfu.h1
-rw-r--r--src/link.c29
4 files changed, 51 insertions, 78 deletions
diff --git a/asm/link.s b/asm/link.s
index 6c7b3ff4a..c1e8a4904 100644
--- a/asm/link.s
+++ b/asm/link.s
@@ -5,63 +5,6 @@
.text
- thumb_func_start sub_800B4DC
-sub_800B4DC: @ 800B4DC
- push {lr}
- ldr r0, =gWirelessCommType
- ldrb r0, [r0]
- cmp r0, 0
- bne _0800B4FC
- ldr r0, =gLink
- ldr r1, =0x00000fbd
- adds r0, r1
- ldrb r0, [r0]
- b _0800B500
- .pool
-_0800B4FC:
- bl sub_80124D4
-_0800B500:
- pop {r1}
- bx r1
- thumb_func_end sub_800B4DC
-
- thumb_func_start sub_800B504
-sub_800B504: @ 800B504
- push {lr}
- bl sub_800B4DC
- cmp r0, 0x2
- bhi _0800B512
- movs r0, 0
- b _0800B514
-_0800B512:
- movs r0, 0x1
-_0800B514:
- pop {r1}
- bx r1
- thumb_func_end sub_800B504
-
- thumb_func_start sub_800B518
-sub_800B518: @ 800B518
- ldr r0, =gWirelessCommType
- ldrb r0, [r0]
- bx lr
- .pool
- thumb_func_end sub_800B518
-
- thumb_func_start sub_800B524
-sub_800B524: @ 800B524
- push {lr}
- ldrb r1, [r0, 0x10]
- strb r1, [r0, 0x12]
- adds r2, r0, 0
- adds r2, 0x8
- ldrb r1, [r0, 0x1A]
- adds r0, r2, 0
- bl ConvertInternationalString
- pop {r0}
- bx r0
- thumb_func_end sub_800B524
-
thumb_func_start DisableSerial
DisableSerial: @ 800B53C
push {lr}
diff --git a/include/link.h b/include/link.h
index 50a74e612..edbf0be38 100644
--- a/include/link.h
+++ b/include/link.h
@@ -104,9 +104,9 @@ struct LinkPlayerBlock
struct SendQueue
{
- u16 data[CMD_LENGTH][QUEUE_CAPACITY];
- u8 pos;
- u8 count;
+ /* 0x000 */ u16 data[CMD_LENGTH][QUEUE_CAPACITY];
+ /* 0x320 */ u8 pos;
+ /* 0x321 */ u8 count;
};
struct RecvQueue
@@ -118,29 +118,29 @@ struct RecvQueue
struct Link
{
- u8 isMaster; // 0: slave, 8: master
- u8 state;
- u8 localId; // local multi-player ID
- u8 playerCount;
- u16 tempRecvBuffer[4];
- bool8 receivedNothing;
- s8 serialIntrCounter;
- bool8 handshakeAsMaster;
- u8 link_field_F;
+ /* 0x000 */ u8 isMaster; // 0: slave, 8: master
+ /* 0x001 */ u8 state;
+ /* 0x002 */ u8 localId; // local multi-player ID
+ /* 0x003 */ u8 playerCount;
+ /* 0x004 */ u16 tempRecvBuffer[4];
+ /* 0x00c */ bool8 receivedNothing;
+ /* 0x00d */ s8 serialIntrCounter;
+ /* 0x00e */ bool8 handshakeAsMaster;
+ /* 0x00f */ u8 link_field_F;
// error conditions
- bool8 hardwareError; // hardware reported an error
- bool8 badChecksum; // checksum didn't match between devices
- u8 queueFull; // send or recv queue out of space
- u8 lag; // connection is lagging
+ /* 0x010 */ bool8 hardwareError; // hardware reported an error
+ /* 0x011 */ bool8 badChecksum; // checksum didn't match between devices
+ /* 0x012 */ u8 queueFull; // send or recv queue out of space
+ /* 0x013 */ u8 lag; // connection is lagging
- u16 checksum;
+ /* 0x014 */ u16 checksum;
- u8 sendCmdIndex;
- u8 recvCmdIndex;
+ /* 0x016 */ u8 sendCmdIndex;
+ /* 0x017 */ u8 recvCmdIndex;
- struct SendQueue sendQueue;
- struct RecvQueue recvQueue;
+ /* 0x018 */ struct SendQueue sendQueue;
+ /* 0x33c */ struct RecvQueue recvQueue;
};
struct BlockRequest
diff --git a/include/link_rfu.h b/include/link_rfu.h
index a63e07745..2062b3a79 100644
--- a/include/link_rfu.h
+++ b/include/link_rfu.h
@@ -30,5 +30,6 @@ void sub_800E6D0(void);
bool32 sub_8010EC0(void);
bool32 sub_8010F1C(void);
bool32 sub_800F0B8(void);
+u32 sub_80124D4(void);
#endif //GUARD_LINK_RFU_H
diff --git a/src/link.c b/src/link.c
index 44d96937e..266c7109d 100644
--- a/src/link.c
+++ b/src/link.c
@@ -1866,3 +1866,32 @@ void sub_800B4C0(void)
gWirelessCommType = 0;
}
}
+
+u32 sub_800B4DC(void)
+{
+ if (gWirelessCommType != 0)
+ {
+ return sub_80124D4();
+ }
+ return gLink.recvQueue.count;
+}
+
+bool8 sub_800B504(void)
+{
+ if (sub_800B4DC() > 2)
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+u8 sub_800B518(void)
+{
+ return gWirelessCommType;
+}
+
+void sub_800B524(struct LinkPlayer *player)
+{
+ player->name[10] = player->name[8];
+ ConvertInternationalString(player->name, player->language);
+}