summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira Akashi <rubenru09@aol.com>2021-07-01 03:34:58 +0100
committerGitHub <noreply@github.com>2021-07-01 03:34:58 +0100
commit9427ad1dde34ad16643423e001f1126015e5ef27 (patch)
treebf5b3f918ae19bac1c0548b5e51db033310e5fb9
parent029dab952d33320442fe2a46879b32175c536a79 (diff)
parent93557dd264b6a3c69f00366888e4d35a0d5b0a7c (diff)
Merge branch 'master' into master
-rw-r--r--arm9/asm/WM_ks.s26
-rw-r--r--arm9/asm/unk_020061E8.s45
-rw-r--r--arm9/asm/unk_020222E8.s46
-rw-r--r--arm9/asm/unk_02064E20.s25
-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
-rw-r--r--arm9/src/palette.c5
-rw-r--r--arm9/src/unk_020061E8.c35
-rw-r--r--arm9/src/unk_020222E8.c33
-rw-r--r--arm9/src/unk_02064E20.c17
-rw-r--r--include/unk_020061E8.h10
-rw-r--r--include/unk_020222E8.h11
-rw-r--r--include/unk_02064E20.h8
16 files changed, 205 insertions, 151 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/asm/unk_020061E8.s b/arm9/asm/unk_020061E8.s
deleted file mode 100644
index 22f390c7..00000000
--- a/arm9/asm/unk_020061E8.s
+++ /dev/null
@@ -1,45 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
- .section .text
-
- thumb_func_start FUN_020061E8
-FUN_020061E8: ; 0x020061E8
- push {r3-r7, lr}
- add r5, r1, #0x0
- add r6, r0, #0x0
- add r7, r2, #0x0
- cmp r5, #0x0
- beq _0200620C
- add r0, r3, #0x0
- bl AllocFromHeap
- add r4, r0, #0x0
- bne _02006202
- mov r0, #0x0
- pop {r3-r7, pc}
-_02006202:
- mov r1, #0x0
- add r2, r5, #0x0
- bl memset
- b _0200620E
-_0200620C:
- mov r4, #0x0
-_0200620E:
- add r0, r6, #0x0
- add r1, r4, #0x0
- add r2, r7, #0x0
- bl FUN_0200CA44
- pop {r3-r7, pc}
- .balign 4
-
- thumb_func_start FUN_0200621C
-FUN_0200621C: ; 0x0200621C
- push {r4, lr}
- add r4, r0, #0x0
- bl FUN_0201B6C8
- cmp r0, #0x0
- beq _0200622C
- bl FreeToHeap
-_0200622C:
- add r0, r4, #0x0
- bl FUN_0200CAB4
- pop {r4, pc}
diff --git a/arm9/asm/unk_020222E8.s b/arm9/asm/unk_020222E8.s
deleted file mode 100644
index 047712a5..00000000
--- a/arm9/asm/unk_020222E8.s
+++ /dev/null
@@ -1,46 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .text
-
- thumb_func_start FUN_020222E8
-FUN_020222E8: ; 0x020222E8
- mov r0, #0x5
- lsl r0, r0, #0x18
- bx lr
- .balign 4
-
- thumb_func_start FUN_020222F0
-FUN_020222F0: ; 0x020222F0
- mov r0, #0x2
- lsl r0, r0, #0x8
- bx lr
- .balign 4
-
- thumb_func_start FUN_020222F8
-FUN_020222F8: ; 0x020222F8
- ldr r0, _020222FC ; =0x05000400
- bx lr
- .balign 4
-_020222FC: .word 0x05000400
-
- thumb_func_start FUN_02022300
-FUN_02022300: ; 0x02022300
- mov r0, #0x2
- lsl r0, r0, #0x8
- bx lr
- .balign 4
-
- thumb_func_start FUN_02022308
-FUN_02022308: ; 0x02022308
- ldr r0, _0202230C ; =0x05000200
- bx lr
- .balign 4
-_0202230C: .word 0x05000200
-
- thumb_func_start FUN_02022310
-FUN_02022310: ; 0x02022310
- ldr r0, _02022314 ; =0x05000600
- bx lr
- .balign 4
-_02022314: .word 0x05000600
diff --git a/arm9/asm/unk_02064E20.s b/arm9/asm/unk_02064E20.s
deleted file mode 100644
index 19ada5a3..00000000
--- a/arm9/asm/unk_02064E20.s
+++ /dev/null
@@ -1,25 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .text
-
- thumb_func_start FUN_02064E20
-FUN_02064E20: ; 0x02064E20
- push {r4, lr}
- bl ScriptEnvironment_GetSav2Ptr
- bl FUN_02024ED8
- add r4, r0, #0x0
- bl FUN_020254B4
- cmp r0, #0x6
- beq _02064E48
- add r0, r4, #0x0
- mov r1, #0x6
- bl FUN_02025490
- add r0, r4, #0x0
- mov r1, #0x6
- bl FUN_020254A0
- mov r1, #0x2
- strh r1, [r0, #0x0]
-_02064E48:
- pop {r4, pc}
- .balign 4
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
{
diff --git a/arm9/src/palette.c b/arm9/src/palette.c
index 6726a0ec..e4c42cc4 100644
--- a/arm9/src/palette.c
+++ b/arm9/src/palette.c
@@ -3,11 +3,8 @@
#include "MI_memory.h"
#include "gf_gfx_loader.h"
#include "unk_0200CA44.h"
+#include "unk_020222E8.h"
-extern void *FUN_020222E8();
-extern void *FUN_020222F8();
-extern void *FUN_02022308();
-extern void *FUN_02022310();
extern int abs(int);
THUMB_FUNC struct PaletteData *FUN_02002FD0(u32 heap_id)
diff --git a/arm9/src/unk_020061E8.c b/arm9/src/unk_020061E8.c
new file mode 100644
index 00000000..424fea34
--- /dev/null
+++ b/arm9/src/unk_020061E8.c
@@ -0,0 +1,35 @@
+#include "global.h"
+#include "heap.h"
+#include "unk_0200CA44.h"
+#include "unk_020061E8.h"
+
+extern struct TextPrinter *FUN_0201B6C8(void);
+
+THUMB_FUNC BOOL FUN_020061E8(void (*r0)(u32, struct TextPrinter *), u32 r1, u32 r2, u32 r3)
+{
+ void * r4;
+ if(r1 != 0)
+ {
+ r4 = AllocFromHeap(r3, r1);
+ if(r4 == 0)
+ {
+ return FALSE;
+ }
+ memset(r4, 0, r1);
+ }
+ else
+ {
+ r4 = NULL;
+ }
+ return FUN_0200CA44(r0, r4, r2);
+}
+
+THUMB_FUNC void FUN_0200621C(s32 r4)
+{
+ struct TextPrinter * r0 = FUN_0201B6C8();
+ if(r0 != NULL)
+ {
+ FreeToHeap(r0);
+ }
+ FUN_0200CAB4(r4);
+}
diff --git a/arm9/src/unk_020222E8.c b/arm9/src/unk_020222E8.c
new file mode 100644
index 00000000..30a2a2c4
--- /dev/null
+++ b/arm9/src/unk_020222E8.c
@@ -0,0 +1,33 @@
+#include "global.h"
+#include "unk_020222E8.h"
+
+THUMB_FUNC void * FUN_020222E8()
+{
+ return 0x5 << 0x18;
+}
+
+THUMB_FUNC void * FUN_020222F0()
+{
+ return 0x2 << 0x8;
+}
+
+THUMB_FUNC void * FUN_020222F8()
+{
+ return 0x05000400;
+}
+
+THUMB_FUNC void * FUN_02022300()
+{
+ return 0x2 << 0x8;
+}
+
+THUMB_FUNC void * FUN_02022308()
+{
+ return 0x05000200;
+}
+
+THUMB_FUNC void * FUN_02022310()
+{
+ return 0x05000600;
+}
+
diff --git a/arm9/src/unk_02064E20.c b/arm9/src/unk_02064E20.c
new file mode 100644
index 00000000..8586981b
--- /dev/null
+++ b/arm9/src/unk_02064E20.c
@@ -0,0 +1,17 @@
+#include "global.h"
+#include "scrcmd.h"
+#include "unk_02025484.h"
+#include "unk_02024E64.h"
+#include "unk_02064E20.h"
+
+THUMB_FUNC void FUN_02064E20(struct UnkSavStruct80* unk0)
+{
+ struct unk_2025484 * r4 = (struct unk_2025484 *)FUN_02024ED8(ScriptEnvironment_GetSav2Ptr(unk0));
+ if((u32)FUN_020254B4(r4) == 6)
+ {
+ return;
+ }
+ FUN_02025490(r4, 6);
+ u16 * ptr0 = (u16 *)FUN_020254A0(r4 , 6);
+ ptr0[0] = 2;
+}
diff --git a/include/unk_020061E8.h b/include/unk_020061E8.h
new file mode 100644
index 00000000..d94ea88f
--- /dev/null
+++ b/include/unk_020061E8.h
@@ -0,0 +1,10 @@
+#ifndef POKEDIAMOND_UNK_020061E8_H
+#define POKEDIAMOND_UNK_020061E8_H
+
+#include "nitro/types.h"
+#include "text.h"
+
+BOOL FUN_020061E8(void (*r0)(u32, struct TextPrinter *), u32 r1, u32 r2, u32 r3);
+void FUN_0200621C(s32 r0);
+
+#endif // POKEDIAMOND_UNK_020061E8_H
diff --git a/include/unk_020222E8.h b/include/unk_020222E8.h
new file mode 100644
index 00000000..ac6e1932
--- /dev/null
+++ b/include/unk_020222E8.h
@@ -0,0 +1,11 @@
+#ifndef POKEDIAMOND_UNK_020222E8_H
+#define POKEDIAMOND_UNK_020222E8_H
+
+void * FUN_020222E8();
+void * FUN_020222F0();
+void * FUN_020222F8();
+void * FUN_02022300();
+void * FUN_02022308();
+void * FUN_02022310();
+
+#endif // POKEDIAMOND_UNK_020222E8_H
diff --git a/include/unk_02064E20.h b/include/unk_02064E20.h
new file mode 100644
index 00000000..a9bcd0e0
--- /dev/null
+++ b/include/unk_02064E20.h
@@ -0,0 +1,8 @@
+#ifndef POKEDIAMOND_UNK_02064E20_H
+#define POKEDIAMOND_UNK_02064E20_H
+
+#include "script.h"
+
+void FUN_02064E20(struct UnkSavStruct80* unk0);
+
+#endif // POKEDIAMOND_UNK_02064E20_H