mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-08 19:40:30 +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))
|
if ((current_is_dir && !is_dir) || (first > current))
|
||||||
nav->scroll.indices.list[nav->scroll.indices.size++] = i;
|
nav->scroll.indices.list[nav->scroll.indices.size++] = i;
|
||||||
|
|
||||||
current = first;
|
current = first;
|
||||||
current_is_dir = is_dir;
|
current_is_dir = is_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,6 +116,13 @@ static void menu_list_build_scroll_indices(file_list_t *list)
|
|||||||
list->size - 1;
|
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
|
* Before a refresh, we could have deleted a
|
||||||
* file on disk, causing selection_ptr to
|
* 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)
|
void menu_list_refresh(file_list_t *list)
|
||||||
{
|
{
|
||||||
|
size_t list_size;
|
||||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||||
menu_list_t *menu_list = menu_list_get_ptr();
|
menu_list_t *menu_list = menu_list_get_ptr();
|
||||||
if (!nav || !menu_list || !list)
|
if (!nav || !menu_list || !list)
|
||||||
@ -134,11 +142,11 @@ void menu_list_refresh(file_list_t *list)
|
|||||||
|
|
||||||
menu_list_build_scroll_indices(list);
|
menu_list_build_scroll_indices(list);
|
||||||
|
|
||||||
if (nav->selection_ptr >= menu_list_get_size(menu_list)
|
list_size = menu_list_get_size(menu_list);
|
||||||
&& menu_list_get_size(menu_list))
|
|
||||||
menu_navigation_set(nav,
|
if ((nav->selection_ptr >= list_size) && list_size)
|
||||||
menu_list_get_size(menu_list) - 1, true);
|
menu_navigation_set(nav, list_size - 1, true);
|
||||||
else if (!menu_list_get_size(menu_list))
|
else if (!list_size)
|
||||||
menu_navigation_clear(nav, true);
|
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);
|
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,
|
void menu_list_get_last(const file_list_t *list,
|
||||||
const char **path, const char **label,
|
const char **path, const char **label,
|
||||||
|
Loading…
Reference in New Issue
Block a user