diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index 258d1b8fc0..2684658258 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -438,7 +438,7 @@ static int menu_info_screen_iterate(unsigned action) } if (action == MENU_ACTION_OK) - menu_entries_pop(); + menu_entries_pop(driver.menu->menu_stack); return 0; } @@ -505,7 +505,7 @@ static int menu_start_screen_iterate(unsigned action) driver.menu_ctx->render_messagebox(msg); if (action == MENU_ACTION_OK) - menu_entries_pop(); + menu_entries_pop(driver.menu->menu_stack); return 0; } @@ -1437,7 +1437,7 @@ static int menu_settings_iterate(unsigned action) break; case MENU_ACTION_CANCEL: - menu_entries_pop(); + menu_entries_pop(driver.menu->menu_stack); break; case MENU_ACTION_SELECT: file_list_push(driver.menu->menu_stack, "", "info_screen", @@ -1571,7 +1571,7 @@ static int menu_viewport_iterate(unsigned action) break; case MENU_ACTION_CANCEL: - menu_entries_pop(); + menu_entries_pop(driver.menu->menu_stack); if (!strcmp(label, "custom_viewport_2")) { file_list_push(driver.menu->menu_stack, "", "", @@ -1581,7 +1581,7 @@ static int menu_viewport_iterate(unsigned action) break; case MENU_ACTION_OK: - menu_entries_pop(); + menu_entries_pop(driver.menu->menu_stack); if (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT && !g_settings.video.scale_integer) { @@ -1704,7 +1704,7 @@ static int menu_custom_bind_iterate(void *data, unsigned action) if (binds.begin <= binds.last) binds.target++; else - menu_entries_pop(); + menu_entries_pop(driver.menu->menu_stack); /* Avoid new binds triggering things right away. */ menu->trigger_state = 0; @@ -1751,7 +1751,7 @@ static int menu_custom_bind_iterate_keyboard(void *data, unsigned action) /* binds.begin is updated in keyboard_press callback. */ if (menu->binds.begin > menu->binds.last) { - menu_entries_pop(); + menu_entries_pop(driver.menu->menu_stack); /* Avoid new binds triggering things right away. */ menu->trigger_state = 0; @@ -1818,7 +1818,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) } /* Pop stack until we hit shader manager again. */ - menu_flush_stack_type(MENU_SETTINGS_SHADER_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_SHADER_OPTIONS); } else #endif @@ -1829,7 +1829,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) sizeof(g_extern.fullpath)); rarch_main_command(RARCH_CMD_LOAD_CONTENT); driver.menu->msg_force = true; - menu_flush_stack_type(MENU_SETTINGS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS); return -1; } else if (menu_type == MENU_SETTINGS_CORE) @@ -1837,7 +1837,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) fill_pathname_join(g_settings.libretro, dir, path, sizeof(g_settings.libretro)); rarch_main_command(RARCH_CMD_LOAD_CORE); - menu_flush_stack_type(MENU_SETTINGS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS); #if defined(HAVE_DYNAMIC) /* No content needed for this core, load core immediately. */ if (driver.menu->load_no_content) @@ -1859,7 +1859,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) { char config[PATH_MAX]; fill_pathname_join(config, dir, path, sizeof(config)); - menu_flush_stack_type(MENU_SETTINGS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS); driver.menu->msg_force = true; if (menu_replace_config(config)) { @@ -1873,7 +1873,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "input_overlay"))) menu_common_setting_set_current_string_path(setting, dir, path); - menu_flush_stack_type(MENU_SETTINGS_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_OPTIONS); } else if (menu_type == MENU_SETTINGS_DISK_APPEND) { @@ -1883,13 +1883,13 @@ static int menu_action_ok(const char *dir, unsigned menu_type) g_extern.lifecycle_state |= 1ULL << MODE_GAME; - menu_flush_stack_type(MENU_SETTINGS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS); return -1; } else if (menu_type == MENU_SETTINGS_OPEN_HISTORY) { load_menu_content_history(driver.menu->selection_ptr); - menu_flush_stack_type(MENU_SETTINGS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS); return -1; } else if (menu_type == MENU_CONTENT_HISTORY_PATH) @@ -1898,7 +1898,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "game_history_path"))) menu_common_setting_set_current_string_path(setting, dir, path); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_BROWSER_DIR_PATH) { @@ -1906,7 +1906,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "rgui_browser_directory"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_CONTENT_DIR_PATH) { @@ -1914,7 +1914,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "content_directory"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_ASSETS_DIR_PATH) { @@ -1922,7 +1922,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "assets_directory"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_SCREENSHOT_DIR_PATH) { @@ -1930,21 +1930,21 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "screenshot_directory"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_SAVEFILE_DIR_PATH) { if ((setting = (rarch_setting_t*)setting_data_find_setting( setting_data, "savefile_directory"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_OVERLAY_DIR_PATH) { if ((setting = (rarch_setting_t*)setting_data_find_setting( setting_data, "overlay_directory"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER) { @@ -1952,14 +1952,14 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "video_filter"))) menu_common_setting_set_current_string_path(setting, dir, path); - menu_flush_stack_type(MENU_SETTINGS_VIDEO_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_VIDEO_OPTIONS); } else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER) { if ((setting = (rarch_setting_t*)setting_data_find_setting( setting_data, "audio_dsp_plugin"))) menu_common_setting_set_current_string_path(setting, dir, path); - menu_flush_stack_type(MENU_SETTINGS_AUDIO_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_AUDIO_OPTIONS); } else if (menu_type == MENU_SAVESTATE_DIR_PATH) { @@ -1967,7 +1967,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "savestate_directory"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_LIBRETRO_DIR_PATH) { @@ -1975,7 +1975,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "libretro_dir_path"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_CONFIG_DIR_PATH) { @@ -1983,7 +1983,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "rgui_config_directory"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_LIBRETRO_INFO_DIR_PATH) { @@ -1991,7 +1991,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "libretro_info_path"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_SHADER_DIR_PATH) { @@ -1999,7 +1999,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "video_shader_dir"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_FILTER_DIR_PATH) { @@ -2007,7 +2007,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "video_filter_dir"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_DSP_FILTER_DIR_PATH) { @@ -2015,7 +2015,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "audio_filter_dir"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_SYSTEM_DIR_PATH) { @@ -2023,7 +2023,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "system_directory"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_AUTOCONFIG_DIR_PATH) { @@ -2031,7 +2031,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "joypad_autoconfig_dir"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else if (menu_type == MENU_EXTRACTION_DIR_PATH) { @@ -2039,7 +2039,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) setting_data, "extraction_directory"))) menu_common_setting_set_current_string(setting, dir); - menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS_PATH_OPTIONS); } else { @@ -2052,7 +2052,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) if (ret == -1) { rarch_main_command(RARCH_CMD_LOAD_CORE); - menu_flush_stack_type(MENU_SETTINGS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS); driver.menu->msg_force = true; return -1; } @@ -2067,7 +2067,7 @@ static int menu_action_ok(const char *dir, unsigned menu_type) sizeof(g_extern.fullpath)); g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME); - menu_flush_stack_type(MENU_SETTINGS); + menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS); driver.menu->msg_force = true; return -1; } @@ -2158,7 +2158,7 @@ static int menu_common_iterate(unsigned action) break; case MENU_ACTION_CANCEL: - menu_entries_pop(); + menu_entries_pop(driver.menu->menu_stack); break; case MENU_ACTION_OK: @@ -2180,7 +2180,8 @@ static int menu_common_iterate(unsigned action) if (driver.menu->need_refresh) { - if (menu_parse_and_resolve(driver.menu->selection_buf) == 0) + if (menu_parse_and_resolve(driver.menu->selection_buf, + driver.menu->menu_stack) == 0) driver.menu->need_refresh = false; } diff --git a/frontend/menu/menu_common.h b/frontend/menu/menu_common.h index a3c615c5ad..03d742a41b 100644 --- a/frontend/menu/menu_common.h +++ b/frontend/menu/menu_common.h @@ -189,8 +189,6 @@ bool menu_save_new_config(void); int menu_defer_core(core_info_list_t *data, const char *dir, const char *path, char *deferred_path, size_t sizeof_deferred_path); -void menu_flush_stack_type(unsigned final_type); - void menu_update_system_info(menu_handle_t *menu, bool *load_no_content); void menu_build_scroll_indices(file_list_t *buf); diff --git a/frontend/menu/menu_entries.c b/frontend/menu/menu_entries.c index a5b8fabbfd..eff159818b 100644 --- a/frontend/menu/menu_entries.c +++ b/frontend/menu/menu_entries.c @@ -71,11 +71,11 @@ void menu_entries_push_perfcounter(menu_handle_t *menu, id + i, 0); } -void menu_entries_pop(void) +void menu_entries_pop(file_list_t *list) { - if (file_list_get_size(driver.menu->menu_stack) > 1) + if (file_list_get_size(list) > 1) { - file_list_pop(driver.menu->menu_stack, &driver.menu->selection_ptr); + file_list_pop(list, &driver.menu->selection_ptr); driver.menu->need_refresh = true; } } @@ -584,7 +584,7 @@ int menu_parse_check(const char *label, unsigned menu_type) return 0; } -int menu_parse_and_resolve(file_list_t *list) +int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list) { size_t i, list_size; unsigned menu_type = 0; @@ -592,7 +592,7 @@ int menu_parse_and_resolve(file_list_t *list) const char *dir = NULL; const char *label = NULL; - file_list_get_last(driver.menu->menu_stack, &dir, &label, &menu_type); + file_list_get_last(menu_list, &dir, &label, &menu_type); if ( menu_type == MENU_SETTINGS_DEFERRED_CORE || @@ -774,7 +774,7 @@ int menu_parse_and_resolve(file_list_t *list) { case MENU_SETTINGS_CORE: { - file_list_get_last(driver.menu->menu_stack, &dir, NULL, + file_list_get_last(menu_list, &dir, NULL, &menu_type); list_size = file_list_get_size(list); @@ -809,7 +809,8 @@ int menu_parse_and_resolve(file_list_t *list) return 0; } -void menu_flush_stack_type(unsigned final_type) +void menu_flush_stack_type(file_list_t *list, + unsigned final_type) { const char *path = NULL; const char *label = NULL; @@ -819,11 +820,11 @@ void menu_flush_stack_type(unsigned final_type) return; driver.menu->need_refresh = true; - file_list_get_last(driver.menu->menu_stack, &path, &label, &type); + file_list_get_last(list, &path, &label, &type); while (type != final_type) { - file_list_pop(driver.menu->menu_stack, &driver.menu->selection_ptr); - file_list_get_last(driver.menu->menu_stack, &path, &label, &type); + file_list_pop(list, &driver.menu->selection_ptr); + file_list_get_last(list, &path, &label, &type); } } diff --git a/frontend/menu/menu_entries.h b/frontend/menu/menu_entries.h index 03ff3a4353..1021db5292 100644 --- a/frontend/menu/menu_entries.h +++ b/frontend/menu/menu_entries.h @@ -31,10 +31,10 @@ int menu_entries_push_list(menu_handle_t *menu, int menu_parse_check(const char *label, unsigned menu_type); -int menu_parse_and_resolve(file_list_t *list); +int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list); -void menu_entries_pop(void); +void menu_entries_pop(file_list_t *list); -void menu_flush_stack_type(unsigned final_type); +void menu_flush_stack_type(file_list_t *list, unsigned final_type); #endif