mirror of
https://github.com/libretro/RetroArch
synced 2025-02-07 03:40:24 +00:00
(Menu) Add action_data to file_list_t and add callbacks to menu
backend driver
This commit is contained in:
parent
add2f96bac
commit
6de130a94b
53
file_list.c
53
file_list.c
@ -35,8 +35,14 @@ void file_list_push(file_list_t *list,
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (driver.menu_ctx && driver.menu_ctx->list_insert)
|
||||
driver.menu_ctx->list_insert(list, path, label, list->size);
|
||||
if (driver.menu_ctx)
|
||||
{
|
||||
if (driver.menu_ctx->list_insert)
|
||||
driver.menu_ctx->list_insert(list, path, label, list->size);
|
||||
|
||||
if (driver.menu_ctx->backend->list_insert)
|
||||
driver.menu_ctx->backend->list_insert(list, path, label, list->size);
|
||||
}
|
||||
#endif
|
||||
|
||||
list->list[list->size].label = strdup(label);
|
||||
@ -65,8 +71,13 @@ void file_list_pop(file_list_t *list, size_t *directory_ptr)
|
||||
{
|
||||
--list->size;
|
||||
#ifdef HAVE_MENU
|
||||
if (driver.menu_ctx && driver.menu_ctx->list_delete)
|
||||
driver.menu_ctx->list_delete(list, list->size, list->size);
|
||||
if (driver.menu_ctx)
|
||||
{
|
||||
if (driver.menu_ctx->list_delete)
|
||||
driver.menu_ctx->list_delete(list, list->size, list->size);
|
||||
if (driver.menu_ctx->backend->list_delete)
|
||||
driver.menu_ctx->backend->list_delete(list, list->size, list->size);
|
||||
}
|
||||
#endif
|
||||
free(list->list[list->size].path);
|
||||
free(list->list[list->size].label);
|
||||
@ -76,8 +87,14 @@ void file_list_pop(file_list_t *list, size_t *directory_ptr)
|
||||
*directory_ptr = list->list[list->size].directory_ptr;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (driver.menu_ctx && driver.menu_ctx->list_set_selection)
|
||||
driver.menu_ctx->list_set_selection(list);
|
||||
if (driver.menu_ctx)
|
||||
{
|
||||
if (driver.menu_ctx->list_set_selection)
|
||||
driver.menu_ctx->list_set_selection(list);
|
||||
|
||||
if (driver.menu_ctx->backend->list_set_selection)
|
||||
driver.menu_ctx->backend->list_set_selection(list);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -91,8 +108,13 @@ void file_list_free(file_list_t *list)
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
if (driver.menu_ctx && driver.menu_ctx->list_delete)
|
||||
driver.menu_ctx->list_delete(list, i, list->size);
|
||||
if (driver.menu_ctx)
|
||||
{
|
||||
if (driver.menu_ctx->list_delete)
|
||||
driver.menu_ctx->list_delete(list, i, list->size);
|
||||
if (driver.menu_ctx->backend->list_delete)
|
||||
driver.menu_ctx->backend->list_delete(list, i, list->size);
|
||||
}
|
||||
#endif
|
||||
free(list->list[i].path);
|
||||
free(list->list[i].label);
|
||||
@ -116,8 +138,14 @@ void file_list_clear(file_list_t *list)
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (driver.menu_ctx && driver.menu_ctx->list_clear)
|
||||
driver.menu_ctx->list_clear(list);
|
||||
if (driver.menu_ctx)
|
||||
{
|
||||
if (driver.menu_ctx->list_clear)
|
||||
driver.menu_ctx->list_clear(list);
|
||||
|
||||
if (driver.menu_ctx->backend->list_clear)
|
||||
driver.menu_ctx->backend->list_clear(list);
|
||||
}
|
||||
#endif
|
||||
list->size = 0;
|
||||
}
|
||||
@ -171,6 +199,11 @@ void *file_list_get_userdata_at_offset(const file_list_t *list, size_t index)
|
||||
return list->list[index].userdata;
|
||||
}
|
||||
|
||||
void *file_list_get_actiondata_at_offset(const file_list_t *list, size_t index)
|
||||
{
|
||||
return list->list[index].actiondata;
|
||||
}
|
||||
|
||||
void file_list_get_at_offset(const file_list_t *list, size_t index,
|
||||
const char **path, const char **label, unsigned *file_type)
|
||||
{
|
||||
|
@ -31,6 +31,7 @@ struct item_file
|
||||
unsigned type;
|
||||
size_t directory_ptr;
|
||||
void *userdata;
|
||||
void *actiondata;
|
||||
};
|
||||
|
||||
typedef struct file_list
|
||||
|
@ -11,6 +11,10 @@ typedef struct menu_ctx_driver_backend
|
||||
unsigned (*type_is)(const char *, unsigned);
|
||||
void (*setting_set_label)(char *, size_t, unsigned *,
|
||||
unsigned, const char *, const char *, unsigned);
|
||||
void (*list_insert)(void *, const char *, const char *, size_t);
|
||||
void (*list_delete)(void *, size_t, size_t);
|
||||
void (*list_clear)(void *);
|
||||
void (*list_set_selection)(void *);
|
||||
const char *ident;
|
||||
} menu_ctx_driver_backend_t;
|
||||
|
||||
|
@ -1121,9 +1121,32 @@ static void menu_common_setting_set_label(char *type_str,
|
||||
type, menu_label, label, index);
|
||||
}
|
||||
|
||||
static void menu_common_list_insert(void *data,
|
||||
const char *path, const char *unused, size_t list_size)
|
||||
{
|
||||
}
|
||||
|
||||
static void menu_common_list_delete(void *data, size_t index,
|
||||
size_t list_size)
|
||||
{
|
||||
}
|
||||
|
||||
static void menu_common_list_clear(void *data)
|
||||
{
|
||||
}
|
||||
|
||||
static void menu_common_list_set_selection(void *data)
|
||||
{
|
||||
}
|
||||
|
||||
menu_ctx_driver_backend_t menu_ctx_backend_common = {
|
||||
menu_common_iterate,
|
||||
menu_common_type_is,
|
||||
menu_common_setting_set_label,
|
||||
menu_common_list_insert,
|
||||
menu_common_list_delete,
|
||||
menu_common_list_clear,
|
||||
menu_common_list_set_selection,
|
||||
|
||||
"menu_common",
|
||||
};
|
||||
|
@ -545,5 +545,9 @@ menu_ctx_driver_backend_t menu_ctx_backend_lakka = {
|
||||
menu_lakka_iterate,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"menu_lakka",
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user