void menu_list_pop_stack_by_needle(menu_list_t *list, const char *needle) { uint32_t needle_hash, label_hash; const char *path = NULL; const char *label = NULL; unsigned type = 0; size_t entry_idx = 0; menu_navigation_t *nav = menu_navigation_get_ptr(); if (!list) return; menu_entries_set_refresh(false); menu_list_get_last(list->menu_stack, &path, &label, &type, &entry_idx); needle_hash = menu_hash_calculate(needle); label_hash = menu_hash_calculate(label); while (needle_hash == label_hash) { menu_list_pop(list->menu_stack, &nav->selection_ptr); menu_list_get_last(list->menu_stack, &path, &label, &type, &entry_idx); label_hash = menu_hash_calculate(label); needle_hash = menu_hash_calculate(needle); } }
void menu_list_flush_stack(menu_list_t *list, const char *needle, unsigned final_type) { const char *path = NULL; const char *label = NULL; unsigned type = 0; size_t entry_idx = 0; menu_navigation_t *nav = menu_navigation_get_ptr(); if (!list) return; menu_entries_set_refresh(false); menu_list_get_last(list->menu_stack, &path, &label, &type, &entry_idx); while (menu_list_flush_stack_type( needle, label, type, final_type) != 0) { menu_list_pop(list->menu_stack, &nav->selection_ptr); menu_list_get_last(list->menu_stack, &path, &label, &type, &entry_idx); } }
static int action_ok_file_load(const char *path, const char *label, unsigned type, size_t idx) { const char *menu_label = NULL; const char *menu_path = NULL; rarch_setting_t *setting = NULL; menu_handle_t *menu = menu_driver_get_ptr(); global_t *global = global_get_ptr(); if (!menu) return -1; menu_list_get_last(menu->menu_list->menu_stack, &menu_path, &menu_label, NULL); setting = menu_setting_find(menu_label); if (setting && setting->type == ST_PATH) { menu_action_setting_set_current_string_path(setting, menu_path, path); menu_list_pop_stack_by_needle(menu->menu_list, setting->name); } else { if (type == MENU_FILE_IN_CARCHIVE) fill_pathname_join_delim(global->fullpath, menu_path, path, '#',sizeof(global->fullpath)); else fill_pathname_join(global->fullpath, menu_path, path, sizeof(global->fullpath)); menu_entries_common_load_content(true); return -1; } return 0; }
void menu_list_get_last_stack(const menu_list_t *list, const char **path, const char **label, unsigned *file_type, size_t *entry_idx) { menu_list_get_last(list->menu_stack, path, label, file_type, entry_idx); }