diff options
author | Akira Akashi <rubenru09@aol.com> | 2021-05-16 03:36:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-16 03:36:27 +0100 |
commit | b09a7b81d1f44adc521686d2b56d4b28c748995c (patch) | |
tree | 5245ec30ef97ba2a166c2008fcf16661a8e900cd | |
parent | 21ebb3b01cdd47bd7aa56affe7d2179d167453bc (diff) | |
parent | 5f4bb52fd5d93b2638c99baee82d63b4d9b9f790 (diff) |
Merge pull request #375 from SethBarberee/wifi_md5_stub
WIFIMD5, RTC, and Unk0202254
-rw-r--r-- | arm9/asm/RTC_internal.s | 53 | ||||
-rw-r--r-- | arm9/asm/WIFI_stubsmd5_dummy.s | 25 | ||||
-rw-r--r-- | arm9/asm/unk_02022504.s | 53 | ||||
-rw-r--r-- | arm9/lib/include/RTC_internal.h | 11 | ||||
-rw-r--r-- | arm9/lib/src/RTC_internal.c | 31 | ||||
-rw-r--r-- | arm9/src/WIFI_stubsmd5_dummy.c | 17 | ||||
-rw-r--r-- | arm9/src/unk_02022504.c | 32 | ||||
-rw-r--r-- | include/WIFI_stubsmd5_dummy.h | 11 | ||||
-rw-r--r-- | include/unk_02022504.h | 14 |
9 files changed, 116 insertions, 131 deletions
diff --git a/arm9/asm/RTC_internal.s b/arm9/asm/RTC_internal.s deleted file mode 100644 index 408b630c..00000000 --- a/arm9/asm/RTC_internal.s +++ /dev/null @@ -1,53 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - arm_func_start RtcSendPxiCommand -RtcSendPxiCommand: ; 0x020D61D4 - stmdb sp!, {lr} - sub sp, sp, #0x4 - mov r0, r0, lsl #0x8 - and r1, r0, #0x7f00 - mov r0, #0x5 - mov r2, #0x0 - bl PXI_SendWordByFifo -_020D61F0: ; 0x020D61F0 - cmp r0, #0x0 - movge r0, #0x1 - movlt r0, #0x0 - add sp, sp, #0x4 - ldmia sp!, {lr} - bx lr - - arm_func_start RTCi_WriteRawStatus2Async -RTCi_WriteRawStatus2Async: - ldr ip, _020D6214 ; =RtcSendPxiCommand - mov r0, #0x27 - bx r12 - .balign 4 -_020D6214: .word RtcSendPxiCommand - - arm_func_start RTCi_ReadRawTimeAsync -RTCi_ReadRawTimeAsync: - ldr ip, _020D6224 ; =RtcSendPxiCommand - mov r0, #0x12 - bx r12 - .balign 4 -_020D6224: .word RtcSendPxiCommand - - arm_func_start RTCi_ReadRawDateAsync -RTCi_ReadRawDateAsync: - ldr ip, _020D6234 ; =RtcSendPxiCommand - mov r0, #0x11 - bx r12 - .balign 4 -_020D6234: .word RtcSendPxiCommand - - arm_func_start RTCi_ReadRawDateTimeAsync -RTCi_ReadRawDateTimeAsync: - ldr ip, _020D6244 ; =RtcSendPxiCommand - mov r0, #0x10 - bx r12 - .balign 4 -_020D6244: .word RtcSendPxiCommand diff --git a/arm9/asm/WIFI_stubsmd5_dummy.s b/arm9/asm/WIFI_stubsmd5_dummy.s deleted file mode 100644 index dd3f79a7..00000000 --- a/arm9/asm/WIFI_stubsmd5_dummy.s +++ /dev/null @@ -1,25 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - arm_func_start MD5Final -MD5Final: ; 0x020A8BA4 - ldr ip, _020A8BAC ; =DGT_Hash1GetDigest_R - bx r12 - .balign 4 -_020A8BAC: .word DGT_Hash1GetDigest_R - - arm_func_start MD5Update -MD5Update: ; 0x020A8BB0 - ldr ip, _020A8BB8 ; =DGT_Hash1SetSource - bx r12 - .balign 4 -_020A8BB8: .word DGT_Hash1SetSource - - arm_func_start MD5Init -MD5Init: ; 0x020A8BBC - ldr ip, _020A8BC4 ; =DGT_Hash1Reset - bx r12 - .balign 4 -_020A8BC4: .word DGT_Hash1Reset diff --git a/arm9/asm/unk_02022504.s b/arm9/asm/unk_02022504.s deleted file mode 100644 index e3463538..00000000 --- a/arm9/asm/unk_02022504.s +++ /dev/null @@ -1,53 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_02022504 -FUN_02022504: ; 0x02022504 - ldr r3, _0202250C ; =SavArray_get - mov r1, #0x1b - bx r3 - nop -_0202250C: .word SavArray_get - - thumb_func_start GetStoragePCPointer -GetStoragePCPointer: ; 0x02022510 - ldr r3, _02022518 ; =SavArray_get - mov r1, #0x23 - bx r3 - nop -_02022518: .word SavArray_get - - thumb_func_start FUN_0202251C -FUN_0202251C: ; 0x0202251C - ldr r3, _02022524 ; =SavArray_get - mov r1, #0x1f - bx r3 - nop -_02022524: .word SavArray_get - - thumb_func_start FUN_02022528 -FUN_02022528: ; 0x02022528 - ldr r3, _02022530 ; =SavArray_get - mov r1, #0x20 - bx r3 - nop -_02022530: .word SavArray_get - - thumb_func_start LoadHallOfFame -LoadHallOfFame: ; 0x02022534 - push {r3, lr} - add r3, r2, #0x0 - mov r2, #0x0 - bl ReadSaveFileFromFlash - pop {r3, pc} - - thumb_func_start SaveHallOfFame -SaveHallOfFame: ; 0x02022540 - ldr r3, _02022548 ; =WriteSaveFileToFlash - add r2, r1, #0x0 - mov r1, #0x0 - bx r3 - .balign 4 -_02022548: .word WriteSaveFileToFlash diff --git a/arm9/lib/include/RTC_internal.h b/arm9/lib/include/RTC_internal.h new file mode 100644 index 00000000..440d8b95 --- /dev/null +++ b/arm9/lib/include/RTC_internal.h @@ -0,0 +1,11 @@ +#ifndef NITRO_RTC_INTERNAL_H_ +#define NITRO_RTC_INTERNAL_H_ + +#include "nitro/types.h" + +BOOL RTCi_WriteRawStatus2Async(void); +BOOL RTCi_ReadRawTimeAsync(void); +BOOL RTCi_ReadRawDateAsync(void); +BOOL RTCi_ReadRawDateTimeAsync(void); + +#endif //NITRO_RTC_INTERNAL_H_ diff --git a/arm9/lib/src/RTC_internal.c b/arm9/lib/src/RTC_internal.c new file mode 100644 index 00000000..c7a5f2aa --- /dev/null +++ b/arm9/lib/src/RTC_internal.c @@ -0,0 +1,31 @@ +#include "function_target.h" +#include "PXI_fifo.h" +#include "RTC_internal.h" + +static BOOL RtcSendPxiCommand(u8 command); + +ARM_FUNC BOOL RTCi_ReadRawDateTimeAsync(void) +{ + return RtcSendPxiCommand(16); +} + +ARM_FUNC BOOL RTCi_ReadRawDateAsync(void) +{ + return RtcSendPxiCommand(17); +} + +ARM_FUNC BOOL RTCi_ReadRawTimeAsync(void) +{ + return RtcSendPxiCommand(18); +} + +ARM_FUNC BOOL RTCi_WriteRawStatus2Async(void) +{ + return RtcSendPxiCommand(39); +} + +ARM_FUNC static BOOL RtcSendPxiCommand(u8 command) +{ + s32 data = command << 8 & 0x7f00; + return PXI_SendWordByFifo(PXI_FIFO_TAG_RTC, data, FALSE) >= 0; +} diff --git a/arm9/src/WIFI_stubsmd5_dummy.c b/arm9/src/WIFI_stubsmd5_dummy.c new file mode 100644 index 00000000..6de2edca --- /dev/null +++ b/arm9/src/WIFI_stubsmd5_dummy.c @@ -0,0 +1,17 @@ +#include "function_target.h" +#include "WIFI_stubsmd5_dummy.h" + +ARM_FUNC void MD5Final(u8 *digest, struct DGTHash1Context *context) +{ + DGT_Hash1GetDigest_R(digest, context); +} + +ARM_FUNC void MD5Update(struct DGTHash1Context *context, u8 *input, u32 length) +{ + DGT_Hash1SetSource(context, input, length); +} + +ARM_FUNC void MD5Init(struct DGTHash1Context *context) +{ + DGT_Hash1Reset(context); +} diff --git a/arm9/src/unk_02022504.c b/arm9/src/unk_02022504.c new file mode 100644 index 00000000..0267a87c --- /dev/null +++ b/arm9/src/unk_02022504.c @@ -0,0 +1,32 @@ +#include "global.h" +#include "unk_02022504.h" + +THUMB_FUNC void *FUN_02022504(struct SaveBlock2 *sav2) +{ + return SavArray_get(sav2, 27); +} + +THUMB_FUNC struct PCStorage *GetStoragePCPointer(struct SaveBlock2 *sav2) +{ + return SavArray_get(sav2, 35); +} + +THUMB_FUNC void *FUN_0202251C(struct SaveBlock2 *sav2) +{ + return SavArray_get(sav2, 31); +} + +THUMB_FUNC void *FUN_02022528(struct SaveBlock2 *sav2) +{ + return SavArray_get(sav2, 32); +} + +THUMB_FUNC u8 *LoadHallOfFame(struct SaveBlock2 *sav2, u32 heap_id, int *ret_p) +{ + return ReadSaveFileFromFlash(sav2, heap_id, 0, ret_p); +} + +THUMB_FUNC s32 *SaveHallOfFame(struct SaveBlock2 *sav2, u8 *data) +{ + return WriteSaveFileToFlash(sav2, 0, data); +} diff --git a/include/WIFI_stubsmd5_dummy.h b/include/WIFI_stubsmd5_dummy.h new file mode 100644 index 00000000..d82b55c5 --- /dev/null +++ b/include/WIFI_stubsmd5_dummy.h @@ -0,0 +1,11 @@ +#ifndef POKEDIAMOND_WIFI_STUBSMD5_DUMMY_H +#define POKEDIAMOND_WIFI_STUBSMD5_DUMMY_H + +#include "nitro/types.h" +#include "dgt.h" + +void MD5Final(u8 *digest, struct DGTHash1Context *context); +void MD5Update(struct DGTHash1Context *context, u8 *input, u32 length); +void MD5Init(struct DGTHash1Context *context); + +#endif //POKEDIAMOND_WIFI_STUBSMD5_DUMMY_H diff --git a/include/unk_02022504.h b/include/unk_02022504.h new file mode 100644 index 00000000..aa541f85 --- /dev/null +++ b/include/unk_02022504.h @@ -0,0 +1,14 @@ +#ifndef POKEDIAMOND_UNK_02022504_H +#define POKEDIAMOND_UNK_02022504_H + +#include "save_block_2.h" +#include "pokemon_storage_system.h" + +void *FUN_02022504(struct SaveBlock2 *sav2); +struct PCStorage *GetStoragePCPointer(struct SaveBlock2 *sav2); +void *FUN_0202251C(struct SaveBlock2 *sav2); +void *FUN_02022528(struct SaveBlock2 *sav2); +u8 *LoadHallOfFame(struct SaveBlock2 *sav2, u32 heap_id, int *ret_p); +s32 *SaveHallOfFame(struct SaveBlock2 *sav2, u8 *data); + +#endif //POKEDIAMOND_UNK_02022504_H |