(Menu) Cut down on small superfluos wrapper functions

This commit is contained in:
libretroadmin 2023-05-06 17:19:40 +02:00
parent 99375ff787
commit 6d9482f3f0
14 changed files with 519 additions and 485 deletions

View File

@ -34,14 +34,14 @@ int action_cancel_pop_default(const char *path,
const char *label, unsigned type, size_t idx)
{
size_t new_selection_ptr;
const char *menu_label = NULL;
unsigned menu_type = MENU_SETTINGS_NONE;
menu_search_terms_t *menu_search_terms= menu_entries_search_get_terms();
struct menu_state *menu_st = menu_state_get_ptr();
const char *menu_label = NULL;
unsigned menu_type = MENU_SETTINGS_NONE;
menu_search_terms_t *menu_search_terms = menu_entries_search_get_terms();
#ifdef HAVE_AUDIOMIXER
settings_t *settings = config_get_ptr();
bool audio_enable_menu = settings->bools.audio_enable_menu;
bool audio_enable_menu_cancel = settings->bools.audio_enable_menu_cancel;
settings_t *settings = config_get_ptr();
bool audio_enable_menu = settings->bools.audio_enable_menu;
bool audio_enable_menu_cancel = settings->bools.audio_enable_menu_cancel;
if (audio_enable_menu && audio_enable_menu_cancel)
audio_driver_mixer_play_menu_sound(AUDIO_MIXER_SYSTEM_SLOT_CANCEL);
#endif
@ -52,15 +52,16 @@ int action_cancel_pop_default(const char *path,
* > If so, check whether this is a menu list
* with 'search filter' support
* > If so, remove the last search term */
if (menu_search_terms &&
menu_driver_search_filter_enabled(menu_label, menu_type) &&
menu_entries_search_pop())
if ( menu_search_terms
&& menu_driver_search_filter_enabled(menu_label, menu_type)
&& menu_entries_search_pop())
{
bool refresh = false;
bool refresh = false;
/* Reset navigation pointer */
menu_navigation_set_selection(0);
menu_driver_navigation_set(false);
menu_st->selection_ptr = 0;
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, false);
/* Refresh menu */
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
@ -72,19 +73,19 @@ int action_cancel_pop_default(const char *path,
if (!string_is_empty(menu_label))
{
if (
string_is_equal(menu_label,
string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)
) ||
string_is_equal(menu_label,
)
|| string_is_equal(menu_label,
msg_hash_to_str(MENU_ENUM_LABEL_MENU_WALLPAPER)
)
)
filebrowser_clear_type();
}
new_selection_ptr = menu_navigation_get_selection();
new_selection_ptr = menu_st->selection_ptr;
menu_entries_pop_stack(&new_selection_ptr, 0, 1);
menu_navigation_set_selection(new_selection_ptr);
menu_st->selection_ptr = new_selection_ptr;
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_PATH, NULL);
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_IMAGE, NULL);
@ -123,14 +124,16 @@ static int action_cancel_core_content(const char *path,
/* Check whether search terms have been set
* > If so, remove the last search term */
if (menu_search_terms &&
menu_entries_search_pop())
if ( menu_search_terms
&& menu_entries_search_pop())
{
bool refresh = false;
struct menu_state *menu_st = menu_state_get_ptr();
bool refresh = false;
/* Reset navigation pointer */
menu_navigation_set_selection(0);
menu_driver_navigation_set(false);
menu_st->selection_ptr = 0;
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, false);
/* Refresh menu */
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
@ -209,7 +212,7 @@ static int menu_cbs_init_bind_cancel_compare_type(
case MENU_ENUM_LABEL_CHEAT_DELETE:
{
BIND_ACTION_CANCEL(cbs, action_cancel_cheat_details);
break ;
break;
}
default:
break;
@ -221,17 +224,17 @@ static int menu_cbs_init_bind_cancel_compare_type(
int menu_cbs_init_bind_cancel(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx)
{
if (!cbs)
return -1;
if (cbs)
{
BIND_ACTION_CANCEL(cbs, action_cancel_pop_default);
BIND_ACTION_CANCEL(cbs, action_cancel_pop_default);
if (menu_cbs_init_bind_cancel_compare_label(cbs, label) == 0)
return 0;
if (menu_cbs_init_bind_cancel_compare_label(cbs, label) == 0)
return 0;
if (menu_cbs_init_bind_cancel_compare_type(
cbs, type) == 0)
return 0;
if (menu_cbs_init_bind_cancel_compare_type(
cbs, type) == 0)
return 0;
}
return -1;
}

View File

@ -33,8 +33,9 @@
static int action_info_default(unsigned type, const char *label)
{
menu_displaylist_info_t info;
struct menu_state *menu_st = menu_state_get_ptr();
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
size_t selection = menu_navigation_get_selection();
size_t selection = menu_st->selection_ptr;
settings_t *settings = config_get_ptr();
#ifdef HAVE_AUDIOMIXER
bool audio_enable_menu = settings->bools.audio_enable_menu;
@ -89,19 +90,19 @@ static int action_info_cheevos(unsigned type, const char *label)
int menu_cbs_init_bind_info(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx)
{
if (!cbs)
return -1;
#ifdef HAVE_CHEEVOS
if ((type >= MENU_SETTINGS_CHEEVOS_START) &&
(type < MENU_SETTINGS_NETPLAY_ROOMS_START))
if (cbs)
{
BIND_ACTION_INFO(cbs, action_info_cheevos);
return 0;
}
#ifdef HAVE_CHEEVOS
if ((type >= MENU_SETTINGS_CHEEVOS_START) &&
(type < MENU_SETTINGS_NETPLAY_ROOMS_START))
{
BIND_ACTION_INFO(cbs, action_info_cheevos);
return 0;
}
#endif
BIND_ACTION_INFO(cbs, action_info_default);
BIND_ACTION_INFO(cbs, action_info_default);
}
return -1;
}

View File

@ -227,31 +227,32 @@ static int action_left_input_desc_kbd(unsigned type, const char *label,
static int action_left_scroll(unsigned type, const char *label,
bool wraparound)
{
size_t scroll_accel = 0;
unsigned scroll_speed = 0, fast_scroll_speed = 0;
size_t selection = menu_navigation_get_selection();
size_t scroll_accel = 0;
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
if (!menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
return false;
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
fast_scroll_speed = 10 * scroll_speed;
if (selection > fast_scroll_speed)
if (menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
{
size_t idx = selection - fast_scroll_speed;
menu_navigation_set_selection(idx);
menu_driver_navigation_set(true);
}
else
{
bool pending_push = false;
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
}
unsigned scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
unsigned fast_scroll_speed = 10 * scroll_speed;
if (selection > fast_scroll_speed)
{
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
{
bool pending_push = false;
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
}
#ifdef HAVE_AUDIOMIXER
if (selection != menu_navigation_get_selection())
audio_driver_mixer_play_scroll_sound(true);
if (selection != menu_st->selection_ptr) /* Changed? */
audio_driver_mixer_play_scroll_sound(true);
#endif
}
return 0;
}
@ -284,8 +285,8 @@ static int action_left_mainmenu(unsigned type, const char *label,
/* Tab switching functionality only applies
* to XMB */
if ((list_info.size == 1) &&
string_is_equal(menu_ident, "xmb"))
if ( (list_info.size == 1)
&& string_is_equal(menu_ident, "xmb"))
{
if ((list_info.selection != 0) || menu_nav_wraparound_enable)
return action_left_goto_tab();
@ -321,7 +322,7 @@ static int action_left_shader_scale_pass(unsigned type, const char *label,
shader_pass->fbo.scale_x = current_scale;
shader_pass->fbo.scale_y = current_scale;
shader->flags |= SHDR_FLAG_MODIFIED;
shader->flags |= SHDR_FLAG_MODIFIED;
return 0;
}
@ -329,7 +330,7 @@ static int action_left_shader_scale_pass(unsigned type, const char *label,
static int action_left_shader_filter_pass(unsigned type, const char *label,
bool wraparound)
{
unsigned delta = 2;
unsigned delta = 2;
unsigned pass = type - MENU_SETTINGS_SHADER_PASS_FILTER_0;
struct video_shader *shader = menu_shader_get();
struct video_shader_pass *shader_pass = shader ? &shader->pass[pass] : NULL;

View File

@ -584,10 +584,12 @@ int generic_action_ok_displaylist_push(const char *path,
const char *content_path = NULL;
const char *info_label = NULL;
const char *info_path = NULL;
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
menu_list_t *menu_list = menu_st->entries.list;
settings_t *settings = config_get_ptr();
const char *menu_ident = menu_driver_ident();
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);
#ifdef HAVE_AUDIOMIXER
bool audio_enable_menu = settings->bools.audio_enable_menu;
bool audio_enable_menu_ok = settings->bools.audio_enable_menu_ok;
@ -2312,14 +2314,16 @@ static int action_ok_file_load(const char *path,
const char *menu_label = NULL;
const char *menu_path = NULL;
rarch_setting_t *setting = NULL;
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);
if (filebrowser_get_type() == FILEBROWSER_SELECT_FILE_SUBSYSTEM)
{
/* TODO/FIXME - this path is triggered when we try to load a
* file from an archive while inside the load subsystem
* action */
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
if (!menu)
return -1;
@ -2367,10 +2371,8 @@ static int action_ok_file_load(const char *path,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN))
)
{
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
if (!menu)
return -1;
fill_pathname_join_special(menu_path_new,
menu->scratch2_buf, menu->scratch_buf,
sizeof(menu_path_new));
@ -2399,7 +2401,7 @@ static bool playlist_entry_path_is_valid(const char *entry_path)
char *file_path = NULL;
if (string_is_empty(entry_path))
goto error;
return false;
file_path = strdup(entry_path);
@ -2432,11 +2434,8 @@ static bool playlist_entry_path_is_valid(const char *entry_path)
return true;
error:
if (file_path)
{
free(file_path);
file_path = NULL;
}
free(file_path);
file_path = NULL;
return false;
}
@ -3801,13 +3800,14 @@ static int action_ok_path_manual_scan_directory(const char *path,
static int action_ok_core_deferred_set(const char *new_core_path,
const char *content_label, unsigned type, size_t idx, size_t entry_idx)
{
size_t selection = menu_navigation_get_selection();
char msg[PATH_MAX_LENGTH];
char resolved_core_path[PATH_MAX_LENGTH];
struct menu_state *menu_st = menu_state_get_ptr();
struct playlist_entry entry = {0};
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
size_t selection = menu_st->selection_ptr;
menu_handle_t *menu = menu_st->driver_data;
core_info_t *core_info = NULL;
const char *core_display_name = NULL;
char resolved_core_path[PATH_MAX_LENGTH];
char msg[PATH_MAX_LENGTH];
if ( !menu
|| string_is_empty(new_core_path))
@ -3840,7 +3840,7 @@ static int action_ok_core_deferred_set(const char *new_core_path,
runloop_msg_queue_push(msg, 1, 100, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
menu_entries_pop_stack(&selection, 0, 1);
menu_navigation_set_selection(selection);
menu_st->selection_ptr = selection;
return 0;
}
@ -3944,10 +3944,13 @@ static int action_ok_file_load_ffmpeg(const char *path,
{
char new_path[PATH_MAX_LENGTH];
const char *menu_path = NULL;
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);
if (menu_stack && menu_stack->size)
menu_path = menu_stack->list[menu_stack->size - 1].path;
menu_path = menu_stack->list[menu_stack->size - 1].path;
if (string_is_empty(menu_path))
return -1;
@ -4336,8 +4339,9 @@ static int action_ok_cheat_delete(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char msg[256];
size_t new_selection_ptr = 0;
unsigned int new_size = cheat_manager_get_size() - 1;
size_t new_selection_ptr = 0;
struct menu_state *menu_st = menu_state_get_ptr();
unsigned int new_size = cheat_manager_get_size() - 1;
if (new_size >0)
{
@ -4368,9 +4372,9 @@ static int action_ok_cheat_delete(const char *path,
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
new_selection_ptr = menu_navigation_get_selection();
new_selection_ptr = menu_st->selection_ptr;
menu_entries_pop_stack(&new_selection_ptr, 0, 1);
menu_navigation_set_selection(new_selection_ptr);
menu_st->selection_ptr = new_selection_ptr;
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_PATH, NULL);
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_IMAGE, NULL);
@ -4384,7 +4388,10 @@ static int action_ok_file_load_imageviewer(const char *path,
{
char fullpath[PATH_MAX_LENGTH];
const char *menu_path = NULL;
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);
if (menu_stack && menu_stack->size)
menu_path = menu_stack->list[menu_stack->size - 1].path;
@ -5336,12 +5343,12 @@ static int action_ok_core_options_flush(const char *path,
int action_ok_close_content(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx)
{
int ret;
struct menu_state *menu_st = menu_state_get_ptr();
/* Reset navigation pointer
* > If we are returning to the quick menu, want
* the active entry to be 'Run' (first item in
* menu list) */
menu_navigation_set_selection(0);
menu_st->selection_ptr = 0;
/* Unload core */
ret = generic_action_ok_command(CMD_EVENT_UNLOAD_CORE);
@ -5353,19 +5360,17 @@ int action_ok_close_content(const char *path, const char *label, unsigned type,
* navigation) */
if (type == MENU_SETTING_ACTION_CLOSE)
{
const char *flush_target = msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU);
const char *parent_label = NULL;
struct menu_state *menu_st = menu_state_get_ptr();
const char *flush_target = msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU);
file_list_t *list = NULL;
if (menu_st->entries.list)
list = MENU_LIST_GET(menu_st->entries.list, 0);
if (list && (list->size > 1))
{
parent_label = list->list[list->size - 2].label;
if (string_is_equal(parent_label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENTLESS_CORES_TAB)) ||
string_is_equal(parent_label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CONTENTLESS_CORES_LIST)))
if ( string_is_equal(parent_label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENTLESS_CORES_TAB))
|| string_is_equal(parent_label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CONTENTLESS_CORES_LIST)))
flush_target = parent_label;
}
@ -5679,18 +5684,19 @@ static int action_ok_delete_entry(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
size_t new_selection_ptr;
char *conf_path = NULL;
char *def_conf_path = NULL;
char *def_conf_music_path = NULL;
char *conf_path = NULL;
char *def_conf_path = NULL;
char *def_conf_music_path = NULL;
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
char *def_conf_video_path = NULL;
char *def_conf_video_path = NULL;
#endif
#ifdef HAVE_IMAGEVIEWER
char *def_conf_img_path = NULL;
char *def_conf_img_path = NULL;
#endif
char *def_conf_fav_path = NULL;
playlist_t *playlist = playlist_get_cached();
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
char *def_conf_fav_path = NULL;
playlist_t *playlist = playlist_get_cached();
struct menu_state *menu_st= menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
if (!menu)
return -1;
@ -5707,19 +5713,19 @@ static int action_ok_delete_entry(const char *path,
def_conf_fav_path = playlist_get_conf_path(g_defaults.content_favorites);
if (string_is_equal(conf_path, def_conf_path))
playlist = g_defaults.content_history;
playlist = g_defaults.content_history;
else if (string_is_equal(conf_path, def_conf_music_path))
playlist = g_defaults.music_history;
playlist = g_defaults.music_history;
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
else if (string_is_equal(conf_path, def_conf_video_path))
playlist = g_defaults.video_history;
playlist = g_defaults.video_history;
#endif
#ifdef HAVE_IMAGEVIEWER
else if (string_is_equal(conf_path, def_conf_img_path))
playlist = g_defaults.image_history;
playlist = g_defaults.image_history;
#endif
else if (string_is_equal(conf_path, def_conf_fav_path))
playlist = g_defaults.content_favorites;
playlist = g_defaults.content_favorites;
if (playlist)
{
@ -5727,9 +5733,9 @@ static int action_ok_delete_entry(const char *path,
playlist_write_file(playlist);
}
new_selection_ptr = menu_navigation_get_selection();
new_selection_ptr = menu_st->selection_ptr;
menu_entries_pop_stack(&new_selection_ptr, 0, 1);
menu_navigation_set_selection(new_selection_ptr);
menu_st->selection_ptr = new_selection_ptr;
return 0;
}
@ -6267,8 +6273,9 @@ static int action_ok_push_downloads_dir(const char *path,
int action_ok_push_filebrowser_list_dir_select(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
char current_value[PATH_MAX_LENGTH];
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
current_value[0] = '\0';
@ -6276,7 +6283,7 @@ int action_ok_push_filebrowser_list_dir_select(const char *path,
return -1;
/* Start browsing from current directory */
get_current_menu_value(menu_state_get_ptr(), current_value, sizeof(current_value));
get_current_menu_value(menu_st, current_value, sizeof(current_value));
if (!path_is_directory(current_value))
current_value[0] = '\0';
@ -6741,7 +6748,8 @@ static int action_ok_push_dropdown_item_manual_content_scan_core_name(
static int action_ok_push_dropdown_item_disk_index(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
unsigned disk_index = (unsigned)idx;
struct menu_state *menu_st = menu_state_get_ptr();
unsigned disk_index = (unsigned)idx;
command_event(CMD_EVENT_DISK_INDEX, &disk_index);
@ -6749,7 +6757,7 @@ static int action_ok_push_dropdown_item_disk_index(const char *path,
* automatically be reset to the 'insert disk'
* option */
menu_entries_pop_stack(NULL, 0, 1);
menu_navigation_set_selection(0);
menu_st->selection_ptr = 0;
return 0;
}
@ -6981,7 +6989,8 @@ static int action_ok_start_core(const char *path,
static int action_ok_contentless_core_run(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
const char *core_path = path;
const char *core_path = path;
struct menu_state *menu_st = menu_state_get_ptr();
/* TODO/FIXME: If this function succeeds, the
* quick menu will be pushed on the subsequent
* frame via the RARCH_MENU_CTL_SET_PENDING_QUICK_MENU
@ -6991,8 +7000,8 @@ static int action_ok_contentless_core_run(const char *path,
* menu index is lost. We therefore have to cache
* the current selection here, and reapply it manually
* when building the contentless cores list... */
size_t selection = menu_navigation_get_selection();
uint32_t flags = runloop_get_flags();
size_t selection = menu_st->selection_ptr;
uint32_t flags = runloop_get_flags();
if (string_is_empty(core_path))
return -1;
@ -7001,10 +7010,10 @@ static int action_ok_contentless_core_run(const char *path,
if ( retroarch_ctl(RARCH_CTL_IS_CORE_LOADED, (void*)core_path)
&& (flags & RUNLOOP_FLAG_CORE_RUNNING))
{
bool flush_menu = false;
bool flush_menu = false;
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, &flush_menu);
menu_state_get_ptr()->contentless_core_ptr = selection;
menu_navigation_set_selection(0);
menu_st->contentless_core_ptr = selection;
menu_st->selection_ptr = 0;
return 0;
}
@ -7013,7 +7022,7 @@ static int action_ok_contentless_core_run(const char *path,
* navigation (i.e. running a core will in general
* cause a redraw of the menu, so must record current
* position even if the operation fails) */
menu_state_get_ptr()->contentless_core_ptr = selection;
menu_st->contentless_core_ptr = selection;
/* Load and start core */
path_clear(RARCH_PATH_BASENAME);
@ -7032,7 +7041,8 @@ static int action_ok_load_archive(const char *path,
{
const char *menu_path = NULL;
const char *content_path = NULL;
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
if (!menu)
return -1;
@ -7060,7 +7070,8 @@ static int action_ok_load_archive_detect_core(const char *path,
core_info_list_t *list = NULL;
const char *menu_path = NULL;
const char *content_path = NULL;
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
if (!menu)
return -1;
@ -7111,7 +7122,7 @@ static int action_ok_load_archive_detect_core(const char *path,
}
break;
case 0:
idx = menu_navigation_get_selection();
idx = menu_st->selection_ptr;
ret = generic_action_ok_displaylist_push(path, NULL,
label, type,
idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST);
@ -7296,6 +7307,7 @@ static int action_ok_disk_cycle_tray_status(const char *path,
{
bool disk_ejected = false;
bool print_log = false;
struct menu_state *menu_st = menu_state_get_ptr();
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
settings_t *settings = config_get_ptr();
#ifdef HAVE_AUDIOMIXER
@ -7334,7 +7346,7 @@ static int action_ok_disk_cycle_tray_status(const char *path,
* automatically increment to the 'current disk
* index' option */
if (disk_ejected)
menu_navigation_set_selection(1);
menu_st->selection_ptr = 1;
/* If disk is now inserted and user has enabled
* 'menu_insert_disk_resume', resume running content */
@ -7349,7 +7361,8 @@ static int action_ok_disk_image_append(const char *path,
{
char image_path[PATH_MAX_LENGTH];
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
const char *menu_path = NULL;
settings_t *settings = config_get_ptr();
#ifdef HAVE_AUDIOMIXER
@ -7392,7 +7405,7 @@ static int action_ok_disk_image_append(const char *path,
* > If disk try is closed and user has enabled
* 'menu_insert_disk_resume', resume running content */
if (sys_info && disk_control_get_eject_state(&sys_info->disk_control))
menu_navigation_set_selection(0);
menu_st->selection_ptr = 0;
else if (menu_insert_disk_resume)
generic_action_ok_command(CMD_EVENT_RESUME);

View File

@ -3101,15 +3101,16 @@ static void (*materialui_compute_entries_box)(
static float materialui_get_scroll(materialui_handle_t *mui,
gfx_display_t *p_disp)
{
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
materialui_node_t *node = NULL;
size_t selection = menu_navigation_get_selection();
unsigned header_height = p_disp->header_height;
unsigned width = 0;
unsigned height = 0;
float view_centre = 0.0f;
float selection_centre = 0.0f;
size_t i;
materialui_node_t *node = NULL;
struct menu_state *menu_st = menu_state_get_ptr();
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
size_t selection = menu_st->selection_ptr;
unsigned header_height = p_disp->header_height;
unsigned width = 0;
unsigned height = 0;
float view_centre = 0.0f;
float selection_centre = 0.0f;
if (!mui || !list)
return 0;
@ -3177,7 +3178,8 @@ static size_t materialui_auto_select_onscreen_entry(
materialui_handle_t *mui,
enum materialui_onscreen_entry_position_type target_entry)
{
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
/* Check whether selected item is already on screen */
if (materialui_entry_onscreen(mui, selection))
@ -3207,7 +3209,7 @@ static size_t materialui_auto_select_onscreen_entry(
}
/* Apply new selection */
menu_navigation_set_selection(selection);
menu_st->selection_ptr = selection;
return selection;
}
@ -3579,19 +3581,20 @@ static void materialui_render(void *data,
* disables optimisations and removes excess precision
* (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323#c87) */
volatile float scale_factor;
settings_t *settings = config_get_ptr();
materialui_handle_t *mui = (materialui_handle_t*)data;
gfx_display_t *p_disp = disp_get_ptr();
size_t entries_end = menu_entries_get_size();
size_t selection = menu_navigation_get_selection();
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
unsigned header_height = p_disp->header_height;
bool first_entry_found = false;
bool last_entry_found = false;
settings_t *settings = config_get_ptr();
materialui_handle_t *mui = (materialui_handle_t*)data;
gfx_display_t *p_disp = disp_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
size_t entries_end = menu_entries_get_size();
size_t selection = menu_st->selection_ptr;
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
unsigned header_height = p_disp->header_height;
bool first_entry_found = false;
bool last_entry_found = false;
unsigned landscape_layout_optimization
= settings->uints.menu_materialui_landscape_layout_optimization;
bool show_nav_bar = settings->bools.menu_materialui_show_nav_bar;
bool auto_rotate_nav_bar = settings->bools.menu_materialui_auto_rotate_nav_bar;
= settings->uints.menu_materialui_landscape_layout_optimization;
bool show_nav_bar = settings->bools.menu_materialui_show_nav_bar;
bool auto_rotate_nav_bar = settings->bools.menu_materialui_auto_rotate_nav_bar;
unsigned thumbnail_upscale_threshold =
settings->uints.gfx_thumbnail_upscale_threshold;
bool network_on_demand_thumbnails =
@ -3822,8 +3825,8 @@ static void materialui_render(void *data,
* select current entry */
if (mui->pointer.press_duration >= MENU_INPUT_PRESS_TIME_SHORT)
{
menu_navigation_set_selection(i);
selection = i;
menu_st->selection_ptr = i;
selection = i;
/* Once an entry has been auto selected, disable
* touch feedback selection updates until the next
@ -6994,7 +6997,8 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
materialui_handle_t *mui = (materialui_handle_t*)data;
settings_t *settings = config_get_ptr();
gfx_display_t *p_disp = disp_get_ptr();
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
unsigned header_height = p_disp->header_height;
enum gfx_animation_ticker_type
menu_ticker_type = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
@ -8341,7 +8345,8 @@ static void materialui_animate_scroll(
materialui_handle_t *mui, float scroll_pos, float duration)
{
gfx_animation_ctx_entry_t animation_entry;
uintptr_t animation_tag = (uintptr_t)&mui->scroll_y;
struct menu_state *menu_st = menu_state_get_ptr();
uintptr_t animation_tag = (uintptr_t)&mui->scroll_y;
/* Kill any existing scroll animation */
gfx_animation_kill_by_tag(&animation_tag);
@ -8352,8 +8357,8 @@ static void materialui_animate_scroll(
menu_input_set_pointer_y_accel(0.0f);
/* Set 'animation active' flag */
mui->flags |= MUI_FLAG_SCROLL_ANIMATION_ACTIVE;
mui->scroll_animation_selection = menu_navigation_get_selection();
mui->flags |= MUI_FLAG_SCROLL_ANIMATION_ACTIVE;
mui->scroll_animation_selection = menu_st->selection_ptr;
/* Configure animation */
animation_entry.easing_enum = EASING_IN_OUT_QUAD;
@ -9108,6 +9113,7 @@ static enum menu_action materialui_parse_menu_entry_action(
materialui_handle_t *mui, enum menu_action action)
{
enum menu_action new_action = action;
struct menu_state *menu_st = menu_state_get_ptr();
/* If fullscreen thumbnail view is active, any
* valid menu action will disable it... */
@ -9197,7 +9203,8 @@ static enum menu_action materialui_parse_menu_entry_action(
materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_CENTRE);
else
{
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
/* In all other cases, if current selection is off
* screen, have to disable input - otherwise user can
@ -9247,7 +9254,8 @@ static enum menu_action materialui_parse_menu_entry_action(
* 'scan' action *if* current selection is
* on screen */
{
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
if (mui->flags & MUI_FLAG_IS_PLAYLIST)
{
@ -9267,7 +9275,8 @@ static enum menu_action materialui_parse_menu_entry_action(
* 'start' action *if* current selection is
* on screen */
{
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
if (mui->flags & MUI_FLAG_IS_PLAYLIST)
{
@ -9306,7 +9315,8 @@ static enum menu_action materialui_parse_menu_entry_action(
* In addition, an 'info' action is only valid in general
* if the currently selected entry is on screen */
{
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
if ( (mui->flags & MUI_FLAG_IS_PLAYLIST)
|| !materialui_entry_onscreen(mui, selection))
@ -9321,7 +9331,8 @@ static enum menu_action materialui_parse_menu_entry_action(
* selected item is on screen. If it
* is off screen, must disable input */
{
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
if (!materialui_entry_onscreen(mui, selection))
new_action = MENU_ACTION_NOOP;
@ -9366,14 +9377,14 @@ static enum menu_action materialui_parse_menu_entry_action(
else if (main_menu_tab_index == mui->nav_bar.active_menu_tab_index)
{
/* Jump to first item on Main Menu */
menu_navigation_set_selection(0);
menu_st->selection_ptr = 0;
materialui_navigation_set(mui, true);
}
}
else if (materialui_list_get_size(mui, MENU_LIST_PLAIN) == 1)
{
/* Jump to first item on current menu */
menu_navigation_set_selection(0);
menu_st->selection_ptr = 0;
materialui_navigation_set(mui, true);
}
break;
@ -9393,10 +9404,11 @@ static int materialui_menu_entry_action(
void *userdata, menu_entry_t *entry,
size_t i, enum menu_action action)
{
materialui_handle_t *mui = (materialui_handle_t*)userdata;
menu_entry_t *entry_ptr = entry;
size_t selection = i;
size_t new_selection;
struct menu_state *menu_st = menu_state_get_ptr();
materialui_handle_t *mui = (materialui_handle_t*)userdata;
menu_entry_t *entry_ptr = entry;
size_t selection = i;
/* Process input action */
enum menu_action new_action = materialui_parse_menu_entry_action(
mui, action);
@ -9411,9 +9423,9 @@ static int materialui_menu_entry_action(
/* Check whether current selection has changed
* (due to automatic on screen entry selection...) */
new_selection = menu_navigation_get_selection();
new_selection = menu_st->selection_ptr;
if (new_selection != selection)
if (new_selection != selection) /* Changed? */
{
static menu_entry_t new_entry;
@ -9854,8 +9866,9 @@ static int materialui_pointer_up_swipe_horz_default(
{
if ((ptr < entries_end) && (ptr == selection))
{
size_t new_selection = menu_navigation_get_selection();
int ret = materialui_menu_entry_action(
struct menu_state *menu_st = menu_state_get_ptr();
size_t new_selection = menu_st->selection_ptr;
int ret = materialui_menu_entry_action(
mui, entry, selection, action);
/* If we are changing a settings value, want to scroll
@ -9972,11 +9985,12 @@ static int materialui_pointer_up(void *userdata,
{
unsigned width;
unsigned height;
gfx_display_t *p_disp = disp_get_ptr();
unsigned header_height = p_disp->header_height;
size_t selection = menu_navigation_get_selection();
size_t entries_end = menu_entries_get_size();
materialui_handle_t *mui = (materialui_handle_t*)userdata;
gfx_display_t *p_disp = disp_get_ptr();
unsigned header_height = p_disp->header_height;
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
size_t entries_end = menu_entries_get_size();
materialui_handle_t *mui = (materialui_handle_t*)userdata;
if (!mui)
return -1;
@ -10113,7 +10127,7 @@ static int materialui_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;
/* Perform a MENU_ACTION_SELECT on currently
* active item
@ -10135,7 +10149,7 @@ static int materialui_pointer_up(void *userdata,
* - but menu_navigation_set_selection() just sets a
* variable, so there's no real point in performing
* a (selection != ptr) check here */
menu_navigation_set_selection(ptr);
menu_st->selection_ptr = ptr;
menu_input_set_pointer_y_accel(0.0f);
}
}
@ -11027,7 +11041,8 @@ static void materialui_get_thumbnail_system(void *userdata, char *s, size_t len)
static void materialui_refresh_thumbnail_image(void *userdata, unsigned i)
{
materialui_handle_t *mui = (materialui_handle_t*)userdata;
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
bool refresh_enabled = false;
if (!mui)

View File

@ -5447,7 +5447,7 @@ static void ozone_compute_entries_position(
}
/* Update scrolling */
ozone->selection = menu_navigation_get_selection();
ozone->selection = menu_st->selection_ptr;
ozone_update_scroll(ozone, false, (ozone_node_t*)selection_buf->list[ozone->selection].userdata);
}
@ -8498,8 +8498,9 @@ static int ozone_menu_entry_action(
{
menu_entry_t new_entry;
ozone_handle_t *ozone = (ozone_handle_t*)userdata;
menu_entry_t *entry_ptr = entry;
struct menu_state *menu_st = menu_state_get_ptr();
settings_t *settings = config_get_ptr();
menu_entry_t *entry_ptr = entry;
size_t selection = i;
/* Process input action */
enum menu_action new_action = ozone_parse_menu_entry_action(ozone,
@ -8508,7 +8509,7 @@ static int ozone_menu_entry_action(
action);
/* Check whether current selection has changed
* (due to automatic on screen entry selection...) */
size_t new_selection = menu_navigation_get_selection();
size_t new_selection = menu_st->selection_ptr;
if (new_selection != selection)
{
@ -9738,7 +9739,7 @@ static void ozone_render(void *data,
ozone_cache_footer_labels(ozone);
}
ozone->selection = menu_navigation_get_selection();
ozone->selection = menu_st->selection_ptr;
/* Need to update this each frame, otherwise touchscreen
* input breaks when changing orientation */
@ -10127,7 +10128,7 @@ static void ozone_render(void *data,
/* Handle any pending thumbnail load requests */
if (ozone->show_thumbnail_bar && (ozone->thumbnails.pending != OZONE_PENDING_THUMBNAIL_NONE))
{
size_t selection = menu_navigation_get_selection();
size_t selection = menu_st->selection_ptr;
playlist_t *playlist = playlist_get_cached();
unsigned gfx_thumbnail_upscale_threshold = settings->uints.gfx_thumbnail_upscale_threshold;
bool network_on_demand_thumbnails = settings->bools.network_on_demand_thumbnails;
@ -11292,6 +11293,8 @@ static void ozone_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;
#ifdef HAVE_DISCORD_OWN_AVATAR
static bool reset = false;
@ -11496,7 +11499,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
video_height,
(unsigned)ozone->selection,
(unsigned)ozone->selection_old,
menu_entries_get_selection_buf_ptr(0),
MENU_LIST_GET_SELECTION(menu_list, 0),
ozone->animations.list_alpha,
ozone->animations.scroll_y,
ozone->flags & OZONE_FLAG_IS_PLAYLIST,
@ -11961,11 +11964,11 @@ static void ozone_populate_entries(
{
ozone->flags &= ~(OZONE_FLAG_WANT_THUMBNAIL_BAR
| OZONE_FLAG_SKIP_THUMBNAIL_RESET);
ozone_update_savestate_thumbnail_path(ozone, (unsigned)menu_navigation_get_selection());
ozone_update_savestate_thumbnail_path(ozone, (unsigned)menu_st->selection_ptr);
ozone_update_savestate_thumbnail_image(ozone);
}
else if (gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) ||
gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_LEFT))
else if ( gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_RIGHT)
|| gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_LEFT))
{
ozone->flags |= (OZONE_FLAG_WANT_THUMBNAIL_BAR
| OZONE_FLAG_SKIP_THUMBNAIL_RESET);
@ -11973,9 +11976,7 @@ static void ozone_populate_entries(
}
}
else if (ozone->flags & OZONE_FLAG_IS_STATE_SLOT)
{
ozone->flags |= OZONE_FLAG_WANT_THUMBNAIL_BAR;
}
else if (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST)
{
ozone->flags &= ~OZONE_FLAG_WANT_THUMBNAIL_BAR;
@ -12063,8 +12064,8 @@ static void ozone_populate_entries(
static void ozone_toggle(void *userdata, bool menu_on)
{
settings_t *settings = NULL;
ozone_handle_t *ozone = (ozone_handle_t*) userdata;
settings_t *settings = NULL;
ozone_handle_t *ozone = (ozone_handle_t*) userdata;
if (!ozone)
return;
@ -12074,18 +12075,19 @@ static void ozone_toggle(void *userdata, bool menu_on)
* 'save state' option */
if (ozone->is_quick_menu)
{
ozone->flags &= ~(OZONE_FLAG_WANT_THUMBNAIL_BAR
| OZONE_FLAG_SKIP_THUMBNAIL_RESET);
struct menu_state *menu_st = menu_state_get_ptr();
ozone->flags &= ~(OZONE_FLAG_WANT_THUMBNAIL_BAR
| OZONE_FLAG_SKIP_THUMBNAIL_RESET);
gfx_thumbnail_reset(&ozone->thumbnails.savestate);
ozone_update_savestate_thumbnail_path(ozone, (unsigned)menu_navigation_get_selection());
ozone_update_savestate_thumbnail_path(ozone, (unsigned)menu_st->selection_ptr);
ozone_update_savestate_thumbnail_image(ozone);
}
settings = config_get_ptr();
if ((!menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL)))
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
else
if (menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL))
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL);
else
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
if (ozone->depth == 1)
{

View File

@ -4936,6 +4936,7 @@ static void rgui_render(
settings_t *settings = config_get_ptr();
gfx_animation_t *p_anim = anim_get_ptr();
gfx_display_t *p_disp = disp_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
rgui_t *rgui = (rgui_t*)data;
enum gfx_animation_ticker_type
menu_ticker_type = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
@ -5168,11 +5169,12 @@ static void rgui_render(
* this is better than switching back to the text playlist
* view, which causes ugly flickering when scrolling quickly
* through a list...) */
const char *thumbnail_title = NULL;
char thumbnail_title_buf[255];
unsigned title_x, title_width;
bool is_state_slot = !string_is_empty(rgui->savestate_thumbnail_file_path);
thumbnail_title_buf[0] = '\0';
const char *thumbnail_title = NULL;
struct menu_state *menu_st = menu_state_get_ptr();
bool is_state_slot = !string_is_empty(rgui->savestate_thumbnail_file_path);
thumbnail_title_buf[0] = '\0';
/* Draw thumbnail */
rgui_render_fs_thumbnail(rgui, fb_width, fb_height, fb_pitch);
@ -5200,7 +5202,7 @@ static void rgui_render(
snprintf(thumbnail_title_buf + _len,
sizeof(thumbnail_title_buf) - _len,
" %d",
(int)menu_navigation_get_selection() - 1);
(int)menu_st->selection_ptr - 1);
thumbnail_title = thumbnail_title_buf;
}
}
@ -5250,7 +5252,7 @@ static void rgui_render(
else
{
/* Render usual text */
size_t selection = menu_navigation_get_selection();
size_t selection = menu_st->selection_ptr;
char title_buf[255];
size_t title_max_len;
size_t title_len;
@ -6760,9 +6762,10 @@ static void rgui_load_current_thumbnails(rgui_t *rgui, bool download_missing)
/* On demand thumbnail downloads */
if (thumbnails_missing && download_missing)
{
const char *system = NULL;
playlist_t *playlist = playlist_get_cached();
size_t selection = menu_navigation_get_selection();
const char *system = NULL;
playlist_t *playlist = playlist_get_cached();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
/* Explore list needs cached selection index */
if (rgui->flags & RGUI_FLAG_IS_EXPLORE_LIST)
@ -6909,19 +6912,20 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load)
|| (rgui->flags & RGUI_FLAG_IS_EXPLORE_LIST)
|| (rgui->is_quick_menu))
{
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;
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
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;
if (rgui->flags & RGUI_FLAG_IS_PLAYLIST)
{
/* Get playlist index corresponding
* to the selected entry */
if (list &&
(selection < list_size) &&
(list->list[selection].type == FILE_TYPE_RPL_ENTRY))
if ( (list)
&& (selection < list_size)
&& (list->list[selection].type == FILE_TYPE_RPL_ENTRY))
{
playlist_valid = true;
playlist_index = list->list[selection].entry_idx;
@ -6971,8 +6975,9 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load)
if ( (rgui->is_quick_menu)
|| (rgui->flags & RGUI_FLAG_IS_STATE_SLOT))
{
size_t selection = menu_navigation_get_selection();
size_t list_size = menu_entries_get_size();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
size_t list_size = menu_entries_get_size();
if (selection < list_size)
{
@ -7132,8 +7137,9 @@ static void rgui_navigation_set(void *data, bool scroll)
{
size_t start = 0;
bool menu_show_sublabels = false;
struct menu_state *menu_st = menu_state_get_ptr();
size_t end = menu_entries_get_size();
size_t selection = menu_navigation_get_selection();
size_t selection = menu_st->selection_ptr;
rgui_t *rgui = (rgui_t*)data;
if (!rgui)
@ -7359,8 +7365,9 @@ static int rgui_pointer_up(
menu_entry_t *entry,
unsigned action)
{
rgui_t *rgui = (rgui_t*)data;
size_t selection = menu_navigation_get_selection();
rgui_t *rgui = (rgui_t*)data;
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
if (!rgui)
return -1;
@ -7394,6 +7401,7 @@ static int rgui_pointer_up(
return rgui_menu_entry_action(rgui, entry, selection, MENU_ACTION_CANCEL);
else if (ptr <= (menu_entries_get_size() - 1))
{
struct menu_state *menu_st = menu_state_get_ptr();
/* If currently selected item matches 'pointer' value,
* perform a MENU_ACTION_SELECT on it */
if (ptr == selection)
@ -7401,7 +7409,7 @@ static int rgui_pointer_up(
/* Otherwise, just move the current selection to the
* 'pointer' value */
menu_navigation_set_selection(ptr);
menu_st->selection_ptr = ptr;
rgui_navigation_set(rgui, false);
}
}
@ -7874,9 +7882,10 @@ static enum menu_action rgui_parse_menu_entry_action(
if (string_is_equal(rgui->menu_title, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MAIN_MENU)))
{
struct menu_state *menu_st = menu_state_get_ptr();
/* Jump to first item on Main Menu */
menu_navigation_set_selection(0);
new_action = MENU_ACTION_NOOP;
menu_st->selection_ptr = 0;
new_action = MENU_ACTION_NOOP;
}
break;
case MENU_ACTION_START:

View File

@ -1366,7 +1366,9 @@ static void xmb_unload_thumbnail_textures(void *data)
static void xmb_set_thumbnail_content(void *data, const char *s)
{
xmb_handle_t *xmb = (xmb_handle_t*)data;
xmb_handle_t *xmb = (xmb_handle_t*)data;
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
if (!xmb)
return;
@ -1383,8 +1385,6 @@ 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();
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);
@ -1412,8 +1412,6 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
if (string_is_empty(s))
{
menu_entry_t entry;
size_t selection = menu_navigation_get_selection();
MENU_ENTRY_INITIALIZE(entry);
entry.flags |= MENU_ENTRY_FLAG_PATH_ENABLED;
menu_entry_get(&entry, 0, selection, NULL, true);
@ -1435,7 +1433,7 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
menu_entry_t entry;
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, selection, NULL, true);
xmb->fullscreen_thumbnails_available =
(menu_explore_set_playlist_thumbnail(entry.type, xmb->thumbnail_path_data) >= 0);
@ -1446,9 +1444,7 @@ 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_LIST_GET_SELECTION(menu_list, 0);
xmb_node_t *node = (xmb_node_t*)selection_buf->list[selection].userdata;
@ -2146,10 +2142,11 @@ static void xmb_tab_set_selection(void *data)
if (xmb)
{
size_t tab_selection = xmb->tab_selection[xmb->categories_selection_ptr];
size_t tab_selection = xmb->tab_selection[xmb->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;
xmb_selection_pointer_changed(xmb, false);
}
}
@ -2623,7 +2620,7 @@ static void xmb_list_open(xmb_handle_t *xmb)
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();
size_t selection = menu_st->selection_ptr;
xmb->depth = (int)
xmb_list_get_size(xmb, MENU_LIST_PLAIN);
@ -2805,7 +2802,7 @@ static void xmb_populate_entries(void *data,
!xmb->is_quick_menu &&
(xmb->is_playlist || xmb->is_explore_list)))
{
size_t entry_idx_selection = menu_navigation_get_selection() + 1;
size_t entry_idx_selection = menu_st->selection_ptr + 1;
size_t list_size = MENU_LIST_GET_SELECTION(menu_list, 0)->size;
unsigned entry_idx_offset = 0;
@ -4531,7 +4528,8 @@ static int xmb_menu_entry_action(
static enum menu_action xmb_parse_menu_entry_action(
xmb_handle_t *xmb, enum menu_action action)
{
enum menu_action new_action = action;
struct menu_state *menu_st = menu_state_get_ptr();
enum menu_action new_action = action;
/* Scan user inputs */
switch (action)
@ -4597,7 +4595,7 @@ static enum menu_action xmb_parse_menu_entry_action(
!xmb->show_fullscreen_thumbnails)
{
xmb_hide_fullscreen_thumbnails(xmb, false);
xmb_show_fullscreen_thumbnails(xmb, menu_navigation_get_selection());
xmb_show_fullscreen_thumbnails(xmb, menu_st->selection_ptr);
xmb->want_fullscreen_thumbnails = true;
xmb_set_thumbnail_delay(false);
new_action = MENU_ACTION_NOOP;
@ -4616,7 +4614,7 @@ static enum menu_action xmb_parse_menu_entry_action(
(xmb->is_quick_menu && !string_is_empty(xmb->savestate_thumbnail_file_path))))
{
xmb_hide_fullscreen_thumbnails(xmb, false);
xmb_show_fullscreen_thumbnails(xmb, menu_navigation_get_selection());
xmb_show_fullscreen_thumbnails(xmb, menu_st->selection_ptr);
xmb->want_fullscreen_thumbnails = true;
new_action = MENU_ACTION_NOOP;
}
@ -4646,7 +4644,7 @@ static enum menu_action xmb_parse_menu_entry_action(
if (xmb->show_fullscreen_thumbnails)
xmb_hide_fullscreen_thumbnails(xmb, true);
else
xmb_show_fullscreen_thumbnails(xmb, menu_navigation_get_selection());
xmb_show_fullscreen_thumbnails(xmb, menu_st->selection_ptr);
return MENU_ACTION_NOOP;
}
@ -4679,7 +4677,7 @@ static enum menu_action xmb_parse_menu_entry_action(
(unsigned)xmb->categories_selection_ptr) == XMB_SYSTEM_TAB_MAIN)
{
/* Jump to first item on Main Menu */
menu_navigation_set_selection(0);
menu_st->selection_ptr = 0;
xmb_selection_pointer_changed(xmb, true);
}
else
@ -4690,7 +4688,7 @@ static enum menu_action xmb_parse_menu_entry_action(
menu_entry_t entry;
MENU_ENTRY_INITIALIZE(entry);
menu_entry_get(&entry, 0, menu_navigation_get_selection(), NULL, true);
menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true);
/* Icon animations get stuck if they happen too fast,
therefore allow it only on the last action */
@ -4701,7 +4699,7 @@ static enum menu_action xmb_parse_menu_entry_action(
xmb->allow_horizontal_animation = true;
xmb_menu_entry_action(xmb,
&entry, menu_navigation_get_selection(), MENU_ACTION_LEFT);
&entry, menu_st->selection_ptr, MENU_ACTION_LEFT);
}
}
return MENU_ACTION_NOOP;
@ -4809,7 +4807,7 @@ static void xmb_render(void *data,
if (xmb->pointer.type != MENU_POINTER_DISABLED)
{
size_t selection = menu_navigation_get_selection();
size_t selection = menu_st->selection_ptr;
int16_t margin_top = (int16_t)xmb->margins_screen_top;
int16_t margin_left = (int16_t)xmb->margins_screen_left;
int16_t margin_right = (int16_t)((float)width - xmb->margins_screen_left);
@ -4945,7 +4943,7 @@ static void xmb_render(void *data,
/* Handle any pending thumbnail load requests */
if (xmb->thumbnails.pending != XMB_PENDING_THUMBNAIL_NONE)
{
size_t selection = menu_navigation_get_selection();
size_t selection = menu_st->selection_ptr;
playlist_t *playlist = playlist_get_cached();
unsigned gfx_thumbnail_upscale_threshold = settings->uints.gfx_thumbnail_upscale_threshold;
bool network_on_demand_thumbnails = settings->bools.network_on_demand_thumbnails;
@ -5765,7 +5763,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
xmb_coord_black,
xmb_coord_white);
selection = menu_navigation_get_selection();
selection = menu_st->selection_ptr;
/* Use alternative title if available */
strlcpy(title_truncated,
@ -5827,24 +5825,24 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
}
/* Allow browsing playlist in fullscreen thumbnail mode */
if ((xmb->is_playlist || xmb->is_state_slot) &&
xmb->show_fullscreen_thumbnails &&
xmb->fullscreen_thumbnails_available &&
menu_navigation_get_selection() != xmb->fullscreen_thumbnail_selection)
xmb_show_fullscreen_thumbnails(xmb, menu_navigation_get_selection());
else if (!xmb->show_fullscreen_thumbnails &&
xmb->fullscreen_thumbnails_available &&
xmb->want_fullscreen_thumbnails)
xmb_show_fullscreen_thumbnails(xmb, menu_navigation_get_selection());
if ( (xmb->is_playlist || xmb->is_state_slot)
&& xmb->show_fullscreen_thumbnails
&& xmb->fullscreen_thumbnails_available
&& (menu_st->selection_ptr != xmb->fullscreen_thumbnail_selection))
xmb_show_fullscreen_thumbnails(xmb, menu_st->selection_ptr);
else if (!xmb->show_fullscreen_thumbnails
&& xmb->fullscreen_thumbnails_available
&& xmb->want_fullscreen_thumbnails)
xmb_show_fullscreen_thumbnails(xmb, menu_st->selection_ptr);
/* Note: This is incredibly ugly, but there are
* so many combinations here that we would go insane
* trying to rationalise this any further... */
/* Save state thumbnail, right side in PS3 layout, left in PSP layout */
if ((xmb->is_quick_menu || xmb->is_state_slot) &&
((xmb->thumbnails.savestate.status == GFX_THUMBNAIL_STATUS_AVAILABLE) ||
(xmb->thumbnails.savestate.status == GFX_THUMBNAIL_STATUS_PENDING)))
if ( (xmb->is_quick_menu || xmb->is_state_slot)
&& ((xmb->thumbnails.savestate.status == GFX_THUMBNAIL_STATUS_AVAILABLE)
|| (xmb->thumbnails.savestate.status == GFX_THUMBNAIL_STATUS_PENDING)))
{
float thumb_width = right_thumbnail_margin_width;
float thumb_height = thumbnail_margin_height_full;
@ -7463,11 +7461,12 @@ static void xmb_list_insert(void *userdata,
size_t list_size,
unsigned entry_type)
{
int current = 0;
int i = (int)list_size;
xmb_node_t *node = NULL;
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
size_t selection = menu_navigation_get_selection();
int current = 0;
int i = (int)list_size;
xmb_node_t *node = NULL;
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
if (!xmb || !list)
return;
@ -7568,7 +7567,7 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action
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();
size_t selection = menu_st->selection_ptr;
settings_t *settings = config_get_ptr();
bool menu_horizontal_animation = settings->bools.menu_horizontal_animation;
@ -8199,8 +8198,8 @@ static int xmb_pointer_up(void *userdata,
int16_t margin_left;
int16_t margin_right;
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
menu_list_t *menu_list = menu_st->entries.list;
unsigned end = (unsigned)MENU_LIST_GET_SELECTION(menu_list, 0)->size;
@ -8249,7 +8248,7 @@ static int xmb_pointer_up(void *userdata,
entry, selection, MENU_ACTION_SELECT);
/* ...otherwise navigate to the current pointer item */
menu_navigation_set_selection(ptr);
menu_st->selection_ptr = ptr;
xmb_navigation_set(xmb, false);
}
break;
@ -8297,7 +8296,7 @@ static int xmb_pointer_up(void *userdata,
if (last < end)
{
menu_navigation_set_selection((size_t)last);
menu_st->selection_ptr = (size_t)last;
xmb_navigation_set(xmb, true);
}
else
@ -8347,7 +8346,7 @@ static int xmb_pointer_up(void *userdata,
if (new_idx > 0)
{
menu_navigation_set_selection(new_idx);
menu_st->selection_ptr = new_idx;
xmb_navigation_set(xmb, true);
}
else

View File

@ -1223,13 +1223,14 @@ static unsigned menu_displaylist_parse_core_option_dropdown_list(
if (checked_found)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
info_list->list[checked].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(checked);
menu_st->selection_ptr = checked;
}
return count;
@ -5076,10 +5077,11 @@ static int menu_displaylist_parse_audio_device_list(
* mapped to this entry */
if (audio_device_index == i)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info_list->list[menu_index].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info_list->list[menu_index].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(menu_index);
menu_st->selection_ptr = menu_index;
}
count++;
@ -5106,10 +5108,11 @@ static int menu_displaylist_parse_audio_device_list(
* mapped to this entry */
if (audio_device_index == i)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info_list->list[menu_index].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info_list->list[menu_index].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(menu_index);
cbs->checked = true;
menu_st->selection_ptr = menu_index;
}
count++;
@ -5205,10 +5208,11 @@ static int menu_displaylist_parse_input_device_type_list(
* mapped to this entry */
if (current_device == devices[i])
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info_list->list[menu_index].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info_list->list[menu_index].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(menu_index);
cbs->checked = true;
menu_st->selection_ptr = menu_index;
}
count++;
@ -5309,9 +5313,9 @@ static int menu_displaylist_parse_input_select_physical_keyboard_list(
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info_list->list[menu_index].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(menu_index);
keyboard_added = true;
cbs->checked = true;
menu_st->selection_ptr = menu_index;
keyboard_added = true;
}
count++;
menu_index++;
@ -5324,8 +5328,8 @@ static int menu_displaylist_parse_input_select_physical_keyboard_list(
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info_list->list[0].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(0);
cbs->checked = true;
menu_st->selection_ptr = 0;
}
return count;
@ -5425,11 +5429,12 @@ static int menu_displaylist_parse_input_description_list(
* mapped to this entry */
if (current_remap_idx == i)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[menu_index].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[menu_index].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(menu_index);
current_input_mapped = true;
cbs->checked = true;
menu_st->selection_ptr = menu_index;
current_input_mapped = true;
}
count++;
@ -5449,10 +5454,11 @@ static int menu_displaylist_parse_input_description_list(
/* Add checkmark if input is currently unmapped */
if (!current_input_mapped)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[menu_index].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[menu_index].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(menu_index);
cbs->checked = true;
menu_st->selection_ptr = menu_index;
}
count++;
@ -5482,13 +5488,12 @@ static unsigned menu_displaylist_parse_netplay_mitm_server_list(
{
if (string_is_equal(server->name, netplay_mitm_server))
{
menu_file_list_cbs_t *cbs =
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs =
(menu_file_list_cbs_t*)info_list->list[count].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(count);
cbs->checked = true;
menu_st->selection_ptr = count;
}
count++;
@ -5572,10 +5577,11 @@ static int menu_displaylist_parse_input_description_kbd_list(
* mapped to this entry */
if (current_key_id == key_id)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info_list->list[menu_index].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info_list->list[menu_index].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(menu_index);
cbs->checked = true;
menu_st->selection_ptr = menu_index;
}
count++;
@ -5666,10 +5672,11 @@ static void wifi_scan_callback(retro_task_t *task,
bool menu_displaylist_process(menu_displaylist_info_t *info)
{
#ifdef HAVE_NETWORKING
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
#endif
uint32_t info_flags = info->flags;
file_list_t *info_list = info->list;
struct menu_state *menu_st = menu_state_get_ptr();
uint32_t info_flags = info->flags;
file_list_t *info_list = info->list;
if (info_flags & MD_FLAG_NEED_NAVIGATION_CLEAR)
{
@ -5730,7 +5737,7 @@ bool menu_displaylist_process(menu_displaylist_info_t *info)
menu_entries_ctl(MENU_ENTRIES_CTL_REFRESH, info_list);
if (info_flags & MD_FLAG_NEED_CLEAR)
menu_navigation_set_selection(0);
menu_st->selection_ptr = 0;
if (info_flags & MD_FLAG_NEED_PUSH)
{
@ -5743,7 +5750,10 @@ bool menu_displaylist_process(menu_displaylist_info_t *info)
MENU_ENUM_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE,
MENU_INFO_MESSAGE, 0, 0, NULL);
menu_driver_populate_entries(info);
if (menu_st->driver_ctx && menu_st->driver_ctx->populate_entries)
menu_st->driver_ctx->populate_entries(
menu_st->userdata, info->path,
info->label, info->type);
}
return true;
}
@ -5857,10 +5867,11 @@ static unsigned populate_playlist_thumbnail_mode_dropdown_list(
/* Add checkmark if item is currently selected */
if (current_thumbnail_mode == thumbnail_mode)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(i);
cbs->checked = true;
menu_st->selection_ptr = i;
}
}
}
@ -7811,10 +7822,11 @@ unsigned menu_displaylist_build_list(
if (video_list[i].current)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(i);
cbs->checked = true;
menu_st->selection_ptr = i;
}
}
@ -7833,9 +7845,10 @@ unsigned menu_displaylist_build_list(
if (core_info_list && playlist)
{
size_t i;
struct menu_state *menu_st = menu_state_get_ptr();
const char *current_core_name = playlist_get_default_core_name(playlist);
core_info_t *core_info = NULL;
size_t i;
/* Sort cores alphabetically */
core_info_qsort(core_info_list, CORE_INFO_LIST_SORT_DISPLAY_NAME);
@ -7852,19 +7865,16 @@ unsigned menu_displaylist_build_list(
if (string_is_empty(current_core_name) ||
string_is_equal(current_core_name, "DETECT"))
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[0].actiondata;
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[0].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(0);
cbs->checked = true;
menu_st->selection_ptr = 0;
}
/* Loop through cores */
for (i = 0; i < core_info_list->count; i++)
{
core_info = NULL;
core_info = core_info_get(core_info_list, i);
if (core_info)
if ((core_info = core_info_get(core_info_list, i)))
{
if (menu_entries_append(list,
core_info->display_name,
@ -7878,8 +7888,8 @@ unsigned menu_displaylist_build_list(
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i + 1].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(i + 1);
cbs->checked = true;
menu_st->selection_ptr = (i + 1);
}
}
}
@ -7939,10 +7949,11 @@ unsigned menu_displaylist_build_list(
if (current_display_mode == display_mode)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(i);
cbs->checked = true;
menu_st->selection_ptr = i;
}
}
}
@ -8002,10 +8013,11 @@ unsigned menu_displaylist_build_list(
/* Check whether current entry is checked */
if (current_sort_mode == sort_mode)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(i);
cbs->checked = true;
menu_st->selection_ptr = i;
}
}
}
@ -8055,10 +8067,11 @@ unsigned menu_displaylist_build_list(
/* Check whether current entry is checked */
if (string_is_equal(current_system_name, system_name))
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(i);
cbs->checked = true;
menu_st->selection_ptr = i;
}
}
@ -8101,10 +8114,11 @@ unsigned menu_displaylist_build_list(
/* Check whether current entry is checked */
if (string_is_equal(current_core_name, core_name))
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(i);
cbs->checked = true;
menu_st->selection_ptr = i;
}
}
@ -8185,10 +8199,11 @@ unsigned menu_displaylist_build_list(
/* Check whether current disk is selected */
if (i == current_image)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(i);
cbs->checked = true;
menu_st->selection_ptr = i;
}
}
}
@ -10935,10 +10950,11 @@ static unsigned menu_displaylist_build_shader_parameter(
if (checked_found)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[checked].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[checked].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(checked);
cbs->checked = true;
menu_st->selection_ptr = checked;
}
return count;
@ -11238,12 +11254,13 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
case DISPLAYLIST_OPTIONS_REMAPPINGS_PORT:
{
unsigned max_users = settings->uints.input_max_users;
struct menu_state *menu_st = menu_state_get_ptr();
const char *menu_driver = menu_driver_ident();
bool is_rgui = string_is_equal(menu_driver, "rgui");
file_list_t *list = info->list;
unsigned port = string_to_unsigned(info->path);
unsigned mapped_port = settings->uints.input_remap_ports[port];
size_t selection = menu_navigation_get_selection();
size_t selection = menu_st->selection_ptr;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
@ -12398,8 +12415,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
core_updater_list_t *core_list = core_updater_list_get_cached();
menu_search_terms_t *search_terms= menu_entries_search_get_terms();
struct menu_state *menu_st = menu_state_get_ptr();
bool show_experimental_cores = settings->bools.network_buildbot_show_experimental_cores;
size_t selection = menu_navigation_get_selection();
size_t selection = menu_st->selection_ptr;
if (core_list)
{
@ -12798,7 +12816,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
* current selection index is less than the current
* number of menu entries - if not, we reset the
* navigation pointer */
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
count = menu_displaylist_parse_core_info(info->list, info->type,
@ -12832,8 +12851,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
* have to cache the last set menu size, and reset
* the navigation pointer if the current size is
* different */
static size_t prev_count = 0;
size_t selection = menu_navigation_get_selection();
static size_t prev_count = 0;
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
count = menu_displaylist_parse_core_manager_list
(info->list, settings);
@ -12895,8 +12915,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
#endif
case DISPLAYLIST_CONTENTLESS_CORES:
{
size_t contentless_core_ptr =
menu_state_get_ptr()->contentless_core_ptr;
struct menu_state *menu_st = menu_state_get_ptr();
size_t contentless_core_ptr = menu_st->contentless_core_ptr;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
count = menu_displaylist_contentless_cores(info->list, settings);
@ -12911,7 +12931,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
* menu index is lost. We therefore have to apply
* a cached index value after rebuilding the list... */
if (contentless_core_ptr < count)
menu_navigation_set_selection(contentless_core_ptr);
menu_st->selection_ptr = contentless_core_ptr;
info->flags &= ~MD_FLAG_NEED_SORT;
info->flags |= MD_FLAG_NEED_PUSH;
@ -13021,7 +13041,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
* we therefore have to check that the current selection
* index is less than the current number of menu entries
* - if not, we reset the navigation pointer */
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
runloop_state_t *runloop_st = runloop_state_get_ptr();
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
@ -13133,7 +13154,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
* current selection index is less than the current
* number of menu entries - if not, we reset the
* navigation pointer */
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
count = menu_displaylist_parse_core_option_override_list(info->list, settings);
@ -13164,7 +13186,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
* current selection index is less than the current
* number of menu entries - if not, we reset the
* navigation pointer */
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
count = menu_displaylist_parse_remap_file_manager_list(info->list, settings);
@ -14492,10 +14515,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (checked_found)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(checked);
cbs->checked = true;
menu_st->selection_ptr = checked;
}
}
@ -14571,10 +14595,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (checked_found)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(checked);
cbs->checked = true;
menu_st->selection_ptr = checked;
}
}
break;
@ -14646,10 +14671,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (checked_found)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(checked);
cbs->checked = true;
menu_st->selection_ptr = checked;
}
}
break;
@ -14721,10 +14747,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (checked_found)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(checked);
cbs->checked = true;
menu_st->selection_ptr = checked;
}
}
break;
@ -14761,10 +14788,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (i == pass_count)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[i].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[i].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(i);
cbs->checked = true;
menu_st->selection_ptr = i;
}
}
@ -14825,10 +14853,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (checked_found)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(checked);
cbs->checked = true;
menu_st->selection_ptr = checked;
}
}
@ -14903,10 +14932,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (checked_found)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(checked);
cbs->checked = true;
menu_st->selection_ptr = checked;
}
}
break;
@ -14977,10 +15007,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (checked_found)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(checked);
cbs->checked = true;
menu_st->selection_ptr = checked;
}
}
break;
@ -15052,10 +15083,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (checked_found)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
struct menu_state *menu_st = menu_state_get_ptr();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)info->list->list[checked].actiondata;
if (cbs)
cbs->checked = true;
menu_navigation_set_selection(checked);
cbs->checked = true;
menu_st->selection_ptr = checked;
}
}
break;
@ -15106,8 +15138,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (menu_entries_list_search(pending_selection, &selection_idx))
{
menu_navigation_set_selection(selection_idx);
menu_driver_navigation_set(true);
struct menu_state *menu_st = menu_state_get_ptr();
menu_st->selection_ptr = selection_idx;
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
}
menu_driver_set_pending_selection(NULL);

View File

@ -342,18 +342,6 @@ static bool menu_should_pop_stack(const char *label)
return false;
}
size_t menu_navigation_get_selection(void)
{
struct menu_state *menu_st = &menu_driver_state;
return menu_st->selection_ptr;
}
void menu_navigation_set_selection(size_t val)
{
struct menu_state *menu_st = &menu_driver_state;
menu_st->selection_ptr = val;
}
void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
size_t i, void *userdata, bool use_representation)
{
@ -515,17 +503,6 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
}
}
menu_file_list_cbs_t *menu_entries_get_last_stack_actiondata(void)
{
struct menu_state *menu_st = &menu_driver_state;
if (menu_st->entries.list)
{
const file_list_t *list = MENU_LIST_GET(menu_st->entries.list, 0);
return (menu_file_list_cbs_t*)list->list[list->size - 1].actiondata;
}
return NULL;
}
file_list_t *menu_entries_get_menu_stack_ptr(size_t idx)
{
struct menu_state *menu_st = &menu_driver_state;
@ -619,10 +596,10 @@ bool menu_entries_list_search(const char *needle, size_t *idx)
* of the list (e.g. 'Parent Directory'). These
* have no bearing on the actual content of the
* list, and should be excluded from the search */
if ((entry.type == FILE_TYPE_SCAN_DIRECTORY) ||
(entry.type == FILE_TYPE_MANUAL_SCAN_DIRECTORY) ||
(entry.type == FILE_TYPE_USE_DIRECTORY) ||
(entry.type == FILE_TYPE_PARENT_DIRECTORY))
if ( (entry.type == FILE_TYPE_SCAN_DIRECTORY)
|| (entry.type == FILE_TYPE_MANUAL_SCAN_DIRECTORY)
|| (entry.type == FILE_TYPE_USE_DIRECTORY)
|| (entry.type == FILE_TYPE_PARENT_DIRECTORY))
continue;
/* Get displayed entry label */
@ -1259,11 +1236,11 @@ static bool input_event_osk_show_symbol_pages(
menu->driver_ctx &&
menu->driver_ctx->set_texture);
unsigned language = *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE);
return !menu_has_fb ||
((language == RETRO_LANGUAGE_JAPANESE) ||
(language == RETRO_LANGUAGE_KOREAN) ||
(language == RETRO_LANGUAGE_CHINESE_SIMPLIFIED) ||
(language == RETRO_LANGUAGE_CHINESE_TRADITIONAL));
return (!menu_has_fb)
|| ((language == RETRO_LANGUAGE_JAPANESE)
|| (language == RETRO_LANGUAGE_KOREAN)
|| (language == RETRO_LANGUAGE_CHINESE_SIMPLIFIED)
|| (language == RETRO_LANGUAGE_CHINESE_TRADITIONAL));
#else /* HAVE_RGUI */
return true;
#endif /* HAVE_RGUI */
@ -2620,11 +2597,11 @@ static void menu_driver_set_last_shader_path_int(
{
const char *file_name = NULL;
if (!type ||
!shader_dir ||
(dir_len < 1) ||
!shader_file ||
(file_len < 1))
if ( !type
|| !shader_dir
|| (dir_len < 1)
|| !shader_file
|| (file_len < 1))
return;
/* Reset existing cache */
@ -4212,11 +4189,10 @@ static void menu_input_search_cb(void *userdata, const char *str)
if (menu_entries_search_push(str))
{
bool refresh = false;
/* Reset navigation pointer */
menu_st->selection_ptr = 0;
menu_driver_navigation_set(false);
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, false);
/* Refresh menu */
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
@ -4231,7 +4207,8 @@ static void menu_input_search_cb(void *userdata, const char *str)
if (menu_entries_list_search(str, &idx))
{
menu_st->selection_ptr = idx;
menu_driver_navigation_set(true);
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
}
}
@ -4248,10 +4225,10 @@ const char *menu_driver_get_last_start_directory(void)
/* Return default directory if there is no
* last directory or it's invalid */
if (!menu ||
!use_last ||
string_is_empty(menu->last_start_content.directory) ||
!path_is_directory(menu->last_start_content.directory))
if ( !menu
|| !use_last
|| string_is_empty(menu->last_start_content.directory)
|| !path_is_directory(menu->last_start_content.directory))
return default_directory;
return menu->last_start_content.directory;
@ -4625,8 +4602,8 @@ bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data)
{
size_t idx = list_size - 1;
menu_st->selection_ptr = idx;
menu_driver_navigation_set(true);
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
}
}
else
@ -4755,22 +4732,6 @@ bool menu_driver_list_cache(menu_ctx_list_t *list)
return true;
}
void menu_driver_navigation_set(bool scroll)
{
struct menu_state *menu_st = &menu_driver_state;
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, scroll);
}
void menu_driver_populate_entries(menu_displaylist_info_t *info)
{
struct menu_state *menu_st = &menu_driver_state;
if (menu_st->driver_ctx && menu_st->driver_ctx->populate_entries)
menu_st->driver_ctx->populate_entries(
menu_st->userdata, info->path,
info->label, info->type);
}
bool menu_driver_push_list(menu_ctx_displaylist_t *disp_list)
{
struct menu_state *menu_st = &menu_driver_state;
@ -6120,8 +6081,8 @@ static int menu_input_pointer_post_iterate(
uint16_t dx_start_abs = dx_start < 0 ? dx_start * -1 : dx_start;
uint16_t dy_start_abs = dy_start < 0 ? dy_start * -1 : dy_start;
if ((dx_start_abs > dpi_threshold_drag) ||
(dy_start_abs > dpi_threshold_drag))
if ( (dx_start_abs > dpi_threshold_drag)
|| (dy_start_abs > dpi_threshold_drag))
{
uint16_t dpi_threshold_press_direction_min =
(uint16_t)((dpi * MENU_INPUT_DPI_THRESHOLD_PRESS_DIRECTION_MIN) + 0.5f);
@ -6263,9 +6224,9 @@ static int menu_input_pointer_post_iterate(
* NOTE: Of course, we must also 'reset' y acceleration
* whenever the onscreen keyboard or a message box is
* shown */
if ((!menu_input->pointer.dragged &&
(menu_input->pointer.press_duration > MENU_INPUT_Y_ACCEL_RESET_DELAY)) ||
(osk_active || messagebox_active))
if ( (!menu_input->pointer.dragged
&& (menu_input->pointer.press_duration > MENU_INPUT_Y_ACCEL_RESET_DELAY))
|| (osk_active || messagebox_active))
{
menu_input->pointer.y_accel = 0.0f;
accel0 = 0.0f;
@ -6886,9 +6847,9 @@ void retroarch_menu_running_finished(bool quit)
(enum input_auto_game_focus_type)settings->uints.input_auto_game_focus :
AUTO_GAME_FOCUS_OFF;
if ((auto_game_focus_type == AUTO_GAME_FOCUS_ON) ||
((auto_game_focus_type == AUTO_GAME_FOCUS_DETECT) &&
input_st->game_focus_state.core_requested))
if ( (auto_game_focus_type == AUTO_GAME_FOCUS_ON)
|| ((auto_game_focus_type == AUTO_GAME_FOCUS_DETECT)
&& input_st->game_focus_state.core_requested))
{
enum input_game_focus_cmd_type game_focus_cmd = GAME_FOCUS_CMD_ON;
command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, &game_focus_cmd);
@ -7150,14 +7111,13 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
/* Always set current selection to first entry */
menu_st->selection_ptr = 0;
/* menu_driver_navigation_set() will be called
* at the next 'push'.
/* navigation_set() will be called at the next 'push'.
* If a push is *not* pending, have to do it here
* instead */
if (!(*pending_push))
{
menu_driver_navigation_set(true);
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
if (menu_st->driver_ctx->navigation_clear)
menu_st->driver_ctx->navigation_clear(
menu_st->userdata, *pending_push);
@ -7851,7 +7811,8 @@ int generic_menu_entry_action(
}
menu_st->selection_ptr = idx;
menu_driver_navigation_set(true);
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
if (menu_driver_ctx->navigation_decrement)
menu_driver_ctx->navigation_decrement(menu_userdata);
@ -7871,10 +7832,10 @@ int generic_menu_entry_action(
{
if ((menu_st->selection_ptr + scroll_speed) < selection_buf_size)
{
size_t idx = menu_st->selection_ptr + scroll_speed;
size_t idx = menu_st->selection_ptr + scroll_speed;
menu_st->selection_ptr = idx;
menu_driver_navigation_set(true);
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
}
else
{
@ -7910,12 +7871,11 @@ int generic_menu_entry_action(
{
size_t idx = 0;
if (menu_st->selection_ptr >= scroll_speed)
idx = menu_st->selection_ptr - scroll_speed;
else
idx = 0;
idx = menu_st->selection_ptr - scroll_speed;
menu_st->selection_ptr = idx;
menu_driver_navigation_set(true);
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
if (menu_driver_ctx->navigation_decrement)
menu_driver_ctx->navigation_decrement(menu_userdata);
@ -7967,10 +7927,10 @@ int generic_menu_entry_action(
{
if ((menu_st->selection_ptr + scroll_speed) < selection_buf_size)
{
size_t idx = menu_st->selection_ptr + scroll_speed;
size_t idx = menu_st->selection_ptr + scroll_speed;
menu_st->selection_ptr = idx;
menu_driver_navigation_set(true);
if (menu_st->driver_ctx->navigation_set)
menu_st->driver_ctx->navigation_set(menu_st->userdata, true);
}
else
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
@ -8191,9 +8151,9 @@ int generic_menu_entry_action(
}
/* If core was launched via 'Contentless Cores' menu,
* flush to 'Contentless Cores' menu */
else if (string_is_equal(parent_label,
msg_hash_to_str(MENU_ENUM_LABEL_CONTENTLESS_CORES_TAB)) ||
string_is_equal(parent_label,
else if ( string_is_equal(parent_label,
msg_hash_to_str(MENU_ENUM_LABEL_CONTENTLESS_CORES_TAB))
|| string_is_equal(parent_label,
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CONTENTLESS_CORES_LIST)))
{
flush_target = parent_label;

View File

@ -631,10 +631,6 @@ int menu_driver_deferred_push_content_list(file_list_t *list);
bool menu_driver_list_cache(menu_ctx_list_t *list);
void menu_driver_navigation_set(bool scroll);
void menu_driver_populate_entries(menu_displaylist_info_t *info);
bool menu_driver_push_list(menu_ctx_displaylist_t *disp_list);
bool menu_driver_init(bool video_is_threaded);
@ -655,10 +651,6 @@ bool menu_driver_screensaver_supported(void);
retro_time_t menu_driver_get_current_time(void);
size_t menu_navigation_get_selection(void);
void menu_navigation_set_selection(size_t val);
void menu_display_handle_thumbnail_upload(retro_task_t *task,
void *task_data,
void *user_data, const char *err);

View File

@ -175,8 +175,6 @@ file_list_t *menu_entries_get_menu_stack_ptr(size_t idx);
void menu_entries_get_last_stack(const char **path, const char **label,
unsigned *file_type, enum msg_hash_enums *enum_idx, size_t *entry_idx);
menu_file_list_cbs_t *menu_entries_get_last_stack_actiondata(void);
void menu_entries_pop_stack(size_t *ptr, size_t idx, bool animate);
void menu_entries_flush_stack(const char *needle, unsigned final_type);

View File

@ -7002,9 +7002,10 @@ int menu_action_handle_setting(rarch_setting_t *setting,
{
menu_displaylist_info_t info;
settings_t *settings = config_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
const char *name = setting->name;
size_t selection = menu_navigation_get_selection();
size_t selection = menu_st->selection_ptr;
menu_displaylist_info_init(&info);
@ -7052,7 +7053,8 @@ int menu_action_handle_setting(rarch_setting_t *setting,
case ST_ACTION:
{
int ret = -1;
size_t selection = menu_navigation_get_selection();
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;
switch (action)
{
case MENU_ACTION_UP:
@ -7194,8 +7196,9 @@ rarch_setting_t *menu_setting_find_enum(enum msg_hash_enums enum_idx)
int menu_setting_set(unsigned type, unsigned action, bool wraparound)
{
int ret = 0;
struct menu_state *menu_st = menu_state_get_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
size_t selection = menu_navigation_get_selection();
size_t selection = menu_st->selection_ptr;
menu_file_list_cbs_t *cbs = selection_buf ?
(menu_file_list_cbs_t*)file_list_get_actiondata_at_offset(selection_buf, selection) : NULL;

View File

@ -2717,6 +2717,9 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
const char *contentLabel = NULL;
const char *contentDbName = NULL;
const char *contentCrc32 = NULL;
#ifdef HAVE_MENU
struct menu_state *menu_st = menu_state_get_ptr();
#endif
QVariantMap coreMap = m_launchWithComboBox->currentData(Qt::UserRole).value<QVariantMap>();
core_selection coreSelection = static_cast<core_selection>(coreMap.value("core_selection").toInt());
core_info_t *coreInfo = NULL;
@ -2851,7 +2854,7 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
content_info.environ_get = NULL;
#ifdef HAVE_MENU
menu_navigation_set_selection(0);
menu_st->selection_ptr = 0;
#endif
command_event(CMD_EVENT_UNLOAD_CORE, NULL);
@ -3581,7 +3584,8 @@ void MainWindow::onTimeout()
void MainWindow::onStopClicked()
{
#ifdef HAVE_MENU
menu_navigation_set_selection(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_st->selection_ptr = 0;
#endif
command_event(CMD_EVENT_UNLOAD_CORE, NULL);
setCurrentCoreLabel();
@ -3669,10 +3673,10 @@ void MainWindow::onCoreLoaded()
void MainWindow::onUnloadCoreMenuAction()
{
QAction *action = qobject_cast<QAction*>(sender());
QAction *action = qobject_cast<QAction*>(sender());
#ifdef HAVE_MENU
menu_navigation_set_selection(0);
struct menu_state *menu_st = menu_state_get_ptr();
menu_st->selection_ptr = 0;
#endif
/* TODO */