mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 11:43:00 +00:00
Create RARCH_MENU_CTL_LIST_FREE
This commit is contained in:
parent
84d64c4042
commit
71507808c9
@ -189,21 +189,6 @@ static bool menu_init(menu_handle_t *menu_data)
|
||||
return true;
|
||||
}
|
||||
|
||||
void menu_driver_list_free(file_list_t *list, size_t idx, size_t list_size)
|
||||
{
|
||||
if (menu_driver_ctx)
|
||||
{
|
||||
if (menu_driver_ctx->list_free)
|
||||
menu_driver_ctx->list_free(list, idx, list_size);
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
file_list_free_userdata (list, idx);
|
||||
file_list_free_actiondata(list, idx);
|
||||
}
|
||||
}
|
||||
|
||||
size_t menu_driver_list_get_selection(void)
|
||||
{
|
||||
if (!menu_driver_ctx || !menu_driver_ctx->list_get_selection)
|
||||
@ -695,6 +680,23 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
info->label, info->type);
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_LIST_FREE:
|
||||
{
|
||||
menu_ctx_list_t *list = (menu_ctx_list_t*)data;
|
||||
|
||||
if (menu_driver_ctx)
|
||||
{
|
||||
if (menu_driver_ctx->list_free)
|
||||
menu_driver_ctx->list_free(list->list, list->idx, list->list_size);
|
||||
}
|
||||
|
||||
if (list->list)
|
||||
{
|
||||
file_list_free_userdata (list->list, list->idx);
|
||||
file_list_free_actiondata(list->list, list->idx);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_LIST_PUSH:
|
||||
{
|
||||
menu_ctx_displaylist_t *disp_list = (menu_ctx_displaylist_t*)data;
|
||||
|
@ -152,6 +152,7 @@ enum rarch_menu_ctl_state
|
||||
RARCH_MENU_CTL_POPULATE_ENTRIES,
|
||||
RARCH_MENU_CTL_FIND_DRIVER,
|
||||
RARCH_MENU_CTL_LOAD_IMAGE,
|
||||
RARCH_MENU_CTL_LIST_FREE,
|
||||
RARCH_MENU_CTL_LIST_CLEAR,
|
||||
RARCH_MENU_CTL_LIST_SET_SELECTION,
|
||||
RARCH_MENU_CTL_LIST_CACHE,
|
||||
@ -345,6 +346,7 @@ typedef struct menu_ctx_load_image
|
||||
typedef struct menu_ctx_list
|
||||
{
|
||||
file_list_t *list;
|
||||
size_t list_size;
|
||||
const char *path;
|
||||
const char *label;
|
||||
size_t idx;
|
||||
@ -398,8 +400,6 @@ const char *menu_driver_find_ident(int index);
|
||||
**/
|
||||
const char* config_get_menu_driver_options(void);
|
||||
|
||||
void menu_driver_list_free(file_list_t *list, size_t i, size_t list_size);
|
||||
|
||||
size_t menu_driver_list_get_size(menu_list_type_t type);
|
||||
|
||||
void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i);
|
||||
|
@ -40,7 +40,15 @@ static void menu_list_free_list(file_list_t *list)
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
menu_driver_list_free(list, i, list->size);
|
||||
{
|
||||
menu_ctx_list_t list_info;
|
||||
|
||||
list_info.list = list;
|
||||
list_info.idx = i;
|
||||
list_info.list_size = list->size;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_LIST_FREE, &list_info);
|
||||
}
|
||||
|
||||
if (list)
|
||||
file_list_free(list);
|
||||
@ -173,7 +181,15 @@ static bool menu_list_pop_stack(menu_list_t *list, size_t idx, size_t *directory
|
||||
menu_driver_ctl(RARCH_MENU_CTL_LIST_CACHE, &list_info);
|
||||
|
||||
if (menu_list->size != 0)
|
||||
menu_driver_list_free(menu_list, menu_list->size - 1, menu_list->size - 1);
|
||||
{
|
||||
menu_ctx_list_t list_info;
|
||||
|
||||
list_info.list = menu_list;
|
||||
list_info.idx = menu_list->size - 1;
|
||||
list_info.list_size = menu_list->size - 1;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_LIST_FREE, &list_info);
|
||||
}
|
||||
|
||||
file_list_pop(menu_list, directory_ptr);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_LIST_SET_SELECTION, menu_list);
|
||||
|
Loading…
x
Reference in New Issue
Block a user