From 338959eb598fb0a0218db48c2b0618d9b089556e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Tue, 9 Jun 2015 21:24:22 -0300 Subject: [PATCH] (XMB) Fix horizontal menus --- menu/cbs/menu_entries_cbs_right.c | 2 +- menu/drivers/xmb.c | 25 +++++++++++++------------ menu/menu_displaylist.c | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/menu/cbs/menu_entries_cbs_right.c b/menu/cbs/menu_entries_cbs_right.c index dde4f394a8..ce820d6dce 100644 --- a/menu/cbs/menu_entries_cbs_right.c +++ b/menu/cbs/menu_entries_cbs_right.c @@ -151,7 +151,7 @@ static int action_right_mainmenu(unsigned type, const char *label, if (list_size == 1) { menu->navigation.selection_ptr = 0; - if (menu->categories.selection_ptr != (menu_driver_list_get_size(MENU_LIST_HORIZONTAL) - 1)) + if (menu->categories.selection_ptr != menu_driver_list_get_size(MENU_LIST_HORIZONTAL)) push_list = 1; } else diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 740b4bd227..638cc7bf44 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -270,8 +270,9 @@ static void *xmb_list_get_entry(void *data, menu_list_type_t type, unsigned i) case MENU_LIST_HORIZONTAL: if (xmb && xmb->horizontal_list) list_size = file_list_get_size(xmb->horizontal_list); - if (i < list_size) - ptr = (void*)&xmb->horizontal_list->list[i]; + + if (i < list_size+1) + ptr = (void*)&xmb->horizontal_list->list[i-1]; break; } @@ -789,7 +790,7 @@ static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb, menu_handle_t *me unsigned j; size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL); - for (j = 0; j < list_size; j++) + for (j = 0; j < list_size + 1; j++) { float ia = xmb->categories.passive.alpha; float iz = xmb->categories.passive.zoom; @@ -850,7 +851,7 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu unsigned j; size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL); - for (j = 0; j < list_size; j++) + for (j = 0; j < list_size + 1; j++) { float ia = 0; xmb_node_t *node = &xmb->settings_node; @@ -1260,7 +1261,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu, gl unsigned i; size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL); - for (i = 0; i < list_size; i++) + for (i = 0; i < list_size + 1; i++) { xmb_node_t *node = &xmb->settings_node; @@ -1632,23 +1633,23 @@ static void xmb_context_reset_horizontal_list(xmb_handle_t *xmb, unsigned i; size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL); - for (i = 1; i < list_size; i++) + for (i = 0; i < list_size; i++) { char iconpath[PATH_MAX_LENGTH], sysname[PATH_MAX_LENGTH]; char texturepath[PATH_MAX_LENGTH], content_texturepath[PATH_MAX_LENGTH]; struct texture_image ti = {0}; xmb_node_t *node = xmb_get_userdata_from_horizontal_list( - xmb, i - 1); + xmb, i); struct item_file *info = NULL; if (!node) { - node = xmb_node_allocate_userdata(xmb, i - 1); + node = xmb_node_allocate_userdata(xmb, i); if (!node) continue; } - info = (struct item_file*)&xmb->horizontal_list->list[i - 1]; + info = (struct item_file*)&xmb->horizontal_list->list[i]; if (!info) continue; @@ -1990,9 +1991,9 @@ static void xmb_context_destroy_horizontal_list(xmb_handle_t *xmb, unsigned i; size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL); - for (i = 1; i < list_size; i++) + for (i = 0; i < list_size; i++) { - xmb_node_t *node = xmb_get_userdata_from_horizontal_list(xmb, i - 1); + xmb_node_t *node = xmb_get_userdata_from_horizontal_list(xmb, i); if (!node) continue; @@ -2029,7 +2030,7 @@ static void xmb_toggle_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu) unsigned i; size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL); - for (i = 0; i < list_size; i++) + for (i = 0; i < list_size + 1; i++) { xmb_node_t *node = &xmb->settings_node; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index e25c5fdc13..485bc6799b 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1368,7 +1368,7 @@ static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info) settings_t *settings = config_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr(); struct item_file *item = (struct item_file*) - menu_driver_list_get_entry(MENU_LIST_HORIZONTAL, menu->categories.selection_ptr - 1); + menu_driver_list_get_entry(MENU_LIST_HORIZONTAL, menu->categories.selection_ptr); if (!item) return -1;