diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index ef55e5e0e5..3f7a387335 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -502,18 +502,6 @@ static int menu_start_screen_iterate(unsigned action) return 0; } -static void menu_common_setting_push_current_menu(file_list_t *list, - const char *path, const char *label, unsigned type, - size_t directory_ptr, unsigned action) -{ - if (action == MENU_ACTION_OK) - { - file_list_push(list, path, label, type, directory_ptr); - menu_clear_navigation(driver.menu); - driver.menu->need_refresh = true; - } -} - static int menu_common_core_setting_toggle(unsigned setting, unsigned action) { unsigned index = setting - MENU_SETTINGS_CORE_OPTION_START; @@ -552,7 +540,7 @@ static void defer_decision_automatic(void) static void defer_decision_manual(void) { if (driver.menu) - menu_common_setting_push_current_menu(driver.menu->menu_stack, + menu_entries_push(driver.menu->menu_stack, g_settings.libretro_directory, "deferred_core_list", MENU_SETTINGS_DEFERRED_CORE, driver.menu->selection_ptr, MENU_ACTION_OK); @@ -614,7 +602,7 @@ static void menu_common_setting_set_current_path_selection( switch (action) { case MENU_ACTION_OK: - menu_common_setting_push_current_menu(driver.menu->menu_stack, + menu_entries_push(driver.menu->menu_stack, start_path, "path_list", type, driver.menu->selection_ptr, action); break; @@ -1356,19 +1344,19 @@ static int menu_settings_iterate(unsigned action) && action == MENU_ACTION_OK) { driver.menu->defer_core = (!strcmp(label, "detect_core_list")); - menu_common_setting_push_current_menu(driver.menu->menu_stack, + menu_entries_push(driver.menu->menu_stack, g_settings.menu_content_directory, "", MENU_FILE_DIRECTORY, driver.menu->selection_ptr, action); } else if ((!strcmp(label, "history_list") || menu_common_type_is(type) == MENU_FILE_DIRECTORY) && action == MENU_ACTION_OK) - menu_common_setting_push_current_menu(driver.menu->menu_stack, + menu_entries_push(driver.menu->menu_stack, "", "", type, driver.menu->selection_ptr, action); else if ((menu_common_type_is(type) == MENU_SETTINGS || type == MENU_SETTINGS_CORE || type == MENU_SETTINGS_CONFIG || type == MENU_SETTINGS_DISK_APPEND) && action == MENU_ACTION_OK) - menu_common_setting_push_current_menu(driver.menu->menu_stack, + menu_entries_push(driver.menu->menu_stack, dir ? dir : label, "", type, driver.menu->selection_ptr, action); else if (type == MENU_SETTINGS_CUSTOM_VIEWPORT && action == MENU_ACTION_OK) @@ -1416,7 +1404,7 @@ static int menu_settings_iterate(unsigned action) if (driver.menu->need_refresh && (menu_parse_check(menu_type) == -1)) { driver.menu->need_refresh = false; - menu_entries_push(driver.menu, path, label, menu_type); + menu_entries_push_list(driver.menu, path, label, menu_type); } if (driver.menu_ctx && driver.menu_ctx->render) @@ -1711,7 +1699,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) char cat_path[PATH_MAX]; fill_pathname_join(cat_path, dir, path, sizeof(cat_path)); - menu_common_setting_push_current_menu(driver.menu->menu_stack, + menu_entries_push(driver.menu->menu_stack, cat_path, "browser_list", type, driver.menu->selection_ptr, MENU_ACTION_OK); } diff --git a/frontend/menu/backend/menu_common_shader_backend.c b/frontend/menu/backend/menu_common_shader_backend.c index 8f5e8fad93..519243c79d 100644 --- a/frontend/menu/backend/menu_common_shader_backend.c +++ b/frontend/menu/backend/menu_common_shader_backend.c @@ -312,7 +312,7 @@ static int menu_common_shader_manager_setting_toggle(unsigned id, unsigned actio } else if ((id == MENU_SETTINGS_SHADER_PARAMETERS || id == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)) - menu_common_setting_push_current_menu(driver.menu->menu_stack, "", + menu_entries_push(driver.menu->menu_stack, "", "shader_parameters", id, driver.menu->selection_ptr, action); else if (id >= MENU_SETTINGS_SHADER_PARAMETER_0 && id <= MENU_SETTINGS_SHADER_PARAMETER_LAST) { @@ -359,7 +359,7 @@ static int menu_common_shader_manager_setting_toggle(unsigned id, unsigned actio switch (action) { case MENU_ACTION_OK: - menu_common_setting_push_current_menu(driver.menu->menu_stack, + menu_entries_push(driver.menu->menu_stack, g_settings.video.shader_dir, "video_shader_preset", id, driver.menu->selection_ptr, action); break; diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index e416a74fd8..98471adb7e 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -273,7 +273,7 @@ void *menu_init(const void *data) menu->push_start_screen = g_settings.menu_show_start_screen; g_settings.menu_show_start_screen = false; - menu_entries_push(menu, "", "mainmenu", 0); + menu_entries_push_list(menu, "", "mainmenu", 0); menu->trigger_state = 0; menu->old_input_state = 0; diff --git a/frontend/menu/menu_entries.c b/frontend/menu/menu_entries.c index 78f5956de0..130f580484 100644 --- a/frontend/menu/menu_entries.c +++ b/frontend/menu/menu_entries.c @@ -78,7 +78,7 @@ void menu_entries_pop(void) } } -int menu_entries_push(menu_handle_t *menu, +int menu_entries_push_list(menu_handle_t *menu, const char *path, const char *label, unsigned menu_type) { @@ -596,7 +596,7 @@ int menu_parse_and_resolve(void) menu_type == MENU_SETTINGS_DEFERRED_CORE || menu_type == MENU_SETTINGS_OPEN_HISTORY ) - return menu_entries_push(driver.menu, dir, label, menu_type); + return menu_entries_push_list(driver.menu, dir, label, menu_type); if (menu_parse_check(menu_type) == -1) return - 1; @@ -764,7 +764,7 @@ int menu_parse_and_resolve(void) is_dir ? menu_type : MENU_FILE_PLAIN, 0); } - menu_entries_push(driver.menu, dir, label, menu_type); + menu_entries_push_list(driver.menu, dir, label, menu_type); string_list_free(str_list); switch (menu_type) @@ -829,3 +829,15 @@ void menu_flush_stack_type(unsigned final_type) file_list_get_last(driver.menu->menu_stack, &path, &label, &type); } } + +void menu_entries_push(file_list_t *list, + const char *path, const char *label, unsigned type, + size_t directory_ptr, unsigned action) +{ + if (action == MENU_ACTION_OK) + { + file_list_push(list, path, label, type, directory_ptr); + menu_clear_navigation(driver.menu); + driver.menu->need_refresh = true; + } +} diff --git a/frontend/menu/menu_entries.h b/frontend/menu/menu_entries.h index 446acb847a..1b61f970f7 100644 --- a/frontend/menu/menu_entries.h +++ b/frontend/menu/menu_entries.h @@ -19,7 +19,10 @@ #include "menu_common.h" -int menu_entries_push(menu_handle_t *menu, const char *path, +void menu_entries_push(file_list_t *list, + const char *path, const char *label, unsigned type, + size_t directory_ptr, unsigned action); +int menu_entries_push_list(menu_handle_t *menu, const char *path, const char *label, unsigned menu_type); void menu_entries_push_info(void); int menu_parse_check(unsigned menu_type);