From c78e83978a9f79b9109021ed14dd8718d104cf18 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Thu, 11 May 2023 03:29:45 +0200 Subject: [PATCH] Refactor menu_entries_ctl into menu_entries_clear --- menu/cbs/menu_cbs_ok.c | 12 +-- menu/drivers/materialui.c | 92 ++++++++-------- menu/drivers/ozone.c | 15 +-- menu/drivers/rgui.c | 64 +++++------ menu/drivers/xmb.c | 49 ++++----- menu/menu_displaylist.c | 218 ++++++++++++++++++-------------------- menu/menu_driver.c | 73 ++++--------- menu/menu_entries.h | 13 +-- 8 files changed, 231 insertions(+), 305 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 969dc40b35..01f833174d 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1340,12 +1340,6 @@ int generic_action_ok_displaylist_push(const char *path, dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; case ACTION_OK_DL_SAVESTATE_LIST: - info.type = type; - info.directory_ptr = idx; - info_path = path; - info_label = label; - dl_type = DISPLAYLIST_GENERIC; - break; case ACTION_OK_DL_CORE_OPTIONS_LIST: info.type = type; info.directory_ptr = idx; @@ -4633,9 +4627,7 @@ static int action_ok_core_updater_list(const char *path, if (!core_list) { core_updater_list_init_cached(); - core_list = core_updater_list_get_cached(); - - if (!core_list) + if (!(core_list = core_updater_list_get_cached())) return -1; } @@ -4868,7 +4860,7 @@ static void cb_generic_dir_download(retro_task_t *task, void *task_data, void *user_data, const char *err) { - file_transfer_t *transf = (file_transfer_t*)user_data; + file_transfer_t *transf = (file_transfer_t*)user_data; if (transf) { generic_action_ok_network(transf->path, transf->path, 0, 0, 0, diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 17e82e1c0a..cc9fde4fb9 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -3861,7 +3861,7 @@ static void materialui_render(void *data, break; } - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &mui->first_onscreen_entry); + menu_st->entries.begin = mui->first_onscreen_entry; } /* ============================== @@ -5665,6 +5665,8 @@ static void materialui_render_entry_touch_feedback( static void materialui_render_header( materialui_handle_t *mui, + struct menu_state *menu_st, + menu_list_t *menu_list, settings_t *settings, gfx_display_t *p_disp, void *userdata, @@ -5679,7 +5681,7 @@ static void materialui_render_header( size_t sys_bar_clock_width = 0; int sys_bar_text_y = (int)(((float)mui->sys_bar_height / 2.0f) + (float)mui->font_data.hint.line_centre_offset); int title_x = 0; - bool show_back_icon = menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL); + bool show_back_icon = menu_list ? (MENU_LIST_GET_STACK_SIZE(menu_st->entries.list, 0) > 1) : false; bool show_search_icon = (mui->flags & MUI_FLAG_IS_PLAYLIST) || (mui->flags & MUI_FLAG_IS_FILE_LIST) @@ -7021,6 +7023,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info) settings_t *settings = config_get_ptr(); gfx_display_t *p_disp = disp_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr(); + menu_list_t *menu_list = menu_st->entries.list; menu_input_t *menu_input = &menu_st->input_state; size_t selection = menu_st->selection_ptr; unsigned header_height = p_disp->header_height; @@ -7165,7 +7168,8 @@ static void materialui_frame(void *data, video_frame_info_t *video_info) video_width, video_height, header_height, selection); /* Draw title + system bar */ - materialui_render_header(mui, settings, p_disp, userdata, + materialui_render_header(mui, menu_st, menu_list, + settings, p_disp, userdata, video_width, video_height, &mymat); /* Draw navigation bar */ @@ -8429,12 +8433,13 @@ static void materialui_list_set_selection(void *data, file_list_t *list) /* The navigation pointer is set back to zero */ static void materialui_navigation_clear(void *data, bool pending_push) { - size_t i = 0; - materialui_handle_t *mui = (materialui_handle_t*)data; + size_t i = 0; + struct menu_state *menu_st = menu_state_get_ptr(); + materialui_handle_t *mui = (materialui_handle_t*)data; if (!mui) return; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i); + menu_st->entries.begin = i; materialui_animate_scroll( mui, @@ -8453,23 +8458,27 @@ static void materialui_navigation_alphabet(void *data, size_t *unused) } static void materialui_populate_nav_bar( - materialui_handle_t *mui, const char *label, settings_t *settings) + materialui_handle_t *mui, + struct menu_state *menu_st, + const char *label, + settings_t *settings) { - size_t menu_tab_index = 0; - bool menu_content_show_playlists = + size_t menu_tab_index = 0; + bool menu_content_show_playlists = settings->bools.menu_content_show_playlists; - /* Cache last active menu tab index */ mui->nav_bar.last_active_menu_tab_index = mui->nav_bar.active_menu_tab_index; /* Back tab */ - mui->nav_bar.back_tab.enabled = menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL); + mui->nav_bar.back_tab.enabled = menu_st->entries.list + ? (MENU_LIST_GET_STACK_SIZE(menu_st->entries.list, 0) > 1) + : false; /* Resume tab * > Menu driver must be alive at this point, and retroarch * must be initialised, so all we have to do (or can do) * is check whether a non-dummy core is loaded) */ - mui->nav_bar.resume_tab.enabled = !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL); + mui->nav_bar.resume_tab.enabled = !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL); /* Menu tabs */ @@ -8746,7 +8755,7 @@ static void materialui_populate_entries( * Since the visibility may change at any * point, we must always keep track of the * current navigation bar status */ - materialui_populate_nav_bar(mui, label, settings); + materialui_populate_nav_bar(mui, menu_st, label, settings); /* Update list view/thumbnail parameters */ materialui_update_list_view(mui, settings); @@ -9491,40 +9500,37 @@ static int materialui_list_push(void *data, void *userdata, switch (type) { case DISPLAYLIST_LOAD_CONTENT_LIST: + menu_entries_clear(info->list); + menu_entries_append(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FAVORITES), + msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES), + MENU_ENUM_LABEL_FAVORITES, + MENU_SETTING_ACTION_FAVORITES_DIR, 0, 0, NULL); + + core_info_get_list(&list); + if (list->info_count > 0) { - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - menu_entries_append(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FAVORITES), - msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES), - MENU_ENUM_LABEL_FAVORITES, - MENU_SETTING_ACTION_FAVORITES_DIR, 0, 0, NULL); + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST), + msg_hash_to_str(MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST), + MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST, + MENU_SETTING_ACTION, 0, 0, NULL); + } - core_info_get_list(&list); - if (list->info_count > 0) - { - menu_entries_append(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST), - msg_hash_to_str(MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST), - MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST, - MENU_SETTING_ACTION, 0, 0, NULL); - } - - if (frontend_driver_parse_drive_list(info->list, true) != 0) - menu_entries_append(info->list, "/", - msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), - MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR, - MENU_SETTING_ACTION, 0, 0, NULL); - - menu_entries_append(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS), - msg_hash_to_str(MENU_ENUM_LABEL_MENU_FILE_BROWSER_SETTINGS), - MENU_ENUM_LABEL_MENU_FILE_BROWSER_SETTINGS, + if (frontend_driver_parse_drive_list(info->list, true) != 0) + menu_entries_append(info->list, "/", + msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), + MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR, MENU_SETTING_ACTION, 0, 0, NULL); - info->flags |= MD_FLAG_NEED_PUSH | MD_FLAG_NEED_REFRESH; - ret = 0; - } + menu_entries_append(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS), + msg_hash_to_str(MENU_ENUM_LABEL_MENU_FILE_BROWSER_SETTINGS), + MENU_ENUM_LABEL_MENU_FILE_BROWSER_SETTINGS, + MENU_SETTING_ACTION, 0, 0, NULL); + + info->flags |= MD_FLAG_NEED_PUSH | MD_FLAG_NEED_REFRESH; + ret = 0; break; case DISPLAYLIST_MAIN_MENU: { @@ -9537,7 +9543,7 @@ static int materialui_list_push(void *data, void *userdata, if (mui->nav_bar.location == MUI_NAV_BAR_LOCATION_HIDDEN) return ret; - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); if (flags & RUNLOOP_FLAG_CORE_RUNNING) { diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 7220305c05..cbe9d753de 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -5383,8 +5383,7 @@ static void ozone_compute_entries_position( if (ozone->show_thumbnail_bar) ozone_update_content_metadata(ozone); - menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); - + i = menu_st->entries.begin; selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0); video_driver_get_size(&video_info_width, &video_info_height); @@ -9462,8 +9461,7 @@ static int ozone_list_push(void *data, void *userdata, bool menu_content_show_playlists = settings->bools.menu_content_show_playlists; bool kiosk_mode_enable = settings->bools.kiosk_mode_enable; - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - + menu_entries_clear(info->list); menu_entries_append(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FAVORITES), msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES), @@ -9512,7 +9510,7 @@ static int ozone_list_push(void *data, void *userdata, rarch_system_info_t *system = &runloop_state_get_ptr()->system; uint32_t flags = runloop_get_flags(); - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); if (flags & RUNLOOP_FLAG_CORE_RUNNING) { @@ -10270,13 +10268,10 @@ static void ozone_render(void *data, ozone->thumbnails_right_status_prev = ozone->thumbnails.right.status; } - menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); + i = menu_st->entries.begin; if (i >= entries_end) - { - i = 0; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i); - } + menu_st->entries.begin = 0; GFX_ANIMATION_CLEAR_ACTIVE(p_anim); } diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 848403c373..d94e54364d 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -5087,16 +5087,10 @@ static void rgui_render( /* Get offset of bottommost entry */ bottom = (int)(entries_end - rgui->term_layout.height); - menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &old_start); + old_start = menu_st->entries.begin; if (old_start > (unsigned)bottom) - { - /* MENU_ENTRIES_CTL_SET_START requires a pointer of - * type size_t, so have to create a copy of 'bottom' - * here to avoid memory errors... */ - size_t bottom_cpy = (size_t)bottom; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &bottom_cpy); - } + menu_st->entries.begin = (size_t)bottom; /* Handle pointer input * Note: This is ignored when showing a fullscreen thumbnail */ @@ -5106,7 +5100,7 @@ static void rgui_render( /* Update currently 'highlighted' item */ if (rgui->pointer.y > rgui->term_layout.start_y) { - menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &old_start); + old_start = menu_st->entries.begin; /* NOTE: It's okay for this to go out of range * (limits are checked in rgui_pointer_up()) */ menu_input->ptr = (unsigned)((rgui->pointer.y - rgui->term_layout.start_y) / rgui->font_height_stride) + old_start; @@ -5115,32 +5109,27 @@ static void rgui_render( /* Allow drag-scrolling if items are currently off-screen */ if (rgui->pointer.dragged && (bottom > 0)) { - size_t start; - int16_t scroll_y_max = bottom * rgui->font_height_stride; - - rgui->scroll_y += -1 * rgui->pointer.dy; + int16_t scroll_y_max = bottom * rgui->font_height_stride; + rgui->scroll_y += -1 * rgui->pointer.dy; if (rgui->scroll_y < 0) - rgui->scroll_y = 0; + rgui->scroll_y = 0; if (rgui->scroll_y > scroll_y_max) - rgui->scroll_y = scroll_y_max; + rgui->scroll_y = scroll_y_max; - start = rgui->scroll_y / rgui->font_height_stride; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &start); + menu_st->entries.begin = rgui->scroll_y / rgui->font_height_stride; } } /* Start position may have changed - get current * value and determine index of last displayed entry */ - menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &old_start); - end = ((old_start + rgui->term_layout.height) <= entries_end) ? - old_start + rgui->term_layout.height : entries_end; + old_start = menu_st->entries.begin; + end = ((old_start + rgui->term_layout.height) <= entries_end) + ? old_start + rgui->term_layout.height + : entries_end; /* Do not scroll if all items are visible. */ if (entries_end <= rgui->term_layout.height) - { - size_t start = 0; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &start); - } + menu_st->entries.begin = 0; /* Render background */ rgui_render_background(rgui, fb_width, fb_height, fb_pitch); @@ -5437,10 +5426,9 @@ static void rgui_render( title_buf, rgui->colors.title_color, rgui->colors.shadow_color); /* Print menu entries */ - x = rgui->term_layout.start_x; - y = rgui->term_layout.start_y; - - menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &new_start); + x = rgui->term_layout.start_x; + y = rgui->term_layout.start_y; + new_start = menu_st->entries.begin; for (i = new_start; i < end; i++, y += rgui->font_height_stride) { @@ -6406,6 +6394,7 @@ static void *rgui_init(void **userdata, bool video_is_threaded) unsigned rgui_color_theme = settings->uints.menu_rgui_color_theme; const char *dynamic_theme_dir = settings->paths.directory_dynamic_wallpapers; menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu)); + struct menu_state *menu_st = menu_state_get_ptr(); if (!menu) return NULL; @@ -6477,7 +6466,7 @@ static void *rgui_init(void **userdata, bool video_is_threaded) settings->uints.menu_rgui_aspect_ratio ); - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &start); + menu_st->entries.begin = start; rgui->scroll_y = 0; if (settings->bools.menu_rgui_background_filler_thickness_enable) @@ -6692,13 +6681,14 @@ static void rgui_set_texture(void *data) static void rgui_navigation_clear(void *data, bool pending_push) { - size_t start = 0; - rgui_t *rgui = (rgui_t*)data; + size_t start = 0; + struct menu_state *menu_st = menu_state_get_ptr(); + rgui_t *rgui = (rgui_t*)data; if (!rgui) return; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &start); - rgui->scroll_y = 0; + menu_st->entries.begin = start; + rgui->scroll_y = 0; } static void rgui_set_thumbnail_system(void *userdata, char *s, size_t len) @@ -7190,14 +7180,14 @@ static void rgui_navigation_set(void *data, bool scroll) if (selection < rgui->term_layout.height / 2) { } else if (selection >= (rgui->term_layout.height / 2) && selection < (end - rgui->term_layout.height / 2)) - start = selection - rgui->term_layout.height / 2; + start = selection - rgui->term_layout.height / 2; else if (selection >= (end - rgui->term_layout.height / 2)) - start = end - rgui->term_layout.height; + start = end - rgui->term_layout.height; else return; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &start); - rgui->scroll_y = start * rgui->font_height_stride; + menu_st->entries.begin = start; + rgui->scroll_y = start * rgui->font_height_stride; } static void rgui_navigation_set_last(void *data) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 91953d02e3..029bab4395 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1535,10 +1535,9 @@ static void xmb_selection_pointer_changed( video_driver_get_size(NULL, &height); - tag = (uintptr_t)selection_buf; - + tag = (uintptr_t)selection_buf; gfx_animation_kill_by_tag(&tag); - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &num); + menu_st->entries.begin = num; for (i = 0; i < end; i++) { @@ -1763,13 +1762,15 @@ static void xmb_list_open_new(xmb_handle_t *xmb, file_list_t *list, int dir, size_t current) { unsigned i, height; - unsigned xmb_system_tab = 0; - size_t skip = 0; - int threshold = xmb->icon_size * 10; - size_t end = list ? list->size : 0; - settings_t *settings = config_get_ptr(); - bool savestate_thumbnail_enable - = settings ? settings->bools.savestate_thumbnail_enable : false; + unsigned xmb_system_tab = 0; + size_t skip = 0; + int threshold = xmb->icon_size * 10; + size_t end = list ? list->size : 0; + settings_t *settings = config_get_ptr(); + struct menu_state *menu_st = menu_state_get_ptr(); + bool savestate_thumbnail_enable = settings + ? settings->bools.savestate_thumbnail_enable + : false; video_driver_get_size(NULL, &height); @@ -1837,9 +1838,8 @@ static void xmb_list_open_new(xmb_handle_t *xmb, } } - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &skip); - - xmb_system_tab = xmb_get_system_tab(xmb, + menu_st->entries.begin = skip; + xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr); if (xmb_system_tab <= XMB_SYSTEM_TAB_SETTINGS && xmb->depth > xmb->old_depth) @@ -4247,6 +4247,7 @@ static void xmb_draw_items( gfx_display_t *p_disp, gfx_display_ctx_driver_t *dispctx, gfx_animation_t *p_anim, + struct menu_state *menu_st, settings_t *settings, unsigned video_width, unsigned video_height, @@ -4269,9 +4270,8 @@ static void xmb_draw_items( core_node = xmb_get_userdata_from_horizontal_list( xmb, (unsigned)(cat_selection_ptr - (xmb->system_tab_end + 1))); - end = list->size; - - menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); + end = list->size; + i = menu_st->entries.begin; if (list == &xmb->selection_buf_old) { @@ -4743,8 +4743,6 @@ static int xmb_menu_entry_action( static void xmb_render(void *data, unsigned width, unsigned height, bool is_idle) { - /* 'i' must be of 'size_t', since it is passed - * by reference to menu_entries_ctl() */ size_t i; /* c.f. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 * On some platforms (e.g. 32-bit x86 without SSE), @@ -5006,13 +5004,10 @@ static void xmb_render(void *data, } } - menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); + i = menu_st->entries.begin; if (i >= end) - { - i = 0; - menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i); - } + menu_st->entries.begin = 0; GFX_ANIMATION_CLEAR_ACTIVE(p_anim); } @@ -6296,6 +6291,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) p_disp, dispctx, p_anim, + menu_st, settings, video_width, video_height, @@ -6319,6 +6315,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) p_disp, dispctx, p_anim, + menu_st, settings, video_width, video_height, @@ -7881,8 +7878,7 @@ static int xmb_list_push(void *data, void *userdata, switch (type) { case DISPLAYLIST_LOAD_CONTENT_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - + menu_entries_clear(info->list); menu_entries_append(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FAVORITES), msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES), @@ -7924,7 +7920,8 @@ static int xmb_list_push(void *data, void *userdata, { rarch_system_info_t *system = &runloop_state_get_ptr()->system; uint32_t flags = runloop_get_flags(); - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + + menu_entries_clear(info->list); if (flags & RUNLOOP_FLAG_CORE_RUNNING) { diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 1cc8af5237..9451ccc3be 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5656,7 +5656,7 @@ static void bluetooth_scan_callback(retro_task_t *task, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_BLUETOOTH_SETTINGS_LIST))) return; - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, selection_buf); + menu_entries_clear(selection_buf); device_list = string_list_new(); @@ -6235,7 +6235,7 @@ static unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list) settings->bools.netplay_show_only_installed_cores; bool show_passworded = settings->bools.netplay_show_passworded; - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); if (menu_entries_append(list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETWORK_HOSTING_SETTINGS), @@ -6990,7 +6990,7 @@ unsigned menu_displaylist_build_list( count = menu_displaylist_parse_system_info(list); break; case DISPLAYLIST_EXPLORE: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); #if defined(HAVE_LIBRETRODB) count = menu_displaylist_explore(list, settings); #endif @@ -7835,7 +7835,7 @@ unsigned menu_displaylist_build_list( #endif break; case DISPLAYLIST_DROPDOWN_LIST_RESOLUTION: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); { unsigned i, size = 0; struct video_display_config *video_list = (struct video_display_config*) @@ -7874,7 +7874,7 @@ unsigned menu_displaylist_build_list( } break; case DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_DEFAULT_CORE: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); { core_info_list_t *core_info_list = NULL; playlist_t *playlist = playlist_get_cached(); @@ -7936,7 +7936,7 @@ unsigned menu_displaylist_build_list( } break; case DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_LABEL_DISPLAY_MODE: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); { playlist_t *playlist = playlist_get_cached(); @@ -7999,15 +7999,15 @@ unsigned menu_displaylist_build_list( } break; case DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_RIGHT_THUMBNAIL_MODE: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); count = populate_playlist_thumbnail_mode_dropdown_list(list, PLAYLIST_THUMBNAIL_RIGHT); break; case DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_LEFT_THUMBNAIL_MODE: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); count = populate_playlist_thumbnail_mode_dropdown_list(list, PLAYLIST_THUMBNAIL_LEFT); break; case DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_SORT_MODE: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); { playlist_t *playlist = playlist_get_cached(); @@ -8063,7 +8063,7 @@ unsigned menu_displaylist_build_list( } break; case DISPLAYLIST_DROPDOWN_LIST_MANUAL_CONTENT_SCAN_SYSTEM_NAME: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); /* Get system name list */ { bool show_hidden_files = settings->bools.show_hidden_files; @@ -8120,7 +8120,7 @@ unsigned menu_displaylist_build_list( } break; case DISPLAYLIST_DROPDOWN_LIST_MANUAL_CONTENT_SCAN_CORE_NAME: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); { /* Get core name list */ struct string_list *core_name_list = @@ -8167,7 +8167,7 @@ unsigned menu_displaylist_build_list( } break; case DISPLAYLIST_DROPDOWN_LIST_DISK_INDEX: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); { rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system; @@ -11199,7 +11199,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, {MENU_ENUM_LABEL_NETPLAY_NAT_TRAVERSAL, PARSE_ONLY_BOOL, true}, }; - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, list); + menu_entries_clear(list); if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) { @@ -11268,7 +11268,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_NETPLAY_KICK_LIST: #ifdef HAVE_NETWORKING - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_netplay_kick(info->list); if (count == 0) if (menu_entries_append(info->list, @@ -11283,7 +11283,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_NETPLAY_BAN_LIST: #ifdef HAVE_NETWORKING - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_netplay_ban(info->list); if (count == 0) if (menu_entries_append(info->list, @@ -11298,6 +11298,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_OPTIONS_REMAPPINGS_PORT: { + char key_type[64]; + char key_analog[64]; + char key_port[64]; unsigned max_users = settings->uints.input_max_users; struct menu_state *menu_st = menu_state_get_ptr(); const char *menu_driver = menu_driver_ident(); @@ -11307,13 +11310,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, unsigned mapped_port = settings->uints.input_remap_ports[port]; size_t selection = menu_st->selection_ptr; - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); { - char key_type[64]; - char key_analog[64]; - char key_port[64]; - key_type[0] = '\0'; key_analog[0] = '\0'; key_port[0] = '\0'; @@ -11463,8 +11462,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, char drive = info->path[0]; bool atip = false; - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - count = 0; + menu_entries_clear(info->list); + count = 0; if (cdrom_drive_has_media(drive)) { @@ -11715,7 +11714,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; } case DISPLAYLIST_LOAD_DISC: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_disc_info(info->list, MENU_SET_LOAD_CDROM_LIST); @@ -11739,8 +11738,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, #ifndef HAVE_LAKKA_SWITCH #ifdef HAVE_LAKKA case DISPLAYLIST_CPU_POLICY_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - + menu_entries_clear(info->list); menu_entries_append(info->list, info->path, info->path, @@ -11766,7 +11764,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, case DISPLAYLIST_CPU_PERFPOWER_LIST: { cpu_scaling_driver_t **drivers = get_cpu_scaling_drivers(true); - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); if (drivers) { int count = 0; @@ -11852,7 +11850,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, /* TODO/FIXME - localize */ runloop_msg_queue_push("Warning : extended overclocking can damage the Switch", 1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #ifdef HAVE_LAKKA_SWITCH profile = popen("cpu-profile get", "r"); fgets(current_profile, PATH_MAX_LENGTH, profile); @@ -11916,7 +11914,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, fgets(current_profile, PATH_MAX_LENGTH, profile); pclose(profile); - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); /* TODO/FIXME - Localize */ strlcpy(text, "Current profile : ", sizeof(text)); @@ -11946,8 +11944,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, #endif /* HAVE_LAKKA_SWITCH || HAVE_LIBNX */ case DISPLAYLIST_MUSIC_LIST: { - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - + menu_entries_clear(info->list); #ifdef HAVE_AUDIOMIXER { char combined_path[PATH_MAX_LENGTH]; @@ -12005,7 +12002,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_CLEAR; break; case DISPLAYLIST_MIXER_STREAM_SETTINGS_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #ifdef HAVE_AUDIOMIXER { @@ -12097,12 +12094,12 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, /* TODO/FIXME ? */ break; case DISPLAYLIST_NETPLAY: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); info->flags |= MD_FLAG_NEED_PUSH; /* TODO/FIXME ? */ break; case DISPLAYLIST_INFORMATION: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); if (settings) count = menu_displaylist_parse_content_information(menu, settings, info->list); @@ -12118,7 +12115,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DATABASE_ENTRY: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); { #ifdef HAVE_LIBRETRODB bool parse_database = false; @@ -12170,7 +12167,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, info->flags |= MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DATABASE_QUERY: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #ifdef HAVE_LIBRETRODB { unsigned i; @@ -12208,7 +12205,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_OPTIONS_SHADERS: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) { unsigned i; @@ -12356,7 +12353,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, info->flags |= MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_CORE_CONTENT: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #ifdef HAVE_NETWORKING count = print_buf_lines(info->list, menu->core_buf, "", (int)menu->core_len, @@ -12409,7 +12406,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_CORE_CONTENT_DIRS: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); { #ifdef HAVE_NETWORKING char new_label[PATH_MAX_LENGTH]; @@ -12436,7 +12433,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_CORE_SYSTEM_FILES: #ifdef HAVE_NETWORKING - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = print_buf_lines(info->list, menu->core_buf, "", (int)menu->core_len, FILE_TYPE_DOWNLOAD_CORE_SYSTEM_FILES, true, false); @@ -12454,7 +12451,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, #endif break; case DISPLAYLIST_CORES_UPDATER: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #ifdef HAVE_NETWORKING { core_updater_list_t *core_list = core_updater_list_get_cached(); @@ -12539,7 +12536,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_THUMBNAILS_UPDATER: #ifdef HAVE_NETWORKING - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = print_buf_lines(info->list, menu->core_buf, "", (int)menu->core_len, FILE_TYPE_DOWNLOAD_THUMBNAIL_CONTENT, true, false); @@ -12558,7 +12555,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_PL_THUMBNAILS_UPDATER: #ifdef HAVE_NETWORKING - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_pl_thumbnail_download_list(info->list, settings); @@ -12575,7 +12572,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, #endif break; case DISPLAYLIST_LAKKA: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #ifdef HAVE_NETWORKING count = print_buf_lines(info->list, menu->core_buf, "", (int)menu->core_len, FILE_TYPE_DOWNLOAD_LAKKA, @@ -12596,7 +12593,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, case DISPLAYLIST_PLAYLIST_COLLECTION: /* Note: This would appear to be legacy code. Cannot find * a single instance where this case is met... */ - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); if ( string_starts_with_size(info->path, "content_", STRLEN_CONST("content_")) && string_ends_with_size (info->path, ".lpl", strlen(info->path), STRLEN_CONST(".lpl"))) @@ -12658,7 +12655,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, bool history_list_enable = settings->bools.history_list_enable; const char *path_content_history = settings->paths.path_content_history; - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); if (history_list_enable) count = menu_displaylist_parse_playlist_generic( menu, info, settings, "history", @@ -12690,7 +12687,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, { const char *path_content_favorites = settings->paths.path_content_favorites; - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_playlist_generic(menu, info, settings, "favorites", path_content_favorites, false, /* Not a conventional collection */ @@ -12718,7 +12715,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_MUSIC_HISTORY: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); { const char * path_content_music_history = settings->paths.path_content_music_history; @@ -12759,7 +12756,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_VIDEO_HISTORY: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #if defined(HAVE_FFMPEG) || defined(HAVE_MPV) { bool history_list_enable = settings->bools.history_list_enable; @@ -12806,7 +12803,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_ACHIEVEMENT_PAUSE_MENU: #ifdef HAVE_CHEEVOS - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); rcheevos_menu_populate_hardcore_pause_submenu(info); #endif info->flags |= MD_FLAG_NEED_REFRESH @@ -12814,14 +12811,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_ACHIEVEMENT_LIST: #ifdef HAVE_CHEEVOS - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); rcheevos_menu_populate(info); #endif info->flags |= MD_FLAG_NEED_REFRESH | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_CORES_SUPPORTED: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_supported_cores(info, settings, menu->deferred_path, @@ -12833,7 +12830,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_CORES_COLLECTION_SUPPORTED: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_supported_cores(info, settings, menu->deferred_path, @@ -12863,7 +12860,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, 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); + menu_entries_clear(info->list); count = menu_displaylist_parse_core_info(info->list, info->type, info->path, settings); @@ -12874,14 +12871,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_CORE_RESTORE_BACKUP_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_core_backup_list( info->list, info->path, settings, true); info->flags |= MD_FLAG_NEED_REFRESH | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_CORE_DELETE_BACKUP_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_core_backup_list( info->list, info->path, settings, false); info->flags |= MD_FLAG_NEED_REFRESH @@ -12898,7 +12895,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, 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); + menu_entries_clear(info->list); count = menu_displaylist_parse_core_manager_list (info->list, settings); @@ -12922,7 +12919,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; #ifdef HAVE_MIST case DISPLAYLIST_CORE_MANAGER_STEAM_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_core_manager_steam_list(info->list, settings); info->flags &= ~MD_FLAG_NEED_REFRESH; info->flags |= MD_FLAG_NEED_PUSH @@ -12939,7 +12936,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_CORE_INFORMATION_STEAM_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); info->flags &= ~MD_FLAG_NEED_REFRESH; info->flags |= MD_FLAG_NEED_PUSH @@ -12962,7 +12959,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, 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); + menu_entries_clear(info->list); count = menu_displaylist_contentless_cores(info->list, settings); /* TODO/FIXME: Selecting an entry in the @@ -12985,7 +12982,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, { bool savestates_enabled = core_info_current_supports_savestate(); - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); if ( savestates_enabled && settings->bools.quick_menu_show_save_load_state) @@ -13089,7 +13086,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, 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); + menu_entries_clear(info->list); if (runloop_st->core_options) { @@ -13201,7 +13198,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, 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); + menu_entries_clear(info->list); count = menu_displaylist_parse_core_option_override_list(info->list, settings); /* Fallback, in case we open this menu while running @@ -13233,7 +13230,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, 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); + menu_entries_clear(info->list); count = menu_displaylist_parse_remap_file_manager_list(info->list, settings); /* Fallback */ @@ -13252,7 +13249,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_ARCHIVE_ACTION_DETECT_CORE: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #ifdef HAVE_COMPRESSION if (menu_entries_append(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OPEN_ARCHIVE), @@ -13271,7 +13268,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, info->flags |= MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_PLAYLIST_MANAGER_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_playlist_manager_list(info->list, settings); if (count == 0) @@ -13284,7 +13281,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, info->flags |= MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_PLAYLIST_MANAGER_SETTINGS: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); if (!menu_displaylist_parse_playlist_manager_settings(menu, settings, info->list, info->path)) @@ -13297,7 +13294,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, info->flags |= MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DROPDOWN_LIST_VIDEO_SHADER_PARAMETER: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_build_shader_parameter( info->list, info->type, @@ -13308,7 +13305,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DROPDOWN_LIST_VIDEO_SHADER_PRESET_PARAMETER: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_build_shader_parameter( info->list, info->type, @@ -13318,7 +13315,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DROPDOWN_LIST_INPUT_DEVICE_TYPE: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_input_device_type_list(info->list, info->path, settings); if (count == 0) @@ -13333,7 +13330,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; #ifdef ANDROID case DISPLAYLIST_DROPDOWN_LIST_INPUT_SELECT_PHYSICAL_KEYBOARD: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_input_select_physical_keyboard_list(info->list, info->path, settings); if (count == 0) @@ -13348,7 +13345,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; #endif case DISPLAYLIST_DROPDOWN_LIST_INPUT_DESCRIPTION: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_input_description_list(info, settings); if (count == 0) @@ -13362,7 +13359,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DROPDOWN_LIST_INPUT_DESCRIPTION_KBD: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_input_description_kbd_list( info->list, info->type, settings); if (count == 0) @@ -13376,7 +13373,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DROPDOWN_LIST_AUDIO_DEVICE: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_audio_device_list(info->list, info->path, settings); if (count == 0) @@ -13391,7 +13388,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; #ifdef HAVE_NETWORKING case DISPLAYLIST_DROPDOWN_LIST_NETPLAY_MITM_SERVER: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_netplay_mitm_server_list(info->list, settings); if (count == 0) @@ -13517,7 +13514,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, #endif case DISPLAYLIST_ARCHIVE_ACTION: case DISPLAYLIST_OPTIONS_OVERRIDES: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_build_list(info->list, settings, type, false); if (count == 0) @@ -13610,7 +13607,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_HORIZONTAL: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); ret = menu_displaylist_parse_horizontal_list(menu, settings, info); /* Playlists themselves are sorted @@ -13621,7 +13618,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_HORIZONTAL_CONTENT_ACTIONS: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); ret = menu_displaylist_parse_horizontal_content_actions (menu, settings, info->list); info->flags |= MD_FLAG_NEED_REFRESH @@ -13634,7 +13631,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_OPTIONS: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); { #ifdef HAVE_LAKKA if (menu_entries_append(info->list, @@ -13854,7 +13851,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_SHADER_PARAMETERS: case DISPLAYLIST_SHADER_PARAMETERS_PRESET: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) { video_shader_ctx_t shader_info; @@ -13889,7 +13886,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_MAIN_MENU: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); { rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system; bool show_add_content = false; @@ -14113,7 +14110,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_USER_BINDS_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); { char lbl[PATH_MAX_LENGTH]; unsigned val = atoi(info->path); @@ -14127,24 +14124,22 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_DATABASES: - { - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - filebrowser_clear_type(); - if (!string_is_empty(info->exts)) - free(info->exts); - if (info->path) - free(info->path); - info->type_default = FILE_TYPE_RDB; - info->exts = strldup(".rdb", sizeof(".rdb")); - info->enum_idx = MENU_ENUM_LABEL_PLAYLISTS_TAB; - info->path = strdup(settings->paths.path_content_database); - load_content = false; - use_filebrowser = true; - } + menu_entries_clear(info->list); + filebrowser_clear_type(); + if (!string_is_empty(info->exts)) + free(info->exts); + if (info->path) + free(info->path); + info->type_default = FILE_TYPE_RDB; + info->exts = strldup(".rdb", sizeof(".rdb")); + info->enum_idx = MENU_ENUM_LABEL_PLAYLISTS_TAB; + info->path = strdup(settings->paths.path_content_database); + load_content = false; + use_filebrowser = true; break; case DISPLAYLIST_SHADER_PASS: case DISPLAYLIST_SHADER_PRESET: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) { struct string_list str_list = {0}; @@ -14195,7 +14190,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_SHADER_PRESET_PREPEND: case DISPLAYLIST_SHADER_PRESET_APPEND: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) { struct string_list str_list = {0}; @@ -14222,7 +14217,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, #endif break; case DISPLAYLIST_IMAGES: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); if ( (filebrowser_get_type() != FILEBROWSER_SELECT_FILE) && (filebrowser_get_type() != FILEBROWSER_SELECT_IMAGE)) filebrowser_clear_type(); @@ -14256,7 +14251,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, use_filebrowser = true; break; case DISPLAYLIST_PLAYLIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_playlist_generic(menu, info, settings, path_basename_nocompression(info->path), @@ -14274,7 +14269,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_IMAGES_HISTORY: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #ifdef HAVE_IMAGEVIEWER { bool history_list_enable = settings->bools.history_list_enable; @@ -14326,7 +14321,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, case DISPLAYLIST_CHEAT_FILES: case DISPLAYLIST_MANUAL_CONTENT_SCAN_DAT_FILES: case DISPLAYLIST_FILE_BROWSER_SELECT_SIDELOAD_CORE: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); filebrowser_clear_type(); if (!string_is_empty(info->exts)) free(info->exts); @@ -14405,7 +14400,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, use_filebrowser = true; break; case DISPLAYLIST_CONTENT_HISTORY: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); filebrowser_clear_type(); info->type_default = FILE_TYPE_PLAIN; use_filebrowser = true; @@ -14418,8 +14413,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, { bool is_horizontal = (type == DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL); - - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_playlists(info->list, info->type_default, info->path, settings, is_horizontal); @@ -14436,7 +14430,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_CORES: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); { char ext_name[PATH_MAX_LENGTH]; @@ -14468,16 +14462,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, | MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DEFAULT: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); load_content = false; use_filebrowser = true; break; case DISPLAYLIST_CORES_DETECTED: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); use_filebrowser = true; break; case DISPLAYLIST_MANUAL_CONTENT_SCAN_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); count = menu_displaylist_parse_manual_content_scan_list(info->list); if (count == 0) @@ -14490,7 +14484,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, info->flags |= MD_FLAG_NEED_PUSH; break; case DISPLAYLIST_DROPDOWN_LIST: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); { if (string_starts_with_size(info->path, "core_option_", STRLEN_CONST("core_option_"))) @@ -14810,14 +14804,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, } break; case DISPLAYLIST_DROPDOWN_LIST_VIDEO_SHADER_NUM_PASSES: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) { unsigned i; struct video_shader *shader = menu_shader_get(); unsigned pass_count = shader ? shader->passes : 0; - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); for (i = 0; i < GFX_MAX_SHADERS+1; i++) { @@ -14846,7 +14840,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, #endif break; case DISPLAYLIST_DROPDOWN_LIST_SPECIAL: - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); if (string_starts_with_size(info->path, "core_option_", STRLEN_CONST("core_option_"))) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 328d907c88..edc35dd1d2 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -2225,7 +2225,7 @@ static bool menu_driver_displaylist_push_internal( info->label = strdup( msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)); - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); menu_displaylist_ctl(DISPLAYLIST_MUSIC_HISTORY, info, settings); return true; } @@ -2243,7 +2243,7 @@ static bool menu_driver_displaylist_push_internal( info->label = strdup( msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)); - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); menu_displaylist_ctl(DISPLAYLIST_VIDEO_HISTORY, info, settings); return true; } @@ -2261,8 +2261,7 @@ static bool menu_driver_displaylist_push_internal( info->label = strdup( msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)); - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - + menu_entries_clear(info->list); menu_displaylist_ctl(DISPLAYLIST_IMAGES_HISTORY, info, settings); return true; } @@ -2284,7 +2283,7 @@ static bool menu_driver_displaylist_push_internal( if (string_is_empty(dir_playlist)) { - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + menu_entries_clear(info->list); info->flags |= MD_FLAG_NEED_REFRESH | MD_FLAG_NEED_PUSH_NO_PLAYLIST_ENTRIES | MD_FLAG_NEED_PUSH; @@ -4358,62 +4357,26 @@ void menu_entries_pop_stack(size_t *ptr, size_t idx, bool animate) } } -bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data) +bool menu_entries_clear(file_list_t *list) { + size_t i; struct menu_state *menu_st = &menu_driver_state; - switch (state) + if (!list) + return false; + + /* Clear all the menu lists. */ + if (menu_st->driver_ctx->list_clear) + menu_st->driver_ctx->list_clear(list); + + for (i = 0; i < list->size; i++) { - case MENU_ENTRIES_CTL_SET_START: - { - size_t *idx = (size_t*)data; - if (idx) - menu_st->entries.begin = *idx; - } - break; - case MENU_ENTRIES_CTL_START_GET: - { - size_t *idx = (size_t*)data; - if (!idx) - return false; - - *idx = menu_st->entries.begin; - } - break; - case MENU_ENTRIES_CTL_CLEAR: - { - unsigned i; - file_list_t *list = (file_list_t*)data; - - if (!list) - return false; - - /* Clear all the menu lists. */ - if (menu_st->driver_ctx->list_clear) - menu_st->driver_ctx->list_clear(list); - - for (i = 0; i < list->size; i++) - { - if (list->list[i].actiondata) - free(list->list[i].actiondata); - list->list[i].actiondata = NULL; - } - - file_list_clear(list); - } - break; - case MENU_ENTRIES_CTL_SHOW_BACK: - /* Returns true if a Back button should be shown - * (i.e. we are at least - * one level deep in the menu hierarchy). */ - if (!menu_st->entries.list) - return false; - return (MENU_LIST_GET_STACK_SIZE(menu_st->entries.list, 0) > 1); - case MENU_ENTRIES_CTL_NONE: - default: - break; + if (list->list[i].actiondata) + free(list->list[i].actiondata); + list->list[i].actiondata = NULL; } + file_list_clear(list); return true; } diff --git a/menu/menu_entries.h b/menu/menu_entries.h index 0b7966e23a..47fb753ca7 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -35,17 +35,6 @@ RETRO_BEGIN_DECLS #define MENU_SEARCH_FILTER_MAX_TERMS 8 #define MENU_SEARCH_FILTER_MAX_LENGTH 64 -enum menu_entries_ctl_state -{ - MENU_ENTRIES_CTL_NONE = 0, - /* Sets the starting index of the menu entry list. */ - MENU_ENTRIES_CTL_SET_START, - /* Returns the starting index of the menu entry list. */ - MENU_ENTRIES_CTL_START_GET, - MENU_ENTRIES_CTL_CLEAR, - MENU_ENTRIES_CTL_SHOW_BACK -}; - enum menu_list_type { MENU_LIST_PLAIN = 0, @@ -179,7 +168,7 @@ bool menu_entries_append(file_list_t *list, unsigned type, size_t directory_ptr, size_t entry_idx, rarch_setting_t *setting); -bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data); +bool menu_entries_clear(file_list_t *list); bool menu_entries_search_pop(void);