diff options
author | Akira Akashi <rubenru09@aol.com> | 2021-03-30 20:57:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-30 20:57:18 +0100 |
commit | 5feba455f7b44720c5d8428dfdaf6de00faf020c (patch) | |
tree | d5e28c92f4f1ef74310c628f9403d46443c63866 | |
parent | d415e2a4e3f6c45cb83df3393c9d3b7ba66d5054 (diff) | |
parent | 3063fdd0e1f1cdfa7d5108a19ea4031009f71af0 (diff) |
Merge pull request #348 from red031000/master
more scrcmd
-rw-r--r-- | arm9/asm/scrcmd_asm.s | 248 | ||||
-rw-r--r-- | arm9/asm/unk_02038C78.s | 14 | ||||
-rw-r--r-- | arm9/global.inc | 14 | ||||
-rw-r--r-- | arm9/src/scrcmd.c | 86 | ||||
-rw-r--r-- | include/scrcmd.h | 7 |
5 files changed, 105 insertions, 264 deletions
diff --git a/arm9/asm/scrcmd_asm.s b/arm9/asm/scrcmd_asm.s index c10ba0f5..3d6645c2 100644 --- a/arm9/asm/scrcmd_asm.s +++ b/arm9/asm/scrcmd_asm.s @@ -5,7 +5,6 @@ .extern UNK_020F3538 .extern gMain .extern FUN_0203A2F0 - .extern FUN_0203AD2C .section .bss @@ -15,253 +14,6 @@ UNK_021C5A0C: ; 0x021C5A0C .text - thumb_func_start FUN_0203ADC4 -FUN_0203ADC4: ; 0x0203ADC4 - 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_021E1F34 - 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_0203AE4C -FUN_0203AE4C: ; 0x0203AE4C - 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_021E1F34 - 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_0203AED4 -FUN_0203AED4: ; 0x0203AED4 - push {r3-r7, 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 r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r7, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r3, r0, #0x0 - lsl r1, r6, #0x18 - lsl r2, r7, #0x18 - lsl r3, r3, #0x18 - ldr r0, [r4, #0x0] - lsr r1, r1, #0x18 - lsr r2, r2, #0x18 - lsr r3, r3, #0x18 - bl MOD05_021E1F58 - mov r0, #0x0 - pop {r3-r7, pc} - - thumb_func_start FUN_0203AF34 -FUN_0203AF34: ; 0x0203AF34 - 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_021E1F60 - ldr r1, _0203AF54 ; =FUN_0203AD2C - add r0, r4, #0x0 - bl SetupNativeScript - mov r0, #0x1 - pop {r4, pc} - .balign 4 -_0203AF54: .word FUN_0203AD2C - - thumb_func_start FUN_0203AF58 -FUN_0203AF58: ; 0x0203AF58 - push {r4, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x0 - bl FUN_02039438 - ldr r2, [r4, #0x8] - add r1, r2, #0x1 - str r1, [r4, #0x8] - ldrb r1, [r2, #0x0] - ldr r0, [r0, #0x0] - bl MOD05_021E26CC - ldr r1, _0203AF80 ; =FUN_0203AD2C - add r0, r4, #0x0 - bl SetupNativeScript - mov r0, #0x1 - pop {r4, pc} - .balign 4 -_0203AF80: .word FUN_0203AD2C - - thumb_func_start FUN_0203AF84 -FUN_0203AF84: ; 0x0203AF84 - push {r4, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x0 - bl FUN_02039438 - ldr r2, [r4, #0x8] - add r1, r2, #0x1 - str r1, [r4, #0x8] - ldrb r1, [r2, #0x0] - ldr r0, [r0, #0x0] - bl MOD05_021E2B80 - mov r0, #0x1 - pop {r4, pc} - - thumb_func_start FUN_0203AFA4 -FUN_0203AFA4: ; 0x0203AFA4 - push {r4, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x0 - bl FUN_02039438 - ldr r2, [r4, #0x8] - add r1, r2, #0x1 - str r1, [r4, #0x8] - ldrb r1, [r2, #0x0] - ldr r0, [r0, #0x0] - bl MOD05_021E2B9C - mov r0, #0x1 - pop {r4, pc} - thumb_func_start FUN_0203AFC4 FUN_0203AFC4: ; 0x0203AFC4 push {r4-r6, lr} diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index 72d8bce2..4b80024a 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -217,11 +217,11 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_Unk0041 .word ScrCmd_Unk0042 .word ScrCmd_Unk0043 - .word FUN_0203ADC4 - .word FUN_0203AE4C - .word FUN_0203AED4 - .word FUN_0203AF34 - .word FUN_0203AF58 + .word ScrCmd_Unk0044 + .word ScrCmd_Unk0045 + .word ScrCmd_Unk0046 + .word ScrCmd_Unk0047 + .word ScrCmd_Unk0048 .word FUN_020414E0 .word FUN_020414FC .word FUN_02041518 @@ -868,8 +868,8 @@ gScriptCmdTable: ; 0x020F355C .word FUN_02041100 .word FUN_02041138 .word FUN_02041174 - .word FUN_0203AF84 - .word FUN_0203AFA4 + .word ScrCmd_Unk02CF + .word ScrCmd_Unk02D0 .text diff --git a/arm9/global.inc b/arm9/global.inc index e90bb423..d5d12155 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -2776,13 +2776,13 @@ .extern ScrCmd_Unk029D .extern ScrCmd_Unk0043 .extern ScrCmd_Unk02B9 -.extern FUN_0203ADC4 -.extern FUN_0203AE4C -.extern FUN_0203AED4 -.extern FUN_0203AF34 -.extern FUN_0203AF58 -.extern FUN_0203AF84 -.extern FUN_0203AFA4 +.extern ScrCmd_Unk0044 +.extern ScrCmd_Unk0045 +.extern ScrCmd_Unk0046 +.extern ScrCmd_Unk0047 +.extern ScrCmd_Unk0048 +.extern ScrCmd_Unk02CF +.extern ScrCmd_Unk02D0 .extern FUN_0203AFC4 .extern FUN_0203B024 .extern FUN_0203B148 diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index a40ed547..4ad17e51 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -48,6 +48,12 @@ 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 u32 MOD05_021E1F34(struct UnkSavStruct80 *arg, u8 param1, u8 param2, u8 param3, u8 param4, u16 *param5, u32 param6, u32 *param7, struct MsgData *msgData); +extern void MOD05_021E1F58(u32 param0, u8 param1, u8 param2, u8 param3); +extern void MOD05_021E1F60(u32 param0); +extern void MOD05_021E26CC(u32 param0, u8 param1); +extern void MOD05_021E2B80(u32 param0, u8 param1); +extern void MOD05_021E2B9C(u32 param0, u8 param1); extern u8 *UNK_020F34E0; @@ -64,7 +70,7 @@ static BOOL FUN_0203A8A0(struct ScriptContext *ctx); static BOOL FUN_0203A94C(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_0203AD2C(struct ScriptContext *ctx); static BOOL FUN_0203AD78(struct ScriptContext *ctx); extern u8 sScriptConditionTable[6][3]; @@ -1171,7 +1177,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0043(struct ScriptContext *ctx) return TRUE; } -THUMB_FUNC BOOL FUN_0203AD2C(struct ScriptContext *ctx) +THUMB_FUNC static BOOL FUN_0203AD2C(struct ScriptContext *ctx) { u16 *varPtr = GetVarPointer(ctx->unk80, (u16)ctx->data[0]); if (*varPtr == 0xEEEE) @@ -1216,3 +1222,79 @@ THUMB_FUNC static BOOL FUN_0203AD78(struct ScriptContext *ctx) return TRUE; } } + +THUMB_FUNC BOOL ScrCmd_Unk0044(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 halfWord = ScriptReadHalfword(ctx); + u16 *varPtr = GetVarPointer(unk80, halfWord); + u32 *unk7 = FUN_02039438(ctx->unk80, 1); + *unk = MOD05_021E1F34(unk80, unk3, unk4, unk5, unk6, varPtr, *unk2, unk7, NULL); + ctx->data[0] = halfWord; + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0045(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 halfWord = ScriptReadHalfword(ctx); + u16 *varPtr = GetVarPointer(unk80, halfWord); + u32 *unk7 = FUN_02039438(ctx->unk80, 1); + *unk = MOD05_021E1F34(unk80, unk3, unk4, unk5, unk6, varPtr, *unk2, unk7, ctx->msgData); + ctx->data[0] = halfWord; + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0046(struct ScriptContext *ctx) +{ + u32 *unk = FUN_02039438(ctx->unk80, 0); + u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unk3 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unk4 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + MOD05_021E1F58(*unk, (u8)unk2, (u8)unk3, (u8)unk4); + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0047(struct ScriptContext *ctx) +{ + u32 *unk = FUN_02039438(ctx->unk80, 0); + MOD05_021E1F60(*unk); + SetupNativeScript(ctx, FUN_0203AD2C); + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0048(struct ScriptContext *ctx) +{ + u32 *unk = FUN_02039438(ctx->unk80, 0); + MOD05_021E26CC(*unk, ScriptReadByte(ctx)); + SetupNativeScript(ctx, FUN_0203AD2C); + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk02CF(struct ScriptContext *ctx) +{ + u32 *unk = FUN_02039438(ctx->unk80, 0); + MOD05_021E2B80(*unk, ScriptReadByte(ctx)); + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk02D0(struct ScriptContext *ctx) +{ + u32 *unk = FUN_02039438(ctx->unk80, 0); + MOD05_021E2B9C(*unk, ScriptReadByte(ctx)); + return TRUE; +} diff --git a/include/scrcmd.h b/include/scrcmd.h index a1b3362f..dd43e586 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -98,6 +98,13 @@ BOOL ScrCmd_Unk0042(struct ScriptContext *ctx); BOOL ScrCmd_Unk029D(struct ScriptContext *ctx); BOOL ScrCmd_Unk0043(struct ScriptContext *ctx); BOOL ScrCmd_Unk02B9(struct ScriptContext *ctx); +BOOL ScrCmd_Unk0044(struct ScriptContext *ctx); +BOOL ScrCmd_Unk0045(struct ScriptContext *ctx); +BOOL ScrCmd_Unk0046(struct ScriptContext *ctx); +BOOL ScrCmd_Unk0047(struct ScriptContext *ctx); +BOOL ScrCmd_Unk0048(struct ScriptContext *ctx); +BOOL ScrCmd_Unk02CF(struct ScriptContext *ctx); +BOOL ScrCmd_Unk02D0(struct ScriptContext *ctx); //scrcmd_coins.c BOOL ScrCmd_Unk0075(struct ScriptContext* ctx); |