mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Change return types of menu_driver_list_get_selection/get_size
and simplify struct
This commit is contained in:
parent
5de30567a1
commit
0674613d28
@ -270,26 +270,23 @@ static int action_left_goto_tab(void)
|
|||||||
static int action_left_mainmenu(unsigned type, const char *label,
|
static int action_left_mainmenu(unsigned type, const char *label,
|
||||||
bool wraparound)
|
bool wraparound)
|
||||||
{
|
{
|
||||||
menu_ctx_list_t list_info;
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool menu_nav_wraparound_enable = settings->bools.menu_navigation_wraparound_enable;
|
bool menu_nav_wraparound_enable = settings->bools.menu_navigation_wraparound_enable;
|
||||||
const char *menu_ident = menu_driver_ident();
|
const char *menu_ident = menu_driver_ident();
|
||||||
|
size_t selection = menu_driver_list_get_selection();
|
||||||
|
size_t size = menu_driver_list_get_size(MENU_LIST_PLAIN);
|
||||||
|
|
||||||
menu_driver_list_get_selection(&list_info);
|
#ifdef HAVE_XMB
|
||||||
|
|
||||||
list_info.type = MENU_LIST_PLAIN;
|
|
||||||
|
|
||||||
menu_driver_list_get_size(&list_info);
|
|
||||||
|
|
||||||
/* Tab switching functionality only applies
|
/* Tab switching functionality only applies
|
||||||
* to XMB */
|
* to XMB */
|
||||||
if ( (list_info.size == 1)
|
if ( (size == 1)
|
||||||
&& string_is_equal(menu_ident, "xmb"))
|
&& string_is_equal(menu_ident, "xmb"))
|
||||||
{
|
{
|
||||||
if ((list_info.selection != 0) || menu_nav_wraparound_enable)
|
if ((selection != 0) || menu_nav_wraparound_enable)
|
||||||
return action_left_goto_tab();
|
return action_left_goto_tab();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
action_left_scroll(0, "", false);
|
action_left_scroll(0, "", false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -358,11 +355,12 @@ static int action_left_shader_filter_default(unsigned type, const char *label,
|
|||||||
static int action_left_cheat_num_passes(unsigned type, const char *label,
|
static int action_left_cheat_num_passes(unsigned type, const char *label,
|
||||||
bool wraparound)
|
bool wraparound)
|
||||||
{
|
{
|
||||||
bool refresh = false;
|
bool refresh = false;
|
||||||
unsigned new_size = 0;
|
unsigned new_size = 0;
|
||||||
|
unsigned cheat_size = cheat_manager_get_size();
|
||||||
|
|
||||||
if (cheat_manager_get_size())
|
if (cheat_size)
|
||||||
new_size = cheat_manager_get_size() - 1;
|
new_size = cheat_size - 1;
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU);
|
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU);
|
||||||
|
@ -303,36 +303,27 @@ static int action_right_goto_tab(void)
|
|||||||
static int action_right_mainmenu(unsigned type, const char *label,
|
static int action_right_mainmenu(unsigned type, const char *label,
|
||||||
bool wraparound)
|
bool wraparound)
|
||||||
{
|
{
|
||||||
menu_ctx_list_t list_info;
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool menu_nav_wraparound_enable = settings->bools.menu_navigation_wraparound_enable;
|
bool menu_nav_wraparound_enable = settings->bools.menu_navigation_wraparound_enable;
|
||||||
const char *menu_ident = menu_driver_ident();
|
const char *menu_ident = menu_driver_ident();
|
||||||
|
size_t selection = menu_driver_list_get_selection();
|
||||||
|
size_t size = menu_driver_list_get_size(MENU_LIST_PLAIN);
|
||||||
|
|
||||||
menu_driver_list_get_selection(&list_info);
|
#ifdef HAVE_XMB
|
||||||
|
|
||||||
list_info.type = MENU_LIST_PLAIN;
|
|
||||||
|
|
||||||
menu_driver_list_get_size(&list_info);
|
|
||||||
|
|
||||||
/* Tab switching functionality only applies
|
/* Tab switching functionality only applies
|
||||||
* to XMB */
|
* to XMB */
|
||||||
if ((list_info.size == 1) &&
|
if ( (size == 1)
|
||||||
string_is_equal(menu_ident, "xmb"))
|
&& string_is_equal(menu_ident, "xmb"))
|
||||||
{
|
{
|
||||||
menu_ctx_list_t list_horiz_info;
|
size_t horiz_size = menu_driver_list_get_size(MENU_LIST_HORIZONTAL);
|
||||||
menu_ctx_list_t list_tabs_info;
|
size_t tabs_size = menu_driver_list_get_size(MENU_LIST_TABS);
|
||||||
|
|
||||||
list_horiz_info.type = MENU_LIST_HORIZONTAL;
|
if ( (selection != (horiz_size + tabs_size))
|
||||||
list_tabs_info.type = MENU_LIST_TABS;
|
|
||||||
|
|
||||||
menu_driver_list_get_size(&list_horiz_info);
|
|
||||||
menu_driver_list_get_size(&list_tabs_info);
|
|
||||||
|
|
||||||
if ((list_info.selection != (list_horiz_info.size + list_tabs_info.size))
|
|
||||||
|| menu_nav_wraparound_enable)
|
|| menu_nav_wraparound_enable)
|
||||||
return action_right_goto_tab();
|
return action_right_goto_tab();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
action_right_scroll(0, "", false);
|
action_right_scroll(0, "", false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3331,22 +3331,16 @@ static void menu_displaylist_set_new_playlist(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int menu_displaylist_parse_horizontal_list(
|
static int menu_displaylist_parse_horizontal_list(
|
||||||
menu_handle_t *menu,
|
menu_handle_t *menu, settings_t *settings,
|
||||||
settings_t *settings,
|
|
||||||
menu_displaylist_info_t *info)
|
menu_displaylist_info_t *info)
|
||||||
{
|
{
|
||||||
menu_ctx_list_t list_info;
|
|
||||||
menu_ctx_list_t list_horiz_info;
|
menu_ctx_list_t list_horiz_info;
|
||||||
struct item_file *item = NULL;
|
struct item_file *item = NULL;
|
||||||
|
size_t selection = menu_driver_list_get_selection();
|
||||||
|
size_t size = menu_driver_list_get_size(MENU_LIST_TABS);
|
||||||
|
|
||||||
menu_driver_list_get_selection(&list_info);
|
list_horiz_info.type = MENU_LIST_HORIZONTAL;
|
||||||
|
list_horiz_info.idx = selection - (size +1);
|
||||||
list_info.type = MENU_LIST_TABS;
|
|
||||||
|
|
||||||
menu_driver_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_list_get_entry(&list_horiz_info);
|
menu_driver_list_get_entry(&list_horiz_info);
|
||||||
|
|
||||||
|
@ -4561,33 +4561,22 @@ bool menu_driver_list_get_entry(menu_ctx_list_t *list)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool menu_driver_list_get_selection(menu_ctx_list_t *list)
|
size_t menu_driver_list_get_selection(void)
|
||||||
{
|
{
|
||||||
struct menu_state *menu_st = &menu_driver_state;
|
struct menu_state *menu_st = &menu_driver_state;
|
||||||
if ( !menu_st->driver_ctx ||
|
if ( !menu_st->driver_ctx ||
|
||||||
!menu_st->driver_ctx->list_get_selection)
|
!menu_st->driver_ctx->list_get_selection)
|
||||||
{
|
return 0;
|
||||||
list->selection = 0;
|
return menu_st->driver_ctx->list_get_selection(menu_st->userdata);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
list->selection = menu_st->driver_ctx->list_get_selection(
|
|
||||||
menu_st->userdata);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool menu_driver_list_get_size(menu_ctx_list_t *list)
|
size_t menu_driver_list_get_size(enum menu_list_type type)
|
||||||
{
|
{
|
||||||
struct menu_state *menu_st = &menu_driver_state;
|
struct menu_state *menu_st = &menu_driver_state;
|
||||||
if ( !menu_st->driver_ctx ||
|
if ( !menu_st->driver_ctx
|
||||||
!menu_st->driver_ctx->list_get_size)
|
|| !menu_st->driver_ctx->list_get_size)
|
||||||
{
|
return 0;
|
||||||
list->size = 0;
|
return menu_st->driver_ctx->list_get_size(menu_st->userdata, type);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
list->size = menu_st->driver_ctx->list_get_size(
|
|
||||||
menu_st->userdata, list->type);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_input_get_pointer_state(menu_input_pointer_t *copy_target)
|
void menu_input_get_pointer_state(menu_input_pointer_t *copy_target)
|
||||||
|
@ -622,12 +622,12 @@ bool menu_driver_list_cache(menu_ctx_list_t *list);
|
|||||||
|
|
||||||
bool menu_driver_init(bool video_is_threaded);
|
bool menu_driver_init(bool video_is_threaded);
|
||||||
|
|
||||||
bool menu_driver_list_get_selection(menu_ctx_list_t *list);
|
size_t menu_driver_list_get_selection(void);
|
||||||
|
|
||||||
|
size_t menu_driver_list_get_size(enum menu_list_type type);
|
||||||
|
|
||||||
bool menu_driver_list_get_entry(menu_ctx_list_t *list);
|
bool menu_driver_list_get_entry(menu_ctx_list_t *list);
|
||||||
|
|
||||||
bool menu_driver_list_get_size(menu_ctx_list_t *list);
|
|
||||||
|
|
||||||
retro_time_t menu_driver_get_current_time(void);
|
retro_time_t menu_driver_get_current_time(void);
|
||||||
|
|
||||||
void menu_display_timedate(gfx_display_ctx_datetime_t *datetime);
|
void menu_display_timedate(gfx_display_ctx_datetime_t *datetime);
|
||||||
|
@ -82,8 +82,6 @@ typedef struct menu_ctx_list
|
|||||||
file_list_t *list;
|
file_list_t *list;
|
||||||
void *entry;
|
void *entry;
|
||||||
size_t idx;
|
size_t idx;
|
||||||
size_t selection;
|
|
||||||
size_t size;
|
|
||||||
size_t list_size;
|
size_t list_size;
|
||||||
unsigned entry_type;
|
unsigned entry_type;
|
||||||
unsigned action;
|
unsigned action;
|
||||||
|
@ -1001,26 +1001,24 @@ static const char* explore_get_view_path(void)
|
|||||||
/* check if we are opening a saved view from the horizontal/tabs menu */
|
/* check if we are opening a saved view from the horizontal/tabs menu */
|
||||||
if (cur->type == MENU_SETTING_HORIZONTAL_MENU)
|
if (cur->type == MENU_SETTING_HORIZONTAL_MENU)
|
||||||
{
|
{
|
||||||
menu_ctx_list_t tabs, horizontal;
|
size_t selection, size;
|
||||||
tabs.type = MENU_LIST_TABS;
|
selection = menu_driver_list_get_selection();
|
||||||
if (menu_driver_list_get_selection(&tabs) && menu_driver_list_get_size(&tabs))
|
size = menu_driver_list_get_size(MENU_LIST_TABS);
|
||||||
|
if (selection > 0 && size > 0)
|
||||||
{
|
{
|
||||||
|
menu_ctx_list_t horizontal;
|
||||||
horizontal.type = MENU_LIST_HORIZONTAL;
|
horizontal.type = MENU_LIST_HORIZONTAL;
|
||||||
horizontal.idx = tabs.selection - (tabs.size + 1);
|
horizontal.idx = selection - (size + 1);
|
||||||
|
/* Label contains the path and path contains the label */
|
||||||
if (menu_driver_list_get_entry(&horizontal))
|
if (menu_driver_list_get_entry(&horizontal))
|
||||||
{
|
|
||||||
/* label contains the path and path contains the label */
|
|
||||||
return ((struct item_file*)horizontal.entry)->label;
|
return ((struct item_file*)horizontal.entry)->label;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if we are opening a saved view via Content > Playlists */
|
/* check if we are opening a saved view via Content > Playlists */
|
||||||
if (cur->type == MENU_EXPLORE_TAB && cur->path && !string_is_equal(cur->path,
|
if (cur->type == MENU_EXPLORE_TAB && cur->path && !string_is_equal(cur->path,
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_GOTO_EXPLORE)))
|
msg_hash_to_str(MENU_ENUM_LABEL_GOTO_EXPLORE)))
|
||||||
{
|
|
||||||
return cur->path;
|
return cur->path;
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -93,12 +93,13 @@ static void cb_task_menu_explore_init(
|
|||||||
/* check if we are opening a saved view from the horizontal/tabs menu */
|
/* check if we are opening a saved view from the horizontal/tabs menu */
|
||||||
if (menu_type == MENU_SETTING_HORIZONTAL_MENU)
|
if (menu_type == MENU_SETTING_HORIZONTAL_MENU)
|
||||||
{
|
{
|
||||||
menu_ctx_list_t tabs, horizontal;
|
size_t selection = menu_driver_list_get_selection();
|
||||||
tabs.type = MENU_LIST_TABS;
|
size_t size = menu_driver_list_get_size(MENU_LIST_TABS);
|
||||||
if (menu_driver_list_get_selection(&tabs) && menu_driver_list_get_size(&tabs))
|
if (selection > 0 && size > 0)
|
||||||
{
|
{
|
||||||
|
menu_ctx_list_t horizontal;
|
||||||
horizontal.type = MENU_LIST_HORIZONTAL;
|
horizontal.type = MENU_LIST_HORIZONTAL;
|
||||||
horizontal.idx = tabs.selection - (tabs.size + 1);
|
horizontal.idx = selection - (size + 1);
|
||||||
if (menu_driver_list_get_entry(&horizontal))
|
if (menu_driver_list_get_entry(&horizontal))
|
||||||
menu_type = ((struct item_file*)horizontal.entry)->type;
|
menu_type = ((struct item_file*)horizontal.entry)->type;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user