diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2020-02-11 08:57:13 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2020-02-11 09:36:32 -0500 |
commit | bb7f1f1ff7c9b05e21c8987419eb43b7fa206eac (patch) | |
tree | 8c6f1ae1f85b908203bc247b2e88d7818c26d829 /src | |
parent | fd1f45ceaef6d5987bd987cfda9207d00a394dbb (diff) |
Some version differences in librfu_rfu
Diffstat (limited to 'src')
-rw-r--r-- | src/librfu_rfu.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index 5b0b92c4e..420fb7c9a 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -116,6 +116,14 @@ static const char lib_ver[] = "RFU_V1024"; static const char str_checkMbootLL[] = "RFU-MBOOT"; +#define COPY(src, dst, size) do { \ + const u16 *_src = (const u16 *)(src); \ + u16 *_dst = (u16 *)(dst); \ + u16 _size = (size); \ + while (_size-- != 0) \ + *_dst++ = *_src++; \ +} while (0) + u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p, bool8 copyInterruptToRam) { u16 i; @@ -168,18 +176,21 @@ u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p gRfuSlotStatusUNI[i]->recvBuffer = NULL; gRfuSlotStatusUNI[i]->recvBufferSize = 0; } - src = (const u16 *)((uintptr_t)&rfu_STC_fastCopy & ~1); - dst = gRfuFixed->fastCopyBuffer; // rfu_REQ_changeMasterSlave is the function next to rfu_STC_fastCopy #if LIBRFU_VERSION < 1028 -//#if 0 + src = (const u16 *)((uintptr_t)&rfu_STC_fastCopy & ~1); + dst = gRfuFixed->fastCopyBuffer; buffByteSizeMax = ((void *)rfu_REQ_changeMasterSlave - (void *)rfu_STC_fastCopy) / sizeof(u16); + while (buffByteSizeMax-- != 0) + *dst++ = *src++; #else // register swap dst <--> buffByteSizeMax - buffByteSizeMax = 0x60 / sizeof(u16); + COPY( + (const u16 *)((uintptr_t)&rfu_STC_fastCopy & ~1), + gRfuFixed->fastCopyBuffer, + 0x60 / sizeof(u16) + ); #endif - while (buffByteSizeMax-- != 0) - *dst++ = *src++; gRfuFixed->fastCopyPtr = (void *)gRfuFixed->fastCopyBuffer + 1; return 0; } @@ -490,6 +501,13 @@ static void rfu_CB_configGameData(u8 reqCommand, u16 reqResult) void rfu_REQ_startSearchChild(void) { u16 result; +#if LIBRFU_VERSION >= 1028 + u16 i; + for (i = 0; i < RFU_CHILD_MAX; i++) + { + gRfuStatic->lsFixedCount[i] = 0; + } +#endif STWI_set_Callback_M(rfu_CB_defaultCallback); STWI_send_SystemStatusREQ(); @@ -576,6 +594,11 @@ static void rfu_STC_readChildList(void) u8 true_slots[RFU_CHILD_MAX]; u8 bm_slot_id; +#if LIBRFU_VERSION >= 1028 +//#if 1 + // TODO: decompile this +#endif + if (numSlots != 0) { stwiParam = gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket32.data[0]; |