mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
Refactor xmb_list_cache function callback
This commit is contained in:
parent
d3102e03c8
commit
2e81d7f8dc
@ -1870,7 +1870,7 @@ static void xmb_list_delete(file_list_t *list,
|
|||||||
list->list[idx].userdata = NULL;
|
list->list[idx].userdata = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_list_cache(bool horizontal, unsigned action)
|
static void xmb_list_cache(menu_list_type_t type, unsigned action)
|
||||||
{
|
{
|
||||||
size_t stack_size;
|
size_t stack_size;
|
||||||
xmb_handle_t *xmb = NULL;
|
xmb_handle_t *xmb = NULL;
|
||||||
@ -1888,9 +1888,11 @@ static void xmb_list_cache(bool horizontal, unsigned action)
|
|||||||
file_list_copy(menu->menu_list->menu_stack, xmb->menu_stack_old);
|
file_list_copy(menu->menu_list->menu_stack, xmb->menu_stack_old);
|
||||||
xmb->selection_ptr_old = menu->navigation.selection_ptr;
|
xmb->selection_ptr_old = menu->navigation.selection_ptr;
|
||||||
|
|
||||||
if(!horizontal)
|
switch (type)
|
||||||
return;
|
{
|
||||||
|
case MENU_LIST_PLAIN:
|
||||||
|
break;
|
||||||
|
case MENU_LIST_HORIZONTAL:
|
||||||
xmb->categories.selection_ptr_old = menu->categories.selection_ptr;
|
xmb->categories.selection_ptr_old = menu->categories.selection_ptr;
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
@ -1923,6 +1925,8 @@ static void xmb_list_cache(bool horizontal, unsigned action)
|
|||||||
menu->menu_list->menu_stack->list[stack_size - 1].type =
|
menu->menu_list->menu_stack->list[stack_size - 1].type =
|
||||||
MENU_SETTING_HORIZONTAL_MENU;
|
MENU_SETTING_HORIZONTAL_MENU;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_context_destroy(void)
|
static void xmb_context_destroy(void)
|
||||||
|
@ -1717,7 +1717,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
|||||||
menu_list_push(info->list, info->path, info->label, info->type, info->directory_ptr);
|
menu_list_push(info->list, info->path, info->label, info->type, info->directory_ptr);
|
||||||
break;
|
break;
|
||||||
case DISPLAYLIST_GENERIC:
|
case DISPLAYLIST_GENERIC:
|
||||||
menu_driver_list_cache(false, 0);
|
menu_driver_list_cache(MENU_LIST_PLAIN, 0);
|
||||||
|
|
||||||
menu_list_push(info->list, info->path, info->label, info->type, info->directory_ptr);
|
menu_list_push(info->list, info->path, info->label, info->type, info->directory_ptr);
|
||||||
menu_navigation_clear(&menu->navigation, true);
|
menu_navigation_clear(&menu->navigation, true);
|
||||||
|
@ -251,12 +251,12 @@ void menu_driver_list_insert(file_list_t *list, const char *path,
|
|||||||
menu_entries_cbs_init(list, path, label, type, idx);
|
menu_entries_cbs_init(list, path, label, type, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_driver_list_cache(bool state, unsigned action)
|
void menu_driver_list_cache(menu_list_type_t type, unsigned action)
|
||||||
{
|
{
|
||||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||||
|
|
||||||
if (driver->list_cache)
|
if (driver->list_cache)
|
||||||
driver->list_cache(state, action);
|
driver->list_cache(type, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_driver_navigation_increment(void)
|
void menu_driver_navigation_increment(void)
|
||||||
|
@ -254,7 +254,7 @@ typedef struct menu_ctx_driver
|
|||||||
void (*list_insert)(file_list_t *list, const char *, const char *, size_t);
|
void (*list_insert)(file_list_t *list, const char *, const char *, size_t);
|
||||||
void (*list_delete)(file_list_t *list, size_t, size_t);
|
void (*list_delete)(file_list_t *list, size_t, size_t);
|
||||||
void (*list_clear)(file_list_t *list);
|
void (*list_clear)(file_list_t *list);
|
||||||
void (*list_cache)(bool, unsigned);
|
void (*list_cache)(menu_list_type_t, unsigned);
|
||||||
void (*list_set_selection)(file_list_t *list);
|
void (*list_set_selection)(file_list_t *list);
|
||||||
bool (*load_image)(void *data, menu_image_type_t type);
|
bool (*load_image)(void *data, menu_image_type_t type);
|
||||||
const char *ident;
|
const char *ident;
|
||||||
@ -336,7 +336,7 @@ void menu_driver_navigation_descend_alphabet(size_t *);
|
|||||||
|
|
||||||
void menu_driver_navigation_ascend_alphabet(size_t *);
|
void menu_driver_navigation_ascend_alphabet(size_t *);
|
||||||
|
|
||||||
void menu_driver_list_cache(bool state, unsigned action);
|
void menu_driver_list_cache(menu_list_type_t type, unsigned action);
|
||||||
|
|
||||||
void menu_driver_list_delete(file_list_t *list, size_t i, size_t list_size);
|
void menu_driver_list_delete(file_list_t *list, size_t i, size_t list_size);
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ static int action_left_mainmenu(unsigned type, const char *label,
|
|||||||
switch (push_list)
|
switch (push_list)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
menu_driver_list_cache(true, action);
|
menu_driver_list_cache(MENU_LIST_HORIZONTAL, action);
|
||||||
|
|
||||||
if (cbs && cbs->action_content_list_switch)
|
if (cbs && cbs->action_content_list_switch)
|
||||||
return cbs->action_content_list_switch(
|
return cbs->action_content_list_switch(
|
||||||
|
@ -168,7 +168,7 @@ static int action_right_mainmenu(unsigned type, const char *label,
|
|||||||
switch (push_list)
|
switch (push_list)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
menu_driver_list_cache(true, action);
|
menu_driver_list_cache(MENU_LIST_HORIZONTAL, action);
|
||||||
|
|
||||||
if (cbs && cbs->action_content_list_switch)
|
if (cbs && cbs->action_content_list_switch)
|
||||||
return cbs->action_content_list_switch(
|
return cbs->action_content_list_switch(
|
||||||
|
@ -278,7 +278,7 @@ void menu_list_pop_stack(menu_list_t *list)
|
|||||||
if (file_list_get_size(list->menu_stack) <= 1)
|
if (file_list_get_size(list->menu_stack) <= 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
menu_driver_list_cache(false, 0);
|
menu_driver_list_cache(MENU_LIST_PLAIN, 0);
|
||||||
|
|
||||||
menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr);
|
menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr);
|
||||||
menu_set_refresh();
|
menu_set_refresh();
|
||||||
|
@ -32,6 +32,12 @@ typedef struct menu_list
|
|||||||
file_list_t *selection_buf;
|
file_list_t *selection_buf;
|
||||||
} menu_list_t;
|
} menu_list_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
MENU_LIST_PLAIN = 0,
|
||||||
|
MENU_LIST_HORIZONTAL,
|
||||||
|
} menu_list_type_t;
|
||||||
|
|
||||||
typedef struct menu_file_list_cbs
|
typedef struct menu_file_list_cbs
|
||||||
{
|
{
|
||||||
int (*action_iterate)(const char *label, unsigned action);
|
int (*action_iterate)(const char *label, unsigned action);
|
||||||
|
Loading…
Reference in New Issue
Block a user