diff options
author | Akira Akashi <rubenru09@aol.com> | 2021-03-23 23:10:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-23 23:10:08 +0000 |
commit | 2e056e1c50add86f00dc8a84d99c6f0afed0334f (patch) | |
tree | 3a3e6fa309f8e84362f1d36c6eaeb63f26a56be9 | |
parent | 41ed9de2d4c81986cce976f2d93923b70101ac3a (diff) | |
parent | 963908bc38d5bddeee08acf77619ee23c2680482 (diff) |
Merge pull request #345 from red031000/master
more scrcmd, struct changes
-rw-r--r-- | .github/calcrom/.gitattributes | 1 | ||||
-rw-r--r-- | .github/calcrom/webhook.sh | 1 | ||||
-rw-r--r-- | arm9/asm/scrcmd_asm.s | 479 | ||||
-rw-r--r-- | arm9/asm/unk_02038C78.s | 20 | ||||
-rw-r--r-- | arm9/global.inc | 20 | ||||
-rw-r--r-- | arm9/src/scrcmd.c | 228 | ||||
-rw-r--r-- | arm9/src/scrcmd_coins.c | 4 | ||||
-rw-r--r-- | include/scrcmd.h | 10 | ||||
-rw-r--r-- | include/script.h | 10 |
9 files changed, 266 insertions, 507 deletions
diff --git a/.github/calcrom/.gitattributes b/.github/calcrom/.gitattributes new file mode 100644 index 00000000..70f1c267 --- /dev/null +++ b/.github/calcrom/.gitattributes @@ -0,0 +1 @@ +webhook.sh text eol=lf diff --git a/.github/calcrom/webhook.sh b/.github/calcrom/webhook.sh index 279f795d..c15e9b50 100644 --- a/.github/calcrom/webhook.sh +++ b/.github/calcrom/webhook.sh @@ -16,4 +16,3 @@ fi make -C ${GITHUB_WORKSPACE}/.github/calcrom output=$(${GITHUB_WORKSPACE}/.github/calcrom/calcrom ${GITHUB_WORKSPACE} | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST $url -popd diff --git a/arm9/asm/scrcmd_asm.s b/arm9/asm/scrcmd_asm.s index dcf84948..c10ba0f5 100644 --- a/arm9/asm/scrcmd_asm.s +++ b/arm9/asm/scrcmd_asm.s @@ -1,11 +1,11 @@ .include "asm/macros.inc" .include "global.inc" - .extern UNK_020F34E0 .extern UNK_020F34FC .extern UNK_020F3538 .extern gMain .extern FUN_0203A2F0 + .extern FUN_0203AD2C .section .bss @@ -15,483 +15,6 @@ UNK_021C5A0C: ; 0x021C5A0C .text - thumb_func_start FUN_0203AA0C -FUN_0203AA0C: ; 0x0203AA0C - push {r3-r5, lr} - add r5, r0, #0x0 - ldr r1, [r5, #0x64] - add r0, #0x80 - lsl r1, r1, #0x10 - ldr r0, [r0, #0x0] - lsr r1, r1, #0x10 - bl GetVarPointer - add r4, r0, #0x0 - ldr r0, _0203AA88 ; =gMain - ldr r1, _0203AA8C ; =0x0000FFFF - ldr r2, [r0, #0x48] - mov r0, #0x3 - add r3, r2, #0x0 - tst r3, r0 - beq _0203AA36 - mov r0, #0x0 - strh r0, [r4, #0x0] - mov r0, #0x1 - pop {r3-r5, pc} -_0203AA36: - mov r3, #0x40 - tst r3, r2 - beq _0203AA40 - mov r1, #0x0 - b _0203AA5C -_0203AA40: - mov r3, #0x80 - tst r3, r2 - beq _0203AA4A - mov r1, #0x1 - b _0203AA5C -_0203AA4A: - mov r3, #0x20 - tst r3, r2 - beq _0203AA54 - mov r1, #0x2 - b _0203AA5C -_0203AA54: - mov r3, #0x10 - tst r3, r2 - beq _0203AA5C - add r1, r0, #0x0 -_0203AA5C: - ldr r0, _0203AA8C ; =0x0000FFFF - cmp r1, r0 - beq _0203AA74 - add r5, #0x80 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0x38] - bl FUN_02055304 - mov r0, #0x0 - strh r0, [r4, #0x0] - mov r0, #0x1 - pop {r3-r5, pc} -_0203AA74: - mov r0, #0x1 - lsl r0, r0, #0xa - tst r0, r2 - beq _0203AA82 - mov r0, #0x1 - strh r0, [r4, #0x0] - pop {r3-r5, pc} -_0203AA82: - mov r0, #0x0 - pop {r3-r5, pc} - nop -_0203AA88: .word gMain -_0203AA8C: .word 0x0000FFFF - - thumb_func_start FUN_0203AA90 -FUN_0203AA90: ; 0x0203AA90 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - bl FUN_02039460 - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_0203AAA0 -FUN_0203AAA0: ; 0x0203AAA0 - push {r3-r7, lr} - sub sp, #0x8 - add r5, r0, #0x0 - add r0, #0x80 - ldr r4, [r0, #0x0] - mov r1, #0x2 - add r0, r4, #0x0 - bl FUN_02039438 - add r6, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r7, r0, #0x0 - mov r0, #0x0 - str r0, [sp, #0x0] - mov r0, #0x4 - str r0, [sp, #0x4] - ldr r0, [r4, #0x8] - ldr r2, _0203AAF4 ; =0x000003D9 - mov r1, #0x3 - mov r3, #0xb - bl FUN_0200CB00 - mov r0, #0x4 - str r0, [sp, #0x0] - ldr r0, [r4, #0x8] - ldr r1, _0203AAF8 ; =UNK_020F34E0 - ldr r2, _0203AAF4 ; =0x000003D9 - mov r3, #0xb - bl Std_CreateYesNoMenu - str r0, [r6, #0x0] - ldr r1, _0203AAFC ; =FUN_0203AB00 - add r0, r5, #0x0 - str r7, [r5, #0x64] - bl SetupNativeScript - mov r0, #0x1 - add sp, #0x8 - pop {r3-r7, pc} - nop -_0203AAF4: .word 0x000003D9 -_0203AAF8: .word UNK_020F34E0 -_0203AAFC: .word FUN_0203AB00 - - thumb_func_start FUN_0203AB00 -FUN_0203AB00: ; 0x0203AB00 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r6, [r0, #0x0] - mov r1, #0x2 - add r0, r6, #0x0 - bl FUN_02039438 - ldr r1, [r5, #0x64] - add r4, r0, #0x0 - lsl r1, r1, #0x10 - add r0, r6, #0x0 - lsr r1, r1, #0x10 - bl GetVarPointer - add r5, r0, #0x0 - ldr r0, [r4, #0x0] - mov r1, #0x4 - bl FUN_020021AC - mov r1, #0x0 - mvn r1, r1 - cmp r0, r1 - bne _0203AB34 - mov r0, #0x0 - pop {r4-r6, pc} -_0203AB34: - cmp r0, #0x0 - bne _0203AB3C - mov r0, #0x0 - b _0203AB3E -_0203AB3C: - mov r0, #0x1 -_0203AB3E: - strh r0, [r5, #0x0] - mov r0, #0x1 - pop {r4-r6, pc} - - thumb_func_start FUN_0203AB44 -FUN_0203AB44: ; 0x0203AB44 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x1 - bl FUN_02039438 - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - mov r1, #0x12 - bl FUN_02039438 - add r5, r0, #0x0 - ldr r1, _0203AB70 ; =0x000003E2 - add r0, r4, #0x0 - bl FUN_0200D858 - str r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - nop -_0203AB70: .word 0x000003E2 - - thumb_func_start FUN_0203AB74 -FUN_0203AB74: ; 0x0203AB74 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x12 - bl FUN_02039438 - ldr r0, [r0, #0x0] - bl FUN_0200DBFC - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_0203AB8C -FUN_0203AB8C: ; 0x0203AB8C - push {r4-r7, lr} - sub sp, #0x2c - add r5, r0, #0x0 - add r0, #0x80 - ldr r6, [r0, #0x0] - mov r1, #0x0 - add r0, r6, #0x0 - bl FUN_02039438 - str r0, [sp, #0x1c] - add r0, r6, #0x0 - mov r1, #0xf - bl FUN_02039438 - str r0, [sp, #0x20] - ldr r0, [r5, #0x8] - add r1, r0, #0x1 - str r1, [r5, #0x8] - ldrb r0, [r0, #0x0] - add r2, r1, #0x1 - str r0, [sp, #0x18] - str r2, [r5, #0x8] - ldrb r0, [r1, #0x0] - add r1, r2, #0x1 - str r0, [sp, #0x14] - str r1, [r5, #0x8] - ldrb r7, [r2, #0x0] - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - str r0, [sp, #0x24] - ldr r1, [sp, #0x24] - add r0, r6, #0x0 - bl GetVarPointer - str r0, [sp, #0x28] - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x1 - bl FUN_02039438 - ldr r1, [sp, #0x28] - str r4, [sp, #0x0] - str r1, [sp, #0x4] - ldr r1, [sp, #0x20] - add r3, r7, #0x0 - ldr r1, [r1, #0x0] - str r1, [sp, #0x8] - str r0, [sp, #0xc] - mov r0, #0x0 - str r0, [sp, #0x10] - ldr r1, [sp, #0x18] - ldr r2, [sp, #0x14] - add r0, r6, #0x0 - bl MOD05_021E1BF8 - ldr r1, [sp, #0x1c] - str r0, [r1, #0x0] - ldr r0, [sp, #0x24] - str r0, [r5, #0x64] - mov r0, #0x1 - add sp, #0x2c - pop {r4-r7, pc} - .balign 4 - - thumb_func_start FUN_0203AC14 -FUN_0203AC14: ; 0x0203AC14 - push {r4-r7, lr} - sub sp, #0x2c - add r5, r0, #0x0 - add r0, #0x80 - ldr r6, [r0, #0x0] - mov r1, #0x0 - add r0, r6, #0x0 - bl FUN_02039438 - str r0, [sp, #0x1c] - add r0, r6, #0x0 - mov r1, #0xf - bl FUN_02039438 - str r0, [sp, #0x20] - ldr r0, [r5, #0x8] - add r1, r0, #0x1 - str r1, [r5, #0x8] - ldrb r0, [r0, #0x0] - add r2, r1, #0x1 - str r0, [sp, #0x18] - str r2, [r5, #0x8] - ldrb r0, [r1, #0x0] - add r1, r2, #0x1 - str r0, [sp, #0x14] - str r1, [r5, #0x8] - ldrb r7, [r2, #0x0] - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - str r0, [sp, #0x24] - ldr r1, [sp, #0x24] - add r0, r6, #0x0 - bl GetVarPointer - str r0, [sp, #0x28] - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x1 - bl FUN_02039438 - ldr r1, [sp, #0x28] - str r4, [sp, #0x0] - str r1, [sp, #0x4] - ldr r1, [sp, #0x20] - add r3, r7, #0x0 - ldr r1, [r1, #0x0] - str r1, [sp, #0x8] - str r0, [sp, #0xc] - ldr r0, [r5, #0x78] - str r0, [sp, #0x10] - ldr r1, [sp, #0x18] - ldr r2, [sp, #0x14] - add r0, r6, #0x0 - bl MOD05_021E1BF8 - ldr r1, [sp, #0x1c] - str r0, [r1, #0x0] - ldr r0, [sp, #0x24] - str r0, [r5, #0x64] - mov r0, #0x1 - add sp, #0x2c - pop {r4-r7, pc} - .balign 4 - - thumb_func_start FUN_0203AC9C -FUN_0203AC9C: ; 0x0203AC9C - push {r4, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x0 - bl FUN_02039438 - ldr r1, [r4, #0x8] - add r3, r1, #0x1 - str r3, [r4, #0x8] - ldrb r1, [r1, #0x0] - add r2, r3, #0x1 - str r2, [r4, #0x8] - ldrb r2, [r3, #0x0] - ldr r0, [r0, #0x0] - bl MOD05_021E1C4C - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_0203ACC4 -FUN_0203ACC4: ; 0x0203ACC4 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x0 - 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 r6, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r4, #0x0] - add r1, r6, #0x0 - bl MOD05_021E1C4C - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_0203AD08 -FUN_0203AD08: ; 0x0203AD08 - push {r4, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x0 - bl FUN_02039438 - ldr r0, [r0, #0x0] - bl MOD05_021E1C54 - ldr r1, _0203AD28 ; =FUN_0203AD2C - add r0, r4, #0x0 - bl SetupNativeScript - mov r0, #0x1 - pop {r4, pc} - .balign 4 -_0203AD28: .word FUN_0203AD2C - - thumb_func_start FUN_0203AD2C -FUN_0203AD2C: ; 0x0203AD2C - push {r3, lr} - add r1, r0, #0x0 - ldr r1, [r1, #0x64] - add r0, #0x80 - lsl r1, r1, #0x10 - ldr r0, [r0, #0x0] - lsr r1, r1, #0x10 - bl GetVarPointer - ldrh r1, [r0, #0x0] - ldr r0, _0203AD50 ; =0x0000EEEE - cmp r1, r0 - beq _0203AD4A - mov r0, #0x1 - pop {r3, pc} -_0203AD4A: - mov r0, #0x0 - pop {r3, pc} - nop -_0203AD50: .word 0x0000EEEE - - thumb_func_start FUN_0203AD54 -FUN_0203AD54: ; 0x0203AD54 - push {r4, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x0 - bl FUN_02039438 - ldr r0, [r0, #0x0] - bl MOD05_021E1C54 - ldr r1, _0203AD74 ; =FUN_0203AD78 - add r0, r4, #0x0 - bl SetupNativeScript - mov r0, #0x1 - pop {r4, pc} - .balign 4 -_0203AD74: .word FUN_0203AD78 - - thumb_func_start FUN_0203AD78 -FUN_0203AD78: ; 0x0203AD78 - push {r4-r6, lr} - add r1, r0, #0x0 - add r0, #0x80 - ldr r1, [r1, #0x64] - ldr r5, [r0, #0x0] - lsl r1, r1, #0x10 - add r0, r5, #0x0 - lsr r1, r1, #0x10 - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - mov r1, #0x0 - bl FUN_02039438 - add r6, r0, #0x0 - ldrh r1, [r4, #0x0] - ldr r0, _0203ADC0 ; =0x0000EEEE - cmp r1, r0 - bne _0203ADBC - ldr r0, [r5, #0x78] - bl FUN_02052714 - cmp r0, #0x0 - beq _0203ADB8 - mov r0, #0x8 - strh r0, [r4, #0x0] - ldr r0, [r6, #0x0] - bl MOD05_021E1ECC - mov r0, #0x1 - pop {r4-r6, pc} -_0203ADB8: - mov r0, #0x0 - pop {r4-r6, pc} -_0203ADBC: - mov r0, #0x1 - pop {r4-r6, pc} - .balign 4 -_0203ADC0: .word 0x0000EEEE - thumb_func_start FUN_0203ADC4 FUN_0203ADC4: ; 0x0203ADC4 push {r4-r7, lr} diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index c9a8bdd6..7051e8ff 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -209,14 +209,14 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_Unk0039 .word ScrCmd_Unk003A .word ScrCmd_Unk003B - .word FUN_0203AA90 + .word ScrCmd_Menu .word ScrCmd_ScrollBg - .word FUN_0203AAA0 + .word ScrCmd_YesNoMenu .word FUN_0203DEA8 - .word FUN_0203AB8C - .word FUN_0203AC14 - .word FUN_0203AC9C - .word FUN_0203AD08 + .word ScrCmd_Unk0040 + .word ScrCmd_Unk0041 + .word ScrCmd_Unk0042 + .word ScrCmd_Unk0043 .word FUN_0203ADC4 .word FUN_0203AE4C .word FUN_0203AED4 @@ -546,8 +546,8 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203DAE8 .word FUN_0203DB38 .word FUN_0203DB88 - .word FUN_0203AB44 - .word FUN_0203AB74 + .word ScrCmd_ShowSaveClock + .word ScrCmd_HideSaveClock .word FUN_0203DBD4 .word ScrCmd_WaitButtonABTime .word FUN_0203B8E4 @@ -818,7 +818,7 @@ gScriptCmdTable: ; 0x020F355C .word FUN_02042A48 .word FUN_02042A98 .word FUN_0203D7DC - .word FUN_0203ACC4 + .word ScrCmd_Unk029D .word FUN_0203F8C0 .word FUN_0203F954 .word FUN_0204190C @@ -846,7 +846,7 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203FC1C .word FUN_020451D0 .word FUN_02042000 - .word FUN_0203AD54 + .word ScrCmd_Unk02B9 .word FUN_0203D4E8 .word FUN_0203D920 .word FUN_02041B40 diff --git a/arm9/global.inc b/arm9/global.inc index d45b7243..30385d33 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -2770,16 +2770,16 @@ .extern ScrCmd_Unk0039 .extern ScrCmd_Unk003A .extern ScrCmd_Unk003B -.extern FUN_0203AA90 -.extern FUN_0203AAA0 -.extern FUN_0203AB44 -.extern FUN_0203AB74 -.extern FUN_0203AB8C -.extern FUN_0203AC14 -.extern FUN_0203AC9C -.extern FUN_0203ACC4 -.extern FUN_0203AD08 -.extern FUN_0203AD54 +.extern ScrCmd_Menu +.extern ScrCmd_YesNoMenu +.extern ScrCmd_ShowSaveClock +.extern ScrCmd_HideSaveClock +.extern ScrCmd_Unk0040 +.extern ScrCmd_Unk0041 +.extern ScrCmd_Unk0042 +.extern ScrCmd_Unk029D +.extern ScrCmd_Unk0043 +.extern ScrCmd_Unk02B9 .extern FUN_0203ADC4 .extern FUN_0203AE4C .extern FUN_0203AED4 diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index 870d6353..bad0d69c 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -27,7 +27,6 @@ extern u32 FUN_02058488(u32 param0); extern BOOL FUN_02030F40(void); extern void FUN_02055304(u32 param0, u32 param1); extern void FUN_02039460(struct UnkSavStruct80 *arg); -extern void FUN_02055304(u32 param0, u32 param1); extern void FUN_020545B8(u32 param0, u8 *param1, u32 param2); extern void FUN_02054608(u8 *param0, struct Options *options); extern void FUN_0200D0E0(u32 *param0, u32 param1); @@ -41,6 +40,18 @@ extern u32 MOD05_021E8140(u32 param0); extern BOOL MOD05_021E8148(u32 param0); extern u8 FUN_02054658(u32 param0, struct String *str, struct Options *opt, u32 param3); extern void MOD05_021E8144(u32 param0); +extern void FUN_0200CB00(u32 param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5); +extern u32 Std_CreateYesNoMenu(u32 param0, u8 **param1, u32 param2, u32 param3, u32 param4); +extern u32 FUN_020021AC(u32 param0, u32 param1); +extern u32 FUN_0200D858(u32 *param0, u32 param1); +extern void FUN_0200DBFC(u32 param0); +extern u32 MOD05_021E1BF8(struct UnkSavStruct80 *arg, u8 param1, u8 param2, u8 param3, u8 param4, u16 *param5, u32 param6, u32 *param7, struct MsgData *msgData); +extern void MOD05_021E1C4C(u32 param0, u32 param1, u32 param2); +extern void MOD05_021E1C54(u32 param0); +extern u32 FUN_02052714(u32 param0); +extern void MOD05_021E1ECC(u32 param0); + +extern u8 *UNK_020F34E0; static BOOL RunPauseTimer(struct ScriptContext *ctx); static u32 Compare(u16 a, u16 b); @@ -53,7 +64,10 @@ static BOOL FUN_0203A570(struct ScriptContext *ctx); static BOOL FUN_0203A6C8(struct ScriptContext *ctx); static BOOL FUN_0203A8A0(struct ScriptContext *ctx); static BOOL FUN_0203A94C(struct ScriptContext *ctx); -/*static*/ BOOL FUN_0203AA0C(struct ScriptContext *ctx); +static BOOL FUN_0203AA0C(struct ScriptContext *ctx); +static BOOL FUN_0203AB00(struct ScriptContext *ctx); +/*static*/ BOOL FUN_0203AD2C(struct ScriptContext *ctx); +static BOOL FUN_0203AD78(struct ScriptContext *ctx); extern u8 sScriptConditionTable[6][3]; @@ -994,3 +1008,213 @@ THUMB_FUNC BOOL ScrCmd_Unk003B(struct ScriptContext *ctx) SetupNativeScript(ctx, FUN_0203AA0C); return TRUE; } + +THUMB_FUNC static BOOL FUN_0203AA0C(struct ScriptContext *ctx) +{ + u16 *unk = GetVarPointer(ctx->unk80, (u16)ctx->data[0]); + + u32 tmp = 0xFFFF; + if (gMain.unk48 & 0x3) + { + *unk = 0; + return TRUE; + } + else if (gMain.unk48 & 0x40) + { + tmp = 0; + } + else if (gMain.unk48 & 0x80) + { + tmp = 1; + } + else if (gMain.unk48 & 0x20) + { + tmp = 2; + } + else if (gMain.unk48 & 0x10) + { + tmp = 3; + } + + if (tmp != 0xFFFF) + { + FUN_02055304(ctx->unk80->unk38, tmp); + *unk = 0; + return TRUE; + } + else + { + if (gMain.unk48 & 0x400) + { + *unk = 1; + return TRUE; + } + else + { + return FALSE; + } + } +} + +THUMB_FUNC BOOL ScrCmd_Menu(struct ScriptContext *ctx) +{ + FUN_02039460(ctx->unk80); + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_YesNoMenu(struct ScriptContext *ctx) +{ + struct UnkSavStruct80 *unk80 = ctx->unk80; + u32 *unk = FUN_02039438(unk80, 2); + u16 wk = ScriptReadHalfword(ctx); + FUN_0200CB00(unk80->unk08, 3, 985, 11, 0, 4); + *unk = Std_CreateYesNoMenu(unk80->unk08, &UNK_020F34E0, 985, 11, 4); + ctx->data[0] = wk; + SetupNativeScript(ctx, FUN_0203AB00); + return TRUE; +} + +THUMB_FUNC static BOOL FUN_0203AB00(struct ScriptContext *ctx) +{ + struct UnkSavStruct80 *unk80 = ctx->unk80; + u32 *unk = FUN_02039438(unk80, 2); + u16 *ptr = GetVarPointer(unk80, (u16)ctx->data[0]); + u32 unk2 = FUN_020021AC(*unk, 4); + + if (unk2 == -1) + { + return FALSE; + } + + if (unk2 == 0) + { + *ptr = 0; + } + else + { + *ptr = 1; + } + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_ShowSaveClock(struct ScriptContext *ctx) +{ + u32 *unk = FUN_02039438(ctx->unk80, 1); + u32 *unk2 = FUN_02039438(ctx->unk80, 18); + *unk2 = FUN_0200D858(unk, 994); + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_HideSaveClock(struct ScriptContext *ctx) +{ + u32 *unk = FUN_02039438(ctx->unk80, 18); + FUN_0200DBFC(*unk); + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0040(struct ScriptContext *ctx) +{ + struct UnkSavStruct80 *unk80 = ctx->unk80; + u32 *unk = FUN_02039438(unk80, 0); + u32 *unk2 = FUN_02039438(unk80, 15); + u8 unk3 = ScriptReadByte(ctx); + u8 unk4 = ScriptReadByte(ctx); + u8 unk5 = ScriptReadByte(ctx); + u8 unk6 = ScriptReadByte(ctx); + u16 unk7 = ScriptReadHalfword(ctx); + u16 *ptr = GetVarPointer(unk80, unk7); + u32 *unk8 = FUN_02039438(ctx->unk80, 1); + *unk = MOD05_021E1BF8(unk80, unk3, unk4, unk5, unk6, ptr, *unk2, unk8, NULL); + ctx->data[0] = unk7; + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0041(struct ScriptContext *ctx) +{ + struct UnkSavStruct80 *unk80 = ctx->unk80; + u32 *unk = FUN_02039438(unk80, 0); + u32 *unk2 = FUN_02039438(unk80, 15); + u8 unk3 = ScriptReadByte(ctx); + u8 unk4 = ScriptReadByte(ctx); + u8 unk5 = ScriptReadByte(ctx); + u8 unk6 = ScriptReadByte(ctx); + u16 unk7 = ScriptReadHalfword(ctx); + u16 *ptr = GetVarPointer(unk80, unk7); + u32 *unk8 = FUN_02039438(ctx->unk80, 1); + *unk = MOD05_021E1BF8(unk80, unk3, unk4, unk5, unk6, ptr, *unk2, unk8, ctx->msgData); + ctx->data[0] = unk7; + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0042(struct ScriptContext *ctx) +{ + u32 *unk = FUN_02039438(ctx->unk80, 0); + u8 unk2 = ScriptReadByte(ctx); + u8 unk3 = ScriptReadByte(ctx); + MOD05_021E1C4C(*unk, unk2, unk3); + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk029D(struct ScriptContext *ctx) +{ + struct UnkSavStruct80 *unk80 = ctx->unk80; + u32 *unk = FUN_02039438(unk80, 0); + u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unk3 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + MOD05_021E1C4C(*unk, unk2, unk3); + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0043(struct ScriptContext *ctx) +{ + u32 *unk = FUN_02039438(ctx->unk80, 0); + MOD05_021E1C54(*unk); + SetupNativeScript(ctx, FUN_0203AD2C); + return TRUE; +} + +THUMB_FUNC BOOL FUN_0203AD2C(struct ScriptContext *ctx) +{ + u16 *varPtr = GetVarPointer(ctx->unk80, (u16)ctx->data[0]); + if (*varPtr == 0xEEEE) + { + return FALSE; + } + else + { + return TRUE; + } +} + +THUMB_FUNC BOOL ScrCmd_Unk02B9(struct ScriptContext *ctx) +{ + u32 *unk = FUN_02039438(ctx->unk80, 0); + MOD05_021E1C54(*unk); + SetupNativeScript(ctx, FUN_0203AD78); + return TRUE; +} + +THUMB_FUNC static BOOL FUN_0203AD78(struct ScriptContext *ctx) +{ + struct UnkSavStruct80 *unk80 = ctx->unk80; + u16 *varPtr = GetVarPointer(unk80, (u16)ctx->data[0]); + u32 *unk = FUN_02039438(unk80, 0); + + if (*varPtr == 0xEEEE) + { + if (FUN_02052714(unk80->unk78)) + { + *varPtr = 8; + MOD05_021E1ECC(*unk); + return TRUE; + } + else + { + return FALSE; + } + } + else + { + return TRUE; + } +} diff --git a/arm9/src/scrcmd_coins.c b/arm9/src/scrcmd_coins.c index de4e993e..5f7c4aa8 100644 --- a/arm9/src/scrcmd_coins.c +++ b/arm9/src/scrcmd_coins.c @@ -19,7 +19,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0075(struct ScriptContext * ctx) u16 ** unk_ret_ptr = FUN_02039438(sav_ptr, 0x26); u32 unk3 = MOD05_021E2950(ctx->unk80, (u8)unk1, (u8)unk2); - *unk_ret_ptr = unk3; + *unk_ret_ptr = (u16 *)unk3; return FALSE; } @@ -134,7 +134,7 @@ THUMB_FUNC BOOL ScrCmd_CanGiveCoins(struct ScriptContext * ctx) u16 * ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); u16 amount = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); - *ret_ptr = CanGiveCoins(coins_ptr, amount); + *ret_ptr = (u16)CanGiveCoins(coins_ptr, amount); return FALSE; } diff --git a/include/scrcmd.h b/include/scrcmd.h index 2dacb9fb..44151627 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -84,6 +84,16 @@ BOOL ScrCmd_Unk0038(struct ScriptContext *ctx); BOOL ScrCmd_Unk0039(struct ScriptContext* ctx); BOOL ScrCmd_Unk003A(struct ScriptContext* ctx); BOOL ScrCmd_Unk003B(struct ScriptContext *ctx); +BOOL ScrCmd_Menu(struct ScriptContext *ctx); +BOOL ScrCmd_YesNoMenu(struct ScriptContext *ctx); +BOOL ScrCmd_ShowSaveClock(struct ScriptContext *ctx); +BOOL ScrCmd_HideSaveClock(struct ScriptContext *ctx); +BOOL ScrCmd_Unk0040(struct ScriptContext *ctx); +BOOL ScrCmd_Unk0041(struct ScriptContext *ctx); +BOOL ScrCmd_Unk0042(struct ScriptContext *ctx); +BOOL ScrCmd_Unk029D(struct ScriptContext *ctx); +BOOL ScrCmd_Unk0043(struct ScriptContext *ctx); +BOOL ScrCmd_Unk02B9(struct ScriptContext *ctx); //scrcmd_coins.c BOOL ScrCmd_Unk0075(struct ScriptContext* ctx); diff --git a/include/script.h b/include/script.h index ab126e09..9a7270c2 100644 --- a/include/script.h +++ b/include/script.h @@ -27,14 +27,16 @@ struct UnkSavStruct80 {
u8 padding[0x8];
u32 unk08;
- struct SaveBlock2 *saveBlock2; //0xC
+ struct SaveBlock2 *saveBlock2; //0xC
u8 padding2[0xC];
u32 *mapId; //0x1C
u8 padding3[0x18];
u32 unk38;
u8 padding4[0x24];
u32 unk60;
- u8 padding5[0x44];
+ u8 padding5[0x14];
+ u32 unk78;
+ u8 padding6[0x2C];
struct UnkStruct_02046444 * unkA8;
};
@@ -50,8 +52,8 @@ struct ScriptContext u32 cmdCount;
u32 data[4];
struct UnkStruct_0204639C *unk74;
- struct MsgData *msgData;
- u8 *unk7C;
+ struct MsgData *msgData;
+ u8 *unk7C;
struct UnkSavStruct80 *unk80;
};
|