diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index e1ea267175..c136950e70 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -533,7 +533,7 @@ static int action_ok_playlist_entry(const char *path, { case MENU_LABEL_COLLECTION: case MENU_LABEL_RDB_ENTRY_START_CONTENT: - menu_entries_pop_stack(&selection); + menu_entries_pop_stack(&selection, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); break; default: @@ -911,7 +911,7 @@ static int action_ok_core_deferred_set(const char *path, content_playlist_write_file(menu->playlist); - menu_entries_pop_stack(&selection); + menu_entries_pop_stack(&selection, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); return -1; diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index 16e8a16833..53d48ed202 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -243,7 +243,7 @@ int generic_menu_iterate(enum menu_action action) case ITERATE_TYPE_BIND: if (menu_input_key_bind_iterate(menu->menu_state.msg, sizeof(menu->menu_state.msg))) { - menu_entries_pop_stack(&selection); + menu_entries_pop_stack(&selection, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } else @@ -304,7 +304,7 @@ int generic_menu_iterate(enum menu_action action) if (BIT64_GET(menu->state, MENU_STATE_POP_STACK)) { size_t new_selection_ptr = selection; - menu_entries_pop_stack(&new_selection_ptr); + menu_entries_pop_stack(&new_selection_ptr, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 66ac36e723..45554fbed7 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -306,7 +306,7 @@ static size_t xmb_list_get_size(void *data, menu_list_type_t type) switch (type) { case MENU_LIST_PLAIN: - list_size = menu_entries_get_stack_size(); + list_size = menu_entries_get_stack_size(0); break; case MENU_LIST_HORIZONTAL: if (xmb && xmb->horizontal_list) @@ -328,7 +328,7 @@ static void *xmb_list_get_entry(void *data, menu_list_type_t type, unsigned i) switch (type) { case MENU_LIST_PLAIN: - list_size = menu_entries_get_stack_size(); + list_size = menu_entries_get_stack_size(0); if (i < list_size) ptr = (void*)&menu_stack->list[i]; break; diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 31c4ec4361..2524e7397c 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -109,11 +109,11 @@ error: return NULL; } -static size_t menu_list_get_stack_size(menu_list_t *list) +static size_t menu_list_get_stack_size(menu_list_t *list, size_t idx) { if (!list) return 0; - return file_list_get_size(list->menu_stack[0]); + return file_list_get_size(list->menu_stack[idx]); } void menu_entries_get_at_offset(const file_list_t *list, size_t idx, @@ -155,15 +155,15 @@ static INLINE int menu_entries_flush_stack_type( return needle ? strcmp(needle, label) : (type != final_type); } -static bool menu_list_pop_stack(menu_list_t *list, size_t *directory_ptr) +static bool menu_list_pop_stack(menu_list_t *list, size_t idx, size_t *directory_ptr) { file_list_t *menu_list = NULL; if (!list) return false; - menu_list = list->menu_stack[0]; + menu_list = list->menu_stack[idx]; - if (menu_list_get_stack_size(list) <= 1) + if (menu_list_get_stack_size(list, idx) <= 1) return false; menu_driver_list_cache(MENU_LIST_PLAIN, 0); @@ -180,7 +180,7 @@ static bool menu_list_pop_stack(menu_list_t *list, size_t *directory_ptr) } static void menu_list_flush_stack(menu_list_t *list, - const char *needle, unsigned final_type) + size_t idx, const char *needle, unsigned final_type) { const char *path = NULL; const char *label = NULL; @@ -190,7 +190,7 @@ static void menu_list_flush_stack(menu_list_t *list, return; menu_entries_set_refresh(false); - menu_entries_get_last(list->menu_stack[0], + menu_entries_get_last(list->menu_stack[idx], &path, &label, &type, &entry_idx); while (menu_entries_flush_stack_type( @@ -200,12 +200,12 @@ static void menu_list_flush_stack(menu_list_t *list, menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &new_selection_ptr); - if (!menu_list_pop_stack(list, &new_selection_ptr)) + if (!menu_list_pop_stack(list, idx, &new_selection_ptr)) break; menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &new_selection_ptr); - menu_entries_get_last(list->menu_stack[0], + menu_entries_get_last(list->menu_stack[idx], &path, &label, &type, &entry_idx); } } @@ -450,7 +450,7 @@ int menu_entries_get_title(char *s, size_t len) * one level deep in the menu hierarchy). */ bool menu_entries_show_back(void) { - return (menu_entries_get_stack_size() > 1); + return (menu_entries_get_stack_size(0) > 1); } /* Sets 's' to the name of the current core @@ -633,22 +633,22 @@ void menu_entries_flush_stack(const char *needle, unsigned final_type) { menu_list_t *menu_list = menu_list_get_ptr(); if (menu_list) - menu_list_flush_stack(menu_list, needle, final_type); + menu_list_flush_stack(menu_list, 0, needle, final_type); } -void menu_entries_pop_stack(size_t *ptr) +void menu_entries_pop_stack(size_t *ptr, size_t idx) { menu_list_t *menu_list = menu_list_get_ptr(); if (menu_list) - menu_list_pop_stack(menu_list, ptr); + menu_list_pop_stack(menu_list, idx, ptr); } -size_t menu_entries_get_stack_size(void) +size_t menu_entries_get_stack_size(size_t idx) { menu_list_t *menu_list = menu_list_get_ptr(); if (!menu_list) return 0; - return menu_list_get_stack_size(menu_list); + return menu_list_get_stack_size(menu_list, idx); } size_t menu_entries_get_size(void) diff --git a/menu/menu_entries.h b/menu/menu_entries.h index c60fe308ed..46826ab891 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -141,11 +141,11 @@ void menu_entries_get_last_stack(const char **path, const char **label, menu_file_list_cbs_t *menu_entries_get_last_stack_actiondata(void); -void menu_entries_pop_stack(size_t *ptr); +void menu_entries_pop_stack(size_t *ptr, size_t idx); void menu_entries_flush_stack(const char *needle, unsigned final_type); -size_t menu_entries_get_stack_size(void); +size_t menu_entries_get_stack_size(size_t idx); size_t menu_entries_get_size(void); diff --git a/menu/menu_entry.c b/menu/menu_entry.c index f767289e27..fcec9abc07 100644 --- a/menu/menu_entry.c +++ b/menu/menu_entry.c @@ -37,7 +37,7 @@ int menu_entry_go_back(void) size_t new_selection_ptr; menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &new_selection_ptr); - menu_entries_pop_stack(&new_selection_ptr); + menu_entries_pop_stack(&new_selection_ptr, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &new_selection_ptr); return 0; diff --git a/menu/menu_input.c b/menu/menu_input.c index 5299a002f8..d012443df7 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -904,7 +904,7 @@ static int menu_input_mouse_frame( if (BIT64_GET(input_mouse, MOUSE_ACTION_BUTTON_R)) { - menu_entries_pop_stack(&selection); + menu_entries_pop_stack(&selection, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } @@ -960,7 +960,7 @@ static int menu_input_mouse_post_iterate(uint64_t *input_mouse, if ((unsigned)menu_input->mouse.y < header_height) { - menu_entries_pop_stack(&selection); + menu_entries_pop_stack(&selection, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); return 0; } @@ -1143,7 +1143,7 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs, { if ((unsigned)menu_input->pointer.start_y < header_height) { - menu_entries_pop_stack(&selection); + menu_entries_pop_stack(&selection, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } else if (menu_input->pointer.ptr <= (menu_entries_get_size() - 1)) @@ -1169,7 +1169,7 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs, if (!menu_input->pointer.oldback) { menu_input->pointer.oldback = true; - menu_entries_pop_stack(&selection); + menu_entries_pop_stack(&selection, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); } }