mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-22 18:58:21 +00:00
(Menu) Cleanup menu_list_refresh
This commit is contained in:
parent
a7b43854e0
commit
8596de7716
@ -108,7 +108,7 @@ static void menu_list_build_scroll_indices(file_list_t *list)
|
||||
if ((current_is_dir && !is_dir) || (first > current))
|
||||
nav->scroll.indices.list[nav->scroll.indices.size++] = i;
|
||||
|
||||
current = first;
|
||||
current = first;
|
||||
current_is_dir = is_dir;
|
||||
}
|
||||
|
||||
@ -116,6 +116,13 @@ static void menu_list_build_scroll_indices(file_list_t *list)
|
||||
list->size - 1;
|
||||
}
|
||||
|
||||
size_t menu_list_get_size(menu_list_t *list)
|
||||
{
|
||||
if (!list)
|
||||
return 0;
|
||||
return file_list_get_size(list->selection_buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Before a refresh, we could have deleted a
|
||||
* file on disk, causing selection_ptr to
|
||||
@ -125,6 +132,7 @@ static void menu_list_build_scroll_indices(file_list_t *list)
|
||||
**/
|
||||
void menu_list_refresh(file_list_t *list)
|
||||
{
|
||||
size_t list_size;
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
if (!nav || !menu_list || !list)
|
||||
@ -134,11 +142,11 @@ void menu_list_refresh(file_list_t *list)
|
||||
|
||||
menu_list_build_scroll_indices(list);
|
||||
|
||||
if (nav->selection_ptr >= menu_list_get_size(menu_list)
|
||||
&& menu_list_get_size(menu_list))
|
||||
menu_navigation_set(nav,
|
||||
menu_list_get_size(menu_list) - 1, true);
|
||||
else if (!menu_list_get_size(menu_list))
|
||||
list_size = menu_list_get_size(menu_list);
|
||||
|
||||
if ((nav->selection_ptr >= list_size) && list_size)
|
||||
menu_navigation_set(nav, list_size - 1, true);
|
||||
else if (!list_size)
|
||||
menu_navigation_clear(nav, true);
|
||||
}
|
||||
|
||||
@ -203,12 +211,6 @@ void menu_list_get_at_offset(const file_list_t *list, size_t idx,
|
||||
file_list_get_at_offset(list, idx, path, label, file_type);
|
||||
}
|
||||
|
||||
size_t menu_list_get_size(menu_list_t *list)
|
||||
{
|
||||
if (!list)
|
||||
return 0;
|
||||
return file_list_get_size(list->selection_buf);
|
||||
}
|
||||
|
||||
void menu_list_get_last(const file_list_t *list,
|
||||
const char **path, const char **label,
|
||||
|
Loading…
Reference in New Issue
Block a user