diff --git a/asm/include/overlay_13_0238BE6C.inc b/asm/include/overlay_13_0238BE6C.inc deleted file mode 100644 index 0887a0f3..00000000 --- a/asm/include/overlay_13_0238BE6C.inc +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once -.public DrawTextInWindow -.public ExitOverlay13 -.public InitPreprocessorArgs -.public PERSONALITY_TEST_PTR -.public PersonalityTestFrameUpdate -.public PreprocessStringFromId -.public sub_02027B1C -.public UpdateWindow diff --git a/asm/include/overlay_13_0238C010.inc b/asm/include/overlay_13_0238C010.inc new file mode 100644 index 00000000..7a0cfa4e --- /dev/null +++ b/asm/include/overlay_13_0238C010.inc @@ -0,0 +1,3 @@ +#pragma once +.public ExitOverlay13 +.public PersonalityTestFrameUpdate diff --git a/asm/overlay_13_0238BE6C.s b/asm/overlay_13_0238C010.s similarity index 91% rename from asm/overlay_13_0238BE6C.s rename to asm/overlay_13_0238C010.s index 3a01f227..054b12a4 100644 --- a/asm/overlay_13_0238BE6C.s +++ b/asm/overlay_13_0238C010.s @@ -1,135 +1,7 @@ .include "asm/macros.inc" - .include "overlay_13_0238BE6C.inc" + .include "overlay_13_0238C010.inc" .text - - arm_func_start DrawPersonalityTestDebug -DrawPersonalityTestDebug: ; 0x0238BE6C - stmdb sp!, {r4, r5, lr} - sub sp, sp, #0x54 - sub sp, sp, #0x400 - mov r4, r0 - add r0, sp, #4 - bl InitPreprocessorArgs - mov r0, r4 - bl sub_02027B1C - ldr r0, _0238BFFC ; =PERSONALITY_TEST_PTR - ldr r2, _0238C000 ; =0x000006CA - ldr lr, [r0] - add r5, sp, #4 - ldrb r3, [lr, #0x34] - add r0, sp, #0x54 - mov r1, #0x400 - str r3, [sp, #0x28] - ldrb ip, [lr, #0x35] - ldr r3, _0238C004 ; =0x0000C402 - str ip, [sp, #0x2c] - ldrb ip, [lr, #0x36] - str ip, [sp, #0x30] - ldrb ip, [lr, #0x37] - str ip, [sp, #0x34] - str r5, [sp] - bl PreprocessStringFromId - mov r0, r4 - mov r1, #4 - mov r2, #0 - add r3, sp, #0x54 - bl DrawTextInWindow - ldr r0, _0238BFFC ; =PERSONALITY_TEST_PTR - ldr r2, _0238C008 ; =0x000006CB - ldr lr, [r0] - add r0, sp, #0x54 - ldrb r3, [lr, #0x38] - mov r1, #0x400 - str r3, [sp, #0x28] - ldrb ip, [lr, #0x39] - ldr r3, _0238C004 ; =0x0000C402 - str ip, [sp, #0x2c] - ldrb ip, [lr, #0x3a] - str ip, [sp, #0x30] - ldrb ip, [lr, #0x3b] - str ip, [sp, #0x34] - str r5, [sp] - bl PreprocessStringFromId - mov r0, r4 - mov r1, #4 - mov r2, #0xc - add r3, sp, #0x54 - bl DrawTextInWindow -#ifdef JAPAN - ldr r0, _0238BFFC ; =PERSONALITY_TEST_PTR - mov ip, r5 - ldr r5, [r0] - ldr r2, _0238D570 ; =0x000031C8 - ldrb r3, [r5, #0x3c] - add r0, sp, #0x54 - mov r1, #0x400 -#else - mov r1, #0x400 - ldr r0, _0238BFFC ; =PERSONALITY_TEST_PTR - mov ip, r5 - ldr r5, [r0] - add r0, sp, #0x54 - ldrb r3, [r5, #0x3c] - add r2, r1, #0x2cc -#endif - str r3, [sp, #0x28] - ldrb lr, [r5, #0x3d] - ldr r3, _0238C004 ; =0x0000C402 - str lr, [sp, #0x2c] - ldrb lr, [r5, #0x3e] - str lr, [sp, #0x30] - ldrb lr, [r5, #0x3f] - str lr, [sp, #0x34] - str ip, [sp] - bl PreprocessStringFromId - mov r0, r4 - mov r1, #4 - mov r2, #0x18 - add r3, sp, #0x54 - bl DrawTextInWindow - ldr r0, _0238BFFC ; =PERSONALITY_TEST_PTR - ldr r3, _0238C004 ; =0x0000C402 - ldr r2, [r0] - add ip, sp, #4 - ldrb r0, [r2, #0x40] - str r0, [sp, #0x28] - ldrb r0, [r2, #0x41] - str r0, [sp, #0x2c] - ldrb r1, [r2, #0x42] - add r0, sp, #0x54 - str r1, [sp, #0x30] - ldrb r1, [r2, #0x43] - ldr r2, _0238C00C ; =0x000006CD - str r1, [sp, #0x34] - mov r1, #0x400 - str ip, [sp] - bl PreprocessStringFromId - add r3, sp, #0x54 - mov r0, r4 - mov r1, #4 - mov r2, #0x24 - bl DrawTextInWindow - mov r0, r4 - bl UpdateWindow - add sp, sp, #0x54 - add sp, sp, #0x400 - ldmia sp!, {r4, r5, pc} - .align 2, 0 -#ifdef JAPAN -#define OV13_0238BE6C_OFFSET 0x2AFC -#else -#define OV13_0238BE6C_OFFSET 0 -#endif -_0238BFFC: .word PERSONALITY_TEST_PTR -_0238C000: .word 0x000006CA + OV13_0238BE6C_OFFSET -_0238C004: .word 0x0000C402 -_0238C008: .word 0x000006CB + OV13_0238BE6C_OFFSET -#ifdef JAPAN -_0238D570: .word 0x000031C8 -#endif -_0238C00C: .word 0x000006CD + OV13_0238BE6C_OFFSET - arm_func_end DrawPersonalityTestDebug ; 0x0238C010 .rodata diff --git a/include/overlay_13_0238BDA8.h b/include/overlay_13_0238BDA8.h index 7881032e..643a81ae 100644 --- a/include/overlay_13_0238BDA8.h +++ b/include/overlay_13_0238BDA8.h @@ -122,5 +122,6 @@ struct personality_test s32 GetPersonality(void); char* GetPartnerOptionString(char* output, s32 option_id); void WaitForNextStep(enum personality_test_state state); +void DrawPersonalityTestDebug(s8 window_id); #endif //PMDSKY_OVERLAY_13_0238BDA8_H diff --git a/main.lsf b/main.lsf index 86109c51..a60c43ac 100644 --- a/main.lsf +++ b/main.lsf @@ -438,7 +438,7 @@ Overlay OVY_13 Object src/overlay_13_EntryOverlay13.o Object asm/overlay_13.o Object src/overlay_13_0238BDA8.o - Object asm/overlay_13_0238BE6C.o + Object asm/overlay_13_0238C010.o } Overlay OVY_14 { diff --git a/src/overlay_13_0238BDA8.c b/src/overlay_13_0238BDA8.c index fd24d444..d9759bc5 100644 --- a/src/overlay_13_0238BDA8.c +++ b/src/overlay_13_0238BDA8.c @@ -4,6 +4,11 @@ extern struct personality_test *PERSONALITY_TEST_PTR; extern int PreprocessString(char *output,int output_size,char *format,u16 flags,struct preprocessor_args *args); extern char ov13_0238CE70[32]; // "[gender:0][CLUM_SET:28][kind:0]" +extern void DrawTextInWindow(s8 window_id,s32 x,s32 y,char *string); +extern void InitPreprocessorArgs(struct preprocessor_args* args); +extern int PreprocessStringFromId(char *output,s32 output_size,s32 string_id,s32 flags,struct preprocessor_args *args); +extern void UpdateWindow(s8 window_id); +extern void sub_02027B1C(s8 window_id); // this is "ClearAndUpdateWindow" in my (Chesyon's) notes, but I haven't submitted it to pmdsky-debug yet. s32 GetPersonality(void) { s32 i; @@ -36,3 +41,48 @@ void WaitForNextStep(enum personality_test_state state) { PERSONALITY_TEST_PTR->state = QUIZ_WAIT_NEXT_STEP; PERSONALITY_TEST_PTR->future_state = state; } + +#ifdef JAPAN + #define DIAGNOSIS_DEBUG_STRING_1 0x31C6 + #define DIAGNOSIS_DEBUG_STRING_2 0x31C7 + #define DIAGNOSIS_DEBUG_STRING_3 0x31C8 + #define DIAGNOSIS_DEBUG_STRING_4 0x31C9 +#else + #define DIAGNOSIS_DEBUG_STRING_1 0x6CA + #define DIAGNOSIS_DEBUG_STRING_2 0x6CB + #define DIAGNOSIS_DEBUG_STRING_3 0x6CC + #define DIAGNOSIS_DEBUG_STRING_4 0x6CD +#endif + +void DrawPersonalityTestDebug(s8 window_id) { + char buf[1024]; + struct preprocessor_args args; + + InitPreprocessorArgs(&args); + sub_02027B1C(window_id); + args.number_vals[0] = PERSONALITY_TEST_PTR->personality_points[0]; + args.number_vals[1] = PERSONALITY_TEST_PTR->personality_points[1]; + args.number_vals[2] = PERSONALITY_TEST_PTR->personality_points[2]; + args.number_vals[3] = PERSONALITY_TEST_PTR->personality_points[3]; + PreprocessStringFromId((char*)&buf, sizeof(buf), DIAGNOSIS_DEBUG_STRING_1, 0xC402, &args); + DrawTextInWindow(window_id, 4, 0, (char*)&buf); + args.number_vals[0] = PERSONALITY_TEST_PTR->personality_points[4]; + args.number_vals[1] = PERSONALITY_TEST_PTR->personality_points[5]; + args.number_vals[2] = PERSONALITY_TEST_PTR->personality_points[6]; + args.number_vals[3] = PERSONALITY_TEST_PTR->personality_points[7]; + PreprocessStringFromId((char*)&buf, sizeof(buf), DIAGNOSIS_DEBUG_STRING_2, 0xC402, &args); + DrawTextInWindow(window_id, 4, 0xC, (char*)&buf); + args.number_vals[0] = PERSONALITY_TEST_PTR->personality_points[8]; + args.number_vals[1] = PERSONALITY_TEST_PTR->personality_points[9]; + args.number_vals[2] = PERSONALITY_TEST_PTR->personality_points[10]; + args.number_vals[3] = PERSONALITY_TEST_PTR->personality_points[11]; + PreprocessStringFromId((char*)&buf, sizeof(buf), DIAGNOSIS_DEBUG_STRING_3, 0xC402, &args); + DrawTextInWindow(window_id, 4, 0x18, (char*)&buf); + args.number_vals[0] = PERSONALITY_TEST_PTR->personality_points[12]; + args.number_vals[1] = PERSONALITY_TEST_PTR->personality_points[13]; + args.number_vals[2] = PERSONALITY_TEST_PTR->personality_points[14]; + args.number_vals[3] = PERSONALITY_TEST_PTR->personality_points[15]; + PreprocessStringFromId((char*)&buf, sizeof(buf), DIAGNOSIS_DEBUG_STRING_4, 0xC402, &args); + DrawTextInWindow(window_id, 4, 0x24, (char*)&buf); + UpdateWindow(window_id); +}