From 4364ce92c3b5e04e500a1bb91d5bca28b9a5c6ef Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 11 Feb 2016 01:12:19 +0100 Subject: [PATCH] Create RARCH_MENU_CTL_LIST_GET_ENTRY --- menu/menu_displaylist.c | 12 ++++++++---- menu/menu_driver.c | 24 +++++++++++++++--------- menu/menu_driver.h | 3 +-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index c72b8b900a..f280b3936a 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1757,6 +1757,7 @@ static int menu_displaylist_sort_playlist(const content_playlist_entry_t *a, static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info) { menu_ctx_list_t list_info; + menu_ctx_list_t list_horiz_info; char path_playlist[PATH_MAX_LENGTH], lpl_basename[PATH_MAX_LENGTH]; bool is_historylist = false; content_playlist_t *playlist = NULL; @@ -1766,12 +1767,15 @@ static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info) menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SELECTION, &list_info); - list_info.type = MENU_LIST_TABS; + list_info.type = MENU_LIST_TABS; menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SIZE, &list_info); + + list_horiz_info.type = MENU_LIST_HORIZONTAL; + list_horiz_info.idx = list_info.selection - (list_info.size +1); + + menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_ENTRY, &list_horiz_info); - item = (struct item_file*) - menu_driver_list_get_entry(MENU_LIST_HORIZONTAL, - list_info.selection - (list_info.size +1)); + item = (struct item_file*)list_horiz_info.entry; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) return -1; diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 93adddd217..4664904510 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -58,8 +58,6 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = { NULL }; -static const menu_ctx_driver_t *menu_driver_ctx = NULL; -static void *menu_userdata = NULL; /** * menu_driver_find_handle: @@ -189,13 +187,6 @@ static bool menu_init(menu_handle_t *menu_data) return true; } -void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i) -{ - if (!menu_driver_ctx || !menu_driver_ctx->list_get_entry) - return NULL; - return menu_driver_ctx->list_get_entry(menu_userdata, type, i); -} - static void menu_input_key_event(bool down, unsigned keycode, uint32_t character, uint16_t mod) { @@ -276,6 +267,8 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) static content_playlist_t *menu_driver_playlist = NULL; static struct video_shader *menu_driver_shader = NULL; static menu_handle_t *menu_driver_data = NULL; + static const menu_ctx_driver_t *menu_driver_ctx = NULL; + static void *menu_userdata = NULL; settings_t *settings = config_get_ptr(); switch (state) @@ -644,6 +637,19 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) info->label, info->type); } break; + case RARCH_MENU_CTL_LIST_GET_ENTRY: + { + menu_ctx_list_t *list = (menu_ctx_list_t*)data; + + if (!menu_driver_ctx || !menu_driver_ctx->list_get_entry) + { + list->entry = NULL; + return false; + } + list->entry = menu_driver_ctx->list_get_entry(menu_userdata, + list->type, list->idx); + } + break; case RARCH_MENU_CTL_LIST_GET_SIZE: { menu_ctx_list_t *list = (menu_ctx_list_t*)data; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 70bd6a0d22..538cc2b5f4 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -157,6 +157,7 @@ enum rarch_menu_ctl_state RARCH_MENU_CTL_LIST_SET_SELECTION, RARCH_MENU_CTL_LIST_GET_SELECTION, RARCH_MENU_CTL_LIST_GET_SIZE, + RARCH_MENU_CTL_LIST_GET_ENTRY, RARCH_MENU_CTL_LIST_CACHE, RARCH_MENU_CTL_LIST_INSERT, RARCH_MENU_CTL_LIST_PUSH, @@ -432,8 +433,6 @@ const char *menu_driver_find_ident(int index); **/ const char* config_get_menu_driver_options(void); -void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i); - /* HACK */ extern unsigned int rdb_entry_start_game_selection_ptr;