From 2738cbd6ac35b3d305658642176c0f15fda722ab Mon Sep 17 00:00:00 2001 From: z64a Date: Wed, 23 Oct 2024 23:36:37 -0400 Subject: [PATCH] complete --- include/enums.h | 12 ++- include/filemenu.h | 14 ++- include/functions.h | 2 +- src/filemenu/filemenu_common.c | 23 +++-- src/filemenu/filemenu_createfile.c | 90 +++++++++-------- src/filemenu/filemenu_info.c | 41 ++++---- src/filemenu/filemenu_main.c | 135 ++++++++++++++----------- src/filemenu/filemenu_msg.c | 14 +-- src/filemenu/filemenu_selectlanguage.c | 2 +- src/filemenu/filemenu_yesno.c | 114 ++++++++++----------- src/state_file_select.c | 8 +- ver/jp/undefined_syms.txt | 2 +- ver/us/symbol_addrs.txt | 2 +- 13 files changed, 249 insertions(+), 210 deletions(-) diff --git a/include/enums.h b/include/enums.h index 2c187718f2..be51d6fbf2 100644 --- a/include/enums.h +++ b/include/enums.h @@ -5369,14 +5369,14 @@ enum FileMenuMessages { /* 31 */ FILE_MESSAGE_HAS_BEEN_CREATED, // has been created.[End] #if VERSION_PAL // TODO: determine where these new entries should be placed - UNK1, - UNK2, + FILE_MESSAGE_PAL_UNK1, + FILE_MESSAGE_PAL_UNK2, #endif /* 32 */ FILE_MESSAGE_ENTER_A_FILE_NAME, // Enter a file name![End] /* 33 */ FILE_MESSAGE_QUESTION, // ?[End] /* 34 */ FILE_MESSAGE_PERIOD_34, // .[End] #if VERSION_PAL - FILE_MESSAGE_BASE_UNK, + FILE_MESSAGE_PAL_UNK3, #endif }; @@ -6033,6 +6033,12 @@ enum MsgChars { MSG_CHAR_UNK_C3 = 0xC3, + MSG_CHAR_MENU_SPACE = 0xC6, + MSG_CHAR_MENU_USE_CHARSET_B = 0xC7, + MSG_CHAR_MENU_USE_CHARSET_A = 0xC8, + MSG_CHAR_MENU_BACK = 0xC9, + MSG_CHAR_MENU_END = 0xCA, + // special character codes used when reading from the source buffer MSG_CHAR_READ_ENDL = 0xF0, MSG_CHAR_READ_WAIT = 0xF1, diff --git a/include/filemenu.h b/include/filemenu.h index b6477cb7cc..dcefa3f183 100644 --- a/include/filemenu.h +++ b/include/filemenu.h @@ -19,30 +19,38 @@ enum { FILE_MENU_CONFIRM = 1, // confirmation prompt is open FILE_MENU_MESSAGE = 2, // message is displayed, e.g. "File X has been deleted." FILE_MENU_INPUT_NAME = 3, // "Enter a file name!" screen + FILE_MENU_SELECT_LANG = 4, // PAL only }; enum { + // states for main menu FM_MAIN_SELECT_FILE = 0, // choose which file to load FM_MAIN_SELECT_DELETE, // choose which file to delete #if !VERSION_PAL - FM_MAIN_DUMMY_LANG_SELECT, + FM_MAIN_DUMMY_LANG_SELECT, // non-PAL versions have an unimplemented dummy language select #endif FM_MAIN_SELECT_COPY_FROM, FM_MAIN_SELECT_COPY_TO, FM_MAIN_PAL_LANG_SELECT, + // states for confirm submenu FM_CONFIRM_DELETE = 0, - FM_CONFIRM_CREATE, #if !VERSION_PAL - FM_CONFIRM_DUMMY, // order?? + FM_CONFIRM_DUMMY, #endif + FM_CONFIRM_CREATE, FM_CONFIRM_COPY, // unused FM_CONFIRM_START, + // states for message submenu FM_MESSAGE_DELETED = 0, +#if !VERSION_PAL + FM_MESSAGE_DUMMY, +#endif FM_MESSAGE_COPIED, FM_MESSAGE_CREATED, + // states for input submenu FM_INPUT_CHARSET_A = 0, FM_INPUT_CHARSET_B, }; diff --git a/include/functions.h b/include/functions.h index 40d14235cc..1bc2d29952 100644 --- a/include/functions.h +++ b/include/functions.h @@ -113,7 +113,7 @@ void pause_cleanup(void); void filemenu_init(s32 mode); void filemenu_cleanup(void); void filemenu_update(void); -s32 func_80244BC4(void); +s32 filemenu_get_exit_mode(void); void filemenu_set_selected(MenuPanel* menu, s32 col, s32 row); void filemenu_set_cursor_alpha(s32 arg0); void filemenu_set_cursor_goal_pos(s32 windowIndex, s32 posX, s32 posY); diff --git a/src/filemenu/filemenu_common.c b/src/filemenu/filemenu_common.c index 621108aec3..2ff913fcf7 100644 --- a/src/filemenu/filemenu_common.c +++ b/src/filemenu/filemenu_common.c @@ -1047,10 +1047,10 @@ void filemenu_init(s32 mode) { if (mode != 2) { filemenu_currentMenu = FILE_MENU_MAIN; menu = filemenu_menus[FILE_MENU_MAIN]; - menu->state = filemenu_currentMenu; + menu->state = FM_MAIN_SELECT_FILE; func_PAL_8002B574(); - if (menu->state == 0) { + if (menu->state == FM_MAIN_SELECT_FILE) { fio_load_globals(); if (gSaveGlobals.lastFileSelected >= 4) { gSaveGlobals.lastFileSelected = 0; @@ -1146,15 +1146,22 @@ void filemenu_cleanup(void) { set_window_update(WIN_PAUSE_TUTORIAL, WINDOW_UPDATE_HIDE); set_window_update(WIN_PAUSE_DECRIPTION, WINDOW_UPDATE_HIDE); - func_80244BC4(); + filemenu_get_exit_mode(); // part of a conditional that optimized out? } -s32 func_80244BC4() { - if (filemenu_menus[0]->state == 0 && filemenu_currentMenu == 1 && filemenu_menus[1]->selected == 0) { +s32 filemenu_get_exit_mode() { + if (filemenu_menus[FILE_MENU_MAIN]->state == FM_MAIN_SELECT_FILE + && filemenu_currentMenu == FILE_MENU_CONFIRM + && filemenu_menus[FILE_MENU_CONFIRM]->selected == 0 + ) { return 2; - } else if (filemenu_menus[0]->state == 0 && filemenu_menus[0]->selected < 4) { + } + + if (filemenu_menus[FILE_MENU_MAIN]->state == FM_MAIN_SELECT_FILE + && filemenu_menus[FILE_MENU_MAIN]->selected <= FM_MAIN_OPT_FILE_4 + ) { return 1; - } else { - return 0; } + + return 0; } diff --git a/src/filemenu/filemenu_createfile.c b/src/filemenu/filemenu_createfile.c index a0d55e73e1..9468b29dd9 100644 --- a/src/filemenu/filemenu_createfile.c +++ b/src/filemenu/filemenu_createfile.c @@ -118,7 +118,7 @@ void filemenu_draw_contents_file_create_header( } } - if (filemenu_currentMenu == 3) { + if (filemenu_currentMenu == FILE_MENU_INPUT_NAME) { if (filemenu_filename_pos == 8) { xOffset = temp_s2 + 86; } else { @@ -148,7 +148,7 @@ void filemenu_draw_contents_file_create_header( } tempAmt = 8; - if (filemenu_currentMenu == 3) { + if (filemenu_currentMenu == FILE_MENU_INPUT_NAME) { s32 phi_v0 = 122; if (filemenu_filename_pos != tempAmt) { @@ -221,7 +221,7 @@ void filemenu_draw_contents_choose_name( for (col = 0; col < menu->numCols; col++) { c = menu->gridData[page * menu->numCols * menu->numRows + menu->numCols * row + col]; - if (c != 0xF7) { + if (c != MSG_CHAR_READ_SPACE) { if (col == menu->col && row == menu->row) { flags = 8; color = 0; @@ -236,23 +236,23 @@ void filemenu_draw_contents_choose_name( #endif specialChar = c; if (c >= 0xA2 && c < 0xF0) { - if (c >= 0xC6) { + if (c >= MSG_CHAR_MENU_SPACE) { hud_element_set_render_pos(filemenu_createfile_HIDs[2], baseX + xOffset + 22, baseY + yOffset + 8); hud_element_draw_without_clipping(filemenu_createfile_HIDs[2]); flags = 0; } } - if (specialChar == 0xC6) { + if (specialChar == MSG_CHAR_MENU_SPACE) { xOffset--; } - if (specialChar == 0xC9) { + if (specialChar == MSG_CHAR_MENU_BACK) { #if VERSION_PAL xOffset += 16; #else xOffset += 5; #endif } - if (specialChar == 0xCA) { + if (specialChar == MSG_CHAR_MENU_END) { #if VERSION_PAL if (gCurrentLanguage == LANGUAGE_DE) { xOffset += 4; @@ -263,7 +263,7 @@ void filemenu_draw_contents_choose_name( xOffset += 8; #endif } - if (specialChar == 0xC6 || specialChar == 0xCA || specialChar == 0xC9) { + if (specialChar == MSG_CHAR_MENU_SPACE || specialChar == MSG_CHAR_MENU_END || specialChar == MSG_CHAR_MENU_BACK) { yOffset--; xNudge = 9; } @@ -281,7 +281,7 @@ void filemenu_draw_contents_choose_name( for (col = 0; col < menu->numCols; col++) { for (row = 0; row < menu->numRows; row++) { c = menu->gridData[menu->state * menu->numCols * menu->numRows + menu->numCols * row + col]; - if (c != 0xF7) { + if (c != MSG_CHAR_READ_SPACE) { if (col == menu->col && row == menu->row) { flags = 8; color = 0; @@ -296,19 +296,19 @@ void filemenu_draw_contents_choose_name( #endif specialChar = c; if (c >= 0xA2 && c < 0xF0) { - if (c >= 0xC6) { + if (c >= MSG_CHAR_MENU_SPACE) { hud_element_set_render_pos(filemenu_createfile_HIDs[2], baseX + xOffset + 22, baseY + yOffset + 8); hud_element_draw_without_clipping(filemenu_createfile_HIDs[2]); flags = 0; } } - if (specialChar == 0xC6) { + if (specialChar == MSG_CHAR_MENU_SPACE) { xOffset--; } - if (specialChar == 0xC9) { + if (specialChar == MSG_CHAR_MENU_BACK) { xOffset += FILEMENU_C9_OFFSET; } - if (specialChar == 0xCA) { + if (specialChar == MSG_CHAR_MENU_END) { #if VERSION_PAL if (gCurrentLanguage == LANGUAGE_DE) { xOffset += 4; @@ -319,7 +319,7 @@ void filemenu_draw_contents_choose_name( xOffset += 8; #endif } - if (specialChar == 0xC6 || specialChar == 0xCA || specialChar == 0xC9) { + if (specialChar == MSG_CHAR_MENU_SPACE || specialChar == MSG_CHAR_MENU_END || specialChar == MSG_CHAR_MENU_BACK) { yOffset--; xNudge = 9; } @@ -333,7 +333,7 @@ void filemenu_draw_contents_choose_name( } } - if (filemenu_currentMenu == 3) { + if (filemenu_currentMenu == FILE_MENU_INPUT_NAME) { if (filemenu_heldButtons & (BUTTON_STICK_RIGHT | BUTTON_STICK_LEFT | BUTTON_STICK_DOWN | BUTTON_STICK_UP)) { D_8024A18C = -4; } @@ -367,8 +367,6 @@ void filemenu_choose_name_init(MenuPanel* menu) { void filemenu_choose_name_handle_input(MenuPanel* menu) { s32 oldSelected = menu->selected; - MenuPanel* newMenu; - MenuPanel* newMenu2; s32 i; #if VERSION_PAL @@ -431,39 +429,42 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) { } if (filemenu_pressedButtons & BUTTON_A) { + MenuPanel* confirmMenu; + switch (menu->selected) { - case 0xC6: + case MSG_CHAR_MENU_SPACE: sfx_play_sound(SOUND_CREATE_FILE_SET_CHARACTER); if (filemenu_filename_pos == ARRAY_COUNT(filemenu_filename)) { filemenu_filename_pos = ARRAY_COUNT(filemenu_filename) - 1; } - filemenu_filename[filemenu_filename_pos] = 0xF7; + filemenu_filename[filemenu_filename_pos] = MSG_CHAR_READ_SPACE; filemenu_filename_pos++; if (filemenu_filename_pos > ARRAY_COUNT(filemenu_filename)) { filemenu_filename_pos = ARRAY_COUNT(filemenu_filename); } break; - case 0xC9: + case MSG_CHAR_MENU_BACK: + // handled later to combine with B-input detection break; - case 0xC7: - if (menu->state != 1) { + case MSG_CHAR_MENU_USE_CHARSET_B: + if (menu->state != FM_INPUT_CHARSET_B) { sfx_play_sound(SOUND_CREATE_FILE_CHANGE_CHARSET); - menu->state = 1; + menu->state = FM_INPUT_CHARSET_B; filemenu_set_selected(menu, menu->col, menu->row); set_window_update(WIN_FILES_INPUT_KEYBOARD, (s32)filemenu_update_change_layout); } break; - case 0xC8: - if (menu->state != 0) { + case MSG_CHAR_MENU_USE_CHARSET_A: + if (menu->state != FM_INPUT_CHARSET_A) { sfx_play_sound(SOUND_CREATE_FILE_CHANGE_CHARSET); - menu->state = 0; + menu->state = FM_INPUT_CHARSET_A; filemenu_set_selected(menu, menu->col, menu->row); set_window_update(WIN_FILES_INPUT_KEYBOARD, (s32)filemenu_update_change_layout); } break; - case 0xCA: + case MSG_CHAR_MENU_END: for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) { - if (filemenu_filename[i] != 0xF7) { + if (filemenu_filename[i] != MSG_CHAR_READ_SPACE) { break; } } @@ -490,10 +491,10 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) { gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); #endif - filemenu_currentMenu = 1; - newMenu = filemenu_menus[filemenu_currentMenu]; - newMenu->state = INPUT_FINAL_PAGE; - filemenu_set_selected(newMenu, 0, 0); + filemenu_currentMenu = FILE_MENU_CONFIRM; + confirmMenu = filemenu_menus[filemenu_currentMenu]; + confirmMenu->state = FM_CONFIRM_CREATE; + filemenu_set_selected(confirmMenu, 0, 0); return; default: sfx_play_sound(SOUND_CREATE_FILE_SET_CHARACTER); @@ -509,13 +510,16 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) { break; } - if (menu->selected != 0xC7 && menu->selected != 0xC8 && menu->selected != 0xC9 && - filemenu_filename_pos == ARRAY_COUNT(filemenu_filename)) { + if (menu->selected != MSG_CHAR_MENU_USE_CHARSET_A + && menu->selected != MSG_CHAR_MENU_USE_CHARSET_B + && menu->selected != MSG_CHAR_MENU_BACK + && filemenu_filename_pos == ARRAY_COUNT(filemenu_filename) + ) { filemenu_set_selected(menu, menu->numCols - 3, menu->numRows - 1); } } - if ((filemenu_pressedButtons & BUTTON_B) || ((filemenu_pressedButtons & BUTTON_A) && menu->selected == 0xC9)) { + if ((filemenu_pressedButtons & BUTTON_B) || ((filemenu_pressedButtons & BUTTON_A) && menu->selected == MSG_CHAR_MENU_BACK)) { sfx_play_sound(SOUND_CREATE_FILE_BACKSPACE); filemenu_filename_pos--; if (filemenu_filename_pos < 0) { @@ -538,13 +542,15 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) { } for (i = filemenu_filename_pos; i < ARRAY_COUNT(filemenu_filename); i++) { - filemenu_filename[i] = 0xF7; + filemenu_filename[i] = MSG_CHAR_READ_SPACE; } } if (filemenu_pressedButtons & BUTTON_START) { + MenuPanel* confirmMenu; + for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) { - if (filemenu_filename[i] != 0xF7) { + if (filemenu_filename[i] != MSG_CHAR_READ_SPACE) { break; } } @@ -573,15 +579,13 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) { gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); #endif - filemenu_currentMenu = 1; - newMenu2 = filemenu_menus[filemenu_currentMenu]; - newMenu2->state = INPUT_FINAL_PAGE; - filemenu_set_selected(newMenu2, 0, 0); + filemenu_currentMenu = FILE_MENU_CONFIRM; + confirmMenu = filemenu_menus[filemenu_currentMenu]; + confirmMenu->state = FM_CONFIRM_CREATE; + filemenu_set_selected(confirmMenu, 0, 0); } } -static const f32 padding[2] = { 0.0f, 0.0f }; // not sure why this is needed - void filemenu_choose_name_update(MenuPanel* menu) { } diff --git a/src/filemenu/filemenu_info.c b/src/filemenu/filemenu_info.c index 3ae2690ad3..5346380a6b 100644 --- a/src/filemenu/filemenu_info.c +++ b/src/filemenu/filemenu_info.c @@ -65,18 +65,17 @@ void filemenu_info_draw_message_contents( #if VERSION_PAL s32 xOffset; - // TODO figure out FILE_MESSAGE constants switch (menu->state) { - case 0: + case FM_MESSAGE_DELETED: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_28), baseX + 10, baseY + 4, 255, 0, 0); xOffset = D_filemenu_80250934[gCurrentLanguage] + 10; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + xOffset, baseY + 4, 255, 0, 0); xOffset += D_filemenu_802508FC[gCurrentLanguage]; - draw_number(filemenu_menus[0]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3); xOffset++; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_HAS_BEEN_DELETED), baseX + xOffset, baseY + 4, 255, 0, 0); break; - case 1: + case FM_MESSAGE_COPIED: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_COPY_FROM), baseX + 10, baseY + 4, 255, 0, 0); xOffset = D_filemenu_80250948[gCurrentLanguage] + 10; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + xOffset, baseY + 4, 255, 0, 0); @@ -90,24 +89,24 @@ void filemenu_info_draw_message_contents( xOffset += D_filemenu_80250950[gCurrentLanguage]; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_HAS_BEEN_CREATED), baseX + xOffset, baseY + 18, 255, 0, 0); break; - case 2: - filemenu_draw_message(filemenu_get_menu_message(0x20), baseX + 10, baseY + 4, 255, 0, 0); + case FM_MESSAGE_CREATED: + filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PAL_UNK2), baseX + 10, baseY + 4, 255, 0, 0); xOffset = D_filemenu_80250968[gCurrentLanguage] + 10; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + xOffset, baseY + 4, 255, 0, 0); xOffset += D_filemenu_802508FC[gCurrentLanguage]; - draw_number(filemenu_menus[0]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3); xOffset++; - filemenu_draw_message(filemenu_get_menu_message(0x1F), baseX + xOffset, baseY + 4, 255, 0, 0); + filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PAL_UNK1), baseX + xOffset, baseY + 4, 255, 0, 0); break; } #else switch (menu->state) { - case 0: + case FM_MESSAGE_DELETED: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + 10, baseY + 4, 255, 0, 0); - draw_number(filemenu_menus[0]->selected + 1, baseX + 48, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + 48, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_HAS_BEEN_DELETED), baseX + 49, baseY + 4, 255, 0, 0); break; - case 2: + case FM_MESSAGE_COPIED: #if VERSION_IQUE filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_COPY_FROM), baseX + 10, baseY + 7, 255, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + 42, baseY + 7, 255, 0, 0); @@ -126,12 +125,12 @@ void filemenu_info_draw_message_contents( filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_34), baseX + 65, baseY + 18, 255, 0, 0); #endif break; - case 1: + case FM_MESSAGE_DUMMY: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_28), baseX + 10, baseY + 4, 255, 0, 0); break; - case 3: + case FM_MESSAGE_CREATED: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + 10, baseY + 4, 255, 0, 0); - draw_number(filemenu_menus[0]->selected + 1, baseX + CREATE_SUCCESS_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + CREATE_SUCCESS_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_HAS_BEEN_CREATED), baseX + 49, baseY + 4, 255, 0, 0); break; } @@ -152,21 +151,21 @@ void filemenu_info_init(MenuPanel* tab) { void filemenu_info_handle_input(MenuPanel* menu) { if (filemenu_pressedButtons & (BUTTON_A | BUTTON_B)) { - MenuPanel* menu = filemenu_menus[0]; + MenuPanel* menu = filemenu_menus[FILE_MENU_MAIN]; filemenu_currentMenu = FILE_MENU_MAIN; switch (menu->state) { - case PAGE_1: - menu->state = PAGE_0; + case FM_MAIN_SELECT_DELETE: + menu->state = FM_MAIN_SELECT_FILE; set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); filemenu_set_selected(menu, 0, 2); break; - case PAGE_4: - menu->state = PAGE_0; + case FM_MAIN_SELECT_COPY_TO: + menu->state = FM_MAIN_SELECT_FILE; set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); @@ -174,8 +173,8 @@ void filemenu_info_handle_input(MenuPanel* menu) { filemenu_set_selected(menu, 1, 2); break; #if !VERSION_PAL - case PAGE_2: - menu->state = 2; + case FM_MAIN_DUMMY_LANG_SELECT: + menu->state = FM_MAIN_DUMMY_LANG_SELECT; filemenu_set_selected(menu, 1, 2); break; #endif diff --git a/src/filemenu/filemenu_main.c b/src/filemenu/filemenu_main.c index 6f1e13b1b8..2ac7cee0eb 100644 --- a/src/filemenu/filemenu_main.c +++ b/src/filemenu/filemenu_main.c @@ -350,28 +350,28 @@ void filemenu_draw_contents_title( s32 yOffset; switch (menu->state) { - case PAGE_0: + case FM_MAIN_SELECT_FILE: msgIdx = FILE_MESSAGE_SELECT_FILE_TO_START; xOffset = 9; yOffset = 4; break; - case PAGE_1: + case FM_MAIN_SELECT_DELETE: msgIdx = FILE_MESSAGE_SELECT_FILE_TO_DELETE; xOffset = DELETE_OFFSET_X; yOffset = 4; break; - case PAGE_3: + case FM_MAIN_SELECT_COPY_FROM: msgIdx = FILE_MESSAGE_COPY_WHICH_FILE; xOffset = SAVE_OFFSET_X; yOffset = 4; break; - case PAGE_4: + case FM_MAIN_SELECT_COPY_TO: msgIdx = FILE_MESSAGE_COPY_TO_WHICH_FILE; xOffset = COPY_OFFSET_X; yOffset = 4; break; #if !VERSION_PAL - case PAGE_2: + case FM_MAIN_DUMMY_LANG_SELECT: default: msgIdx = FILE_MESSAGE_SELECT_FILE_TO_SAVE; xOffset = 10; @@ -427,7 +427,7 @@ void filemenu_draw_contents_option_left( } filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_DELETE_FILE), baseX + offset + OFFSET_WIDTH, baseY + 2, 255, 0, 1); #else - if (menu->state != 2) { + if (menu->state != FM_MAIN_DUMMY_LANG_SELECT) { if (menu->col == 0 && menu->row == 2) { filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_LEFT, baseX, baseY + 8); } @@ -448,9 +448,9 @@ void filemenu_draw_contents_option_center( s32 yOffset; switch (menu->state) { - case 1: - case 2: - case 3: + case FM_MAIN_SELECT_DELETE: + case FM_MAIN_SELECT_COPY_FROM: + case FM_MAIN_SELECT_COPY_TO: msgIdx = FILE_MESSAGE_CANCEL; xOffset = D_filemenu_802508F4[gCurrentLanguage]; yOffset = 0; @@ -482,10 +482,10 @@ void filemenu_draw_contents_option_center( s32 yOffset; switch (menu->state) { - case 1: - case 2: - case 3: - case 4: + case FM_MAIN_SELECT_DELETE: + case FM_MAIN_DUMMY_LANG_SELECT: + case FM_MAIN_SELECT_COPY_FROM: + case FM_MAIN_SELECT_COPY_TO: msgIdx = FILE_MESSAGE_CANCEL; xOffset = CENTER_CANCEL_X; yOffset = 0; @@ -619,19 +619,19 @@ void filemenu_draw_contents_file_title( s32 width, s32 height, s32 opacity, s32 darkening) { - if (filemenu_currentMenu == 0 && menu->selected == fileIdx) { + if (filemenu_currentMenu == FILE_MENU_MAIN && menu->selected == fileIdx) { filemenu_set_cursor_goal_pos(fileIdx + 60, baseX - 3, baseY + 8); } filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OK), baseX + FILE_X, baseY + 1, 255, 0, 1); if (!gSaveSlotHasData[fileIdx]) { - filemenu_draw_message(filemenu_get_menu_message(fileIdx + FILE_MESSAGE_BASE_UNK), + filemenu_draw_message(filemenu_get_menu_message(fileIdx + FILE_MESSAGE_PAL_UNK3), baseX + D_filemenu_802508D0[gCurrentLanguage], baseY + 1, 255, 0, 1); } else { s32 tmp = D_filemenu_802508D0[gCurrentLanguage]; - filemenu_draw_message(filemenu_get_menu_message(fileIdx + FILE_MESSAGE_BASE_UNK), + filemenu_draw_message(filemenu_get_menu_message(fileIdx + FILE_MESSAGE_PAL_UNK3), baseX + tmp, baseY + 1, 255, 0, 1); tmp += D_filemenu_802508D4[gCurrentLanguage]; @@ -651,7 +651,7 @@ void filemenu_draw_contents_file_title( s32 width, s32 height, s32 opacity, s32 darkening) { - if (filemenu_currentMenu == 0 && menu->selected == fileIdx) { + if (filemenu_currentMenu == FILE_MENU_MAIN && menu->selected == fileIdx) { filemenu_set_cursor_goal_pos(fileIdx + 60, baseX - 3, baseY + 8); } @@ -761,7 +761,7 @@ void filemenu_main_init(MenuPanel* menu) { gWindows[WIN_FILES_TITLE].width = 162; gWindows[WIN_FILES_TITLE].height = 25; #else - if (menu->state == 2) { + if (menu->state == FM_MAIN_DUMMY_LANG_SELECT) { gWindows[WIN_FILES_TITLE].pos.y = 1; gWindows[WIN_FILES_TITLE].width = 211; gWindows[WIN_FILES_TITLE].height = 25; @@ -774,7 +774,7 @@ void filemenu_main_init(MenuPanel* menu) { gWindows[WIN_FILES_TITLE].pos.x = CENTER_WINDOW_X(WIN_FILES_TITLE); gWindows[WIN_FILES_OPTION_CENTER].pos.x = CENTER_WINDOW_X(WIN_FILES_OPTION_CENTER); - if (menu->state != 0) { + if (menu->state != FM_MAIN_SELECT_FILE) { set_window_update(WIN_FILES_OPTION_LEFT, WINDOW_UPDATE_HIDE); set_window_update(WIN_FILES_OPTION_RIGHT, WINDOW_UPDATE_HIDE); set_window_update(WIN_FILES_STEREO, WINDOW_UPDATE_HIDE); @@ -833,38 +833,47 @@ void filemenu_main_handle_input(MenuPanel* menu) { switch (menu->state) { case FM_MAIN_SELECT_FILE: + // force selection to column 0 when navigating up from bottom row if (menu->col == 1 && (u8) menu->row < 2) { menu->col = 0; } break; case FM_MAIN_SELECT_DELETE: // TODO required to duplicate cases 1-4 instead of using fallthrough + // force selection to column 0 when navigating up from bottom row if (menu->col == 1 && (u8) menu->row < 2) { menu->col = 0; } + // force selection to column 1 when navigating down to bottom row if (menu->row == 2) { menu->col = 1; } break; case FM_MAIN_DUMMY_LANG_SELECT: + // force selection to column 0 when navigating up from bottom row if (menu->col == 1 && (u8) menu->row < 2) { menu->col = 0; } + // force selection to column 1 when navigating down to bottom row if (menu->row == 2) { menu->col = 1; } break; case FM_MAIN_SELECT_COPY_FROM: + // force selection to column 0 when navigating up from bottom row if (menu->col == 1 && (u8) menu->row < 2) { menu->col = 0; } + // force selection to column 1 when navigating down to bottom row if (menu->row == 2) { menu->col = 1; } break; case FM_MAIN_SELECT_COPY_TO: + // force selection to column 0 when navigating up from bottom row if (menu->col == 1 && (u8) menu->row < 2) { menu->col = 0; } + // force selection to column 1 when navigating down to bottom row if (menu->row == 2) { menu->col = 1; } @@ -876,7 +885,7 @@ void filemenu_main_handle_input(MenuPanel* menu) { sfx_play_sound(SOUND_FILE_MENU_MOVE_CURSOR); } - if (menu->state == 0) { + if (menu->state == FM_MAIN_SELECT_FILE) { s32 originalOutputMode = gGameStatusPtr->soundOutputMode; if (filemenu_pressedButtons & BUTTON_Z) { @@ -896,7 +905,7 @@ void filemenu_main_handle_input(MenuPanel* menu) { } } - if ((filemenu_pressedButtons & BUTTON_START) && menu->state == 0 && menu->selected <= FM_MAIN_OPT_FILE_4) { + if ((filemenu_pressedButtons & BUTTON_START) && menu->state == FM_MAIN_SELECT_FILE && menu->selected <= FM_MAIN_OPT_FILE_4) { filemenu_pressedButtons = BUTTON_A; } @@ -910,6 +919,7 @@ void filemenu_main_handle_input(MenuPanel* menu) { } if (cond) { + // selected a file with no data MenuPanel* inputMenu; for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) { filemenu_filename[i] = MSG_CHAR_READ_SPACE; @@ -1074,8 +1084,8 @@ void filemenu_main_handle_input(MenuPanel* menu) { filemenu_iterFileIdx = menu->selected; if (!gSaveSlotHasData[menu->selected]) { sfx_play_sound(SOUND_MENU_NEXT); - filemenu_currentMenu = 2; - filemenu_menus[filemenu_currentMenu]->state = 2; + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[filemenu_currentMenu]->state = FM_MESSAGE_COPIED; gWindows[WIN_FILES_MESSAGE].width = 154; gWindows[WIN_FILES_MESSAGE].height = 39; gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); @@ -1088,7 +1098,7 @@ void filemenu_main_handle_input(MenuPanel* menu) { fio_save_game(filemenu_iterFileIdx); gSaveSlotHasData[filemenu_iterFileIdx] = TRUE; } else { - MenuPanel* temp_a0; + MenuPanel* confirmMenu; sfx_play_sound(SOUND_MENU_NEXT); set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_show_name_confirm); @@ -1102,30 +1112,32 @@ void filemenu_main_handle_input(MenuPanel* menu) { gWindows[WIN_FILES_CONFIRM_PROMPT].height = 39; gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); - filemenu_currentMenu = 1; - temp_a0 = filemenu_menus[filemenu_currentMenu]; - temp_a0->state = 3; - filemenu_set_selected(temp_a0, 0, 1); + filemenu_currentMenu = FILE_MENU_CONFIRM; + confirmMenu = filemenu_menus[filemenu_currentMenu]; + confirmMenu->state = FM_CONFIRM_COPY; + filemenu_set_selected(confirmMenu, 0, 1); } } } break; - case 2: - if (menu->selected == 6) { + case FM_MAIN_DUMMY_LANG_SELECT: + if (menu->selected == FM_MAIN_OPT_CANCEL) { + // selected "Cancel" button sfx_play_sound(SOUND_MENU_NEXT); set_game_mode(GAME_MODE_END_LANGUAGE_SELECT); - } else if (menu->selected < 4) { + } else if (menu->selected <= FM_MAIN_OPT_FILE_4) { + // selected a file if (!gSaveSlotHasData[menu->selected]) { sfx_play_sound(SOUND_MENU_NEXT); - filemenu_currentMenu = 2; - filemenu_menus[filemenu_currentMenu]->state = 1; + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[filemenu_currentMenu]->state = FM_MESSAGE_DUMMY; set_window_update(WIN_FILES_MAIN, (s32)main_menu_window_update); set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); set_window_update(WIN_FILES_CONFIRM_OPTIONS, WINDOW_UPDATE_HIDE); fio_save_game(menu->selected); gSaveSlotHasData[menu->selected] = TRUE; } else { - MenuPanel* temp_a0; + MenuPanel* confirmMenu; sfx_play_sound(SOUND_MENU_NEXT); set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_show_name_confirm); @@ -1139,10 +1151,10 @@ void filemenu_main_handle_input(MenuPanel* menu) { gWindows[WIN_FILES_CONFIRM_PROMPT].height = 38; gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); - filemenu_currentMenu = 1; - temp_a0 = filemenu_menus[filemenu_currentMenu]; - temp_a0->state = 1; - filemenu_set_selected(temp_a0, 0, 1); + filemenu_currentMenu = FILE_MENU_CONFIRM; + confirmMenu = filemenu_menus[filemenu_currentMenu]; + confirmMenu->state = FM_CONFIRM_DUMMY; + filemenu_set_selected(confirmMenu, 0, 1); } } break; @@ -1151,25 +1163,25 @@ void filemenu_main_handle_input(MenuPanel* menu) { if (filemenu_pressedButtons & BUTTON_B) { switch (menu->state) { - case 0: + case FM_MAIN_SELECT_FILE: filemenu_set_selected(menu, 2, 2); break; - case 1: + case FM_MAIN_SELECT_DELETE: filemenu_set_selected(menu, 1, 2); break; - case 2: + case FM_MAIN_DUMMY_LANG_SELECT: filemenu_set_selected(menu, 1, 2); break; - case 3: + case FM_MAIN_SELECT_COPY_FROM: filemenu_set_selected(menu, 1, 2); break; - case 4: + case FM_MAIN_SELECT_COPY_TO: filemenu_set_selected(menu, 1, 2); break; } switch (menu->state) { - case 0: + case FM_MAIN_SELECT_FILE: set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_hidden_options_left); set_window_update(WIN_FILES_MONO, (s32)filemenu_update_hidden_options_right); set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_hidden_options_bottom); @@ -1183,8 +1195,8 @@ void filemenu_main_handle_input(MenuPanel* menu) { sfx_play_sound(SOUND_FILE_MENU_OUT); set_game_mode(GAME_MODE_END_FILE_SELECT); break; - case 1: - menu->state = 0; + case FM_MAIN_SELECT_DELETE: + menu->state = FM_MAIN_SELECT_FILE; filemenu_set_selected(menu, 0, 2); set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); @@ -1192,8 +1204,8 @@ void filemenu_main_handle_input(MenuPanel* menu) { set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); sfx_play_sound(SOUND_MENU_BACK); break; - case 3: - menu->state = 0; + case FM_MAIN_SELECT_COPY_FROM: + menu->state = FM_MAIN_SELECT_FILE; filemenu_set_selected(menu, 1, 2); set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); @@ -1201,12 +1213,12 @@ void filemenu_main_handle_input(MenuPanel* menu) { set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); sfx_play_sound(SOUND_MENU_BACK); break; - case 4: - menu->state = 3; + case FM_MAIN_SELECT_COPY_TO: + menu->state = FM_MAIN_SELECT_COPY_FROM; filemenu_set_selected(menu, (filemenu_loadedFileIdx % 2) * 2, filemenu_loadedFileIdx / 2); sfx_play_sound(SOUND_MENU_BACK); break; - case 2: + case FM_MAIN_DUMMY_LANG_SELECT: sfx_play_sound(SOUND_MENU_BACK); set_game_mode(GAME_MODE_END_LANGUAGE_SELECT); break; @@ -1216,6 +1228,7 @@ void filemenu_main_handle_input(MenuPanel* menu) { #endif void filemenu_main_update(MenuPanel* menu) { + // set default styles for all file slot panels gWindowStyles[WIN_FILES_SLOT1_BODY].customStyle = &filemenu_windowStyles[15]; gWindowStyles[WIN_FILES_SLOT2_BODY].customStyle = &filemenu_windowStyles[15]; gWindowStyles[WIN_FILES_SLOT3_BODY].customStyle = &filemenu_windowStyles[15]; @@ -1225,40 +1238,42 @@ void filemenu_main_update(MenuPanel* menu) { gWindowStyles[WIN_FILES_SLOT3_TITLE].customStyle = &filemenu_windowStyles[17]; gWindowStyles[WIN_FILES_SLOT4_TITLE].customStyle = &filemenu_windowStyles[17]; + // modify style for selected file slot panel to add highlight switch (menu->selected) { - case 0: + case FM_MAIN_OPT_FILE_1: gWindowStyles[WIN_FILES_SLOT1_BODY].customStyle = &filemenu_windowStyles[16]; gWindowStyles[WIN_FILES_SLOT1_TITLE].customStyle = &filemenu_windowStyles[18]; break; - case 1: + case FM_MAIN_OPT_FILE_2: gWindowStyles[WIN_FILES_SLOT2_BODY].customStyle = &filemenu_windowStyles[16]; gWindowStyles[WIN_FILES_SLOT2_TITLE].customStyle = &filemenu_windowStyles[18]; break; - case 2: + case FM_MAIN_OPT_FILE_3: gWindowStyles[WIN_FILES_SLOT3_BODY].customStyle = &filemenu_windowStyles[16]; gWindowStyles[WIN_FILES_SLOT3_TITLE].customStyle = &filemenu_windowStyles[18]; break; - case 3: + case FM_MAIN_OPT_FILE_4: gWindowStyles[WIN_FILES_SLOT4_BODY].customStyle = &filemenu_windowStyles[16]; gWindowStyles[WIN_FILES_SLOT4_TITLE].customStyle = &filemenu_windowStyles[18]; break; } - if (filemenu_menus[0]->state == PAGE_4) { + // also add highlight to "copy to" target + if (filemenu_menus[FILE_MENU_MAIN]->state == FM_MAIN_SELECT_COPY_TO) { switch (filemenu_loadedFileIdx) { - case 0: + case FM_MAIN_OPT_FILE_1: gWindowStyles[WIN_FILES_SLOT1_BODY].customStyle = &filemenu_windowStyles[16]; gWindowStyles[WIN_FILES_SLOT1_TITLE].customStyle = &filemenu_windowStyles[18]; return; - case 1: + case FM_MAIN_OPT_FILE_2: gWindowStyles[WIN_FILES_SLOT2_BODY].customStyle = &filemenu_windowStyles[16]; gWindowStyles[WIN_FILES_SLOT2_TITLE].customStyle = &filemenu_windowStyles[18]; return; - case 2: + case FM_MAIN_OPT_FILE_3: gWindowStyles[WIN_FILES_SLOT3_BODY].customStyle = &filemenu_windowStyles[16]; gWindowStyles[WIN_FILES_SLOT3_TITLE].customStyle = &filemenu_windowStyles[18]; return; - case 3: + case FM_MAIN_OPT_FILE_4: gWindowStyles[WIN_FILES_SLOT4_BODY].customStyle = &filemenu_windowStyles[16]; gWindowStyles[WIN_FILES_SLOT4_TITLE].customStyle = &filemenu_windowStyles[18]; return; diff --git a/src/filemenu/filemenu_msg.c b/src/filemenu/filemenu_msg.c index 59c3f9551c..64b4d35546 100644 --- a/src/filemenu/filemenu_msg.c +++ b/src/filemenu/filemenu_msg.c @@ -589,21 +589,21 @@ s32 filemenu_draw_char(s32 c, s32 x, s32 y, s32 flag1, s32 color, s32 flag2) { } #endif - if (c == 0xF7) { + if (c == MSG_CHAR_READ_SPACE) { return charWidth - 6; } switch (c) { - case 0xF3: + case MSG_CHAR_READ_VARIANT0: filemenu_charset_raster_id = 0; break; - case 0xF4: + case MSG_CHAR_READ_VARIANT1: filemenu_charset_raster_id = 1; break; - case 0xF5: + case MSG_CHAR_READ_VARIANT2: filemenu_charset_raster_id = 2; break; - case 0xF6: + case MSG_CHAR_READ_VARIANT3: filemenu_charset_raster_id = 3; break; } @@ -637,7 +637,7 @@ void filemenu_draw_message(u8* message, s32 x, s32 y, s32 alpha, s32 color, u32 u8* tmp; filemenu_draw_char(0xF3, x, y, flag1, color, flag2); tmp = message; - while (*tmp != 0xFD) { + while (*tmp != MSG_CHAR_READ_END) { #if VERSION_IQUE int ord = *tmp; if (ord >= MSG_CHAR_MULTIBYTE_FIRST && ord <= MSG_CHAR_MULTIBYTE_LAST) { @@ -671,7 +671,7 @@ void filemenu_draw_file_name(u8* filename, s32 length, s32 x, s32 y, s32 alpha, for (i = 0; i < length; i++) { u32 c = filename[i]; - if (c != 0xF7) { + if (c != MSG_CHAR_READ_SPACE) { #if VERSION_IQUE // Numerals get drawn one pixel lower than other characters if (c >= MSG_CHAR_DIGIT_0 && c <= MSG_CHAR_DIGIT_9) { diff --git a/src/filemenu/filemenu_selectlanguage.c b/src/filemenu/filemenu_selectlanguage.c index 6c0d72bb0d..161e278faa 100644 --- a/src/filemenu/filemenu_selectlanguage.c +++ b/src/filemenu/filemenu_selectlanguage.c @@ -158,7 +158,7 @@ void filemenu_draw_pal_8024d6a0(MenuPanel* menu, s32 baseX, s32 baseY, s32 width void func_filemenu_8024D710(s32 arg0, MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { s32 var_a1; - if (filemenu_currentMenu == 4 && menu->selected == arg0) { + if (filemenu_currentMenu == FILE_MENU_SELECT_LANG && menu->selected == arg0) { filemenu_set_cursor_goal_pos(arg0 + 60, baseX + 4, baseY + 10); } diff --git a/src/filemenu/filemenu_yesno.c b/src/filemenu/filemenu_yesno.c index c8fda550bc..1013314072 100644 --- a/src/filemenu/filemenu_yesno.c +++ b/src/filemenu/filemenu_yesno.c @@ -29,12 +29,12 @@ u8 filemenu_yesno_gridData[] = { 0, 1, +#if !VERSION_PAL + 0, 1, +#endif 0, 1, 0, 1, 0, 1, -#if !VERSION_PAL - 0, 1 -#endif }; MenuWindowBP filemenu_yesno_windowBPs[] = { @@ -98,44 +98,44 @@ void filemenu_yesno_draw_options_contents( s32 cursorGoalYOffset; switch (menu->state) { - case 0: + case FM_CONFIRM_DELETE: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; yOffset2 = 21; break; - case 1: +#if !VERSION_PAL + case FM_CONFIRM_DUMMY: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; yOffset2 = 21; break; - case 2: +#endif + case FM_CONFIRM_CREATE: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; yOffset2 = 21; break; - case 3: + case FM_CONFIRM_COPY: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; yOffset2 = 21; break; -#if !VERSION_PAL - case 4: + case FM_CONFIRM_START: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; yOffset2 = 21; break; -#endif } filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_YES), baseX + xOffset1, baseY + yOffset1, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_NO), baseX + xOffset2, baseY + yOffset2, 0xFF, 0, 0); - if (filemenu_currentMenu == 1) { + if (filemenu_currentMenu == FILE_MENU_CONFIRM) { if (menu->selected == 0) { cursorGoalXOffset = xOffset1 - 10; cursorGoalYOffset = yOffset1 + 8; @@ -160,26 +160,26 @@ void filemenu_yesno_draw_prompt_contents( s32 i; switch (menu->state) { - case 0: + case FM_CONFIRM_DELETE: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_DELETE), baseX + DELETE_FILE_DELETE_X, baseY + 4, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_22), baseX + DELETE_FILE_FILE_X, baseY + 4, 0xFF, 0, 0); - draw_number(filemenu_menus[0]->selected + 1, baseX + DELETE_FILE_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + DELETE_FILE_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_QUESTION), baseX + DELETE_FILE_QMARK_X, baseY + 4, 0xFF, 0, 0); break; - case 3: + case FM_CONFIRM_COPY: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_22), baseX + 10, baseY + 4, 0xFF, 0, 0); - draw_number(filemenu_menus[0]->selected + 1, baseX + COPY_FILE_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + COPY_FILE_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_WILL_BE_DELETED), baseX + 49, baseY + 4, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OK_TO_COPY_TO_THIS_FILE), baseX + 10, baseY + 18, 0xFF, 0, 0); break; - case 1: + case FM_CONFIRM_DUMMY: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OVERRIDE_TO_NEW_DATA), baseX + 10, baseY + 4, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_SAVE_OK), baseX + 10, baseY + 18, 0xFF, 0, 0); break; - case 2: + case FM_CONFIRM_CREATE: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_NAME_IS), baseX + 10, baseY + 6, 0xFF, 0, 0); for (i = ARRAY_COUNT(filemenu_filename) - 1; i >= 0; i--) { - if (filemenu_filename[i] != 0xF7) { + if (filemenu_filename[i] != MSG_CHAR_READ_SPACE) { break; } } @@ -190,10 +190,10 @@ void filemenu_yesno_draw_prompt_contents( filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_20), baseX + xOffset, baseY + 22, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OK), baseX + 70, baseY + 38, 0xFF, 0, 0); break; - case 4: + case FM_CONFIRM_START: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_START_GAME_WITH), baseX + START_GAME_START_WITH_X, baseY + 4, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_22), baseX + START_GAME_FILE_X, baseY + 4, 0xFF, 0, 0); - draw_number(filemenu_menus[0]->selected + 1, baseX + START_GAME_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + START_GAME_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_QUESTION), baseX + START_GAME_QMARK_X, baseY + 4, 0xFF, 0, 0); break; } @@ -237,7 +237,7 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { sfx_play_sound(SOUND_MENU_CHANGE_SELECTION); } - if ((filemenu_pressedButtons & BUTTON_START) && menu->state == 4) { + if ((filemenu_pressedButtons & BUTTON_START) && menu->state == FM_CONFIRM_START) { filemenu_set_selected(menu, 0, 0); filemenu_pressedButtons = BUTTON_A; } @@ -252,11 +252,11 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { sfx_play_sound(SOUND_MENU_NEXT); switch (menu->selected) { - case 0: + case 0: // YES switch (menu->state) { - case 0: - filemenu_currentMenu = 2; - filemenu_menus[filemenu_currentMenu]->state = 0; + case FM_CONFIRM_DELETE: + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[FILE_MENU_MESSAGE]->state = FM_MESSAGE_DELETED; gWindows[WIN_FILES_MESSAGE].width = 182; gWindows[WIN_FILES_MESSAGE].height = 25; gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); @@ -264,9 +264,9 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); - slot = filemenu_menus[0]->selected; + slot = filemenu_menus[FILE_MENU_MAIN]->selected; for (i = 0; i < ARRAY_COUNT(gSaveSlotMetadata->filename); i++) { - gSaveSlotMetadata[slot].filename[i] = 0xF7; + gSaveSlotMetadata[slot].filename[i] = MSG_CHAR_READ_SPACE; } gSaveSlotMetadata[slot].level = 0; gSaveSlotMetadata[slot].timePlayed = 0; @@ -274,9 +274,9 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { fio_erase_game(slot); gSaveSlotHasData[slot] = FALSE; break; - case 3: - filemenu_currentMenu = 2; - filemenu_menus[filemenu_currentMenu]->state = 2; + case FM_CONFIRM_COPY: + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[filemenu_currentMenu]->state = FM_MESSAGE_COPIED; gWindows[WIN_FILES_MESSAGE].width = 154; gWindows[WIN_FILES_MESSAGE].height = 39; gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); @@ -288,20 +288,20 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { fio_save_game(filemenu_iterFileIdx); gSaveSlotHasData[filemenu_iterFileIdx] = TRUE; break; - case 1: - filemenu_currentMenu = 2; - filemenu_menus[filemenu_currentMenu]->state = 1; + case FM_CONFIRM_DUMMY: + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[filemenu_currentMenu]->state = FM_MESSAGE_DUMMY; gWindows[WIN_FILES_MESSAGE].width = 153; gWindows[WIN_FILES_MESSAGE].height = 25; gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); gWindows[WIN_FILES_MESSAGE].pos.y = CENTER_WINDOW_Y(WIN_FILES_MESSAGE); set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); - gSaveSlotMetadata[filemenu_menus[0]->selected] = gSaveSlotMetadata[gGameStatusPtr->saveSlot]; - fio_save_game(filemenu_menus[0]->selected); - gSaveSlotHasData[filemenu_menus[0]->selected] = TRUE; + gSaveSlotMetadata[filemenu_menus[FILE_MENU_MAIN]->selected] = gSaveSlotMetadata[gGameStatusPtr->saveSlot]; + fio_save_game(filemenu_menus[FILE_MENU_MAIN]->selected); + gSaveSlotHasData[filemenu_menus[FILE_MENU_MAIN]->selected] = TRUE; break; - case 2: + case FM_CONFIRM_CREATE: clear_player_data(); clear_saved_variables(); gGameStatusPtr->areaID = AREA_KMR; @@ -309,7 +309,7 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { gGameStatusPtr->entryID = 0; evt_set_variable(NULL, GB_StoryProgress, STORY_INTRO); - slot2 = filemenu_menus[0]->selected; + slot2 = filemenu_menus[FILE_MENU_MAIN]->selected; for (i = 0; i < ARRAY_COUNT(gSaveSlotMetadata->filename); i++) { gSaveSlotMetadata[slot2].filename[i] = filemenu_filename[i]; } @@ -329,16 +329,16 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { set_window_update(WIN_FILES_SLOT3_BODY, (s32)filemenu_update_show_with_rotation); set_window_update(WIN_FILES_SLOT4_BODY, (s32)filemenu_update_show_with_rotation); set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); - filemenu_currentMenu = 2; - filemenu_menus[2]->state = 3; + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[FILE_MENU_MESSAGE]->state = FM_MESSAGE_CREATED; gWindows[WIN_FILES_MESSAGE].width = 184; gWindows[WIN_FILES_MESSAGE].height = 25; gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); gWindows[WIN_FILES_MESSAGE].pos.y = CENTER_WINDOW_Y(WIN_FILES_MESSAGE); set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); break; - case 4: - slot3 = filemenu_menus[0]->selected; + case FM_CONFIRM_START: + slot3 = filemenu_menus[FILE_MENU_MAIN]->selected; if (gGameStatusPtr->soundOutputMode != 1 - gSaveGlobals.useMonoSound || slot3 != (u8)gSaveGlobals.lastFileSelected) { @@ -351,21 +351,21 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { break; } break; - case 1: + case 1: // NO switch (menu->state) { - case 0: - case 1: - case 3: + case FM_CONFIRM_DELETE: + case FM_CONFIRM_DUMMY: + case FM_CONFIRM_COPY: filemenu_currentMenu = FILE_MENU_MAIN; set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); break; - case 2: - filemenu_currentMenu = 3; + case FM_CONFIRM_CREATE: + filemenu_currentMenu = FILE_MENU_INPUT_NAME; set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); break; - case 4: + case FM_CONFIRM_START: filemenu_currentMenu = FILE_MENU_MAIN; - slot4 = filemenu_menus[0]->selected; + slot4 = filemenu_menus[FILE_MENU_MAIN]->selected; set_window_update(WIN_FILES_TITLE, (s32)filemenu_update_show_with_rotation); set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_with_rotation); set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_with_rotation); @@ -392,19 +392,19 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { filemenu_set_selected(menu, 0, 1); switch (menu->state) { - case 0: - case 1: - case 3: + case FM_CONFIRM_DELETE: + case FM_CONFIRM_DUMMY: + case FM_CONFIRM_COPY: filemenu_currentMenu = FILE_MENU_MAIN; set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); break; - case 2: - filemenu_currentMenu = 3; + case FM_CONFIRM_CREATE: + filemenu_currentMenu = FILE_MENU_INPUT_NAME; set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); break; - case 4: + case FM_CONFIRM_START: filemenu_currentMenu = FILE_MENU_MAIN; - slot = filemenu_menus[0]->selected; + slot = filemenu_menus[FILE_MENU_MAIN]->selected; set_window_update(WIN_FILES_TITLE, (s32)filemenu_update_show_with_rotation); set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_with_rotation); set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_with_rotation); diff --git a/src/state_file_select.c b/src/state_file_select.c index 41a92db195..187c8de65c 100644 --- a/src/state_file_select.c +++ b/src/state_file_select.c @@ -232,7 +232,7 @@ void state_init_exit_file_select(void) { D_800A0932[0] = 0; D_800A0930 = 0; - if (func_80244BC4() == 0) { + if (filemenu_get_exit_mode() == 0) { set_map_transition_effect(TRANSITION_SLOW_FADE_TO_WHITE); } else { set_map_transition_effect(TRANSITION_ENTER_WORLD); @@ -377,7 +377,7 @@ void state_step_exit_language_select(void) { } void state_step_exit_file_select(void) { - s32 temp_s0 = func_80244BC4(); + s32 exitMode = filemenu_get_exit_mode(); s32 flagSum; s32 i; @@ -398,7 +398,7 @@ void state_step_exit_file_select(void) { } break; case 1: - if (temp_s0 == 0 || update_exit_map_screen_overlay(D_800A0932) != 0) { + if (exitMode == 0 || update_exit_map_screen_overlay(D_800A0932) != 0) { D_800A0931 = 2; } break; @@ -408,7 +408,7 @@ void state_step_exit_file_select(void) { D_800A0931 = 3; case 3: set_time_freeze_mode(TIME_FREEZE_NONE); - if (temp_s0 == 0) { + if (exitMode == 0) { set_game_mode(GAME_MODE_TITLE_SCREEN); gOverrideFlags &= ~GLOBAL_OVERRIDES_WINDOWS_OVER_CURTAINS; } else { diff --git a/ver/jp/undefined_syms.txt b/ver/jp/undefined_syms.txt index b8662dd93f..f8b5d6393d 100644 --- a/ver/jp/undefined_syms.txt +++ b/ver/jp/undefined_syms.txt @@ -65,7 +65,7 @@ pause_handle_input = 0x80243BF4; pause_cleanup = 0x80243EC4; filemenu_init = 0x802440B0; filemenu_cleanup = 0x802442D0; -func_80244BC4 = 0x80244394; +filemenu_get_exit_mode = 0x80244394; heap_collisionHead = 0x80268000; shim_create_audio_system_obfuscated = 0x802B2000; shim_load_engine_data_obfuscated = 0x802B203C; diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index e125149f9e..8b4ce20a6c 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -6343,7 +6343,7 @@ filemenu_draw_cursor = 0x80244030; // type:func rom:0x164890 filemenu_draw_contents_copy_arrow = 0x802440BC; // type:func rom:0x16491C filemenu_init = 0x802448E0; // type:func rom:0x165140 filemenu_cleanup = 0x80244B00; // type:func rom:0x165360 -func_80244BC4 = 0x80244BC4; // type:func rom:0x165424 +filemenu_get_exit_mode = 0x80244BC4; // type:func rom:0x165424 filemenu_draw_contents_title = 0x80244C30; // type:func rom:0x165490 filemenu_draw_contents_stereo = 0x80244CEC; // type:func rom:0x16554C filemenu_draw_contents_mono = 0x80244D60; // type:func rom:0x1655C0