From 1d43c0efebf166781b264467980e09d0333ab851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Na=C5=9Bciszewski?= Date: Mon, 28 Dec 2020 04:23:40 +0100 Subject: [PATCH] Decompile GameLoop and lots of renames --- asm/code_2.s | 293 +--------------------------------------- asm/code_8012A18.s | 96 ++++++------- asm/code_801D760.s | 116 ++++++++-------- asm/code_8027C84.s | 12 +- asm/code_803D110.s | 12 +- asm/code_80428A0.s | 2 +- asm/code_80521D0.s | 34 ++--- asm/code_808DAB4.s | 10 +- asm/code_808EAB0.s | 4 +- asm/code_8092334.s | 58 ++++---- asm/personality_test.s | 8 +- asm/text.s | 48 +++---- asm/wonder_mail.s | 296 ++++++++++++++++++++--------------------- include/file_system.h | 1 + include/input.h | 13 +- include/text.h | 2 +- ld_script.txt | 1 + src/code_2.c | 195 +++++++++++++++++++++++++++ src/code_800C9CC.c | 2 +- src/input.c | 147 ++++++++++---------- src/main.c | 12 +- src/pokemon.c | 4 +- src/text.c | 26 ++-- src/wonder_mail.c | 26 ++-- sym_ewram.txt | 20 +-- sym_ewram2.txt | 2 +- 26 files changed, 675 insertions(+), 765 deletions(-) create mode 100644 src/code_2.c diff --git a/asm/code_2.s b/asm/code_2.s index 406eb392..fefc8e89 100644 --- a/asm/code_2.s +++ b/asm/code_2.s @@ -5,291 +5,6 @@ .text - thumb_func_start GameLoop -GameLoop: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - movs r0, 0x1 - mov r9, r0 - bl InitHeap - bl NDS_DebugInit - bl sub_801180C - bl NDS_LoadOverlay_GroundMain - bl sub_8014144 - bl LoadMonsterParameters - bl sub_8097670 - bl sub_8094F88 - bl sub_8094980 - bl sub_8094C14 - bl sub_8097F5C - bl sub_80923A0 - bl sub_8090998 - bl sub_809207C - bl LoadWazaParameters - bl sub_80950BC - bl sub_80958E8 - movs r0, 0x80 - lsls r0, 8 - movs r1, 0 - bl sub_800CD64 - bl sub_8012284 - movs r0, 0x1 - bl sub_8094998 - ldr r0, _08000498 - bl SetWindowTitle - bl sub_800DAAC - movs r0, 0 - bl SetSavingIconCoords - movs r0, 0 - str r0, [sp] - mov r0, sp - bl sub_8011DAC - cmp r0, 0 - beq _080003D2 - bl sub_800135C -_080003D2: - movs r0, 0xE - bl xxx_script_related_8001334 - movs r0, 0xF - bl xxx_script_related_8001334 - movs r0, 0 - movs r1, 0x39 - bl sub_80015C0 - movs r0, 0x10 - bl xxx_script_related_8001334 - movs r0, 0 - movs r1, 0x39 - bl sub_8001658 - cmp r0, 0 - bne _080003FE - movs r0, 0x11 - bl xxx_script_related_8001334 -_080003FE: - movs r1, 0 - mov r10, r1 - ldr r2, _0800049C - mov r8, r2 -_08000406: - ldr r0, _080004A0 - mov r1, r10 - str r1, [r0] - movs r0, 0x2 - bl sub_800A8F8 - movs r0, 0x1 - bl ResetSprites - movs r0, 0 - bl xxx_update_some_bg_tiles - bl sub_80097B0 - movs r0, 0x2 - bl sub_800CDA8 - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - bl sub_800641C - ldr r1, _080004A4 - movs r2, 0x80 - lsls r2, 5 - adds r0, r2, 0 - strh r0, [r1] - bl sub_8000634 - movs r0, 0 - movs r1, 0 - bl sub_800CCA0 - movs r0, 0 - movs r1, 0 - bl sub_800CCAC - mov r0, r10 - mov r1, r8 - str r0, [r1] -_08000456: - mov r2, r8 - ldr r0, [r2] - adds r0, 0x1 - str r0, [r2] - movs r4, 0 -_08000460: - ldr r0, _080004A8 - ldr r0, [r0] - lsls r2, r4, 2 - ldr r1, [r0, 0x4] - adds r1, r2 - mov r0, r8 - ldr r2, [r0] - adds r0, r4, 0 - movs r3, 0 - bl SetBGPaletteBufferColorRGB - adds r4, 0x1 - cmp r4, 0xEF - ble _08000460 - movs r0, 0 - bl xxx_update_stuff - mov r1, r8 - ldr r0, [r1] - cmp r0, 0x1F - ble _08000456 - mov r2, r9 - cmp r2, 0 - beq _080004C0 - bl sub_8012468 - b _080004B2 - .align 2, 0 -_08000498: .4byte gUnknown_80B69BC -_0800049C: .4byte gUnknown_2000A80 -_080004A0: .4byte gUnknown_203B03C -_080004A4: .4byte gUnknown_2026E4E -_080004A8: .4byte gUnknown_203B038 -_080004AC: - movs r0, 0 - bl xxx_update_stuff -_080004B2: - bl sub_8012484 - lsls r0, 24 - cmp r0, 0 - bne _080004AC - bl sub_8012558 -_080004C0: - movs r0, 0x1 - mov r9, r0 - movs r0, 0x8 - bl sub_800BDFC - movs r4, 0x1 - movs r0, 0 - movs r1, 0x14 - bl sub_80095CC - bl InitMainMenu -_080004D8: - bl sub_80363E0 - lsls r0, 24 - cmp r0, 0 - beq _08000522 - ldr r3, _080004FC - ldrh r1, [r3, 0x2] - movs r2, 0x80 - lsls r2, 2 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _08000500 - movs r4, 0 - movs r0, 0x13 - bl SetBGOBJEnableFlags - b _08000516 - .align 2, 0 -_080004FC: .4byte gRealInputs -_08000500: - cmp r4, 0 - bne _08000522 - ldrh r1, [r3] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _08000516 - movs r4, 0x1 - movs r0, 0 - bl SetBGOBJEnableFlags -_08000516: - cmp r4, 0 - bne _08000522 - movs r0, 0 - bl xxx_update_stuff - b _080004D8 -_08000522: - bl SetUpMenu - movs r0, 0 - bl xxx_update_stuff - bl UpdateMenu - adds r5, r0, 0 - bl CleanUpMenu - cmp r5, 0x2 - beq _08000542 - cmp r5, 0x4 - beq _08000542 - cmp r5, 0x3 - bne _080004D8 -_08000542: - bl sub_80357D0 - mov r1, r8 - ldr r0, [r1] - cmp r0, 0 - ble _08000580 - ldr r7, _08000598 - adds r6, r7, 0 -_08000552: - ldr r0, [r6] - subs r0, 0x1 - str r0, [r6] - movs r4, 0 -_0800055A: - ldr r0, _0800059C - ldr r0, [r0] - lsls r2, r4, 2 - ldr r1, [r0, 0x4] - adds r1, r2 - ldr r2, [r6] - adds r0, r4, 0 - movs r3, 0 - bl SetBGPaletteBufferColorRGB - adds r4, 0x1 - cmp r4, 0xEF - ble _0800055A - movs r0, 0 - bl xxx_update_stuff - ldr r0, [r7] - cmp r0, 0 - bgt _08000552 -_08000580: - ldr r0, _0800059C - ldr r0, [r0] - bl CloseFile - cmp r5, 0x3 - beq _080005CA - cmp r5, 0x3 - bhi _080005A0 - cmp r5, 0x2 - beq _080005A6 - b _08000406 - .align 2, 0 -_08000598: .4byte gUnknown_2000A80 -_0800059C: .4byte gUnknown_203B038 -_080005A0: - cmp r5, 0x4 - beq _080005C6 - b _08000406 -_080005A6: - movs r0, 0x7 - bl sub_80953D4 - adds r1, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080005C2 - lsls r0, r1, 24 - lsrs r0, 24 - bl sub_8095240 - movs r0, 0x2 - b _080005D4 -_080005C2: - movs r0, 0x1 - b _080005D4 -_080005C6: - movs r0, 0x3 - b _080005D4 -_080005CA: - bl sub_80122A8 - bl nullsub_33 - movs r0, 0 -_080005D4: - bl sub_80009D0 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - b _08000406 - thumb_func_end GameLoop - thumb_func_start xxx_update_stuff xxx_update_stuff: push {lr} @@ -320,8 +35,8 @@ xxx_update_stuff: _08000630: .4byte gUnknown_203B46C thumb_func_end xxx_update_stuff - thumb_func_start sub_8000634 -sub_8000634: + thumb_func_start LoadTitleScreen +LoadTitleScreen: push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -425,11 +140,11 @@ _08000708: .4byte gUnknown_80B69F8 _0800070C: .4byte gUnknown_80B6A28 _08000710: .4byte 0x00005b20 _08000714: .4byte gUnknown_8380000 -_08000718: .4byte gUnknown_203B038 +_08000718: .4byte gTitlePaletteFile _0800071C: .4byte gUnknown_202B038 _08000720: .4byte 0x06008000 _08000724: .4byte 0x00004b20 - thumb_func_end sub_8000634 + thumb_func_end LoadTitleScreen thumb_func_start sub_8000728 sub_8000728: diff --git a/asm/code_8012A18.s b/asm/code_8012A18.s index 872b6788..90b3ebd1 100644 --- a/asm/code_8012A18.s +++ b/asm/code_8012A18.s @@ -229,7 +229,7 @@ _08012C18: lsrs r0, 24 bl sub_8092288 adds r4, r0, 0 - bl sub_8008584 + bl GetCharacter movs r1, 0x6 ldrsh r0, [r0, r1] add r8, r0 @@ -271,7 +271,7 @@ sub_8012C60: lsrs r0, 24 bl sub_8092288 adds r4, r0, 0 - bl sub_8008584 + bl GetCharacter adds r1, r0, 0 movs r2, 0x6 ldrsh r0, [r1, r2] @@ -978,7 +978,7 @@ sub_801317C: strh r1, [r0, 0xA] adds r0, 0x8 bl nullsub_7 - bl sub_8004914 + bl ResetUnusedInputStruct pop {r0} bx r0 .align 2, 0 @@ -3377,7 +3377,7 @@ _08014368: stm r0!, {r1,r3,r5} ldm r2!, {r1,r3,r6} stm r0!, {r1,r3,r6} - bl sub_8004914 + bl ResetUnusedInputStruct adds r0, r4, 0 movs r1, 0x1 movs r2, 0x1 @@ -4184,7 +4184,7 @@ _08014A04: lsrs r0, 16 cmp r0, 0 beq _08014A34 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -4325,7 +4325,7 @@ _08014AE8: ldm r0!, {r2,r3,r6} stm r1!, {r2,r3,r6} _08014B1E: - bl sub_8004914 + bl ResetUnusedInputStruct adds r0, r4, 0 movs r1, 0x1 movs r2, 0 @@ -5019,7 +5019,7 @@ _080150AC: adds r0, 0x84 mov r1, r9 bl sub_8012CAC - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x54 movs r1, 0x1 @@ -5494,7 +5494,7 @@ _080154A0: stm r1!, {r2,r3,r5} ldm r0!, {r2,r6,r7} stm r1!, {r2,r6,r7} - bl sub_8004914 + bl ResetUnusedInputStruct mov r3, r8 ldr r0, [r3] adds r0, r4 @@ -6918,7 +6918,7 @@ _08015FBC: .4byte gUnknown_203B1FC _08015FC0: ldrb r0, [r2] bl sub_8092288 - bl sub_8008584 + bl GetCharacter ldr r3, [r7] adds r1, r3, 0 adds r1, 0x8A @@ -6954,7 +6954,7 @@ sub_8015FEC: _08016002: ldrb r0, [r4] bl sub_8092288 - bl sub_8008584 + bl GetCharacter movs r1, 0x6 ldrsh r0, [r0, r1] adds r7, r0 @@ -6983,7 +6983,7 @@ sub_801602C: push {r4-r6,lr} adds r6, r0, 0 adds r5, r1, 0 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -7358,7 +7358,7 @@ _080162E0: sub_80162E4: push {r4-r6,lr} adds r4, r0, 0 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -7599,7 +7599,7 @@ _080164AC: ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} _080164D8: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0xA8 movs r1, 0x1 @@ -7630,7 +7630,7 @@ _08016502: subs r2, 0x1 cmp r2, 0 bge _08016502 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08016534 ldr r0, [r0] adds r0, 0xA8 @@ -8576,7 +8576,7 @@ _08016C90: .4byte gUnknown_203B460 sub_8016C94: push {r4-r6,lr} adds r4, r0, 0 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -8955,7 +8955,7 @@ _08016FBE: cmp r2, 0 bge _08016FBE _08016FD8: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08016FF0 ldr r0, [r0] adds r0, 0xEC @@ -10750,7 +10750,7 @@ _08017E18: .4byte gUnknown_203B208 thumb_func_start sub_8017E1C sub_8017E1C: push {r4,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -11084,7 +11084,7 @@ _080180C6: cmp r2, 0 bge _080180C6 _080180E0: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _080180F8 ldr r0, [r0] adds r0, 0xF0 @@ -12760,7 +12760,7 @@ _08018E4E: cmp r2, 0 bge _08018E4E _08018E68: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08018E80 ldr r0, [r0] adds r0, 0xE8 @@ -14755,7 +14755,7 @@ sub_8019E40: ldr r1, [r0, 0x38] adds r0, 0x9C str r0, [r1, 0x14] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x3C movs r1, 0x1 @@ -14917,7 +14917,7 @@ sub_8019FCC: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0801A00C ldr r0, [r5] adds r0, 0x3C @@ -14964,7 +14964,7 @@ sub_801A010: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -15029,7 +15029,7 @@ sub_801A064: adds r3, 0x2 adds r2, 0x4C strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -15223,7 +15223,7 @@ sub_801A20C: ldr r1, [r0, 0x38] adds r0, 0x9C str r0, [r1, 0x14] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x3C movs r1, 0x1 @@ -15385,7 +15385,7 @@ sub_801A398: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0801A3D8 ldr r0, [r5] adds r0, 0x3C @@ -15432,7 +15432,7 @@ sub_801A3DC: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -15497,7 +15497,7 @@ sub_801A430: adds r3, 0x2 adds r2, 0x4C strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -15736,7 +15736,7 @@ _0801A66E: bl sub_8012D08 movs r0, 0x1 bl sub_8099690 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x90 movs r1, 0x1 @@ -16021,7 +16021,7 @@ sub_801A8D0: lsrs r4, 24 movs r0, 0x1 bl sub_8099690 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0801A924 ldr r0, [r5] adds r0, 0x90 @@ -16084,7 +16084,7 @@ sub_801A928: stm r1!, {r2,r3,r5} movs r0, 0 bl sub_8099690 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x90 movs r1, 0x1 @@ -16129,7 +16129,7 @@ sub_801A998: ldr r0, [r4] adds r0, 0xF3 strb r2, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x90 movs r1, 0x1 @@ -17437,7 +17437,7 @@ sub_801B3C0: str r1, [r0, 0x24] adds r0, 0x28 bl sub_80140B4 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x28 movs r1, 0x1 @@ -17950,7 +17950,7 @@ _0801B7D2: subs r2, 0x1 cmp r2, 0 bge _0801B7D2 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0801B7F8 ldr r0, [r0] b _0801B82E @@ -17975,7 +17975,7 @@ _0801B800: adds r0, r1, r0 adds r1, 0xCC bl sub_8012CAC - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] _0801B82E: adds r0, 0xF4 @@ -17998,7 +17998,7 @@ _0801B840: stm r1!, {r2,r3,r7} ldm r0!, {r5-r7} stm r1!, {r5-r7} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0xF4 movs r1, 0x1 @@ -18979,7 +18979,7 @@ _0801C000: cmp r2, 0 bge _0801C000 _0801C01A: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0801C038 ldr r0, [r0] adds r0, 0xC4 @@ -19317,7 +19317,7 @@ _0801C270: str r1, [r0, 0x14] adds r1, r7, 0 bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x60 movs r1, 0x1 @@ -19438,7 +19438,7 @@ sub_801C3B0: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0801C3F4 ldr r0, [r5] adds r0, 0x60 @@ -19485,7 +19485,7 @@ sub_801C3F8: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x60 movs r1, 0x1 @@ -19528,7 +19528,7 @@ sub_801C440: ldr r0, [r4] adds r0, 0xC3 strb r2, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x60 movs r1, 0x1 @@ -19557,7 +19557,7 @@ sub_801C440: adds r2, r1 adds r2, 0x70 strh r0, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x60 movs r1, 0x1 @@ -19759,7 +19759,7 @@ sub_801C620: str r6, [r0, 0x24] adds r0, 0x28 bl sub_80140B4 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x28 movs r1, 0x1 @@ -20165,7 +20165,7 @@ _0801C96C: ldr r0, [r0] mov r1, r10 bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, r7 movs r1, 0x1 @@ -20391,7 +20391,7 @@ sub_801CB5C: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0801CBAC ldr r0, [r5] movs r1, 0x9E @@ -20463,7 +20463,7 @@ sub_801CBB8: stm r1!, {r2,r3,r6} ldm r0!, {r2,r3,r6} stm r1!, {r2,r3,r6} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, r4 movs r1, 0x1 @@ -20544,7 +20544,7 @@ sub_801CC38: lsls r0, 3 adds r3, r0 strh r2, [r3] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] movs r1, 0x9E lsls r1, 3 @@ -21011,7 +21011,7 @@ _0801D010: .4byte gUnknown_203B244 sub_801D014: push {r4,r5,lr} adds r5, r0, 0 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -21454,7 +21454,7 @@ _0801D368: cmp r2, 0x3 ble _0801D368 _0801D384: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0801D3A4 ldr r0, [r0] adds r0, 0xB8 diff --git a/asm/code_801D760.s b/asm/code_801D760.s index 8b6a04b8..41049817 100644 --- a/asm/code_801D760.s +++ b/asm/code_801D760.s @@ -187,7 +187,7 @@ sub_801D9E4: ldr r1, [r0, 0x38] adds r0, 0x9C str r0, [r1, 0x14] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -325,7 +325,7 @@ sub_801DB0C: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -363,7 +363,7 @@ sub_801DB54: ldr r0, [r4] adds r0, 0x9F strb r2, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -394,7 +394,7 @@ sub_801DB54: adds r3, 0x2 adds r2, 0x4C strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -770,7 +770,7 @@ _0801DE90: cmp r3, 0x3 ble _0801DE90 _0801DEAC: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0801DECC ldr r0, [r0] adds r0, 0xBC @@ -1175,7 +1175,7 @@ sub_801E198: ldr r0, [r0, 0x48] movs r1, 0x1 bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x4C movs r1, 0x1 @@ -1312,7 +1312,7 @@ sub_801E2C4: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x4C movs r1, 0x1 @@ -1483,7 +1483,7 @@ _0801E406: ldr r0, [r0, 0x38] movs r1, 0xA bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -1594,7 +1594,7 @@ sub_801E510: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0801E548 ldr r0, [r5] adds r0, 0x3C @@ -1635,7 +1635,7 @@ sub_801E54C: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -1683,7 +1683,7 @@ sub_801E594: adds r3, 0x2 adds r2, 0x4C strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -1780,7 +1780,7 @@ sub_801E658: ldr r1, [r0, 0x38] adds r0, 0x9C str r0, [r1, 0x14] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -1868,7 +1868,7 @@ sub_801E724: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -1907,7 +1907,7 @@ sub_801E76C: ldr r0, [r4] adds r0, 0x9F strb r2, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -2225,7 +2225,7 @@ _0801E9E6: cmp r3, 0 bge _0801E9E6 _0801EA00: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0801EA24 ldr r0, [r0] movs r7, 0x96 @@ -2859,7 +2859,7 @@ _0801EED8: adds r0, r1 adds r1, r6, 0 bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x58 movs r1, 0x1 @@ -3219,7 +3219,7 @@ sub_801F1B0: bne _0801F1C6 strb r1, [r2, 0x4] _0801F1C6: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x58 movs r1, 0x1 @@ -3290,7 +3290,7 @@ sub_801F214: ldm r0!, {r2,r3,r6} stm r1!, {r2,r3,r6} _0801F258: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x58 movs r1, 0x1 @@ -3602,7 +3602,7 @@ sub_801F428: adds r4, 0x3 adds r0, r4 strb r2, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] add r0, r8 movs r1, 0x1 @@ -3749,7 +3749,7 @@ sub_801F5F0: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0801F638 ldr r0, [r5] movs r1, 0xE1 @@ -3803,7 +3803,7 @@ sub_801F63C: stm r1!, {r2,r3,r6} ldm r0!, {r2,r3,r6} stm r1!, {r2,r3,r6} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, r4 movs r1, 0x1 @@ -3859,7 +3859,7 @@ sub_801F690: lsls r0, 2 adds r3, r0 strh r2, [r3] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] movs r1, 0xE1 lsls r1, 2 @@ -4024,7 +4024,7 @@ sub_801F808: str r1, [r0, 0x60] adds r0, r1, 0 bl sub_80140B4 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x64 movs r1, 0x1 @@ -4129,7 +4129,7 @@ sub_801F8D0: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x64 movs r1, 0x1 @@ -4200,7 +4200,7 @@ _0801F950: ldr r0, [r4] adds r0, 0xC7 strb r3, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x64 movs r1, 0x1 @@ -4208,7 +4208,7 @@ _0801F950: bl sub_800641C b _0801F99C _0801F98C: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x64 movs r1, 0x1 @@ -4439,7 +4439,7 @@ _0801FB48: sub_801FB50: push {r4-r7,lr} adds r4, r0, 0 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -4765,7 +4765,7 @@ _0801FDF6: stm r1!, {r2,r3,r7} ldm r0!, {r2,r6,r7} stm r1!, {r2,r6,r7} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, r5 movs r1, 0x1 @@ -4789,7 +4789,7 @@ _0801FE38: adds r0, r1, r0 adds r1, 0x7C bl sub_8012CAC - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] movs r6, 0xC0 lsls r6, 1 @@ -4836,7 +4836,7 @@ _0801FEB0: adds r0, r1, r0 adds r1, 0x7C bl sub_8012CAC - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, r5 _0801FEC2: @@ -4870,7 +4870,7 @@ _0801FEE4: subs r2, 0x1 cmp r2, 0 bge _0801FEE4 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0801FF20 ldr r0, [r0] movs r1, 0xC0 @@ -7236,7 +7236,7 @@ _080211C0: ldr r1, [r0, 0x78] adds r0, 0xDC str r0, [r1, 0x14] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x7C movs r1, 0x1 @@ -7408,7 +7408,7 @@ sub_8021354: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0802139C ldr r0, [r5] adds r0, 0x7C @@ -7469,7 +7469,7 @@ sub_80213A0: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x7C movs r1, 0x1 @@ -7510,7 +7510,7 @@ sub_8021410: ldr r0, [r4] adds r0, 0xDF strb r2, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x7C movs r1, 0x1 @@ -7542,7 +7542,7 @@ sub_8021410: adds r3, 0x2 adds r2, 0x8C strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x7C movs r1, 0x1 @@ -8045,7 +8045,7 @@ sub_8021830: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x7C movs r1, 0x1 @@ -8067,7 +8067,7 @@ _08021874: .4byte gUnknown_80DC4BC thumb_func_start sub_8021878 sub_8021878: push {lr} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08021890 ldr r0, [r0] adds r0, 0x7C @@ -8106,7 +8106,7 @@ sub_8021894: bl xxx_call_draw_string ldr r0, [r4] ldrb r0, [r0, 0xC] - bl sub_80925DC + bl GetFriendAreaDescription adds r2, r0, 0 ldr r0, [r4] ldr r3, [r0, 0x74] @@ -8469,7 +8469,7 @@ _08021B94: sub_8021B9C: push {r4-r6,lr} adds r4, r0, 0 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -8743,7 +8743,7 @@ _08021DD2: cmp r2, 0 bge _08021DD2 _08021DEC: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08021E04 ldr r0, [r0] adds r0, 0xD0 @@ -9987,7 +9987,7 @@ _080227B2: sub_80227B8: push {r4,r5,lr} adds r5, r0, 0 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -10246,7 +10246,7 @@ _080229CC: cmp r2, 0 bge _080229CC _080229E6: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08022A08 ldr r0, [r0] movs r6, 0xA4 @@ -11251,7 +11251,7 @@ _080231F6: ldr r0, [r0] mov r1, r10 bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r6] adds r0, r5 movs r1, 0x1 @@ -11422,7 +11422,7 @@ sub_8023354: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0802339C ldr r0, [r5] movs r1, 0xE6 @@ -11490,7 +11490,7 @@ sub_80233A0: stm r1!, {r2,r3,r6} ldm r0!, {r2,r3,r6} stm r1!, {r2,r3,r6} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, r4 movs r1, 0x1 @@ -11568,7 +11568,7 @@ sub_8023420: lsls r1, 2 adds r3, r1 strh r0, [r3] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] movs r2, 0xE6 lsls r2, 2 @@ -12269,7 +12269,7 @@ _08023A04: ldr r0, [r0] mov r1, r10 bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, r6 movs r1, 0x1 @@ -12455,7 +12455,7 @@ sub_8023B7C: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _08023BD0 ldr r0, [r5] movs r1, 0xE5 @@ -12607,7 +12607,7 @@ sub_8023C60: stm r1!, {r2,r3,r6} ldm r0!, {r2,r3,r6} stm r1!, {r2,r3,r6} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, r4 movs r1, 0x1 @@ -12708,7 +12708,7 @@ _08023D38: lsls r1, 2 adds r3, r1 strh r0, [r3] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] movs r2, 0xE5 lsls r2, 2 @@ -13766,7 +13766,7 @@ sub_802453C: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0xE8 movs r1, 0x1 @@ -13805,7 +13805,7 @@ sub_8024588: ldr r1, _080245CC adds r0, r1 strb r2, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0xE8 movs r1, 0x1 @@ -13896,7 +13896,7 @@ _08024658: .4byte gUnknown_203B45C thumb_func_start sub_802465C sub_802465C: push {r4,r5,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -14179,7 +14179,7 @@ _080248B8: cmp r2, 0 bge _080248B8 _080248D2: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _080248F4 ldr r0, [r0] movs r6, 0x8A @@ -15714,7 +15714,7 @@ _080254D8: cmp r2, 0x3 ble _080254D8 _080254F8: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08025514 ldr r0, [r0] movs r6, 0x8C @@ -17280,7 +17280,7 @@ _08026188: cmp r2, 0 bge _08026188 _080261A2: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _080261C8 ldr r0, [r0] movs r6, 0x88 @@ -19348,7 +19348,7 @@ _08027234: cmp r2, 0x3 ble _08027234 _08027254: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08027270 ldr r0, [r0] movs r1, 0xC0 diff --git a/asm/code_8027C84.s b/asm/code_8027C84.s index 90efd220..23e12d04 100644 --- a/asm/code_8027C84.s +++ b/asm/code_8027C84.s @@ -390,7 +390,7 @@ _08027F82: thumb_func_start sub_8027F88 sub_8027F88: push {r4-r6,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -890,7 +890,7 @@ _08028464: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -976,7 +976,7 @@ _0802850C: beq _08028516 b _08028AF2 _08028516: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -1073,7 +1073,7 @@ _080285DC: beq _080285E6 b _08028AF2 _080285E6: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -1328,7 +1328,7 @@ _080287DC: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -1430,7 +1430,7 @@ _080288A0: beq _080288AA b _08028AF2 _080288AA: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 diff --git a/asm/code_803D110.s b/asm/code_803D110.s index 4ab65ff6..55aaf578 100644 --- a/asm/code_803D110.s +++ b/asm/code_803D110.s @@ -3346,7 +3346,7 @@ _0803EB50: movs r0, 0 bl sub_8052210 _0803EB5E: - bl sub_8004914 + bl ResetUnusedInputStruct bl sub_803EC94 movs r0, 0 movs r1, 0x1 @@ -3394,7 +3394,7 @@ _0803EBBC: movs r0, 0 bl sub_8052210 _0803EBCA: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0803EBD8 movs r1, 0x1 b _0803EC6E @@ -3409,7 +3409,7 @@ _0803EBDC: movs r0, 0 bl sub_8052210 _0803EBEA: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0803EBF8 movs r1, 0x1 b _0803EC6E @@ -3424,7 +3424,7 @@ _0803EBFC: movs r0, 0 bl sub_8052210 _0803EC0A: - bl sub_8004914 + bl ResetUnusedInputStruct bl sub_803EC94 movs r0, 0 movs r1, 0x1 @@ -3468,7 +3468,7 @@ _0803EC54: bl sub_8052210 bl sub_8083D44 _0803EC66: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0803EC7C movs r1, 0 _0803EC6E: @@ -3520,7 +3520,7 @@ sub_803ECB4: str r0, [r1] movs r0, 0 bl sub_8052210 - bl sub_8004914 + bl ResetUnusedInputStruct adds r0, r5, 0 movs r1, 0x1 adds r2, r4, 0 diff --git a/asm/code_80428A0.s b/asm/code_80428A0.s index 62dcac0a..829650b6 100644 --- a/asm/code_80428A0.s +++ b/asm/code_80428A0.s @@ -2609,7 +2609,7 @@ _08043FF0: ldrsh r1, [r4, r0] adds r0, r5, 0 mov r2, r9 - bl sub_808E010 + bl GetPokemonLevelData mov r1, r9 strb r1, [r4, 0x3] ldr r0, [sp, 0x20] diff --git a/asm/code_80521D0.s b/asm/code_80521D0.s index af7b646f..2f2c168a 100644 --- a/asm/code_80521D0.s +++ b/asm/code_80521D0.s @@ -22510,7 +22510,7 @@ _0805D928: bl sub_8083600 bl sub_80647F0 bl ResetRepeatTimers - bl sub_8004914 + bl ResetUnusedInputStruct bl sub_805F1AC lsls r0, 16 cmp r0, 0 @@ -23031,7 +23031,7 @@ _0805DD66: ldr r0, _0805DDD4 strb r4, [r0] bl ResetRepeatTimers - bl sub_8004914 + bl ResetUnusedInputStruct _0805DD7E: ldr r2, _0805DDC8 ldrh r0, [r2] @@ -23048,7 +23048,7 @@ _0805DD7E: beq _0805DDA4 bl sub_80532B4 bl ResetRepeatTimers - bl sub_8004914 + bl ResetUnusedInputStruct _0805DDA4: movs r4, 0 ldr r0, _0805DDC8 @@ -23628,7 +23628,7 @@ _0805E238: adds r0, r2, 0 bl ShowFieldMenu bl ResetRepeatTimers - bl sub_8004914 + bl ResetUnusedInputStruct ldr r1, _0805E294 movs r0, 0 strb r0, [r1] @@ -26454,7 +26454,7 @@ _0805F904: cmp r3, 0 bne _0805F920 bl ResetRepeatTimers - bl sub_8004914 + bl ResetUnusedInputStruct b _0805F240 .align 2, 0 _0805F91C: .4byte gUnknown_203B418 @@ -26467,7 +26467,7 @@ _0805F92A: movs r1, 0 bl sub_803EAF0 bl ResetRepeatTimers - bl sub_8004914 + bl ResetUnusedInputStruct add sp, 0x18 pop {r3-r5} mov r8, r3 @@ -46957,7 +46957,7 @@ _08069D6C: ldrsh r1, [r4, r0] ldrb r2, [r4, 0x9] mov r0, sp - bl sub_808E010 + bl GetPokemonLevelData ldr r0, [sp] str r0, [r5, 0x10] ldrb r0, [r4, 0x14] @@ -52043,7 +52043,7 @@ _0806C462: mov r0, sp adds r1, r6, 0 adds r2, r4, 0 - bl sub_808E010 + bl GetPokemonLevelData mov r1, r8 ldrh r0, [r1, 0x4] adds r5, r0 @@ -52084,7 +52084,7 @@ _0806C4AE: mov r0, sp adds r1, r6, 0 adds r2, r4, 0 - bl sub_808E010 + bl GetPokemonLevelData mov r1, r8 ldrb r0, [r1] adds r5, r0 @@ -52124,7 +52124,7 @@ _0806C4F8: mov r0, sp adds r1, r6, 0 adds r2, r4, 0 - bl sub_808E010 + bl GetPokemonLevelData mov r1, r8 ldrb r0, [r1] adds r5, r0 @@ -64045,7 +64045,7 @@ _08072080: movs r0, 0x2 ldrsh r1, [r5, r0] mov r0, sp - bl sub_808E010 + bl GetPokemonLevelData ldr r0, [sp] str r0, [r5, 0x18] mov r0, r9 @@ -64406,7 +64406,7 @@ _0807236C: movs r0, 0x2 ldrsh r1, [r4, r0] mov r0, sp - bl sub_808E010 + bl GetPokemonLevelData ldr r0, [sp] str r0, [r4, 0x18] mov r0, r8 @@ -64656,7 +64656,7 @@ _0807255A: mov r0, sp ldr r1, [sp, 0x1C] mov r2, r8 - bl sub_808E010 + bl GetPokemonLevelData ldr r0, [sp] ldr r3, [sp, 0x20] cmp r0, r3 @@ -64739,7 +64739,7 @@ _080725F8: mov r0, sp ldr r1, [sp, 0x18] mov r2, r8 - bl sub_808E010 + bl GetPokemonLevelData ldr r0, [sp] ldr r1, [sp, 0x1C] cmp r0, r1 @@ -64764,7 +64764,7 @@ _08072624: mov r0, sp ldr r1, [sp, 0x18] adds r2, r4, 0 - bl sub_808E010 + bl GetPokemonLevelData ldr r0, [sp] subs r0, 0x1 str r0, [r5, 0x18] @@ -64779,7 +64779,7 @@ _08072644: mov r0, sp ldr r1, [sp, 0x18] adds r2, r4, 0 - bl sub_808E010 + bl GetPokemonLevelData mov r0, r8 strb r0, [r5, 0x9] ldrh r0, [r5, 0x10] @@ -65493,7 +65493,7 @@ sub_8072B78: ldrb r2, [r6, 0x9] mov r0, sp adds r1, r5, 0 - bl sub_808E010 + bl GetPokemonLevelData ldr r0, [sp] str r0, [r6, 0x18] str r4, [r7, 0x64] diff --git a/asm/code_808DAB4.s b/asm/code_808DAB4.s index bfc6812f..7ea9fd67 100644 --- a/asm/code_808DAB4.s +++ b/asm/code_808DAB4.s @@ -243,8 +243,8 @@ _0808E00A: bx r0 thumb_func_end sub_808DFDC - thumb_func_start sub_808E010 -sub_808E010: + thumb_func_start GetPokemonLevelData +GetPokemonLevelData: push {r4-r6,lr} sub sp, 0xC adds r6, r0, 0 @@ -289,11 +289,11 @@ _0808E052: pop {r0} bx r0 .align 2, 0 -_0808E06C: .4byte gUnknown_20384E8 +_0808E06C: .4byte gLevelCurrentPokeId _0808E070: .4byte gUnknown_810768C _0808E074: .4byte gUnknown_8300500 -_0808E078: .4byte gUnknown_20384F0 - thumb_func_end sub_808E010 +_0808E078: .4byte gLevelCurrentData + thumb_func_end GetPokemonLevelData thumb_func_start sub_808E07C sub_808E07C: diff --git a/asm/code_808EAB0.s b/asm/code_808EAB0.s index 6ab65ce6..51c049bd 100644 --- a/asm/code_808EAB0.s +++ b/asm/code_808EAB0.s @@ -1559,7 +1559,7 @@ sub_808F798: mov r1, sp ldrb r2, [r1, 0x3] adds r1, r5, 0 - bl sub_808E010 + bl GetPokemonLevelData ldr r0, [sp, 0x58] str r0, [sp, 0x1C] movs r0, 0 @@ -1715,7 +1715,7 @@ _0808F8A0: ldrsh r1, [r0, r3] adds r2, 0x1 add r0, sp, 0x8 - bl sub_808E010 + bl GetPokemonLevelData ldr r0, [sp, 0x8] mov r2, r10 ldr r1, [r2, 0x30] diff --git a/asm/code_8092334.s b/asm/code_8092334.s index 9048c878..42f5e90a 100644 --- a/asm/code_8092334.s +++ b/asm/code_8092334.s @@ -266,8 +266,8 @@ _080925CE: _080925D8: .4byte gFriendAreaNames thumb_func_end sub_8092578 - thumb_func_start sub_80925DC -sub_80925DC: + thumb_func_start GetFriendAreaDescription +GetFriendAreaDescription: lsls r0, 24 ldr r1, _080925E8 lsrs r0, 22 @@ -276,7 +276,7 @@ sub_80925DC: bx lr .align 2, 0 _080925E8: .4byte gFriendAreaDescriptions - thumb_func_end sub_80925DC + thumb_func_end GetFriendAreaDescription thumb_func_start sub_80925EC sub_80925EC: @@ -636,8 +636,8 @@ LoadWazaParameters: _08092868: .4byte gUnknown_81098D0 _0809286C: .4byte gUnknown_8300500 _08092870: .4byte gWazaParametersFile -_08092874: .4byte gUnknown_2038C68 -_08092878: .4byte gUnknown_2038C6C +_08092874: .4byte gMovesData +_08092878: .4byte gMovesRelated_2038C6C thumb_func_end LoadWazaParameters thumb_func_start sub_809287C @@ -766,7 +766,7 @@ _08092944: b _08092A6A .align 2, 0 _08092964: .4byte gUnknown_81098E0 -_08092968: .4byte gUnknown_2038C68 +_08092968: .4byte gMovesData _0809296C: adds r0, r4, 0 bl sub_8092BF4 @@ -848,7 +848,7 @@ _080929E2: _08092A10: .4byte gUnknown_81098EC _08092A14: .4byte gUnknown_810990C _08092A18: .4byte gUnknown_8109928 -_08092A1C: .4byte gUnknown_2038C68 +_08092A1C: .4byte gMovesData _08092A20: adds r0, r4, 0 bl sub_8092BF4 @@ -897,7 +897,7 @@ _08092A6A: _08092A78: .4byte gUnknown_8109910 _08092A7C: .4byte gUnknown_810990C _08092A80: .4byte gUnknown_8109928 -_08092A84: .4byte gUnknown_2038C68 +_08092A84: .4byte gMovesData thumb_func_end sub_80928C0 thumb_func_start sub_8092A88 @@ -972,7 +972,7 @@ sub_8092AE0: ldrsh r0, [r0, r1] bx lr .align 2, 0 -_08092AFC: .4byte gUnknown_2038C68 +_08092AFC: .4byte gMovesData thumb_func_end sub_8092AE0 thumb_func_start sub_8092B00 @@ -987,7 +987,7 @@ sub_8092B00: ldrb r0, [r0, 0x6] bx lr .align 2, 0 -_08092B14: .4byte gUnknown_2038C68 +_08092B14: .4byte gMovesData thumb_func_end sub_8092B00 thumb_func_start sub_8092B18 @@ -1013,7 +1013,7 @@ sub_8092B18: b _08092B4A .align 2, 0 _08092B40: .4byte 0x000001a5 -_08092B44: .4byte gUnknown_2038C6C +_08092B44: .4byte gMovesRelated_2038C6C _08092B48: ldr r0, _08092B50 _08092B4A: @@ -1046,7 +1046,7 @@ sub_8092B54: b _08092B86 .align 2, 0 _08092B7C: .4byte 0x000001a5 -_08092B80: .4byte gUnknown_2038C6C +_08092B80: .4byte gMovesRelated_2038C6C _08092B84: ldr r0, _08092B8C _08092B86: @@ -1068,7 +1068,7 @@ sub_8092B90: ldrb r0, [r0, 0xD] bx lr .align 2, 0 -_08092BA4: .4byte gUnknown_2038C68 +_08092BA4: .4byte gMovesData thumb_func_end sub_8092B90 thumb_func_start sub_8092BA8 @@ -1083,7 +1083,7 @@ sub_8092BA8: ldrb r0, [r0, 0x11] bx lr .align 2, 0 -_08092BBC: .4byte gUnknown_2038C68 +_08092BBC: .4byte gMovesData thumb_func_end sub_8092BA8 thumb_func_start sub_8092BC0 @@ -1099,7 +1099,7 @@ sub_8092BC0: ldrsh r0, [r0, r1] bx lr .align 2, 0 -_08092BD4: .4byte gUnknown_2038C68 +_08092BD4: .4byte gMovesData thumb_func_end sub_8092BC0 thumb_func_start sub_8092BD8 @@ -1116,7 +1116,7 @@ sub_8092BD8: ldrb r0, [r0] bx lr .align 2, 0 -_08092BF0: .4byte gUnknown_2038C68 +_08092BF0: .4byte gMovesData thumb_func_end sub_8092BD8 thumb_func_start sub_8092BF4 @@ -1131,7 +1131,7 @@ sub_8092BF4: ldrb r0, [r0, 0xC] bx lr .align 2, 0 -_08092C08: .4byte gUnknown_2038C68 +_08092C08: .4byte gMovesData thumb_func_end sub_8092BF4 thumb_func_start sub_8092C0C @@ -1146,7 +1146,7 @@ sub_8092C0C: ldrb r0, [r0, 0x12] bx lr .align 2, 0 -_08092C20: .4byte gUnknown_2038C68 +_08092C20: .4byte gMovesData thumb_func_end sub_8092C0C thumb_func_start sub_8092C24 @@ -1161,7 +1161,7 @@ sub_8092C24: ldrb r0, [r0, 0x13] bx lr .align 2, 0 -_08092C38: .4byte gUnknown_2038C68 +_08092C38: .4byte gMovesData thumb_func_end sub_8092C24 thumb_func_start sub_8092C3C @@ -1176,7 +1176,7 @@ sub_8092C3C: ldrb r0, [r0, 0x17] bx lr .align 2, 0 -_08092C50: .4byte gUnknown_2038C68 +_08092C50: .4byte gMovesData thumb_func_end sub_8092C3C thumb_func_start sub_8092C54 @@ -1191,7 +1191,7 @@ sub_8092C54: ldrb r0, [r0, 0x18] bx lr .align 2, 0 -_08092C68: .4byte gUnknown_2038C68 +_08092C68: .4byte gMovesData thumb_func_end sub_8092C54 thumb_func_start sub_8092C6C @@ -1206,7 +1206,7 @@ sub_8092C6C: ldrb r0, [r0, 0x19] bx lr .align 2, 0 -_08092C80: .4byte gUnknown_2038C68 +_08092C80: .4byte gMovesData thumb_func_end sub_8092C6C thumb_func_start sub_8092C84 @@ -1241,7 +1241,7 @@ sub_8092CA8: ldr r0, [r1, 0x20] bx lr .align 2, 0 -_08092CBC: .4byte gUnknown_2038C68 +_08092CBC: .4byte gMovesData thumb_func_end sub_8092CA8 thumb_func_start sub_8092CC0 @@ -1257,7 +1257,7 @@ sub_8092CC0: ldrb r0, [r1, 0x14] bx lr .align 2, 0 -_08092CD4: .4byte gUnknown_2038C68 +_08092CD4: .4byte gMovesData thumb_func_end sub_8092CC0 thumb_func_start sub_8092CD8 @@ -1273,7 +1273,7 @@ sub_8092CD8: ldrb r0, [r1, 0x15] bx lr .align 2, 0 -_08092CEC: .4byte gUnknown_2038C68 +_08092CEC: .4byte gMovesData thumb_func_end sub_8092CD8 thumb_func_start sub_8092CF0 @@ -1289,7 +1289,7 @@ sub_8092CF0: ldrb r0, [r1, 0x16] bx lr .align 2, 0 -_08092D04: .4byte gUnknown_2038C68 +_08092D04: .4byte gMovesData thumb_func_end sub_8092CF0 thumb_func_start sub_8092D08 @@ -3827,7 +3827,7 @@ _08093E3A: _08093E80: .4byte 0xfffffcdc _08093E84: .4byte gUnknown_202DF98 _08093E88: .4byte gUnknown_8109930 -_08093E8C: .4byte gUnknown_2038C68 +_08093E8C: .4byte gMovesData thumb_func_end sub_8093DE8 thumb_func_start sub_8093E90 @@ -3915,7 +3915,7 @@ sub_8093F10: strb r0, [r3, 0x5] b _08093F4A .align 2, 0 -_08093F44: .4byte gUnknown_2038C68 +_08093F44: .4byte gMovesData _08093F48: strb r0, [r3] _08093F4A: @@ -3955,7 +3955,7 @@ _08093F5C: strb r0, [r3, 0x5] b _08093F8E .align 2, 0 -_08093F88: .4byte gUnknown_2038C68 +_08093F88: .4byte gMovesData _08093F8C: strb r0, [r3] _08093F8E: diff --git a/asm/personality_test.s b/asm/personality_test.s index 0c45e923..545c45a1 100644 --- a/asm/personality_test.s +++ b/asm/personality_test.s @@ -1497,7 +1497,7 @@ sub_803CC80: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct mov r0, sp movs r1, 0x1 movs r2, 0 @@ -1600,7 +1600,7 @@ sub_803CD08: ldr r0, [r5] adds r0, 0xB7 strb r3, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x54 movs r1, 0x1 @@ -1732,7 +1732,7 @@ sub_803CE6C: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x54 movs r1, 0x1 @@ -1819,7 +1819,7 @@ sub_803CEF0: adds r3, 0x2 adds r2, 0x64 strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r6] adds r0, 0x54 movs r1, 0x1 diff --git a/asm/text.s b/asm/text.s index 659c236c..4c7aa616 100644 --- a/asm/text.s +++ b/asm/text.s @@ -2093,7 +2093,7 @@ _080074B0: b _080074CC .align 2, 0 _080074B8: .4byte gUnknown_80B853C -_080074BC: .4byte gUnknown_20274AC +_080074BC: .4byte gCurrentCharmap _080074C0: ldr r0, _080074F8 cmp r4, r0 @@ -2103,7 +2103,7 @@ _080074C0: add r10, r1 _080074CC: adds r0, r4, 0 - bl sub_8008584 + bl GetCharacter str r0, [sp] ldr r2, [r0] str r2, [sp, 0x4] @@ -2324,7 +2324,7 @@ _0800764E: .align 2, 0 _08007664: .4byte gUnknown_80B85DC _08007668: .4byte gUnknown_202B028 -_0800766C: .4byte gUnknown_20274AC +_0800766C: .4byte gCurrentCharmap _08007670: movs r0, 0 str r0, [sp, 0x20] @@ -2614,10 +2614,10 @@ _0800786C: .align 2, 0 _0800788C: .4byte gUnknown_80B85DC _08007890: .4byte gUnknown_202B028 -_08007894: .4byte gUnknown_20274AC +_08007894: .4byte gCurrentCharmap _08007898: .4byte 0x11111111 _0800789C: .4byte gUnknown_202B030 -_080078A0: .4byte gUnknown_2027498 +_080078A0: .4byte gCharacterSpacing thumb_func_end xxx_draw_char thumb_func_start sub_80078A4 @@ -4434,8 +4434,8 @@ _08008570: _08008580: .4byte 0x00000fff thumb_func_end sub_80084A4 - thumb_func_start sub_8008584 -sub_8008584: + thumb_func_start GetCharacter +GetCharacter: push {r4,r5,lr} adds r3, r0, 0 ldr r1, _080085C4 @@ -4468,8 +4468,8 @@ sub_8008584: adds r1, r5, r1 b _08008624 .align 2, 0 -_080085C4: .4byte gKanji -_080085C8: .4byte gUnknown_20274AC +_080085C4: .4byte gCharmaps +_080085C8: .4byte gCurrentCharmap _080085CC: .4byte 0xffff0800 _080085D0: .4byte 0x000007fe _080085D4: @@ -4525,7 +4525,7 @@ _08008624: bx r1 .align 2, 0 _0800862C: .4byte gUnknown_80B86A4 - thumb_func_end sub_8008584 + thumb_func_end GetCharacter thumb_func_start sub_8008630 sub_8008630: @@ -5857,7 +5857,7 @@ _08008F44: b _08008F64 _08008F4C: adds r0, r1, 0 - bl sub_8008584 + bl GetCharacter cmp r0, 0 beq _08008F64 movs r1, 0x6 @@ -5887,7 +5887,7 @@ _08008F7E: pop {r1} bx r1 .align 2, 0 -_08008F88: .4byte gUnknown_2027498 +_08008F88: .4byte gCharacterSpacing thumb_func_end sub_8008ED0 thumb_func_start sub_8008F8C @@ -6012,7 +6012,7 @@ _0800904A: b _08009128 .align 2, 0 _08009058: .4byte 0x000082a0 -_0800905C: .4byte gUnknown_20274AC +_0800905C: .4byte gCurrentCharmap _08009060: ldr r0, _08009070 cmp r3, r0 @@ -6023,7 +6023,7 @@ _08009060: b _08009128 .align 2, 0 _08009070: .4byte 0x000082a2 -_08009074: .4byte gUnknown_20274AC +_08009074: .4byte gCurrentCharmap _08009078: cmp r3, 0x1B beq _0800914A @@ -6082,7 +6082,7 @@ _080090B8: b _08009128 _080090E0: adds r0, r3, 0 - bl sub_8008584 + bl GetCharacter adds r2, r0, 0 cmp r2, 0 beq _08009128 @@ -6120,7 +6120,7 @@ _08009128: adds r0, r5, 0 adds r1, r4, 0 add r2, sp, 0x8 - bl sub_80091AC + bl HandleTextFormat adds r4, r0, 0 mov r1, r9 bl xxx_get_next_char_from_string @@ -6141,7 +6141,7 @@ _0800914A: pop {r0} bx r0 .align 2, 0 -_08009158: .4byte gUnknown_2027498 +_08009158: .4byte gCharacterSpacing thumb_func_end xxx_draw_string thumb_func_start sub_800915C @@ -6184,7 +6184,7 @@ sub_8009190: adds r2, r1, 0 ldr r0, _080091A4 adds r1, r3, 0 - bl sub_80091AC + bl HandleTextFormat pop {r1} bx r1 .align 2, 0 @@ -6197,8 +6197,8 @@ sub_80091A8: bx lr thumb_func_end sub_80091A8 - thumb_func_start sub_80091AC -sub_80091AC: + thumb_func_start HandleTextFormat +HandleTextFormat: push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -6463,7 +6463,7 @@ _0800937A: pop {r4-r7} pop {r1} bx r1 - thumb_func_end sub_80091AC + thumb_func_end HandleTextFormat thumb_func_start sub_8009388 sub_8009388: @@ -6929,8 +6929,8 @@ _080096DA: bx r1 thumb_func_end sub_800963C - thumb_func_start sub_80096E0 -sub_80096E0: + thumb_func_start InitGraphics +InitGraphics: push {r4-r6,lr} ldr r1, _0800978C movs r0, 0x1 @@ -7019,7 +7019,7 @@ _080097A0: .4byte 0x06004f00 _080097A4: .4byte gUnknown_80B88B8 _080097A8: .4byte 0x06017e00 _080097AC: .4byte gUnknown_80B88C0 - thumb_func_end sub_80096E0 + thumb_func_end InitGraphics thumb_func_start sub_80097B0 sub_80097B0: diff --git a/asm/wonder_mail.s b/asm/wonder_mail.s index ba8c4251..5b902716 100644 --- a/asm/wonder_mail.s +++ b/asm/wonder_mail.s @@ -8,7 +8,7 @@ thumb_func_start sub_8029B50 sub_8029B50: push {r4,r5,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -596,7 +596,7 @@ sub_802A050: cmp r0, 0x3 bhi _0802A08C bl sub_8031E10 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802A084 ldr r0, [r0] movs r1, 0xEF @@ -700,7 +700,7 @@ _0802A10C: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -790,7 +790,7 @@ _0802A1D2: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -835,7 +835,7 @@ sub_802A230: cmp r0, 0x2 bcc _0802A284 bl sub_8030DE4 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _0802A27C ldr r0, [r4] movs r1, 0xEF @@ -933,7 +933,7 @@ _0802A2FC: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -960,7 +960,7 @@ sub_802A33C: cmp r0, 0x3 bhi _0802A394 bl sub_801B450 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _0802A38C ldr r0, [r4] movs r1, 0xEF @@ -1048,7 +1048,7 @@ _0802A3FA: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -1329,7 +1329,7 @@ _0802A654: _0802A65C: .4byte gUnknown_203B2C4 _0802A660: bl sub_80155F0 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802A688 ldr r0, [r0] movs r1, 0xEF @@ -2186,7 +2186,7 @@ _0802AD20: beq _0802AD2A b _0802B2AA _0802AD2A: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -2229,7 +2229,7 @@ _0802AD80: beq _0802AD8A b _0802B2AA _0802AD8A: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -2406,7 +2406,7 @@ _0802AEF4: lsls r5, 2 adds r0, r5 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -2422,7 +2422,7 @@ _0802AF1A: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -2891,7 +2891,7 @@ _0802B2D0: .4byte gUnknown_203B2C4 thumb_func_start sub_802B2D4 sub_802B2D4: push {r4,r5,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -3382,7 +3382,7 @@ _0802B6B0: ldr r0, [r0, 0x70] mov r1, r8 bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x74 movs r1, 0x1 @@ -3525,7 +3525,7 @@ sub_802B7D0: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0802B818 ldr r0, [r5] adds r0, 0x74 @@ -3583,7 +3583,7 @@ sub_802B81C: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x74 movs r1, 0x1 @@ -3634,7 +3634,7 @@ sub_802B880: adds r3, 0x2 adds r2, 0x84 strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x74 movs r1, 0x1 @@ -3845,7 +3845,7 @@ sub_802B9FC: stm r0!, {r1,r4,r7} ldm r2!, {r3,r4,r7} stm r0!, {r3,r4,r7} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x28 movs r1, 0x1 @@ -3925,7 +3925,7 @@ sub_802BACC: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x28 movs r1, 0x1 @@ -4280,7 +4280,7 @@ _0802BD8E: ldr r0, [r0, 0x3C] mov r1, r8 bl sub_8012D34 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x40 movs r1, 0x1 @@ -4409,7 +4409,7 @@ sub_802BE94: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0802BED8 ldr r0, [r5] adds r0, 0x40 @@ -4458,7 +4458,7 @@ sub_802BEDC: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x40 movs r1, 0x1 @@ -4522,7 +4522,7 @@ sub_802BF30: adds r3, 0x2 adds r2, 0x50 strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x40 movs r1, 0x1 @@ -4785,7 +4785,7 @@ _0802C186: ldr r0, [r0, 0x40] mov r1, r8 bl sub_8012D34 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x44 movs r1, 0x1 @@ -4914,7 +4914,7 @@ sub_802C28C: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0802C2D0 ldr r0, [r5] adds r0, 0x44 @@ -4963,7 +4963,7 @@ sub_802C2D4: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x44 movs r1, 0x1 @@ -5028,7 +5028,7 @@ sub_802C328: adds r3, 0x2 adds r2, 0x54 strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x44 movs r1, 0x1 @@ -5258,7 +5258,7 @@ _0802C53A: ldr r0, [r0, 0x40] mov r1, r8 bl sub_8012D34 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] adds r0, 0x44 movs r1, 0x1 @@ -5387,7 +5387,7 @@ sub_802C640: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0802C684 ldr r0, [r5] adds r0, 0x44 @@ -5436,7 +5436,7 @@ sub_802C688: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x44 movs r1, 0x1 @@ -5501,7 +5501,7 @@ sub_802C6DC: adds r3, 0x2 adds r2, 0x54 strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x44 movs r1, 0x1 @@ -5837,7 +5837,7 @@ _0802C998: cmp r2, 0x3 ble _0802C998 _0802C9B8: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802C9D4 ldr r0, [r0] movs r1, 0xCE @@ -6391,7 +6391,7 @@ _0802CDEA: str r1, [r0, 0x14] movs r1, 0x4 bl sub_8012D34 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -6486,7 +6486,7 @@ sub_802CED8: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _0802CF10 ldr r0, [r5] adds r0, 0x3C @@ -6527,7 +6527,7 @@ sub_802CF14: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -6591,7 +6591,7 @@ sub_802CF5C: adds r3, 0x2 adds r2, 0x4C strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -6943,7 +6943,7 @@ _0802D264: cmp r2, 0 bge _0802D264 _0802D27E: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802D2A0 ldr r0, [r0] movs r6, 0xD4 @@ -8063,7 +8063,7 @@ sub_802DB28: movs r0, 0 b _0802DBC6 _0802DB4A: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -8226,7 +8226,7 @@ _0802DC60: cmp r2, 0 bge _0802DC60 _0802DC7A: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802DC94 ldr r0, [r0] adds r0, 0x48 @@ -8569,7 +8569,7 @@ sub_802DF24: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x18 movs r1, 0x1 @@ -8591,7 +8591,7 @@ _0802DF68: .4byte gUnknown_80E0248 thumb_func_start sub_802DF6C sub_802DF6C: push {lr} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802DF84 ldr r0, [r0] adds r0, 0x18 @@ -8858,7 +8858,7 @@ _0802E168: cmp r3, 0x3 ble _0802E168 _0802E188: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802E1A8 ldr r0, [r0] movs r7, 0x86 @@ -9931,7 +9931,7 @@ _0802EA14: cmp r3, 0x3 ble _0802EA14 _0802EA34: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802EA54 ldr r0, [r0] movs r7, 0x86 @@ -10731,7 +10731,7 @@ _0802F04C: cmp r3, 0 bge _0802F04C _0802F066: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802F084 ldr r0, [r0] adds r0, 0xF0 @@ -10949,7 +10949,7 @@ sub_802F204: adds r6, r0, 0 lsls r4, r1, 24 lsrs r4, 24 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -11104,7 +11104,7 @@ _0802F31C: subs r2, 0x1 cmp r2, 0 bge _0802F31C - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802F350 ldr r0, [r0] adds r0, 0x24 @@ -11679,7 +11679,7 @@ _0802F7FC: ldr r0, [r0] mov r1, r8 bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0xF8 movs r1, 0x1 @@ -11884,7 +11884,7 @@ sub_802F974: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0xF8 movs r1, 0x1 @@ -11959,7 +11959,7 @@ sub_802F9C0: lsls r0, 1 adds r3, r0 strh r2, [r3] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0xF8 movs r1, 0x1 @@ -12335,7 +12335,7 @@ _0802FD0E: sub_802FD14: push {r4-r6,lr} adds r5, r0, 0 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -12625,7 +12625,7 @@ _0802FF4E: cmp r2, 0 bge _0802FF4E _0802FF68: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0802FF80 ldr r0, [r0] adds r0, 0x6C @@ -13128,7 +13128,7 @@ _08030362: ldr r0, [r0, 0x68] mov r1, r8 bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x6C movs r1, 0x1 @@ -13284,7 +13284,7 @@ sub_8030480: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x6C movs r1, 0x1 @@ -13348,7 +13348,7 @@ sub_80304C8: adds r3, 0x2 adds r2, 0x7C strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x6C movs r1, 0x1 @@ -13604,7 +13604,7 @@ _0803071E: ldr r0, [r0, 0x5C] mov r1, r8 bl sub_8012D08 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r6] adds r0, 0x60 movs r1, 0x1 @@ -13769,7 +13769,7 @@ sub_803084C: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x60 movs r1, 0x1 @@ -13821,7 +13821,7 @@ sub_80308A0: ldr r0, [r4] adds r0, 0xC3 strb r2, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x60 movs r1, 0x1 @@ -13852,7 +13852,7 @@ sub_80308A0: adds r3, 0x2 adds r2, 0x70 strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x60 movs r1, 0x1 @@ -14513,7 +14513,7 @@ sub_8030DE4: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x18 movs r1, 0x1 @@ -14535,7 +14535,7 @@ _08030E28: .4byte gUnknown_80E0900 thumb_func_start sub_8030E2C sub_8030E2C: push {lr} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08030E44 ldr r0, [r0] adds r0, 0x18 @@ -14686,7 +14686,7 @@ _08030F54: .4byte gUnknown_80E0938 sub_8030F58: push {r4-r6,lr} adds r6, r0, 0 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -15035,13 +15035,13 @@ _080311E8: _08031224: .4byte gUnknown_203B328 _08031228: .4byte gUnknown_80E0990 _0803122C: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 bl sub_800641C _0803123A: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08031254 ldr r0, [r0] adds r0, 0xA8 @@ -15360,7 +15360,7 @@ sub_80314B4: push {r4-r6,lr} lsls r0, 16 asrs r5, r0, 16 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -16102,7 +16102,7 @@ sub_8031A3C: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x18 movs r1, 0x1 @@ -16155,7 +16155,7 @@ _08031ABE: ldr r0, [r0, 0x14] bl sub_8012D08 _08031AC6: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08031AE0 ldr r0, [r0] adds r0, 0x18 @@ -16575,7 +16575,7 @@ sub_8031E10: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x18 movs r1, 0x1 @@ -16597,7 +16597,7 @@ _08031E54: .4byte gUnknown_80E1FA8 thumb_func_start sub_8031E58 sub_8031E58: push {lr} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08031E70 ldr r0, [r0] adds r0, 0x18 @@ -16766,7 +16766,7 @@ sub_8031F60: ldr r1, [r0, 0x38] adds r0, 0x9C str r0, [r1, 0x14] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -16856,7 +16856,7 @@ sub_803203C: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -16920,7 +16920,7 @@ sub_8032084: adds r3, 0x2 adds r2, 0x4C strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -17102,7 +17102,7 @@ _08032258: .4byte gUnknown_203B338 thumb_func_start sub_803225C sub_803225C: push {r4,r5,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -18234,7 +18234,7 @@ _08032D9C: beq _08032DA8 bl _080338B4 _08032DA8: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -18284,7 +18284,7 @@ _08032E0C: lsls r3, 2 adds r0, r3 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -18383,7 +18383,7 @@ _08032EEC: beq _08032EF8 bl sub_8023C60 _08032EF8: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -18456,7 +18456,7 @@ _08032F98: beq _08032FA4 bl _080338B4 _08032FA4: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -18745,7 +18745,7 @@ _080331DC: beq _080331E6 b _080338B4 _080331E6: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -18838,7 +18838,7 @@ _08033288: beq _08033292 b _080338B4 _08033292: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -19010,7 +19010,7 @@ _080333EC: adds r0, r4 _080333F4: bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -19031,7 +19031,7 @@ _0803341C: lsls r5, 2 adds r0, r5 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -19338,7 +19338,7 @@ _0803368C: beq _08033696 b _080338B4 _08033696: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -20449,7 +20449,7 @@ _08033F2E: _08033F34: .4byte gUnknown_203B484 _08033F38: bl sub_80155F0 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08033F60 ldr r0, [r0] movs r1, 0xEF @@ -20591,7 +20591,7 @@ _08034028: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -20665,7 +20665,7 @@ _080340D2: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -20710,7 +20710,7 @@ sub_8034130: cmp r0, 0x2 bcc _08034184 bl sub_8030DE4 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _0803417C ldr r0, [r4] movs r1, 0xEF @@ -20814,7 +20814,7 @@ _08034204: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -20889,7 +20889,7 @@ _080342B2: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -20939,7 +20939,7 @@ _08034320: cmp r0, 0x3 bhi _08034370 bl sub_802453C - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _08034368 ldr r0, [r4] movs r1, 0xEF @@ -21159,7 +21159,7 @@ sub_80344C0: cmp r0, 0x3 bhi _080344FC bl sub_8031E10 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _080344F4 ldr r0, [r0] movs r1, 0xEF @@ -21230,7 +21230,7 @@ _08034544: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -21304,7 +21304,7 @@ _080345EE: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -21349,7 +21349,7 @@ sub_803464C: cmp r0, 0x2 bcc _080346A0 bl sub_8030DE4 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _08034698 ldr r0, [r4] movs r1, 0xEF @@ -21475,7 +21475,7 @@ sub_803473C: cmp r0, 0x3 bhi _08034778 bl sub_8031E10 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08034770 ldr r0, [r0] movs r1, 0xEF @@ -21767,7 +21767,7 @@ sub_8034970: cmp r0, 0x3 bhi _080349AC bl sub_8031E10 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _080349A4 ldr r0, [r0] movs r1, 0xEF @@ -21865,7 +21865,7 @@ _08034A24: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -21939,7 +21939,7 @@ _08034ACE: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -21984,7 +21984,7 @@ sub_8034B2C: cmp r0, 0x2 bcc _08034B80 bl sub_8030DE4 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _08034B78 ldr r0, [r4] movs r1, 0xEF @@ -22082,7 +22082,7 @@ _08034BF8: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -22109,7 +22109,7 @@ sub_8034C38: cmp r0, 0x3 bhi _08034C90 bl sub_801B450 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _08034C88 ldr r0, [r4] movs r1, 0xEF @@ -22197,7 +22197,7 @@ _08034CF6: lsls r1, 2 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -22378,7 +22378,7 @@ _08034E90: _08034E98: .4byte gUnknown_203B33C _08034E9C: bl sub_80155F0 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _08034EC4 ldr r0, [r0] movs r3, 0xEF @@ -23190,7 +23190,7 @@ _08035472: stm r1!, {r2-r4} ldm r0!, {r5-r7} stm r1!, {r5-r7} - bl sub_8004914 + bl ResetUnusedInputStruct mov r1, r9 ldr r0, [r1] movs r1, 0x1 @@ -23284,7 +23284,7 @@ _08035542: movs r0, 0 bl sub_80073E0 movs r0, 0 - bl sub_80063CC + bl SelectCharmap ldr r2, _08035570 movs r0, 0x9 movs r1, 0 @@ -23381,7 +23381,7 @@ _08035610: lsls r0, 24 cmp r0, 0 bne _08035654 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -24101,7 +24101,7 @@ SetMenuItems: stm r0!, {r1,r2,r7} ldm r3!, {r1,r2,r7} stm r0!, {r1,r2,r7} - bl sub_8004914 + bl ResetUnusedInputStruct adds r0, r4, 0 movs r1, 0x1 movs r2, 0x1 @@ -24163,7 +24163,7 @@ sub_8035CC0: stm r1!, {r2-r4} ldm r0!, {r2-r4} stm r1!, {r2-r4} - bl sub_8004914 + bl ResetUnusedInputStruct adds r0, r5, 0 movs r1, 0x1 movs r2, 0x1 @@ -24401,7 +24401,7 @@ _08035E42: subs r2, 0x1 cmp r2, 0 bge _08035E42 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _08035EB8 ldr r0, [r4] movs r6, 0xA2 @@ -24449,7 +24449,7 @@ _08035EBC: .4byte gUnknown_80E59C8 thumb_func_start sub_8035EC0 sub_8035EC0: push {r4,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -24546,7 +24546,7 @@ _08035F7A: ldr r0, [r4] str r5, [r0] str r6, [sp] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x4 movs r1, 0 @@ -25085,7 +25085,7 @@ _080363FA: thumb_func_start sub_8036400 sub_8036400: push {r4,r5,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -25361,7 +25361,7 @@ _0803662C: lsls r2, 1 adds r0, r2 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -25432,7 +25432,7 @@ _080366CE: lsls r1, 1 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -25476,7 +25476,7 @@ sub_8036728: cmp r0, 0x3 bhi _08036780 bl sub_801B450 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _08036778 ldr r0, [r4] movs r1, 0xF2 @@ -26078,7 +26078,7 @@ _08036BE4: beq _08036BEE b _08036DFA _08036BEE: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -26454,7 +26454,7 @@ sub_8036ECC: stm r1!, {r2-r4} ldm r0!, {r2-r4} stm r1!, {r2-r4} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r6] adds r0, r5 movs r1, 0x1 @@ -26558,7 +26558,7 @@ sub_8036FDC: push {r7} sub sp, 0x10 adds r6, r0, 0 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -26625,7 +26625,7 @@ _08037054: cmp r2, 0 bge _08037054 movs r6, 0 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _080370C0 ldr r0, [r5] movs r4, 0xAE @@ -28907,7 +28907,7 @@ sub_80382A0: thumb_func_start sub_80382AC sub_80382AC: push {lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -28980,7 +28980,7 @@ _0803831C: subs r2, 0x1 cmp r2, 0 bge _0803831C - bl sub_8004914 + bl ResetUnusedInputStruct ldr r5, _08038398 ldr r0, [r5] movs r6, 0xA4 @@ -29035,7 +29035,7 @@ _080383A4: .4byte gUnknown_80E6EAC thumb_func_start sub_80383A8 sub_80383A8: push {r4,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -29257,7 +29257,7 @@ _08038544: subs r2, 0x1 cmp r2, 0 bge _08038544 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _0803859C ldr r0, [r4] movs r6, 0xA4 @@ -29335,7 +29335,7 @@ _08038600: .4byte gUnknown_203B364 thumb_func_start sub_8038604 sub_8038604: push {r4,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -29759,7 +29759,7 @@ _08038942: subs r2, 0x1 cmp r2, 0 bge _08038942 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r4, _080389B8 ldr r0, [r4] movs r7, 0xA4 @@ -29875,7 +29875,7 @@ _08038A58: .4byte gUnknown_203B370 thumb_func_start sub_8038A5C sub_8038A5C: push {r4,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -30174,7 +30174,7 @@ _08038CEA: bne _08038DB0 _08038CEE: bl sub_8039174 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -30230,7 +30230,7 @@ _08038D62: bne _08038DB0 _08038D66: bl sub_8039174 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -30281,7 +30281,7 @@ sub_8038DC0: lsls r1, 1 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -30491,7 +30491,7 @@ sub_8038F98: lsls r1, 1 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -30884,7 +30884,7 @@ _0803928E: subs r2, 0x1 cmp r2, 0 bge _0803928E - bl sub_8004914 + bl ResetUnusedInputStruct ldr r6, _080392EC ldr r0, [r6] movs r5, 0xA2 @@ -31037,7 +31037,7 @@ _080393EC: .4byte gUnknown_80E779C thumb_func_start sub_80393F0 sub_80393F0: push {r4,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -31608,7 +31608,7 @@ _080398A2: thumb_func_start sub_80398AC sub_80398AC: push {r4,r5,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -32080,7 +32080,7 @@ sub_8039C60: cmp r4, 0x3 bne _08039D04 bl sub_80155F0 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] movs r1, 0xF6 lsls r1, 1 @@ -32128,7 +32128,7 @@ _08039CC0: b _08039D04 _08039CE6: bl sub_80155F0 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r5] movs r2, 0xF6 lsls r2, 1 @@ -32364,7 +32364,7 @@ _08039EB8: _08039EC0: .4byte gUnknown_80E7AE0 _08039EC4: .4byte gUnknown_80E7894 _08039EC8: - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -32700,7 +32700,7 @@ _0803A168: lsls r1, 1 adds r0, r1 bl sub_8006518 - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -32782,7 +32782,7 @@ sub_803A1E8: thumb_func_start sub_803A1EC sub_803A1EC: push {lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -32831,7 +32831,7 @@ _0803A232: subs r2, 0x1 cmp r2, 0 bge _0803A232 - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0803A270 ldr r0, [r0] movs r6, 0xA0 @@ -32854,7 +32854,7 @@ _0803A274: .4byte gUnknown_80E7D40 thumb_func_start sub_803A278 sub_803A278: push {r4,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -33095,7 +33095,7 @@ _0803A458: .4byte 0x0000012b thumb_func_start sub_803A45C sub_803A45C: push {r4,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -33246,7 +33246,7 @@ _0803A564: cmp r2, 0 bge _0803A564 _0803A57E: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0803A59C ldr r0, [r0] adds r0, 0xD8 @@ -33627,7 +33627,7 @@ _0803A884: thumb_func_start sub_803A888 sub_803A888: push {r4,lr} - bl sub_8004914 + bl ResetUnusedInputStruct movs r0, 0 movs r1, 0x1 movs r2, 0x1 @@ -33762,7 +33762,7 @@ _0803A970: cmp r2, 0 bge _0803A970 _0803A98A: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0803A9A8 ldr r0, [r0] adds r0, 0x9C @@ -34262,7 +34262,7 @@ _0803AD50: cmp r2, 0x3 ble _0803AD50 _0803AD6C: - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, _0803AD84 ldr r0, [r0] adds r0, 0xE0 @@ -34659,7 +34659,7 @@ sub_803B050: ldr r1, [r0, 0x38] adds r0, 0x9C str r0, [r1, 0x14] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -34832,7 +34832,7 @@ sub_803B1BC: stm r1!, {r2,r3,r5} ldm r0!, {r2,r3,r5} stm r1!, {r2,r3,r5} - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -34870,7 +34870,7 @@ sub_803B204: ldr r0, [r4] adds r0, 0x9F strb r2, [r0] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 @@ -34901,7 +34901,7 @@ sub_803B204: adds r3, 0x2 adds r2, 0x4C strh r3, [r2] - bl sub_8004914 + bl ResetUnusedInputStruct ldr r0, [r4] adds r0, 0x3C movs r1, 0x1 diff --git a/include/file_system.h b/include/file_system.h index 45f6aacd..6d93b880 100644 --- a/include/file_system.h +++ b/include/file_system.h @@ -36,5 +36,6 @@ struct OpenedFile *OpenFile(const char *filename, const struct FileArchive *arc) u8 *GetFileDataPtr(struct OpenedFile *openedFile, int unused); struct OpenedFile *OpenFileAndGetFileDataPtr(const char *filename, const struct FileArchive *arc); struct OpenedFile *Call_OpenFileAndGetFileDataPtr(const char *filename, const struct FileArchive *arc); +void CloseFile(struct OpenedFile *openedFile); #endif //GUARD_FILE_SYSTEM_H diff --git a/include/input.h b/include/input.h index 17e2bafd..9c931286 100644 --- a/include/input.h +++ b/include/input.h @@ -1,7 +1,7 @@ #ifndef GUARD_INPUT_H #define GUARD_INPUT_H -struct UnkInputStruct1 +struct Inputs { /* 0x0 */ u16 held; /* 0x2 */ u16 pressed; @@ -12,7 +12,7 @@ struct UnkInputStruct1 /* 0xC */ s32 repeatTimerDpad; }; -struct UnkInputStruct2 +struct InputTimers { /* 0x0 */ s16 holdTimerB; /* 0x2 */ s16 holdTimerR; @@ -20,7 +20,7 @@ struct UnkInputStruct2 /* 0x6 */ u16 unk6; }; -struct Input +struct UnusedInputStruct { /* 0x0 */ u16 unk0; /* 0x2 */ u16 unk2; @@ -34,7 +34,7 @@ struct Input /* 0x12 */ u16 unk12; /* 0x14 */ u16 unk14; /* 0x16 */ u16 unk16; - /* 0x16 */ u16 unk18; + /* 0x18 */ u16 unk18; /* 0x1A */ u16 unk1A; /* 0x1C */ u16 unk1C; /* 0x1E */ u16 unk1E; @@ -43,8 +43,7 @@ struct Input /* 0x24 */ u16 unk26; /* 0x28 */ u8 unk28; /* 0x29 */ u8 unk29; - /* 0x2A */ u8 unk2A; - /* 0x2B */ u8 padding; + /* 0x2A..0x2B - padding */ }; void InitInput(void); @@ -57,7 +56,7 @@ u8 sub_80048C8(void); u8 sub_80048CC(void); void ResetRepeatTimers(void); void UnpressButtons(void); -void sub_8004914(void); +void ResetUnusedInputStruct(void); void UpdateInput(void); #endif // GUARD_INPUT_H diff --git a/include/text.h b/include/text.h index d23ccf75..b7868121 100644 --- a/include/text.h +++ b/include/text.h @@ -18,7 +18,7 @@ struct UnkTextStruct2 { u8 fill12[0x06]; }; -void sub_8006218(void); +void LoadCharmaps(void); u32 xxx_update_some_bg_tiles(u32 a0); void sub_8006438(const struct UnkTextStruct2 *a0, u8 a1, u8 a2, u32 *a3); void sub_8006554(void *a0, void *a1, void *a2, void *a3, u32 a4, const struct UnkTextStruct2 *a5, u8 a6, u32 a7, u32 *a8, u32 a9); diff --git a/ld_script.txt b/ld_script.txt index c53b23cf..e1dcd0e8 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -42,6 +42,7 @@ SECTIONS { asm/crt0.o(.text); src/code_80001DC.o(.text); asm/arm_func.o(.text); + src/code_2.o(.text); asm/code_2.o(.text); src/code.o(.text); asm/event_flag.o(.text); diff --git a/src/code_2.c b/src/code_2.c new file mode 100644 index 00000000..d53ab29c --- /dev/null +++ b/src/code_2.c @@ -0,0 +1,195 @@ +#include "global.h" +#include "file_system.h" +#include "input.h" + +extern void InitHeap(void); +extern void NDS_DebugInit(void); +extern void sub_801180C(void); +extern void NDS_LoadOverlay_GroundMain(void); +extern void sub_8014144(void); +extern void LoadMonsterParameters(void); +extern void sub_8097670(void); +extern void sub_8094F88(void); +extern void sub_8094980(void); +extern void sub_8094C14(void); +extern void sub_8097F5C(void); +extern void sub_80923A0(void); +extern void sub_8090998(void); +extern void sub_809207C(void); +extern void LoadWazaParameters(void); +extern void sub_80950BC(void); +extern void sub_80958E8(void); +extern void sub_800CD64(u32, u32); +extern void sub_8012284(void); +extern void sub_8094998(u32); +extern void SetWindowTitle(char *); +extern void sub_800DAAC(void); +extern void SetSavingIconCoords(u32); +extern u32 sub_8011DAC(u32 *); +extern void sub_800135C(void); +extern void xxx_script_related_8001334(u32); +extern void sub_80015C0(u32, u32); +extern u32 sub_8001658(u32, u32); +extern void sub_800A8F8(u32); +extern void ResetSprites(u32); +extern void xxx_update_some_bg_tiles(u32); +extern void sub_80097B0(void); +extern void sub_800CDA8(u32); +extern void sub_800641C(u32, u32, u32); +extern void LoadTitleScreen(void); +extern void sub_800CCA0(u32, u32); +extern void sub_800CCAC(u32, u32); +extern void SetBGPaletteBufferColorRGB(s32, u8 *, s32, u8 *); +extern void xxx_update_stuff(u32); +extern void sub_800BDFC(u32); +extern void sub_80095CC(u32, u32); +extern void InitMainMenu(void); + +extern void sub_8012468(void); +extern u32 sub_8012484(void); +extern void sub_8012558(void); +extern u8 sub_80363E0(void); +extern void SetBGOBJEnableFlags(u32); +extern void SetUpMenu(void); +extern u32 UpdateMenu(void); +extern void CleanUpMenu(void); +extern void sub_80357D0(void); +extern s32 sub_80953D4(u32); +extern void sub_8095240(u8); +extern void sub_80122A8(void); +extern void nullsub_33(void); +extern u32 sub_80009D0(u32); + +extern u32 gUnknown_203B03C; +extern u16 gUnknown_2026E4E; +extern s32 gUnknown_2000A80; +extern struct OpenedFile *gTitlePaletteFile; +extern struct Inputs gRealInputs; + +extern char gUnknown_80B69BC[]; + +void GameLoop(void) +{ + u32 tmp; + u8 tmp3 = 1; + u32 tmp4; + u32 flag; + + InitHeap(); + NDS_DebugInit(); + sub_801180C(); + NDS_LoadOverlay_GroundMain(); + sub_8014144(); + LoadMonsterParameters(); + sub_8097670(); + sub_8094F88(); + sub_8094980(); + sub_8094C14(); + sub_8097F5C(); + sub_80923A0(); + sub_8090998(); + sub_809207C(); + LoadWazaParameters(); + sub_80950BC(); + sub_80958E8(); + sub_800CD64(0x8000, 0); + sub_8012284(); + sub_8094998(1); + SetWindowTitle(gUnknown_80B69BC); + sub_800DAAC(); + SetSavingIconCoords(0); + tmp = 0; + if (sub_8011DAC(&tmp)) + sub_800135C(); + xxx_script_related_8001334(14); + xxx_script_related_8001334(15); + sub_80015C0(0, 57); + xxx_script_related_8001334(16); + if (sub_8001658(0, 57) == 0) + xxx_script_related_8001334(17); + + while (1) { + gUnknown_203B03C = 0; // ??? + sub_800A8F8(2); + ResetSprites(1); + xxx_update_some_bg_tiles(0); + sub_80097B0(); + sub_800CDA8(2); + sub_800641C(0, 1, 1); + gUnknown_2026E4E = 0x1000; + LoadTitleScreen(); + sub_800CCA0(0, 0); + sub_800CCAC(0, 0); + gUnknown_2000A80 = 0; + while (gUnknown_2000A80 < 32) { + s32 i; + gUnknown_2000A80++; + for (i = 0; i < 240; i++) + SetBGPaletteBufferColorRGB(i, &gTitlePaletteFile->data[i * 4], gUnknown_2000A80, 0); + xxx_update_stuff(0); + } + if (tmp3) { + sub_8012468(); + while ((u8)(tmp3 = sub_8012484())) + xxx_update_stuff(0); + sub_8012558(); + } + tmp3 = 1; + sub_800BDFC(8); + flag = TRUE; + sub_80095CC(0, 20); + InitMainMenu(); + while (1) { + if ((u8)sub_80363E0()) { + if (gRealInputs.pressed & L_BUTTON) { + flag = FALSE; + SetBGOBJEnableFlags(19); + } else if (!flag && (gRealInputs.held & L_BUTTON) == 0) { + flag = TRUE; + SetBGOBJEnableFlags(0); + } + if (!flag) { + xxx_update_stuff(0); + continue; + } + } + SetUpMenu(); + xxx_update_stuff(0); + tmp4 = UpdateMenu(); + CleanUpMenu(); + if (tmp4 == 2) break; + if (tmp4 == 4) break; + if (tmp4 == 3) break; + } + sub_80357D0(); + while (gUnknown_2000A80 > 0) { + s32 i; + gUnknown_2000A80--; + for (i = 0; i < 240; i++) + SetBGPaletteBufferColorRGB(i, &gTitlePaletteFile->data[i * 4], gUnknown_2000A80, 0); + xxx_update_stuff(0); + } + CloseFile(gTitlePaletteFile); + switch (tmp4) { + case 2: { + s32 tmp5 = sub_80953D4(7); + if (tmp5 != -1) { + sub_8095240(tmp5); + tmp3 = sub_80009D0(2); + } else { + tmp3 = sub_80009D0(1); + } + break; + } + case 4: + tmp3 = sub_80009D0(3); + break; + case 3: + sub_80122A8(); + nullsub_33(); + tmp3 = sub_80009D0(0); + break; + } + + } +} diff --git a/src/code_800C9CC.c b/src/code_800C9CC.c index 593728e8..ddc49c67 100644 --- a/src/code_800C9CC.c +++ b/src/code_800C9CC.c @@ -19,7 +19,7 @@ extern struct unkStruct_809CC88 gUnknown_202D6A0; extern struct unkStruct_809CC88 gUnknown_202D6A8; extern struct unkStruct_809CC88 gUnknown_202D6B0; -void ReadKeyInput(struct UnkInputStruct1 *r0) +void ReadKeyInput(struct Inputs *r0) { u16 keyInput = REG_KEYINPUT ^ KEYS_MASK; r0->held = 0; diff --git a/src/input.c b/src/input.c index 59511030..e13bb7db 100644 --- a/src/input.c +++ b/src/input.c @@ -1,15 +1,15 @@ #include "global.h" #include "input.h" -EWRAM_DATA struct Input gUnknown_2025600; -EWRAM_DATA struct UnkInputStruct1 gRealInputs; -EWRAM_DATA struct UnkInputStruct1 gBufferedInputs; -EWRAM_DATA struct UnkInputStruct1 gCurrentInputs; -EWRAM_DATA struct UnkInputStruct1 gLastInputs; -EWRAM_DATA struct UnkInputStruct2 gUnknown_2025668; +EWRAM_DATA struct UnusedInputStruct gUnusedInputsRelated; +EWRAM_DATA struct Inputs gRealInputs; +EWRAM_DATA struct Inputs gBufferedInputs; +EWRAM_DATA struct Inputs gCurrentInputs; +EWRAM_DATA struct Inputs gLastInputs; +EWRAM_DATA struct InputTimers gInputTimers; EWRAM_DATA u32 gUnusedScrambledInputJunk; -void ReadKeyInput(struct UnkInputStruct1 *r0); +void ReadKeyInput(struct Inputs *r0); void InitInput(void) { @@ -25,26 +25,26 @@ void InitInput(void) gUnusedScrambledInputJunk = 0x4a14c1; // seems like random keyboard mashing (see UpdateInput) - gUnknown_2025600.unk20 = 0; - gUnknown_2025600.unk0 = 0xffff; // probably a mask - gUnknown_2025600.unk2 = -1; - gUnknown_2025600.unk4 = -1; - gUnknown_2025600.unk6 = -1; - gUnknown_2025600.unk1C = -1; - gUnknown_2025600.unk1E = -1; - gUnknown_2025600.unk8 = -1; - gUnknown_2025600.unkA = -1; - gUnknown_2025600.unkC = -1; - gUnknown_2025600.unkE = -1; - gUnknown_2025600.unk10 = -1; - gUnknown_2025600.unk12 = -1; - gUnknown_2025600.unk14 = -1; - gUnknown_2025600.unk16 = -1; - gUnknown_2025600.unk28 = 0; - gUnknown_2025600.unk29 = 0; + gUnusedInputsRelated.unk20 = 0; + gUnusedInputsRelated.unk0 = 0xffff; // probably a mask + gUnusedInputsRelated.unk2 = -1; + gUnusedInputsRelated.unk4 = -1; + gUnusedInputsRelated.unk6 = -1; + gUnusedInputsRelated.unk1C = -1; + gUnusedInputsRelated.unk1E = -1; + gUnusedInputsRelated.unk8 = -1; + gUnusedInputsRelated.unkA = -1; + gUnusedInputsRelated.unkC = -1; + gUnusedInputsRelated.unkE = -1; + gUnusedInputsRelated.unk10 = -1; + gUnusedInputsRelated.unk12 = -1; + gUnusedInputsRelated.unk14 = -1; + gUnusedInputsRelated.unk16 = -1; + gUnusedInputsRelated.unk28 = 0; + gUnusedInputsRelated.unk29 = 0; - gUnknown_2025668.holdTimerB = 0; - gUnknown_2025668.holdTimerR = 0; + gInputTimers.holdTimerB = 0; + gInputTimers.holdTimerR = 0; } void LoadBufferedInputs(void) @@ -56,21 +56,21 @@ void LoadBufferedInputs(void) gBufferedInputs.repeated = 0; gBufferedInputs.shortPress = 0; - gUnknown_2025600.unk0 = 0xffff; - gUnknown_2025600.unk2 = -1; - gUnknown_2025600.unk4 = -1; - gUnknown_2025600.unk6 = -1; - gUnknown_2025600.unk8 = -1; - gUnknown_2025600.unkA = -1; - gUnknown_2025600.unkC = -1; - gUnknown_2025600.unkE = -1; - gUnknown_2025600.unk10 = -1; - gUnknown_2025600.unk12 = -1; - gUnknown_2025600.unk14 = -1; - gUnknown_2025600.unk16 = -1; + gUnusedInputsRelated.unk0 = 0xffff; + gUnusedInputsRelated.unk2 = -1; + gUnusedInputsRelated.unk4 = -1; + gUnusedInputsRelated.unk6 = -1; + gUnusedInputsRelated.unk8 = -1; + gUnusedInputsRelated.unkA = -1; + gUnusedInputsRelated.unkC = -1; + gUnusedInputsRelated.unkE = -1; + gUnusedInputsRelated.unk10 = -1; + gUnusedInputsRelated.unk12 = -1; + gUnusedInputsRelated.unk14 = -1; + gUnusedInputsRelated.unk16 = -1; - gUnknown_2025600.unk28 = 0; - gUnknown_2025600.unk29 = 0; + gUnusedInputsRelated.unk28 = 0; + gUnusedInputsRelated.unk29 = 0; } // Unused @@ -112,8 +112,8 @@ void ResetRepeatTimers(void) gRealInputs.repeated = 0; gCurrentInputs.repeatTimerDpad = 0; gCurrentInputs.heldDpad = 0; - gUnknown_2025668.holdTimerB = 999; - gUnknown_2025668.holdTimerR = 999; + gInputTimers.holdTimerB = 999; + gInputTimers.holdTimerR = 999; } @@ -124,25 +124,25 @@ void UnpressButtons(void) gCurrentInputs.pressed = 0; } -void sub_8004914(void) +void ResetUnusedInputStruct(void) { - gUnknown_2025600.unk20 = 0x5; - gUnknown_2025600.unk24 = 0; - gUnknown_2025600.unk0 = 0xffff; - gUnknown_2025600.unk2 = -1; - gUnknown_2025600.unk4 = -1; - gUnknown_2025600.unk6 = -1; - gUnknown_2025600.unk8 = -1; - gUnknown_2025600.unkA = -1; - gUnknown_2025600.unkC = -1; - gUnknown_2025600.unkE = -1; - gUnknown_2025600.unk10 = -1; - gUnknown_2025600.unk12 = -1; - gUnknown_2025600.unk14 = -1; - gUnknown_2025600.unk16 = -1; + gUnusedInputsRelated.unk20 = 0x5; + gUnusedInputsRelated.unk24 = 0; + gUnusedInputsRelated.unk0 = 0xffff; + gUnusedInputsRelated.unk2 = -1; + gUnusedInputsRelated.unk4 = -1; + gUnusedInputsRelated.unk6 = -1; + gUnusedInputsRelated.unk8 = -1; + gUnusedInputsRelated.unkA = -1; + gUnusedInputsRelated.unkC = -1; + gUnusedInputsRelated.unkE = -1; + gUnusedInputsRelated.unk10 = -1; + gUnusedInputsRelated.unk12 = -1; + gUnusedInputsRelated.unk14 = -1; + gUnusedInputsRelated.unk16 = -1; - gUnknown_2025600.unk28 = 0; - gUnknown_2025600.unk29 = 0; + gUnusedInputsRelated.unk28 = 0; + gUnusedInputsRelated.unk29 = 0; } @@ -155,12 +155,11 @@ void UpdateInput(void) gCurrentInputs.pressed = (gLastInputs.held ^ gCurrentInputs.held) & gCurrentInputs.held; if (gCurrentInputs.held) { - // 0xF0 -- DPAD buttons - if ((gCurrentInputs.heldDpad & 0xf0) == (gCurrentInputs.held & 0xf0)) { + if ((gCurrentInputs.heldDpad & DPAD_ANY) == (gCurrentInputs.held & DPAD_ANY)) { if (gCurrentInputs.repeatTimerDpad < 50) gCurrentInputs.repeatTimerDpad++; } else { - gCurrentInputs.heldDpad = gCurrentInputs.held & 0xf0; + gCurrentInputs.heldDpad = gCurrentInputs.held & DPAD_ANY; gCurrentInputs.repeatTimerDpad = 1; } } else { @@ -169,33 +168,33 @@ void UpdateInput(void) } if (gCurrentInputs.repeatTimerDpad == 1) { - gCurrentInputs.repeated = (gCurrentInputs.heldDpad & 0xf0) | gCurrentInputs.pressed; + gCurrentInputs.repeated = (gCurrentInputs.heldDpad & DPAD_ANY) | gCurrentInputs.pressed; } else if (gCurrentInputs.repeatTimerDpad == 48) { gCurrentInputs.repeatTimerDpad = 43; - gCurrentInputs.repeated = (gCurrentInputs.heldDpad & 0xf0) | gCurrentInputs.pressed; + gCurrentInputs.repeated = (gCurrentInputs.heldDpad & DPAD_ANY) | gCurrentInputs.pressed; } else { gCurrentInputs.repeated = 0; } gCurrentInputs.shortPress = 0; if (gCurrentInputs.held & B_BUTTON) { - if (gUnknown_2025668.holdTimerB < 100) - gUnknown_2025668.holdTimerB++; - } else if (1 < gUnknown_2025668.holdTimerB && gUnknown_2025668.holdTimerB < 12) { + if (gInputTimers.holdTimerB < 100) + gInputTimers.holdTimerB++; + } else if (1 < gInputTimers.holdTimerB && gInputTimers.holdTimerB < 12) { gCurrentInputs.shortPress = B_BUTTON; - gUnknown_2025668.holdTimerB = 0; + gInputTimers.holdTimerB = 0; } else { - gUnknown_2025668.holdTimerB = 0; + gInputTimers.holdTimerB = 0; } if (gCurrentInputs.held & R_BUTTON) { - if (gUnknown_2025668.holdTimerR < 100) - gUnknown_2025668.holdTimerR++; - } else if (1 < gUnknown_2025668.holdTimerR && gUnknown_2025668.holdTimerR < 12) { + if (gInputTimers.holdTimerR < 100) + gInputTimers.holdTimerR++; + } else if (1 < gInputTimers.holdTimerR && gInputTimers.holdTimerR < 12) { gCurrentInputs.shortPress |= R_BUTTON; - gUnknown_2025668.holdTimerR = 0; + gInputTimers.holdTimerR = 0; } else { - gUnknown_2025668.holdTimerR = 0; + gInputTimers.holdTimerR = 0; } gBufferedInputs.held |= gCurrentInputs.held; diff --git a/src/main.c b/src/main.c index 7dcfc4a4..687ef6d6 100644 --- a/src/main.c +++ b/src/main.c @@ -10,7 +10,7 @@ extern u8 gUnknown_202D7FE; extern char alt_203B038[]; -extern char gUnknown_203B038[]; +extern char gTitlePaletteFile[]; extern char gUnknown_203BC04[]; extern char iwram_start[]; @@ -36,7 +36,7 @@ extern void InitBGPaletteBuffer(void); extern void sub_80057E8(void); extern void InitFileSystem(void); extern void sub_80098A0(void); -extern void sub_80096E0(void); +extern void InitGraphics(void); extern void sub_800B6F4(int, void *); extern void GameLoop(void); extern void Hang(void); @@ -54,8 +54,8 @@ void AgbMain(void) DmaStop(2); DmaStop(3); - if (gUnknown_203BC04 - gUnknown_203B038 > 0) - CpuCopy32(gUnknown_8270000, gUnknown_203B038, gUnknown_203BC04 - gUnknown_203B038); + if (gUnknown_203BC04 - gTitlePaletteFile > 0) + CpuCopy32(gUnknown_8270000, gTitlePaletteFile, gUnknown_203BC04 - gTitlePaletteFile); if (alt_203B038 - ewram_start > 0) { @@ -98,9 +98,9 @@ void AgbMain(void) InitBGPaletteBuffer(); sub_80057E8(); InitFileSystem(); - sub_8006218(); + LoadCharmaps(); sub_80098A0(); - sub_80096E0(); + InitGraphics(); sub_800B6F4(1, sub_800CE54); REG_DISPCNT = 32576; GameLoop(); diff --git a/src/pokemon.c b/src/pokemon.c index 454751e0..11dc1897 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -7,7 +7,7 @@ extern u32 gUnknown_202F400; extern struct FileArchive gUnknown_8300500; extern const char gUnknown_81075F4; extern struct OpenedFile *gMonsterParametersFile; -extern u16 gUnknown_20384E8; +extern u16 gLevelCurrentPokeId; extern struct gPokemon gMonsterParameters; extern u64 gUnknown_8107544[]; @@ -32,7 +32,7 @@ void LoadMonsterParameters(void) gMonsterParametersFile = OpenFileAndGetFileDataPtr(&gUnknown_81075F4, &gUnknown_8300500); // TODO verify this... other parts imply this is an array gMonsterParameters.species = gMonsterParametersFile->data; - gUnknown_20384E8 = 0; + gLevelCurrentPokeId = 0; } u32 *sub_808CE00(void) diff --git a/src/text.c b/src/text.c index 9de996a1..65275efa 100644 --- a/src/text.c +++ b/src/text.c @@ -23,13 +23,13 @@ struct UnkTextStruct2 { extern char gUnknown_3000E94[]; EWRAM_DATA struct UnkTextStruct1 gUnknown_2027370[4]; -EWRAM_DATA u8 *gKanji[2]; -EWRAM_DATA u16 gUnknown_2027498; +EWRAM_DATA u8 *gCharmaps[2]; +EWRAM_DATA u16 gCharacterSpacing; EWRAM_DATA u8 gUnknown_20274A5; -EWRAM_DATA u32 gUnknown_20274AC; +EWRAM_DATA u32 gCurrentCharmap; EWRAM_DATA vu32 gUnknown_20274B0; EWRAM_DATA u8 gUnknown_20274B4[0x3b00]; -EWRAM_DATA struct OpenedFile *gKanjiFiles[2]; +EWRAM_DATA struct OpenedFile *gCharmapFiles[2]; EWRAM_DATA struct UnkTextStruct2 gUnknown_202AFC0[4]; EWRAM_DATA u32 gUnknown_202B020; EWRAM_DATA u32 gUnknown_202B024; @@ -53,17 +53,17 @@ extern const u32 gUnknown_80B87C4[8]; extern const u32 gUnknown_80B87E4[8]; extern const u32 gUnknown_80B8804[4]; -void sub_8006218(void) +void LoadCharmaps(void) { int i; int j; int k; - gUnknown_20274AC = 0; - gKanjiFiles[0] = OpenFileAndGetFileDataPtr(gUnknown_80B87B4, &gUnknown_8300500); - gKanjiFiles[1] = OpenFileAndGetFileDataPtr(gUnknown_80B87BC, &gUnknown_8300500); - gKanji[0] = gKanjiFiles[0]->data; - gKanji[1] = gKanjiFiles[1]->data; + gCurrentCharmap = 0; + gCharmapFiles[0] = OpenFileAndGetFileDataPtr(gUnknown_80B87B4, &gUnknown_8300500); + gCharmapFiles[1] = OpenFileAndGetFileDataPtr(gUnknown_80B87BC, &gUnknown_8300500); + gCharmaps[0] = gCharmapFiles[0]->data; + gCharmaps[1] = gCharmapFiles[1]->data; gUnknown_202B028[0] = 11; gUnknown_202B028[1] = 12; for (k = 0; k < 4; k++) @@ -72,7 +72,7 @@ void sub_8006218(void) gUnknown_2027370[k].unk08 = 0; gUnknown_2027370[k].unk46 = 0; } - gUnknown_2027498 = 0; + gCharacterSpacing = 0; for (i = 0; i < 20; i++) { gUnknown_202B038[0][i][0] = 0xf279; @@ -132,9 +132,9 @@ u8 sub_80063BC(u8 a0) return retval; } -void sub_80063CC(u32 a0) +void SelectCharmap(u32 a0) { - gUnknown_20274AC = a0; + gCurrentCharmap = a0; } void sub_80063D8(int a0) diff --git a/src/wonder_mail.c b/src/wonder_mail.c index c3fa39b2..07c4ff96 100644 --- a/src/wonder_mail.c +++ b/src/wonder_mail.c @@ -90,7 +90,7 @@ extern void sub_80141B4(u32 *r0, u32, u32 *r1, u32); extern void nullsub_130(void); extern void sub_8028348(void); extern void sub_800641C(void *r0, u8, u8); -extern void sub_8004914(); +extern void ResetUnusedInputStruct(); extern void sub_803084C(); extern u32 sub_8030768(u32); extern u8 sub_80307EC(); @@ -587,7 +587,7 @@ void sub_8029044(void) gUnknown_203B2C0->unk0 = 0x1F; gUnknown_203B2C0->unk218 = sub_80307EC(); sub_8006518(&(gUnknown_203B2C0->unk3BC)); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(0, 1, 1); sub_8030D40(gUnknown_203B2C0->unk218, 0); sub_8028B04(33); @@ -623,7 +623,7 @@ void sub_80290F0(void) case 12: gUnknown_203B2C0->unk0 = 0x3D; sub_8006518(&(gUnknown_203B2C0->unk3BC)); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(0, 1, 1); sub_8030D40(gUnknown_203B2C0->unk218, 0); sub_8028B04(33); @@ -646,7 +646,7 @@ void sub_80291AC(void) case 2: case 3: sub_8030DE4(); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(&(gUnknown_203B2C0->unk3BC), 1, 1); sub_803092C(); if(gUnknown_203B2C0->unk0 == 0x3D) @@ -892,7 +892,7 @@ void sub_80293F4(void) break; case 2: sub_80155F0(); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(&(gUnknown_203B2C0->unk3BC), 1, 1); sub_8028B04(1); break; @@ -1032,7 +1032,7 @@ void sub_80293F4(void) "_0802952C: .4byte 0x00000101\n" "_08029530:\n" "\tbl sub_80155F0\n" - "\tbl sub_8004914\n" + "\tbl ResetUnusedInputStruct\n" "\tldr r0, _08029558\n" "\tldr r0, [r0]\n" "\tmovs r2, 0xEF\n" @@ -1117,7 +1117,7 @@ void sub_80295D8(void) gUnknown_203B2C0->unk0 = 0x2A; gUnknown_203B2C0->unk218 = sub_80307EC(); sub_8006518(&(gUnknown_203B2C0->unk3BC)); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(0, 1, 1); sub_8030D40(gUnknown_203B2C0->unk218, 0); sub_8028B04(0x2C); @@ -1153,7 +1153,7 @@ void sub_8029684(void) case 0xC: gUnknown_203B2C0->unk0 = 0x3D; sub_8006518(&(gUnknown_203B2C0->unk3BC)); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(0, 1, 1); sub_8030D40(gUnknown_203B2C0->unk218, 0); sub_8028B04(0x2C); @@ -1174,7 +1174,7 @@ void sub_8029740(void) case 2: case 3: sub_8030DE4(); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(&(gUnknown_203B2C0->unk3BC), 1, 1); sub_803092C(); if(gUnknown_203B2C0->unk0 == 0x3D) @@ -1227,7 +1227,7 @@ void sub_80297D4(void) gUnknown_203B2C0->unk0 = 0x33; gUnknown_203B2C0->unk544 = sub_8023B44(); sub_8006518(&(gUnknown_203B2C0->unk3BC)); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(0, 1, 1); sub_8024458(gUnknown_203B2C0->unk544, 0); sub_8028B04(0x35); @@ -1253,7 +1253,7 @@ void sub_8029884(void) case 0xC: gUnknown_203B2C0->unk0 = 0x3D; sub_8006518(&(gUnknown_203B2C0->unk3BC)); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(0, 1, 1); sub_8024458(gUnknown_203B2C0->unk544, 0); sub_8028B04(0x35); @@ -1283,7 +1283,7 @@ void sub_8029944(void) case 2: case 3: sub_802453C(); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(&(gUnknown_203B2C0->unk3BC), 1, 1); sub_8023B7C(1); if(gUnknown_203B2C0->unk0 == 0x3D) @@ -1423,7 +1423,7 @@ void sub_8029AF4(void) case 2: case 3: sub_8031E10(); - sub_8004914(); + ResetUnusedInputStruct(); sub_800641C(&(gUnknown_203B2C0->unk3BC), 1, 1); sub_8028B04(0x3C); break; diff --git a/sym_ewram.txt b/sym_ewram.txt index a6aea259..112158b1 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -40,7 +40,7 @@ gBGPaletteBuffer = .; /* 20251F0 */ gRealInputs = .; /* 20255F0 */ . += 0x10; -gUnknown_2025600 = .; /* 2025600 */ +gUnusedInputsRelated = .; /* 2025600 */ . += 0x2C; gUnusedScrambledInputJunk = .; /* 202562C */ @@ -55,7 +55,7 @@ gCurrentInputs = .; /* 2025648 */ gLastInputs = .; /* 2025658 */ . += 0x10; -gUnknown_2025668 = .; /* 2025668 */ +gInputTimers = .; /* 2025668 */ . += 0x8; gUnknown_2025670 = .; /* 2025670 */ @@ -133,10 +133,10 @@ gUnknown_2027370 = .; /* 2027370 */ gUnknown_20273B8 = .; /* 20273B8 */ . += 0xD8; -gKanji = .; /* 2027490 */ +gCharmaps = .; /* 2027490 */ . += 0x8; -gUnknown_2027498 = .; /* 2027498 */ +gCharacterSpacing = .; /* 2027498 */ . += 0x2; gUnknown_202749A = .; /* 202749A */ @@ -148,7 +148,7 @@ gUnknown_20274A5 = .; /* 20274A5 */ gUnknown_20274A6 = .; /* 20274A6 */ . += 0x6; -gUnknown_20274AC = .; /* 20274AC */ +gCurrentCharmap = .; /* 20274AC */ . += 0x4; gUnknown_20274B0 = .; /* 20274B0 */ @@ -157,7 +157,7 @@ gUnknown_20274B0 = .; /* 20274B0 */ gUnknown_20274B4 = .; /* 20274B4 */ . += 0x3B00; -gKanjiFiles = .; /* 202AFB4 */ +gCharmapFiles = .; /* 202AFB4 */ . += 0x8; gUnknown_202AFBC = .; /* 202AFBC */ @@ -863,10 +863,10 @@ gUnknown_202F3E8 = .; /* 202F3E8 */ gUnknown_202F400 = .; /* 202F400 */ . += 0x90E8; -gUnknown_20384E8 = .; /* 20384E8 */ +gLevelCurrentPokeId = .; /* 20384E8 */ . += 0x8; -gUnknown_20384F0 = .; /* 20384F0 */ +gLevelCurrentData = .; /* 20384F0 */ . += 0x4B0; gItemParametersFile = .; /* 20389A0 */ @@ -884,10 +884,10 @@ gBoughtFriendAreas = .; /* 2038C28 (one byte for each friend area) */ gWazaParametersFile = .; /* 2038C64 */ . += 0x4; -gUnknown_2038C68 = .; /* 2038C68 */ +gMovesData = .; /* 2038C68 */ . += 0x4; -gUnknown_2038C6C = .; /* 2038C6C */ +gMovesRelated_2038C6C = .; /* 2038C6C */ . += 0x4; gUnknown_2038C70 = .; /* 2038C70 */ diff --git a/sym_ewram2.txt b/sym_ewram2.txt index 6496bca2..e6466338 100644 --- a/sym_ewram2.txt +++ b/sym_ewram2.txt @@ -47,7 +47,7 @@ errno = .; /* 203B034 */ alt_203B038 = .; -gUnknown_203B038 = .; /* 203B038 */ +gTitlePaletteFile = .; /* 203B038 */ . += 0x4; gUnknown_203B03C = .; /* 203B03C */