diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 97823691ea..72aa1775a1 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -306,8 +306,7 @@ static void glui_render_menu_list(runloop_t *runloop, bool selected = false; menu_list_get_entry(&entry, i, label, NULL); - - selected = (i == menu->navigation.selection_ptr); + selected = menu_list_entry_is_currently_selected(&entry); menu_animation_ticker_line(entry_title_buf, glui->ticker_limit, runloop->frames.video.count / 100, entry.path, selected); diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 295d641bd9..5dab13ba28 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -494,8 +494,7 @@ static void rgui_render(void) bool selected = false; menu_list_get_entry(&entry, i, label, NULL); - - selected = (i == menu->navigation.selection_ptr); + selected = menu_list_entry_is_currently_selected(&entry); if (i > (menu->navigation.selection_ptr + 100)) continue; diff --git a/menu/drivers/rmenu.c b/menu/drivers/rmenu.c index 245a8368ec..206826ba74 100644 --- a/menu/drivers/rmenu.c +++ b/menu/drivers/rmenu.c @@ -235,8 +235,7 @@ static void rmenu_render(void) bool selected = false; menu_list_get_entry(&entry, i, label, NULL); - - selected = (i == menu->navigation.selection_ptr); + selected = menu_list_entry_is_currently_selected(&entry); menu_animation_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (entry.spacing + 1 + 2), runloop->frames.video.count / 15, entry.path, selected); diff --git a/menu/menu_list.c b/menu/menu_list.c index e48342b9d9..f766934099 100644 --- a/menu/menu_list.c +++ b/menu/menu_list.c @@ -475,6 +475,16 @@ void menu_list_get_entry(menu_entry_t *entry, size_t i, entry_label, path, entry->path, sizeof(entry->path)); + entry->id = i; + if (entry_label) strlcpy(entry->label, entry_label, sizeof(entry->label)); } + +bool menu_list_entry_is_currently_selected(menu_entry_t *entry) +{ + menu_navigation_t *nav = menu_navigation_get_ptr(); + if (!entry || !nav) + return false; + return (entry->id == nav->selection_ptr); +} diff --git a/menu/menu_list.h b/menu/menu_list.h index f92005f26f..eaafb5ede8 100644 --- a/menu/menu_list.h +++ b/menu/menu_list.h @@ -110,6 +110,8 @@ int menu_list_populate_generic(file_list_t *list, void menu_list_get_entry(menu_entry_t *entry, size_t i, const char *label, void *userdata); +bool menu_list_entry_is_currently_selected(menu_entry_t *entry); + #ifdef __cplusplus } #endif