From 6cd590f4fd974d61421851d5d14a88e4eb910d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20L=C3=B8vig?= Date: Wed, 28 Mar 2018 00:33:08 +0200 Subject: [PATCH] Decompiled start_menu.s --- asm/script_menu.s | 2 +- asm/start_menu.s | 2101 --------------------------------------- include/event_scripts.h | 2 + include/item_menu.h | 2 + include/link.h | 1 + include/load_save.h | 2 + include/menu.h | 14 +- include/start_menu.h | 2 + include/text.h | 6 + ld_script.txt | 1 - src/menu.c | 98 +- src/start_menu.c | 1160 ++++++++++++++++++++- sym_common.txt | 2 +- 13 files changed, 1202 insertions(+), 2191 deletions(-) delete mode 100644 asm/start_menu.s diff --git a/asm/script_menu.s b/asm/script_menu.s index 7317317a3..0624dba83 100644 --- a/asm/script_menu.s +++ b/asm/script_menu.s @@ -836,7 +836,7 @@ _080E24C6: adds r1, r4, 0 adds r2, r7, 0 movs r3, 0x11 - bl sub_819A024 + bl PrintPlayerNameOnWindow adds r0, r6, 0 mov r1, r8 movs r2, 0 diff --git a/asm/start_menu.s b/asm/start_menu.s deleted file mode 100644 index 275d2124e..000000000 --- a/asm/start_menu.s +++ /dev/null @@ -1,2101 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start PrintStartMenuActions -PrintStartMenuActions: @ 809F7C0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - mov r8, r0 - adds r6, r1, 0 - ldrb r2, [r0] - ldr r0, =sStartMenuItems - mov r9, r0 - ldr r1, =gStringVar4 - mov r10, r1 -_0809F7DA: - ldr r0, =sCurrentStartMenuActions - lsls r2, 24 - asrs r4, r2, 24 - adds r5, r4, r0 - ldrb r0, [r5] - lsls r3, r0, 3 - mov r0, r9 - adds r0, 0x4 - adds r0, r3, r0 - ldr r1, [r0] - ldr r0, =StartMenu_PlayerName - adds r7, r2, 0 - cmp r1, r0 - bne _0809F828 - bl GetStartMenuWindowId - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r5] - lsls r1, 3 - add r1, r9 - ldr r1, [r1] - lsls r3, r4, 4 - adds r3, 0x9 - lsls r3, 16 - lsrs r3, 16 - movs r2, 0x8 - bl sub_819A024 - b _0809F858 - .pool -_0809F828: - mov r1, r9 - adds r0, r3, r1 - ldr r1, [r0] - mov r0, r10 - bl StringExpandPlaceholders - bl GetStartMenuWindowId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r4, 4 - adds r1, 0x9 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - mov r2, r10 - movs r3, 0x8 - bl PrintTextOnWindow -_0809F858: - movs r0, 0x80 - lsls r0, 17 - adds r1, r7, r0 - lsrs r2, r1, 24 - asrs r1, 24 - ldr r0, =sNumStartMenuActions - ldrb r0, [r0] - cmp r1, r0 - bge _0809F87C - subs r6, 0x1 - cmp r6, 0 - bne _0809F7DA - mov r1, r8 - strb r2, [r1] - movs r0, 0 - b _0809F882 - .pool -_0809F87C: - mov r0, r8 - strb r2, [r0] - movs r0, 0x1 -_0809F882: - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end PrintStartMenuActions - - thumb_func_start sub_809F894 -sub_809F894: @ 809F894 - push {r4,lr} - sub sp, 0xC - ldr r0, =gUnknown_02037619 - movs r1, 0 - ldrsb r1, [r0, r1] - adds r2, r0, 0 - cmp r1, 0x5 - bhi _0809F98C - lsls r0, r1, 2 - ldr r1, =_0809F8B8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0809F8B8: - .4byte _0809F8D0 - .4byte _0809F8D8 - .4byte _0809F8E4 - .4byte _0809F90C - .4byte _0809F930 - .4byte _0809F94C -_0809F8D0: - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - b _0809F98C -_0809F8D8: - bl BuildStartMenuActions - ldr r1, =gUnknown_02037619 - b _0809F940 - .pool -_0809F8E4: - bl sub_81973A4 - ldr r0, =sNumStartMenuActions - ldrb r0, [r0] - bl sub_81979C4 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldr r1, =gUnknown_02037619 - movs r0, 0 - strb r0, [r1, 0x1] - b _0809F940 - .pool -_0809F90C: - bl GetSafariZoneFlag - cmp r0, 0 - beq _0809F918 - bl DisplaySafariBallsWindow -_0809F918: - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - beq _0809F926 - bl DisplayPyramidFloorWindow -_0809F926: - ldr r1, =gUnknown_02037619 - b _0809F940 - .pool -_0809F930: - ldr r4, =gUnknown_02037619+1 - adds r0, r4, 0 - movs r1, 0x2 - bl PrintStartMenuActions - cmp r0, 0 - beq _0809F98C - subs r1, r4, 0x1 -_0809F940: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0809F98C - .pool -_0809F94C: - bl GetStartMenuWindowId - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x10 - str r1, [sp] - ldr r1, =sNumStartMenuActions - ldrb r1, [r1] - str r1, [sp, 0x4] - ldr r4, =sStartMenuCursorPos - ldrb r1, [r4] - str r1, [sp, 0x8] - movs r1, 0x1 - movs r2, 0 - movs r3, 0x9 - bl sub_81983AC - strb r0, [r4] - bl GetStartMenuWindowId - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl CopyWindowToVram - movs r0, 0x1 - b _0809F98E - .pool -_0809F98C: - movs r0, 0 -_0809F98E: - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_809F894 - - thumb_func_start sub_809F998 -sub_809F998: @ 809F998 - push {lr} - ldr r1, =gUnknown_02037619 - movs r0, 0 - strb r0, [r1] - strb r0, [r1, 0x1] -_0809F9A2: - bl sub_809F894 - cmp r0, 0 - beq _0809F9A2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_809F998 - - thumb_func_start task50_startmenu -task50_startmenu: @ 809F9B4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_809F894 - cmp r0, 0x1 - bne _0809F9C8 - adds r0, r4, 0 - bl SwitchTaskToFollowupFunc -_0809F9C8: - pop {r4} - pop {r0} - bx r0 - thumb_func_end task50_startmenu - - thumb_func_start sub_809F9D0 -sub_809F9D0: @ 809F9D0 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r1, =gUnknown_02037619 - movs r0, 0 - strb r0, [r1] - strb r0, [r1, 0x1] - ldr r4, =task50_startmenu - adds r0, r4, 0 - movs r1, 0x50 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - adds r2, r5, 0 - bl SetTaskFuncWithFollowupFunc - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_809F9D0 - - thumb_func_start sub_809FA00 -sub_809FA00: @ 809FA00 - push {lr} - bl sub_809F894 - cmp r0, 0 - beq _0809FA12 - bl sub_80AF688 - movs r0, 0x1 - b _0809FA14 -_0809FA12: - movs r0, 0 -_0809FA14: - pop {r1} - bx r1 - thumb_func_end sub_809FA00 - - thumb_func_start sub_809FA18 -sub_809FA18: @ 809FA18 - ldr r1, =gUnknown_02037619 - movs r0, 0 - strb r0, [r1] - strb r0, [r1, 0x1] - ldr r1, =gUnknown_03005DB0 - ldr r0, =sub_809FA00 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_809FA18 - - thumb_func_start sub_809FA34 -sub_809FA34: @ 809FA34 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0809FA58 - cmp r0, 0x1 - beq _0809FA7C - b _0809FA92 - .pool -_0809FA58: - bl InUnionRoom - cmp r0, 0x1 - bne _0809FA64 - bl var_800D_set_xB -_0809FA64: - ldr r1, =gUnknown_03005DF4 - ldr r0, =HandleStartMenuInput - str r0, [r1] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0809FA92 - .pool -_0809FA7C: - ldr r0, =gUnknown_03005DF4 - ldr r0, [r0] - bl _call_via_r0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0809FA92 - adds r0, r5, 0 - bl DestroyTask -_0809FA92: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_809FA34 - - thumb_func_start sub_809FA9C -sub_809FA9C: @ 809FA9C - push {lr} - bl is_c1_link_related_active - cmp r0, 0 - bne _0809FAB2 - bl FreezeMapObjects - bl sub_808B864 - bl sub_808BCF4 -_0809FAB2: - ldr r0, =sub_809FA34 - bl sub_809F9D0 - bl ScriptContext2_Enable - pop {r0} - bx r0 - .pool - thumb_func_end sub_809FA9C - - thumb_func_start HandleStartMenuInput -HandleStartMenuInput: @ 809FAC4 - push {r4,lr} - ldr r4, =gMain - ldrh r1, [r4, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0809FAE4 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - negs r0, r0 - bl MoveMenuCursor - ldr r1, =sStartMenuCursorPos - strb r0, [r1] -_0809FAE4: - ldrh r1, [r4, 0x2E] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0809FAFE - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - bl MoveMenuCursor - ldr r1, =sStartMenuCursorPos - strb r0, [r1] -_0809FAFE: - ldrh r1, [r4, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0809FB98 - movs r0, 0x5 - bl PlaySE - ldr r1, =sStartMenuItems - ldr r2, =sCurrentStartMenuActions - ldr r0, =sStartMenuCursorPos - ldrb r0, [r0] - adds r0, r2 - ldrb r0, [r0] - lsls r0, 3 - adds r1, 0x4 - adds r0, r1 - ldr r1, [r0] - ldr r0, =StartMenu_Pokedex - cmp r1, r0 - bne _0809FB34 - movs r0, 0 - bl GetNationalPokedexCount - lsls r0, 16 - cmp r0, 0 - beq _0809FBA0 -_0809FB34: - ldr r3, =gUnknown_03005DF4 - ldr r1, =sStartMenuItems - ldr r2, =sCurrentStartMenuActions - ldr r0, =sStartMenuCursorPos - ldrb r0, [r0] - adds r0, r2 - ldrb r0, [r0] - lsls r0, 3 - adds r1, 0x4 - adds r0, r1 - ldr r1, [r0] - str r1, [r3] - ldr r0, =StartMenu_Save - cmp r1, r0 - beq _0809FBA0 - ldr r0, =StartMenu_Exit - cmp r1, r0 - beq _0809FBA0 - ldr r0, =StartMenu_SafariZoneRetire - cmp r1, r0 - beq _0809FBA0 - ldr r0, =StartMenu_BattlePyramidRetire - cmp r1, r0 - beq _0809FBA0 - movs r0, 0x1 - movs r1, 0 - bl FadeScreen - b _0809FBA0 - .pool -_0809FB98: - movs r0, 0xA - ands r0, r1 - cmp r0, 0 - bne _0809FBA4 -_0809FBA0: - movs r0, 0 - b _0809FBAE -_0809FBA4: - bl RemoveExtraStartMenuWindows - bl sub_80A0934 - movs r0, 0x1 -_0809FBAE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end HandleStartMenuInput - - thumb_func_start StartMenu_Pokedex -StartMenu_Pokedex: @ 809FBB4 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0809FBCC - movs r0, 0 - b _0809FBE6 - .pool -_0809FBCC: - movs r0, 0x29 - bl IncrementGameStat - bl play_some_sound - bl RemoveExtraStartMenuWindows - bl overworld_free_bg_tilemaps - ldr r0, =sub_80BB534 - bl SetMainCallback2 - movs r0, 0x1 -_0809FBE6: - pop {r1} - bx r1 - .pool - thumb_func_end StartMenu_Pokedex - - thumb_func_start StartMenu_Pokemon -StartMenu_Pokemon: @ 809FBF0 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0809FC08 - movs r0, 0 - b _0809FC1C - .pool -_0809FC08: - bl play_some_sound - bl RemoveExtraStartMenuWindows - bl overworld_free_bg_tilemaps - ldr r0, =CB2_PartyMenuFromStartMenu - bl SetMainCallback2 - movs r0, 0x1 -_0809FC1C: - pop {r1} - bx r1 - .pool - thumb_func_end StartMenu_Pokemon - - thumb_func_start StartMenu_Bag -StartMenu_Bag: @ 809FC24 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0809FC3C - movs r0, 0 - b _0809FC50 - .pool -_0809FC3C: - bl play_some_sound - bl RemoveExtraStartMenuWindows - bl overworld_free_bg_tilemaps - ldr r0, =CB2_BagMenuFromStartMenu - bl SetMainCallback2 - movs r0, 0x1 -_0809FC50: - pop {r1} - bx r1 - .pool - thumb_func_end StartMenu_Bag - - thumb_func_start StartMenu_PokeNav -StartMenu_PokeNav: @ 809FC58 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0809FC70 - movs r0, 0 - b _0809FC84 - .pool -_0809FC70: - bl play_some_sound - bl RemoveExtraStartMenuWindows - bl overworld_free_bg_tilemaps - ldr r0, =CB2_PokeNav - bl SetMainCallback2 - movs r0, 0x1 -_0809FC84: - pop {r1} - bx r1 - .pool - thumb_func_end StartMenu_PokeNav - - thumb_func_start StartMenu_PlayerName -StartMenu_PlayerName: @ 809FC8C - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0809FCF4 - bl play_some_sound - bl RemoveExtraStartMenuWindows - bl overworld_free_bg_tilemaps - bl is_c1_link_related_active - cmp r0, 0 - bne _0809FCB6 - bl InUnionRoom - cmp r0, 0 - beq _0809FCC8 -_0809FCB6: - ldr r0, =CB2_ReturnToFieldWithOpenMenu - bl sub_80C4DDC - b _0809FCEA - .pool -_0809FCC8: - ldr r0, =0x000008d2 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _0809FCE4 - ldr r0, =CB2_ReturnToFieldWithOpenMenu - bl sub_80C51C4 - b _0809FCEA - .pool -_0809FCE4: - ldr r0, =CB2_ReturnToFieldWithOpenMenu - bl sub_80C4DDC -_0809FCEA: - movs r0, 0x1 - b _0809FCF6 - .pool -_0809FCF4: - movs r0, 0 -_0809FCF6: - pop {r1} - bx r1 - thumb_func_end StartMenu_PlayerName - - thumb_func_start StartMenu_Save -StartMenu_Save: @ 809FCFC - push {lr} - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - beq _0809FD0C - bl RemoveExtraStartMenuWindows -_0809FD0C: - ldr r1, =gUnknown_03005DF4 - ldr r0, =sub_809FE28 - str r0, [r1] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end StartMenu_Save - - thumb_func_start StartMenu_Option -StartMenu_Option: @ 809FD20 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0809FD38 - movs r0, 0 - b _0809FD52 - .pool -_0809FD38: - bl play_some_sound - bl RemoveExtraStartMenuWindows - bl overworld_free_bg_tilemaps - ldr r0, =CB2_InitOptionMenu - bl SetMainCallback2 - ldr r1, =gMain - ldr r0, =CB2_ReturnToFieldWithOpenMenu - str r0, [r1, 0x8] - movs r0, 0x1 -_0809FD52: - pop {r1} - bx r1 - .pool - thumb_func_end StartMenu_Option - - thumb_func_start StartMenu_Exit -StartMenu_Exit: @ 809FD64 - push {lr} - bl RemoveExtraStartMenuWindows - bl sub_80A0934 - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end StartMenu_Exit - - thumb_func_start StartMenu_SafariZoneRetire -StartMenu_SafariZoneRetire: @ 809FD74 - push {lr} - bl RemoveExtraStartMenuWindows - bl sub_80A0934 - bl SafariZoneRetirePrompt - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end StartMenu_SafariZoneRetire - - thumb_func_start StartMenu_LinkModePlayerName -StartMenu_LinkModePlayerName: @ 809FD88 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0809FDA0 - movs r0, 0 - b _0809FDB4 - .pool -_0809FDA0: - bl play_some_sound - bl overworld_free_bg_tilemaps - ldr r0, =gUnknown_03005DB4 - ldrb r0, [r0] - ldr r1, =CB2_ReturnToFieldWithOpenMenu - bl sub_80C4E74 - movs r0, 0x1 -_0809FDB4: - pop {r1} - bx r1 - .pool - thumb_func_end StartMenu_LinkModePlayerName - - thumb_func_start StartMenu_BattlePyramidRetire -StartMenu_BattlePyramidRetire: @ 809FDC0 - ldr r1, =gUnknown_03005DF4 - ldr r0, =sub_809FE9C - str r0, [r1] - movs r0, 0 - bx lr - .pool - thumb_func_end StartMenu_BattlePyramidRetire - - thumb_func_start sub_809FDD4 -sub_809FDD4: @ 809FDD4 - push {lr} - movs r0, 0 - movs r1, 0 - bl sub_8197DF8 - bl sub_80984F4 - ldr r0, =sub_809FA34 - bl sub_809F9D0 - bl ScriptContext2_Enable - pop {r0} - bx r0 - .pool - thumb_func_end sub_809FDD4 - - thumb_func_start StartMenu_BattlePyramidBag -StartMenu_BattlePyramidBag: @ 809FDF4 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0809FE0C - movs r0, 0 - b _0809FE20 - .pool -_0809FE0C: - bl play_some_sound - bl RemoveExtraStartMenuWindows - bl overworld_free_bg_tilemaps - ldr r0, =sub_81C4EFC - bl SetMainCallback2 - movs r0, 0x1 -_0809FE20: - pop {r1} - bx r1 - .pool - thumb_func_end StartMenu_BattlePyramidBag - - thumb_func_start sub_809FE28 -sub_809FE28: @ 809FE28 - push {lr} - bl sub_809FF28 - ldr r1, =gUnknown_03005DF4 - ldr r0, =sub_809FE44 - str r0, [r1] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_809FE28 - - thumb_func_start sub_809FE44 -sub_809FE44: @ 809FE44 - push {lr} - bl sub_809FF4C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0809FE7C - cmp r0, 0x1 - ble _0809FE94 - cmp r0, 0x2 - beq _0809FE60 - cmp r0, 0x3 - beq _0809FE7C - b _0809FE94 -_0809FE60: - movs r0, 0 - movs r1, 0 - bl sub_8197DF8 - bl sub_809F998 - ldr r1, =gUnknown_03005DF4 - ldr r0, =HandleStartMenuInput - str r0, [r1] - b _0809FE94 - .pool -_0809FE7C: - movs r0, 0 - movs r1, 0x1 - bl sub_8197DF8 - bl sub_80984F4 - bl ScriptContext2_Disable - bl sub_81A9EC8 - movs r0, 0x1 - b _0809FE96 -_0809FE94: - movs r0, 0 -_0809FE96: - pop {r1} - bx r1 - thumb_func_end sub_809FE44 - - thumb_func_start sub_809FE9C -sub_809FE9C: @ 809FE9C - push {lr} - bl sub_80A0340 - ldr r1, =gUnknown_03005DF4 - ldr r0, =sub_809FED4 - str r0, [r1] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_809FE9C - - thumb_func_start sub_809FEB8 -sub_809FEB8: @ 809FEB8 - push {lr} - bl sub_809F998 - ldr r1, =gUnknown_03005DF4 - ldr r0, =HandleStartMenuInput - str r0, [r1] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_809FEB8 - - thumb_func_start sub_809FED4 -sub_809FED4: @ 809FED4 - push {lr} - bl sub_809FF4C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0809FEEC - cmp r0, 0x1 - ble _0809FF20 - cmp r0, 0x2 - beq _0809FF00 - b _0809FF20 -_0809FEEC: - bl RemoveExtraStartMenuWindows - ldr r1, =gUnknown_03005DF4 - ldr r0, =sub_809FEB8 - str r0, [r1] - b _0809FF20 - .pool -_0809FF00: - movs r0, 0 - movs r1, 0x1 - bl sub_8197DF8 - bl sub_80984F4 - bl ScriptContext2_Disable - ldr r0, =BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88 - bl ScriptContext1_SetupScript - movs r0, 0x1 - b _0809FF22 - .pool -_0809FF20: - movs r0, 0 -_0809FF22: - pop {r1} - bx r1 - thumb_func_end sub_809FED4 - - thumb_func_start sub_809FF28 -sub_809FF28: @ 809FF28 - push {lr} - bl save_serialize_map - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A00A0 - str r0, [r1] - ldr r1, =gUnknown_02037621 - movs r0, 0 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_809FF28 - - thumb_func_start sub_809FF4C -sub_809FF4C: @ 809FF4C - push {lr} - bl sub_8197224 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - beq _0809FF78 - ldr r1, =gUnknown_02037621 - movs r0, 0 - strb r0, [r1] - ldr r0, =gUnknown_0203761C - ldr r0, [r0] - bl _call_via_r0 - lsls r0, 24 - lsrs r0, 24 - b _0809FF7A - .pool -_0809FF78: - movs r0, 0 -_0809FF7A: - pop {r1} - bx r1 - thumb_func_end sub_809FF4C - - thumb_func_start sub_809FF80 -sub_809FF80: @ 809FF80 - push {lr} - bl sub_809FF28 - ldr r0, =task50_save_game - movs r1, 0x50 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_809FF80 - - thumb_func_start sub_809FF98 -sub_809FF98: @ 809FF98 - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - ldr r0, =gStringVar4 - adds r1, r2, 0 - bl StringExpandPlaceholders - movs r0, 0 - movs r1, 0x1 - bl sub_819786C - movs r0, 0x1 - bl AddTextPrinterForMessage_2 - ldr r1, =gUnknown_02037621 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =gUnknown_0203761C - str r4, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_809FF98 - - thumb_func_start task50_save_game -task50_save_game: @ 809FFD0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_809FF4C - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x1 - beq _0809FFFC - cmp r1, 0x1 - bgt _0809FFEC - cmp r1, 0 - beq _080A000A - b _080A0000 -_0809FFEC: - cmp r1, 0x3 - bgt _080A0000 - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - b _080A0000 - .pool -_0809FFFC: - ldr r0, =gSpecialVar_Result - strh r1, [r0] -_080A0000: - adds r0, r4, 0 - bl DestroyTask - bl EnableBothScriptContexts -_080A000A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task50_save_game - - thumb_func_start sub_80A0014 -sub_80A0014: @ 80A0014 - push {lr} - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - pop {r0} - bx r0 - thumb_func_end sub_80A0014 - - thumb_func_start sub_80A0024 -sub_80A0024: @ 80A0024 - push {lr} - bl sub_80A0888 - pop {r0} - bx r0 - thumb_func_end sub_80A0024 - - thumb_func_start sub_80A0030 -sub_80A0030: @ 80A0030 - ldr r1, =gUnknown_02037620 - movs r0, 0x3C - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_80A0030 - - thumb_func_start sub_80A003C -sub_80A003C: @ 80A003C - push {lr} - ldr r1, =gUnknown_02037620 - ldrb r0, [r1] - subs r2, r0, 0x1 - strb r2, [r1] - ldr r0, =gMain - ldrh r1, [r0, 0x2C] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080A0064 - lsls r0, r2, 24 - cmp r0, 0 - beq _080A006A - movs r0, 0 - b _080A006C - .pool -_080A0064: - movs r0, 0x5 - bl PlaySE -_080A006A: - movs r0, 0x1 -_080A006C: - pop {r1} - bx r1 - thumb_func_end sub_80A003C - - thumb_func_start sub_80A0070 -sub_80A0070: @ 80A0070 - push {lr} - ldr r1, =gUnknown_02037620 - ldrb r0, [r1] - cmp r0, 0 - bne _080A0094 - ldr r0, =gMain - ldrh r1, [r0, 0x2C] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080A0098 - movs r0, 0x1 - b _080A009A - .pool -_080A0094: - subs r0, 0x1 - strb r0, [r1] -_080A0098: - movs r0, 0 -_080A009A: - pop {r1} - bx r1 - thumb_func_end sub_80A0070 - - thumb_func_start sub_80A00A0 -sub_80A00A0: @ 80A00A0 - push {lr} - bl GetStartMenuWindowId - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_819746C - bl remove_start_menu_window_maybe - bl sub_80A06B4 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - beq _080A00D4 - ldr r0, =BattleFrontier_BattlePyramidEmptySquare_Text_252CA7 - ldr r1, =sub_80A00EC - bl sub_809FF98 - b _080A00DC - .pool -_080A00D4: - ldr r0, =gUnknown_082C87B4 - ldr r1, =sub_80A00EC - bl sub_809FF98 -_080A00DC: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A00A0 - - thumb_func_start sub_80A00EC -sub_80A00EC: @ 80A00EC - push {lr} - bl sub_8197930 - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A0108 - str r0, [r1] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A00EC - - thumb_func_start sub_80A0108 -sub_80A0108: @ 80A0108 - push {lr} - bl ProcessMenuInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080A012A - cmp r1, 0 - bgt _080A0124 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080A0168 - b _080A0174 -_080A0124: - cmp r1, 0x1 - beq _080A0168 - b _080A0174 -_080A012A: - ldr r0, =gSaveFileStatus - ldrh r0, [r0] - cmp r0, 0 - beq _080A0136 - cmp r0, 0x2 - bne _080A013E -_080A0136: - ldr r0, =gDifferentSaveFile - ldrb r0, [r0] - cmp r0, 0 - bne _080A0158 -_080A013E: - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A017C - str r0, [r1] - b _080A0174 - .pool -_080A0158: - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A0234 - str r0, [r1] - b _080A0174 - .pool -_080A0168: - bl sub_80A0024 - bl sub_80A0014 - movs r0, 0x2 - b _080A0176 -_080A0174: - movs r0, 0 -_080A0176: - pop {r1} - bx r1 - thumb_func_end sub_80A0108 - - thumb_func_start sub_80A017C -sub_80A017C: @ 80A017C - push {lr} - ldr r0, =gDifferentSaveFile - ldrb r0, [r0] - cmp r0, 0x1 - bne _080A019C - ldr r0, =gUnknown_082C8845 - ldr r1, =sub_80A01B4 - bl sub_809FF98 - b _080A01A4 - .pool -_080A019C: - ldr r0, =gUnknown_082C87D5 - ldr r1, =sub_80A01D0 - bl sub_809FF98 -_080A01A4: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A017C - - thumb_func_start sub_80A01B4 -sub_80A01B4: @ 80A01B4 - push {lr} - movs r0, 0x1 - bl sub_8197948 - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A01EC - str r0, [r1] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A01B4 - - thumb_func_start sub_80A01D0 -sub_80A01D0: @ 80A01D0 - push {lr} - bl sub_8197930 - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A01EC - str r0, [r1] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A01D0 - - thumb_func_start sub_80A01EC -sub_80A01EC: @ 80A01EC - push {lr} - bl ProcessMenuInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080A020E - cmp r1, 0 - bgt _080A0208 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080A0220 - b _080A022C -_080A0208: - cmp r1, 0x1 - beq _080A0220 - b _080A022C -_080A020E: - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A0234 - str r0, [r1] - b _080A022C - .pool -_080A0220: - bl sub_80A0024 - bl sub_80A0014 - movs r0, 0x2 - b _080A022E -_080A022C: - movs r0, 0 -_080A022E: - pop {r1} - bx r1 - thumb_func_end sub_80A01EC - - thumb_func_start sub_80A0234 -sub_80A0234: @ 80A0234 - push {lr} - ldr r0, =gUnknown_082C8810 - ldr r1, =sub_80A024C - bl sub_809FF98 - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A0234 - - thumb_func_start sub_80A024C -sub_80A024C: @ 80A024C - push {r4,lr} - movs r0, 0 - bl IncrementGameStat - bl sub_81A9E90 - ldr r4, =gDifferentSaveFile - ldrb r0, [r4] - cmp r0, 0x1 - bne _080A0274 - movs r0, 0x4 - bl TrySavingData - lsls r0, 24 - lsrs r1, r0, 24 - movs r0, 0 - strb r0, [r4] - b _080A027E - .pool -_080A0274: - movs r0, 0 - bl TrySavingData - lsls r0, 24 - lsrs r1, r0, 24 -_080A027E: - cmp r1, 0x1 - bne _080A0294 - ldr r0, =gUnknown_082C8832 - ldr r1, =sub_80A02B0 - bl sub_809FF98 - b _080A029C - .pool -_080A0294: - ldr r0, =gUnknown_082C892A - ldr r1, =sub_80A02FC - bl sub_809FF98 -_080A029C: - bl sub_80A0030 - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A024C - - thumb_func_start sub_80A02B0 -sub_80A02B0: @ 80A02B0 - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _080A02CA - movs r0, 0x37 - bl PlaySE - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A02D8 - str r0, [r1] -_080A02CA: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A02B0 - - thumb_func_start sub_80A02D8 -sub_80A02D8: @ 80A02D8 - push {lr} - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _080A02F6 - bl sub_80A003C - lsls r0, 24 - cmp r0, 0 - beq _080A02F6 - bl sub_80A0024 - movs r0, 0x1 - b _080A02F8 -_080A02F6: - movs r0, 0 -_080A02F8: - pop {r1} - bx r1 - thumb_func_end sub_80A02D8 - - thumb_func_start sub_80A02FC -sub_80A02FC: @ 80A02FC - push {lr} - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _080A0316 - movs r0, 0x16 - bl PlaySE - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A0324 - str r0, [r1] -_080A0316: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A02FC - - thumb_func_start sub_80A0324 -sub_80A0324: @ 80A0324 - push {lr} - bl sub_80A0070 - lsls r0, 24 - cmp r0, 0 - beq _080A0338 - bl sub_80A0024 - movs r0, 0x3 - b _080A033A -_080A0338: - movs r0, 0 -_080A033A: - pop {r1} - bx r1 - thumb_func_end sub_80A0324 - - thumb_func_start sub_80A0340 -sub_80A0340: @ 80A0340 - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A035C - str r0, [r1] - ldr r1, =gUnknown_02037621 - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_80A0340 - - thumb_func_start sub_80A035C -sub_80A035C: @ 80A035C - push {lr} - bl GetStartMenuWindowId - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_819746C - bl remove_start_menu_window_maybe - ldr r0, =BattleFrontier_BattlePyramidEmptySquare_Text_252CFB - ldr r1, =sub_80A0388 - bl sub_809FF98 - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A035C - - thumb_func_start sub_80A0388 -sub_80A0388: @ 80A0388 - push {lr} - movs r0, 0x1 - bl sub_8197948 - ldr r1, =gUnknown_0203761C - ldr r0, =sub_80A03A4 - str r0, [r1] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A0388 - - thumb_func_start sub_80A03A4 -sub_80A03A4: @ 80A03A4 - push {lr} - bl ProcessMenuInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080A03C6 - cmp r1, 0 - bgt _080A03C0 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080A03CA - b _080A03D2 -_080A03C0: - cmp r1, 0x1 - beq _080A03CA - b _080A03D2 -_080A03C6: - movs r0, 0x2 - b _080A03D4 -_080A03CA: - bl sub_80A0014 - movs r0, 0x1 - b _080A03D4 -_080A03D2: - movs r0, 0 -_080A03D4: - pop {r1} - bx r1 - thumb_func_end sub_80A03A4 - - thumb_func_start sub_80A03D8 -sub_80A03D8: @ 80A03D8 - push {lr} - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_80A03D8 - - thumb_func_start sub_80A03E4 -sub_80A03E4: @ 80A03E4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - mov r8, r0 - ldrb r0, [r0] - cmp r0, 0x4 - bls _080A03F6 - b _080A04FC -_080A03F6: - lsls r0, 2 - ldr r1, =_080A0404 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080A0404: - .4byte _080A0418 - .4byte _080A0490 - .4byte _080A04A2 - .4byte _080A04D4 - .4byte _080A04F8 -_080A0418: - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl SetVBlankCallback - bl ScanlineEffect_Stop - movs r2, 0xA0 - lsls r2, 19 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r1, =0x040000d4 - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - ldr r0, =0x81000200 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r2, 0xC0 - lsls r2, 19 - movs r3, 0xC0 - lsls r3, 9 - mov r4, sp - movs r6, 0 - movs r5, 0x80 - lsls r5, 5 - ldr r7, =0x81000800 - movs r0, 0x81 - lsls r0, 24 - mov r12, r0 -_080A045A: - strh r6, [r4] - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - str r7, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r2, r5 - subs r3, r5 - cmp r3, r5 - bhi _080A045A - strh r6, [r4] - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - lsrs r0, r3, 1 - mov r2, r12 - orrs r0, r2 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - b _080A04FC - .pool -_080A0490: - bl ResetSpriteData - bl ResetTasks - bl ResetPaletteFade - bl ScanlineEffect_Clear - b _080A04FC -_080A04A2: - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085105A8 - movs r0, 0 - movs r2, 0x1 - bl InitBgsFromTemplates - ldr r0, =gUnknown_085105AC - bl InitWindows - movs r0, 0 - movs r1, 0x8 - movs r2, 0xE0 - bl box_border_load_tiles_and_pal - movs r0, 0xF0 - bl sub_81978B0 - b _080A04FC - .pool -_080A04D4: - movs r0, 0 - bl ShowBg - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r0, =sub_80A03D8 - bl SetVBlankCallback - movs r0, 0x1 - bl EnableInterrupts - b _080A04FC - .pool -_080A04F8: - movs r0, 0x1 - b _080A0506 -_080A04FC: - mov r1, r8 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0 -_080A0506: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80A03E4 - - thumb_func_start sub_80A0514 -sub_80A0514: @ 80A0514 - push {lr} - ldr r0, =gMain+0x438 - bl sub_80A03E4 - cmp r0, 0 - beq _080A052E - ldr r0, =sub_80A0550 - movs r1, 0x50 - bl CreateTask - ldr r0, =sub_80A0540 - bl SetMainCallback2 -_080A052E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A0514 - - thumb_func_start sub_80A0540 -sub_80A0540: @ 80A0540 - push {lr} - bl RunTasks - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_80A0540 - - thumb_func_start sub_80A0550 -sub_80A0550: @ 80A0550 - push {r4-r6,lr} - sub sp, 0x10 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080A0570 - b _080A06A8 -_080A0570: - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0x6 - bls _080A057A - b _080A06A8 -_080A057A: - lsls r0, 2 - ldr r1, =_080A0590 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080A0590: - .4byte _080A05AC - .4byte _080A0630 - .4byte _080A063C - .4byte _080A065C - .4byte _080A0670 - .4byte _080A0688 - .4byte _080A0698 -_080A05AC: - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, =gText_SavingDontTurnOffPower - movs r4, 0 - str r4, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r6, 0x1 - str r6, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0xFF - bl AddTextPrinterParameterized - movs r0, 0 - movs r1, 0x8 - movs r2, 0xE - bl sub_8098858 - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - movs r0, 0x1 - negs r0, r0 - str r4, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _080A0620 - bl InUnionRoom - cmp r0, 0 - beq _080A0620 - bl sub_800A07C - cmp r0, 0 - beq _080A061C - strh r6, [r5] - b _080A06A8 - .pool -_080A061C: - movs r0, 0x5 - b _080A06A6 -_080A0620: - ldr r0, =gSoftResetDisabled - movs r1, 0x1 - strb r1, [r0] - movs r0, 0x1 - b _080A06A6 - .pool -_080A0630: - bl sub_8076D5C - bl sub_8153430 - movs r0, 0x2 - b _080A06A6 -_080A063C: - bl sub_8153474 - lsls r0, 24 - cmp r0, 0 - beq _080A06A8 - bl sav2_gender2_inplace_and_xFE - movs r0, 0x3 - strh r0, [r5] - ldr r1, =gSoftResetDisabled - movs r0, 0 - strb r0, [r1] - b _080A06A8 - .pool -_080A065C: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - movs r0, 0x4 - b _080A06A6 -_080A0670: - bl FreeAllWindowBuffers - ldr r0, =gMain - ldr r0, [r0, 0x8] - bl SetMainCallback2 - adds r0, r4, 0 - bl DestroyTask - b _080A06A8 - .pool -_080A0688: - ldr r0, =sub_8153688 - movs r1, 0x5 - bl CreateTask - movs r0, 0x6 - b _080A06A6 - .pool -_080A0698: - ldr r0, =sub_8153688 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _080A06A8 - movs r0, 0x3 -_080A06A6: - strh r0, [r5] -_080A06A8: - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A0550 - - thumb_func_start sub_80A06B4 -sub_80A06B4: @ 80A06B4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - ldr r0, =gUnknown_085105BC - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0xC] - str r1, [sp, 0x10] - ldr r0, =0x00000861 - mov r10, r0 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _080A06EC - add r0, sp, 0xC - ldrb r1, [r0, 0x4] - subs r1, 0x2 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =0xffffff00 - ldr r0, [sp, 0x10] - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x10] -_080A06EC: - ldr r6, =gUnknown_02037622 - add r0, sp, 0xC - bl AddWindow - strb r0, [r6] - ldrb r0, [r6] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - movs r1, 0x4 - mov r9, r1 - cmp r0, 0 - bne _080A0710 - movs r0, 0x8 - mov r9, r0 -_080A0710: - movs r4, 0x1 - ldr r5, =gStringVar4 - movs r0, 0x3 - adds r1, r5, 0 - movs r2, 0x6 - bl sub_819A344 - ldrb r0, [r6] - str r4, [sp] - movs r1, 0xFF - mov r8, r1 - str r1, [sp, 0x4] - movs r7, 0 - str r7, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - movs r3, 0 - bl PrintTextOnWindow - movs r4, 0x11 - ldrb r0, [r6] - ldr r2, =gText_SavingPlayer - str r4, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r7, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - movs r0, 0 - adds r1, r5, 0 - mov r2, r9 - bl sub_819A344 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x70 - bl GetStringRightAlignXOffset - adds r2, r0, 0 - ldrb r0, [r6] - lsls r2, 16 - lsrs r2, 16 - adds r1, r5, 0 - movs r3, 0x11 - bl sub_819A024 - movs r4, 0x21 - ldrb r0, [r6] - ldr r2, =gText_SavingBadges - str r4, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r7, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - movs r0, 0x4 - adds r1, r5, 0 - mov r2, r9 - bl sub_819A344 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x70 - bl GetStringRightAlignXOffset - adds r2, r0, 0 - ldrb r0, [r6] - lsls r3, r2, 24 - lsrs r3, 24 - str r4, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r7, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - bl PrintTextOnWindow - mov r0, r10 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080A0802 - movs r4, 0x31 - ldrb r0, [r6] - ldr r2, =gText_SavingPokedex - str r4, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r7, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - movs r0, 0x1 - adds r1, r5, 0 - mov r2, r9 - bl sub_819A344 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x70 - bl GetStringRightAlignXOffset - adds r2, r0, 0 - ldrb r0, [r6] - lsls r3, r2, 24 - lsrs r3, 24 - str r4, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r7, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - bl PrintTextOnWindow -_080A0802: - adds r4, 0x10 - ldrb r0, [r6] - ldr r2, =gText_SavingTime - lsls r4, 24 - lsrs r4, 24 - str r4, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r7, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - movs r0, 0x2 - adds r1, r5, 0 - mov r2, r9 - bl sub_819A344 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x70 - bl GetStringRightAlignXOffset - adds r2, r0, 0 - ldrb r0, [r6] - lsls r3, r2, 24 - lsrs r3, 24 - str r4, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r7, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - bl PrintTextOnWindow - ldrb r0, [r6] - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A06B4 - - thumb_func_start sub_80A0888 -sub_80A0888: @ 80A0888 - push {r4,lr} - ldr r4, =gUnknown_02037622 - ldrb r0, [r4] - movs r1, 0 - bl sub_819746C - ldrb r0, [r4] - bl RemoveWindow - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A0888 - - thumb_func_start sub_80A08A4 -sub_80A08A4: @ 80A08A4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =sub_8153688 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _080A08C0 - adds r0, r4, 0 - bl DestroyTask - bl EnableBothScriptContexts -_080A08C0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A08A4 - - thumb_func_start sub_80A08CC -sub_80A08CC: @ 80A08CC - push {r4,r5,lr} - ldr r0, =sub_8153688 - movs r1, 0x5 - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r5 - movs r1, 0x1 - strh r1, [r0, 0xC] - ldr r0, =sub_80A08A4 - movs r1, 0x6 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - strh r4, [r1, 0xA] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80A08CC - - thumb_func_start sub_80A0914 -sub_80A0914: @ 80A0914 - push {lr} - bl GetStartMenuWindowId - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl sub_819746C - bl remove_start_menu_window_maybe - bl sub_80984F4 - bl ScriptContext2_Disable - pop {r0} - bx r0 - thumb_func_end sub_80A0914 - - thumb_func_start sub_80A0934 -sub_80A0934: @ 80A0934 - push {lr} - movs r0, 0x5 - bl PlaySE - bl sub_80A0914 - pop {r0} - bx r0 - thumb_func_end sub_80A0934 - - thumb_func_start AppendToList -AppendToList: @ 80A0944 - ldrb r3, [r1] - adds r0, r3 - strb r2, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - bx lr - thumb_func_end AppendToList - - .align 2, 0 @ Don't pad with nop. diff --git a/include/event_scripts.h b/include/event_scripts.h index 4c5dfd544..ba137cf3b 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -382,6 +382,8 @@ extern const u8 SecretBase_RedCave1_Text_2751E1[]; extern const u8 SecretBase_RedCave1_Text_2754F6[]; extern const u8 SecretBase_RedCave1_Text_2758CC[]; +extern const u8 BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88[]; + //field effects extern const u8 FieryPath_EventScript_2908FD[]; extern const u8 EventScript_290CAE[]; diff --git a/include/item_menu.h b/include/item_menu.h index 9cffaa6c7..e49aeb861 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -55,4 +55,6 @@ void sub_81AAC50(void); void sub_81AAC70(void); void bag_menu_mail_related(void); +void CB2_BagMenuFromStartMenu(void); + #endif //GUARD_item_menu_H diff --git a/include/link.h b/include/link.h index 0fa4d39c2..051370897 100644 --- a/include/link.h +++ b/include/link.h @@ -257,6 +257,7 @@ void sub_800AAF4(void); void sub_800AF18(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06); void sub_800B348(void); void sub_800B3A4(u32 who); +bool32 sub_800A07C(void); extern u16 gLinkPartnersHeldKeys[6]; extern u32 gLinkDebugSeed; diff --git a/include/load_save.h b/include/load_save.h index 92c99fd90..460cdf6f3 100644 --- a/include/load_save.h +++ b/include/load_save.h @@ -21,5 +21,7 @@ void LoadSerializedGame(void); void LoadPlayerBag(void); void SavePlayerBag(void); void SetSaveBlocksPointers(u16); +void sub_8076D5C(void); +void sav2_gender2_inplace_and_xFE(void); #endif // GUARD_LOAD_SAVE_H diff --git a/include/menu.h b/include/menu.h index c2f15422a..dfc4ece02 100644 --- a/include/menu.h +++ b/include/menu.h @@ -1,3 +1,4 @@ + #ifndef GUARD_MENU_H #define GUARD_MENU_H @@ -27,8 +28,9 @@ void NewMenuHelpers_DrawDialogueFrame(u8, u8); void sub_819746C(u8 windowId, bool8 copyToVram); void NewMenuHelpers_DrawStdWindowFrame(u8, u8); u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor); +void PrintPlayerNameOnWindow(u8, const u8*, u16, u16); void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback); -void sub_8197434(u8 a0, u8 a1); +void sub_8197434(u8 windowId, bool8 copyToVram); void SetStandardWindowBorderStyle(u8 a0, u8 a1); void sub_8197930(void); u8 GetPlayerTextSpeed(void); @@ -67,6 +69,16 @@ void AddItemMenuActionTextPrinters (u8, u8, u8, u8, u8, u8, u8, const struct Men void sub_8198DBC(u8, u8, u8, u8, u8, u8, u8, const struct MenuAction*, const u8*); u8 sub_8199944(u8, u8, u8, u8, u8); u8 sub_8199134(s8, s8); +u8 GetStartMenuWindowId(void); void sub_819A2BC(u8, u8); +u8 MoveMenuCursor(s8 cursorDelta); +void NewMenuHelpers_DrawStdWindowFrame(u8 windowId, bool8 CopyToVram); +u8 sub_81979C4(u8 a1); +u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos); +void sub_819786C(u8 windowId, bool8 copyToVram); +void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress); +void remove_start_menu_window_maybe(void); +void sub_8197948(u8 initialCursorPos); +void sub_819A344(u8 a0, u8 *dest, u8 color); #endif // GUARD_MENU_H diff --git a/include/start_menu.h b/include/start_menu.h index 6c7cb3237..216094f20 100644 --- a/include/start_menu.h +++ b/include/start_menu.h @@ -1,6 +1,8 @@ #ifndef GUARD_START_MENU_H #define GUARD_START_MENU_H +extern bool8 (*gMenuCallback)(void); // Defined in sym_common.txt + void AppendToList(u8* list, u8* pos, u8 newEntry); #endif // GUARD_START_MENU_H diff --git a/include/text.h b/include/text.h index 81c066426..2566b51b7 100644 --- a/include/text.h +++ b/include/text.h @@ -82,6 +82,12 @@ #define TEXT_COLOR_TRANSPARENT 0x0 #define TEXT_COLOR_WHITE 0x1 #define TEXT_COLOR_DARK_GREY 0x2 +// 0x3 +#define TEXT_COLOR_RED 0x4 +// 0x5 +#define TEXT_COLOR_GREEN 0x6 +// 0x7 +#define TEXT_COLOR_BLUE 0x8 // battle placeholders are located in battle_message.h diff --git a/ld_script.txt b/ld_script.txt index 7ead2a863..aeb739376 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -107,7 +107,6 @@ SECTIONS { src/clock.o(.text); src/reset_rtc_screen.o(.text); src/start_menu.o(.text); - asm/start_menu.o(.text); src/tileset_anims.o(.text); src/palette.o(.text); src/sound.o(.text); diff --git a/src/menu.c b/src/menu.c index b20ab5164..c9d5ca853 100644 --- a/src/menu.c +++ b/src/menu.c @@ -25,11 +25,11 @@ #define STD_WINDOW_PALETTE_NUM 14 #define STD_WINDOW_BASE_TILE_NUM 0x214 -struct SomeUnkStruct_60F0D4 +struct MoveMenuInfoIcon { - u8 unk1; - u8 unk2; - u16 unk3; + u8 width; + u8 height; + u16 offset; }; struct Menu @@ -48,7 +48,7 @@ struct Menu bool8 APressMuted; }; -static EWRAM_DATA u8 gUnknown_0203CD8C = 0; +static EWRAM_DATA u8 gStartMenuWindowId = 0; static EWRAM_DATA u8 gUnknown_0203CD8D = 0; static EWRAM_DATA struct Menu gUnknown_0203CD90 = {0}; static EWRAM_DATA u16 gUnknown_0203CD9C = 0; @@ -76,34 +76,36 @@ static const struct WindowTemplate gUnknown_0860F0A8 = const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal"); const u8 gUnknown_0860F0D0[] = { 15, 1, 2 }; -const struct SomeUnkStruct_60F0D4 gUnknown_0860F0D4[] = -{ - { 12, 12, 0x00 }, - { 32, 12, 0x20 }, - { 32, 12, 0x64 }, - { 32, 12, 0x60 }, - { 32, 12, 0x80 }, - { 32, 12, 0x48 }, - { 32, 12, 0x44 }, - { 32, 12, 0x6C }, - { 32, 12, 0x68 }, - { 32, 12, 0x88 }, - { 32, 12, 0xA4 }, - { 32, 12, 0x24 }, - { 32, 12, 0x28 }, - { 32, 12, 0x2C }, - { 32, 12, 0x40 }, - { 32, 12, 0x84 }, - { 32, 12, 0x4C }, - { 32, 12, 0xA0 }, - { 32, 12, 0x8C }, - { 42, 12, 0xA8 }, - { 42, 12, 0xC0 }, - { 42, 12, 0xC8 }, - { 42, 12, 0xE0 }, - { 42, 12, 0xE8 }, - { 8, 8, 0xAE }, - { 8, 8, 0xAF }, + +// Table of move info icon offsets in graphics/interface_fr/menu.png +const struct MoveMenuInfoIcon gMoveMenuInfoIcons[] = +{ // { width, height, offset } + { 12, 12, 0x00 }, // Unused + { 32, 12, 0x20 }, // Normal icon + { 32, 12, 0x64 }, // Fight icon + { 32, 12, 0x60 }, // Flying icon + { 32, 12, 0x80 }, // Poison icon + { 32, 12, 0x48 }, // Ground icon + { 32, 12, 0x44 }, // Rock icon + { 32, 12, 0x6C }, // Bug icon + { 32, 12, 0x68 }, // Ghost icon + { 32, 12, 0x88 }, // Steel icon + { 32, 12, 0xA4 }, // ??? (Mystery) icon + { 32, 12, 0x24 }, // Fire icon + { 32, 12, 0x28 }, // Water icon + { 32, 12, 0x2C }, // Grass icon + { 32, 12, 0x40 }, // Electric icon + { 32, 12, 0x84 }, // Psychic icon + { 32, 12, 0x4C }, // Ice icon + { 32, 12, 0xA0 }, // Dragon icon + { 32, 12, 0x8C }, // Dark icon + { 42, 12, 0xA8 }, // -Type- icon + { 42, 12, 0xC0 }, // -Power- icon + { 42, 12, 0xC8 }, // -Accuracy- icon + { 42, 12, 0xE0 }, // -PP- icon + { 42, 12, 0xE8 }, // -Effect- icon + { 8, 8, 0xAE }, // Unused (Small white pokeball) + { 8, 8, 0xAF }, // Unused (Small dark pokeball) }; // Forward declarations @@ -125,7 +127,7 @@ extern void task_free_buf_after_copying_tile_data_to_vram(u8 taskId); void sub_81971D0(void) { InitWindows(gUnknown_0860F098); - gUnknown_0203CD8C = 0xFF; + gStartMenuWindowId = 0xFF; gUnknown_0203CD8D = 0xFF; } @@ -471,22 +473,22 @@ u8 GetPlayerTextSpeed(void) u8 sub_81979C4(u8 a1) { - if (gUnknown_0203CD8C == 0xFF) - gUnknown_0203CD8C = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139); - return gUnknown_0203CD8C; + if (gStartMenuWindowId == 0xFF) + gStartMenuWindowId = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139); + return gStartMenuWindowId; } u8 GetStartMenuWindowId(void) { - return gUnknown_0203CD8C; + return gStartMenuWindowId; } void remove_start_menu_window_maybe(void) { - if (gUnknown_0203CD8C != 0xFF) + if (gStartMenuWindowId != 0xFF) { - RemoveWindow(gUnknown_0203CD8C); - gUnknown_0203CD8C = 0xFF; + RemoveWindow(gStartMenuWindowId); + gStartMenuWindowId = 0xFF; } } @@ -1988,7 +1990,7 @@ void sub_8199F74(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 spee AddTextPrinter(&printer, speed, callback); } -void sub_819A024(u8 windowId, const u8 *src, u16 a2, u16 a3) +void PrintPlayerNameOnWindow(u8 windowId, const u8 *src, u16 x, u16 y) { int count = 0; while (gSaveBlock2Ptr->playerName[count] != EOS) @@ -1996,7 +1998,7 @@ void sub_819A024(u8 windowId, const u8 *src, u16 a2, u16 a3) StringExpandPlaceholders(gStringVar4, src); - PrintTextOnWindow(windowId, 1, gStringVar4, a2, a3, 0xFF, 0); + PrintTextOnWindow(windowId, 1, gStringVar4, x, y, 0xFF, 0); } //Screw this function, it's long and unreferenced and ugh @@ -2364,22 +2366,22 @@ void sub_819A2BC(u8 palOffset, u8 palId) void blit_move_info_icon(u8 windowId, u8 iconId, u16 x, u16 y) { - BlitBitmapRectToWindow(windowId, gFireRedMenuElements_Gfx + gUnknown_0860F0D4[iconId].unk3 * 32, 0, 0, 128, 128, x, y, gUnknown_0860F0D4[iconId].unk1, gUnknown_0860F0D4[iconId].unk2); + BlitBitmapRectToWindow(windowId, gFireRedMenuElements_Gfx + gMoveMenuInfoIcons[iconId].offset * 32, 0, 0, 128, 128, x, y, gMoveMenuInfoIcons[iconId].width, gMoveMenuInfoIcons[iconId].height); } -void sub_819A344(u8 a0, u8 *a1, u8 a2) +void sub_819A344(u8 a0, u8 *dest, u8 color) { s32 curFlag; s32 flagCount; u8 *endOfString; - u8 *string = a1; + u8 *string = dest; *(string++) = EXT_CTRL_CODE_BEGIN; *(string++) = EXT_CTRL_CODE_COLOR; - *(string++) = a2; + *(string++) = color; *(string++) = EXT_CTRL_CODE_BEGIN; *(string++) = EXT_CTRL_CODE_SHADOW; - *(string++) = a2 + 1; + *(string++) = color + 1; switch (a0) { diff --git a/src/start_menu.c b/src/start_menu.c index d076d307d..0df3f7b66 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -8,6 +8,29 @@ #include "text.h" #include "strings.h" #include "bg.h" +#include "field_effect.h" +#include "task.h" +#include "overworld.h" +#include "link.h" +#include "battle_frontier_2.h" +#include "rom_818CFC8.h" +#include "field_specials.h" +#include "field_map_obj_helpers.h" +#include "script.h" +#include "main.h" +#include "sound.h" +#include "pokedex.h" +#include "field_weather.h" +#include "palette.h" +#include "item_menu.h" +#include "option_menu.h" +#include "event_scripts.h" +#include "save.h" +#include "gpu_regs.h" +#include "scanline_effect.h" +#include "text_window.h" +#include "load_save.h" +#include "international_string_util.h" // Menu actions enum @@ -27,15 +50,71 @@ enum MENU_ACTION_PYRAMID_BAG }; -extern bool32 is_c1_link_related_active(void); -extern bool32 InUnionRoom(void); -extern bool8 InBattlePike(void); -extern bool8 InBattlePyramid(void); -extern bool8 InMultiBattleRoom(void); -extern void NewMenuHelpers_DrawStdWindowFrame(u8 windowId, u8 a1); -extern void sub_8198070(u8 windowId, u8 a1); +// Save status +enum +{ + SAVE_IN_PROGRESS, + SAVE_SUCCESS, + SAVE_CANCELED, + SAVE_ERROR +}; + +// Text +extern u8 BattleFrontier_BattlePyramidEmptySquare_Text_252CA7[]; +extern u8 BattleFrontier_BattlePyramidEmptySquare_Text_252CFB[]; +extern u8 gUnknown_082C87B4[]; +extern u8 gUnknown_082C8845[]; // Different save file +extern u8 gUnknown_082C87D5[]; // Already a save file +extern u8 gUnknown_082C8810[]; // Saving… DON’T TURN OFF THE POWER. +extern u8 gUnknown_082C8832[]; // {PLAYER} saved the game. +extern u8 gUnknown_082C892A[]; // Save error. +extern u8 gText_SavingDontTurnOffPower[]; +extern u8 gText_SavingPlayer[]; +extern u8 gText_SavingBadges[]; +extern u8 gText_SavingPokedex[]; +extern u8 gText_SavingTime[]; + +// Extern variables +extern u8 gDifferentSaveFile; +extern u16 gSaveFileStatus; +extern u8 gUnknown_03005DB4; + +extern void sub_80AF688(void); +extern void var_800D_set_xB(void); +extern void sub_808B864(void); +extern void sub_808BCF4(void); +extern void sub_80A0934(void); +extern void sub_80BB534(void); +extern void play_some_sound(void); +extern void CB2_PartyMenuFromStartMenu(void); +extern void CB2_PokeNav(void); +extern void sub_80C4DDC(void (*)(void)); +extern void sub_80C51C4(void (*)(void)); +extern void sub_80C4E74(u8, void (*)(void)); +extern void sub_81C4EFC(void); +extern void sub_80984F4(void); +extern void sub_81A9EC8(void); +extern void save_serialize_map(void); +extern void sub_81A9E90(void); + +bool8 sub_809FE9C(void); +void sub_80A0888(void); +void sub_80A06B4(void); // this file's functions +static bool8 StartMenu_Pokedex(void); +static bool8 StartMenu_Pokemon(void); +static bool8 StartMenu_Bag(void); +static bool8 StartMenu_PokeNav(void); +static bool8 StartMenu_PlayerName(void); +static bool8 StartMenu_Save(void); +static bool8 StartMenu_Option(void); +static bool8 StartMenu_Exit(void); +static bool8 StartMenu_SafariZoneRetire(void); +static bool8 StartMenu_LinkModePlayerName(void); +static bool8 StartMenu_BattlePyramidRetire(void); +static bool8 StartMenu_BattlePyramidBag(void); + static void BuildStartMenuActions_LinkMode(void); static void BuildStartMenuActions_UnionRoom(void); static void BuildStartMenuActions_SafariZone(void); @@ -43,18 +122,42 @@ static void BuildStartMenuActions_BattlePike(void); static void BuildStartMenuActions_BattlePyramid(void); static void BuildStartMenuActions_MultiBattleRoom(void); static void BuildStartMenuActions_Normal(void); -bool8 StartMenu_Pokedex(void); -bool8 StartMenu_Pokemon(void); -bool8 StartMenu_Bag(void); -bool8 StartMenu_PokeNav(void); -bool8 StartMenu_PlayerName(void); -bool8 StartMenu_Save(void); -bool8 StartMenu_Option(void); -bool8 StartMenu_Exit(void); -bool8 StartMenu_SafariZoneRetire(void); -bool8 StartMenu_LinkModePlayerName(void); -bool8 StartMenu_BattlePyramidRetire(void); -bool8 StartMenu_BattlePyramidBag(void); + +static void task50_save_game(u8 taskId); + +u8 sub_809FF4C(void); +u8 sub_80A00EC(void); +bool8 sub_80A00A0(void); +bool8 sub_80A0108(void); +bool8 sub_80A017C(void); +u8 sub_80A01B4(void); +u8 sub_80A01D0(void); +u8 sub_80A01EC(void); +u8 sub_80A0234(void); +u8 sub_80A024C(void); +u8 sub_80A02B0(void); +u8 sub_80A02FC(void); +u8 sub_80A02D8(void); +u8 sub_80A0324(void); +void sub_80A0340(void); +u8 sub_80A035C(void); +u8 sub_80A0388(void); +u8 sub_80A03A4(void); + +bool8 HandleStartMenuInput(void); + +bool32 PrintStartMenuActions(s8*, u32); +bool32 sub_809F894(void); +void InitStartMenu(void); +void sub_809FF28(void); + +void sub_80A0540(void); +void sub_80A0550(u8 taskId); + +// gMenuCallbacks +bool8 sub_809FE28(void); +bool8 sub_809FE44(void); +bool8 sub_809FED4(void); // EWRAM vars EWRAM_DATA u8 sSafariBallsWindowId = 0; @@ -65,8 +168,8 @@ EWRAM_DATA u8 sCurrentStartMenuActions[9] = {0}; EWRAM_DATA u8 gUnknown_02037619[2] = {0}; EWRAM_DATA bool8 (*gUnknown_0203761C)(void) = NULL; EWRAM_DATA u8 gUnknown_02037620 = 0; -EWRAM_DATA u8 gUnknown_02037621 = 0; -EWRAM_DATA u8 gUnknown_02037622 = 0; +EWRAM_DATA bool8 gUnknown_02037621 = FALSE; +EWRAM_DATA u8 gSaveInfoWindowId = 0; // const rom data static const struct WindowTemplate gSafariBallsWindowTemplate = {0, 1, 1, 9, 4, 0xF, 8}; @@ -122,7 +225,7 @@ const struct WindowTemplate gUnknown_085105AC[] = DUMMY_WIN_TEMPLATE }; -const struct WindowTemplate gUnknown_085105BC = {0, 1, 1, 0xE, 0xA, 0xF, 8}; +const struct WindowTemplate gSaveInfoWindowTemplate = {0, 1, 1, 0xE, 0xA, 0xF, 8}; // code void SetDexPokemonPokenavFlags(void) // unused @@ -273,33 +376,1014 @@ void RemoveExtraStartMenuWindows(void) } } -/* -// Prints n menu items starting at *index -static bool32 PrintStartMenuItemsMultistep(s16 *index, u32 n) +bool32 PrintStartMenuActions(s8 *pIndex, u32 count) { - s8 _index = *index; - + s8 index = *pIndex; + do { - if (sStartMenuItems[sCurrentStartMenuActions[_index]].func.u8_void == StartMenu_PlayerName) - { - + if (sStartMenuItems[sCurrentStartMenuActions[index]].func.u8_void == StartMenu_PlayerName) { + PrintPlayerNameOnWindow(GetStartMenuWindowId(), sStartMenuItems[sCurrentStartMenuActions[index]].text, 8, (index << 4) + 9); } - else - { - + else { + StringExpandPlaceholders(gStringVar4, sStartMenuItems[sCurrentStartMenuActions[index]].text); + PrintTextOnWindow(GetStartMenuWindowId(), 1, gStringVar4, 8, (index << 4) + 9, 0xFF, 0); } - } while (++_index > sNumStartMenuActions); + index++; + if (index >= sNumStartMenuActions) { + *pIndex = index; + return TRUE; + } - if (--n == 0) + count--; + } + while (count != 0); + + *pIndex = index; + return FALSE; +} + +bool32 sub_809F894(void) +{ + s8 value = gUnknown_02037619[0]; + switch (value) + { + case 0: + gUnknown_02037619[0]++; + break; + case 1: + BuildStartMenuActions(); + gUnknown_02037619[0]++; + break; + case 2: + sub_81973A4(); + NewMenuHelpers_DrawStdWindowFrame(sub_81979C4(sNumStartMenuActions), FALSE); + gUnknown_02037619[1] = 0; + gUnknown_02037619[0]++; + break; + case 3: + if (GetSafariZoneFlag() != FALSE) + { + DisplaySafariBallsWindow(); + } + if (InBattlePyramid() != FALSE) + { + DisplayPyramidFloorWindow(); + } + gUnknown_02037619[0]++; + break; + case 4: + if (PrintStartMenuActions(&gUnknown_02037619[1], 2) == FALSE) + { + break; + } + gUnknown_02037619[0]++; + break; + case 5: + sStartMenuCursorPos = sub_81983AC(GetStartMenuWindowId(), 1, 0, 9, 16, sNumStartMenuActions, sStartMenuCursorPos); + CopyWindowToVram(GetStartMenuWindowId(), TRUE); + return TRUE; + default: + break; + } + + return FALSE; +} + +void InitStartMenu(void) +{ + gUnknown_02037619[0] = 0; + gUnknown_02037619[1] = 0; + while (!sub_809F894()); +} + +void task50_startmenu(u8 taskId) +{ + if (sub_809F894() == TRUE) + { + SwitchTaskToFollowupFunc(taskId); + } +} + +void sub_809F9D0(TaskFunc followupFunc) +{ + gUnknown_02037619[0] = 0; + gUnknown_02037619[1] = 0; + SetTaskFuncWithFollowupFunc(CreateTask(&task50_startmenu, 0x50), &task50_startmenu, followupFunc); +} + +bool8 sub_809FA00(void) +{ + if (sub_809F894() == FALSE) { - *index = _index; return FALSE; } + + sub_80AF688(); + return TRUE; +} + +void sub_809FA18(void) +{ + gUnknown_02037619[0] = 0; + gUnknown_02037619[1] = 0; + gUnknown_03005DB0 = &sub_809FA00; +} + +void sub_809FA34(u8 taskId) +{ + struct Task* task = &gTasks[taskId]; + + switch(task->data[0]) + { + case 0: + if (InUnionRoom() == TRUE) + { + var_800D_set_xB(); + } + + gMenuCallback = HandleStartMenuInput; + task->data[0]++; + break; + case 1: + if (gMenuCallback() == TRUE) + { + DestroyTask(taskId); + } + break; + } +} + +void sub_809FA9C(void) +{ + if (!is_c1_link_related_active()) + { + FreezeMapObjects(); + sub_808B864(); + sub_808BCF4(); + } + sub_809F9D0(sub_809FA34); + ScriptContext2_Enable(); +} + +bool8 HandleStartMenuInput(void) // TODO callback +{ + if (gMain.newKeys & DPAD_UP) + { + PlaySE(5); + sStartMenuCursorPos = MoveMenuCursor(-1); + } + + if (gMain.newKeys & DPAD_DOWN) + { + PlaySE(5); + sStartMenuCursorPos = MoveMenuCursor(1); + } + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(5); + if (sStartMenuItems[sCurrentStartMenuActions[sStartMenuCursorPos]].func.u8_void == StartMenu_Pokedex) + { + if (GetNationalPokedexCount(0) == FALSE) { + return FALSE; + } + } + + gMenuCallback = sStartMenuItems[sCurrentStartMenuActions[sStartMenuCursorPos]].func.u8_void; + + if (gMenuCallback != StartMenu_Save + && gMenuCallback != StartMenu_Exit + && gMenuCallback != StartMenu_SafariZoneRetire + && gMenuCallback != StartMenu_BattlePyramidRetire) + { + FadeScreen(1, 0); + } + + return FALSE; + } + + if (gMain.newKeys & (START_BUTTON | B_BUTTON)) + { + RemoveExtraStartMenuWindows(); + sub_80A0934(); + return TRUE; + } + + return FALSE; +} + +static bool8 StartMenu_Pokedex(void) +{ + if (!gPaletteFade.active) + { + IncrementGameStat(GAME_STAT_CHECKED_POKEDEX); + play_some_sound(); + RemoveExtraStartMenuWindows(); + overworld_free_bg_tilemaps(); + SetMainCallback2(sub_80BB534); + + return TRUE; + } + + return FALSE; +} + +static bool8 StartMenu_Pokemon(void) +{ + if (!gPaletteFade.active) + { + play_some_sound(); + RemoveExtraStartMenuWindows(); + overworld_free_bg_tilemaps(); + SetMainCallback2(CB2_PartyMenuFromStartMenu); + + return TRUE; + } + + return FALSE; +} + +static bool8 StartMenu_Bag(void) +{ + if (!gPaletteFade.active) + { + play_some_sound(); + RemoveExtraStartMenuWindows(); + overworld_free_bg_tilemaps(); + SetMainCallback2(CB2_BagMenuFromStartMenu); + + return TRUE; + } + + return FALSE; +} + +static bool8 StartMenu_PokeNav(void) +{ + if (!gPaletteFade.active) + { + play_some_sound(); + RemoveExtraStartMenuWindows(); + overworld_free_bg_tilemaps(); + SetMainCallback2(CB2_PokeNav); + + return TRUE; + } + + return FALSE; +} + +static bool8 StartMenu_PlayerName(void) +{ + if (!gPaletteFade.active) + { + play_some_sound(); + RemoveExtraStartMenuWindows(); + overworld_free_bg_tilemaps(); + + if (is_c1_link_related_active() || InUnionRoom()) + { + sub_80C4DDC(CB2_ReturnToFieldWithOpenMenu); + } + else if (FlagGet(FLAG_SYS_FRONTIER_PASS)) + { + sub_80C51C4(CB2_ReturnToFieldWithOpenMenu); + } + else + { + sub_80C4DDC(CB2_ReturnToFieldWithOpenMenu); + } + + return TRUE; + } + + return FALSE; +} + +static bool8 StartMenu_Save(void) +{ + if (InBattlePyramid()) + { + RemoveExtraStartMenuWindows(); + } + + gMenuCallback = sub_809FE28; + + return FALSE; +} + +static bool8 StartMenu_Option(void) +{ + if (!gPaletteFade.active) + { + play_some_sound(); + RemoveExtraStartMenuWindows(); + overworld_free_bg_tilemaps(); + SetMainCallback2(CB2_InitOptionMenu); + gMain.savedCallback = CB2_ReturnToFieldWithOpenMenu; + + return TRUE; + } + + return FALSE; +} + +static bool8 StartMenu_Exit(void) +{ + RemoveExtraStartMenuWindows(); + sub_80A0934(); + + return TRUE; +} + +static bool8 StartMenu_SafariZoneRetire(void) +{ + RemoveExtraStartMenuWindows(); + sub_80A0934(); + SafariZoneRetirePrompt(); + + return TRUE; +} + +static bool8 StartMenu_LinkModePlayerName(void) +{ + if (!gPaletteFade.active) + { + play_some_sound(); + overworld_free_bg_tilemaps(); + sub_80C4E74(gUnknown_03005DB4, CB2_ReturnToFieldWithOpenMenu); + + return TRUE; + } + + return FALSE; +} + +static bool8 StartMenu_BattlePyramidRetire(void) +{ + gMenuCallback = sub_809FE9C; + + return FALSE; +} + +void sub_809FDD4(void) +{ + sub_8197DF8(0, 0); + sub_80984F4(); + sub_809F9D0(sub_809FA34); + ScriptContext2_Enable(); +} + +static bool8 StartMenu_BattlePyramidBag(void) +{ + if (!gPaletteFade.active) + { + play_some_sound(); + RemoveExtraStartMenuWindows(); + overworld_free_bg_tilemaps(); + SetMainCallback2(sub_81C4EFC); + + return TRUE; + } + + return FALSE; +} + +bool8 sub_809FE28(void) +{ + sub_809FF28(); + gMenuCallback = sub_809FE44; + + return FALSE; +} + +bool8 sub_809FE44(void) +{ + switch (sub_809FF4C()) + { + case SAVE_IN_PROGRESS: + return FALSE; + case SAVE_CANCELED: + sub_8197DF8(0, 0); + InitStartMenu(); + gMenuCallback = HandleStartMenuInput; + return FALSE; + case SAVE_SUCCESS: + case SAVE_ERROR: + sub_8197DF8(0, 1); + sub_80984F4(); + ScriptContext2_Disable(); + sub_81A9EC8(); + return TRUE; + } + + return FALSE; +} + +bool8 sub_809FE9C(void) +{ + sub_80A0340(); + gMenuCallback = sub_809FED4; + + return FALSE; +} + +bool8 sub_809FEB8(void) +{ + InitStartMenu(); + gMenuCallback = HandleStartMenuInput; + + return FALSE; +} + +bool8 sub_809FED4(void) +{ + switch (sub_809FF4C()) + { + case SAVE_SUCCESS: + RemoveExtraStartMenuWindows(); + gMenuCallback = sub_809FEB8; + return FALSE; + case SAVE_IN_PROGRESS: + return FALSE; + case SAVE_CANCELED: + sub_8197DF8(0, 1); + sub_80984F4(); + ScriptContext2_Disable(); + ScriptContext1_SetupScript(BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88); + return TRUE; + } + + return FALSE; +} + +void sub_809FF28(void) +{ + save_serialize_map(); + gUnknown_0203761C = sub_80A00A0; + gUnknown_02037621 = FALSE; +} + +u8 sub_809FF4C(void) +{ + if (sub_8197224() == TRUE) + { + return FALSE; + } + + gUnknown_02037621 = FALSE; + return gUnknown_0203761C(); +} + +void sub_809FF80(void) +{ + sub_809FF28(); + CreateTask(task50_save_game, 0x50); +} + +// DisplaySaveMessageWithCallback +void sub_809FF98(const u8 *message, u8 (*func)(void)) +{ + StringExpandPlaceholders(gStringVar4, message); + sub_819786C(0, TRUE); + AddTextPrinterForMessage_2(TRUE); + gUnknown_02037621 = TRUE; + gUnknown_0203761C = func; +} + +static void task50_save_game(u8 taskId) +{ + u8 status = sub_809FF4C(); + + switch (status) + { + case SAVE_CANCELED: + case SAVE_ERROR: + gSpecialVar_Result = 0; + break; + case SAVE_SUCCESS: + gSpecialVar_Result = status; + break; + case SAVE_IN_PROGRESS: + return; + } + + DestroyTask(taskId); + EnableBothScriptContexts(); +} + +void sub_80A0014(void) +{ + sub_8197434(0, TRUE); +} + +void sub_80A0024(void) +{ + sub_80A0888(); +} + +void sub_80A0030(void) +{ + gUnknown_02037620 = 60; +} + +bool8 sub_80A003C(void) +{ + gUnknown_02037620--; + if (gMain.heldKeys & A_BUTTON) + { + PlaySE(5); + return TRUE; + } + else if (gUnknown_02037620 == 0) + { + return TRUE; + } + + return FALSE; +} + +bool8 sub_80A0070(void) +{ + if (gUnknown_02037620 != 0) + { + gUnknown_02037620--; + } + else if (gMain.heldKeys & A_BUTTON) + { + return TRUE; + } + + return FALSE; +} + +bool8 sub_80A00A0(void) // Return u8? Ruby +{ + sub_819746C(GetStartMenuWindowId(), FALSE); + remove_start_menu_window_maybe(); + sub_80A06B4(); + + if (InBattlePyramid()) + { + sub_809FF98(BattleFrontier_BattlePyramidEmptySquare_Text_252CA7, sub_80A00EC); + } + else + { + sub_809FF98(gUnknown_082C87B4, sub_80A00EC); + } + + return FALSE; // SAVE_IN_PROGRESS ? +} + +bool8 sub_80A00EC(void) +{ + sub_8197930(); + gUnknown_0203761C = sub_80A0108; + return FALSE; +} + +u8 sub_80A0108(void) +{ + switch (ProcessMenuInputNoWrap_()) + { + case 0: // Yes + switch (gSaveFileStatus) + { + case 0: + case 2: + if (gDifferentSaveFile == FALSE) + { + gUnknown_0203761C = sub_80A017C; + return SAVE_IN_PROGRESS; + } + + gUnknown_0203761C = sub_80A0234; + return SAVE_IN_PROGRESS; + default: + gUnknown_0203761C = sub_80A017C; + return SAVE_IN_PROGRESS; + } + case -1: // B Button + case 1: // No + sub_80A0024(); + sub_80A0014(); + return SAVE_CANCELED; + } + + return SAVE_IN_PROGRESS; +} + +// A different save file exists +u8 sub_80A017C(void) +{ + if (gDifferentSaveFile == TRUE) + { + sub_809FF98(gUnknown_082C8845, sub_80A01B4); + } + else + { + sub_809FF98(gUnknown_082C87D5, sub_80A01D0); + } + + return SAVE_IN_PROGRESS; +} + +u8 sub_80A01B4(void) +{ + sub_8197948(1); + gUnknown_0203761C = sub_80A01EC; + return SAVE_IN_PROGRESS; +} + +u8 sub_80A01D0(void) +{ + sub_8197930(); + gUnknown_0203761C = sub_80A01EC; + return SAVE_IN_PROGRESS; +} + +u8 sub_80A01EC(void) +{ + switch (ProcessMenuInputNoWrap_()) + { + case 0: // Yes + gUnknown_0203761C = sub_80A0234; + return SAVE_IN_PROGRESS; + case -1: // B Button + case 1: // No + sub_80A0024(); + sub_80A0014(); + return SAVE_CANCELED; + } + + return SAVE_IN_PROGRESS; +} + +u8 sub_80A0234(void) +{ + sub_809FF98(gUnknown_082C8810, sub_80A024C); + return SAVE_IN_PROGRESS; +} + +u8 sub_80A024C(void) +{ + u8 saveStatus; + + IncrementGameStat(GAME_STAT_SAVED_GAME); + sub_81A9E90(); + + if (gDifferentSaveFile == TRUE) + { + saveStatus = TrySavingData(SAVE_OVERWRITE_DIFFERENT_FILE); + gDifferentSaveFile = FALSE; + } + else + { + saveStatus = TrySavingData(SAVE_NORMAL); + } + + if (saveStatus == 1) // Save succeded + { + sub_809FF98(gUnknown_082C8832, sub_80A02B0); + } + else // Save error + { + sub_809FF98(gUnknown_082C892A, sub_80A02FC); + } + + sub_80A0030(); + return SAVE_IN_PROGRESS; +} + +u8 sub_80A02B0(void) +{ + if (!IsTextPrinterActive(0)) + { + PlaySE(0x37); // 55 + gUnknown_0203761C = sub_80A02D8; + } + + return SAVE_IN_PROGRESS; +} + +u8 sub_80A02D8(void) +{ + if (!IsSEPlaying() && sub_80A003C()) + { + sub_80A0024(); + return SAVE_SUCCESS; + } + else + { + return SAVE_IN_PROGRESS; + } +} + +u8 sub_80A02FC(void) +{ + if (!IsTextPrinterActive(0)) + { + PlaySE(0x16); // 22 + gUnknown_0203761C = sub_80A0324; + } + + return SAVE_IN_PROGRESS; +} + +u8 sub_80A0324(void) +{ + if (!sub_80A0070()) + { + return SAVE_IN_PROGRESS; + } else { - *index = _index; + sub_80A0024(); + return SAVE_ERROR; + } +} + +void sub_80A0340(void) +{ + gUnknown_0203761C = sub_80A035C; + gUnknown_02037621 = FALSE; +} + +u8 sub_80A035C(void) +{ + sub_819746C(GetStartMenuWindowId(), FALSE); + remove_start_menu_window_maybe(); + sub_809FF98(BattleFrontier_BattlePyramidEmptySquare_Text_252CFB, sub_80A0388); + + return SAVE_IN_PROGRESS; +} + +u8 sub_80A0388(void) +{ + sub_8197948(1); + gUnknown_0203761C = sub_80A03A4; + + return SAVE_IN_PROGRESS; +} + +u8 sub_80A03A4(void) +{ + switch (ProcessMenuInputNoWrap_()) + { + case 0: // Yes + return SAVE_CANCELED; + case -1: // B Button + case 1: // No + sub_80A0014(); + return SAVE_SUCCESS; + } + + return SAVE_IN_PROGRESS; +} + +void sub_80A03D8(void) +{ + TransferPlttBuffer(); +} + +bool32 sub_80A03E4(u8 *par1) +{ + switch (*par1) + { + case 0: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0); + SetVBlankCallback(NULL); + ScanlineEffect_Stop(); + DmaClear16(3, PLTT, PLTT_SIZE); + DmaFillLarge16(3, 0, (void *)(VRAM + 0x0), 0x18000, 0x1000); + break; + case 1: + ResetSpriteData(); + ResetTasks(); + ResetPaletteFade(); + ScanlineEffect_Clear(); + break; + case 2: + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_085105A8, ARRAY_COUNT(gUnknown_085105A8)); + InitWindows(gUnknown_085105AC); + box_border_load_tiles_and_pal(0, 8, 224); + sub_81978B0(240); + break; + case 3: + ShowBg(0); + BlendPalettes(-1, 16, 0); + SetVBlankCallback(sub_80A03D8); + EnableInterrupts(1); + break; + case 4: return TRUE; } -}*/ + + (*par1)++; + return FALSE; +} + +void sub_80A0514(void) +{ + if (sub_80A03E4(&gMain.state)) + { + CreateTask(&sub_80A0550, 0x50); + SetMainCallback2(sub_80A0540); + } +} + +void sub_80A0540(void) +{ + RunTasks(); + UpdatePaletteFade(); +} + +void sub_80A0550(u8 taskId) +{ + s16 *step = gTasks[taskId].data; + + if (!gPaletteFade.active) + { + switch (*step) + { + case 0: + FillWindowPixelBuffer(0, 17); + AddTextPrinterParameterized(0, + 1, + gText_SavingDontTurnOffPower, + 255, + NULL, + 2, + 1, + 3); + sub_8098858(0, 8, 14); + PutWindowTilemap(0); + CopyWindowToVram(0, 3); + BeginNormalPaletteFade(-1, 0, 16, 0, 0); + + if (gWirelessCommType != 0 && InUnionRoom()) + { + if (sub_800A07C()) + { + *step = 1; + } + else + { + *step = 5; + } + } + else + { + gSoftResetDisabled = 1; + *step = 1; + } + break; + case 1: + sub_8076D5C(); + sub_8153430(); + *step = 2; + break; + case 2: + if (sub_8153474()) + { + sav2_gender2_inplace_and_xFE(); + *step = 3; + gSoftResetDisabled = 0; + } + break; + case 3: + BeginNormalPaletteFade(-1, 0, 0, 16, 0); + *step = 4; + break; + case 4: + FreeAllWindowBuffers(); + SetMainCallback2(gMain.savedCallback); + DestroyTask(taskId); + break; + case 5: + CreateTask(&sub_8153688, 0x5); + *step = 6; + break; + case 6: + if (!FuncIsActiveTask(&sub_8153688)) + { + *step = 3; + } + break; + } + } +} + +void sub_80A06B4(void) +{ + struct WindowTemplate saveInfoWindow = gSaveInfoWindowTemplate; + u8 gender; + u8 color; + u32 xOffset; + u32 yOffset; + + if (!FlagGet(FLAG_SYS_POKEDEX_GET)) + { + saveInfoWindow.height -= 2; + } + + gSaveInfoWindowId = AddWindow(&saveInfoWindow); + NewMenuHelpers_DrawStdWindowFrame(gSaveInfoWindowId, 0); + + gender = gSaveBlock2Ptr->playerGender; + color = TEXT_COLOR_RED; // Red when gender is female, blue when male. + + if (gender == MALE) + { + color = TEXT_COLOR_BLUE; + } + + // Print region name + yOffset = 1; + sub_819A344(3, gStringVar4, TEXT_COLOR_GREEN); + PrintTextOnWindow(gSaveInfoWindowId, 1, gStringVar4, 0, yOffset, 0xFF, NULL); + + // Print player name + yOffset = 0x11; + PrintTextOnWindow(gSaveInfoWindowId, 1, gText_SavingPlayer, 0, yOffset, 0xFF, NULL); + sub_819A344(0, gStringVar4, color); + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 0x70); + PrintPlayerNameOnWindow(gSaveInfoWindowId, gStringVar4, xOffset, yOffset); + + // Print badge count + yOffset = 0x21; + PrintTextOnWindow(gSaveInfoWindowId, 1, gText_SavingBadges, 0, yOffset, 0xFF, NULL); + sub_819A344(4, gStringVar4, color); + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 0x70); + PrintTextOnWindow(gSaveInfoWindowId, 1, gStringVar4, xOffset, yOffset, 0xFF, NULL); + + if (FlagGet(FLAG_SYS_POKEDEX_GET) == TRUE) + { + + // Print pokedex count + yOffset = 0x31; + PrintTextOnWindow(gSaveInfoWindowId, 1, gText_SavingPokedex, 0, yOffset, 0xFF, NULL); + sub_819A344(1, gStringVar4, color); + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 0x70); + PrintTextOnWindow(gSaveInfoWindowId, 1, gStringVar4, xOffset, yOffset, 0xFF, NULL); + } + + // Print play time + yOffset += 0x10; + PrintTextOnWindow(gSaveInfoWindowId, 1, gText_SavingTime, 0, yOffset, 0xFF, NULL); + sub_819A344(2, gStringVar4, color); + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 0x70); + PrintTextOnWindow(gSaveInfoWindowId, 1, gStringVar4, xOffset, yOffset, 0xFF, NULL); + + CopyWindowToVram(gSaveInfoWindowId, 2); +} + +void sub_80A0888(void) +{ + sub_819746C(gSaveInfoWindowId, FALSE); + RemoveWindow(gSaveInfoWindowId); +} + +void sub_80A08A4(u8 taskId) +{ + if (!FuncIsActiveTask(sub_8153688)) + { + DestroyTask(taskId); + EnableBothScriptContexts(); + } +} + +void sub_80A08CC(void) +{ + u32 taskId1; + u32 taskId2; + + taskId1 = CreateTask(&sub_8153688, 0x5); + gTasks[taskId1].data[2] = 1; + + taskId2 = CreateTask(&sub_80A08A4, 0x6); + gTasks[taskId2].data[1] = taskId1; +} + +void sub_80A0914(void) +{ + sub_819746C(GetStartMenuWindowId(), TRUE); + remove_start_menu_window_maybe(); + sub_80984F4(); + ScriptContext2_Disable(); +} + +void sub_80A0934(void) +{ + PlaySE(5); + sub_80A0914(); +} + +void AppendToList(u8 *list, u8 *pos, u8 newEntry) +{ + list[*pos] = newEntry; + (*pos)++; +} \ No newline at end of file diff --git a/sym_common.txt b/sym_common.txt index 01772fa5a..6f6a8da32 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -70,7 +70,7 @@ gUnknown_03005DEC: @ 3005DEC gSelectedMapObject: @ 3005DF0 .space 0x4 -gUnknown_03005DF4: @ 3005DF4 +gMenuCallback: @ 3005DF4 .space 0x4 .include "sound.o"