mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-12 12:39:56 +00:00
Create menu_list_get_current_entry_id
This commit is contained in:
parent
f9713ab764
commit
290bff0097
@ -488,3 +488,25 @@ bool menu_list_entry_is_currently_selected(menu_entry_t *entry)
|
||||
return false;
|
||||
return (entry->id == nav->selection_ptr);
|
||||
}
|
||||
|
||||
int menu_list_get_current_entry_id(void)
|
||||
{
|
||||
size_t i;
|
||||
const char *label = NULL;
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
size_t end = menu_list_get_size(menu_list);
|
||||
|
||||
menu_list_get_last_stack(menu_list,
|
||||
NULL, &label, NULL);
|
||||
|
||||
for (i = 0; i < end; i++)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
menu_list_get_entry(&entry, i, label, NULL);
|
||||
|
||||
if (menu_list_entry_is_currently_selected(&entry))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
int menu_list_get_current_entry_id(void);
|
||||
|
||||
bool menu_list_entry_is_currently_selected(menu_entry_t *entry);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user