summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm9/arm9.lsf2
-rw-r--r--arm9/asm/scrcmd_6.s399
-rw-r--r--arm9/global.inc1
-rw-r--r--arm9/src/scrcmd_sound.c299
4 files changed, 301 insertions, 400 deletions
diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf
index 1abf5a52..898904d3 100644
--- a/arm9/arm9.lsf
+++ b/arm9/arm9.lsf
@@ -157,7 +157,7 @@ Static arm9
Object scrcmd_3.o
Object scrcmd_names.o
Object scrcmd_5.o
- Object scrcmd_6.o
+ Object scrcmd_sound.o
Object scrcmd_7.o
Object scrcmd_8.o
Object scrcmd_9.o
diff --git a/arm9/asm/scrcmd_6.s b/arm9/asm/scrcmd_6.s
deleted file mode 100644
index 10b41ff7..00000000
--- a/arm9/asm/scrcmd_6.s
+++ /dev/null
@@ -1,399 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .text
-
- thumb_func_start FUN_020413C0
-FUN_020413C0: ; 0x020413C0
- push {r3-r5, lr}
- add r4, r0, #0x0
- bl ScriptReadHalfword
- add r5, r0, #0x0
- add r0, r4, #0x0
- bl ScriptReadHalfword
- add r4, #0x80
- add r1, r0, #0x0
- ldr r0, [r4, #0x0]
- bl GetVarPointer
- add r4, r0, #0x0
- add r0, r5, #0x0
- bl FUN_02005410
- strh r0, [r4, #0x0]
- mov r0, #0x0
- pop {r3-r5, pc}
-
- thumb_func_start FUN_020413E8
-FUN_020413E8: ; 0x020413E8
- push {r3, lr}
- bl ScriptReadHalfword
- bl FUN_0200521C
- mov r0, #0x0
- pop {r3, pc}
- .balign 4
-
- thumb_func_start FUN_020413F8
-FUN_020413F8: ; 0x020413F8
- push {r3, lr}
- bl ScriptReadHalfword
- bl FUN_02004124
- mov r1, #0x0
- bl FUN_02005350
- mov r0, #0x0
- pop {r3, pc}
-
- thumb_func_start FUN_0204140C
-FUN_0204140C: ; 0x0204140C
- push {r3, lr}
- add r0, #0x80
- ldr r0, [r0, #0x0]
- ldr r1, [r0, #0x1c]
- ldr r1, [r1, #0x0]
- bl FUN_0204ABA8
- bl FUN_0200521C
- mov r0, #0x0
- pop {r3, pc}
- .balign 4
-
- thumb_func_start FUN_02041424
-FUN_02041424: ; 0x02041424
- push {r4, lr}
- add r4, r0, #0x0
- bl ScriptReadHalfword
- add r4, #0x80
- add r1, r0, #0x0
- ldr r0, [r4, #0x0]
- bl FUN_0204AB20
- mov r0, #0x0
- pop {r4, pc}
- .balign 4
-
- thumb_func_start FUN_0204143C
-FUN_0204143C: ; 0x0204143C
- push {r3-r5, lr}
- add r5, r0, #0x0
- bl ScriptReadHalfword
- add r4, r0, #0x0
- add r0, r5, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r4, #0x0
- bl FUN_020053CC
- ldr r1, _02041460 ; =FUN_02041464
- add r0, r5, #0x0
- bl SetupNativeScript
- mov r0, #0x1
- pop {r3-r5, pc}
- .balign 4
-_02041460: .word FUN_02041464
-
- thumb_func_start FUN_02041464
-FUN_02041464: ; 0x02041464
- push {r3, lr}
- bl FUN_02005404
- cmp r0, #0x0
- bne _02041472
- mov r0, #0x1
- pop {r3, pc}
-_02041472:
- mov r0, #0x0
- pop {r3, pc}
- .balign 4
-
- thumb_func_start FUN_02041478
-FUN_02041478: ; 0x02041478
- push {r4, lr}
- add r4, r0, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- mov r0, #0x7f
- mov r2, #0x0
- bl FUN_0200538C
- ldr r1, _02041498 ; =FUN_02041464
- add r0, r4, #0x0
- bl SetupNativeScript
- mov r0, #0x1
- pop {r4, pc}
- nop
-_02041498: .word FUN_02041464
-
- thumb_func_start FUN_0204149C
-FUN_0204149C: ; 0x0204149C
- push {r3, lr}
- ldr r1, [r0, #0x8]
- add r3, r1, #0x1
- str r3, [r0, #0x8]
- ldrb r2, [r1, #0x0]
- add r1, r3, #0x1
- str r1, [r0, #0x8]
- ldrb r1, [r3, #0x0]
- add r0, r2, #0x0
- bl FUN_020047C8
- mov r0, #0x0
- pop {r3, pc}
- .balign 4
-
- thumb_func_start FUN_020414B8
-FUN_020414B8: ; 0x020414B8
- push {r3, lr}
- bl ScriptReadHalfword
- add r1, r0, #0x0
- mov r0, #0x4
- bl FUN_02005308
- mov r0, #0x0
- pop {r3, pc}
- .balign 4
-
- thumb_func_start FUN_020414CC
-FUN_020414CC: ; 0x020414CC
- push {r3, lr}
- ldr r2, [r0, #0x8]
- add r1, r2, #0x1
- str r1, [r0, #0x8]
- ldrb r0, [r2, #0x0]
- bl FUN_020040F4
- mov r0, #0x0
- pop {r3, pc}
- .balign 4
-
- thumb_func_start FUN_020414E0
-FUN_020414E0: ; 0x020414E0
- push {r4, lr}
- add r4, r0, #0x0
- bl ScriptReadHalfword
- add r4, #0x80
- add r1, r0, #0x0
- ldr r0, [r4, #0x0]
- bl VarGet
- bl FUN_020054C8
- mov r0, #0x0
- pop {r4, pc}
- .balign 4
-
- thumb_func_start FUN_020414FC
-FUN_020414FC: ; 0x020414FC
- push {r4, lr}
- add r4, r0, #0x0
- bl ScriptReadHalfword
- add r4, #0x80
- add r1, r0, #0x0
- ldr r0, [r4, #0x0]
- bl VarGet
- mov r1, #0x0
- bl FUN_020054F0
- mov r0, #0x0
- pop {r4, pc}
-
- thumb_func_start FUN_02041518
-FUN_02041518: ; 0x02041518
- push {r4, lr}
- add r4, r0, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r4, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl VarGet
- str r0, [r4, #0x64]
- ldr r1, _0204153C ; =FUN_02041540
- add r0, r4, #0x0
- bl SetupNativeScript
- mov r0, #0x1
- pop {r4, pc}
- nop
-_0204153C: .word FUN_02041540
-
- thumb_func_start FUN_02041540
-FUN_02041540: ; 0x02041540
- push {r3, lr}
- ldr r0, [r0, #0x64]
- lsl r0, r0, #0x10
- lsr r0, r0, #0x10
- bl FUN_02005508
- cmp r0, #0x0
- bne _02041554
- mov r0, #0x1
- pop {r3, pc}
-_02041554:
- mov r0, #0x0
- pop {r3, pc}
-
- thumb_func_start FUN_02041558
-FUN_02041558: ; 0x02041558
- push {r3-r5, lr}
- add r4, r0, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r4, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl VarGet
- add r5, r0, #0x0
- add r0, r4, #0x0
- bl ScriptReadHalfword
- add r4, #0x80
- add r1, r0, #0x0
- ldr r0, [r4, #0x0]
- bl VarGet
- add r0, r5, #0x0
- bl FUN_02005578
- mov r0, #0x0
- pop {r3-r5, pc}
-
- thumb_func_start ScrCmd_waitcry
-ScrCmd_waitcry: ; 0x02041588
- push {r3, lr}
- ldr r1, _02041594 ; =FUN_02041598
- bl SetupNativeScript
- mov r0, #0x1
- pop {r3, pc}
- .balign 4
-_02041594: .word FUN_02041598
-
- thumb_func_start FUN_02041598
-FUN_02041598: ; 0x02041598
- push {r3, lr}
- bl FUN_02005670
- cmp r0, #0x0
- bne _020415A6
- mov r0, #0x1
- pop {r3, pc}
-_020415A6:
- mov r0, #0x0
- pop {r3, pc}
- .balign 4
-
- thumb_func_start ScrCmd_playbgm
-ScrCmd_playbgm: ; 0x020415AC
- push {r3, lr}
- bl ScriptReadHalfword
- bl PlayBGM
- mov r0, #0x0
- pop {r3, pc}
- .balign 4
-
- thumb_func_start FUN_020415BC
-FUN_020415BC: ; 0x020415BC
- push {r3, lr}
- ldr r1, _020415C8 ; =FUN_020415CC
- bl SetupNativeScript
- mov r0, #0x1
- pop {r3, pc}
- .balign 4
-_020415C8: .word FUN_020415CC
-
- thumb_func_start FUN_020415CC
-FUN_020415CC: ; 0x020415CC
- push {r3, lr}
- bl FUN_02005CBC
- cmp r0, #0x0
- bne _020415DA
- mov r0, #0x1
- pop {r3, pc}
-_020415DA:
- mov r0, #0x0
- pop {r3, pc}
- .balign 4
-
- thumb_func_start FUN_020415E0
-FUN_020415E0: ; 0x020415E0
- 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 r5, #0x80
- add r4, r0, #0x0
- ldr r0, [r5, #0x0]
- ldr r0, [r0, #0xc]
- bl FUN_02029EF8
- bl FUN_02005D20
- cmp r0, #0x1
- bne _02041610
- mov r0, #0x1
- strh r0, [r4, #0x0]
- mov r0, #0x0
- pop {r3-r5, pc}
-_02041610:
- mov r0, #0x0
- strh r0, [r4, #0x0]
- pop {r3-r5, pc}
- .balign 4
-
- thumb_func_start FUN_02041618
-FUN_02041618: ; 0x02041618
- push {r4, lr}
- add r4, r0, #0x0
- bl ScriptReadHalfword
- add r4, #0x80
- add r1, r0, #0x0
- ldr r0, [r4, #0x0]
- bl GetVarPointer
- add r4, r0, #0x0
- bl FUN_02005E28
- cmp r0, #0x0
- bne _0204163C
- mov r0, #0x1
- strh r0, [r4, #0x0]
- mov r0, #0x0
- pop {r4, pc}
-_0204163C:
- mov r0, #0x0
- strh r0, [r4, #0x0]
- pop {r4, pc}
- .balign 4
-
- thumb_func_start FUN_02041644
-FUN_02041644: ; 0x02041644
- push {r3, lr}
- bl FUN_02005E64
- mov r0, #0x1
- pop {r3, pc}
- .balign 4
-
- thumb_func_start FUN_02041650
-FUN_02041650: ; 0x02041650
- push {r3, lr}
- add r0, #0x80
- ldr r0, [r0, #0x0]
- ldr r0, [r0, #0xc]
- bl FUN_02029EF8
- bl FUN_02005E6C
- mov r0, #0x1
- pop {r3, pc}
-
- thumb_func_start FUN_02041664
-FUN_02041664: ; 0x02041664
- push {r3, lr}
- mov r1, #0x0
- mov r0, #0x3f
- add r2, r1, #0x0
- bl FUN_0200433C
- mov r0, #0x1
- pop {r3, pc}
-
- thumb_func_start FUN_02041674
-FUN_02041674: ; 0x02041674
- push {r3-r5, lr}
- add r4, r0, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r4, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl VarGet
- add r5, r0, #0x0
- add r0, r4, #0x0
- bl ScriptReadHalfword
- add r4, #0x80
- add r1, r0, #0x0
- ldr r0, [r4, #0x0]
- bl VarGet
- add r1, r0, #0x0
- add r0, r5, #0x0
- bl FUN_0200488C
- mov r0, #0x0
- pop {r3-r5, pc}
- .balign 4
diff --git a/arm9/global.inc b/arm9/global.inc
index 05ba01a7..91c312ad 100644
--- a/arm9/global.inc
+++ b/arm9/global.inc
@@ -8518,3 +8518,4 @@
.extern FUN_02025490
.extern FUN_020254A0
.extern FUN_020254B4
+.extern FUN_02041464
diff --git a/arm9/src/scrcmd_sound.c b/arm9/src/scrcmd_sound.c
new file mode 100644
index 00000000..14ffed61
--- /dev/null
+++ b/arm9/src/scrcmd_sound.c
@@ -0,0 +1,299 @@
+#include "global.h"
+#include "script.h"
+#include "scrcmd.h"
+
+extern BOOL FUN_020413C0(struct ScriptContext *ctx);
+extern BOOL FUN_020413E8(struct ScriptContext *ctx);
+extern BOOL FUN_020413F8(struct ScriptContext *ctx);
+extern BOOL FUN_0204140C(struct ScriptContext *ctx);
+extern BOOL FUN_02041424(struct ScriptContext *ctx);
+extern BOOL FUN_0204143C(struct ScriptContext *ctx);
+extern BOOL FUN_02041464(struct ScriptContext *ctx);
+extern BOOL FUN_02041478(struct ScriptContext* ctx);
+extern BOOL FUN_0204149C(struct ScriptContext* ctx);
+extern BOOL FUN_020414B8(struct ScriptContext *ctx);
+extern BOOL FUN_020414CC(struct ScriptContext* ctx);
+extern BOOL FUN_020414E0(struct ScriptContext* ctx);
+extern BOOL FUN_020414FC(struct ScriptContext* ctx);
+extern BOOL FUN_02041518(struct ScriptContext* ctx);
+extern BOOL FUN_02041540(struct ScriptContext* ctx);
+extern BOOL FUN_02041558(struct ScriptContext* ctx);
+extern BOOL ScrCmd_waitcry(struct ScriptContext* ctx);
+extern BOOL FUN_02041598(struct ScriptContext* ctx);
+extern BOOL FUN_020415BC(struct ScriptContext* ctx);
+extern BOOL FUN_020415CC(struct ScriptContext* ctx);
+extern BOOL ScrCmd_playbgm(struct ScriptContext* ctx);
+extern BOOL FUN_020415E0(struct ScriptContext* ctx);
+extern BOOL FUN_02041618(struct ScriptContext* ctx);
+extern BOOL FUN_02041644(struct ScriptContext* ctx);
+extern BOOL FUN_02041650(struct ScriptContext* ctx);
+extern BOOL FUN_02041664(struct ScriptContext* ctx);
+extern BOOL FUN_02041674(struct ScriptContext* ctx);
+
+extern void* FUN_02029EF8(struct SaveBlock2* sav2);
+extern u32 FUN_02005D20(void *);
+extern void FUN_02005E6C(void *);
+extern void FUN_0200433C(u32, u32, u32);
+extern u32 FUN_02005E28(void);
+extern void FUN_02005E64(void);
+extern BOOL FUN_02005CBC(void);
+extern void PlayBGM(u16);
+extern u32 FUN_02004124(u16);
+extern void FUN_0204AB20(struct UnkSavStruct80 *ctx, u16);
+extern u16 FUN_0204ABA8(struct UnkSavStruct80 *ctx, u32);
+extern void FUN_0200521C(u16);
+extern void FUN_02005308(u32, u16);
+extern void FUN_02005350(u32, u32);
+extern void FUN_0200538C(u32, u16, u32);
+extern void FUN_020053CC(u16, u16);
+extern BOOL FUN_02005404(void);
+extern u16 FUN_02005410(u16);
+extern void FUN_020054C8(u16);
+extern void FUN_020054F0(u16, u32);
+extern void FUN_020047C8(u8, u8);
+extern void FUN_020040F4(u8);
+extern BOOL FUN_02005508(u16);
+extern void FUN_02005578(u16);
+extern BOOL FUN_02005670(void);
+extern void FUN_0200488C(u16, u16);
+
+
+THUMB_FUNC BOOL FUN_020413C0(struct ScriptContext *ctx)
+{
+ u16 unk0;
+ u16 *unk1;
+
+ unk0 = ScriptReadHalfword(ctx);
+ unk1 = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ *unk1 = FUN_02005410(unk0);
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_020413E8(struct ScriptContext *ctx)
+{
+ FUN_0200521C(ScriptReadHalfword(ctx));
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_020413F8(struct ScriptContext *ctx)
+{
+ u32 unk0 = FUN_02004124(ScriptReadHalfword(ctx));
+ FUN_02005350(unk0, 0);
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_0204140C(struct ScriptContext *ctx)
+{
+ u16 unk0 = FUN_0204ABA8(ctx->unk80, *ctx->unk80->mapId);
+ FUN_0200521C(unk0);
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_02041424(struct ScriptContext *ctx)
+{
+ FUN_0204AB20(ctx->unk80, ScriptReadHalfword(ctx));
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_0204143C(struct ScriptContext* ctx)
+{
+ u16 unk1 = ScriptReadHalfword(ctx);
+ u16 unk2 = ScriptReadHalfword(ctx);
+
+ FUN_020053CC(unk1, unk2);
+ SetupNativeScript(ctx, FUN_02041464);
+
+ return TRUE;
+}
+
+THUMB_FUNC BOOL FUN_02041464(struct ScriptContext* ctx)
+{
+#pragma unused(ctx)
+
+ if(!FUN_02005404())
+ return TRUE;
+ else
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_02041478(struct ScriptContext* ctx)
+{
+ u16 unk = ScriptReadHalfword(ctx);
+
+ FUN_0200538C(0x7F, unk, 0);
+ SetupNativeScript(ctx, FUN_02041464);
+
+ return TRUE;
+}
+
+THUMB_FUNC BOOL FUN_0204149C(struct ScriptContext* ctx)
+{
+
+ u8 PtrIndx0 = *ctx->scriptPtr++;
+
+ u8 PtrIndx1 = *ctx->scriptPtr++;
+
+ FUN_020047C8(PtrIndx0, PtrIndx1);
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_020414B8(struct ScriptContext *ctx)
+{
+ FUN_02005308(4, ScriptReadHalfword(ctx));
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_020414CC(struct ScriptContext* ctx)
+{
+ u8 PtrIndx0 = *ctx->scriptPtr++;
+ FUN_020040F4(PtrIndx0);
+ return FALSE;
+}
+
+
+THUMB_FUNC BOOL FUN_020414E0(struct ScriptContext* ctx)
+{
+ u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ FUN_020054C8(unk);
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_020414FC(struct ScriptContext* ctx)
+{
+ u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ FUN_020054F0(unk, 0);
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_02041518(struct ScriptContext* ctx)
+{
+ u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+
+ ctx->data[0] = unk;
+ SetupNativeScript(ctx, FUN_02041540);
+
+ return TRUE;
+}
+
+THUMB_FUNC BOOL FUN_02041540(struct ScriptContext* ctx)
+{
+ if(!FUN_02005508((u16)ctx->data[0]))
+ return 1;
+ else
+ return 0;
+}
+
+THUMB_FUNC BOOL FUN_02041558(struct ScriptContext* ctx)
+{
+ u16 unk0 = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u16 unused = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ FUN_02005578(unk0);
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_waitcry(struct ScriptContext* ctx)
+{
+ SetupNativeScript(ctx, FUN_02041598);
+ return TRUE;
+}
+
+THUMB_FUNC BOOL FUN_02041598(struct ScriptContext* ctx)
+{
+#pragma unused(ctx)
+
+ if(!FUN_02005670())
+ return TRUE;
+ else
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_playbgm(struct ScriptContext* ctx)
+{
+ u16 bgm_id = ScriptReadHalfword(ctx);
+ PlayBGM(bgm_id);
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_020415BC(struct ScriptContext* ctx)
+{
+ SetupNativeScript(ctx, FUN_020415CC);
+ return TRUE;
+}
+
+THUMB_FUNC BOOL FUN_020415CC(struct ScriptContext* ctx)
+{
+#pragma unused(ctx)
+ if (!FUN_02005CBC())
+ return TRUE;
+ else
+ return FALSE;
+}
+
+THUMB_FUNC BOOL FUN_020415E0(struct ScriptContext* ctx)
+{
+ u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ void* unk = FUN_02029EF8(ctx->unk80->saveBlock2);
+ if (FUN_02005D20(unk) == 1)
+ {
+ *ret_ptr = 1;
+ return FALSE;
+ }
+ else
+ {
+ *ret_ptr = 0;
+ return FALSE;
+ }
+}
+
+THUMB_FUNC BOOL FUN_02041618(struct ScriptContext* ctx)
+{
+ u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ if (FUN_02005E28() == 0)
+ {
+ *ret_ptr = 1;
+ return FALSE;
+ }
+ else
+ {
+ *ret_ptr = 0;
+ return FALSE;
+ }
+}
+
+THUMB_FUNC BOOL FUN_02041644(struct ScriptContext* ctx)
+{
+#pragma unused(ctx)
+ FUN_02005E64();
+ return TRUE;
+}
+
+THUMB_FUNC BOOL FUN_02041650(struct ScriptContext* ctx)
+{
+ void* unk = FUN_02029EF8(ctx->unk80->saveBlock2);
+ FUN_02005E6C(unk);
+
+ return TRUE;
+}
+
+THUMB_FUNC BOOL FUN_02041664(struct ScriptContext* ctx)
+{
+#pragma unused(ctx)
+ FUN_0200433C(0x3F, 0, 0);
+ return TRUE;
+}
+
+THUMB_FUNC BOOL FUN_02041674(struct ScriptContext* ctx)
+{
+ u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+
+ FUN_0200488C(unk1, unk2);
+
+ return FALSE;
+}
+