diff options
-rw-r--r-- | arm9/asm/scrcmd_asm.s | 224 | ||||
-rw-r--r-- | arm9/asm/unk_02038C78.s | 8 | ||||
-rw-r--r-- | arm9/global.inc | 8 | ||||
-rw-r--r-- | arm9/src/scrcmd.c | 118 | ||||
-rw-r--r-- | arm9/src/text.c | 1 | ||||
-rw-r--r-- | include/scrcmd.h | 4 | ||||
-rw-r--r-- | tools/asm_processor/compile.sh | 3 |
7 files changed, 133 insertions, 233 deletions
diff --git a/arm9/asm/scrcmd_asm.s b/arm9/asm/scrcmd_asm.s index 3633bc53..95b132fd 100644 --- a/arm9/asm/scrcmd_asm.s +++ b/arm9/asm/scrcmd_asm.s @@ -15,230 +15,6 @@ UNK_021C5A0C: ; 0x021C5A0C .text - thumb_func_start FUN_0203A830 -FUN_0203A830: ; 0x0203A830 - push {r3-r5, lr} - add r1, r0, #0x0 - add r1, #0x80 - ldr r2, [r0, #0x8] - ldr r4, [r1, #0x0] - add r1, r2, #0x1 - str r1, [r0, #0x8] - ldrb r5, [r2, #0x0] - bl ScriptReadHalfword - add r2, r0, #0x0 - ldr r0, [r4, #0x60] - add r1, r5, #0x0 - bl MOD05_021E8128 - ldr r0, [r4, #0x60] - mov r1, #0x1 - bl MOD05_021E8130 - mov r0, #0x1 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_0203A85C -FUN_0203A85C: ; 0x0203A85C - push {r3, lr} - add r1, r0, #0x0 - add r1, #0x80 - ldr r2, [r0, #0x8] - ldr r3, [r1, #0x0] - add r1, r2, #0x1 - str r1, [r0, #0x8] - ldrb r1, [r2, #0x0] - ldr r0, [r3, #0x60] - bl MOD05_021E8130 - mov r0, #0x1 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_0203A878 -FUN_0203A878: ; 0x0203A878 - push {r4, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x60] - bl MOD05_021E8148 - cmp r0, #0x1 - bne _0203A88E - mov r0, #0x0 - pop {r4, pc} -_0203A88E: - ldr r1, _0203A89C ; =FUN_0203A8A0 - add r0, r4, #0x0 - bl SetupNativeScript - mov r0, #0x1 - pop {r4, pc} - nop -_0203A89C: .word FUN_0203A8A0 - - thumb_func_start FUN_0203A8A0 -FUN_0203A8A0: ; 0x0203A8A0 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x60] - bl MOD05_021E8148 - cmp r0, #0x1 - bne _0203A8B4 - mov r0, #0x1 - pop {r3, pc} -_0203A8B4: - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start FUN_0203A8B8 -FUN_0203A8B8: ; 0x0203A8B8 - push {r3-r7, lr} - sub sp, #0x10 - add r5, r0, #0x0 - add r0, #0x80 - ldr r4, [r0, #0x0] - mov r1, #0x3 - add r0, r4, #0x0 - bl FUN_02039438 - str r0, [sp, #0x4] - add r0, r4, #0x0 - mov r1, #0x11 - bl FUN_02039438 - add r6, r0, #0x0 - add r0, r4, #0x0 - mov r1, #0x10 - bl FUN_02039438 - add r7, r0, #0x0 - add r0, r4, #0x0 - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - str r0, [sp, #0x8] - add r0, r1, #0x1 - str r0, [r5, #0x8] - ldrb r0, [r1, #0x0] - str r0, [sp, #0x0] - add r0, r5, #0x0 - bl ScriptReadHalfword - str r0, [sp, #0xc] - ldr r0, [r5, #0x78] - ldr r1, [sp, #0x0] - ldr r2, [r6, #0x0] - bl ReadMsgDataIntoString - ldr r0, [sp, #0x8] - ldr r1, [r7, #0x0] - ldr r0, [r0, #0x0] - ldr r2, [r6, #0x0] - bl StringExpandPlaceholders - ldr r0, [r4, #0x60] - bl MOD05_021E8140 - add r4, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Sav2_PlayerData_GetOptionsAddr - add r2, r0, #0x0 - ldr r1, [r7, #0x0] - add r0, r4, #0x0 - mov r3, #0x1 - bl FUN_02054658 - ldr r1, [sp, #0x4] - strb r0, [r1, #0x0] - ldr r0, [sp, #0xc] - ldr r1, _0203A948 ; =FUN_0203A94C - str r0, [r5, #0x64] - add r0, r5, #0x0 - bl SetupNativeScript - mov r0, #0x1 - add sp, #0x10 - pop {r3-r7, pc} - .balign 4 -_0203A948: .word FUN_0203A94C - - thumb_func_start FUN_0203A94C -FUN_0203A94C: ; 0x0203A94C - push {r3-r7, lr} - add r7, r0, #0x0 - add r0, #0x80 - ldr r5, [r0, #0x0] - mov r1, #0x3 - add r0, r5, #0x0 - bl FUN_02039438 - ldr r1, [r7, #0x64] - add r6, r0, #0x0 - lsl r1, r1, #0x10 - add r0, r5, #0x0 - lsr r1, r1, #0x10 - bl GetVarPointer - add r4, r0, #0x0 - ldr r0, [r5, #0x60] - bl MOD05_021E8144 - ldrb r0, [r6, #0x0] - ldr r5, _0203A9E8 ; =0x0000FFFF - bl FUN_020546C8 - cmp r0, #0x1 - bne _0203A986 - mov r0, #0x2 - strh r0, [r4, #0x0] - mov r0, #0x1 - pop {r3-r7, pc} -_0203A986: - ldr r0, _0203A9EC ; =gMain - mov r1, #0x40 - ldr r0, [r0, #0x48] - tst r1, r0 - beq _0203A994 - mov r5, #0x0 - b _0203A9B0 -_0203A994: - mov r1, #0x80 - tst r1, r0 - beq _0203A99E - mov r5, #0x1 - b _0203A9B0 -_0203A99E: - mov r1, #0x20 - tst r1, r0 - beq _0203A9A8 - mov r5, #0x2 - b _0203A9B0 -_0203A9A8: - mov r1, #0x10 - tst r1, r0 - beq _0203A9B0 - mov r5, #0x3 -_0203A9B0: - ldr r1, _0203A9E8 ; =0x0000FFFF - cmp r5, r1 - beq _0203A9D0 - ldrb r0, [r6, #0x0] - bl FUN_0201BD7C - add r7, #0x80 - ldr r0, [r7, #0x0] - add r1, r5, #0x0 - ldr r0, [r0, #0x38] - bl FUN_02055304 - mov r0, #0x0 - strh r0, [r4, #0x0] - mov r0, #0x1 - pop {r3-r7, pc} -_0203A9D0: - mov r1, #0x1 - lsl r1, r1, #0xa - tst r0, r1 - beq _0203A9E4 - ldrb r0, [r6, #0x0] - bl FUN_0201BD7C - mov r0, #0x1 - strh r0, [r4, #0x0] - pop {r3-r7, pc} -_0203A9E4: - mov r0, #0x0 - pop {r3-r7, pc} - .balign 4 -_0203A9E8: .word 0x0000FFFF -_0203A9EC: .word gMain - thumb_func_start FUN_0203A9F0 FUN_0203A9F0: ; 0x0203A9F0 push {r4, lr} diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index 379ff363..950ebd45 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -204,10 +204,10 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_Unk0034 .word ScrCmd_Unk0035 .word ScrCmd_CreateMessageBox - .word FUN_0203A830 - .word FUN_0203A85C - .word FUN_0203A878 - .word FUN_0203A8B8 + .word ScrCmd_Unk0037 + .word ScrCmd_Unk0038 + .word ScrCmd_Unk0039 + .word ScrCmd_Unk003A .word FUN_0203A9F0 .word FUN_0203AA90 .word ScrCmd_ScrollBg diff --git a/arm9/global.inc b/arm9/global.inc index 1614c405..c9b785dc 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -2766,10 +2766,10 @@ .extern ScrCmd_Unk0035 .extern ScrCmd_ScrollBg .extern ScrCmd_CreateMessageBox -.extern FUN_0203A830 -.extern FUN_0203A85C -.extern FUN_0203A878 -.extern FUN_0203A8B8 +.extern ScrCmd_Unk0037 +.extern ScrCmd_Unk0038 +.extern ScrCmd_Unk0039 +.extern ScrCmd_Unk003A .extern FUN_0203A9F0 .extern FUN_0203AA90 .extern FUN_0203AAA0 diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index 0f8c6c45..478148bc 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -38,6 +38,9 @@ extern void MOD05_021E8128(u32 param0, u8 type, u16 map); extern void MOD05_021E8130(u32 param0, u32 param1); extern void MOD05_021E8158(struct UnkSavStruct80 *unk80); 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); static BOOL RunPauseTimer(struct ScriptContext *ctx); static u32 Compare(u16 a, u16 b); @@ -47,7 +50,9 @@ static BOOL FUN_0203A46C(struct ScriptContext *ctx); static BOOL FUN_0203A4AC(struct ScriptContext *ctx); static BOOL FUN_0203A4E0(struct ScriptContext *ctx); static BOOL FUN_0203A570(struct ScriptContext *ctx); -static BOOL FUN_0203A6C8(struct ScriptContext* ctx); +static BOOL FUN_0203A6C8(struct ScriptContext *ctx); +static BOOL FUN_0203A8A0(struct ScriptContext *ctx); +static BOOL FUN_0203A94C(struct ScriptContext *ctx); extern u8 sScriptConditionTable[6][3]; @@ -869,3 +874,114 @@ THUMB_FUNC BOOL ScrCmd_CreateMessageBox(struct ScriptContext* ctx) return TRUE; } + +THUMB_FUNC BOOL ScrCmd_Unk0037(struct ScriptContext *ctx) +{ + struct UnkSavStruct80 *unk80 = ctx->unk80; + u8 typ = ScriptReadByte(ctx); + u16 map = ScriptReadHalfword(ctx); + + MOD05_021E8128(unk80->unk60, typ, map); + MOD05_021E8130(unk80->unk60, 1); + + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0038(struct ScriptContext *ctx) +{ + struct UnkSavStruct80 *unk80 = ctx->unk80; + u8 req = ScriptReadByte(ctx); + MOD05_021E8130(unk80->unk60, req); + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0039(struct ScriptContext *ctx) +{ + if (MOD05_021E8148(ctx->unk80->unk60) == TRUE) + { + return FALSE; + } + + SetupNativeScript(ctx, FUN_0203A8A0); + return TRUE; +} + +THUMB_FUNC static BOOL FUN_0203A8A0(struct ScriptContext *ctx) +{ + if (MOD05_021E8148(ctx->unk80->unk60) == TRUE) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk003A(struct ScriptContext *ctx) +{ + struct UnkSavStruct80 *unk80 = ctx->unk80; + u8 *unk1 = FUN_02039438(unk80, 3); + struct String **unk2 = FUN_02039438(unk80, 17); + struct String **unk3 = FUN_02039438(unk80, 16); + struct ScrStrBufs **unk4 = FUN_02039438(unk80, 15); + + u8 msg = ScriptReadByte(ctx); + u16 wk = ScriptReadHalfword(ctx); + + ReadMsgDataIntoString(ctx->msgData, msg, *unk2); + StringExpandPlaceholders(*unk4, *unk3, *unk2); + + *unk1 = FUN_02054658(MOD05_021E8140(unk80->unk60), *unk3, Sav2_PlayerData_GetOptionsAddr(ctx->unk80->saveBlock2), 1); + ctx->data[0] = wk; + SetupNativeScript(ctx, FUN_0203A94C); + return TRUE; +} + +THUMB_FUNC static BOOL FUN_0203A94C(struct ScriptContext* ctx) +{ + struct UnkSavStruct80 *unk80 = ctx->unk80; + u8 *unk1 = FUN_02039438(unk80, 3); + u16 *varPtr = GetVarPointer(unk80, (u16)ctx->data[0]); + MOD05_021E8144(unk80->unk60); + + u32 tmp = 0xFFFF; + if (FUN_020546C8(*unk1) == TRUE) + { + *varPtr = 2; + return TRUE; + } + + 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_0201BD7C(*unk1); + FUN_02055304(ctx->unk80->unk38, tmp); + *varPtr = 0; + return TRUE; + } + else + { + if (gMain.unk48 & 0x400) + { + FUN_0201BD7C(*unk1); + *varPtr = 1; + return TRUE; + } + return FALSE; + } +} diff --git a/arm9/src/text.c b/arm9/src/text.c index 6207d913..665b5dd9 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -416,6 +416,7 @@ THUMB_FUNC void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadow *(current++) = (shadow12) | temp; } #else +//GLOBAL_ASM("asm/nonmatchings/GenerateFontHalfRowLookupTable.s") THUMB_FUNC void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) //TODO use asm preprocessor { asm { diff --git a/include/scrcmd.h b/include/scrcmd.h index 7eafd112..4fa58f46 100644 --- a/include/scrcmd.h +++ b/include/scrcmd.h @@ -79,6 +79,10 @@ BOOL ScrCmd_Unk0034(struct ScriptContext* ctx); BOOL ScrCmd_Unk0035(struct ScriptContext* ctx); BOOL ScrCmd_ScrollBg(struct ScriptContext* ctx); BOOL ScrCmd_CreateMessageBox(struct ScriptContext* ctx); +BOOL ScrCmd_Unk0037(struct ScriptContext* ctx); +BOOL ScrCmd_Unk0038(struct ScriptContext *ctx); +BOOL ScrCmd_Unk0039(struct ScriptContext* ctx); +BOOL ScrCmd_Unk003A(struct ScriptContext* ctx); //scrcmd_18.c BOOL ScrCmd_GiveMon(struct ScriptContext* ctx); diff --git a/tools/asm_processor/compile.sh b/tools/asm_processor/compile.sh index 8c367b3e..561b0399 100644 --- a/tools/asm_processor/compile.sh +++ b/tools/asm_processor/compile.sh @@ -25,3 +25,6 @@ $DEVKITARM/bin/arm-none-eabi-objcopy --remove-section .comment "$PADDED_OBJ" "$O rm "$PADDED_SRC" rm "$PADDED_OBJ" rm "$PRELUDE" +rm output.txt +rm asm_processor_temp.s +rm asm_processor_temp.o |