diff --git a/menu/disp/xmb.c b/menu/disp/xmb.c index b4f031e20b..6bb9491bf2 100644 --- a/menu/disp/xmb.c +++ b/menu/disp/xmb.c @@ -79,6 +79,10 @@ struct xmb_texture_item 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_old; 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) { - 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; @@ -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); - dir = driver.menu->cat_selection_ptr > driver.menu->cat_selection_ptr_old ? 1 : -1; - xmb_list_switch_old(driver.menu->menu_list->selection_buf_old, dir, driver.menu->selection_ptr_old); + dir = driver.menu->cat_selection_ptr > xmb->cat_selection_ptr_old ? 1 : -1; + 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->active_category_old = driver.menu->cat_selection_ptr; return; @@ -752,7 +756,7 @@ static void xmb_populate_entries(void *data, const char *path, 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); 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); xmb_draw_items( - driver.menu->menu_list->selection_buf_old, - driver.menu->menu_list->menu_stack_old, - driver.menu->selection_ptr_old, + xmb->selection_buf_old, + xmb->menu_stack_old, + xmb->selection_ptr_old, depth > 1 ? driver.menu->cat_selection_ptr : - driver.menu->cat_selection_ptr_old); + xmb->cat_selection_ptr_old); xmb_draw_items( driver.menu->menu_list->selection_buf, driver.menu->menu_list->menu_stack, @@ -1061,6 +1065,9 @@ static void *xmb_init(void) 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_old = 0; xmb->x = 0; @@ -1392,14 +1399,19 @@ static void xmb_list_clear(void *data) static void xmb_list_cache(bool horizontal, unsigned action) { - file_list_copy(driver.menu->menu_list->selection_buf, driver.menu->menu_list->selection_buf_old); - 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; + 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; - driver.menu->cat_selection_ptr_old = driver.menu->cat_selection_ptr; + 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; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 831b0aa948..18fe3e817e 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -79,9 +79,7 @@ typedef struct menu_list_t *menu_list; size_t cat_selection_ptr; - size_t cat_selection_ptr_old; size_t selection_ptr; - size_t selection_ptr_old; bool need_refresh; bool msg_force; bool push_start_screen; diff --git a/menu/menu_list.c b/menu/menu_list.c index 8001efde47..e80cc9fcf7 100644 --- a/menu/menu_list.c +++ b/menu/menu_list.c @@ -56,8 +56,6 @@ void *menu_list_new(void) 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->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) { diff --git a/menu/menu_list.h b/menu/menu_list.h index 523c0d17a6..cb0c679ba6 100644 --- a/menu/menu_list.h +++ b/menu/menu_list.h @@ -26,9 +26,7 @@ extern "C" { typedef struct menu_list { file_list_t *menu_stack; - file_list_t *menu_stack_old; file_list_t *selection_buf; - file_list_t *selection_buf_old; } menu_list_t; void menu_list_free(menu_list_t *menu_list);