From 9a261d36c07763742ebaeab5a3b52b7553f8750b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 26 Jan 2015 21:59:55 +0100 Subject: [PATCH] (XMB) Split xmb_populate_entries in two functions --- menu/drivers/xmb.c | 75 ++++++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 26 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 46e553c6cd..02dc9cd201 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -744,8 +744,7 @@ static void xmb_set_title(void) } } -static void xmb_populate_entries(void *data, const char *path, - const char *label, unsigned k) +static void xmb_list_open() { int dir; unsigned j; @@ -754,36 +753,40 @@ static void xmb_populate_entries(void *data, const char *path, if (!xmb) return; - xmb_set_title(); + dir = driver.menu->cat_selection_ptr > xmb->cat_selection_ptr_old ? 1 : -1; - if (driver.menu->cat_selection_ptr != xmb->active_category_old) + xmb->active_category += dir; + + for (j = 0; j < xmb->num_categories; j++) { - dir = driver.menu->cat_selection_ptr > xmb->cat_selection_ptr_old ? 1 : -1; + float ia, iz; + xmb_node_t *node = j ? xmb_node_for_core(j-1) : &xmb->settings_node; - xmb->active_category += dir; + if (!node) + continue; - for (j = 0; j < xmb->num_categories; j++) - { - float ia, iz; - xmb_node_t *node = j ? xmb_node_for_core(j-1) : &xmb->settings_node; - - if (!node) - continue; - - ia = (j == xmb->active_category) ? xmb->c_active_alpha : xmb->c_passive_alpha; - iz = (j == xmb->active_category) ? xmb->c_active_zoom : xmb->c_passive_zoom; - add_tween(XMB_DELAY, ia, &node->alpha, &inOutQuad, NULL); - add_tween(XMB_DELAY, iz, &node->zoom, &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 > 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; + ia = (j == xmb->active_category) ? xmb->c_active_alpha : xmb->c_passive_alpha; + iz = (j == xmb->active_category) ? xmb->c_active_zoom : xmb->c_passive_zoom; + add_tween(XMB_DELAY, ia, &node->alpha, &inOutQuad, NULL); + add_tween(XMB_DELAY, iz, &node->zoom, &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 > 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; +} + +static void xmb_list_switch() +{ + int dir; + unsigned j; + xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata; + + if (!xmb) + return; + xmb->depth = file_list_get_size(driver.menu->menu_list->menu_stack); dir = 0; @@ -820,6 +823,26 @@ static void xmb_populate_entries(void *data, const char *path, xmb->old_depth = xmb->depth; } +static void xmb_populate_entries(void *data, const char *path, + const char *label, unsigned k) +{ + int dir; + unsigned j; + xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata; + + if (!xmb) + return; + + xmb_set_title(); + + // horizontal list switching + if (driver.menu->cat_selection_ptr != xmb->active_category_old) + xmb_list_open(); + // list open + else + xmb_list_switch(); +} + static void xmb_draw_items(file_list_t *list, file_list_t *stack, size_t current, size_t cat_selection_ptr) {