mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
Merge pull request #1275 from lakkatv/xmb
(XMB) Move all caching stuff to the display driver
This commit is contained in:
commit
07e2f24039
@ -624,6 +624,7 @@ menu_ctx_driver_t menu_ctx_glui = {
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
glui_init_core_info,
|
glui_init_core_info,
|
||||||
glui_update_core_info,
|
glui_update_core_info,
|
||||||
&menu_ctx_backend_common,
|
&menu_ctx_backend_common,
|
||||||
|
@ -1338,6 +1338,7 @@ menu_ctx_driver_t menu_ctx_lakka = {
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
lakka_init_core_info,
|
lakka_init_core_info,
|
||||||
lakka_update_core_info,
|
lakka_update_core_info,
|
||||||
&menu_ctx_backend_lakka,
|
&menu_ctx_backend_lakka,
|
||||||
|
@ -30,6 +30,7 @@ typedef struct menu_ctx_driver
|
|||||||
void (*list_insert)(void *, const char *, const char *, size_t);
|
void (*list_insert)(void *, const char *, const char *, size_t);
|
||||||
void (*list_delete)(void *, size_t, size_t);
|
void (*list_delete)(void *, size_t, size_t);
|
||||||
void (*list_clear)(void *);
|
void (*list_clear)(void *);
|
||||||
|
void (*list_cache)(bool, unsigned);
|
||||||
void (*list_set_selection)(void *);
|
void (*list_set_selection)(void *);
|
||||||
void (*init_core_info)(void *);
|
void (*init_core_info)(void *);
|
||||||
void (*update_core_info)(void *);
|
void (*update_core_info)(void *);
|
||||||
|
@ -594,6 +594,7 @@ menu_ctx_driver_t menu_ctx_rgui = {
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
NULL,
|
||||||
rgui_update_core_info,
|
rgui_update_core_info,
|
||||||
&menu_ctx_backend_common,
|
&menu_ctx_backend_common,
|
||||||
"rgui",
|
"rgui",
|
||||||
|
@ -79,6 +79,10 @@ struct xmb_texture_item
|
|||||||
|
|
||||||
typedef struct xmb_handle
|
typedef struct xmb_handle
|
||||||
{
|
{
|
||||||
|
file_list_t *menu_stack_old;
|
||||||
|
file_list_t *selection_buf_old;
|
||||||
|
size_t cat_selection_ptr_old;
|
||||||
|
size_t selection_ptr_old;
|
||||||
int active_category;
|
int active_category;
|
||||||
int active_category_old;
|
int active_category_old;
|
||||||
int num_categories;
|
int num_categories;
|
||||||
@ -707,7 +711,7 @@ static void xmb_populate_entries(void *data, const char *path,
|
|||||||
|
|
||||||
if (driver.menu->cat_selection_ptr != xmb->active_category_old)
|
if (driver.menu->cat_selection_ptr != xmb->active_category_old)
|
||||||
{
|
{
|
||||||
dir = driver.menu->cat_selection_ptr > driver.menu->cat_selection_ptr_old ? 1 : -1;
|
dir = driver.menu->cat_selection_ptr > xmb->cat_selection_ptr_old ? 1 : -1;
|
||||||
|
|
||||||
xmb->active_category += dir;
|
xmb->active_category += dir;
|
||||||
|
|
||||||
@ -725,8 +729,8 @@ static void xmb_populate_entries(void *data, const char *path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_tween(XMB_DELAY, xmb->hspacing*-(float)driver.menu->cat_selection_ptr, &xmb->categories_x, &inOutQuad, NULL);
|
add_tween(XMB_DELAY, xmb->hspacing*-(float)driver.menu->cat_selection_ptr, &xmb->categories_x, &inOutQuad, NULL);
|
||||||
dir = driver.menu->cat_selection_ptr > driver.menu->cat_selection_ptr_old ? 1 : -1;
|
dir = driver.menu->cat_selection_ptr > xmb->cat_selection_ptr_old ? 1 : -1;
|
||||||
xmb_list_switch_old(driver.menu->menu_list->selection_buf_old, dir, driver.menu->selection_ptr_old);
|
xmb_list_switch_old(xmb->selection_buf_old, dir, xmb->selection_ptr_old);
|
||||||
xmb_list_switch_new(driver.menu->menu_list->selection_buf, dir, driver.menu->selection_ptr);
|
xmb_list_switch_new(driver.menu->menu_list->selection_buf, dir, driver.menu->selection_ptr);
|
||||||
xmb->active_category_old = driver.menu->cat_selection_ptr;
|
xmb->active_category_old = driver.menu->cat_selection_ptr;
|
||||||
return;
|
return;
|
||||||
@ -752,7 +756,7 @@ static void xmb_populate_entries(void *data, const char *path,
|
|||||||
add_tween(XMB_DELAY, ia, &node->alpha, &inOutQuad, NULL);
|
add_tween(XMB_DELAY, ia, &node->alpha, &inOutQuad, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
xmb_list_open_old(driver.menu->menu_list->selection_buf_old, dir, driver.menu->selection_ptr_old);
|
xmb_list_open_old(xmb->selection_buf_old, dir, xmb->selection_ptr_old);
|
||||||
xmb_list_open_new(driver.menu->menu_list->selection_buf, dir, driver.menu->selection_ptr);
|
xmb_list_open_new(driver.menu->menu_list->selection_buf, dir, driver.menu->selection_ptr);
|
||||||
|
|
||||||
if (xmb->depth == 1 || xmb->depth == 2)
|
if (xmb->depth == 1 || xmb->depth == 2)
|
||||||
@ -954,11 +958,11 @@ static void xmb_frame(void)
|
|||||||
depth = file_list_get_size(driver.menu->menu_list->menu_stack);
|
depth = file_list_get_size(driver.menu->menu_list->menu_stack);
|
||||||
|
|
||||||
xmb_draw_items(
|
xmb_draw_items(
|
||||||
driver.menu->menu_list->selection_buf_old,
|
xmb->selection_buf_old,
|
||||||
driver.menu->menu_list->menu_stack_old,
|
xmb->menu_stack_old,
|
||||||
driver.menu->selection_ptr_old,
|
xmb->selection_ptr_old,
|
||||||
depth > 1 ? driver.menu->cat_selection_ptr :
|
depth > 1 ? driver.menu->cat_selection_ptr :
|
||||||
driver.menu->cat_selection_ptr_old);
|
xmb->cat_selection_ptr_old);
|
||||||
xmb_draw_items(
|
xmb_draw_items(
|
||||||
driver.menu->menu_list->selection_buf,
|
driver.menu->menu_list->selection_buf,
|
||||||
driver.menu->menu_list->menu_stack,
|
driver.menu->menu_list->menu_stack,
|
||||||
@ -1061,6 +1065,9 @@ static void *xmb_init(void)
|
|||||||
|
|
||||||
xmb = (xmb_handle_t*)menu->userdata;
|
xmb = (xmb_handle_t*)menu->userdata;
|
||||||
|
|
||||||
|
xmb->menu_stack_old = (file_list_t*)calloc(1, sizeof(file_list_t));
|
||||||
|
xmb->selection_buf_old = (file_list_t*)calloc(1, sizeof(file_list_t));
|
||||||
|
|
||||||
xmb->active_category = 0;
|
xmb->active_category = 0;
|
||||||
xmb->active_category_old = 0;
|
xmb->active_category_old = 0;
|
||||||
xmb->x = 0;
|
xmb->x = 0;
|
||||||
@ -1390,6 +1397,36 @@ static void xmb_list_clear(void *data)
|
|||||||
(void)data;
|
(void)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void xmb_list_cache(bool horizontal, unsigned action)
|
||||||
|
{
|
||||||
|
xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;
|
||||||
|
|
||||||
|
if (!xmb)
|
||||||
|
return;
|
||||||
|
|
||||||
|
file_list_copy(driver.menu->menu_list->selection_buf, xmb->selection_buf_old);
|
||||||
|
file_list_copy(driver.menu->menu_list->menu_stack, xmb->menu_stack_old);
|
||||||
|
xmb->selection_ptr_old = driver.menu->selection_ptr;
|
||||||
|
|
||||||
|
if(!horizontal)
|
||||||
|
return;
|
||||||
|
|
||||||
|
xmb->cat_selection_ptr_old = driver.menu->cat_selection_ptr;
|
||||||
|
driver.menu->cat_selection_ptr += action == MENU_ACTION_LEFT ? -1 : 1;
|
||||||
|
|
||||||
|
size_t stack_size = driver.menu->menu_list->menu_stack->size;
|
||||||
|
if (driver.menu->cat_selection_ptr == 0)
|
||||||
|
{
|
||||||
|
strlcpy(driver.menu->menu_list->menu_stack->list[stack_size-1].label, "Main Menu", PATH_MAX);
|
||||||
|
driver.menu->menu_list->menu_stack->list[stack_size-1].type = MENU_SETTINGS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strlcpy(driver.menu->menu_list->menu_stack->list[stack_size-1].label, "Horizontal Menu", PATH_MAX);
|
||||||
|
driver.menu->menu_list->menu_stack->list[stack_size-1].type = MENU_SETTING_HORIZONTAL_MENU;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void xmb_list_set_selection(void *data)
|
static void xmb_list_set_selection(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
@ -1424,7 +1461,6 @@ static void xmb_context_destroy(void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
menu_ctx_driver_t menu_ctx_xmb = {
|
menu_ctx_driver_t menu_ctx_xmb = {
|
||||||
NULL,
|
NULL,
|
||||||
xmb_get_message,
|
xmb_get_message,
|
||||||
@ -1448,6 +1484,7 @@ menu_ctx_driver_t menu_ctx_xmb = {
|
|||||||
xmb_list_insert,
|
xmb_list_insert,
|
||||||
xmb_list_delete,
|
xmb_list_delete,
|
||||||
xmb_list_clear,
|
xmb_list_clear,
|
||||||
|
xmb_list_cache,
|
||||||
xmb_list_set_selection,
|
xmb_list_set_selection,
|
||||||
xmb_init_core_info,
|
xmb_init_core_info,
|
||||||
xmb_update_core_info,
|
xmb_update_core_info,
|
||||||
|
@ -79,9 +79,7 @@ typedef struct
|
|||||||
|
|
||||||
menu_list_t *menu_list;
|
menu_list_t *menu_list;
|
||||||
size_t cat_selection_ptr;
|
size_t cat_selection_ptr;
|
||||||
size_t cat_selection_ptr_old;
|
|
||||||
size_t selection_ptr;
|
size_t selection_ptr;
|
||||||
size_t selection_ptr_old;
|
|
||||||
bool need_refresh;
|
bool need_refresh;
|
||||||
bool msg_force;
|
bool msg_force;
|
||||||
bool push_start_screen;
|
bool push_start_screen;
|
||||||
|
@ -981,24 +981,8 @@ static int action_toggle_mainmenu(unsigned type, const char *label,
|
|||||||
switch (push_list)
|
switch (push_list)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
file_list_copy(driver.menu->menu_list->selection_buf, driver.menu->menu_list->selection_buf_old);
|
if (driver.menu_ctx->list_cache)
|
||||||
file_list_copy(driver.menu->menu_list->menu_stack, driver.menu->menu_list->menu_stack_old);
|
driver.menu_ctx->list_cache(true, action);
|
||||||
driver.menu->selection_ptr_old = driver.menu->selection_ptr;
|
|
||||||
driver.menu->cat_selection_ptr_old = driver.menu->cat_selection_ptr;
|
|
||||||
driver.menu->cat_selection_ptr += action == MENU_ACTION_LEFT ? -1 : 1;
|
|
||||||
driver.menu->selection_ptr = 0;
|
|
||||||
|
|
||||||
size_t stack_size = driver.menu->menu_list->menu_stack->size;
|
|
||||||
if (driver.menu->cat_selection_ptr == 0)
|
|
||||||
{
|
|
||||||
strlcpy(driver.menu->menu_list->menu_stack->list[stack_size-1].label, "Main Menu", PATH_MAX);
|
|
||||||
driver.menu->menu_list->menu_stack->list[stack_size-1].type = MENU_SETTINGS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strlcpy(driver.menu->menu_list->menu_stack->list[stack_size-1].label, "Horizontal Menu", PATH_MAX);
|
|
||||||
driver.menu->menu_list->menu_stack->list[stack_size-1].type = MENU_SETTING_HORIZONTAL_MENU;
|
|
||||||
}
|
|
||||||
|
|
||||||
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(
|
||||||
|
@ -56,8 +56,6 @@ void *menu_list_new(void)
|
|||||||
|
|
||||||
list->menu_stack = (file_list_t*)calloc(1, sizeof(file_list_t));
|
list->menu_stack = (file_list_t*)calloc(1, sizeof(file_list_t));
|
||||||
list->selection_buf = (file_list_t*)calloc(1, sizeof(file_list_t));
|
list->selection_buf = (file_list_t*)calloc(1, sizeof(file_list_t));
|
||||||
list->menu_stack_old = (file_list_t*)calloc(1, sizeof(file_list_t));
|
|
||||||
list->selection_buf_old = (file_list_t*)calloc(1, sizeof(file_list_t));
|
|
||||||
|
|
||||||
if (!list->menu_stack || !list->selection_buf)
|
if (!list->menu_stack || !list->selection_buf)
|
||||||
{
|
{
|
||||||
@ -163,11 +161,9 @@ 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)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_XMB
|
if (driver.menu_ctx->list_cache)
|
||||||
file_list_copy(driver.menu->menu_list->selection_buf, driver.menu->menu_list->selection_buf_old);
|
driver.menu_ctx->list_cache(false, 0);
|
||||||
file_list_copy(driver.menu->menu_list->menu_stack, driver.menu->menu_list->menu_stack_old);
|
|
||||||
driver.menu->selection_ptr_old = driver.menu->selection_ptr;
|
|
||||||
#endif
|
|
||||||
menu_list_pop(list->menu_stack, &driver.menu->selection_ptr);
|
menu_list_pop(list->menu_stack, &driver.menu->selection_ptr);
|
||||||
driver.menu->need_refresh = true;
|
driver.menu->need_refresh = true;
|
||||||
}
|
}
|
||||||
@ -278,11 +274,8 @@ void menu_list_push_stack_refresh(menu_list_t *list,
|
|||||||
if (!list)
|
if (!list)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef HAVE_XMB
|
if (driver.menu_ctx->list_cache)
|
||||||
file_list_copy(driver.menu->menu_list->selection_buf, driver.menu->menu_list->selection_buf_old);
|
driver.menu_ctx->list_cache(false, 0);
|
||||||
file_list_copy(driver.menu->menu_list->menu_stack, driver.menu->menu_list->menu_stack_old);
|
|
||||||
driver.menu->selection_ptr_old = driver.menu->selection_ptr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
menu_list_push_stack(list, path, label, type, directory_ptr);
|
menu_list_push_stack(list, path, label, type, directory_ptr);
|
||||||
menu_navigation_clear(driver.menu, true);
|
menu_navigation_clear(driver.menu, true);
|
||||||
|
@ -26,9 +26,7 @@ extern "C" {
|
|||||||
typedef struct menu_list
|
typedef struct menu_list
|
||||||
{
|
{
|
||||||
file_list_t *menu_stack;
|
file_list_t *menu_stack;
|
||||||
file_list_t *menu_stack_old;
|
|
||||||
file_list_t *selection_buf;
|
file_list_t *selection_buf;
|
||||||
file_list_t *selection_buf_old;
|
|
||||||
} menu_list_t;
|
} menu_list_t;
|
||||||
|
|
||||||
void menu_list_free(menu_list_t *menu_list);
|
void menu_list_free(menu_list_t *menu_list);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user