From a3b4e07042ac4edef087694dbec353e27d39021e Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 8 Oct 2024 20:20:45 -0400 Subject: [PATCH 01/25] NamingScreenApp_Init --- asm/include/overlay_12_battle_command.inc | 2 +- asm/include/overlay_14.inc | 2 +- asm/include/overlay_43.inc | 2 +- asm/include/overlay_80_0222BDF4.inc | 2 +- asm/include/unk_02082908.inc | 2 +- asm/include/unk_020910D8.inc | 2 +- asm/include/unk_020912AC.inc | 2 +- asm/include/unk_02091564.inc | 2 +- asm/overlay_12_battle_command.s | 4 +- asm/overlay_14.s | 4 +- asm/overlay_43.s | 6 +- asm/overlay_80_0222BDF4.s | 4 +- asm/unk_02082908.s | 228 +--------------------- asm/unk_020910D8.s | 6 +- asm/unk_020912AC.s | 2 +- asm/unk_02091564.s | 2 +- include/heap.h | 1 + include/unk_02082908.h | 2 +- main.lsf | 1 + src/launch_application.c | 2 +- src/naming_screen.c | 117 +++++++++++ src/oaks_speech.c | 2 +- 22 files changed, 154 insertions(+), 243 deletions(-) create mode 100644 src/naming_screen.c diff --git a/asm/include/overlay_12_battle_command.inc b/asm/include/overlay_12_battle_command.inc index 3480961ef7..6db859e4ea 100644 --- a/asm/include/overlay_12_battle_command.inc +++ b/asm/include/overlay_12_battle_command.inc @@ -104,7 +104,7 @@ .public _s32_div_f .public _u32_div_f .public gGameLanguage -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public gSystem .public ov07_02232F58 .public ov07_02232F60 diff --git a/asm/include/overlay_14.inc b/asm/include/overlay_14.inc index 9680178eb3..6c4614ad23 100644 --- a/asm/include/overlay_14.inc +++ b/asm/include/overlay_14.inc @@ -292,7 +292,7 @@ .public _fsub .public _s32_div_f .public _u32_div_f -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public gOverlayTemplate_PokemonSummary .public gSystem .public PCBox_Init diff --git a/asm/include/overlay_43.inc b/asm/include/overlay_43.inc index 4fd2409020..88d88adf45 100644 --- a/asm/include/overlay_43.inc +++ b/asm/include/overlay_43.inc @@ -192,7 +192,7 @@ .public _ull_mod .public _s32_div_f .public _u32_div_f -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public _02102620 .public gSystem .public ov42_02227060 diff --git a/asm/include/overlay_80_0222BDF4.inc b/asm/include/overlay_80_0222BDF4.inc index 8e1c7dd341..83d8e3fa53 100644 --- a/asm/include/overlay_80_0222BDF4.inc +++ b/asm/include/overlay_80_0222BDF4.inc @@ -180,7 +180,7 @@ .public _s32_div_f .public _u32_div_f .public gOverlayTemplate_Battle -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public gSystem .public ov00_021E6EBC .public _0223DC20 diff --git a/asm/include/unk_02082908.inc b/asm/include/unk_02082908.inc index b6542cbda0..4946a5f06e 100644 --- a/asm/include/unk_02082908.inc +++ b/asm/include/unk_02082908.inc @@ -144,6 +144,6 @@ .public _s32_div_f .public gOverlayTemplate_Battle .public gNatureStatMods -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public gSystem .public OS_IRQTable diff --git a/asm/include/unk_020910D8.inc b/asm/include/unk_020910D8.inc index 6803a854ce..4869867a16 100644 --- a/asm/include/unk_020910D8.inc +++ b/asm/include/unk_020910D8.inc @@ -21,7 +21,7 @@ .public MonSetTrainerMemo .public CallTask_HatchEggInParty .public sub_02093134 -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public ov95_021E6D70 .public ov95_021E6E88 .public ov95_021E6F0C diff --git a/asm/include/unk_020912AC.inc b/asm/include/unk_020912AC.inc index 84815540ff..67aaae13b9 100644 --- a/asm/include/unk_020912AC.inc +++ b/asm/include/unk_020912AC.inc @@ -5,4 +5,4 @@ .public sub_020912AC .public sub_020912D0 .public _u32_div_f -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen diff --git a/asm/include/unk_02091564.inc b/asm/include/unk_02091564.inc index c8af9ef687..f13c0c0ffc 100644 --- a/asm/include/unk_02091564.inc +++ b/asm/include/unk_02091564.inc @@ -37,7 +37,7 @@ .public sub_02091598 .public sub_020915A0 .public sub_020915A4 -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public gApplication_OakSpeech .public OakSpeech_Init .public OakSpeech_Main diff --git a/asm/overlay_12_battle_command.s b/asm/overlay_12_battle_command.s index 4799c4eb0a..fb54218b54 100644 --- a/asm/overlay_12_battle_command.s +++ b/asm/overlay_12_battle_command.s @@ -1187,7 +1187,7 @@ _02246DB0: mov r2, #0 bl GetMonData str r0, [r5, #0x10] - ldr r0, _0224706C ; =sOverlayTemplate_NamingScreen + ldr r0, _0224706C ; =gOverlayTemplate_NamingScreen add r1, r5, #0 mov r2, #5 bl OverlayManager_New @@ -1484,7 +1484,7 @@ _0224702E: _02247060: .word 0x0000FFFF _02247064: .word 0x0000219C _02247068: .word 0x00000496 -_0224706C: .word sOverlayTemplate_NamingScreen +_0224706C: .word gOverlayTemplate_NamingScreen _02247070: .word 0x00000498 _02247074: add r0, r5, #0 diff --git a/asm/overlay_14.s b/asm/overlay_14.s index db7de131d1..166be02705 100644 --- a/asm/overlay_14.s +++ b/asm/overlay_14.s @@ -6717,7 +6717,7 @@ ov14_021E8B3C: ; 0x021E8B3C ldr r0, [r4, #4] ldr r2, [r2, #0x18] bl PCStorage_GetBoxName - ldr r0, _021E8B7C ; =sOverlayTemplate_NamingScreen + ldr r0, _021E8B7C ; =gOverlayTemplate_NamingScreen ldr r1, [r4, #0x18] mov r2, #9 bl OverlayManager_New @@ -6726,7 +6726,7 @@ ov14_021E8B3C: ; 0x021E8B3C add sp, #8 pop {r4, pc} .balign 4, 0 -_021E8B7C: .word sOverlayTemplate_NamingScreen +_021E8B7C: .word gOverlayTemplate_NamingScreen thumb_func_end ov14_021E8B3C thumb_func_start ov14_021E8B80 diff --git a/asm/overlay_43.s b/asm/overlay_43.s index 6302fa043a..0e630dc7ec 100644 --- a/asm/overlay_43.s +++ b/asm/overlay_43.s @@ -5792,7 +5792,7 @@ _0222CBE2: str r0, [r4, #8] add r0, r7, #0 bl ov43_0222A1DC - ldr r0, _0222CD2C ; =sOverlayTemplate_NamingScreen + ldr r0, _0222CD2C ; =gOverlayTemplate_NamingScreen ldr r1, [r4, #4] add r2, r6, #0 bl OverlayManager_New @@ -5865,7 +5865,7 @@ _0222CCAC: str r0, [r4, #4] add r0, r7, #0 bl ov43_0222A1DC - ldr r0, _0222CD2C ; =sOverlayTemplate_NamingScreen + ldr r0, _0222CD2C ; =gOverlayTemplate_NamingScreen ldr r1, [r4, #4] add r2, r6, #0 bl OverlayManager_New @@ -5918,7 +5918,7 @@ _0222CD26: add sp, #0x18 pop {r3, r4, r5, r6, r7, pc} .balign 4, 0 -_0222CD2C: .word sOverlayTemplate_NamingScreen +_0222CD2C: .word gOverlayTemplate_NamingScreen _0222CD30: .word _02102620 thumb_func_end ov43_0222CBB4 diff --git a/asm/overlay_80_0222BDF4.s b/asm/overlay_80_0222BDF4.s index b7e9684cc1..6cc0183908 100644 --- a/asm/overlay_80_0222BDF4.s +++ b/asm/overlay_80_0222BDF4.s @@ -1829,7 +1829,7 @@ FrtCmd_052: ; 0x0222CB54 bl NamingScreen_CreateArgs add r2, r0, #0 ldr r0, _0222CB8C ; =ov80_0222CB94 - ldr r1, _0222CB90 ; =sOverlayTemplate_NamingScreen + ldr r1, _0222CB90 ; =gOverlayTemplate_NamingScreen str r0, [sp] ldr r0, [r4] mov r3, #0 @@ -1840,7 +1840,7 @@ FrtCmd_052: ; 0x0222CB54 pop {r4, pc} .balign 4, 0 _0222CB8C: .word ov80_0222CB94 -_0222CB90: .word sOverlayTemplate_NamingScreen +_0222CB90: .word gOverlayTemplate_NamingScreen thumb_func_end FrtCmd_052 thumb_func_start ov80_0222CB94 diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index e3fba8a718..10036f4af4 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -10,6 +10,7 @@ .public gOverlayTemplate_Battle .public gNatureStatMods + .extern NamingScreenApp_Init .bss @@ -18,213 +19,6 @@ _021D43B0: .text - thumb_func_start sub_02082908 -sub_02082908: ; 0x02082908 - push {r4, r5, r6, r7, lr} - sub sp, #0xc - add r5, r1, #0 - ldr r1, [r5] - add r6, r0, #0 - cmp r1, #0 - beq _0208291E - cmp r1, #1 - bne _0208291C - b _02082A88 -_0208291C: - b _02082AC2 -_0208291E: - mov r0, #0 - add r1, r0, #0 - bl Main_SetVBlankIntrCB - bl HBlankInterruptDisable - bl GfGfx_DisableEngineAPlanes - bl GfGfx_DisableEngineBPlanes - mov r2, #1 - lsl r2, r2, #0x1a - ldr r1, [r2] - ldr r0, _02082AC8 ; =0xFFFFE0FF - and r1, r0 - str r1, [r2] - ldr r2, _02082ACC ; =0x04001000 - ldr r1, [r2] - and r0, r1 - str r0, [r2] - mov r2, #0xa - mov r0, #3 - mov r1, #0x12 - lsl r2, r2, #0xe - bl CreateHeap - ldr r1, _02082AD0 ; =0x000005D4 - add r0, r6, #0 - mov r2, #0x12 - bl OverlayManager_CreateAndGetData - ldr r2, _02082AD0 ; =0x000005D4 - mov r1, #0 - add r4, r0, #0 - bl memset - mov r0, #0x12 - bl BgConfig_Alloc - mov r1, #0x16 - lsl r1, r1, #4 - str r0, [r4, r1] - mov r0, #0x1f - mov r1, #0x12 - bl NARC_New - add r7, r0, #0 - mov r0, #0x12 - bl MessageFormat_New - mov r1, #0x5a - lsl r1, r1, #2 - str r0, [r4, r1] - mov r0, #0 - mov r1, #0x1b - mov r2, #0xf9 - mov r3, #0x12 - bl NewMsgDataFromNarc - mov r1, #0x5b - lsl r1, r1, #2 - str r0, [r4, r1] - mov r0, #1 - mov r1, #0x1b - mov r2, #0xfe - mov r3, #0x12 - bl NewMsgDataFromNarc - mov r1, #0x17 - lsl r1, r1, #4 - str r0, [r4, r1] - mov r0, #1 - mov r1, #0x1b - mov r2, #0xc5 - mov r3, #0x12 - bl NewMsgDataFromNarc - mov r1, #0x5d - lsl r1, r1, #2 - str r0, [r4, r1] - mov r0, #4 - mov r1, #8 - bl SetKeyRepeatTimers - bl sub_02083184 - mov r0, #0x16 - lsl r0, r0, #4 - ldr r0, [r4, r0] - bl sub_020831A4 - add r0, r6, #0 - bl OverlayManager_GetArgs - add r1, r0, #0 - add r0, r4, #0 - bl sub_02083160 - add r0, r4, #0 - add r1, r7, #0 - bl sub_02083654 - mov r0, #2 - mov r1, #0x12 - bl FontID_Alloc - ldr r0, _02082AD4 ; =sub_02083140 - mov r1, #0 - bl Main_SetVBlankIntrCB - add r0, r4, #0 - add r1, r6, #0 - bl sub_02083334 - mov r0, #0 - mov r1, #0x12 - bl FontID_SetAccessDirect - bl sub_0208377C - add r0, r4, #0 - add r1, r7, #0 - bl sub_020837AC - add r0, r4, #0 - bl sub_020839EC - add r0, r4, #0 - add r1, r6, #0 - add r2, r7, #0 - bl sub_02083F9C - ldr r0, _02082AD8 ; =0x000004C4 - mov r3, #0x5f - add r1, r4, r0 - lsl r3, r3, #2 - str r1, [sp] - ldr r1, [r4, r3] - add r2, r3, #0 - str r1, [sp, #4] - sub r2, #0x24 - sub r0, #0xcc - add r1, r4, #0 - sub r3, #0x22 - ldrh r2, [r4, r2] - add r0, r4, r0 - add r1, #0xd8 - add r3, r4, r3 - bl sub_02084740 - mov r1, #0 - mov r0, #0x34 - add r2, r1, #0 - bl sub_02004EC4 - mov r0, #0x10 - str r0, [sp] - mov r1, #1 - str r1, [sp, #4] - mov r0, #0x12 - str r0, [sp, #8] - mov r0, #0 - add r2, r1, #0 - add r3, r0, #0 - bl BeginNormalPaletteFade - mov r0, #1 - bl sub_020832E4 - ldr r0, _02082ADC ; =gSystem + 0x60 - mov r1, #1 - strb r1, [r0, #9] - bl GfGfx_SwapDisplay - add r0, r7, #0 - bl NARC_Delete - ldr r0, [r5] - add r0, r0, #1 - str r0, [r5] - b _02082AC2 -_02082A88: - bl OverlayManager_GetData - add r4, r0, #0 - ldr r0, [r4] - cmp r0, #1 - bne _02082AA4 - ldr r1, _02082AE0 ; =0x000004B8 - ldr r2, [r4, #4] - ldr r0, [r4, r1] - add r1, #8 - ldr r1, [r4, r1] - ldr r3, [r4, #8] - bl sub_02082AEC -_02082AA4: - ldr r0, _02082AE4 ; =_021D43B0 - mov r1, #1 - str r4, [r0] - mov r0, #0 - mov r2, #0xc - mov r3, #0x12 - bl sub_020163E0 - ldr r1, _02082AE8 ; =0x000005C4 - add sp, #0xc - str r0, [r4, r1] - mov r0, #0 - str r0, [r5] - mov r0, #1 - pop {r4, r5, r6, r7, pc} -_02082AC2: - mov r0, #0 - add sp, #0xc - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_02082AC8: .word 0xFFFFE0FF -_02082ACC: .word 0x04001000 -_02082AD0: .word 0x000005D4 -_02082AD4: .word sub_02083140 -_02082AD8: .word 0x000004C4 -_02082ADC: .word gSystem + 0x60 -_02082AE0: .word 0x000004B8 -_02082AE4: .word _021D43B0 -_02082AE8: .word 0x000005C4 - thumb_func_end sub_02082908 - thumb_func_start sub_02082AEC sub_02082AEC: ; 0x02082AEC push {r4, r5, r6, lr} @@ -251,8 +45,8 @@ sub_02082AEC: ; 0x02082AEC _02082B1C: .word 0x000057E0 thumb_func_end sub_02082AEC - thumb_func_start sub_02082B20 -sub_02082B20: ; 0x02082B20 + thumb_func_start NamingScreenApp_Main +NamingScreenApp_Main: ; 0x02082B20 push {r4, r5, r6, lr} sub sp, #0x10 add r5, r1, #0 @@ -479,7 +273,7 @@ _02082CE8: .word 0x00000458 _02082CEC: .word 0x000005E2 _02082CF0: .word 0x000004A8 _02082CF4: .word 0x00000464 - thumb_func_end sub_02082B20 + thumb_func_end NamingScreenApp_Main thumb_func_start sub_02082CF8 sub_02082CF8: ; 0x02082CF8 @@ -736,8 +530,8 @@ _02082EE0: .word 0x000001DE _02082EE4: .word 0x0000FFFF thumb_func_end sub_02082EC0 - thumb_func_start sub_02082EE8 -sub_02082EE8: ; 0x02082EE8 + thumb_func_start NamingScreenApp_Exit +NamingScreenApp_Exit: ; 0x02082EE8 push {r4, r5, r6, r7, lr} sub sp, #0x14 str r0, [sp, #0x10] @@ -949,7 +743,7 @@ _020830C8: .word 0x000004B4 _020830CC: .word 0x000004BC _020830D0: .word 0xFFFF1FFF _020830D4: .word gSystem + 0x60 - thumb_func_end sub_02082EE8 + thumb_func_end NamingScreenApp_Exit thumb_func_start NamingScreen_CreateArgs NamingScreen_CreateArgs: ; 0x020830D8 @@ -5476,12 +5270,10 @@ _02102422: .short 0x0089, 0x008A, 0x008B .short 0x008C, 0x008D, 0x008E - ; File boundary - .balign 4, 0 - .public sOverlayTemplate_NamingScreen -sOverlayTemplate_NamingScreen: - .word sub_02082908, sub_02082B20, sub_02082EE8, 0xFFFFFFFF + .public gOverlayTemplate_NamingScreen +gOverlayTemplate_NamingScreen: + .word NamingScreenApp_Init, NamingScreenApp_Main, NamingScreenApp_Exit, 0xFFFFFFFF .data diff --git a/asm/unk_020910D8.s b/asm/unk_020910D8.s index 67c8731373..e895697797 100644 --- a/asm/unk_020910D8.s +++ b/asm/unk_020910D8.s @@ -8,7 +8,7 @@ .include "unk_020910D8.inc" .include "global.inc" - .public sOverlayTemplate_NamingScreen + .public gOverlayTemplate_NamingScreen .text @@ -136,7 +136,7 @@ _0209119A: bl GetMonData ldr r1, [r4, #8] str r0, [r1, #8] - ldr r1, _0209123C ; =sOverlayTemplate_NamingScreen + ldr r1, _0209123C ; =gOverlayTemplate_NamingScreen ldr r2, [r4, #8] add r0, r5, #0 bl CallApplicationAsTask @@ -178,7 +178,7 @@ _02091232: pop {r3, r4, r5, r6, r7, pc} .balign 4, 0 _02091238: .word _02106048 -_0209123C: .word sOverlayTemplate_NamingScreen +_0209123C: .word gOverlayTemplate_NamingScreen thumb_func_end Task_HatchEggInParty thumb_func_start CallTask_HatchEggInParty diff --git a/asm/unk_020912AC.s b/asm/unk_020912AC.s index 9d17083d9e..b327eb4f05 100644 --- a/asm/unk_020912AC.s +++ b/asm/unk_020912AC.s @@ -7,7 +7,7 @@ .include "unk_020912AC.inc" .include "global.inc" - .public sOverlayTemplate_NamingScreen + .public gOverlayTemplate_NamingScreen .text diff --git a/asm/unk_02091564.s b/asm/unk_02091564.s index e5cfa1ee83..759c147b6a 100644 --- a/asm/unk_02091564.s +++ b/asm/unk_02091564.s @@ -7,7 +7,7 @@ .include "unk_02091564.inc" .include "global.inc" - .public sOverlayTemplate_NamingScreen + .public gOverlayTemplate_NamingScreen .text diff --git a/include/heap.h b/include/heap.h index 3a02d0628d..1e3fb71b5c 100644 --- a/include/heap.h +++ b/include/heap.h @@ -17,6 +17,7 @@ typedef enum HeapID { HEAP_ID_10, HEAP_ID_FIELD, HEAP_ID_PARTY_MENU, + HEAP_ID_NAMING_SCREEN = 18, HEAP_ID_20 = 20, HEAP_ID_26 = 26, HEAP_ID_TITLE_SCREEN = 30, diff --git a/include/unk_02082908.h b/include/unk_02082908.h index 77d369c1fc..0ead420fed 100644 --- a/include/unk_02082908.h +++ b/include/unk_02082908.h @@ -5,7 +5,7 @@ #include "overlay_manager.h" #include "pm_string.h" -extern const OVY_MGR_TEMPLATE sOverlayTemplate_NamingScreen; +extern const OVY_MGR_TEMPLATE gOverlayTemplate_NamingScreen; typedef struct NamingScreenArgs { int kind; diff --git a/main.lsf b/main.lsf index 58499ce224..bebae75dfb 100644 --- a/main.lsf +++ b/main.lsf @@ -273,6 +273,7 @@ Static main Object src/party_menu_sprites.o Object src/party_menu_list_items.o Object src/party_menu_items.o + Object src/naming_screen.o Object asm/unk_02082908.o Object asm/unk_020850F4.o Object asm/unk_02085604.o diff --git a/src/launch_application.c b/src/launch_application.c index c0aede6ab9..0a2e1f30cd 100644 --- a/src/launch_application.c +++ b/src/launch_application.c @@ -1036,7 +1036,7 @@ static BOOL Task_NamingScreen(TaskManager *taskman) { data->state++; break; case 1: - CallApplicationAsTask(taskman, &sOverlayTemplate_NamingScreen, data->args); + CallApplicationAsTask(taskman, &gOverlayTemplate_NamingScreen, data->args); data->state++; break; case 2: diff --git a/src/naming_screen.c b/src/naming_screen.c new file mode 100644 index 0000000000..4ffc10f938 --- /dev/null +++ b/src/naming_screen.c @@ -0,0 +1,117 @@ +#include "global.h" + +#include "msgdata/msg.naix" + +#include "bg_window.h" +#include "filesystem.h" +#include "font.h" +#include "gf_gfx_planes.h" +#include "launch_application.h" +#include "message_format.h" +#include "msgdata.h" +#include "sound_02004A44.h" +#include "system.h" +#include "unk_0200FA24.h" +#include "unk_020163E0.h" +#include "unk_02082908.h" + +typedef struct NamingScreenAppData { + int unk_000; + int unk_004; + int unk_008; + u8 filler_00C[0xCC]; + u16 unk_0D8[0x40]; + u16 unk_158; + u16 unk_15A; + u8 filler_15C[0x4]; + BgConfig *bgConfig; // 0x160 + u8 filler_164[4]; + MessageFormat *msgFormat; // 0x168 + MsgData *msgData; // 0x16C + MsgData *msgData2; // 0x170 + MsgData *msgData3; // 0x174 + u8 filler_178[0x4]; + int unk_17C; + u8 unk_180[0x278]; + u8 unk_3F8[0xC0]; + NNSG2dCharacterData *unk_4B8; + u8 filler_4BC[0x4]; + NNSG2dPaletteData *unk_4C0; + u8 unk_4C4[0x100]; + UnkStruct_020163E0 *unk_5C4; + u8 filler_5C8[0xC]; +} NamingScreenAppData; // size: 0x5D4 + +BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); +void sub_02083184(void); +void sub_020831A4(BgConfig *bgConfig); +void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args); +void sub_02083654(NamingScreenAppData *data, NARC *narc); +void sub_02083140(void *param); +void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +void sub_0208377C(void); +void sub_020837AC(NamingScreenAppData *data, NARC *narc); +void sub_020839EC(NamingScreenAppData *data); +void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); +void sub_02084740(void *a0, u16 *a1, u16 a2, void *a3, void *a4, int a5); +void sub_020832E4(int a0); +void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); + +static NamingScreenAppData *_021D43B0; + +BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { + NamingScreenAppData *data; + NARC *narc; + switch (*pState) { + case 0: + Main_SetVBlankIntrCB(NULL, NULL); + HBlankInterruptDisable(); + GfGfx_DisableEngineAPlanes(); + GfGfx_DisableEngineBPlanes(); + GX_SetVisiblePlane(0); + GXS_SetVisiblePlane(0); + CreateHeap(HEAP_ID_3, HEAP_ID_NAMING_SCREEN, 0x28000); + + data = OverlayManager_CreateAndGetData(ovyMan, sizeof(NamingScreenAppData), HEAP_ID_NAMING_SCREEN); + memset(data, 0, sizeof(NamingScreenAppData)); + data->bgConfig = BgConfig_Alloc(HEAP_ID_NAMING_SCREEN); + narc = NARC_New(NARC_a_0_3_1, HEAP_ID_NAMING_SCREEN); + data->msgFormat = MessageFormat_New(HEAP_ID_NAMING_SCREEN); + data->msgData = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_msgdata_msg, NARC_msg_msg_0249_bin, HEAP_ID_NAMING_SCREEN); + data->msgData2 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0254_bin, HEAP_ID_NAMING_SCREEN); + data->msgData3 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0197_bin, HEAP_ID_NAMING_SCREEN); + SetKeyRepeatTimers(4, 8); + sub_02083184(); + sub_020831A4(data->bgConfig); + sub_02083160(data, OverlayManager_GetArgs(ovyMan)); + sub_02083654(data, narc); + FontID_Alloc(2, HEAP_ID_NAMING_SCREEN); + Main_SetVBlankIntrCB(sub_02083140, NULL); + sub_02083334(data, ovyMan); + FontID_SetAccessDirect(0, HEAP_ID_NAMING_SCREEN); + sub_0208377C(); + sub_020837AC(data, narc); + sub_020839EC(data); + sub_02083F9C(data, ovyMan, narc); + sub_02084740(data->unk_3F8, data->unk_0D8, data->unk_158, &data->unk_15A, data->unk_4C4, data->unk_17C); + sub_02004EC4(0x34, 0, 0); + BeginNormalPaletteFade(0, 1, 1, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); + sub_020832E4(1); + gSystem.screensFlipped = TRUE; + GfGfx_SwapDisplay(); + NARC_Delete(narc); + ++(*pState); + break; + case 1: + data = OverlayManager_GetData(ovyMan); + if (data->unk_000 == NAME_SCREEN_POKEMON) { + sub_02082AEC(data->unk_4B8, data->unk_4C0, data->unk_004, data->unk_008); + } + _021D43B0 = data; + data->unk_5C4 = sub_020163E0(NULL, PM_LCD_BOTTOM, 12, HEAP_ID_NAMING_SCREEN); + *pState = 0; + return TRUE; + } + + return FALSE; +} diff --git a/src/oaks_speech.c b/src/oaks_speech.c index 8ec5fffb3e..76e32a7d37 100644 --- a/src/oaks_speech.c +++ b/src/oaks_speech.c @@ -2009,7 +2009,7 @@ static BOOL OakSpeech_DoMainTask(OakSpeechData *data) { case OAK_SPEECH_MAIN_STATE_PROMPT_NAME_LAUNCH_NAMING_SCREEN: String_SetEmpty(data->namingScreenArgs_Player->nameInputString); data->namingScreenArgs_Player->playerGender = data->playerGender; - data->overlayManager = OverlayManager_New(&sOverlayTemplate_NamingScreen, data->namingScreenArgs_Player, data->heapId); + data->overlayManager = OverlayManager_New(&gOverlayTemplate_NamingScreen, data->namingScreenArgs_Player, data->heapId); data->state = OAK_SPEECH_MAIN_STATE_PROMPT_NAME_RESTORE_GRAPHICS_AFTER; break; From a7a532fba1f71bcafc3aa93845a57988428b711b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 8 Oct 2024 22:15:15 -0400 Subject: [PATCH 02/25] through NamingScreenApp_Main --- asm/unk_02082908.s | 262 +------------------------------------------- src/naming_screen.c | 125 +++++++++++++++++++-- 2 files changed, 118 insertions(+), 269 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index 10036f4af4..67377071f3 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -11,270 +11,10 @@ .public gOverlayTemplate_Battle .public gNatureStatMods .extern NamingScreenApp_Init - - .bss - -_021D43B0: - .space 0x4 + .extern NamingScreenApp_Main .text - thumb_func_start sub_02082AEC -sub_02082AEC: ; 0x02082AEC - push {r4, r5, r6, lr} - add r4, r1, #0 - add r5, r2, #0 - mov r2, #2 - ldr r0, [r0, #0x14] - ldr r1, _02082B1C ; =0x000057E0 - add r6, r3, #0 - lsl r2, r2, #8 - bl GX_LoadOBJ - ldr r4, [r4, #0xc] - add r0, r5, #0 - add r1, r6, #0 - mov r2, #0 - bl GetMonIconPaletteEx - lsl r0, r0, #5 - add r0, r4, r0 - mov r1, #0xc0 - mov r2, #0x20 - bl GX_LoadOBJPltt - pop {r4, r5, r6, pc} - nop -_02082B1C: .word 0x000057E0 - thumb_func_end sub_02082AEC - - thumb_func_start NamingScreenApp_Main -NamingScreenApp_Main: ; 0x02082B20 - push {r4, r5, r6, lr} - sub sp, #0x10 - add r5, r1, #0 - add r6, r0, #0 - bl OverlayManager_GetData - ldr r1, [r5] - add r4, r0, #0 - cmp r1, #3 - bhi _02082B84 - add r2, r1, r1 - add r2, pc - ldrh r2, [r2, #6] - lsl r2, r2, #0x10 - asr r2, r2, #0x10 - add pc, r2 -_02082B40: ; jump table - .short _02082B48 - _02082B40 - 2 ; case 0 - .short _02082B5C - _02082B40 - 2 ; case 1 - .short _02082B90 - _02082B40 - 2 ; case 2 - .short _02082CBE - _02082B40 - 2 ; case 3 -_02082B48: - bl IsPaletteFadeFinished - cmp r0, #0 - beq _02082B84 - mov r0, #1 - str r0, [r5] - ldr r0, _02082CDC ; =0x000005CC - mov r1, #0 - str r1, [r4, r0] - b _02082CCC -_02082B5C: - ldr r1, _02082CDC ; =0x000005CC - ldr r2, [r4, r1] - add r2, r2, #1 - str r2, [r4, r1] - bl sub_02084FCC - mov r2, #0x49 - lsl r2, r2, #4 - add r0, r4, r2 - mov r1, #0xcb - sub r2, #0x30 - lsl r1, r1, #2 - ldr r2, [r4, r2] - add r1, r4, r1 - bl sub_02084F3C - ldr r0, _02082CDC ; =0x000005CC - ldr r1, [r4, r0] - cmp r1, #5 - bgt _02082B86 -_02082B84: - b _02082CCC -_02082B86: - mov r1, #2 - str r1, [r5] - mov r1, #0 - str r1, [r4, r0] - b _02082CCC -_02082B90: - ldr r3, _02082CE0 ; =0x0000045C - ldr r2, [r4, r3] - cmp r2, #7 - bhi _02082C6A - add r2, r2, r2 - add r2, pc - ldrh r2, [r2, #6] - lsl r2, r2, #0x10 - asr r2, r2, #0x10 - add pc, r2 -_02082BA4: ; jump table - .short _02082C6A - _02082BA4 - 2 ; case 0 - .short _02082C6A - _02082BA4 - 2 ; case 1 - .short _02082C6A - _02082BA4 - 2 ; case 2 - .short _02082C6A - _02082BA4 - 2 ; case 3 - .short _02082BB4 - _02082BA4 - 2 ; case 4 - .short _02082BC8 - _02082BA4 - 2 ; case 5 - .short _02082C14 - _02082BA4 - 2 ; case 6 - .short _02082C40 - _02082BA4 - 2 ; case 7 -_02082BB4: - ldr r2, [r4, #0x34] - cmp r2, #0 - bne _02082BC0 - bl sub_02082CF8 - str r0, [r5] -_02082BC0: - add r0, r4, #0 - bl sub_02084FCC - b _02082C6A -_02082BC8: - add r1, r6, #0 - bl sub_020834FC - ldr r0, _02082CE4 ; =0x00000448 - mov r1, #0xf - add r0, r4, r0 - bl FillWindowPixelBuffer - ldr r0, _02082CE4 ; =0x00000448 - mov r2, #1 - add r0, r4, r0 - mov r1, #0 - lsl r2, r2, #8 - mov r3, #0xa - bl DrawFrameAndWindow2 - mov r3, #0 - mov r2, #6 - ldr r0, _02082CE4 ; =0x00000448 - str r3, [sp] - mov r1, #1 - str r1, [sp, #4] - str r3, [sp, #8] - lsl r2, r2, #6 - ldr r2, [r4, r2] - add r0, r4, r0 - bl AddTextPrinterParameterized - ldr r1, _02082CE8 ; =0x00000458 - str r0, [r4, r1] - sub r1, #0x10 - add r0, r4, r1 - bl CopyWindowToVram - ldr r0, _02082CE0 ; =0x0000045C - mov r1, #6 - str r1, [r4, r0] - b _02082C6A -_02082C14: - sub r0, r3, #4 - ldr r0, [r4, r0] - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - bl TextPrinterCheckActive - cmp r0, #0 - bne _02082C6A - ldr r0, _02082CEC ; =0x000005E2 - bl PlaySE - ldr r1, _02082CF0 ; =0x000004A8 - mov r2, #0 - ldr r0, [r4, r1] - add r0, r0, #1 - str r0, [r4, r1] - ldr r0, _02082CDC ; =0x000005CC - sub r1, #0x4c - str r2, [r4, r0] - mov r0, #7 - str r0, [r4, r1] - b _02082C6A -_02082C40: - ldr r0, _02082CDC ; =0x000005CC - ldr r1, [r4, r0] - add r1, r1, #1 - str r1, [r4, r0] - ldr r0, [r4, r0] - cmp r0, #0x1e - ble _02082C6A - mov r0, #0x10 - str r0, [sp] - mov r1, #0 - mov r0, #1 - str r0, [sp, #4] - mov r0, #0x12 - str r0, [sp, #8] - mov r0, #2 - add r2, r1, #0 - add r3, r1, #0 - bl BeginNormalPaletteFade - mov r0, #3 - str r0, [r5] -_02082C6A: - ldr r3, _02082CF4 ; =0x00000464 - mov r1, #0xcb - add r0, r4, r3 - str r0, [sp] - add r0, r3, #4 - add r0, r4, r0 - lsl r1, r1, #2 - str r0, [sp, #4] - add r0, r4, r1 - str r0, [sp, #8] - add r0, r3, #0 - add r0, #0x4c - ldr r0, [r4, r0] - add r2, r3, #0 - ldr r0, [r0, #0x14] - add r1, #0x8c - str r0, [sp, #0xc] - mov r0, #0x16 - lsl r0, r0, #4 - sub r3, r3, #4 - sub r2, #8 - ldr r0, [r4, r0] - ldr r3, [r4, r3] - add r1, r4, r1 - add r2, r4, r2 - bl sub_02083D34 - mov r2, #0x49 - lsl r2, r2, #4 - add r0, r4, r2 - mov r1, #0xcb - sub r2, #0x30 - lsl r1, r1, #2 - ldr r2, [r4, r2] - add r1, r4, r1 - bl sub_02084F3C - add r0, r4, #0 - add r0, #0x38 - bl sub_02084500 - b _02082CCC -_02082CBE: - bl IsPaletteFadeFinished - cmp r0, #0 - beq _02082CCC - add sp, #0x10 - mov r0, #1 - pop {r4, r5, r6, pc} -_02082CCC: - mov r0, #0x62 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl SpriteList_RenderAndAnimateSprites - mov r0, #0 - add sp, #0x10 - pop {r4, r5, r6, pc} - .balign 4, 0 -_02082CDC: .word 0x000005CC -_02082CE0: .word 0x0000045C -_02082CE4: .word 0x00000448 -_02082CE8: .word 0x00000458 -_02082CEC: .word 0x000005E2 -_02082CF0: .word 0x000004A8 -_02082CF4: .word 0x00000464 - thumb_func_end NamingScreenApp_Main - thumb_func_start sub_02082CF8 sub_02082CF8: ; 0x02082CF8 push {r3, r4, r5, lr} diff --git a/src/naming_screen.c b/src/naming_screen.c index 4ffc10f938..4fcacbc61d 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -9,8 +9,11 @@ #include "launch_application.h" #include "message_format.h" #include "msgdata.h" +#include "pokemon_icon_idx.h" #include "sound_02004A44.h" #include "system.h" +#include "text.h" +#include "unk_02005D10.h" #include "unk_0200FA24.h" #include "unk_020163E0.h" #include "unk_02082908.h" @@ -19,7 +22,9 @@ typedef struct NamingScreenAppData { int unk_000; int unk_004; int unk_008; - u8 filler_00C[0xCC]; + u8 filler_00C[0x28]; + int unk_034; + u8 unk_038[0xA0]; u16 unk_0D8[0x40]; u16 unk_158; u16 unk_15A; @@ -32,30 +37,56 @@ typedef struct NamingScreenAppData { MsgData *msgData3; // 0x174 u8 filler_178[0x4]; int unk_17C; - u8 unk_180[0x278]; - u8 unk_3F8[0xC0]; + String *unk_180; + u8 unk_184[0x4]; + SpriteList *unk_188; + u8 unk_18C[0x1A0]; + u8 unk_32C[0x8C]; + u8 unk_3B8[0x40]; + u8 unk_3F8[0x50]; + Window unk_448; + int unk_458; + int unk_45C; + int unk_460; + u8 unk_464[4]; + u8 unk_468[4]; + u8 filler_46C[0x24]; + u8 unk_490[0x18]; + int unk_4A8; + u8 filler_4AC[4]; + NNSG2dCharacterData *unk_4B0; + u8 filler_4B4[4]; NNSG2dCharacterData *unk_4B8; u8 filler_4BC[0x4]; NNSG2dPaletteData *unk_4C0; u8 unk_4C4[0x100]; UnkStruct_020163E0 *unk_5C4; - u8 filler_5C8[0xC]; + u8 filler_5C8[0x4]; + int unk_5CC; + u8 filler_5D0[0x4]; } NamingScreenAppData; // size: 0x5D4 BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); +void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); +BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState); +void sub_02083140(void *param); void sub_02083184(void); void sub_020831A4(BgConfig *bgConfig); void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args); -void sub_02083654(NamingScreenAppData *data, NARC *narc); -void sub_02083140(void *param); +void sub_020832E4(int a0); void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +void sub_02083654(NamingScreenAppData *data, NARC *narc); void sub_0208377C(void); void sub_020837AC(NamingScreenAppData *data, NARC *narc); void sub_020839EC(NamingScreenAppData *data); void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); void sub_02084740(void *a0, u16 *a1, u16 a2, void *a3, void *a4, int a5); -void sub_020832E4(int a0); -void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); +int sub_02082CF8(NamingScreenAppData *data, int a1); +void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +void sub_02084FCC(NamingScreenAppData *data); +void sub_02084F3C(void *a0, void *a1, int a2); +void sub_02083D34(BgConfig *bgConfig, void *a1, void *a2, int a3, void *a4, void *a5, void *a6, const u16 *a7); +void sub_02084500(void *a0); static NamingScreenAppData *_021D43B0; @@ -115,3 +146,81 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { return FALSE; } + +void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form) { + GX_LoadOBJ(pCharData->pRawData, 0x57E0, 0x200); + const u16 *rawPltt = pPlttData->pRawData; + u32 plttNo = GetMonIconPaletteEx(species, form, FALSE); + GX_LoadOBJPltt(rawPltt + 16 * plttNo, 0xC0, 0x20); +} + +BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { + NamingScreenAppData *data = OverlayManager_GetData(ovyMan); + + switch (*pState) { + case 0: + if (IsPaletteFadeFinished()) { + *pState = 1; + data->unk_5CC = 0; + } + break; + case 1: + ++data->unk_5CC; + sub_02084FCC(data); + sub_02084F3C(data->unk_490, data->unk_32C, data->unk_460); + if (data->unk_5CC > 5) { + *pState = 2; + data->unk_5CC = 0; + } + break; + case 2: + switch (data->unk_45C) { + case 0: + case 1: + case 2: + case 3: + break; + case 4: + if (data->unk_034 == 0) { + *pState = sub_02082CF8(data, *pState); + } + sub_02084FCC(data); + break; + case 5: + sub_020834FC(data, ovyMan); + FillWindowPixelBuffer(&data->unk_448, 15); + DrawFrameAndWindow2(&data->unk_448, FALSE, 256, 10); + data->unk_458 = AddTextPrinterParameterized(&data->unk_448, 1, data->unk_180, 0, 0, 1, NULL); + CopyWindowToVram(&data->unk_448); + data->unk_45C = 6; + break; + case 6: + if (!TextPrinterCheckActive(data->unk_458)) { + PlaySE(SEQ_SE_DP_PIRORIRO); + ++data->unk_4A8; + data->unk_5CC = 0; + data->unk_45C = 7; + } + break; + case 7: + ++data->unk_5CC; + if (data->unk_5CC > 30) { + BeginNormalPaletteFade(2, 0, 0, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); + *pState = 3; + } + break; + } + sub_02083D34(data->bgConfig, data->unk_3B8, &data->unk_45C, data->unk_460, data->unk_464, data->unk_468, data->unk_32C, data->unk_4B0->pRawData); + sub_02084F3C(data->unk_490, data->unk_32C, data->unk_460); + sub_02084500(data->unk_038); + break; + case 3: + if (IsPaletteFadeFinished()) { + return TRUE; + } + break; + } + + SpriteList_RenderAndAnimateSprites(data->unk_188); + return FALSE; +} From 5c4b4e1ed1e57191db60a051e96d6aaf829cc4ec Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 9 Oct 2024 19:25:16 -0400 Subject: [PATCH 03/25] through NamingScreenApp_Exit --- asm/unk_02082908.s | 473 +--------------------------------------- include/gf_gfx_planes.h | 8 +- src/naming_screen.c | 243 ++++++++++++++++++--- 3 files changed, 220 insertions(+), 504 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index 67377071f3..cd35ba4442 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -12,479 +12,12 @@ .public gNatureStatMods .extern NamingScreenApp_Init .extern NamingScreenApp_Main + .extern NamingScreenApp_Exit + .extern sub_02082E28 + .extern sub_02082EC0 .text - thumb_func_start sub_02082CF8 -sub_02082CF8: ; 0x02082CF8 - push {r3, r4, r5, lr} - add r5, r0, #0 - add r4, r1, #0 - bl sub_0208432C - ldr r0, _02082E10 ; =gSystem - mov r1, #4 - ldr r0, [r0, #0x48] - tst r1, r0 - beq _02082D9C - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - bl Sprite_GetVisibleFlag - cmp r0, #0 - bne _02082D2A - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - add r0, r4, #0 - pop {r3, r4, r5, pc} -_02082D2A: - ldr r0, [r5] - cmp r0, #4 - beq _02082D74 - ldr r1, _02082E14 ; =0x0000045C - mov r0, #0 - str r0, [r5, r1] - add r2, r1, #4 - ldr r2, [r5, r2] - add r3, r2, #1 - add r2, r1, #4 - str r3, [r5, r2] - ldr r2, [r5, r2] - cmp r2, #3 - blt _02082D4A - add r1, r1, #4 - str r0, [r5, r1] -_02082D4A: - mov r2, #0x49 - lsl r2, r2, #4 - add r1, r2, #0 - sub r1, #0x30 - ldr r1, [r5, r1] - add r0, r5, r2 - lsl r3, r1, #2 - ldr r1, [r0, r3] - sub r2, #0x30 - add r1, r1, #1 - str r1, [r0, r3] - add r0, r5, #0 - ldr r1, [r5, r2] - add r0, #0x3a - bl sub_02084830 - ldr r0, _02082E18 ; =0x0000069D - bl PlaySE - mov r0, #1 - str r0, [r5, #0x30] -_02082D74: - mov r2, #0x49 - lsl r2, r2, #4 - add r1, r2, #0 - sub r1, #0x30 - ldr r1, [r5, r1] - add r0, r5, r2 - lsl r3, r1, #2 - ldr r1, [r0, r3] - sub r2, #0x30 - add r1, r1, #1 - str r1, [r0, r3] - add r0, r5, #0 - ldr r1, [r5, r2] - add r0, #0x3a - bl sub_02084830 - ldr r0, _02082E18 ; =0x0000069D - bl PlaySE - b _02082E0A -_02082D9C: - mov r2, #1 - add r1, r0, #0 - tst r1, r2 - beq _02082DC2 - ldr r3, [r5, #0x20] - mov r1, #0x1a - mul r1, r3 - add r3, r5, r1 - ldr r1, [r5, #0x1c] - add r0, r5, #0 - lsl r1, r1, #1 - add r1, r3, r1 - ldrh r1, [r1, #0x3a] - bl sub_02084884 - add r4, r0, #0 - mov r0, #1 - str r0, [r5, #0x30] - b _02082E0A -_02082DC2: - ldr r1, _02082E1C ; =0x000005C8 - ldr r1, [r5, r1] - cmp r1, #1 - bne _02082DE6 - ldr r2, [r5, #0x20] - mov r1, #0x1a - mul r1, r2 - add r2, r5, r1 - ldr r1, [r5, #0x1c] - add r0, r5, #0 - lsl r1, r1, #1 - add r1, r2, r1 - ldrh r1, [r1, #0x3a] - mov r2, #0 - bl sub_02084884 - add r4, r0, #0 - b _02082E0A -_02082DE6: - mov r1, #2 - add r3, r0, #0 - tst r3, r1 - beq _02082DFA - ldr r1, _02082E20 ; =0x0000E007 - add r0, r5, #0 - bl sub_02084884 - add r4, r0, #0 - b _02082E0A -_02082DFA: - add r1, #0xfe - tst r0, r1 - beq _02082E0A - ldr r1, _02082E24 ; =0x0000E006 - add r0, r5, #0 - bl sub_02084884 - add r4, r0, #0 -_02082E0A: - add r0, r4, #0 - pop {r3, r4, r5, pc} - nop -_02082E10: .word gSystem -_02082E14: .word 0x0000045C -_02082E18: .word 0x0000069D -_02082E1C: .word 0x000005C8 -_02082E20: .word 0x0000E007 -_02082E24: .word 0x0000E006 - thumb_func_end sub_02082CF8 - - thumb_func_start sub_02082E28 -sub_02082E28: ; 0x02082E28 - push {r4, r5, r6, lr} - add r5, r0, #0 - ldr r0, [r5] - add r4, r1, #0 - cmp r0, #0 - bne _02082E8A - ldr r0, [r5, #4] - cmp r0, #0 - bne _02082E52 - bl LCRandom - mov r1, #0x12 - bl _s32_div_f - mov r0, #0x17 - lsl r0, r0, #4 - ldr r0, [r5, r0] -#ifndef HEARTGOLD - add r1, #0x2A -#endif - bl NewString_ReadMsgData - add r6, r0, #0 - b _02082E6E -_02082E52: - cmp r0, #1 - bne _02082E6E - bl LCRandom - mov r1, #0x12 - bl _s32_div_f - mov r0, #0x17 - lsl r0, r0, #4 - ldr r0, [r5, r0] -#ifdef HEARTGOLD - add r1, #0x12 -#else - add r1, #0x3C -#endif - bl NewString_ReadMsgData - add r6, r0, #0 -_02082E6E: - ldr r0, [r4, #0x18] - add r1, r6, #0 - bl String_Copy - add r0, r6, #0 - bl String_Delete - ldr r0, [r4, #0x18] - add r4, #0x1c - add r1, r4, #0 - mov r2, #0xa - bl CopyStringToU16Array - pop {r4, r5, r6, pc} -_02082E8A: - cmp r0, #3 - bne _02082EB8 - mov r0, #0x17 - lsl r0, r0, #4 - ldr r0, [r5, r0] -#ifdef HEARTGOLD - mov r1, #0x54 -#else - mov r1, #0x55 -#endif - bl NewString_ReadMsgData - add r5, r0, #0 - ldr r0, [r4, #0x18] - add r1, r5, #0 - bl String_Copy - add r0, r5, #0 - bl String_Delete - ldr r0, [r4, #0x18] - add r4, #0x1c - add r1, r4, #0 - mov r2, #0xa - bl CopyStringToU16Array - pop {r4, r5, r6, pc} -_02082EB8: - mov r0, #1 - str r0, [r4, #0x14] - pop {r4, r5, r6, pc} - .balign 4, 0 - thumb_func_end sub_02082E28 - - thumb_func_start sub_02082EC0 -sub_02082EC0: ; 0x02082EC0 - push {r4, r5} - ldr r1, _02082EE0 ; =0x000001DE - ldr r2, _02082EE4 ; =0x0000FFFF - mov r5, #1 - mov r3, #0 -_02082ECA: - ldrh r4, [r0] - cmp r4, r2 - beq _02082EDA - cmp r4, r1 - beq _02082ED6 - add r5, r3, #0 -_02082ED6: - add r0, r0, #2 - b _02082ECA -_02082EDA: - add r0, r5, #0 - pop {r4, r5} - bx lr - .balign 4, 0 -_02082EE0: .word 0x000001DE -_02082EE4: .word 0x0000FFFF - thumb_func_end sub_02082EC0 - - thumb_func_start NamingScreenApp_Exit -NamingScreenApp_Exit: ; 0x02082EE8 - push {r4, r5, r6, r7, lr} - sub sp, #0x14 - str r0, [sp, #0x10] - bl OverlayManager_GetData - add r4, r0, #0 - ldr r0, [sp, #0x10] - bl OverlayManager_GetArgs - add r5, r0, #0 - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r0, [r4, r0] - ldr r1, _020830C0 ; =0x0000FFFF - lsl r0, r0, #1 - add r0, r4, r0 - add r0, #0xd8 - strh r1, [r0] - ldr r0, [r4] - cmp r0, #1 - bne _02082F32 - mov r0, #0x12 - bl AllocMonZeroed - mov r3, #0xa - str r3, [sp] - str r3, [sp, #4] - str r3, [sp, #8] - str r3, [sp, #0xc] - ldr r1, [r4, #4] - add r6, r0, #0 - mov r2, #5 - bl CreateMon - add r0, r6, #0 - bl FreeToHeap -_02082F32: - mov r1, #0x56 - lsl r1, r1, #2 - ldrh r0, [r4, r1] - cmp r0, #0 - beq _02082F58 - add r0, r4, #0 - sub r1, #0x40 - add r0, #0xd8 - add r1, r4, r1 - bl StringNotEqual - cmp r0, #0 - beq _02082F58 - add r0, r4, #0 - add r0, #0xd8 - bl sub_02082EC0 - cmp r0, #0 - beq _02082F62 -_02082F58: - add r0, r4, #0 - add r1, r5, #0 - bl sub_02082E28 - b _02082F86 -_02082F62: - mov r0, #0x46 - lsl r0, r0, #2 - add r1, r4, #0 - add r0, r4, r0 - add r1, #0xd8 - bl CopyU16StringArray - add r0, r5, #0 - add r1, r4, #0 - add r0, #0x1c - add r1, #0xd8 - bl CopyU16StringArray - add r1, r4, #0 - ldr r0, [r5, #0x18] - add r1, #0xd8 - bl CopyU16ArrayToString -_02082F86: - mov r0, #0x61 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl String_Delete - mov r7, #0xe7 - mov r6, #0 - add r5, r4, #0 - lsl r7, r7, #2 -_02082F98: - ldr r0, [r5, r7] - bl DestroySysTaskAndEnvironment - add r6, r6, #1 - add r5, r5, #4 - cmp r6, #7 - blt _02082F98 - mov r0, #0xb1 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_0200AEB0 - mov r0, #0xb5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_0200AEB0 - mov r0, #0xb2 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_0200B0A8 - mov r0, #0xb6 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_0200B0A8 - mov r7, #0xad - mov r6, #0 - add r5, r4, #0 - lsl r7, r7, #2 -_02082FD6: - ldr r0, [r5, r7] - bl Destroy2DGfxResObjMan - add r6, r6, #1 - add r5, r5, #4 - cmp r6, #4 - blt _02082FD6 - mov r0, #0x62 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl SpriteList_Delete - bl OamManager_Free - ldr r1, _020830C4 ; =0x000004AC - mov r0, #0x12 - ldr r1, [r4, r1] - bl FreeToHeapExplicit - ldr r0, [r4] - cmp r0, #1 - bne _02083016 - ldr r1, _020830C8 ; =0x000004B4 - mov r0, #0x12 - ldr r1, [r4, r1] - bl FreeToHeapExplicit - ldr r1, _020830CC ; =0x000004BC - mov r0, #0x12 - ldr r1, [r4, r1] - bl FreeToHeapExplicit -_02083016: - mov r0, #0x16 - lsl r0, r0, #4 - ldr r0, [r4, r0] - mov r1, #7 - bl FreeBgTilemapBuffer - bl ObjCharTransfer_Destroy - bl ObjPlttTransfer_Destroy - mov r0, #0x16 - lsl r0, r0, #4 - mov r1, #0xee - lsl r1, r1, #2 - ldr r0, [r4, r0] - add r1, r4, r1 - bl sub_02083614 - mov r0, #0 - bl FontID_SetAccessLazy - mov r2, #1 - lsl r2, r2, #0x1a - ldr r1, [r2] - ldr r0, _020830D0 ; =0xFFFF1FFF - and r0, r1 - str r0, [r2] - mov r0, #2 - bl FontID_Release - mov r0, #6 - lsl r0, r0, #6 - ldr r0, [r4, r0] - cmp r0, #0 - beq _02083060 - bl String_Delete -_02083060: - mov r0, #0x5e - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl String_Delete - mov r0, #0x5f - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl String_Delete - mov r0, #0x5d - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl DestroyMsgData - mov r0, #0x17 - lsl r0, r0, #4 - ldr r0, [r4, r0] - bl DestroyMsgData - mov r0, #0x5b - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl DestroyMsgData - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl MessageFormat_Delete - ldr r0, [sp, #0x10] - bl OverlayManager_FreeData - mov r0, #0 - add r1, r0, #0 - bl Main_SetVBlankIntrCB - mov r0, #0x12 - bl DestroyHeap - ldr r0, _020830D4 ; =gSystem + 0x60 - mov r1, #0 - strb r1, [r0, #9] - bl GfGfx_SwapDisplay - mov r0, #1 - add sp, #0x14 - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_020830C0: .word 0x0000FFFF -_020830C4: .word 0x000004AC -_020830C8: .word 0x000004B4 -_020830CC: .word 0x000004BC -_020830D0: .word 0xFFFF1FFF -_020830D4: .word gSystem + 0x60 - thumb_func_end NamingScreenApp_Exit - thumb_func_start NamingScreen_CreateArgs NamingScreen_CreateArgs: ; 0x020830D8 push {r3, r4, r5, r6, r7, lr} diff --git a/include/gf_gfx_planes.h b/include/gf_gfx_planes.h index ce1e21ec2f..f56e74b1f9 100644 --- a/include/gf_gfx_planes.h +++ b/include/gf_gfx_planes.h @@ -1,8 +1,7 @@ #ifndef POKEHEARTGOLD_GF_GFX_PLANES_H #define POKEHEARTGOLD_GF_GFX_PLANES_H -#include -#include +#include "system.h" typedef enum { GF_PLANE_TOGGLE_OFF, @@ -60,4 +59,9 @@ void GfGfx_BothDispOn(void); void GfGfx_SwapDisplay(void); u32 GfGfx_EngineAGetPlanes(void); +static inline void GfGfx_SetMainDisplay(PMLCDTarget screen) { + gSystem.screensFlipped = (BOOL)screen; + GfGfx_SwapDisplay(); +} + #endif // POKEHEARTGOLD_GF_GFX_PLANES_H diff --git a/src/naming_screen.c b/src/naming_screen.c index 4fcacbc61d..45c10bfea5 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -1,47 +1,76 @@ #include "global.h" #include "msgdata/msg.naix" +#include "msgdata/msg/msg_0197.h" +#include "msgdata/msg/msg_0249.h" +#include "msgdata/msg/msg_0254.h" #include "bg_window.h" #include "filesystem.h" #include "font.h" #include "gf_gfx_planes.h" #include "launch_application.h" +#include "math_util.h" #include "message_format.h" #include "msgdata.h" +#include "obj_char_transfer.h" +#include "obj_pltt_transfer.h" #include "pokemon_icon_idx.h" #include "sound_02004A44.h" +#include "systask_environment.h" #include "system.h" #include "text.h" #include "unk_02005D10.h" +#include "unk_0200ACF0.h" +#include "unk_0200B150.h" #include "unk_0200FA24.h" #include "unk_020163E0.h" #include "unk_02082908.h" typedef struct NamingScreenAppData { - int unk_000; + NameScreenType type; int unk_004; int unk_008; - u8 filler_00C[0x28]; + u8 filler_00C[0x10]; + int unk_01C; + int unk_020; + u8 filler_024[0xC]; + int unk_030; int unk_034; - u8 unk_038[0xA0]; - u16 unk_0D8[0x40]; + u8 unk_038[0x2]; + u16 unk_03A[6][13]; + u8 filler_0D6[2]; + u16 unk_0D8[0x20]; + u16 unk_118[0x20]; u16 unk_158; u16 unk_15A; u8 filler_15C[0x4]; BgConfig *bgConfig; // 0x160 u8 filler_164[4]; MessageFormat *msgFormat; // 0x168 - MsgData *msgData; // 0x16C - MsgData *msgData2; // 0x170 - MsgData *msgData3; // 0x174 - u8 filler_178[0x4]; - int unk_17C; + MsgData *msgData_249; // 0x16C + MsgData *msgData_254; // 0x170 + MsgData *msgData_197; // 0x174 + String *unk_178; + String *unk_17C; String *unk_180; - u8 unk_184[0x4]; + String *unk_184; SpriteList *unk_188; - u8 unk_18C[0x1A0]; - u8 unk_32C[0x8C]; + u8 unk_18C[0x128]; + GF_2DGfxResMan *unk_2B4[4]; + GF_2DGfxResObj *unk_2C4; + GF_2DGfxResObj *unk_2C8; + GF_2DGfxResObj *unk_2CC; + GF_2DGfxResObj *unk_2D0; + GF_2DGfxResObj *unk_2D4; + GF_2DGfxResObj *unk_2D8; + GF_2DGfxResObj *unk_2DC; + GF_2DGfxResObj *unk_2E0; + u8 filler_2E4[0x48]; + u8 unk_32C[0x20]; + Sprite *unk_34C; + u8 filler_350[0x4C]; + SysTask *unk_39C[7]; u8 unk_3B8[0x40]; u8 unk_3F8[0x50]; Window unk_448; @@ -51,17 +80,17 @@ typedef struct NamingScreenAppData { u8 unk_464[4]; u8 unk_468[4]; u8 filler_46C[0x24]; - u8 unk_490[0x18]; + int unk_490[6]; int unk_4A8; - u8 filler_4AC[4]; + void *unk_4AC; NNSG2dCharacterData *unk_4B0; - u8 filler_4B4[4]; + void *unk_4B4; NNSG2dCharacterData *unk_4B8; - u8 filler_4BC[0x4]; + void *unk_4BC; NNSG2dPaletteData *unk_4C0; u8 unk_4C4[0x100]; UnkStruct_020163E0 *unk_5C4; - u8 filler_5C8[0x4]; + BOOL unk_5C8; int unk_5CC; u8 filler_5D0[0x4]; } NamingScreenAppData; // size: 0x5D4 @@ -69,23 +98,31 @@ typedef struct NamingScreenAppData { BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState); +int sub_02082CF8(NamingScreenAppData *data, int a1); +void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args); +BOOL sub_02082EC0(const u16 *s); +BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState); void sub_02083140(void *param); +BOOL sub_02082EC0(const u16 *s); +void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args); void sub_02083184(void); void sub_020831A4(BgConfig *bgConfig); -void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args); void sub_020832E4(int a0); void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +void sub_02083614(BgConfig *bgConfig, void *a1); void sub_02083654(NamingScreenAppData *data, NARC *narc); void sub_0208377C(void); void sub_020837AC(NamingScreenAppData *data, NARC *narc); void sub_020839EC(NamingScreenAppData *data); +void sub_02083D34(BgConfig *bgConfig, void *a1, void *a2, int a3, void *a4, void *a5, void *a6, const u16 *a7); void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); -void sub_02084740(void *a0, u16 *a1, u16 a2, void *a3, void *a4, int a5); -int sub_02082CF8(NamingScreenAppData *data, int a1); -void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan); -void sub_02084FCC(NamingScreenAppData *data); +void sub_0208432C(NamingScreenAppData *data); +void sub_02084740(void *a0, u16 *a1, u16 a2, void *a3, void *a4, String *a5); +void sub_02084830(u16 (*a0)[13], int a1); +int sub_02084884(NamingScreenAppData *data, int key, BOOL a2); void sub_02084F3C(void *a0, void *a1, int a2); -void sub_02083D34(BgConfig *bgConfig, void *a1, void *a2, int a3, void *a4, void *a5, void *a6, const u16 *a7); +void sub_02084FCC(NamingScreenAppData *data); void sub_02084500(void *a0); static NamingScreenAppData *_021D43B0; @@ -105,12 +142,12 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { data = OverlayManager_CreateAndGetData(ovyMan, sizeof(NamingScreenAppData), HEAP_ID_NAMING_SCREEN); memset(data, 0, sizeof(NamingScreenAppData)); - data->bgConfig = BgConfig_Alloc(HEAP_ID_NAMING_SCREEN); - narc = NARC_New(NARC_a_0_3_1, HEAP_ID_NAMING_SCREEN); - data->msgFormat = MessageFormat_New(HEAP_ID_NAMING_SCREEN); - data->msgData = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_msgdata_msg, NARC_msg_msg_0249_bin, HEAP_ID_NAMING_SCREEN); - data->msgData2 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0254_bin, HEAP_ID_NAMING_SCREEN); - data->msgData3 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0197_bin, HEAP_ID_NAMING_SCREEN); + data->bgConfig = BgConfig_Alloc(HEAP_ID_NAMING_SCREEN); + narc = NARC_New(NARC_a_0_3_1, HEAP_ID_NAMING_SCREEN); + data->msgFormat = MessageFormat_New(HEAP_ID_NAMING_SCREEN); + data->msgData_249 = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_msgdata_msg, NARC_msg_msg_0249_bin, HEAP_ID_NAMING_SCREEN); + data->msgData_254 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0254_bin, HEAP_ID_NAMING_SCREEN); + data->msgData_197 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0197_bin, HEAP_ID_NAMING_SCREEN); SetKeyRepeatTimers(4, 8); sub_02083184(); sub_020831A4(data->bgConfig); @@ -128,14 +165,13 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { sub_02004EC4(0x34, 0, 0); BeginNormalPaletteFade(0, 1, 1, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); sub_020832E4(1); - gSystem.screensFlipped = TRUE; - GfGfx_SwapDisplay(); + GfGfx_SetMainDisplay(PM_LCD_BOTTOM); NARC_Delete(narc); ++(*pState); break; case 1: data = OverlayManager_GetData(ovyMan); - if (data->unk_000 == NAME_SCREEN_POKEMON) { + if (data->type == NAME_SCREEN_POKEMON) { sub_02082AEC(data->unk_4B8, data->unk_4C0, data->unk_004, data->unk_008); } _021D43B0 = data; @@ -224,3 +260,146 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { SpriteList_RenderAndAnimateSprites(data->unk_188); return FALSE; } + +int sub_02082CF8(NamingScreenAppData *data, int a1) { + int ret = a1; + + sub_0208432C(data); + if (gSystem.newKeys & PAD_BUTTON_SELECT) { + if (!Sprite_GetVisibleFlag(data->unk_34C)) { + Sprite_SetVisibleFlag(data->unk_34C, TRUE); + return ret; + } + if (data->type != 4) { + data->unk_45C = 0; + ++data->unk_460; + if (data->unk_460 >= 3) { + data->unk_460 = 0; + } + ++data->unk_490[data->unk_460]; + sub_02084830(data->unk_03A, data->unk_460); + PlaySE(SEQ_SE_DP_SYU03); + data->unk_030 = 1; + } + ++data->unk_490[data->unk_460]; + sub_02084830(data->unk_03A, data->unk_460); + PlaySE(SEQ_SE_DP_SYU03); + } else if (gSystem.newKeys & PAD_BUTTON_A) { + ret = sub_02084884(data, data->unk_03A[data->unk_020][data->unk_01C], TRUE); + data->unk_030 = 1; + } else if (data->unk_5C8 == TRUE) { + ret = sub_02084884(data, data->unk_03A[data->unk_020][data->unk_01C], FALSE); + } else if (gSystem.newKeys & PAD_BUTTON_B) { + ret = sub_02084884(data, 0xE007, TRUE); + } else if (gSystem.newKeys & PAD_BUTTON_R) { + ret = sub_02084884(data, 0xE006, TRUE); + } + return ret; +} + +#ifdef HEARTGOLD +#define FIRST_DEFAULT_NAME_MALE msg_0254_00000 +#define FIRST_DEFAULT_NAME_FEMALE msg_0254_00018 +#define FIRST_DEFAULT_NAME_RIVAL msg_0254_00084 +#else +#define FIRST_DEFAULT_NAME_MALE msg_0254_00042 +#define FIRST_DEFAULT_NAME_FEMALE msg_0254_00060 +#define FIRST_DEFAULT_NAME_RIVAL msg_0254_00085 +#endif // HEARTGOLD + +void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args) { + String *string; + + if (data->type == NAME_SCREEN_PLAYER) { + if (data->unk_004 == PLAYER_GENDER_MALE) { + string = NewString_ReadMsgData(data->msgData_254, FIRST_DEFAULT_NAME_MALE + (LCRandom() % 18)); + } else if (data->unk_004 == PLAYER_GENDER_FEMALE) { + string = NewString_ReadMsgData(data->msgData_254, FIRST_DEFAULT_NAME_FEMALE + (LCRandom() % 18)); + } + // UB: Nonbinary players will not initialize string. + String_Copy(args->nameInputString, string); + String_Delete(string); + CopyStringToU16Array(args->nameInputString, args->unk1C, 10); + } else if (data->type == NAME_SCREEN_RIVAL) { + string = NewString_ReadMsgData(data->msgData_254, FIRST_DEFAULT_NAME_RIVAL); + String_Copy(args->nameInputString, string); + String_Delete(string); + CopyStringToU16Array(args->nameInputString, args->unk1C, 10); + } else { + args->unk14 = 1; + } +} + +BOOL sub_02082EC0(const u16 *s) { + BOOL ret = TRUE; + int i; + + for (i = 0;; ++i) { + if (s[i] == EOS) { + break; + } + if (s[i] != CHAR_SPACE) { + ret = FALSE; + } + } + return ret; +} + +BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { + NamingScreenAppData *data = OverlayManager_GetData(ovyMan); + NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); + + data->unk_0D8[data->unk_158] = EOS; + if (data->type == NAME_SCREEN_POKEMON) { + Pokemon *mon = AllocMonZeroed(HEAP_ID_NAMING_SCREEN); + CreateMon(mon, data->unk_004, 5, 10, 10, 10, 10, 10); + // wtf + FreeToHeap(mon); + } + if (data->unk_158 == 0 || !StringNotEqual(data->unk_0D8, data->unk_118) || sub_02082EC0(data->unk_0D8)) { + sub_02082E28(data, args); + } else { + CopyU16StringArray(data->unk_118, data->unk_0D8); + CopyU16StringArray(args->unk1C, data->unk_0D8); + CopyU16ArrayToString(args->nameInputString, data->unk_0D8); + } + String_Delete(data->unk_184); + for (int i = 0; i < 7; ++i) { + DestroySysTaskAndEnvironment(data->unk_39C[i]); + } + sub_0200AEB0(data->unk_2C4); + sub_0200AEB0(data->unk_2D4); + sub_0200B0A8(data->unk_2C8); + sub_0200B0A8(data->unk_2D8); + for (int i = 0; i < 4; ++i) { + Destroy2DGfxResObjMan(data->unk_2B4[i]); + } + SpriteList_Delete(data->unk_188); + OamManager_Free(); + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->unk_4AC); + if (data->type == NAME_SCREEN_POKEMON) { + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->unk_4B4); + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->unk_4BC); + } + FreeBgTilemapBuffer(data->bgConfig, GF_BG_LYR_SUB_3); + ObjCharTransfer_Destroy(); + ObjPlttTransfer_Destroy(); + sub_02083614(data->bgConfig, data->unk_3B8); + FontID_SetAccessLazy(0); + GX_SetVisibleWnd(0); + FontID_Release(2); + if (data->unk_180 != NULL) { + String_Delete(data->unk_180); + } + String_Delete(data->unk_178); + String_Delete(data->unk_17C); + DestroyMsgData(data->msgData_197); + DestroyMsgData(data->msgData_254); + DestroyMsgData(data->msgData_249); + MessageFormat_Delete(data->msgFormat); + OverlayManager_FreeData(ovyMan); + Main_SetVBlankIntrCB(NULL, NULL); + DestroyHeap(HEAP_ID_NAMING_SCREEN); + GfGfx_SetMainDisplay(PM_LCD_TOP); + return TRUE; +} From 0b3edc6374b4cbd88e73774796e05220b068f943 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 9 Oct 2024 20:17:52 -0400 Subject: [PATCH 04/25] through NamingScreen_DeleteArgs --- asm/unk_02082908.s | 56 --------------------- include/launch_application_internal.h | 2 +- include/{unk_02082908.h => naming_screen.h} | 18 ++++--- include/oaks_speech.h | 2 +- include/oaks_speech_internal.h | 2 +- src/launch_application.c | 2 +- src/naming_screen.c | 31 +++++++++++- src/oaks_speech.c | 2 +- 8 files changed, 46 insertions(+), 69 deletions(-) rename include/{unk_02082908.h => naming_screen.h} (64%) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index cd35ba4442..7e9a7c0552 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -18,62 +18,6 @@ .text - thumb_func_start NamingScreen_CreateArgs -NamingScreen_CreateArgs: ; 0x020830D8 - push {r3, r4, r5, r6, r7, lr} - add r5, r1, #0 - mov r1, #0x54 - str r0, [sp] - add r6, r2, #0 - add r7, r3, #0 - bl AllocFromHeap - add r4, r0, #0 - str r5, [r4] - str r6, [r4, #4] - str r7, [r4, #0xc] - mov r0, #0 - str r0, [r4, #0x14] - ldr r0, _02083118 ; =0x0000FFFF - ldr r1, [sp] - strh r0, [r4, #0x1c] - mov r0, #0x20 - bl String_New - str r0, [r4, #0x18] - mov r1, #0 - str r1, [r4, #0x44] - str r1, [r4, #0x48] - ldr r0, [sp, #0x18] - str r1, [r4, #0x10] - str r0, [r4, #0x4c] - ldr r0, [sp, #0x1c] - str r1, [r4, #8] - str r0, [r4, #0x50] - add r0, r4, #0 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02083118: .word 0x0000FFFF - thumb_func_end NamingScreen_CreateArgs - - thumb_func_start NamingScreen_DeleteArgs -NamingScreen_DeleteArgs: ; 0x0208311C - push {r4, lr} - add r4, r0, #0 - ldr r0, [r4, #0x18] - cmp r0, #0 - bne _0208312A - bl GF_AssertFail -_0208312A: - cmp r4, #0 - bne _02083132 - bl GF_AssertFail -_02083132: - ldr r0, [r4, #0x18] - bl String_Delete - add r0, r4, #0 - bl FreeToHeap - pop {r4, pc} - thumb_func_end NamingScreen_DeleteArgs - thumb_func_start sub_02083140 sub_02083140: ; 0x02083140 push {r3, lr} diff --git a/include/launch_application_internal.h b/include/launch_application_internal.h index 3efca28912..dca2eaaaf2 100644 --- a/include/launch_application_internal.h +++ b/include/launch_application_internal.h @@ -2,8 +2,8 @@ #define POKEHEARTGOLD_FIELD_LAUNCH_APPLICATION_INTERNAL_H #include "launch_application.h" +#include "naming_screen.h" #include "unk_0202C034.h" -#include "unk_02082908.h" typedef enum PartyMenuMoveSelectState { PMMS_OPEN_PARTY_MENU, diff --git a/include/unk_02082908.h b/include/naming_screen.h similarity index 64% rename from include/unk_02082908.h rename to include/naming_screen.h index 0ead420fed..a468599fbf 100644 --- a/include/unk_02082908.h +++ b/include/naming_screen.h @@ -1,5 +1,5 @@ -#ifndef POKEHEARTGOLD_UNK_02082908_H -#define POKEHEARTGOLD_UNK_02082908_H +#ifndef POKEHEARTGOLD_NAMING_SCREEN_H +#define POKEHEARTGOLD_NAMING_SCREEN_H #include "options.h" #include "overlay_manager.h" @@ -9,16 +9,20 @@ extern const OVY_MGR_TEMPLATE gOverlayTemplate_NamingScreen; typedef struct NamingScreenArgs { int kind; - int playerGender; + int playerGender; // monSpecies int monForm; - u8 unkC[0x4]; + int maxLen; int monGender; int unk14; String *nameInputString; - u16 unk1C[PLAYER_NAME_LENGTH + 1]; + u16 unk1C[20]; + int unk44; + int unk48; + Options *options; + int *unk50; } NamingScreenArgs; -void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs); NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, int kind, int param, int maxLen, Options *options, int *a5); +void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs); -#endif // POKEHEARTGOLD_UNK_02082908_H +#endif // POKEHEARTGOLD_NAMING_SCREEN_H diff --git a/include/oaks_speech.h b/include/oaks_speech.h index 98e5bb63ce..d8447c3c2a 100644 --- a/include/oaks_speech.h +++ b/include/oaks_speech.h @@ -2,11 +2,11 @@ #define GUARD_POKEHEARTGOLD_OAKS_SPEECH_H #include "bg_window.h" +#include "naming_screen.h" #include "options.h" #include "overlay_manager.h" #include "save.h" #include "unk_0200CF18.h" -#include "unk_02082908.h" BOOL OakSpeech_Init(OVY_MANAGER *ovyMan, int *pState); BOOL OakSpeech_Main(OVY_MANAGER *ovyMan, int *pState); diff --git a/include/oaks_speech_internal.h b/include/oaks_speech_internal.h index 7e483a2000..8b0bf6756b 100644 --- a/include/oaks_speech_internal.h +++ b/include/oaks_speech_internal.h @@ -3,11 +3,11 @@ #include "bg_window.h" #include "msgdata.h" +#include "naming_screen.h" #include "options.h" #include "overlay_manager.h" #include "unk_0200CF18.h" #include "unk_020163E0.h" -#include "unk_02082908.h" #define GENDER_CURSOR_MALE 0 #define GENDER_CURSOR_FEMALE 1 diff --git a/src/launch_application.c b/src/launch_application.c index 0a2e1f30cd..a4117cb193 100644 --- a/src/launch_application.c +++ b/src/launch_application.c @@ -19,6 +19,7 @@ #include "get_egg.h" #include "launch_application_internal.h" #include "mail_misc.h" +#include "naming_screen.h" #include "overlay_02.h" #include "overlay_100.h" #include "overlay_101.h" @@ -80,7 +81,6 @@ #include "unk_0205A44C.h" #include "unk_0206D494.h" #include "unk_020755E8.h" -#include "unk_02082908.h" #include "unk_02087A78.h" #include "unk_02088288.h" #include "unk_020910D8.h" diff --git a/src/naming_screen.c b/src/naming_screen.c index 45c10bfea5..a786432003 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -1,3 +1,5 @@ +#include "naming_screen.h" + #include "global.h" #include "msgdata/msg.naix" @@ -25,7 +27,6 @@ #include "unk_0200B150.h" #include "unk_0200FA24.h" #include "unk_020163E0.h" -#include "unk_02082908.h" typedef struct NamingScreenAppData { NameScreenType type; @@ -403,3 +404,31 @@ BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { GfGfx_SetMainDisplay(PM_LCD_TOP); return TRUE; } + +// ------------------------------- +// Public functions +// ------------------------------- + +NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, int kind, int param, int maxLen, Options *options, int *a5) { + NamingScreenArgs *ret = AllocFromHeap(heapId, sizeof(NamingScreenArgs)); + ret->kind = kind; + ret->playerGender = param; + ret->maxLen = maxLen; + ret->unk14 = 0; + ret->unk1C[0] = EOS; + ret->nameInputString = String_New(32, heapId); + ret->unk44 = 0; + ret->unk48 = 0; + ret->monGender = 0; + ret->options = options; + ret->monForm = 0; + ret->unk50 = a5; + return ret; +} + +void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs) { + GF_ASSERT(namingScreenArgs->nameInputString != NULL); + GF_ASSERT(namingScreenArgs != NULL); // UB: should check this first + String_Delete(namingScreenArgs->nameInputString); + FreeToHeap(namingScreenArgs); +} diff --git a/src/oaks_speech.c b/src/oaks_speech.c index 76e32a7d37..23bc7b546b 100644 --- a/src/oaks_speech.c +++ b/src/oaks_speech.c @@ -14,6 +14,7 @@ #include "launch_application.h" #include "main.h" #include "math_util.h" +#include "naming_screen.h" #include "oaks_speech_internal.h" #include "overlay_36.h" #include "overlay_manager.h" @@ -26,7 +27,6 @@ #include "touchscreen.h" #include "unk_02005D10.h" #include "unk_0200FA24.h" -#include "unk_02082908.h" #include "yes_no_prompt.h" FS_EXTERN_OVERLAY(OVY_36); From 3cdc13abe4f01325ca79059141ae9f5608792b1d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 9 Oct 2024 21:36:30 -0400 Subject: [PATCH 05/25] through sub_020832E4 --- asm/unk_02082908.s | 258 ++--------------------------------- include/bg_window.h | 4 +- include/gf_gfx_planes.h | 4 +- include/naming_screen.h | 5 +- lib/include/nitro/gx/gx.h | 46 +++---- src/bg_window.c | 4 +- src/communication_error.c | 2 +- src/error_message_reset.c | 2 +- src/gf_gfx_planes.c | 4 +- src/intro_movie.c | 2 +- src/intro_movie_scene_3.c | 2 +- src/intro_movie_scene_4.c | 2 +- src/intro_movie_scenes_lib.c | 6 +- src/naming_screen.c | 95 ++++++++++++- src/save_data_read_error.c | 4 +- src/save_data_write_error.c | 2 +- src/wfc_user_info_warning.c | 2 +- 17 files changed, 148 insertions(+), 296 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index 7e9a7c0552..091586eccb 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -18,247 +18,6 @@ .text - thumb_func_start sub_02083140 -sub_02083140: ; 0x02083140 - push {r3, lr} - bl GF_RunVramTransferTasks - bl OamManager_ApplyAndResetBuffers - ldr r3, _02083158 ; =OS_IRQTable - ldr r1, _0208315C ; =0x00003FF8 - mov r0, #1 - ldr r2, [r3, r1] - orr r0, r2 - str r0, [r3, r1] - pop {r3, pc} - .balign 4, 0 -_02083158: .word OS_IRQTable -_0208315C: .word 0x00003FF8 - thumb_func_end sub_02083140 - - thumb_func_start sub_02083160 -sub_02083160: ; 0x02083160 - ldr r2, [r1] - str r2, [r0] - ldr r2, [r1, #4] - str r2, [r0, #4] - ldr r2, [r1, #8] - str r2, [r0, #8] - ldr r2, [r1, #0xc] - str r2, [r0, #0xc] - ldr r2, [r1, #0x10] - str r2, [r0, #0x10] - ldr r2, [r1, #0x4c] - str r2, [r0, #0x18] - ldr r2, [r1, #0x50] - mov r1, #0x5d - lsl r1, r1, #4 - str r2, [r0, r1] - bx lr - .balign 4, 0 - thumb_func_end sub_02083160 - - thumb_func_start sub_02083184 -sub_02083184: ; 0x02083184 - push {r4, lr} - sub sp, #0x28 - ldr r4, _020831A0 ; =_02102140 - add r3, sp, #0 - mov r2, #5 -_0208318E: - ldmia r4!, {r0, r1} - stmia r3!, {r0, r1} - sub r2, r2, #1 - bne _0208318E - add r0, sp, #0 - bl GfGfx_SetBanks - add sp, #0x28 - pop {r4, pc} - .balign 4, 0 -_020831A0: .word _02102140 - thumb_func_end sub_02083184 - - thumb_func_start sub_020831A4 -sub_020831A4: ; 0x020831A4 - push {r3, r4, r5, lr} - sub sp, #0x80 - ldr r5, _020832C8 ; =_02101D60 - add r3, sp, #0x70 - add r4, r0, #0 - add r2, r3, #0 - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - add r0, r2, #0 - bl SetBothScreensModesAndDisable - ldr r5, _020832CC ; =_02101ED4 - add r3, sp, #0x54 - ldmia r5!, {r0, r1} - add r2, r3, #0 - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldr r0, [r5] - mov r1, #0 - str r0, [r3] - add r0, r4, #0 - add r3, r1, #0 - bl InitBgFromTemplate - add r0, r4, #0 - mov r1, #0 - bl BgClearTilemapBufferAndCommit - ldr r5, _020832D0 ; =_02101FB4 - add r3, sp, #0x38 - ldmia r5!, {r0, r1} - add r2, r3, #0 - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldr r0, [r5] - mov r1, #1 - str r0, [r3] - add r0, r4, #0 - mov r3, #0 - bl InitBgFromTemplate - add r0, r4, #0 - mov r1, #1 - bl BgClearTilemapBufferAndCommit - ldr r5, _020832D4 ; =_02102078 - add r3, sp, #0x1c - ldmia r5!, {r0, r1} - add r2, r3, #0 - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldr r0, [r5] - mov r1, #2 - str r0, [r3] - add r0, r4, #0 - mov r3, #0 - bl InitBgFromTemplate - add r0, r4, #0 - mov r1, #2 - bl BgClearTilemapBufferAndCommit - ldr r5, _020832D8 ; =_02101E10 - add r3, sp, #0 - ldmia r5!, {r0, r1} - add r2, r3, #0 - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldr r0, [r5] - mov r1, #4 - str r0, [r3] - add r0, r4, #0 - mov r3, #0 - bl InitBgFromTemplate - add r0, r4, #0 - mov r1, #4 - bl BgClearTilemapBufferAndCommit - mov r0, #0 - bl sub_020832E4 - mov r0, #0 - mov r1, #0x20 - add r2, r0, #0 - mov r3, #0x12 - bl BG_ClearCharDataRange - mov r0, #4 - mov r1, #0x20 - mov r2, #0 - mov r3, #0x12 - bl BG_ClearCharDataRange - mov r0, #1 - lsl r0, r0, #0x1a - add r4, r0, #0 - ldr r2, [r0] - ldr r1, _020832DC ; =0xFFFF1FFF - add r4, #0x48 - and r2, r1 - lsr r1, r0, #0xd - orr r1, r2 - str r1, [r0] - ldrh r3, [r4] - mov r2, #0x3f - mov r1, #0x14 - bic r3, r2 - orr r1, r3 - mov r3, #0x20 - orr r1, r3 - strh r1, [r4] - add r4, r0, #0 - add r4, #0x4a - ldrh r5, [r4] - mov r1, #0x1f - bic r5, r2 - orr r1, r5 - orr r1, r3 - strh r1, [r4] - add r1, r0, #0 - mov r2, #0xff - add r1, #0x40 - strh r2, [r1] - mov r1, #0x40 - add r0, #0x44 - strh r1, [r0] - ldr r0, _020832E0 ; =0x04001050 - mov r1, #0 - strh r1, [r0] - add sp, #0x80 - pop {r3, r4, r5, pc} - .balign 4, 0 -_020832C8: .word _02101D60 -_020832CC: .word _02101ED4 -_020832D0: .word _02101FB4 -_020832D4: .word _02102078 -_020832D8: .word _02101E10 -_020832DC: .word 0xFFFF1FFF -_020832E0: .word 0x04001050 - thumb_func_end sub_020831A4 - - thumb_func_start sub_020832E4 -sub_020832E4: ; 0x020832E4 - push {r4, lr} - add r4, r0, #0 - lsl r1, r4, #0x18 - mov r0, #1 - lsr r1, r1, #0x18 - bl GfGfx_EngineATogglePlanes - lsl r1, r4, #0x18 - mov r0, #2 - lsr r1, r1, #0x18 - bl GfGfx_EngineATogglePlanes - lsl r1, r4, #0x18 - mov r0, #4 - lsr r1, r1, #0x18 - bl GfGfx_EngineATogglePlanes - mov r0, #8 - mov r1, #0 - bl GfGfx_EngineATogglePlanes - lsl r1, r4, #0x18 - mov r0, #0x10 - lsr r1, r1, #0x18 - bl GfGfx_EngineATogglePlanes - lsl r1, r4, #0x18 - mov r0, #1 - lsr r1, r1, #0x18 - bl GfGfx_EngineBTogglePlanes - mov r0, #2 - mov r1, #0 - bl GfGfx_EngineBTogglePlanes - mov r0, #0x10 - mov r1, #0 - bl GfGfx_EngineBTogglePlanes - pop {r4, pc} - thumb_func_end sub_020832E4 - thumb_func_start sub_02083334 sub_02083334: ; 0x02083334 push {r3, r4, r5, r6, r7, lr} @@ -4055,6 +3814,8 @@ _02101D4C: .byte 0x29, 0x29, 0x29, 0x00 _02101D54: .byte 0x70, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00 + + .global _02101D60 _02101D60: .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 _02101D70: @@ -4065,8 +3826,6 @@ _02101D80: .byte 0x30, 0x00, 0xE2, 0x00, 0xFF, 0xFF, 0x8D, 0x00, 0x74, 0x00, 0x60, 0x00, 0x6A, 0x00, 0x2F, 0x00 .byte 0x01, 0x00, 0x2B, 0x00, 0x3F, 0x00, 0x09, 0x00, 0x30, 0x00, 0xE2, 0x00, 0xFF, 0xFF - ; File boundary - _02101DBE: .byte 0x02, 0xE0 .byte 0x02, 0xE0, 0x03, 0xE0, 0x03, 0xE0, 0x04, 0xE0, 0x04, 0xE0, 0x04, 0xD0, 0x04, 0xD0, 0x07, 0xE0 @@ -4078,6 +3837,8 @@ _02101DD8: _02101DF2: .short 0x00E3, 0x00E4, 0x00F9, 0x00F8, 0x00E5, 0x00E6, 0x00F5 .short 0x00F6, 0x00F7, 0x00E7, 0x0001, 0x00EE, 0x00EF, 0xFFFF, 0x0000 + + .global _02101E10 _02101E10: .short 0x0000, 0x0000, 0x0000, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000 .short 0x0001, 0x041F, 0x0000, 0x0000, 0x0000, 0x0000 @@ -4099,6 +3860,8 @@ _02101E9C: .short 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x01DE, 0x01B3, 0x01BE, 0xFFFF _02101EB8: .short 0x013F, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF + + .global _02101ED4 _02101ED4: .short 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0x0003, 0x041E, 0x0100, 0x0000, 0x0000, 0x0000 _02101EF0: @@ -4115,6 +3878,8 @@ _02101F7C: .short 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x0001, 0x00E1, 0x00E2, 0xFFFF _02101F98: .short 0x01AD, 0x01AE, 0x01C4, 0x01C5, 0x01AB, 0x01AC, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0x01DE, 0x01DE, 0xFFFF + + .global _02101FB4 _02101FB4: .short 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0x0003, 0x041C, 0x0200, 0x0000, 0x0000, 0x0000 _02101FD0: @@ -4129,11 +3894,11 @@ _02102040: .short 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA, 0x01DD, 0x01DB, 0x01DC, 0x01DE, 0x01DE, 0xFFFF _0210205C: .short 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF + + .global _02102078 _02102078: .short 0x0000, 0x0000, 0x0000, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000, 0x0001, 0x001A, 0x0300, 0x0000, 0x0000, 0x0000, 0x008E, 0x0062, 0x0093, 0x00A1, 0x002F, 0x0001, 0x007C, 0x0074, 0x0060, 0x007E, 0x00F1, 0x0091, 0x0030, 0x00E2, 0xFFFF - ; File boundary - .balign 4, 0 _021020B4: .short 0x0000, 0x0000, 0x0001, 0x0000, 0x0002, 0x0000, 0x0003, 0x0000, 0x0004, 0x0000, 0x0005, 0x0000, 0x0006, 0x0000, 0x0008, 0x0000 @@ -4143,6 +3908,7 @@ _021020F8: .short 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF _0210211C: .short 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF + .global _02102140 _02102140: .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 @@ -4526,5 +4292,3 @@ _021104F8: .word _0210211C .word _0210211C .word _0210211C - - ; File boundary diff --git a/include/bg_window.h b/include/bg_window.h index a1492688f5..a9565a1535 100644 --- a/include/bg_window.h +++ b/include/bg_window.h @@ -206,12 +206,12 @@ BgConfig *BgConfig_Alloc(HeapID heapId); HeapID BgConfig_GetHeapId(BgConfig *bgConfig); void SetBothScreensModesAndDisable(const GraphicsModes *modes); void SetScreenModeAndDisable(const struct GraphicsModes *gfxModes, enum GFScreen screen); -void InitBgFromTemplateEx(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, u8 bgType, GFPlaneToggle enable); +void InitBgFromTemplateEx(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, u8 bgType, u8 enable); void InitBgFromTemplate(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, u8 bgType); void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value); void FreeBgTilemapBuffer(BgConfig *bgConfig, u8 bgId); void SetBgPriority(u8 bgId, u16 priority); -void ToggleBgLayer(u8 bgId, GFPlaneToggle toggle); +void ToggleBgLayer(u8 bgId, u8 toggle); void BgSetPosTextAndCommit(BgConfig *bgConfig, u8 bgId, enum BgPosAdjustOp op, int val); int Bg_GetXpos(const BgConfig *bgConfig, GFBgLayer bgId); int Bg_GetYpos(const BgConfig *bgConfig, GFBgLayer bgId); diff --git a/include/gf_gfx_planes.h b/include/gf_gfx_planes.h index f56e74b1f9..df03d5e1fc 100644 --- a/include/gf_gfx_planes.h +++ b/include/gf_gfx_planes.h @@ -50,10 +50,10 @@ typedef struct GraphicsBanks { void GfGfx_SetBanks(const GraphicsBanks *banks); void GfGfx_DisableEngineAPlanes(void); -void GfGfx_EngineATogglePlanes(GXPlaneMask planeMask, GFPlaneToggle enable); +void GfGfx_EngineATogglePlanes(u8 planeMask, u8 enable); void GfGfx_EngineASetPlanes(u32 planes); void GfGfx_DisableEngineBPlanes(void); -void GfGfx_EngineBTogglePlanes(GXPlaneMask planeMask, GFPlaneToggle enable); +void GfGfx_EngineBTogglePlanes(u8 planeMask, u8 enable); void GfGfx_EngineBSetPlanes(u32 planes); void GfGfx_BothDispOn(void); void GfGfx_SwapDisplay(void); diff --git a/include/naming_screen.h b/include/naming_screen.h index a468599fbf..329c7c6dd5 100644 --- a/include/naming_screen.h +++ b/include/naming_screen.h @@ -1,6 +1,7 @@ #ifndef POKEHEARTGOLD_NAMING_SCREEN_H #define POKEHEARTGOLD_NAMING_SCREEN_H +#include "launch_application.h" #include "options.h" #include "overlay_manager.h" #include "pm_string.h" @@ -8,7 +9,7 @@ extern const OVY_MGR_TEMPLATE gOverlayTemplate_NamingScreen; typedef struct NamingScreenArgs { - int kind; + NameScreenType kind; int playerGender; // monSpecies int monForm; int maxLen; @@ -22,7 +23,7 @@ typedef struct NamingScreenArgs { int *unk50; } NamingScreenArgs; -NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, int kind, int param, int maxLen, Options *options, int *a5); +NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, NameScreenType kind, int param, int maxLen, Options *options, int *a5); void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs); #endif // POKEHEARTGOLD_NAMING_SCREEN_H diff --git a/lib/include/nitro/gx/gx.h b/lib/include/nitro/gx/gx.h index e6e5802bca..ce4b7b7b0b 100644 --- a/lib/include/nitro/gx/gx.h +++ b/lib/include/nitro/gx/gx.h @@ -1,19 +1,19 @@ #ifndef NITRO_GX_GX_H_ #define NITRO_GX_GX_H_ -#include #include +#include #define GX_LCD_SIZE_X 256 #define GX_LCD_SIZE_Y 192 typedef enum { GX_DISPMODE_GRAPHICS = 0x01, - GX_DISPMODE_VRAM_A = 0x02, - GX_DISPMODE_VRAM_B = 0x06, - GX_DISPMODE_VRAM_C = 0x0a, - GX_DISPMODE_VRAM_D = 0x0e, - GX_DISPMODE_MMEM = 0x03 + GX_DISPMODE_VRAM_A = 0x02, + GX_DISPMODE_VRAM_B = 0x06, + GX_DISPMODE_VRAM_C = 0x0a, + GX_DISPMODE_VRAM_D = 0x0e, + GX_DISPMODE_MMEM = 0x03 } GXDispMode; typedef enum { @@ -54,22 +54,18 @@ typedef enum { } GXBGCharOffset; typedef enum { - GX_OBJVRAMMODE_CHAR_2D = (0 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (0 << REG_GX_DISPCNT_EXOBJ_SHIFT), - GX_OBJVRAMMODE_CHAR_1D_32K = - (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (0 << REG_GX_DISPCNT_EXOBJ_SHIFT), - GX_OBJVRAMMODE_CHAR_1D_64K = - (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (1 << REG_GX_DISPCNT_EXOBJ_SHIFT), - GX_OBJVRAMMODE_CHAR_1D_128K = - (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (2 << REG_GX_DISPCNT_EXOBJ_SHIFT), - GX_OBJVRAMMODE_CHAR_1D_256K = - (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (3 << REG_GX_DISPCNT_EXOBJ_SHIFT) + GX_OBJVRAMMODE_CHAR_2D = (0 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (0 << REG_GX_DISPCNT_EXOBJ_SHIFT), + GX_OBJVRAMMODE_CHAR_1D_32K = (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (0 << REG_GX_DISPCNT_EXOBJ_SHIFT), + GX_OBJVRAMMODE_CHAR_1D_64K = (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (1 << REG_GX_DISPCNT_EXOBJ_SHIFT), + GX_OBJVRAMMODE_CHAR_1D_128K = (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (2 << REG_GX_DISPCNT_EXOBJ_SHIFT), + GX_OBJVRAMMODE_CHAR_1D_256K = (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (3 << REG_GX_DISPCNT_EXOBJ_SHIFT) } GXOBJVRamModeChar; typedef enum { GX_POWER_OFF = 0, GX_POWER_2D_MAIN = 1 << REG_GX_POWCNT_E2DG_SHIFT, - GX_POWER_2D_SUB = 1 << REG_GX_POWCNT_E2DGB_SHIFT, + GX_POWER_2D_SUB = 1 << REG_GX_POWCNT_E2DGB_SHIFT, GX_POWER_RE = 1 << REG_GX_POWCNT_RE_SHIFT, GX_POWER_GE = 1 << REG_GX_POWCNT_GE_SHIFT, @@ -97,6 +93,13 @@ typedef enum { GX_PLANEMASK_ALL = GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_BG2 | GX_PLANEMASK_BG3 | GX_PLANEMASK_OBJ, } GXPlaneMask; +typedef enum { + GX_WNDMASK_NONE = 0x00, + GX_WNDMASK_W0 = 0x01, + GX_WNDMASK_W1 = 0x02, + GX_WNDMASK_OW = 0x04 +} GXWndMask; + void GX_SetGraphicsMode(GXDispMode dispMode, GXBGMode bgMode, GXBG0As bg0_2d3d); void GXS_SetGraphicsMode(GXBGMode bgMode); @@ -123,15 +126,12 @@ static inline void GX_SetVCountEqVal(s32 val) { reg_GX_DISPSTAT = (u16)(reg_GX_DISPSTAT & (REG_GX_DISPSTAT_VBLK_MASK | REG_GX_DISPSTAT_HBLK_MASK | REG_GX_DISPSTAT_LYC_MASK | REG_GX_DISPSTAT_VBI_MASK | REG_GX_DISPSTAT_HBI_MASK | REG_GX_DISPSTAT_VQI_MASK) | ((val & 0xFF) << 8) | ((val & 0x100) >> 1)); } -static inline void GX_SetBGScrOffset(GXBGScrOffset offset) -{ - reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_BGSCREENOFFSET_MASK) | - (offset << REG_GX_DISPCNT_BGSCREENOFFSET_SHIFT)); +static inline void GX_SetBGScrOffset(GXBGScrOffset offset) { + reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_BGSCREENOFFSET_MASK) | (offset << REG_GX_DISPCNT_BGSCREENOFFSET_SHIFT)); } static inline void GX_SetBGCharOffset(GXBGCharOffset offset) { - reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_BGCHAROFFSET_MASK) | - (offset << REG_GX_DISPCNT_BGCHAROFFSET_SHIFT)); + reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_BGCHAROFFSET_MASK) | (offset << REG_GX_DISPCNT_BGCHAROFFSET_SHIFT)); } s32 GX_VBlankIntr(BOOL enable); @@ -196,4 +196,4 @@ static inline int GXS_GetMasterBrightness(void) { return GXx_GetMasterBrightness_(®_GXS_DB_MASTER_BRIGHT); } -#endif //NITRO_GX_GX_H_ +#endif // NITRO_GX_GX_H_ diff --git a/src/bg_window.c b/src/bg_window.c index e7147034e4..80bea8596f 100644 --- a/src/bg_window.c +++ b/src/bg_window.c @@ -124,7 +124,7 @@ void SetScreenModeAndDisable(const struct GraphicsModes *gfxModes, enum GFScreen } } -void InitBgFromTemplateEx(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, u8 bgType, GFPlaneToggle enable) { +void InitBgFromTemplateEx(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, u8 bgType, u8 enable) { u8 screenSize = TranslateGFBgModePairToGXScreenSize((enum GFBgScreenSize) template->size, (enum GFBgType)bgType); switch (bgId) { @@ -624,7 +624,7 @@ void SetBgPriority(u8 bgId, u16 priority) { } } -void ToggleBgLayer(u8 bgId, GFPlaneToggle toggle) { +void ToggleBgLayer(u8 bgId, u8 toggle) { switch (bgId) { case GF_BG_LYR_MAIN_0: GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG0, toggle); diff --git a/src/communication_error.c b/src/communication_error.c index 16fc8e1457..74c8582408 100644 --- a/src/communication_error.c +++ b/src/communication_error.c @@ -148,7 +148,7 @@ void ShowCommunicationError(HeapID heapId, u32 error, u32 errorCode) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sCommunicationErrorGraphicsBanks); diff --git a/src/error_message_reset.c b/src/error_message_reset.c index 65f9f0396e..042d984eb7 100644 --- a/src/error_message_reset.c +++ b/src/error_message_reset.c @@ -116,7 +116,7 @@ void PrintErrorMessageAndReset(void) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sErrorMessageBanksConfig); diff --git a/src/gf_gfx_planes.c b/src/gf_gfx_planes.c index cb1c0f07f3..ff73cad70c 100644 --- a/src/gf_gfx_planes.c +++ b/src/gf_gfx_planes.c @@ -36,7 +36,7 @@ void GfGfx_DisableEngineAPlanes(void) { sEngineAPlanes = 0; } -void GfGfx_EngineATogglePlanes(GXPlaneMask planeMask, GFPlaneToggle enable) { +void GfGfx_EngineATogglePlanes(u8 planeMask, u8 enable) { if (enable == GF_PLANE_TOGGLE_ON) { if (sEngineAPlanes & planeMask) { return; @@ -59,7 +59,7 @@ void GfGfx_DisableEngineBPlanes(void) { sEngineBPlanes = 0; } -void GfGfx_EngineBTogglePlanes(GXPlaneMask planeMask, GFPlaneToggle enable) { +void GfGfx_EngineBTogglePlanes(u8 planeMask, u8 enable) { if (enable == GF_PLANE_TOGGLE_ON) { if (sEngineBPlanes & planeMask) { return; diff --git a/src/intro_movie.c b/src/intro_movie.c index 0aba237836..c0d199a00b 100644 --- a/src/intro_movie.c +++ b/src/intro_movie.c @@ -154,7 +154,7 @@ static BOOL IntroMovie_Exit(OVY_MANAGER *man, int *state) { Main_SetHBlankIntrCB(NULL, NULL); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); sub_0200FB70(); SetLCRNGSeed(data->savedLCRngSeed); diff --git a/src/intro_movie_scene_3.c b/src/intro_movie_scene_3.c index 004f26228e..886c68caad 100644 --- a/src/intro_movie_scene_3.c +++ b/src/intro_movie_scene_3.c @@ -336,7 +336,7 @@ static BOOL IntroMovie_Scene3_Main(IntroMovieOverlayData *data, IntroMovieScene3 break; case INTRO_SCENE3_LOAD_ROCKETS: if (IntroMovie_WaitBgScrollAnim(bgAnimCnt->scroll, GF_BG_LYR_SUB_2)) { - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfxLoader_LoadCharData(NARC_demo_opening_gs_opening, NARC_gs_opening_gs_opening_00000041_NCGR_lz, bgConfig, GF_BG_LYR_SUB_3, 0, 0x4000, TRUE, HEAP_ID_INTRO_MOVIE); IntroMovie_AdvanceSceneStep(data); diff --git a/src/intro_movie_scene_4.c b/src/intro_movie_scene_4.c index add9aa550b..d4261877ad 100644 --- a/src/intro_movie_scene_4.c +++ b/src/intro_movie_scene_4.c @@ -189,7 +189,7 @@ static BOOL IntroMovie_Scene4_Main(IntroMovieOverlayData *data, IntroMovieScene4 IntroMovie_StartSpriteAnimAndMakeVisible(sceneData->hand2Sprite, FALSE); GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG1, GF_PLANE_TOGGLE_OFF); GfGfx_EngineBTogglePlanes(GX_PLANEMASK_BG1, GF_PLANE_TOGGLE_OFF); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); IntroMovie_AdvanceSceneStep(data); } diff --git a/src/intro_movie_scenes_lib.c b/src/intro_movie_scenes_lib.c index c301dc19b5..2cae0c5ac1 100644 --- a/src/intro_movie_scenes_lib.c +++ b/src/intro_movie_scenes_lib.c @@ -325,7 +325,7 @@ void Task_IntroMovie_WindowPanEffect(SysTask *task, void *pVoid) { void IntroMovie_WindowsOn_SetInsideOutsidePlanes(int winIn, int winOut, u8 topScreenEffect, u8 bottomScreenEffect, int whichScreen) { if (whichScreen) { - GX_SetVisibleWnd(3); // both + GX_SetVisibleWnd(GX_WNDMASK_W0 | GX_WNDMASK_W1); G2_SetWnd0InsidePlane(winIn, topScreenEffect); G2_SetWnd1InsidePlane(winIn, topScreenEffect); G2_SetWndOutsidePlane(winOut, topScreenEffect); @@ -374,7 +374,7 @@ int IntroMovie_GetTotalFrameCount(IntroMovieOverlayData *data) { void IntroMovie_InitBgAnimGxState(IntroMovieOverlayData *data) { G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); for (int i = 0; i < 8; ++i) { BgSetPosTextAndCommit(data->bgConfig, i, BG_POS_OP_SET_X, 0); @@ -456,7 +456,7 @@ void Task_IntroMovie_CircleWipeEffect(SysTask *task, void *pVoid) { sub_0200FBF4(screen, RGB_BLACK); } else { if (effectData->whichScreen) { - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); } else { GXS_SetVisibleWnd(0); } diff --git a/src/naming_screen.c b/src/naming_screen.c index a786432003..3706455576 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -27,12 +27,16 @@ #include "unk_0200B150.h" #include "unk_0200FA24.h" #include "unk_020163E0.h" +#include "vram_transfer_manager.h" typedef struct NamingScreenAppData { NameScreenType type; int unk_004; int unk_008; - u8 filler_00C[0x10]; + int unk_00C; + int unk_010; + u8 filler_014[0x4]; + Options *unk_018; int unk_01C; int unk_020; u8 filler_024[0xC]; @@ -93,7 +97,7 @@ typedef struct NamingScreenAppData { UnkStruct_020163E0 *unk_5C4; BOOL unk_5C8; int unk_5CC; - u8 filler_5D0[0x4]; + int *unk_5D0; } NamingScreenAppData; // size: 0x5D4 BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); @@ -387,7 +391,7 @@ BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { ObjPlttTransfer_Destroy(); sub_02083614(data->bgConfig, data->unk_3B8); FontID_SetAccessLazy(0); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); FontID_Release(2); if (data->unk_180 != NULL) { String_Delete(data->unk_180); @@ -409,7 +413,7 @@ BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { // Public functions // ------------------------------- -NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, int kind, int param, int maxLen, Options *options, int *a5) { +NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, NameScreenType kind, int param, int maxLen, Options *options, int *a5) { NamingScreenArgs *ret = AllocFromHeap(heapId, sizeof(NamingScreenArgs)); ret->kind = kind; ret->playerGender = param; @@ -432,3 +436,86 @@ void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs) { String_Delete(namingScreenArgs->nameInputString); FreeToHeap(namingScreenArgs); } + +// ------------------------------- +// Back to private scope +// ------------------------------- + +void sub_02083140(void *param) { + GF_RunVramTransferTasks(); + OamManager_ApplyAndResetBuffers(); + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args) { + data->type = args->kind; + data->unk_004 = args->playerGender; + data->unk_008 = args->monForm; + data->unk_00C = args->maxLen; + data->unk_010 = args->monGender; + data->unk_018 = args->options; + data->unk_5D0 = args->unk50; +} + +void sub_02083184(void) { + extern const GraphicsBanks _02102140; + GraphicsBanks graphicsBanks = _02102140; + GfGfx_SetBanks(&graphicsBanks); +} + +void sub_020831A4(BgConfig *bgConfig) { + { + extern const GraphicsModes _02101D60; + GraphicsModes graphicsModes = _02101D60; + SetBothScreensModesAndDisable(&graphicsModes); + } + + { + extern const BgTemplate _02101ED4; + BgTemplate bgTemplate = _02101ED4; + InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_0, &bgTemplate, GF_BG_TYPE_TEXT); + BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_0); + } + + { + extern const BgTemplate _02101FB4; + BgTemplate bgTemplate = _02101FB4; + InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_1, &bgTemplate, GF_BG_TYPE_TEXT); + BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_1); + } + + { + extern const BgTemplate _02102078; + BgTemplate bgTemplate = _02102078; + InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_2, &bgTemplate, GF_BG_TYPE_TEXT); + BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_2); + } + + { + extern const BgTemplate _02101E10; + BgTemplate bgTemplate = _02101E10; + InitBgFromTemplate(bgConfig, GF_BG_LYR_SUB_0, &bgTemplate, GF_BG_TYPE_TEXT); + BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_SUB_0); + } + + sub_020832E4(0); + BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, HEAP_ID_NAMING_SCREEN); + BG_ClearCharDataRange(GF_BG_LYR_SUB_0, 0x20, 0, HEAP_ID_NAMING_SCREEN); + GX_SetVisibleWnd(GX_WNDMASK_W0); + G2_SetWnd0InsidePlane(GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_OBJ, 1); + G2_SetWndOutsidePlane(GX_WND_PLANEMASK_BG0 | GX_WND_PLANEMASK_BG1 | GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_BG3 | GX_WND_PLANEMASK_OBJ, + 1); + G2_SetWnd0Position(0, 0, 255, 64); + G2S_BlendNone(); +} + +void sub_020832E4(int a0) { + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG0, a0); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG1, a0); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG2, a0); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG3, GF_PLANE_TOGGLE_OFF); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_OBJ, a0); + GfGfx_EngineBTogglePlanes(GX_PLANEMASK_BG0, a0); + GfGfx_EngineBTogglePlanes(GX_PLANEMASK_BG1, GF_PLANE_TOGGLE_OFF); + GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_OFF); +} diff --git a/src/save_data_read_error.c b/src/save_data_read_error.c index 6aa69035da..469351fe86 100644 --- a/src/save_data_read_error.c +++ b/src/save_data_read_error.c @@ -87,7 +87,7 @@ void ShowSaveDataReadError(HeapID heapId) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sDataReadErrorBanksConfig); @@ -146,7 +146,7 @@ void ShowGBACartRemovedError(HeapID heapId) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sDataReadErrorBanksConfig); diff --git a/src/save_data_write_error.c b/src/save_data_write_error.c index 37f2524024..4cdbf1209b 100644 --- a/src/save_data_write_error.c +++ b/src/save_data_write_error.c @@ -96,7 +96,7 @@ void ShowSaveDataWriteError(HeapID heapId, int code) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sDataWriteErrorBanksConfig); diff --git a/src/wfc_user_info_warning.c b/src/wfc_user_info_warning.c index 97a3b89034..c09c0b8c93 100644 --- a/src/wfc_user_info_warning.c +++ b/src/wfc_user_info_warning.c @@ -85,7 +85,7 @@ void ShowWFCUserInfoWarning(HeapID heapId, int a1) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sWFCWarningMsgBanksConfig); From 688eea4d66a000afbc03575815c7dbb19cfe7bf1 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 10 Oct 2024 20:10:42 -0400 Subject: [PATCH 06/25] through sub_020834FC --- asm/unk_02082908.s | 391 +++------------------------------------- include/naming_screen.h | 2 +- src/naming_screen.c | 122 +++++++++++-- 3 files changed, 131 insertions(+), 384 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index 091586eccb..e7f87e780d 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -18,354 +18,6 @@ .text - thumb_func_start sub_02083334 -sub_02083334: ; 0x02083334 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x10 - add r4, r0, #0 - add r0, r1, #0 - bl OverlayManager_GetArgs - add r7, r0, #0 - ldr r0, _020834E4 ; =0x0000045C - mov r1, #4 - str r1, [r4, r0] - add r0, #0xc - add r0, r4, r0 - mov r1, #0 - bl sub_0208423C - ldr r6, _020834E8 ; =0x00000464 - mov r0, #0x16 - ldr r3, [r4, r6] - mov r5, #0xc - lsl r0, r0, #4 - lsl r1, r3, #0x18 - mul r5, r3 - add r3, r4, r5 - add r5, r6, #4 - ldr r0, [r4, r0] - ldr r3, [r3, r5] - lsr r1, r1, #0x18 - mov r2, #0 - bl BgSetPosTextAndCommit - ldr r3, [r4, r6] - mov r5, #0xc - mov r0, #0x16 - lsl r0, r0, #4 - lsl r1, r3, #0x18 - mul r5, r3 - add r3, r4, r5 - add r6, #8 - ldr r0, [r4, r0] - ldr r3, [r3, r6] - lsr r1, r1, #0x18 - mov r2, #3 - bl BgSetPosTextAndCommit - ldr r6, _020834E8 ; =0x00000464 - mov r0, #1 - ldr r1, [r4, r6] - mov r5, #0xc - add r3, r1, #0 - eor r3, r0 - mov r0, #0x16 - lsl r0, r0, #4 - lsl r1, r3, #0x18 - mul r5, r3 - add r3, r4, r5 - add r5, r6, #4 - ldr r0, [r4, r0] - ldr r3, [r3, r5] - lsr r1, r1, #0x18 - mov r2, #0 - bl BgSetPosTextAndCommit - ldr r1, [r4, r6] - mov r0, #1 - add r3, r1, #0 - eor r3, r0 - mov r5, #0xc - mov r0, #0x16 - lsl r0, r0, #4 - lsl r1, r3, #0x18 - mul r5, r3 - add r3, r4, r5 - add r6, #8 - ldr r0, [r4, r0] - ldr r3, [r3, r6] - lsr r1, r1, #0x18 - mov r2, #3 - bl BgSetPosTextAndCommit - mov r1, #0x46 - ldr r0, _020834EC ; =0x0000FFFF - lsl r1, r1, #2 - strh r0, [r4, r1] - ldr r0, [r7, #0x18] - cmp r0, #0 - beq _020833E8 - add r1, r4, r1 - mov r2, #0x20 - bl CopyStringToU16Array -_020833E8: - add r1, r4, #0 - mov r0, #1 - add r1, #0xd8 - mov r2, #0x40 - bl MIi_CpuClear16 - ldr r0, [r4] - cmp r0, #1 - bne _0208342E - mov r0, #0x12 - bl AllocMonZeroed - mov r3, #0xa - str r3, [sp] - str r3, [sp, #4] - str r3, [sp, #8] - str r3, [sp, #0xc] - ldr r1, [r4, #4] - add r5, r0, #0 - mov r2, #5 - bl CreateMon - add r0, r5, #0 - bl Mon_GetBoxMon - add r2, r0, #0 - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0 - bl BufferBoxMonSpeciesName - add r0, r5, #0 - bl FreeToHeap -_0208342E: - ldr r0, [r7, #0x44] - cmp r0, #0 - beq _02083438 - mov r0, #1 - str r0, [r4, #0x14] -_02083438: - ldr r2, [r4] - mov r1, #0x5a - lsl r1, r1, #2 - lsl r3, r2, #2 - ldr r2, _020834F0 ; =_021020B4 - ldr r0, [r4, r1] - add r1, r1, #4 - ldr r2, [r2, r3] - ldr r1, [r4, r1] - mov r3, #0x12 - bl ReadMsgData_ExpandPlaceholders - mov r1, #0x5e - lsl r1, r1, #2 - str r0, [r4, r1] - add r0, r1, #0 - sub r0, #0x10 - sub r1, #0xc - ldr r0, [r4, r0] - ldr r1, [r4, r1] - mov r2, #9 - mov r3, #0x12 - bl ReadMsgData_ExpandPlaceholders - mov r1, #0x5f - lsl r1, r1, #2 - str r0, [r4, r1] - sub r1, #0x10 - ldr r0, [r4, r1] - mov r1, #7 - bl NewString_ReadMsgData - mov r1, #0x61 - lsl r1, r1, #2 - str r0, [r4, r1] - sub r1, #0x6c - add r0, r4, r1 - bl StringLength - mov r1, #0x56 - lsl r1, r1, #2 - strh r0, [r4, r1] - mov r0, #0 - mov r2, #1 - str r0, [r4, #0x1c] - str r2, [r4, #0x20] - sub r1, r2, #2 - str r1, [r4, #0x24] - str r1, [r4, #0x28] - str r2, [r4, #0x30] - ldr r2, _020834F4 ; =0x00000484 - str r0, [r4, #0x34] - str r1, [r4, r2] - add r1, r2, #4 - str r0, [r4, r1] - add r2, #8 - str r0, [r4, r2] - ldr r1, [r4, #0xc] - ldr r2, _020834EC ; =0x0000FFFF - lsl r1, r1, #1 - add r1, r4, r1 - add r1, #0xd8 - strh r2, [r1] - mov r1, #0x49 - add r3, r4, #0 - add r2, r0, #0 - lsl r1, r1, #4 -_020834BE: - add r0, r0, #1 - str r2, [r3, r1] - add r3, r3, #4 - cmp r0, #7 - blt _020834BE - ldr r0, [r4] - cmp r0, #4 - bne _020834D8 - ldr r0, _020834F8 ; =0x0000049C - mov r1, #1 - add sp, #0x10 - str r1, [r4, r0] - pop {r3, r4, r5, r6, r7, pc} -_020834D8: - mov r0, #0x49 - mov r1, #1 - lsl r0, r0, #4 - str r1, [r4, r0] - add sp, #0x10 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_020834E4: .word 0x0000045C -_020834E8: .word 0x00000464 -_020834EC: .word 0x0000FFFF -_020834F0: .word _021020B4 -_020834F4: .word 0x00000484 -_020834F8: .word 0x0000049C - thumb_func_end sub_02083334 - - thumb_func_start sub_020834FC -sub_020834FC: ; 0x020834FC - push {r4, r5, r6, r7, lr} - sub sp, #0x14 - add r5, r0, #0 - add r0, r1, #0 - bl OverlayManager_GetArgs - add r4, r0, #0 - ldr r0, [r4, #0x44] - cmp r0, #0 - beq _0208360C - mov r0, #0xc8 - mov r1, #0x12 - bl String_New - add r7, r0, #0 - mov r0, #6 - mov r1, #0 - lsl r0, r0, #6 - str r1, [r5, r0] - ldr r0, [r4, #0x48] - bl PCStorage_GetActiveBox - add r6, r0, #0 - ldr r0, [r4, #0x48] - bl PCStorage_FindFirstBoxWithEmptySlot - str r0, [sp, #0x10] - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r2, [r4, #0x48] - mov r1, #1 - add r3, r6, #0 - bl BufferPCBoxName - ldr r0, [sp, #0x10] - cmp r6, r0 - beq _02083560 - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r2, [r4, #0x48] - ldr r3, [sp, #0x10] - mov r1, #2 - bl BufferPCBoxName - ldr r0, [r4, #0x44] - add r0, r0, #2 - str r0, [r4, #0x44] - b _02083570 -_02083560: - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r2, [r4, #0x48] - mov r1, #2 - add r3, r6, #0 - bl BufferPCBoxName -_02083570: - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r0, [r5, r0] - cmp r0, #0 - beq _02083586 - add r0, r5, #0 - add r0, #0xd8 - bl sub_02082EC0 - cmp r0, #0 - beq _020835BC -_02083586: - mov r0, #0x12 - bl AllocMonZeroed - mov r3, #0 - str r3, [sp] - str r3, [sp, #4] - str r3, [sp, #8] - str r3, [sp, #0xc] - ldr r1, [r5, #4] - add r6, r0, #0 - mov r2, #1 - bl CreateMon - add r0, r6, #0 - bl Mon_GetBoxMon - add r2, r0, #0 - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #0 - bl BufferBoxMonSpeciesName - add r0, r6, #0 - bl FreeToHeap - b _020835EA -_020835BC: - mov r1, #0x56 - lsl r1, r1, #2 - ldrh r1, [r5, r1] - ldr r0, _02083610 ; =0x0000FFFF - lsl r1, r1, #1 - add r1, r5, r1 - add r1, #0xd8 - strh r0, [r1] - add r1, r5, #0 - add r0, r7, #0 - add r1, #0xd8 - bl CopyU16ArrayToString - mov r1, #0 - str r1, [sp] - mov r0, #0x5a - str r1, [sp, #4] - lsl r0, r0, #2 - ldr r0, [r5, r0] - add r2, r7, #0 - add r3, r1, #0 - bl BufferString -_020835EA: - mov r1, #0x5a - lsl r1, r1, #2 - ldr r0, [r5, r1] - add r1, #0xc - ldr r1, [r5, r1] - ldr r2, [r4, #0x44] - mov r3, #0x12 - bl ReadMsgData_ExpandPlaceholders - mov r1, #6 - lsl r1, r1, #6 - str r0, [r5, r1] - mov r0, #1 - str r0, [r5, #0x14] - add r0, r7, #0 - bl String_Delete -_0208360C: - add sp, #0x14 - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_02083610: .word 0x0000FFFF - thumb_func_end sub_020834FC - thumb_func_start sub_02083614 sub_02083614: ; 0x02083614 push {r4, r5, r6, lr} @@ -3816,8 +3468,8 @@ _02101D54: .byte 0x70, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00 .global _02101D60 -_02101D60: - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +_02101D60: // GraphicsModes + .word 0x00000001, 0x00000000, 0x00000000, 0x00000000 _02101D70: .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 _02101D80: @@ -3839,9 +3491,10 @@ _02101DF2: .short 0x00F6, 0x00F7, 0x00E7, 0x0001, 0x00EE, 0x00EF, 0xFFFF, 0x0000 .global _02101E10 -_02101E10: - .short 0x0000, 0x0000, 0x0000, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000 - .short 0x0001, 0x041F, 0x0000, 0x0000, 0x0000, 0x0000 +_02101E10: // BgTemplate + .word 0x00000000, 0x00000000, 0x00000800, 0x00000000 + .byte 0x01, 0x00, 0x1F, 0x04, 0x00, 0x00, 0x00, 0x00 + .word 0x00000000 _02101E2C: .short 0x01DE, 0x01DE .short 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE @@ -3862,8 +3515,10 @@ _02101EB8: .short 0x013F, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF .global _02101ED4 -_02101ED4: - .short 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0x0003, 0x041E, 0x0100, 0x0000, 0x0000, 0x0000 +_02101ED4: // BgTemplate + .word 0x00000000, 0x00000000, 0x00001000, 0x00000000 + .byte 0x03, 0x00, 0x1E, 0x04, 0x00, 0x01, 0x00, 0x00 + .word 0x00000000 _02101EF0: .short 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x01DE, 0x01AD, 0x01AE, 0xFFFF _02101F0C: @@ -3880,8 +3535,10 @@ _02101F98: .short 0x01AD, 0x01AE, 0x01C4, 0x01C5, 0x01AB, 0x01AC, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0x01DE, 0x01DE, 0xFFFF .global _02101FB4 -_02101FB4: - .short 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0x0003, 0x041C, 0x0200, 0x0000, 0x0000, 0x0000 +_02101FB4: // BgTemplate + .word 0x00000000, 0x00000000, 0x00001000, 0x00000000 + .byte 0x03, 0x00, 0x1C, 0x04, 0x00, 0x02, 0x00, 0x00 + .word 0x00000000 _02101FD0: .short 0x01B4, 0x01B5, 0x01B2, 0x01B3, 0x01B9, 0x01BA, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF _02101FEC: @@ -3896,12 +3553,18 @@ _0210205C: .short 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF .global _02102078 -_02102078: - .short 0x0000, 0x0000, 0x0000, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000, 0x0001, 0x001A, 0x0300, 0x0000, 0x0000, 0x0000, 0x008E, 0x0062, 0x0093, 0x00A1, 0x002F, 0x0001, 0x007C, 0x0074, 0x0060, 0x007E, 0x00F1, 0x0091, 0x0030, 0x00E2, 0xFFFF +_02102078: // BgTemplate + .word 0x00000000, 0x00000000, 0x00000800, 0x00000000 + .byte 0x01, 0x00, 0x1A, 0x00, 0x00, 0x03, 0x00, 0x00 + .word 0x00000000 + +_02102094: + .short 0x008E, 0x0062, 0x0093, 0x00A1, 0x002F, 0x0001, 0x007C, 0x0074, 0x0060, 0x007E, 0x00F1, 0x0091, 0x0030, 0x00E2, 0xFFFF .balign 4, 0 + .global _021020B4 _021020B4: - .short 0x0000, 0x0000, 0x0001, 0x0000, 0x0002, 0x0000, 0x0003, 0x0000, 0x0004, 0x0000, 0x0005, 0x0000, 0x0006, 0x0000, 0x0008, 0x0000 + .word 0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000008 _021020D4: .short 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF _021020F8: @@ -3909,10 +3572,10 @@ _021020F8: _0210211C: .short 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF .global _02102140 -_02102140: - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +_02102140: // GraphicsBanks + .word 0x00000001, 0x00000000, 0x00000004, 0x00000000 + .word 0x00000002, 0x00000000, 0x00000100, 0x00000000 + .word 0x00000000, 0x00000000 _02102168: .word 0, 0 .word 0, -1 diff --git a/include/naming_screen.h b/include/naming_screen.h index 329c7c6dd5..075830fd85 100644 --- a/include/naming_screen.h +++ b/include/naming_screen.h @@ -18,7 +18,7 @@ typedef struct NamingScreenArgs { String *nameInputString; u16 unk1C[20]; int unk44; - int unk48; + PCStorage *unk48; Options *options; int *unk50; } NamingScreenArgs; diff --git a/src/naming_screen.c b/src/naming_screen.c index 3706455576..74637d9c5d 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -35,11 +35,13 @@ typedef struct NamingScreenAppData { int unk_008; int unk_00C; int unk_010; - u8 filler_014[0x4]; + int unk_014; Options *unk_018; int unk_01C; int unk_020; - u8 filler_024[0xC]; + int unk_024; + int unk_028; + int unk_02C; int unk_030; int unk_034; u8 unk_038[0x2]; @@ -82,11 +84,13 @@ typedef struct NamingScreenAppData { int unk_458; int unk_45C; int unk_460; - u8 unk_464[4]; - u8 unk_468[4]; - u8 filler_46C[0x24]; - int unk_490[6]; - int unk_4A8; + int unk_464; + VecFx32 unk_468[2]; + u8 filler_480[4]; + int unk_484; + int unk_488; + int unk_48C; + int unk_490[7]; void *unk_4AC; NNSG2dCharacterData *unk_4B0; void *unk_4B4; @@ -112,7 +116,7 @@ BOOL sub_02082EC0(const u16 *s); void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args); void sub_02083184(void); void sub_020831A4(BgConfig *bgConfig); -void sub_020832E4(int a0); +void sub_020832E4(GFPlaneToggle enable); void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan); void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan); void sub_02083614(BgConfig *bgConfig, void *a1); @@ -120,8 +124,9 @@ void sub_02083654(NamingScreenAppData *data, NARC *narc); void sub_0208377C(void); void sub_020837AC(NamingScreenAppData *data, NARC *narc); void sub_020839EC(NamingScreenAppData *data); -void sub_02083D34(BgConfig *bgConfig, void *a1, void *a2, int a3, void *a4, void *a5, void *a6, const u16 *a7); +void sub_02083D34(BgConfig *bgConfig, void *a1, void *a2, int a3, int *a4, VecFx32 *a5, void *a6, const u16 *a7); void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); +void sub_0208423C(VecFx32 *a0, int a1); void sub_0208432C(NamingScreenAppData *data); void sub_02084740(void *a0, u16 *a1, u16 a2, void *a3, void *a4, String *a5); void sub_02084830(u16 (*a0)[13], int a1); @@ -132,6 +137,8 @@ void sub_02084500(void *a0); static NamingScreenAppData *_021D43B0; +extern const int _021020B4[8]; + BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { NamingScreenAppData *data; NARC *narc; @@ -169,7 +176,7 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { sub_02084740(data->unk_3F8, data->unk_0D8, data->unk_158, &data->unk_15A, data->unk_4C4, data->unk_17C); sub_02004EC4(0x34, 0, 0); BeginNormalPaletteFade(0, 1, 1, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); - sub_020832E4(1); + sub_020832E4(GF_PLANE_TOGGLE_ON); GfGfx_SetMainDisplay(PM_LCD_BOTTOM); NARC_Delete(narc); ++(*pState); @@ -238,7 +245,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { case 6: if (!TextPrinterCheckActive(data->unk_458)) { PlaySE(SEQ_SE_DP_PIRORIRO); - ++data->unk_4A8; + ++data->unk_490[6]; data->unk_5CC = 0; data->unk_45C = 7; } @@ -251,7 +258,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { } break; } - sub_02083D34(data->bgConfig, data->unk_3B8, &data->unk_45C, data->unk_460, data->unk_464, data->unk_468, data->unk_32C, data->unk_4B0->pRawData); + sub_02083D34(data->bgConfig, data->unk_3B8, &data->unk_45C, data->unk_460, &data->unk_464, data->unk_468, data->unk_32C, data->unk_4B0->pRawData); sub_02084F3C(data->unk_490, data->unk_32C, data->unk_460); sub_02084500(data->unk_038); break; @@ -498,7 +505,7 @@ void sub_020831A4(BgConfig *bgConfig) { BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_SUB_0); } - sub_020832E4(0); + sub_020832E4(GF_PLANE_TOGGLE_OFF); BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, HEAP_ID_NAMING_SCREEN); BG_ClearCharDataRange(GF_BG_LYR_SUB_0, 0x20, 0, HEAP_ID_NAMING_SCREEN); GX_SetVisibleWnd(GX_WNDMASK_W0); @@ -509,13 +516,90 @@ void sub_020831A4(BgConfig *bgConfig) { G2S_BlendNone(); } -void sub_020832E4(int a0) { - GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG0, a0); - GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG1, a0); - GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG2, a0); +void sub_020832E4(GFPlaneToggle enable) { + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG0, enable); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG1, enable); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG2, enable); GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG3, GF_PLANE_TOGGLE_OFF); - GfGfx_EngineATogglePlanes(GX_PLANEMASK_OBJ, a0); - GfGfx_EngineBTogglePlanes(GX_PLANEMASK_BG0, a0); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_OBJ, enable); + GfGfx_EngineBTogglePlanes(GX_PLANEMASK_BG0, enable); GfGfx_EngineBTogglePlanes(GX_PLANEMASK_BG1, GF_PLANE_TOGGLE_OFF); GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_OFF); } + +void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { + NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); + + data->unk_45C = 4; + sub_0208423C(data->unk_468, 0); + BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_X, data->unk_468[data->unk_464].x); + BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_Y, data->unk_468[data->unk_464].y); + BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_X, data->unk_468[data->unk_464 ^ 1].x); + BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_Y, data->unk_468[data->unk_464 ^ 1].y); + data->unk_118[0] = EOS; + if (args->nameInputString != NULL) { + CopyStringToU16Array(args->nameInputString, data->unk_118, 32); + } + MI_CpuFill16(data->unk_0D8, 1, sizeof(data->unk_0D8)); + if (data->type == NAME_SCREEN_POKEMON) { + Pokemon *mon = AllocMonZeroed(HEAP_ID_NAMING_SCREEN); + CreateMon(mon, data->unk_004, 5, 10, 10, 10, 10, 10); + BufferBoxMonSpeciesName(data->msgFormat, 0, Mon_GetBoxMon(mon)); + FreeToHeap(mon); + } + if (args->unk44) { + data->unk_014 = 1; + } + data->unk_178 = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, _021020B4[data->type], HEAP_ID_NAMING_SCREEN); + data->unk_17C = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, msg_0249_00009, HEAP_ID_NAMING_SCREEN); + data->unk_184 = NewString_ReadMsgData(data->msgData_249, msg_0249_00007); + data->unk_158 = StringLength(data->unk_118); + data->unk_01C = 0; + data->unk_020 = 1; + data->unk_024 = -1; + data->unk_028 = -1; + data->unk_030 = 1; + data->unk_034 = 0; + data->unk_484 = -1; + data->unk_488 = 0; + data->unk_48C = 0; + data->unk_0D8[data->unk_00C] = EOS; + for (int i = 0; i < 7; ++i) { + data->unk_490[i] = 0; + } + if (data->type == NAME_SCREEN_UNK4) { + data->unk_490[3] = 1; + } else { + data->unk_490[0] = 1; + } +} + +void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { + NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); + if (args->unk44 != 0) { + String *string = String_New(200, HEAP_ID_NAMING_SCREEN); + data->unk_180 = NULL; + int boxno = PCStorage_GetActiveBox(args->unk48); + int nextOpenBoxNo = PCStorage_FindFirstBoxWithEmptySlot(args->unk48); + BufferPCBoxName(data->msgFormat, 1, args->unk48, boxno); + if (boxno != nextOpenBoxNo) { + BufferPCBoxName(data->msgFormat, 2, args->unk48, nextOpenBoxNo); + args->unk44 += 2; + } else { + BufferPCBoxName(data->msgFormat, 2, args->unk48, boxno); + } + if (data->unk_158 == 0 || sub_02082EC0(data->unk_0D8)) { + Pokemon *mon = AllocMonZeroed(HEAP_ID_NAMING_SCREEN); + CreateMon(mon, data->unk_004, 1, 0, 0, 0, 0, 0); + BufferBoxMonSpeciesName(data->msgFormat, 0, Mon_GetBoxMon(mon)); + FreeToHeap(mon); + } else { + data->unk_0D8[data->unk_158] = EOS; + CopyU16ArrayToString(string, data->unk_0D8); + BufferString(data->msgFormat, 0, string, 0, 0, 0); + } + data->unk_180 = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_197, args->unk44, HEAP_ID_NAMING_SCREEN); + data->unk_014 = 1; + String_Delete(string); + } +} From ef2d98010e71c2186eebe97e3d31b3e3acbba268 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 10 Oct 2024 21:03:51 -0400 Subject: [PATCH 07/25] through sub_02083654 --- asm/unk_02082908.s | 170 -------------------------------------------- src/naming_screen.c | 52 +++++++++++--- 2 files changed, 42 insertions(+), 180 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index e7f87e780d..9eba6e1833 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -18,176 +18,6 @@ .text - thumb_func_start sub_02083614 -sub_02083614: ; 0x02083614 - push {r4, r5, r6, lr} - add r6, r0, #0 - add r5, r1, #0 - mov r4, #0 -_0208361C: - add r0, r5, #0 - bl RemoveWindow - add r4, r4, #1 - add r5, #0x10 - cmp r4, #0xa - blt _0208361C - add r0, r6, #0 - mov r1, #4 - bl FreeBgTilemapBuffer - add r0, r6, #0 - mov r1, #2 - bl FreeBgTilemapBuffer - add r0, r6, #0 - mov r1, #1 - bl FreeBgTilemapBuffer - add r0, r6, #0 - mov r1, #0 - bl FreeBgTilemapBuffer - mov r0, #0x12 - add r1, r6, #0 - bl FreeToHeapExplicit - pop {r4, r5, r6, pc} - thumb_func_end sub_02083614 - - thumb_func_start sub_02083654 -sub_02083654: ; 0x02083654 - push {r4, r5, r6, lr} - sub sp, #0x10 - add r5, r0, #0 - mov r0, #0x16 - lsl r0, r0, #4 - ldr r6, [r5, r0] - mov r0, #0x60 - add r4, r1, #0 - mov r1, #0 - str r0, [sp] - mov r0, #0x12 - str r0, [sp, #4] - add r0, r4, #0 - add r2, r1, #0 - add r3, r1, #0 - bl GfGfxLoader_GXLoadPalFromOpenNarc - mov r0, #0x20 - str r0, [sp] - mov r0, #0x12 - str r0, [sp, #4] - mov r0, #0xe - mov r1, #0x47 - mov r2, #4 - mov r3, #0 - bl GfGfxLoader_GXLoadPal - mov r0, #4 - mov r1, #0 - bl BG_SetMaskColor - mov r0, #0 - str r0, [sp] - mov r0, #2 - lsl r0, r0, #0xc - str r0, [sp, #4] - mov r0, #1 - str r0, [sp, #8] - mov r0, #0x12 - mov r1, #2 - str r0, [sp, #0xc] - add r0, r4, #0 - add r2, r6, #0 - add r3, r1, #0 - bl GfGfxLoader_LoadCharDataFromOpenNarc - mov r0, #0 - str r0, [sp] - mov r0, #6 - lsl r0, r0, #8 - str r0, [sp, #4] - mov r0, #1 - str r0, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - add r0, r4, #0 - mov r1, #4 - add r2, r6, #0 - mov r3, #2 - bl GfGfxLoader_LoadScrnDataFromOpenNarc - mov r0, #0 - str r0, [sp] - mov r0, #2 - lsl r0, r0, #0xc - str r0, [sp, #4] - mov r3, #1 - str r3, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - add r0, r4, #0 - mov r1, #2 - add r2, r6, #0 - bl GfGfxLoader_LoadCharDataFromOpenNarc - mov r0, #0 - str r0, [sp] - mov r0, #0xe - lsl r0, r0, #6 - str r0, [sp, #4] - mov r3, #1 - str r3, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - add r0, r4, #0 - mov r1, #6 - add r2, r6, #0 - bl GfGfxLoader_LoadScrnDataFromOpenNarc - mov r3, #0 - mov r0, #0xe - str r3, [sp] - lsl r0, r0, #6 - str r0, [sp, #4] - mov r0, #1 - str r0, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - add r0, r4, #0 - mov r1, #7 - add r2, r6, #0 - bl GfGfxLoader_LoadScrnDataFromOpenNarc - mov r1, #6 - mov r0, #0 - lsl r1, r1, #6 - mov r2, #0x12 - bl LoadFontPal1 - ldr r0, [r5, #0x18] - bl Options_GetFrame - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp] - mov r0, #0x12 - str r0, [sp, #4] - mov r0, #0x16 - lsl r0, r0, #4 - mov r1, #4 - add r2, r1, #0 - ldr r0, [r5, r0] - add r2, #0xfc - mov r3, #0xa - bl LoadUserFrameGfx2 - mov r1, #6 - mov r0, #4 - lsl r1, r1, #6 - mov r2, #0x12 - bl LoadFontPal1 - mov r3, #0x4b - mov r0, #0x12 - lsl r3, r3, #4 - str r0, [sp] - add r0, r4, #0 - mov r1, #0x10 - mov r2, #1 - add r3, r5, r3 - bl GfGfxLoader_GetCharDataFromOpenNarc - ldr r1, _02083778 ; =0x000004AC - str r0, [r5, r1] - add sp, #0x10 - pop {r4, r5, r6, pc} - .balign 4, 0 -_02083778: .word 0x000004AC - thumb_func_end sub_02083654 - thumb_func_start sub_0208377C sub_0208377C: ; 0x0208377C push {r4, lr} diff --git a/src/naming_screen.c b/src/naming_screen.c index 74637d9c5d..224f87c2ca 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -10,6 +10,7 @@ #include "bg_window.h" #include "filesystem.h" #include "font.h" +#include "gf_gfx_loader.h" #include "gf_gfx_planes.h" #include "launch_application.h" #include "math_util.h" @@ -78,9 +79,7 @@ typedef struct NamingScreenAppData { Sprite *unk_34C; u8 filler_350[0x4C]; SysTask *unk_39C[7]; - u8 unk_3B8[0x40]; - u8 unk_3F8[0x50]; - Window unk_448; + Window unk_3B8[10]; int unk_458; int unk_45C; int unk_460; @@ -119,7 +118,7 @@ void sub_020831A4(BgConfig *bgConfig); void sub_020832E4(GFPlaneToggle enable); void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan); void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan); -void sub_02083614(BgConfig *bgConfig, void *a1); +void sub_02083614(BgConfig *bgConfig, Window *a1); void sub_02083654(NamingScreenAppData *data, NARC *narc); void sub_0208377C(void); void sub_020837AC(NamingScreenAppData *data, NARC *narc); @@ -128,7 +127,7 @@ void sub_02083D34(BgConfig *bgConfig, void *a1, void *a2, int a3, int *a4, VecFx void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); void sub_0208423C(VecFx32 *a0, int a1); void sub_0208432C(NamingScreenAppData *data); -void sub_02084740(void *a0, u16 *a1, u16 a2, void *a3, void *a4, String *a5); +void sub_02084740(Window *a0, u16 *a1, u16 a2, void *a3, void *a4, String *a5); void sub_02084830(u16 (*a0)[13], int a1); int sub_02084884(NamingScreenAppData *data, int key, BOOL a2); void sub_02084F3C(void *a0, void *a1, int a2); @@ -173,7 +172,7 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { sub_020837AC(data, narc); sub_020839EC(data); sub_02083F9C(data, ovyMan, narc); - sub_02084740(data->unk_3F8, data->unk_0D8, data->unk_158, &data->unk_15A, data->unk_4C4, data->unk_17C); + sub_02084740(&data->unk_3B8[4], data->unk_0D8, data->unk_158, &data->unk_15A, data->unk_4C4, data->unk_17C); sub_02004EC4(0x34, 0, 0); BeginNormalPaletteFade(0, 1, 1, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); sub_020832E4(GF_PLANE_TOGGLE_ON); @@ -236,10 +235,10 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { break; case 5: sub_020834FC(data, ovyMan); - FillWindowPixelBuffer(&data->unk_448, 15); - DrawFrameAndWindow2(&data->unk_448, FALSE, 256, 10); - data->unk_458 = AddTextPrinterParameterized(&data->unk_448, 1, data->unk_180, 0, 0, 1, NULL); - CopyWindowToVram(&data->unk_448); + FillWindowPixelBuffer(&data->unk_3B8[9], 15); + DrawFrameAndWindow2(&data->unk_3B8[9], FALSE, 256, 10); + data->unk_458 = AddTextPrinterParameterized(&data->unk_3B8[9], 1, data->unk_180, 0, 0, 1, NULL); + CopyWindowToVram(&data->unk_3B8[9]); data->unk_45C = 6; break; case 6: @@ -603,3 +602,36 @@ void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { String_Delete(string); } } + +void sub_02083614(BgConfig *bgConfig, Window *a1) { + for (int i = 0; i < 10; ++i) { + RemoveWindow(&a1[i]); + } + FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_SUB_0); + FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_MAIN_2); + FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_MAIN_1); + FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_MAIN_0); + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, bgConfig); +} + +void sub_02083654(NamingScreenAppData *data, NARC *narc) { + BgConfig *bgConfig = data->bgConfig; + + GfGfxLoader_GXLoadPalFromOpenNarc(narc, 0, GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0, 0x60, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_GXLoadPal(NARC_a_0_1_4, 71, GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)0, 0x20, HEAP_ID_NAMING_SCREEN); + BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB_BLACK); + + GfGfxLoader_LoadCharDataFromOpenNarc(narc, 2, bgConfig, GF_BG_LYR_MAIN_2, 0, 0x2000, TRUE, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, 4, bgConfig, GF_BG_LYR_MAIN_2, 0, 0x600, TRUE, HEAP_ID_NAMING_SCREEN); + + GfGfxLoader_LoadCharDataFromOpenNarc(narc, 2, bgConfig, GF_BG_LYR_MAIN_1, 0, 0x2000, TRUE, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, 6, bgConfig, GF_BG_LYR_MAIN_1, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, 7, bgConfig, GF_BG_LYR_MAIN_0, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + + LoadFontPal1(GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0x180, HEAP_ID_NAMING_SCREEN); + LoadUserFrameGfx2(data->bgConfig, GF_BG_LYR_SUB_0, 0x100, 10, Options_GetFrame(data->unk_018), HEAP_ID_NAMING_SCREEN); + LoadFontPal1(GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)0x180, HEAP_ID_NAMING_SCREEN); + + data->unk_4AC = GfGfxLoader_GetCharDataFromOpenNarc(narc, 16, TRUE, &data->unk_4B0, HEAP_ID_NAMING_SCREEN); +} From dd2b540c36b2b0825d228224d0ccad58c27e3bd2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 11 Oct 2024 07:46:10 -0400 Subject: [PATCH 08/25] through sub_020837AC --- asm/unk_02082908.s | 283 ++------------------------------------------ src/naming_screen.c | 62 ++++++++-- 2 files changed, 61 insertions(+), 284 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index 9eba6e1833..6e38598235 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -18,271 +18,6 @@ .text - thumb_func_start sub_0208377C -sub_0208377C: ; 0x0208377C - push {r4, lr} - sub sp, #0x10 - ldr r4, _020837A8 ; =_02101D70 - add r3, sp, #0 - add r2, r3, #0 - ldmia r4!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r4!, {r0, r1} - stmia r3!, {r0, r1} - add r0, r2, #0 - bl ObjCharTransfer_Init - mov r0, #0x14 - mov r1, #0x12 - bl ObjPlttTransfer_Init - bl ObjCharTransfer_ClearBuffers - bl ObjPlttTransfer_Reset - add sp, #0x10 - pop {r4, pc} - .balign 4, 0 -_020837A8: .word _02101D70 - thumb_func_end sub_0208377C - - thumb_func_start sub_020837AC -sub_020837AC: ; 0x020837AC - push {r4, r5, r6, r7, lr} - sub sp, #0x14 - add r5, r0, #0 - add r7, r1, #0 - bl NNS_G2dInitOamManagerModule - mov r2, #1 - lsl r2, r2, #0x1a - ldr r1, [r2] - ldr r0, _020839A4 ; =0xFFCFFFEF - add r3, r1, #0 - and r3, r0 - mov r1, #0x10 - orr r3, r1 - str r3, [r2] - ldr r3, _020839A8 ; =0x04001000 - ldr r2, [r3] - and r0, r2 - orr r0, r1 - str r0, [r3] - mov r0, #0 - str r0, [sp] - mov r1, #0x80 - str r1, [sp, #4] - str r0, [sp, #8] - mov r3, #0x20 - str r3, [sp, #0xc] - mov r2, #0x12 - str r2, [sp, #0x10] - add r2, r0, #0 - bl OamManager_Create - mov r1, #0x63 - lsl r1, r1, #2 - mov r0, #0x2c - add r1, r5, r1 - mov r2, #0x12 - bl G2dRenderer_Init - mov r1, #0x62 - lsl r1, r1, #2 - str r0, [r5, r1] - add r0, r1, #4 - mov r2, #1 - add r0, r5, r0 - mov r1, #0 - lsl r2, r2, #0x14 - bl G2dRenderer_SetSubSurfaceCoords - mov r6, #0 - add r4, r5, #0 -_02083812: - mov r0, #2 - add r1, r6, #0 - mov r2, #0x12 - bl Create2DGfxResObjMan - mov r1, #0xad - lsl r1, r1, #2 - str r0, [r4, r1] - add r6, r6, #1 - add r4, r4, #4 - cmp r6, #4 - blt _02083812 - mov r0, #0 - str r0, [sp] - mov r3, #1 - str r3, [sp, #4] - mov r0, #0x12 - str r0, [sp, #8] - add r0, r1, #0 - ldr r0, [r5, r0] - add r1, r7, #0 - mov r2, #0xa - bl AddCharResObjFromOpenNarc - mov r1, #0xb1 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r3, #0 - str r3, [sp] - mov r2, #1 - str r2, [sp, #4] - mov r0, #9 - str r0, [sp, #8] - mov r0, #0x12 - sub r1, #0xc - str r0, [sp, #0xc] - ldr r0, [r5, r1] - add r1, r7, #0 - bl AddPlttResObjFromOpenNarc - mov r1, #0xb2 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r0, #0 - str r0, [sp] - mov r0, #2 - str r0, [sp, #4] - mov r0, #0x12 - sub r1, #0xc - str r0, [sp, #8] - ldr r0, [r5, r1] - add r1, r7, #0 - mov r2, #0xc - mov r3, #1 - bl AddCellOrAnimResObjFromOpenNarc - mov r1, #0xb3 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r0, #0 - str r0, [sp] - mov r0, #3 - str r0, [sp, #4] - mov r0, #0x12 - sub r1, #0xc - str r0, [sp, #8] - ldr r0, [r5, r1] - add r1, r7, #0 - mov r2, #0xe - mov r3, #1 - bl AddCellOrAnimResObjFromOpenNarc - mov r1, #0x2d - lsl r1, r1, #4 - str r0, [r5, r1] - ldr r0, [r5] - cmp r0, #1 - bne _020838FC - ldr r0, [r5, #4] - ldr r2, [r5, #8] - mov r1, #0 - bl GetMonIconNaixEx - ldr r3, _020839AC ; =0x000004B8 - add r1, r0, #0 - mov r0, #0x12 - str r0, [sp] - mov r0, #0x14 - mov r2, #0 - add r3, r5, r3 - bl GfGfxLoader_GetCharData - ldr r1, _020839B0 ; =0x000004B4 - str r0, [r5, r1] - add r0, r1, #4 - mov r1, #2 - ldr r0, [r5, r0] - lsl r1, r1, #8 - bl DC_FlushRange - bl sub_02074490 - mov r2, #0x13 - lsl r2, r2, #6 - add r1, r0, #0 - mov r0, #0x14 - add r2, r5, r2 - mov r3, #0x12 - bl GfGfxLoader_GetPlttData - ldr r1, _020839B4 ; =0x000004BC - str r0, [r5, r1] - add r0, r1, #4 - ldr r0, [r5, r0] - mov r1, #0x80 - bl DC_FlushRange -_020838FC: - mov r3, #1 - str r3, [sp] - mov r0, #2 - str r0, [sp, #4] - mov r0, #0x12 - str r0, [sp, #8] - mov r0, #0xad - lsl r0, r0, #2 - ldr r0, [r5, r0] - add r1, r7, #0 - mov r2, #0xb - bl AddCharResObjFromOpenNarc - mov r1, #0xb5 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r2, #1 - str r2, [sp] - mov r0, #2 - str r0, [sp, #4] - mov r0, #3 - str r0, [sp, #8] - mov r0, #0x12 - sub r1, #0x1c - str r0, [sp, #0xc] - ldr r0, [r5, r1] - add r1, r7, #0 - mov r3, #0 - bl AddPlttResObjFromOpenNarc - mov r1, #0xb6 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r3, #1 - str r3, [sp] - mov r0, #2 - str r0, [sp, #4] - mov r0, #0x12 - sub r1, #0x1c - str r0, [sp, #8] - ldr r0, [r5, r1] - add r1, r7, #0 - mov r2, #0xd - bl AddCellOrAnimResObjFromOpenNarc - mov r1, #0xb7 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r3, #1 - str r3, [sp] - mov r0, #3 - str r0, [sp, #4] - mov r0, #0x12 - sub r1, #0x1c - str r0, [sp, #8] - ldr r0, [r5, r1] - add r1, r7, #0 - mov r2, #0xf - bl AddCellOrAnimResObjFromOpenNarc - mov r1, #0x2e - lsl r1, r1, #4 - str r0, [r5, r1] - sub r1, #0x1c - ldr r0, [r5, r1] - bl sub_0200ACF0 - mov r0, #0xb5 - lsl r0, r0, #2 - ldr r0, [r5, r0] - bl sub_0200ACF0 - mov r0, #0xb2 - lsl r0, r0, #2 - ldr r0, [r5, r0] - bl sub_0200AF94 - mov r0, #0xb6 - lsl r0, r0, #2 - ldr r0, [r5, r0] - bl sub_0200AF94 - add sp, #0x14 - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_020839A4: .word 0xFFCFFFEF -_020839A8: .word 0x04001000 -_020839AC: .word 0x000004B8 -_020839B0: .word 0x000004B4 -_020839B4: .word 0x000004BC - thumb_func_end sub_020837AC - thumb_func_start sub_020839B8 sub_020839B8: ; 0x020839B8 push {r3, r4, lr} @@ -3300,13 +3035,19 @@ _02101D54: .global _02101D60 _02101D60: // GraphicsModes .word 0x00000001, 0x00000000, 0x00000000, 0x00000000 -_02101D70: - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 + + .global _02101D70 +_02101D70: // ObjCharTransferTemplate + .word 0x00000014 + .word 0x00000800 + .word 0x00000800 + .word 0x00000012 + _02101D80: - .byte 0x19, 0x00, 0x39, 0x00, 0x59, 0x00, 0x61, 0x00, 0x7A, 0x00, 0x9E, 0x00, 0xC6, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x2B, 0x00, 0x20, 0x00, 0x2F, 0x00, 0x01, 0x00, 0x2B, 0x00, 0x3F, 0x00, 0x09, 0x00 - .byte 0x30, 0x00, 0xE2, 0x00, 0xFF, 0xFF, 0x8D, 0x00, 0x74, 0x00, 0x60, 0x00, 0x6A, 0x00, 0x2F, 0x00 - .byte 0x01, 0x00, 0x2B, 0x00, 0x3F, 0x00, 0x09, 0x00, 0x30, 0x00, 0xE2, 0x00, 0xFF, 0xFF + .short 0x0019, 0x0039, 0x0059, 0x0061, 0x007A, 0x009E, 0x00C6, 0x0000 + .short 0x0003, 0x002B, 0x0020, 0x002F, 0x0001, 0x002B, 0x003F, 0x0009 + .short 0x0030, 0x00E2, 0xFFFF, 0x008D, 0x0074, 0x0060, 0x006A, 0x002F + .short 0x0001, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, 0xFFFF _02101DBE: .byte 0x02, 0xE0 diff --git a/src/naming_screen.c b/src/naming_screen.c index 224f87c2ca..8bc1801815 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -64,16 +64,9 @@ typedef struct NamingScreenAppData { String *unk_180; String *unk_184; SpriteList *unk_188; - u8 unk_18C[0x128]; + GF_G2dRenderer unk_18C; GF_2DGfxResMan *unk_2B4[4]; - GF_2DGfxResObj *unk_2C4; - GF_2DGfxResObj *unk_2C8; - GF_2DGfxResObj *unk_2CC; - GF_2DGfxResObj *unk_2D0; - GF_2DGfxResObj *unk_2D4; - GF_2DGfxResObj *unk_2D8; - GF_2DGfxResObj *unk_2DC; - GF_2DGfxResObj *unk_2E0; + GF_2DGfxResObj *unk_2C4[2][4]; u8 filler_2E4[0x48]; u8 unk_32C[0x20]; Sprite *unk_34C; @@ -378,10 +371,10 @@ BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { for (int i = 0; i < 7; ++i) { DestroySysTaskAndEnvironment(data->unk_39C[i]); } - sub_0200AEB0(data->unk_2C4); - sub_0200AEB0(data->unk_2D4); - sub_0200B0A8(data->unk_2C8); - sub_0200B0A8(data->unk_2D8); + sub_0200AEB0(data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR]); + sub_0200AEB0(data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR]); + sub_0200B0A8(data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT]); + sub_0200B0A8(data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT]); for (int i = 0; i < 4; ++i) { Destroy2DGfxResObjMan(data->unk_2B4[i]); } @@ -635,3 +628,46 @@ void sub_02083654(NamingScreenAppData *data, NARC *narc) { data->unk_4AC = GfGfxLoader_GetCharDataFromOpenNarc(narc, 16, TRUE, &data->unk_4B0, HEAP_ID_NAMING_SCREEN); } + +void sub_0208377C(void) { + extern const ObjCharTransferTemplate _02101D70; + ObjCharTransferTemplate tmplate = _02101D70; + ObjCharTransfer_Init(&tmplate); + ObjPlttTransfer_Init(20, HEAP_ID_NAMING_SCREEN); + ObjCharTransfer_ClearBuffers(); + ObjPlttTransfer_Reset(); +} + +void sub_020837AC(NamingScreenAppData *data, NARC *narc) { + NNS_G2dInitOamManagerModule(); + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); + GXS_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); + OamManager_Create(0, 128, 0, 32, 0, 128, 0, 32, HEAP_ID_NAMING_SCREEN); + data->unk_188 = G2dRenderer_Init(44, &data->unk_18C, HEAP_ID_NAMING_SCREEN); + G2dRenderer_SetSubSurfaceCoords(&data->unk_18C, 0, FX32_CONST(256)); + + for (int i = 0; i < 4; ++i) { + data->unk_2B4[i] = Create2DGfxResObjMan(2, (GfGfxResType)i, HEAP_ID_NAMING_SCREEN); + } + + data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_CHAR], narc, 10, TRUE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, HEAP_ID_NAMING_SCREEN); + data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_PLTT], narc, 1, FALSE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 9, HEAP_ID_NAMING_SCREEN); + data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_CELL], narc, 12, TRUE, 0, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); + data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_ANIM], narc, 14, TRUE, 0, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); + if (data->type == NAME_SCREEN_POKEMON) { + data->unk_4B4 = GfGfxLoader_GetCharData(NARC_poketool_icongra_poke_icon, GetMonIconNaixEx(data->unk_004, FALSE, data->unk_008), FALSE, &data->unk_4B8, HEAP_ID_NAMING_SCREEN); + DC_FlushRange(data->unk_4B8, 0x200); + data->unk_4BC = GfGfxLoader_GetPlttData(NARC_poketool_icongra_poke_icon, sub_02074490(), &data->unk_4C0, HEAP_ID_NAMING_SCREEN); + DC_FlushRange(data->unk_4C0, 0x80); + } + + data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_CHAR], narc, 11, TRUE, 1, NNS_G2D_VRAM_TYPE_2DSUB, HEAP_ID_NAMING_SCREEN); + data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_PLTT], narc, 1, FALSE, 1, NNS_G2D_VRAM_TYPE_2DSUB, 3, HEAP_ID_NAMING_SCREEN); + data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_CELL], narc, 13, TRUE, 1, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); + data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_ANIM], narc, 15, TRUE, 1, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); + + sub_0200ACF0(data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR]); + sub_0200ACF0(data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR]); + sub_0200AF94(data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT]); + sub_0200AF94(data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT]); +} From eb5639be5abc1d3a6fe7fbec1236ff2d462e90d3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 12 Oct 2024 09:06:28 -0400 Subject: [PATCH 09/25] through sub_020839EC --- asm/unk_02082908.s | 275 +++-------------------------------- include/sprite.h | 2 +- src/naming_screen.c | 339 ++++++++++++++++++++++++++++++++++++++++---- src/sprite.c | 2 +- 4 files changed, 333 insertions(+), 285 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index 6e38598235..6498197bf9 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -15,255 +15,10 @@ .extern NamingScreenApp_Exit .extern sub_02082E28 .extern sub_02082EC0 + .extern sub_020839B8 .text - thumb_func_start sub_020839B8 -sub_020839B8: ; 0x020839B8 - push {r3, r4, lr} - sub sp, #0xc - add r4, r1, #0 - ldr r0, [r4] - bl Sprite_GetMatrixPtr - ldr r1, [r0] - ldr r0, [r4, #8] - add r0, r1, r0 - str r0, [sp] - ldr r0, [r4, #0xc] - lsl r1, r0, #4 - ldr r0, _020839E8 ; =_021021E8 + 4 - ldr r0, [r0, r1] - add r1, sp, #0 - lsl r0, r0, #0xc - str r0, [sp, #4] - mov r0, #0 - str r0, [sp, #8] - ldr r0, [r4, #4] - bl Sprite_SetMatrix - add sp, #0xc - pop {r3, r4, pc} - .balign 4, 0 -_020839E8: .word _021021E8 + 4 - thumb_func_end sub_020839B8 - - thumb_func_start sub_020839EC -sub_020839EC: ; 0x020839EC - push {r4, r5, r6, r7, lr} - sub sp, #0x5c - mov r1, #0 - add r6, r0, #0 - str r1, [sp] - sub r0, r1, #1 - str r0, [sp, #4] - str r0, [sp, #8] - mov r2, #0xad - str r1, [sp, #0xc] - mov r0, #1 - lsl r2, r2, #2 - str r0, [sp, #0x10] - ldr r0, [r6, r2] - add r3, r1, #0 - str r0, [sp, #0x14] - add r0, r2, #4 - ldr r0, [r6, r0] - str r0, [sp, #0x18] - add r0, r2, #0 - add r0, #8 - ldr r0, [r6, r0] - str r0, [sp, #0x1c] - add r0, r2, #0 - add r0, #0xc - ldr r0, [r6, r0] - add r2, #0x30 - str r0, [sp, #0x20] - str r1, [sp, #0x24] - add r0, r6, r2 - add r2, r1, #0 - str r1, [sp, #0x28] - bl CreateSpriteResourcesHeader - mov r1, #1 - mov r3, #0xad - str r1, [sp] - sub r0, r1, #2 - str r0, [sp, #4] - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - str r0, [sp, #0x10] - lsl r3, r3, #2 - ldr r2, [r6, r3] - str r2, [sp, #0x14] - add r2, r3, #4 - ldr r2, [r6, r2] - str r2, [sp, #0x18] - add r2, r3, #0 - add r2, #8 - ldr r2, [r6, r2] - str r2, [sp, #0x1c] - add r2, r3, #0 - add r2, #0xc - ldr r2, [r6, r2] - add r3, #0x54 - str r2, [sp, #0x20] - str r0, [sp, #0x24] - str r0, [sp, #0x28] - add r0, r6, r3 - add r2, r1, #0 - add r3, r1, #0 - bl CreateSpriteResourcesHeader - mov r0, #0x62 - lsl r0, r0, #2 - ldr r0, [r6, r0] - mov r1, #2 - str r0, [sp, #0x2c] - mov r0, #0xb9 - lsl r0, r0, #2 - add r0, r6, r0 - str r0, [sp, #0x30] - mov r0, #6 - lsl r1, r1, #0x10 - lsl r0, r0, #0x10 - str r0, [sp, #0x38] - lsr r0, r1, #5 - mov r7, #0 - str r1, [sp, #0x34] - str r7, [sp, #0x3c] - str r0, [sp, #0x40] - str r0, [sp, #0x44] - str r0, [sp, #0x48] - add r0, sp, #0x2c - strh r7, [r0, #0x20] - mov r0, #1 - str r0, [sp, #0x50] - str r0, [sp, #0x54] - mov r0, #0x12 - ldr r4, _02083BAC ; =_021021E8 - str r0, [sp, #0x58] - add r5, r6, #0 -_02083AA8: - ldr r0, [r4] - lsl r0, r0, #0xc - str r0, [sp, #0x34] - ldr r0, [r4, #4] - lsl r0, r0, #0xc - str r0, [sp, #0x38] - add r0, sp, #0x2c - bl Sprite_CreateAffine - mov r1, #0xcb - lsl r1, r1, #2 - str r0, [r5, r1] - add r0, r1, #0 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetAnimActiveFlag - mov r0, #0xcb - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r1, [r4, #8] - bl Sprite_SetAnimCtrlSeq - mov r0, #0xcb - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r1, [r4, #0xc] - bl Sprite_SetDrawPriority - add r7, r7, #1 - add r4, #0x10 - add r5, r5, #4 - cmp r7, #9 - blt _02083AA8 - mov r0, #0xcf - lsl r0, r0, #2 - ldr r0, [r6, r0] - mov r1, #0 - bl Sprite_SetVisibleFlag - ldr r7, _02083BAC ; =_021021E8 - mov r5, #0 - add r4, r6, #0 -_02083AFE: - ldr r0, _02083BB0 ; =sub_020839B8 - mov r1, #0x10 - mov r2, #5 - mov r3, #0x12 - bl CreateSysTaskAndEnvironment - mov r1, #0xe7 - lsl r1, r1, #2 - str r0, [r4, r1] - add r0, r1, #0 - ldr r0, [r4, r0] - bl SysTask_GetData - mov r1, #0xd2 - lsl r1, r1, #2 - ldr r1, [r6, r1] - str r1, [r0] - mov r1, #0xcb - lsl r1, r1, #2 - ldr r1, [r4, r1] - add r4, r4, #4 - str r1, [r0, #4] - ldr r1, [r7] - add r7, #0x10 - lsl r1, r1, #0xc - str r1, [r0, #8] - str r5, [r0, #0xc] - add r5, r5, #1 - cmp r5, #7 - blt _02083AFE - ldr r2, [r6, #0xc] - mov r7, #0 - cmp r2, #0 - ble _02083B7E - mov r5, #0x50 - add r4, r6, #0 -_02083B46: - lsl r0, r5, #0xc - str r0, [sp, #0x34] - mov r0, #0x27 - lsl r0, r0, #0xc - str r0, [sp, #0x38] - add r0, sp, #0x2c - bl Sprite_CreateAffine - mov r1, #0xd9 - lsl r1, r1, #2 - str r0, [r4, r1] - add r0, r1, #0 - ldr r0, [r4, r0] - mov r1, #1 - bl Sprite_SetAnimActiveFlag - mov r0, #0xd9 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x2b - bl Sprite_SetAnimCtrlSeq - ldr r2, [r6, #0xc] - add r7, r7, #1 - add r5, #0xc - add r4, r4, #4 - cmp r7, r2 - blt _02083B46 -_02083B7E: - mov r1, #0x56 - lsl r1, r1, #2 - mov r0, #0xd9 - lsl r0, r0, #2 - ldrh r1, [r6, r1] - add r0, r6, r0 - bl sub_02084E18 - add r0, r6, #0 - add r1, sp, #0x2c - bl sub_02083BB4 - mov r0, #0x10 - mov r1, #1 - bl GfGfx_EngineATogglePlanes - mov r0, #0x10 - mov r1, #1 - bl GfGfx_EngineBTogglePlanes - add sp, #0x5c - pop {r4, r5, r6, r7, pc} - nop -_02083BAC: .word _021021E8 -_02083BB0: .word sub_020839B8 - thumb_func_end sub_020839EC - thumb_func_start sub_02083BB4 sub_02083BB4: ; 0x02083BB4 push {r3, r4, r5, lr} @@ -2821,7 +2576,7 @@ _02084F7E: blt _02084F48 _02084F86: ldr r4, [sp] - ldr r5, _02084FC8 ; =_02102238 + ldr r5, _02084FC8 ; =_021021E8 + 0x50 mov r7, #5 add r4, #0x14 add r6, #0x14 @@ -2854,7 +2609,7 @@ _02084FB0: .balign 4, 0 _02084FC0: .word _021021E8 _02084FC4: .word _021021E8 + 8 -_02084FC8: .word _02102238 +_02084FC8: .word _021021E8 + 0x50 thumb_func_end sub_02084F3C thumb_func_start sub_02084FCC @@ -3177,18 +2932,19 @@ _021021B8: .short 0x0088, 0x0087 .short 0x008B, 0x008A .short 0x008E, 0x008D + + .global _021021E8 _021021E8: - .byte 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x24, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x44, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 -_02102218: - .byte 0x00, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x65, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 -_02102238: - .byte 0x88, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0xB0, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x16, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x1A, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .word 0x00000004, 0x00000044, 0x00000003, 0x00000001 + .word 0x00000024, 0x00000044, 0x00000008, 0x00000001 + .word 0x00000044, 0x00000044, 0x0000000D, 0x00000001 + .word 0x00000000, 0x000000C8, 0x00000012, 0x00000001 + .word 0x00000065, 0x00000044, 0x00000014, 0x00000001 + .word 0x00000088, 0x00000044, 0x00000017, 0x00000001 + .word 0x000000B0, 0x00000044, 0x00000019, 0x00000001 + .word 0x00000016, 0x00000038, 0x00000025, 0x00000002 + .word 0x0000001A, 0x0000005B, 0x00000027, 0x00000000 + _02102278: .byte 0x19, 0x3C .short 0x00 @@ -3403,6 +3159,7 @@ _02102278: .byte 0xDC, 0xA4 .short 0x0002 .byte 0x0C, 0x05 + _02102422: .short 0x0003, 0x0001, 0x0002 .short 0x0005, 0x0001, 0x0004 diff --git a/include/sprite.h b/include/sprite.h index 64a8a1fed5..a683c69d7f 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -147,7 +147,7 @@ int Sprite_GetPalIndex(Sprite *sprite); void Sprite_SetPalOffset(Sprite *sprite, u8 offset); void Sprite_SetPalOffsetRespectVramOffset(Sprite *sprite, u8 offset); u8 Sprite_GetPalOffset(Sprite *sprite); -void Sprite_SetDrawPriority(Sprite *sprite, u16 priority); +void Sprite_SetDrawPriority(Sprite *sprite, u32 priority); u16 Sprite_GetDrawPriority(Sprite *sprite); void Sprite_SetImageProxy(Sprite *sprite, NNSG2dImageProxy *proxy); NNSG2dImageProxy *Sprite_GetImageProxy(Sprite *sprite); diff --git a/src/naming_screen.c b/src/naming_screen.c index 8bc1801815..5e4c22eb0f 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -34,7 +34,7 @@ typedef struct NamingScreenAppData { NameScreenType type; int unk_004; int unk_008; - int unk_00C; + int maxLen; int unk_010; int unk_014; Options *unk_018; @@ -67,10 +67,11 @@ typedef struct NamingScreenAppData { GF_G2dRenderer unk_18C; GF_2DGfxResMan *unk_2B4[4]; GF_2DGfxResObj *unk_2C4[2][4]; - u8 filler_2E4[0x48]; - u8 unk_32C[0x20]; - Sprite *unk_34C; - u8 filler_350[0x4C]; + SpriteResourcesHeader unk_2E4; + SpriteResourcesHeader unk_308; + Sprite *unk_32C[14]; + Sprite *unk_364[12]; + Sprite *unk_394[2]; SysTask *unk_39C[7]; Window unk_3B8[10]; int unk_458; @@ -115,21 +116,25 @@ void sub_02083614(BgConfig *bgConfig, Window *a1); void sub_02083654(NamingScreenAppData *data, NARC *narc); void sub_0208377C(void); void sub_020837AC(NamingScreenAppData *data, NARC *narc); +void sub_020839B8(SysTask *task, void *taskData); void sub_020839EC(NamingScreenAppData *data); -void sub_02083D34(BgConfig *bgConfig, void *a1, void *a2, int a3, int *a4, VecFx32 *a5, void *a6, const u16 *a7); +void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate); +void sub_02083D34(BgConfig *bgConfig, Window *a1, int *a2, int a3, int *a4, VecFx32 *a5, Sprite **a6, const u16 *a7); void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); void sub_0208423C(VecFx32 *a0, int a1); void sub_0208432C(NamingScreenAppData *data); void sub_02084740(Window *a0, u16 *a1, u16 a2, void *a3, void *a4, String *a5); void sub_02084830(u16 (*a0)[13], int a1); int sub_02084884(NamingScreenAppData *data, int key, BOOL a2); -void sub_02084F3C(void *a0, void *a1, int a2); +void sub_02084E18(Sprite **sprites, int a1); +void sub_02084F3C(int *a0, Sprite **a1, int a2); void sub_02084FCC(NamingScreenAppData *data); void sub_02084500(void *a0); static NamingScreenAppData *_021D43B0; extern const int _021020B4[8]; +extern const int _021021E8[][4]; BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { NamingScreenAppData *data; @@ -270,8 +275,8 @@ int sub_02082CF8(NamingScreenAppData *data, int a1) { sub_0208432C(data); if (gSystem.newKeys & PAD_BUTTON_SELECT) { - if (!Sprite_GetVisibleFlag(data->unk_34C)) { - Sprite_SetVisibleFlag(data->unk_34C, TRUE); + if (!Sprite_GetVisibleFlag(data->unk_32C[8])) { + Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); return ret; } if (data->type != 4) { @@ -450,7 +455,7 @@ void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args) { data->type = args->kind; data->unk_004 = args->playerGender; data->unk_008 = args->monForm; - data->unk_00C = args->maxLen; + data->maxLen = args->maxLen; data->unk_010 = args->monGender; data->unk_018 = args->options; data->unk_5D0 = args->unk50; @@ -542,20 +547,20 @@ void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { if (args->unk44) { data->unk_014 = 1; } - data->unk_178 = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, _021020B4[data->type], HEAP_ID_NAMING_SCREEN); - data->unk_17C = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, msg_0249_00009, HEAP_ID_NAMING_SCREEN); - data->unk_184 = NewString_ReadMsgData(data->msgData_249, msg_0249_00007); - data->unk_158 = StringLength(data->unk_118); - data->unk_01C = 0; - data->unk_020 = 1; - data->unk_024 = -1; - data->unk_028 = -1; - data->unk_030 = 1; - data->unk_034 = 0; - data->unk_484 = -1; - data->unk_488 = 0; - data->unk_48C = 0; - data->unk_0D8[data->unk_00C] = EOS; + data->unk_178 = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, _021020B4[data->type], HEAP_ID_NAMING_SCREEN); + data->unk_17C = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, msg_0249_00009, HEAP_ID_NAMING_SCREEN); + data->unk_184 = NewString_ReadMsgData(data->msgData_249, msg_0249_00007); + data->unk_158 = StringLength(data->unk_118); + data->unk_01C = 0; + data->unk_020 = 1; + data->unk_024 = -1; + data->unk_028 = -1; + data->unk_030 = 1; + data->unk_034 = 0; + data->unk_484 = -1; + data->unk_488 = 0; + data->unk_48C = 0; + data->unk_0D8[data->maxLen] = EOS; for (int i = 0; i < 7; ++i) { data->unk_490[i] = 0; } @@ -671,3 +676,289 @@ void sub_020837AC(NamingScreenAppData *data, NARC *narc) { sub_0200AF94(data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT]); sub_0200AF94(data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT]); } + +typedef struct SysTaskData_020839B8 { + Sprite *sprite; + Sprite *sprite2; + fx32 dx; + int i; +} SysTaskData_020839B8; + +void sub_020839B8(SysTask *task, void *taskData) { + SysTaskData_020839B8 *data = taskData; + VecFx32 *pMatrix = Sprite_GetMatrixPtr(data->sprite); + VecFx32 matrix; + matrix.x = pMatrix->x + data->dx; + matrix.y = FX32_ONE * _021021E8[data->i][1]; + matrix.z = 0; + Sprite_SetMatrix(data->sprite2, &matrix); +} + +#ifdef NONMATCHING +void sub_020839EC(NamingScreenAppData *data) { + int i; + CreateSpriteResourcesHeader(&data->unk_2E4, 0, 0, 0, 0, -1, -1, 0, 1, data->unk_2B4[GF_GFX_RES_TYPE_CHAR], data->unk_2B4[GF_GFX_RES_TYPE_PLTT], data->unk_2B4[GF_GFX_RES_TYPE_CELL], data->unk_2B4[GF_GFX_RES_TYPE_ANIM], NULL, NULL); + CreateSpriteResourcesHeader(&data->unk_308, 1, 1, 1, 1, -1, -1, 0, 0, data->unk_2B4[GF_GFX_RES_TYPE_CHAR], data->unk_2B4[GF_GFX_RES_TYPE_PLTT], data->unk_2B4[GF_GFX_RES_TYPE_CELL], data->unk_2B4[GF_GFX_RES_TYPE_ANIM], NULL, NULL); + { + SpriteTemplate spriteTemplate; + spriteTemplate.spriteList = data->unk_188; + spriteTemplate.header = &data->unk_2E4; + spriteTemplate.position.x = FX32_CONST(32); + spriteTemplate.position.y = FX32_CONST(96); + spriteTemplate.position.z = 0; + spriteTemplate.scale.x = FX32_ONE; + spriteTemplate.scale.y = FX32_ONE; + spriteTemplate.scale.z = FX32_ONE; + spriteTemplate.rotation = 0; + spriteTemplate.priority = 1; + spriteTemplate.whichScreen = NNS_G2D_VRAM_TYPE_2DMAIN; + spriteTemplate.heapId = HEAP_ID_NAMING_SCREEN; + + for (i = 0; i < 9; ++i) { + spriteTemplate.position.x = _021021E8[i][0] * FX32_ONE; + spriteTemplate.position.y = _021021E8[i][1] * FX32_ONE; + data->unk_32C[i] = Sprite_CreateAffine(&spriteTemplate); + Sprite_SetAnimActiveFlag(data->unk_32C[i], TRUE); + Sprite_SetAnimCtrlSeq(data->unk_32C[i], _021021E8[i][2]); + Sprite_SetDrawPriority(data->unk_32C[i], _021021E8[i][3]); + } + Sprite_SetVisibleFlag(data->unk_32C[4], FALSE); + for (i = 0; i < 7; ++i) { + data->unk_39C[i] = CreateSysTaskAndEnvironment(sub_020839B8, sizeof(SysTaskData_020839B8), 5, HEAP_ID_NAMING_SCREEN); + SysTaskData_020839B8 *taskData = SysTask_GetData(data->unk_39C[i]); + taskData->sprite = data->unk_32C[7]; + taskData->sprite2 = data->unk_32C[i]; + taskData->dx = _021021E8[i][0] * FX32_ONE; + taskData->i = i; + } + // regswap: data->maxLen should be r2, instead r0 + for (i = 0; i < data->maxLen; ++i) { + spriteTemplate.position.x = FX32_ONE * (80 + i * 12); + spriteTemplate.position.y = FX32_ONE * 39; + data->unk_364[i] = Sprite_CreateAffine(&spriteTemplate); + Sprite_SetAnimActiveFlag(data->unk_364[i], TRUE); + Sprite_SetAnimCtrlSeq(data->unk_364[i], 43); + } + sub_02084E18(data->unk_364, data->unk_158); + sub_02083BB4(data, &spriteTemplate); + } + GfGfx_EngineATogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); + GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); +} +#else +// clang-format off +asm void sub_020839EC(NamingScreenAppData *data) { + push {r4, r5, r6, r7, lr} + sub sp, #0x5c + mov r1, #0 + add r6, r0, #0 + str r1, [sp] + sub r0, r1, #1 + str r0, [sp, #4] + str r0, [sp, #8] + mov r2, #0xad + str r1, [sp, #0xc] + mov r0, #1 + lsl r2, r2, #2 + str r0, [sp, #0x10] + ldr r0, [r6, r2] + add r3, r1, #0 + str r0, [sp, #0x14] + add r0, r2, #4 + ldr r0, [r6, r0] + str r0, [sp, #0x18] + add r0, r2, #0 + add r0, #8 + ldr r0, [r6, r0] + str r0, [sp, #0x1c] + add r0, r2, #0 + add r0, #0xc + ldr r0, [r6, r0] + add r2, #0x30 + str r0, [sp, #0x20] + str r1, [sp, #0x24] + add r0, r6, r2 + add r2, r1, #0 + str r1, [sp, #0x28] + bl CreateSpriteResourcesHeader + mov r1, #1 + mov r3, #0xad + str r1, [sp] + sub r0, r1, #2 + str r0, [sp, #4] + str r0, [sp, #8] + mov r0, #0 + str r0, [sp, #0xc] + str r0, [sp, #0x10] + lsl r3, r3, #2 + ldr r2, [r6, r3] + str r2, [sp, #0x14] + add r2, r3, #4 + ldr r2, [r6, r2] + str r2, [sp, #0x18] + add r2, r3, #0 + add r2, #8 + ldr r2, [r6, r2] + str r2, [sp, #0x1c] + add r2, r3, #0 + add r2, #0xc + ldr r2, [r6, r2] + add r3, #0x54 + str r2, [sp, #0x20] + str r0, [sp, #0x24] + str r0, [sp, #0x28] + add r0, r6, r3 + add r2, r1, #0 + add r3, r1, #0 + bl CreateSpriteResourcesHeader + mov r0, #0x62 + lsl r0, r0, #2 + ldr r0, [r6, r0] + mov r1, #2 + str r0, [sp, #0x2c] + mov r0, #0xb9 + lsl r0, r0, #2 + add r0, r6, r0 + str r0, [sp, #0x30] + mov r0, #6 + lsl r1, r1, #0x10 + lsl r0, r0, #0x10 + str r0, [sp, #0x38] + lsr r0, r1, #5 + mov r7, #0 + str r1, [sp, #0x34] + str r7, [sp, #0x3c] + str r0, [sp, #0x40] + str r0, [sp, #0x44] + str r0, [sp, #0x48] + add r0, sp, #0x2c + strh r7, [r0, #0x20] + mov r0, #1 + str r0, [sp, #0x50] + str r0, [sp, #0x54] + mov r0, #0x12 + ldr r4, =_021021E8 + str r0, [sp, #0x58] + add r5, r6, #0 +_02083AA8: + ldr r0, [r4, #0] + lsl r0, r0, #0xc + str r0, [sp, #0x34] + ldr r0, [r4, #4] + lsl r0, r0, #0xc + str r0, [sp, #0x38] + add r0, sp, #0x2c + bl Sprite_CreateAffine + mov r1, #0xcb + lsl r1, r1, #2 + str r0, [r5, r1] + add r0, r1, #0 + ldr r0, [r5, r0] + mov r1, #1 + bl Sprite_SetAnimActiveFlag + mov r0, #0xcb + lsl r0, r0, #2 + ldr r0, [r5, r0] + ldr r1, [r4, #8] + bl Sprite_SetAnimCtrlSeq + mov r0, #0xcb + lsl r0, r0, #2 + ldr r0, [r5, r0] + ldr r1, [r4, #0xc] + bl Sprite_SetDrawPriority + add r7, r7, #1 + add r4, #0x10 + add r5, r5, #4 + cmp r7, #9 + blt _02083AA8 + mov r0, #0xcf + lsl r0, r0, #2 + ldr r0, [r6, r0] + mov r1, #0 + bl Sprite_SetVisibleFlag + ldr r7, =_021021E8 + mov r5, #0 + add r4, r6, #0 +_02083AFE: + ldr r0, =sub_020839B8 + mov r1, #0x10 + mov r2, #5 + mov r3, #0x12 + bl CreateSysTaskAndEnvironment + mov r1, #0xe7 + lsl r1, r1, #2 + str r0, [r4, r1] + add r0, r1, #0 + ldr r0, [r4, r0] + bl SysTask_GetData + mov r1, #0xd2 + lsl r1, r1, #2 + ldr r1, [r6, r1] + str r1, [r0] + mov r1, #0xcb + lsl r1, r1, #2 + ldr r1, [r4, r1] + add r4, r4, #4 + str r1, [r0, #4] + ldr r1, [r7, #0] + add r7, #0x10 + lsl r1, r1, #0xc + str r1, [r0, #8] + str r5, [r0, #0xc] + add r5, r5, #1 + cmp r5, #7 + blt _02083AFE + ldr r2, [r6, #0xc] + mov r7, #0 + cmp r2, #0 + ble _02083B7E + mov r5, #0x50 + add r4, r6, #0 +_02083B46: + lsl r0, r5, #0xc + str r0, [sp, #0x34] + mov r0, #0x27 + lsl r0, r0, #0xc + str r0, [sp, #0x38] + add r0, sp, #0x2c + bl Sprite_CreateAffine + mov r1, #0xd9 + lsl r1, r1, #2 + str r0, [r4, r1] + add r0, r1, #0 + ldr r0, [r4, r0] + mov r1, #1 + bl Sprite_SetAnimActiveFlag + mov r0, #0xd9 + lsl r0, r0, #2 + ldr r0, [r4, r0] + mov r1, #0x2b + bl Sprite_SetAnimCtrlSeq + ldr r2, [r6, #0xc] + add r7, r7, #1 + add r5, #0xc + add r4, r4, #4 + cmp r7, r2 + blt _02083B46 +_02083B7E: + mov r1, #0x56 + lsl r1, r1, #2 + mov r0, #0xd9 + lsl r0, r0, #2 + ldrh r1, [r6, r1] + add r0, r6, r0 + bl sub_02084E18 + add r0, r6, #0 + add r1, sp, #0x2c + bl sub_02083BB4 + mov r0, #0x10 + mov r1, #1 + bl GfGfx_EngineATogglePlanes + mov r0, #0x10 + mov r1, #1 + bl GfGfx_EngineBTogglePlanes + add sp, #0x5c + pop {r4, r5, r6, r7, pc} +} +// clang-format on +#endif // NONMATCHING diff --git a/src/sprite.c b/src/sprite.c index 902d68e972..cadc85ab61 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -398,7 +398,7 @@ u8 Sprite_GetPalOffset(Sprite *sprite) { return sprite->palOffset; } -void Sprite_SetDrawPriority(Sprite *sprite, u16 priority) { +void Sprite_SetDrawPriority(Sprite *sprite, u32 priority) { SpriteList *spriteList = sprite->spriteList; sprite->drawPriority = priority; Sprite_EjectFromList(sprite); From ea1c0e0c6657feaf693f87fb89a29ddbd5cde3f3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 12 Oct 2024 11:00:12 -0400 Subject: [PATCH 10/25] through sub_02083F48 --- asm/unk_02082908.s | 526 ++------------------------------------------ src/naming_screen.c | 173 ++++++++++++++- 2 files changed, 182 insertions(+), 517 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index 6498197bf9..f650de1962 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -13,515 +13,11 @@ .extern NamingScreenApp_Init .extern NamingScreenApp_Main .extern NamingScreenApp_Exit - .extern sub_02082E28 - .extern sub_02082EC0 - .extern sub_020839B8 + .extern sub_02083F18 + .extern sub_02083F48 .text - thumb_func_start sub_02083BB4 -sub_02083BB4: ; 0x02083BB4 - push {r3, r4, r5, lr} - add r4, r0, #0 - mov r0, #6 - add r5, r1, #0 - lsl r0, r0, #0xe - str r0, [r5, #8] - mov r0, #2 - lsl r0, r0, #0xe - str r0, [r5, #0xc] - add r0, r5, #0 - bl Sprite_CreateAffine - mov r1, #0xe5 - lsl r1, r1, #2 - str r0, [r4, r1] - ldr r0, [r4, r1] - mov r1, #1 - bl Sprite_SetAnimActiveFlag - ldr r0, [r4] - cmp r0, #7 - bhi _02083CAA - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_02083BEC: ; jump table - .short _02083BFC - _02083BEC - 2 ; case 0 - .short _02083C64 - _02083BEC - 2 ; case 1 - .short _02083C56 - _02083BEC - 2 ; case 2 - .short _02083C1E - _02083BEC - 2 ; case 3 - .short _02083C48 - _02083BEC - 2 ; case 4 - .short _02083C3A - _02083BEC - 2 ; case 5 - .short _02083C2C - _02083BEC - 2 ; case 6 - .short _02083C48 - _02083BEC - 2 ; case 7 -_02083BFC: - ldr r0, [r4, #4] - cmp r0, #0 - bne _02083C10 - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x30 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C10: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x31 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C1E: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x33 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C2C: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x37 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C3A: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x36 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C48: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x35 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C56: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x2f - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C64: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x32 - bl Sprite_SetAnimCtrlSeq - ldr r0, [r4, #0x10] - cmp r0, #2 - beq _02083CAA - ldr r1, [r4, #0xc] - mov r0, #0xd - mul r0, r1 - add r0, #0x50 - lsl r0, r0, #0xc - str r0, [r5, #8] - mov r0, #0x1b - lsl r0, r0, #0xc - str r0, [r5, #0xc] - add r0, r5, #0 - bl Sprite_CreateAffine - mov r1, #0xe6 - lsl r1, r1, #2 - str r0, [r4, r1] - ldr r0, [r4, #0x10] - cmp r0, #0 - ldr r0, [r4, r1] - bne _02083CA4 - mov r1, #0x2d - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083CA4: - mov r1, #0x2e - bl Sprite_SetAnimCtrlSeq -_02083CAA: - pop {r3, r4, r5, pc} - thumb_func_end sub_02083BB4 - - thumb_func_start sub_02083CAC -sub_02083CAC: ; 0x02083CAC - push {r4, r5, lr} - sub sp, #0xc - add r4, r1, #0 - add r5, r0, #0 - ldr r0, [r4, #0xc] - str r0, [sp, #4] - mov r0, #0 - str r0, [sp, #8] - ldr r0, [r4, #4] - cmp r0, #6 - bhi _02083D2A - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_02083CCE: ; jump table - .short _02083CDC - _02083CCE - 2 ; case 0 - .short _02083D2A - _02083CCE - 2 ; case 1 - .short _02083CF0 - _02083CCE - 2 ; case 2 - .short _02083D2A - _02083CCE - 2 ; case 3 - .short _02083D04 - _02083CCE - 2 ; case 4 - .short _02083D2A - _02083CCE - 2 ; case 5 - .short _02083D18 - _02083CCE - 2 ; case 6 -_02083CDC: - mov r0, #1 - ldr r1, [r4, #8] - lsl r0, r0, #0xe - add r0, r1, r0 - str r0, [sp] - ldr r0, [r4] - add r1, sp, #0 - bl Sprite_SetMatrix - b _02083D2A -_02083CF0: - mov r0, #3 - ldr r1, [r4, #8] - lsl r0, r0, #0xc - sub r0, r1, r0 - str r0, [sp] - ldr r0, [r4] - add r1, sp, #0 - bl Sprite_SetMatrix - b _02083D2A -_02083D04: - mov r0, #2 - ldr r1, [r4, #8] - lsl r0, r0, #0xc - add r0, r1, r0 - str r0, [sp] - ldr r0, [r4] - add r1, sp, #0 - bl Sprite_SetMatrix - b _02083D2A -_02083D18: - ldr r0, [r4, #8] - add r1, sp, #0 - str r0, [sp] - ldr r0, [r4] - bl Sprite_SetMatrix - add r0, r5, #0 - bl DestroySysTaskAndEnvironment -_02083D2A: - ldr r0, [r4, #4] - add r0, r0, #1 - str r0, [r4, #4] - add sp, #0xc - pop {r4, r5, pc} - thumb_func_end sub_02083CAC - - thumb_func_start sub_02083D34 -sub_02083D34: ; 0x02083D34 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x28 - str r1, [sp, #0x14] - ldr r1, [sp, #0x40] - add r5, r2, #0 - str r1, [sp, #0x40] - ldr r1, [sp, #0x48] - mov r2, #1 - str r1, [sp, #0x48] - ldr r1, [sp, #0x40] - str r0, [sp, #0x10] - ldr r6, [r1] - add r7, r3, #0 - add r1, r6, #0 - eor r1, r2 - str r1, [sp, #0x18] - ldr r1, [r5] - ldr r4, [sp, #0x44] - cmp r1, #4 - bls _02083D5E - b _02083F02 -_02083D5E: - add r1, r1, r1 - add r1, pc - ldrh r1, [r1, #6] - lsl r1, r1, #0x10 - asr r1, r1, #0x10 - add pc, r1 -_02083D6A: ; jump table - .short _02083D74 - _02083D6A - 2 ; case 0 - .short _02083DC0 - _02083D6A - 2 ; case 1 - .short _02083DE6 - _02083D6A - 2 ; case 2 - .short _02083E80 - _02083D6A - 2 ; case 3 - .short _02083F02 - _02083D6A - 2 ; case 4 -_02083D74: - mov r0, #0 - str r0, [sp] - mov r0, #0xe - lsl r0, r0, #6 - str r0, [sp, #4] - str r2, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - ldr r2, [sp, #0x10] - mov r0, #0x1f - add r1, r7, #6 - add r3, r6, #0 - bl GfGfxLoader_LoadScrnData - add r0, r4, #0 - add r1, r6, #0 - bl sub_0208423C - ldr r0, _02083F08 ; =_02101D40 - lsl r2, r6, #4 - ldrb r1, [r0, r7] - ldr r0, [sp, #0x4c] - ldr r3, _02083F0C ; =0x000E0F00 - str r0, [sp] - ldr r0, [sp, #0x14] - add r0, r0, r2 - lsl r2, r1, #4 - orr r1, r2 - lsl r1, r1, #0x10 - lsr r1, r1, #0x10 - add r2, r7, #0 - bl sub_02084E54 - ldr r0, [r5] - add sp, #0x28 - add r0, r0, #1 - str r0, [r5] - pop {r3, r4, r5, r6, r7, pc} -_02083DC0: - lsl r1, r6, #0x18 - lsr r1, r1, #0x18 - mov r2, #0 - mov r3, #0xee - bl BgSetPosTextAndCommit - mov r2, #3 - lsl r1, r6, #0x18 - add r3, r2, #0 - ldr r0, [sp, #0x10] - lsr r1, r1, #0x18 - sub r3, #0x53 - bl BgSetPosTextAndCommit - ldr r0, [r5] - add sp, #0x28 - add r0, r0, #1 - str r0, [r5] - pop {r3, r4, r5, r6, r7, pc} -_02083DE6: - mov r1, #0xc - add r0, r6, #0 - mul r0, r1 - ldr r2, [r4, r0] - str r0, [sp, #0x1c] - sub r2, #0x18 - str r2, [r4, r0] - ldr r0, [r4, r0] - sub r1, #0xd - cmp r0, r1 - bge _02083E3E - ldr r0, _02083F10 ; =sub_02083CAC - mov r1, #0x10 - mov r2, #0 - mov r3, #0x12 - bl CreateSysTaskAndEnvironment - bl SysTask_GetData - add r7, r0, #0 - ldr r0, [sp, #0x48] - ldr r0, [r0, #0x1c] - str r0, [r7] - mov r0, #0 - str r0, [r7, #4] - ldr r0, [sp, #0x48] - ldr r0, [r0, #0x1c] - bl Sprite_GetMatrixPtr - ldr r0, [r0] - str r0, [r7, #8] - ldr r0, [sp, #0x48] - ldr r0, [r0, #0x1c] - bl Sprite_GetMatrixPtr - ldr r0, [r0, #4] - mov r1, #0xa - str r0, [r7, #0xc] - ldr r0, [sp, #0x1c] - mvn r1, r1 - str r1, [r4, r0] - ldr r0, [r5] - add r0, r0, #1 - str r0, [r5] -_02083E3E: - ldr r0, [sp, #0x18] - mov r1, #0xc - add r7, r0, #0 - add r5, r4, #4 - mul r7, r1 - ldr r0, [r5, r7] - sub r0, #0xa - str r0, [r5, r7] - add r0, r1, #0 - ldr r2, [r5, r7] - sub r0, #0xd0 - cmp r2, r0 - bge _02083E5C - sub r1, #0xd0 - str r1, [r5, r7] -_02083E5C: - ldr r3, [sp, #0x1c] - lsl r1, r6, #0x18 - ldr r0, [sp, #0x10] - ldr r3, [r4, r3] - lsr r1, r1, #0x18 - mov r2, #0 - bl BgSetPosTextAndCommit - ldr r1, [sp, #0x18] - ldr r0, [sp, #0x10] - lsl r1, r1, #0x18 - ldr r3, [r5, r7] - lsr r1, r1, #0x18 - mov r2, #3 - bl BgSetPosTextAndCommit - add sp, #0x28 - pop {r3, r4, r5, r6, r7, pc} -_02083E80: - ldr r1, [sp, #0x18] - mov r0, #0xc - add r2, r1, #0 - mul r2, r0 - str r2, [sp, #0x20] - add r7, r4, #4 - ldr r2, [r7, r2] - ldr r1, [sp, #0x20] - sub r2, #0xa - str r2, [r7, r1] - ldr r2, [r7, r1] - add r1, r0, #0 - sub r1, #0xd0 - cmp r2, r1 - bge _02083EA4 - ldr r1, [sp, #0x20] - sub r0, #0xd0 - str r0, [r7, r1] -_02083EA4: - mov r0, #0xc - mul r0, r6 - str r0, [sp, #0x24] - ldr r3, [sp, #0x24] - lsl r1, r6, #0x18 - ldr r0, [sp, #0x10] - ldr r3, [r4, r3] - lsr r1, r1, #0x18 - mov r2, #0 - bl BgSetPosTextAndCommit - ldr r1, [sp, #0x18] - ldr r3, [sp, #0x20] - lsl r1, r1, #0x18 - ldr r0, [sp, #0x10] - ldr r3, [r7, r3] - lsr r1, r1, #0x18 - mov r2, #3 - bl BgSetPosTextAndCommit - ldr r0, [sp, #0x24] - mov r1, #0xa - ldr r0, [r4, r0] - mvn r1, r1 - cmp r0, r1 - bne _02083F02 - ldr r0, [sp, #0x20] - sub r1, #0xb9 - ldr r0, [r7, r0] - cmp r0, r1 - bne _02083F02 - ldr r0, [r5] - add r2, r4, #0 - add r0, r0, #1 - str r0, [r5] - ldr r0, [sp, #0x40] - ldr r1, [r0] - mov r0, #1 - eor r1, r0 - ldr r0, [sp, #0x40] - str r1, [r0] - ldr r0, [sp, #0x10] - bl sub_0208421C - ldr r0, _02083F14 ; =0x0000069A - bl PlaySE -_02083F02: - add sp, #0x28 - pop {r3, r4, r5, r6, r7, pc} - nop -_02083F08: .word _02101D40 -_02083F0C: .word 0x000E0F00 -_02083F10: .word sub_02083CAC -_02083F14: .word 0x0000069A - thumb_func_end sub_02083D34 - - thumb_func_start sub_02083F18 -sub_02083F18: ; 0x02083F18 - push {r4, r5, lr} - sub sp, #0xc - add r4, r2, #0 - mov r2, #1 - mov r1, #0 - lsl r2, r2, #8 - mov r3, #0xa - add r5, r0, #0 - bl DrawFrameAndWindow2 - mov r3, #0 - str r3, [sp] - str r3, [sp, #4] - add r0, r5, #0 - mov r1, #1 - add r2, r4, #0 - str r3, [sp, #8] - bl AddTextPrinterParameterized - add r0, r5, #0 - bl CopyWindowToVram - add sp, #0xc - pop {r4, r5, pc} - thumb_func_end sub_02083F18 - - thumb_func_start sub_02083F48 -sub_02083F48: ; 0x02083F48 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x10 - add r5, r0, #0 - add r7, r2, #0 - mov r0, #0 - add r1, r7, #0 - add r2, r0, #0 - mov r4, #0x10 - bl FontID_String_GetWidth - add r6, r0, #0 - add r0, r5, #0 - bl GetWindowWidth - lsl r1, r0, #3 - add r0, r6, #0 - add r0, #0x10 - cmp r0, r1 - ble _02083F70 - sub r4, r1, r6 -_02083F70: - add r0, r5, #0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r1, #0 - str r1, [sp] - ldr r0, _02083F98 ; =0x000E0F01 - str r1, [sp, #4] - str r0, [sp, #8] - add r0, r5, #0 - add r2, r7, #0 - add r3, r4, #0 - str r1, [sp, #0xc] - bl AddTextPrinterParameterizedWithColor - add r0, r5, #0 - bl CopyWindowToVram - add sp, #0x10 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02083F98: .word 0x000E0F01 - thumb_func_end sub_02083F48 - thumb_func_start sub_02083F9C sub_02083F9C: ; 0x02083F9C push {r4, r5, r6, r7, lr} @@ -2777,6 +2273,8 @@ _020850F0: .word _02102278 _02101D3C: .byte 0x60, 0x68, 0x50, 0x58 + + .global _02101D40 _02101D40: .byte 0x04, 0x07, 0x0D, 0x0A _02101D44: @@ -2785,7 +2283,9 @@ _02101D4C: .byte 0x28, 0x28, 0x28, 0x28 .byte 0x29, 0x29, 0x29, 0x00 _02101D54: - .byte 0x70, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00 + .word 0x00000070 + .word 0x0000004C + .word 0x00000048 .global _02101D60 _02101D60: // GraphicsModes @@ -2805,13 +2305,13 @@ _02101D80: .short 0x0001, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, 0xFFFF _02101DBE: - .byte 0x02, 0xE0 - .byte 0x02, 0xE0, 0x03, 0xE0, 0x03, 0xE0, 0x04, 0xE0, 0x04, 0xE0, 0x04, 0xD0, 0x04, 0xD0, 0x07, 0xE0 - .byte 0x07, 0xE0, 0x07, 0xE0, 0x08, 0xE0, 0x08, 0xE0 + .short 0xE002, 0xE002, 0xE003, 0xE003, 0xE004, 0xE004, 0xD004, 0xD004 + .short 0xE007, 0xE007, 0xE007, 0xE008, 0xE008 + _02101DD8: - .byte 0x04, 0xD0, 0x04, 0xD0, 0x04, 0xD0, 0x04, 0xD0 - .byte 0x04, 0xD0, 0x04, 0xD0, 0x04, 0xD0, 0x04, 0xD0, 0x07, 0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x08, 0xE0 - .byte 0x08, 0xE0 + .short 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004 + .short 0xE007, 0xE007, 0xE007, 0xE008, 0xE008 + _02101DF2: .short 0x00E3, 0x00E4, 0x00F9, 0x00F8, 0x00E5, 0x00E6, 0x00F5 .short 0x00F6, 0x00F7, 0x00E7, 0x0001, 0x00EE, 0x00EF, 0xFFFF, 0x0000 diff --git a/src/naming_screen.c b/src/naming_screen.c index 5e4c22eb0f..37c939c8bd 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -77,7 +77,7 @@ typedef struct NamingScreenAppData { int unk_458; int unk_45C; int unk_460; - int unk_464; + GFBgLayer unk_464; VecFx32 unk_468[2]; u8 filler_480[4]; int unk_484; @@ -119,10 +119,15 @@ void sub_020837AC(NamingScreenAppData *data, NARC *narc); void sub_020839B8(SysTask *task, void *taskData); void sub_020839EC(NamingScreenAppData *data); void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate); -void sub_02083D34(BgConfig *bgConfig, Window *a1, int *a2, int a3, int *a4, VecFx32 *a5, Sprite **a6, const u16 *a7); +void sub_02083CAC(SysTask *task, void *taskData); +void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData); +void sub_02083F18(Window *window, int unused, String *msg); +void sub_02083F48(Window *window, int unused, String *msg); void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); -void sub_0208423C(VecFx32 *a0, int a1); +sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); +void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId); void sub_0208432C(NamingScreenAppData *data); +void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); void sub_02084740(Window *a0, u16 *a1, u16 a2, void *a3, void *a4, String *a5); void sub_02084830(u16 (*a0)[13], int a1); int sub_02084884(NamingScreenAppData *data, int key, BOOL a2); @@ -135,6 +140,7 @@ static NamingScreenAppData *_021D43B0; extern const int _021020B4[8]; extern const int _021021E8[][4]; +extern const u8 _02101D40[]; BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { NamingScreenAppData *data; @@ -528,7 +534,7 @@ void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); data->unk_45C = 4; - sub_0208423C(data->unk_468, 0); + sub_0208423C(data->unk_468, GF_BG_LYR_MAIN_0); BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_X, data->unk_468[data->unk_464].x); BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_Y, data->unk_468[data->unk_464].y); BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_X, data->unk_468[data->unk_464 ^ 1].x); @@ -962,3 +968,162 @@ asm void sub_020839EC(NamingScreenAppData *data) { } // clang-format on #endif // NONMATCHING + +void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate) { + tmplate->position.x = FX32_CONST(24); + tmplate->position.y = FX32_CONST(8); + data->unk_394[0] = Sprite_CreateAffine(tmplate); + Sprite_SetAnimActiveFlag(data->unk_394[0], TRUE); + + switch (data->type) { + case NAME_SCREEN_PLAYER: + if (data->unk_004 == PLAYER_GENDER_MALE) { + Sprite_SetAnimCtrlSeq(data->unk_394[0], 48); + } else { + Sprite_SetAnimCtrlSeq(data->unk_394[0], 49); + } + break; + case NAME_SCREEN_RIVAL: + Sprite_SetAnimCtrlSeq(data->unk_394[0], 51); + break; + case NAME_SCREEN_UNK6: + Sprite_SetAnimCtrlSeq(data->unk_394[0], 55); + break; + case NAME_SCREEN_GROUP: + Sprite_SetAnimCtrlSeq(data->unk_394[0], 54); + break; + case NAME_SCREEN_UNK4: + case NAME_SCREEN_UNK7: + Sprite_SetAnimCtrlSeq(data->unk_394[0], 53); + break; + case NAME_SCREEN_BOX: + Sprite_SetAnimCtrlSeq(data->unk_394[0], 47); + break; + case NAME_SCREEN_POKEMON: + Sprite_SetAnimCtrlSeq(data->unk_394[0], 50); + if (data->unk_010 != 2) { + tmplate->position.x = (13 * data->maxLen + 80) * FX32_ONE; + tmplate->position.y = FX32_CONST(27); + data->unk_394[1] = Sprite_CreateAffine(tmplate); + if (data->unk_010 == 0) { + Sprite_SetAnimCtrlSeq(data->unk_394[1], 45); + } else { + Sprite_SetAnimCtrlSeq(data->unk_394[1], 46); + } + } + break; + } +} + +typedef struct SysTaskData_02083CAC { + Sprite *sprite; + int state; + fx32 x; + int y; +} SysTaskData_02083CAC; + +void sub_02083CAC(SysTask *task, void *taskData) { + SysTaskData_02083CAC *data = taskData; + + VecFx32 matrix; + + matrix.y = data->y; + matrix.z = 0; + switch (data->state) { + case 0: + matrix.x = data->x + FX32_CONST(4); + Sprite_SetMatrix(data->sprite, &matrix); + break; + case 2: + matrix.x = data->x - FX32_CONST(3); + Sprite_SetMatrix(data->sprite, &matrix); + break; + case 4: + matrix.x = data->x + FX32_CONST(2); + Sprite_SetMatrix(data->sprite, &matrix); + break; + case 6: + matrix.x = data->x; + Sprite_SetMatrix(data->sprite, &matrix); + DestroySysTaskAndEnvironment(task); // invalidates data + break; + } + ++data->state; // UB: potential use after free +} + +void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData) { + GFBgLayer bgId_prev = *pBgId; + GFBgLayer bgId_curr = (GFBgLayer)(bgId_prev ^ 1); + + switch (*pState) { + case 0: { + u16 fillVal = _02101D40[pageNum] | (_02101D40[pageNum] << 4); + GfGfxLoader_LoadScrnData(NARC_a_0_3_1, pageNum + 6, bgConfig, bgId_prev, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + sub_0208423C(posVecs, bgId_prev); + sub_02084E54(&windows[bgId_prev], fillVal, pageNum, MAKE_TEXT_COLOR(14, 15, 0), pRawData); + ++(*pState); + break; + } + case 1: + BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_X, 238); + BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_Y, -80); + ++*(pState); + break; + case 2: + posVecs[bgId_prev].x -= 24; + if (posVecs[bgId_prev].x < -1) { + SysTaskData_02083CAC *data; + SysTask *task; + + task = CreateSysTaskAndEnvironment(sub_02083CAC, sizeof(SysTaskData_02083CAC), 0, HEAP_ID_NAMING_SCREEN); + data = SysTask_GetData(task); + data->sprite = pSprites[7]; + data->state = 0; + data->x = Sprite_GetMatrixPtr(pSprites[7])->x; + data->y = Sprite_GetMatrixPtr(pSprites[7])->y; + posVecs[bgId_prev].x = -11; + ++(*pState); + } + posVecs[bgId_curr].y -= 10; + if (posVecs[bgId_curr].y < -196) { + posVecs[bgId_curr].y = -196; + } + BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_X, posVecs[bgId_prev].x); + BgSetPosTextAndCommit(bgConfig, bgId_curr, BG_POS_OP_SET_Y, posVecs[bgId_curr].y); + break; + case 3: + posVecs[bgId_curr].y -= 10; + if (posVecs[bgId_curr].y < -196) { + posVecs[bgId_curr].y = -196; + } + BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_X, posVecs[bgId_prev].x); + BgSetPosTextAndCommit(bgConfig, bgId_curr, BG_POS_OP_SET_Y, posVecs[bgId_curr].y); + if (posVecs[bgId_prev].x == -11 && posVecs[bgId_curr].y == -196) { + ++(*pState); + (*pBgId) ^= 1; + sub_0208421C(bgConfig, *pBgId, posVecs); + PlaySE(SEQ_SE_DP_NAMEIN_01); + } + break; + case 4: + break; + } +} + +void sub_02083F18(Window *window, int unused, String *msg) { + DrawFrameAndWindow2(window, FALSE, 0x100, 10); + AddTextPrinterParameterized(window, 1, msg, 0, 0, TEXT_SPEED_INSTANT, NULL); + CopyWindowToVram(window); +} + +void sub_02083F48(Window *window, int unused, String *msg) { + int x = 16; + int width = FontID_String_GetWidth(0, msg, 0); + int windowWidth = GetWindowWidth(window) * 8; + if (width + 16 > windowWidth) { + x = windowWidth - width; + } + FillWindowPixelBuffer(window, 1); + AddTextPrinterParameterizedWithColor(window, 0, msg, x, 0, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + CopyWindowToVram(window); +} From ea98e89366f4386f729b7dfb1867c12b2de83791 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 12 Oct 2024 13:46:15 -0400 Subject: [PATCH 11/25] through sub_02084264 --- asm/unk_02082908.s | 357 +------------------------------------------- src/naming_screen.c | 89 ++++++++++- 2 files changed, 82 insertions(+), 364 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index f650de1962..d41c8aea37 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -13,365 +13,10 @@ .extern NamingScreenApp_Init .extern NamingScreenApp_Main .extern NamingScreenApp_Exit - .extern sub_02083F18 - .extern sub_02083F48 + .extern sub_02084264 .text - thumb_func_start sub_02083F9C -sub_02083F9C: ; 0x02083F9C - push {r4, r5, r6, r7, lr} - sub sp, #0x14 - add r6, r1, #0 - mov r1, #1 - add r5, r0, #0 - str r1, [sp] - mov r0, #0x1a - str r0, [sp, #4] - mov r0, #0xc - str r0, [sp, #8] - str r1, [sp, #0xc] - add r0, #0xf4 - str r0, [sp, #0x10] - mov r0, #0x16 - lsl r0, r0, #4 - mov r1, #0xee - lsl r1, r1, #2 - add r4, r2, #0 - ldr r0, [r5, r0] - add r1, r5, r1 - mov r2, #0 - mov r3, #2 - bl AddWindowParameterized - mov r2, #1 - mov r1, #0xf2 - lsl r1, r1, #2 - str r2, [sp] - mov r0, #0x1a - str r0, [sp, #4] - mov r0, #0xc - str r0, [sp, #8] - mov r0, #0x8e - str r2, [sp, #0xc] - lsl r0, r0, #2 - str r0, [sp, #0x10] - sub r0, #0xd8 - ldr r0, [r5, r0] - add r1, r5, r1 - mov r3, #2 - bl AddWindowParameterized - ldr r0, [r5] - cmp r0, #4 - bne _02084040 - mov r0, #0 - str r0, [sp] - mov r0, #0xe - lsl r0, r0, #6 - str r0, [sp, #4] - mov r3, #1 - mov r2, #0x16 - str r3, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - lsl r2, r2, #4 - ldr r2, [r5, r2] - add r0, r4, #0 - mov r1, #9 - bl GfGfxLoader_LoadScrnDataFromOpenNarc - mov r0, #0x46 - mov r1, #4 - lsl r0, r0, #4 - str r1, [r5, r0] - add r0, r5, #0 - add r0, #0x3a - bl sub_02084830 - mov r0, #0x4b - lsl r0, r0, #4 - ldr r1, [r5, r0] - sub r0, #0xe8 - ldr r1, [r1, #0x14] - ldr r3, _02084200 ; =0x000E0F00 - str r1, [sp] - ldr r1, _02084204 ; =0x00000A0A - add r0, r5, r0 - mov r2, #4 - bl sub_02084E54 - b _0208406A -_02084040: - mov r0, #0x46 - mov r1, #0 - lsl r0, r0, #4 - str r1, [r5, r0] - add r0, r5, #0 - add r0, #0x3a - bl sub_02084830 - mov r1, #0x4b - lsl r1, r1, #4 - ldr r0, [r5, r1] - ldr r3, _02084200 ; =0x000E0F00 - ldr r0, [r0, #0x14] - mov r2, #0 - str r0, [sp] - add r0, r1, #0 - sub r0, #0xe8 - add r0, r5, r0 - sub r1, #0xac - bl sub_02084E54 -_0208406A: - mov r2, #2 - str r2, [sp] - mov r3, #0x16 - str r3, [sp, #4] - mov r1, #0x37 - str r2, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - lsl r1, r1, #4 - str r1, [sp, #0x10] - lsl r0, r3, #4 - add r1, #0x68 - ldr r0, [r5, r0] - add r1, r5, r1 - mov r3, #7 - bl AddWindowParameterized - ldr r1, [r5, #0xc] - mov r0, #0xc - add r2, r1, #0 - mul r2, r0 - asr r0, r2, #2 - lsr r0, r0, #0x1d - add r0, r2, r0 - asr r0, r0, #3 - add r4, r0, #1 - mov r0, #3 - str r0, [sp] - lsl r0, r4, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #4] - mov r2, #2 - mov r1, #0xe7 - str r2, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - lsl r1, r1, #2 - mov r0, #0x16 - str r1, [sp, #0x10] - lsl r0, r0, #4 - add r1, #0x4c - ldr r0, [r5, r0] - add r1, r5, r1 - mov r3, #0xa - bl AddWindowParameterized - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r5, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #3 - str r0, [sp] - mov r0, #7 - str r0, [sp, #4] - mov r2, #2 - mov r1, #0xf - add r4, #9 - lsl r3, r4, #0x18 - str r2, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - lsl r1, r1, #6 - mov r0, #0x16 - str r1, [sp, #0x10] - lsl r0, r0, #4 - add r1, #0x78 - ldr r0, [r5, r0] - add r1, r5, r1 - lsr r3, r3, #0x18 - bl AddWindowParameterized - ldr r0, _02084208 ; =0x00000438 - mov r1, #1 - add r0, r5, r0 - bl FillWindowPixelBuffer - ldr r1, [r5] - cmp r1, #5 - bne _02084122 - mov r2, #0x61 - ldr r0, _02084208 ; =0x00000438 - lsl r2, r2, #2 - ldr r2, [r5, r2] - add r0, r5, r0 - bl sub_02083F48 - ldr r0, _02084208 ; =0x00000438 - add r0, r5, r0 - bl CopyWindowToVram -_02084122: - mov r0, #0x13 - str r0, [sp] - mov r0, #0x1b - str r0, [sp, #4] - mov r2, #4 - ldr r1, _0208420C ; =0x00000448 - str r2, [sp, #8] - mov r0, #0xc - str r0, [sp, #0xc] - mov r0, #0x84 - str r0, [sp, #0x10] - add r0, #0xdc - ldr r0, [r5, r0] - add r1, r5, r1 - mov r3, #2 - bl AddWindowParameterized - ldr r0, _0208420C ; =0x00000448 - mov r1, #0xf - add r0, r5, r0 - bl FillWindowPixelBuffer - mov r2, #0x5e - ldr r0, _0208420C ; =0x00000448 - lsl r2, r2, #2 - ldr r1, [r5] - ldr r2, [r5, r2] - add r0, r5, r0 - bl sub_02083F18 - add r0, r6, #0 - bl OverlayManager_GetArgs - mov r1, #0x46 - lsl r1, r1, #2 - ldrh r2, [r5, r1] - ldr r0, _02084210 ; =0x0000FFFF - cmp r2, r0 - beq _02084198 - add r0, r5, #0 - add r0, #0xd8 - add r1, r5, r1 - bl CopyU16StringArray - mov r0, #0xc - str r0, [sp] - mov r2, #0 - add r1, r5, #0 - ldr r0, _02084214 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r5, r0 - add r1, #0xd8 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 -_02084198: - mov r0, #0xee - lsl r0, r0, #2 - mov r4, #0 - add r7, r5, r0 -_020841A0: - add r0, r4, #4 - lsl r6, r0, #4 - mov r0, #0 - str r0, [sp] - mov r0, #2 - str r0, [sp, #4] - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - mov r0, #0x78 - str r0, [sp, #0x10] - add r0, #0xe8 - ldr r0, [r5, r0] - add r1, r7, r6 - mov r2, #2 - mov r3, #0 - bl AddWindowParameterized - add r0, r7, r6 - mov r1, #0 - bl FillWindowPixelBuffer - add r4, r4, #1 - cmp r4, #3 - blt _020841A0 - mov r3, #0 - str r3, [sp] - mov r0, #0x10 - str r0, [sp, #4] - mov r2, #2 - str r2, [sp, #8] - ldr r1, _02084218 ; =0x00000428 - str r3, [sp, #0xc] - mov r0, #0x84 - str r0, [sp, #0x10] - add r0, #0xdc - ldr r0, [r5, r0] - add r1, r5, r1 - bl AddWindowParameterized - ldr r0, _02084218 ; =0x00000428 - mov r1, #0 - add r0, r5, r0 - bl FillWindowPixelBuffer - add sp, #0x14 - pop {r4, r5, r6, r7, pc} - nop -_02084200: .word 0x000E0F00 -_02084204: .word 0x00000A0A -_02084208: .word 0x00000438 -_0208420C: .word 0x00000448 -_02084210: .word 0x0000FFFF -_02084214: .word 0x000E0F01 -_02084218: .word 0x00000428 - thumb_func_end sub_02083F9C - - thumb_func_start sub_0208421C -sub_0208421C: ; 0x0208421C - push {r4, lr} - add r4, r1, #0 - lsl r0, r4, #0x18 - lsr r0, r0, #0x18 - mov r1, #1 - bl SetBgPriority - mov r0, #1 - eor r0, r4 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - mov r1, #2 - bl SetBgPriority - pop {r4, pc} - .balign 4, 0 - thumb_func_end sub_0208421C - - thumb_func_start sub_0208423C -sub_0208423C: ; 0x0208423C - push {r3, r4} - mov r3, #0xc - add r4, r1, #0 - mul r4, r3 - mov r2, #0xee - str r2, [r0, r4] - add r2, r3, #0 - sub r2, #0x5c - add r4, r0, r4 - str r2, [r4, #4] - mov r4, #1 - eor r1, r4 - mul r3, r1 - sub r4, #0xc - str r4, [r0, r3] - add r0, r0, r3 - str r2, [r0, #4] - pop {r3, r4} - bx lr - .balign 4, 0 - thumb_func_end sub_0208423C - - thumb_func_start sub_02084264 -sub_02084264: ; 0x02084264 - cmp r0, r2 - blt _0208426A - add r0, r1, #0 -_0208426A: - cmp r0, r1 - bge _02084270 - sub r0, r2, #1 -_02084270: - bx lr - .balign 4, 0 - thumb_func_end sub_02084264 - thumb_func_start sub_02084274 sub_02084274: ; 0x02084274 push {r3, r4, r5, r6, r7, lr} diff --git a/src/naming_screen.c b/src/naming_screen.c index 37c939c8bd..b0290cc4b8 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -45,7 +45,7 @@ typedef struct NamingScreenAppData { int unk_02C; int unk_030; int unk_034; - u8 unk_038[0x2]; + u16 unk_038; u16 unk_03A[6][13]; u8 filler_0D6[2]; u16 unk_0D8[0x20]; @@ -121,11 +121,12 @@ void sub_020839EC(NamingScreenAppData *data); void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate); void sub_02083CAC(SysTask *task, void *taskData); void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData); -void sub_02083F18(Window *window, int unused, String *msg); -void sub_02083F48(Window *window, int unused, String *msg); +void sub_02083F18(Window *window, NameScreenType unused, String *msg); +void sub_02083F48(Window *window, NameScreenType unused, String *msg); void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); -sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); +void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId); +int sub_02084264(int val, int lo, int hi); void sub_0208432C(NamingScreenAppData *data); void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); void sub_02084740(Window *a0, u16 *a1, u16 a2, void *a3, void *a4, String *a5); @@ -134,7 +135,8 @@ int sub_02084884(NamingScreenAppData *data, int key, BOOL a2); void sub_02084E18(Sprite **sprites, int a1); void sub_02084F3C(int *a0, Sprite **a1, int a2); void sub_02084FCC(NamingScreenAppData *data); -void sub_02084500(void *a0); +void sub_02084500(u16 *a0); +void sub_02084540(Window *window, const u16 *rawChars, int a2, int a3, int a4, int a5, u32 color, int a7); static NamingScreenAppData *_021D43B0; @@ -263,7 +265,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { } sub_02083D34(data->bgConfig, data->unk_3B8, &data->unk_45C, data->unk_460, &data->unk_464, data->unk_468, data->unk_32C, data->unk_4B0->pRawData); sub_02084F3C(data->unk_490, data->unk_32C, data->unk_460); - sub_02084500(data->unk_038); + sub_02084500(&data->unk_038); break; case 3: if (IsPaletteFadeFinished()) { @@ -1110,13 +1112,13 @@ void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, } } -void sub_02083F18(Window *window, int unused, String *msg) { +void sub_02083F18(Window *window, NameScreenType unused, String *msg) { DrawFrameAndWindow2(window, FALSE, 0x100, 10); AddTextPrinterParameterized(window, 1, msg, 0, 0, TEXT_SPEED_INSTANT, NULL); CopyWindowToVram(window); } -void sub_02083F48(Window *window, int unused, String *msg) { +void sub_02083F48(Window *window, NameScreenType unused, String *msg) { int x = 16; int width = FontID_String_GetWidth(0, msg, 0); int windowWidth = GetWindowWidth(window) * 8; @@ -1127,3 +1129,74 @@ void sub_02083F48(Window *window, int unused, String *msg) { AddTextPrinterParameterizedWithColor(window, 0, msg, x, 0, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); CopyWindowToVram(window); } + +void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc) { + AddWindowParameterized(data->bgConfig, &data->unk_3B8[0], GF_BG_LYR_MAIN_0, 2, 1, 26, 12, 1, 0x100); + AddWindowParameterized(data->bgConfig, &data->unk_3B8[1], GF_BG_LYR_MAIN_1, 2, 1, 26, 12, 1, 0x238); + + if (data->type == NAME_SCREEN_UNK4) { + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, 9, data->bgConfig, GF_BG_LYR_MAIN_1, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + data->unk_460 = 4; + sub_02084830(data->unk_03A, 4); + sub_02084E54(&data->unk_3B8[1], 0x0A0A, 4, MAKE_TEXT_COLOR(14, 15, 0), data->unk_4B0->pRawData); + } else { + data->unk_460 = 0; + sub_02084830(data->unk_03A, 0); + sub_02084E54(&data->unk_3B8[1], 0x0404, 0, MAKE_TEXT_COLOR(14, 15, 0), data->unk_4B0->pRawData); + } + + AddWindowParameterized(data->bgConfig, &data->unk_3B8[2], GF_BG_LYR_MAIN_2, 7, 2, 22, 2, 0, 0x370); + + int win3Width = (data->maxLen * 12) / 8 + 1; + AddWindowParameterized(data->bgConfig, &data->unk_3B8[3], GF_BG_LYR_MAIN_2, 10, 3, win3Width, 2, 0, 0x39C); + FillWindowPixelBuffer(&data->unk_3B8[3], 1); + + AddWindowParameterized(data->bgConfig, &data->unk_3B8[8], GF_BG_LYR_MAIN_2, win3Width + 9, 3, 7, 2, 0, 0x3C0); + FillWindowPixelBuffer(&data->unk_3B8[8], 1); + + if (data->type == NAME_SCREEN_GROUP) { + sub_02083F48(&data->unk_3B8[8], data->type, data->unk_184); + CopyWindowToVram(&data->unk_3B8[8]); + } + + AddWindowParameterized(data->bgConfig, &data->unk_3B8[9], GF_BG_LYR_SUB_0, 2, 19, 27, 4, 12, 0x084); + FillWindowPixelBuffer(&data->unk_3B8[9], 15); + sub_02083F18(&data->unk_3B8[9], data->type, data->unk_178); + + OverlayManager_GetArgs(ovyMan); + + if (data->unk_118[0] != EOS) { + CopyU16StringArray(data->unk_0D8, data->unk_118); + sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, 0, MAKE_TEXT_COLOR(14, 15, 1), 0); + } + + for (int i = 0; i < 3; ++i) { + AddWindowParameterized(data->bgConfig, &data->unk_3B8[i + 4], GF_BG_LYR_MAIN_2, 0, 0, 2, 2, 0, 0x078); + FillWindowPixelBuffer(&data->unk_3B8[i + 4], 0); + } + + AddWindowParameterized(data->bgConfig, &data->unk_3B8[7], GF_BG_LYR_MAIN_2, 0, 0, 16, 2, 0, 0x084); + FillWindowPixelBuffer(&data->unk_3B8[7], 0); +} + +void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos) { + SetBgPriority(bgId, 1); + SetBgPriority(bgId ^ 1, 2); +} + +void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId) { + posVecs[bgId].x = 238; + posVecs[bgId].y = -80; + posVecs[bgId ^ 1].x = -11; + posVecs[bgId ^ 1].y = -80; +} + +int sub_02084264(int val, int lo, int hi) { + if (val >= hi) { + val = lo; + } + if (val < lo) { + val = hi - 1; + } + return val; +} From f266432b4206facc844d0457217a4053becb9657 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 13 Oct 2024 07:51:56 -0400 Subject: [PATCH 12/25] through sub_02084830 --- asm/unk_02082908.s | 835 ++--------------------------------------- include/unk_02013534.h | 2 + src/naming_screen.c | 330 +++++++++++++++- 3 files changed, 344 insertions(+), 823 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index d41c8aea37..065eac6924 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -14,796 +14,15 @@ .extern NamingScreenApp_Main .extern NamingScreenApp_Exit .extern sub_02084264 + .extern sub_02084430 + .extern sub_02084540 + .extern sub_02084640 + .extern sub_02084664 + .extern sub_02084740 + .extern sub_02084830 .text - thumb_func_start sub_02084274 -sub_02084274: ; 0x02084274 - push {r3, r4, r5, r6, r7, lr} - add r5, r0, #0 - cmp r1, #0 - beq _02084318 - ldr r3, [r5, #0x20] - mov r2, #0x1a - mul r2, r3 - ldr r0, [r5, #0x1c] - add r3, r5, r2 - lsl r2, r0, #1 - add r2, r3, r2 - ldrh r2, [r2, #0x3a] - lsl r6, r1, #3 - ldr r1, _0208431C ; =_02102168 - str r2, [sp] - ldr r1, [r1, r6] - mov r2, #0xd - add r0, r0, r1 - mov r1, #0 - bl sub_02084264 - add r4, r0, #0 - ldr r0, _02084320 ; =_02102168 + 4 - ldr r1, [r5, #0x20] - ldr r0, [r0, r6] - mov r2, #6 - add r0, r1, r0 - mov r1, #0 - bl sub_02084264 - add r7, r0, #0 - ldr r0, _0208431C ; =_02102168 - add r6, r0, r6 - b _020842F6 -_020842B8: - ldr r1, [r5, #0x28] - cmp r1, #0 - bne _020842DA - ldr r1, _02084324 ; =0x0000D004 - cmp r0, r1 - bne _020842DA - ldr r0, [r6, #4] - cmp r0, #0 - beq _020842DA - ldr r0, [r5, #0x2c] - mov r1, #0 - add r0, r4, r0 - mov r2, #0xd - bl sub_02084264 - add r4, r0, #0 - b _020842F6 -_020842DA: - ldr r0, [r6] - mov r1, #0 - add r0, r4, r0 - mov r2, #0xd - bl sub_02084264 - add r4, r0, #0 - ldr r0, [r6, #4] - mov r1, #0 - add r0, r7, r0 - mov r2, #6 - bl sub_02084264 - add r7, r0, #0 -_020842F6: - mov r0, #0x1a - mul r0, r7 - lsl r1, r4, #1 - add r0, r5, r0 - add r0, r1, r0 - ldrh r0, [r0, #0x3a] - ldr r1, _02084324 ; =0x0000D004 - cmp r0, r1 - beq _020842B8 - ldr r1, [sp] - cmp r1, r0 - bne _02084314 - ldr r1, _02084328 ; =0x0000E001 - cmp r0, r1 - bhi _020842B8 -_02084314: - str r4, [r5, #0x1c] - str r7, [r5, #0x20] -_02084318: - pop {r3, r4, r5, r6, r7, pc} - nop -_0208431C: .word _02102168 -_02084320: .word _02102168 + 4 -_02084324: .word 0x0000D004 -_02084328: .word 0x0000E001 - thumb_func_end sub_02084274 - - thumb_func_start sub_0208432C -sub_0208432C: ; 0x0208432C - push {r3, r4, r5, r6, r7, lr} - add r5, r0, #0 - mov r0, #0xd3 - lsl r0, r0, #2 - mov r4, #0 - ldr r0, [r5, r0] - add r6, r4, #0 - add r7, r4, #0 - bl Sprite_GetVisibleFlag - cmp r0, #0 - bne _02084346 - mov r7, #1 -_02084346: - ldr r0, _02084424 ; =gSystem - ldr r1, [r0, #0x4c] - mov r0, #0x40 - tst r0, r1 - beq _02084366 - ldr r0, _02084428 ; =0x000005DC - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r6, #1 - add r4, r4, #1 -_02084366: - ldr r0, _02084424 ; =gSystem - ldr r1, [r0, #0x4c] - mov r0, #0x80 - tst r0, r1 - beq _02084386 - ldr r0, _02084428 ; =0x000005DC - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r6, #2 - add r4, r4, #1 -_02084386: - ldr r0, _02084424 ; =gSystem - ldr r1, [r0, #0x4c] - mov r0, #0x20 - tst r0, r1 - beq _020843A6 - ldr r0, _02084428 ; =0x000005DC - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r6, #3 - add r4, r4, #1 -_020843A6: - ldr r0, _02084424 ; =gSystem - ldr r1, [r0, #0x4c] - mov r0, #0x10 - tst r0, r1 - beq _020843C6 - ldr r0, _02084428 ; =0x000005DC - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r6, #4 - add r4, r4, #1 -_020843C6: - ldr r0, _02084424 ; =gSystem - ldr r1, [r0, #0x48] - mov r0, #8 - tst r0, r1 - beq _020843EC - ldr r0, _02084428 ; =0x000005DC - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r0, #0xc - str r0, [r5, #0x1c] - mov r0, #0 - str r0, [r5, #0x20] - add r4, r4, #1 -_020843EC: - add r0, r5, #0 - bl sub_0208503C - ldr r1, _0208442C ; =0x000005C8 - str r0, [r5, r1] - ldr r0, [r5, r1] - cmp r0, #1 - bne _02084400 - mov r6, #0 - add r4, r4, #1 -_02084400: - cmp r7, #1 - bne _0208440E - add r0, r5, #0 - add r1, r6, #0 - mov r4, #0 - bl sub_02084430 -_0208440E: - cmp r4, #0 - beq _02084422 - add r0, r5, #0 - add r1, r6, #0 - bl sub_02084274 - add r0, r5, #0 - add r1, r6, #0 - bl sub_02084430 -_02084422: - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02084424: .word gSystem -_02084428: .word 0x000005DC -_0208442C: .word 0x000005C8 - thumb_func_end sub_0208432C - - thumb_func_start sub_02084430 -sub_02084430: ; 0x02084430 - push {r3, r4, r5, lr} - sub sp, #0x18 - add r5, r0, #0 - add r4, r1, #0 - ldr r1, [r5, #0x20] - cmp r1, #0 - beq _0208448A - ldr r0, [r5, #0x28] - cmp r0, #0 - bne _02084454 - cmp r0, r1 - beq _02084454 - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #0x27 - bl Sprite_SetAnimCtrlSeq -_02084454: - cmp r4, #0 - beq _02084464 - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #0x27 - bl Sprite_SetAnimCtrlSeq -_02084464: - ldr r0, [r5, #0x1c] - lsl r0, r0, #4 - add r0, #0x1a - lsl r0, r0, #0xc - str r0, [sp, #0xc] - ldr r0, [r5, #0x20] - sub r1, r0, #1 - mov r0, #0x13 - mul r0, r1 - add r0, #0x5b - lsl r0, r0, #0xc - str r0, [sp, #0x10] - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - add r1, sp, #0xc - bl Sprite_SetMatrix - b _020844C6 -_0208448A: - mov r0, #0x1a - mul r0, r1 - add r1, r5, r0 - ldr r0, [r5, #0x1c] - lsl r0, r0, #1 - add r0, r1, r0 - ldrh r1, [r0, #0x3a] - ldr r0, _020844F0 ; =0x0000E002 - sub r1, r1, r0 - ldr r0, _020844F4 ; =_02101D80 - lsl r2, r1, #1 - ldrh r0, [r0, r2] - ldr r2, _020844F8 ; =_02101D4C - lsl r0, r0, #0xc - str r0, [sp] - mov r0, #0x11 - lsl r0, r0, #0xe - str r0, [sp, #4] - mov r0, #0xd3 - lsl r0, r0, #2 - ldrb r1, [r2, r1] - ldr r0, [r5, r0] - bl Sprite_SetAnimCtrlSeq - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - add r1, sp, #0 - bl Sprite_SetMatrix -_020844C6: - mov r0, #0xb4 - strh r0, [r5, #0x38] - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #0 - bl Sprite_SetAnimCtrlCurrentFrame - ldr r0, [r5, #0x1c] - lsl r1, r4, #3 - str r0, [r5, #0x24] - ldr r0, [r5, #0x20] - str r0, [r5, #0x28] - ldr r0, _020844FC ; =_02102168 - ldr r0, [r0, r1] - cmp r0, #0 - beq _020844EA - str r0, [r5, #0x2c] -_020844EA: - add sp, #0x18 - pop {r3, r4, r5, pc} - nop -_020844F0: .word 0x0000E002 -_020844F4: .word _02101D80 -_020844F8: .word _02101D4C -_020844FC: .word _02102168 - thumb_func_end sub_02084430 - - thumb_func_start sub_02084500 -sub_02084500: ; 0x02084500 - push {r3, lr} - ldrh r1, [r0] - add r1, #0x14 - strh r1, [r0] - ldrh r2, [r0] - mov r1, #0x5a - lsl r1, r1, #2 - cmp r2, r1 - bls _02084516 - mov r1, #0 - strh r1, [r0] -_02084516: - ldrh r0, [r0] - bl GF_SinDeg - mov r1, #0xa - mul r1, r0 - asr r0, r1, #0xb - lsr r0, r0, #0x14 - add r0, r1, r0 - asr r0, r0, #0xc - add r0, #0xf - lsl r1, r0, #5 - mov r0, #0x1d - orr r1, r0 - add r0, sp, #0 - strh r1, [r0] - add r0, sp, #0 - mov r1, #0x3a - mov r2, #2 - bl GX_LoadOBJPltt - pop {r3, pc} - thumb_func_end sub_02084500 - - thumb_func_start sub_02084540 -sub_02084540: ; 0x02084540 - push {r4, r5, r6, r7, lr} - sub sp, #0x3c - str r0, [sp, #0x18] - add r7, r1, #0 - mov r0, #2 - mov r1, #0x12 - str r2, [sp, #0x1c] - str r3, [sp, #0x20] - mov r4, #0 - bl String_New - str r0, [sp, #0x28] - ldrh r1, [r7] - ldr r0, _02084630 ; =0x0000FFFF - cmp r1, r0 - beq _02084626 - ldr r0, [sp, #0x54] - ldr r6, [sp, #0x50] - str r0, [sp, #0x24] - ldr r0, [sp, #0x58] - str r0, [sp, #0x34] - ldr r0, [sp, #0x20] - add r0, r0, #2 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - str r0, [sp, #0x2c] - ldr r0, [sp, #0x5c] - str r0, [sp, #0x30] -_02084578: - lsl r0, r4, #1 - ldrh r1, [r7, r0] - ldr r0, _02084634 ; =0x00002FFF - add r0, r1, r0 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - cmp r0, #2 - bhi _020845C4 - mov r0, #0xc - str r0, [sp] - str r0, [sp, #4] - add r2, r4, #0 - ldr r0, [sp, #0x1c] - mul r2, r6 - add r0, r0, r2 - ldr r2, _02084638 ; =0x0000D001 - lsl r0, r0, #0x10 - sub r1, r1, r2 - lsl r1, r1, #0x10 - lsr r0, r0, #0x10 - lsr r2, r1, #8 - str r0, [sp, #8] - ldr r0, [sp, #0x2c] - lsr r1, r2, #0x1f - add r1, r2, r1 - str r0, [sp, #0xc] - mov r0, #0xc - asr r2, r1, #1 - ldr r1, [sp, #0x30] - str r0, [sp, #0x10] - str r0, [sp, #0x14] - add r1, r1, r2 - mov r2, #0 - ldr r0, [sp, #0x18] - add r3, r2, #0 - bl BlitBitmapRectToWindow - b _0208461A -_020845C4: - ldr r0, _0208463C ; =0x0000D004 - cmp r1, r0 - bne _020845CE - add r4, r4, #1 - b _0208461C -_020845CE: - add r0, sp, #0x38 - strh r1, [r0] - ldr r1, _02084630 ; =0x0000FFFF - strh r1, [r0, #2] - mov r0, #0 - add r1, sp, #0x38 - add r2, r0, #0 - bl FontID_FlatArray_GetWidth - add r5, r0, #0 - ldr r0, [sp, #0x28] - add r1, sp, #0x38 - bl CopyU16ArrayToString - ldr r0, [sp, #0x20] - sub r3, r6, r5 - str r0, [sp] - ldr r0, [sp, #0x24] - lsr r5, r3, #0x1f - add r5, r3, r5 - asr r3, r5, #1 - str r0, [sp, #4] - ldr r0, [sp, #0x34] - mov ip, r3 - add r5, r4, #0 - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - ldr r3, [sp, #0x1c] - mul r5, r6 - add r3, r3, r5 - mov r5, ip - ldr r0, [sp, #0x18] - ldr r2, [sp, #0x28] - mov r1, #0 - add r3, r5, r3 - bl AddTextPrinterParameterizedWithColor -_0208461A: - add r4, r4, #1 -_0208461C: - lsl r0, r4, #1 - ldrh r1, [r7, r0] - ldr r0, _02084630 ; =0x0000FFFF - cmp r1, r0 - bne _02084578 -_02084626: - ldr r0, [sp, #0x28] - bl String_Delete - add sp, #0x3c - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_02084630: .word 0x0000FFFF -_02084634: .word 0x00002FFF -_02084638: .word 0x0000D001 -_0208463C: .word 0x0000D004 - thumb_func_end sub_02084540 - - thumb_func_start sub_02084640 -sub_02084640: ; 0x02084640 - push {r4, r5, r6, lr} - sub sp, #0x10 - mov r5, #0 - add r6, r1, #0 - str r5, [sp] - mov r1, #0xff - str r1, [sp, #4] - str r3, [sp, #8] - add r1, r2, #0 - add r2, r6, #0 - add r3, r5, #0 - add r4, r0, #0 - str r5, [sp, #0xc] - bl AddTextPrinterParameterizedWithColor - ldr r0, [r4, #0xc] - add sp, #0x10 - pop {r4, r5, r6, pc} - thumb_func_end sub_02084640 - - thumb_func_start sub_02084664 -sub_02084664: ; 0x02084664 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x38 - add r6, r0, #0 - str r1, [sp, #8] - add r0, #0x30 - mov r1, #0 - add r5, r2, #0 - add r4, r3, #0 - bl FillWindowPixelBuffer - add r0, r6, #0 - ldr r3, _02084730 ; =0x000D0E0F - add r0, #0x30 - add r1, r4, #0 - mov r2, #2 - bl sub_02084640 - mov r1, #2 - lsl r1, r1, #0xa - bl DC_FlushRange - add r7, r6, #0 - mov r4, #0 - add r7, #0x30 -_02084694: - mov r0, #0 - str r0, [sp] - add r0, r7, #0 - mov r1, #4 - mov r2, #2 - lsl r3, r4, #2 - str r5, [sp, #4] - bl sub_02013A50 - mov r1, #1 - add r0, r5, #0 - lsl r1, r1, #8 - bl DC_FlushRange - ldr r1, _02084734 ; =_02101D3C - mov r2, #1 - ldrb r1, [r1, r4] - add r0, r5, #0 - lsl r2, r2, #8 - lsl r1, r1, #5 - bl GXS_LoadOBJ - add r0, r4, #1 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 - cmp r4, #4 - blo _02084694 - mov r0, #0x15 - mov r1, #0x12 - bl String_New - add r4, r0, #0 - mov r5, #0 -_020846D6: - ldr r0, [sp, #8] - lsl r1, r5, #1 - ldrh r1, [r0, r1] - add r0, sp, #0xc - lsl r7, r5, #4 - strh r1, [r0] - ldr r1, _02084738 ; =0x0000FFFF - strh r1, [r0, #2] - add r0, r6, r7 - mov r1, #0 - bl FillWindowPixelBuffer - add r0, r4, #0 - add r1, sp, #0xc - bl CopyU16ArrayToString - ldr r3, _02084730 ; =0x000D0E0F - add r0, r6, r7 - add r1, r4, #0 - mov r2, #2 - bl sub_02084640 - mov r1, #0x80 - add r7, r0, #0 - bl DC_FlushRange - ldr r1, _0208473C ; =_02101D54 - lsl r2, r5, #2 - ldr r1, [r1, r2] - add r0, r7, #0 - lsl r1, r1, #5 - mov r2, #0x80 - bl GXS_LoadOBJ - add r0, r5, #1 - lsl r0, r0, #0x10 - lsr r5, r0, #0x10 - cmp r5, #3 - blo _020846D6 - add r0, r4, #0 - bl String_Delete - add sp, #0x38 - pop {r3, r4, r5, r6, r7, pc} - nop -_02084730: .word 0x000D0E0F -_02084734: .word _02101D3C -_02084738: .word 0x0000FFFF -_0208473C: .word _02101D54 - thumb_func_end sub_02084664 - - thumb_func_start sub_02084740 -sub_02084740: ; 0x02084740 - push {r3, r4, r5, lr} - cmp r2, #0 - bne _0208474A - ldr r1, _0208481C ; =0x0000D003 - b _02084750 -_0208474A: - sub r2, r2, #1 - lsl r2, r2, #1 - ldrh r1, [r1, r2] -_02084750: - ldr r4, _02084820 ; =0x0000E003 - cmp r1, r4 - bgt _02084780 - bge _020847A6 - ldr r2, _02084824 ; =0x0000D004 - cmp r1, r2 - bgt _02084778 - sub r2, r2, #3 - sub r2, r1, r2 - bmi _020847A8 - add r2, r2, r2 - add r2, pc - ldrh r2, [r2, #6] - lsl r2, r2, #0x10 - asr r2, r2, #0x10 - add pc, r2 -_02084770: ; jump table - .short _020847A6 - _02084770 - 2 ; case 0 - .short _020847A6 - _02084770 - 2 ; case 1 - .short _020847A6 - _02084770 - 2 ; case 2 - .short _020847A6 - _02084770 - 2 ; case 3 -_02084778: - ldr r2, _02084828 ; =0x0000E002 - cmp r1, r2 - beq _020847A6 - b _020847A8 -_02084780: - add r2, r4, #1 - cmp r1, r2 - bgt _0208478A - beq _020847A6 - b _020847A8 -_0208478A: - add r2, r4, #2 - sub r2, r1, r2 - cmp r2, #3 - bhi _020847A8 - add r2, r2, r2 - add r2, pc - ldrh r2, [r2, #6] - lsl r2, r2, #0x10 - asr r2, r2, #0x10 - add pc, r2 -_0208479E: ; jump table - .short _020847A6 - _0208479E - 2 ; case 0 - .short _020847A6 - _0208479E - 2 ; case 1 - .short _020847A6 - _0208479E - 2 ; case 2 - .short _020847A6 - _0208479E - 2 ; case 3 -_020847A6: - mov r1, #1 -_020847A8: - mov r4, #0 - add r5, r3, #0 - mov r2, #1 -_020847AE: - add r4, r4, #1 - strh r2, [r5] - add r5, r5, #2 - cmp r4, #3 - blt _020847AE - strh r1, [r3] - cmp r1, #1 - beq _0208480E - ldr r5, _0208482C ; =_02102422 - mov r2, #0 -_020847C2: - ldrh r4, [r5] - cmp r1, r4 - bne _020847E4 - mov r4, #6 - ldr r5, _0208482C ; =_02102422 - mul r4, r2 - add r4, r5, r4 - mov r1, #0 - add r5, r3, #0 -_020847D4: - ldrh r2, [r4] - add r1, r1, #1 - add r4, r4, #2 - strh r2, [r5] - add r5, r5, #2 - cmp r1, #3 - blt _020847D4 - b _0208480E -_020847E4: - ldrh r4, [r5, #4] - cmp r1, r4 - bne _02084806 - mov r4, #6 - ldr r5, _0208482C ; =_02102422 - mul r4, r2 - add r4, r5, r4 - mov r1, #0 - add r5, r3, #0 -_020847F6: - ldrh r2, [r4] - add r1, r1, #1 - add r4, r4, #2 - strh r2, [r5] - add r5, r5, #2 - cmp r1, #3 - blt _020847F6 - b _0208480E -_02084806: - add r2, r2, #1 - add r5, r5, #6 - cmp r2, #0x52 - blo _020847C2 -_0208480E: - add r1, r3, #0 - ldr r2, [sp, #0x10] - ldr r3, [sp, #0x14] - bl sub_02084664 - pop {r3, r4, r5, pc} - nop -_0208481C: .word 0x0000D003 -_02084820: .word 0x0000E003 -_02084824: .word 0x0000D004 -_02084828: .word 0x0000E002 -_0208482C: .word _02102422 - thumb_func_end sub_02084740 - - thumb_func_start sub_02084830 -sub_02084830: ; 0x02084830 - push {r4, r5, r6, r7} - mov r4, #0 - ldr r3, _0208487C ; =_021104E4 - add r5, r4, #0 - add r6, r0, #0 - lsl r2, r1, #2 -_0208483C: - ldr r7, [r3, r2] - add r4, r4, #1 - ldrh r7, [r7, r5] - add r5, r5, #2 - strh r7, [r6] - add r6, r6, #2 - cmp r4, #0xd - blt _0208483C - mov r3, #0x14 - ldr r4, _02084880 ; =_021104F8 - mul r3, r1 - mov r2, #0 - add r3, r4, r3 - add r1, r2, #0 -_02084858: - add r6, r1, #0 - add r4, r1, #0 - add r5, r0, #0 -_0208485E: - ldr r7, [r3] - add r6, r6, #1 - ldrh r7, [r7, r4] - add r4, r4, #2 - strh r7, [r5, #0x1a] - add r5, r5, #2 - cmp r6, #0xd - blt _0208485E - add r2, r2, #1 - add r3, r3, #4 - add r0, #0x1a - cmp r2, #5 - blt _02084858 - pop {r4, r5, r6, r7} - bx lr - .balign 4, 0 -_0208487C: .word _021104E4 -_02084880: .word _021104F8 - thumb_func_end sub_02084830 - thumb_func_start sub_02084884 sub_02084884: ; 0x02084884 push {r4, r5, r6, lr} @@ -1916,6 +1135,7 @@ _020850F0: .word _02102278 .rodata + .global _02101D3C _02101D3C: .byte 0x60, 0x68, 0x50, 0x58 @@ -1924,9 +1144,13 @@ _02101D40: .byte 0x04, 0x07, 0x0D, 0x0A _02101D44: .byte 0x03, 0x06, 0x0C, 0x09, 0x09, 0x00, 0x00, 0x00 + + .global _02101D4C _02101D4C: .byte 0x28, 0x28, 0x28, 0x28 .byte 0x29, 0x29, 0x29, 0x00 + + .global _02101D54 _02101D54: .word 0x00000070 .word 0x0000004C @@ -1943,6 +1167,7 @@ _02101D70: // ObjCharTransferTemplate .word 0x00000800 .word 0x00000012 + .global _02101D80 _02101D80: .short 0x0019, 0x0039, 0x0059, 0x0061, 0x007A, 0x009E, 0x00C6, 0x0000 .short 0x0003, 0x002B, 0x0020, 0x002F, 0x0001, 0x002B, 0x003F, 0x0009 @@ -2047,6 +1272,8 @@ _02102140: // GraphicsBanks .word 0x00000001, 0x00000000, 0x00000004, 0x00000000 .word 0x00000002, 0x00000000, 0x00000100, 0x00000000 .word 0x00000000, 0x00000000 + + .global _02102168 _02102168: .word 0, 0 .word 0, -1 @@ -2305,6 +1532,7 @@ _02102278: .short 0x0002 .byte 0x0C, 0x05 + .global _02102422 _02102422: .short 0x0003, 0x0001, 0x0002 .short 0x0005, 0x0001, 0x0004 @@ -2396,35 +1624,18 @@ gOverlayTemplate_NamingScreen: .data + .global _021104E4 _021104E4: .word _02101DBE .word _02101DBE .word _02101DBE .word _02101DBE .word _02101DD8 + + .global _021104F8 _021104F8: - .word _02101E80 - .word _02101E9C - .word _02101EB8 - .word _02101E2C - .word _02101E64 - .word _02101EF0 - .word _02101F0C - .word _0210205C - .word _02101F60 - .word _02102024 - .word _02101F98 - .word _02101FD0 - .word _02101FEC - .word _02102008 - .word _02102040 - .word _02101F7C - .word _02101DF2 - .word _02101F44 - .word _02101F28 - .word _02101E48 - .word _021020D4 - .word _021020F8 - .word _0210211C - .word _0210211C - .word _0210211C + .word _02101E80, _02101E9C, _02101EB8, _02101E2C, _02101E64 + .word _02101EF0, _02101F0C, _0210205C, _02101F60, _02102024 + .word _02101F98, _02101FD0, _02101FEC, _02102008, _02102040 + .word _02101F7C, _02101DF2, _02101F44, _02101F28, _02101E48 + .word _021020D4, _021020F8, _0210211C, _0210211C, _0210211C diff --git a/include/unk_02013534.h b/include/unk_02013534.h index 509bf126c9..7cd6592747 100644 --- a/include/unk_02013534.h +++ b/include/unk_02013534.h @@ -1,8 +1,10 @@ #ifndef POKEHEARTGOLD_UNK_02013534_H #define POKEHEARTGOLD_UNK_02013534_H +#include "bg_window.h" #include "heap.h" void *sub_02013534(int, HeapID); +void sub_02013A50(Window *window, int a1, int a2, int a3, int a4, void *a5); #endif // POKEHEARTGOLD_UNK_02013534_H diff --git a/src/naming_screen.c b/src/naming_screen.c index b0290cc4b8..2e928172d8 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -27,6 +27,7 @@ #include "unk_0200ACF0.h" #include "unk_0200B150.h" #include "unk_0200FA24.h" +#include "unk_02013534.h" #include "unk_020163E0.h" #include "vram_transfer_manager.h" @@ -38,8 +39,8 @@ typedef struct NamingScreenAppData { int unk_010; int unk_014; Options *unk_018; - int unk_01C; - int unk_020; + int cursorX; + int cursorY; int unk_024; int unk_028; int unk_02C; @@ -127,22 +128,35 @@ void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId); int sub_02084264(int val, int lo, int hi); +void sub_02084274(NamingScreenAppData *data, int a1); void sub_0208432C(NamingScreenAppData *data); +void sub_02084430(NamingScreenAppData *data, int a1); void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); -void sub_02084740(Window *a0, u16 *a1, u16 a2, void *a3, void *a4, String *a5); -void sub_02084830(u16 (*a0)[13], int a1); +void sub_02084500(u16 *a0); +void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels); +void *sub_02084640(Window *window, String *string, FontID fontId, u32 color); +void sub_02084664(Window *windows, const u16 *a1, void *a2, String *a3); +void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String *a5); +void sub_02084830(u16 (*a0)[13], const int a1); int sub_02084884(NamingScreenAppData *data, int key, BOOL a2); void sub_02084E18(Sprite **sprites, int a1); void sub_02084F3C(int *a0, Sprite **a1, int a2); void sub_02084FCC(NamingScreenAppData *data); -void sub_02084500(u16 *a0); -void sub_02084540(Window *window, const u16 *rawChars, int a2, int a3, int a4, int a5, u32 color, int a7); +BOOL sub_0208503C(NamingScreenAppData *data); static NamingScreenAppData *_021D43B0; extern const int _021020B4[8]; extern const int _021021E8[][4]; extern const u8 _02101D40[]; +extern const int _02102168[][2]; +extern const u16 _02101D80[]; +extern const u8 _02101D4C[]; +extern const u8 _02101D3C[]; +extern const int _02101D54[]; +extern const u16 _02102422[][3]; +extern const u16 *_021104E4[]; +extern const u16 *_021104F8[][5]; BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { NamingScreenAppData *data; @@ -302,10 +316,10 @@ int sub_02082CF8(NamingScreenAppData *data, int a1) { sub_02084830(data->unk_03A, data->unk_460); PlaySE(SEQ_SE_DP_SYU03); } else if (gSystem.newKeys & PAD_BUTTON_A) { - ret = sub_02084884(data, data->unk_03A[data->unk_020][data->unk_01C], TRUE); + ret = sub_02084884(data, data->unk_03A[data->cursorY][data->cursorX], TRUE); data->unk_030 = 1; } else if (data->unk_5C8 == TRUE) { - ret = sub_02084884(data, data->unk_03A[data->unk_020][data->unk_01C], FALSE); + ret = sub_02084884(data, data->unk_03A[data->cursorY][data->cursorX], FALSE); } else if (gSystem.newKeys & PAD_BUTTON_B) { ret = sub_02084884(data, 0xE007, TRUE); } else if (gSystem.newKeys & PAD_BUTTON_R) { @@ -559,8 +573,8 @@ void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { data->unk_17C = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, msg_0249_00009, HEAP_ID_NAMING_SCREEN); data->unk_184 = NewString_ReadMsgData(data->msgData_249, msg_0249_00007); data->unk_158 = StringLength(data->unk_118); - data->unk_01C = 0; - data->unk_020 = 1; + data->cursorX = 0; + data->cursorY = 1; data->unk_024 = -1; data->unk_028 = -1; data->unk_030 = 1; @@ -1167,7 +1181,7 @@ void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc) { if (data->unk_118[0] != EOS) { CopyU16StringArray(data->unk_0D8, data->unk_118); - sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, 0, MAKE_TEXT_COLOR(14, 15, 1), 0); + sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); } for (int i = 0; i < 3; ++i) { @@ -1200,3 +1214,297 @@ int sub_02084264(int val, int lo, int hi) { } return val; } + +void sub_02084274(NamingScreenAppData *data, int a1) { + if (a1 == 0) { + return; + } + + u16 sp0 = data->unk_03A[data->cursorY][data->cursorX]; + int newX = sub_02084264(data->cursorX + _02102168[a1][0], 0, 13); + int newY = sub_02084264(data->cursorY + _02102168[a1][1], 0, 6); + while (data->unk_03A[newY][newX] == 0xD004 || (data->unk_03A[newY][newX] == sp0 && data->unk_03A[newY][newX] > 0xE001)) { + if (data->unk_028 == 0 && data->unk_03A[newY][newX] == 0xD004 && _02102168[a1][1] != 0) { + newX = sub_02084264(newX + data->unk_02C, 0, 13); + } else { + newX = sub_02084264(newX + _02102168[a1][0], 0, 13); + newY = sub_02084264(newY + _02102168[a1][1], 0, 6); + } + } + data->cursorX = newX; + data->cursorY = newY; +} + +void sub_0208432C(NamingScreenAppData *data) { + int r4 = 0; + int r6 = 0; + BOOL r7 = FALSE; + if (!Sprite_GetVisibleFlag(data->unk_32C[8])) { + r7 = TRUE; + } + + if (gSystem.newAndRepeatedKeys & PAD_KEY_UP) { + PlaySE(SEQ_SE_DP_SELECT); + Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); + r6 = 1; + ++r4; + } + if (gSystem.newAndRepeatedKeys & PAD_KEY_DOWN) { + PlaySE(SEQ_SE_DP_SELECT); + Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); + r6 = 2; + ++r4; + } + if (gSystem.newAndRepeatedKeys & PAD_KEY_LEFT) { + PlaySE(SEQ_SE_DP_SELECT); + Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); + r6 = 3; + ++r4; + } + if (gSystem.newAndRepeatedKeys & PAD_KEY_RIGHT) { + PlaySE(SEQ_SE_DP_SELECT); + Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); + r6 = 4; + ++r4; + } + if (gSystem.newKeys & PAD_BUTTON_START) { + PlaySE(SEQ_SE_DP_SELECT); + Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); + data->cursorX = 12; + data->cursorY = 0; + ++r4; + } + data->unk_5C8 = sub_0208503C(data); + if (data->unk_5C8 == TRUE) { + r6 = 0; + ++r4; + } + if (r7 == TRUE) { + r4 = 0; + sub_02084430(data, r6); + } + if (r4) { + sub_02084274(data, r6); + sub_02084430(data, r6); + } +} + +void sub_02084430(NamingScreenAppData *data, int a1) { + if (data->cursorY != 0) { + if (data->unk_028 == 0 && data->unk_028 != data->cursorY) { + Sprite_SetAnimCtrlSeq(data->unk_32C[8], 39); + } + if (a1 != 0) { + Sprite_SetAnimCtrlSeq(data->unk_32C[8], 39); + } + + VecFx32 vec; + vec.x = (data->cursorX * 16 + 26) * FX32_ONE; + vec.y = ((data->cursorY - 1) * 19 + 91) * FX32_ONE; + // vec.z = 0; + Sprite_SetMatrix(data->unk_32C[8], &vec); + } else { + int buttonId = data->unk_03A[data->cursorY][data->cursorX] - 0xE002; + VecFx32 vec; + + vec.x = _02101D80[buttonId] * FX32_ONE; + vec.y = FX32_CONST(68); + // vec.z = 0; + Sprite_SetAnimCtrlSeq(data->unk_32C[8], _02101D4C[buttonId]); + Sprite_SetMatrix(data->unk_32C[8], &vec); + } + + data->unk_038 = 180; + Sprite_SetAnimCtrlCurrentFrame(data->unk_32C[8], 0); + data->unk_024 = data->cursorX; + data->unk_028 = data->cursorY; + if (_02102168[a1][0] != 0) { + data->unk_02C = _02102168[a1][0]; + } +} + +void sub_02084500(u16 *a0) { + *a0 += 20; + if (*a0 > 360) { + *a0 = 0; + } + int val = ((GF_SinDeg(*a0) * 10) / FX32_ONE) + 15; + u16 col = RGB(29, val, 0); + GX_LoadOBJPltt(&col, 0x3A, sizeof(col)); +} + +void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels) { + int i = 0; + int width; + int centerX; + u16 sp38[2]; + String *string = String_New(2, HEAP_ID_NAMING_SCREEN); + while (rawChars[i] != EOS) { + if (rawChars[i] == 0xD001 || rawChars[i] == 0xD002 || rawChars[i] == 0xD003) { + u16 buttonId = rawChars[i] - 0xD001; + BlitBitmapRectToWindow(window, buttonPixels + (buttonId * 256) / 2, 0, 0, 12, 12, x + i * spacing, y + 2, 12, 12); + } else if (rawChars[i] == 0xD004) { + ++i; + continue; + } else { + sp38[0] = rawChars[i]; + sp38[1] = EOS; + width = FontID_FlatArray_GetWidth(0, sp38, 0); + CopyU16ArrayToString(string, sp38); + centerX = x + i * spacing + ((spacing - width) / 2); + AddTextPrinterParameterizedWithColor(window, 0, string, centerX, y, textSpeed, color, NULL); + } + ++i; + } + String_Delete(string); +} + +void *sub_02084640(Window *window, String *string, FontID fontId, u32 color) { + AddTextPrinterParameterizedWithColor(window, fontId, string, 0, 0, TEXT_SPEED_NOTRANSFER, color, NULL); + return window->pixelBuffer; +} + +void sub_02084664(Window *windows, const u16 *a1, void *a2, String *a3) { + u16 spC[21]; + u16 i; + void *ptr; + String *string; + + FillWindowPixelBuffer(&windows[3], 0); + ptr = sub_02084640(&windows[3], a3, 2, MAKE_TEXT_COLOR(13, 14, 15)); + DC_FlushRange(ptr, 0x800); + + for (i = 0; i < 4; ++i) { + sub_02013A50(&windows[3], 4, 2, i * 4, 0, a2); + DC_FlushRange(a2, 0x100); + GXS_LoadOBJ(a2, _02101D3C[i] * 32, 0x100); + } + + string = String_New(21, HEAP_ID_NAMING_SCREEN); + for (i = 0; i < 3; ++i) { + spC[0] = a1[i]; + spC[1] = EOS; + + FillWindowPixelBuffer(&windows[i], 0); + CopyU16ArrayToString(string, spC); + ptr = sub_02084640(&windows[i], string, 2, MAKE_TEXT_COLOR(13, 14, 15)); + DC_FlushRange(ptr, 0x80); + GXS_LoadOBJ(ptr, _02101D54[i] * 32, 0x80); + } + + String_Delete(string); +} + +void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String *a5) { + int i; + int j; + u16 character; + + if (a2 == 0) { + character = 0xD003; + } else { + character = a1[a2 - 1]; + } + + switch (character) { + case 0xD001: + case 0xD002: + case 0xD003: + case 0xD004: + case 0xE002: + case 0xE003: + case 0xE004: + case 0xE005: + case 0xE006: + case 0xE007: + case 0xE008: + character = 1; + break; + } + + for (i = 0; i < 3; ++i) { + a3[i] = 1; + } + + a3[0] = character; + if (character != 1) { + for (i = 0; i < 82u; ++i) { + if (character == _02102422[i][0]) { + for (j = 0; j < 3; ++j) { + a3[j] = _02102422[i][j]; + } + break; + } + if (character == _02102422[i][2]) { + for (j = 0; j < 3; ++j) { + a3[j] = _02102422[i][j]; + } + break; + } + } + } + + sub_02084664(a0, a3, a4, a5); +} + +#ifdef NONMATCHING +void sub_02084830(u16 (*a0)[13], const int a1) { + int i; + int j; + + for (i = 0; i < 13; ++i) { + a0[0][i] = _021104E4[a1][i]; + } + for (j = 0; j < 5; ++j) { + for (i = 0; i < 13; ++i) { + a0[j + 1][i] = _021104F8[a1][j][i]; + } + } +} +#else +// clang-format off +asm void sub_02084830(u16 (*a0)[13], const int a1) { + push {r4, r5, r6, r7} + mov r4, #0 + ldr r3, =_021104E4 + add r5, r4, #0 + add r6, r0, #0 + lsl r2, r1, #2 +_0208483C: + ldr r7, [r3, r2] + add r4, r4, #1 + ldrh r7, [r7, r5] + add r5, r5, #2 + strh r7, [r6, #0] + add r6, r6, #2 + cmp r4, #0xd + blt _0208483C + mov r3, #0x14 + ldr r4, =_021104F8 + mul r3, r1 + mov r2, #0 + add r3, r4, r3 + add r1, r2, #0 +_02084858: + add r6, r1, #0 + add r4, r1, #0 + add r5, r0, #0 +_0208485E: + ldr r7, [r3, #0] + add r6, r6, #1 + ldrh r7, [r7, r4] + add r4, r4, #2 + strh r7, [r5, #0x1a] + add r5, r5, #2 + cmp r6, #0xd + blt _0208485E + add r2, r2, #1 + add r3, r3, #4 + add r0, #0x1a + cmp r2, #5 + blt _02084858 + pop {r4, r5, r6, r7} + bx lr +} +// clang-format on +#endif // NONMATCHING From f74d5586977368a719e46dc7fae710be137c6b62 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 13 Oct 2024 14:23:49 -0400 Subject: [PATCH 13/25] through sub_02084C98 --- asm/unk_02082908.s | 575 +--------------------------------------- include/naming_screen.h | 2 +- src/naming_screen.c | 380 +++++++++++--------------- 3 files changed, 156 insertions(+), 801 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index 065eac6924..26bcde44b0 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -13,585 +13,12 @@ .extern NamingScreenApp_Init .extern NamingScreenApp_Main .extern NamingScreenApp_Exit - .extern sub_02084264 + .extern sub_02084C78 .extern sub_02084430 .extern sub_02084540 - .extern sub_02084640 - .extern sub_02084664 - .extern sub_02084740 - .extern sub_02084830 .text - thumb_func_start sub_02084884 -sub_02084884: ; 0x02084884 - push {r4, r5, r6, lr} - sub sp, #0x10 - add r4, r0, #0 - ldr r0, _02084BBC ; =0x00002FFD - add r5, r1, #0 - add r0, r5, r0 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - add r6, r2, #0 - cmp r0, #1 - bhi _0208489C - mov r5, #1 -_0208489C: - ldr r0, [r4] - cmp r0, #4 - bne _020848B0 - ldr r0, _02084BC0 ; =0x00001FFE - add r0, r5, r0 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - cmp r0, #3 - bhi _020848B0 - mov r5, #1 -_020848B0: - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl Sprite_GetVisibleFlag - cmp r0, #0 - bne _020848D8 - ldr r0, _02084BC4 ; =gSystem + 0x40 - ldrh r0, [r0, #0x24] - cmp r0, #0 - bne _020848D8 - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - add sp, #0x10 - mov r0, #2 - pop {r4, r5, r6, pc} -_020848D8: - ldr r0, _02084BC8 ; =0x0000E002 - cmp r5, r0 - bgt _020848F6 - blt _020848E2 - b _02084A0A -_020848E2: - ldr r3, _02084BCC ; =0x0000D002 - cmp r5, r3 - bgt _020848F4 - sub r0, r3, #1 - cmp r5, r0 - blt _020848F4 - beq _02084918 - cmp r5, r3 - beq _0208496A -_020848F4: - b _02084B2E -_020848F6: - add r0, r0, #1 - sub r0, r5, r0 - cmp r0, #5 - bls _02084900 - b _02084B2E -_02084900: - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_0208490C: ; jump table - .short _02084A0A - _0208490C - 2 ; case 0 - .short _02084A0A - _0208490C - 2 ; case 1 - .short _02084A0A - _0208490C - 2 ; case 2 - .short _020849B8 - _0208490C - 2 ; case 3 - .short _02084A40 - _0208490C - 2 ; case 4 - .short _02084AE4 - _0208490C - 2 ; case 5 -_02084918: - add r0, r4, #0 - add r0, #0xd8 - str r0, [sp] - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r0, [r4, r0] - ldr r3, _02084BD0 ; =0x0000D001 - mov r1, #0x52 - str r0, [sp, #4] - mov r0, #0x2a - mov r2, #1 - bl sub_02084D04 - cmp r0, #0 - bne _02084938 - b _02084C4E -_02084938: - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #0xc - str r0, [sp] - mov r2, #0 - ldr r0, _02084BD4 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - add r4, #0xd8 - add r1, r4, #0 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 - ldr r0, _02084BD8 ; =0x000005EB - bl PlaySE - b _02084C4E -_0208496A: - add r0, r4, #0 - add r0, #0xd8 - str r0, [sp] - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r0, [r4, r0] - mov r1, #0x52 - mov r2, #2 - str r0, [sp, #4] - mov r0, #0x48 - bl sub_02084D04 - cmp r0, #0 - beq _02084A4A - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #0xc - str r0, [sp] - mov r2, #0 - ldr r0, _02084BD4 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - add r4, #0xd8 - add r1, r4, #0 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 - ldr r0, _02084BD8 ; =0x000005EB - bl PlaySE - b _02084C4E -_020849B8: - mov r3, #0x56 - lsl r3, r3, #2 - ldrh r3, [r4, r3] - add r2, r4, #0 - mov r0, #0 - mov r1, #0x52 - add r2, #0xd8 - bl sub_02084C98 - cmp r0, #0 - beq _02084A4A - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #0xc - str r0, [sp] - mov r2, #0 - add r1, r4, #0 - ldr r0, _02084BD4 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - add r1, #0xd8 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 - mov r0, #0x4a - lsl r0, r0, #4 - ldr r1, [r4, r0] - add r1, r1, #1 - str r1, [r4, r0] - ldr r0, _02084BD8 ; =0x000005EB - bl PlaySE - b _02084C4E -_02084A0A: - mov r1, #0x46 - lsl r1, r1, #4 - ldr r0, _02084BC8 ; =0x0000E002 - ldr r2, [r4, r1] - sub r5, r5, r0 - cmp r2, r5 - beq _02084A4A - mov r2, #0 - sub r0, r1, #4 - str r2, [r4, r0] - str r5, [r4, r1] - add r0, r4, #0 - ldr r1, [r4, r1] - add r0, #0x3a - bl sub_02084830 - mov r0, #0x49 - lsl r0, r0, #4 - add r2, r4, r0 - lsl r1, r5, #2 - ldr r0, [r2, r1] - add r0, r0, #1 - str r0, [r2, r1] - ldr r0, _02084BDC ; =0x0000069D - bl PlaySE - b _02084C4E -_02084A40: - mov r1, #0x56 - lsl r1, r1, #2 - ldrh r0, [r4, r1] - cmp r0, #0 - bne _02084A4C -_02084A4A: - b _02084C4E -_02084A4C: - sub r0, r0, #1 - lsl r0, r0, #1 - add r0, r4, r0 - ldr r2, _02084BE0 ; =0x0000FFFF - add r0, #0xd8 - strh r2, [r0] - ldrh r0, [r4, r1] - sub r0, r0, #1 - strh r0, [r4, r1] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r0, [r4, r0] - cmp r0, #0 - bne _02084A80 - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - bl CopyWindowToVram - b _02084A9E -_02084A80: - mov r0, #0xc - str r0, [sp] - mov r2, #0 - ldr r0, _02084BD4 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r1, r4, #0 - add r0, r4, r0 - add r1, #0xd8 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 -_02084A9E: - ldr r0, _02084BE4 ; =0x000004C4 - mov r3, #0x5f - add r1, r4, r0 - lsl r3, r3, #2 - str r1, [sp] - ldr r1, [r4, r3] - add r2, r3, #0 - str r1, [sp, #4] - sub r2, #0x24 - sub r0, #0xcc - add r1, r4, #0 - sub r3, #0x22 - ldrh r2, [r4, r2] - add r0, r4, r0 - add r1, #0xd8 - add r3, r4, r3 - bl sub_02084740 - mov r1, #0x56 - lsl r1, r1, #2 - mov r0, #0xd9 - lsl r0, r0, #2 - ldrh r1, [r4, r1] - ldr r2, [r4, #0xc] - add r0, r4, r0 - bl sub_02084E18 - ldr r0, _02084BE8 ; =0x000004A4 - ldr r1, [r4, r0] - add r1, r1, #1 - str r1, [r4, r0] - ldr r0, _02084BEC ; =0x000005DC - bl PlaySE - b _02084C4E -_02084AE4: - ldr r0, _02084BF0 ; =0x000005C4 - ldr r0, [r4, r0] - bl sub_020164C4 - ldr r0, [r4, #0x14] - cmp r0, #0 - bne _02084B26 - ldr r0, _02084BF4 ; =0x000005E2 - bl PlaySE - ldr r0, _02084BF8 ; =0x000004A8 - ldr r1, [r4, r0] - add r1, r1, #1 - str r1, [r4, r0] - mov r1, #0 - mov r0, #0x10 - str r0, [sp] - mov r0, #1 - str r0, [sp, #4] - mov r0, #0x12 - str r0, [sp, #8] - mov r0, #2 - add r2, r1, #0 - add r3, r1, #0 - bl BeginNormalPaletteFade - add r0, r4, #0 - add r1, r6, #0 - bl sub_02084C58 - add sp, #0x10 - mov r0, #3 - pop {r4, r5, r6, pc} -_02084B26: - ldr r0, _02084BFC ; =0x0000045C - mov r1, #5 - str r1, [r4, r0] - b _02084C4E -_02084B2E: - mov r0, #0x46 - lsl r0, r0, #4 - ldr r0, [r4, r0] - cmp r0, #4 - bne _02084B42 - cmp r5, #1 - bne _02084B42 - add sp, #0x10 - mov r0, #2 - pop {r4, r5, r6, pc} -_02084B42: - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r1, [r4, r0] - ldr r0, [r4, #0xc] - cmp r1, r0 - beq _02084C4E - lsl r0, r1, #1 - add r0, r4, r0 - add r0, #0xd8 - strh r5, [r0] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #0xc - str r0, [sp] - mov r2, #0 - add r1, r4, #0 - ldr r0, _02084BD4 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - add r1, #0xd8 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 - mov r1, #0x56 - lsl r1, r1, #2 - ldrh r0, [r4, r1] - add r0, r0, #1 - strh r0, [r4, r1] - mov r0, #0xd9 - lsl r0, r0, #2 - ldrh r1, [r4, r1] - ldr r2, [r4, #0xc] - add r0, r4, r0 - bl sub_02084E18 - ldr r0, _02084BD8 ; =0x000005EB - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #1 - bl Sprite_SetOamMode - mov r3, #8 - ldr r0, _02084C00 ; =0x04000050 - b _02084C04 - .balign 4, 0 -_02084BBC: .word 0x00002FFD -_02084BC0: .word 0x00001FFE -_02084BC4: .word gSystem + 0x40 -_02084BC8: .word 0x0000E002 -_02084BCC: .word 0x0000D002 -_02084BD0: .word 0x0000D001 -_02084BD4: .word 0x000E0F01 -_02084BD8: .word 0x000005EB -_02084BDC: .word 0x0000069D -_02084BE0: .word 0x0000FFFF -_02084BE4: .word 0x000004C4 -_02084BE8: .word 0x000004A4 -_02084BEC: .word 0x000005DC -_02084BF0: .word 0x000005C4 -_02084BF4: .word 0x000005E2 -_02084BF8: .word 0x000004A8 -_02084BFC: .word 0x0000045C -_02084C00: .word 0x04000050 -_02084C04: - mov r1, #0 - mov r2, #7 - str r3, [sp] - bl G2x_SetBlendAlpha_ - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x3c - bl Sprite_SetAnimCtrlSeq - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r1, [r4, r0] - ldr r0, [r4, #0xc] - cmp r1, r0 - bne _02084C2A - mov r0, #1 - str r0, [r4, #0x34] -_02084C2A: - ldr r0, _02084C54 ; =0x000004C4 - mov r3, #0x5f - add r1, r4, r0 - lsl r3, r3, #2 - str r1, [sp] - ldr r1, [r4, r3] - add r2, r3, #0 - str r1, [sp, #4] - sub r2, #0x24 - sub r0, #0xcc - add r1, r4, #0 - sub r3, #0x22 - ldrh r2, [r4, r2] - add r0, r4, r0 - add r1, #0xd8 - add r3, r4, r3 - bl sub_02084740 -_02084C4E: - mov r0, #2 - add sp, #0x10 - pop {r4, r5, r6, pc} - .balign 4, 0 -_02084C54: .word 0x000004C4 - thumb_func_end sub_02084884 - - thumb_func_start sub_02084C58 -sub_02084C58: ; 0x02084C58 - push {r3, lr} - mov r2, #0x5d - lsl r2, r2, #4 - ldr r0, [r0, r2] - cmp r0, #0 - beq _02084C76 - cmp r1, #1 - bne _02084C70 - mov r1, #0 - bl sub_02018410 - pop {r3, pc} -_02084C70: - mov r1, #1 - bl sub_02018410 -_02084C76: - pop {r3, pc} - thumb_func_end sub_02084C58 - - thumb_func_start sub_02084C78 -sub_02084C78: ; 0x02084C78 - push {r4, r5, r6, lr} - add r5, r0, #0 - mov r4, #0 - mov r6, #3 -_02084C80: - add r0, r1, #1 - add r1, r4, #0 - add r2, r6, #0 - bl sub_02084264 - add r1, r0, #0 - lsl r0, r1, #1 - ldrh r0, [r5, r0] - cmp r0, #1 - beq _02084C80 - pop {r4, r5, r6, pc} - .balign 4, 0 - thumb_func_end sub_02084C78 - - thumb_func_start sub_02084C98 -sub_02084C98: ; 0x02084C98 - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - add r4, r0, #0 - add r0, r1, #0 - str r2, [sp] - cmp r3, #0 - bne _02084CAC - add sp, #8 - mov r0, #0 - pop {r3, r4, r5, r6, r7, pc} -_02084CAC: - sub r1, r3, #1 - lsl r1, r1, #1 - str r1, [sp, #4] - ldrh r3, [r2, r1] - cmp r4, r0 - bge _02084CFA - mov r1, #6 - ldr r2, _02084D00 ; =_02102422 - mul r1, r4 - add r5, r2, r1 - mov r7, #0 -_02084CC2: - add r2, r7, #0 - add r6, r5, #0 -_02084CC6: - ldrh r1, [r6] - cmp r3, r1 - bne _02084CEA - cmp r3, #1 - beq _02084CEA - mov r0, #6 - ldr r1, _02084D00 ; =_02102422 - mul r0, r4 - add r0, r1, r0 - add r1, r2, #0 - bl sub_02084C78 - ldr r2, [sp] - ldr r1, [sp, #4] - add sp, #8 - strh r0, [r2, r1] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084CEA: - add r2, r2, #1 - add r6, r6, #2 - cmp r2, #3 - blt _02084CC6 - add r4, r4, #1 - add r5, r5, #6 - cmp r4, r0 - blt _02084CC2 -_02084CFA: - mov r0, #0 - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02084D00: .word _02102422 - thumb_func_end sub_02084C98 - thumb_func_start sub_02084D04 sub_02084D04: ; 0x02084D04 push {r3, r4, r5, r6, r7, lr} diff --git a/include/naming_screen.h b/include/naming_screen.h index 075830fd85..f20fa3bfbd 100644 --- a/include/naming_screen.h +++ b/include/naming_screen.h @@ -20,7 +20,7 @@ typedef struct NamingScreenArgs { int unk44; PCStorage *unk48; Options *options; - int *unk50; + BOOL *unk50; } NamingScreenArgs; NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, NameScreenType kind, int param, int maxLen, Options *options, int *a5); diff --git a/src/naming_screen.c b/src/naming_screen.c index 2e928172d8..9c40b06f78 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -29,6 +29,7 @@ #include "unk_0200FA24.h" #include "unk_02013534.h" #include "unk_020163E0.h" +#include "unk_020183F0.h" #include "vram_transfer_manager.h" typedef struct NamingScreenAppData { @@ -52,8 +53,7 @@ typedef struct NamingScreenAppData { u16 unk_0D8[0x20]; u16 unk_118[0x20]; u16 unk_158; - u16 unk_15A; - u8 filler_15C[0x4]; + u16 unk_15A[3]; BgConfig *bgConfig; // 0x160 u8 filler_164[4]; MessageFormat *msgFormat; // 0x168 @@ -95,7 +95,7 @@ typedef struct NamingScreenAppData { UnkStruct_020163E0 *unk_5C4; BOOL unk_5C8; int unk_5CC; - int *unk_5D0; + BOOL *unk_5D0; } NamingScreenAppData; // size: 0x5D4 BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); @@ -131,15 +131,19 @@ int sub_02084264(int val, int lo, int hi); void sub_02084274(NamingScreenAppData *data, int a1); void sub_0208432C(NamingScreenAppData *data); void sub_02084430(NamingScreenAppData *data, int a1); -void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); void sub_02084500(u16 *a0); void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels); void *sub_02084640(Window *window, String *string, FontID fontId, u32 color); void sub_02084664(Window *windows, const u16 *a1, void *a2, String *a3); void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String *a5); void sub_02084830(u16 (*a0)[13], const int a1); -int sub_02084884(NamingScreenAppData *data, int key, BOOL a2); -void sub_02084E18(Sprite **sprites, int a1); +int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2); +void sub_02084C58(NamingScreenAppData *data, BOOL a1); +int sub_02084C78(const u16 *a0, int a1); +BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3); +BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5); +void sub_02084E18(Sprite **sprites, int a1, int maxLen); +void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); void sub_02084F3C(int *a0, Sprite **a1, int a2); void sub_02084FCC(NamingScreenAppData *data); BOOL sub_0208503C(NamingScreenAppData *data); @@ -192,7 +196,7 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { sub_020837AC(data, narc); sub_020839EC(data); sub_02083F9C(data, ovyMan, narc); - sub_02084740(&data->unk_3B8[4], data->unk_0D8, data->unk_158, &data->unk_15A, data->unk_4C4, data->unk_17C); + sub_02084740(&data->unk_3B8[4], data->unk_0D8, data->unk_158, data->unk_15A, data->unk_4C4, data->unk_17C); sub_02004EC4(0x34, 0, 0); BeginNormalPaletteFade(0, 1, 1, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); sub_020832E4(GF_PLANE_TOGGLE_ON); @@ -716,7 +720,6 @@ void sub_020839B8(SysTask *task, void *taskData) { Sprite_SetMatrix(data->sprite2, &matrix); } -#ifdef NONMATCHING void sub_020839EC(NamingScreenAppData *data) { int i; CreateSpriteResourcesHeader(&data->unk_2E4, 0, 0, 0, 0, -1, -1, 0, 1, data->unk_2B4[GF_GFX_RES_TYPE_CHAR], data->unk_2B4[GF_GFX_RES_TYPE_PLTT], data->unk_2B4[GF_GFX_RES_TYPE_CELL], data->unk_2B4[GF_GFX_RES_TYPE_ANIM], NULL, NULL); @@ -761,229 +764,12 @@ void sub_020839EC(NamingScreenAppData *data) { Sprite_SetAnimActiveFlag(data->unk_364[i], TRUE); Sprite_SetAnimCtrlSeq(data->unk_364[i], 43); } - sub_02084E18(data->unk_364, data->unk_158); + sub_02084E18(data->unk_364, data->unk_158, data->maxLen); sub_02083BB4(data, &spriteTemplate); } GfGfx_EngineATogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); } -#else -// clang-format off -asm void sub_020839EC(NamingScreenAppData *data) { - push {r4, r5, r6, r7, lr} - sub sp, #0x5c - mov r1, #0 - add r6, r0, #0 - str r1, [sp] - sub r0, r1, #1 - str r0, [sp, #4] - str r0, [sp, #8] - mov r2, #0xad - str r1, [sp, #0xc] - mov r0, #1 - lsl r2, r2, #2 - str r0, [sp, #0x10] - ldr r0, [r6, r2] - add r3, r1, #0 - str r0, [sp, #0x14] - add r0, r2, #4 - ldr r0, [r6, r0] - str r0, [sp, #0x18] - add r0, r2, #0 - add r0, #8 - ldr r0, [r6, r0] - str r0, [sp, #0x1c] - add r0, r2, #0 - add r0, #0xc - ldr r0, [r6, r0] - add r2, #0x30 - str r0, [sp, #0x20] - str r1, [sp, #0x24] - add r0, r6, r2 - add r2, r1, #0 - str r1, [sp, #0x28] - bl CreateSpriteResourcesHeader - mov r1, #1 - mov r3, #0xad - str r1, [sp] - sub r0, r1, #2 - str r0, [sp, #4] - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - str r0, [sp, #0x10] - lsl r3, r3, #2 - ldr r2, [r6, r3] - str r2, [sp, #0x14] - add r2, r3, #4 - ldr r2, [r6, r2] - str r2, [sp, #0x18] - add r2, r3, #0 - add r2, #8 - ldr r2, [r6, r2] - str r2, [sp, #0x1c] - add r2, r3, #0 - add r2, #0xc - ldr r2, [r6, r2] - add r3, #0x54 - str r2, [sp, #0x20] - str r0, [sp, #0x24] - str r0, [sp, #0x28] - add r0, r6, r3 - add r2, r1, #0 - add r3, r1, #0 - bl CreateSpriteResourcesHeader - mov r0, #0x62 - lsl r0, r0, #2 - ldr r0, [r6, r0] - mov r1, #2 - str r0, [sp, #0x2c] - mov r0, #0xb9 - lsl r0, r0, #2 - add r0, r6, r0 - str r0, [sp, #0x30] - mov r0, #6 - lsl r1, r1, #0x10 - lsl r0, r0, #0x10 - str r0, [sp, #0x38] - lsr r0, r1, #5 - mov r7, #0 - str r1, [sp, #0x34] - str r7, [sp, #0x3c] - str r0, [sp, #0x40] - str r0, [sp, #0x44] - str r0, [sp, #0x48] - add r0, sp, #0x2c - strh r7, [r0, #0x20] - mov r0, #1 - str r0, [sp, #0x50] - str r0, [sp, #0x54] - mov r0, #0x12 - ldr r4, =_021021E8 - str r0, [sp, #0x58] - add r5, r6, #0 -_02083AA8: - ldr r0, [r4, #0] - lsl r0, r0, #0xc - str r0, [sp, #0x34] - ldr r0, [r4, #4] - lsl r0, r0, #0xc - str r0, [sp, #0x38] - add r0, sp, #0x2c - bl Sprite_CreateAffine - mov r1, #0xcb - lsl r1, r1, #2 - str r0, [r5, r1] - add r0, r1, #0 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetAnimActiveFlag - mov r0, #0xcb - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r1, [r4, #8] - bl Sprite_SetAnimCtrlSeq - mov r0, #0xcb - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r1, [r4, #0xc] - bl Sprite_SetDrawPriority - add r7, r7, #1 - add r4, #0x10 - add r5, r5, #4 - cmp r7, #9 - blt _02083AA8 - mov r0, #0xcf - lsl r0, r0, #2 - ldr r0, [r6, r0] - mov r1, #0 - bl Sprite_SetVisibleFlag - ldr r7, =_021021E8 - mov r5, #0 - add r4, r6, #0 -_02083AFE: - ldr r0, =sub_020839B8 - mov r1, #0x10 - mov r2, #5 - mov r3, #0x12 - bl CreateSysTaskAndEnvironment - mov r1, #0xe7 - lsl r1, r1, #2 - str r0, [r4, r1] - add r0, r1, #0 - ldr r0, [r4, r0] - bl SysTask_GetData - mov r1, #0xd2 - lsl r1, r1, #2 - ldr r1, [r6, r1] - str r1, [r0] - mov r1, #0xcb - lsl r1, r1, #2 - ldr r1, [r4, r1] - add r4, r4, #4 - str r1, [r0, #4] - ldr r1, [r7, #0] - add r7, #0x10 - lsl r1, r1, #0xc - str r1, [r0, #8] - str r5, [r0, #0xc] - add r5, r5, #1 - cmp r5, #7 - blt _02083AFE - ldr r2, [r6, #0xc] - mov r7, #0 - cmp r2, #0 - ble _02083B7E - mov r5, #0x50 - add r4, r6, #0 -_02083B46: - lsl r0, r5, #0xc - str r0, [sp, #0x34] - mov r0, #0x27 - lsl r0, r0, #0xc - str r0, [sp, #0x38] - add r0, sp, #0x2c - bl Sprite_CreateAffine - mov r1, #0xd9 - lsl r1, r1, #2 - str r0, [r4, r1] - add r0, r1, #0 - ldr r0, [r4, r0] - mov r1, #1 - bl Sprite_SetAnimActiveFlag - mov r0, #0xd9 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x2b - bl Sprite_SetAnimCtrlSeq - ldr r2, [r6, #0xc] - add r7, r7, #1 - add r5, #0xc - add r4, r4, #4 - cmp r7, r2 - blt _02083B46 -_02083B7E: - mov r1, #0x56 - lsl r1, r1, #2 - mov r0, #0xd9 - lsl r0, r0, #2 - ldrh r1, [r6, r1] - add r0, r6, r0 - bl sub_02084E18 - add r0, r6, #0 - add r1, sp, #0x2c - bl sub_02083BB4 - mov r0, #0x10 - mov r1, #1 - bl GfGfx_EngineATogglePlanes - mov r0, #0x10 - mov r1, #1 - bl GfGfx_EngineBTogglePlanes - add sp, #0x5c - pop {r4, r5, r6, r7, pc} -} -// clang-format on -#endif // NONMATCHING void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate) { tmplate->position.x = FX32_CONST(24); @@ -1508,3 +1294,145 @@ asm void sub_02084830(u16 (*a0)[13], const int a1) { } // clang-format on #endif // NONMATCHING + +int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2) { + if (key == 0xD003 || key == 0xD004) { + key = 1; + } + if (data->type == NAME_SCREEN_UNK4) { + if (key == 0xE002 || key == 0xE003 || key == 0xE004 || key == 0xE005) { + key = 1; + } + } + if (!Sprite_GetVisibleFlag(data->unk_32C[8]) && gSystem.touchNew == 0) { + Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); + return 2; + } + + switch (key) { + case 0xD001: + if (sub_02084D04(0x2A, 0x52, 1, 0xD001, data->unk_0D8, data->unk_158)) { + FillWindowPixelBuffer(&data->unk_3B8[3], 1); + sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + PlaySE(SEQ_SE_DP_BOX02); + } + break; + case 0xD002: + if (sub_02084D04(0x48, 0x52, 2, 0xD002, data->unk_0D8, data->unk_158)) { + FillWindowPixelBuffer(&data->unk_3B8[3], 1); + sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + PlaySE(SEQ_SE_DP_BOX02); + } + break; + case 0xE006: + if (sub_02084C98(0, 0x52, data->unk_0D8, data->unk_158)) { + FillWindowPixelBuffer(&data->unk_3B8[3], 1); + sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + ++data->unk_490[4]; + PlaySE(SEQ_SE_DP_BOX02); + } + break; + case 0xE002: + case 0xE003: + case 0xE004: + case 0xE005: + if (data->unk_460 != key - 0xE002) { + data->unk_45C = 0; + data->unk_460 = key - 0xE002; + sub_02084830(data->unk_03A, data->unk_460); + ++data->unk_490[key - 0xE002]; + PlaySE(SEQ_SE_DP_SYU03); + } + break; + case 0xE007: + if (data->unk_158 != 0) { + data->unk_0D8[data->unk_158 - 1] = EOS; + --data->unk_158; + FillWindowPixelBuffer(&data->unk_3B8[3], 1); + if (data->unk_158 == 0) { + CopyWindowToVram(&data->unk_3B8[3]); + } else { + sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + } + sub_02084740(&data->unk_3B8[4], data->unk_0D8, data->unk_158, data->unk_15A, data->unk_4C4, data->unk_17C); + sub_02084E18(data->unk_364, data->unk_158, data->maxLen); + ++data->unk_490[5]; + PlaySE(SEQ_SE_DP_SELECT); + } + break; + case 0xE008: + sub_020164C4(data->unk_5C4); + if (data->unk_014 == 0) { + PlaySE(SEQ_SE_DP_PIRORIRO); + ++data->unk_490[6]; + BeginNormalPaletteFade(2, 0, 0, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); + sub_02084C58(data, a2); + return 3; + } else { + data->unk_45C = 5; + } + break; + default: + if (data->unk_460 == 4 && key == 1) { + return 2; + } + if (data->unk_158 != data->maxLen) { + data->unk_0D8[data->unk_158] = key; + FillWindowPixelBuffer(&data->unk_3B8[3], 1); + sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + ++data->unk_158; + sub_02084E18(data->unk_364, data->unk_158, data->maxLen); + PlaySE(SEQ_SE_DP_BOX02); + Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); + Sprite_SetOamMode(data->unk_32C[8], GX_OAM_MODE_XLU); + G2_SetBlendAlpha(0, GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2, 8, 8); + Sprite_SetAnimCtrlSeq(data->unk_32C[8], 60); + if (data->unk_158 == data->maxLen) { + data->unk_034 = 1; + } + sub_02084740(&data->unk_3B8[4], data->unk_0D8, data->unk_158, data->unk_15A, data->unk_4C4, data->unk_17C); + } + break; + } + + return 2; +} + +void sub_02084C58(NamingScreenAppData *data, BOOL a1) { + if (data->unk_5D0 != NULL) { + if (a1 == TRUE) { + sub_02018410(data->unk_5D0, FALSE); + } else { + sub_02018410(data->unk_5D0, TRUE); + } + } +} + +// DANGER: Can spin infinitely here +int sub_02084C78(const u16 *a0, int a1) { + do { + a1 = sub_02084264(a1 + 1, 0, 3); + } while (a0[a1] == 1); + return a0[a1]; +} + +BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3) { + int i; + int j; + u16 key; + + if (a3 == 0) { + return FALSE; + } + key = a2[a3 - 1]; + for (i = a0; i < a1; ++i) { + for (j = 0; j < 3; ++j) { + if (key == _02102422[i][j] && key != 1) { + a2[a3 - 1] = sub_02084C78(_02102422[i], j); + return TRUE; + } + } + } + + return FALSE; +} From 79247f8b3dd5f014f53f037839d99a06e4d167a4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 13 Oct 2024 15:04:05 -0400 Subject: [PATCH 14/25] Finish naming_screen code --- asm/unk_02082908.s | 548 +------------------------------------------- src/naming_screen.c | 179 +++++++++++++++ 2 files changed, 186 insertions(+), 541 deletions(-) diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s index 26bcde44b0..5cc8966072 100644 --- a/asm/unk_02082908.s +++ b/asm/unk_02082908.s @@ -19,547 +19,6 @@ .text - thumb_func_start sub_02084D04 -sub_02084D04: ; 0x02084D04 - push {r3, r4, r5, r6, r7, lr} - add r4, r0, #0 - add r0, r1, #0 - ldr r1, [sp, #0x1c] - mov lr, r2 - mov ip, r3 - cmp r1, #0 - beq _02084D20 - sub r1, r1, #1 - ldr r6, [sp, #0x18] - lsl r7, r1, #1 - ldrh r5, [r6, r7] - cmp r5, #1 - bne _02084D24 -_02084D20: - mov r0, #0 - pop {r3, r4, r5, r6, r7, pc} -_02084D24: - add r2, r4, #0 - cmp r4, r0 - bge _02084D56 - mov r1, #6 - ldr r3, _02084DFC ; =_02102422 - mul r1, r4 - add r3, r3, r1 -_02084D32: - ldrh r1, [r3] - cmp r5, r1 - bne _02084D4E - add r3, r2, #0 - mov r0, #6 - mul r3, r0 - mov r0, lr - ldr r2, _02084DFC ; =_02102422 - lsl r1, r0, #1 - add r0, r2, r3 - ldrh r0, [r1, r0] - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084D4E: - add r2, r2, #1 - add r3, r3, #6 - cmp r2, r0 - blt _02084D32 -_02084D56: - cmp r4, r0 - bge _02084D86 - mov r2, lr - ldr r1, _02084DFC ; =_02102422 - lsl r2, r2, #1 - add r1, r1, r2 - mov r2, #6 - mul r2, r4 - add r2, r1, r2 -_02084D68: - ldrh r1, [r2] - cmp r5, r1 - bne _02084D7E - mov r0, #6 - add r1, r4, #0 - mul r1, r0 - ldr r0, _02084DFC ; =_02102422 - ldrh r0, [r0, r1] - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084D7E: - add r4, r4, #1 - add r2, r2, #6 - cmp r4, r0 - blt _02084D68 -_02084D86: - ldr r1, _02084E00 ; =0x0000D001 - mov r0, ip - cmp r0, r1 - beq _02084DA0 - add r1, r1, #1 - mov r0, ip - cmp r0, r1 - beq _02084DC0 - ldr r1, _02084E04 ; =0x0000E006 - mov r0, ip - cmp r0, r1 - beq _02084DE0 - b _02084DF8 -_02084DA0: - ldr r1, _02084E08 ; =_021021B8 - mov r2, #0 -_02084DA4: - ldrh r0, [r1] - cmp r5, r0 - bne _02084DB6 - ldr r0, _02084E0C ; =_021021B8 + 2 - lsl r1, r2, #2 - ldrh r0, [r0, r1] - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084DB6: - add r2, r2, #1 - add r1, r1, #4 - cmp r2, #0xc - blo _02084DA4 - b _02084DF8 -_02084DC0: - ldr r1, _02084E10 ; =_02102190 - mov r2, #0 -_02084DC4: - ldrh r0, [r1] - cmp r5, r0 - bne _02084DD6 - ldr r0, _02084E14 ; =_02102190 + 2 - lsl r1, r2, #2 - ldrh r0, [r0, r1] - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084DD6: - add r2, r2, #1 - add r1, r1, #4 - cmp r2, #0xa - blo _02084DC4 - b _02084DF8 -_02084DE0: - cmp r5, #0x26 - bne _02084DEC - mov r0, #0x24 - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084DEC: - cmp r5, #0x76 - bne _02084DF8 - mov r0, #0x74 - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084DF8: - mov r0, #0 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02084DFC: .word _02102422 -_02084E00: .word 0x0000D001 -_02084E04: .word 0x0000E006 -_02084E08: .word _021021B8 -_02084E0C: .word _021021B8 + 2 -_02084E10: .word _02102190 -_02084E14: .word _02102190 + 2 - thumb_func_end sub_02084D04 - - thumb_func_start sub_02084E18 -sub_02084E18: ; 0x02084E18 - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - add r6, r2, #0 - mov r4, #0 - str r0, [sp] - str r1, [sp, #4] - cmp r6, #0 - ble _02084E3C - add r5, r0, #0 - mov r7, #0x2b -_02084E2C: - ldr r0, [r5] - add r1, r7, #0 - bl Sprite_SetAnimCtrlSeq - add r4, r4, #1 - add r5, r5, #4 - cmp r4, r6 - blt _02084E2C -_02084E3C: - ldr r0, [sp, #4] - cmp r0, r6 - beq _02084E4E - lsl r1, r0, #2 - ldr r0, [sp] - ldr r0, [r0, r1] - mov r1, #0x2c - bl Sprite_SetAnimCtrlSeq -_02084E4E: - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 - thumb_func_end sub_02084E18 - - thumb_func_start sub_02084E54 -sub_02084E54: ; 0x02084E54 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x18 - str r2, [sp, #0x10] - ldr r2, [sp, #0x30] - lsl r1, r1, #0x18 - lsr r1, r1, #0x18 - add r5, r0, #0 - str r3, [sp, #0x14] - str r2, [sp, #0x30] - bl FillWindowPixelBuffer - ldr r1, _02084F34 ; =_02101D44 - ldr r0, [sp, #0x10] - mov r7, #0 - ldrb r4, [r1, r0] - mov r6, #0x10 -_02084E74: - mov r0, #0x10 - str r0, [sp] - mov r0, #0x13 - lsl r2, r6, #0x10 - str r0, [sp, #4] - add r0, r5, #0 - add r1, r4, #0 - lsr r2, r2, #0x10 - mov r3, #0 - bl FillWindowPixelRect - mov r0, #0x10 - str r0, [sp] - mov r0, #0x13 - lsl r2, r6, #0x10 - str r0, [sp, #4] - add r0, r5, #0 - add r1, r4, #0 - lsr r2, r2, #0x10 - mov r3, #0x26 - bl FillWindowPixelRect - mov r0, #0x10 - str r0, [sp] - mov r0, #0x13 - lsl r2, r6, #0x10 - str r0, [sp, #4] - add r0, r5, #0 - add r1, r4, #0 - lsr r2, r2, #0x10 - mov r3, #0x4c - bl FillWindowPixelRect - add r7, r7, #1 - add r6, #0x20 - cmp r7, #6 - blt _02084E74 - mov r7, #0 - add r6, r7, #0 -_02084EC2: - mov r0, #0x10 - str r0, [sp] - mov r0, #0x13 - lsl r2, r6, #0x10 - str r0, [sp, #4] - add r0, r5, #0 - add r1, r4, #0 - lsr r2, r2, #0x10 - mov r3, #0x13 - bl FillWindowPixelRect - mov r0, #0x10 - str r0, [sp] - mov r0, #0x13 - lsl r2, r6, #0x10 - str r0, [sp, #4] - add r0, r5, #0 - add r1, r4, #0 - lsr r2, r2, #0x10 - mov r3, #0x39 - bl FillWindowPixelRect - add r7, r7, #1 - add r6, #0x20 - cmp r7, #7 - blt _02084EC2 - ldr r0, [sp, #0x10] - mov r1, #0x14 - ldr r2, _02084F38 ; =_021104F8 - mul r1, r0 - mov r7, #0 - mov r6, #4 - add r4, r2, r1 -_02084F04: - mov r0, #0x10 - str r0, [sp] - mov r0, #0xff - str r0, [sp, #4] - ldr r0, [sp, #0x14] - mov r2, #0 - str r0, [sp, #8] - ldr r0, [sp, #0x30] - add r3, r6, #0 - str r0, [sp, #0xc] - ldr r1, [r4] - add r0, r5, #0 - bl sub_02084540 - add r7, r7, #1 - add r6, #0x13 - add r4, r4, #4 - cmp r7, #5 - blt _02084F04 - add r0, r5, #0 - bl CopyWindowToVram - add sp, #0x18 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02084F34: .word _02101D44 -_02084F38: .word _021104F8 - thumb_func_end sub_02084E54 - - thumb_func_start sub_02084F3C -sub_02084F3C: ; 0x02084F3C - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - add r6, r1, #0 - str r0, [sp] - mov r7, #0 - add r1, r0, #0 -_02084F48: - ldr r0, [r1] - cmp r0, #0 - beq _02084F7E - mov r0, #0 - ldr r4, _02084FC0 ; =_021021E8 - str r0, [sp, #4] - add r5, r6, #0 -_02084F56: - ldr r0, [r5] - ldr r1, [r4, #8] - bl Sprite_SetAnimCtrlSeq - ldr r0, [sp, #4] - add r4, #0x10 - add r0, r0, #1 - add r5, r5, #4 - str r0, [sp, #4] - cmp r0, #3 - blt _02084F56 - ldr r1, _02084FC4 ; =_021021E8 + 8 - lsl r2, r7, #4 - lsl r0, r7, #2 - ldr r1, [r1, r2] - ldr r0, [r6, r0] - sub r1, r1, #3 - bl Sprite_SetAnimCtrlSeq - b _02084F86 -_02084F7E: - add r7, r7, #1 - add r1, r1, #4 - cmp r7, #3 - blt _02084F48 -_02084F86: - ldr r4, [sp] - ldr r5, _02084FC8 ; =_021021E8 + 0x50 - mov r7, #5 - add r4, #0x14 - add r6, #0x14 -_02084F90: - ldr r0, [r4] - cmp r0, #0 - beq _02084FA0 - ldr r1, [r5, #8] - ldr r0, [r6] - add r1, r1, #1 - bl Sprite_SetAnimCtrlSeq -_02084FA0: - add r7, r7, #1 - add r4, r4, #4 - add r5, #0x10 - add r6, r6, #4 - cmp r7, #7 - blt _02084F90 - mov r2, #0 - add r1, r2, #0 -_02084FB0: - ldr r0, [sp] - add r2, r2, #1 - stmia r0!, {r1} - str r0, [sp] - cmp r2, #7 - blt _02084FB0 - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02084FC0: .word _021021E8 -_02084FC4: .word _021021E8 + 8 -_02084FC8: .word _021021E8 + 0x50 - thumb_func_end sub_02084F3C - - thumb_func_start sub_02084FCC -sub_02084FCC: ; 0x02084FCC - push {r4, lr} - add r4, r0, #0 - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl Sprite_IsCellAnimationRunning - cmp r0, #0 - bne _02085038 - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r1, [r4, r0] - ldr r0, [r4, #0xc] - cmp r1, r0 - bne _02085004 - mov r0, #0xc - str r0, [r4, #0x1c] - mov r0, #0 - str r0, [r4, #0x20] - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x27 - bl Sprite_SetAnimCtrlSeq - mov r0, #0 - str r0, [r4, #0x34] - b _02085010 -_02085004: - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x27 - bl Sprite_SetAnimCtrlSeq -_02085010: - ldr r0, [r4, #0x30] - cmp r0, #0 - bne _02085024 - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0 - bl Sprite_SetVisibleFlag - b _0208502C -_02085024: - add r0, r4, #0 - mov r1, #0 - bl sub_02084430 -_0208502C: - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0 - bl Sprite_SetOamMode -_02085038: - pop {r4, pc} - .balign 4, 0 - thumb_func_end sub_02084FCC - - thumb_func_start sub_0208503C -sub_0208503C: ; 0x0208503C - push {r3, r4, r5, r6, r7, lr} - str r0, [sp] - mov r0, #0 - mov ip, r0 - ldr r0, [sp] - ldr r0, [r0] - cmp r0, #4 - bne _02085050 - mov r0, #4 - mov ip, r0 -_02085050: - ldr r2, _020850EC ; =gSystem + 0x40 - ldrh r0, [r2, #0x24] - cmp r0, #0 - beq _020850E6 - ldrh r0, [r2, #0x20] - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - mov lr, r0 - ldrh r0, [r2, #0x22] - lsl r0, r0, #0x18 - lsr r7, r0, #0x18 - mov r0, ip - cmp r0, #0x47 - bhs _020850E6 - mov r0, #6 - mov r2, ip - mul r0, r2 - ldr r2, _020850F0 ; =_02102278 - add r2, r2, r0 - add r3, r2, #0 -_02085078: - ldrh r4, [r3, #2] - ldrb r0, [r2] - ldrb r6, [r2, #1] - lsl r4, r4, #0x1e - lsr r4, r4, #0x1e - beq _0208508E - cmp r4, #1 - beq _02085094 - cmp r4, #2 - beq _0208509A - b _0208509E -_0208508E: - mov r5, #0x1f - mov r1, #0x16 - b _0208509E -_02085094: - mov r5, #0x20 - mov r1, #0x16 - b _0208509E -_0208509A: - mov r5, #0x10 - mov r1, #0x13 -_0208509E: - mov r4, lr - cmp r4, r0 - blo _020850D8 - cmp r7, r6 - blo _020850D8 - add r4, r0, r5 - mov r0, lr - cmp r0, r4 - bgt _020850D8 - add r0, r6, r1 - cmp r7, r0 - bgt _020850D8 - ldr r2, _020850F0 ; =_02102278 - mov r1, #6 - mov r0, ip - mul r1, r0 - add r2, r2, r1 - ldrb r0, [r2, #4] - lsl r0, r0, #0x1b - lsr r1, r0, #0x1b - ldr r0, [sp] - str r1, [r0, #0x1c] - ldrb r0, [r2, #5] - lsl r0, r0, #0x1b - lsr r1, r0, #0x1b - ldr r0, [sp] - str r1, [r0, #0x20] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_020850D8: - mov r0, ip - add r0, r0, #1 - add r2, r2, #6 - add r3, r3, #6 - mov ip, r0 - cmp r0, #0x47 - blo _02085078 -_020850E6: - mov r0, #0 - pop {r3, r4, r5, r6, r7, pc} - nop -_020850EC: .word gSystem + 0x40 -_020850F0: .word _02102278 - thumb_func_end sub_0208503C - .rodata .global _02101D3C @@ -569,6 +28,8 @@ _02101D3C: .global _02101D40 _02101D40: .byte 0x04, 0x07, 0x0D, 0x0A + + .global _02101D44 _02101D44: .byte 0x03, 0x06, 0x0C, 0x09, 0x09, 0x00, 0x00, 0x00 @@ -707,6 +168,8 @@ _02102168: .word 0, 1 .word -1, 0 .word 1, 0 + + .global _02102190 _02102190: .short 0x0031, 0x0032 .short 0x0034, 0x0035 @@ -718,6 +181,8 @@ _02102190: .short 0x0087, 0x0088 .short 0x008A, 0x008B .short 0x008D, 0x008E + + .global _021021B8 _021021B8: .short 0x0024, 0x0026 .short 0x0074, 0x0076 @@ -744,6 +209,7 @@ _021021E8: .word 0x00000016, 0x00000038, 0x00000025, 0x00000002 .word 0x0000001A, 0x0000005B, 0x00000027, 0x00000000 + .global _02102278 _02102278: .byte 0x19, 0x3C .short 0x00 diff --git a/src/naming_screen.c b/src/naming_screen.c index 9c40b06f78..342023e9bb 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -98,6 +98,14 @@ typedef struct NamingScreenAppData { BOOL *unk_5D0; } NamingScreenAppData; // size: 0x5D4 +typedef struct UnkStruct_02102278 { + u8 x; + u8 y; + u16 unk_2_0 : 2; + u8 unk_4_0 : 5; + u8 unk_4_5 : 5; +} UnkStruct_02102278; + BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState); @@ -161,6 +169,10 @@ extern const int _02101D54[]; extern const u16 _02102422[][3]; extern const u16 *_021104E4[]; extern const u16 *_021104F8[][5]; +extern const u16 _021021B8[][2]; +extern const u16 _02102190[][2]; +extern const u8 _02101D44[]; +extern const UnkStruct_02102278 _02102278[]; BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { NamingScreenAppData *data; @@ -1436,3 +1448,170 @@ BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3) { return FALSE; } + +BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { + int i; + u16 key; + + if (a5 == 0 || a4[a5 - 1] == 1) { + return FALSE; + } + key = a4[a5 - 1]; + for (i = a0; i < a1; ++i) { + if (key == _02102422[i][0]) { + a4[a5 - 1] = _02102422[i][a2]; + return TRUE; + } + } + for (i = a0; i < a1; ++i) { + if (key == _02102422[i][a2]) { + a4[a5 - 1] = _02102422[i][0]; + return TRUE; + } + } + switch (a3) { + case 0xD001: + for (i = 0; i < 12u; ++i) { + if (key == _021021B8[i][0]) { + a4[a5 - 1] = _021021B8[i][1]; + return TRUE; + } + } + break; + case 0xD002: + for (i = 0; i < 10u; ++i) { + if (key == _02102190[i][0]) { + a4[a5 - 1] = _02102190[i][1]; + return TRUE; + } + } + break; + case 0xE006: + if (key == 0x26) { + a4[a5 - 1] = 0x24; + return TRUE; + } + if (key == 0x76) { + a4[a5 - 1] = 0x74; + return TRUE; + } + break; + } + + return FALSE; +} + +void sub_02084E18(Sprite **sprites, int a1, int maxLen) { + for (int i = 0; i < maxLen; ++i) { + Sprite_SetAnimCtrlSeq(sprites[i], 43); + } + if (a1 != maxLen) { + Sprite_SetAnimCtrlSeq(sprites[a1], 44); + } +} + +void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData) { + FillWindowPixelBuffer(window, fillVal); + + for (int i = 0; i < 6; ++i) { + FillWindowPixelRect(window, _02101D44[pageNum], 32 * i + 16, 0, 16, 19); + FillWindowPixelRect(window, _02101D44[pageNum], 32 * i + 16, 38, 16, 19); + FillWindowPixelRect(window, _02101D44[pageNum], 32 * i + 16, 76, 16, 19); + } + + for (int i = 0; i < 7; ++i) { + FillWindowPixelRect(window, _02101D44[pageNum], 32 * i, 19, 16, 19); + FillWindowPixelRect(window, _02101D44[pageNum], 32 * i, 57, 16, 19); + } + + for (int i = 0; i < 5; ++i) { + sub_02084540(window, _021104F8[pageNum][i], 0, 19 * i + 4, 16, TEXT_SPEED_NOTRANSFER, textColor, pRawData); + } + + CopyWindowToVram(window); +} + +void sub_02084F3C(int *a0, Sprite **a1, int a2) { + for (int i = 0; i < 3; ++i) { + if (a0[i] != 0) { + for (int j = 0; j < 3; ++j) { + Sprite_SetAnimCtrlSeq(a1[j], _021021E8[j][2]); + } + Sprite_SetAnimCtrlSeq(a1[i], _021021E8[i][2] - 3); + break; + } + } + for (int i = 5; i < 7; ++i) { + if (a0[i] != 0) { + Sprite_SetAnimCtrlSeq(a1[i], _021021E8[i][2] + 1); + } + } + for (int i = 0; i < 7; ++i) { + a0[i] = 0; + } +} + +void sub_02084FCC(NamingScreenAppData *data) { + if (Sprite_IsCellAnimationRunning(data->unk_32C[8])) { + return; + } + + if (data->unk_158 == data->maxLen) { + data->cursorX = 12; + data->cursorY = 0; + Sprite_SetAnimCtrlSeq(data->unk_32C[8], 39); + data->unk_034 = 0; + } else { + Sprite_SetAnimCtrlSeq(data->unk_32C[8], 39); + } + if (!data->unk_030) { + Sprite_SetVisibleFlag(data->unk_32C[8], FALSE); + } else { + sub_02084430(data, 0); + } + Sprite_SetOamMode(data->unk_32C[8], GX_OAM_MODE_NORMAL); +} + +BOOL sub_0208503C(NamingScreenAppData *data) { + int i; + int ip = 0; + u8 x; + u8 y; + u8 x0; + u8 y0; + u8 dx; + u8 dy; + if (data->type == NAME_SCREEN_UNK4) { + ip = 4; + } + if (gSystem.touchNew) { + x = gSystem.touchX; + y = gSystem.touchY; + + for (i = ip; i < 71u; ++i) { + x0 = _02102278[i].x; + y0 = _02102278[i].y; + switch (_02102278[i].unk_2_0) { + case 0: + dx = 31; + dy = 22; + break; + case 1: + dx = 32; + dy = 22; + break; + case 2: + dx = 16; + dy = 19; + break; + } + if (x >= x0 && y >= y0 && x <= x0 + dx && y <= y0 + dy) { + data->cursorX = _02102278[i].unk_4_0; + data->cursorY = _02102278[i].unk_4_5; + return TRUE; + } + } + } + + return FALSE; +} From 7e160b2e2c99f5e9899e6e38c9e3caaa2f7dc713 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 13 Oct 2024 16:52:46 -0400 Subject: [PATCH 15/25] naming_screen data decomp --- asm/include/unk_02082908.inc | 149 --------- asm/unk_02082908.s | 534 ----------------------------- main.lsf | 1 - src/naming_screen.c | 627 ++++++++++++++++++++++++++++------- tmp.txt | 71 ++++ 5 files changed, 584 insertions(+), 798 deletions(-) delete mode 100644 asm/include/unk_02082908.inc delete mode 100644 asm/unk_02082908.s create mode 100644 tmp.txt diff --git a/asm/include/unk_02082908.inc b/asm/include/unk_02082908.inc deleted file mode 100644 index 4946a5f06e..0000000000 --- a/asm/include/unk_02082908.inc +++ /dev/null @@ -1,149 +0,0 @@ -#include -#pragma once -.public CopyU16StringArray -.public StringLength -.public StringNotEqual -.public FontID_Alloc -.public FontID_SetAccessDirect -.public FontID_SetAccessLazy -.public FontID_Release -.public FontID_FlatArray_GetWidth -.public FontID_String_GetWidth -.public LoadFontPal1 -.public sub_02004EC4 -.public PlaySE -.public CreateSysTaskAndEnvironment -.public DestroySysTaskAndEnvironment -.public OverlayManager_CreateAndGetData -.public OverlayManager_GetData -.public OverlayManager_FreeData -.public OverlayManager_GetArgs -.public NARC_New -.public NARC_Delete -.public GfGfxLoader_LoadScrnData -.public GfGfxLoader_GXLoadPal -.public GfGfxLoader_GetCharData -.public GfGfxLoader_GetPlttData -.public GfGfxLoader_LoadCharDataFromOpenNarc -.public GfGfxLoader_LoadScrnDataFromOpenNarc -.public GfGfxLoader_GXLoadPalFromOpenNarc -.public GfGfxLoader_GetCharDataFromOpenNarc -.public CreateSpriteResourcesHeader -.public G2dRenderer_Init -.public G2dRenderer_SetSubSurfaceCoords -.public Create2DGfxResObjMan -.public Destroy2DGfxResObjMan -.public AddCharResObjFromOpenNarc -.public AddPlttResObjFromOpenNarc -.public AddCellOrAnimResObjFromOpenNarc -.public sub_0200ACF0 -.public sub_0200AEB0 -.public sub_0200AF94 -.public sub_0200B0A8 -.public OamManager_Create -.public OamManager_ApplyAndResetBuffers -.public OamManager_Free -.public NewMsgDataFromNarc -.public DestroyMsgData -.public NewString_ReadMsgData -.public ReadMsgData_ExpandPlaceholders -.public MessageFormat_New -.public MessageFormat_Delete -.public BufferString -.public BufferBoxMonSpeciesName -.public BufferPCBoxName -.public LoadUserFrameGfx2 -.public DrawFrameAndWindow2 -.public BeginNormalPaletteFade -.public IsPaletteFadeFinished -.public sub_02013A50 -.public sub_020163E0 -.public sub_020164C4 -.public sub_02018410 -.public Main_SetVBlankIntrCB -.public HBlankInterruptDisable -.public SetKeyRepeatTimers -.public CreateHeap -.public DestroyHeap -.public AllocFromHeap -.public FreeToHeap -.public FreeToHeapExplicit -.public BgConfig_Alloc -.public SetBothScreensModesAndDisable -.public InitBgFromTemplate -.public FreeBgTilemapBuffer -.public SetBgPriority -.public BgSetPosTextAndCommit -.public BG_ClearCharDataRange -.public BG_SetMaskColor -.public BgClearTilemapBufferAndCommit -.public AddWindowParameterized -.public RemoveWindow -.public CopyWindowToVram -.public FillWindowPixelBuffer -.public BlitBitmapRectToWindow -.public FillWindowPixelRect -.public GetWindowWidth -.public SysTask_GetData -.public GF_SinDeg -.public LCRandom -.public TextPrinterCheckActive -.public AddTextPrinterParameterized -.public AddTextPrinterParameterizedWithColor -.public GF_RunVramTransferTasks -.public ObjCharTransfer_Init -.public ObjCharTransfer_Destroy -.public ObjCharTransfer_ClearBuffers -.public ObjPlttTransfer_Init -.public ObjPlttTransfer_Destroy -.public ObjPlttTransfer_Reset -.public GfGfx_SetBanks -.public GfGfx_DisableEngineAPlanes -.public GfGfx_EngineATogglePlanes -.public GfGfx_DisableEngineBPlanes -.public GfGfx_EngineBTogglePlanes -.public GfGfx_SwapDisplay -.public SpriteList_Delete -.public SpriteList_RenderAndAnimateSprites -.public Sprite_CreateAffine -.public Sprite_SetMatrix -.public Sprite_SetVisibleFlag -.public Sprite_SetAnimActiveFlag -.public Sprite_GetMatrixPtr -.public Sprite_GetVisibleFlag -.public Sprite_SetAnimCtrlSeq -.public Sprite_SetAnimCtrlCurrentFrame -.public Sprite_SetDrawPriority -.public Sprite_IsCellAnimationRunning -.public Sprite_SetOamMode -.public GF_AssertFail -.public String_New -.public String_Delete -.public String_Copy -.public CopyU16ArrayToString -.public CopyStringToU16Array -.public Options_GetFrame -.public AllocMonZeroed -.public CreateMon -.public Mon_GetBoxMon -.public PCStorage_GetActiveBox -.public PCStorage_FindFirstBoxWithEmptySlot -.public GetMonIconNaixEx -.public GetMonIconPaletteEx -.public sub_02074490 -.public NamingScreen_CreateArgs -.public NamingScreen_DeleteArgs -.public NNS_G2dInitOamManagerModule -.public G2x_SetBlendAlpha_ -.public GX_LoadOBJPltt -.public GX_LoadOBJ -.public GXS_LoadOBJ -.public DC_FlushRange -.public MIi_CpuClear16 -.public memset -.public _s32_div_f -.public gOverlayTemplate_Battle -.public gNatureStatMods -.public gOverlayTemplate_NamingScreen -.public gSystem -.public OS_IRQTable diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s deleted file mode 100644 index 5cc8966072..0000000000 --- a/asm/unk_02082908.s +++ /dev/null @@ -1,534 +0,0 @@ -#include "constants/items.h" -#include "constants/moves.h" -#include "constants/pokemon.h" -#include "constants/ribbon.h" -#include "constants/party_menu.h" -#include "msgdata/msg/msg_0300.h" - .include "asm/macros.inc" - .include "unk_02082908.inc" - .include "global.inc" - - .public gOverlayTemplate_Battle - .public gNatureStatMods - .extern NamingScreenApp_Init - .extern NamingScreenApp_Main - .extern NamingScreenApp_Exit - .extern sub_02084C78 - .extern sub_02084430 - .extern sub_02084540 - - .text - - .rodata - - .global _02101D3C -_02101D3C: - .byte 0x60, 0x68, 0x50, 0x58 - - .global _02101D40 -_02101D40: - .byte 0x04, 0x07, 0x0D, 0x0A - - .global _02101D44 -_02101D44: - .byte 0x03, 0x06, 0x0C, 0x09, 0x09, 0x00, 0x00, 0x00 - - .global _02101D4C -_02101D4C: - .byte 0x28, 0x28, 0x28, 0x28 - .byte 0x29, 0x29, 0x29, 0x00 - - .global _02101D54 -_02101D54: - .word 0x00000070 - .word 0x0000004C - .word 0x00000048 - - .global _02101D60 -_02101D60: // GraphicsModes - .word 0x00000001, 0x00000000, 0x00000000, 0x00000000 - - .global _02101D70 -_02101D70: // ObjCharTransferTemplate - .word 0x00000014 - .word 0x00000800 - .word 0x00000800 - .word 0x00000012 - - .global _02101D80 -_02101D80: - .short 0x0019, 0x0039, 0x0059, 0x0061, 0x007A, 0x009E, 0x00C6, 0x0000 - .short 0x0003, 0x002B, 0x0020, 0x002F, 0x0001, 0x002B, 0x003F, 0x0009 - .short 0x0030, 0x00E2, 0xFFFF, 0x008D, 0x0074, 0x0060, 0x006A, 0x002F - .short 0x0001, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, 0xFFFF - -_02101DBE: - .short 0xE002, 0xE002, 0xE003, 0xE003, 0xE004, 0xE004, 0xD004, 0xD004 - .short 0xE007, 0xE007, 0xE007, 0xE008, 0xE008 - -_02101DD8: - .short 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004 - .short 0xE007, 0xE007, 0xE007, 0xE008, 0xE008 - -_02101DF2: - .short 0x00E3, 0x00E4, 0x00F9, 0x00F8, 0x00E5, 0x00E6, 0x00F5 - .short 0x00F6, 0x00F7, 0x00E7, 0x0001, 0x00EE, 0x00EF, 0xFFFF, 0x0000 - - .global _02101E10 -_02101E10: // BgTemplate - .word 0x00000000, 0x00000000, 0x00000800, 0x00000000 - .byte 0x01, 0x00, 0x1F, 0x04, 0x00, 0x00, 0x00, 0x00 - .word 0x00000000 -_02101E2C: - .short 0x01DE, 0x01DE - .short 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE - .short 0x01DE, 0x01DE, 0x01DE, 0xFFFF -_02101E48: - .short 0x0107, 0x0108, 0x0109, 0x010A - .short 0x010B, 0x010C, 0x010D, 0x010E, 0x0111, 0x010F, 0x0110, 0x0001 - .short 0x0001, 0xFFFF -_02101E64: - .short 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126 - .short 0x0127, 0x0128, 0x0129, 0x012A, 0x01DE, 0x01DE, 0x01DE, 0xFFFF -_02101E80: - .short 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132 - .short 0x0133, 0x0134, 0x01DE, 0x01AD, 0x01AE, 0xFFFF -_02101E9C: - .short 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x01DE, 0x01B3, 0x01BE, 0xFFFF -_02101EB8: - .short 0x013F, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF - - .global _02101ED4 -_02101ED4: // BgTemplate - .word 0x00000000, 0x00000000, 0x00001000, 0x00000000 - .byte 0x03, 0x00, 0x1E, 0x04, 0x00, 0x01, 0x00, 0x00 - .word 0x00000000 -_02101EF0: - .short 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x01DE, 0x01AD, 0x01AE, 0xFFFF -_02101F0C: - .short 0x014F, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x01DE, 0x01B3, 0x01BE, 0xFFFF -_02101F28: - .short 0x00FF, 0x0100, 0x0101, 0x0102, 0x0103, 0x00FC, 0x00FA, 0x00FD, 0x00FB, 0x00FE, 0x0105, 0x0001, 0x0001, 0xFFFF -_02101F44: - .short 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0106, 0x0104, 0xFFFF -_02101F60: - .short 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF -_02101F7C: - .short 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x0001, 0x00E1, 0x00E2, 0xFFFF -_02101F98: - .short 0x01AD, 0x01AE, 0x01C4, 0x01C5, 0x01AB, 0x01AC, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0x01DE, 0x01DE, 0xFFFF - - .global _02101FB4 -_02101FB4: // BgTemplate - .word 0x00000000, 0x00000000, 0x00001000, 0x00000000 - .byte 0x03, 0x00, 0x1C, 0x04, 0x00, 0x02, 0x00, 0x00 - .word 0x00000000 -_02101FD0: - .short 0x01B4, 0x01B5, 0x01B2, 0x01B3, 0x01B9, 0x01BA, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF -_02101FEC: - .short 0x01AF, 0x01B0, 0x01C3, 0x01D0, 0x01C0, 0x01D2, 0x01BD, 0x01BE, 0x01BF, 0x01B1, 0x01C1, 0x01DE, 0x01DE, 0xFFFF -_02102008: - .short 0x01CB, 0x01CC, 0x01CD, 0x01CE, 0x01CF, 0x01C6, 0x01C8, 0x01C9, 0x01C7, 0x01CA, 0x01D1, 0x01DE, 0x01DE, 0xFFFF -_02102024: - .short 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x01DE, 0x01DE, 0x01DE, 0xFFFF -_02102040: - .short 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA, 0x01DD, 0x01DB, 0x01DC, 0x01DE, 0x01DE, 0xFFFF -_0210205C: - .short 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF - - .global _02102078 -_02102078: // BgTemplate - .word 0x00000000, 0x00000000, 0x00000800, 0x00000000 - .byte 0x01, 0x00, 0x1A, 0x00, 0x00, 0x03, 0x00, 0x00 - .word 0x00000000 - -_02102094: - .short 0x008E, 0x0062, 0x0093, 0x00A1, 0x002F, 0x0001, 0x007C, 0x0074, 0x0060, 0x007E, 0x00F1, 0x0091, 0x0030, 0x00E2, 0xFFFF - - .balign 4, 0 - .global _021020B4 -_021020B4: - .word 0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000008 -_021020D4: - .short 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF -_021020F8: - .short 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF -_0210211C: - .short 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF - .global _02102140 -_02102140: // GraphicsBanks - .word 0x00000001, 0x00000000, 0x00000004, 0x00000000 - .word 0x00000002, 0x00000000, 0x00000100, 0x00000000 - .word 0x00000000, 0x00000000 - - .global _02102168 -_02102168: - .word 0, 0 - .word 0, -1 - .word 0, 1 - .word -1, 0 - .word 1, 0 - - .global _02102190 -_02102190: - .short 0x0031, 0x0032 - .short 0x0034, 0x0035 - .short 0x0037, 0x0038 - .short 0x003A, 0x003B - .short 0x003D, 0x003E - .short 0x0081, 0x0082 - .short 0x0084, 0x0085 - .short 0x0087, 0x0088 - .short 0x008A, 0x008B - .short 0x008D, 0x008E - - .global _021021B8 -_021021B8: - .short 0x0024, 0x0026 - .short 0x0074, 0x0076 - .short 0x0032, 0x0031 - .short 0x0035, 0x0034 - .short 0x0038, 0x0037 - .short 0x003B, 0x003A - .short 0x003E, 0x003D - .short 0x0082, 0x0081 - .short 0x0085, 0x0084 - .short 0x0088, 0x0087 - .short 0x008B, 0x008A - .short 0x008E, 0x008D - - .global _021021E8 -_021021E8: - .word 0x00000004, 0x00000044, 0x00000003, 0x00000001 - .word 0x00000024, 0x00000044, 0x00000008, 0x00000001 - .word 0x00000044, 0x00000044, 0x0000000D, 0x00000001 - .word 0x00000000, 0x000000C8, 0x00000012, 0x00000001 - .word 0x00000065, 0x00000044, 0x00000014, 0x00000001 - .word 0x00000088, 0x00000044, 0x00000017, 0x00000001 - .word 0x000000B0, 0x00000044, 0x00000019, 0x00000001 - .word 0x00000016, 0x00000038, 0x00000025, 0x00000002 - .word 0x0000001A, 0x0000005B, 0x00000027, 0x00000000 - - .global _02102278 -_02102278: - .byte 0x19, 0x3C - .short 0x00 - .byte 0x00, 0x00 - .byte 0x39, 0x3C - .short 0x00 - .byte 0x02, 0x00 - .byte 0x59, 0x3C - .short 0x00 - .byte 0x04, 0x00 - .byte 0x00, 0xC0 - .short 0x00 - .byte 0x04, 0x00 - .byte 0x9D, 0x3C - .short 0x01 - .byte 0x08, 0x00 - .byte 0xC5, 0x3C - .short 0x01 - .byte 0x0B, 0x00 - .byte 0x1C, 0x58 - .short 0x02 - .byte 0x00, 0x01 - .byte 0x2C, 0x58 - .short 0x02 - .byte 0x01, 0x01 - .byte 0x3C, 0x58 - .short 0x0002 - .byte 0x02, 0x01 - .byte 0x4C, 0x58 - .short 0x0002 - .byte 0x03, 0x01 - .byte 0x5C, 0x58 - .short 0x0002 - .byte 0x04, 0x01 - .byte 0x6C, 0x58 - .short 0x0002 - .byte 0x05, 0x01 - .byte 0x7C, 0x58 - .short 0x0002 - .byte 0x06, 0x01 - .byte 0x8C, 0x58 - .short 0x0002 - .byte 0x07, 0x01 - .byte 0x9C, 0x58 - .short 0x0002 - .byte 0x08, 0x01 - .byte 0xAC, 0x58 - .short 0x0002 - .byte 0x09, 0x01 - .byte 0xBC, 0x58 - .short 0x0002 - .byte 0x0A, 0x01 - .byte 0xCC, 0x58 - .short 0x0002 - .byte 0x0B, 0x01 - .byte 0xDC, 0x58 - .short 0x0002 - .byte 0x0C, 0x01 - .byte 0x1C, 0x6B - .short 0x0002 - .byte 0x00, 0x02 - .byte 0x2C, 0x6B - .short 0x0002 - .byte 0x01, 0x02 - .byte 0x3C, 0x6B - .short 0x0002 - .byte 0x02, 0x02 - .byte 0x4C, 0x6B - .short 0x0002 - .byte 0x03, 0x02 - .byte 0x5C, 0x6B - .short 0x0002 - .byte 0x04, 0x02 - .byte 0x6C, 0x6B - .short 0x0002 - .byte 0x05, 0x02 - .byte 0x7C, 0x6B - .short 0x0002 - .byte 0x06, 0x02 - .byte 0x8C, 0x6B - .short 0x0002 - .byte 0x07, 0x02 - .byte 0x9C, 0x6B - .short 0x0002 - .byte 0x08, 0x02 - .byte 0xAC, 0x6B - .short 0x0002 - .byte 0x09, 0x02 - .byte 0xBC, 0x6B - .short 0x0002 - .byte 0x0A, 0x02 - .byte 0xCC, 0x6B - .short 0x0002 - .byte 0x0B, 0x02 - .byte 0xDC, 0x6B - .short 0x0002 - .byte 0x0C, 0x02 - .byte 0x1C, 0x7E - .short 0x0002 - .byte 0x00, 0x03 - .byte 0x2C, 0x7E - .short 0x0002 - .byte 0x01, 0x03 - .byte 0x3C, 0x7E - .short 0x0002 - .byte 0x02, 0x03 - .byte 0x4C, 0x7E - .short 0x0002 - .byte 0x03, 0x03 - .byte 0x5C, 0x7E - .short 0x0002 - .byte 0x04, 0x03 - .byte 0x6C, 0x7E - .short 0x0002 - .byte 0x05, 0x03 - .byte 0x7C, 0x7E - .short 0x0002 - .byte 0x06, 0x03 - .byte 0x8C, 0x7E - .short 0x0002 - .byte 0x07, 0x03 - .byte 0x9C, 0x7E - .short 0x0002 - .byte 0x08, 0x03 - .byte 0xAC, 0x7E - .short 0x0002 - .byte 0x09, 0x03 - .byte 0xBC, 0x7E - .short 0x0002 - .byte 0x0A, 0x03 - .byte 0xCC, 0x7E - .short 0x0002 - .byte 0x0B, 0x03 - .byte 0xDC, 0x7E - .short 0x0002 - .byte 0x0C, 0x03 - .byte 0x1C, 0x91 - .short 0x0002 - .byte 0x00, 0x04 - .byte 0x2C, 0x91 - .short 0x0002 - .byte 0x01, 0x04 - .byte 0x3C, 0x91 - .short 0x0002 - .byte 0x02, 0x04 - .byte 0x4C, 0x91 - .short 0x0002 - .byte 0x03, 0x04 - .byte 0x5C, 0x91 - .short 0x0002 - .byte 0x04, 0x04 - .byte 0x6C, 0x91 - .short 0x0002 - .byte 0x05, 0x04 - .byte 0x7C, 0x91 - .short 0x0002 - .byte 0x06, 0x04 - .byte 0x8C, 0x91 - .short 0x0002 - .byte 0x07, 0x04 - .byte 0x9C, 0x91 - .short 0x0002 - .byte 0x08, 0x04 - .byte 0xAC, 0x91 - .short 0x0002 - .byte 0x09, 0x04 - .byte 0xBC, 0x91 - .short 0x0002 - .byte 0x0A, 0x04 - .byte 0xCC, 0x91 - .short 0x0002 - .byte 0x0B, 0x04 - .byte 0xDC, 0x91 - .short 0x0002 - .byte 0x0C, 0x04 - .byte 0x1C, 0xA4 - .short 0x0002 - .byte 0x00, 0x05 - .byte 0x2C, 0xA4 - .short 0x0002 - .byte 0x01, 0x05 - .byte 0x3C, 0xA4 - .short 0x0002 - .byte 0x02, 0x05 - .byte 0x4C, 0xA4 - .short 0x0002 - .byte 0x03, 0x05 - .byte 0x5C, 0xA4 - .short 0x0002 - .byte 0x04, 0x05 - .byte 0x6C, 0xA4 - .short 0x0002 - .byte 0x05, 0x05 - .byte 0x7C, 0xA4 - .short 0x0002 - .byte 0x06, 0x05 - .byte 0x8C, 0xA4 - .short 0x0002 - .byte 0x07, 0x05 - .byte 0x9C, 0xA4 - .short 0x0002 - .byte 0x08, 0x05 - .byte 0xAC, 0xA4 - .short 0x0002 - .byte 0x09, 0x05 - .byte 0xBC, 0xA4 - .short 0x0002 - .byte 0x0A, 0x05 - .byte 0xCC, 0xA4 - .short 0x0002 - .byte 0x0B, 0x05 - .byte 0xDC, 0xA4 - .short 0x0002 - .byte 0x0C, 0x05 - - .global _02102422 -_02102422: - .short 0x0003, 0x0001, 0x0002 - .short 0x0005, 0x0001, 0x0004 - .short 0x0007, 0x0001, 0x0006 - .short 0x0009, 0x0001, 0x0008 - .short 0x000B, 0x0001, 0x000A - .short 0x0053, 0x0001, 0x0052 - .short 0x0055, 0x0001, 0x0054 - .short 0x0057, 0x0001, 0x0056 - .short 0x0059, 0x0001, 0x0058 - .short 0x005B, 0x0001, 0x005A - .short 0x0045, 0x0001, 0x0044 - .short 0x0047, 0x0001, 0x0046 - .short 0x0049, 0x0001, 0x0048 - .short 0x0095, 0x0001, 0x0094 - .short 0x0097, 0x0001, 0x0096 - .short 0x0099, 0x0001, 0x0098 - .short 0x00AC, 0x0001, 0x00C6 - .short 0x00AD, 0x0001, 0x00C7 - .short 0x00AE, 0x0001, 0x00C8 - .short 0x00AF, 0x0001, 0x00C9 - .short 0x00B0, 0x0001, 0x00CA - .short 0x00B1, 0x0001, 0x00CB - .short 0x00B2, 0x0001, 0x00CC - .short 0x00B3, 0x0001, 0x00CD - .short 0x00B4, 0x0001, 0x00CE - .short 0x00B5, 0x0001, 0x00CF - .short 0x00B6, 0x0001, 0x00D0 - .short 0x00B7, 0x0001, 0x00D1 - .short 0x00B8, 0x0001, 0x00D2 - .short 0x00B9, 0x0001, 0x00D3 - .short 0x00BA, 0x0001, 0x00D4 - .short 0x00BB, 0x0001, 0x00D5 - .short 0x00BC, 0x0001, 0x00D6 - .short 0x00BD, 0x0001, 0x00D7 - .short 0x00BE, 0x0001, 0x00D8 - .short 0x00BF, 0x0001, 0x00D9 - .short 0x00C0, 0x0001, 0x00DA - .short 0x00C1, 0x0001, 0x00DB - .short 0x00C2, 0x0001, 0x00DC - .short 0x00C3, 0x0001, 0x00DD - .short 0x00C4, 0x0001, 0x00DE - .short 0x00C5, 0x0001, 0x00DF - .short 0x0025, 0x0026, 0x0024 - .short 0x0075, 0x0076, 0x0074 - .short 0x000C, 0x000D, 0x0001 - .short 0x000E, 0x000F, 0x0001 - .short 0x0010, 0x0011, 0x0001 - .short 0x0012, 0x0013, 0x0001 - .short 0x0014, 0x0015, 0x0001 - .short 0x0016, 0x0017, 0x0001 - .short 0x0018, 0x0019, 0x0001 - .short 0x001A, 0x001B, 0x0001 - .short 0x001C, 0x001D, 0x0001 - .short 0x001E, 0x001F, 0x0001 - .short 0x0020, 0x0021, 0x0001 - .short 0x0022, 0x0023, 0x0001 - .short 0x0027, 0x0028, 0x0001 - .short 0x0029, 0x002A, 0x0001 - .short 0x005C, 0x005D, 0x0001 - .short 0x005E, 0x005F, 0x0001 - .short 0x0060, 0x0061, 0x0001 - .short 0x0062, 0x0063, 0x0001 - .short 0x0064, 0x0065, 0x0001 - .short 0x0066, 0x0067, 0x0001 - .short 0x0068, 0x0069, 0x0001 - .short 0x006A, 0x006B, 0x0001 - .short 0x006C, 0x006D, 0x0001 - .short 0x006E, 0x006F, 0x0001 - .short 0x0070, 0x0071, 0x0001 - .short 0x0072, 0x0073, 0x0001 - .short 0x0077, 0x0078, 0x0001 - .short 0x0079, 0x007A, 0x0001 - .short 0x0030, 0x0031, 0x0032 - .short 0x0033, 0x0034, 0x0035 - .short 0x0036, 0x0037, 0x0038 - .short 0x0039, 0x003A, 0x003B - .short 0x003C, 0x003D, 0x003E - .short 0x0080, 0x0081, 0x0082 - .short 0x0083, 0x0084, 0x0085 - .short 0x0086, 0x0087, 0x0088 - .short 0x0089, 0x008A, 0x008B - .short 0x008C, 0x008D, 0x008E - - .balign 4, 0 - .public gOverlayTemplate_NamingScreen -gOverlayTemplate_NamingScreen: - .word NamingScreenApp_Init, NamingScreenApp_Main, NamingScreenApp_Exit, 0xFFFFFFFF - - .data - - .global _021104E4 -_021104E4: - .word _02101DBE - .word _02101DBE - .word _02101DBE - .word _02101DBE - .word _02101DD8 - - .global _021104F8 -_021104F8: - .word _02101E80, _02101E9C, _02101EB8, _02101E2C, _02101E64 - .word _02101EF0, _02101F0C, _0210205C, _02101F60, _02102024 - .word _02101F98, _02101FD0, _02101FEC, _02102008, _02102040 - .word _02101F7C, _02101DF2, _02101F44, _02101F28, _02101E48 - .word _021020D4, _021020F8, _0210211C, _0210211C, _0210211C diff --git a/main.lsf b/main.lsf index bebae75dfb..315f8321cd 100644 --- a/main.lsf +++ b/main.lsf @@ -274,7 +274,6 @@ Static main Object src/party_menu_list_items.o Object src/party_menu_items.o Object src/naming_screen.o - Object asm/unk_02082908.o Object asm/unk_020850F4.o Object asm/unk_02085604.o Object asm/unk_020863F4.o diff --git a/src/naming_screen.c b/src/naming_screen.c index 342023e9bb..e8160537c2 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -107,72 +107,312 @@ typedef struct UnkStruct_02102278 { } UnkStruct_02102278; BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); -void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); +static void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState); -int sub_02082CF8(NamingScreenAppData *data, int a1); -void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args); -BOOL sub_02082EC0(const u16 *s); +static int sub_02082CF8(NamingScreenAppData *data, int a1); +static void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args); +static BOOL sub_02082EC0(const u16 *s); BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState); -void sub_02083140(void *param); -BOOL sub_02082EC0(const u16 *s); -void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args); -void sub_02083184(void); -void sub_020831A4(BgConfig *bgConfig); -void sub_020832E4(GFPlaneToggle enable); -void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan); -void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan); -void sub_02083614(BgConfig *bgConfig, Window *a1); -void sub_02083654(NamingScreenAppData *data, NARC *narc); -void sub_0208377C(void); -void sub_020837AC(NamingScreenAppData *data, NARC *narc); -void sub_020839B8(SysTask *task, void *taskData); -void sub_020839EC(NamingScreenAppData *data); -void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate); -void sub_02083CAC(SysTask *task, void *taskData); -void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData); -void sub_02083F18(Window *window, NameScreenType unused, String *msg); -void sub_02083F48(Window *window, NameScreenType unused, String *msg); -void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); -void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); -void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId); -int sub_02084264(int val, int lo, int hi); -void sub_02084274(NamingScreenAppData *data, int a1); -void sub_0208432C(NamingScreenAppData *data); -void sub_02084430(NamingScreenAppData *data, int a1); -void sub_02084500(u16 *a0); -void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels); -void *sub_02084640(Window *window, String *string, FontID fontId, u32 color); -void sub_02084664(Window *windows, const u16 *a1, void *a2, String *a3); -void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String *a5); -void sub_02084830(u16 (*a0)[13], const int a1); -int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2); -void sub_02084C58(NamingScreenAppData *data, BOOL a1); -int sub_02084C78(const u16 *a0, int a1); -BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3); -BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5); -void sub_02084E18(Sprite **sprites, int a1, int maxLen); -void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); -void sub_02084F3C(int *a0, Sprite **a1, int a2); -void sub_02084FCC(NamingScreenAppData *data); -BOOL sub_0208503C(NamingScreenAppData *data); +static void sub_02083140(void *param); +static BOOL sub_02082EC0(const u16 *s); +static void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args); +static void sub_02083184(void); +static void sub_020831A4(BgConfig *bgConfig); +static void sub_020832E4(GFPlaneToggle enable); +static void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +static void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +static void sub_02083614(BgConfig *bgConfig, Window *a1); +static void sub_02083654(NamingScreenAppData *data, NARC *narc); +static void sub_0208377C(void); +static void sub_020837AC(NamingScreenAppData *data, NARC *narc); +static void sub_020839B8(SysTask *task, void *taskData); +static void sub_020839EC(NamingScreenAppData *data); +static void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate); +static void sub_02083CAC(SysTask *task, void *taskData); +static void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData); +static void sub_02083F18(Window *window, NameScreenType unused, String *msg); +static void sub_02083F48(Window *window, NameScreenType unused, String *msg); +static void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); +static void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); +static void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId); +static int sub_02084264(int val, int lo, int hi); +static void sub_02084274(NamingScreenAppData *data, int a1); +static void sub_0208432C(NamingScreenAppData *data); +static void sub_02084430(NamingScreenAppData *data, int a1); +static void sub_02084500(u16 *a0); +static void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels); +static void *sub_02084640(Window *window, String *string, FontID fontId, u32 color); +static void sub_02084664(Window *windows, const u16 *a1, void *a2, String *a3); +static void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String *a5); +static void sub_02084830(u16 (*a0)[13], const int a1); +static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2); +static void sub_02084C58(NamingScreenAppData *data, BOOL a1); +static int sub_02084C78(const u16 *a0, int a1); +static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3); +static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5); +static void sub_02084E18(Sprite **sprites, int a1, int maxLen); +static void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); +static void sub_02084F3C(int *a0, Sprite **a1, int a2); +static void sub_02084FCC(NamingScreenAppData *data); +static BOOL sub_0208503C(NamingScreenAppData *data); static NamingScreenAppData *_021D43B0; -extern const int _021020B4[8]; -extern const int _021021E8[][4]; -extern const u8 _02101D40[]; -extern const int _02102168[][2]; -extern const u16 _02101D80[]; -extern const u8 _02101D4C[]; -extern const u8 _02101D3C[]; -extern const int _02101D54[]; -extern const u16 _02102422[][3]; -extern const u16 *_021104E4[]; -extern const u16 *_021104F8[][5]; -extern const u16 _021021B8[][2]; -extern const u16 _02102190[][2]; -extern const u8 _02101D44[]; -extern const UnkStruct_02102278 _02102278[]; +static const int _021021E8[][4] = { + { 0x04, 0x44, 0x03, 0x01 }, + { 0x24, 0x44, 0x08, 0x01 }, + { 0x44, 0x44, 0x0D, 0x01 }, + { 0x00, 0xC8, 0x12, 0x01 }, + { 0x65, 0x44, 0x14, 0x01 }, + { 0x88, 0x44, 0x17, 0x01 }, + { 0xB0, 0x44, 0x19, 0x01 }, + { 0x16, 0x38, 0x25, 0x02 }, + { 0x1A, 0x5B, 0x27, 0x00 }, +}; + +static const u16 _02101DBE[] = { 0xE002, 0xE002, 0xE003, 0xE003, 0xE004, 0xE004, 0xD004, 0xD004, 0xE007, 0xE007, 0xE007, 0xE008, 0xE008 }; + +static const u16 _02101DD8[] = { 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xE007, 0xE007, 0xE007, 0xE008, 0xE008 }; + +static const u16 *_021104E4[] = { + _02101DBE, + _02101DBE, + _02101DBE, + _02101DBE, + _02101DD8, +}; + +static const u16 _02101D80[] = { + 0x0019, + 0x0039, + 0x0059, + 0x0061, + 0x007A, + 0x009E, + 0x00C6, + 0x0000, +}; + +static const u8 _02101D4C[] = { + 0x28, + 0x28, + 0x28, + 0x28, + 0x29, + 0x29, + 0x29, +}; + +static const u16 _02101E80[] = { 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x01DE, 0x01AD, 0x01AE, 0xFFFF }; + +static const u16 _02101E9C[] = { 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x01DE, 0x01B3, 0x01BE, 0xFFFF }; + +static const u16 _02101EB8[] = { 0x013F, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF }; + +static const u16 _02101E2C[] = { 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF }; + +static const u16 _02101E64[] = { 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x01DE, 0x01DE, 0x01DE, 0xFFFF }; + +static const u16 _02101EF0[] = { 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x01DE, 0x01AD, 0x01AE, 0xFFFF }; + +static const u16 _02101F0C[] = { 0x014F, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x01DE, 0x01B3, 0x01BE, 0xFFFF }; + +static const u16 _0210205C[] = { 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF }; + +static const u16 _02101F60[] = { 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF }; + +static const u16 _02102024[] = { 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x01DE, 0x01DE, 0x01DE, 0xFFFF }; + +static const u16 _02101F98[] = { 0x01AD, 0x01AE, 0x01C4, 0x01C5, 0x01AB, 0x01AC, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0x01DE, 0x01DE, 0xFFFF }; + +static const u16 _02101FD0[] = { 0x01B4, 0x01B5, 0x01B2, 0x01B3, 0x01B9, 0x01BA, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF }; + +static const u16 _02101FEC[] = { 0x01AF, 0x01B0, 0x01C3, 0x01D0, 0x01C0, 0x01D2, 0x01BD, 0x01BE, 0x01BF, 0x01B1, 0x01C1, 0x01DE, 0x01DE, 0xFFFF }; + +static const u16 _02102008[] = { 0x01CB, 0x01CC, 0x01CD, 0x01CE, 0x01CF, 0x01C6, 0x01C8, 0x01C9, 0x01C7, 0x01CA, 0x01D1, 0x01DE, 0x01DE, 0xFFFF }; + +static const u16 _02102040[] = { 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA, 0x01DD, 0x01DB, 0x01DC, 0x01DE, 0x01DE, 0xFFFF }; + +static const u16 _02101F7C[] = { 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x0001, 0x00E1, 0x00E2, 0xFFFF }; + +static const u16 _02101DF2[] = { 0x00E3, 0x00E4, 0x00F9, 0x00F8, 0x00E5, 0x00E6, 0x00F5, 0x00F6, 0x00F7, 0x00E7, 0x0001, 0x00EE, 0x00EF, 0xFFFF }; + +static const u16 _02101F44[] = { 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0106, 0x0104, 0xFFFF }; + +static const u16 _02101F28[] = { 0x00FF, 0x0100, 0x0101, 0x0102, 0x0103, 0x00FC, 0x00FA, 0x00FD, 0x00FB, 0x00FE, 0x0105, 0x0001, 0x0001, 0xFFFF }; + +static const u16 _02101E48[] = { 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x0111, 0x010F, 0x0110, 0x0001, 0x0001, 0xFFFF }; + +static const u16 _021020D4[] = { 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF }; + +static const u16 _021020F8[] = { 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF }; + +static const u16 _0210211C[] = { 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF }; + +static const u16 *_021104F8[][5] = { + { _02101E80, _02101E9C, _02101EB8, _02101E2C, _02101E64 }, + { _02101EF0, _02101F0C, _0210205C, _02101F60, _02102024 }, + { _02101F98, _02101FD0, _02101FEC, _02102008, _02102040 }, + { _02101F7C, _02101DF2, _02101F44, _02101F28, _02101E48 }, + { _021020D4, _021020F8, _0210211C, _0210211C, _0210211C }, +}; + +static const u16 _02102422[][3] = { + { 0x0003, 0x0001, 0x0002 }, + { 0x0005, 0x0001, 0x0004 }, + { 0x0007, 0x0001, 0x0006 }, + { 0x0009, 0x0001, 0x0008 }, + { 0x000B, 0x0001, 0x000A }, + { 0x0053, 0x0001, 0x0052 }, + { 0x0055, 0x0001, 0x0054 }, + { 0x0057, 0x0001, 0x0056 }, + { 0x0059, 0x0001, 0x0058 }, + { 0x005B, 0x0001, 0x005A }, + { 0x0045, 0x0001, 0x0044 }, + { 0x0047, 0x0001, 0x0046 }, + { 0x0049, 0x0001, 0x0048 }, + { 0x0095, 0x0001, 0x0094 }, + { 0x0097, 0x0001, 0x0096 }, + { 0x0099, 0x0001, 0x0098 }, + { 0x00AC, 0x0001, 0x00C6 }, + { 0x00AD, 0x0001, 0x00C7 }, + { 0x00AE, 0x0001, 0x00C8 }, + { 0x00AF, 0x0001, 0x00C9 }, + { 0x00B0, 0x0001, 0x00CA }, + { 0x00B1, 0x0001, 0x00CB }, + { 0x00B2, 0x0001, 0x00CC }, + { 0x00B3, 0x0001, 0x00CD }, + { 0x00B4, 0x0001, 0x00CE }, + { 0x00B5, 0x0001, 0x00CF }, + { 0x00B6, 0x0001, 0x00D0 }, + { 0x00B7, 0x0001, 0x00D1 }, + { 0x00B8, 0x0001, 0x00D2 }, + { 0x00B9, 0x0001, 0x00D3 }, + { 0x00BA, 0x0001, 0x00D4 }, + { 0x00BB, 0x0001, 0x00D5 }, + { 0x00BC, 0x0001, 0x00D6 }, + { 0x00BD, 0x0001, 0x00D7 }, + { 0x00BE, 0x0001, 0x00D8 }, + { 0x00BF, 0x0001, 0x00D9 }, + { 0x00C0, 0x0001, 0x00DA }, + { 0x00C1, 0x0001, 0x00DB }, + { 0x00C2, 0x0001, 0x00DC }, + { 0x00C3, 0x0001, 0x00DD }, + { 0x00C4, 0x0001, 0x00DE }, + { 0x00C5, 0x0001, 0x00DF }, + { 0x0025, 0x0026, 0x0024 }, + { 0x0075, 0x0076, 0x0074 }, + { 0x000C, 0x000D, 0x0001 }, + { 0x000E, 0x000F, 0x0001 }, + { 0x0010, 0x0011, 0x0001 }, + { 0x0012, 0x0013, 0x0001 }, + { 0x0014, 0x0015, 0x0001 }, + { 0x0016, 0x0017, 0x0001 }, + { 0x0018, 0x0019, 0x0001 }, + { 0x001A, 0x001B, 0x0001 }, + { 0x001C, 0x001D, 0x0001 }, + { 0x001E, 0x001F, 0x0001 }, + { 0x0020, 0x0021, 0x0001 }, + { 0x0022, 0x0023, 0x0001 }, + { 0x0027, 0x0028, 0x0001 }, + { 0x0029, 0x002A, 0x0001 }, + { 0x005C, 0x005D, 0x0001 }, + { 0x005E, 0x005F, 0x0001 }, + { 0x0060, 0x0061, 0x0001 }, + { 0x0062, 0x0063, 0x0001 }, + { 0x0064, 0x0065, 0x0001 }, + { 0x0066, 0x0067, 0x0001 }, + { 0x0068, 0x0069, 0x0001 }, + { 0x006A, 0x006B, 0x0001 }, + { 0x006C, 0x006D, 0x0001 }, + { 0x006E, 0x006F, 0x0001 }, + { 0x0070, 0x0071, 0x0001 }, + { 0x0072, 0x0073, 0x0001 }, + { 0x0077, 0x0078, 0x0001 }, + { 0x0079, 0x007A, 0x0001 }, + { 0x0030, 0x0031, 0x0032 }, + { 0x0033, 0x0034, 0x0035 }, + { 0x0036, 0x0037, 0x0038 }, + { 0x0039, 0x003A, 0x003B }, + { 0x003C, 0x003D, 0x003E }, + { 0x0080, 0x0081, 0x0082 }, + { 0x0083, 0x0084, 0x0085 }, + { 0x0086, 0x0087, 0x0088 }, + { 0x0089, 0x008A, 0x008B }, + { 0x008C, 0x008D, 0x008E }, +}; + +static const u16 _021021B8[][2] = { + { 0x0024, 0x0026 }, + { 0x0074, 0x0076 }, + { 0x0032, 0x0031 }, + { 0x0035, 0x0034 }, + { 0x0038, 0x0037 }, + { 0x003B, 0x003A }, + { 0x003E, 0x003D }, + { 0x0082, 0x0081 }, + { 0x0085, 0x0084 }, + { 0x0088, 0x0087 }, + { 0x008B, 0x008A }, + { 0x008E, 0x008D }, +}; + +static const u16 _02102190[][2] = { + { 0x0031, 0x0032 }, + { 0x0034, 0x0035 }, + { 0x0037, 0x0038 }, + { 0x003A, 0x003B }, + { 0x003D, 0x003E }, + { 0x0081, 0x0082 }, + { 0x0084, 0x0085 }, + { 0x0087, 0x0088 }, + { 0x008A, 0x008B }, + { 0x008D, 0x008E }, +}; + +static const int _02101D54[] = { + 0x00000070, + 0x0000004C, + 0x00000048, +}; + +static const u8 _02101D40[] = { + 0x04, + 0x07, + 0x0D, + 0x0A, +}; + +const u16 _02101D90[] = { 0x0003, 0x002B, 0x0020, 0x002F, 0x0001, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, 0xFFFF }; + +// ポケモンの ニックネ-ムは? +const u16 _02102094[] = { 0x008E, 0x0062, 0x0093, 0x00A1, 0x002F, 0x0001, 0x007C, 0x0074, 0x0060, 0x007E, 0x00F1, 0x0091, 0x0030, 0x00E2, 0xFFFF }; + +const u16 _02101DA6[] = { 0x008D, 0x0074, 0x0060, 0x006A, 0x002F, 0x0001, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, 0xFFFF }; + +static const u16 *sDeadstrippedPointersTable[] = { + _02101D90, + _02102094, + _02101DA6, +}; + +static const int _021020B4[] = { + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 8, +}; + +const OVY_MGR_TEMPLATE gOverlayTemplate_NamingScreen = { + NamingScreenApp_Init, + NamingScreenApp_Main, + NamingScreenApp_Exit, + FS_OVERLAY_ID_NONE, +}; BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { NamingScreenAppData *data; @@ -230,7 +470,7 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { return FALSE; } -void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form) { +static void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form) { GX_LoadOBJ(pCharData->pRawData, 0x57E0, 0x200); const u16 *rawPltt = pPlttData->pRawData; u32 plttNo = GetMonIconPaletteEx(species, form, FALSE); @@ -308,7 +548,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { return FALSE; } -int sub_02082CF8(NamingScreenAppData *data, int a1) { +static int sub_02082CF8(NamingScreenAppData *data, int a1) { int ret = a1; sub_0208432C(data); @@ -354,7 +594,7 @@ int sub_02082CF8(NamingScreenAppData *data, int a1) { #define FIRST_DEFAULT_NAME_RIVAL msg_0254_00085 #endif // HEARTGOLD -void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args) { +static void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args) { String *string; if (data->type == NAME_SCREEN_PLAYER) { @@ -377,7 +617,7 @@ void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args) { } } -BOOL sub_02082EC0(const u16 *s) { +static BOOL sub_02082EC0(const u16 *s) { BOOL ret = TRUE; int i; @@ -483,13 +723,13 @@ void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs) { // Back to private scope // ------------------------------- -void sub_02083140(void *param) { +static void sub_02083140(void *param) { GF_RunVramTransferTasks(); OamManager_ApplyAndResetBuffers(); OS_SetIrqCheckFlag(OS_IE_V_BLANK); } -void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args) { +static void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args) { data->type = args->kind; data->unk_004 = args->playerGender; data->unk_008 = args->monForm; @@ -499,42 +739,110 @@ void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args) { data->unk_5D0 = args->unk50; } -void sub_02083184(void) { - extern const GraphicsBanks _02102140; +static void sub_02083184(void) { + static const GraphicsBanks _02102140 = { + GX_VRAM_BG_128_A, + GX_VRAM_BGEXTPLTT_NONE, + GX_VRAM_SUB_BG_128_C, + GX_VRAM_SUB_BGEXTPLTT_NONE, + GX_VRAM_OBJ_128_B, + GX_VRAM_OBJEXTPLTT_NONE, + GX_VRAM_SUB_OBJ_16_I, + GX_VRAM_SUB_OBJEXTPLTT_NONE, + GX_VRAM_TEX_NONE, + GX_VRAM_TEXPLTT_NONE, + }; GraphicsBanks graphicsBanks = _02102140; GfGfx_SetBanks(&graphicsBanks); } -void sub_020831A4(BgConfig *bgConfig) { +static void sub_020831A4(BgConfig *bgConfig) { { - extern const GraphicsModes _02101D60; + static const GraphicsModes _02101D60 = { + GX_DISPMODE_GRAPHICS, + GX_BGMODE_0, + GX_BGMODE_0, + GX_BG0_AS_2D, + }; GraphicsModes graphicsModes = _02101D60; SetBothScreensModesAndDisable(&graphicsModes); } { - extern const BgTemplate _02101ED4; + static const BgTemplate _02101ED4 = { + .x = 0x00000000, + .y = 0x00000000, + .bufferSize = GF_BG_BUF_SIZE_512x256_4BPP, + .baseTile = 0x00000000, + .size = GF_BG_SCR_SIZE_512x256, + .colorMode = GX_BG_COLORMODE_16, + .screenBase = GX_BG_SCRBASE_0xf000, + .charBase = GX_BG_CHARBASE_0x10000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .mosaic = 0x00000000, + }; BgTemplate bgTemplate = _02101ED4; InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_0, &bgTemplate, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_0); } { - extern const BgTemplate _02101FB4; + static const BgTemplate _02101FB4 = { + .x = 0x00000000, + .y = 0x00000000, + .bufferSize = GF_BG_BUF_SIZE_512x256_4BPP, + .baseTile = 0x00000000, + .size = GF_BG_SCR_SIZE_512x256, + .colorMode = GX_BG_COLORMODE_16, + .screenBase = GX_BG_SCRBASE_0xe000, + .charBase = GX_BG_CHARBASE_0x10000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 2, + .areaOver = GX_BG_AREAOVER_XLU, + .mosaic = 0x00000000, + }; BgTemplate bgTemplate = _02101FB4; InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_1, &bgTemplate, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_1); } { - extern const BgTemplate _02102078; + static const BgTemplate _02102078 = { + .x = 0x00000000, + .y = 0x00000000, + .bufferSize = GF_BG_BUF_SIZE_256x256_4BPP, + .baseTile = 0x00000000, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, + .screenBase = GX_BG_SCRBASE_0xd000, + .charBase = GX_BG_CHARBASE_0x00000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 3, + .areaOver = GX_BG_AREAOVER_XLU, + .mosaic = 0x00000000, + }; BgTemplate bgTemplate = _02102078; InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_2, &bgTemplate, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_2); } { - extern const BgTemplate _02101E10; + static const BgTemplate _02101E10 = { + .x = 0x00000000, + .y = 0x00000000, + .bufferSize = GF_BG_BUF_SIZE_256x256_4BPP, + .baseTile = 0x00000000, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, + .screenBase = GX_BG_SCRBASE_0xf800, + .charBase = GX_BG_CHARBASE_0x10000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 0, + .areaOver = GX_BG_AREAOVER_XLU, + .mosaic = 0x00000000, + }; BgTemplate bgTemplate = _02101E10; InitBgFromTemplate(bgConfig, GF_BG_LYR_SUB_0, &bgTemplate, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_SUB_0); @@ -551,7 +859,7 @@ void sub_020831A4(BgConfig *bgConfig) { G2S_BlendNone(); } -void sub_020832E4(GFPlaneToggle enable) { +static void sub_020832E4(GFPlaneToggle enable) { GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG0, enable); GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG1, enable); GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG2, enable); @@ -562,7 +870,7 @@ void sub_020832E4(GFPlaneToggle enable) { GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_OFF); } -void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { +static void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); data->unk_45C = 4; @@ -609,7 +917,7 @@ void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { } } -void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { +static void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); if (args->unk44 != 0) { String *string = String_New(200, HEAP_ID_NAMING_SCREEN); @@ -639,7 +947,7 @@ void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { } } -void sub_02083614(BgConfig *bgConfig, Window *a1) { +static void sub_02083614(BgConfig *bgConfig, Window *a1) { for (int i = 0; i < 10; ++i) { RemoveWindow(&a1[i]); } @@ -650,7 +958,7 @@ void sub_02083614(BgConfig *bgConfig, Window *a1) { FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, bgConfig); } -void sub_02083654(NamingScreenAppData *data, NARC *narc) { +static void sub_02083654(NamingScreenAppData *data, NARC *narc) { BgConfig *bgConfig = data->bgConfig; GfGfxLoader_GXLoadPalFromOpenNarc(narc, 0, GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0, 0x60, HEAP_ID_NAMING_SCREEN); @@ -672,8 +980,13 @@ void sub_02083654(NamingScreenAppData *data, NARC *narc) { data->unk_4AC = GfGfxLoader_GetCharDataFromOpenNarc(narc, 16, TRUE, &data->unk_4B0, HEAP_ID_NAMING_SCREEN); } -void sub_0208377C(void) { - extern const ObjCharTransferTemplate _02101D70; +static void sub_0208377C(void) { + static const ObjCharTransferTemplate _02101D70 = { + .maxTasks = 20, + .sizeMain = 0x800, + .sizeSub = 0x800, + .heapId = HEAP_ID_NAMING_SCREEN, + }; ObjCharTransferTemplate tmplate = _02101D70; ObjCharTransfer_Init(&tmplate); ObjPlttTransfer_Init(20, HEAP_ID_NAMING_SCREEN); @@ -681,7 +994,7 @@ void sub_0208377C(void) { ObjPlttTransfer_Reset(); } -void sub_020837AC(NamingScreenAppData *data, NARC *narc) { +static void sub_020837AC(NamingScreenAppData *data, NARC *narc) { NNS_G2dInitOamManagerModule(); GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); GXS_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); @@ -722,7 +1035,7 @@ typedef struct SysTaskData_020839B8 { int i; } SysTaskData_020839B8; -void sub_020839B8(SysTask *task, void *taskData) { +static void sub_020839B8(SysTask *task, void *taskData) { SysTaskData_020839B8 *data = taskData; VecFx32 *pMatrix = Sprite_GetMatrixPtr(data->sprite); VecFx32 matrix; @@ -732,7 +1045,7 @@ void sub_020839B8(SysTask *task, void *taskData) { Sprite_SetMatrix(data->sprite2, &matrix); } -void sub_020839EC(NamingScreenAppData *data) { +static void sub_020839EC(NamingScreenAppData *data) { int i; CreateSpriteResourcesHeader(&data->unk_2E4, 0, 0, 0, 0, -1, -1, 0, 1, data->unk_2B4[GF_GFX_RES_TYPE_CHAR], data->unk_2B4[GF_GFX_RES_TYPE_PLTT], data->unk_2B4[GF_GFX_RES_TYPE_CELL], data->unk_2B4[GF_GFX_RES_TYPE_ANIM], NULL, NULL); CreateSpriteResourcesHeader(&data->unk_308, 1, 1, 1, 1, -1, -1, 0, 0, data->unk_2B4[GF_GFX_RES_TYPE_CHAR], data->unk_2B4[GF_GFX_RES_TYPE_PLTT], data->unk_2B4[GF_GFX_RES_TYPE_CELL], data->unk_2B4[GF_GFX_RES_TYPE_ANIM], NULL, NULL); @@ -783,7 +1096,7 @@ void sub_020839EC(NamingScreenAppData *data) { GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); } -void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate) { +static void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate) { tmplate->position.x = FX32_CONST(24); tmplate->position.y = FX32_CONST(8); data->unk_394[0] = Sprite_CreateAffine(tmplate); @@ -836,7 +1149,7 @@ typedef struct SysTaskData_02083CAC { int y; } SysTaskData_02083CAC; -void sub_02083CAC(SysTask *task, void *taskData) { +static void sub_02083CAC(SysTask *task, void *taskData) { SysTaskData_02083CAC *data = taskData; VecFx32 matrix; @@ -865,7 +1178,7 @@ void sub_02083CAC(SysTask *task, void *taskData) { ++data->state; // UB: potential use after free } -void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData) { +static void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData) { GFBgLayer bgId_prev = *pBgId; GFBgLayer bgId_curr = (GFBgLayer)(bgId_prev ^ 1); @@ -924,13 +1237,13 @@ void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, } } -void sub_02083F18(Window *window, NameScreenType unused, String *msg) { +static void sub_02083F18(Window *window, NameScreenType unused, String *msg) { DrawFrameAndWindow2(window, FALSE, 0x100, 10); AddTextPrinterParameterized(window, 1, msg, 0, 0, TEXT_SPEED_INSTANT, NULL); CopyWindowToVram(window); } -void sub_02083F48(Window *window, NameScreenType unused, String *msg) { +static void sub_02083F48(Window *window, NameScreenType unused, String *msg) { int x = 16; int width = FontID_String_GetWidth(0, msg, 0); int windowWidth = GetWindowWidth(window) * 8; @@ -942,7 +1255,7 @@ void sub_02083F48(Window *window, NameScreenType unused, String *msg) { CopyWindowToVram(window); } -void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc) { +static void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc) { AddWindowParameterized(data->bgConfig, &data->unk_3B8[0], GF_BG_LYR_MAIN_0, 2, 1, 26, 12, 1, 0x100); AddWindowParameterized(data->bgConfig, &data->unk_3B8[1], GF_BG_LYR_MAIN_1, 2, 1, 26, 12, 1, 0x238); @@ -991,19 +1304,27 @@ void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc) { FillWindowPixelBuffer(&data->unk_3B8[7], 0); } -void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos) { +static void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos) { SetBgPriority(bgId, 1); SetBgPriority(bgId ^ 1, 2); } -void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId) { +static void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId) { posVecs[bgId].x = 238; posVecs[bgId].y = -80; posVecs[bgId ^ 1].x = -11; posVecs[bgId ^ 1].y = -80; } -int sub_02084264(int val, int lo, int hi) { +static const int _02102168[][2] = { + { 0, 0 }, + { 0, -1 }, + { 0, 1 }, + { -1, 0 }, + { 1, 0 }, +}; + +static int sub_02084264(int val, int lo, int hi) { if (val >= hi) { val = lo; } @@ -1013,7 +1334,7 @@ int sub_02084264(int val, int lo, int hi) { return val; } -void sub_02084274(NamingScreenAppData *data, int a1) { +static void sub_02084274(NamingScreenAppData *data, int a1) { if (a1 == 0) { return; } @@ -1033,7 +1354,7 @@ void sub_02084274(NamingScreenAppData *data, int a1) { data->cursorY = newY; } -void sub_0208432C(NamingScreenAppData *data) { +static void sub_0208432C(NamingScreenAppData *data) { int r4 = 0; int r6 = 0; BOOL r7 = FALSE; @@ -1087,7 +1408,7 @@ void sub_0208432C(NamingScreenAppData *data) { } } -void sub_02084430(NamingScreenAppData *data, int a1) { +static void sub_02084430(NamingScreenAppData *data, int a1) { if (data->cursorY != 0) { if (data->unk_028 == 0 && data->unk_028 != data->cursorY) { Sprite_SetAnimCtrlSeq(data->unk_32C[8], 39); @@ -1121,7 +1442,7 @@ void sub_02084430(NamingScreenAppData *data, int a1) { } } -void sub_02084500(u16 *a0) { +static void sub_02084500(u16 *a0) { *a0 += 20; if (*a0 > 360) { *a0 = 0; @@ -1131,7 +1452,7 @@ void sub_02084500(u16 *a0) { GX_LoadOBJPltt(&col, 0x3A, sizeof(col)); } -void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels) { +static void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels) { int i = 0; int width; int centerX; @@ -1157,12 +1478,14 @@ void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing String_Delete(string); } -void *sub_02084640(Window *window, String *string, FontID fontId, u32 color) { +static const u8 _02101D3C[] = { 0x60, 0x68, 0x50, 0x58 }; + +static void *sub_02084640(Window *window, String *string, FontID fontId, u32 color) { AddTextPrinterParameterizedWithColor(window, fontId, string, 0, 0, TEXT_SPEED_NOTRANSFER, color, NULL); return window->pixelBuffer; } -void sub_02084664(Window *windows, const u16 *a1, void *a2, String *a3) { +static void sub_02084664(Window *windows, const u16 *a1, void *a2, String *a3) { u16 spC[21]; u16 i; void *ptr; @@ -1193,7 +1516,7 @@ void sub_02084664(Window *windows, const u16 *a1, void *a2, String *a3) { String_Delete(string); } -void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String *a5) { +static void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String *a5) { int i; int j; u16 character; @@ -1246,7 +1569,7 @@ void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String *a5) { } #ifdef NONMATCHING -void sub_02084830(u16 (*a0)[13], const int a1) { +static void sub_02084830(u16 (*a0)[13], const int a1) { int i; int j; @@ -1261,7 +1584,7 @@ void sub_02084830(u16 (*a0)[13], const int a1) { } #else // clang-format off -asm void sub_02084830(u16 (*a0)[13], const int a1) { +static asm void sub_02084830(u16 (*a0)[13], const int a1) { push {r4, r5, r6, r7} mov r4, #0 ldr r3, =_021104E4 @@ -1307,7 +1630,7 @@ asm void sub_02084830(u16 (*a0)[13], const int a1) { // clang-format on #endif // NONMATCHING -int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2) { +static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2) { if (key == 0xD003 || key == 0xD004) { key = 1; } @@ -1410,7 +1733,7 @@ int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2) { return 2; } -void sub_02084C58(NamingScreenAppData *data, BOOL a1) { +static void sub_02084C58(NamingScreenAppData *data, BOOL a1) { if (data->unk_5D0 != NULL) { if (a1 == TRUE) { sub_02018410(data->unk_5D0, FALSE); @@ -1421,14 +1744,14 @@ void sub_02084C58(NamingScreenAppData *data, BOOL a1) { } // DANGER: Can spin infinitely here -int sub_02084C78(const u16 *a0, int a1) { +static int sub_02084C78(const u16 *a0, int a1) { do { a1 = sub_02084264(a1 + 1, 0, 3); } while (a0[a1] == 1); return a0[a1]; } -BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3) { +static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3) { int i; int j; u16 key; @@ -1449,7 +1772,7 @@ BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3) { return FALSE; } -BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { +static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { int i; u16 key; @@ -1501,7 +1824,7 @@ BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { return FALSE; } -void sub_02084E18(Sprite **sprites, int a1, int maxLen) { +static void sub_02084E18(Sprite **sprites, int a1, int maxLen) { for (int i = 0; i < maxLen; ++i) { Sprite_SetAnimCtrlSeq(sprites[i], 43); } @@ -1510,7 +1833,9 @@ void sub_02084E18(Sprite **sprites, int a1, int maxLen) { } } -void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData) { +static const u8 _02101D44[] = { 0x03, 0x06, 0x0C, 0x09, 0x09 }; + +static void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData) { FillWindowPixelBuffer(window, fillVal); for (int i = 0; i < 6; ++i) { @@ -1531,7 +1856,7 @@ void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *p CopyWindowToVram(window); } -void sub_02084F3C(int *a0, Sprite **a1, int a2) { +static void sub_02084F3C(int *a0, Sprite **a1, int a2) { for (int i = 0; i < 3; ++i) { if (a0[i] != 0) { for (int j = 0; j < 3; ++j) { @@ -1551,7 +1876,7 @@ void sub_02084F3C(int *a0, Sprite **a1, int a2) { } } -void sub_02084FCC(NamingScreenAppData *data) { +static void sub_02084FCC(NamingScreenAppData *data) { if (Sprite_IsCellAnimationRunning(data->unk_32C[8])) { return; } @@ -1572,7 +1897,81 @@ void sub_02084FCC(NamingScreenAppData *data) { Sprite_SetOamMode(data->unk_32C[8], GX_OAM_MODE_NORMAL); } -BOOL sub_0208503C(NamingScreenAppData *data) { +static const UnkStruct_02102278 _02102278[] = { + { .x = 0x19, .y = 0x3C, .unk_2_0 = 0, .unk_4_0 = 0, .unk_4_5 = 0 }, + { .x = 0x39, .y = 0x3C, .unk_2_0 = 0, .unk_4_0 = 2, .unk_4_5 = 0 }, + { .x = 0x59, .y = 0x3C, .unk_2_0 = 0, .unk_4_0 = 4, .unk_4_5 = 0 }, + { .x = 0x00, .y = 0xC0, .unk_2_0 = 0, .unk_4_0 = 4, .unk_4_5 = 0 }, + { .x = 0x9D, .y = 0x3C, .unk_2_0 = 1, .unk_4_0 = 8, .unk_4_5 = 0 }, + { .x = 0xC5, .y = 0x3C, .unk_2_0 = 1, .unk_4_0 = 11, .unk_4_5 = 0 }, + { .x = 0x1C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 0, .unk_4_5 = 1 }, + { .x = 0x2C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 1, .unk_4_5 = 1 }, + { .x = 0x3C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 2, .unk_4_5 = 1 }, + { .x = 0x4C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 3, .unk_4_5 = 1 }, + { .x = 0x5C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 4, .unk_4_5 = 1 }, + { .x = 0x6C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 5, .unk_4_5 = 1 }, + { .x = 0x7C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 6, .unk_4_5 = 1 }, + { .x = 0x8C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 7, .unk_4_5 = 1 }, + { .x = 0x9C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 8, .unk_4_5 = 1 }, + { .x = 0xAC, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 9, .unk_4_5 = 1 }, + { .x = 0xBC, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 10, .unk_4_5 = 1 }, + { .x = 0xCC, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 11, .unk_4_5 = 1 }, + { .x = 0xDC, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 12, .unk_4_5 = 1 }, + { .x = 0x1C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 0, .unk_4_5 = 2 }, + { .x = 0x2C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 1, .unk_4_5 = 2 }, + { .x = 0x3C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 2, .unk_4_5 = 2 }, + { .x = 0x4C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 3, .unk_4_5 = 2 }, + { .x = 0x5C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 4, .unk_4_5 = 2 }, + { .x = 0x6C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 5, .unk_4_5 = 2 }, + { .x = 0x7C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 6, .unk_4_5 = 2 }, + { .x = 0x8C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 7, .unk_4_5 = 2 }, + { .x = 0x9C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 8, .unk_4_5 = 2 }, + { .x = 0xAC, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 9, .unk_4_5 = 2 }, + { .x = 0xBC, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 10, .unk_4_5 = 2 }, + { .x = 0xCC, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 11, .unk_4_5 = 2 }, + { .x = 0xDC, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 12, .unk_4_5 = 2 }, + { .x = 0x1C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 0, .unk_4_5 = 3 }, + { .x = 0x2C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 1, .unk_4_5 = 3 }, + { .x = 0x3C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 2, .unk_4_5 = 3 }, + { .x = 0x4C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 3, .unk_4_5 = 3 }, + { .x = 0x5C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 4, .unk_4_5 = 3 }, + { .x = 0x6C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 5, .unk_4_5 = 3 }, + { .x = 0x7C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 6, .unk_4_5 = 3 }, + { .x = 0x8C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 7, .unk_4_5 = 3 }, + { .x = 0x9C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 8, .unk_4_5 = 3 }, + { .x = 0xAC, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 9, .unk_4_5 = 3 }, + { .x = 0xBC, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 10, .unk_4_5 = 3 }, + { .x = 0xCC, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 11, .unk_4_5 = 3 }, + { .x = 0xDC, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 12, .unk_4_5 = 3 }, + { .x = 0x1C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 0, .unk_4_5 = 4 }, + { .x = 0x2C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 1, .unk_4_5 = 4 }, + { .x = 0x3C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 2, .unk_4_5 = 4 }, + { .x = 0x4C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 3, .unk_4_5 = 4 }, + { .x = 0x5C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 4, .unk_4_5 = 4 }, + { .x = 0x6C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 5, .unk_4_5 = 4 }, + { .x = 0x7C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 6, .unk_4_5 = 4 }, + { .x = 0x8C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 7, .unk_4_5 = 4 }, + { .x = 0x9C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 8, .unk_4_5 = 4 }, + { .x = 0xAC, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 9, .unk_4_5 = 4 }, + { .x = 0xBC, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 10, .unk_4_5 = 4 }, + { .x = 0xCC, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 11, .unk_4_5 = 4 }, + { .x = 0xDC, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 12, .unk_4_5 = 4 }, + { .x = 0x1C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 0, .unk_4_5 = 5 }, + { .x = 0x2C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 1, .unk_4_5 = 5 }, + { .x = 0x3C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 2, .unk_4_5 = 5 }, + { .x = 0x4C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 3, .unk_4_5 = 5 }, + { .x = 0x5C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 4, .unk_4_5 = 5 }, + { .x = 0x6C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 5, .unk_4_5 = 5 }, + { .x = 0x7C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 6, .unk_4_5 = 5 }, + { .x = 0x8C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 7, .unk_4_5 = 5 }, + { .x = 0x9C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 8, .unk_4_5 = 5 }, + { .x = 0xAC, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 9, .unk_4_5 = 5 }, + { .x = 0xBC, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 10, .unk_4_5 = 5 }, + { .x = 0xCC, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 11, .unk_4_5 = 5 }, + { .x = 0xDC, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 12, .unk_4_5 = 5 }, +}; + +static BOOL sub_0208503C(NamingScreenAppData *data) { int i; int ip = 0; u8 x; diff --git a/tmp.txt b/tmp.txt new file mode 100644 index 0000000000..260d674565 --- /dev/null +++ b/tmp.txt @@ -0,0 +1,71 @@ +0x0000 +0x0002 +0x0004 +0x0004 +0x0008 +0x000B +0x0100 +0x0101 +0x0102 +0x0103 +0x0104 +0x0105 +0x0106 +0x0107 +0x0108 +0x0109 +0x010A +0x010B +0x010C +0x0200 +0x0201 +0x0202 +0x0203 +0x0204 +0x0205 +0x0206 +0x0207 +0x0208 +0x0209 +0x020A +0x020B +0x020C +0x0300 +0x0301 +0x0302 +0x0303 +0x0304 +0x0305 +0x0306 +0x0307 +0x0308 +0x0309 +0x030A +0x030B +0x030C +0x0400 +0x0401 +0x0402 +0x0403 +0x0404 +0x0405 +0x0406 +0x0407 +0x0408 +0x0409 +0x040A +0x040B +0x040C +0x0500 +0x0501 +0x0502 +0x0503 +0x0504 +0x0505 +0x0506 +0x0507 +0x0508 +0x0509 +0x050A +0x050B +0x050C From f5149d7402c3939bcc915d265978501b9f0c4b89 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 13 Oct 2024 16:53:38 -0400 Subject: [PATCH 16/25] decompiing the data made this match lmfao --- src/naming_screen.c | 48 --------------------------------------------- 1 file changed, 48 deletions(-) diff --git a/src/naming_screen.c b/src/naming_screen.c index e8160537c2..a78bd83bce 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -1568,7 +1568,6 @@ static void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String sub_02084664(a0, a3, a4, a5); } -#ifdef NONMATCHING static void sub_02084830(u16 (*a0)[13], const int a1) { int i; int j; @@ -1582,53 +1581,6 @@ static void sub_02084830(u16 (*a0)[13], const int a1) { } } } -#else -// clang-format off -static asm void sub_02084830(u16 (*a0)[13], const int a1) { - push {r4, r5, r6, r7} - mov r4, #0 - ldr r3, =_021104E4 - add r5, r4, #0 - add r6, r0, #0 - lsl r2, r1, #2 -_0208483C: - ldr r7, [r3, r2] - add r4, r4, #1 - ldrh r7, [r7, r5] - add r5, r5, #2 - strh r7, [r6, #0] - add r6, r6, #2 - cmp r4, #0xd - blt _0208483C - mov r3, #0x14 - ldr r4, =_021104F8 - mul r3, r1 - mov r2, #0 - add r3, r4, r3 - add r1, r2, #0 -_02084858: - add r6, r1, #0 - add r4, r1, #0 - add r5, r0, #0 -_0208485E: - ldr r7, [r3, #0] - add r6, r6, #1 - ldrh r7, [r7, r4] - add r4, r4, #2 - strh r7, [r5, #0x1a] - add r5, r5, #2 - cmp r6, #0xd - blt _0208485E - add r2, r2, #1 - add r3, r3, #4 - add r0, #0x1a - cmp r2, #5 - blt _02084858 - pop {r4, r5, r6, r7} - bx lr -} -// clang-format on -#endif // NONMATCHING static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2) { if (key == 0xD003 || key == 0xD004) { From 5b94579debcfae7eb9b535c60dc2e7d0025d23d6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 13 Oct 2024 19:45:09 -0400 Subject: [PATCH 17/25] Documentation, 1 --- include/constants/charcode.h | 50 +- include/naming_screen.h | 14 +- src/launch_application.c | 12 +- src/naming_screen.c | 1374 +++++++++++++++++----------------- src/oaks_speech.c | 8 +- 5 files changed, 757 insertions(+), 701 deletions(-) diff --git a/include/constants/charcode.h b/include/constants/charcode.h index 8d572188c7..56755332d1 100644 --- a/include/constants/charcode.h +++ b/include/constants/charcode.h @@ -250,11 +250,57 @@ #define CHAR_y 349 #define CHAR_z 350 +#define CHAR_EXCL 427 +#define CHAR_QMARK 428 +#define CHAR_COMMA 429 +#define CHAR_PERIOD 430 #define CHAR_ELLIPSIS 431 +#define CHAR_CTRDOT 432 -#define CHAR_HYPHEN 446 +#define CHAR_SLASH 433 +#define CHAR_LAPOST 434 // left single quote +#define CHAR_RAPOST 435 // right single quote (apostrophe) +#define CHAR_LDQUOT 436 // left double quote +#define CHAR_RDQUOT 437 // right double quote -#define CHAR_SPACE 478 +#define CHAR_LPAREN 441 +#define CHAR_RPAREN 442 +#define CHAR_MALE 443 +#define CHAR_FEMALE 444 +#define CHAR_PLUS 445 +#define CHAR_HYPHEN 446 +#define CHAR_ASTERISK 447 +#define CHAR_HASH 448 +#define CHAR_EQUALS 449 + +#define CHAR_TILDE 451 +#define CHAR_COLON 452 +#define CHAR_SEMICOLON 453 +#define CHAR_SPADE_SUIT 454 +#define CHAR_CLUB_SUIT 455 +#define CHAR_HEART_SUIT 456 +#define CHAR_DIAMOND_SUIT 457 +#define CHAR_STAR 458 +#define CHAR_CIRCLE_DOT 459 +#define CHAR_CIRCLE 460 +#define CHAR_SQUARE 461 +#define CHAR_TRIANGLE 462 +#define CHAR_DIAMOND 463 +#define CHAR_AT 464 +#define CHAR_MUSIC_NOTE 465 +#define CHAR_PERCENT 466 +#define CHAR_SUN 467 +#define CHAR_TREBLE_CLEF 468 +#define CHAR_UMBRELLA 469 +#define CHAR_SNOWMAN 470 +#define CHAR_SMILEY 471 +#define CHAR_LAUGHING 472 +#define CHAR_ANGUISH 473 +#define CHAR_ANGRY 474 +#define CHAR_UP_ARROW 475 +#define CHAR_DOWN_ARROW 476 +#define CHAR_SNORING 477 +#define CHAR_SPACE 478 #define CHAR_NARROW_SPACE 482 diff --git a/include/naming_screen.h b/include/naming_screen.h index f20fa3bfbd..0a0aa0f064 100644 --- a/include/naming_screen.h +++ b/include/naming_screen.h @@ -10,20 +10,20 @@ extern const OVY_MGR_TEMPLATE gOverlayTemplate_NamingScreen; typedef struct NamingScreenArgs { NameScreenType kind; - int playerGender; // monSpecies + int playerGenderOrMonSpecies; // monSpecies int monForm; int maxLen; int monGender; - int unk14; + BOOL needsHandling; String *nameInputString; - u16 unk1C[20]; - int unk44; - PCStorage *unk48; + u16 nameInputFlat[20]; + int battleMsgId; + PCStorage *pcStorage; Options *options; - BOOL *unk50; + BOOL *pMenuInputState; } NamingScreenArgs; -NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, NameScreenType kind, int param, int maxLen, Options *options, int *a5); +NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, NameScreenType kind, int param, int maxLen, Options *options, BOOL *pMenuInputState); void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs); #endif // POKEHEARTGOLD_NAMING_SCREEN_H diff --git a/src/launch_application.c b/src/launch_application.c index a4117cb193..126ec8ef01 100644 --- a/src/launch_application.c +++ b/src/launch_application.c @@ -1047,21 +1047,21 @@ static BOOL Task_NamingScreen(TaskManager *taskman) { NamingScreenArgs *args = data->args; if (args->kind == 1) { if (String_Compare(args->nameInputString, data->unk10) == 0) { - data->args->unk14 = 1; + data->args->needsHandling = 1; } } else if (args->kind == 5) { u16 *var2 = String_cstr(args->nameInputString); SAV_FRIEND_GRP *friendGroup = Save_FriendGroup_Get(fieldSystem->saveData); if (sub_0202C88C(friendGroup, var2)) { - data->args->unk14 = 2; + data->args->needsHandling = 2; } } - if (data->args->unk14 == 0) { + if (data->args->needsHandling == 0) { SetName(taskman); } u16 *retVar = data->retVar; if (data->retVar != NULL) { - *retVar = data->args->unk14; + *retVar = data->args->needsHandling; } NamingScreen_DeleteArgs(data->args); String_Delete(data->unk10); @@ -1077,7 +1077,7 @@ static void SetName(TaskManager *taskman) { switch (data->args->kind) { case NAME_SCREEN_PLAYER: PlayerProfile *profile = Save_PlayerData_GetProfileAddr(fieldSystem->saveData); - Save_Profile_PlayerName_Set(profile, data->args->unk1C); + Save_Profile_PlayerName_Set(profile, data->args->nameInputFlat); break; case NAME_SCREEN_RIVAL: SAVE_MISC_DATA *miscData = Save_Misc_Get(fieldSystem->saveData); @@ -1091,7 +1091,7 @@ static void SetName(TaskManager *taskman) { } else { mon = Party_GetMonByIndex(SaveArray_Party_Get(fieldSystem->saveData), data->partyIdx); } - SetMonData(mon, MON_DATA_NICKNAME_FLAT_COMPARE, data->args->unk1C); + SetMonData(mon, MON_DATA_NICKNAME_FLAT_COMPARE, data->args->nameInputFlat); break; case NAME_SCREEN_GROUP: SAV_FRIEND_GRP *friendGroup = Save_FriendGroup_Get(fieldSystem->saveData); diff --git a/src/naming_screen.c b/src/naming_screen.c index a78bd83bce..896ba8fb16 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -32,14 +32,29 @@ #include "unk_020183F0.h" #include "vram_transfer_manager.h" +enum { + NAME_SCREEN_BUTTON_D001 = 0xD001, + NAME_SCREEN_BUTTON_D002 = 0xD002, + NAME_SCREEN_BUTTON_D003 = 0xD003, + NAME_SCREEN_BUTTON_D004 = 0xD004, + NAME_SCREEN_BUTTON_E001 = 0xE001, + NAME_SCREEN_BUTTON_PAGE_UPPER = 0xE002, + NAME_SCREEN_BUTTON_PAGE_LOWER = 0xE003, + NAME_SCREEN_BUTTON_PAGE_SYMBOLS = 0xE004, + NAME_SCREEN_BUTTON_PAGE_JP_UNUSED = 0xE005, + NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2 = 0xE006, + NAME_SCREEN_BUTTON_E007 = 0xE007, + NAME_SCREEN_BUTTON_E008 = 0xE008, +}; + typedef struct NamingScreenAppData { NameScreenType type; - int unk_004; - int unk_008; + int playerGenderOrMonSpecies; + int monForm; int maxLen; - int unk_010; + int monGender; int unk_014; - Options *unk_018; + Options *options; int cursorX; int cursorY; int unk_024; @@ -48,115 +63,116 @@ typedef struct NamingScreenAppData { int unk_030; int unk_034; u16 unk_038; - u16 unk_03A[6][13]; + u16 keyboard[6][13]; u8 filler_0D6[2]; - u16 unk_0D8[0x20]; + u16 entryBuf[0x20]; u16 unk_118[0x20]; - u16 unk_158; + u16 textCursorPos; u16 unk_15A[3]; - BgConfig *bgConfig; // 0x160 - u8 filler_164[4]; + BgConfig *bgConfig; // 0x160 + BOOL unk_164; // unused MessageFormat *msgFormat; // 0x168 MsgData *msgData_249; // 0x16C MsgData *msgData_254; // 0x170 MsgData *msgData_197; // 0x174 - String *unk_178; - String *unk_17C; - String *unk_180; + String *promptString; + String *unkJapaneseString; + String *battleMsgString; String *unk_184; - SpriteList *unk_188; - GF_G2dRenderer unk_18C; - GF_2DGfxResMan *unk_2B4[4]; - GF_2DGfxResObj *unk_2C4[2][4]; - SpriteResourcesHeader unk_2E4; - SpriteResourcesHeader unk_308; - Sprite *unk_32C[14]; - Sprite *unk_364[12]; - Sprite *unk_394[2]; - SysTask *unk_39C[7]; - Window unk_3B8[10]; + SpriteList *spriteList; + GF_G2dRenderer g2dRender; + GF_2DGfxResMan *gfxResMen[4]; + GF_2DGfxResObj *gfxResObjs[2][4]; + SpriteResourcesHeader spriteResHdr_Main; + SpriteResourcesHeader spriteResHdr_Sub; + Sprite *sprites1[14]; + Sprite *textEntrySprites[12]; + Sprite *sprites3[2]; + SysTask *tasks[7]; + Window windows[10]; int unk_458; int unk_45C; - int unk_460; + int pageNum; GFBgLayer unk_464; - VecFx32 unk_468[2]; - u8 filler_480[4]; - int unk_484; - int unk_488; - int unk_48C; - int unk_490[7]; + VecFx32 bgPosVecs[2]; + int unk_480; // unused + int unk_484; // set but never used + int unk_488; // set but never used + int unk_48C; // set but never used + int spriteStates[7]; void *unk_4AC; - NNSG2dCharacterData *unk_4B0; + NNSG2dCharacterData *charData; void *unk_4B4; - NNSG2dCharacterData *unk_4B8; + NNSG2dCharacterData *monIconCharData; void *unk_4BC; - NNSG2dPaletteData *unk_4C0; - u8 unk_4C4[0x100]; + NNSG2dPaletteData *plttData; + u8 charBuf[0x100]; UnkStruct_020163E0 *unk_5C4; - BOOL unk_5C8; - int unk_5CC; - BOOL *unk_5D0; + BOOL isTouchInput; + int delayCounter; + BOOL *pMenuInputState; } NamingScreenAppData; // size: 0x5D4 typedef struct UnkStruct_02102278 { u8 x; u8 y; - u16 unk_2_0 : 2; - u8 unk_4_0 : 5; - u8 unk_4_5 : 5; -} UnkStruct_02102278; + u16 sizeParam : 2; + u8 cursorX : 5; + u8 cursorY : 5; +} NamingScreenTouchHitboxDef; BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); -static void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); +static void NamingScreen_LoadMonIcon(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState); static int sub_02082CF8(NamingScreenAppData *data, int a1); static void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args); static BOOL sub_02082EC0(const u16 *s); BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState); -static void sub_02083140(void *param); +static void NamingScreen_VBlankCB(void *param); static BOOL sub_02082EC0(const u16 *s); -static void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args); -static void sub_02083184(void); -static void sub_020831A4(BgConfig *bgConfig); -static void sub_020832E4(GFPlaneToggle enable); -static void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +static void NamingScreen_InitFromArgs(NamingScreenAppData *data, NamingScreenArgs *args); +static void NamingScreen_SetGraphicsBanks(void); +static void NamingScreen_SetBgModesAndInitBuffers(BgConfig *bgConfig); +static void NamingScreen_ToggleGfxPlanes(GFPlaneToggle enable); +static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, OVY_MANAGER *ovyMan); static void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan); -static void sub_02083614(BgConfig *bgConfig, Window *a1); -static void sub_02083654(NamingScreenAppData *data, NARC *narc); -static void sub_0208377C(void); -static void sub_020837AC(NamingScreenAppData *data, NARC *narc); +static void NamingScreen_UnloadBgGfx(BgConfig *bgConfig, Window *windows); +static void NamingScreen_CreateBgConfigAndLoadGfx(NamingScreenAppData *data, NARC *narc); +static void NamingScreen_InitObjCharPlttTransfer(void); +static void NamingScreen_LoadObjGfx(NamingScreenAppData *data, NARC *narc); static void sub_020839B8(SysTask *task, void *taskData); -static void sub_020839EC(NamingScreenAppData *data); +static void NamingScreen_CreateSprites(NamingScreenAppData *data); static void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate); static void sub_02083CAC(SysTask *task, void *taskData); static void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData); static void sub_02083F18(Window *window, NameScreenType unused, String *msg); static void sub_02083F48(Window *window, NameScreenType unused, String *msg); -static void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); +static void NamingScreen_InitWindows(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); static void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); static void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId); static int sub_02084264(int val, int lo, int hi); -static void sub_02084274(NamingScreenAppData *data, int a1); +static void sub_02084274(NamingScreenAppData *data, int dpadMovement); static void sub_0208432C(NamingScreenAppData *data); -static void sub_02084430(NamingScreenAppData *data, int a1); +static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, int dpadMovement); static void sub_02084500(u16 *a0); static void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels); -static void *sub_02084640(Window *window, String *string, FontID fontId, u32 color); -static void sub_02084664(Window *windows, const u16 *a1, void *a2, String *a3); -static void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String *a5); -static void sub_02084830(u16 (*a0)[13], const int a1); -static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2); -static void sub_02084C58(NamingScreenAppData *data, BOOL a1); +static void *NamingScreen_PrintStringOnWindow_GetPixelBuffer(Window *window, String *string, FontID fontId, u32 color); +static void NamingScreen_PrintCharacterOnWindowAndOBJ(Window *windows, const u16 *tmpBuf, void *charBuf, String *string); +static void NamingScreen_PrintLastCharacterOfEntryBuf(Window *window, u16 *entryBuf, u16 cursorPos, u16 *tmpBuf, void *charBuf, String *string); +static void NamingScreen_LoadKeyboardLayout(u16 (*a0)[13], const int a1); +static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput); +static void NamingScreen_UpdateFieldMenuInputState(NamingScreenAppData *data, BOOL toggle); static int sub_02084C78(const u16 *a0, int a1); static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3); static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5); -static void sub_02084E18(Sprite **sprites, int a1, int maxLen); +static void sub_02084E18(Sprite **sprites, int cursorPos, int maxLen); static void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); -static void sub_02084F3C(int *a0, Sprite **a1, int a2); -static void sub_02084FCC(NamingScreenAppData *data); -static BOOL sub_0208503C(NamingScreenAppData *data); +static void sub_02084F3C(int *spriteStates, Sprite **sprites, int pageNum); +static void NamingScreen_PlaceCursorSprite(NamingScreenAppData *data); +static BOOL NamingScreen_HandleTouchInput(NamingScreenAppData *data); -static NamingScreenAppData *_021D43B0; +// set but never referenced, never cleaned up +static NamingScreenAppData *sAppData; static const int _021021E8[][4] = { { 0x04, 0x44, 0x03, 0x01 }, @@ -170,11 +186,11 @@ static const int _021021E8[][4] = { { 0x1A, 0x5B, 0x27, 0x00 }, }; -static const u16 _02101DBE[] = { 0xE002, 0xE002, 0xE003, 0xE003, 0xE004, 0xE004, 0xD004, 0xD004, 0xE007, 0xE007, 0xE007, 0xE008, 0xE008 }; +static const u16 _02101DBE[] = { NAME_SCREEN_BUTTON_PAGE_UPPER, NAME_SCREEN_BUTTON_PAGE_UPPER, NAME_SCREEN_BUTTON_PAGE_LOWER, NAME_SCREEN_BUTTON_PAGE_LOWER, NAME_SCREEN_BUTTON_PAGE_SYMBOLS, NAME_SCREEN_BUTTON_PAGE_SYMBOLS, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E008, NAME_SCREEN_BUTTON_E008 }; -static const u16 _02101DD8[] = { 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xD004, 0xE007, 0xE007, 0xE007, 0xE008, 0xE008 }; +static const u16 _02101DD8[] = { NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E008, NAME_SCREEN_BUTTON_E008 }; -static const u16 *_021104E4[] = { +static const u16 *sKeyboardHomeRowLayoutPtrs[] = { _02101DBE, _02101DBE, _02101DBE, @@ -203,143 +219,143 @@ static const u8 _02101D4C[] = { 0x29, }; -static const u16 _02101E80[] = { 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x01DE, 0x01AD, 0x01AE, 0xFFFF }; +static const u16 sKeyboardRow_Upper_1[] = { CHAR_A, CHAR_B, CHAR_C, CHAR_D, CHAR_E, CHAR_F, CHAR_G, CHAR_H, CHAR_I, CHAR_J, CHAR_SPACE, CHAR_COMMA, CHAR_PERIOD, EOS }; -static const u16 _02101E9C[] = { 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x01DE, 0x01B3, 0x01BE, 0xFFFF }; +static const u16 sKeyboardRow_Upper_2[] = { CHAR_K, CHAR_L, CHAR_M, CHAR_N, CHAR_O, CHAR_P, CHAR_Q, CHAR_R, CHAR_S, CHAR_T, CHAR_SPACE, CHAR_RAPOST, CHAR_HYPHEN, EOS }; -static const u16 _02101EB8[] = { 0x013F, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF }; +static const u16 sKeyboardRow_Upper_3[] = { CHAR_U, CHAR_V, CHAR_W, CHAR_X, CHAR_Y, CHAR_Z, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_MALE, CHAR_FEMALE, EOS }; -static const u16 _02101E2C[] = { 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF }; +static const u16 sKeyboardRow_Upper_4[] = { CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, EOS }; -static const u16 _02101E64[] = { 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x01DE, 0x01DE, 0x01DE, 0xFFFF }; +static const u16 sKeyboardRow_Upper_5[] = { CHAR_0, CHAR_1, CHAR_2, CHAR_3, CHAR_4, CHAR_5, CHAR_6, CHAR_7, CHAR_8, CHAR_9, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, EOS }; -static const u16 _02101EF0[] = { 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x01DE, 0x01AD, 0x01AE, 0xFFFF }; +static const u16 sKeyboardRow_Lower_1[] = { CHAR_a, CHAR_b, CHAR_c, CHAR_d, CHAR_e, CHAR_f, CHAR_g, CHAR_h, CHAR_i, CHAR_j, CHAR_SPACE, CHAR_COMMA, CHAR_PERIOD, EOS }; -static const u16 _02101F0C[] = { 0x014F, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x01DE, 0x01B3, 0x01BE, 0xFFFF }; +static const u16 sKeyboardRow_Lower_2[] = { CHAR_k, CHAR_l, CHAR_m, CHAR_n, CHAR_o, CHAR_p, CHAR_q, CHAR_r, CHAR_s, CHAR_t, CHAR_SPACE, CHAR_RAPOST, CHAR_HYPHEN, EOS }; -static const u16 _0210205C[] = { 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF }; +static const u16 sKeyboardRow_Lower_3[] = { CHAR_u, CHAR_v, CHAR_w, CHAR_x, CHAR_y, CHAR_z, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_MALE, CHAR_FEMALE, EOS }; -static const u16 _02101F60[] = { 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF }; +static const u16 sKeyboardRow_Lower_4[] = { CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, EOS }; -static const u16 _02102024[] = { 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x01DE, 0x01DE, 0x01DE, 0xFFFF }; +static const u16 sKeyboardRow_Lower_5[] = { CHAR_0, CHAR_1, CHAR_2, CHAR_3, CHAR_4, CHAR_5, CHAR_6, CHAR_7, CHAR_8, CHAR_9, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, EOS }; -static const u16 _02101F98[] = { 0x01AD, 0x01AE, 0x01C4, 0x01C5, 0x01AB, 0x01AC, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0x01DE, 0x01DE, 0xFFFF }; +static const u16 sKeyboardRow_Symbols_1[] = { CHAR_COMMA, CHAR_PERIOD, CHAR_COLON, CHAR_SEMICOLON, CHAR_EXCL, CHAR_QMARK, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_MALE, CHAR_FEMALE, CHAR_SPACE, CHAR_SPACE, EOS }; -static const u16 _02101FD0[] = { 0x01B4, 0x01B5, 0x01B2, 0x01B3, 0x01B9, 0x01BA, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF }; +static const u16 sKeyboardRow_Symbols_2[] = { CHAR_LDQUOT, CHAR_RDQUOT, CHAR_LAPOST, CHAR_RAPOST, CHAR_LPAREN, CHAR_RPAREN, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, EOS }; -static const u16 _02101FEC[] = { 0x01AF, 0x01B0, 0x01C3, 0x01D0, 0x01C0, 0x01D2, 0x01BD, 0x01BE, 0x01BF, 0x01B1, 0x01C1, 0x01DE, 0x01DE, 0xFFFF }; +static const u16 sKeyboardRow_Symbols_3[] = { CHAR_ELLIPSIS, CHAR_CTRDOT, CHAR_TILDE, CHAR_AT, CHAR_HASH, CHAR_PERCENT, CHAR_PLUS, CHAR_HYPHEN, CHAR_ASTERISK, CHAR_SLASH, CHAR_EQUALS, CHAR_SPACE, CHAR_SPACE, EOS }; -static const u16 _02102008[] = { 0x01CB, 0x01CC, 0x01CD, 0x01CE, 0x01CF, 0x01C6, 0x01C8, 0x01C9, 0x01C7, 0x01CA, 0x01D1, 0x01DE, 0x01DE, 0xFFFF }; +static const u16 sKeyboardRow_Symbols_4[] = { CHAR_CIRCLE_DOT, CHAR_CIRCLE, CHAR_SQUARE, CHAR_TRIANGLE, CHAR_DIAMOND, CHAR_SPADE_SUIT, CHAR_HEART_SUIT, CHAR_DIAMOND_SUIT, CHAR_CLUB_SUIT, CHAR_STAR, CHAR_MUSIC_NOTE, CHAR_SPACE, CHAR_SPACE, EOS }; -static const u16 _02102040[] = { 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA, 0x01DD, 0x01DB, 0x01DC, 0x01DE, 0x01DE, 0xFFFF }; +static const u16 sKeyboardRow_Symbols_5[] = { CHAR_SUN, CHAR_TREBLE_CLEF, CHAR_UMBRELLA, CHAR_SNOWMAN, CHAR_SMILEY, CHAR_LAUGHING, CHAR_ANGUISH, CHAR_ANGRY, CHAR_SNORING, CHAR_UP_ARROW, CHAR_DOWN_ARROW, CHAR_SPACE, CHAR_SPACE, EOS }; -static const u16 _02101F7C[] = { 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x0001, 0x00E1, 0x00E2, 0xFFFF }; +static const u16 sKeyboardRow_FullWidthEN_1[] = { 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, CHAR_JP_SPACE, 0x00E1, 0x00E2, EOS }; -static const u16 _02101DF2[] = { 0x00E3, 0x00E4, 0x00F9, 0x00F8, 0x00E5, 0x00E6, 0x00F5, 0x00F6, 0x00F7, 0x00E7, 0x0001, 0x00EE, 0x00EF, 0xFFFF }; +static const u16 sKeyboardRow_FullWidthEN_2[] = { 0x00E3, 0x00E4, 0x00F9, 0x00F8, 0x00E5, 0x00E6, 0x00F5, 0x00F6, 0x00F7, 0x00E7, CHAR_JP_SPACE, 0x00EE, 0x00EF, EOS }; -static const u16 _02101F44[] = { 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0106, 0x0104, 0xFFFF }; +static const u16 sKeyboardRow_FullWidthEN_3[] = { 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0106, 0x0104, EOS }; -static const u16 _02101F28[] = { 0x00FF, 0x0100, 0x0101, 0x0102, 0x0103, 0x00FC, 0x00FA, 0x00FD, 0x00FB, 0x00FE, 0x0105, 0x0001, 0x0001, 0xFFFF }; +static const u16 sKeyboardRow_FullWidthEN_4[] = { 0x00FF, 0x0100, 0x0101, 0x0102, 0x0103, 0x00FC, 0x00FA, 0x00FD, 0x00FB, 0x00FE, 0x0105, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; -static const u16 _02101E48[] = { 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x0111, 0x010F, 0x0110, 0x0001, 0x0001, 0xFFFF }; +static const u16 sKeyboardRow_FullWidthEN_5[] = { 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x0111, 0x010F, 0x0110, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; -static const u16 _021020D4[] = { 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF }; +static const u16 sKeyboardRow_Numpad_1[] = { 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; -static const u16 _021020F8[] = { 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF }; +static const u16 sKeyboardRow_Numpad_2[] = { 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; -static const u16 _0210211C[] = { 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF }; +static const u16 sKeyboardRow_Numpad_345[] = { CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; -static const u16 *_021104F8[][5] = { - { _02101E80, _02101E9C, _02101EB8, _02101E2C, _02101E64 }, - { _02101EF0, _02101F0C, _0210205C, _02101F60, _02102024 }, - { _02101F98, _02101FD0, _02101FEC, _02102008, _02102040 }, - { _02101F7C, _02101DF2, _02101F44, _02101F28, _02101E48 }, - { _021020D4, _021020F8, _0210211C, _0210211C, _0210211C }, +static const u16 *sKeyboardLayoutPtrs[][5] = { + { sKeyboardRow_Upper_1, sKeyboardRow_Upper_2, sKeyboardRow_Upper_3, sKeyboardRow_Upper_4, sKeyboardRow_Upper_5 }, + { sKeyboardRow_Lower_1, sKeyboardRow_Lower_2, sKeyboardRow_Lower_3, sKeyboardRow_Lower_4, sKeyboardRow_Lower_5 }, + { sKeyboardRow_Symbols_1, sKeyboardRow_Symbols_2, sKeyboardRow_Symbols_3, sKeyboardRow_Symbols_4, sKeyboardRow_Symbols_5 }, + { sKeyboardRow_FullWidthEN_1, sKeyboardRow_FullWidthEN_2, sKeyboardRow_FullWidthEN_3, sKeyboardRow_FullWidthEN_4, sKeyboardRow_FullWidthEN_5 }, + { sKeyboardRow_Numpad_1, sKeyboardRow_Numpad_2, sKeyboardRow_Numpad_345, sKeyboardRow_Numpad_345, sKeyboardRow_Numpad_345 }, }; static const u16 _02102422[][3] = { - { 0x0003, 0x0001, 0x0002 }, - { 0x0005, 0x0001, 0x0004 }, - { 0x0007, 0x0001, 0x0006 }, - { 0x0009, 0x0001, 0x0008 }, - { 0x000B, 0x0001, 0x000A }, - { 0x0053, 0x0001, 0x0052 }, - { 0x0055, 0x0001, 0x0054 }, - { 0x0057, 0x0001, 0x0056 }, - { 0x0059, 0x0001, 0x0058 }, - { 0x005B, 0x0001, 0x005A }, - { 0x0045, 0x0001, 0x0044 }, - { 0x0047, 0x0001, 0x0046 }, - { 0x0049, 0x0001, 0x0048 }, - { 0x0095, 0x0001, 0x0094 }, - { 0x0097, 0x0001, 0x0096 }, - { 0x0099, 0x0001, 0x0098 }, - { 0x00AC, 0x0001, 0x00C6 }, - { 0x00AD, 0x0001, 0x00C7 }, - { 0x00AE, 0x0001, 0x00C8 }, - { 0x00AF, 0x0001, 0x00C9 }, - { 0x00B0, 0x0001, 0x00CA }, - { 0x00B1, 0x0001, 0x00CB }, - { 0x00B2, 0x0001, 0x00CC }, - { 0x00B3, 0x0001, 0x00CD }, - { 0x00B4, 0x0001, 0x00CE }, - { 0x00B5, 0x0001, 0x00CF }, - { 0x00B6, 0x0001, 0x00D0 }, - { 0x00B7, 0x0001, 0x00D1 }, - { 0x00B8, 0x0001, 0x00D2 }, - { 0x00B9, 0x0001, 0x00D3 }, - { 0x00BA, 0x0001, 0x00D4 }, - { 0x00BB, 0x0001, 0x00D5 }, - { 0x00BC, 0x0001, 0x00D6 }, - { 0x00BD, 0x0001, 0x00D7 }, - { 0x00BE, 0x0001, 0x00D8 }, - { 0x00BF, 0x0001, 0x00D9 }, - { 0x00C0, 0x0001, 0x00DA }, - { 0x00C1, 0x0001, 0x00DB }, - { 0x00C2, 0x0001, 0x00DC }, - { 0x00C3, 0x0001, 0x00DD }, - { 0x00C4, 0x0001, 0x00DE }, - { 0x00C5, 0x0001, 0x00DF }, - { 0x0025, 0x0026, 0x0024 }, - { 0x0075, 0x0076, 0x0074 }, - { 0x000C, 0x000D, 0x0001 }, - { 0x000E, 0x000F, 0x0001 }, - { 0x0010, 0x0011, 0x0001 }, - { 0x0012, 0x0013, 0x0001 }, - { 0x0014, 0x0015, 0x0001 }, - { 0x0016, 0x0017, 0x0001 }, - { 0x0018, 0x0019, 0x0001 }, - { 0x001A, 0x001B, 0x0001 }, - { 0x001C, 0x001D, 0x0001 }, - { 0x001E, 0x001F, 0x0001 }, - { 0x0020, 0x0021, 0x0001 }, - { 0x0022, 0x0023, 0x0001 }, - { 0x0027, 0x0028, 0x0001 }, - { 0x0029, 0x002A, 0x0001 }, - { 0x005C, 0x005D, 0x0001 }, - { 0x005E, 0x005F, 0x0001 }, - { 0x0060, 0x0061, 0x0001 }, - { 0x0062, 0x0063, 0x0001 }, - { 0x0064, 0x0065, 0x0001 }, - { 0x0066, 0x0067, 0x0001 }, - { 0x0068, 0x0069, 0x0001 }, - { 0x006A, 0x006B, 0x0001 }, - { 0x006C, 0x006D, 0x0001 }, - { 0x006E, 0x006F, 0x0001 }, - { 0x0070, 0x0071, 0x0001 }, - { 0x0072, 0x0073, 0x0001 }, - { 0x0077, 0x0078, 0x0001 }, - { 0x0079, 0x007A, 0x0001 }, - { 0x0030, 0x0031, 0x0032 }, - { 0x0033, 0x0034, 0x0035 }, - { 0x0036, 0x0037, 0x0038 }, - { 0x0039, 0x003A, 0x003B }, - { 0x003C, 0x003D, 0x003E }, - { 0x0080, 0x0081, 0x0082 }, - { 0x0083, 0x0084, 0x0085 }, - { 0x0086, 0x0087, 0x0088 }, - { 0x0089, 0x008A, 0x008B }, - { 0x008C, 0x008D, 0x008E }, + { 0x0003, CHAR_JP_SPACE, 0x0002 }, + { 0x0005, CHAR_JP_SPACE, 0x0004 }, + { 0x0007, CHAR_JP_SPACE, 0x0006 }, + { 0x0009, CHAR_JP_SPACE, 0x0008 }, + { 0x000B, CHAR_JP_SPACE, 0x000A }, + { 0x0053, CHAR_JP_SPACE, 0x0052 }, + { 0x0055, CHAR_JP_SPACE, 0x0054 }, + { 0x0057, CHAR_JP_SPACE, 0x0056 }, + { 0x0059, CHAR_JP_SPACE, 0x0058 }, + { 0x005B, CHAR_JP_SPACE, 0x005A }, + { 0x0045, CHAR_JP_SPACE, 0x0044 }, + { 0x0047, CHAR_JP_SPACE, 0x0046 }, + { 0x0049, CHAR_JP_SPACE, 0x0048 }, + { 0x0095, CHAR_JP_SPACE, 0x0094 }, + { 0x0097, CHAR_JP_SPACE, 0x0096 }, + { 0x0099, CHAR_JP_SPACE, 0x0098 }, + { 0x00AC, CHAR_JP_SPACE, 0x00C6 }, + { 0x00AD, CHAR_JP_SPACE, 0x00C7 }, + { 0x00AE, CHAR_JP_SPACE, 0x00C8 }, + { 0x00AF, CHAR_JP_SPACE, 0x00C9 }, + { 0x00B0, CHAR_JP_SPACE, 0x00CA }, + { 0x00B1, CHAR_JP_SPACE, 0x00CB }, + { 0x00B2, CHAR_JP_SPACE, 0x00CC }, + { 0x00B3, CHAR_JP_SPACE, 0x00CD }, + { 0x00B4, CHAR_JP_SPACE, 0x00CE }, + { 0x00B5, CHAR_JP_SPACE, 0x00CF }, + { 0x00B6, CHAR_JP_SPACE, 0x00D0 }, + { 0x00B7, CHAR_JP_SPACE, 0x00D1 }, + { 0x00B8, CHAR_JP_SPACE, 0x00D2 }, + { 0x00B9, CHAR_JP_SPACE, 0x00D3 }, + { 0x00BA, CHAR_JP_SPACE, 0x00D4 }, + { 0x00BB, CHAR_JP_SPACE, 0x00D5 }, + { 0x00BC, CHAR_JP_SPACE, 0x00D6 }, + { 0x00BD, CHAR_JP_SPACE, 0x00D7 }, + { 0x00BE, CHAR_JP_SPACE, 0x00D8 }, + { 0x00BF, CHAR_JP_SPACE, 0x00D9 }, + { 0x00C0, CHAR_JP_SPACE, 0x00DA }, + { 0x00C1, CHAR_JP_SPACE, 0x00DB }, + { 0x00C2, CHAR_JP_SPACE, 0x00DC }, + { 0x00C3, CHAR_JP_SPACE, 0x00DD }, + { 0x00C4, CHAR_JP_SPACE, 0x00DE }, + { 0x00C5, CHAR_JP_SPACE, 0x00DF }, + { 0x0025, 0x0026, 0x0024 }, + { 0x0075, 0x0076, 0x0074 }, + { 0x000C, 0x000D, CHAR_JP_SPACE }, + { 0x000E, 0x000F, CHAR_JP_SPACE }, + { 0x0010, 0x0011, CHAR_JP_SPACE }, + { 0x0012, 0x0013, CHAR_JP_SPACE }, + { 0x0014, 0x0015, CHAR_JP_SPACE }, + { 0x0016, 0x0017, CHAR_JP_SPACE }, + { 0x0018, 0x0019, CHAR_JP_SPACE }, + { 0x001A, 0x001B, CHAR_JP_SPACE }, + { 0x001C, 0x001D, CHAR_JP_SPACE }, + { 0x001E, 0x001F, CHAR_JP_SPACE }, + { 0x0020, 0x0021, CHAR_JP_SPACE }, + { 0x0022, 0x0023, CHAR_JP_SPACE }, + { 0x0027, 0x0028, CHAR_JP_SPACE }, + { 0x0029, 0x002A, CHAR_JP_SPACE }, + { 0x005C, 0x005D, CHAR_JP_SPACE }, + { 0x005E, 0x005F, CHAR_JP_SPACE }, + { 0x0060, 0x0061, CHAR_JP_SPACE }, + { 0x0062, 0x0063, CHAR_JP_SPACE }, + { 0x0064, 0x0065, CHAR_JP_SPACE }, + { 0x0066, 0x0067, CHAR_JP_SPACE }, + { 0x0068, 0x0069, CHAR_JP_SPACE }, + { 0x006A, 0x006B, CHAR_JP_SPACE }, + { 0x006C, 0x006D, CHAR_JP_SPACE }, + { 0x006E, 0x006F, CHAR_JP_SPACE }, + { 0x0070, 0x0071, CHAR_JP_SPACE }, + { 0x0072, 0x0073, CHAR_JP_SPACE }, + { 0x0077, 0x0078, CHAR_JP_SPACE }, + { 0x0079, 0x007A, CHAR_JP_SPACE }, + { 0x0030, 0x0031, 0x0032 }, + { 0x0033, 0x0034, 0x0035 }, + { 0x0036, 0x0037, 0x0038 }, + { 0x0039, 0x003A, 0x003B }, + { 0x003C, 0x003D, 0x003E }, + { 0x0080, 0x0081, 0x0082 }, + { 0x0083, 0x0084, 0x0085 }, + { 0x0086, 0x0087, 0x0088 }, + { 0x0089, 0x008A, 0x008B }, + { 0x008C, 0x008D, 0x008E }, }; static const u16 _021021B8[][2] = { @@ -383,12 +399,12 @@ static const u8 _02101D40[] = { 0x0A, }; -const u16 _02101D90[] = { 0x0003, 0x002B, 0x0020, 0x002F, 0x0001, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, 0xFFFF }; +const u16 _02101D90[] = { 0x0003, 0x002B, 0x0020, 0x002F, CHAR_JP_SPACE, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, EOS }; // ポケモンの ニックネ-ムは? -const u16 _02102094[] = { 0x008E, 0x0062, 0x0093, 0x00A1, 0x002F, 0x0001, 0x007C, 0x0074, 0x0060, 0x007E, 0x00F1, 0x0091, 0x0030, 0x00E2, 0xFFFF }; +const u16 _02102094[] = { 0x008E, 0x0062, 0x0093, 0x00A1, 0x002F, CHAR_JP_SPACE, 0x007C, 0x0074, 0x0060, 0x007E, 0x00F1, 0x0091, 0x0030, 0x00E2, EOS }; -const u16 _02101DA6[] = { 0x008D, 0x0074, 0x0060, 0x006A, 0x002F, 0x0001, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, 0xFFFF }; +const u16 _02101DA6[] = { 0x008D, 0x0074, 0x0060, 0x006A, 0x002F, CHAR_JP_SPACE, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, EOS }; static const u16 *sDeadstrippedPointersTable[] = { _02101D90, @@ -397,14 +413,14 @@ static const u16 *sDeadstrippedPointersTable[] = { }; static const int _021020B4[] = { - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 8, + msg_0249_00000, + msg_0249_00001, + msg_0249_00002, + msg_0249_00003, + msg_0249_00004, + msg_0249_00005, + msg_0249_00006, + msg_0249_00008, }; const OVY_MGR_TEMPLATE gOverlayTemplate_NamingScreen = { @@ -436,22 +452,22 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { data->msgData_254 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0254_bin, HEAP_ID_NAMING_SCREEN); data->msgData_197 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0197_bin, HEAP_ID_NAMING_SCREEN); SetKeyRepeatTimers(4, 8); - sub_02083184(); - sub_020831A4(data->bgConfig); - sub_02083160(data, OverlayManager_GetArgs(ovyMan)); - sub_02083654(data, narc); + NamingScreen_SetGraphicsBanks(); + NamingScreen_SetBgModesAndInitBuffers(data->bgConfig); + NamingScreen_InitFromArgs(data, OverlayManager_GetArgs(ovyMan)); + NamingScreen_CreateBgConfigAndLoadGfx(data, narc); FontID_Alloc(2, HEAP_ID_NAMING_SCREEN); - Main_SetVBlankIntrCB(sub_02083140, NULL); - sub_02083334(data, ovyMan); + Main_SetVBlankIntrCB(NamingScreen_VBlankCB, NULL); + NamingScreen_InitKeyboardAndEntryCursors(data, ovyMan); FontID_SetAccessDirect(0, HEAP_ID_NAMING_SCREEN); - sub_0208377C(); - sub_020837AC(data, narc); - sub_020839EC(data); - sub_02083F9C(data, ovyMan, narc); - sub_02084740(&data->unk_3B8[4], data->unk_0D8, data->unk_158, data->unk_15A, data->unk_4C4, data->unk_17C); - sub_02004EC4(0x34, 0, 0); + NamingScreen_InitObjCharPlttTransfer(); + NamingScreen_LoadObjGfx(data, narc); + NamingScreen_CreateSprites(data); + NamingScreen_InitWindows(data, ovyMan, narc); + NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->unk_15A, data->charBuf, data->unkJapaneseString); + sub_02004EC4(0x34, 0, 0); // sound-related BeginNormalPaletteFade(0, 1, 1, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); - sub_020832E4(GF_PLANE_TOGGLE_ON); + NamingScreen_ToggleGfxPlanes(GF_PLANE_TOGGLE_ON); GfGfx_SetMainDisplay(PM_LCD_BOTTOM); NARC_Delete(narc); ++(*pState); @@ -459,9 +475,9 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { case 1: data = OverlayManager_GetData(ovyMan); if (data->type == NAME_SCREEN_POKEMON) { - sub_02082AEC(data->unk_4B8, data->unk_4C0, data->unk_004, data->unk_008); + NamingScreen_LoadMonIcon(data->monIconCharData, data->plttData, data->playerGenderOrMonSpecies, data->monForm); } - _021D43B0 = data; + sAppData = data; data->unk_5C4 = sub_020163E0(NULL, PM_LCD_BOTTOM, 12, HEAP_ID_NAMING_SCREEN); *pState = 0; return TRUE; @@ -470,7 +486,7 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { return FALSE; } -static void sub_02082AEC(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form) { +static void NamingScreen_LoadMonIcon(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form) { GX_LoadOBJ(pCharData->pRawData, 0x57E0, 0x200); const u16 *rawPltt = pPlttData->pRawData; u32 plttNo = GetMonIconPaletteEx(species, form, FALSE); @@ -483,17 +499,17 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { switch (*pState) { case 0: if (IsPaletteFadeFinished()) { - *pState = 1; - data->unk_5CC = 0; + *pState = 1; + data->delayCounter = 0; } break; case 1: - ++data->unk_5CC; - sub_02084FCC(data); - sub_02084F3C(data->unk_490, data->unk_32C, data->unk_460); - if (data->unk_5CC > 5) { - *pState = 2; - data->unk_5CC = 0; + ++data->delayCounter; + NamingScreen_PlaceCursorSprite(data); + sub_02084F3C(data->spriteStates, data->sprites1, data->pageNum); + if (data->delayCounter > 5) { + *pState = 2; + data->delayCounter = 0; } break; case 2: @@ -507,34 +523,34 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { if (data->unk_034 == 0) { *pState = sub_02082CF8(data, *pState); } - sub_02084FCC(data); + NamingScreen_PlaceCursorSprite(data); break; case 5: sub_020834FC(data, ovyMan); - FillWindowPixelBuffer(&data->unk_3B8[9], 15); - DrawFrameAndWindow2(&data->unk_3B8[9], FALSE, 256, 10); - data->unk_458 = AddTextPrinterParameterized(&data->unk_3B8[9], 1, data->unk_180, 0, 0, 1, NULL); - CopyWindowToVram(&data->unk_3B8[9]); + FillWindowPixelBuffer(&data->windows[9], 15); + DrawFrameAndWindow2(&data->windows[9], FALSE, 256, 10); + data->unk_458 = AddTextPrinterParameterized(&data->windows[9], 1, data->battleMsgString, 0, 0, 1, NULL); + CopyWindowToVram(&data->windows[9]); data->unk_45C = 6; break; case 6: if (!TextPrinterCheckActive(data->unk_458)) { PlaySE(SEQ_SE_DP_PIRORIRO); - ++data->unk_490[6]; - data->unk_5CC = 0; - data->unk_45C = 7; + ++data->spriteStates[6]; + data->delayCounter = 0; + data->unk_45C = 7; } break; case 7: - ++data->unk_5CC; - if (data->unk_5CC > 30) { + ++data->delayCounter; + if (data->delayCounter > 30) { BeginNormalPaletteFade(2, 0, 0, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); *pState = 3; } break; } - sub_02083D34(data->bgConfig, data->unk_3B8, &data->unk_45C, data->unk_460, &data->unk_464, data->unk_468, data->unk_32C, data->unk_4B0->pRawData); - sub_02084F3C(data->unk_490, data->unk_32C, data->unk_460); + sub_02083D34(data->bgConfig, data->windows, &data->unk_45C, data->pageNum, &data->unk_464, data->bgPosVecs, data->sprites1, data->charData->pRawData); + sub_02084F3C(data->spriteStates, data->sprites1, data->pageNum); sub_02084500(&data->unk_038); break; case 3: @@ -544,7 +560,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { break; } - SpriteList_RenderAndAnimateSprites(data->unk_188); + SpriteList_RenderAndAnimateSprites(data->spriteList); return FALSE; } @@ -553,33 +569,33 @@ static int sub_02082CF8(NamingScreenAppData *data, int a1) { sub_0208432C(data); if (gSystem.newKeys & PAD_BUTTON_SELECT) { - if (!Sprite_GetVisibleFlag(data->unk_32C[8])) { - Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); + if (!Sprite_GetVisibleFlag(data->sprites1[8])) { + Sprite_SetVisibleFlag(data->sprites1[8], TRUE); return ret; } if (data->type != 4) { data->unk_45C = 0; - ++data->unk_460; - if (data->unk_460 >= 3) { - data->unk_460 = 0; + ++data->pageNum; + if (data->pageNum >= 3) { + data->pageNum = 0; } - ++data->unk_490[data->unk_460]; - sub_02084830(data->unk_03A, data->unk_460); + ++data->spriteStates[data->pageNum]; + NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); PlaySE(SEQ_SE_DP_SYU03); data->unk_030 = 1; } - ++data->unk_490[data->unk_460]; - sub_02084830(data->unk_03A, data->unk_460); + ++data->spriteStates[data->pageNum]; + NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); PlaySE(SEQ_SE_DP_SYU03); } else if (gSystem.newKeys & PAD_BUTTON_A) { - ret = sub_02084884(data, data->unk_03A[data->cursorY][data->cursorX], TRUE); + ret = sub_02084884(data, data->keyboard[data->cursorY][data->cursorX], TRUE); data->unk_030 = 1; - } else if (data->unk_5C8 == TRUE) { - ret = sub_02084884(data, data->unk_03A[data->cursorY][data->cursorX], FALSE); + } else if (data->isTouchInput == TRUE) { + ret = sub_02084884(data, data->keyboard[data->cursorY][data->cursorX], FALSE); } else if (gSystem.newKeys & PAD_BUTTON_B) { - ret = sub_02084884(data, 0xE007, TRUE); + ret = sub_02084884(data, NAME_SCREEN_BUTTON_E007, TRUE); } else if (gSystem.newKeys & PAD_BUTTON_R) { - ret = sub_02084884(data, 0xE006, TRUE); + ret = sub_02084884(data, NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2, TRUE); } return ret; } @@ -598,22 +614,22 @@ static void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args) { String *string; if (data->type == NAME_SCREEN_PLAYER) { - if (data->unk_004 == PLAYER_GENDER_MALE) { + if (data->playerGenderOrMonSpecies == PLAYER_GENDER_MALE) { string = NewString_ReadMsgData(data->msgData_254, FIRST_DEFAULT_NAME_MALE + (LCRandom() % 18)); - } else if (data->unk_004 == PLAYER_GENDER_FEMALE) { + } else if (data->playerGenderOrMonSpecies == PLAYER_GENDER_FEMALE) { string = NewString_ReadMsgData(data->msgData_254, FIRST_DEFAULT_NAME_FEMALE + (LCRandom() % 18)); } // UB: Nonbinary players will not initialize string. String_Copy(args->nameInputString, string); String_Delete(string); - CopyStringToU16Array(args->nameInputString, args->unk1C, 10); + CopyStringToU16Array(args->nameInputString, args->nameInputFlat, 10); } else if (data->type == NAME_SCREEN_RIVAL) { string = NewString_ReadMsgData(data->msgData_254, FIRST_DEFAULT_NAME_RIVAL); String_Copy(args->nameInputString, string); String_Delete(string); - CopyStringToU16Array(args->nameInputString, args->unk1C, 10); + CopyStringToU16Array(args->nameInputString, args->nameInputFlat, 10); } else { - args->unk14 = 1; + args->needsHandling = TRUE; } } @@ -636,32 +652,32 @@ BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { NamingScreenAppData *data = OverlayManager_GetData(ovyMan); NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); - data->unk_0D8[data->unk_158] = EOS; + data->entryBuf[data->textCursorPos] = EOS; if (data->type == NAME_SCREEN_POKEMON) { Pokemon *mon = AllocMonZeroed(HEAP_ID_NAMING_SCREEN); - CreateMon(mon, data->unk_004, 5, 10, 10, 10, 10, 10); + CreateMon(mon, data->playerGenderOrMonSpecies, 5, 10, 10, 10, 10, 10); // wtf FreeToHeap(mon); } - if (data->unk_158 == 0 || !StringNotEqual(data->unk_0D8, data->unk_118) || sub_02082EC0(data->unk_0D8)) { + if (data->textCursorPos == 0 || !StringNotEqual(data->entryBuf, data->unk_118) || sub_02082EC0(data->entryBuf)) { sub_02082E28(data, args); } else { - CopyU16StringArray(data->unk_118, data->unk_0D8); - CopyU16StringArray(args->unk1C, data->unk_0D8); - CopyU16ArrayToString(args->nameInputString, data->unk_0D8); + CopyU16StringArray(data->unk_118, data->entryBuf); + CopyU16StringArray(args->nameInputFlat, data->entryBuf); + CopyU16ArrayToString(args->nameInputString, data->entryBuf); } String_Delete(data->unk_184); for (int i = 0; i < 7; ++i) { - DestroySysTaskAndEnvironment(data->unk_39C[i]); + DestroySysTaskAndEnvironment(data->tasks[i]); } - sub_0200AEB0(data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR]); - sub_0200AEB0(data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR]); - sub_0200B0A8(data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT]); - sub_0200B0A8(data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT]); + sub_0200AEB0(data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR]); + sub_0200AEB0(data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR]); + sub_0200B0A8(data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT]); + sub_0200B0A8(data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT]); for (int i = 0; i < 4; ++i) { - Destroy2DGfxResObjMan(data->unk_2B4[i]); + Destroy2DGfxResObjMan(data->gfxResMen[i]); } - SpriteList_Delete(data->unk_188); + SpriteList_Delete(data->spriteList); OamManager_Free(); FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->unk_4AC); if (data->type == NAME_SCREEN_POKEMON) { @@ -671,15 +687,15 @@ BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { FreeBgTilemapBuffer(data->bgConfig, GF_BG_LYR_SUB_3); ObjCharTransfer_Destroy(); ObjPlttTransfer_Destroy(); - sub_02083614(data->bgConfig, data->unk_3B8); + NamingScreen_UnloadBgGfx(data->bgConfig, data->windows); FontID_SetAccessLazy(0); GX_SetVisibleWnd(GX_WNDMASK_NONE); FontID_Release(2); - if (data->unk_180 != NULL) { - String_Delete(data->unk_180); + if (data->battleMsgString != NULL) { + String_Delete(data->battleMsgString); } - String_Delete(data->unk_178); - String_Delete(data->unk_17C); + String_Delete(data->promptString); + String_Delete(data->unkJapaneseString); DestroyMsgData(data->msgData_197); DestroyMsgData(data->msgData_254); DestroyMsgData(data->msgData_249); @@ -695,20 +711,20 @@ BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { // Public functions // ------------------------------- -NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, NameScreenType kind, int param, int maxLen, Options *options, int *a5) { - NamingScreenArgs *ret = AllocFromHeap(heapId, sizeof(NamingScreenArgs)); - ret->kind = kind; - ret->playerGender = param; - ret->maxLen = maxLen; - ret->unk14 = 0; - ret->unk1C[0] = EOS; - ret->nameInputString = String_New(32, heapId); - ret->unk44 = 0; - ret->unk48 = 0; - ret->monGender = 0; - ret->options = options; - ret->monForm = 0; - ret->unk50 = a5; +NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, NameScreenType kind, int param, int maxLen, Options *options, BOOL *pMenuInputState) { + NamingScreenArgs *ret = AllocFromHeap(heapId, sizeof(NamingScreenArgs)); + ret->kind = kind; + ret->playerGenderOrMonSpecies = param; + ret->maxLen = maxLen; + ret->needsHandling = FALSE; + ret->nameInputFlat[0] = EOS; + ret->nameInputString = String_New(32, heapId); + ret->battleMsgId = 0; + ret->pcStorage = 0; + ret->monGender = 0; + ret->options = options; + ret->monForm = 0; + ret->pMenuInputState = pMenuInputState; return ret; } @@ -723,24 +739,24 @@ void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs) { // Back to private scope // ------------------------------- -static void sub_02083140(void *param) { +static void NamingScreen_VBlankCB(void *param) { GF_RunVramTransferTasks(); OamManager_ApplyAndResetBuffers(); OS_SetIrqCheckFlag(OS_IE_V_BLANK); } -static void sub_02083160(NamingScreenAppData *data, NamingScreenArgs *args) { - data->type = args->kind; - data->unk_004 = args->playerGender; - data->unk_008 = args->monForm; - data->maxLen = args->maxLen; - data->unk_010 = args->monGender; - data->unk_018 = args->options; - data->unk_5D0 = args->unk50; +static void NamingScreen_InitFromArgs(NamingScreenAppData *data, NamingScreenArgs *args) { + data->type = args->kind; + data->playerGenderOrMonSpecies = args->playerGenderOrMonSpecies; + data->monForm = args->monForm; + data->maxLen = args->maxLen; + data->monGender = args->monGender; + data->options = args->options; + data->pMenuInputState = args->pMenuInputState; } -static void sub_02083184(void) { - static const GraphicsBanks _02102140 = { +static void NamingScreen_SetGraphicsBanks(void) { + GraphicsBanks graphicsBanks = { GX_VRAM_BG_128_A, GX_VRAM_BGEXTPLTT_NONE, GX_VRAM_SUB_BG_128_C, @@ -752,24 +768,23 @@ static void sub_02083184(void) { GX_VRAM_TEX_NONE, GX_VRAM_TEXPLTT_NONE, }; - GraphicsBanks graphicsBanks = _02102140; + ; GfGfx_SetBanks(&graphicsBanks); } -static void sub_020831A4(BgConfig *bgConfig) { +static void NamingScreen_SetBgModesAndInitBuffers(BgConfig *bgConfig) { { - static const GraphicsModes _02101D60 = { + GraphicsModes graphicsModes = { GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BGMODE_0, GX_BG0_AS_2D, }; - GraphicsModes graphicsModes = _02101D60; SetBothScreensModesAndDisable(&graphicsModes); } { - static const BgTemplate _02101ED4 = { + BgTemplate bgTemplate = { .x = 0x00000000, .y = 0x00000000, .bufferSize = GF_BG_BUF_SIZE_512x256_4BPP, @@ -783,13 +798,12 @@ static void sub_020831A4(BgConfig *bgConfig) { .areaOver = GX_BG_AREAOVER_XLU, .mosaic = 0x00000000, }; - BgTemplate bgTemplate = _02101ED4; InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_0, &bgTemplate, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_0); } { - static const BgTemplate _02101FB4 = { + BgTemplate bgTemplate = { .x = 0x00000000, .y = 0x00000000, .bufferSize = GF_BG_BUF_SIZE_512x256_4BPP, @@ -803,13 +817,12 @@ static void sub_020831A4(BgConfig *bgConfig) { .areaOver = GX_BG_AREAOVER_XLU, .mosaic = 0x00000000, }; - BgTemplate bgTemplate = _02101FB4; InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_1, &bgTemplate, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_1); } { - static const BgTemplate _02102078 = { + BgTemplate bgTemplate = { .x = 0x00000000, .y = 0x00000000, .bufferSize = GF_BG_BUF_SIZE_256x256_4BPP, @@ -823,13 +836,12 @@ static void sub_020831A4(BgConfig *bgConfig) { .areaOver = GX_BG_AREAOVER_XLU, .mosaic = 0x00000000, }; - BgTemplate bgTemplate = _02102078; InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_2, &bgTemplate, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_2); } { - static const BgTemplate _02101E10 = { + BgTemplate bgTemplate = { .x = 0x00000000, .y = 0x00000000, .bufferSize = GF_BG_BUF_SIZE_256x256_4BPP, @@ -843,12 +855,11 @@ static void sub_020831A4(BgConfig *bgConfig) { .areaOver = GX_BG_AREAOVER_XLU, .mosaic = 0x00000000, }; - BgTemplate bgTemplate = _02101E10; InitBgFromTemplate(bgConfig, GF_BG_LYR_SUB_0, &bgTemplate, GF_BG_TYPE_TEXT); BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_SUB_0); } - sub_020832E4(GF_PLANE_TOGGLE_OFF); + NamingScreen_ToggleGfxPlanes(GF_PLANE_TOGGLE_OFF); BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, HEAP_ID_NAMING_SCREEN); BG_ClearCharDataRange(GF_BG_LYR_SUB_0, 0x20, 0, HEAP_ID_NAMING_SCREEN); GX_SetVisibleWnd(GX_WNDMASK_W0); @@ -859,7 +870,7 @@ static void sub_020831A4(BgConfig *bgConfig) { G2S_BlendNone(); } -static void sub_020832E4(GFPlaneToggle enable) { +static void NamingScreen_ToggleGfxPlanes(GFPlaneToggle enable) { GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG0, enable); GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG1, enable); GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG2, enable); @@ -870,86 +881,86 @@ static void sub_020832E4(GFPlaneToggle enable) { GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_OFF); } -static void sub_02083334(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { +static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); data->unk_45C = 4; - sub_0208423C(data->unk_468, GF_BG_LYR_MAIN_0); - BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_X, data->unk_468[data->unk_464].x); - BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_Y, data->unk_468[data->unk_464].y); - BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_X, data->unk_468[data->unk_464 ^ 1].x); - BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_Y, data->unk_468[data->unk_464 ^ 1].y); + sub_0208423C(data->bgPosVecs, GF_BG_LYR_MAIN_0); + BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_X, data->bgPosVecs[data->unk_464].x); + BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_Y, data->bgPosVecs[data->unk_464].y); + BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_X, data->bgPosVecs[data->unk_464 ^ 1].x); + BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_Y, data->bgPosVecs[data->unk_464 ^ 1].y); data->unk_118[0] = EOS; if (args->nameInputString != NULL) { CopyStringToU16Array(args->nameInputString, data->unk_118, 32); } - MI_CpuFill16(data->unk_0D8, 1, sizeof(data->unk_0D8)); + MI_CpuFill16(data->entryBuf, 1, sizeof(data->entryBuf)); if (data->type == NAME_SCREEN_POKEMON) { Pokemon *mon = AllocMonZeroed(HEAP_ID_NAMING_SCREEN); - CreateMon(mon, data->unk_004, 5, 10, 10, 10, 10, 10); + CreateMon(mon, data->playerGenderOrMonSpecies, 5, 10, 10, 10, 10, 10); BufferBoxMonSpeciesName(data->msgFormat, 0, Mon_GetBoxMon(mon)); FreeToHeap(mon); } - if (args->unk44) { + if (args->battleMsgId != 0) { data->unk_014 = 1; } - data->unk_178 = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, _021020B4[data->type], HEAP_ID_NAMING_SCREEN); - data->unk_17C = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, msg_0249_00009, HEAP_ID_NAMING_SCREEN); - data->unk_184 = NewString_ReadMsgData(data->msgData_249, msg_0249_00007); - data->unk_158 = StringLength(data->unk_118); - data->cursorX = 0; - data->cursorY = 1; - data->unk_024 = -1; - data->unk_028 = -1; - data->unk_030 = 1; - data->unk_034 = 0; - data->unk_484 = -1; - data->unk_488 = 0; - data->unk_48C = 0; - data->unk_0D8[data->maxLen] = EOS; + data->promptString = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, _021020B4[data->type], HEAP_ID_NAMING_SCREEN); + data->unkJapaneseString = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, msg_0249_00009, HEAP_ID_NAMING_SCREEN); + data->unk_184 = NewString_ReadMsgData(data->msgData_249, msg_0249_00007); + data->textCursorPos = StringLength(data->unk_118); + data->cursorX = 0; + data->cursorY = 1; + data->unk_024 = -1; + data->unk_028 = -1; + data->unk_030 = 1; + data->unk_034 = 0; + data->unk_484 = -1; + data->unk_488 = 0; + data->unk_48C = 0; + data->entryBuf[data->maxLen] = EOS; for (int i = 0; i < 7; ++i) { - data->unk_490[i] = 0; + data->spriteStates[i] = 0; } if (data->type == NAME_SCREEN_UNK4) { - data->unk_490[3] = 1; + data->spriteStates[3] = 1; } else { - data->unk_490[0] = 1; + data->spriteStates[0] = 1; } } static void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); - if (args->unk44 != 0) { - String *string = String_New(200, HEAP_ID_NAMING_SCREEN); - data->unk_180 = NULL; - int boxno = PCStorage_GetActiveBox(args->unk48); - int nextOpenBoxNo = PCStorage_FindFirstBoxWithEmptySlot(args->unk48); - BufferPCBoxName(data->msgFormat, 1, args->unk48, boxno); + if (args->battleMsgId != 0) { + String *string = String_New(200, HEAP_ID_NAMING_SCREEN); + data->battleMsgString = NULL; + int boxno = PCStorage_GetActiveBox(args->pcStorage); + int nextOpenBoxNo = PCStorage_FindFirstBoxWithEmptySlot(args->pcStorage); + BufferPCBoxName(data->msgFormat, 1, args->pcStorage, boxno); if (boxno != nextOpenBoxNo) { - BufferPCBoxName(data->msgFormat, 2, args->unk48, nextOpenBoxNo); - args->unk44 += 2; + BufferPCBoxName(data->msgFormat, 2, args->pcStorage, nextOpenBoxNo); + args->battleMsgId += 2; } else { - BufferPCBoxName(data->msgFormat, 2, args->unk48, boxno); + BufferPCBoxName(data->msgFormat, 2, args->pcStorage, boxno); } - if (data->unk_158 == 0 || sub_02082EC0(data->unk_0D8)) { + if (data->textCursorPos == 0 || sub_02082EC0(data->entryBuf)) { Pokemon *mon = AllocMonZeroed(HEAP_ID_NAMING_SCREEN); - CreateMon(mon, data->unk_004, 1, 0, 0, 0, 0, 0); + CreateMon(mon, data->playerGenderOrMonSpecies, 1, 0, 0, 0, 0, 0); BufferBoxMonSpeciesName(data->msgFormat, 0, Mon_GetBoxMon(mon)); FreeToHeap(mon); } else { - data->unk_0D8[data->unk_158] = EOS; - CopyU16ArrayToString(string, data->unk_0D8); + data->entryBuf[data->textCursorPos] = EOS; + CopyU16ArrayToString(string, data->entryBuf); BufferString(data->msgFormat, 0, string, 0, 0, 0); } - data->unk_180 = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_197, args->unk44, HEAP_ID_NAMING_SCREEN); - data->unk_014 = 1; + data->battleMsgString = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_197, args->battleMsgId, HEAP_ID_NAMING_SCREEN); + data->unk_014 = 1; String_Delete(string); } } -static void sub_02083614(BgConfig *bgConfig, Window *a1) { +static void NamingScreen_UnloadBgGfx(BgConfig *bgConfig, Window *windows) { for (int i = 0; i < 10; ++i) { - RemoveWindow(&a1[i]); + RemoveWindow(&windows[i]); } FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_SUB_0); FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_MAIN_2); @@ -958,7 +969,7 @@ static void sub_02083614(BgConfig *bgConfig, Window *a1) { FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, bgConfig); } -static void sub_02083654(NamingScreenAppData *data, NARC *narc) { +static void NamingScreen_CreateBgConfigAndLoadGfx(NamingScreenAppData *data, NARC *narc) { BgConfig *bgConfig = data->bgConfig; GfGfxLoader_GXLoadPalFromOpenNarc(narc, 0, GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0, 0x60, HEAP_ID_NAMING_SCREEN); @@ -974,58 +985,57 @@ static void sub_02083654(NamingScreenAppData *data, NARC *narc) { GfGfxLoader_LoadScrnDataFromOpenNarc(narc, 7, bgConfig, GF_BG_LYR_MAIN_0, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); LoadFontPal1(GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0x180, HEAP_ID_NAMING_SCREEN); - LoadUserFrameGfx2(data->bgConfig, GF_BG_LYR_SUB_0, 0x100, 10, Options_GetFrame(data->unk_018), HEAP_ID_NAMING_SCREEN); + LoadUserFrameGfx2(data->bgConfig, GF_BG_LYR_SUB_0, 0x100, 10, Options_GetFrame(data->options), HEAP_ID_NAMING_SCREEN); LoadFontPal1(GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)0x180, HEAP_ID_NAMING_SCREEN); - data->unk_4AC = GfGfxLoader_GetCharDataFromOpenNarc(narc, 16, TRUE, &data->unk_4B0, HEAP_ID_NAMING_SCREEN); + data->unk_4AC = GfGfxLoader_GetCharDataFromOpenNarc(narc, 16, TRUE, &data->charData, HEAP_ID_NAMING_SCREEN); } -static void sub_0208377C(void) { - static const ObjCharTransferTemplate _02101D70 = { +static void NamingScreen_InitObjCharPlttTransfer(void) { + ObjCharTransferTemplate tmplate = { .maxTasks = 20, .sizeMain = 0x800, .sizeSub = 0x800, .heapId = HEAP_ID_NAMING_SCREEN, }; - ObjCharTransferTemplate tmplate = _02101D70; ObjCharTransfer_Init(&tmplate); ObjPlttTransfer_Init(20, HEAP_ID_NAMING_SCREEN); ObjCharTransfer_ClearBuffers(); ObjPlttTransfer_Reset(); } -static void sub_020837AC(NamingScreenAppData *data, NARC *narc) { +static void NamingScreen_LoadObjGfx(NamingScreenAppData *data, NARC *narc) { NNS_G2dInitOamManagerModule(); GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); GXS_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); OamManager_Create(0, 128, 0, 32, 0, 128, 0, 32, HEAP_ID_NAMING_SCREEN); - data->unk_188 = G2dRenderer_Init(44, &data->unk_18C, HEAP_ID_NAMING_SCREEN); - G2dRenderer_SetSubSurfaceCoords(&data->unk_18C, 0, FX32_CONST(256)); + data->spriteList = G2dRenderer_Init(44, &data->g2dRender, HEAP_ID_NAMING_SCREEN); + G2dRenderer_SetSubSurfaceCoords(&data->g2dRender, 0, FX32_CONST(256)); for (int i = 0; i < 4; ++i) { - data->unk_2B4[i] = Create2DGfxResObjMan(2, (GfGfxResType)i, HEAP_ID_NAMING_SCREEN); + data->gfxResMen[i] = Create2DGfxResObjMan(2, (GfGfxResType)i, HEAP_ID_NAMING_SCREEN); } - data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_CHAR], narc, 10, TRUE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, HEAP_ID_NAMING_SCREEN); - data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_PLTT], narc, 1, FALSE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 9, HEAP_ID_NAMING_SCREEN); - data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_CELL], narc, 12, TRUE, 0, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); - data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_ANIM], narc, 14, TRUE, 0, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CHAR], narc, 10, TRUE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_PLTT], narc, 1, FALSE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 9, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CELL], narc, 12, TRUE, 0, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_ANIM], narc, 14, TRUE, 0, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); if (data->type == NAME_SCREEN_POKEMON) { - data->unk_4B4 = GfGfxLoader_GetCharData(NARC_poketool_icongra_poke_icon, GetMonIconNaixEx(data->unk_004, FALSE, data->unk_008), FALSE, &data->unk_4B8, HEAP_ID_NAMING_SCREEN); - DC_FlushRange(data->unk_4B8, 0x200); - data->unk_4BC = GfGfxLoader_GetPlttData(NARC_poketool_icongra_poke_icon, sub_02074490(), &data->unk_4C0, HEAP_ID_NAMING_SCREEN); - DC_FlushRange(data->unk_4C0, 0x80); + data->unk_4B4 = GfGfxLoader_GetCharData(NARC_poketool_icongra_poke_icon, GetMonIconNaixEx(data->playerGenderOrMonSpecies, FALSE, data->monForm), FALSE, &data->monIconCharData, HEAP_ID_NAMING_SCREEN); + DC_FlushRange(data->monIconCharData, 0x200); + data->unk_4BC = GfGfxLoader_GetPlttData(NARC_poketool_icongra_poke_icon, sub_02074490(), &data->plttData, HEAP_ID_NAMING_SCREEN); + DC_FlushRange(data->plttData, 0x80); } - data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_CHAR], narc, 11, TRUE, 1, NNS_G2D_VRAM_TYPE_2DSUB, HEAP_ID_NAMING_SCREEN); - data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_PLTT], narc, 1, FALSE, 1, NNS_G2D_VRAM_TYPE_2DSUB, 3, HEAP_ID_NAMING_SCREEN); - data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_CELL], narc, 13, TRUE, 1, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); - data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->unk_2B4[GF_GFX_RES_TYPE_ANIM], narc, 15, TRUE, 1, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CHAR], narc, 11, TRUE, 1, NNS_G2D_VRAM_TYPE_2DSUB, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_PLTT], narc, 1, FALSE, 1, NNS_G2D_VRAM_TYPE_2DSUB, 3, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CELL], narc, 13, TRUE, 1, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_ANIM], narc, 15, TRUE, 1, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); - sub_0200ACF0(data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR]); - sub_0200ACF0(data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR]); - sub_0200AF94(data->unk_2C4[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT]); - sub_0200AF94(data->unk_2C4[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT]); + sub_0200ACF0(data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR]); + sub_0200ACF0(data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR]); + sub_0200AF94(data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT]); + sub_0200AF94(data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT]); } typedef struct SysTaskData_020839B8 { @@ -1045,14 +1055,14 @@ static void sub_020839B8(SysTask *task, void *taskData) { Sprite_SetMatrix(data->sprite2, &matrix); } -static void sub_020839EC(NamingScreenAppData *data) { +static void NamingScreen_CreateSprites(NamingScreenAppData *data) { int i; - CreateSpriteResourcesHeader(&data->unk_2E4, 0, 0, 0, 0, -1, -1, 0, 1, data->unk_2B4[GF_GFX_RES_TYPE_CHAR], data->unk_2B4[GF_GFX_RES_TYPE_PLTT], data->unk_2B4[GF_GFX_RES_TYPE_CELL], data->unk_2B4[GF_GFX_RES_TYPE_ANIM], NULL, NULL); - CreateSpriteResourcesHeader(&data->unk_308, 1, 1, 1, 1, -1, -1, 0, 0, data->unk_2B4[GF_GFX_RES_TYPE_CHAR], data->unk_2B4[GF_GFX_RES_TYPE_PLTT], data->unk_2B4[GF_GFX_RES_TYPE_CELL], data->unk_2B4[GF_GFX_RES_TYPE_ANIM], NULL, NULL); + CreateSpriteResourcesHeader(&data->spriteResHdr_Main, 0, 0, 0, 0, -1, -1, 0, 1, data->gfxResMen[GF_GFX_RES_TYPE_CHAR], data->gfxResMen[GF_GFX_RES_TYPE_PLTT], data->gfxResMen[GF_GFX_RES_TYPE_CELL], data->gfxResMen[GF_GFX_RES_TYPE_ANIM], NULL, NULL); + CreateSpriteResourcesHeader(&data->spriteResHdr_Sub, 1, 1, 1, 1, -1, -1, 0, 0, data->gfxResMen[GF_GFX_RES_TYPE_CHAR], data->gfxResMen[GF_GFX_RES_TYPE_PLTT], data->gfxResMen[GF_GFX_RES_TYPE_CELL], data->gfxResMen[GF_GFX_RES_TYPE_ANIM], NULL, NULL); { SpriteTemplate spriteTemplate; - spriteTemplate.spriteList = data->unk_188; - spriteTemplate.header = &data->unk_2E4; + spriteTemplate.spriteList = data->spriteList; + spriteTemplate.header = &data->spriteResHdr_Main; spriteTemplate.position.x = FX32_CONST(32); spriteTemplate.position.y = FX32_CONST(96); spriteTemplate.position.z = 0; @@ -1067,17 +1077,17 @@ static void sub_020839EC(NamingScreenAppData *data) { for (i = 0; i < 9; ++i) { spriteTemplate.position.x = _021021E8[i][0] * FX32_ONE; spriteTemplate.position.y = _021021E8[i][1] * FX32_ONE; - data->unk_32C[i] = Sprite_CreateAffine(&spriteTemplate); - Sprite_SetAnimActiveFlag(data->unk_32C[i], TRUE); - Sprite_SetAnimCtrlSeq(data->unk_32C[i], _021021E8[i][2]); - Sprite_SetDrawPriority(data->unk_32C[i], _021021E8[i][3]); + data->sprites1[i] = Sprite_CreateAffine(&spriteTemplate); + Sprite_SetAnimActiveFlag(data->sprites1[i], TRUE); + Sprite_SetAnimCtrlSeq(data->sprites1[i], _021021E8[i][2]); + Sprite_SetDrawPriority(data->sprites1[i], _021021E8[i][3]); } - Sprite_SetVisibleFlag(data->unk_32C[4], FALSE); + Sprite_SetVisibleFlag(data->sprites1[4], FALSE); for (i = 0; i < 7; ++i) { - data->unk_39C[i] = CreateSysTaskAndEnvironment(sub_020839B8, sizeof(SysTaskData_020839B8), 5, HEAP_ID_NAMING_SCREEN); - SysTaskData_020839B8 *taskData = SysTask_GetData(data->unk_39C[i]); - taskData->sprite = data->unk_32C[7]; - taskData->sprite2 = data->unk_32C[i]; + data->tasks[i] = CreateSysTaskAndEnvironment(sub_020839B8, sizeof(SysTaskData_020839B8), 5, HEAP_ID_NAMING_SCREEN); + SysTaskData_020839B8 *taskData = SysTask_GetData(data->tasks[i]); + taskData->sprite = data->sprites1[7]; + taskData->sprite2 = data->sprites1[i]; taskData->dx = _021021E8[i][0] * FX32_ONE; taskData->i = i; } @@ -1085,11 +1095,11 @@ static void sub_020839EC(NamingScreenAppData *data) { for (i = 0; i < data->maxLen; ++i) { spriteTemplate.position.x = FX32_ONE * (80 + i * 12); spriteTemplate.position.y = FX32_ONE * 39; - data->unk_364[i] = Sprite_CreateAffine(&spriteTemplate); - Sprite_SetAnimActiveFlag(data->unk_364[i], TRUE); - Sprite_SetAnimCtrlSeq(data->unk_364[i], 43); + data->textEntrySprites[i] = Sprite_CreateAffine(&spriteTemplate); + Sprite_SetAnimActiveFlag(data->textEntrySprites[i], TRUE); + Sprite_SetAnimCtrlSeq(data->textEntrySprites[i], 43); } - sub_02084E18(data->unk_364, data->unk_158, data->maxLen); + sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); sub_02083BB4(data, &spriteTemplate); } GfGfx_EngineATogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); @@ -1099,43 +1109,43 @@ static void sub_020839EC(NamingScreenAppData *data) { static void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate) { tmplate->position.x = FX32_CONST(24); tmplate->position.y = FX32_CONST(8); - data->unk_394[0] = Sprite_CreateAffine(tmplate); - Sprite_SetAnimActiveFlag(data->unk_394[0], TRUE); + data->sprites3[0] = Sprite_CreateAffine(tmplate); + Sprite_SetAnimActiveFlag(data->sprites3[0], TRUE); switch (data->type) { case NAME_SCREEN_PLAYER: - if (data->unk_004 == PLAYER_GENDER_MALE) { - Sprite_SetAnimCtrlSeq(data->unk_394[0], 48); + if (data->playerGenderOrMonSpecies == PLAYER_GENDER_MALE) { + Sprite_SetAnimCtrlSeq(data->sprites3[0], 48); } else { - Sprite_SetAnimCtrlSeq(data->unk_394[0], 49); + Sprite_SetAnimCtrlSeq(data->sprites3[0], 49); } break; case NAME_SCREEN_RIVAL: - Sprite_SetAnimCtrlSeq(data->unk_394[0], 51); + Sprite_SetAnimCtrlSeq(data->sprites3[0], 51); break; case NAME_SCREEN_UNK6: - Sprite_SetAnimCtrlSeq(data->unk_394[0], 55); + Sprite_SetAnimCtrlSeq(data->sprites3[0], 55); break; case NAME_SCREEN_GROUP: - Sprite_SetAnimCtrlSeq(data->unk_394[0], 54); + Sprite_SetAnimCtrlSeq(data->sprites3[0], 54); break; case NAME_SCREEN_UNK4: case NAME_SCREEN_UNK7: - Sprite_SetAnimCtrlSeq(data->unk_394[0], 53); + Sprite_SetAnimCtrlSeq(data->sprites3[0], 53); break; case NAME_SCREEN_BOX: - Sprite_SetAnimCtrlSeq(data->unk_394[0], 47); + Sprite_SetAnimCtrlSeq(data->sprites3[0], 47); break; case NAME_SCREEN_POKEMON: - Sprite_SetAnimCtrlSeq(data->unk_394[0], 50); - if (data->unk_010 != 2) { + Sprite_SetAnimCtrlSeq(data->sprites3[0], 50); + if (data->monGender != 2) { tmplate->position.x = (13 * data->maxLen + 80) * FX32_ONE; tmplate->position.y = FX32_CONST(27); - data->unk_394[1] = Sprite_CreateAffine(tmplate); - if (data->unk_010 == 0) { - Sprite_SetAnimCtrlSeq(data->unk_394[1], 45); + data->sprites3[1] = Sprite_CreateAffine(tmplate); + if (data->monGender == 0) { + Sprite_SetAnimCtrlSeq(data->sprites3[1], 45); } else { - Sprite_SetAnimCtrlSeq(data->unk_394[1], 46); + Sprite_SetAnimCtrlSeq(data->sprites3[1], 46); } } break; @@ -1255,53 +1265,53 @@ static void sub_02083F48(Window *window, NameScreenType unused, String *msg) { CopyWindowToVram(window); } -static void sub_02083F9C(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc) { - AddWindowParameterized(data->bgConfig, &data->unk_3B8[0], GF_BG_LYR_MAIN_0, 2, 1, 26, 12, 1, 0x100); - AddWindowParameterized(data->bgConfig, &data->unk_3B8[1], GF_BG_LYR_MAIN_1, 2, 1, 26, 12, 1, 0x238); +static void NamingScreen_InitWindows(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc) { + AddWindowParameterized(data->bgConfig, &data->windows[0], GF_BG_LYR_MAIN_0, 2, 1, 26, 12, 1, 0x100); + AddWindowParameterized(data->bgConfig, &data->windows[1], GF_BG_LYR_MAIN_1, 2, 1, 26, 12, 1, 0x238); if (data->type == NAME_SCREEN_UNK4) { GfGfxLoader_LoadScrnDataFromOpenNarc(narc, 9, data->bgConfig, GF_BG_LYR_MAIN_1, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); - data->unk_460 = 4; - sub_02084830(data->unk_03A, 4); - sub_02084E54(&data->unk_3B8[1], 0x0A0A, 4, MAKE_TEXT_COLOR(14, 15, 0), data->unk_4B0->pRawData); + data->pageNum = 4; + NamingScreen_LoadKeyboardLayout(data->keyboard, 4); + sub_02084E54(&data->windows[1], 0x0A0A, 4, MAKE_TEXT_COLOR(14, 15, 0), data->charData->pRawData); } else { - data->unk_460 = 0; - sub_02084830(data->unk_03A, 0); - sub_02084E54(&data->unk_3B8[1], 0x0404, 0, MAKE_TEXT_COLOR(14, 15, 0), data->unk_4B0->pRawData); + data->pageNum = 0; + NamingScreen_LoadKeyboardLayout(data->keyboard, 0); + sub_02084E54(&data->windows[1], 0x0404, 0, MAKE_TEXT_COLOR(14, 15, 0), data->charData->pRawData); } - AddWindowParameterized(data->bgConfig, &data->unk_3B8[2], GF_BG_LYR_MAIN_2, 7, 2, 22, 2, 0, 0x370); + AddWindowParameterized(data->bgConfig, &data->windows[2], GF_BG_LYR_MAIN_2, 7, 2, 22, 2, 0, 0x370); int win3Width = (data->maxLen * 12) / 8 + 1; - AddWindowParameterized(data->bgConfig, &data->unk_3B8[3], GF_BG_LYR_MAIN_2, 10, 3, win3Width, 2, 0, 0x39C); - FillWindowPixelBuffer(&data->unk_3B8[3], 1); + AddWindowParameterized(data->bgConfig, &data->windows[3], GF_BG_LYR_MAIN_2, 10, 3, win3Width, 2, 0, 0x39C); + FillWindowPixelBuffer(&data->windows[3], 1); - AddWindowParameterized(data->bgConfig, &data->unk_3B8[8], GF_BG_LYR_MAIN_2, win3Width + 9, 3, 7, 2, 0, 0x3C0); - FillWindowPixelBuffer(&data->unk_3B8[8], 1); + AddWindowParameterized(data->bgConfig, &data->windows[8], GF_BG_LYR_MAIN_2, win3Width + 9, 3, 7, 2, 0, 0x3C0); + FillWindowPixelBuffer(&data->windows[8], 1); if (data->type == NAME_SCREEN_GROUP) { - sub_02083F48(&data->unk_3B8[8], data->type, data->unk_184); - CopyWindowToVram(&data->unk_3B8[8]); + sub_02083F48(&data->windows[8], data->type, data->unk_184); + CopyWindowToVram(&data->windows[8]); } - AddWindowParameterized(data->bgConfig, &data->unk_3B8[9], GF_BG_LYR_SUB_0, 2, 19, 27, 4, 12, 0x084); - FillWindowPixelBuffer(&data->unk_3B8[9], 15); - sub_02083F18(&data->unk_3B8[9], data->type, data->unk_178); + AddWindowParameterized(data->bgConfig, &data->windows[9], GF_BG_LYR_SUB_0, 2, 19, 27, 4, 12, 0x084); + FillWindowPixelBuffer(&data->windows[9], 15); + sub_02083F18(&data->windows[9], data->type, data->promptString); OverlayManager_GetArgs(ovyMan); if (data->unk_118[0] != EOS) { - CopyU16StringArray(data->unk_0D8, data->unk_118); - sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + CopyU16StringArray(data->entryBuf, data->unk_118); + sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); } for (int i = 0; i < 3; ++i) { - AddWindowParameterized(data->bgConfig, &data->unk_3B8[i + 4], GF_BG_LYR_MAIN_2, 0, 0, 2, 2, 0, 0x078); - FillWindowPixelBuffer(&data->unk_3B8[i + 4], 0); + AddWindowParameterized(data->bgConfig, &data->windows[i + 4], GF_BG_LYR_MAIN_2, 0, 0, 2, 2, 0, 0x078); + FillWindowPixelBuffer(&data->windows[i + 4], 0); } - AddWindowParameterized(data->bgConfig, &data->unk_3B8[7], GF_BG_LYR_MAIN_2, 0, 0, 16, 2, 0, 0x084); - FillWindowPixelBuffer(&data->unk_3B8[7], 0); + AddWindowParameterized(data->bgConfig, &data->windows[7], GF_BG_LYR_MAIN_2, 0, 0, 16, 2, 0, 0x084); + FillWindowPixelBuffer(&data->windows[7], 0); } static void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos) { @@ -1334,20 +1344,20 @@ static int sub_02084264(int val, int lo, int hi) { return val; } -static void sub_02084274(NamingScreenAppData *data, int a1) { - if (a1 == 0) { +static void sub_02084274(NamingScreenAppData *data, int dpadMovement) { + if (dpadMovement == 0) { return; } - u16 sp0 = data->unk_03A[data->cursorY][data->cursorX]; - int newX = sub_02084264(data->cursorX + _02102168[a1][0], 0, 13); - int newY = sub_02084264(data->cursorY + _02102168[a1][1], 0, 6); - while (data->unk_03A[newY][newX] == 0xD004 || (data->unk_03A[newY][newX] == sp0 && data->unk_03A[newY][newX] > 0xE001)) { - if (data->unk_028 == 0 && data->unk_03A[newY][newX] == 0xD004 && _02102168[a1][1] != 0) { + u16 sp0 = data->keyboard[data->cursorY][data->cursorX]; + int newX = sub_02084264(data->cursorX + _02102168[dpadMovement][0], 0, 13); + int newY = sub_02084264(data->cursorY + _02102168[dpadMovement][1], 0, 6); + while (data->keyboard[newY][newX] == NAME_SCREEN_BUTTON_D004 || (data->keyboard[newY][newX] == sp0 && data->keyboard[newY][newX] > NAME_SCREEN_BUTTON_E001)) { + if (data->unk_028 == 0 && data->keyboard[newY][newX] == NAME_SCREEN_BUTTON_D004 && _02102168[dpadMovement][1] != 0) { newX = sub_02084264(newX + data->unk_02C, 0, 13); } else { - newX = sub_02084264(newX + _02102168[a1][0], 0, 13); - newY = sub_02084264(newY + _02102168[a1][1], 0, 6); + newX = sub_02084264(newX + _02102168[dpadMovement][0], 0, 13); + newY = sub_02084264(newY + _02102168[dpadMovement][1], 0, 6); } } data->cursorX = newX; @@ -1355,90 +1365,90 @@ static void sub_02084274(NamingScreenAppData *data, int a1) { } static void sub_0208432C(NamingScreenAppData *data) { - int r4 = 0; - int r6 = 0; - BOOL r7 = FALSE; - if (!Sprite_GetVisibleFlag(data->unk_32C[8])) { + int doUpdateCursor = 0; + int dpadMovement = 0; + BOOL r7 = FALSE; + if (!Sprite_GetVisibleFlag(data->sprites1[8])) { r7 = TRUE; } if (gSystem.newAndRepeatedKeys & PAD_KEY_UP) { PlaySE(SEQ_SE_DP_SELECT); - Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); - r6 = 1; - ++r4; + Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + dpadMovement = 1; + ++doUpdateCursor; } if (gSystem.newAndRepeatedKeys & PAD_KEY_DOWN) { PlaySE(SEQ_SE_DP_SELECT); - Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); - r6 = 2; - ++r4; + Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + dpadMovement = 2; + ++doUpdateCursor; } if (gSystem.newAndRepeatedKeys & PAD_KEY_LEFT) { PlaySE(SEQ_SE_DP_SELECT); - Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); - r6 = 3; - ++r4; + Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + dpadMovement = 3; + ++doUpdateCursor; } if (gSystem.newAndRepeatedKeys & PAD_KEY_RIGHT) { PlaySE(SEQ_SE_DP_SELECT); - Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); - r6 = 4; - ++r4; + Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + dpadMovement = 4; + ++doUpdateCursor; } if (gSystem.newKeys & PAD_BUTTON_START) { PlaySE(SEQ_SE_DP_SELECT); - Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); + Sprite_SetVisibleFlag(data->sprites1[8], TRUE); data->cursorX = 12; data->cursorY = 0; - ++r4; + ++doUpdateCursor; } - data->unk_5C8 = sub_0208503C(data); - if (data->unk_5C8 == TRUE) { - r6 = 0; - ++r4; + data->isTouchInput = NamingScreen_HandleTouchInput(data); + if (data->isTouchInput == TRUE) { + dpadMovement = 0; + ++doUpdateCursor; } if (r7 == TRUE) { - r4 = 0; - sub_02084430(data, r6); + doUpdateCursor = 0; + NamingScreen_UpdateCursorSpritePosition(data, dpadMovement); } - if (r4) { - sub_02084274(data, r6); - sub_02084430(data, r6); + if (doUpdateCursor) { + sub_02084274(data, dpadMovement); + NamingScreen_UpdateCursorSpritePosition(data, dpadMovement); } } -static void sub_02084430(NamingScreenAppData *data, int a1) { +static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, int dpadMovement) { if (data->cursorY != 0) { if (data->unk_028 == 0 && data->unk_028 != data->cursorY) { - Sprite_SetAnimCtrlSeq(data->unk_32C[8], 39); + Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); } - if (a1 != 0) { - Sprite_SetAnimCtrlSeq(data->unk_32C[8], 39); + if (dpadMovement != 0) { + Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); } VecFx32 vec; vec.x = (data->cursorX * 16 + 26) * FX32_ONE; vec.y = ((data->cursorY - 1) * 19 + 91) * FX32_ONE; // vec.z = 0; - Sprite_SetMatrix(data->unk_32C[8], &vec); + Sprite_SetMatrix(data->sprites1[8], &vec); } else { - int buttonId = data->unk_03A[data->cursorY][data->cursorX] - 0xE002; + int buttonId = data->keyboard[data->cursorY][data->cursorX] - NAME_SCREEN_BUTTON_PAGE_UPPER; VecFx32 vec; vec.x = _02101D80[buttonId] * FX32_ONE; vec.y = FX32_CONST(68); // vec.z = 0; - Sprite_SetAnimCtrlSeq(data->unk_32C[8], _02101D4C[buttonId]); - Sprite_SetMatrix(data->unk_32C[8], &vec); + Sprite_SetAnimCtrlSeq(data->sprites1[8], _02101D4C[buttonId]); + Sprite_SetMatrix(data->sprites1[8], &vec); } data->unk_038 = 180; - Sprite_SetAnimCtrlCurrentFrame(data->unk_32C[8], 0); + Sprite_SetAnimCtrlCurrentFrame(data->sprites1[8], 0); data->unk_024 = data->cursorX; data->unk_028 = data->cursorY; - if (_02102168[a1][0] != 0) { - data->unk_02C = _02102168[a1][0]; + if (_02102168[dpadMovement][0] != 0) { + data->unk_02C = _02102168[dpadMovement][0]; } } @@ -1459,10 +1469,10 @@ static void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int u16 sp38[2]; String *string = String_New(2, HEAP_ID_NAMING_SCREEN); while (rawChars[i] != EOS) { - if (rawChars[i] == 0xD001 || rawChars[i] == 0xD002 || rawChars[i] == 0xD003) { - u16 buttonId = rawChars[i] - 0xD001; + if (rawChars[i] == NAME_SCREEN_BUTTON_D001 || rawChars[i] == NAME_SCREEN_BUTTON_D002 || rawChars[i] == NAME_SCREEN_BUTTON_D003) { + u16 buttonId = rawChars[i] - NAME_SCREEN_BUTTON_D001; BlitBitmapRectToWindow(window, buttonPixels + (buttonId * 256) / 2, 0, 0, 12, 12, x + i * spacing, y + 2, 12, 12); - } else if (rawChars[i] == 0xD004) { + } else if (rawChars[i] == NAME_SCREEN_BUTTON_D004) { ++i; continue; } else { @@ -1480,204 +1490,204 @@ static void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int static const u8 _02101D3C[] = { 0x60, 0x68, 0x50, 0x58 }; -static void *sub_02084640(Window *window, String *string, FontID fontId, u32 color) { +static void *NamingScreen_PrintStringOnWindow_GetPixelBuffer(Window *window, String *string, FontID fontId, u32 color) { AddTextPrinterParameterizedWithColor(window, fontId, string, 0, 0, TEXT_SPEED_NOTRANSFER, color, NULL); return window->pixelBuffer; } -static void sub_02084664(Window *windows, const u16 *a1, void *a2, String *a3) { +static void NamingScreen_PrintCharacterOnWindowAndOBJ(Window *windows, const u16 *tmpBuf, void *charBuf, String *string) { u16 spC[21]; u16 i; void *ptr; - String *string; + String *string2; FillWindowPixelBuffer(&windows[3], 0); - ptr = sub_02084640(&windows[3], a3, 2, MAKE_TEXT_COLOR(13, 14, 15)); + ptr = NamingScreen_PrintStringOnWindow_GetPixelBuffer(&windows[3], string, 2, MAKE_TEXT_COLOR(13, 14, 15)); DC_FlushRange(ptr, 0x800); for (i = 0; i < 4; ++i) { - sub_02013A50(&windows[3], 4, 2, i * 4, 0, a2); - DC_FlushRange(a2, 0x100); - GXS_LoadOBJ(a2, _02101D3C[i] * 32, 0x100); + sub_02013A50(&windows[3], 4, 2, i * 4, 0, charBuf); + DC_FlushRange(charBuf, 0x100); + GXS_LoadOBJ(charBuf, _02101D3C[i] * 32, 0x100); } - string = String_New(21, HEAP_ID_NAMING_SCREEN); + string2 = String_New(21, HEAP_ID_NAMING_SCREEN); for (i = 0; i < 3; ++i) { - spC[0] = a1[i]; + spC[0] = tmpBuf[i]; spC[1] = EOS; FillWindowPixelBuffer(&windows[i], 0); - CopyU16ArrayToString(string, spC); - ptr = sub_02084640(&windows[i], string, 2, MAKE_TEXT_COLOR(13, 14, 15)); + CopyU16ArrayToString(string2, spC); + ptr = NamingScreen_PrintStringOnWindow_GetPixelBuffer(&windows[i], string2, 2, MAKE_TEXT_COLOR(13, 14, 15)); DC_FlushRange(ptr, 0x80); GXS_LoadOBJ(ptr, _02101D54[i] * 32, 0x80); } - String_Delete(string); + String_Delete(string2); } -static void sub_02084740(Window *a0, u16 *a1, u16 a2, u16 *a3, void *a4, String *a5) { +static void NamingScreen_PrintLastCharacterOfEntryBuf(Window *window, u16 *entryBuf, u16 cursorPos, u16 *tmpBuf, void *charBuf, String *string) { int i; int j; u16 character; - if (a2 == 0) { - character = 0xD003; + if (cursorPos == 0) { + character = NAME_SCREEN_BUTTON_D003; } else { - character = a1[a2 - 1]; + character = entryBuf[cursorPos - 1]; } switch (character) { - case 0xD001: - case 0xD002: - case 0xD003: - case 0xD004: - case 0xE002: - case 0xE003: - case 0xE004: - case 0xE005: - case 0xE006: - case 0xE007: - case 0xE008: + case NAME_SCREEN_BUTTON_D001: + case NAME_SCREEN_BUTTON_D002: + case NAME_SCREEN_BUTTON_D003: + case NAME_SCREEN_BUTTON_D004: + case NAME_SCREEN_BUTTON_PAGE_UPPER: + case NAME_SCREEN_BUTTON_PAGE_LOWER: + case NAME_SCREEN_BUTTON_PAGE_SYMBOLS: + case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED: + case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: + case NAME_SCREEN_BUTTON_E007: + case NAME_SCREEN_BUTTON_E008: character = 1; break; } for (i = 0; i < 3; ++i) { - a3[i] = 1; + tmpBuf[i] = 1; } - a3[0] = character; + tmpBuf[0] = character; if (character != 1) { - for (i = 0; i < 82u; ++i) { + for (i = 0; i < NELEMS(_02102422); ++i) { if (character == _02102422[i][0]) { for (j = 0; j < 3; ++j) { - a3[j] = _02102422[i][j]; + tmpBuf[j] = _02102422[i][j]; } break; } if (character == _02102422[i][2]) { for (j = 0; j < 3; ++j) { - a3[j] = _02102422[i][j]; + tmpBuf[j] = _02102422[i][j]; } break; } } } - sub_02084664(a0, a3, a4, a5); + NamingScreen_PrintCharacterOnWindowAndOBJ(window, tmpBuf, charBuf, string); } -static void sub_02084830(u16 (*a0)[13], const int a1) { +static void NamingScreen_LoadKeyboardLayout(u16 (*keyboard)[13], const int pageNum) { int i; int j; for (i = 0; i < 13; ++i) { - a0[0][i] = _021104E4[a1][i]; + keyboard[0][i] = sKeyboardHomeRowLayoutPtrs[pageNum][i]; } for (j = 0; j < 5; ++j) { for (i = 0; i < 13; ++i) { - a0[j + 1][i] = _021104F8[a1][j][i]; + keyboard[j + 1][i] = sKeyboardLayoutPtrs[pageNum][j][i]; } } } -static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2) { - if (key == 0xD003 || key == 0xD004) { - key = 1; +static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput) { + if (key == NAME_SCREEN_BUTTON_D003 || key == NAME_SCREEN_BUTTON_D004) { + key = CHAR_JP_SPACE; } if (data->type == NAME_SCREEN_UNK4) { - if (key == 0xE002 || key == 0xE003 || key == 0xE004 || key == 0xE005) { - key = 1; + if (key == NAME_SCREEN_BUTTON_PAGE_UPPER || key == NAME_SCREEN_BUTTON_PAGE_LOWER || key == NAME_SCREEN_BUTTON_PAGE_SYMBOLS || key == NAME_SCREEN_BUTTON_PAGE_JP_UNUSED) { + key = CHAR_JP_SPACE; } } - if (!Sprite_GetVisibleFlag(data->unk_32C[8]) && gSystem.touchNew == 0) { - Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); + if (!Sprite_GetVisibleFlag(data->sprites1[8]) && gSystem.touchNew == 0) { + Sprite_SetVisibleFlag(data->sprites1[8], TRUE); return 2; } switch (key) { - case 0xD001: - if (sub_02084D04(0x2A, 0x52, 1, 0xD001, data->unk_0D8, data->unk_158)) { - FillWindowPixelBuffer(&data->unk_3B8[3], 1); - sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + case NAME_SCREEN_BUTTON_D001: + if (sub_02084D04(0x2A, 0x52, 1, NAME_SCREEN_BUTTON_D001, data->entryBuf, data->textCursorPos)) { + FillWindowPixelBuffer(&data->windows[3], 1); + sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); PlaySE(SEQ_SE_DP_BOX02); } break; - case 0xD002: - if (sub_02084D04(0x48, 0x52, 2, 0xD002, data->unk_0D8, data->unk_158)) { - FillWindowPixelBuffer(&data->unk_3B8[3], 1); - sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + case NAME_SCREEN_BUTTON_D002: + if (sub_02084D04(0x48, 0x52, 2, NAME_SCREEN_BUTTON_D002, data->entryBuf, data->textCursorPos)) { + FillWindowPixelBuffer(&data->windows[3], 1); + sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); PlaySE(SEQ_SE_DP_BOX02); } break; - case 0xE006: - if (sub_02084C98(0, 0x52, data->unk_0D8, data->unk_158)) { - FillWindowPixelBuffer(&data->unk_3B8[3], 1); - sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); - ++data->unk_490[4]; + case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: + if (sub_02084C98(0, 0x52, data->entryBuf, data->textCursorPos)) { + FillWindowPixelBuffer(&data->windows[3], 1); + sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + ++data->spriteStates[4]; PlaySE(SEQ_SE_DP_BOX02); } break; - case 0xE002: - case 0xE003: - case 0xE004: - case 0xE005: - if (data->unk_460 != key - 0xE002) { + case NAME_SCREEN_BUTTON_PAGE_UPPER: + case NAME_SCREEN_BUTTON_PAGE_LOWER: + case NAME_SCREEN_BUTTON_PAGE_SYMBOLS: + case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED: + if (data->pageNum != key - NAME_SCREEN_BUTTON_PAGE_UPPER) { data->unk_45C = 0; - data->unk_460 = key - 0xE002; - sub_02084830(data->unk_03A, data->unk_460); - ++data->unk_490[key - 0xE002]; + data->pageNum = key - NAME_SCREEN_BUTTON_PAGE_UPPER; + NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); + ++data->spriteStates[key - NAME_SCREEN_BUTTON_PAGE_UPPER]; PlaySE(SEQ_SE_DP_SYU03); } break; - case 0xE007: - if (data->unk_158 != 0) { - data->unk_0D8[data->unk_158 - 1] = EOS; - --data->unk_158; - FillWindowPixelBuffer(&data->unk_3B8[3], 1); - if (data->unk_158 == 0) { - CopyWindowToVram(&data->unk_3B8[3]); + case NAME_SCREEN_BUTTON_E007: + if (data->textCursorPos != 0) { + data->entryBuf[data->textCursorPos - 1] = EOS; + --data->textCursorPos; + FillWindowPixelBuffer(&data->windows[3], 1); + if (data->textCursorPos == 0) { + CopyWindowToVram(&data->windows[3]); } else { - sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); } - sub_02084740(&data->unk_3B8[4], data->unk_0D8, data->unk_158, data->unk_15A, data->unk_4C4, data->unk_17C); - sub_02084E18(data->unk_364, data->unk_158, data->maxLen); - ++data->unk_490[5]; + NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->unk_15A, data->charBuf, data->unkJapaneseString); + sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); + ++data->spriteStates[5]; PlaySE(SEQ_SE_DP_SELECT); } break; - case 0xE008: + case NAME_SCREEN_BUTTON_E008: sub_020164C4(data->unk_5C4); if (data->unk_014 == 0) { PlaySE(SEQ_SE_DP_PIRORIRO); - ++data->unk_490[6]; + ++data->spriteStates[6]; BeginNormalPaletteFade(2, 0, 0, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); - sub_02084C58(data, a2); + NamingScreen_UpdateFieldMenuInputState(data, isButtonInput); return 3; } else { data->unk_45C = 5; } break; default: - if (data->unk_460 == 4 && key == 1) { + if (data->pageNum == 4 && key == CHAR_JP_SPACE) { return 2; } - if (data->unk_158 != data->maxLen) { - data->unk_0D8[data->unk_158] = key; - FillWindowPixelBuffer(&data->unk_3B8[3], 1); - sub_02084540(&data->unk_3B8[3], data->unk_0D8, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); - ++data->unk_158; - sub_02084E18(data->unk_364, data->unk_158, data->maxLen); + if (data->textCursorPos != data->maxLen) { + data->entryBuf[data->textCursorPos] = key; + FillWindowPixelBuffer(&data->windows[3], 1); + sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + ++data->textCursorPos; + sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); PlaySE(SEQ_SE_DP_BOX02); - Sprite_SetVisibleFlag(data->unk_32C[8], TRUE); - Sprite_SetOamMode(data->unk_32C[8], GX_OAM_MODE_XLU); + Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + Sprite_SetOamMode(data->sprites1[8], GX_OAM_MODE_XLU); G2_SetBlendAlpha(0, GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2, 8, 8); - Sprite_SetAnimCtrlSeq(data->unk_32C[8], 60); - if (data->unk_158 == data->maxLen) { + Sprite_SetAnimCtrlSeq(data->sprites1[8], 60); + if (data->textCursorPos == data->maxLen) { data->unk_034 = 1; } - sub_02084740(&data->unk_3B8[4], data->unk_0D8, data->unk_158, data->unk_15A, data->unk_4C4, data->unk_17C); + NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->unk_15A, data->charBuf, data->unkJapaneseString); } break; } @@ -1685,12 +1695,12 @@ static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL a2) { return 2; } -static void sub_02084C58(NamingScreenAppData *data, BOOL a1) { - if (data->unk_5D0 != NULL) { - if (a1 == TRUE) { - sub_02018410(data->unk_5D0, FALSE); +static void NamingScreen_UpdateFieldMenuInputState(NamingScreenAppData *data, BOOL toggle) { + if (data->pMenuInputState != NULL) { + if (toggle == TRUE) { + sub_02018410(data->pMenuInputState, FALSE); } else { - sub_02018410(data->unk_5D0, TRUE); + sub_02018410(data->pMenuInputState, TRUE); } } } @@ -1714,7 +1724,7 @@ static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3) { key = a2[a3 - 1]; for (i = a0; i < a1; ++i) { for (j = 0; j < 3; ++j) { - if (key == _02102422[i][j] && key != 1) { + if (key == _02102422[i][j] && key != CHAR_JP_SPACE) { a2[a3 - 1] = sub_02084C78(_02102422[i], j); return TRUE; } @@ -1745,7 +1755,7 @@ static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { } } switch (a3) { - case 0xD001: + case NAME_SCREEN_BUTTON_D001: for (i = 0; i < 12u; ++i) { if (key == _021021B8[i][0]) { a4[a5 - 1] = _021021B8[i][1]; @@ -1753,7 +1763,7 @@ static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { } } break; - case 0xD002: + case NAME_SCREEN_BUTTON_D002: for (i = 0; i < 10u; ++i) { if (key == _02102190[i][0]) { a4[a5 - 1] = _02102190[i][1]; @@ -1761,7 +1771,7 @@ static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { } } break; - case 0xE006: + case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: if (key == 0x26) { a4[a5 - 1] = 0x24; return TRUE; @@ -1776,12 +1786,12 @@ static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { return FALSE; } -static void sub_02084E18(Sprite **sprites, int a1, int maxLen) { +static void sub_02084E18(Sprite **sprites, int cursorPos, int maxLen) { for (int i = 0; i < maxLen; ++i) { Sprite_SetAnimCtrlSeq(sprites[i], 43); } - if (a1 != maxLen) { - Sprite_SetAnimCtrlSeq(sprites[a1], 44); + if (cursorPos != maxLen) { + Sprite_SetAnimCtrlSeq(sprites[cursorPos], 44); } } @@ -1802,130 +1812,130 @@ static void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor } for (int i = 0; i < 5; ++i) { - sub_02084540(window, _021104F8[pageNum][i], 0, 19 * i + 4, 16, TEXT_SPEED_NOTRANSFER, textColor, pRawData); + sub_02084540(window, sKeyboardLayoutPtrs[pageNum][i], 0, 19 * i + 4, 16, TEXT_SPEED_NOTRANSFER, textColor, pRawData); } CopyWindowToVram(window); } -static void sub_02084F3C(int *a0, Sprite **a1, int a2) { +static void sub_02084F3C(int *spriteStates, Sprite **sprites, int pageNum) { for (int i = 0; i < 3; ++i) { - if (a0[i] != 0) { + if (spriteStates[i] != 0) { for (int j = 0; j < 3; ++j) { - Sprite_SetAnimCtrlSeq(a1[j], _021021E8[j][2]); + Sprite_SetAnimCtrlSeq(sprites[j], _021021E8[j][2]); } - Sprite_SetAnimCtrlSeq(a1[i], _021021E8[i][2] - 3); + Sprite_SetAnimCtrlSeq(sprites[i], _021021E8[i][2] - 3); break; } } for (int i = 5; i < 7; ++i) { - if (a0[i] != 0) { - Sprite_SetAnimCtrlSeq(a1[i], _021021E8[i][2] + 1); + if (spriteStates[i] != 0) { + Sprite_SetAnimCtrlSeq(sprites[i], _021021E8[i][2] + 1); } } for (int i = 0; i < 7; ++i) { - a0[i] = 0; + spriteStates[i] = 0; } } -static void sub_02084FCC(NamingScreenAppData *data) { - if (Sprite_IsCellAnimationRunning(data->unk_32C[8])) { +static void NamingScreen_PlaceCursorSprite(NamingScreenAppData *data) { + if (Sprite_IsCellAnimationRunning(data->sprites1[8])) { return; } - if (data->unk_158 == data->maxLen) { + if (data->textCursorPos == data->maxLen) { data->cursorX = 12; data->cursorY = 0; - Sprite_SetAnimCtrlSeq(data->unk_32C[8], 39); + Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); data->unk_034 = 0; } else { - Sprite_SetAnimCtrlSeq(data->unk_32C[8], 39); + Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); } if (!data->unk_030) { - Sprite_SetVisibleFlag(data->unk_32C[8], FALSE); + Sprite_SetVisibleFlag(data->sprites1[8], FALSE); } else { - sub_02084430(data, 0); + NamingScreen_UpdateCursorSpritePosition(data, 0); } - Sprite_SetOamMode(data->unk_32C[8], GX_OAM_MODE_NORMAL); + Sprite_SetOamMode(data->sprites1[8], GX_OAM_MODE_NORMAL); } -static const UnkStruct_02102278 _02102278[] = { - { .x = 0x19, .y = 0x3C, .unk_2_0 = 0, .unk_4_0 = 0, .unk_4_5 = 0 }, - { .x = 0x39, .y = 0x3C, .unk_2_0 = 0, .unk_4_0 = 2, .unk_4_5 = 0 }, - { .x = 0x59, .y = 0x3C, .unk_2_0 = 0, .unk_4_0 = 4, .unk_4_5 = 0 }, - { .x = 0x00, .y = 0xC0, .unk_2_0 = 0, .unk_4_0 = 4, .unk_4_5 = 0 }, - { .x = 0x9D, .y = 0x3C, .unk_2_0 = 1, .unk_4_0 = 8, .unk_4_5 = 0 }, - { .x = 0xC5, .y = 0x3C, .unk_2_0 = 1, .unk_4_0 = 11, .unk_4_5 = 0 }, - { .x = 0x1C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 0, .unk_4_5 = 1 }, - { .x = 0x2C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 1, .unk_4_5 = 1 }, - { .x = 0x3C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 2, .unk_4_5 = 1 }, - { .x = 0x4C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 3, .unk_4_5 = 1 }, - { .x = 0x5C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 4, .unk_4_5 = 1 }, - { .x = 0x6C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 5, .unk_4_5 = 1 }, - { .x = 0x7C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 6, .unk_4_5 = 1 }, - { .x = 0x8C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 7, .unk_4_5 = 1 }, - { .x = 0x9C, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 8, .unk_4_5 = 1 }, - { .x = 0xAC, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 9, .unk_4_5 = 1 }, - { .x = 0xBC, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 10, .unk_4_5 = 1 }, - { .x = 0xCC, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 11, .unk_4_5 = 1 }, - { .x = 0xDC, .y = 0x58, .unk_2_0 = 2, .unk_4_0 = 12, .unk_4_5 = 1 }, - { .x = 0x1C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 0, .unk_4_5 = 2 }, - { .x = 0x2C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 1, .unk_4_5 = 2 }, - { .x = 0x3C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 2, .unk_4_5 = 2 }, - { .x = 0x4C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 3, .unk_4_5 = 2 }, - { .x = 0x5C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 4, .unk_4_5 = 2 }, - { .x = 0x6C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 5, .unk_4_5 = 2 }, - { .x = 0x7C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 6, .unk_4_5 = 2 }, - { .x = 0x8C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 7, .unk_4_5 = 2 }, - { .x = 0x9C, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 8, .unk_4_5 = 2 }, - { .x = 0xAC, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 9, .unk_4_5 = 2 }, - { .x = 0xBC, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 10, .unk_4_5 = 2 }, - { .x = 0xCC, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 11, .unk_4_5 = 2 }, - { .x = 0xDC, .y = 0x6B, .unk_2_0 = 2, .unk_4_0 = 12, .unk_4_5 = 2 }, - { .x = 0x1C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 0, .unk_4_5 = 3 }, - { .x = 0x2C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 1, .unk_4_5 = 3 }, - { .x = 0x3C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 2, .unk_4_5 = 3 }, - { .x = 0x4C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 3, .unk_4_5 = 3 }, - { .x = 0x5C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 4, .unk_4_5 = 3 }, - { .x = 0x6C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 5, .unk_4_5 = 3 }, - { .x = 0x7C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 6, .unk_4_5 = 3 }, - { .x = 0x8C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 7, .unk_4_5 = 3 }, - { .x = 0x9C, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 8, .unk_4_5 = 3 }, - { .x = 0xAC, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 9, .unk_4_5 = 3 }, - { .x = 0xBC, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 10, .unk_4_5 = 3 }, - { .x = 0xCC, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 11, .unk_4_5 = 3 }, - { .x = 0xDC, .y = 0x7E, .unk_2_0 = 2, .unk_4_0 = 12, .unk_4_5 = 3 }, - { .x = 0x1C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 0, .unk_4_5 = 4 }, - { .x = 0x2C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 1, .unk_4_5 = 4 }, - { .x = 0x3C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 2, .unk_4_5 = 4 }, - { .x = 0x4C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 3, .unk_4_5 = 4 }, - { .x = 0x5C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 4, .unk_4_5 = 4 }, - { .x = 0x6C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 5, .unk_4_5 = 4 }, - { .x = 0x7C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 6, .unk_4_5 = 4 }, - { .x = 0x8C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 7, .unk_4_5 = 4 }, - { .x = 0x9C, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 8, .unk_4_5 = 4 }, - { .x = 0xAC, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 9, .unk_4_5 = 4 }, - { .x = 0xBC, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 10, .unk_4_5 = 4 }, - { .x = 0xCC, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 11, .unk_4_5 = 4 }, - { .x = 0xDC, .y = 0x91, .unk_2_0 = 2, .unk_4_0 = 12, .unk_4_5 = 4 }, - { .x = 0x1C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 0, .unk_4_5 = 5 }, - { .x = 0x2C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 1, .unk_4_5 = 5 }, - { .x = 0x3C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 2, .unk_4_5 = 5 }, - { .x = 0x4C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 3, .unk_4_5 = 5 }, - { .x = 0x5C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 4, .unk_4_5 = 5 }, - { .x = 0x6C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 5, .unk_4_5 = 5 }, - { .x = 0x7C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 6, .unk_4_5 = 5 }, - { .x = 0x8C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 7, .unk_4_5 = 5 }, - { .x = 0x9C, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 8, .unk_4_5 = 5 }, - { .x = 0xAC, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 9, .unk_4_5 = 5 }, - { .x = 0xBC, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 10, .unk_4_5 = 5 }, - { .x = 0xCC, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 11, .unk_4_5 = 5 }, - { .x = 0xDC, .y = 0xA4, .unk_2_0 = 2, .unk_4_0 = 12, .unk_4_5 = 5 }, +static const NamingScreenTouchHitboxDef sTouchHitboxDef[] = { + { .x = 0x19, .y = 0x3C, .sizeParam = 0, .cursorX = 0, .cursorY = 0 }, + { .x = 0x39, .y = 0x3C, .sizeParam = 0, .cursorX = 2, .cursorY = 0 }, + { .x = 0x59, .y = 0x3C, .sizeParam = 0, .cursorX = 4, .cursorY = 0 }, + { .x = 0x00, .y = 0xC0, .sizeParam = 0, .cursorX = 4, .cursorY = 0 }, + { .x = 0x9D, .y = 0x3C, .sizeParam = 1, .cursorX = 8, .cursorY = 0 }, + { .x = 0xC5, .y = 0x3C, .sizeParam = 1, .cursorX = 11, .cursorY = 0 }, + { .x = 0x1C, .y = 0x58, .sizeParam = 2, .cursorX = 0, .cursorY = 1 }, + { .x = 0x2C, .y = 0x58, .sizeParam = 2, .cursorX = 1, .cursorY = 1 }, + { .x = 0x3C, .y = 0x58, .sizeParam = 2, .cursorX = 2, .cursorY = 1 }, + { .x = 0x4C, .y = 0x58, .sizeParam = 2, .cursorX = 3, .cursorY = 1 }, + { .x = 0x5C, .y = 0x58, .sizeParam = 2, .cursorX = 4, .cursorY = 1 }, + { .x = 0x6C, .y = 0x58, .sizeParam = 2, .cursorX = 5, .cursorY = 1 }, + { .x = 0x7C, .y = 0x58, .sizeParam = 2, .cursorX = 6, .cursorY = 1 }, + { .x = 0x8C, .y = 0x58, .sizeParam = 2, .cursorX = 7, .cursorY = 1 }, + { .x = 0x9C, .y = 0x58, .sizeParam = 2, .cursorX = 8, .cursorY = 1 }, + { .x = 0xAC, .y = 0x58, .sizeParam = 2, .cursorX = 9, .cursorY = 1 }, + { .x = 0xBC, .y = 0x58, .sizeParam = 2, .cursorX = 10, .cursorY = 1 }, + { .x = 0xCC, .y = 0x58, .sizeParam = 2, .cursorX = 11, .cursorY = 1 }, + { .x = 0xDC, .y = 0x58, .sizeParam = 2, .cursorX = 12, .cursorY = 1 }, + { .x = 0x1C, .y = 0x6B, .sizeParam = 2, .cursorX = 0, .cursorY = 2 }, + { .x = 0x2C, .y = 0x6B, .sizeParam = 2, .cursorX = 1, .cursorY = 2 }, + { .x = 0x3C, .y = 0x6B, .sizeParam = 2, .cursorX = 2, .cursorY = 2 }, + { .x = 0x4C, .y = 0x6B, .sizeParam = 2, .cursorX = 3, .cursorY = 2 }, + { .x = 0x5C, .y = 0x6B, .sizeParam = 2, .cursorX = 4, .cursorY = 2 }, + { .x = 0x6C, .y = 0x6B, .sizeParam = 2, .cursorX = 5, .cursorY = 2 }, + { .x = 0x7C, .y = 0x6B, .sizeParam = 2, .cursorX = 6, .cursorY = 2 }, + { .x = 0x8C, .y = 0x6B, .sizeParam = 2, .cursorX = 7, .cursorY = 2 }, + { .x = 0x9C, .y = 0x6B, .sizeParam = 2, .cursorX = 8, .cursorY = 2 }, + { .x = 0xAC, .y = 0x6B, .sizeParam = 2, .cursorX = 9, .cursorY = 2 }, + { .x = 0xBC, .y = 0x6B, .sizeParam = 2, .cursorX = 10, .cursorY = 2 }, + { .x = 0xCC, .y = 0x6B, .sizeParam = 2, .cursorX = 11, .cursorY = 2 }, + { .x = 0xDC, .y = 0x6B, .sizeParam = 2, .cursorX = 12, .cursorY = 2 }, + { .x = 0x1C, .y = 0x7E, .sizeParam = 2, .cursorX = 0, .cursorY = 3 }, + { .x = 0x2C, .y = 0x7E, .sizeParam = 2, .cursorX = 1, .cursorY = 3 }, + { .x = 0x3C, .y = 0x7E, .sizeParam = 2, .cursorX = 2, .cursorY = 3 }, + { .x = 0x4C, .y = 0x7E, .sizeParam = 2, .cursorX = 3, .cursorY = 3 }, + { .x = 0x5C, .y = 0x7E, .sizeParam = 2, .cursorX = 4, .cursorY = 3 }, + { .x = 0x6C, .y = 0x7E, .sizeParam = 2, .cursorX = 5, .cursorY = 3 }, + { .x = 0x7C, .y = 0x7E, .sizeParam = 2, .cursorX = 6, .cursorY = 3 }, + { .x = 0x8C, .y = 0x7E, .sizeParam = 2, .cursorX = 7, .cursorY = 3 }, + { .x = 0x9C, .y = 0x7E, .sizeParam = 2, .cursorX = 8, .cursorY = 3 }, + { .x = 0xAC, .y = 0x7E, .sizeParam = 2, .cursorX = 9, .cursorY = 3 }, + { .x = 0xBC, .y = 0x7E, .sizeParam = 2, .cursorX = 10, .cursorY = 3 }, + { .x = 0xCC, .y = 0x7E, .sizeParam = 2, .cursorX = 11, .cursorY = 3 }, + { .x = 0xDC, .y = 0x7E, .sizeParam = 2, .cursorX = 12, .cursorY = 3 }, + { .x = 0x1C, .y = 0x91, .sizeParam = 2, .cursorX = 0, .cursorY = 4 }, + { .x = 0x2C, .y = 0x91, .sizeParam = 2, .cursorX = 1, .cursorY = 4 }, + { .x = 0x3C, .y = 0x91, .sizeParam = 2, .cursorX = 2, .cursorY = 4 }, + { .x = 0x4C, .y = 0x91, .sizeParam = 2, .cursorX = 3, .cursorY = 4 }, + { .x = 0x5C, .y = 0x91, .sizeParam = 2, .cursorX = 4, .cursorY = 4 }, + { .x = 0x6C, .y = 0x91, .sizeParam = 2, .cursorX = 5, .cursorY = 4 }, + { .x = 0x7C, .y = 0x91, .sizeParam = 2, .cursorX = 6, .cursorY = 4 }, + { .x = 0x8C, .y = 0x91, .sizeParam = 2, .cursorX = 7, .cursorY = 4 }, + { .x = 0x9C, .y = 0x91, .sizeParam = 2, .cursorX = 8, .cursorY = 4 }, + { .x = 0xAC, .y = 0x91, .sizeParam = 2, .cursorX = 9, .cursorY = 4 }, + { .x = 0xBC, .y = 0x91, .sizeParam = 2, .cursorX = 10, .cursorY = 4 }, + { .x = 0xCC, .y = 0x91, .sizeParam = 2, .cursorX = 11, .cursorY = 4 }, + { .x = 0xDC, .y = 0x91, .sizeParam = 2, .cursorX = 12, .cursorY = 4 }, + { .x = 0x1C, .y = 0xA4, .sizeParam = 2, .cursorX = 0, .cursorY = 5 }, + { .x = 0x2C, .y = 0xA4, .sizeParam = 2, .cursorX = 1, .cursorY = 5 }, + { .x = 0x3C, .y = 0xA4, .sizeParam = 2, .cursorX = 2, .cursorY = 5 }, + { .x = 0x4C, .y = 0xA4, .sizeParam = 2, .cursorX = 3, .cursorY = 5 }, + { .x = 0x5C, .y = 0xA4, .sizeParam = 2, .cursorX = 4, .cursorY = 5 }, + { .x = 0x6C, .y = 0xA4, .sizeParam = 2, .cursorX = 5, .cursorY = 5 }, + { .x = 0x7C, .y = 0xA4, .sizeParam = 2, .cursorX = 6, .cursorY = 5 }, + { .x = 0x8C, .y = 0xA4, .sizeParam = 2, .cursorX = 7, .cursorY = 5 }, + { .x = 0x9C, .y = 0xA4, .sizeParam = 2, .cursorX = 8, .cursorY = 5 }, + { .x = 0xAC, .y = 0xA4, .sizeParam = 2, .cursorX = 9, .cursorY = 5 }, + { .x = 0xBC, .y = 0xA4, .sizeParam = 2, .cursorX = 10, .cursorY = 5 }, + { .x = 0xCC, .y = 0xA4, .sizeParam = 2, .cursorX = 11, .cursorY = 5 }, + { .x = 0xDC, .y = 0xA4, .sizeParam = 2, .cursorX = 12, .cursorY = 5 }, }; -static BOOL sub_0208503C(NamingScreenAppData *data) { +static BOOL NamingScreen_HandleTouchInput(NamingScreenAppData *data) { int i; - int ip = 0; + int start = 0; u8 x; u8 y; u8 x0; @@ -1933,16 +1943,16 @@ static BOOL sub_0208503C(NamingScreenAppData *data) { u8 dx; u8 dy; if (data->type == NAME_SCREEN_UNK4) { - ip = 4; + start = 4; } if (gSystem.touchNew) { x = gSystem.touchX; y = gSystem.touchY; - for (i = ip; i < 71u; ++i) { - x0 = _02102278[i].x; - y0 = _02102278[i].y; - switch (_02102278[i].unk_2_0) { + for (i = start; i < NELEMS(sTouchHitboxDef); ++i) { + x0 = sTouchHitboxDef[i].x; + y0 = sTouchHitboxDef[i].y; + switch (sTouchHitboxDef[i].sizeParam) { case 0: dx = 31; dy = 22; @@ -1957,8 +1967,8 @@ static BOOL sub_0208503C(NamingScreenAppData *data) { break; } if (x >= x0 && y >= y0 && x <= x0 + dx && y <= y0 + dy) { - data->cursorX = _02102278[i].unk_4_0; - data->cursorY = _02102278[i].unk_4_5; + data->cursorX = sTouchHitboxDef[i].cursorX; + data->cursorY = sTouchHitboxDef[i].cursorY; return TRUE; } } diff --git a/src/oaks_speech.c b/src/oaks_speech.c index 23bc7b546b..4926a9ba30 100644 --- a/src/oaks_speech.c +++ b/src/oaks_speech.c @@ -641,7 +641,7 @@ BOOL OakSpeech_Exit(OVY_MANAGER *ovyMan, int *pState) { HeapID heapId = data->heapId; FontID_Release(4); PlayerName_StringToFlat(Save_PlayerData_GetProfileAddr(data->saveData), data->namingScreenArgs_Player->nameInputString); - PlayerProfile_SetTrainerGender(Save_PlayerData_GetProfileAddr(data->saveData), data->namingScreenArgs_Player->playerGender); + PlayerProfile_SetTrainerGender(Save_PlayerData_GetProfileAddr(data->saveData), data->namingScreenArgs_Player->playerGenderOrMonSpecies); Save_Misc_RivalName_Set(Save_Misc_Get(data->saveData), data->namingScreenArgs_Rival->nameInputString); NamingScreen_DeleteArgs(data->namingScreenArgs_Player); NamingScreen_DeleteArgs(data->namingScreenArgs_Rival); @@ -2008,9 +2008,9 @@ static BOOL OakSpeech_DoMainTask(OakSpeechData *data) { case OAK_SPEECH_MAIN_STATE_PROMPT_NAME_LAUNCH_NAMING_SCREEN: String_SetEmpty(data->namingScreenArgs_Player->nameInputString); - data->namingScreenArgs_Player->playerGender = data->playerGender; - data->overlayManager = OverlayManager_New(&gOverlayTemplate_NamingScreen, data->namingScreenArgs_Player, data->heapId); - data->state = OAK_SPEECH_MAIN_STATE_PROMPT_NAME_RESTORE_GRAPHICS_AFTER; + data->namingScreenArgs_Player->playerGenderOrMonSpecies = data->playerGender; + data->overlayManager = OverlayManager_New(&gOverlayTemplate_NamingScreen, data->namingScreenArgs_Player, data->heapId); + data->state = OAK_SPEECH_MAIN_STATE_PROMPT_NAME_RESTORE_GRAPHICS_AFTER; break; case OAK_SPEECH_MAIN_STATE_PROMPT_NAME_RESTORE_GRAPHICS_AFTER: From 5adf14840aba1e13430879cae159431884b5ad5e Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 13 Oct 2024 21:31:09 -0400 Subject: [PATCH 18/25] Documentation, 2 --- include/constants/charcode.h | 798 ++++++++++++++++++++++------------- src/naming_screen.c | 334 +++++++-------- 2 files changed, 661 insertions(+), 471 deletions(-) diff --git a/include/constants/charcode.h b/include/constants/charcode.h index 56755332d1..25b26894a6 100644 --- a/include/constants/charcode.h +++ b/include/constants/charcode.h @@ -1,311 +1,499 @@ #ifndef POKEHEARTGOLD_CONSTANTS_CHARCODE_H #define POKEHEARTGOLD_CONSTANTS_CHARCODE_H -#define CHAR_NUL 0 -#define CHAR_JP_SPACE 1 - -#define CHAR_JP_HIRA_A_SMALL 2 -#define CHAR_JP_HIRA_A 3 -#define CHAR_JP_HIRA_I_SMALL 4 -#define CHAR_JP_HIRA_I 5 -#define CHAR_JP_HIRA_U_SMALL 6 -#define CHAR_JP_HIRA_U 7 -#define CHAR_JP_HIRA_E_SMALL 8 -#define CHAR_JP_HIRA_E 9 -#define CHAR_JP_HIRA_O_SMALL 10 -#define CHAR_JP_HIRA_O 11 -#define CHAR_JP_HIRA_KA 12 -#define CHAR_JP_HIRA_GA 13 -#define CHAR_JP_HIRA_KI 14 -#define CHAR_JP_HIRA_GI 15 -#define CHAR_JP_HIRA_KU 16 -#define CHAR_JP_HIRA_GU 17 -#define CHAR_JP_HIRA_KE 18 -#define CHAR_JP_HIRA_GE 19 -#define CHAR_JP_HIRA_KO 20 -#define CHAR_JP_HIRA_GO 21 -#define CHAR_JP_HIRA_SA 22 -#define CHAR_JP_HIRA_ZA 23 -#define CHAR_JP_HIRA_SI 24 -#define CHAR_JP_HIRA_ZI 25 -#define CHAR_JP_HIRA_SU 26 -#define CHAR_JP_HIRA_ZU 27 -#define CHAR_JP_HIRA_SE 28 -#define CHAR_JP_HIRA_ZE 29 -#define CHAR_JP_HIRA_SO 30 -#define CHAR_JP_HIRA_ZO 31 -#define CHAR_JP_HIRA_TA 32 -#define CHAR_JP_HIRA_DA 33 -#define CHAR_JP_HIRA_TI 34 -#define CHAR_JP_HIRA_DI 35 -#define CHAR_JP_HIRA_TU_SMALL 36 -#define CHAR_JP_HIRA_TU 37 -#define CHAR_JP_HIRA_DU 38 -#define CHAR_JP_HIRA_TE 39 -#define CHAR_JP_HIRA_DE 40 -#define CHAR_JP_HIRA_TO 41 -#define CHAR_JP_HIRA_DO 42 -#define CHAR_JP_HIRA_NA 43 -#define CHAR_JP_HIRA_NI 44 -#define CHAR_JP_HIRA_NU 45 -#define CHAR_JP_HIRA_NE 46 -#define CHAR_JP_HIRA_NO 47 -#define CHAR_JP_HIRA_HA 48 -#define CHAR_JP_HIRA_BA 49 -#define CHAR_JP_HIRA_PA 50 -#define CHAR_JP_HIRA_HI 51 -#define CHAR_JP_HIRA_BI 52 -#define CHAR_JP_HIRA_PI 53 -#define CHAR_JP_HIRA_HU 54 -#define CHAR_JP_HIRA_BU 55 -#define CHAR_JP_HIRA_PU 56 -#define CHAR_JP_HIRA_HE 57 -#define CHAR_JP_HIRA_BE 58 -#define CHAR_JP_HIRA_PE 59 -#define CHAR_JP_HIRA_HO 60 -#define CHAR_JP_HIRA_BO 61 -#define CHAR_JP_HIRA_PO 62 -#define CHAR_JP_HIRA_MA 63 -#define CHAR_JP_HIRA_MI 64 -#define CHAR_JP_HIRA_MU 65 -#define CHAR_JP_HIRA_ME 66 -#define CHAR_JP_HIRA_MO 67 -#define CHAR_JP_HIRA_YA_SMALL 68 -#define CHAR_JP_HIRA_YA 69 -#define CHAR_JP_HIRA_YU_SMALL 70 -#define CHAR_JP_HIRA_YU 71 -#define CHAR_JP_HIRA_YO_SMALL 72 -#define CHAR_JP_HIRA_YO 73 -#define CHAR_JP_HIRA_RA 74 -#define CHAR_JP_HIRA_RI 75 -#define CHAR_JP_HIRA_RU 76 -#define CHAR_JP_HIRA_RE 77 -#define CHAR_JP_HIRA_RO 78 -#define CHAR_JP_HIRA_WA 79 -#define CHAR_JP_HIRA_WO 80 -#define CHAR_JP_HIRA_N_ 81 - -#define CHAR_JP_KATA_A_SMALL 82 -#define CHAR_JP_KATA_A 83 -#define CHAR_JP_KATA_I_SMALL 84 -#define CHAR_JP_KATA_I 85 -#define CHAR_JP_KATA_U_SMALL 86 -#define CHAR_JP_KATA_U 87 -#define CHAR_JP_KATA_E_SMALL 88 -#define CHAR_JP_KATA_E 89 -#define CHAR_JP_KATA_O_SMALL 90 -#define CHAR_JP_KATA_O 91 -#define CHAR_JP_KATA_KA 92 -#define CHAR_JP_KATA_GA 93 -#define CHAR_JP_KATA_KI 94 -#define CHAR_JP_KATA_GI 95 -#define CHAR_JP_KATA_KU 96 -#define CHAR_JP_KATA_GU 97 -#define CHAR_JP_KATA_KE 98 -#define CHAR_JP_KATA_GE 99 -#define CHAR_JP_KATA_KO 100 -#define CHAR_JP_KATA_GO 101 -#define CHAR_JP_KATA_SA 102 -#define CHAR_JP_KATA_ZA 103 -#define CHAR_JP_KATA_SI 104 -#define CHAR_JP_KATA_ZI 105 -#define CHAR_JP_KATA_SU 106 -#define CHAR_JP_KATA_ZU 107 -#define CHAR_JP_KATA_SE 108 -#define CHAR_JP_KATA_ZE 109 -#define CHAR_JP_KATA_SO 110 -#define CHAR_JP_KATA_ZO 111 -#define CHAR_JP_KATA_TA 112 -#define CHAR_JP_KATA_DA 113 -#define CHAR_JP_KATA_TI 114 -#define CHAR_JP_KATA_DI 115 -#define CHAR_JP_KATA_TU_SMALL 116 -#define CHAR_JP_KATA_TU 117 -#define CHAR_JP_KATA_DU 118 -#define CHAR_JP_KATA_TE 119 -#define CHAR_JP_KATA_DE 120 -#define CHAR_JP_KATA_TO 121 -#define CHAR_JP_KATA_DO 122 -#define CHAR_JP_KATA_NA 123 -#define CHAR_JP_KATA_NI 124 -#define CHAR_JP_KATA_NU 125 -#define CHAR_JP_KATA_NE 126 -#define CHAR_JP_KATA_NO 127 -#define CHAR_JP_KATA_HA 128 -#define CHAR_JP_KATA_BA 129 -#define CHAR_JP_KATA_PA 130 -#define CHAR_JP_KATA_HI 131 -#define CHAR_JP_KATA_BI 132 -#define CHAR_JP_KATA_PI 133 -#define CHAR_JP_KATA_HU 134 -#define CHAR_JP_KATA_BU 135 -#define CHAR_JP_KATA_PU 136 -#define CHAR_JP_KATA_HE 137 -#define CHAR_JP_KATA_BE 138 -#define CHAR_JP_KATA_PE 139 -#define CHAR_JP_KATA_HO 140 -#define CHAR_JP_KATA_BO 141 -#define CHAR_JP_KATA_PO 142 -#define CHAR_JP_KATA_MA 143 -#define CHAR_JP_KATA_MI 144 -#define CHAR_JP_KATA_MU 145 -#define CHAR_JP_KATA_ME 146 -#define CHAR_JP_KATA_MO 147 -#define CHAR_JP_KATA_YA_SMALL 148 -#define CHAR_JP_KATA_YA 149 -#define CHAR_JP_KATA_YU_SMALL 150 -#define CHAR_JP_KATA_YU 151 -#define CHAR_JP_KATA_YO_SMALL 152 -#define CHAR_JP_KATA_YO 153 -#define CHAR_JP_KATA_RA 154 -#define CHAR_JP_KATA_RI 155 -#define CHAR_JP_KATA_RU 156 -#define CHAR_JP_KATA_RE 157 -#define CHAR_JP_KATA_RO 158 -#define CHAR_JP_KATA_WA 159 -#define CHAR_JP_KATA_WO 160 -#define CHAR_JP_KATA_N_ 161 - -#define CHAR_JP_0 162 -#define CHAR_JP_1 163 -#define CHAR_JP_2 164 -#define CHAR_JP_3 165 -#define CHAR_JP_4 166 -#define CHAR_JP_5 167 -#define CHAR_JP_6 168 -#define CHAR_JP_7 169 -#define CHAR_JP_8 170 -#define CHAR_JP_9 171 -#define CHAR_JP_A 172 -#define CHAR_JP_B 173 -#define CHAR_JP_C 174 -#define CHAR_JP_D 175 -#define CHAR_JP_E 176 -#define CHAR_JP_F 177 - -#define CHAR_JP_QUESTION_MARK 226 - -#define CHAR_JP_HYPHEN 241 - -#define CHAR_0 289 -#define CHAR_1 290 -#define CHAR_2 291 -#define CHAR_3 292 -#define CHAR_4 293 -#define CHAR_5 294 -#define CHAR_6 295 -#define CHAR_7 296 -#define CHAR_8 297 -#define CHAR_9 298 -#define CHAR_A 299 -#define CHAR_B 300 -#define CHAR_C 301 -#define CHAR_D 302 -#define CHAR_E 303 -#define CHAR_F 304 -#define CHAR_G 305 -#define CHAR_H 306 -#define CHAR_I 307 -#define CHAR_J 308 -#define CHAR_K 309 -#define CHAR_L 310 -#define CHAR_M 311 -#define CHAR_N 312 -#define CHAR_O 313 -#define CHAR_P 314 -#define CHAR_Q 315 -#define CHAR_R 316 -#define CHAR_S 317 -#define CHAR_T 318 -#define CHAR_U 319 -#define CHAR_V 320 -#define CHAR_W 321 -#define CHAR_X 322 -#define CHAR_Y 323 -#define CHAR_Z 324 -#define CHAR_a 325 -#define CHAR_b 326 -#define CHAR_c 327 -#define CHAR_d 328 -#define CHAR_e 329 -#define CHAR_f 330 -#define CHAR_g 331 -#define CHAR_h 332 -#define CHAR_i 333 -#define CHAR_j 334 -#define CHAR_k 335 -#define CHAR_l 336 -#define CHAR_m 337 -#define CHAR_n 338 -#define CHAR_o 339 -#define CHAR_p 340 -#define CHAR_q 341 -#define CHAR_r 342 -#define CHAR_s 343 -#define CHAR_t 344 -#define CHAR_u 345 -#define CHAR_v 346 -#define CHAR_w 347 -#define CHAR_x 348 -#define CHAR_y 349 -#define CHAR_z 350 - -#define CHAR_EXCL 427 -#define CHAR_QMARK 428 -#define CHAR_COMMA 429 -#define CHAR_PERIOD 430 -#define CHAR_ELLIPSIS 431 -#define CHAR_CTRDOT 432 - -#define CHAR_SLASH 433 -#define CHAR_LAPOST 434 // left single quote -#define CHAR_RAPOST 435 // right single quote (apostrophe) -#define CHAR_LDQUOT 436 // left double quote -#define CHAR_RDQUOT 437 // right double quote - -#define CHAR_LPAREN 441 -#define CHAR_RPAREN 442 -#define CHAR_MALE 443 -#define CHAR_FEMALE 444 -#define CHAR_PLUS 445 -#define CHAR_HYPHEN 446 -#define CHAR_ASTERISK 447 -#define CHAR_HASH 448 -#define CHAR_EQUALS 449 - -#define CHAR_TILDE 451 -#define CHAR_COLON 452 -#define CHAR_SEMICOLON 453 -#define CHAR_SPADE_SUIT 454 -#define CHAR_CLUB_SUIT 455 -#define CHAR_HEART_SUIT 456 -#define CHAR_DIAMOND_SUIT 457 -#define CHAR_STAR 458 -#define CHAR_CIRCLE_DOT 459 -#define CHAR_CIRCLE 460 -#define CHAR_SQUARE 461 -#define CHAR_TRIANGLE 462 -#define CHAR_DIAMOND 463 -#define CHAR_AT 464 -#define CHAR_MUSIC_NOTE 465 -#define CHAR_PERCENT 466 -#define CHAR_SUN 467 -#define CHAR_TREBLE_CLEF 468 -#define CHAR_UMBRELLA 469 -#define CHAR_SNOWMAN 470 -#define CHAR_SMILEY 471 -#define CHAR_LAUGHING 472 -#define CHAR_ANGUISH 473 -#define CHAR_ANGRY 474 -#define CHAR_UP_ARROW 475 -#define CHAR_DOWN_ARROW 476 -#define CHAR_SNORING 477 -#define CHAR_SPACE 478 - -#define CHAR_NARROW_SPACE 482 - -#define CHAR_ONE_DOT 491 -#define CHAR_TWO_DOTS 492 +#define CHAR_NUL 0 +#define CHAR_JP_SPACE 1 +#define CHAR_JP_HIRA_A_SMALL 2 +#define CHAR_JP_HIRA_A 3 +#define CHAR_JP_HIRA_I_SMALL 4 +#define CHAR_JP_HIRA_I 5 +#define CHAR_JP_HIRA_U_SMALL 6 +#define CHAR_JP_HIRA_U 7 +#define CHAR_JP_HIRA_E_SMALL 8 +#define CHAR_JP_HIRA_E 9 +#define CHAR_JP_HIRA_O_SMALL 10 +#define CHAR_JP_HIRA_O 11 +#define CHAR_JP_HIRA_KA 12 +#define CHAR_JP_HIRA_GA 13 +#define CHAR_JP_HIRA_KI 14 +#define CHAR_JP_HIRA_GI 15 +#define CHAR_JP_HIRA_KU 16 +#define CHAR_JP_HIRA_GU 17 +#define CHAR_JP_HIRA_KE 18 +#define CHAR_JP_HIRA_GE 19 +#define CHAR_JP_HIRA_KO 20 +#define CHAR_JP_HIRA_GO 21 +#define CHAR_JP_HIRA_SA 22 +#define CHAR_JP_HIRA_ZA 23 +#define CHAR_JP_HIRA_SI 24 +#define CHAR_JP_HIRA_ZI 25 +#define CHAR_JP_HIRA_SU 26 +#define CHAR_JP_HIRA_ZU 27 +#define CHAR_JP_HIRA_SE 28 +#define CHAR_JP_HIRA_ZE 29 +#define CHAR_JP_HIRA_SO 30 +#define CHAR_JP_HIRA_ZO 31 +#define CHAR_JP_HIRA_TA 32 +#define CHAR_JP_HIRA_DA 33 +#define CHAR_JP_HIRA_TI 34 +#define CHAR_JP_HIRA_DI 35 +#define CHAR_JP_HIRA_TU_SMALL 36 +#define CHAR_JP_HIRA_TU 37 +#define CHAR_JP_HIRA_DU 38 +#define CHAR_JP_HIRA_TE 39 +#define CHAR_JP_HIRA_DE 40 +#define CHAR_JP_HIRA_TO 41 +#define CHAR_JP_HIRA_DO 42 +#define CHAR_JP_HIRA_NA 43 +#define CHAR_JP_HIRA_NI 44 +#define CHAR_JP_HIRA_NU 45 +#define CHAR_JP_HIRA_NE 46 +#define CHAR_JP_HIRA_NO 47 +#define CHAR_JP_HIRA_HA 48 +#define CHAR_JP_HIRA_BA 49 +#define CHAR_JP_HIRA_PA 50 +#define CHAR_JP_HIRA_HI 51 +#define CHAR_JP_HIRA_BI 52 +#define CHAR_JP_HIRA_PI 53 +#define CHAR_JP_HIRA_HU 54 +#define CHAR_JP_HIRA_BU 55 +#define CHAR_JP_HIRA_PU 56 +#define CHAR_JP_HIRA_HE 57 +#define CHAR_JP_HIRA_BE 58 +#define CHAR_JP_HIRA_PE 59 +#define CHAR_JP_HIRA_HO 60 +#define CHAR_JP_HIRA_BO 61 +#define CHAR_JP_HIRA_PO 62 +#define CHAR_JP_HIRA_MA 63 +#define CHAR_JP_HIRA_MI 64 +#define CHAR_JP_HIRA_MU 65 +#define CHAR_JP_HIRA_ME 66 +#define CHAR_JP_HIRA_MO 67 +#define CHAR_JP_HIRA_YA_SMALL 68 +#define CHAR_JP_HIRA_YA 69 +#define CHAR_JP_HIRA_YU_SMALL 70 +#define CHAR_JP_HIRA_YU 71 +#define CHAR_JP_HIRA_YO_SMALL 72 +#define CHAR_JP_HIRA_YO 73 +#define CHAR_JP_HIRA_RA 74 +#define CHAR_JP_HIRA_RI 75 +#define CHAR_JP_HIRA_RU 76 +#define CHAR_JP_HIRA_RE 77 +#define CHAR_JP_HIRA_RO 78 +#define CHAR_JP_HIRA_WA 79 +#define CHAR_JP_HIRA_WO 80 +#define CHAR_JP_HIRA_N_ 81 +#define CHAR_JP_KATA_A_SMALL 82 +#define CHAR_JP_KATA_A 83 +#define CHAR_JP_KATA_I_SMALL 84 +#define CHAR_JP_KATA_I 85 +#define CHAR_JP_KATA_U_SMALL 86 +#define CHAR_JP_KATA_U 87 +#define CHAR_JP_KATA_E_SMALL 88 +#define CHAR_JP_KATA_E 89 +#define CHAR_JP_KATA_O_SMALL 90 +#define CHAR_JP_KATA_O 91 +#define CHAR_JP_KATA_KA 92 +#define CHAR_JP_KATA_GA 93 +#define CHAR_JP_KATA_KI 94 +#define CHAR_JP_KATA_GI 95 +#define CHAR_JP_KATA_KU 96 +#define CHAR_JP_KATA_GU 97 +#define CHAR_JP_KATA_KE 98 +#define CHAR_JP_KATA_GE 99 +#define CHAR_JP_KATA_KO 100 +#define CHAR_JP_KATA_GO 101 +#define CHAR_JP_KATA_SA 102 +#define CHAR_JP_KATA_ZA 103 +#define CHAR_JP_KATA_SI 104 +#define CHAR_JP_KATA_ZI 105 +#define CHAR_JP_KATA_SU 106 +#define CHAR_JP_KATA_ZU 107 +#define CHAR_JP_KATA_SE 108 +#define CHAR_JP_KATA_ZE 109 +#define CHAR_JP_KATA_SO 110 +#define CHAR_JP_KATA_ZO 111 +#define CHAR_JP_KATA_TA 112 +#define CHAR_JP_KATA_DA 113 +#define CHAR_JP_KATA_TI 114 +#define CHAR_JP_KATA_DI 115 +#define CHAR_JP_KATA_TU_SMALL 116 +#define CHAR_JP_KATA_TU 117 +#define CHAR_JP_KATA_DU 118 +#define CHAR_JP_KATA_TE 119 +#define CHAR_JP_KATA_DE 120 +#define CHAR_JP_KATA_TO 121 +#define CHAR_JP_KATA_DO 122 +#define CHAR_JP_KATA_NA 123 +#define CHAR_JP_KATA_NI 124 +#define CHAR_JP_KATA_NU 125 +#define CHAR_JP_KATA_NE 126 +#define CHAR_JP_KATA_NO 127 +#define CHAR_JP_KATA_HA 128 +#define CHAR_JP_KATA_BA 129 +#define CHAR_JP_KATA_PA 130 +#define CHAR_JP_KATA_HI 131 +#define CHAR_JP_KATA_BI 132 +#define CHAR_JP_KATA_PI 133 +#define CHAR_JP_KATA_HU 134 +#define CHAR_JP_KATA_BU 135 +#define CHAR_JP_KATA_PU 136 +#define CHAR_JP_KATA_HE 137 +#define CHAR_JP_KATA_BE 138 +#define CHAR_JP_KATA_PE 139 +#define CHAR_JP_KATA_HO 140 +#define CHAR_JP_KATA_BO 141 +#define CHAR_JP_KATA_PO 142 +#define CHAR_JP_KATA_MA 143 +#define CHAR_JP_KATA_MI 144 +#define CHAR_JP_KATA_MU 145 +#define CHAR_JP_KATA_ME 146 +#define CHAR_JP_KATA_MO 147 +#define CHAR_JP_KATA_YA_SMALL 148 +#define CHAR_JP_KATA_YA 149 +#define CHAR_JP_KATA_YU_SMALL 150 +#define CHAR_JP_KATA_YU 151 +#define CHAR_JP_KATA_YO_SMALL 152 +#define CHAR_JP_KATA_YO 153 +#define CHAR_JP_KATA_RA 154 +#define CHAR_JP_KATA_RI 155 +#define CHAR_JP_KATA_RU 156 +#define CHAR_JP_KATA_RE 157 +#define CHAR_JP_KATA_RO 158 +#define CHAR_JP_KATA_WA 159 +#define CHAR_JP_KATA_WO 160 +#define CHAR_JP_KATA_N_ 161 +#define CHAR_JP_0 162 +#define CHAR_JP_1 163 +#define CHAR_JP_2 164 +#define CHAR_JP_3 165 +#define CHAR_JP_4 166 +#define CHAR_JP_5 167 +#define CHAR_JP_6 168 +#define CHAR_JP_7 169 +#define CHAR_JP_8 170 +#define CHAR_JP_9 171 +#define CHAR_JP_A 172 +#define CHAR_JP_B 173 +#define CHAR_JP_C 174 +#define CHAR_JP_D 175 +#define CHAR_JP_E 176 +#define CHAR_JP_F 177 +#define CHAR_JP_G 178 +#define CHAR_JP_H 179 +#define CHAR_JP_I 180 +#define CHAR_JP_J 181 +#define CHAR_JP_K 182 +#define CHAR_JP_L 183 +#define CHAR_JP_M 184 +#define CHAR_JP_N 185 +#define CHAR_JP_O 186 +#define CHAR_JP_P 187 +#define CHAR_JP_Q 188 +#define CHAR_JP_R 189 +#define CHAR_JP_S 190 +#define CHAR_JP_T 191 +#define CHAR_JP_U 192 +#define CHAR_JP_V 193 +#define CHAR_JP_W 194 +#define CHAR_JP_X 195 +#define CHAR_JP_Y 196 +#define CHAR_JP_Z 197 +#define CHAR_JP_a 198 +#define CHAR_JP_b 199 +#define CHAR_JP_c 200 +#define CHAR_JP_d 201 +#define CHAR_JP_e 202 +#define CHAR_JP_f 203 +#define CHAR_JP_g 204 +#define CHAR_JP_h 205 +#define CHAR_JP_i 206 +#define CHAR_JP_j 207 +#define CHAR_JP_k 208 +#define CHAR_JP_l 209 +#define CHAR_JP_m 210 +#define CHAR_JP_n 211 +#define CHAR_JP_o 212 +#define CHAR_JP_p 213 +#define CHAR_JP_q 214 +#define CHAR_JP_r 215 +#define CHAR_JP_s 216 +#define CHAR_JP_t 217 +#define CHAR_JP_u 218 +#define CHAR_JP_v 219 +#define CHAR_JP_w 220 +#define CHAR_JP_x 221 +#define CHAR_JP_y 222 +#define CHAR_JP_z 223 +#define CHAR_INVALID_E0 224 +#define CHAR_JP_EXCLAM_MARK 225 +#define CHAR_JP_QUESTION_MARK 226 +#define CHAR_JP_COMMA 227 +#define CHAR_JP_FULLSTOP 228 +#define CHAR_JP_ELLIPSIS 229 +#define CHAR_JP_CENTER_DOT 230 +#define CHAR_JP_SLASH 231 +#define CHAR_JP_OPEN_QUOT 232 +#define CHAR_JP_CLOSE_QUOT 233 +#define CHAR_JP_OPEN_DQUOT 234 +#define CHAR_JP_CLOSE_DQUOT 235 +#define CHAR_JP_OPEN_PAREN 236 +#define CHAR_JP_CLOSE_PAREN 237 +#define CHAR_JP_OTOKO 238 +#define CHAR_JP_ONNA 239 +#define CHAR_JP_PLUS 240 +#define CHAR_JP_HYPHEN 241 +#define CHAR_JP_MULT 242 +#define CHAR_JP_DIV 243 +#define CHAR_JP_EQUAL 244 +#define CHAR_JP_TILDE 245 +#define CHAR_JP_HW_COLON 246 +#define CHAR_JP_HW_SEMICOLON 247 +#define CHAR_JP_HW_PERIOD 248 +#define CHAR_JP_HW_COMMA 249 +#define CHAR_JP_SPADE_SUIT 250 +#define CHAR_JP_CLUB_SUIT 251 +#define CHAR_JP_HEART_SUIT 252 +#define CHAR_JP_DIAMOND_SUIT 253 +#define CHAR_JP_STAR 254 +#define CHAR_JP_CIRCLE_DOT 255 +#define CHAR_JP_CIRCLE 256 +#define CHAR_JP_SQUARE 257 +#define CHAR_JP_TRIANGLE 258 +#define CHAR_JP_DIAMOND 259 +#define CHAR_JP_AT 260 +#define CHAR_JP_MUSIC_NOTE 261 +#define CHAR_JP_PERCENT 262 +#define CHAR_JP_SUN 263 +#define CHAR_JP_TREBLE_CLEF 264 +#define CHAR_JP_UMBRELLA 265 +#define CHAR_JP_SNOWMAN 266 +#define CHAR_JP_SMILEY 267 +#define CHAR_JP_LAUGHING 268 +#define CHAR_JP_ANGUISH 269 +#define CHAR_JP_ANGRY 270 +#define CHAR_JP_UP_ARROW 271 +#define CHAR_JP_DOWN_ARROW 272 +#define CHAR_JP_SNORING 273 +#define CHAR_JP_YEN 274 +#define CHAR_JP_ITEMS 275 +#define CHAR_JP_KEY_ITEMS 276 +#define CHAR_JP_TMHM 277 +#define CHAR_JP_MAIL 278 +#define CHAR_JP_MEDICINE 279 +#define CHAR_JP_BERRIES 280 +#define CHAR_JP_BALLS 281 +#define CHAR_JP_BATTLE_ITEMS 282 +#define CHAR_JP_DIR_LEFT 283 +#define CHAR_JP_DIR_UP 284 +#define CHAR_JP_DIR_DOWN 285 +#define CHAR_JP_DIR_RIGHT 286 +#define CHAR_JP_CONTINUE_ARROW 287 +#define CHAR_JP_AMPERSAND 288 +#define CHAR_0 289 +#define CHAR_1 290 +#define CHAR_2 291 +#define CHAR_3 292 +#define CHAR_4 293 +#define CHAR_5 294 +#define CHAR_6 295 +#define CHAR_7 296 +#define CHAR_8 297 +#define CHAR_9 298 +#define CHAR_A 299 +#define CHAR_B 300 +#define CHAR_C 301 +#define CHAR_D 302 +#define CHAR_E 303 +#define CHAR_F 304 +#define CHAR_G 305 +#define CHAR_H 306 +#define CHAR_I 307 +#define CHAR_J 308 +#define CHAR_K 309 +#define CHAR_L 310 +#define CHAR_M 311 +#define CHAR_N 312 +#define CHAR_O 313 +#define CHAR_P 314 +#define CHAR_Q 315 +#define CHAR_R 316 +#define CHAR_S 317 +#define CHAR_T 318 +#define CHAR_U 319 +#define CHAR_V 320 +#define CHAR_W 321 +#define CHAR_X 322 +#define CHAR_Y 323 +#define CHAR_Z 324 +#define CHAR_a 325 +#define CHAR_b 326 +#define CHAR_c 327 +#define CHAR_d 328 +#define CHAR_e 329 +#define CHAR_f 330 +#define CHAR_g 331 +#define CHAR_h 332 +#define CHAR_i 333 +#define CHAR_j 334 +#define CHAR_k 335 +#define CHAR_l 336 +#define CHAR_m 337 +#define CHAR_n 338 +#define CHAR_o 339 +#define CHAR_p 340 +#define CHAR_q 341 +#define CHAR_r 342 +#define CHAR_s 343 +#define CHAR_t 344 +#define CHAR_u 345 +#define CHAR_v 346 +#define CHAR_w 347 +#define CHAR_x 348 +#define CHAR_y 349 +#define CHAR_z 350 +#define CHAR_Agrave 351 +#define CHAR_Aacute 352 +#define CHAR_Acarat 353 +#define CHAR_Atilde 354 +#define CHAR_Aumlaut 355 +#define CHAR_Aring 356 +#define CHAR_AE 357 +#define CHAR_Ccedilla 358 +#define CHAR_Egrave 359 +#define CHAR_Eacute 360 +#define CHAR_Ecarat 361 +#define CHAR_Eumlaut 362 +#define CHAR_Igrave 363 +#define CHAR_Iacute 364 +#define CHAR_Icarat 365 +#define CHAR_Iumlaut 366 +#define CHAR_ETH 367 +#define CHAR_Ntilde 368 +#define CHAR_Ograve 369 +#define CHAR_Oacute 370 +#define CHAR_Ocarat 371 +#define CHAR_Otilde 372 +#define CHAR_Oumlaut 373 +#define CHAR_MULT 374 +#define CHAR_Oslash 375 +#define CHAR_Ugrave 376 +#define CHAR_Uacute 377 +#define CHAR_Ucarat 378 +#define CHAR_Uumlaut 379 +#define CHAR_Yacute 380 +#define CHAR_THORN 381 +#define CHAR_ESZETT 382 +#define CHAR_agrave 383 +#define CHAR_aacute 384 +#define CHAR_acarat 385 +#define CHAR_atilde 386 +#define CHAR_aumlaut 387 +#define CHAR_aring 388 +#define CHAR_ae 389 +#define CHAR_ccedilla 390 +#define CHAR_egrave 391 +#define CHAR_eacute 392 +#define CHAR_ecarat 393 +#define CHAR_eumlaut 394 +#define CHAR_igrave 395 +#define CHAR_iacute 396 +#define CHAR_icarat 397 +#define CHAR_iumlaut 398 +#define CHAR_eth 399 +#define CHAR_ntilde 400 +#define CHAR_ograve 401 +#define CHAR_oacute 402 +#define CHAR_ocarat 403 +#define CHAR_otilde 404 +#define CHAR_oumlaut 405 +#define CHAR_div 406 +#define CHAR_oslash 407 +#define CHAR_ugrave 408 +#define CHAR_uacute 409 +#define CHAR_ucarat 410 +#define CHAR_uumlaut 411 +#define CHAR_yacute 412 +#define CHAR_thorm 413 +#define CHAR_eszett 414 +#define CHAR_OE 415 +#define CHAR_oe 416 +#define CHAR_Scedilla 417 +#define CHAR_scedilla 418 +#define CHAR_super_a 419 // latin f ordinal +#define CHAR_super_o 420 // latin m ordinal +#define CHAR_super_er 421 +#define CHAR_super_re 422 +#define CHAR_super_r 423 +#define CHAR_POKEMONEY 424 +#define CHAR_UPSIDEDOWN_EXCL 425 +#define CHAR_UPSIDEDOWN_QMARK 426 +#define CHAR_EXCL 427 +#define CHAR_QMARK 428 +#define CHAR_COMMA 429 +#define CHAR_PERIOD 430 +#define CHAR_ELLIPSIS 431 +#define CHAR_CTRDOT 432 +#define CHAR_SLASH 433 +#define CHAR_LAPOST 434 // left single quote +#define CHAR_RAPOST 435 // right single quote (apostrophe) +#define CHAR_LDQUOT 436 // left double quote +#define CHAR_RDQUOT 437 // right double quote +#define CHAR_LOW_RDQUOT 438 +#define CHAR_FR_LQUOT 439 +#define CHAR_FR_RQUOT 440 +#define CHAR_LPAREN 441 +#define CHAR_RPAREN 442 +#define CHAR_MALE 443 +#define CHAR_FEMALE 444 +#define CHAR_PLUS 445 +#define CHAR_HYPHEN 446 +#define CHAR_ASTERISK 447 +#define CHAR_HASH 448 +#define CHAR_EQUALS 449 +#define CHAR_AMPERSAND 450 +#define CHAR_TILDE 451 +#define CHAR_COLON 452 +#define CHAR_SEMICOLON 453 +#define CHAR_SPADE_SUIT 454 +#define CHAR_CLUB_SUIT 455 +#define CHAR_HEART_SUIT 456 +#define CHAR_DIAMOND_SUIT 457 +#define CHAR_STAR 458 +#define CHAR_CIRCLE_DOT 459 +#define CHAR_CIRCLE 460 +#define CHAR_SQUARE 461 +#define CHAR_TRIANGLE 462 +#define CHAR_DIAMOND 463 +#define CHAR_AT 464 +#define CHAR_MUSIC_NOTE 465 +#define CHAR_PERCENT 466 +#define CHAR_SUN 467 +#define CHAR_TREBLE_CLEF 468 +#define CHAR_UMBRELLA 469 +#define CHAR_SNOWMAN 470 +#define CHAR_SMILEY 471 +#define CHAR_LAUGHING 472 +#define CHAR_ANGUISH 473 +#define CHAR_ANGRY 474 +#define CHAR_UP_ARROW 475 +#define CHAR_DOWN_ARROW 476 +#define CHAR_SNORING 477 +#define CHAR_SPACE 478 +#define CHAR_super_e 479 +#define CHAR_PK 480 +#define CHAR_MN 481 +#define CHAR_NARROW_SPACE 482 +#define CHAR_FILL1PX 483 +#define CHAR_FILL2PX 484 +#define CHAR_FILL4PX 485 +#define CHAR_FILL8PX 486 +#define CHAR_FILL16PX 487 +#define CHAR_DEGREE 488 +#define CHAR_UNDERSCORE 489 +#define CHAR_UNDERSCORE2 490 +#define CHAR_ONE_DOT 491 +#define CHAR_TWO_DOTS 492 #define CHAR_LF 0xE000 #define TRNAMECODE 0xF100 diff --git a/src/naming_screen.c b/src/naming_screen.c index 896ba8fb16..3d6f7f1904 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -32,20 +32,18 @@ #include "unk_020183F0.h" #include "vram_transfer_manager.h" -enum { - NAME_SCREEN_BUTTON_D001 = 0xD001, - NAME_SCREEN_BUTTON_D002 = 0xD002, - NAME_SCREEN_BUTTON_D003 = 0xD003, - NAME_SCREEN_BUTTON_D004 = 0xD004, - NAME_SCREEN_BUTTON_E001 = 0xE001, - NAME_SCREEN_BUTTON_PAGE_UPPER = 0xE002, - NAME_SCREEN_BUTTON_PAGE_LOWER = 0xE003, - NAME_SCREEN_BUTTON_PAGE_SYMBOLS = 0xE004, - NAME_SCREEN_BUTTON_PAGE_JP_UNUSED = 0xE005, - NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2 = 0xE006, - NAME_SCREEN_BUTTON_E007 = 0xE007, - NAME_SCREEN_BUTTON_E008 = 0xE008, -}; +#define NAME_SCREEN_CONTROL_DAKU 0xD001 // unused +#define NAME_SCREEN_CONTROL_HANDAKU 0xD002 // unused +#define NAME_SCREEN_CONTROL_SPACE 0xD003 // unused +#define NAME_SCREEN_CONTROL_SKIP 0xD004 // unused but because it's greyed out +#define NAME_SCREEN_BUTTON_START 0xE001 +#define NAME_SCREEN_BUTTON_PAGE_UPPER 0xE002 +#define NAME_SCREEN_BUTTON_PAGE_LOWER 0xE003 +#define NAME_SCREEN_BUTTON_PAGE_SYMBOLS 0xE004 +#define NAME_SCREEN_BUTTON_PAGE_JP_UNUSED 0xE005 +#define NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2 0xE006 +#define NAME_SCREEN_BUTTON_BACK 0xE007 +#define NAME_SCREEN_BUTTON_OK 0xE008 typedef struct NamingScreenAppData { NameScreenType type; @@ -186,16 +184,16 @@ static const int _021021E8[][4] = { { 0x1A, 0x5B, 0x27, 0x00 }, }; -static const u16 _02101DBE[] = { NAME_SCREEN_BUTTON_PAGE_UPPER, NAME_SCREEN_BUTTON_PAGE_UPPER, NAME_SCREEN_BUTTON_PAGE_LOWER, NAME_SCREEN_BUTTON_PAGE_LOWER, NAME_SCREEN_BUTTON_PAGE_SYMBOLS, NAME_SCREEN_BUTTON_PAGE_SYMBOLS, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E008, NAME_SCREEN_BUTTON_E008 }; +static const u16 sKeyboardHomeRow_All[] = { NAME_SCREEN_BUTTON_PAGE_UPPER, NAME_SCREEN_BUTTON_PAGE_UPPER, NAME_SCREEN_BUTTON_PAGE_LOWER, NAME_SCREEN_BUTTON_PAGE_LOWER, NAME_SCREEN_BUTTON_PAGE_SYMBOLS, NAME_SCREEN_BUTTON_PAGE_SYMBOLS, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_OK, NAME_SCREEN_BUTTON_OK }; -static const u16 _02101DD8[] = { NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_D004, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E007, NAME_SCREEN_BUTTON_E008, NAME_SCREEN_BUTTON_E008 }; +static const u16 sKeyboardHomeRow_Numpad[] = { NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_OK, NAME_SCREEN_BUTTON_OK }; static const u16 *sKeyboardHomeRowLayoutPtrs[] = { - _02101DBE, - _02101DBE, - _02101DBE, - _02101DBE, - _02101DD8, + sKeyboardHomeRow_All, + sKeyboardHomeRow_All, + sKeyboardHomeRow_All, + sKeyboardHomeRow_All, + sKeyboardHomeRow_Numpad, }; static const u16 _02101D80[] = { @@ -249,141 +247,142 @@ static const u16 sKeyboardRow_Symbols_4[] = { CHAR_CIRCLE_DOT, CHAR_CIRCLE, CHAR static const u16 sKeyboardRow_Symbols_5[] = { CHAR_SUN, CHAR_TREBLE_CLEF, CHAR_UMBRELLA, CHAR_SNOWMAN, CHAR_SMILEY, CHAR_LAUGHING, CHAR_ANGUISH, CHAR_ANGRY, CHAR_SNORING, CHAR_UP_ARROW, CHAR_DOWN_ARROW, CHAR_SPACE, CHAR_SPACE, EOS }; -static const u16 sKeyboardRow_FullWidthEN_1[] = { 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, CHAR_JP_SPACE, 0x00E1, 0x00E2, EOS }; +static const u16 sKeyboardRow_JPMisc_1[] = { CHAR_JP_0, CHAR_JP_1, CHAR_JP_2, CHAR_JP_3, CHAR_JP_4, CHAR_JP_5, CHAR_JP_6, CHAR_JP_7, CHAR_JP_8, CHAR_JP_9, CHAR_JP_SPACE, CHAR_JP_EXCLAM_MARK, CHAR_JP_QUESTION_MARK, EOS }; -static const u16 sKeyboardRow_FullWidthEN_2[] = { 0x00E3, 0x00E4, 0x00F9, 0x00F8, 0x00E5, 0x00E6, 0x00F5, 0x00F6, 0x00F7, 0x00E7, CHAR_JP_SPACE, 0x00EE, 0x00EF, EOS }; +static const u16 sKeyboardRow_JPMisc_2[] = { CHAR_JP_COMMA, CHAR_JP_FULLSTOP, CHAR_JP_HW_COMMA, CHAR_JP_HW_PERIOD, CHAR_JP_ELLIPSIS, CHAR_JP_CENTER_DOT, CHAR_JP_TILDE, CHAR_JP_HW_COLON, CHAR_JP_HW_SEMICOLON, CHAR_JP_SLASH, CHAR_JP_SPACE, CHAR_JP_OTOKO, CHAR_JP_ONNA, EOS }; -static const u16 sKeyboardRow_FullWidthEN_3[] = { 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0106, 0x0104, EOS }; +static const u16 sKeyboardRow_JPMisc_3[] = { CHAR_JP_OPEN_QUOT, CHAR_JP_CLOSE_QUOT, CHAR_JP_OPEN_DQUOT, CHAR_JP_CLOSE_DQUOT, CHAR_JP_OPEN_PAREN, CHAR_JP_CLOSE_PAREN, CHAR_JP_PLUS, CHAR_JP_HYPHEN, CHAR_JP_MULT, CHAR_JP_DIV, CHAR_JP_EQUAL, CHAR_JP_PERCENT, CHAR_JP_AT, EOS }; -static const u16 sKeyboardRow_FullWidthEN_4[] = { 0x00FF, 0x0100, 0x0101, 0x0102, 0x0103, 0x00FC, 0x00FA, 0x00FD, 0x00FB, 0x00FE, 0x0105, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; +static const u16 sKeyboardRow_JPMisc_4[] = { CHAR_JP_CIRCLE_DOT, CHAR_JP_CIRCLE, CHAR_JP_SQUARE, CHAR_JP_TRIANGLE, CHAR_JP_DIAMOND, CHAR_JP_HEART_SUIT, CHAR_JP_SPADE_SUIT, CHAR_JP_DIAMOND_SUIT, CHAR_JP_CLUB_SUIT, CHAR_JP_STAR, CHAR_JP_MUSIC_NOTE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; -static const u16 sKeyboardRow_FullWidthEN_5[] = { 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x0111, 0x010F, 0x0110, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; +static const u16 sKeyboardRow_JPMisc_5[] = { CHAR_JP_SUN, CHAR_JP_TREBLE_CLEF, CHAR_JP_UMBRELLA, CHAR_JP_SNOWMAN, CHAR_JP_SMILEY, CHAR_JP_LAUGHING, CHAR_JP_ANGUISH, CHAR_JP_ANGRY, CHAR_JP_SNORING, CHAR_JP_UP_ARROW, CHAR_JP_DOWN_ARROW, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; -static const u16 sKeyboardRow_Numpad_1[] = { 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; +static const u16 sKeyboardRow_Numpad_1[] = { CHAR_0, CHAR_1, CHAR_2, CHAR_3, CHAR_4, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; -static const u16 sKeyboardRow_Numpad_2[] = { 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; +static const u16 sKeyboardRow_Numpad_2[] = { CHAR_5, CHAR_6, CHAR_7, CHAR_8, CHAR_9, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; static const u16 sKeyboardRow_Numpad_345[] = { CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; static const u16 *sKeyboardLayoutPtrs[][5] = { - { sKeyboardRow_Upper_1, sKeyboardRow_Upper_2, sKeyboardRow_Upper_3, sKeyboardRow_Upper_4, sKeyboardRow_Upper_5 }, - { sKeyboardRow_Lower_1, sKeyboardRow_Lower_2, sKeyboardRow_Lower_3, sKeyboardRow_Lower_4, sKeyboardRow_Lower_5 }, - { sKeyboardRow_Symbols_1, sKeyboardRow_Symbols_2, sKeyboardRow_Symbols_3, sKeyboardRow_Symbols_4, sKeyboardRow_Symbols_5 }, - { sKeyboardRow_FullWidthEN_1, sKeyboardRow_FullWidthEN_2, sKeyboardRow_FullWidthEN_3, sKeyboardRow_FullWidthEN_4, sKeyboardRow_FullWidthEN_5 }, - { sKeyboardRow_Numpad_1, sKeyboardRow_Numpad_2, sKeyboardRow_Numpad_345, sKeyboardRow_Numpad_345, sKeyboardRow_Numpad_345 }, + { sKeyboardRow_Upper_1, sKeyboardRow_Upper_2, sKeyboardRow_Upper_3, sKeyboardRow_Upper_4, sKeyboardRow_Upper_5 }, + { sKeyboardRow_Lower_1, sKeyboardRow_Lower_2, sKeyboardRow_Lower_3, sKeyboardRow_Lower_4, sKeyboardRow_Lower_5 }, + { sKeyboardRow_Symbols_1, sKeyboardRow_Symbols_2, sKeyboardRow_Symbols_3, sKeyboardRow_Symbols_4, sKeyboardRow_Symbols_5 }, + { sKeyboardRow_JPMisc_1, sKeyboardRow_JPMisc_2, sKeyboardRow_JPMisc_3, sKeyboardRow_JPMisc_4, sKeyboardRow_JPMisc_5 }, + { sKeyboardRow_Numpad_1, sKeyboardRow_Numpad_2, sKeyboardRow_Numpad_345, sKeyboardRow_Numpad_345, sKeyboardRow_Numpad_345 }, }; +// These arrays are used to convert Japanese characters in response to pressing select. static const u16 _02102422[][3] = { - { 0x0003, CHAR_JP_SPACE, 0x0002 }, - { 0x0005, CHAR_JP_SPACE, 0x0004 }, - { 0x0007, CHAR_JP_SPACE, 0x0006 }, - { 0x0009, CHAR_JP_SPACE, 0x0008 }, - { 0x000B, CHAR_JP_SPACE, 0x000A }, - { 0x0053, CHAR_JP_SPACE, 0x0052 }, - { 0x0055, CHAR_JP_SPACE, 0x0054 }, - { 0x0057, CHAR_JP_SPACE, 0x0056 }, - { 0x0059, CHAR_JP_SPACE, 0x0058 }, - { 0x005B, CHAR_JP_SPACE, 0x005A }, - { 0x0045, CHAR_JP_SPACE, 0x0044 }, - { 0x0047, CHAR_JP_SPACE, 0x0046 }, - { 0x0049, CHAR_JP_SPACE, 0x0048 }, - { 0x0095, CHAR_JP_SPACE, 0x0094 }, - { 0x0097, CHAR_JP_SPACE, 0x0096 }, - { 0x0099, CHAR_JP_SPACE, 0x0098 }, - { 0x00AC, CHAR_JP_SPACE, 0x00C6 }, - { 0x00AD, CHAR_JP_SPACE, 0x00C7 }, - { 0x00AE, CHAR_JP_SPACE, 0x00C8 }, - { 0x00AF, CHAR_JP_SPACE, 0x00C9 }, - { 0x00B0, CHAR_JP_SPACE, 0x00CA }, - { 0x00B1, CHAR_JP_SPACE, 0x00CB }, - { 0x00B2, CHAR_JP_SPACE, 0x00CC }, - { 0x00B3, CHAR_JP_SPACE, 0x00CD }, - { 0x00B4, CHAR_JP_SPACE, 0x00CE }, - { 0x00B5, CHAR_JP_SPACE, 0x00CF }, - { 0x00B6, CHAR_JP_SPACE, 0x00D0 }, - { 0x00B7, CHAR_JP_SPACE, 0x00D1 }, - { 0x00B8, CHAR_JP_SPACE, 0x00D2 }, - { 0x00B9, CHAR_JP_SPACE, 0x00D3 }, - { 0x00BA, CHAR_JP_SPACE, 0x00D4 }, - { 0x00BB, CHAR_JP_SPACE, 0x00D5 }, - { 0x00BC, CHAR_JP_SPACE, 0x00D6 }, - { 0x00BD, CHAR_JP_SPACE, 0x00D7 }, - { 0x00BE, CHAR_JP_SPACE, 0x00D8 }, - { 0x00BF, CHAR_JP_SPACE, 0x00D9 }, - { 0x00C0, CHAR_JP_SPACE, 0x00DA }, - { 0x00C1, CHAR_JP_SPACE, 0x00DB }, - { 0x00C2, CHAR_JP_SPACE, 0x00DC }, - { 0x00C3, CHAR_JP_SPACE, 0x00DD }, - { 0x00C4, CHAR_JP_SPACE, 0x00DE }, - { 0x00C5, CHAR_JP_SPACE, 0x00DF }, - { 0x0025, 0x0026, 0x0024 }, - { 0x0075, 0x0076, 0x0074 }, - { 0x000C, 0x000D, CHAR_JP_SPACE }, - { 0x000E, 0x000F, CHAR_JP_SPACE }, - { 0x0010, 0x0011, CHAR_JP_SPACE }, - { 0x0012, 0x0013, CHAR_JP_SPACE }, - { 0x0014, 0x0015, CHAR_JP_SPACE }, - { 0x0016, 0x0017, CHAR_JP_SPACE }, - { 0x0018, 0x0019, CHAR_JP_SPACE }, - { 0x001A, 0x001B, CHAR_JP_SPACE }, - { 0x001C, 0x001D, CHAR_JP_SPACE }, - { 0x001E, 0x001F, CHAR_JP_SPACE }, - { 0x0020, 0x0021, CHAR_JP_SPACE }, - { 0x0022, 0x0023, CHAR_JP_SPACE }, - { 0x0027, 0x0028, CHAR_JP_SPACE }, - { 0x0029, 0x002A, CHAR_JP_SPACE }, - { 0x005C, 0x005D, CHAR_JP_SPACE }, - { 0x005E, 0x005F, CHAR_JP_SPACE }, - { 0x0060, 0x0061, CHAR_JP_SPACE }, - { 0x0062, 0x0063, CHAR_JP_SPACE }, - { 0x0064, 0x0065, CHAR_JP_SPACE }, - { 0x0066, 0x0067, CHAR_JP_SPACE }, - { 0x0068, 0x0069, CHAR_JP_SPACE }, - { 0x006A, 0x006B, CHAR_JP_SPACE }, - { 0x006C, 0x006D, CHAR_JP_SPACE }, - { 0x006E, 0x006F, CHAR_JP_SPACE }, - { 0x0070, 0x0071, CHAR_JP_SPACE }, - { 0x0072, 0x0073, CHAR_JP_SPACE }, - { 0x0077, 0x0078, CHAR_JP_SPACE }, - { 0x0079, 0x007A, CHAR_JP_SPACE }, - { 0x0030, 0x0031, 0x0032 }, - { 0x0033, 0x0034, 0x0035 }, - { 0x0036, 0x0037, 0x0038 }, - { 0x0039, 0x003A, 0x003B }, - { 0x003C, 0x003D, 0x003E }, - { 0x0080, 0x0081, 0x0082 }, - { 0x0083, 0x0084, 0x0085 }, - { 0x0086, 0x0087, 0x0088 }, - { 0x0089, 0x008A, 0x008B }, - { 0x008C, 0x008D, 0x008E }, + { CHAR_JP_HIRA_A, CHAR_JP_SPACE, CHAR_JP_HIRA_A_SMALL }, + { CHAR_JP_HIRA_I, CHAR_JP_SPACE, CHAR_JP_HIRA_I_SMALL }, + { CHAR_JP_HIRA_U, CHAR_JP_SPACE, CHAR_JP_HIRA_U_SMALL }, + { CHAR_JP_HIRA_E, CHAR_JP_SPACE, CHAR_JP_HIRA_E_SMALL }, + { CHAR_JP_HIRA_O, CHAR_JP_SPACE, CHAR_JP_HIRA_O_SMALL }, + { CHAR_JP_KATA_A, CHAR_JP_SPACE, CHAR_JP_KATA_A_SMALL }, + { CHAR_JP_KATA_I, CHAR_JP_SPACE, CHAR_JP_KATA_I_SMALL }, + { CHAR_JP_KATA_U, CHAR_JP_SPACE, CHAR_JP_KATA_U_SMALL }, + { CHAR_JP_KATA_E, CHAR_JP_SPACE, CHAR_JP_KATA_E_SMALL }, + { CHAR_JP_KATA_O, CHAR_JP_SPACE, CHAR_JP_KATA_O_SMALL }, + { CHAR_JP_HIRA_YA, CHAR_JP_SPACE, CHAR_JP_HIRA_YA_SMALL }, + { CHAR_JP_HIRA_YU, CHAR_JP_SPACE, CHAR_JP_HIRA_YU_SMALL }, + { CHAR_JP_HIRA_YO, CHAR_JP_SPACE, CHAR_JP_HIRA_YO_SMALL }, + { CHAR_JP_KATA_YA, CHAR_JP_SPACE, CHAR_JP_KATA_YA_SMALL }, + { CHAR_JP_KATA_YU, CHAR_JP_SPACE, CHAR_JP_KATA_YU_SMALL }, + { CHAR_JP_KATA_YO, CHAR_JP_SPACE, CHAR_JP_KATA_YO_SMALL }, + { CHAR_JP_A, CHAR_JP_SPACE, CHAR_JP_a }, + { CHAR_JP_B, CHAR_JP_SPACE, CHAR_JP_b }, + { CHAR_JP_C, CHAR_JP_SPACE, CHAR_JP_c }, + { CHAR_JP_D, CHAR_JP_SPACE, CHAR_JP_d }, + { CHAR_JP_E, CHAR_JP_SPACE, CHAR_JP_e }, + { CHAR_JP_F, CHAR_JP_SPACE, CHAR_JP_f }, + { CHAR_JP_G, CHAR_JP_SPACE, CHAR_JP_g }, + { CHAR_JP_H, CHAR_JP_SPACE, CHAR_JP_h }, + { CHAR_JP_I, CHAR_JP_SPACE, CHAR_JP_i }, + { CHAR_JP_J, CHAR_JP_SPACE, CHAR_JP_j }, + { CHAR_JP_K, CHAR_JP_SPACE, CHAR_JP_k }, + { CHAR_JP_L, CHAR_JP_SPACE, CHAR_JP_l }, + { CHAR_JP_M, CHAR_JP_SPACE, CHAR_JP_m }, + { CHAR_JP_N, CHAR_JP_SPACE, CHAR_JP_n }, + { CHAR_JP_O, CHAR_JP_SPACE, CHAR_JP_o }, + { CHAR_JP_P, CHAR_JP_SPACE, CHAR_JP_p }, + { CHAR_JP_Q, CHAR_JP_SPACE, CHAR_JP_q }, + { CHAR_JP_R, CHAR_JP_SPACE, CHAR_JP_r }, + { CHAR_JP_S, CHAR_JP_SPACE, CHAR_JP_s }, + { CHAR_JP_T, CHAR_JP_SPACE, CHAR_JP_t }, + { CHAR_JP_U, CHAR_JP_SPACE, CHAR_JP_u }, + { CHAR_JP_V, CHAR_JP_SPACE, CHAR_JP_v }, + { CHAR_JP_W, CHAR_JP_SPACE, CHAR_JP_w }, + { CHAR_JP_X, CHAR_JP_SPACE, CHAR_JP_x }, + { CHAR_JP_Y, CHAR_JP_SPACE, CHAR_JP_y }, + { CHAR_JP_Z, CHAR_JP_SPACE, CHAR_JP_z }, + { CHAR_JP_HIRA_TU, CHAR_JP_HIRA_DU, CHAR_JP_HIRA_TU_SMALL }, + { CHAR_JP_KATA_TU, CHAR_JP_KATA_DU, CHAR_JP_KATA_TU_SMALL }, + { CHAR_JP_HIRA_KA, CHAR_JP_HIRA_GA, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_KI, CHAR_JP_HIRA_GI, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_KU, CHAR_JP_HIRA_GU, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_KE, CHAR_JP_HIRA_GE, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_KO, CHAR_JP_HIRA_GO, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_SA, CHAR_JP_HIRA_ZA, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_SI, CHAR_JP_HIRA_ZI, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_SU, CHAR_JP_HIRA_ZU, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_SE, CHAR_JP_HIRA_ZE, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_SO, CHAR_JP_HIRA_ZO, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_TA, CHAR_JP_HIRA_DA, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_TI, CHAR_JP_HIRA_DI, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_TE, CHAR_JP_HIRA_DE, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_TO, CHAR_JP_HIRA_DO, CHAR_JP_SPACE }, + { CHAR_JP_KATA_KA, CHAR_JP_KATA_GA, CHAR_JP_SPACE }, + { CHAR_JP_KATA_KI, CHAR_JP_KATA_GI, CHAR_JP_SPACE }, + { CHAR_JP_KATA_KU, CHAR_JP_KATA_GU, CHAR_JP_SPACE }, + { CHAR_JP_KATA_KE, CHAR_JP_KATA_GE, CHAR_JP_SPACE }, + { CHAR_JP_KATA_KO, CHAR_JP_KATA_GO, CHAR_JP_SPACE }, + { CHAR_JP_KATA_SA, CHAR_JP_KATA_ZA, CHAR_JP_SPACE }, + { CHAR_JP_KATA_SI, CHAR_JP_KATA_ZI, CHAR_JP_SPACE }, + { CHAR_JP_KATA_SU, CHAR_JP_KATA_ZU, CHAR_JP_SPACE }, + { CHAR_JP_KATA_SE, CHAR_JP_KATA_ZE, CHAR_JP_SPACE }, + { CHAR_JP_KATA_SO, CHAR_JP_KATA_ZO, CHAR_JP_SPACE }, + { CHAR_JP_KATA_TA, CHAR_JP_KATA_DA, CHAR_JP_SPACE }, + { CHAR_JP_KATA_TI, CHAR_JP_KATA_DI, CHAR_JP_SPACE }, + { CHAR_JP_KATA_TE, CHAR_JP_KATA_DE, CHAR_JP_SPACE }, + { CHAR_JP_KATA_TO, CHAR_JP_KATA_DO, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_HA, CHAR_JP_HIRA_BA, CHAR_JP_HIRA_PA }, + { CHAR_JP_HIRA_HI, CHAR_JP_HIRA_BI, CHAR_JP_HIRA_PI }, + { CHAR_JP_HIRA_HU, CHAR_JP_HIRA_BU, CHAR_JP_HIRA_PU }, + { CHAR_JP_HIRA_HE, CHAR_JP_HIRA_BE, CHAR_JP_HIRA_PE }, + { CHAR_JP_HIRA_HO, CHAR_JP_HIRA_BO, CHAR_JP_HIRA_PO }, + { CHAR_JP_KATA_HA, CHAR_JP_KATA_BA, CHAR_JP_KATA_PA }, + { CHAR_JP_KATA_HI, CHAR_JP_KATA_BI, CHAR_JP_KATA_PI }, + { CHAR_JP_KATA_HU, CHAR_JP_KATA_BU, CHAR_JP_KATA_PU }, + { CHAR_JP_KATA_HE, CHAR_JP_KATA_BE, CHAR_JP_KATA_PE }, + { CHAR_JP_KATA_HO, CHAR_JP_KATA_BO, CHAR_JP_KATA_PO }, }; static const u16 _021021B8[][2] = { - { 0x0024, 0x0026 }, - { 0x0074, 0x0076 }, - { 0x0032, 0x0031 }, - { 0x0035, 0x0034 }, - { 0x0038, 0x0037 }, - { 0x003B, 0x003A }, - { 0x003E, 0x003D }, - { 0x0082, 0x0081 }, - { 0x0085, 0x0084 }, - { 0x0088, 0x0087 }, - { 0x008B, 0x008A }, - { 0x008E, 0x008D }, + { CHAR_JP_HIRA_TU_SMALL, CHAR_JP_HIRA_DU }, + { CHAR_JP_KATA_TU_SMALL, CHAR_JP_KATA_DU }, + { CHAR_JP_HIRA_PA, CHAR_JP_HIRA_BA }, + { CHAR_JP_HIRA_PI, CHAR_JP_HIRA_BI }, + { CHAR_JP_HIRA_PU, CHAR_JP_HIRA_BU }, + { CHAR_JP_HIRA_PE, CHAR_JP_HIRA_BE }, + { CHAR_JP_HIRA_PO, CHAR_JP_HIRA_BO }, + { CHAR_JP_KATA_PA, CHAR_JP_KATA_BA }, + { CHAR_JP_KATA_PI, CHAR_JP_KATA_BI }, + { CHAR_JP_KATA_PU, CHAR_JP_KATA_BU }, + { CHAR_JP_KATA_PE, CHAR_JP_KATA_BE }, + { CHAR_JP_KATA_PO, CHAR_JP_KATA_BO }, }; static const u16 _02102190[][2] = { - { 0x0031, 0x0032 }, - { 0x0034, 0x0035 }, - { 0x0037, 0x0038 }, - { 0x003A, 0x003B }, - { 0x003D, 0x003E }, - { 0x0081, 0x0082 }, - { 0x0084, 0x0085 }, - { 0x0087, 0x0088 }, - { 0x008A, 0x008B }, - { 0x008D, 0x008E }, + { CHAR_JP_HIRA_BA, CHAR_JP_HIRA_PA }, + { CHAR_JP_HIRA_BI, CHAR_JP_HIRA_PI }, + { CHAR_JP_HIRA_BU, CHAR_JP_HIRA_PU }, + { CHAR_JP_HIRA_BE, CHAR_JP_HIRA_PE }, + { CHAR_JP_HIRA_BO, CHAR_JP_HIRA_PO }, + { CHAR_JP_KATA_BA, CHAR_JP_KATA_PA }, + { CHAR_JP_KATA_BI, CHAR_JP_KATA_PI }, + { CHAR_JP_KATA_BU, CHAR_JP_KATA_PU }, + { CHAR_JP_KATA_BE, CHAR_JP_KATA_PE }, + { CHAR_JP_KATA_BO, CHAR_JP_KATA_PO }, }; static const int _02101D54[] = { @@ -399,17 +398,20 @@ static const u8 _02101D40[] = { 0x0A, }; -const u16 _02101D90[] = { 0x0003, 0x002B, 0x0020, 0x002F, CHAR_JP_SPACE, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, EOS }; +// These were intended for the Japanese build, but their purpose was replaced with GMM. +// The arrays still appear in the final English ROM. +const u16 sPrompt_YourName[] = { CHAR_JP_HIRA_A, CHAR_JP_HIRA_NA, CHAR_JP_HIRA_TA, CHAR_JP_HIRA_NO, CHAR_JP_SPACE, CHAR_JP_HIRA_NA, CHAR_JP_HIRA_MA, CHAR_JP_HIRA_E, CHAR_JP_HIRA_HA, CHAR_JP_QUESTION_MARK, EOS }; -// ポケモンの ニックネ-ムは? -const u16 _02102094[] = { 0x008E, 0x0062, 0x0093, 0x00A1, 0x002F, CHAR_JP_SPACE, 0x007C, 0x0074, 0x0060, 0x007E, 0x00F1, 0x0091, 0x0030, 0x00E2, EOS }; +const u16 sPrompt_PokemonsNickname[] = { CHAR_JP_KATA_PO, CHAR_JP_KATA_KE, CHAR_JP_KATA_MO, CHAR_JP_KATA_N_, CHAR_JP_HIRA_NO, CHAR_JP_SPACE, CHAR_JP_KATA_NI, CHAR_JP_KATA_TU_SMALL, CHAR_JP_KATA_KU, CHAR_JP_KATA_NE, CHAR_JP_HYPHEN, CHAR_JP_KATA_MU, CHAR_JP_HIRA_HA, CHAR_JP_QUESTION_MARK, EOS }; -const u16 _02101DA6[] = { 0x008D, 0x0074, 0x0060, 0x006A, 0x002F, CHAR_JP_SPACE, 0x002B, 0x003F, 0x0009, 0x0030, 0x00E2, EOS }; +const u16 sPrompt_BoxName[] = { CHAR_JP_KATA_BO, CHAR_JP_KATA_TU_SMALL, CHAR_JP_KATA_KU, CHAR_JP_KATA_SU, CHAR_JP_HIRA_NO, CHAR_JP_SPACE, CHAR_JP_HIRA_NA, CHAR_JP_HIRA_MA, CHAR_JP_HIRA_E, CHAR_JP_HIRA_HA, CHAR_JP_QUESTION_MARK, EOS }; +// Required to force the above three arrays to appear in the final ROM. +// This pointer array does not appear in the final ROM. static const u16 *sDeadstrippedPointersTable[] = { - _02101D90, - _02102094, - _02101DA6, + sPrompt_YourName, + sPrompt_PokemonsNickname, + sPrompt_BoxName, }; static const int _021020B4[] = { @@ -593,7 +595,7 @@ static int sub_02082CF8(NamingScreenAppData *data, int a1) { } else if (data->isTouchInput == TRUE) { ret = sub_02084884(data, data->keyboard[data->cursorY][data->cursorX], FALSE); } else if (gSystem.newKeys & PAD_BUTTON_B) { - ret = sub_02084884(data, NAME_SCREEN_BUTTON_E007, TRUE); + ret = sub_02084884(data, NAME_SCREEN_BUTTON_BACK, TRUE); } else if (gSystem.newKeys & PAD_BUTTON_R) { ret = sub_02084884(data, NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2, TRUE); } @@ -1352,8 +1354,8 @@ static void sub_02084274(NamingScreenAppData *data, int dpadMovement) { u16 sp0 = data->keyboard[data->cursorY][data->cursorX]; int newX = sub_02084264(data->cursorX + _02102168[dpadMovement][0], 0, 13); int newY = sub_02084264(data->cursorY + _02102168[dpadMovement][1], 0, 6); - while (data->keyboard[newY][newX] == NAME_SCREEN_BUTTON_D004 || (data->keyboard[newY][newX] == sp0 && data->keyboard[newY][newX] > NAME_SCREEN_BUTTON_E001)) { - if (data->unk_028 == 0 && data->keyboard[newY][newX] == NAME_SCREEN_BUTTON_D004 && _02102168[dpadMovement][1] != 0) { + while (data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP || (data->keyboard[newY][newX] == sp0 && data->keyboard[newY][newX] > NAME_SCREEN_BUTTON_START)) { + if (data->unk_028 == 0 && data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP && _02102168[dpadMovement][1] != 0) { newX = sub_02084264(newX + data->unk_02C, 0, 13); } else { newX = sub_02084264(newX + _02102168[dpadMovement][0], 0, 13); @@ -1469,10 +1471,10 @@ static void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int u16 sp38[2]; String *string = String_New(2, HEAP_ID_NAMING_SCREEN); while (rawChars[i] != EOS) { - if (rawChars[i] == NAME_SCREEN_BUTTON_D001 || rawChars[i] == NAME_SCREEN_BUTTON_D002 || rawChars[i] == NAME_SCREEN_BUTTON_D003) { - u16 buttonId = rawChars[i] - NAME_SCREEN_BUTTON_D001; + if (rawChars[i] == NAME_SCREEN_CONTROL_DAKU || rawChars[i] == NAME_SCREEN_CONTROL_HANDAKU || rawChars[i] == NAME_SCREEN_CONTROL_SPACE) { + u16 buttonId = rawChars[i] - NAME_SCREEN_CONTROL_DAKU; BlitBitmapRectToWindow(window, buttonPixels + (buttonId * 256) / 2, 0, 0, 12, 12, x + i * spacing, y + 2, 12, 12); - } else if (rawChars[i] == NAME_SCREEN_BUTTON_D004) { + } else if (rawChars[i] == NAME_SCREEN_CONTROL_SKIP) { ++i; continue; } else { @@ -1532,23 +1534,23 @@ static void NamingScreen_PrintLastCharacterOfEntryBuf(Window *window, u16 *entry u16 character; if (cursorPos == 0) { - character = NAME_SCREEN_BUTTON_D003; + character = NAME_SCREEN_CONTROL_SPACE; } else { character = entryBuf[cursorPos - 1]; } switch (character) { - case NAME_SCREEN_BUTTON_D001: - case NAME_SCREEN_BUTTON_D002: - case NAME_SCREEN_BUTTON_D003: - case NAME_SCREEN_BUTTON_D004: + case NAME_SCREEN_CONTROL_DAKU: + case NAME_SCREEN_CONTROL_HANDAKU: + case NAME_SCREEN_CONTROL_SPACE: + case NAME_SCREEN_CONTROL_SKIP: case NAME_SCREEN_BUTTON_PAGE_UPPER: case NAME_SCREEN_BUTTON_PAGE_LOWER: case NAME_SCREEN_BUTTON_PAGE_SYMBOLS: case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED: case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: - case NAME_SCREEN_BUTTON_E007: - case NAME_SCREEN_BUTTON_E008: + case NAME_SCREEN_BUTTON_BACK: + case NAME_SCREEN_BUTTON_OK: character = 1; break; } @@ -1593,7 +1595,7 @@ static void NamingScreen_LoadKeyboardLayout(u16 (*keyboard)[13], const int pageN } static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput) { - if (key == NAME_SCREEN_BUTTON_D003 || key == NAME_SCREEN_BUTTON_D004) { + if (key == NAME_SCREEN_CONTROL_SPACE || key == NAME_SCREEN_CONTROL_SKIP) { key = CHAR_JP_SPACE; } if (data->type == NAME_SCREEN_UNK4) { @@ -1607,15 +1609,15 @@ static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput) } switch (key) { - case NAME_SCREEN_BUTTON_D001: - if (sub_02084D04(0x2A, 0x52, 1, NAME_SCREEN_BUTTON_D001, data->entryBuf, data->textCursorPos)) { + case NAME_SCREEN_CONTROL_DAKU: + if (sub_02084D04(0x2A, 0x52, 1, NAME_SCREEN_CONTROL_DAKU, data->entryBuf, data->textCursorPos)) { FillWindowPixelBuffer(&data->windows[3], 1); sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); PlaySE(SEQ_SE_DP_BOX02); } break; - case NAME_SCREEN_BUTTON_D002: - if (sub_02084D04(0x48, 0x52, 2, NAME_SCREEN_BUTTON_D002, data->entryBuf, data->textCursorPos)) { + case NAME_SCREEN_CONTROL_HANDAKU: + if (sub_02084D04(0x48, 0x52, 2, NAME_SCREEN_CONTROL_HANDAKU, data->entryBuf, data->textCursorPos)) { FillWindowPixelBuffer(&data->windows[3], 1); sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); PlaySE(SEQ_SE_DP_BOX02); @@ -1641,7 +1643,7 @@ static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput) PlaySE(SEQ_SE_DP_SYU03); } break; - case NAME_SCREEN_BUTTON_E007: + case NAME_SCREEN_BUTTON_BACK: if (data->textCursorPos != 0) { data->entryBuf[data->textCursorPos - 1] = EOS; --data->textCursorPos; @@ -1657,7 +1659,7 @@ static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput) PlaySE(SEQ_SE_DP_SELECT); } break; - case NAME_SCREEN_BUTTON_E008: + case NAME_SCREEN_BUTTON_OK: sub_020164C4(data->unk_5C4); if (data->unk_014 == 0) { PlaySE(SEQ_SE_DP_PIRORIRO); @@ -1755,7 +1757,7 @@ static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { } } switch (a3) { - case NAME_SCREEN_BUTTON_D001: + case NAME_SCREEN_CONTROL_DAKU: for (i = 0; i < 12u; ++i) { if (key == _021021B8[i][0]) { a4[a5 - 1] = _021021B8[i][1]; @@ -1763,7 +1765,7 @@ static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { } } break; - case NAME_SCREEN_BUTTON_D002: + case NAME_SCREEN_CONTROL_HANDAKU: for (i = 0; i < 10u; ++i) { if (key == _02102190[i][0]) { a4[a5 - 1] = _02102190[i][1]; From ddd230d98b0af156945af0ddd37da269bec02b44 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 13 Oct 2024 23:20:39 -0400 Subject: [PATCH 19/25] Documentation, 3 --- include/naming_screen.h | 2 +- src/launch_application.c | 8 +- src/naming_screen.c | 365 +++++++++++++++++++++------------------ 3 files changed, 200 insertions(+), 175 deletions(-) diff --git a/include/naming_screen.h b/include/naming_screen.h index 0a0aa0f064..d2bd4f29cd 100644 --- a/include/naming_screen.h +++ b/include/naming_screen.h @@ -14,7 +14,7 @@ typedef struct NamingScreenArgs { int monForm; int maxLen; int monGender; - BOOL needsHandling; + BOOL noInput; String *nameInputString; u16 nameInputFlat[20]; int battleMsgId; diff --git a/src/launch_application.c b/src/launch_application.c index 126ec8ef01..c205c7e0eb 100644 --- a/src/launch_application.c +++ b/src/launch_application.c @@ -1047,21 +1047,21 @@ static BOOL Task_NamingScreen(TaskManager *taskman) { NamingScreenArgs *args = data->args; if (args->kind == 1) { if (String_Compare(args->nameInputString, data->unk10) == 0) { - data->args->needsHandling = 1; + data->args->noInput = 1; } } else if (args->kind == 5) { u16 *var2 = String_cstr(args->nameInputString); SAV_FRIEND_GRP *friendGroup = Save_FriendGroup_Get(fieldSystem->saveData); if (sub_0202C88C(friendGroup, var2)) { - data->args->needsHandling = 2; + data->args->noInput = 2; } } - if (data->args->needsHandling == 0) { + if (data->args->noInput == 0) { SetName(taskman); } u16 *retVar = data->retVar; if (data->retVar != NULL) { - *retVar = data->args->needsHandling; + *retVar = data->args->noInput; } NamingScreen_DeleteArgs(data->args); String_Delete(data->unk10); diff --git a/src/naming_screen.c b/src/naming_screen.c index 3d6f7f1904..38953b02ad 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -45,26 +45,42 @@ #define NAME_SCREEN_BUTTON_BACK 0xE007 #define NAME_SCREEN_BUTTON_OK 0xE008 +typedef enum NamingScreenInitState { + NS_INIT_STATE_LOAD_GFX, + NS_INIT_STATE_LOAD_MON_ICON, +} NamingScreenInitState; + +typedef enum NamingScreenMainState { + NS_MAIN_STATE_WAIT_FADE_IN, + NS_MAIN_STATE_FINISH_INIT, + NS_MAIN_STATE_INPUT_LOOP, + NS_MAIN_STATE_WAIT_FADE_OUT, +} NamingScreenMainState; + +typedef struct NamingScreenCursor { + int x; + int y; + int prevX; + int prevY; + int deltaX; + BOOL showCursor; // always TRUE + BOOL unk18; +} NamingScreenCursor; + typedef struct NamingScreenAppData { NameScreenType type; int playerGenderOrMonSpecies; int monForm; int maxLen; int monGender; - int unk_014; + BOOL printedFromBattleGMM; // logic that makes this TRUE is unreachable Options *options; - int cursorX; - int cursorY; - int unk_024; - int unk_028; - int unk_02C; - int unk_030; - int unk_034; + NamingScreenCursor kbCursor; u16 unk_038; u16 keyboard[6][13]; u8 filler_0D6[2]; u16 entryBuf[0x20]; - u16 unk_118[0x20]; + u16 entryBufBak[0x20]; u16 textCursorPos; u16 unk_15A[3]; BgConfig *bgConfig; // 0x160 @@ -85,7 +101,7 @@ typedef struct NamingScreenAppData { SpriteResourcesHeader spriteResHdr_Sub; Sprite *sprites1[14]; Sprite *textEntrySprites[12]; - Sprite *sprites3[2]; + Sprite *iconSprites[2]; SysTask *tasks[7]; Window windows[10]; int unk_458; @@ -122,43 +138,42 @@ typedef struct UnkStruct_02102278 { BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); static void NamingScreen_LoadMonIcon(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState); -static int sub_02082CF8(NamingScreenAppData *data, int a1); -static void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args); -static BOOL sub_02082EC0(const u16 *s); +static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, NamingScreenMainState a1); +static void NamingScreen_SetDefaultName(NamingScreenAppData *data, NamingScreenArgs *args); +static BOOL NamingScreen_PMCharArrayIsAllSpaces(const u16 *s); BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState); static void NamingScreen_VBlankCB(void *param); -static BOOL sub_02082EC0(const u16 *s); static void NamingScreen_InitFromArgs(NamingScreenAppData *data, NamingScreenArgs *args); static void NamingScreen_SetGraphicsBanks(void); static void NamingScreen_SetBgModesAndInitBuffers(BgConfig *bgConfig); static void NamingScreen_ToggleGfxPlanes(GFPlaneToggle enable); static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, OVY_MANAGER *ovyMan); -static void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +static void NamingScreen_PrepareBattleMessage(NamingScreenAppData *data, OVY_MANAGER *ovyMan); static void NamingScreen_UnloadBgGfx(BgConfig *bgConfig, Window *windows); static void NamingScreen_CreateBgConfigAndLoadGfx(NamingScreenAppData *data, NARC *narc); static void NamingScreen_InitObjCharPlttTransfer(void); static void NamingScreen_LoadObjGfx(NamingScreenAppData *data, NARC *narc); -static void sub_020839B8(SysTask *task, void *taskData); +static void SysTask_NamingScreen_SubspritePosController(SysTask *task, void *taskData); static void NamingScreen_CreateSprites(NamingScreenAppData *data); -static void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate); -static void sub_02083CAC(SysTask *task, void *taskData); +static void NamingScreen_CreateIconSprite(NamingScreenAppData *data, SpriteTemplate *tmplate); +static void SysTask_NamingScreen_WiggleEffect(SysTask *task, void *taskData); static void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData); static void sub_02083F18(Window *window, NameScreenType unused, String *msg); static void sub_02083F48(Window *window, NameScreenType unused, String *msg); static void NamingScreen_InitWindows(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); static void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); static void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId); -static int sub_02084264(int val, int lo, int hi); -static void sub_02084274(NamingScreenAppData *data, int dpadMovement); -static void sub_0208432C(NamingScreenAppData *data); +static int NamingScreen_WrapAroundWithinInterval(int val, int lo, int hi); +static void NamingScreen_MoveKeyboardCursor(NamingScreenAppData *data, int dpadMovement); +static void NamingScreen_GetPlayerInput(NamingScreenAppData *data); static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, int dpadMovement); static void sub_02084500(u16 *a0); -static void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels); +static void NamingScreen_BlitRawCharactersToWindow(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels); static void *NamingScreen_PrintStringOnWindow_GetPixelBuffer(Window *window, String *string, FontID fontId, u32 color); static void NamingScreen_PrintCharacterOnWindowAndOBJ(Window *windows, const u16 *tmpBuf, void *charBuf, String *string); static void NamingScreen_PrintLastCharacterOfEntryBuf(Window *window, u16 *entryBuf, u16 cursorPos, u16 *tmpBuf, void *charBuf, String *string); static void NamingScreen_LoadKeyboardLayout(u16 (*a0)[13], const int a1); -static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput); +static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppData *data, u16 key, BOOL isButtonInput); static void NamingScreen_UpdateFieldMenuInputState(NamingScreenAppData *data, BOOL toggle); static int sub_02084C78(const u16 *a0, int a1); static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3); @@ -435,8 +450,8 @@ const OVY_MGR_TEMPLATE gOverlayTemplate_NamingScreen = { BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { NamingScreenAppData *data; NARC *narc; - switch (*pState) { - case 0: + switch ((NamingScreenInitState)*pState) { + case NS_INIT_STATE_LOAD_GFX: Main_SetVBlankIntrCB(NULL, NULL); HBlankInterruptDisable(); GfGfx_DisableEngineAPlanes(); @@ -474,14 +489,14 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { NARC_Delete(narc); ++(*pState); break; - case 1: + case NS_INIT_STATE_LOAD_MON_ICON: data = OverlayManager_GetData(ovyMan); if (data->type == NAME_SCREEN_POKEMON) { NamingScreen_LoadMonIcon(data->monIconCharData, data->plttData, data->playerGenderOrMonSpecies, data->monForm); } sAppData = data; data->unk_5C4 = sub_020163E0(NULL, PM_LCD_BOTTOM, 12, HEAP_ID_NAMING_SCREEN); - *pState = 0; + *pState = NS_MAIN_STATE_WAIT_FADE_IN; return TRUE; } @@ -498,23 +513,23 @@ static void NamingScreen_LoadMonIcon(NNSG2dCharacterData *pCharData, NNSG2dPalet BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { NamingScreenAppData *data = OverlayManager_GetData(ovyMan); - switch (*pState) { - case 0: + switch ((NamingScreenMainState)*pState) { + case NS_MAIN_STATE_WAIT_FADE_IN: if (IsPaletteFadeFinished()) { - *pState = 1; + *pState = NS_MAIN_STATE_FINISH_INIT; data->delayCounter = 0; } break; - case 1: + case NS_MAIN_STATE_FINISH_INIT: ++data->delayCounter; NamingScreen_PlaceCursorSprite(data); sub_02084F3C(data->spriteStates, data->sprites1, data->pageNum); if (data->delayCounter > 5) { - *pState = 2; + *pState = NS_MAIN_STATE_INPUT_LOOP; data->delayCounter = 0; } break; - case 2: + case NS_MAIN_STATE_INPUT_LOOP: switch (data->unk_45C) { case 0: case 1: @@ -522,13 +537,13 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { case 3: break; case 4: - if (data->unk_034 == 0) { - *pState = sub_02082CF8(data, *pState); + if (data->kbCursor.unk18 == 0) { + *pState = NamingScreen_HandleInput(data, (NamingScreenMainState)*pState); } NamingScreen_PlaceCursorSprite(data); break; case 5: - sub_020834FC(data, ovyMan); + NamingScreen_PrepareBattleMessage(data, ovyMan); FillWindowPixelBuffer(&data->windows[9], 15); DrawFrameAndWindow2(&data->windows[9], FALSE, 256, 10); data->unk_458 = AddTextPrinterParameterized(&data->windows[9], 1, data->battleMsgString, 0, 0, 1, NULL); @@ -547,7 +562,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { ++data->delayCounter; if (data->delayCounter > 30) { BeginNormalPaletteFade(2, 0, 0, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); - *pState = 3; + *pState = NS_MAIN_STATE_WAIT_FADE_OUT; } break; } @@ -555,7 +570,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { sub_02084F3C(data->spriteStates, data->sprites1, data->pageNum); sub_02084500(&data->unk_038); break; - case 3: + case NS_MAIN_STATE_WAIT_FADE_OUT: if (IsPaletteFadeFinished()) { return TRUE; } @@ -566,16 +581,16 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { return FALSE; } -static int sub_02082CF8(NamingScreenAppData *data, int a1) { - int ret = a1; +static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, NamingScreenMainState a1) { + NamingScreenMainState ret = a1; - sub_0208432C(data); + NamingScreen_GetPlayerInput(data); if (gSystem.newKeys & PAD_BUTTON_SELECT) { if (!Sprite_GetVisibleFlag(data->sprites1[8])) { Sprite_SetVisibleFlag(data->sprites1[8], TRUE); return ret; } - if (data->type != 4) { + if (data->type != NAME_SCREEN_UNK4) { data->unk_45C = 0; ++data->pageNum; if (data->pageNum >= 3) { @@ -584,20 +599,20 @@ static int sub_02082CF8(NamingScreenAppData *data, int a1) { ++data->spriteStates[data->pageNum]; NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); PlaySE(SEQ_SE_DP_SYU03); - data->unk_030 = 1; + data->kbCursor.showCursor = TRUE; } ++data->spriteStates[data->pageNum]; NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); PlaySE(SEQ_SE_DP_SYU03); } else if (gSystem.newKeys & PAD_BUTTON_A) { - ret = sub_02084884(data, data->keyboard[data->cursorY][data->cursorX], TRUE); - data->unk_030 = 1; + ret = NamingScreen_HandleCharacterInput(data, data->keyboard[data->kbCursor.y][data->kbCursor.x], TRUE); + data->kbCursor.showCursor = TRUE; } else if (data->isTouchInput == TRUE) { - ret = sub_02084884(data, data->keyboard[data->cursorY][data->cursorX], FALSE); + ret = NamingScreen_HandleCharacterInput(data, data->keyboard[data->kbCursor.y][data->kbCursor.x], FALSE); } else if (gSystem.newKeys & PAD_BUTTON_B) { - ret = sub_02084884(data, NAME_SCREEN_BUTTON_BACK, TRUE); + ret = NamingScreen_HandleCharacterInput(data, NAME_SCREEN_BUTTON_BACK, TRUE); } else if (gSystem.newKeys & PAD_BUTTON_R) { - ret = sub_02084884(data, NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2, TRUE); + ret = NamingScreen_HandleCharacterInput(data, NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2, TRUE); } return ret; } @@ -612,7 +627,8 @@ static int sub_02082CF8(NamingScreenAppData *data, int a1) { #define FIRST_DEFAULT_NAME_RIVAL msg_0254_00085 #endif // HEARTGOLD -static void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args) { +// Called when the input is empty +static void NamingScreen_SetDefaultName(NamingScreenAppData *data, NamingScreenArgs *args) { String *string; if (data->type == NAME_SCREEN_PLAYER) { @@ -631,11 +647,12 @@ static void sub_02082E28(NamingScreenAppData *data, NamingScreenArgs *args) { String_Delete(string); CopyStringToU16Array(args->nameInputString, args->nameInputFlat, 10); } else { - args->needsHandling = TRUE; + // Remaining cases have their own separate handlers. + args->noInput = TRUE; } } -static BOOL sub_02082EC0(const u16 *s) { +static BOOL NamingScreen_PMCharArrayIsAllSpaces(const u16 *s) { BOOL ret = TRUE; int i; @@ -645,6 +662,7 @@ static BOOL sub_02082EC0(const u16 *s) { } if (s[i] != CHAR_SPACE) { ret = FALSE; + // break; } } return ret; @@ -661,10 +679,10 @@ BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { // wtf FreeToHeap(mon); } - if (data->textCursorPos == 0 || !StringNotEqual(data->entryBuf, data->unk_118) || sub_02082EC0(data->entryBuf)) { - sub_02082E28(data, args); + if (data->textCursorPos == 0 || !StringNotEqual(data->entryBuf, data->entryBufBak) || NamingScreen_PMCharArrayIsAllSpaces(data->entryBuf)) { + NamingScreen_SetDefaultName(data, args); } else { - CopyU16StringArray(data->unk_118, data->entryBuf); + CopyU16StringArray(data->entryBufBak, data->entryBuf); CopyU16StringArray(args->nameInputFlat, data->entryBuf); CopyU16ArrayToString(args->nameInputString, data->entryBuf); } @@ -718,7 +736,7 @@ NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, NameScreenType kind, in ret->kind = kind; ret->playerGenderOrMonSpecies = param; ret->maxLen = maxLen; - ret->needsHandling = FALSE; + ret->noInput = FALSE; ret->nameInputFlat[0] = EOS; ret->nameInputString = String_New(32, heapId); ret->battleMsgId = 0; @@ -892,9 +910,9 @@ static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_Y, data->bgPosVecs[data->unk_464].y); BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_X, data->bgPosVecs[data->unk_464 ^ 1].x); BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_Y, data->bgPosVecs[data->unk_464 ^ 1].y); - data->unk_118[0] = EOS; + data->entryBufBak[0] = EOS; if (args->nameInputString != NULL) { - CopyStringToU16Array(args->nameInputString, data->unk_118, 32); + CopyStringToU16Array(args->nameInputString, data->entryBufBak, 32); } MI_CpuFill16(data->entryBuf, 1, sizeof(data->entryBuf)); if (data->type == NAME_SCREEN_POKEMON) { @@ -904,18 +922,18 @@ static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, FreeToHeap(mon); } if (args->battleMsgId != 0) { - data->unk_014 = 1; + data->printedFromBattleGMM = TRUE; } data->promptString = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, _021020B4[data->type], HEAP_ID_NAMING_SCREEN); data->unkJapaneseString = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, msg_0249_00009, HEAP_ID_NAMING_SCREEN); data->unk_184 = NewString_ReadMsgData(data->msgData_249, msg_0249_00007); - data->textCursorPos = StringLength(data->unk_118); - data->cursorX = 0; - data->cursorY = 1; - data->unk_024 = -1; - data->unk_028 = -1; - data->unk_030 = 1; - data->unk_034 = 0; + data->textCursorPos = StringLength(data->entryBufBak); + data->kbCursor.x = 0; + data->kbCursor.y = 1; + data->kbCursor.prevX = -1; + data->kbCursor.prevY = -1; + data->kbCursor.showCursor = TRUE; + data->kbCursor.unk18 = FALSE; data->unk_484 = -1; data->unk_488 = 0; data->unk_48C = 0; @@ -930,7 +948,7 @@ static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, } } -static void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { +static void NamingScreen_PrepareBattleMessage(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); if (args->battleMsgId != 0) { String *string = String_New(200, HEAP_ID_NAMING_SCREEN); @@ -944,7 +962,7 @@ static void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { } else { BufferPCBoxName(data->msgFormat, 2, args->pcStorage, boxno); } - if (data->textCursorPos == 0 || sub_02082EC0(data->entryBuf)) { + if (data->textCursorPos == 0 || NamingScreen_PMCharArrayIsAllSpaces(data->entryBuf)) { Pokemon *mon = AllocMonZeroed(HEAP_ID_NAMING_SCREEN); CreateMon(mon, data->playerGenderOrMonSpecies, 1, 0, 0, 0, 0, 0); BufferBoxMonSpeciesName(data->msgFormat, 0, Mon_GetBoxMon(mon)); @@ -954,8 +972,8 @@ static void sub_020834FC(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { CopyU16ArrayToString(string, data->entryBuf); BufferString(data->msgFormat, 0, string, 0, 0, 0); } - data->battleMsgString = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_197, args->battleMsgId, HEAP_ID_NAMING_SCREEN); - data->unk_014 = 1; + data->battleMsgString = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_197, args->battleMsgId, HEAP_ID_NAMING_SCREEN); + data->printedFromBattleGMM = TRUE; String_Delete(string); } } @@ -1040,21 +1058,21 @@ static void NamingScreen_LoadObjGfx(NamingScreenAppData *data, NARC *narc) { sub_0200AF94(data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT]); } -typedef struct SysTaskData_020839B8 { - Sprite *sprite; - Sprite *sprite2; +typedef struct SubspritePosControllerTaskData { + Sprite *parent; + Sprite *child; fx32 dx; int i; -} SysTaskData_020839B8; +} SubspritePosControllerTaskData; -static void sub_020839B8(SysTask *task, void *taskData) { - SysTaskData_020839B8 *data = taskData; - VecFx32 *pMatrix = Sprite_GetMatrixPtr(data->sprite); +static void SysTask_NamingScreen_SubspritePosController(SysTask *task, void *taskData) { + SubspritePosControllerTaskData *data = taskData; + VecFx32 *pMatrix = Sprite_GetMatrixPtr(data->parent); VecFx32 matrix; matrix.x = pMatrix->x + data->dx; matrix.y = FX32_ONE * _021021E8[data->i][1]; matrix.z = 0; - Sprite_SetMatrix(data->sprite2, &matrix); + Sprite_SetMatrix(data->child, &matrix); } static void NamingScreen_CreateSprites(NamingScreenAppData *data) { @@ -1086,12 +1104,12 @@ static void NamingScreen_CreateSprites(NamingScreenAppData *data) { } Sprite_SetVisibleFlag(data->sprites1[4], FALSE); for (i = 0; i < 7; ++i) { - data->tasks[i] = CreateSysTaskAndEnvironment(sub_020839B8, sizeof(SysTaskData_020839B8), 5, HEAP_ID_NAMING_SCREEN); - SysTaskData_020839B8 *taskData = SysTask_GetData(data->tasks[i]); - taskData->sprite = data->sprites1[7]; - taskData->sprite2 = data->sprites1[i]; - taskData->dx = _021021E8[i][0] * FX32_ONE; - taskData->i = i; + data->tasks[i] = CreateSysTaskAndEnvironment(SysTask_NamingScreen_SubspritePosController, sizeof(SubspritePosControllerTaskData), 5, HEAP_ID_NAMING_SCREEN); + SubspritePosControllerTaskData *taskData = SysTask_GetData(data->tasks[i]); + taskData->parent = data->sprites1[7]; + taskData->child = data->sprites1[i]; + taskData->dx = _021021E8[i][0] * FX32_ONE; + taskData->i = i; } // regswap: data->maxLen should be r2, instead r0 for (i = 0; i < data->maxLen; ++i) { @@ -1102,67 +1120,69 @@ static void NamingScreen_CreateSprites(NamingScreenAppData *data) { Sprite_SetAnimCtrlSeq(data->textEntrySprites[i], 43); } sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); - sub_02083BB4(data, &spriteTemplate); + NamingScreen_CreateIconSprite(data, &spriteTemplate); } GfGfx_EngineATogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); } -static void sub_02083BB4(NamingScreenAppData *data, SpriteTemplate *tmplate) { - tmplate->position.x = FX32_CONST(24); - tmplate->position.y = FX32_CONST(8); - data->sprites3[0] = Sprite_CreateAffine(tmplate); - Sprite_SetAnimActiveFlag(data->sprites3[0], TRUE); +static void NamingScreen_CreateIconSprite(NamingScreenAppData *data, SpriteTemplate *tmplate) { + tmplate->position.x = FX32_CONST(24); + tmplate->position.y = FX32_CONST(8); + data->iconSprites[0] = Sprite_CreateAffine(tmplate); + Sprite_SetAnimActiveFlag(data->iconSprites[0], TRUE); switch (data->type) { case NAME_SCREEN_PLAYER: if (data->playerGenderOrMonSpecies == PLAYER_GENDER_MALE) { - Sprite_SetAnimCtrlSeq(data->sprites3[0], 48); + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 48); } else { - Sprite_SetAnimCtrlSeq(data->sprites3[0], 49); + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 49); } break; case NAME_SCREEN_RIVAL: - Sprite_SetAnimCtrlSeq(data->sprites3[0], 51); + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 51); break; case NAME_SCREEN_UNK6: - Sprite_SetAnimCtrlSeq(data->sprites3[0], 55); + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 55); break; case NAME_SCREEN_GROUP: - Sprite_SetAnimCtrlSeq(data->sprites3[0], 54); + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 54); break; case NAME_SCREEN_UNK4: case NAME_SCREEN_UNK7: - Sprite_SetAnimCtrlSeq(data->sprites3[0], 53); + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 53); break; case NAME_SCREEN_BOX: - Sprite_SetAnimCtrlSeq(data->sprites3[0], 47); + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 47); break; case NAME_SCREEN_POKEMON: - Sprite_SetAnimCtrlSeq(data->sprites3[0], 50); + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 50); if (data->monGender != 2) { - tmplate->position.x = (13 * data->maxLen + 80) * FX32_ONE; - tmplate->position.y = FX32_CONST(27); - data->sprites3[1] = Sprite_CreateAffine(tmplate); + tmplate->position.x = (13 * data->maxLen + 80) * FX32_ONE; + tmplate->position.y = FX32_CONST(27); + data->iconSprites[1] = Sprite_CreateAffine(tmplate); if (data->monGender == 0) { - Sprite_SetAnimCtrlSeq(data->sprites3[1], 45); + Sprite_SetAnimCtrlSeq(data->iconSprites[1], 45); } else { - Sprite_SetAnimCtrlSeq(data->sprites3[1], 46); + Sprite_SetAnimCtrlSeq(data->iconSprites[1], 46); } } break; } } -typedef struct SysTaskData_02083CAC { +typedef struct WiggleEffectTaskData { Sprite *sprite; int state; fx32 x; int y; -} SysTaskData_02083CAC; +} WiggleEffectTaskData; -static void sub_02083CAC(SysTask *task, void *taskData) { - SysTaskData_02083CAC *data = taskData; +static void SysTask_NamingScreen_WiggleEffect(SysTask *task, void *taskData) { + WiggleEffectTaskData + *data + = taskData; VecFx32 matrix; @@ -1211,10 +1231,11 @@ static void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int p case 2: posVecs[bgId_prev].x -= 24; if (posVecs[bgId_prev].x < -1) { - SysTaskData_02083CAC *data; + WiggleEffectTaskData + *data; SysTask *task; - task = CreateSysTaskAndEnvironment(sub_02083CAC, sizeof(SysTaskData_02083CAC), 0, HEAP_ID_NAMING_SCREEN); + task = CreateSysTaskAndEnvironment(SysTask_NamingScreen_WiggleEffect, sizeof(WiggleEffectTaskData), 0, HEAP_ID_NAMING_SCREEN); data = SysTask_GetData(task); data->sprite = pSprites[7]; data->state = 0; @@ -1302,9 +1323,9 @@ static void NamingScreen_InitWindows(NamingScreenAppData *data, OVY_MANAGER *ovy OverlayManager_GetArgs(ovyMan); - if (data->unk_118[0] != EOS) { - CopyU16StringArray(data->entryBuf, data->unk_118); - sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + if (data->entryBufBak[0] != EOS) { + CopyU16StringArray(data->entryBuf, data->entryBufBak); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); } for (int i = 0; i < 3; ++i) { @@ -1336,7 +1357,9 @@ static const int _02102168[][2] = { { 1, 0 }, }; -static int sub_02084264(int val, int lo, int hi) { +// If val is outside the range, clamp to the opposite side of that range +// The interval is right half open. +static int NamingScreen_WrapAroundWithinInterval(int val, int lo, int hi) { if (val >= hi) { val = lo; } @@ -1346,32 +1369,33 @@ static int sub_02084264(int val, int lo, int hi) { return val; } -static void sub_02084274(NamingScreenAppData *data, int dpadMovement) { +static void NamingScreen_MoveKeyboardCursor(NamingScreenAppData *data, int dpadMovement) { + // Only run this logic if the keyboard cursor is moving in response to dpad input. if (dpadMovement == 0) { return; } - u16 sp0 = data->keyboard[data->cursorY][data->cursorX]; - int newX = sub_02084264(data->cursorX + _02102168[dpadMovement][0], 0, 13); - int newY = sub_02084264(data->cursorY + _02102168[dpadMovement][1], 0, 6); - while (data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP || (data->keyboard[newY][newX] == sp0 && data->keyboard[newY][newX] > NAME_SCREEN_BUTTON_START)) { - if (data->unk_028 == 0 && data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP && _02102168[dpadMovement][1] != 0) { - newX = sub_02084264(newX + data->unk_02C, 0, 13); + u16 prevKey = data->keyboard[data->kbCursor.y][data->kbCursor.x]; + int newX = NamingScreen_WrapAroundWithinInterval(data->kbCursor.x + _02102168[dpadMovement][0], 0, 13); + int newY = NamingScreen_WrapAroundWithinInterval(data->kbCursor.y + _02102168[dpadMovement][1], 0, 6); + while (data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP || (data->keyboard[newY][newX] == prevKey && data->keyboard[newY][newX] > NAME_SCREEN_BUTTON_START)) { + if (data->kbCursor.prevY == 0 && data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP && _02102168[dpadMovement][1] != 0) { + newX = NamingScreen_WrapAroundWithinInterval(newX + data->kbCursor.deltaX, 0, 13); } else { - newX = sub_02084264(newX + _02102168[dpadMovement][0], 0, 13); - newY = sub_02084264(newY + _02102168[dpadMovement][1], 0, 6); + newX = NamingScreen_WrapAroundWithinInterval(newX + _02102168[dpadMovement][0], 0, 13); + newY = NamingScreen_WrapAroundWithinInterval(newY + _02102168[dpadMovement][1], 0, 6); } } - data->cursorX = newX; - data->cursorY = newY; + data->kbCursor.x = newX; + data->kbCursor.y = newY; } -static void sub_0208432C(NamingScreenAppData *data) { - int doUpdateCursor = 0; - int dpadMovement = 0; - BOOL r7 = FALSE; +static void NamingScreen_GetPlayerInput(NamingScreenAppData *data) { + int doUpdateCursor = 0; + int dpadMovement = 0; + BOOL buttonInputIsTransition = FALSE; if (!Sprite_GetVisibleFlag(data->sprites1[8])) { - r7 = TRUE; + buttonInputIsTransition = TRUE; } if (gSystem.newAndRepeatedKeys & PAD_KEY_UP) { @@ -1401,8 +1425,8 @@ static void sub_0208432C(NamingScreenAppData *data) { if (gSystem.newKeys & PAD_BUTTON_START) { PlaySE(SEQ_SE_DP_SELECT); Sprite_SetVisibleFlag(data->sprites1[8], TRUE); - data->cursorX = 12; - data->cursorY = 0; + data->kbCursor.x = 12; + data->kbCursor.y = 0; ++doUpdateCursor; } data->isTouchInput = NamingScreen_HandleTouchInput(data); @@ -1410,19 +1434,19 @@ static void sub_0208432C(NamingScreenAppData *data) { dpadMovement = 0; ++doUpdateCursor; } - if (r7 == TRUE) { + if (buttonInputIsTransition == TRUE) { doUpdateCursor = 0; NamingScreen_UpdateCursorSpritePosition(data, dpadMovement); } if (doUpdateCursor) { - sub_02084274(data, dpadMovement); + NamingScreen_MoveKeyboardCursor(data, dpadMovement); NamingScreen_UpdateCursorSpritePosition(data, dpadMovement); } } static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, int dpadMovement) { - if (data->cursorY != 0) { - if (data->unk_028 == 0 && data->unk_028 != data->cursorY) { + if (data->kbCursor.y != 0) { + if (data->kbCursor.prevY == 0 && data->kbCursor.prevY != data->kbCursor.y) { Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); } if (dpadMovement != 0) { @@ -1430,12 +1454,12 @@ static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, i } VecFx32 vec; - vec.x = (data->cursorX * 16 + 26) * FX32_ONE; - vec.y = ((data->cursorY - 1) * 19 + 91) * FX32_ONE; + vec.x = (data->kbCursor.x * 16 + 26) * FX32_ONE; + vec.y = ((data->kbCursor.y - 1) * 19 + 91) * FX32_ONE; // vec.z = 0; Sprite_SetMatrix(data->sprites1[8], &vec); } else { - int buttonId = data->keyboard[data->cursorY][data->cursorX] - NAME_SCREEN_BUTTON_PAGE_UPPER; + int buttonId = data->keyboard[data->kbCursor.y][data->kbCursor.x] - NAME_SCREEN_BUTTON_PAGE_UPPER; VecFx32 vec; vec.x = _02101D80[buttonId] * FX32_ONE; @@ -1447,10 +1471,10 @@ static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, i data->unk_038 = 180; Sprite_SetAnimCtrlCurrentFrame(data->sprites1[8], 0); - data->unk_024 = data->cursorX; - data->unk_028 = data->cursorY; + data->kbCursor.prevX = data->kbCursor.x; + data->kbCursor.prevY = data->kbCursor.y; if (_02102168[dpadMovement][0] != 0) { - data->unk_02C = _02102168[dpadMovement][0]; + data->kbCursor.deltaX = _02102168[dpadMovement][0]; } } @@ -1464,24 +1488,25 @@ static void sub_02084500(u16 *a0) { GX_LoadOBJPltt(&col, 0x3A, sizeof(col)); } -static void sub_02084540(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels) { +static void NamingScreen_BlitRawCharactersToWindow(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels) { int i = 0; int width; int centerX; - u16 sp38[2]; + u16 pmCharBuf[2]; String *string = String_New(2, HEAP_ID_NAMING_SCREEN); while (rawChars[i] != EOS) { if (rawChars[i] == NAME_SCREEN_CONTROL_DAKU || rawChars[i] == NAME_SCREEN_CONTROL_HANDAKU || rawChars[i] == NAME_SCREEN_CONTROL_SPACE) { + // This is unreachable outside of Japan. u16 buttonId = rawChars[i] - NAME_SCREEN_CONTROL_DAKU; BlitBitmapRectToWindow(window, buttonPixels + (buttonId * 256) / 2, 0, 0, 12, 12, x + i * spacing, y + 2, 12, 12); } else if (rawChars[i] == NAME_SCREEN_CONTROL_SKIP) { ++i; continue; } else { - sp38[0] = rawChars[i]; - sp38[1] = EOS; - width = FontID_FlatArray_GetWidth(0, sp38, 0); - CopyU16ArrayToString(string, sp38); + pmCharBuf[0] = rawChars[i]; + pmCharBuf[1] = EOS; + width = FontID_FlatArray_GetWidth(0, pmCharBuf, 0); + CopyU16ArrayToString(string, pmCharBuf); centerX = x + i * spacing + ((spacing - width) / 2); AddTextPrinterParameterizedWithColor(window, 0, string, centerX, y, textSpeed, color, NULL); } @@ -1551,16 +1576,16 @@ static void NamingScreen_PrintLastCharacterOfEntryBuf(Window *window, u16 *entry case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: case NAME_SCREEN_BUTTON_BACK: case NAME_SCREEN_BUTTON_OK: - character = 1; + character = CHAR_JP_SPACE; break; } for (i = 0; i < 3; ++i) { - tmpBuf[i] = 1; + tmpBuf[i] = CHAR_JP_SPACE; } tmpBuf[0] = character; - if (character != 1) { + if (character != CHAR_JP_SPACE) { for (i = 0; i < NELEMS(_02102422); ++i) { if (character == _02102422[i][0]) { for (j = 0; j < 3; ++j) { @@ -1594,7 +1619,7 @@ static void NamingScreen_LoadKeyboardLayout(u16 (*keyboard)[13], const int pageN } } -static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput) { +static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppData *data, u16 key, BOOL isButtonInput) { if (key == NAME_SCREEN_CONTROL_SPACE || key == NAME_SCREEN_CONTROL_SKIP) { key = CHAR_JP_SPACE; } @@ -1605,28 +1630,28 @@ static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput) } if (!Sprite_GetVisibleFlag(data->sprites1[8]) && gSystem.touchNew == 0) { Sprite_SetVisibleFlag(data->sprites1[8], TRUE); - return 2; + return NS_MAIN_STATE_INPUT_LOOP; } switch (key) { case NAME_SCREEN_CONTROL_DAKU: if (sub_02084D04(0x2A, 0x52, 1, NAME_SCREEN_CONTROL_DAKU, data->entryBuf, data->textCursorPos)) { FillWindowPixelBuffer(&data->windows[3], 1); - sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); PlaySE(SEQ_SE_DP_BOX02); } break; case NAME_SCREEN_CONTROL_HANDAKU: if (sub_02084D04(0x48, 0x52, 2, NAME_SCREEN_CONTROL_HANDAKU, data->entryBuf, data->textCursorPos)) { FillWindowPixelBuffer(&data->windows[3], 1); - sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); PlaySE(SEQ_SE_DP_BOX02); } break; case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: if (sub_02084C98(0, 0x52, data->entryBuf, data->textCursorPos)) { FillWindowPixelBuffer(&data->windows[3], 1); - sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); ++data->spriteStates[4]; PlaySE(SEQ_SE_DP_BOX02); } @@ -1651,7 +1676,7 @@ static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput) if (data->textCursorPos == 0) { CopyWindowToVram(&data->windows[3]); } else { - sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); } NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->unk_15A, data->charBuf, data->unkJapaneseString); sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); @@ -1661,24 +1686,24 @@ static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput) break; case NAME_SCREEN_BUTTON_OK: sub_020164C4(data->unk_5C4); - if (data->unk_014 == 0) { + if (!data->printedFromBattleGMM) { PlaySE(SEQ_SE_DP_PIRORIRO); ++data->spriteStates[6]; BeginNormalPaletteFade(2, 0, 0, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); NamingScreen_UpdateFieldMenuInputState(data, isButtonInput); - return 3; + return NS_MAIN_STATE_WAIT_FADE_OUT; } else { data->unk_45C = 5; } break; default: if (data->pageNum == 4 && key == CHAR_JP_SPACE) { - return 2; + return NS_MAIN_STATE_INPUT_LOOP; } if (data->textCursorPos != data->maxLen) { data->entryBuf[data->textCursorPos] = key; FillWindowPixelBuffer(&data->windows[3], 1); - sub_02084540(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); ++data->textCursorPos; sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); PlaySE(SEQ_SE_DP_BOX02); @@ -1687,14 +1712,14 @@ static int sub_02084884(NamingScreenAppData *data, u16 key, BOOL isButtonInput) G2_SetBlendAlpha(0, GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2, 8, 8); Sprite_SetAnimCtrlSeq(data->sprites1[8], 60); if (data->textCursorPos == data->maxLen) { - data->unk_034 = 1; + data->kbCursor.unk18 = TRUE; } NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->unk_15A, data->charBuf, data->unkJapaneseString); } break; } - return 2; + return NS_MAIN_STATE_INPUT_LOOP; } static void NamingScreen_UpdateFieldMenuInputState(NamingScreenAppData *data, BOOL toggle) { @@ -1710,8 +1735,8 @@ static void NamingScreen_UpdateFieldMenuInputState(NamingScreenAppData *data, BO // DANGER: Can spin infinitely here static int sub_02084C78(const u16 *a0, int a1) { do { - a1 = sub_02084264(a1 + 1, 0, 3); - } while (a0[a1] == 1); + a1 = NamingScreen_WrapAroundWithinInterval(a1 + 1, 0, 3); + } while (a0[a1] == CHAR_JP_SPACE); return a0[a1]; } @@ -1814,7 +1839,7 @@ static void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor } for (int i = 0; i < 5; ++i) { - sub_02084540(window, sKeyboardLayoutPtrs[pageNum][i], 0, 19 * i + 4, 16, TEXT_SPEED_NOTRANSFER, textColor, pRawData); + NamingScreen_BlitRawCharactersToWindow(window, sKeyboardLayoutPtrs[pageNum][i], 0, 19 * i + 4, 16, TEXT_SPEED_NOTRANSFER, textColor, pRawData); } CopyWindowToVram(window); @@ -1846,14 +1871,14 @@ static void NamingScreen_PlaceCursorSprite(NamingScreenAppData *data) { } if (data->textCursorPos == data->maxLen) { - data->cursorX = 12; - data->cursorY = 0; + data->kbCursor.x = 12; + data->kbCursor.y = 0; Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); - data->unk_034 = 0; + data->kbCursor.unk18 = FALSE; } else { Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); } - if (!data->unk_030) { + if (!data->kbCursor.showCursor) { Sprite_SetVisibleFlag(data->sprites1[8], FALSE); } else { NamingScreen_UpdateCursorSpritePosition(data, 0); @@ -1969,8 +1994,8 @@ static BOOL NamingScreen_HandleTouchInput(NamingScreenAppData *data) { break; } if (x >= x0 && y >= y0 && x <= x0 + dx && y <= y0 + dy) { - data->cursorX = sTouchHitboxDef[i].cursorX; - data->cursorY = sTouchHitboxDef[i].cursorY; + data->kbCursor.x = sTouchHitboxDef[i].cursorX; + data->kbCursor.y = sTouchHitboxDef[i].cursorY; return TRUE; } } From 1eac138c11fc02a11543039e37bd7f41dcb30891 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 13 Oct 2024 23:50:48 -0400 Subject: [PATCH 20/25] Documentation, 4 --- src/naming_screen.c | 132 ++++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/src/naming_screen.c b/src/naming_screen.c index 38953b02ad..44f9e99c10 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -104,8 +104,8 @@ typedef struct NamingScreenAppData { Sprite *iconSprites[2]; SysTask *tasks[7]; Window windows[10]; - int unk_458; - int unk_45C; + int battleMessageTextPrinterId; + int pageSwitchState; int pageNum; GFBgLayer unk_464; VecFx32 bgPosVecs[2]; @@ -138,7 +138,7 @@ typedef struct UnkStruct_02102278 { BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); static void NamingScreen_LoadMonIcon(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState); -static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, NamingScreenMainState a1); +static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, NamingScreenMainState state); static void NamingScreen_SetDefaultName(NamingScreenAppData *data, NamingScreenArgs *args); static BOOL NamingScreen_PMCharArrayIsAllSpaces(const u16 *s); BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState); @@ -157,25 +157,25 @@ static void SysTask_NamingScreen_SubspritePosController(SysTask *task, void *tas static void NamingScreen_CreateSprites(NamingScreenAppData *data); static void NamingScreen_CreateIconSprite(NamingScreenAppData *data, SpriteTemplate *tmplate); static void SysTask_NamingScreen_WiggleEffect(SysTask *task, void *taskData); -static void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData); -static void sub_02083F18(Window *window, NameScreenType unused, String *msg); -static void sub_02083F48(Window *window, NameScreenType unused, String *msg); +static void NamingScreen_HandlePageSwitch(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData); +static void NamingScreen_PrintMessageOnWindowLeftAlign(Window *window, NameScreenType unused, String *msg); +static void NamingScreen_PrintMessageOnWindowWithMargin(Window *window, NameScreenType unused, String *msg); static void NamingScreen_InitWindows(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); -static void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); -static void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId); +static void NamingScreen_SetPageBgPriorities(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); +static void NamingScreen_SetPagePgPosVecs(VecFx32 *posVecs, GFBgLayer bgId); static int NamingScreen_WrapAroundWithinInterval(int val, int lo, int hi); static void NamingScreen_MoveKeyboardCursor(NamingScreenAppData *data, int dpadMovement); static void NamingScreen_GetPlayerInput(NamingScreenAppData *data); static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, int dpadMovement); -static void sub_02084500(u16 *a0); +static void NamingScreen_PaletteGlowEffect(u16 *pSinArg); static void NamingScreen_BlitRawCharactersToWindow(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels); static void *NamingScreen_PrintStringOnWindow_GetPixelBuffer(Window *window, String *string, FontID fontId, u32 color); static void NamingScreen_PrintCharacterOnWindowAndOBJ(Window *windows, const u16 *tmpBuf, void *charBuf, String *string); static void NamingScreen_PrintLastCharacterOfEntryBuf(Window *window, u16 *entryBuf, u16 cursorPos, u16 *tmpBuf, void *charBuf, String *string); -static void NamingScreen_LoadKeyboardLayout(u16 (*a0)[13], const int a1); +static void NamingScreen_LoadKeyboardLayout(u16 (*keyboard)[13], const int pageNum); static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppData *data, u16 key, BOOL isButtonInput); static void NamingScreen_UpdateFieldMenuInputState(NamingScreenAppData *data, BOOL toggle); -static int sub_02084C78(const u16 *a0, int a1); +static int NamingScreen_SearchJpConvTableForNonSpace(const u16 *table, int pos); static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3); static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5); static void sub_02084E18(Sprite **sprites, int cursorPos, int maxLen); @@ -287,7 +287,7 @@ static const u16 *sKeyboardLayoutPtrs[][5] = { }; // These arrays are used to convert Japanese characters in response to pressing select. -static const u16 _02102422[][3] = { +static const u16 sJpCharConvTable[][3] = { { CHAR_JP_HIRA_A, CHAR_JP_SPACE, CHAR_JP_HIRA_A_SMALL }, { CHAR_JP_HIRA_I, CHAR_JP_SPACE, CHAR_JP_HIRA_I_SMALL }, { CHAR_JP_HIRA_U, CHAR_JP_SPACE, CHAR_JP_HIRA_U_SMALL }, @@ -530,7 +530,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { } break; case NS_MAIN_STATE_INPUT_LOOP: - switch (data->unk_45C) { + switch (data->pageSwitchState) { case 0: case 1: case 2: @@ -546,16 +546,16 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { NamingScreen_PrepareBattleMessage(data, ovyMan); FillWindowPixelBuffer(&data->windows[9], 15); DrawFrameAndWindow2(&data->windows[9], FALSE, 256, 10); - data->unk_458 = AddTextPrinterParameterized(&data->windows[9], 1, data->battleMsgString, 0, 0, 1, NULL); + data->battleMessageTextPrinterId = AddTextPrinterParameterized(&data->windows[9], 1, data->battleMsgString, 0, 0, 1, NULL); CopyWindowToVram(&data->windows[9]); - data->unk_45C = 6; + data->pageSwitchState = 6; break; case 6: - if (!TextPrinterCheckActive(data->unk_458)) { + if (!TextPrinterCheckActive(data->battleMessageTextPrinterId)) { PlaySE(SEQ_SE_DP_PIRORIRO); ++data->spriteStates[6]; - data->delayCounter = 0; - data->unk_45C = 7; + data->delayCounter = 0; + data->pageSwitchState = 7; } break; case 7: @@ -566,9 +566,9 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { } break; } - sub_02083D34(data->bgConfig, data->windows, &data->unk_45C, data->pageNum, &data->unk_464, data->bgPosVecs, data->sprites1, data->charData->pRawData); + NamingScreen_HandlePageSwitch(data->bgConfig, data->windows, &data->pageSwitchState, data->pageNum, &data->unk_464, data->bgPosVecs, data->sprites1, data->charData->pRawData); sub_02084F3C(data->spriteStates, data->sprites1, data->pageNum); - sub_02084500(&data->unk_038); + NamingScreen_PaletteGlowEffect(&data->unk_038); break; case NS_MAIN_STATE_WAIT_FADE_OUT: if (IsPaletteFadeFinished()) { @@ -581,8 +581,8 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { return FALSE; } -static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, NamingScreenMainState a1) { - NamingScreenMainState ret = a1; +static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, NamingScreenMainState state) { + NamingScreenMainState ret = state; NamingScreen_GetPlayerInput(data); if (gSystem.newKeys & PAD_BUTTON_SELECT) { @@ -591,7 +591,7 @@ static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, return ret; } if (data->type != NAME_SCREEN_UNK4) { - data->unk_45C = 0; + data->pageSwitchState = 0; ++data->pageNum; if (data->pageNum >= 3) { data->pageNum = 0; @@ -904,8 +904,8 @@ static void NamingScreen_ToggleGfxPlanes(GFPlaneToggle enable) { static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); - data->unk_45C = 4; - sub_0208423C(data->bgPosVecs, GF_BG_LYR_MAIN_0); + data->pageSwitchState = 4; + NamingScreen_SetPagePgPosVecs(data->bgPosVecs, GF_BG_LYR_MAIN_0); BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_X, data->bgPosVecs[data->unk_464].x); BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_Y, data->bgPosVecs[data->unk_464].y); BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_X, data->bgPosVecs[data->unk_464 ^ 1].x); @@ -1210,7 +1210,7 @@ static void SysTask_NamingScreen_WiggleEffect(SysTask *task, void *taskData) { ++data->state; // UB: potential use after free } -static void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData) { +static void NamingScreen_HandlePageSwitch(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData) { GFBgLayer bgId_prev = *pBgId; GFBgLayer bgId_curr = (GFBgLayer)(bgId_prev ^ 1); @@ -1218,7 +1218,7 @@ static void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int p case 0: { u16 fillVal = _02101D40[pageNum] | (_02101D40[pageNum] << 4); GfGfxLoader_LoadScrnData(NARC_a_0_3_1, pageNum + 6, bgConfig, bgId_prev, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); - sub_0208423C(posVecs, bgId_prev); + NamingScreen_SetPagePgPosVecs(posVecs, bgId_prev); sub_02084E54(&windows[bgId_prev], fillVal, pageNum, MAKE_TEXT_COLOR(14, 15, 0), pRawData); ++(*pState); break; @@ -1261,7 +1261,7 @@ static void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int p if (posVecs[bgId_prev].x == -11 && posVecs[bgId_curr].y == -196) { ++(*pState); (*pBgId) ^= 1; - sub_0208421C(bgConfig, *pBgId, posVecs); + NamingScreen_SetPageBgPriorities(bgConfig, *pBgId, posVecs); PlaySE(SEQ_SE_DP_NAMEIN_01); } break; @@ -1270,13 +1270,13 @@ static void sub_02083D34(BgConfig *bgConfig, Window *windows, int *pState, int p } } -static void sub_02083F18(Window *window, NameScreenType unused, String *msg) { +static void NamingScreen_PrintMessageOnWindowLeftAlign(Window *window, NameScreenType unused, String *msg) { DrawFrameAndWindow2(window, FALSE, 0x100, 10); AddTextPrinterParameterized(window, 1, msg, 0, 0, TEXT_SPEED_INSTANT, NULL); CopyWindowToVram(window); } -static void sub_02083F48(Window *window, NameScreenType unused, String *msg) { +static void NamingScreen_PrintMessageOnWindowWithMargin(Window *window, NameScreenType unused, String *msg) { int x = 16; int width = FontID_String_GetWidth(0, msg, 0); int windowWidth = GetWindowWidth(window) * 8; @@ -1313,13 +1313,13 @@ static void NamingScreen_InitWindows(NamingScreenAppData *data, OVY_MANAGER *ovy FillWindowPixelBuffer(&data->windows[8], 1); if (data->type == NAME_SCREEN_GROUP) { - sub_02083F48(&data->windows[8], data->type, data->unk_184); + NamingScreen_PrintMessageOnWindowWithMargin(&data->windows[8], data->type, data->unk_184); CopyWindowToVram(&data->windows[8]); } AddWindowParameterized(data->bgConfig, &data->windows[9], GF_BG_LYR_SUB_0, 2, 19, 27, 4, 12, 0x084); FillWindowPixelBuffer(&data->windows[9], 15); - sub_02083F18(&data->windows[9], data->type, data->promptString); + NamingScreen_PrintMessageOnWindowLeftAlign(&data->windows[9], data->type, data->promptString); OverlayManager_GetArgs(ovyMan); @@ -1337,19 +1337,19 @@ static void NamingScreen_InitWindows(NamingScreenAppData *data, OVY_MANAGER *ovy FillWindowPixelBuffer(&data->windows[7], 0); } -static void sub_0208421C(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos) { +static void NamingScreen_SetPageBgPriorities(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos) { SetBgPriority(bgId, 1); SetBgPriority(bgId ^ 1, 2); } -static void sub_0208423C(VecFx32 *posVecs, GFBgLayer bgId) { +static void NamingScreen_SetPagePgPosVecs(VecFx32 *posVecs, GFBgLayer bgId) { posVecs[bgId].x = 238; posVecs[bgId].y = -80; posVecs[bgId ^ 1].x = -11; posVecs[bgId ^ 1].y = -80; } -static const int _02102168[][2] = { +static const int sDpadMovementCoordDeltas[][2] = { { 0, 0 }, { 0, -1 }, { 0, 1 }, @@ -1376,14 +1376,14 @@ static void NamingScreen_MoveKeyboardCursor(NamingScreenAppData *data, int dpadM } u16 prevKey = data->keyboard[data->kbCursor.y][data->kbCursor.x]; - int newX = NamingScreen_WrapAroundWithinInterval(data->kbCursor.x + _02102168[dpadMovement][0], 0, 13); - int newY = NamingScreen_WrapAroundWithinInterval(data->kbCursor.y + _02102168[dpadMovement][1], 0, 6); + int newX = NamingScreen_WrapAroundWithinInterval(data->kbCursor.x + sDpadMovementCoordDeltas[dpadMovement][0], 0, 13); + int newY = NamingScreen_WrapAroundWithinInterval(data->kbCursor.y + sDpadMovementCoordDeltas[dpadMovement][1], 0, 6); while (data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP || (data->keyboard[newY][newX] == prevKey && data->keyboard[newY][newX] > NAME_SCREEN_BUTTON_START)) { - if (data->kbCursor.prevY == 0 && data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP && _02102168[dpadMovement][1] != 0) { + if (data->kbCursor.prevY == 0 && data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP && sDpadMovementCoordDeltas[dpadMovement][1] != 0) { newX = NamingScreen_WrapAroundWithinInterval(newX + data->kbCursor.deltaX, 0, 13); } else { - newX = NamingScreen_WrapAroundWithinInterval(newX + _02102168[dpadMovement][0], 0, 13); - newY = NamingScreen_WrapAroundWithinInterval(newY + _02102168[dpadMovement][1], 0, 6); + newX = NamingScreen_WrapAroundWithinInterval(newX + sDpadMovementCoordDeltas[dpadMovement][0], 0, 13); + newY = NamingScreen_WrapAroundWithinInterval(newY + sDpadMovementCoordDeltas[dpadMovement][1], 0, 6); } } data->kbCursor.x = newX; @@ -1473,17 +1473,17 @@ static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, i Sprite_SetAnimCtrlCurrentFrame(data->sprites1[8], 0); data->kbCursor.prevX = data->kbCursor.x; data->kbCursor.prevY = data->kbCursor.y; - if (_02102168[dpadMovement][0] != 0) { - data->kbCursor.deltaX = _02102168[dpadMovement][0]; + if (sDpadMovementCoordDeltas[dpadMovement][0] != 0) { + data->kbCursor.deltaX = sDpadMovementCoordDeltas[dpadMovement][0]; } } -static void sub_02084500(u16 *a0) { - *a0 += 20; - if (*a0 > 360) { - *a0 = 0; +static void NamingScreen_PaletteGlowEffect(u16 *pSinArg) { + *pSinArg += 20; + if (*pSinArg > 360) { + *pSinArg = 0; } - int val = ((GF_SinDeg(*a0) * 10) / FX32_ONE) + 15; + int val = ((GF_SinDeg(*pSinArg) * 10) / FX32_ONE) + 15; u16 col = RGB(29, val, 0); GX_LoadOBJPltt(&col, 0x3A, sizeof(col)); } @@ -1586,16 +1586,16 @@ static void NamingScreen_PrintLastCharacterOfEntryBuf(Window *window, u16 *entry tmpBuf[0] = character; if (character != CHAR_JP_SPACE) { - for (i = 0; i < NELEMS(_02102422); ++i) { - if (character == _02102422[i][0]) { + for (i = 0; i < NELEMS(sJpCharConvTable); ++i) { + if (character == sJpCharConvTable[i][0]) { for (j = 0; j < 3; ++j) { - tmpBuf[j] = _02102422[i][j]; + tmpBuf[j] = sJpCharConvTable[i][j]; } break; } - if (character == _02102422[i][2]) { + if (character == sJpCharConvTable[i][2]) { for (j = 0; j < 3; ++j) { - tmpBuf[j] = _02102422[i][j]; + tmpBuf[j] = sJpCharConvTable[i][j]; } break; } @@ -1661,8 +1661,8 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa case NAME_SCREEN_BUTTON_PAGE_SYMBOLS: case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED: if (data->pageNum != key - NAME_SCREEN_BUTTON_PAGE_UPPER) { - data->unk_45C = 0; - data->pageNum = key - NAME_SCREEN_BUTTON_PAGE_UPPER; + data->pageSwitchState = 0; + data->pageNum = key - NAME_SCREEN_BUTTON_PAGE_UPPER; NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); ++data->spriteStates[key - NAME_SCREEN_BUTTON_PAGE_UPPER]; PlaySE(SEQ_SE_DP_SYU03); @@ -1693,7 +1693,7 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa NamingScreen_UpdateFieldMenuInputState(data, isButtonInput); return NS_MAIN_STATE_WAIT_FADE_OUT; } else { - data->unk_45C = 5; + data->pageSwitchState = 5; } break; default: @@ -1732,12 +1732,11 @@ static void NamingScreen_UpdateFieldMenuInputState(NamingScreenAppData *data, BO } } -// DANGER: Can spin infinitely here -static int sub_02084C78(const u16 *a0, int a1) { +static int NamingScreen_SearchJpConvTableForNonSpace(const u16 *table, int pos) { do { - a1 = NamingScreen_WrapAroundWithinInterval(a1 + 1, 0, 3); - } while (a0[a1] == CHAR_JP_SPACE); - return a0[a1]; + pos = NamingScreen_WrapAroundWithinInterval(pos + 1, 0, 3); + } while (table[pos] == CHAR_JP_SPACE); + return table[pos]; } static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3) { @@ -1751,8 +1750,9 @@ static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3) { key = a2[a3 - 1]; for (i = a0; i < a1; ++i) { for (j = 0; j < 3; ++j) { - if (key == _02102422[i][j] && key != CHAR_JP_SPACE) { - a2[a3 - 1] = sub_02084C78(_02102422[i], j); + // This whole loop could be bypassed by simply checking whether key is space up-front + if (key == sJpCharConvTable[i][j] && key != CHAR_JP_SPACE) { + a2[a3 - 1] = NamingScreen_SearchJpConvTableForNonSpace(sJpCharConvTable[i], j); return TRUE; } } @@ -1770,14 +1770,14 @@ static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { } key = a4[a5 - 1]; for (i = a0; i < a1; ++i) { - if (key == _02102422[i][0]) { - a4[a5 - 1] = _02102422[i][a2]; + if (key == sJpCharConvTable[i][0]) { + a4[a5 - 1] = sJpCharConvTable[i][a2]; return TRUE; } } for (i = a0; i < a1; ++i) { - if (key == _02102422[i][a2]) { - a4[a5 - 1] = _02102422[i][0]; + if (key == sJpCharConvTable[i][a2]) { + a4[a5 - 1] = sJpCharConvTable[i][0]; return TRUE; } } From fb0702f528e52ec2589cb2072b0f771109c66fb7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 14 Oct 2024 07:43:57 -0400 Subject: [PATCH 21/25] Documentation, 5 --- files/.gitignore | 2 + files/a/0/3/1 | Bin 16432 -> 0 bytes files/data/namein.mk | 30 +++ files/data/namein/.knarcignore | 4 + files/data/namein/namein_00000002.NCGR | Bin 0 -> 8256 bytes files/data/namein/namein_00000003.NCGR | Bin 0 -> 2112 bytes files/data/namein/namein_00000004.NSCR | Bin 0 -> 1572 bytes files/data/namein/namein_00000005.NSCR | Bin 0 -> 1572 bytes files/data/namein/namein_00000006.NSCR | Bin 0 -> 932 bytes files/data/namein/namein_00000007.NSCR | Bin 0 -> 932 bytes files/data/namein/namein_00000008.NSCR | Bin 0 -> 932 bytes files/data/namein/namein_00000009.NSCR | Bin 0 -> 932 bytes files/data/namein/namein_00000010.NCGR | Bin 0 -> 26832 bytes files/data/namein/namein_00000011.NCGR | Bin 0 -> 3760 bytes files/data/namein/namein_00000012.NCER | Bin 0 -> 2166 bytes files/data/namein/namein_00000013.NCER | Bin 0 -> 461 bytes files/data/namein/namein_00000014.NANR | Bin 0 -> 3314 bytes files/data/namein/namein_00000015.NANR | Bin 0 -> 249 bytes files/data/namein/namein_00000016.NCGR | Bin 0 -> 1088 bytes files/data/namein/namein_00000017.NSCR | Bin 0 -> 1572 bytes files/data/namein/namein_00000018.NSCR | Bin 0 -> 1572 bytes filesystem.mk | 2 + include/filesystem_files_def.h | 2 +- src/naming_screen.c | 248 +++++++++++++------------ tmp.txt | 71 ------- 25 files changed, 168 insertions(+), 191 deletions(-) delete mode 100644 files/a/0/3/1 create mode 100644 files/data/namein.mk create mode 100644 files/data/namein/.knarcignore create mode 100644 files/data/namein/namein_00000002.NCGR create mode 100644 files/data/namein/namein_00000003.NCGR create mode 100644 files/data/namein/namein_00000004.NSCR create mode 100644 files/data/namein/namein_00000005.NSCR create mode 100644 files/data/namein/namein_00000006.NSCR create mode 100644 files/data/namein/namein_00000007.NSCR create mode 100644 files/data/namein/namein_00000008.NSCR create mode 100644 files/data/namein/namein_00000009.NSCR create mode 100644 files/data/namein/namein_00000010.NCGR create mode 100644 files/data/namein/namein_00000011.NCGR create mode 100644 files/data/namein/namein_00000012.NCER create mode 100644 files/data/namein/namein_00000013.NCER create mode 100644 files/data/namein/namein_00000014.NANR create mode 100644 files/data/namein/namein_00000015.NANR create mode 100644 files/data/namein/namein_00000016.NCGR create mode 100644 files/data/namein/namein_00000017.NSCR create mode 100644 files/data/namein/namein_00000018.NSCR delete mode 100644 tmp.txt diff --git a/files/.gitignore b/files/.gitignore index 975eb5efaa..9e69f13d85 100644 --- a/files/.gitignore +++ b/files/.gitignore @@ -13,6 +13,7 @@ a/0/2/0 a/0/2/1 a/0/2/7 a/0/3/0 +a/0/3/1 a/0/3/2 a/0/3/3 a/0/3/4 @@ -78,4 +79,5 @@ data/photo_data.narc graphic/camera_viewfinder.narc application/guinness.narc demo/intro/intro.narc +data/namein.narc *.NCLR diff --git a/files/a/0/3/1 b/files/a/0/3/1 deleted file mode 100644 index fabac04b023456a008f4c49c92ec05e103d441a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16432 zcmeIZdsq|K);PQ-lMrISOb8ehWrhG=YY7Cz8)lH;4V4I_dh}@U2CcRwUfQ(9njp4d zwFNKdRJ1KvZENGP#Y#($(I#y@uYDD3EY*6Wq1v8$UQcCmfrMN3w+Ga7d4GSLzrN@9 ze9t#KdnRjN*V?mYt-aRXdtr7#P6z>^W&tQ5VP;YGtRn!Rz>&Yk3I?NI2*Ae)Qh>*B ztc(QMj^n#S0gmAKlMLWz98XdJO*n3s55}S>06r$+2Ko3u69N8?aqOH95X5oJ42%bktF(Y|TsRAN0T>;85ionf+*wcK^n&?03sDFN z9%l-t7ZuId$KwCwKskIHNC)WO`s1c6>*g&_S+TTi*UG`nn>qGrr!)t~tfD$s1h%Hm zil3@AT1wkSSPC7+54BzEd(27ZH!Y_utEhbie}4J%%;qtBayCu)ZPK;E>x(DOK0kFK z?jOKE>3aUX)WH`2|NH-~Bk-T{Nv!3^#aYvqWgf`{cdZ_(2p0r9UgkVZ)?4g=d+qsDJy%_`SHvzvAQ*-%ddmjNjrZo8&9n%6Aw1 z?-u{Rl|r!$7AmuOp+XSA0~8h^!h-BMISfd{A&lWgi-`a_w!K!yNtual_{w558YeMH zqgh?j&X5#c9IsNT5(|dP<%v-yvX+K;m0B)uB%HKHE>Dh3lgkr|N!Hlfu+6v{YD=J! zBH1cV%qoA@kKx2jj@{l!*lbg5wpxWpbs}A-QxoxLTUs~*6ndHpZ^@g_k!G`+ILB$3 zMJ)qKTR775705p(x)X?gm6~*pB&_nPi+Yly<%Ilw;(QcEUiGRN<08RwgPP=wh7yB` z;4E@X3Y8dhk0QO>7)OQROf}AQXsWAmrh72c9E&q=C(tLzQN&G(?Dfzdbb=OWsKhvm z+?~g{q)~Akz2W6_O^z7d1=Y>Tg=}%_FPifIeMe#VvF`xn_tir?K7S%+k20b z`dWYEWc;6mG@s+-rJ(<-rte$-sOV7GPMB4WN7w`oWPII)6L(zh0 zagic1(CVul8Ld24l$4k`vI7HO-9~L3X;K6QKGadVS{axlogS_j z<~@wWy`eE@=cFj3e&~oL8|l3$IXlfdL(_7;rR4*MTN!v^=hw=O!LNdjT2lGGHMaHQ z#fxpXZrytM7EhQylS+gM7diSX_3x@LCClZD!rckJ@H>>4l1=_?QF2%EaA^yr%&aMh z>6$%!VnNJ>-=#>NkgFh4C0Ry^|3b;eX>YdafNY~k%Nda;_7Wx5E4puY`+LGrPi)Wl zp6NXcdy0ED_H6I@BkDQYbE>DM=f@tdSI`^XI~x5N1<9$u#yzXN6HGMGfjekQmR|c1 zn0i@n=^6y2pUmWmPYOvt;h#$jZ!BJdrf;MvIZ%X*PEbL|ke6%8A-e{OoqN1}=m%3< zJ@cBQJoD_eB>yoUOFE=a4`g3)T)DIxN%y?$$vgO< zV%|}XbeI&cMda}n_n^1l9C`R$eBLLhq8cL3)RGY`7F@!lh_Au-m^~=MYw^tQ9jx41 zR^k#Kq8CDZeGX21=5Y9|yPy4f1RK z+P133`jZ2d$**2E)S`YzhMhCwT5&RqoSs&U9#)Yc#0jj?e4QU>pBSj)KB*_avhPMA z%cOF?j**JXm(%4dAJjof%Kr6dF7q|q;!kjm4jxDHtLi2dBq-F z<<~*f>gqV6R^iun`?b+kTzvoqrK*_$xBJwEIdoL`7)shs_H;MVt+6v3$SCCn0>s}H z%|Jo=1r4{!SsrqK;R&G6WgP+cpO4R>V+Jd9-|T3j`3f;kTylR3w+T7Rk=rp)G~hn< z%pBSh_n_^AgC#9-Up^>`OFA5vdjsek9dLi}*Ew`7U$VEI^wWbyW52>B5#K7`DDohL z45$>L7tv1iHu@NSiCWPwD1ehgy(kjVC>7=WA4@n9&J2YBIyz)B;5b}k;QEEXThRTX z>dO02rG1o+Q`Jwy{rm0sPrK|4h&vcDylg>KM28G9?Xp@Db+mWfH- zF>fot)bEW!)h;@y-I9AiTle97ZP#DAe(3sJS8pH^1?WI(ASYl5lm=c5>Q;7->z>xV0CgL?H*{Ba z|DpSX?mu^5=x#&Z9X&*kq9?g0vuAG4vYux;dMu}QOWih}o&AYhR`=1p(TRPPCb|dN z<%Ri_K8MOnVjvt4#fJa0Zo|Mo>o&pvLAS~ArP`$82ueZ4X*4`HW!Y@}gEGSER49cU zl`1V=rJDJq28IBcPLY+VI=N1#)32#C7(hT6mb@}qW2mOc>6((-co@M5^m|K6#+8)7 z>_R=M!iwrttzrkv=159`OHFpvIu5fW^*wc+>*e}AG&&LI(c+LZaMy0of~Lf<#87Q` zC8@gFqcs@hnbpH40zqvy!>2^cE zyNzpW`whq++lE5>{Z$UH@toKAiLtucKmb;A#;pcwM6tkY#7a(?8fUQ7?WRvC3p0JQ zeT#gnHy*PldN~9L{f5Ae6@SP5w)-MLZHR*i1TvIkNqlwh4=&QztDoXC`iz~v)rDsK zsn)+D_yGSbO9ZtPDflF6+3J(KcSfB=-`5m;5M3C(EP8eHdVOGb4ZDP>sa#T5mtHxt zx;jT_j_!3C>*_3Z#HX6fB;+~i_jU?b-bDU-91eT5es_AH;N0a*bXnVZZl#u(7PHf% z9Trz`ZpactU0uvU4KXbpg+*W1$} zl`ipUWtSUMO*d~e8VKdEHQGr0b4?l9s$<*RV_FiXii2_6md6cZcNAutY;Pg*uJxL|JG=+I$Gr~kW$zuww$5>U<6Lrars7ME?B`;* zG29d`k6Z34o68YsFe@gTBL{QZ2eZ(BFg};~@gbPO=DAGt&$#ob58zHP34;aDzY@oN z8Ww=k~{VHQjEM3R~q!o$V?9W$OG2jKCXCBQjWN{X|JwRkegp_OxE zB+P_?JPC(9_*>rL(SB(WGvOXbyXUgUL7WRu5+{ur%8X?O26+&#u}Nc+uso)Y;3@Yb z{^Eg${I!qgFB1r{XTS=|)zl$s<0>9qXL1R}%mk5@DyG%~@d^<4I5DTxk6Br)Eyc*@ z*S8zjj5KMva&D*VFsJ>Q`Iw*SxDoexE(7< z?@sT*qs5lvKl2pbzVi_#Xa}|7wL!FwQGZIz{!ib}Ch7#WapPdc=LhJirA*XwK>Xnm zJsXO(<_Gj_#`H8kpy!Vd>Df!|`zLxfKceT4|3=Rz)ZTy4V~(!&bu8`#ivZ zKLa+c6Ql?YMTi7SfqiS@1_w55St%FB#d71h>D)pmSM1uzPXjiX1!nUGY!tPVO_Owa z6t-#25Z^Aa$L2L*`_42@XScIWU<9*S2_hQ6)`lm`by`ym?5oy}TL3b`UrH38bHaViuHBC(U`ELTR&_q@?An zEDw~3+S?u=q;kcg1FnEv%FzgSuWjs=ORX!sgjeBB4tg`abG^&F&t#))oldCB)@U^C zWTEEij3|t@jz`;&kydEn=vu~5C`USxE*kLkhBSa8JUiD=gbV8o@@$QPsnHeXg5WMB z@d#&tT9cbWWoQc3l{#H+(U2lTZV`wLATIP$Bq%71tu6yfi+bl1n|vAMPLFf6PC_ulKLI<3m2Alg`R3@u4OO=cn6gAKEV6@L6+-4ag=CmxHvK zCCeM3yeWEbv^lS-sp(50SxhuHnaz1*`zxDEb$NDkw5nMc(JvH%lv1RhB<~5!n_01C zjmyF}??ZmtPx}!5(?xVCx{|vxyXJN+>w4yr51l15G!qp}g=feAgL;g)l0&m{?Lowr2=`zqwkIVOXwK!fu`~T-G-L?Ni&$~H z1^4!ku6-y-pr9g{9Lx;P4K52l6F^_1t@Z%gAI{?zKqpaCj#-JyH<9T`E!sc)?u_v7R>|@L;g{VmxSd8X~W6M!sAOz_k zZZm+o`%ur&9;PR)N7wU2&y##oNL(2}M<4a7t5Txe?A#2#Q%Z3+d^z8#M(NQN=}s%V ziyn5Gk+C!*Tv!xNMu%y_sls!hnDa?A6b^QaV$1)vTh!avH?)uGOY771J<<1MFG9UY zin~2a^t$ctzT2n$^EZ(04dr9WMzY*2TED?=UoZXZXVUx3XS0C(ta;66O+@o7dwJex zW{47*o7T*-$GMxOZd6QCvWUftJNj2SExou={Ofi1y8GMuJ3>TA5lTj(%+TD>vd}Xj zONj2H_t7DKD0;CGg#?c1v2?C;Y+@sstINnX7|x6gD~uS*km2*9A2-0z^*V}-NHD~q zA}Q_%QL<_o+UB(M;byR9!FPrFu}*$;ZLdK;-M@dIA>XO{eVvp1hDH$22!4ebdX z34O+ez6sq3{rwBeB7?zDzKFo?pVXZYZ&+0B688?aW?I0S3pi4(u)>Q4He2$0OAWfE z6uH!91EFE*Q#QR6mxp-UdobiEcKT7IO)WMQEQR-Ms$^BNVX3HK>C&a|fp{s*FHL3= z)v|)6T;LN6bX$@+-`09q{!?5dM%rt+6nbNi#bDSt4bNNRxCy8cr(r?OpfsdIPoO8a zhX#yehWyy}qRmCp_xMq_*_=d&(1^ua@@pL3Fp4X4RSI9*Vm^0X*nj@qe4CYQ*+MBP z%Tb&1{JB4wNV8tbgUh}F(H3mWQ8sv%5&uNVC}q24yh?TGEI*WfG)TH1D~f$60euYQ zcmixf?86{AB{xPr4d=Xy_9GiYr_r~l9eMqzlk_7$>g%L&&>lgZ<+(NZ?PL(D_e7QN zB^Q{;Us$DRny}%$r5yPlr4*?ORH|f<7+4Cy7$%lSp)+vSO<6j9$VyWyyA*5b_E7-~ z+J!sA%_}++J2NpjaNR-<sea6oo?-O@L{VP zqcMO9gN~w8sAWdI#~8GHN}s3qx<9Zqmz3xPc3!aC301QgYe;)Dh2@jBH%1A0vO8F~ zufhDyxf@VpIkofQcloQa-fJna*z>%WZ94?@u%XG^yrJA)PCt;USg1~mYPAZcl$6_> zOU%t<&3Pckg0)GPhZ3-Fmk+#+iw>YaA@l`uq1#@quimTm=0p`<@3j1(%FtLpNrgjGHgV~Fa_?!;dN~N0vo1$2q7fH9H;4Yc&`51>9}%%NX*E{5N*#d z5>*;>!`g^=P|QxFu>_7W8!Wk1F}->%>T-8#JMpOE>wWY&I*-sTbbkPRaJz`mJ1^@E z@xKiHn`Y>5TXXQ&(@Ucz(_EyUE<|DrM~aOs8?el_@QlB+Ry#~C4>PQUa85g-q+~Re zP<3x~two-@ippGBBB!(~u}cVKobLpQqlgJmNO2FrMBLmR?2uT%H{!AQIIX9iGkP34 zod)1V);t>%Ds*#kgZ;cKV~v& zMO~3ybXRIuPM4vpwClx^ofvTrb$yO!5`)()#D6_#3wi@Jpij_QbhRJd^`U_KS9bul z)1L~g&USJMX8S0)eFAx6f<5lU2_V&CC&-ob}zbYj?NL>feI=)}HL1!k)D~=AIor2RA1mF0euT zfTS#xk5(eI3B7{eL?0qMy2yJY-+B}AE>%j=Ku0Aghu7_fal;uQC2ODw`M8APyN3@4 za*mu84XOw=L)AnmQqpu!ie#zs*4>h`H>F;kv{lD}FLXuEiXktj~tLJ$L=XrYZx9ZI! z`gyG!>ghxM(oj~v#j%O5l+_@5ucw}_G}ai=N1Jf-SX9vHD!Pk$P%IjcrlW<3bMy8& z@AkoluGWjm#|@)z&<*r=6v7z}EDJntFO5HbEq>uR5%pU7%zYMI3VGdL9MLXcB(q83bO&{!UlHm?_fS6;^=>Q)++8$I?9zJh93*H7TDr~MmJYPmQ~y)Fo+7(_ zLDY?Bc?eg-H-tJ69O6i1QY?()NLI-wVY)1ctHSP}oxKVDvi<~28;NQ4h&j~%dVjsg z;;Hmlkf+LH2}whv28E!P#MFm&gbs#|do4IrdMyZvc@n&6lWfA`*pYa^@NYo-X{@7u zDN5=1wjd`mAtN%`kOO2!WV%6b7&PZ)!_%oNV>944Elsbh=(63BVpB?9){!J$1JTgBG;R|IDF5}cPm_(SVA0eJ1IV$B)6_uhN<@pJ8 zo+D4)Q2{W-*H1C94rhW4QjF)G^HLG)a4NxDoTq|JBcjGIcurntErQ8W!+)h5dh&pQ z_dxT`ww{N6FxD~^s^)#ik&MDd<4+WbYC&~%-3w+jLq0jVq=dpEgo-ztt6pcwl9E>$ zDdj#4Kfip0ufUm$tEjy;SJ{205_Zvnc`}o$jE%1Y-CormO?q8jKWA>YxOy4$qBr%u zQ)IWCdNW6B>h?})+lwf%i*{kd)8q4syh`sle2l+gH(jVg=F%8g|>&tHzCnNQ{e{&jk~$gY^KFD{ILI!u0RLwuGC zauQT7ol2Eu)sw9gRasfzPlT)my6{d|C{2m+5>5*zu6RAqoK%^p7b6k_! z`t(iwm7Z{+uZxwgoA7A8iwi!yaQgU%$L+^p>gzgt+x2`oq`r4^ z>WX8LH^FfeT22pv7C0t^WAlcp&Z1wW+G{+7D#uh6Y+9 zNN`olVzo~lxB)GZ*IHX5HIZlrwuSJ;ON_(lQx%C&%ey2ma?rtTq+m7v^f!`G__2{h z0sM+c3vx!S{*Hv>7f!oAAdlM*eDJ!C&xc4jcKip}{^9gDhhSlVg@gs2ZiValEo}$d z+7?s@$gG@nc>P+|QER@d{`$#V2X0)PeGBMFohEYW#u2>uK&XqC$@n#n!Y`1&9==Ts zaz3n7{qR%okqf6`9vrv3%&+TQFS0j$=-72QHuXb@+&;y2v;O)S&TrxC)}V{G@CaPI z)mrU}%xZPgzjLDlH(Zg|vWQ5~=^|l)sEq#l76??BDf*EBMO)Emz-u932m#XL`mdmB zeYJbeeHvDXpoTz3s1DYM(34ltOO=(b6m(p6cU0IxaLF&fQiE!$*`SHsUX5y!s-gOB zQkq6{b24_Opc-5SG1b@btG|Y7G$608PE62fREqO+Vw&RgN9vTq|^2^C9DUs_B zQ-{gUu%zqQ&$ylA^H$hgr`%)hE)i-Ydyi?3gWZ07rn`-u3BKyPM{X`%Xp3yS>9`?6 zK;9&K;h8qbzupp=BdfDVUKR@ixbHxfHNSg-P6G>abpmL^ew;J#dsi`Da>_+HPql## z{%{=(SR@}u{$~O|2DqRg80{rzl0j|HCuGnV-0)r%MYM?~9nZIg-ILn}xglzGC(jgt z-@-jNhzYiAR3lgoFzP$437u_rfwJcwtDQt@(&j`qg-wDVU7sHCD{(LiM&DF>hU9Ny^5}}PFx^Hy<9d(C# zsE7Q}vo271i9ka%$MNeQ3^%)xWKtW^yBfLVy`76)%alL$wu#WhK%!|J}A*IjiUoZ_25%-Zj0?_g3d3SfIIhD_7@=j98wFx5_nLXv|p?@qVQ40Eq;x zZFXa%ARZX96ZQVBx3@2n!!Cf-zMQZ`&?Csu8~k*HX=ude4iLtp4nyD8zS_Qb-)j2B zDy+nF5mykQIV_M1s)2l?T5APz+nLvE@I-umM;MLps}D;=bFh(7Ge=WXy%4ImRWH2% zMom-j78-e?mh7j`q@MZt4G1n+^Yf=|xxH}FWjNcyEOT%` zf^e;=q=P1r(4=W1HPMNhC`kAYlD^XriHYCIHL9o(o}kI|6GzD=Onf6HzP~dwP!Lc9}TPEnUW`9d5Q2UxJpF(>HQPo!VuLJ z`w&B<#TKGbA1_LfcR>DKLf>KWh)#G{zn1c^lCjs@>Ls_PxOmB!FqFPrchvsEe!+m; zj3TcS)%1?KaDO=>7f4YXUPhmAU9h@s&t%&(k0oy-kYVikH|YJ>VcfC(1!s<_*2<0# zS^I?_T*FK&E!=LLzau@hiKvc?;3`vh(Jlnw?GnT?bRTS&~~E@4bCYZ zPAROGB~xMNJeD*`b96e$!Mm^a)!FT1r<`TT3m|Qoa+bY7k*D!Wx2}a~X=%Y$42Hh} z36Q5RfaF5UX=TfW!_bcB7{z#w(b8C{He-a#)MopIOH`GNdo%puC6-%0J| z%G)iqzMtNh(g3}4;pct(>gsZ2=^Bj<#Msr{O!dAZC+qMf9-l*rf5k~ZaJ@F0T;U0L zCH>ww??gOBU*uhV`?(xJRlz>N&a)h8v+3P!GQ3QEhPYdcr*s1Gx|_9RlsjGU^IXB* z`PhLI6{_7tRW(#nWt4eQ>DN)~sj9c}r7v^QaIxjq#fvR(U*FmWV!jk-Y4FL(@4w8J zB_6nS{rdG=ti`>E-0i;3mf{J~^;(?y+=6VGFYvu&gkox{EBbNUA@TzSdCYrUH}6nD zJvHs3w^e6SsK>P;!4J!)3U1=zrKIVHbi`Rgr#oVsyDuHc&AKQBBi=Ss2a|L*an9U* zHtdij6De_ru02|;NY~-TzFAnOga;LQ(PlxVz8vywx|~37!Irj~Q+Xg5wtVkYRup&94U^Lzq5dp%*21r(| zSUc;m!7z61Y*2JT>~ke5q99qdwjkL6M5O8oL-KAkOsoy#3TB7-17XpnlZN%LAyl@h zWh&b|ikveB#G?&Bme}THm*9D=VO4>OGQsF%gQ2WoZ3&bm7nn;`Dl?cztIVrP@z-8p z*l0*zWj2H-KVMo3kFPB)5sp?pUxK}qC1#>zbm=Uc%?u-rt?R8GkM_AI#$EKtz%ga<8>^MrD+m5(yBo0 z<9Kr=zq3Hg>2RzHVLNaaHhdl2SDa%vsSyeA2F^qvHB>}}2XAP_Ze$h2BSzq1c(WP% zZl3hK^)nO?!&)1H%!T6qWZ@uqXQZ-nnL-wbR*TaeG)e;e}e^S|%^+<)HJ>UH~kcmnw#SBpWT7y0-0;si&lw)5`j zvAQn2uRl_kuF>fd8z<^u_>VS0j1z`;7VFHh%0Q+Tev9Xwx&nhMZ*1#SVI1>0Q@J-+b z-caGd!Hw{+A|olf)IC3!$G?lD<{Zshi?!@wtM=R2ns?YY zkFfbR^Q@jGY(7h=!$6*&`^C)ez5!9%rO882Lg*Iex`VYSgogXe%Rqqo{yN zd4~~wL`mU`?ZgJKI#w~Ff}UR(DISV(mo`#HH-wpT81ZialnUn0%%1-(nZ8~6sjz04aIbvhW5R=(RH03Hc!BVPCBkE?g&#j_ z6P|oY*!-%{zDMYI$0q#RCOr3<@WNNZOW)drtv7@}{8f0{KC93XGLPr5%L?|fk+e?3p$yGnN4CVls9 zWT1!a4HKX!l8m>J;_;+(5-FQWDi+#EHVrYPnqtySjK(w}-89LNValFlnxAP}JlVABxhd9Fwa;41 zQmv*`>jp!rbz`b^Q>t}ys`WVxJfCVcr&<4+R{N{XdN0bjq*?E!*{pw0v;LN5 zy`N_7&>XK=p{X!xb{AKy)Ksi8Xew4~D%NN!)@mwBFi@IaaW%c-hxCeT>(X~$uegz3 zaWlQ*R=TaCExqE$^a^*zwuKqTw&iDR(`Rg3l(DB^TcIIiTT#X~e19Ti+hSsp8j6`l@J!ZM7g#P9#%Xf|Ju^P-pO#du{_FB|DhiO!+wqw}bG za}rz6=Z&?BsY`m<%a7r#N~$AzC)JV8cJvQaJE#}SX}xT^GeyTH1vd%$+s9;XnW>H0`J6y7JEoEn*RrzxGZ+65vr|6i-RzVjPFc*s zs4BysX4W*$e6wk0{pVpj*M|u{h&f3LKK_Ok$9#Q1$`NCaI`{p|OEGpT<%W&Tyv1sN zWM{XB-Hfma0=HT5&raE0mj0hl*)e~2%7#g!$xJU>v)s?-cd?6y#nsCC3QMnuSw)$U z6^FC32v&JzSdOA5njI6%ri>gtZB)k>@vL~*GI^PbRlbmf`GVG`=(PYX<68(I1t7+o zP=q#+i9itsN-@NR+klop;t&`kg$WThNQnf^P{@?QG-?Q7&l==J!EA*M@}eO>1`3D4 zVxFbOil*SEAx zu|e-tK+_0vIw8)o5z-liOiL(OLYa+Ea6%4tx#eyn5(o57E-gJS5f76{6C|?e{7i|` zrs!BO=kRLDm}eyuUb0D2UX^I}NHX7%OtT%6Xg`zWd?lIvtt2mM=eoa23Zpb3$+97m z`NOVA^zyGCmn@ko`TZxCq^U&mxnZN^^j3-U zHObjOO1?3?D{1*i;yNYy{=X#GU_jttc{83@I1luVZ9w5X&^I3qD4d7-#x|gE9_Sm} zfWmp8Z$2GRI1lxWfmb*W^$i9(G!ONSZ9w5X&^NXLh4Vn)93N0P5A}_KS2z##4c03Q zGal-jbps0Lfxc-NP&fnnMxASj{cz+tsv8TzM{<$}2K5b=lSlCeFo=<0F{!{?xN9Nq zW4!=xh9iJbN2|qZ*-tmPS@D1&`d3ie^($XN?mj1Nfhh5<1?AjOLfc+cx4e0BlPt{>TcJiwn_ z5Is1TCxFN}EWb_su{{1%o|Tyx!s}W1><5j{esGU*GdMlBirajid)0LG!PyUPE8-fl z{r5fhS1zc2`abdC><5Tn8aVs0AswInAadGS*@Lqmp)daB><4@eQx83dcNXgSlNS+# z$Hh#FmKJr(z-ck;sz7?_pYzW_g}tizW+&&2rK0G-0PIlDg69^-)8@4Pc#oa+!Ot9 z&;9?)d&-AKGBSqZooGoM0kWi_Nslur%#-Q|DJe;hlSz*;6PXA;VKy!^G3haESufzU zf8n&wN(B>bB9bWLIR$U?75_I`OW=*=_qZ=P$0A8gyEcYj?0jwI+ze*YK)H+{zg~^E zkz2mB$eF0gOgi5#m&`;Z5%Q!|CXK76NlQvi`oC|yl#xs5QO;Wyu%9-{n-IW!*|C1~4M)mU*3`Ks^B7ybULaRJ&l)-21O4Xu6F*+Sc4&a5Y% zy>IRDb8C+_sOCw!narcui<-I!tFu-spk)K3wHK7AY>myn$JGe zE^VLpPtULiQQ@Z4%-6(>44fM>L7>{OKD0kt3Q!c>Z(^|Hu*VCpf9jQfTr%9*-|l zXc~{#X`VvUc!&ReoVS&H3C&m6;XKa%K9ZaCp&fhZ2y>rn*Ze1MTyFC-;VSV|v!Ku^+vo%%GPB zswXMXM@s13+7)BKy|uGK3~=Y*1obGex92JRgu7}A<^09+oqI2z8J{if+w~7d2E8;; zJx_r?QbO;teq5(lm=^9FoTDBEUWL09-r`kBp`5>5Km0htca!$*`md)3H)jo0?^2+T zl+e4ZAJ_2}0)RUQcc@2!Z-lE9e#5s!3g!Ie`r*eBeoNB6UH|38;LAh<)vFZfBPH}M z>&NHL3IV{KgDcdd&|D0aeKLW<8K?{{m-!9cs!6#UrG4uY+;8)~Y58r++(@)B_#^~O zQ{;v1aUU+FatCdaJ9Ln4d@dg~H(B<{)EkUOdi~&5O~U@c{WkBzcA(df!RH}hnj$aY z?w1tASM-Z%$sIaKH$In-nwu>9Wa?c{r+WS1R!zeG!TmPx)Am}gAA|2gz%)f(;C(A4 zh_C1u(~>)MkZyb~A2l~w_Q}+{oJ{ok!L6Ev{e$~$ey>>mwy}BtG59J3OjG2A*A0UB ziheOIxkCr3;|p<5x0U&&9HBWRwNr-#8jbkNV%^@jQcY}TCNeI$U zYw<_l$S^MUz4fR09h_6*;GCReC%YYp?ZD%sG0Wwid3cER_^|DZPmN&=3*ce>VdpZ7 z#o~UwUf=IQFAI&?x5CO2xZl%QFYlL&$NRnYn&T0q6Q%BpB^V5KMDyM+^KACpbp7|& ze^lQOj>}zTw*$K!_@C?muJ>Q^yAAPPTN(dL;RP(e=^f< AMF0Q* literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000003.NCGR b/files/data/namein/namein_00000003.NCGR new file mode 100644 index 0000000000000000000000000000000000000000..dd7c31ea8944aa1431c0558eb3d950fd4b7e0248 GIT binary patch literal 2112 zcmb7`!H&}~5Qe?Wg%etC9IL!RaSlDQ1PM-nwz8Bb=!-;=%mZ-9d2hUv2`|vn7huEx zxB0WF8#moir{l>uWBc>i?ZfBdYxi_>^Wn8IcjneS+68ZvucH>ItUG4o8KXUWE zj9E?atIpXSxq+Sk2|ZsQ){F%WETayW);bkyx9wA}ZTqhc`w+I~cX(s|><%SOIFKdu z1$?}Bm^*cf4;~M4J)cu9WaFAKpHnVctMJIb){5@|!oD+Ix9!>x!rxuknJ#pDI30Y# zk?5GqA6vy_pJUJGX`((ZoUh}#o8h;vQKvQPv;;3Ink&@SaAt>%=o{iC+vl%%r|@p! z9fP?Sn!oCl`%z*)s`fu;X1k%};e)x~AdXY{4!^l9(U4@p9&P9An@Y57_&fm+Clm=Zd9loNkT} zxj=25_#KGz#r_;02QFN93AOm*`(r-h!afw`Pw^2K*%TM$NpVqp{q1{k*Z=r0@Gs#% D5J9zu literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000004.NSCR b/files/data/namein/namein_00000004.NSCR new file mode 100644 index 0000000000000000000000000000000000000000..cab16df3e80cf98101c8c0d6caba1b0eab195fc3 GIT binary patch literal 1572 zcmeH{K@Ng25Jg{Al%)$VfR-S~&}u-`F5tqRO#O`~pk1(#dC6qbHZVO NY|x^UVCS@Kcn5D}p1A-3 literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000006.NSCR b/files/data/namein/namein_00000006.NSCR new file mode 100644 index 0000000000000000000000000000000000000000..0eb39a037d18684f87be4f08036bebcb1e5bb16d GIT binary patch literal 932 zcmWG?4)**1kAZOsGXsMF10#c9kaO@9Ae(`)07x(}GyvJj0t*F_$be}AU?UhB1QG;N zfv^<_Nud+r`qN3$2eT(d24;Uc$##Rxpj3aG2*mzoffkC~&%lsEv3^*XkV3=!53-*W teXuxQB+v|v0rK3RF490X{p7eGVgFLH{J%^9=Ke;3CNkh+fhFJ^000=a*xUdB literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000007.NSCR b/files/data/namein/namein_00000007.NSCR new file mode 100644 index 0000000000000000000000000000000000000000..0289705014cabc7f0700297ad9d592b5d8604d25 GIT binary patch literal 932 zcmWG?4)**1kAZOsGXsMF10#c9kaO@9Ae(`)07x(}GyvJz0xJcw$bfkQU?Uhh1TqA2 zfv^_{Nue|0`twQB2eT(f1ZMvVlI;eW(MKiy-2y!nxu1a{heG{*6#1Wlfjs@I1iED) nF+iUC^F=zSq@O(ZuYlXXmaOnwCjfJQr$84OaJ9f1a1Hn|rsAIzQ-5t#iONVXef#xyGFpDZwiBKI>elu)RD8b$tRU?5NbCV|N^ okQgA({pBJPsHC4f_iupPzm=@;+a>^W|3raFWWdb=TfjL00GtT(NdN!< literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000009.NSCR b/files/data/namein/namein_00000009.NSCR new file mode 100644 index 0000000000000000000000000000000000000000..7b04c5190c59c92831edb27f47d8614c6bb59039 GIT binary patch literal 932 zcmWG?4)**1kAZOsGXsMF10#c9kaO@9Ae(`)07x(}GyvJv0y_n&$bfYMU?Ui22vi8v z0^wXBB!#Yo>#rwCAIzQ_5t#iuNVXef#yl$NpDi$lBKI>e)KI8@9!36VU?5NbE`ixH okQgA({q-UPx# literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000010.NCGR b/files/data/namein/namein_00000010.NCGR new file mode 100644 index 0000000000000000000000000000000000000000..8c1d29e9f6114da6a0d5abfdbbccce6513865ca8 GIT binary patch literal 26832 zcmeHPeQX@ZbsxeNPzbnMCkb|BL5*)^GPVVwkd{|iD%hC5C2b!=OS$7Z1q~?>ORW+J zuEDg`HX(rkhTWbF$%HMnkUAy6m?Y+ra8rqWPKF zzagGSxQ|hu6NZrYB{#m3B#h9b>w1r-X=TVLZNvv#2fHkoZ5gu?Uop)L_)OOyWSUkE zv-?5T(`$~EA)}i;t)@c#(Z_o6AB6xr-iEl=d$diP=%IG|$DX7$ser6-8;5Ww{JV zIZAx66|l>K8cnK|__C@d!DouHnaOfFROB_cs2ycUDr&Q=+Wk>FTJRr*06QK@BM2IvLGT=e#|wq?jSDYRuW z8Tfx8jAeAa4G!*bHBB*hEQJLnK zY+i7IlIQ~Xf&Op%U$R4PPIe@L7NEmLOS2qJl5bLoCX?V6LkAo@3I}(%_*CVns?ZYA zfyDr;0OCpHIsDBm3P0}vhV|7OMgUt8GvP}%=8I_>|xJ-tU=AWnI$W*hk? zJYS<7Umw$H=O5$1(Zuy{lxb^g!y#a7OxJDKNBk1w?thaonOyXf%pL zKnKnMaDAg`|iuIg8=>Q&`^ecT9DAIQPgmvQT0N7WM-PhOmgZ}{1x=o!D zSFc(p`cCxy0M!Tj`c9<#t_-AYN@?V~@{2k@CP{Bdl0<#xb|I<^mL2XUpUVlN;cy+B z{~_>L9ZO5KK|*~3wYgdXjpf%>RsA|f)(^x7TXl!NjMU0^WhOv<0m%u&s6XGSb`m-b z10QOq!Q)`7U>oPvP8A%9U^rAwbe=b)dZ}LROmud3o(JtjWA%0!C!OdF(wWZ>`ixeTutT8$ULTPd%Wqq`O-RhBsh+smM28 ztH^)tM7cb#{MY*QD<5F>`{0Tp!0MxX1M=T7KDhGFMd&1Zt{cdj^~rDyl{?Cu>8*m(Y4@cnzq*_h7Ci##6(jr+aIr|}EC-(0}^3#uRd z{9OJ1yw>*@?lbd}@6X*!k^-TzAf5R5d+$rV?=MQ8o#|P6kNgK)R;RR0ht(q4VNX|KNCw5>CQBr!h8n4)+=-Jm`Mjo(W1z5067UVXi3 zufE>2xBO~L|L*#|qq*oG@CbMX{c~veQ23C@--z@fxEII9Ll4-tO=TQ+vp?aVMIRLF z6PG-Y3V_(b%XhO2Wa0d%tZ7lj3toS<`X4DueO!9~q6%Ka;QJv_MQQZGYIC@|-5)=l z#k?x=*8Jb`kRbc3=05`er!c@WaK34744XSH?l8Arya+fHY0iJwG|kA?$ky=It$;%* z&G}%P#Mx@1x{ENV$Pa^m5%r4*i}hbX@fY3&BEVLF(pAi30c=}m)!+FVqog#S3*EPONx( zk%2}ZRGVLtLo$N=^B(g{Y!m8|LzU?)=K1L?=2g@Go_JtoA!Ry~-W;N?esNJ(zj!tM zz0W(|bmgv>KkqH}`Nt!Vp21|s&R$t_=blguru}{m*7iFzP ze7W_j*8Y-o_S^EsyhSuxt$)6JK^A=<*6Salc;EVBfhEO-4%GMnR;_>j{GxpDqxW9_ zs)JTo%TdxVUTDByzXIF-8;B+7SCCn){i39miB;?0GVu%J1Fg&AetWK%=eOsId3>J= zqM}TXe)~~pzbMNuF3R$Y2g$u_`RF0_G6)z_wGwLXM+Mo==&i|L8~yu73y5{?1%qZz2vru6ipxle5%?_}#RBfK zAqXx+>8CC5y|E2nX6#eM?|0J<|9+59fiEL+KO*;k;-pa?Bf9~)giq*uXC)&||wAUMk&H4NV7lU%+Dy{a)|pG;It*7T%O83>;gS21_>2u?oqseB9}4o z`_U^H-wWCC02uT%Vc%z_QmORc=(>$>X&O=LGv^aq*ZTb&=*%Y{LdmxL;bvVwa!q{?3ZCqLwVN&K4UUy$cF|DwGAZ}Tsn1r`^VW!Cfvol$&)j2{b=8q1D} zzGVY4hmfDm#v)Qyk)$S$8#|?@rkgvP+LfELN_$RfzQLrYZUT)V2XaW-C5JZcl1JrT zH)aFc7PGTrLWom-cJ^j&+vvof8d>wU$=#I$ljBRnVa4h-gSO<@4=DK z?EACK8eh+>k>6t@@%8ML@BN&;^}T7Kxur#O*)uuTluI$_%bFA%(yjYgHidz8&d+CN ztkA6+R!9yx&!S6{vea6zfeL|apvEvnHde_7$i^z!zyjpk^Bh!;Y|Lu|Y;dzhkW2qKmv`i1v@d(g_}et2@6#YfGoep1PPcgDy6r`gEf3!zu`7_)Cp zPb_5psW>@Pb7yi>b2n1iP}2=8N1lgf#?H)SL${hj_#1%`YlkoV`y7LbI8W*o8(uQ= zKj)eHd47MsKmTezmGU+-kBt1mb*w-CO_sXTk8hVOC~zOh+RNG~E)cdE2Fr%8z1pAe zPu(fvl~lg}kyPr}kL;G^*(YQ<-`~G3pHJO#Am7UO%i&aNdqkEc;8ywgRXOJ#c`#+Ot{F7e3VL!#t$0V_ime6tp7Rq{)jwknxjwM&OQ0mf2DpsJlpx4 zk(+&g2J1gC3*Ub+$M#KIp;+1sUBgOU(=OPq$gI6ZVY!YLHi5>ok^{HPv2W*?^7qqB z#kI%iLRK3nR(mMgfL~jp4fyc`@*Eq;GS~nV88xuZg$=T?N;W_?R>=m+WRa8^jFsWe zKWvP#ZC)EFR3jVn+5oNptm#K)?oSf8$;QfTV1#U7CiKk=v3E05S>zMzdMIHS1zs$zEKMW}?uz?J08|G1B&AzSHl3ASlW$}N~ZFFY& z{2!j4!`v7AKTC68zOM2SDx3Qp=6>g>In>mCJ3FG3`@cQ+v!Q)I%FV^PF3g5W9&c<3 zbZV|$o|vY`VlxUDNryxUf+`=3I}8O%LwI%kGp9?XVdB1@23YZcfC+n>ifBH!yy zTuHN!@sa=dF1)__RezrSHlNSl$>*O0+Ec*msjmVrPn_(Z&*wkJ{*Vs=*dy}KH@gNelCSd*+Y?%poTyKyd%N_BJZM>bmHk%%?2^V-PZHkL|Hvw^{L)Q%mv9q{x* zsgZs233i~Ni@m5l&kkrGvaGhwJ|nmjJg{?ez4SA4y&5u>Y0ArbT51Cxw$}zc?1dyt zZ2&e_$p*;AD%rpS1d==+yf(nd#=JHVfelv5|qq#E5iwbp7Gym(};Ff2DK(#rA)DKK$l> z!yujy)5jkjIyLCy|2g=7I+Qw&c{x5Y!Y4Ig?m0Vuz-C&0jv2T< zv|hrzYZ?H0_`}7W59t1Ml?3sQxEROZ496~8*6Flq?zwDZ5^-zKD-LU(9s3@!Sp4!fLGu` z{NfnB03UKG?G&h~Ef23w+H7$P#5zKg9H9l11(EaVARXK?I^Ci>Sz- zvgW3ytikCVs3?>AA*LygAj+dLxCu}{>@YVyJw4~PPjgGMNMFvMcIA+KKfWlB#-JUb zepC++k(uoBlzYfHi+4Gj0AFjR(q|2Wsyh6@Qk$HTV)IlMdhG?`E-3B<1)WxuVdL4; zjetUPZd1<3kSVC97_nzh8wvq&qHZ8%s4)c*G~<9Wo$NShtSB388A=RYiJ#iD8BLut z9QnwlI2y2Ib<1f36*!+BKUR8goCe(xV4T*#G3Hr^71bxr_8*06D@NnxnRXzMPlD`4t zuQmF)x5J5g75}8?)q1pL2kHsw{Z-&;;D3-f^2dl6-IB5QCCP{rz5+C;fM&!s8=Bgc zz)#Gni3a?T@IYu|^^JS5x5>slW6AdLGl$k2de`E!Q854Pi(k}6-z@;jH{x`WOk{$Bzs n;W^(699G+kO2fmNMjWE{Z9kB;|KDymxAC{ZL|I2sv*0~+J!@;;% z;SB(~LkT{nSw7Y@TU3RT2Y7XU-vr-r&0L@WW4XNF*McT!&}y9E;Cb#mf8K+o&pk}} zr}D6>r`~YzFEvhilUoDhyN>yn=3}0vW8<3mcCPil!@ig5r@miHe`$Wuxfu0g&Z&yF zPHEu$Uml0nc5yO2#`%m4ba%d-i#*{U+d2#?tyc_+LAih$r-fX+9yY2QK|}E(7`o2d zIM2aQ67)56!S|`>XfMr$Z{&W?DkXSou8D8p7A0DpJm@d0TX~Gn<&r0IG;(r#_auK* z69+ZoOdp-&6ZUV)&uORdDQnCPfJn?Y-_I4aO^IP|rZ;(F%{y4ryRSa){Zhlcfb;t> W?;s)9T$1Y@>QA@>bN@NH^#282AH=-? literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000012.NCER b/files/data/namein/namein_00000012.NCER new file mode 100644 index 0000000000000000000000000000000000000000..bdd7a544818d44c1cc095f00f40ed6441d7fa48d GIT binary patch literal 2166 zcmZvePe@c@6vgiwOJAuqYDl!OQKCgey}$N{(C3Uwl!-`1L_`!tg^5T+w20RqT13bo z5z#^-BBF&z3y~0;A|fKpRYZ$|h-g)Vv=}6;bFZJhOZ36-ob%o9F=yt@Jeb~&T=(yJ zvd-B=X)2@L*^bv>N=oEL!$=RF1@Zc3xG0_w2lC0q@y)@$2z^@pT)_o}Je^ zz~}6|HUNt%#Ch+qVExZiR4H@z9k_;lr}4ew)pP{Ts}H28TAcUi&7PgtRlw)$yz-!$ zTEs1U+KP;jIT1j#&|}&iq;$7XxuZt)p(2XcH_H@ z_ZZ)A{E&DV9fhZG_fLvf(phsJ8^31!hVfzJw~db&zb{@!j~3h-TkzEQf>%t!mr!}d zbK@V3&l+EzS~zcl$SF9`fkF>-tT51+j*6G^&~$to>cn@UJ@G^6 zKs*M`#}m-8xB#7rUo~dp7loNdeBn{CW4)Xky z=nv7~9#2+YVO=Y_nUz}Wh)OlBb$I_7){@&=XOrzjP|8F&wbQJ4(=u<9Nt>K^;U=!F5IzcZu3{Hb{;4&BjcfbSi7)*iJ z;2ro3zJobXj&GwDG=L4D8Dv2>I0#OFL2waV2e-gIFbbZ4mmqh%udl8D)S2T>65S+v zN%WH#Br!~4a}u{CacdH{CDGM&s?Sx0u4;5urK>t!RqCo%SJk?z*HgWo>h)Bwr+Pir z>#1H(^?It;Q@x(*^;NI0dVSUFt6pFA`l{Dgy}s)8Rj;pl1JxU--az#Rsy9%*f$9xZ uZ=iYu)f=eZQ1ynYH&nf$>J3$IsCq-y8>-$=^@ggq*`d7$I`%F8Gx!70yS>=} literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000013.NCER b/files/data/namein/namein_00000013.NCER new file mode 100644 index 0000000000000000000000000000000000000000..8584822e07ab1c553ba1af8ad2f70ffa475970b3 GIT binary patch literal 461 zcmZ9Iu}T9$6h-eUs6mSIKQEUUh`2?QLN^X|NNW{SDZ($Vh^f{y@D*v8E;OJ61L0ElG&Uxzr8DbT@5 z@UkAhN!>*ctJ=jE&s}VZ**CS5m&m>`)@RRBS8fmAsGO3lO)QK_kaO!hGjd8AE54Yg z!k7d(x4ttYr=BoYVS(BuSm?rNVL~c$X?^FDd?%eJYMbB)m-m*nk~(iW=k`o8PW`CHZ&WW4b6sTNHZS}@++*?zLZdQI-X1h&yP>z R^G!@P@d9^cc7L$G^anHta&!Oy literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000014.NANR b/files/data/namein/namein_00000014.NANR new file mode 100644 index 0000000000000000000000000000000000000000..87873846c5e194097a97ec27d757e1e4236bd12e GIT binary patch literal 3314 zcmZ9MZ%CbG7{>3T=FT>&(=xL%cebo-+4B9TZn;vog^-Di1ria1T3FbSh>(aOeF*78 zNFPG_5HcbpA|fJ2ABOZHMvUQy2#JUo5hJ2xL`a0|cb{`VoV(|R-?^Uaz3%t9-uL`F zF*!PUeOpS`+C(bSEKf|1jh1(c9FeoqDI!;!MK*S@u%lGdk~Eno=BWEJtNQu6uhtS? zEbnLK=ZB(vD$1wve!sbBej%D)jPjKzU&Z_V*6{v$)}#52DBq0oExg~a!e)NID#kx= zFFwrc+(_i7B7X|6bNZ?}7v=LV*L@eGd@0IT@cw>Q-Mn7E7R|3m^BYmV8Rc8}@O-Kj zUO2^J-v_+!?~U>id<)Y}%R(xvI_w&)>%X<|~$~>U_K9!3XWMTvhiAzAKuqTCS@5^`Lrx!3XWNTvhiA zz7Ox``z=@1{c_8L4?1MIs_qy3a5O)HFO!db}7Tecp0a-9Px5XnxjmRo!pS^5BEMYPqWJ7yNuQ|AyrYXcKdbrc0*F zsP?R&`aYdA{V?*Yce?jt zll8&_azGxGK6ywE%ES16NhC#cDP%wfWr+15I1G=#FdTtL;V~G2Q5ln?a!ii1o){aQ zxNQHAySc9p*av+u2>N?}5~krfI0LW4TktM?03XAb@HJcp{Vx6r`kmQ^U3_L8pr7GE zI1G=&33wJ>g4f_pcn98xkKl8-0N=v*a0UK=f1s5&a}RXG0T_TWn1rX{1$YI{!rSm3 zoP$r{EBFSEo}Qf@J@ewrr~4brq_IpJ%dD}?8_S}x9B3>D8_S`_@=#-$_&V2@xWdFW zCayAZorx<=Tx;TL6W5!%-qiJ`t~YhPsq0N$Z|Zte*PFWD)b(brH*>w2>&;wm=6W;N zo4MZ1^=7U&bG^Ci&0TNqdUMyCyWZUO=B_t)y}9enU2oxf3)fq?-oo`3uD5W#h3hR` WZ{d0i*E`TJC#R1;)y6MQkN*Jk0;J0T literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000015.NANR b/files/data/namein/namein_00000015.NANR new file mode 100644 index 0000000000000000000000000000000000000000..e3ad94f41462ae6829b51de678efde29c64c2ae5 GIT binary patch literal 249 zcmWIYbM*WFkAd+g0|SEq12coSpOfPXAe)(ilR*MVdjRnSAcg^EFoThS5h?(oA$*W} zRwQ`^s2UcA_xqTDY!J-?q(y)<2b2$@nSgvAD9r~I2k}AbVd@xwHZn1sIl~OZEI?a) poE&{jfoed28;He#*f}*P$1yK6H`NfqG(a$o7(yakLqP_E001f9C!GKQ literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000016.NCGR b/files/data/namein/namein_00000016.NCGR new file mode 100644 index 0000000000000000000000000000000000000000..d1461b49cdcf64600235e88bc8ee5494464ec7e5 GIT binary patch literal 1088 zcmWG?clP`LkCD-Vg@HkUfr%l=(Zg8*$Yuiam>G}&P)q`ei;Ma19|Obt_xubWKHyS8 zTk&^%3=AMQyaVD7|7mL%!@GCy9{m6R{{cUceh;RBwj%(D^B#yF@FU~@?;pH>_wND! z|NkKUKu4mu5?L+K3k*Q5D8Sg**aaU>OG_)qhtHfja~B_;IdkSJd{~eGa3KIz5dh@` W07_tta_Alc!Ttfx0#I8)B zGw2Pqky-5__xl69VDRK~|J=&wUi|~c4M$_}%D?%MoqU26mk*^(*rG%4g1x0<%Li+K Buu%X2 literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000018.NSCR b/files/data/namein/namein_00000018.NSCR new file mode 100644 index 0000000000000000000000000000000000000000..b79e861ca6a3e581231d12bf4ae0c34b5769c222 GIT binary patch literal 1572 zcmeIvI}3v_6b0afLMMj~1>bTCXVlrZ4(<;6hx^Ogrc`v$1f+Db`5@foaPLiqZtR~A zA$bP*?JRwK3e6YUHu!h3${wLD?k6pMrzsPJ--JZwH|8&pB@X8 LsPtGFlq~oHjEc5n literal 0 HcmV?d00001 diff --git a/filesystem.mk b/filesystem.mk index 8e67b5a5e5..f959ee89a4 100644 --- a/filesystem.mk +++ b/filesystem.mk @@ -410,6 +410,7 @@ $(eval $(call arc_strip_name,files/itemtool/itemdata/item_icon.narc,files/a/0/1/ $(eval $(call arc_strip_name,files/graphic/plist_gra.narc,files/a/0/2/1)) $(eval $(call arc_strip_name,files/msgdata/msg.narc,files/a/0/2/7)) $(eval $(call arc_strip_name,files/battledata/script/effect_script.narc,files/a/0/3/0)) +$(eval $(call arc_strip_name,files/data/namein.narc,files/a/0/3/1)) $(eval $(call arc_strip_name,files/fielddata/eventdata/zone_event.narc,files/a/0/3/2)) $(eval $(call arc_strip_name,files/poketool/personal/wotbl.narc,files/a/0/3/3)) $(eval $(call arc_strip_name,files/poketool/personal/evo.narc,files/a/0/3/4)) @@ -519,6 +520,7 @@ include files/data/photo_data.mk include files/graphic/camera_viewfinder.mk include files/application/guinness.mk include files/demo/intro/intro.mk +include files/data/namein.mk $(filter-out $(DIFF_ARCS) $(FS_RULE_OVERRIDES),$(NITROFS_FILES)): ; diff --git a/include/filesystem_files_def.h b/include/filesystem_files_def.h index 8a182e6c61..2d0814ccbf 100644 --- a/include/filesystem_files_def.h +++ b/include/filesystem_files_def.h @@ -35,7 +35,7 @@ typedef enum NarcId { NARC_a_0_2_8 = 28, NARC_a_0_2_9 = 29, NARC_a_0_3_0 = 30, - NARC_a_0_3_1 = 31, + NARC_data_namein = 31, NARC_fielddata_eventdata_zone_event = 32, NARC_poketool_personal_wotbl = 33, NARC_poketool_personal_evo = 34, diff --git a/src/naming_screen.c b/src/naming_screen.c index 44f9e99c10..78d3b61b6b 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -2,6 +2,7 @@ #include "global.h" +#include "data/namein.naix" #include "msgdata/msg.naix" #include "msgdata/msg/msg_0197.h" #include "msgdata/msg/msg_0249.h" @@ -99,7 +100,7 @@ typedef struct NamingScreenAppData { GF_2DGfxResObj *gfxResObjs[2][4]; SpriteResourcesHeader spriteResHdr_Main; SpriteResourcesHeader spriteResHdr_Sub; - Sprite *sprites1[14]; + Sprite *uiSprites[14]; Sprite *textEntrySprites[12]; Sprite *iconSprites[2]; SysTask *tasks[7]; @@ -113,7 +114,7 @@ typedef struct NamingScreenAppData { int unk_484; // set but never used int unk_488; // set but never used int unk_48C; // set but never used - int spriteStates[7]; + BOOL spriteAnimUpdateReq[7]; void *unk_4AC; NNSG2dCharacterData *charData; void *unk_4B4; @@ -130,9 +131,9 @@ typedef struct NamingScreenAppData { typedef struct UnkStruct_02102278 { u8 x; u8 y; - u16 sizeParam : 2; - u8 cursorX : 5; - u8 cursorY : 5; + u16 sizeParam : 2; // GameFreak tried to be size-efficient here, but + u8 cursorX : 5; // messed up the data types. + u8 cursorY : 5; // cursorX and cursorY should both be u16. } NamingScreenTouchHitboxDef; BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); @@ -179,15 +180,20 @@ static int NamingScreen_SearchJpConvTableForNonSpace(const u16 *table, int pos); static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3); static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5); static void sub_02084E18(Sprite **sprites, int cursorPos, int maxLen); -static void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); -static void sub_02084F3C(int *spriteStates, Sprite **sprites, int pageNum); +static void NamingScreen_DrawKeyboardOnWindow(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); +static void NamingScreen_UpdateSpritesAnims(BOOL *req, Sprite **sprites, int pageNum); static void NamingScreen_PlaceCursorSprite(NamingScreenAppData *data); static BOOL NamingScreen_HandleTouchInput(NamingScreenAppData *data); // set but never referenced, never cleaned up static NamingScreenAppData *sAppData; -static const int _021021E8[][4] = { +// sprite params +// [0]: x coord +// [1]: y coord +// [2]: anim +// [3]: priority +static const int sUISpritesParam[][4] = { { 0x04, 0x44, 0x03, 0x01 }, { 0x24, 0x44, 0x08, 0x01 }, { 0x44, 0x44, 0x0D, 0x01 }, @@ -211,25 +217,27 @@ static const u16 *sKeyboardHomeRowLayoutPtrs[] = { sKeyboardHomeRow_Numpad, }; -static const u16 _02101D80[] = { - 0x0019, - 0x0039, - 0x0059, - 0x0061, - 0x007A, - 0x009E, - 0x00C6, +// x coordinates +static const u16 sHomeRowCursorXCoords[] = { + 0x0019, // Upper + 0x0039, // Lower + 0x0059, // Symbols + 0x0061, // JP Symbols + 0x007A, // Numpad + 0x009E, // Back + 0x00C6, // OK 0x0000, }; -static const u8 _02101D4C[] = { - 0x28, - 0x28, - 0x28, - 0x28, - 0x29, - 0x29, - 0x29, +// anim ids +static const u8 sHomeRowCursorAnimIDs[] = { + 0x28, // Upper + 0x28, // Lower + 0x28, // Symbols + 0x28, // JP Symbols + 0x29, // Numpad + 0x29, // Back + 0x29, // OK }; static const u16 sKeyboardRow_Upper_1[] = { CHAR_A, CHAR_B, CHAR_C, CHAR_D, CHAR_E, CHAR_F, CHAR_G, CHAR_H, CHAR_I, CHAR_J, CHAR_SPACE, CHAR_COMMA, CHAR_PERIOD, EOS }; @@ -286,7 +294,7 @@ static const u16 *sKeyboardLayoutPtrs[][5] = { { sKeyboardRow_Numpad_1, sKeyboardRow_Numpad_2, sKeyboardRow_Numpad_345, sKeyboardRow_Numpad_345, sKeyboardRow_Numpad_345 }, }; -// These arrays are used to convert Japanese characters in response to pressing select. +// These arrays are used to convert Japanese characters in response to pressing R. static const u16 sJpCharConvTable[][3] = { { CHAR_JP_HIRA_A, CHAR_JP_SPACE, CHAR_JP_HIRA_A_SMALL }, { CHAR_JP_HIRA_I, CHAR_JP_SPACE, CHAR_JP_HIRA_I_SMALL }, @@ -372,7 +380,7 @@ static const u16 sJpCharConvTable[][3] = { { CHAR_JP_KATA_HO, CHAR_JP_KATA_BO, CHAR_JP_KATA_PO }, }; -static const u16 _021021B8[][2] = { +static const u16 sDakutenTable[][2] = { { CHAR_JP_HIRA_TU_SMALL, CHAR_JP_HIRA_DU }, { CHAR_JP_KATA_TU_SMALL, CHAR_JP_KATA_DU }, { CHAR_JP_HIRA_PA, CHAR_JP_HIRA_BA }, @@ -387,7 +395,7 @@ static const u16 _021021B8[][2] = { { CHAR_JP_KATA_PO, CHAR_JP_KATA_BO }, }; -static const u16 _02102190[][2] = { +static const u16 sHandakutenTable[][2] = { { CHAR_JP_HIRA_BA, CHAR_JP_HIRA_PA }, { CHAR_JP_HIRA_BI, CHAR_JP_HIRA_PI }, { CHAR_JP_HIRA_BU, CHAR_JP_HIRA_PU }, @@ -400,13 +408,14 @@ static const u16 _02102190[][2] = { { CHAR_JP_KATA_BO, CHAR_JP_KATA_PO }, }; -static const int _02101D54[] = { +// offsets for GXS_LoadOBJ +static const int sSpriteGfxOffsets[] = { 0x00000070, 0x0000004C, 0x00000048, }; -static const u8 _02101D40[] = { +static const u8 sKeyboardFrameColors[] = { 0x04, 0x07, 0x0D, @@ -429,6 +438,7 @@ static const u16 *sDeadstrippedPointersTable[] = { sPrompt_BoxName, }; +// These are the GMMs that replace the above. static const int _021020B4[] = { msg_0249_00000, msg_0249_00001, @@ -463,7 +473,7 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { data = OverlayManager_CreateAndGetData(ovyMan, sizeof(NamingScreenAppData), HEAP_ID_NAMING_SCREEN); memset(data, 0, sizeof(NamingScreenAppData)); data->bgConfig = BgConfig_Alloc(HEAP_ID_NAMING_SCREEN); - narc = NARC_New(NARC_a_0_3_1, HEAP_ID_NAMING_SCREEN); + narc = NARC_New(NARC_data_namein, HEAP_ID_NAMING_SCREEN); data->msgFormat = MessageFormat_New(HEAP_ID_NAMING_SCREEN); data->msgData_249 = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_msgdata_msg, NARC_msg_msg_0249_bin, HEAP_ID_NAMING_SCREEN); data->msgData_254 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0254_bin, HEAP_ID_NAMING_SCREEN); @@ -523,7 +533,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { case NS_MAIN_STATE_FINISH_INIT: ++data->delayCounter; NamingScreen_PlaceCursorSprite(data); - sub_02084F3C(data->spriteStates, data->sprites1, data->pageNum); + NamingScreen_UpdateSpritesAnims(data->spriteAnimUpdateReq, data->uiSprites, data->pageNum); if (data->delayCounter > 5) { *pState = NS_MAIN_STATE_INPUT_LOOP; data->delayCounter = 0; @@ -553,7 +563,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { case 6: if (!TextPrinterCheckActive(data->battleMessageTextPrinterId)) { PlaySE(SEQ_SE_DP_PIRORIRO); - ++data->spriteStates[6]; + ++data->spriteAnimUpdateReq[6]; data->delayCounter = 0; data->pageSwitchState = 7; } @@ -566,8 +576,8 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { } break; } - NamingScreen_HandlePageSwitch(data->bgConfig, data->windows, &data->pageSwitchState, data->pageNum, &data->unk_464, data->bgPosVecs, data->sprites1, data->charData->pRawData); - sub_02084F3C(data->spriteStates, data->sprites1, data->pageNum); + NamingScreen_HandlePageSwitch(data->bgConfig, data->windows, &data->pageSwitchState, data->pageNum, &data->unk_464, data->bgPosVecs, data->uiSprites, data->charData->pRawData); + NamingScreen_UpdateSpritesAnims(data->spriteAnimUpdateReq, data->uiSprites, data->pageNum); NamingScreen_PaletteGlowEffect(&data->unk_038); break; case NS_MAIN_STATE_WAIT_FADE_OUT: @@ -586,8 +596,8 @@ static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, NamingScreen_GetPlayerInput(data); if (gSystem.newKeys & PAD_BUTTON_SELECT) { - if (!Sprite_GetVisibleFlag(data->sprites1[8])) { - Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + if (!Sprite_GetVisibleFlag(data->uiSprites[8])) { + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); return ret; } if (data->type != NAME_SCREEN_UNK4) { @@ -596,12 +606,12 @@ static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, if (data->pageNum >= 3) { data->pageNum = 0; } - ++data->spriteStates[data->pageNum]; + ++data->spriteAnimUpdateReq[data->pageNum]; NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); PlaySE(SEQ_SE_DP_SYU03); data->kbCursor.showCursor = TRUE; } - ++data->spriteStates[data->pageNum]; + ++data->spriteAnimUpdateReq[data->pageNum]; NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); PlaySE(SEQ_SE_DP_SYU03); } else if (gSystem.newKeys & PAD_BUTTON_A) { @@ -939,12 +949,12 @@ static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, data->unk_48C = 0; data->entryBuf[data->maxLen] = EOS; for (int i = 0; i < 7; ++i) { - data->spriteStates[i] = 0; + data->spriteAnimUpdateReq[i] = 0; } if (data->type == NAME_SCREEN_UNK4) { - data->spriteStates[3] = 1; + data->spriteAnimUpdateReq[3] = 1; } else { - data->spriteStates[0] = 1; + data->spriteAnimUpdateReq[0] = 1; } } @@ -992,23 +1002,23 @@ static void NamingScreen_UnloadBgGfx(BgConfig *bgConfig, Window *windows) { static void NamingScreen_CreateBgConfigAndLoadGfx(NamingScreenAppData *data, NARC *narc) { BgConfig *bgConfig = data->bgConfig; - GfGfxLoader_GXLoadPalFromOpenNarc(narc, 0, GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0, 0x60, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_GXLoadPalFromOpenNarc(narc, NARC_namein_namein_00000000_NCLR, GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0, 0x60, HEAP_ID_NAMING_SCREEN); GfGfxLoader_GXLoadPal(NARC_a_0_1_4, 71, GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)0, 0x20, HEAP_ID_NAMING_SCREEN); BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB_BLACK); - GfGfxLoader_LoadCharDataFromOpenNarc(narc, 2, bgConfig, GF_BG_LYR_MAIN_2, 0, 0x2000, TRUE, HEAP_ID_NAMING_SCREEN); - GfGfxLoader_LoadScrnDataFromOpenNarc(narc, 4, bgConfig, GF_BG_LYR_MAIN_2, 0, 0x600, TRUE, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_LoadCharDataFromOpenNarc(narc, NARC_namein_namein_00000002_NCGR_lz, bgConfig, GF_BG_LYR_MAIN_2, 0, 0x2000, TRUE, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, NARC_namein_namein_00000004_NSCR_lz, bgConfig, GF_BG_LYR_MAIN_2, 0, 0x600, TRUE, HEAP_ID_NAMING_SCREEN); - GfGfxLoader_LoadCharDataFromOpenNarc(narc, 2, bgConfig, GF_BG_LYR_MAIN_1, 0, 0x2000, TRUE, HEAP_ID_NAMING_SCREEN); - GfGfxLoader_LoadScrnDataFromOpenNarc(narc, 6, bgConfig, GF_BG_LYR_MAIN_1, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_LoadCharDataFromOpenNarc(narc, NARC_namein_namein_00000002_NCGR_lz, bgConfig, GF_BG_LYR_MAIN_1, 0, 0x2000, TRUE, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, NARC_namein_namein_00000006_NSCR_lz, bgConfig, GF_BG_LYR_MAIN_1, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); - GfGfxLoader_LoadScrnDataFromOpenNarc(narc, 7, bgConfig, GF_BG_LYR_MAIN_0, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, NARC_namein_namein_00000007_NSCR_lz, bgConfig, GF_BG_LYR_MAIN_0, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); LoadFontPal1(GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0x180, HEAP_ID_NAMING_SCREEN); LoadUserFrameGfx2(data->bgConfig, GF_BG_LYR_SUB_0, 0x100, 10, Options_GetFrame(data->options), HEAP_ID_NAMING_SCREEN); LoadFontPal1(GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)0x180, HEAP_ID_NAMING_SCREEN); - data->unk_4AC = GfGfxLoader_GetCharDataFromOpenNarc(narc, 16, TRUE, &data->charData, HEAP_ID_NAMING_SCREEN); + data->unk_4AC = GfGfxLoader_GetCharDataFromOpenNarc(narc, NARC_namein_namein_00000016_NCGR_lz, TRUE, &data->charData, HEAP_ID_NAMING_SCREEN); } static void NamingScreen_InitObjCharPlttTransfer(void) { @@ -1036,10 +1046,10 @@ static void NamingScreen_LoadObjGfx(NamingScreenAppData *data, NARC *narc) { data->gfxResMen[i] = Create2DGfxResObjMan(2, (GfGfxResType)i, HEAP_ID_NAMING_SCREEN); } - data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CHAR], narc, 10, TRUE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, HEAP_ID_NAMING_SCREEN); - data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_PLTT], narc, 1, FALSE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 9, HEAP_ID_NAMING_SCREEN); - data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CELL], narc, 12, TRUE, 0, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); - data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_ANIM], narc, 14, TRUE, 0, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CHAR], narc, NARC_namein_namein_00000010_NCGR_lz, TRUE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_PLTT], narc, NARC_namein_namein_00000001_NCLR, FALSE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 9, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CELL], narc, NARC_namein_namein_00000012_NCER_lz, TRUE, 0, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_ANIM], narc, NARC_namein_namein_00000014_NANR_lz, TRUE, 0, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); if (data->type == NAME_SCREEN_POKEMON) { data->unk_4B4 = GfGfxLoader_GetCharData(NARC_poketool_icongra_poke_icon, GetMonIconNaixEx(data->playerGenderOrMonSpecies, FALSE, data->monForm), FALSE, &data->monIconCharData, HEAP_ID_NAMING_SCREEN); DC_FlushRange(data->monIconCharData, 0x200); @@ -1047,10 +1057,10 @@ static void NamingScreen_LoadObjGfx(NamingScreenAppData *data, NARC *narc) { DC_FlushRange(data->plttData, 0x80); } - data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CHAR], narc, 11, TRUE, 1, NNS_G2D_VRAM_TYPE_2DSUB, HEAP_ID_NAMING_SCREEN); - data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_PLTT], narc, 1, FALSE, 1, NNS_G2D_VRAM_TYPE_2DSUB, 3, HEAP_ID_NAMING_SCREEN); - data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CELL], narc, 13, TRUE, 1, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); - data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_ANIM], narc, 15, TRUE, 1, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CHAR], narc, NARC_namein_namein_00000011_NCGR_lz, TRUE, 1, NNS_G2D_VRAM_TYPE_2DSUB, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_PLTT], narc, NARC_namein_namein_00000001_NCLR, FALSE, 1, NNS_G2D_VRAM_TYPE_2DSUB, 3, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CELL], narc, NARC_namein_namein_00000013_NCER_lz, TRUE, 1, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_ANIM], narc, NARC_namein_namein_00000015_NANR_lz, TRUE, 1, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); sub_0200ACF0(data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR]); sub_0200ACF0(data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR]); @@ -1070,7 +1080,7 @@ static void SysTask_NamingScreen_SubspritePosController(SysTask *task, void *tas VecFx32 *pMatrix = Sprite_GetMatrixPtr(data->parent); VecFx32 matrix; matrix.x = pMatrix->x + data->dx; - matrix.y = FX32_ONE * _021021E8[data->i][1]; + matrix.y = FX32_ONE * sUISpritesParam[data->i][1]; matrix.z = 0; Sprite_SetMatrix(data->child, &matrix); } @@ -1095,20 +1105,20 @@ static void NamingScreen_CreateSprites(NamingScreenAppData *data) { spriteTemplate.heapId = HEAP_ID_NAMING_SCREEN; for (i = 0; i < 9; ++i) { - spriteTemplate.position.x = _021021E8[i][0] * FX32_ONE; - spriteTemplate.position.y = _021021E8[i][1] * FX32_ONE; - data->sprites1[i] = Sprite_CreateAffine(&spriteTemplate); - Sprite_SetAnimActiveFlag(data->sprites1[i], TRUE); - Sprite_SetAnimCtrlSeq(data->sprites1[i], _021021E8[i][2]); - Sprite_SetDrawPriority(data->sprites1[i], _021021E8[i][3]); + spriteTemplate.position.x = sUISpritesParam[i][0] * FX32_ONE; + spriteTemplate.position.y = sUISpritesParam[i][1] * FX32_ONE; + data->uiSprites[i] = Sprite_CreateAffine(&spriteTemplate); + Sprite_SetAnimActiveFlag(data->uiSprites[i], TRUE); + Sprite_SetAnimCtrlSeq(data->uiSprites[i], sUISpritesParam[i][2]); + Sprite_SetDrawPriority(data->uiSprites[i], sUISpritesParam[i][3]); } - Sprite_SetVisibleFlag(data->sprites1[4], FALSE); + Sprite_SetVisibleFlag(data->uiSprites[4], FALSE); for (i = 0; i < 7; ++i) { data->tasks[i] = CreateSysTaskAndEnvironment(SysTask_NamingScreen_SubspritePosController, sizeof(SubspritePosControllerTaskData), 5, HEAP_ID_NAMING_SCREEN); SubspritePosControllerTaskData *taskData = SysTask_GetData(data->tasks[i]); - taskData->parent = data->sprites1[7]; - taskData->child = data->sprites1[i]; - taskData->dx = _021021E8[i][0] * FX32_ONE; + taskData->parent = data->uiSprites[7]; + taskData->child = data->uiSprites[i]; + taskData->dx = sUISpritesParam[i][0] * FX32_ONE; taskData->i = i; } // regswap: data->maxLen should be r2, instead r0 @@ -1216,10 +1226,10 @@ static void NamingScreen_HandlePageSwitch(BgConfig *bgConfig, Window *windows, i switch (*pState) { case 0: { - u16 fillVal = _02101D40[pageNum] | (_02101D40[pageNum] << 4); - GfGfxLoader_LoadScrnData(NARC_a_0_3_1, pageNum + 6, bgConfig, bgId_prev, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + u16 fillVal = sKeyboardFrameColors[pageNum] | (sKeyboardFrameColors[pageNum] << 4); + GfGfxLoader_LoadScrnData(NARC_data_namein, pageNum + 6, bgConfig, bgId_prev, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); NamingScreen_SetPagePgPosVecs(posVecs, bgId_prev); - sub_02084E54(&windows[bgId_prev], fillVal, pageNum, MAKE_TEXT_COLOR(14, 15, 0), pRawData); + NamingScreen_DrawKeyboardOnWindow(&windows[bgId_prev], fillVal, pageNum, MAKE_TEXT_COLOR(14, 15, 0), pRawData); ++(*pState); break; } @@ -1293,14 +1303,14 @@ static void NamingScreen_InitWindows(NamingScreenAppData *data, OVY_MANAGER *ovy AddWindowParameterized(data->bgConfig, &data->windows[1], GF_BG_LYR_MAIN_1, 2, 1, 26, 12, 1, 0x238); if (data->type == NAME_SCREEN_UNK4) { - GfGfxLoader_LoadScrnDataFromOpenNarc(narc, 9, data->bgConfig, GF_BG_LYR_MAIN_1, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, NARC_namein_namein_00000009_NSCR_lz, data->bgConfig, GF_BG_LYR_MAIN_1, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); data->pageNum = 4; NamingScreen_LoadKeyboardLayout(data->keyboard, 4); - sub_02084E54(&data->windows[1], 0x0A0A, 4, MAKE_TEXT_COLOR(14, 15, 0), data->charData->pRawData); + NamingScreen_DrawKeyboardOnWindow(&data->windows[1], 0x0A0A, 4, MAKE_TEXT_COLOR(14, 15, 0), data->charData->pRawData); } else { data->pageNum = 0; NamingScreen_LoadKeyboardLayout(data->keyboard, 0); - sub_02084E54(&data->windows[1], 0x0404, 0, MAKE_TEXT_COLOR(14, 15, 0), data->charData->pRawData); + NamingScreen_DrawKeyboardOnWindow(&data->windows[1], 0x0404, 0, MAKE_TEXT_COLOR(14, 15, 0), data->charData->pRawData); } AddWindowParameterized(data->bgConfig, &data->windows[2], GF_BG_LYR_MAIN_2, 7, 2, 22, 2, 0, 0x370); @@ -1394,37 +1404,37 @@ static void NamingScreen_GetPlayerInput(NamingScreenAppData *data) { int doUpdateCursor = 0; int dpadMovement = 0; BOOL buttonInputIsTransition = FALSE; - if (!Sprite_GetVisibleFlag(data->sprites1[8])) { + if (!Sprite_GetVisibleFlag(data->uiSprites[8])) { buttonInputIsTransition = TRUE; } if (gSystem.newAndRepeatedKeys & PAD_KEY_UP) { PlaySE(SEQ_SE_DP_SELECT); - Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); dpadMovement = 1; ++doUpdateCursor; } if (gSystem.newAndRepeatedKeys & PAD_KEY_DOWN) { PlaySE(SEQ_SE_DP_SELECT); - Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); dpadMovement = 2; ++doUpdateCursor; } if (gSystem.newAndRepeatedKeys & PAD_KEY_LEFT) { PlaySE(SEQ_SE_DP_SELECT); - Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); dpadMovement = 3; ++doUpdateCursor; } if (gSystem.newAndRepeatedKeys & PAD_KEY_RIGHT) { PlaySE(SEQ_SE_DP_SELECT); - Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); dpadMovement = 4; ++doUpdateCursor; } if (gSystem.newKeys & PAD_BUTTON_START) { PlaySE(SEQ_SE_DP_SELECT); - Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); data->kbCursor.x = 12; data->kbCursor.y = 0; ++doUpdateCursor; @@ -1447,30 +1457,30 @@ static void NamingScreen_GetPlayerInput(NamingScreenAppData *data) { static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, int dpadMovement) { if (data->kbCursor.y != 0) { if (data->kbCursor.prevY == 0 && data->kbCursor.prevY != data->kbCursor.y) { - Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); + Sprite_SetAnimCtrlSeq(data->uiSprites[8], 39); } if (dpadMovement != 0) { - Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); + Sprite_SetAnimCtrlSeq(data->uiSprites[8], 39); } VecFx32 vec; vec.x = (data->kbCursor.x * 16 + 26) * FX32_ONE; vec.y = ((data->kbCursor.y - 1) * 19 + 91) * FX32_ONE; // vec.z = 0; - Sprite_SetMatrix(data->sprites1[8], &vec); + Sprite_SetMatrix(data->uiSprites[8], &vec); } else { int buttonId = data->keyboard[data->kbCursor.y][data->kbCursor.x] - NAME_SCREEN_BUTTON_PAGE_UPPER; VecFx32 vec; - vec.x = _02101D80[buttonId] * FX32_ONE; + vec.x = sHomeRowCursorXCoords[buttonId] * FX32_ONE; vec.y = FX32_CONST(68); // vec.z = 0; - Sprite_SetAnimCtrlSeq(data->sprites1[8], _02101D4C[buttonId]); - Sprite_SetMatrix(data->sprites1[8], &vec); + Sprite_SetAnimCtrlSeq(data->uiSprites[8], sHomeRowCursorAnimIDs[buttonId]); + Sprite_SetMatrix(data->uiSprites[8], &vec); } data->unk_038 = 180; - Sprite_SetAnimCtrlCurrentFrame(data->sprites1[8], 0); + Sprite_SetAnimCtrlCurrentFrame(data->uiSprites[8], 0); data->kbCursor.prevX = data->kbCursor.x; data->kbCursor.prevY = data->kbCursor.y; if (sDpadMovementCoordDeltas[dpadMovement][0] != 0) { @@ -1547,7 +1557,7 @@ static void NamingScreen_PrintCharacterOnWindowAndOBJ(Window *windows, const u16 CopyU16ArrayToString(string2, spC); ptr = NamingScreen_PrintStringOnWindow_GetPixelBuffer(&windows[i], string2, 2, MAKE_TEXT_COLOR(13, 14, 15)); DC_FlushRange(ptr, 0x80); - GXS_LoadOBJ(ptr, _02101D54[i] * 32, 0x80); + GXS_LoadOBJ(ptr, sSpriteGfxOffsets[i] * 32, 0x80); } String_Delete(string2); @@ -1628,8 +1638,8 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa key = CHAR_JP_SPACE; } } - if (!Sprite_GetVisibleFlag(data->sprites1[8]) && gSystem.touchNew == 0) { - Sprite_SetVisibleFlag(data->sprites1[8], TRUE); + if (!Sprite_GetVisibleFlag(data->uiSprites[8]) && gSystem.touchNew == 0) { + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); return NS_MAIN_STATE_INPUT_LOOP; } @@ -1652,7 +1662,7 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa if (sub_02084C98(0, 0x52, data->entryBuf, data->textCursorPos)) { FillWindowPixelBuffer(&data->windows[3], 1); NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); - ++data->spriteStates[4]; + ++data->spriteAnimUpdateReq[4]; PlaySE(SEQ_SE_DP_BOX02); } break; @@ -1664,7 +1674,7 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa data->pageSwitchState = 0; data->pageNum = key - NAME_SCREEN_BUTTON_PAGE_UPPER; NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); - ++data->spriteStates[key - NAME_SCREEN_BUTTON_PAGE_UPPER]; + ++data->spriteAnimUpdateReq[key - NAME_SCREEN_BUTTON_PAGE_UPPER]; PlaySE(SEQ_SE_DP_SYU03); } break; @@ -1680,7 +1690,7 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa } NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->unk_15A, data->charBuf, data->unkJapaneseString); sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); - ++data->spriteStates[5]; + ++data->spriteAnimUpdateReq[5]; PlaySE(SEQ_SE_DP_SELECT); } break; @@ -1688,7 +1698,7 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa sub_020164C4(data->unk_5C4); if (!data->printedFromBattleGMM) { PlaySE(SEQ_SE_DP_PIRORIRO); - ++data->spriteStates[6]; + ++data->spriteAnimUpdateReq[6]; BeginNormalPaletteFade(2, 0, 0, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); NamingScreen_UpdateFieldMenuInputState(data, isButtonInput); return NS_MAIN_STATE_WAIT_FADE_OUT; @@ -1707,10 +1717,10 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa ++data->textCursorPos; sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); PlaySE(SEQ_SE_DP_BOX02); - Sprite_SetVisibleFlag(data->sprites1[8], TRUE); - Sprite_SetOamMode(data->sprites1[8], GX_OAM_MODE_XLU); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); + Sprite_SetOamMode(data->uiSprites[8], GX_OAM_MODE_XLU); G2_SetBlendAlpha(0, GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2, 8, 8); - Sprite_SetAnimCtrlSeq(data->sprites1[8], 60); + Sprite_SetAnimCtrlSeq(data->uiSprites[8], 60); if (data->textCursorPos == data->maxLen) { data->kbCursor.unk18 = TRUE; } @@ -1784,16 +1794,16 @@ static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { switch (a3) { case NAME_SCREEN_CONTROL_DAKU: for (i = 0; i < 12u; ++i) { - if (key == _021021B8[i][0]) { - a4[a5 - 1] = _021021B8[i][1]; + if (key == sDakutenTable[i][0]) { + a4[a5 - 1] = sDakutenTable[i][1]; return TRUE; } } break; case NAME_SCREEN_CONTROL_HANDAKU: for (i = 0; i < 10u; ++i) { - if (key == _02102190[i][0]) { - a4[a5 - 1] = _02102190[i][1]; + if (key == sHandakutenTable[i][0]) { + a4[a5 - 1] = sHandakutenTable[i][1]; return TRUE; } } @@ -1822,20 +1832,20 @@ static void sub_02084E18(Sprite **sprites, int cursorPos, int maxLen) { } } -static const u8 _02101D44[] = { 0x03, 0x06, 0x0C, 0x09, 0x09 }; +static const u8 sKeyboardFillValues[] = { 0x03, 0x06, 0x0C, 0x09, 0x09 }; -static void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData) { +static void NamingScreen_DrawKeyboardOnWindow(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData) { FillWindowPixelBuffer(window, fillVal); for (int i = 0; i < 6; ++i) { - FillWindowPixelRect(window, _02101D44[pageNum], 32 * i + 16, 0, 16, 19); - FillWindowPixelRect(window, _02101D44[pageNum], 32 * i + 16, 38, 16, 19); - FillWindowPixelRect(window, _02101D44[pageNum], 32 * i + 16, 76, 16, 19); + FillWindowPixelRect(window, sKeyboardFillValues[pageNum], 32 * i + 16, 0, 16, 19); + FillWindowPixelRect(window, sKeyboardFillValues[pageNum], 32 * i + 16, 38, 16, 19); + FillWindowPixelRect(window, sKeyboardFillValues[pageNum], 32 * i + 16, 76, 16, 19); } for (int i = 0; i < 7; ++i) { - FillWindowPixelRect(window, _02101D44[pageNum], 32 * i, 19, 16, 19); - FillWindowPixelRect(window, _02101D44[pageNum], 32 * i, 57, 16, 19); + FillWindowPixelRect(window, sKeyboardFillValues[pageNum], 32 * i, 19, 16, 19); + FillWindowPixelRect(window, sKeyboardFillValues[pageNum], 32 * i, 57, 16, 19); } for (int i = 0; i < 5; ++i) { @@ -1845,45 +1855,45 @@ static void sub_02084E54(Window *window, u16 fillVal, int pageNum, u32 textColor CopyWindowToVram(window); } -static void sub_02084F3C(int *spriteStates, Sprite **sprites, int pageNum) { +static void NamingScreen_UpdateSpritesAnims(BOOL *req, Sprite **sprites, int pageNum) { for (int i = 0; i < 3; ++i) { - if (spriteStates[i] != 0) { + if (req[i]) { for (int j = 0; j < 3; ++j) { - Sprite_SetAnimCtrlSeq(sprites[j], _021021E8[j][2]); + Sprite_SetAnimCtrlSeq(sprites[j], sUISpritesParam[j][2]); } - Sprite_SetAnimCtrlSeq(sprites[i], _021021E8[i][2] - 3); + Sprite_SetAnimCtrlSeq(sprites[i], sUISpritesParam[i][2] - 3); break; } } for (int i = 5; i < 7; ++i) { - if (spriteStates[i] != 0) { - Sprite_SetAnimCtrlSeq(sprites[i], _021021E8[i][2] + 1); + if (req[i]) { + Sprite_SetAnimCtrlSeq(sprites[i], sUISpritesParam[i][2] + 1); } } for (int i = 0; i < 7; ++i) { - spriteStates[i] = 0; + req[i] = FALSE; } } static void NamingScreen_PlaceCursorSprite(NamingScreenAppData *data) { - if (Sprite_IsCellAnimationRunning(data->sprites1[8])) { + if (Sprite_IsCellAnimationRunning(data->uiSprites[8])) { return; } if (data->textCursorPos == data->maxLen) { data->kbCursor.x = 12; data->kbCursor.y = 0; - Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); + Sprite_SetAnimCtrlSeq(data->uiSprites[8], 39); data->kbCursor.unk18 = FALSE; } else { - Sprite_SetAnimCtrlSeq(data->sprites1[8], 39); + Sprite_SetAnimCtrlSeq(data->uiSprites[8], 39); } if (!data->kbCursor.showCursor) { - Sprite_SetVisibleFlag(data->sprites1[8], FALSE); + Sprite_SetVisibleFlag(data->uiSprites[8], FALSE); } else { NamingScreen_UpdateCursorSpritePosition(data, 0); } - Sprite_SetOamMode(data->sprites1[8], GX_OAM_MODE_NORMAL); + Sprite_SetOamMode(data->uiSprites[8], GX_OAM_MODE_NORMAL); } static const NamingScreenTouchHitboxDef sTouchHitboxDef[] = { diff --git a/tmp.txt b/tmp.txt deleted file mode 100644 index 260d674565..0000000000 --- a/tmp.txt +++ /dev/null @@ -1,71 +0,0 @@ -0x0000 -0x0002 -0x0004 -0x0004 -0x0008 -0x000B -0x0100 -0x0101 -0x0102 -0x0103 -0x0104 -0x0105 -0x0106 -0x0107 -0x0108 -0x0109 -0x010A -0x010B -0x010C -0x0200 -0x0201 -0x0202 -0x0203 -0x0204 -0x0205 -0x0206 -0x0207 -0x0208 -0x0209 -0x020A -0x020B -0x020C -0x0300 -0x0301 -0x0302 -0x0303 -0x0304 -0x0305 -0x0306 -0x0307 -0x0308 -0x0309 -0x030A -0x030B -0x030C -0x0400 -0x0401 -0x0402 -0x0403 -0x0404 -0x0405 -0x0406 -0x0407 -0x0408 -0x0409 -0x040A -0x040B -0x040C -0x0500 -0x0501 -0x0502 -0x0503 -0x0504 -0x0505 -0x0506 -0x0507 -0x0508 -0x0509 -0x050A -0x050B -0x050C From 95b4e4ace7104a00a13b1f43548e7bc7447ba265 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 14 Oct 2024 17:53:12 -0400 Subject: [PATCH 22/25] Documentation, 6 --- src/naming_screen.c | 76 ++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/src/naming_screen.c b/src/naming_screen.c index 78d3b61b6b..68dff8f524 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -83,7 +83,7 @@ typedef struct NamingScreenAppData { u16 entryBuf[0x20]; u16 entryBufBak[0x20]; u16 textCursorPos; - u16 unk_15A[3]; + u16 tmpBuf[3]; BgConfig *bgConfig; // 0x160 BOOL unk_164; // unused MessageFormat *msgFormat; // 0x168 @@ -177,9 +177,9 @@ static void NamingScreen_LoadKeyboardLayout(u16 (*keyboard)[13], const int pageN static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppData *data, u16 key, BOOL isButtonInput); static void NamingScreen_UpdateFieldMenuInputState(NamingScreenAppData *data, BOOL toggle); static int NamingScreen_SearchJpConvTableForNonSpace(const u16 *table, int pos); -static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3); -static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5); -static void sub_02084E18(Sprite **sprites, int cursorPos, int maxLen); +static BOOL NamingScreen_JP_FlipAlphaCase(int tableStart, int tableEnd, u16 *pmCharBuf, int cursorPos); +static BOOL NamingScreen_JP_FlipDiacritic(int tableStart, int tableEnd, int convColno, int mode, u16 *pmCharBuf, int cursorPos); +static void NamingScreen_UpdateSprite_HighlightedCharacterInInputBuffer(Sprite **sprites, int cursorPos, int maxLen); static void NamingScreen_DrawKeyboardOnWindow(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); static void NamingScreen_UpdateSpritesAnims(BOOL *req, Sprite **sprites, int pageNum); static void NamingScreen_PlaceCursorSprite(NamingScreenAppData *data); @@ -380,6 +380,10 @@ static const u16 sJpCharConvTable[][3] = { { CHAR_JP_KATA_HO, CHAR_JP_KATA_BO, CHAR_JP_KATA_PO }, }; +#define CHARCONVTBL_ALPHA_BEGIN 0 +#define CHARCONVTBL_DAKU_BEGIN 42 +#define CHARCONVTBL_HANDAKU_BEGIN 72 + static const u16 sDakutenTable[][2] = { { CHAR_JP_HIRA_TU_SMALL, CHAR_JP_HIRA_DU }, { CHAR_JP_KATA_TU_SMALL, CHAR_JP_KATA_DU }, @@ -491,7 +495,7 @@ BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { NamingScreen_LoadObjGfx(data, narc); NamingScreen_CreateSprites(data); NamingScreen_InitWindows(data, ovyMan, narc); - NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->unk_15A, data->charBuf, data->unkJapaneseString); + NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->tmpBuf, data->charBuf, data->unkJapaneseString); sub_02004EC4(0x34, 0, 0); // sound-related BeginNormalPaletteFade(0, 1, 1, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); NamingScreen_ToggleGfxPlanes(GF_PLANE_TOGGLE_ON); @@ -1129,7 +1133,7 @@ static void NamingScreen_CreateSprites(NamingScreenAppData *data) { Sprite_SetAnimActiveFlag(data->textEntrySprites[i], TRUE); Sprite_SetAnimCtrlSeq(data->textEntrySprites[i], 43); } - sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); + NamingScreen_UpdateSprite_HighlightedCharacterInInputBuffer(data->textEntrySprites, data->textCursorPos, data->maxLen); NamingScreen_CreateIconSprite(data, &spriteTemplate); } GfGfx_EngineATogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); @@ -1645,21 +1649,21 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa switch (key) { case NAME_SCREEN_CONTROL_DAKU: - if (sub_02084D04(0x2A, 0x52, 1, NAME_SCREEN_CONTROL_DAKU, data->entryBuf, data->textCursorPos)) { + if (NamingScreen_JP_FlipDiacritic(CHARCONVTBL_DAKU_BEGIN, NELEMS(sJpCharConvTable), 1, NAME_SCREEN_CONTROL_DAKU, data->entryBuf, data->textCursorPos)) { FillWindowPixelBuffer(&data->windows[3], 1); NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); PlaySE(SEQ_SE_DP_BOX02); } break; case NAME_SCREEN_CONTROL_HANDAKU: - if (sub_02084D04(0x48, 0x52, 2, NAME_SCREEN_CONTROL_HANDAKU, data->entryBuf, data->textCursorPos)) { + if (NamingScreen_JP_FlipDiacritic(CHARCONVTBL_HANDAKU_BEGIN, NELEMS(sJpCharConvTable), 2, NAME_SCREEN_CONTROL_HANDAKU, data->entryBuf, data->textCursorPos)) { FillWindowPixelBuffer(&data->windows[3], 1); NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); PlaySE(SEQ_SE_DP_BOX02); } break; case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: - if (sub_02084C98(0, 0x52, data->entryBuf, data->textCursorPos)) { + if (NamingScreen_JP_FlipAlphaCase(CHARCONVTBL_ALPHA_BEGIN, NELEMS(sJpCharConvTable), data->entryBuf, data->textCursorPos)) { FillWindowPixelBuffer(&data->windows[3], 1); NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); ++data->spriteAnimUpdateReq[4]; @@ -1688,8 +1692,8 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa } else { NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); } - NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->unk_15A, data->charBuf, data->unkJapaneseString); - sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); + NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->tmpBuf, data->charBuf, data->unkJapaneseString); + NamingScreen_UpdateSprite_HighlightedCharacterInInputBuffer(data->textEntrySprites, data->textCursorPos, data->maxLen); ++data->spriteAnimUpdateReq[5]; PlaySE(SEQ_SE_DP_SELECT); } @@ -1715,7 +1719,7 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa FillWindowPixelBuffer(&data->windows[3], 1); NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); ++data->textCursorPos; - sub_02084E18(data->textEntrySprites, data->textCursorPos, data->maxLen); + NamingScreen_UpdateSprite_HighlightedCharacterInInputBuffer(data->textEntrySprites, data->textCursorPos, data->maxLen); PlaySE(SEQ_SE_DP_BOX02); Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); Sprite_SetOamMode(data->uiSprites[8], GX_OAM_MODE_XLU); @@ -1724,7 +1728,7 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa if (data->textCursorPos == data->maxLen) { data->kbCursor.unk18 = TRUE; } - NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->unk_15A, data->charBuf, data->unkJapaneseString); + NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->tmpBuf, data->charBuf, data->unkJapaneseString); } break; } @@ -1749,20 +1753,20 @@ static int NamingScreen_SearchJpConvTableForNonSpace(const u16 *table, int pos) return table[pos]; } -static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3) { +static BOOL NamingScreen_JP_FlipAlphaCase(int tableStart, int tableEnd, u16 *pmCharBuf, int cursorPos) { int i; int j; u16 key; - if (a3 == 0) { + if (cursorPos == 0) { return FALSE; } - key = a2[a3 - 1]; - for (i = a0; i < a1; ++i) { + key = pmCharBuf[cursorPos - 1]; + for (i = tableStart; i < tableEnd; ++i) { for (j = 0; j < 3; ++j) { // This whole loop could be bypassed by simply checking whether key is space up-front if (key == sJpCharConvTable[i][j] && key != CHAR_JP_SPACE) { - a2[a3 - 1] = NamingScreen_SearchJpConvTableForNonSpace(sJpCharConvTable[i], j); + pmCharBuf[cursorPos - 1] = NamingScreen_SearchJpConvTableForNonSpace(sJpCharConvTable[i], j); return TRUE; } } @@ -1771,50 +1775,50 @@ static BOOL sub_02084C98(int a0, int a1, u16 *a2, int a3) { return FALSE; } -static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { +static BOOL NamingScreen_JP_FlipDiacritic(int tableStart, int tableEnd, int convColno, int mode, u16 *pmCharBuf, int cursorPos) { int i; u16 key; - if (a5 == 0 || a4[a5 - 1] == 1) { + if (cursorPos == 0 || pmCharBuf[cursorPos - 1] == CHAR_JP_SPACE) { return FALSE; } - key = a4[a5 - 1]; - for (i = a0; i < a1; ++i) { + key = pmCharBuf[cursorPos - 1]; + for (i = tableStart; i < tableEnd; ++i) { if (key == sJpCharConvTable[i][0]) { - a4[a5 - 1] = sJpCharConvTable[i][a2]; + pmCharBuf[cursorPos - 1] = sJpCharConvTable[i][convColno]; return TRUE; } } - for (i = a0; i < a1; ++i) { - if (key == sJpCharConvTable[i][a2]) { - a4[a5 - 1] = sJpCharConvTable[i][0]; + for (i = tableStart; i < tableEnd; ++i) { + if (key == sJpCharConvTable[i][convColno]) { + pmCharBuf[cursorPos - 1] = sJpCharConvTable[i][0]; return TRUE; } } - switch (a3) { + switch (mode) { case NAME_SCREEN_CONTROL_DAKU: - for (i = 0; i < 12u; ++i) { + for (i = 0; i < NELEMS(sDakutenTable); ++i) { if (key == sDakutenTable[i][0]) { - a4[a5 - 1] = sDakutenTable[i][1]; + pmCharBuf[cursorPos - 1] = sDakutenTable[i][1]; return TRUE; } } break; case NAME_SCREEN_CONTROL_HANDAKU: - for (i = 0; i < 10u; ++i) { + for (i = 0; i < NELEMS(sHandakutenTable); ++i) { if (key == sHandakutenTable[i][0]) { - a4[a5 - 1] = sHandakutenTable[i][1]; + pmCharBuf[cursorPos - 1] = sHandakutenTable[i][1]; return TRUE; } } break; case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: - if (key == 0x26) { - a4[a5 - 1] = 0x24; + if (key == CHAR_JP_HIRA_DU) { + pmCharBuf[cursorPos - 1] = CHAR_JP_HIRA_TU_SMALL; return TRUE; } - if (key == 0x76) { - a4[a5 - 1] = 0x74; + if (key == CHAR_JP_KATA_DU) { + pmCharBuf[cursorPos - 1] = CHAR_JP_KATA_TU_SMALL; return TRUE; } break; @@ -1823,7 +1827,7 @@ static BOOL sub_02084D04(int a0, int a1, int a2, int a3, u16 *a4, int a5) { return FALSE; } -static void sub_02084E18(Sprite **sprites, int cursorPos, int maxLen) { +static void NamingScreen_UpdateSprite_HighlightedCharacterInInputBuffer(Sprite **sprites, int cursorPos, int maxLen) { for (int i = 0; i < maxLen; ++i) { Sprite_SetAnimCtrlSeq(sprites[i], 43); } From 7ec0efa8766cf469fac05993e26b3f3c1467879f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 14 Oct 2024 17:59:59 -0400 Subject: [PATCH 23/25] add missing nclr (why are these gitignored anyway?) --- files/data/namein/namein_00000000.NCLR | Bin 0 -> 552 bytes files/data/namein/namein_00000001.NCLR | Bin 0 -> 552 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 files/data/namein/namein_00000000.NCLR create mode 100644 files/data/namein/namein_00000001.NCLR diff --git a/files/data/namein/namein_00000000.NCLR b/files/data/namein/namein_00000000.NCLR new file mode 100644 index 0000000000000000000000000000000000000000..7798438213daeac4218f922cb6011db0ea2f8314 GIT binary patch literal 552 zcmWIYarXQFkAYExiGe|Yfsr93#3w)k$Yy4M0I$m2mk=-&n;>I literal 0 HcmV?d00001 diff --git a/files/data/namein/namein_00000001.NCLR b/files/data/namein/namein_00000001.NCLR new file mode 100644 index 0000000000000000000000000000000000000000..9850267e4b101ada20011d8c4fa06f3d7fd73262 GIT binary patch literal 552 zcmWIYarXQFkAYExiGe|Yfsr93#3w)k$Yy4M0F$Q6e&J#}mEPOdbI&Oj%aYBCtP|y1A2^reU)i6!`SJIPuV(cp>BqhGJ(ad0 zEiW;=Xs*9i63C1sfv<5J(;4dOd8Rn^7#3D*mp@J8NQ+LsS8VFHBkCbDNdAZ4b;0{W z?24U+OJ$70_NiXa`XR%wINL5ho`E4aYH$4yzixq_GW!kLHQQb5^<$GP^DE_G@>A3H z)}y)^ljm*aBTyn^srtt@RpXR_e9aOC4%2rE5c97A^>0kKjJL=Jxv#SLOWfwLbC&<> Vf$j^pEEbHrTRkxd)5PH=0swlhWzhft literal 0 HcmV?d00001 From 84f57541e6987455d4b4d5da32474500c8f4d81d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 14 Oct 2024 19:29:36 -0400 Subject: [PATCH 24/25] Documentation, 7 --- src/naming_screen.c | 57 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/naming_screen.c b/src/naming_screen.c index 68dff8f524..9e50236a8c 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -65,7 +65,7 @@ typedef struct NamingScreenCursor { int prevY; int deltaX; BOOL showCursor; // always TRUE - BOOL unk18; + BOOL ignoreInput; } NamingScreenCursor; typedef struct NamingScreenAppData { @@ -77,7 +77,7 @@ typedef struct NamingScreenAppData { BOOL printedFromBattleGMM; // logic that makes this TRUE is unreachable Options *options; NamingScreenCursor kbCursor; - u16 unk_038; + u16 plttGlowEffectAngle; u16 keyboard[6][13]; u8 filler_0D6[2]; u16 entryBuf[0x20]; @@ -93,7 +93,7 @@ typedef struct NamingScreenAppData { String *promptString; String *unkJapaneseString; String *battleMsgString; - String *unk_184; + String *unk_184; // set to a message that was not localized SpriteList *spriteList; GF_G2dRenderer g2dRender; GF_2DGfxResMan *gfxResMen[4]; @@ -108,18 +108,18 @@ typedef struct NamingScreenAppData { int battleMessageTextPrinterId; int pageSwitchState; int pageNum; - GFBgLayer unk_464; + GFBgLayer activeKeyboardBgId; // alternates between main 0/1 VecFx32 bgPosVecs[2]; int unk_480; // unused int unk_484; // set but never used int unk_488; // set but never used int unk_48C; // set but never used BOOL spriteAnimUpdateReq[7]; - void *unk_4AC; + void *charDataRaw; NNSG2dCharacterData *charData; - void *unk_4B4; + void *monIconCharDaraRaw; NNSG2dCharacterData *monIconCharData; - void *unk_4BC; + void *plttDataRaw; NNSG2dPaletteData *plttData; u8 charBuf[0x100]; UnkStruct_020163E0 *unk_5C4; @@ -551,7 +551,7 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { case 3: break; case 4: - if (data->kbCursor.unk18 == 0) { + if (!data->kbCursor.ignoreInput) { *pState = NamingScreen_HandleInput(data, (NamingScreenMainState)*pState); } NamingScreen_PlaceCursorSprite(data); @@ -580,9 +580,9 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { } break; } - NamingScreen_HandlePageSwitch(data->bgConfig, data->windows, &data->pageSwitchState, data->pageNum, &data->unk_464, data->bgPosVecs, data->uiSprites, data->charData->pRawData); + NamingScreen_HandlePageSwitch(data->bgConfig, data->windows, &data->pageSwitchState, data->pageNum, &data->activeKeyboardBgId, data->bgPosVecs, data->uiSprites, data->charData->pRawData); NamingScreen_UpdateSpritesAnims(data->spriteAnimUpdateReq, data->uiSprites, data->pageNum); - NamingScreen_PaletteGlowEffect(&data->unk_038); + NamingScreen_PaletteGlowEffect(&data->plttGlowEffectAngle); break; case NS_MAIN_STATE_WAIT_FADE_OUT: if (IsPaletteFadeFinished()) { @@ -713,10 +713,10 @@ BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { } SpriteList_Delete(data->spriteList); OamManager_Free(); - FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->unk_4AC); + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->charDataRaw); if (data->type == NAME_SCREEN_POKEMON) { - FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->unk_4B4); - FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->unk_4BC); + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->monIconCharDaraRaw); + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->plttDataRaw); } FreeBgTilemapBuffer(data->bgConfig, GF_BG_LYR_SUB_3); ObjCharTransfer_Destroy(); @@ -920,10 +920,10 @@ static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, data->pageSwitchState = 4; NamingScreen_SetPagePgPosVecs(data->bgPosVecs, GF_BG_LYR_MAIN_0); - BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_X, data->bgPosVecs[data->unk_464].x); - BgSetPosTextAndCommit(data->bgConfig, data->unk_464, BG_POS_OP_SET_Y, data->bgPosVecs[data->unk_464].y); - BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_X, data->bgPosVecs[data->unk_464 ^ 1].x); - BgSetPosTextAndCommit(data->bgConfig, data->unk_464 ^ 1, BG_POS_OP_SET_Y, data->bgPosVecs[data->unk_464 ^ 1].y); + BgSetPosTextAndCommit(data->bgConfig, data->activeKeyboardBgId, BG_POS_OP_SET_X, data->bgPosVecs[data->activeKeyboardBgId].x); + BgSetPosTextAndCommit(data->bgConfig, data->activeKeyboardBgId, BG_POS_OP_SET_Y, data->bgPosVecs[data->activeKeyboardBgId].y); + BgSetPosTextAndCommit(data->bgConfig, data->activeKeyboardBgId ^ 1, BG_POS_OP_SET_X, data->bgPosVecs[data->activeKeyboardBgId ^ 1].x); + BgSetPosTextAndCommit(data->bgConfig, data->activeKeyboardBgId ^ 1, BG_POS_OP_SET_Y, data->bgPosVecs[data->activeKeyboardBgId ^ 1].y); data->entryBufBak[0] = EOS; if (args->nameInputString != NULL) { CopyStringToU16Array(args->nameInputString, data->entryBufBak, 32); @@ -947,7 +947,7 @@ static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, data->kbCursor.prevX = -1; data->kbCursor.prevY = -1; data->kbCursor.showCursor = TRUE; - data->kbCursor.unk18 = FALSE; + data->kbCursor.ignoreInput = FALSE; data->unk_484 = -1; data->unk_488 = 0; data->unk_48C = 0; @@ -1022,7 +1022,7 @@ static void NamingScreen_CreateBgConfigAndLoadGfx(NamingScreenAppData *data, NAR LoadUserFrameGfx2(data->bgConfig, GF_BG_LYR_SUB_0, 0x100, 10, Options_GetFrame(data->options), HEAP_ID_NAMING_SCREEN); LoadFontPal1(GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)0x180, HEAP_ID_NAMING_SCREEN); - data->unk_4AC = GfGfxLoader_GetCharDataFromOpenNarc(narc, NARC_namein_namein_00000016_NCGR_lz, TRUE, &data->charData, HEAP_ID_NAMING_SCREEN); + data->charDataRaw = GfGfxLoader_GetCharDataFromOpenNarc(narc, NARC_namein_namein_00000016_NCGR_lz, TRUE, &data->charData, HEAP_ID_NAMING_SCREEN); } static void NamingScreen_InitObjCharPlttTransfer(void) { @@ -1055,9 +1055,9 @@ static void NamingScreen_LoadObjGfx(NamingScreenAppData *data, NARC *narc) { data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CELL], narc, NARC_namein_namein_00000012_NCER_lz, TRUE, 0, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_ANIM], narc, NARC_namein_namein_00000014_NANR_lz, TRUE, 0, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); if (data->type == NAME_SCREEN_POKEMON) { - data->unk_4B4 = GfGfxLoader_GetCharData(NARC_poketool_icongra_poke_icon, GetMonIconNaixEx(data->playerGenderOrMonSpecies, FALSE, data->monForm), FALSE, &data->monIconCharData, HEAP_ID_NAMING_SCREEN); + data->monIconCharDaraRaw = GfGfxLoader_GetCharData(NARC_poketool_icongra_poke_icon, GetMonIconNaixEx(data->playerGenderOrMonSpecies, FALSE, data->monForm), FALSE, &data->monIconCharData, HEAP_ID_NAMING_SCREEN); DC_FlushRange(data->monIconCharData, 0x200); - data->unk_4BC = GfGfxLoader_GetPlttData(NARC_poketool_icongra_poke_icon, sub_02074490(), &data->plttData, HEAP_ID_NAMING_SCREEN); + data->plttDataRaw = GfGfxLoader_GetPlttData(NARC_poketool_icongra_poke_icon, sub_02074490(), &data->plttData, HEAP_ID_NAMING_SCREEN); DC_FlushRange(data->plttData, 0x80); } @@ -1125,7 +1125,6 @@ static void NamingScreen_CreateSprites(NamingScreenAppData *data) { taskData->dx = sUISpritesParam[i][0] * FX32_ONE; taskData->i = i; } - // regswap: data->maxLen should be r2, instead r0 for (i = 0; i < data->maxLen; ++i) { spriteTemplate.position.x = FX32_ONE * (80 + i * 12); spriteTemplate.position.y = FX32_ONE * 39; @@ -1483,7 +1482,7 @@ static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, i Sprite_SetMatrix(data->uiSprites[8], &vec); } - data->unk_038 = 180; + data->plttGlowEffectAngle = 180; Sprite_SetAnimCtrlCurrentFrame(data->uiSprites[8], 0); data->kbCursor.prevX = data->kbCursor.x; data->kbCursor.prevY = data->kbCursor.y; @@ -1537,7 +1536,7 @@ static void *NamingScreen_PrintStringOnWindow_GetPixelBuffer(Window *window, Str } static void NamingScreen_PrintCharacterOnWindowAndOBJ(Window *windows, const u16 *tmpBuf, void *charBuf, String *string) { - u16 spC[21]; + u16 curCharBuf[21]; u16 i; void *ptr; String *string2; @@ -1554,11 +1553,11 @@ static void NamingScreen_PrintCharacterOnWindowAndOBJ(Window *windows, const u16 string2 = String_New(21, HEAP_ID_NAMING_SCREEN); for (i = 0; i < 3; ++i) { - spC[0] = tmpBuf[i]; - spC[1] = EOS; + curCharBuf[0] = tmpBuf[i]; + curCharBuf[1] = EOS; FillWindowPixelBuffer(&windows[i], 0); - CopyU16ArrayToString(string2, spC); + CopyU16ArrayToString(string2, curCharBuf); ptr = NamingScreen_PrintStringOnWindow_GetPixelBuffer(&windows[i], string2, 2, MAKE_TEXT_COLOR(13, 14, 15)); DC_FlushRange(ptr, 0x80); GXS_LoadOBJ(ptr, sSpriteGfxOffsets[i] * 32, 0x80); @@ -1726,7 +1725,7 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa G2_SetBlendAlpha(0, GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2, 8, 8); Sprite_SetAnimCtrlSeq(data->uiSprites[8], 60); if (data->textCursorPos == data->maxLen) { - data->kbCursor.unk18 = TRUE; + data->kbCursor.ignoreInput = TRUE; } NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->tmpBuf, data->charBuf, data->unkJapaneseString); } @@ -1888,7 +1887,7 @@ static void NamingScreen_PlaceCursorSprite(NamingScreenAppData *data) { data->kbCursor.x = 12; data->kbCursor.y = 0; Sprite_SetAnimCtrlSeq(data->uiSprites[8], 39); - data->kbCursor.unk18 = FALSE; + data->kbCursor.ignoreInput = FALSE; } else { Sprite_SetAnimCtrlSeq(data->uiSprites[8], 39); } From abff4b36f1dc9a05b30f2270752a86e27ddf0f61 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 15 Oct 2024 20:45:25 -0400 Subject: [PATCH 25/25] Documentation, 8 --- src/naming_screen.c | 49 +++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/src/naming_screen.c b/src/naming_screen.c index 9e50236a8c..016bacb7d0 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -58,6 +58,17 @@ typedef enum NamingScreenMainState { NS_MAIN_STATE_WAIT_FADE_OUT, } NamingScreenMainState; +typedef enum NamingScreenPageSwitchState { + NS_PAGESWITCH_STATE_DRAW_NEW_PAGE, + NS_PAGESWITCH_STATE_SET_INIT_POS, + NS_PAGESWITCH_STATE_MOVE_BGS, + NS_PAGESWITCH_STATE_FINISH_BGS, + NS_PAGESWITCH_STATE_IDLE, + NS_PAGESWITCH_STATE_PRINT_BATTLE_MESSAGE, + NS_PAGESWITCH_STATE_WAIT_BATTLE_MESSAGE, + NS_PAGESWITCH_STATE_DELAY_AND_FADE_OUT, +} NamingScreenPageSwitchState; + typedef struct NamingScreenCursor { int x; int y; @@ -545,34 +556,34 @@ BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { break; case NS_MAIN_STATE_INPUT_LOOP: switch (data->pageSwitchState) { - case 0: - case 1: - case 2: - case 3: + case NS_PAGESWITCH_STATE_DRAW_NEW_PAGE: + case NS_PAGESWITCH_STATE_SET_INIT_POS: + case NS_PAGESWITCH_STATE_MOVE_BGS: + case NS_PAGESWITCH_STATE_FINISH_BGS: break; - case 4: + case NS_PAGESWITCH_STATE_IDLE: if (!data->kbCursor.ignoreInput) { *pState = NamingScreen_HandleInput(data, (NamingScreenMainState)*pState); } NamingScreen_PlaceCursorSprite(data); break; - case 5: + case NS_PAGESWITCH_STATE_PRINT_BATTLE_MESSAGE: NamingScreen_PrepareBattleMessage(data, ovyMan); FillWindowPixelBuffer(&data->windows[9], 15); DrawFrameAndWindow2(&data->windows[9], FALSE, 256, 10); data->battleMessageTextPrinterId = AddTextPrinterParameterized(&data->windows[9], 1, data->battleMsgString, 0, 0, 1, NULL); CopyWindowToVram(&data->windows[9]); - data->pageSwitchState = 6; + data->pageSwitchState = NS_PAGESWITCH_STATE_WAIT_BATTLE_MESSAGE; break; - case 6: + case NS_PAGESWITCH_STATE_WAIT_BATTLE_MESSAGE: if (!TextPrinterCheckActive(data->battleMessageTextPrinterId)) { PlaySE(SEQ_SE_DP_PIRORIRO); ++data->spriteAnimUpdateReq[6]; data->delayCounter = 0; - data->pageSwitchState = 7; + data->pageSwitchState = NS_PAGESWITCH_STATE_DELAY_AND_FADE_OUT; } break; - case 7: + case NS_PAGESWITCH_STATE_DELAY_AND_FADE_OUT: ++data->delayCounter; if (data->delayCounter > 30) { BeginNormalPaletteFade(2, 0, 0, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); @@ -605,7 +616,7 @@ static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, return ret; } if (data->type != NAME_SCREEN_UNK4) { - data->pageSwitchState = 0; + data->pageSwitchState = NS_PAGESWITCH_STATE_DRAW_NEW_PAGE; ++data->pageNum; if (data->pageNum >= 3) { data->pageNum = 0; @@ -918,7 +929,7 @@ static void NamingScreen_ToggleGfxPlanes(GFPlaneToggle enable) { static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); - data->pageSwitchState = 4; + data->pageSwitchState = NS_PAGESWITCH_STATE_IDLE; NamingScreen_SetPagePgPosVecs(data->bgPosVecs, GF_BG_LYR_MAIN_0); BgSetPosTextAndCommit(data->bgConfig, data->activeKeyboardBgId, BG_POS_OP_SET_X, data->bgPosVecs[data->activeKeyboardBgId].x); BgSetPosTextAndCommit(data->bgConfig, data->activeKeyboardBgId, BG_POS_OP_SET_Y, data->bgPosVecs[data->activeKeyboardBgId].y); @@ -1228,7 +1239,7 @@ static void NamingScreen_HandlePageSwitch(BgConfig *bgConfig, Window *windows, i GFBgLayer bgId_curr = (GFBgLayer)(bgId_prev ^ 1); switch (*pState) { - case 0: { + case NS_PAGESWITCH_STATE_DRAW_NEW_PAGE: { u16 fillVal = sKeyboardFrameColors[pageNum] | (sKeyboardFrameColors[pageNum] << 4); GfGfxLoader_LoadScrnData(NARC_data_namein, pageNum + 6, bgConfig, bgId_prev, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); NamingScreen_SetPagePgPosVecs(posVecs, bgId_prev); @@ -1236,12 +1247,12 @@ static void NamingScreen_HandlePageSwitch(BgConfig *bgConfig, Window *windows, i ++(*pState); break; } - case 1: + case NS_PAGESWITCH_STATE_SET_INIT_POS: BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_X, 238); BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_Y, -80); ++*(pState); break; - case 2: + case NS_PAGESWITCH_STATE_MOVE_BGS: posVecs[bgId_prev].x -= 24; if (posVecs[bgId_prev].x < -1) { WiggleEffectTaskData @@ -1264,7 +1275,7 @@ static void NamingScreen_HandlePageSwitch(BgConfig *bgConfig, Window *windows, i BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_X, posVecs[bgId_prev].x); BgSetPosTextAndCommit(bgConfig, bgId_curr, BG_POS_OP_SET_Y, posVecs[bgId_curr].y); break; - case 3: + case NS_PAGESWITCH_STATE_FINISH_BGS: posVecs[bgId_curr].y -= 10; if (posVecs[bgId_curr].y < -196) { posVecs[bgId_curr].y = -196; @@ -1278,7 +1289,7 @@ static void NamingScreen_HandlePageSwitch(BgConfig *bgConfig, Window *windows, i PlaySE(SEQ_SE_DP_NAMEIN_01); } break; - case 4: + case NS_PAGESWITCH_STATE_IDLE: break; } } @@ -1674,7 +1685,7 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa case NAME_SCREEN_BUTTON_PAGE_SYMBOLS: case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED: if (data->pageNum != key - NAME_SCREEN_BUTTON_PAGE_UPPER) { - data->pageSwitchState = 0; + data->pageSwitchState = NS_PAGESWITCH_STATE_DRAW_NEW_PAGE; data->pageNum = key - NAME_SCREEN_BUTTON_PAGE_UPPER; NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); ++data->spriteAnimUpdateReq[key - NAME_SCREEN_BUTTON_PAGE_UPPER]; @@ -1706,7 +1717,7 @@ static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppDa NamingScreen_UpdateFieldMenuInputState(data, isButtonInput); return NS_MAIN_STATE_WAIT_FADE_OUT; } else { - data->pageSwitchState = 5; + data->pageSwitchState = NS_PAGESWITCH_STATE_PRINT_BATTLE_MESSAGE; } break; default: