mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 02:00:41 +00:00
Get rid of some useless wrapper functions
This commit is contained in:
parent
8844c991e1
commit
976d7b8067
@ -267,11 +267,10 @@ static int action_left_goto_tab(void)
|
||||
static int action_left_mainmenu(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool menu_nav_wraparound_enable = settings->bools.menu_navigation_wraparound_enable;
|
||||
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);
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx;
|
||||
const char *menu_ident = (driver_ctx && driver_ctx->ident) ? driver_ctx->ident : NULL;
|
||||
size_t size = (driver_ctx && driver_ctx->list_get_size) ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_PLAIN) : 0;
|
||||
|
||||
#ifdef HAVE_XMB
|
||||
/* Tab switching functionality only applies
|
||||
@ -279,6 +278,9 @@ static int action_left_mainmenu(unsigned type, const char *label,
|
||||
if ( (size == 1)
|
||||
&& string_is_equal(menu_ident, "xmb"))
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool menu_nav_wraparound_enable = settings->bools.menu_navigation_wraparound_enable;
|
||||
size_t selection = (driver_ctx && driver_ctx->list_get_selection) ? driver_ctx->list_get_selection(menu_st->userdata) : 0;
|
||||
if ((selection != 0) || menu_nav_wraparound_enable)
|
||||
return action_left_goto_tab();
|
||||
}
|
||||
|
@ -295,11 +295,10 @@ static int action_right_goto_tab(void)
|
||||
static int action_right_mainmenu(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool menu_nav_wraparound_enable = settings->bools.menu_navigation_wraparound_enable;
|
||||
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);
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx;
|
||||
const char *menu_ident = (driver_ctx && driver_ctx->ident) ? driver_ctx->ident : NULL;
|
||||
size_t size = (driver_ctx && driver_ctx->list_get_size) ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_PLAIN) : 0;
|
||||
|
||||
#ifdef HAVE_XMB
|
||||
/* Tab switching functionality only applies
|
||||
@ -307,8 +306,18 @@ static int action_right_mainmenu(unsigned type, const char *label,
|
||||
if ( (size == 1)
|
||||
&& string_is_equal(menu_ident, "xmb"))
|
||||
{
|
||||
size_t horiz_size = menu_driver_list_get_size(MENU_LIST_HORIZONTAL);
|
||||
size_t tabs_size = menu_driver_list_get_size(MENU_LIST_TABS);
|
||||
size_t horiz_size = 0, tabs_size = 0, selection = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool menu_nav_wraparound_enable = settings->bools.menu_navigation_wraparound_enable;
|
||||
if (driver_ctx)
|
||||
{
|
||||
selection = (driver_ctx->list_get_selection) ? driver_ctx->list_get_selection(menu_st->userdata) : 0;
|
||||
if (driver_ctx->list_get_size)
|
||||
{
|
||||
horiz_size = driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_HORIZONTAL);
|
||||
tabs_size = driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS);
|
||||
}
|
||||
}
|
||||
|
||||
if ( (selection != (horiz_size + tabs_size))
|
||||
|| menu_nav_wraparound_enable)
|
||||
|
@ -3330,20 +3330,20 @@ static void menu_displaylist_set_new_playlist(
|
||||
}
|
||||
|
||||
static int menu_displaylist_parse_horizontal_list(
|
||||
menu_handle_t *menu, settings_t *settings,
|
||||
menu_handle_t *menu, struct menu_state *menu_st,
|
||||
settings_t *settings,
|
||||
menu_displaylist_info_t *info)
|
||||
{
|
||||
menu_ctx_list_t list_horiz_info;
|
||||
struct item_file *item = NULL;
|
||||
size_t selection = menu_driver_list_get_selection();
|
||||
size_t size = menu_driver_list_get_size(MENU_LIST_TABS);
|
||||
struct item_file *item = NULL;
|
||||
const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx;
|
||||
size_t selection = driver_ctx->list_get_selection ? driver_ctx->list_get_selection(menu_st->userdata) : 0;
|
||||
size_t size = driver_ctx->list_get_size ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0;
|
||||
|
||||
list_horiz_info.type = MENU_LIST_HORIZONTAL;
|
||||
list_horiz_info.idx = selection - (size +1);
|
||||
if (!driver_ctx->list_get_entry)
|
||||
return -1;
|
||||
|
||||
menu_driver_list_get_entry(&list_horiz_info);
|
||||
|
||||
if (!(item = (struct item_file*)list_horiz_info.entry))
|
||||
if (!(item = (struct item_file*)driver_ctx->list_get_entry(menu_st->userdata, MENU_LIST_HORIZONTAL,
|
||||
(unsigned)(selection - (size +1)))))
|
||||
return -1;
|
||||
|
||||
/* When opening a saved view the explore menu will handle the list */
|
||||
@ -5617,7 +5617,7 @@ static int menu_displaylist_parse_playlist_generic(
|
||||
bool sort_enabled,
|
||||
int *ret)
|
||||
{
|
||||
unsigned count = 0;
|
||||
unsigned count = 0;
|
||||
playlist_t *playlist = NULL;
|
||||
|
||||
menu_displaylist_set_new_playlist(menu, settings,
|
||||
@ -13608,7 +13608,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||
break;
|
||||
case DISPLAYLIST_HORIZONTAL:
|
||||
menu_entries_clear(info->list);
|
||||
ret = menu_displaylist_parse_horizontal_list(menu, settings, info);
|
||||
ret = menu_displaylist_parse_horizontal_list(menu, menu_st, settings, info);
|
||||
|
||||
/* Playlists themselves are sorted
|
||||
* > Display lists generated from playlists
|
||||
|
@ -4422,39 +4422,6 @@ void menu_driver_destroy(
|
||||
menu_st->input_driver_flushing_input = 0;
|
||||
}
|
||||
|
||||
bool menu_driver_list_get_entry(menu_ctx_list_t *list)
|
||||
{
|
||||
struct menu_state *menu_st = &menu_driver_state;
|
||||
if ( !menu_st->driver_ctx ||
|
||||
!menu_st->driver_ctx->list_get_entry)
|
||||
{
|
||||
list->entry = NULL;
|
||||
return false;
|
||||
}
|
||||
list->entry = menu_st->driver_ctx->list_get_entry(
|
||||
menu_st->userdata,
|
||||
list->type, (unsigned int)list->idx);
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t menu_driver_list_get_selection(void)
|
||||
{
|
||||
struct menu_state *menu_st = &menu_driver_state;
|
||||
if ( !menu_st->driver_ctx ||
|
||||
!menu_st->driver_ctx->list_get_selection)
|
||||
return 0;
|
||||
return menu_st->driver_ctx->list_get_selection(menu_st->userdata);
|
||||
}
|
||||
|
||||
size_t menu_driver_list_get_size(enum menu_list_type type)
|
||||
{
|
||||
struct menu_state *menu_st = &menu_driver_state;
|
||||
if ( !menu_st->driver_ctx
|
||||
|| !menu_st->driver_ctx->list_get_size)
|
||||
return 0;
|
||||
return menu_st->driver_ctx->list_get_size(menu_st->userdata, type);
|
||||
}
|
||||
|
||||
void menu_input_get_pointer_state(menu_input_pointer_t *copy_target)
|
||||
{
|
||||
struct menu_state *menu_st = &menu_driver_state;
|
||||
|
@ -619,12 +619,6 @@ int menu_driver_deferred_push_content_list(file_list_t *list);
|
||||
|
||||
bool menu_driver_init(bool video_is_threaded);
|
||||
|
||||
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);
|
||||
|
||||
retro_time_t menu_driver_get_current_time(void);
|
||||
|
||||
void menu_display_timedate(gfx_display_ctx_datetime_t *datetime);
|
||||
|
@ -993,16 +993,19 @@ static const char* explore_get_view_path(struct menu_state *menu_st, menu_list_t
|
||||
/* check if we are opening a saved view from the horizontal/tabs menu */
|
||||
if (cur->type == MENU_SETTING_HORIZONTAL_MENU)
|
||||
{
|
||||
size_t selection = menu_driver_list_get_selection();
|
||||
size_t size = menu_driver_list_get_size(MENU_LIST_TABS);
|
||||
if (selection > 0 && size > 0)
|
||||
const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx;
|
||||
if (driver_ctx->list_get_entry)
|
||||
{
|
||||
menu_ctx_list_t horizontal;
|
||||
horizontal.type = MENU_LIST_HORIZONTAL;
|
||||
horizontal.idx = selection - (size + 1);
|
||||
/* Label contains the path and path contains the label */
|
||||
if (menu_driver_list_get_entry(&horizontal))
|
||||
return ((struct item_file*)horizontal.entry)->label;
|
||||
size_t selection = driver_ctx->list_get_selection ? driver_ctx->list_get_selection(menu_st->userdata) : 0;
|
||||
size_t size = driver_ctx->list_get_size ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0;
|
||||
if (selection > 0 && size > 0)
|
||||
{
|
||||
struct item_file *item = NULL;
|
||||
/* Label contains the path and path contains the label */
|
||||
if ((item = (struct item_file*)driver_ctx->list_get_entry(menu_st->userdata, MENU_LIST_HORIZONTAL,
|
||||
(unsigned)(selection - (size +1)))))
|
||||
return item->label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
#include "tasks_internal.h"
|
||||
|
||||
#include "../menu/menu_entries.h"
|
||||
#include "../menu/menu_driver.h"
|
||||
|
||||
typedef struct menu_explore_init_handle
|
||||
@ -73,13 +72,12 @@ static void cb_task_menu_explore_init(
|
||||
{
|
||||
menu_explore_init_handle_t *menu_explore = NULL;
|
||||
unsigned menu_type = 0;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
|
||||
if (!task)
|
||||
return;
|
||||
|
||||
menu_explore = (menu_explore_init_handle_t*)task->state;
|
||||
|
||||
if (!menu_explore)
|
||||
if (!(menu_explore = (menu_explore_init_handle_t*)task->state))
|
||||
return;
|
||||
|
||||
/* Assign global menu explore state object */
|
||||
@ -93,24 +91,25 @@ static void cb_task_menu_explore_init(
|
||||
/* check if we are opening a saved view from the horizontal/tabs menu */
|
||||
if (menu_type == MENU_SETTING_HORIZONTAL_MENU)
|
||||
{
|
||||
size_t selection = menu_driver_list_get_selection();
|
||||
size_t size = menu_driver_list_get_size(MENU_LIST_TABS);
|
||||
if (selection > 0 && size > 0)
|
||||
const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx;
|
||||
if (driver_ctx->list_get_entry)
|
||||
{
|
||||
menu_ctx_list_t horizontal;
|
||||
horizontal.type = MENU_LIST_HORIZONTAL;
|
||||
horizontal.idx = selection - (size + 1);
|
||||
if (menu_driver_list_get_entry(&horizontal))
|
||||
menu_type = ((struct item_file*)horizontal.entry)->type;
|
||||
size_t selection = driver_ctx->list_get_selection ? driver_ctx->list_get_selection(menu_st->userdata) : 0;
|
||||
size_t size = driver_ctx->list_get_size ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0;
|
||||
if (selection > 0 && size > 0)
|
||||
{
|
||||
struct item_file *item = NULL;
|
||||
/* Label contains the path and path contains the label */
|
||||
if ((item = (struct item_file*)driver_ctx->list_get_entry(menu_st->userdata, MENU_LIST_HORIZONTAL,
|
||||
(unsigned)(selection - (size +1)))))
|
||||
menu_type = item->type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_type == MENU_EXPLORE_TAB)
|
||||
{
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
|
||||
| MENU_ST_FLAG_PREVENT_POPULATE;
|
||||
}
|
||||
}
|
||||
|
||||
static void task_menu_explore_init_free(retro_task_t *task)
|
||||
@ -131,47 +130,37 @@ static void task_menu_explore_init_free(retro_task_t *task)
|
||||
|
||||
static void task_menu_explore_init_handler(retro_task_t *task)
|
||||
{
|
||||
menu_explore_init_handle_t *menu_explore = NULL;
|
||||
|
||||
if (!task)
|
||||
goto task_finished;
|
||||
|
||||
menu_explore = (menu_explore_init_handle_t*)task->state;
|
||||
|
||||
if (!menu_explore)
|
||||
goto task_finished;
|
||||
|
||||
if (task_get_cancelled(task))
|
||||
goto task_finished;
|
||||
|
||||
/* TODO/FIXME: It could be beneficial to
|
||||
* initialise the explore menu iteratively,
|
||||
* but this would require a non-trivial rewrite
|
||||
* of the menu_explore code. For now, we will
|
||||
* do it in a single shot (the most important
|
||||
* consideration here is to place this
|
||||
* initialisation on a background thread) */
|
||||
menu_explore->state = menu_explore_build_list(
|
||||
menu_explore->directory_playlist,
|
||||
menu_explore->directory_database);
|
||||
|
||||
task_set_progress(task, 100);
|
||||
|
||||
task_finished:
|
||||
|
||||
if (task)
|
||||
{
|
||||
menu_explore_init_handle_t *menu_explore = NULL;
|
||||
if ((menu_explore = (menu_explore_init_handle_t*)task->state))
|
||||
{
|
||||
if (!task_get_cancelled(task))
|
||||
{
|
||||
/* TODO/FIXME: It could be beneficial to
|
||||
* initialise the explore menu iteratively,
|
||||
* but this would require a non-trivial rewrite
|
||||
* of the menu_explore code. For now, we will
|
||||
* do it in a single shot (the most important
|
||||
* consideration here is to place this
|
||||
* initialisation on a background thread) */
|
||||
menu_explore->state = menu_explore_build_list(
|
||||
menu_explore->directory_playlist,
|
||||
menu_explore->directory_database);
|
||||
|
||||
task_set_progress(task, 100);
|
||||
}
|
||||
}
|
||||
|
||||
task_set_finished(task, true);
|
||||
}
|
||||
}
|
||||
|
||||
static bool task_menu_explore_init_finder(
|
||||
retro_task_t *task, void *user_data)
|
||||
{
|
||||
if (!task)
|
||||
return false;
|
||||
|
||||
if (task->handler == task_menu_explore_init_handler)
|
||||
if (task && task->handler == task_menu_explore_init_handler)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -182,8 +171,8 @@ bool task_push_menu_explore_init(const char *directory_playlist,
|
||||
retro_task_t *task = NULL;
|
||||
menu_explore_init_handle_t *menu_explore = NULL;
|
||||
|
||||
if (string_is_empty(directory_playlist) ||
|
||||
string_is_empty(directory_database))
|
||||
if ( string_is_empty(directory_playlist)
|
||||
|| string_is_empty(directory_database))
|
||||
goto error;
|
||||
|
||||
task = task_init();
|
||||
|
Loading…
Reference in New Issue
Block a user