diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 357c0f0966..688b2ee280 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -305,7 +305,7 @@ static void glui_render_menu_list(runloop_t *runloop, entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH]; bool selected = false; - menu_list_get_entry(&entry, i, NULL); + menu_list_get_entry(&entry, i, NULL, true); selected = menu_list_entry_is_currently_selected(&entry); menu_animation_ticker_line(entry_title_buf, glui->ticker_limit, diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 3dde494dc0..7d646ab9d5 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -493,7 +493,7 @@ static void rgui_render(void) entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH]; bool selected = false; - menu_list_get_entry(&entry, i, NULL); + menu_list_get_entry(&entry, i, NULL, true); selected = menu_list_entry_is_currently_selected(&entry); if (i > (menu->navigation.selection_ptr + 100)) diff --git a/menu/drivers/rmenu.c b/menu/drivers/rmenu.c index 4e12ab1ff6..8baa3ec64a 100644 --- a/menu/drivers/rmenu.c +++ b/menu/drivers/rmenu.c @@ -234,7 +234,7 @@ static void rmenu_render(void) entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH]; bool selected = false; - menu_list_get_entry(&entry, i, NULL); + menu_list_get_entry(&entry, i, NULL, true); selected = menu_list_entry_is_currently_selected(&entry); menu_animation_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (entry.spacing + 1 + 2), diff --git a/menu/drivers/rmenu_xui.cpp b/menu/drivers/rmenu_xui.cpp index fec504d703..f806008605 100644 --- a/menu/drivers/rmenu_xui.cpp +++ b/menu/drivers/rmenu_xui.cpp @@ -605,7 +605,7 @@ static void rmenu_xui_render(void) menu_entry_t entry; wchar_t msg_left[PATH_MAX_LENGTH], msg_right[PATH_MAX_LENGTH]; - menu_list_get_entry(&entry, i, NULL); + menu_list_get_entry(&entry, i, NULL, true); mbstowcs(msg_left, entry.path, sizeof(msg_left) / sizeof(wchar_t)); mbstowcs(msg_right, entry.value, sizeof(msg_right) / sizeof(wchar_t)); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 599daf2683..8ce0fdef78 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1020,7 +1020,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl, icon_y > global->video_data.height + xmb->icon.size) continue; - menu_list_get_entry(&entry, i, list); + menu_list_get_entry(&entry, i, list, true); if (entry.type == MENU_FILE_CONTENTLIST_ENTRY) strlcpy(entry.path, path_basename(entry.path), sizeof(entry.path)); diff --git a/menu/menu_entries_cbs_iterate.c b/menu/menu_entries_cbs_iterate.c index e5cb7a9521..3ffc98a3fb 100644 --- a/menu/menu_entries_cbs_iterate.c +++ b/menu/menu_entries_cbs_iterate.c @@ -484,29 +484,25 @@ static int action_iterate_message(const char *label, unsigned action) static int action_iterate_switch(const char *label, unsigned action) { - unsigned type_offset = 0; - const char *label_offset = NULL; - const char *path_offset = NULL; + menu_entry_t entry; menu_file_list_cbs_t *cbs = NULL; - menu_handle_t *menu = menu_driver_get_ptr(); menu_list_t *menu_list = menu_list_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); menu_navigation_t *nav = menu_navigation_get_ptr(); size_t selected = menu_navigation_get_current_selection(); if (!menu) return 0; - cbs = (menu_file_list_cbs_t*) - menu_list_get_actiondata_at_offset(menu_list->selection_buf, - selected); + menu_list_get_entry(&entry, selected, NULL, false); + + cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset(menu_list->selection_buf, selected); - menu_list_get_at_offset(menu_list->selection_buf, - selected, &path_offset, &label_offset, &type_offset); switch (action) { case MENU_ACTION_UP: case MENU_ACTION_DOWN: if (cbs && cbs->action_up_or_down) - return cbs->action_up_or_down(type_offset, label_offset, action); + return cbs->action_up_or_down(entry.type, entry.label, action); break; case MENU_ACTION_SCROLL_UP: menu_navigation_descend_alphabet(nav, &nav->selection_ptr); @@ -517,25 +513,25 @@ static int action_iterate_switch(const char *label, unsigned action) case MENU_ACTION_CANCEL: if (cbs && cbs->action_cancel) - return cbs->action_cancel(path_offset, label_offset, type_offset, selected); + return cbs->action_cancel(entry.path, entry.label, entry.type, selected); break; case MENU_ACTION_OK: if (cbs && cbs->action_ok) - return cbs->action_ok(path_offset, label_offset, type_offset, selected); + return cbs->action_ok(entry.path, entry.label, entry.type, selected); break; case MENU_ACTION_START: if (cbs && cbs->action_start) - return cbs->action_start(type_offset, label_offset, action); + return cbs->action_start(entry.type, entry.label, action); break; case MENU_ACTION_LEFT: case MENU_ACTION_RIGHT: if (cbs && cbs->action_toggle) - return cbs->action_toggle(type_offset, label_offset, action, false); + return cbs->action_toggle(entry.type, entry.label, action, false); break; case MENU_ACTION_SELECT: if (cbs && cbs->action_select) - return cbs->action_select(type_offset, label_offset, action); + return cbs->action_select(entry.type, entry.label, action); break; case MENU_ACTION_REFRESH: diff --git a/menu/menu_list.c b/menu/menu_list.c index 90aaec053d..8ed05f318e 100644 --- a/menu/menu_list.c +++ b/menu/menu_list.c @@ -447,7 +447,8 @@ int menu_list_populate_generic(file_list_t *list, const char *path, return 0; } -void menu_list_get_entry(menu_entry_t *entry, size_t i, void *userdata) +void menu_list_get_entry(menu_entry_t *entry, size_t i, void *userdata, + bool use_representation) { const char *label = NULL; const char *path = NULL; @@ -470,7 +471,7 @@ void menu_list_get_entry(menu_entry_t *entry, size_t i, void *userdata) cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset(list, i); - if (cbs && cbs->action_get_representation) + if (cbs && cbs->action_get_representation && use_representation) cbs->action_get_representation(list, &entry->spacing, entry->type, i, label, entry->value, sizeof(entry->value), @@ -491,7 +492,7 @@ bool menu_list_entry_is_currently_selected(menu_entry_t *entry) return (entry->id == nav->selection_ptr); } -int menu_list_get_current_entry_id(void) +int menu_list_get_current_entry_id(bool use_representation) { size_t i; menu_list_t *menu_list = menu_list_get_ptr(); @@ -500,7 +501,8 @@ int menu_list_get_current_entry_id(void) for (i = 0; i < end; i++) { menu_entry_t entry; - menu_list_get_entry(&entry, i, NULL); + menu_list_get_entry(&entry, i, + NULL, use_representation); if (menu_list_entry_is_currently_selected(&entry)) return i; diff --git a/menu/menu_list.h b/menu/menu_list.h index ba1c85a774..e39bb11fab 100644 --- a/menu/menu_list.h +++ b/menu/menu_list.h @@ -107,9 +107,9 @@ void menu_list_set_alt_at_offset(file_list_t *list, size_t idx, int menu_list_populate_generic(file_list_t *list, const char *path, const char *label, unsigned type); -void menu_list_get_entry(menu_entry_t *entry, size_t i, void *userdata); +void menu_list_get_entry(menu_entry_t *entry, size_t i, void *userdata, bool use_representation); -int menu_list_get_current_entry_id(void); +int menu_list_get_current_entry_id(bool use_representation); bool menu_list_entry_is_currently_selected(menu_entry_t *entry);