summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortgsm <doodrabbit@hotmail.com>2021-04-05 20:55:25 -0400
committertgsm <doodrabbit@hotmail.com>2021-04-07 09:07:45 -0400
commit3f493d7ab6c45e17e515fd9901450935a6a08f14 (patch)
tree6a55d5c42de3e9ca5d04a8e589238eacc0f0e518
parentab9f2170d20b5b8e2c92407b3e08df4a38dd8c93 (diff)
Decompile scrcmd_11
-rw-r--r--arm9/asm/scrcmd_11.s239
-rw-r--r--arm9/asm/unk_02038C78.s18
-rw-r--r--arm9/global.inc18
-rw-r--r--arm9/src/scrcmd_11.c120
-rw-r--r--include/scrcmd.h11
-rw-r--r--include/unk_02029FB0.h2
6 files changed, 151 insertions, 257 deletions
diff --git a/arm9/asm/scrcmd_11.s b/arm9/asm/scrcmd_11.s
deleted file mode 100644
index 5612284f..00000000
--- a/arm9/asm/scrcmd_11.s
+++ /dev/null
@@ -1,239 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .text
-
- thumb_func_start FUN_02042B0C
-FUN_02042B0C: ; 0x02042B0C
- push {r3-r5, lr}
- add r5, r0, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r5, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl GetVarPointer
- add r4, r0, #0x0
- add r0, r5, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- mov r1, #0xa
- bl FUN_02039438
- add r1, r0, #0x0
- add r5, #0x80
- ldr r0, [r5, #0x0]
- ldr r1, [r1, #0x0]
- bl FUN_0204B5FC
- strh r0, [r4, #0x0]
- mov r0, #0x0
- pop {r3-r5, pc}
-
- thumb_func_start FUN_02042B40
-FUN_02042B40: ; 0x02042B40
- push {r4-r6, lr}
- add r5, r0, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- mov r1, #0xa
- bl FUN_02039438
- add r4, r0, #0x0
- add r0, r5, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r5, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl GetVarPointer
- add r5, #0x80
- add r6, r0, #0x0
- ldr r0, [r5, #0x0]
- ldr r1, [r4, #0x0]
- bl FUN_0204B63C
- strh r0, [r6, #0x0]
- mov r0, #0x0
- pop {r4-r6, pc}
-
- thumb_func_start FUN_02042B74
-FUN_02042B74: ; 0x02042B74
- push {r4-r6, lr}
- add r5, r0, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- mov r1, #0xa
- bl FUN_02039438
- add r4, r0, #0x0
- add r0, r5, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r5, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl GetVarPointer
- add r5, #0x80
- add r6, r0, #0x0
- ldr r0, [r5, #0x0]
- ldr r1, [r4, #0x0]
- bl FUN_0204B660
- strh r0, [r6, #0x0]
- mov r0, #0x0
- pop {r4-r6, pc}
-
- thumb_func_start FUN_02042BA8
-FUN_02042BA8: ; 0x02042BA8
- push {r4-r6, lr}
- add r5, r0, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- mov r1, #0xa
- bl FUN_02039438
- add r4, r0, #0x0
- add r0, r5, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r5, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl GetVarPointer
- add r5, #0x80
- add r6, r0, #0x0
- ldr r0, [r5, #0x0]
- ldr r1, [r4, #0x0]
- bl FUN_0204B684
- strh r0, [r6, #0x0]
- mov r0, #0x0
- pop {r4-r6, pc}
-
- thumb_func_start FUN_02042BDC
-FUN_02042BDC: ; 0x02042BDC
- push {r4-r6, lr}
- add r5, r0, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- mov r1, #0xa
- bl FUN_02039438
- add r4, r0, #0x0
- add r0, r5, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r5, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl GetVarPointer
- add r5, #0x80
- add r6, r0, #0x0
- ldr r0, [r5, #0x0]
- ldr r1, [r4, #0x0]
- bl FUN_0204B6A4
- strh r0, [r6, #0x0]
- mov r0, #0x0
- pop {r4-r6, pc}
-
- thumb_func_start FUN_02042C10
-FUN_02042C10: ; 0x02042C10
- push {r3-r5, lr}
- add r5, r0, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- mov r1, #0xa
- bl FUN_02039438
- add r4, r0, #0x0
- add r0, r5, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r5, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl VarGet
- add r5, #0x80
- add r2, r0, #0x0
- ldr r0, [r5, #0x0]
- ldr r1, [r4, #0x0]
- bl FUN_0204B57C
- mov r0, #0x0
- pop {r3-r5, pc}
- .balign 4
-
- thumb_func_start FUN_02042C44
-FUN_02042C44: ; 0x02042C44
- push {r4-r6, lr}
- add r5, r0, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- mov r1, #0xa
- bl FUN_02039438
- add r4, r0, #0x0
- add r0, r5, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- ldr r0, [r0, #0xc]
- bl FUN_02029FC8
- add r6, r0, #0x0
- add r0, r5, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r5, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl VarGet
- add r5, #0x80
- add r2, r0, #0x0
- ldr r0, [r5, #0x0]
- ldr r1, [r4, #0x0]
- bl FUN_0204B5A8
- add r0, r6, #0x0
- mov r1, #0x3
- bl FUN_0202A0E8
- mov r0, #0x0
- pop {r4-r6, pc}
-
- thumb_func_start FUN_02042C8C
-FUN_02042C8C: ; 0x02042C8C
- push {r4, lr}
- add r4, r0, #0x0
- bl ScriptReadHalfword
- cmp r0, #0x0
- beq _02042C9E
- cmp r0, #0x1
- beq _02042CA8
- b _02042CB2
-_02042C9E:
- add r4, #0x80
- ldr r0, [r4, #0x0]
- bl FUN_0204B9A0
- b _02042CB6
-_02042CA8:
- add r4, #0x80
- ldr r0, [r4, #0x0]
- bl FUN_0204B9CC
- b _02042CB6
-_02042CB2:
- bl ErrorHandling
-_02042CB6:
- mov r0, #0x1
- pop {r4, pc}
- .balign 4
-
- thumb_func_start FUN_02042CBC
-FUN_02042CBC: ; 0x02042CBC
- push {r3-r5, lr}
- add r5, r0, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- ldr r0, [r0, #0xc]
- bl FUN_02029FC8
- add r4, r0, #0x0
- add r0, r5, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- mov r1, #0xa
- bl FUN_02039438
- add r1, r0, #0x0
- add r5, #0x80
- ldr r0, [r5, #0x0]
- ldr r1, [r1, #0x0]
- bl FUN_0204B4FC
- add r0, r4, #0x0
- mov r1, #0x0
- bl FUN_0202A170
- mov r0, #0x0
- pop {r3-r5, pc}
diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s
index 70b66348..b79288ca 100644
--- a/arm9/asm/unk_02038C78.s
+++ b/arm9/asm/unk_02038C78.s
@@ -530,15 +530,15 @@ gScriptCmdTable: ; 0x020F355C
.word FUN_0203D958
.word FUN_02040D04
.word FUN_02040D7C
- .word FUN_02042B0C
- .word FUN_02042B40
- .word FUN_02042B74
- .word FUN_02042BA8
- .word FUN_02042BDC
- .word FUN_02042C10
- .word FUN_02042C44
- .word FUN_02042C8C
- .word FUN_02042CBC
+ .word ScrCmd_Unk017D
+ .word ScrCmd_Unk017E
+ .word ScrCmd_Unk017F
+ .word ScrCmd_Unk0180
+ .word ScrCmd_Unk0181
+ .word ScrCmd_Unk0182
+ .word ScrCmd_Unk0183
+ .word ScrCmd_Unk0184
+ .word ScrCmd_Unk0185
.word FUN_0203D998
.word FUN_0203D9E8
.word FUN_0203DA78
diff --git a/arm9/global.inc b/arm9/global.inc
index b09157f2..0da3fadd 100644
--- a/arm9/global.inc
+++ b/arm9/global.inc
@@ -3264,15 +3264,15 @@
.extern FUN_02042A18
.extern FUN_02042A48
.extern FUN_02042A98
-.extern FUN_02042B0C
-.extern FUN_02042B40
-.extern FUN_02042B74
-.extern FUN_02042BA8
-.extern FUN_02042BDC
-.extern FUN_02042C10
-.extern FUN_02042C44
-.extern FUN_02042C8C
-.extern FUN_02042CBC
+.extern ScrCmd_Unk017D
+.extern ScrCmd_Unk017E
+.extern ScrCmd_Unk017F
+.extern ScrCmd_Unk0180
+.extern ScrCmd_Unk0181
+.extern ScrCmd_Unk0182
+.extern ScrCmd_Unk0183
+.extern ScrCmd_Unk0184
+.extern ScrCmd_Unk0185
.extern FUN_02042D1C
.extern ScrCmd_Unk0253
.extern ScrCmd_Unk0254
diff --git a/arm9/src/scrcmd_11.c b/arm9/src/scrcmd_11.c
new file mode 100644
index 00000000..8553adfa
--- /dev/null
+++ b/arm9/src/scrcmd_11.c
@@ -0,0 +1,120 @@
+#include "scrcmd.h"
+#include "unk_02029FB0.h"
+
+extern void* FUN_02039438(struct UnkSavStruct80*, int idx);
+
+extern void FUN_0202A0E8(struct UnkStruct_02029FB0*, int);
+extern void FUN_0202A170(struct UnkStruct_02029FB0*, int);
+extern u8 FUN_0204B5FC(struct UnkSavStruct80*, void*);
+extern void FUN_0204B57C(struct UnkSavStruct80*, void*, int);
+extern u16 FUN_0204B63C(struct UnkSavStruct80*, void*);
+extern u16 FUN_0204B660(struct UnkSavStruct80*, void*);
+extern u16 FUN_0204B684(struct UnkSavStruct80*, void*);
+extern u16 FUN_0204B6A4(struct UnkSavStruct80*, void*);
+extern void FUN_0204B9CC(struct UnkSavStruct80*);
+extern void FUN_0204B5A8(struct UnkSavStruct80*, void*, u16);
+extern void FUN_0204B9A0(struct UnkSavStruct80*);
+extern void FUN_0204B4FC(struct UnkSavStruct80*, void*);
+
+THUMB_FUNC BOOL ScrCmd_Unk017D(struct ScriptContext* ctx)
+{
+ u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+ void** unk = FUN_02039438(ctx->unk80, 10);
+
+ *ret_ptr = FUN_0204B5FC(ctx->unk80, *unk);
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_Unk017E(struct ScriptContext* ctx)
+{
+ void** unk = FUN_02039438(ctx->unk80, 10);
+ u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ *ret_ptr = FUN_0204B63C(ctx->unk80, *unk);
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_Unk017F(struct ScriptContext* ctx)
+{
+ void** unk = FUN_02039438(ctx->unk80, 10);
+ u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ *ret_ptr = FUN_0204B660(ctx->unk80, *unk);
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_Unk0180(struct ScriptContext* ctx)
+{
+ void** unk = FUN_02039438(ctx->unk80, 10);
+ u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ *ret_ptr = FUN_0204B684(ctx->unk80, *unk);
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_Unk0181(struct ScriptContext* ctx)
+{
+ void** unk = FUN_02039438(ctx->unk80, 10);
+ u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ *ret_ptr = FUN_0204B6A4(ctx->unk80, *unk);
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_Unk0182(struct ScriptContext* ctx)
+{
+ void** unk = FUN_02039438(ctx->unk80, 10);
+ u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+
+ FUN_0204B57C(ctx->unk80, *unk, unk2);
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_Unk0183(struct ScriptContext* ctx)
+{
+ void** unk = FUN_02039438(ctx->unk80, 10);
+ struct UnkStruct_02029FB0* unk2 = FUN_02029FC8(ctx->unk80->saveBlock2);
+ u16 unk3 = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+
+ FUN_0204B5A8(ctx->unk80, *unk, unk3);
+ FUN_0202A0E8(unk2, 3);
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_Unk0184(struct ScriptContext* ctx)
+{
+ u16 unk = ScriptReadHalfword(ctx);
+
+ switch (unk)
+ {
+ case 0:
+ FUN_0204B9A0(ctx->unk80);
+ break;
+ case 1:
+ FUN_0204B9CC(ctx->unk80);
+ break;
+ default:
+ GF_ASSERT(FALSE);
+ break;
+ }
+
+ return TRUE;
+}
+
+THUMB_FUNC BOOL ScrCmd_Unk0185(struct ScriptContext* ctx)
+{
+ struct UnkStruct_02029FB0* unk = FUN_02029FC8(ctx->unk80->saveBlock2);
+ void** unk2 = FUN_02039438(ctx->unk80, 10);
+
+ FUN_0204B4FC(ctx->unk80, *unk2);
+ FUN_0202A170(unk, 0);
+
+ return FALSE;
+}
diff --git a/include/scrcmd.h b/include/scrcmd.h
index 3ea5c916..fcae3549 100644
--- a/include/scrcmd.h
+++ b/include/scrcmd.h
@@ -106,6 +106,17 @@ BOOL ScrCmd_Unk0048(struct ScriptContext *ctx);
BOOL ScrCmd_Unk02CF(struct ScriptContext *ctx);
BOOL ScrCmd_Unk02D0(struct ScriptContext *ctx);
+//scrcmd_11.c
+BOOL ScrCmd_Unk017D(struct ScriptContext* ctx);
+BOOL ScrCmd_Unk017E(struct ScriptContext* ctx);
+BOOL ScrCmd_Unk017F(struct ScriptContext* ctx);
+BOOL ScrCmd_Unk0180(struct ScriptContext* ctx);
+BOOL ScrCmd_Unk0181(struct ScriptContext* ctx);
+BOOL ScrCmd_Unk0182(struct ScriptContext* ctx);
+BOOL ScrCmd_Unk0183(struct ScriptContext* ctx);
+BOOL ScrCmd_Unk0184(struct ScriptContext* ctx);
+BOOL ScrCmd_Unk0185(struct ScriptContext* ctx);
+
//scrcmd_13.c
BOOL ScrCmd_Unk0253(struct ScriptContext* ctx);
BOOL ScrCmd_Unk0254(struct ScriptContext* ctx);
diff --git a/include/unk_02029FB0.h b/include/unk_02029FB0.h
index 0185bff4..9ce6451d 100644
--- a/include/unk_02029FB0.h
+++ b/include/unk_02029FB0.h
@@ -1,6 +1,8 @@
#ifndef POKEDIAMOND_UNK_02029FB0_H
#define POKEDIAMOND_UNK_02029FB0_H
+struct Pokedex;
+
struct UnkStruct_02029FB0
{
u8 unk[0x14C];