Create RARCH_MENU_CTL_LIST_GET_ENTRY

This commit is contained in:
twinaphex 2016-02-11 01:12:19 +01:00
parent b3944a21d5
commit 4364ce92c3
3 changed files with 24 additions and 15 deletions

View File

@ -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);
item = (struct item_file*)
menu_driver_list_get_entry(MENU_LIST_HORIZONTAL,
list_info.selection - (list_info.size +1));
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*)list_horiz_info.entry;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return -1;

View File

@ -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;

View File

@ -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;