Create RARCH_MENU_CT_LIST_GET_SELECTION

This commit is contained in:
twinaphex 2016-02-11 00:59:55 +01:00
parent 9e69551408
commit 48e67d5546
5 changed files with 29 additions and 14 deletions

View File

@ -128,6 +128,7 @@ static int action_left_scroll(unsigned type, const char *label,
static int action_left_mainmenu(unsigned type, const char *label,
bool wraparound)
{
menu_ctx_list_t list_info;
size_t selection = 0;
menu_file_list_cbs_t *cbs = NULL;
unsigned push_list = 0;
@ -141,10 +142,12 @@ static int action_left_mainmenu(unsigned type, const char *label,
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SELECTION, &list_info);
if (list_size == 1)
{
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
if (menu_driver_list_get_selection() != 0
if ((list_info.selection != 0)
|| settings->menu.navigation.wraparound.enable)
push_list = 1;
}

View File

@ -148,6 +148,7 @@ static int action_right_scroll(unsigned type, const char *label,
static int action_right_mainmenu(unsigned type, const char *label,
bool wraparound)
{
menu_ctx_list_t list_info;
size_t selection = 0;
menu_file_list_cbs_t *cbs = NULL;
unsigned push_list = 0;
@ -163,7 +164,9 @@ static int action_right_mainmenu(unsigned type, const char *label,
size_t list_size_tabs = menu_driver_list_get_size(MENU_LIST_TABS);
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
if ((menu_driver_list_get_selection() != (list_size_horiz + list_size_tabs))
menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SELECTION, &list_info);
if ((list_info.selection != (list_size_horiz + list_size_tabs))
|| settings->menu.navigation.wraparound.enable)
push_list = 1;
}

View File

@ -1756,14 +1756,19 @@ 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;
char path_playlist[PATH_MAX_LENGTH], lpl_basename[PATH_MAX_LENGTH];
bool is_historylist = false;
content_playlist_t *playlist = NULL;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = NULL;
struct item_file *item = (struct item_file*)
struct item_file *item = NULL;
menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SELECTION, &list_info);
item = (struct item_file*)
menu_driver_list_get_entry(MENU_LIST_HORIZONTAL,
menu_driver_list_get_selection() - (menu_driver_list_get_size(MENU_LIST_TABS)+1));
list_info.selection - (menu_driver_list_get_size(MENU_LIST_TABS)+1));
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return -1;

View File

@ -189,13 +189,6 @@ static bool menu_init(menu_handle_t *menu_data)
return true;
}
size_t menu_driver_list_get_selection(void)
{
if (!menu_driver_ctx || !menu_driver_ctx->list_get_selection)
return 0;
return menu_driver_ctx->list_get_selection(menu_userdata);
}
size_t menu_driver_list_get_size(menu_list_type_t type)
{
if (!menu_driver_ctx || !menu_driver_ctx->list_get_size)
@ -658,6 +651,18 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
info->label, info->type);
}
break;
case RARCH_MENU_CTL_LIST_GET_SELECTION:
{
menu_ctx_list_t *list = (menu_ctx_list_t*)data;
if (!menu_driver_ctx || !menu_driver_ctx->list_get_selection)
{
list->selection = 0;
return false;
}
list->selection = menu_driver_ctx->list_get_selection(menu_userdata);
}
break;
case RARCH_MENU_CTL_LIST_FREE:
{
menu_ctx_list_t *list = (menu_ctx_list_t*)data;

View File

@ -155,6 +155,7 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_LIST_FREE,
RARCH_MENU_CTL_LIST_CLEAR,
RARCH_MENU_CTL_LIST_SET_SELECTION,
RARCH_MENU_CTL_LIST_GET_SELECTION,
RARCH_MENU_CTL_LIST_CACHE,
RARCH_MENU_CTL_LIST_INSERT,
RARCH_MENU_CTL_LIST_PUSH,
@ -354,6 +355,7 @@ typedef struct menu_ctx_list
size_t idx;
menu_list_type_t type;
unsigned action;
size_t selection;
} menu_ctx_list_t;
typedef struct menu_ctx_displaylist
@ -431,9 +433,6 @@ size_t menu_driver_list_get_size(menu_list_type_t type);
void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i);
size_t menu_driver_list_get_selection(void);
/* HACK */
extern unsigned int rdb_entry_start_game_selection_ptr;