summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiangzhengwenjz <jiangzhengwenjzw@qq.com>2020-01-10 04:13:33 +0800
committerjiangzhengwenjz <jiangzhengwenjzw@qq.com>2020-01-10 04:14:22 +0800
commitaa9843199592012301931381bd2fe1396fe29c82 (patch)
tree6bf12c647db0c4dd6bf7f8f19d0b60f97b2abda9
parent0ce29c0ee9e7a37089e9bea8111ef40e16d6a63e (diff)
librfu rodata
-rw-r--r--data/librfu_rodata.s28
-rw-r--r--ld_script.txt3
-rw-r--r--src/librfu_rfu.c37
-rw-r--r--src/librfu_s32id.c7
4 files changed, 32 insertions, 43 deletions
diff --git a/data/librfu_rodata.s b/data/librfu_rodata.s
deleted file mode 100644
index e5b15c6c5..000000000
--- a/data/librfu_rodata.s
+++ /dev/null
@@ -1,28 +0,0 @@
- .section .rodata
-
- .set VERSION_MAJOR, 1
- .set VERSION_MINOR, 0
- .set VERSION_REVISION, 24
-
- .align 2
-_Str_RfuHeader::
- .byte 2, 14, 0, 10, 9, 5, 7, 2
- .byte 0, 15, 1, 3, 3, 0, 31, 0
- .byte 3, 22, 18, 14, 13, 9, 11, 3
- .byte 15, 15, 1, 3, 3, 0, 0x7f, 0
-
- @ .ascii "RFU_V1024"
- .ascii "RFU_V"
- .byte VERSION_MAJOR + 0x30
- .byte VERSION_MINOR + 0x30
- .byte (VERSION_REVISION / 10) + 0x30
- .byte (VERSION_REVISION % 10) + 0x30
- .byte 0
-
- .align 2
-_Str_RFU_MBOOT::
- .asciz "RFU-MBOOT"
-
- .align 2
-_Str_Sio32ID::
- .asciz "NINTENDOSio32ID_030820"
diff --git a/ld_script.txt b/ld_script.txt
index 0588a613a..614bc4c93 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -940,7 +940,8 @@ SECTIONS {
src/agb_flash_1m.o(.rodata);
src/agb_flash_mx.o(.rodata);
src/agb_flash_le.o(.rodata);
- data/librfu_rodata.o(.rodata);
+ src/librfu_rfu.o(.rodata);
+ src/librfu_s32id.o(.rodata);
src/isagbprn.o(.rodata);
*libgcc.a:_divdi3.o(.rodata);
*libgcc.a:_udivdi3.o(.rodata);
diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c
index 70d5b4990..96de99c2a 100644
--- a/src/librfu_rfu.c
+++ b/src/librfu_rfu.c
@@ -1,6 +1,6 @@
#include "librfu.h"
-struct RfuHeader
+struct LLSFStruct
{
u8 unk00;
u8 unk01;
@@ -67,15 +67,30 @@ static void rfu_STC_NI_receive_Sender(u8, u8, const struct RfuLocalStruct *, UNU
static void rfu_STC_NI_initSlot_asRecvDataEntity(u8, struct NIComm *);
static void rfu_STC_NI_initSlot_asRecvControllData(u8, struct NIComm *);
-extern const char _Str_RFU_MBOOT[];
-extern const struct RfuHeader _Str_RfuHeader[2];
-
struct RfuSlotStatusUNI *gRfuSlotStatusUNI[RFU_CHILD_MAX];
struct RfuSlotStatusNI *gRfuSlotStatusNI[RFU_CHILD_MAX];
struct RfuLinkStatus *gRfuLinkStatus;
struct RfuStatic *gRfuStatic;
struct RfuFixed *gRfuFixed;
+static const struct LLSFStruct llsf_struct[2] = {
+ {
+ 2, 14, 0, 10, 9, 5, 7, 2,
+ 0, 15, 1, 3, 3, 0x1f
+ }, {
+ 3, 22, 18, 14, 13, 9, 11, 3,
+ 15, 15, 1, 3, 3, 0x7f
+ }
+};
+
+#ifdef EMERALD
+static const char lib_ver[] = "RFU_V1026";
+#else
+static const char lib_ver[] = "RFU_V1024";
+#endif
+
+static const char str_checkMbootLL[] = "RFU-MBOOT";
+
u16 rfu_initializeAPI(struct RfuAPIBuffer *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p, bool8 copyInterruptToRam)
{
u16 i;
@@ -264,7 +279,7 @@ u16 rfu_getRFUStatus(u8 *rfuState)
u16 rfu_MBOOT_CHILD_inheritanceLinkStatus(void)
{
- const char *s1 = _Str_RFU_MBOOT;
+ const char *s1 = str_checkMbootLL;
char *s2 = (char *)0x30000F0;
u16 checksum;
u16 *r2;
@@ -1315,7 +1330,7 @@ static u16 rfu_STC_setSendData_org(u8 r6, u8 bmSendSlot, u8 subFrameSize, const
r9 = &gRfuLinkStatus->remainLLFrameSizeParent;
else if (gRfuLinkStatus->parentChild == MODE_CHILD)
r9 = &gRfuLinkStatus->remainLLFrameSizeChild[r2];
- r4 = _Str_RfuHeader[gRfuLinkStatus->parentChild].unk00;
+ r4 = llsf_struct[gRfuLinkStatus->parentChild].unk00;
if (subFrameSize > *r9 || subFrameSize <= r4)
return ERR_SUBFRAME_SIZE;
sp04 = REG_IME;
@@ -1672,7 +1687,7 @@ static u16 rfu_STC_NI_constructLLSF(u8 r10, u8 **r12, struct NIComm *r4)
u32 sp00;
u8 i;
u8 *r2;
- const struct RfuHeader *r8 = &_Str_RfuHeader[gRfuLinkStatus->parentChild];
+ const struct LLSFStruct *r8 = &llsf_struct[gRfuLinkStatus->parentChild];
if (r4->state == SLOT_STATE_SENDING)
{
@@ -1732,7 +1747,7 @@ static u16 rfu_STC_NI_constructLLSF(u8 r10, u8 **r12, struct NIComm *r4)
static u16 rfu_STC_UNI_constructLLSF(u8 r8, u8 **r6)
{
- const struct RfuHeader *r5;
+ const struct LLSFStruct *r5;
const u8 *sp04;
u32 sp00;
u8 *r2;
@@ -1741,7 +1756,7 @@ static u16 rfu_STC_UNI_constructLLSF(u8 r8, u8 **r6)
if (!r4->dataReadyFlag || !r4->bmSlot)
return 0;
- r5 = &_Str_RfuHeader[gRfuLinkStatus->parentChild];
+ r5 = &llsf_struct[gRfuLinkStatus->parentChild];
sp00 = (r4->state & 0xF) << r5->unk03
| r4->payloadSize;
if (gRfuLinkStatus->parentChild == MODE_PARENT)
@@ -1857,13 +1872,13 @@ static void rfu_STC_CHILD_analyzeRecvPacket(void)
static u16 rfu_STC_analyzeLLSF(u8 r12, const u8 *r7, u16 r3)
{
struct RfuLocalStruct sp00;
- const struct RfuHeader *r6;
+ const struct LLSFStruct *r6;
u32 r5;
u8 r4;
u32 r0;
u16 r10;
- r6 = &_Str_RfuHeader[~gRfuLinkStatus->parentChild & (MODE_NEUTRAL & MODE_PARENT)];
+ r6 = &llsf_struct[~gRfuLinkStatus->parentChild & (MODE_NEUTRAL & MODE_PARENT)];
if (r3 < r6->unk00)
return r3;
r5 = 0;
diff --git a/src/librfu_s32id.c b/src/librfu_s32id.c
index 7c99cda2d..ed51dcd12 100644
--- a/src/librfu_s32id.c
+++ b/src/librfu_s32id.c
@@ -1,13 +1,14 @@
#include "librfu.h"
-extern const u16 _Str_Sio32ID[];
-
static void Sio32IDIntr(void);
static void Sio32IDInit(void);
static s32 Sio32IDMain(void);
struct RfuS32Id gRfuS32Id;
+static const u16 Sio32ConnectionData[] = { 0x494e, 0x544e, 0x4e45, 0x4f44 }; // NINTENDO
+static const char Sio32IDLib_Var[] = "Sio32ID_030820";
+
s32 AgbRFU_checkID(u8 r5)
{
u16 r8;
@@ -147,7 +148,7 @@ static void Sio32IDIntr(void)
}
}
if (gRfuS32Id.unk2 < 4)
- gRfuS32Id.unk4 = *(gRfuS32Id.unk2 + _Str_Sio32ID);
+ gRfuS32Id.unk4 = *(gRfuS32Id.unk2 + Sio32ConnectionData);
else
gRfuS32Id.unk4 = 0x8001;
gRfuS32Id.unk6 = ~r5;