From a7b43854e04bccac010c22c586b6e1847bf7deec Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 8 Jun 2015 11:30:19 +0200 Subject: [PATCH] (XMB) Use menu_list_get_ptr --- menu/drivers/xmb.c | 62 +++++++++++++++++++---------------- menu/menu_entries_cbs_title.c | 6 ++-- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 7efaebce58..cc7e29db2f 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -477,8 +477,9 @@ end: static void xmb_selection_pointer_changed(void) { unsigned i, current, end; - xmb_handle_t *xmb = NULL; - menu_handle_t *menu = menu_driver_get_ptr(); + xmb_handle_t *xmb = NULL; + menu_handle_t *menu = menu_driver_get_ptr(); + menu_list_t *menu_list = menu_list_get_ptr(); if (!menu) return; @@ -497,7 +498,7 @@ static void xmb_selection_pointer_changed(void) float ia = xmb->item.passive.alpha; float iz = xmb->item.passive.zoom; xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset( - menu->menu_list->selection_buf, i); + menu_list->selection_buf, i); if (!node) continue; @@ -817,7 +818,8 @@ static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb, menu_handle_t *me static void xmb_list_switch(xmb_handle_t *xmb) { int dir = -1; - menu_handle_t *menu = menu_driver_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); + menu_list_t *menu_list = menu_list_get_ptr(); if (!menu) return; @@ -839,7 +841,7 @@ static void xmb_list_switch(xmb_handle_t *xmb) xmb_list_switch_old(xmb, xmb->selection_buf_old, dir, xmb->selection_ptr_old); - xmb_list_switch_new(xmb, menu->menu_list->selection_buf, + xmb_list_switch_new(xmb, menu_list->selection_buf, dir, menu->navigation.selection_ptr); xmb->categories.active.idx_old = menu->categories.selection_ptr; } @@ -873,8 +875,9 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu static void xmb_list_open(xmb_handle_t *xmb) { - int dir = 0; - menu_handle_t *menu = menu_driver_get_ptr(); + int dir = 0; + menu_handle_t *menu = menu_driver_get_ptr(); + menu_list_t *menu_list = menu_list_get_ptr(); if (!menu) return; @@ -890,7 +893,7 @@ static void xmb_list_open(xmb_handle_t *xmb) xmb_list_open_old(xmb, xmb->selection_buf_old, dir, xmb->selection_ptr_old); - xmb_list_open_new(xmb, menu->menu_list->selection_buf, + xmb_list_open_new(xmb, menu_list->selection_buf, dir, menu->navigation.selection_ptr); switch (xmb->depth) @@ -1212,9 +1215,10 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, float x, float y) static void xmb_render(void) { unsigned i, current, end; - xmb_handle_t *xmb = NULL; - settings_t *settings = config_get_ptr(); - menu_handle_t *menu = menu_driver_get_ptr(); + xmb_handle_t *xmb = NULL; + settings_t *settings = config_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); + menu_list_t *menu_list = menu_list_get_ptr(); if (!menu) return; @@ -1227,7 +1231,7 @@ static void xmb_render(void) menu_animation_update(menu->animation, menu->dt / IDEAL_DT); current = menu->navigation.selection_ptr; - end = menu_list_get_size(menu->menu_list); + end = menu_list_get_size(menu_list); if (settings->menu.pointer.enable) { @@ -1298,8 +1302,9 @@ static void xmb_frame(void) xmb_handle_t *xmb = NULL; gl_t *gl = NULL; const struct font_renderer *font_driver = NULL; - menu_handle_t *menu = menu_driver_get_ptr(); - settings_t *settings = config_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); + menu_list_t *menu_list = menu_list_get_ptr(); + settings_t *settings = config_get_ptr(); if (!menu) return; @@ -1352,8 +1357,8 @@ static void xmb_frame(void) xmb->categories.selection_ptr_old); xmb_draw_items(xmb, gl, - menu->menu_list->selection_buf, - menu->menu_list->menu_stack, + menu_list->selection_buf, + menu_list->menu_stack, menu->navigation.selection_ptr, menu->categories.selection_ptr); @@ -1933,8 +1938,9 @@ static void xmb_list_delete(file_list_t *list, static void xmb_list_cache(menu_list_type_t type, unsigned action) { size_t stack_size; - xmb_handle_t *xmb = NULL; - menu_handle_t *menu = menu_driver_get_ptr(); + xmb_handle_t *xmb = NULL; + menu_handle_t *menu = menu_driver_get_ptr(); + menu_list_t *menu_list = menu_list_get_ptr(); if (!menu) return; @@ -1944,8 +1950,8 @@ static void xmb_list_cache(menu_list_type_t type, unsigned action) if (!xmb) return; - file_list_copy(menu->menu_list->selection_buf, xmb->selection_buf_old); - file_list_copy(menu->menu_list->menu_stack, xmb->menu_stack_old); + file_list_copy(menu_list->selection_buf, xmb->selection_buf_old); + file_list_copy(menu_list->menu_stack, xmb->menu_stack_old); xmb->selection_ptr_old = menu->navigation.selection_ptr; switch (type) @@ -1965,24 +1971,24 @@ static void xmb_list_cache(menu_list_type_t type, unsigned action) break; } - stack_size = menu->menu_list->menu_stack->size; + stack_size = menu_list->menu_stack->size; - if (menu->menu_list->menu_stack->list[stack_size - 1].label) - free(menu->menu_list->menu_stack->list[stack_size - 1].label); - menu->menu_list->menu_stack->list[stack_size - 1].label = NULL; + if (menu_list->menu_stack->list[stack_size - 1].label) + free(menu_list->menu_stack->list[stack_size - 1].label); + menu_list->menu_stack->list[stack_size - 1].label = NULL; if (menu->categories.selection_ptr == 0) { - menu->menu_list->menu_stack->list[stack_size - 1].label = + menu_list->menu_stack->list[stack_size - 1].label = strdup("Main Menu"); - menu->menu_list->menu_stack->list[stack_size - 1].type = + menu_list->menu_stack->list[stack_size - 1].type = MENU_SETTINGS; } else { - menu->menu_list->menu_stack->list[stack_size - 1].label = + menu_list->menu_stack->list[stack_size - 1].label = strdup("Horizontal Menu"); - menu->menu_list->menu_stack->list[stack_size - 1].type = + menu_list->menu_stack->list[stack_size - 1].type = MENU_SETTING_HORIZONTAL_MENU; } break; diff --git a/menu/menu_entries_cbs_title.c b/menu/menu_entries_cbs_title.c index ff951bf811..ba5955df0e 100644 --- a/menu/menu_entries_cbs_title.c +++ b/menu/menu_entries_cbs_title.c @@ -40,7 +40,7 @@ static INLINE void sanitize_to_string(char *s, const char *label, size_t len) static int action_get_title_default(const char *path, const char *label, unsigned menu_type, char *s, size_t len) { - uint32_t hash = 0; + uint32_t label_hash = 0; char elem0[PATH_MAX_LENGTH], elem1[PATH_MAX_LENGTH]; char elem0_path[PATH_MAX_LENGTH], elem1_path[PATH_MAX_LENGTH]; struct string_list *list_label = string_split(label, "|"); @@ -72,7 +72,7 @@ static int action_get_title_default(const char *path, const char *label, string_list_free(list_path); } - hash = djb2_calculate(label); + label_hash = djb2_calculate(label); #if 0 RARCH_LOG("label %s, elem0 %s, elem1 %s\n", label, elem0, elem1); @@ -94,7 +94,7 @@ static int action_get_title_default(const char *path, const char *label, } } - switch (hash) + switch (label_hash) { case MENU_LABEL_DEFERRED_DATABASE_MANAGER_LIST: snprintf(s, len, "DATABASE SELECTION - %s", (elem0_path[0] != '\0') ? path_basename(elem0_path) : "");