(Menu) Get rid of a bunch of useless wrpaper function calls

This commit is contained in:
libretroadmin 2023-05-06 07:39:20 +02:00
parent fe8221a259
commit ead88eebfe
6 changed files with 174 additions and 118 deletions

View File

@ -238,24 +238,27 @@ static int action_right_scroll(unsigned type, const char *label,
if (menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
{
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
size_t selection = menu_st->selection_ptr;
unsigned scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
unsigned fast_scroll_speed = 10 * scroll_speed;
size_t entries_end = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
if (selection + fast_scroll_speed < (menu_entries_get_size()))
if (selection + fast_scroll_speed < entries_end)
{
size_t idx = selection + fast_scroll_speed;
menu_navigation_set_selection(idx);
menu_driver_navigation_set(true);
size_t idx = selection + fast_scroll_speed;
menu_st->selection_ptr = idx;
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
}
else
{
if ((menu_entries_get_size() > 0))
if (entries_end > 0)
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
}
#ifdef HAVE_AUDIOMIXER
if (selection != menu_navigation_get_selection())
if (selection != menu_st->selection_ptr)
audio_driver_mixer_play_scroll_sound(false);
#endif
}

View File

@ -1763,12 +1763,14 @@ static int action_bind_sublabel_playlist_entry(
char *s, size_t len)
{
size_t _len;
size_t list_size = menu_entries_get_size();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
size_t list_size = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
playlist_t *playlist = NULL;
const struct playlist_entry *entry = NULL;
size_t playlist_index = i;
#ifdef HAVE_OZONE
const char *menu_ident = menu_driver_ident();
const char *menu_ident = (menu_st->driver_ctx && menu_st->driver_ctx->ident) ? menu_st->driver_ctx->ident : NULL;
#endif
settings_t *settings = config_get_ptr();
bool playlist_show_sublabels = settings->bools.playlist_show_sublabels;

View File

@ -4034,7 +4034,9 @@ static void linebreak_after_colon(char (*str)[255])
static void ozone_update_content_metadata(ozone_handle_t *ozone)
{
const char *core_name = NULL;
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
size_t selection = menu_st->selection_ptr;
playlist_t *playlist = playlist_get_cached();
settings_t *settings = config_get_ptr();
bool scroll_content_metadata = settings->bools.ozone_scroll_content_metadata;
@ -4081,8 +4083,8 @@ static void ozone_update_content_metadata(ozone_handle_t *ozone)
const char *core_label = NULL;
const struct playlist_entry *entry = NULL;
ssize_t playlist_index = selection;
size_t list_size = menu_entries_get_size();
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
size_t list_size = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
file_list_t *list = MENU_LIST_GET_SELECTION(menu_list, 0);
bool content_runtime_log = settings->bools.content_runtime_log;
bool content_runtime_log_aggr = settings->bools.content_runtime_log_aggregate;
@ -4263,7 +4265,8 @@ static void ozone_tab_set_selection(void *data)
size_t tab_selection = ozone->tab_selection[ozone->categories_selection_ptr];
if (tab_selection)
{
menu_navigation_set_selection(tab_selection);
struct menu_state *menu_st = menu_state_get_ptr();
menu_st->selection_ptr = tab_selection;
ozone_selection_changed(ozone, false);
}
}
@ -4422,6 +4425,8 @@ static void ozone_list_cache(
float scale_factor;
unsigned first = 0;
unsigned last = 0;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = NULL;
ozone_handle_t *ozone = (ozone_handle_t*)data;
@ -4440,8 +4445,8 @@ static void ozone_list_cache(
/* Deep copy visible elements */
video_driver_get_size(NULL, &video_info_height);
y = ozone->dimensions.header_height + ozone->dimensions.entry_padding_vertical;
entries_end = menu_entries_get_size();
selection_buf = menu_entries_get_selection_buf_ptr(0);
entries_end = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
bottom_boundary = video_info_height - ozone->dimensions.header_height - ozone->dimensions.footer_height;
for (i = 0; i < entries_end; i++)
@ -4479,8 +4484,10 @@ static void ozone_change_tab(
enum msg_hash_enums tab,
enum menu_settings_type type)
{
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
size_t stack_size = menu_stack->size;
if (menu_stack->list[stack_size - 1].label)
@ -5258,8 +5265,10 @@ static void ozone_update_scroll(
gfx_animation_ctx_entry_t entry;
float new_scroll = 0, entries_middle;
float bottom_boundary, current_selection_middle_onscreen;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
uintptr_t tag = (uintptr_t) selection_buf;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
uintptr_t tag = (uintptr_t)selection_buf;
video_driver_get_size(NULL, &video_info_height);
@ -5332,10 +5341,12 @@ static void ozone_compute_entries_position(
bool menu_show_sublabels,
size_t entries_end)
{
size_t i;
/* Compute entries height and adjust scrolling if needed */
unsigned video_info_height;
unsigned video_info_width;
size_t i;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = NULL;
int entry_padding = ozone_get_entries_padding(ozone);
float scale_factor = ozone->last_scale_factor;
@ -5354,7 +5365,7 @@ static void ozone_compute_entries_position(
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i);
selection_buf = menu_entries_get_selection_buf_ptr(0);
selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
video_driver_get_size(&video_info_width, &video_info_height);
@ -7023,7 +7034,9 @@ static void ozone_hide_fullscreen_thumbnails(ozone_handle_t *ozone, bool animate
static void ozone_show_fullscreen_thumbnails(ozone_handle_t *ozone)
{
gfx_animation_ctx_entry_t animation_entry;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
uintptr_t alpha_tag = (uintptr_t)&ozone->animations.fullscreen_thumbnail_alpha;
uintptr_t scroll_tag = (uintptr_t)selection_buf;
@ -7462,6 +7475,8 @@ error:
static void ozone_set_thumbnail_content(void *data, const char *s)
{
ozone_handle_t *ozone = (ozone_handle_t*)data;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
if (!ozone)
return;
@ -7471,9 +7486,9 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
/* Playlist content */
if (string_is_empty(s))
{
size_t selection = menu_navigation_get_selection();
size_t list_size = menu_entries_get_size();
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
size_t selection = menu_st->selection_ptr;
size_t list_size = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
file_list_t *list = MENU_LIST_GET_SELECTION(menu_list, 0);
/* Get playlist index corresponding
* to the selected entry */
@ -7513,7 +7528,7 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
MENU_ENTRY_INITIALIZE(entry);
entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED;
menu_entry_get(&entry, 0, menu_navigation_get_selection(), NULL, true);
menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true);
if (!string_is_empty(entry.path))
gfx_thumbnail_set_content(ozone->thumbnail_path_data, entry.path);
@ -7530,7 +7545,7 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
MENU_ENTRY_INITIALIZE(entry);
entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED;
menu_entry_get(&entry, 0, menu_navigation_get_selection(), NULL, true);
menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true);
if (menu_explore_set_playlist_thumbnail(entry.type, ozone->thumbnail_path_data) >= 0)
ozone->flags |= OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE;
@ -7547,8 +7562,8 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
else if (string_is_equal(s, "imageviewer"))
{
/* Filebrowser image updates */
size_t selection = menu_navigation_get_selection();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
size_t selection = menu_st->selection_ptr;
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
ozone_node_t *node = (ozone_node_t*)selection_buf->list[selection].userdata;
if (node)
@ -7583,8 +7598,8 @@ static bool INLINE ozone_category_onscreen(
ozone_handle_t *ozone,
size_t idx)
{
return (idx >= ozone->first_onscreen_category) &&
(idx <= ozone->last_onscreen_category);
return (idx >= ozone->first_onscreen_category)
&& (idx <= ozone->last_onscreen_category);
}
/* If current category is on screen, returns its
@ -7609,25 +7624,21 @@ static void ozone_auto_select_onscreen_entry(
ozone_handle_t *ozone,
enum ozone_onscreen_entry_position_type target_entry)
{
size_t selection = 0;
struct menu_state *menu_st = menu_state_get_ptr();
/* Update selection index */
switch (target_entry)
{
case OZONE_ONSCREEN_ENTRY_FIRST:
selection = ozone->first_onscreen_entry;
menu_st->selection_ptr = ozone->first_onscreen_entry;
break;
case OZONE_ONSCREEN_ENTRY_LAST:
selection = ozone->last_onscreen_entry;
menu_st->selection_ptr = ozone->last_onscreen_entry;
break;
case OZONE_ONSCREEN_ENTRY_CENTRE:
default:
selection = (ozone->first_onscreen_entry >> 1) + (ozone->last_onscreen_entry >> 1);
menu_st->selection_ptr = (ozone->first_onscreen_entry >> 1) + (ozone->last_onscreen_entry >> 1);
break;
}
/* Apply new selection */
menu_navigation_set_selection(selection);
}
static bool INLINE ozone_metadata_override_available(ozone_handle_t *ozone, settings_t *settings)
@ -7643,8 +7654,8 @@ static bool INLINE ozone_metadata_override_available(ozone_handle_t *ozone, sett
* only OZONE_FLAG_IS_PLAYLIST will be evaluated,
* so this isn't too much of a performance hog... */
return (
(ozone->flags & OZONE_FLAG_IS_PLAYLIST) ||
(ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST)
(ozone->flags & OZONE_FLAG_IS_PLAYLIST)
|| (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST)
)
&& (ozone->show_thumbnail_bar)
&& (settings->uints.menu_left_thumbnails)
@ -7930,22 +7941,24 @@ static enum menu_action ozone_parse_menu_entry_action(
bool ozone_collapse_sidebar,
enum menu_action action)
{
settings_t *settings = config_get_ptr();
uintptr_t tag;
int new_selection;
enum menu_action new_action = action;
file_list_t *selection_buf = NULL;
unsigned horizontal_list_size = 0;
bool is_current_entry_settings;
size_t selection;
size_t selection_total;
bool is_current_entry_settings = false;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
settings_t *settings = config_get_ptr();
enum menu_action new_action = action;
file_list_t *selection_buf = NULL;
unsigned horizontal_list_size = 0;
/* We have to override the thumbnail stream
* delay when opening the thumbnail sidebar;
* ensure that the proper value is restored
* whenever the user performs regular navigation */
if ((action != MENU_ACTION_NOOP) &&
(ozone->thumbnails.stream_delay != OZONE_THUMBNAIL_STREAM_DELAY))
if ( (action != MENU_ACTION_NOOP)
&& (ozone->thumbnails.stream_delay != OZONE_THUMBNAIL_STREAM_DELAY))
{
ozone->thumbnails.stream_delay = OZONE_THUMBNAIL_STREAM_DELAY;
gfx_thumbnail_set_stream_delay(ozone->thumbnails.stream_delay);
@ -7957,10 +7970,10 @@ static enum menu_action ozone_parse_menu_entry_action(
ozone->flags |= OZONE_FLAG_MSGBOX_STATE;
else
ozone->flags &= ~OZONE_FLAG_MSGBOX_STATE;
selection_buf = menu_entries_get_selection_buf_ptr(0);
selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
tag = (uintptr_t)selection_buf;
selection = menu_navigation_get_selection();
selection_total = menu_entries_get_size();
selection = menu_st->selection_ptr;
selection_total = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
/* Don't wiggle left or right if the current entry is a setting. This is
partially wrong because some settings don't use left and right to change their value, such as
@ -8016,7 +8029,7 @@ static enum menu_action ozone_parse_menu_entry_action(
if (!(ozone->flags & OZONE_FLAG_EMPTY_PLAYLIST))
ozone_leave_sidebar(ozone, ozone_collapse_sidebar, tag);
menu_navigation_set_selection(0);
menu_st->selection_ptr = 0;
ozone_selection_changed(ozone, false);
break;
}
@ -8149,7 +8162,8 @@ static enum menu_action ozone_parse_menu_entry_action(
* is off screen, auto select *centre* item */
if (ozone->flags & OZONE_FLAG_CURSOR_MODE)
if (!OZONE_ENTRY_ONSCREEN(ozone, selection))
ozone_auto_select_onscreen_entry(ozone, OZONE_ONSCREEN_ENTRY_CENTRE);
ozone_auto_select_onscreen_entry(ozone,
OZONE_ONSCREEN_ENTRY_CENTRE);
ozone->flags &= ~OZONE_FLAG_CURSOR_MODE;
break;
case MENU_ACTION_LEFT:
@ -8202,9 +8216,9 @@ static enum menu_action ozone_parse_menu_entry_action(
&& !is_current_entry_settings)
ozone_start_cursor_wiggle(ozone, MENU_ACTION_DOWN);
if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)
&& ( (ozone->flags & OZONE_FLAG_IS_PLAYLIST) ||
(ozone->is_quick_menu && !menu_is_running_quick_menu())))
if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)
&& ( (ozone->flags & OZONE_FLAG_IS_PLAYLIST)
|| (ozone->is_quick_menu && !menu_is_running_quick_menu())))
return MENU_ACTION_NOOP;
break;
@ -8284,7 +8298,7 @@ static enum menu_action ozone_parse_menu_entry_action(
{
/* Jump to first item on Main Menu */
ozone->tab_selection[ozone->categories_selection_ptr] = 0;
menu_navigation_set_selection(0);
menu_st->selection_ptr = 0;
}
new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_TITLE;
@ -8373,7 +8387,8 @@ static enum menu_action ozone_parse_menu_entry_action(
* is off screen, auto select *last* item */
if (ozone->flags & OZONE_FLAG_CURSOR_MODE)
if (!OZONE_ENTRY_ONSCREEN(ozone, selection))
ozone_auto_select_onscreen_entry(ozone, OZONE_ONSCREEN_ENTRY_LAST);
ozone_auto_select_onscreen_entry(ozone,
OZONE_ONSCREEN_ENTRY_LAST);
ozone->flags &= ~OZONE_FLAG_CURSOR_MODE;
break;
case MENU_ACTION_SCROLL_DOWN:
@ -8435,7 +8450,8 @@ static enum menu_action ozone_parse_menu_entry_action(
* is off screen, auto select *first* item */
if (ozone->flags & OZONE_FLAG_CURSOR_MODE)
if (!OZONE_ENTRY_ONSCREEN(ozone, selection))
ozone_auto_select_onscreen_entry(ozone, OZONE_ONSCREEN_ENTRY_FIRST);
ozone_auto_select_onscreen_entry(ozone,
OZONE_ONSCREEN_ENTRY_FIRST);
ozone->flags &= ~OZONE_FLAG_CURSOR_MODE;
break;
@ -9673,7 +9689,9 @@ static void ozone_render(void *data,
* (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323#c87) */
volatile float scale_factor;
volatile float thumbnail_scale_factor;
unsigned entries_end = (unsigned)menu_entries_get_size();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
unsigned entries_end = (unsigned)MENU_LIST_GET_SELECTION(menu_list, 0)->size;
bool pointer_enabled = false;
unsigned language = *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE);
ozone_handle_t *ozone = (ozone_handle_t*)data;
@ -9791,7 +9809,7 @@ static void ozone_render(void *data,
if (pointer_enabled)
{
bool pointer_in_sidebar, last_pointer_in_sidebar;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
uintptr_t animation_tag = (uintptr_t)selection_buf;
int entry_padding = (ozone->depth == 1)
@ -9995,7 +10013,7 @@ static void ozone_render(void *data,
&& (ozone->pointer.y_accel < ozone->last_scale_factor)
&& (ozone->pointer.y_accel > -ozone->last_scale_factor))
{
menu_navigation_set_selection(i);
menu_st->selection_ptr = i;
/* If this is a playlist, must update thumbnails */
if ( ((ozone->flags & OZONE_FLAG_IS_PLAYLIST) && (ozone->depth == 1 || ozone->depth == 4))
@ -10024,7 +10042,7 @@ static void ozone_render(void *data,
&& (ozone->pointer.press_duration >= MENU_INPUT_PRESS_TIME_SHORT)
&& (i != ozone->selection))
{
menu_navigation_set_selection(i);
menu_st->selection_ptr = i;
/* If we are currently in the sidebar, leave it */
if (ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR)
@ -11114,8 +11132,10 @@ static void ozone_get_thumbnail_system(void *data, char *s, size_t len)
static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation)
{
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
size_t new_selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
size_t new_selection = menu_st->selection_ptr;
ozone_node_t *node = (ozone_node_t*)selection_buf->list[new_selection].userdata;
if (!node)
@ -11126,7 +11146,7 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation)
menu_entry_t entry;
unsigned entry_type;
uintptr_t tag = (uintptr_t)selection_buf;
size_t selection = menu_navigation_get_selection();
size_t selection = new_selection;
MENU_ENTRY_INITIALIZE(entry);
menu_entry_get(&entry, 0, selection, NULL, true);
@ -11769,6 +11789,8 @@ static void ozone_populate_entries(
bool want_thumbnail_bar = false;
bool fullscreen_thumbnails_available = false;
bool animate = false;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
settings_t *settings = NULL;
ozone_handle_t *ozone = (ozone_handle_t*) data;
@ -11811,7 +11833,7 @@ static void ozone_populate_entries(
* playlist, return to the sidebar */
if (!(ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR))
{
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
file_list_t *list = MENU_LIST_GET_SELECTION(menu_list, 0);
uintptr_t animation_tag = (uintptr_t)&ozone->animations.cursor_alpha;
bool goto_sidebar = false;
@ -12079,8 +12101,10 @@ static bool ozone_menu_init_list(void *data)
menu_displaylist_info_t info;
settings_t *settings = config_get_ptr();
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
menu_displaylist_info_init(&info);
@ -12251,10 +12275,12 @@ static int ozone_pointer_up(void *userdata,
{
unsigned width, height;
ozone_handle_t *ozone = (ozone_handle_t*)userdata;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
uintptr_t sidebar_tag = (uintptr_t)selection_buf;
size_t selection = menu_navigation_get_selection();
size_t entries_end = menu_entries_get_size();
size_t selection = menu_st->selection_ptr;
size_t entries_end = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
settings_t *settings = config_get_ptr();
bool ozone_collapse_sidebar = settings->bools.ozone_collapse_sidebar;
@ -12298,7 +12324,7 @@ static int ozone_pointer_up(void *userdata,
/* If current 'pointer' item is not active,
* activate it immediately */
if (ptr != selection)
menu_navigation_set_selection(ptr);
menu_st->selection_ptr = ptr;
/* If we are not currently in the sidebar,
* perform a MENU_ACTION_SELECT on currently
@ -12326,7 +12352,7 @@ static int ozone_pointer_up(void *userdata,
menu_input_set_pointer_y_accel(0.0f);
if (ptr != selection)
menu_navigation_set_selection(ptr);
menu_st->selection_ptr = ptr;
/* If we are currently in the sidebar, leave it */
if (ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR)

View File

@ -847,8 +847,10 @@ static void *xmb_list_get_entry(void *data,
{
case MENU_LIST_PLAIN:
{
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
list_size = menu_entries_get_stack_size(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET_SELECTION(menu_list, 0);
list_size = MENU_LIST_GET_STACK_SIZE(menu_list, 0);
if (i < list_size)
return (void*)&menu_stack->list[i];
}
@ -1381,11 +1383,13 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
/* Playlist content */
if (string_is_empty(s))
{
size_t selection = menu_navigation_get_selection();
size_t list_size = menu_entries_get_size();
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
bool playlist_valid = false;
size_t playlist_index = selection;
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
size_t list_size = (unsigned)MENU_LIST_GET_SELECTION(menu_list, 0)->size;
file_list_t *list = MENU_LIST_GET_SELECTION(menu_list, 0);
bool playlist_valid = false;
size_t playlist_index = selection;
/* Get playlist index corresponding
* to the selected entry */
@ -1442,8 +1446,10 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
{
/* Filebrowser image updates */
menu_entry_t entry;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
size_t selection = menu_navigation_get_selection();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
xmb_node_t *node = (xmb_node_t*)selection_buf->list[selection].userdata;
if (node)
@ -1514,14 +1520,16 @@ static void xmb_selection_pointer_changed(
uintptr_t tag;
size_t num = 0;
int threshold = 0;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
size_t selection = menu_st->selection_ptr;
if (!xmb)
return;
end = (unsigned)menu_entries_get_size();
threshold = xmb->icon_size * 10;
end = (unsigned)MENU_LIST_GET_SELECTION(menu_list, 0)->size;
threshold = xmb->icon_size * 10;
video_driver_get_size(NULL, &height);
@ -2150,8 +2158,10 @@ static void xmb_tab_set_selection(void *data)
static void xmb_list_switch(xmb_handle_t *xmb)
{
gfx_animation_ctx_entry_t anim_entry;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
int dir = -1;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
size_t selection = 0;
settings_t *settings = config_get_ptr();
bool xmb_main_tab_selected = false;
@ -2175,7 +2185,7 @@ static void xmb_list_switch(xmb_handle_t *xmb)
xmb_tab_set_selection(xmb);
/* Selection needs to be taken after tab restore */
selection = menu_navigation_get_selection();
selection = menu_st->selection_ptr;
xmb_list_switch_horizontal_list(xmb);
@ -2610,7 +2620,9 @@ static void xmb_list_open(xmb_handle_t *xmb)
menu_xmb_animation_opening_main_menu =
settings->uints.menu_xmb_animation_opening_main_menu;
int dir = 0;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
size_t selection = menu_navigation_get_selection();
xmb->depth = (int)
@ -2679,13 +2691,15 @@ static void xmb_populate_entries(void *data,
const char *label, unsigned k)
{
unsigned xmb_system_tab, xmb_horizontal_type;
xmb_handle_t *xmb = (xmb_handle_t*)data;
settings_t *settings = config_get_ptr();
xmb_handle_t *xmb = (xmb_handle_t*)data;
settings_t *settings = config_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
bool menu_dynamic_wallpaper_enable =
settings ? settings->bools.menu_dynamic_wallpaper_enable : false;
bool show_entry_idx = settings ? settings->bools.playlist_show_entry_idx : false;
bool was_db_manager_list = false;
unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN);
bool show_entry_idx = settings ? settings->bools.playlist_show_entry_idx : false;
bool was_db_manager_list = false;
unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN);
if (!xmb)
return;
xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr);
@ -2792,7 +2806,7 @@ static void xmb_populate_entries(void *data,
(xmb->is_playlist || xmb->is_explore_list)))
{
size_t entry_idx_selection = menu_navigation_get_selection() + 1;
size_t list_size = menu_entries_get_size();
size_t list_size = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
unsigned entry_idx_offset = 0;
if (xmb->is_explore_list)
@ -4738,11 +4752,13 @@ static void xmb_render(void *data,
* disables optimisations and removes excess precision
* (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323#c87) */
volatile float scale_factor;
xmb_handle_t *xmb = (xmb_handle_t*)data;
settings_t *settings = config_get_ptr();
size_t end = menu_entries_get_size();
gfx_display_t *p_disp = disp_get_ptr();
gfx_animation_t *p_anim = anim_get_ptr();
xmb_handle_t *xmb = (xmb_handle_t*)data;
settings_t *settings = config_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
size_t end = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
gfx_display_t *p_disp = disp_get_ptr();
gfx_animation_t *p_anim = anim_get_ptr();
if (!xmb)
return;
@ -5675,6 +5691,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
gfx_display_t *p_disp = (gfx_display_t*)video_info->disp_userdata;
gfx_animation_t *p_anim = anim_get_ptr();
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
bool input_dialog_display_kb = menu_input_dialog_get_display_kb();
if (!xmb)
@ -6297,7 +6315,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
video_height,
&mymat);
selection_buf = menu_entries_get_selection_buf_ptr(0);
selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
/* List icons */
xmb_draw_items(
@ -6527,10 +6545,12 @@ static void xmb_init_scale_mod(void)
static void xmb_layout(xmb_handle_t *xmb)
{
unsigned width, height, i;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
size_t selection = menu_navigation_get_selection();
unsigned current = (unsigned)selection;
unsigned end = (unsigned)menu_entries_get_size();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
size_t selection = menu_st->selection_ptr;
unsigned current = (unsigned)selection;
unsigned end = (unsigned)MENU_LIST_GET_SELECTION(menu_list, 0)->size;
video_driver_get_size(&width, &height);
xmb_init_scale_mod();
@ -7544,8 +7564,10 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action
{
size_t stack_size, list_size;
xmb_handle_t *xmb = (xmb_handle_t*)data;
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
size_t selection = menu_navigation_get_selection();
settings_t *settings = config_get_ptr();
bool menu_horizontal_animation = settings->bools.menu_horizontal_animation;
@ -8129,8 +8151,10 @@ static bool xmb_menu_init_list(void *data)
menu_displaylist_info_t info;
settings_t *settings = config_get_ptr();
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
menu_displaylist_info_init(&info);
@ -8174,9 +8198,11 @@ static int xmb_pointer_up(void *userdata,
int16_t margin_top;
int16_t margin_left;
int16_t margin_right;
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
size_t selection = menu_navigation_get_selection();
unsigned end = (unsigned)menu_entries_get_size();
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
unsigned end = (unsigned)MENU_LIST_GET_SELECTION(menu_list, 0)->size;
if (!xmb)
return -1;

View File

@ -5039,7 +5039,7 @@ static const char * msvc_vercode_to_str(const unsigned vercode)
/* Sets 's' to the name of the current core
* (shown at the top of the UI). */
int menu_entries_get_core_title(char *s, size_t len)
void menu_entries_get_core_title(char *s, size_t len)
{
struct retro_system_info *system = &runloop_state_get_ptr()->system.info;
const char *core_name =
@ -5059,8 +5059,6 @@ int menu_entries_get_core_title(char *s, size_t len)
snprintf(s + _len, len - _len, " - %s (%s)", core_name, core_version);
else
snprintf(s + _len, len - _len, " - %s", core_name);
return 0;
}
static bool menu_driver_init_internal(
@ -8371,13 +8369,14 @@ size_t menu_update_fullscreen_thumbnail_label(
{
char tmpstr[64];
menu_entry_t selected_entry;
struct menu_state *menu_st = &menu_driver_state;
const char *thumbnail_label = NULL;
/* > Get menu entry */
MENU_ENTRY_INITIALIZE(selected_entry);
selected_entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED
| MENU_ENTRY_FLAG_RICH_LABEL_ENABLED;
menu_entry_get(&selected_entry, 0, menu_navigation_get_selection(), NULL, true);
menu_entry_get(&selected_entry, 0, menu_st->selection_ptr, NULL, true);
/* > Get entry label */
if (!string_is_empty(selected_entry.rich_label))

View File

@ -166,7 +166,7 @@ typedef struct menu_entry
int menu_entries_get_title(char *title, size_t title_len);
int menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
void menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
file_list_t *menu_entries_get_selection_buf_ptr(size_t idx);