summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRevo <projectrevotpp@hotmail.com>2021-06-28 22:23:12 -0400
committerGitHub <noreply@github.com>2021-06-28 22:23:12 -0400
commitc14bd5bca2631fd4574c498201c679732b562f09 (patch)
tree1c1af641918697e925de24525348bc2e53db4c41
parent3eb05d47001de840cb6e8e99ca5181dc2ad67b32 (diff)
parent58b831b027e56480daa516c352d1e74323d53579 (diff)
Merge pull request #418 from red031000/master
WM_ks decomp, plus some mod63 docs
-rw-r--r--arm9/asm/WM_ks.s26
-rw-r--r--arm9/lib/include/WM.h61
-rw-r--r--arm9/lib/include/WM_ks.h9
-rw-r--r--arm9/lib/src/WM_ks.c15
-rw-r--r--arm9/modules/63/include/mod63_021DB450.h6
-rw-r--r--arm9/modules/63/src/mod63_021DB450.c4
6 files changed, 90 insertions, 31 deletions
diff --git a/arm9/asm/WM_ks.s b/arm9/asm/WM_ks.s
deleted file mode 100644
index 3dd46c1b..00000000
--- a/arm9/asm/WM_ks.s
+++ /dev/null
@@ -1,26 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .text
-
- arm_func_start WM_EndKeySharing
-WM_EndKeySharing: ; 0x020DAD3C
- ldr ip, _020DAD44 ; =WM_EndDataSharing
- bx r12
- .balign 4
-_020DAD44: .word WM_EndDataSharing
-
- arm_func_start WM_StartKeySharing
-WM_StartKeySharing: ; 0x020DAD48
- stmdb sp!, {lr}
- sub sp, sp, #0x4
- ldr r2, _020DAD70 ; =0x0000FFFF
- mov r12, #0x1
- mov r3, #0x2
- str r12, [sp, #0x0]
- bl WM_StartDataSharing
- add sp, sp, #0x4
- ldmia sp!, {lr}
- bx lr
- .balign 4
-_020DAD70: .word 0x0000FFFF
diff --git a/arm9/lib/include/WM.h b/arm9/lib/include/WM.h
new file mode 100644
index 00000000..ad287292
--- /dev/null
+++ b/arm9/lib/include/WM.h
@@ -0,0 +1,61 @@
+#ifndef POKEDIAMOND_WM_H
+#define POKEDIAMOND_WM_H
+
+#include "nitro/types.h"
+
+typedef struct WMDataSet
+{
+ u16 aidBitmap;
+ u16 receivedBitmap;
+ u16 data[508 / sizeof(u16)];
+} WMDataSet;
+
+typedef struct WMDataSharingInfo
+{
+ WMDataSet ds[4];
+ u16 seqNum[4];
+ u16 writeIndex;
+ u16 sendIndex;
+ u16 readIndex;
+ u16 aidBitmap;
+ u16 dataLength;
+ u16 stationNumber;
+ u16 dataSetLength;
+ u16 port;
+ u16 doubleMode;
+ u16 currentSeqNum;
+ u16 state;
+ u16 reserved[1];
+} WMDataSharingInfo;
+
+typedef WMDataSharingInfo WMKeySetBuf;
+
+typedef enum WMErrCode
+{
+ WM_ERRCODE_SUCCESS = 0,
+ WM_ERRCODE_FAILED = 1,
+ WM_ERRCODE_OPERATING = 2,
+ WM_ERRCODE_ILLEGAL_STATE = 3,
+ WM_ERRCODE_WM_DISABLE = 4,
+ WM_ERRCODE_NO_KEYSET = 5,
+ WM_ERRCODE_NO_DATASET = 5,
+ WM_ERRCODE_INVALID_PARAM = 6,
+ WM_ERRCODE_NO_CHILD = 7,
+ WM_ERRCODE_FIFO_ERROR = 8,
+ WM_ERRCODE_TIMEOUT = 9,
+ WM_ERRCODE_SEND_QUEUE_FULL = 10,
+ WM_ERRCODE_NO_ENTRY = 11,
+ WM_ERRCODE_OVER_MAX_ENTRY = 12,
+ WM_ERRCODE_INVALID_POLLBITMAP = 13,
+ WM_ERRCODE_NO_DATA = 14,
+ WM_ERRCODE_SEND_FAILED = 15,
+
+ WM_ERRCODE_DCF_TEST,
+ WM_ERRCODE_WL_INVALID_PARAM,
+ WM_ERRCODE_WL_LENGTH_ERR,
+
+ WM_ERRCODE_FLASH_ERROR,
+ WM_ERRCODE_MAX
+} WMErrCode;
+
+#endif //POKEDIAMOND_WM_H
diff --git a/arm9/lib/include/WM_ks.h b/arm9/lib/include/WM_ks.h
new file mode 100644
index 00000000..0eeb6b1b
--- /dev/null
+++ b/arm9/lib/include/WM_ks.h
@@ -0,0 +1,9 @@
+#ifndef POKEDIAMOND_WM_KS_H
+#define POKEDIAMOND_WM_KS_H
+
+#include "WM.h"
+
+WMErrCode WM_StartKeySharing(WMKeySetBuf *buf, u16 port);
+WMErrCode WM_EndKeySharing(WMKeySetBuf *buf);
+
+#endif //POKEDIAMOND_WM_KS_H
diff --git a/arm9/lib/src/WM_ks.c b/arm9/lib/src/WM_ks.c
new file mode 100644
index 00000000..93e96f89
--- /dev/null
+++ b/arm9/lib/src/WM_ks.c
@@ -0,0 +1,15 @@
+#include "WM_ks.h"
+#include "function_target.h"
+
+extern WMErrCode WM_StartDataSharing(WMKeySetBuf *buf, u16 port, u16 aidBitmap, u16 dataLength, BOOL doubleMode);
+extern WMErrCode WM_EndDataSharing(WMKeySetBuf *buf);
+
+ARM_FUNC WMErrCode WM_StartKeySharing(WMKeySetBuf *buf, u16 port)
+{
+ return WM_StartDataSharing(buf, port, 0xffff, 2, TRUE);
+}
+
+ARM_FUNC WMErrCode WM_EndKeySharing(WMKeySetBuf *buf)
+{
+ return WM_EndDataSharing(buf);
+}
diff --git a/arm9/modules/63/include/mod63_021DB450.h b/arm9/modules/63/include/mod63_021DB450.h
index e5ecc7df..ac3da1b6 100644
--- a/arm9/modules/63/include/mod63_021DB450.h
+++ b/arm9/modules/63/include/mod63_021DB450.h
@@ -3,10 +3,10 @@
#include "global.h"
-typedef struct UnkStruct63_021DB450
+typedef struct UnkStruct63_021DB450 //intro base struct type
{
- struct UnkStruct63_021DB450 * field_00;
- u32 field_04[3];
+ struct UnkStruct63_021DB450 * field_00; //oddly requires this to be set to progress past copyright/pokemon screen.
+ u32 field_04[3]; //mon animations?
u32 field_10;
void * field_14;
void * field_18;
diff --git a/arm9/modules/63/src/mod63_021DB450.c b/arm9/modules/63/src/mod63_021DB450.c
index 84461fe1..454b2b19 100644
--- a/arm9/modules/63/src/mod63_021DB450.c
+++ b/arm9/modules/63/src/mod63_021DB450.c
@@ -69,12 +69,12 @@ THUMB_FUNC u32 MOD63_021DB498(void)
return 32;
}
-THUMB_FUNC void Title_SetupMonAnimationSprites(struct UnkStruct63_021DB450 * arg0)
+THUMB_FUNC void Title_SetupMonAnimationSprites(struct UnkStruct63_021DB450 * arg0) //TODO: this does a lot more than setup anim sprites
{
struct UnkStruct63_021DB49C sp1C;
int introMonArray[3] = {SPECIES_TURTWIG, SPECIES_CHIMCHAR, SPECIES_PIPLUP};
- arg0->field_00 = FUN_02006D98(76);
+ arg0->field_00 = FUN_02006D98(76); //this is needed to get into the world view, otherwise it is just black
for (u8 i = 0; i < 3; i++) //some kind of animation assignment TODO: investigate further
{