From b14ff4d50400c8f281bc1fdd42f01656ee71ef93 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 25 Nov 2018 18:43:08 +0100 Subject: [PATCH 01/18] - Try to fix Screen Resolution hang on platforms other than PC by hiding the setting if display server is NULL - Fix some warnings that had to do with certain strings being too small --- menu/menu_displaylist.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 5cfdbcdd8c..36a9713301 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -373,7 +373,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) #if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) gfx_ctx_ident_t ident_info; #endif - char tmp[PATH_MAX_LENGTH]; + char tmp[8192]; char feat_str[255]; #ifdef ANDROID bool perms = false; @@ -432,7 +432,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) } { - char cpu_str[255]; + char cpu_str[8192]; char cpu_arch_str[PATH_MAX_LENGTH]; char cpu_text_str[PATH_MAX_LENGTH]; enum frontend_architecture arch = frontend_driver_get_cpu_architecture(); @@ -1445,7 +1445,7 @@ static int menu_displaylist_parse_shader_options(menu_displaylist_info_t *info) for (i = 0; i < pass_count; i++) { char buf_tmp[64]; - char buf[64]; + char buf[128]; buf[0] = buf_tmp[0] = '\0'; @@ -3381,8 +3381,8 @@ static int menu_displaylist_parse_options_remappings( { for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 8; retro_id++) { - char desc_label[64]; - char descriptor[255]; + char desc_label[400]; + char descriptor[300]; const struct retro_keybind *auto_bind = NULL; const struct retro_keybind *keybind = NULL; @@ -6546,6 +6546,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE, PARSE_ONLY_BOOL, false); +#if defined(GEKKO) || defined(__CELLOS_LV2__) + if (true) +#else + if (!string_is_equal(video_display_server_get_ident(), "null")) +#endif + { + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_SCREEN_RESOLUTION, + PARSE_ACTION, false); + } menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_PAL60_ENABLE, PARSE_ONLY_BOOL, false); From ff4fa3be7ae3fadd60574f2db7920373c5e6845e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 25 Nov 2018 18:49:04 +0100 Subject: [PATCH 02/18] Fix more string is too small warnings --- network/netplay/netplay_frontend.c | 2 +- network/netplay/netplay_io.c | 2 +- tasks/task_decompress.c | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 6da9b1dee9..2fcc934247 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -851,7 +851,7 @@ void netplay_get_architecture(char *frontend_architecture, size_t size) static void netplay_announce(void) { - char buf [2048]; + char buf [4600]; char frontend_architecture[PATH_MAX_LENGTH]; char url [2048] = "http://lobby.libretro.com/add/"; char *username = NULL; diff --git a/network/netplay/netplay_io.c b/network/netplay/netplay_io.c index 4028515719..33506e1430 100644 --- a/network/netplay/netplay_io.c +++ b/network/netplay/netplay_io.c @@ -1990,7 +1990,7 @@ void netplay_handle_slaves(netplay_t *netplay) void netplay_announce_nat_traversal(netplay_t *netplay) { #ifndef HAVE_SOCKET_LEGACY - char msg[512], host[PATH_MAX_LENGTH], port[6]; + char msg[4200], host[PATH_MAX_LENGTH], port[6]; if (netplay->nat_traversal_state.have_inet4) { diff --git a/tasks/task_decompress.c b/tasks/task_decompress.c index 80b5ddf9db..d83cc1d1c7 100644 --- a/tasks/task_decompress.c +++ b/tasks/task_decompress.c @@ -28,6 +28,8 @@ #include "../verbosity.h" #include "../msg_hash.h" +#define CALLBACK_ERROR_SIZE 4200 + static int file_decompressed_target_file(const char *name, const char *valid_exts, const uint8_t *cdata, @@ -80,9 +82,9 @@ next_file: return 1; error: - userdata->dec->callback_error = (char*)malloc(PATH_MAX_LENGTH); + userdata->dec->callback_error = (char*)malloc(CALLBACK_ERROR_SIZE); snprintf(userdata->dec->callback_error, - PATH_MAX_LENGTH, "Failed to deflate %s.\n", path); + CALLBACK_ERROR_SIZE, "Failed to deflate %s.\n", path); return 0; } @@ -122,8 +124,8 @@ next_file: return 1; error: - dec->callback_error = (char*)malloc(PATH_MAX_LENGTH); - snprintf(dec->callback_error, PATH_MAX_LENGTH, + dec->callback_error = (char*)malloc(CALLBACK_ERROR_SIZE); + snprintf(dec->callback_error, CALLBACK_ERROR_SIZE, "Failed to deflate %s.\n", path); return 0; From fb957f29a84606036c11d7fc29b22a37502d580a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 25 Nov 2018 19:12:21 +0100 Subject: [PATCH 03/18] Set current_display_server by default to dispserv_null --- gfx/video_display_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/video_display_server.c b/gfx/video_display_server.c index 0f77f6697a..e4824a0a46 100644 --- a/gfx/video_display_server.c +++ b/gfx/video_display_server.c @@ -20,7 +20,7 @@ #include "video_driver.h" #include "../verbosity.h" -static const video_display_server_t *current_display_server = NULL; +static const video_display_server_t *current_display_server = &dispserv_null; static void *current_display_server_data = NULL; const char *video_display_server_get_ident(void) From 3ca4ac2a21ec4045597ee27a6467a43c07d492c9 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 25 Nov 2018 19:22:55 +0100 Subject: [PATCH 04/18] (Ozone) Fix redefinition of typedef --- menu/drivers/ozone/ozone.h | 6 +++--- menu/drivers/ozone/ozone_theme.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/menu/drivers/ozone/ozone.h b/menu/drivers/ozone/ozone.h index 5438714485..76912544b9 100644 --- a/menu/drivers/ozone/ozone.h +++ b/menu/drivers/ozone/ozone.h @@ -42,7 +42,7 @@ typedef struct ozone_handle ozone_handle_t; #define INTERVAL_BATTERY_LEVEL_CHECK (30 * 1000000) #define INTERVAL_OSK_CURSOR (0.5f * 1000000) -typedef struct ozone_handle +struct ozone_handle { uint64_t frame_count; @@ -152,7 +152,7 @@ typedef struct ozone_handle unsigned old_list_offset_y; file_list_t *horizontal_list; /* console tabs */ -} ozone_handle_t; +}; /* If you change this struct, also change ozone_alloc_node and @@ -207,4 +207,4 @@ void ozone_free_list_nodes(file_list_t *list, bool actiondata); bool ozone_is_playlist(ozone_handle_t *ozone); -#endif \ No newline at end of file +#endif diff --git a/menu/drivers/ozone/ozone_theme.c b/menu/drivers/ozone/ozone_theme.c index fa9478fa82..5a32bd4943 100644 --- a/menu/drivers/ozone/ozone_theme.c +++ b/menu/drivers/ozone/ozone_theme.c @@ -118,10 +118,10 @@ void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) last_color_theme = color_theme; } -unsigned ozone_get_system_theme() +unsigned ozone_get_system_theme(void) { - unsigned ret = 0; #ifdef HAVE_LIBNX + unsigned ret = 0; if (R_SUCCEEDED(setsysInitialize())) { ColorSetId theme; @@ -133,4 +133,4 @@ unsigned ozone_get_system_theme() return ret; #endif return 0; -} \ No newline at end of file +} From de903c650dc1d7f3304886e025640ae7fc078be5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 25 Nov 2018 20:34:50 +0100 Subject: [PATCH 05/18] Reinitialize context in a different way --- menu/drivers/xmb.c | 1496 ++++++++++++++++++++++---------------------- 1 file changed, 758 insertions(+), 738 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 0d85039a14..4bb2b29ab8 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1,8 +1,8 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2014-2017 - Jean-André Santoni * Copyright (C) 2016-2017 - Brad Parker - * Copyright (C) 2018 - Alfredo Monclús + * Copyright (C) 2018 - Alfredo Monclús * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -233,6 +233,7 @@ typedef struct xmb_handle { bool mouse_show; bool use_ps3_layout; + bool context_just_reset; uint8_t system_tab_end; uint8_t tabs[XMB_SYSTEM_TAB_MAX_LENGTH]; @@ -2111,6 +2112,7 @@ static void xmb_context_reset_horizontal_list( } } + xmb_toggle_horizontal_list(xmb); } static void xmb_refresh_horizontal_list(xmb_handle_t *xmb) @@ -2132,7 +2134,6 @@ static void xmb_refresh_horizontal_list(xmb_handle_t *xmb) xmb_init_horizontal_list(xmb); xmb_context_reset_horizontal_list(xmb); - xmb_toggle_horizontal_list(xmb); } static int xmb_environ(enum menu_environ_cb type, void *data, void *userdata) @@ -3319,710 +3320,8 @@ static void xmb_draw_dark_layer( menu_display_blend_end(video_info); } -static const char *xmb_texture_path(unsigned id) -{ - char *iconpath = (char*) malloc(PATH_MAX_LENGTH * sizeof(char)); - char *icon_name = (char*) malloc(PATH_MAX_LENGTH * sizeof(char)); - char *icon_fullpath = (char*) malloc(PATH_MAX_LENGTH * sizeof(char)); - - iconpath[0] = icon_name[0] = icon_fullpath[0] = '\0'; - - switch (id) - { - case XMB_TEXTURE_MAIN_MENU: -#if defined(HAVE_LAKKA) - icon_name = "lakka.png"; - break; -#else - icon_name = "retroarch.png"; - break; -#endif - case XMB_TEXTURE_SETTINGS: - icon_name = "settings.png"; - break; - case XMB_TEXTURE_HISTORY: - icon_name = "history.png"; - break; - case XMB_TEXTURE_FAVORITES: - icon_name = "favorites.png"; - break; - case XMB_TEXTURE_ADD_FAVORITE: - icon_name = "add-favorite.png"; - break; - case XMB_TEXTURE_MUSICS: - icon_name = "musics.png"; - break; -#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) - case XMB_TEXTURE_MOVIES: - icon_name = "movies.png"; - break; -#endif -#ifdef HAVE_IMAGEVIEWER - case XMB_TEXTURE_IMAGES: - icon_name = "images.png"; - break; -#endif - case XMB_TEXTURE_SETTING: - icon_name = "setting.png"; - break; - case XMB_TEXTURE_SUBSETTING: - icon_name = "subsetting.png"; - break; - case XMB_TEXTURE_ARROW: - icon_name = "arrow.png"; - break; - case XMB_TEXTURE_RUN: - icon_name = "run.png"; - break; - case XMB_TEXTURE_CLOSE: - icon_name = "close.png"; - break; - case XMB_TEXTURE_RESUME: - icon_name = "resume.png"; - break; - case XMB_TEXTURE_CLOCK: - icon_name = "clock.png"; - break; - case XMB_TEXTURE_BATTERY_FULL: - icon_name = "battery-full.png"; - break; - case XMB_TEXTURE_BATTERY_CHARGING: - icon_name = "battery-charging.png"; - break; - case XMB_TEXTURE_POINTER: - icon_name = "pointer.png"; - break; - case XMB_TEXTURE_SAVESTATE: - icon_name = "savestate.png"; - break; - case XMB_TEXTURE_LOADSTATE: - icon_name = "loadstate.png"; - break; - case XMB_TEXTURE_UNDO: - icon_name = "undo.png"; - break; - case XMB_TEXTURE_CORE_INFO: - icon_name = "core-infos.png"; - break; - case XMB_TEXTURE_WIFI: - icon_name = "wifi.png"; - break; - case XMB_TEXTURE_CORE_OPTIONS: - icon_name = "core-options.png"; - break; - case XMB_TEXTURE_INPUT_REMAPPING_OPTIONS: - icon_name = "core-input-remapping-options.png"; - break; - case XMB_TEXTURE_CHEAT_OPTIONS: - icon_name = "core-cheat-options.png"; - break; - case XMB_TEXTURE_DISK_OPTIONS: - icon_name = "core-disk-options.png"; - break; - case XMB_TEXTURE_SHADER_OPTIONS: - icon_name = "core-shader-options.png"; - break; - case XMB_TEXTURE_ACHIEVEMENT_LIST: - icon_name = "achievement-list.png"; - break; - case XMB_TEXTURE_SCREENSHOT: - icon_name = "screenshot.png"; - break; - case XMB_TEXTURE_RELOAD: - icon_name = "reload.png"; - break; - case XMB_TEXTURE_RENAME: - icon_name = "rename.png"; - break; - case XMB_TEXTURE_FILE: - icon_name = "file.png"; - break; - case XMB_TEXTURE_FOLDER: - icon_name = "folder.png"; - break; - case XMB_TEXTURE_ZIP: - icon_name = "zip.png"; - break; - case XMB_TEXTURE_MUSIC: - icon_name = "music.png"; - break; - case XMB_TEXTURE_FAVORITE: - icon_name = "favorites-content.png"; - break; - case XMB_TEXTURE_IMAGE: - icon_name = "image.png"; - break; - case XMB_TEXTURE_MOVIE: - icon_name = "movie.png"; - break; - case XMB_TEXTURE_CORE: - icon_name = "core.png"; - break; - case XMB_TEXTURE_RDB: - icon_name = "database.png"; - break; - case XMB_TEXTURE_CURSOR: - icon_name = "cursor.png"; - break; - case XMB_TEXTURE_SWITCH_ON: - icon_name = "on.png"; - break; - case XMB_TEXTURE_SWITCH_OFF: - icon_name = "off.png"; - break; - case XMB_TEXTURE_ADD: - icon_name = "add.png"; - break; -#ifdef HAVE_NETWORKING - case XMB_TEXTURE_NETPLAY: - icon_name = "netplay.png"; - break; - case XMB_TEXTURE_ROOM: - icon_name = "menu_room.png"; - break; - case XMB_TEXTURE_ROOM_LAN: - icon_name = "menu_room_lan.png"; - break; - case XMB_TEXTURE_ROOM_RELAY: - icon_name = "menu_room_relay.png"; - break; -#endif - case XMB_TEXTURE_KEY: - icon_name = "key.png"; - break; - case XMB_TEXTURE_KEY_HOVER: - icon_name = "key-hover.png"; - break; - case XMB_TEXTURE_DIALOG_SLICE: - icon_name = "dialog-slice.png"; - break; - case XMB_TEXTURE_ACHIEVEMENTS: - icon_name = "menu_achievements.png"; - break; - case XMB_TEXTURE_AUDIO: - icon_name = "menu_audio.png"; - break; - case XMB_TEXTURE_DRIVERS: - icon_name = "menu_drivers.png"; - break; - case XMB_TEXTURE_EXIT: - icon_name = "menu_exit.png"; - break; - case XMB_TEXTURE_FRAMESKIP: - icon_name = "menu_frameskip.png"; - break; - case XMB_TEXTURE_HELP: - icon_name = "menu_help.png"; - break; - case XMB_TEXTURE_INFO: - icon_name = "menu_info.png"; - break; - case XMB_TEXTURE_INPUT_SETTINGS: - icon_name = "Libretro - Pad.png"; - break; - case XMB_TEXTURE_LATENCY: - icon_name = "menu_latency.png"; - break; - case XMB_TEXTURE_NETWORK: - icon_name = "menu_network.png"; - break; - case XMB_TEXTURE_POWER: - icon_name = "menu_power.png"; - break; - case XMB_TEXTURE_RECORD: - icon_name = "menu_record.png"; - break; - case XMB_TEXTURE_SAVING: - icon_name = "menu_saving.png"; - break; - case XMB_TEXTURE_UPDATER: - icon_name = "menu_updater.png"; - break; - case XMB_TEXTURE_VIDEO: - icon_name = "menu_video.png"; - break; - case XMB_TEXTURE_MIXER: - icon_name = "menu_mixer.png"; - break; - case XMB_TEXTURE_LOG: - icon_name = "menu_log.png"; - break; - case XMB_TEXTURE_OSD: - icon_name = "menu_osd.png"; - break; - case XMB_TEXTURE_UI: - icon_name = "menu_ui.png"; - break; - case XMB_TEXTURE_USER: - icon_name = "menu_user.png"; - break; - case XMB_TEXTURE_PRIVACY: - icon_name = "menu_privacy.png"; - break; - case XMB_TEXTURE_PLAYLIST: - icon_name = "menu_playlist.png"; - break; - case XMB_TEXTURE_QUICKMENU: - icon_name = "menu_quickmenu.png"; - break; - case XMB_TEXTURE_REWIND: - icon_name = "menu_rewind.png"; - break; - case XMB_TEXTURE_OVERLAY: - icon_name = "menu_overlay.png"; - break; - case XMB_TEXTURE_OVERRIDE: - icon_name = "menu_override.png"; - break; - case XMB_TEXTURE_NOTIFICATIONS: - icon_name = "menu_notifications.png"; - break; - case XMB_TEXTURE_STREAM: - icon_name = "menu_stream.png"; - break; - case XMB_TEXTURE_SHUTDOWN: - icon_name = "menu_shutdown.png"; - break; - case XMB_TEXTURE_INPUT_DPAD_U: - icon_name = "input_DPAD-U.png"; - break; - case XMB_TEXTURE_INPUT_DPAD_D: - icon_name = "input_DPAD-D.png"; - break; - case XMB_TEXTURE_INPUT_DPAD_L: - icon_name = "input_DPAD-L.png"; - break; - case XMB_TEXTURE_INPUT_DPAD_R: - icon_name = "input_DPAD-R.png"; - break; - case XMB_TEXTURE_INPUT_STCK_U: - icon_name = "input_STCK-U.png"; - break; - case XMB_TEXTURE_INPUT_STCK_D: - icon_name = "input_STCK-D.png"; - break; - case XMB_TEXTURE_INPUT_STCK_L: - icon_name = "input_STCK-L.png"; - break; - case XMB_TEXTURE_INPUT_STCK_R: - icon_name = "input_STCK-R.png"; - break; - case XMB_TEXTURE_INPUT_STCK_P: - icon_name = "input_STCK-P.png"; - break; - case XMB_TEXTURE_INPUT_BTN_U: - icon_name = "input_BTN-U.png"; - break; - case XMB_TEXTURE_INPUT_BTN_D: - icon_name = "input_BTN-D.png"; - break; - case XMB_TEXTURE_INPUT_BTN_L: - icon_name = "input_BTN-L.png"; - break; - case XMB_TEXTURE_INPUT_BTN_R: - icon_name = "input_BTN-R.png"; - break; - case XMB_TEXTURE_INPUT_LB: - icon_name = "input_LB.png"; - break; - case XMB_TEXTURE_INPUT_RB: - icon_name = "input_RB.png"; - break; - case XMB_TEXTURE_INPUT_LT: - icon_name = "input_LT.png"; - break; - case XMB_TEXTURE_INPUT_RT: - icon_name = "input_RT.png"; - break; - case XMB_TEXTURE_INPUT_SELECT: - icon_name = "input_SELECT.png"; - break; - case XMB_TEXTURE_INPUT_START: - icon_name = "input_START.png"; - break; - case XMB_TEXTURE_CHECKMARK: - icon_name = "menu_check.png"; - break; - case XMB_TEXTURE_MENU_ADD: - icon_name = "menu_add.png"; - break; - case XMB_TEXTURE_BRIGHTNESS: - icon_name = "menu_brightness.png"; - break; - case XMB_TEXTURE_PAUSE: - icon_name = "menu_pause.png"; - break; - } - - fill_pathname_application_special(iconpath, - PATH_MAX_LENGTH * sizeof(char), - APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS); - - icon_fullpath = iconpath; - strlcat(icon_fullpath, icon_name, PATH_MAX_LENGTH * sizeof(char)); - - if (!filestream_exists(icon_fullpath)) - { - RARCH_WARN("[XMB] Asset missing: %s\n", icon_fullpath); - return NULL; - } - else - return icon_name; - -} - -static void xmb_context_reset_textures_nodes(xmb_handle_t *xmb) -{ - xmb->main_menu_node.icon = xmb->textures.list[XMB_TEXTURE_MAIN_MENU]; - xmb->main_menu_node.alpha = xmb->categories_active_alpha; - xmb->main_menu_node.zoom = xmb->categories_active_zoom; - - xmb->settings_tab_node.icon = xmb->textures.list[XMB_TEXTURE_SETTINGS]; - xmb->settings_tab_node.alpha = xmb->categories_active_alpha; - xmb->settings_tab_node.zoom = xmb->categories_active_zoom; - - xmb->history_tab_node.icon = xmb->textures.list[XMB_TEXTURE_HISTORY]; - xmb->history_tab_node.alpha = xmb->categories_active_alpha; - xmb->history_tab_node.zoom = xmb->categories_active_zoom; - - xmb->favorites_tab_node.icon = xmb->textures.list[XMB_TEXTURE_FAVORITES]; - xmb->favorites_tab_node.alpha = xmb->categories_active_alpha; - xmb->favorites_tab_node.zoom = xmb->categories_active_zoom; - - xmb->music_tab_node.icon = xmb->textures.list[XMB_TEXTURE_MUSICS]; - xmb->music_tab_node.alpha = xmb->categories_active_alpha; - xmb->music_tab_node.zoom = xmb->categories_active_zoom; - -#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) - xmb->video_tab_node.icon = xmb->textures.list[XMB_TEXTURE_MOVIES]; - xmb->video_tab_node.alpha = xmb->categories_active_alpha; - xmb->video_tab_node.zoom = xmb->categories_active_zoom; -#endif - -#ifdef HAVE_IMAGEVIEWER - xmb->images_tab_node.icon = xmb->textures.list[XMB_TEXTURE_IMAGES]; - xmb->images_tab_node.alpha = xmb->categories_active_alpha; - xmb->images_tab_node.zoom = xmb->categories_active_zoom; -#endif - - xmb->add_tab_node.icon = xmb->textures.list[XMB_TEXTURE_ADD]; - xmb->add_tab_node.alpha = xmb->categories_active_alpha; - xmb->add_tab_node.zoom = xmb->categories_active_zoom; - -#ifdef HAVE_NETWORKING - xmb->netplay_tab_node.icon = xmb->textures.list[XMB_TEXTURE_NETPLAY]; - xmb->netplay_tab_node.alpha = xmb->categories_active_alpha; - xmb->netplay_tab_node.zoom = xmb->categories_active_zoom; -#endif -} - -static void xmb_context_reset_textures( - xmb_handle_t *xmb, const char *iconpath) -{ - unsigned i; - settings_t *settings = config_get_ptr(); - - for (i = 0; i < XMB_TEXTURE_LAST; i++) - { - if (xmb_texture_path(i) == NULL) - { - /* If the icon doesn't exist at least try to return the subsetting icon*/ - if (!(i == XMB_TEXTURE_DIALOG_SLICE || i == XMB_TEXTURE_KEY_HOVER || i == XMB_TEXTURE_KEY_HOVER)) - menu_display_reset_textures_list(xmb_texture_path(XMB_TEXTURE_SUBSETTING), iconpath, &xmb->textures.list[i], TEXTURE_FILTER_MIPMAP_LINEAR); - continue; - } - menu_display_reset_textures_list(xmb_texture_path(i), iconpath, &xmb->textures.list[i], TEXTURE_FILTER_MIPMAP_LINEAR); - } - - /* Warn only if critical assets are missing, some themes are incomplete */ - if ( - ((xmb_texture_path(XMB_TEXTURE_SUBSETTING) == NULL)) && !(settings->uints.menu_xmb_theme == XMB_ICON_THEME_CUSTOM) - ) - runloop_msg_queue_push(msg_hash_to_str(MSG_MISSING_ASSETS), 1, 256, false); - - menu_display_allocate_white_texture(); - - -} - -static void xmb_context_reset_background(const char *iconpath) -{ - char *path = NULL; - settings_t *settings = config_get_ptr(); - const char *path_menu_wp = settings->paths.path_menu_wallpaper; - - if (!string_is_empty(path_menu_wp)) - path = strdup(path_menu_wp); - else if (!string_is_empty(iconpath)) - { - path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - path[0] = '\0'; - - fill_pathname_join(path, iconpath, "bg.png", - PATH_MAX_LENGTH * sizeof(char)); - } - - if (filestream_exists(path)) - task_push_image_load(path, - menu_display_handle_wallpaper_upload, NULL); - - if (path) - free(path); -} - -static void xmb_context_reset(void *data, bool is_threaded) -{ - xmb_handle_t *xmb = (xmb_handle_t*)data; - char *iconpath = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - - char bg_file_path[PATH_MAX_LENGTH] = {0}; - iconpath[0] = '\0'; - fill_pathname_application_special(iconpath, - PATH_MAX_LENGTH * sizeof(char), - APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS); - fill_pathname_application_special(bg_file_path, - sizeof(bg_file_path), APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_BG); - - if (!string_is_empty(bg_file_path)) - { - if (!string_is_empty(xmb->bg_file_path)) - free(xmb->bg_file_path); - xmb->bg_file_path = strdup(bg_file_path); - } - - xmb_context_reset_textures(xmb, iconpath); - xmb_context_reset_background(iconpath); - xmb_context_reset_horizontal_list(xmb); - - xmb->previous_scale_factor = 0.0; - - free(iconpath); -} - -static void xmb_layout_ps3(xmb_handle_t *xmb, int width) -{ - unsigned new_font_size, new_header_height; - settings_t *settings = config_get_ptr(); - - float scale_factor = - (settings->uints.menu_xmb_scale_factor * width) / (1920.0 * 100); - - xmb->above_subitem_offset = 1.5; - xmb->above_item_offset = -1.0; - xmb->active_item_factor = 3.0; - xmb->under_item_offset = 5.0; - - xmb->categories_active_zoom = 1.0; - xmb->categories_passive_zoom = 0.5; - xmb->items_active_zoom = 1.0; - xmb->items_passive_zoom = 0.5; - - xmb->categories_active_alpha = 1.0; - xmb->categories_passive_alpha = 0.85; - xmb->items_active_alpha = 1.0; - xmb->items_passive_alpha = 0.85; - - xmb->shadow_offset = 2.0; - - new_font_size = 32.0 * scale_factor; - xmb->font2_size = 24.0 * scale_factor; - new_header_height = 128.0 * scale_factor; - - - xmb->thumbnail_width = 1024.0 * scale_factor; - xmb->left_thumbnail_width = 1024.0 * scale_factor; - xmb->savestate_thumbnail_width= 460.0 * scale_factor; - xmb->cursor_size = 64.0 * scale_factor; - - xmb->icon_spacing_horizontal = 200.0 * scale_factor; - xmb->icon_spacing_vertical = 64.0 * scale_factor; - - xmb->margins_screen_top = (256+32) * scale_factor; - xmb->margins_screen_left = 336.0 * scale_factor; - - xmb->margins_title_left = 60 * scale_factor; - xmb->margins_title_top = 60 * scale_factor + new_font_size / 3; - xmb->margins_title_bottom = 60 * scale_factor - new_font_size / 3; - - xmb->margins_label_left = 85.0 * scale_factor; - xmb->margins_label_top = new_font_size / 3.0; - - xmb->margins_setting_left = 600.0 * scale_factor * scale_mod[6]; - xmb->margins_dialog = 48 * scale_factor; - - xmb->margins_slice = 16; - - xmb->icon_size = 128.0 * scale_factor; - xmb->font_size = new_font_size; - - menu_display_set_header_height(new_header_height); -} - -static void xmb_layout_psp(xmb_handle_t *xmb, int width) -{ - unsigned new_font_size, new_header_height; - settings_t *settings = config_get_ptr(); - float scale_factor = - ((settings->uints.menu_xmb_scale_factor * width) / (1920.0 * 100)) * 1.5; -#ifdef _3DS - scale_factor = - settings->uints.menu_xmb_scale_factor / 400.0; -#endif - - xmb->above_subitem_offset = 1.5; - xmb->above_item_offset = -1.0; - xmb->active_item_factor = 2.0; - xmb->under_item_offset = 3.0; - - xmb->categories_active_zoom = 1.0; - xmb->categories_passive_zoom = 1.0; - xmb->items_active_zoom = 1.0; - xmb->items_passive_zoom = 1.0; - - xmb->categories_active_alpha = 1.0; - xmb->categories_passive_alpha = 0.85; - xmb->items_active_alpha = 1.0; - xmb->items_passive_alpha = 0.85; - - xmb->shadow_offset = 1.0; - - new_font_size = 32.0 * scale_factor; - xmb->font2_size = 24.0 * scale_factor; - new_header_height = 128.0 * scale_factor; - xmb->margins_screen_top = (256+32) * scale_factor; - - xmb->thumbnail_width = 460.0 * scale_factor; - xmb->left_thumbnail_width = 400.0 * scale_factor; - xmb->savestate_thumbnail_width= 460.0 * scale_factor; - xmb->cursor_size = 64.0; - - xmb->icon_spacing_horizontal = 250.0 * scale_factor; - xmb->icon_spacing_vertical = 108.0 * scale_factor; - - xmb->margins_screen_left = 136.0 * scale_factor; - xmb->margins_title_left = 60 * scale_factor; - xmb->margins_title_top = 60 * scale_factor + new_font_size / 3; - xmb->margins_title_bottom = 60 * scale_factor - new_font_size / 3; - xmb->margins_label_left = 85.0 * scale_factor; - xmb->margins_label_top = new_font_size / 3.0; - xmb->margins_setting_left = 600.0 * scale_factor; - xmb->margins_dialog = 48 * scale_factor; - xmb->margins_slice = 16; - xmb->icon_size = 128.0 * scale_factor; - xmb->font_size = new_font_size; - - menu_display_set_header_height(new_header_height); -} - -static void xmb_layout(xmb_handle_t *xmb) -{ - unsigned width, height, i, current, end; - settings_t *settings = config_get_ptr(); - file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); - size_t selection = menu_navigation_get_selection(); - - video_driver_get_size(&width, &height); - - switch (settings->uints.menu_xmb_layout) - { - /* Automatic */ - case 0: - { - xmb->use_ps3_layout = false; - xmb->use_ps3_layout = width > 320 && height > 240; - - /* Mimic the layout of the PSP instead of the PS3 on tiny screens */ - if (xmb->use_ps3_layout) - xmb_layout_ps3(xmb, width); - else - xmb_layout_psp(xmb, width); - } - break; - /* PS3 */ - case 1: - { - xmb->use_ps3_layout = true; - xmb_layout_ps3(xmb, width); - } - break; - /* PSP */ - case 2: - { - xmb->use_ps3_layout = false; - xmb_layout_psp(xmb, width); - } - break; - } - -#ifdef XMB_DEBUG - RARCH_LOG("[XMB] margin screen left: %.2f\n", xmb->margins_screen_left); - RARCH_LOG("[XMB] margin screen top: %.2f\n", xmb->margins_screen_top); - RARCH_LOG("[XMB] margin title left: %.2f\n", xmb->margins_title_left); - RARCH_LOG("[XMB] margin title top: %.2f\n", xmb->margins_title_top); - RARCH_LOG("[XMB] margin title bott: %.2f\n", xmb->margins_title_bottom); - RARCH_LOG("[XMB] margin label left: %.2f\n", xmb->margins_label_left); - RARCH_LOG("[XMB] margin label top: %.2f\n", xmb->margins_label_top); - RARCH_LOG("[XMB] margin sett left: %.2f\n", xmb->margins_setting_left); - RARCH_LOG("[XMB] icon spacing hor: %.2f\n", xmb->icon_spacing_horizontal); - RARCH_LOG("[XMB] icon spacing ver: %.2f\n", xmb->icon_spacing_vertical); - RARCH_LOG("[XMB] icon size: %.2f\n", xmb->icon_size); -#endif - - current = (unsigned)selection; - end = (unsigned)menu_entries_get_size(); - - for (i = 0; i < end; i++) - { - float ia = xmb->items_passive_alpha; - float iz = xmb->items_passive_zoom; - xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset( - selection_buf, i); - - if (!node) - continue; - - if (i == current) - { - ia = xmb->items_active_alpha; - iz = xmb->items_active_alpha; - } - - node->alpha = ia; - node->label_alpha = ia; - node->zoom = iz; - node->y = xmb_item_y(xmb, i, current); - } - - if (xmb->depth <= 1) - return; - - current = (unsigned)xmb->selection_ptr_old; - end = (unsigned)file_list_get_size(xmb->selection_buf_old); - - for (i = 0; i < end; i++) - { - float ia = 0; - float iz = xmb->items_passive_zoom; - xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset( - xmb->selection_buf_old, i); - - if (!node) - continue; - - if (i == current) - { - ia = xmb->items_active_alpha; - iz = xmb->items_active_alpha; - } - - node->alpha = ia; - node->label_alpha = 0; - node->zoom = iz; - node->y = xmb_item_y(xmb, i, current); - node->x = xmb->icon_size * 1 * -2; - } -} - +static void xmb_context_reset_internal(xmb_handle_t *xmb, + bool is_threaded, bool reinit_textures); static void xmb_frame(void *data, video_frame_info_t *video_info) { @@ -4053,37 +3352,14 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) scale_factor = (settings->uints.menu_xmb_scale_factor * (float)width) / (1920.0 * 100); pseudo_font_length = xmb->icon_spacing_horizontal * 4 - xmb->icon_size / 4; - if (scale_factor != xmb->previous_scale_factor) - { - bool video_is_threaded = video_driver_is_threaded(); - menu_display_font_free(xmb->font); - menu_display_font_free(xmb->font2); - xmb_layout(xmb); - xmb->font = menu_display_font( - APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_FONT, - xmb->font_size, - video_is_threaded); - xmb->font2 = menu_display_font( - APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_FONT, - xmb->font2_size, - video_is_threaded); - xmb_context_reset_textures_nodes(xmb); - xmb_toggle_horizontal_list(xmb); + if (scale_factor != xmb->previous_scale_factor && !xmb->context_just_reset) + xmb_context_reset_internal(xmb, video_driver_is_threaded(), + false); - if (!string_is_equal(xmb_thumbnails_ident('R'), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))) - { - xmb_update_thumbnail_path(xmb, 0, 'R'); - xmb_update_thumbnail_image(xmb); - } - if (!string_is_equal(xmb_thumbnails_ident('L'), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))) - { - xmb_update_thumbnail_path(xmb, 0, 'L'); - xmb_update_thumbnail_image(xmb); - } - xmb_update_savestate_thumbnail_image(xmb); - } + if (xmb->context_just_reset) + xmb->context_just_reset = false; + + xmb->previous_scale_factor = scale_factor; xmb->frame_count++; @@ -4834,8 +4110,230 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) } menu_display_unset_viewport(video_info->width, video_info->height); +} - xmb->previous_scale_factor = scale_factor; +static void xmb_layout_ps3(xmb_handle_t *xmb, int width) +{ + unsigned new_font_size, new_header_height; + settings_t *settings = config_get_ptr(); + + float scale_factor = + (settings->uints.menu_xmb_scale_factor * width) / (1920.0 * 100); + + xmb->above_subitem_offset = 1.5; + xmb->above_item_offset = -1.0; + xmb->active_item_factor = 3.0; + xmb->under_item_offset = 5.0; + + xmb->categories_active_zoom = 1.0; + xmb->categories_passive_zoom = 0.5; + xmb->items_active_zoom = 1.0; + xmb->items_passive_zoom = 0.5; + + xmb->categories_active_alpha = 1.0; + xmb->categories_passive_alpha = 0.85; + xmb->items_active_alpha = 1.0; + xmb->items_passive_alpha = 0.85; + + xmb->shadow_offset = 2.0; + + new_font_size = 32.0 * scale_factor; + xmb->font2_size = 24.0 * scale_factor; + new_header_height = 128.0 * scale_factor; + + + xmb->thumbnail_width = 1024.0 * scale_factor; + xmb->left_thumbnail_width = 1024.0 * scale_factor; + xmb->savestate_thumbnail_width= 460.0 * scale_factor; + xmb->cursor_size = 64.0 * scale_factor; + + xmb->icon_spacing_horizontal = 200.0 * scale_factor; + xmb->icon_spacing_vertical = 64.0 * scale_factor; + + xmb->margins_screen_top = (256+32) * scale_factor; + xmb->margins_screen_left = 336.0 * scale_factor; + + xmb->margins_title_left = 60 * scale_factor; + xmb->margins_title_top = 60 * scale_factor + new_font_size / 3; + xmb->margins_title_bottom = 60 * scale_factor - new_font_size / 3; + + xmb->margins_label_left = 85.0 * scale_factor; + xmb->margins_label_top = new_font_size / 3.0; + + xmb->margins_setting_left = 600.0 * scale_factor * scale_mod[6]; + xmb->margins_dialog = 48 * scale_factor; + + xmb->margins_slice = 16; + + xmb->icon_size = 128.0 * scale_factor; + xmb->font_size = new_font_size; + + menu_display_set_header_height(new_header_height); +} + +static void xmb_layout_psp(xmb_handle_t *xmb, int width) +{ + unsigned new_font_size, new_header_height; + settings_t *settings = config_get_ptr(); + float scale_factor = + ((settings->uints.menu_xmb_scale_factor * width) / (1920.0 * 100)) * 1.5; +#ifdef _3DS + scale_factor = + settings->uints.menu_xmb_scale_factor / 400.0; +#endif + + xmb->above_subitem_offset = 1.5; + xmb->above_item_offset = -1.0; + xmb->active_item_factor = 2.0; + xmb->under_item_offset = 3.0; + + xmb->categories_active_zoom = 1.0; + xmb->categories_passive_zoom = 1.0; + xmb->items_active_zoom = 1.0; + xmb->items_passive_zoom = 1.0; + + xmb->categories_active_alpha = 1.0; + xmb->categories_passive_alpha = 0.85; + xmb->items_active_alpha = 1.0; + xmb->items_passive_alpha = 0.85; + + xmb->shadow_offset = 1.0; + + new_font_size = 32.0 * scale_factor; + xmb->font2_size = 24.0 * scale_factor; + new_header_height = 128.0 * scale_factor; + xmb->margins_screen_top = (256+32) * scale_factor; + + xmb->thumbnail_width = 460.0 * scale_factor; + xmb->left_thumbnail_width = 400.0 * scale_factor; + xmb->savestate_thumbnail_width= 460.0 * scale_factor; + xmb->cursor_size = 64.0; + + xmb->icon_spacing_horizontal = 250.0 * scale_factor; + xmb->icon_spacing_vertical = 108.0 * scale_factor; + + xmb->margins_screen_left = 136.0 * scale_factor; + xmb->margins_title_left = 60 * scale_factor; + xmb->margins_title_top = 60 * scale_factor + new_font_size / 3; + xmb->margins_title_bottom = 60 * scale_factor - new_font_size / 3; + xmb->margins_label_left = 85.0 * scale_factor; + xmb->margins_label_top = new_font_size / 3.0; + xmb->margins_setting_left = 600.0 * scale_factor; + xmb->margins_dialog = 48 * scale_factor; + xmb->margins_slice = 16; + xmb->icon_size = 128.0 * scale_factor; + xmb->font_size = new_font_size; + + menu_display_set_header_height(new_header_height); +} + +static void xmb_layout(xmb_handle_t *xmb) +{ + unsigned width, height, i, current, end; + settings_t *settings = config_get_ptr(); + file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + size_t selection = menu_navigation_get_selection(); + + video_driver_get_size(&width, &height); + + switch (settings->uints.menu_xmb_layout) + { + /* Automatic */ + case 0: + { + xmb->use_ps3_layout = false; + xmb->use_ps3_layout = width > 320 && height > 240; + + /* Mimic the layout of the PSP instead of the PS3 on tiny screens */ + if (xmb->use_ps3_layout) + xmb_layout_ps3(xmb, width); + else + xmb_layout_psp(xmb, width); + } + break; + /* PS3 */ + case 1: + { + xmb->use_ps3_layout = true; + xmb_layout_ps3(xmb, width); + } + break; + /* PSP */ + case 2: + { + xmb->use_ps3_layout = false; + xmb_layout_psp(xmb, width); + } + break; + } + +#ifdef XMB_DEBUG + RARCH_LOG("[XMB] margin screen left: %.2f\n", xmb->margins_screen_left); + RARCH_LOG("[XMB] margin screen top: %.2f\n", xmb->margins_screen_top); + RARCH_LOG("[XMB] margin title left: %.2f\n", xmb->margins_title_left); + RARCH_LOG("[XMB] margin title top: %.2f\n", xmb->margins_title_top); + RARCH_LOG("[XMB] margin title bott: %.2f\n", xmb->margins_title_bottom); + RARCH_LOG("[XMB] margin label left: %.2f\n", xmb->margins_label_left); + RARCH_LOG("[XMB] margin label top: %.2f\n", xmb->margins_label_top); + RARCH_LOG("[XMB] margin sett left: %.2f\n", xmb->margins_setting_left); + RARCH_LOG("[XMB] icon spacing hor: %.2f\n", xmb->icon_spacing_horizontal); + RARCH_LOG("[XMB] icon spacing ver: %.2f\n", xmb->icon_spacing_vertical); + RARCH_LOG("[XMB] icon size: %.2f\n", xmb->icon_size); +#endif + + current = (unsigned)selection; + end = (unsigned)menu_entries_get_size(); + + for (i = 0; i < end; i++) + { + float ia = xmb->items_passive_alpha; + float iz = xmb->items_passive_zoom; + xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset( + selection_buf, i); + + if (!node) + continue; + + if (i == current) + { + ia = xmb->items_active_alpha; + iz = xmb->items_active_alpha; + } + + node->alpha = ia; + node->label_alpha = ia; + node->zoom = iz; + node->y = xmb_item_y(xmb, i, current); + } + + if (xmb->depth <= 1) + return; + + current = (unsigned)xmb->selection_ptr_old; + end = (unsigned)file_list_get_size(xmb->selection_buf_old); + + for (i = 0; i < end; i++) + { + float ia = 0; + float iz = xmb->items_passive_zoom; + xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset( + xmb->selection_buf_old, i); + + if (!node) + continue; + + if (i == current) + { + ia = xmb->items_active_alpha; + iz = xmb->items_active_alpha; + } + + node->alpha = ia; + node->label_alpha = 0; + node->zoom = iz; + node->y = xmb_item_y(xmb, i, current); + node->x = xmb->icon_size * 1 * -2; + } } static void xmb_ribbon_set_vertex(float *ribbon_verts, @@ -5116,6 +4614,528 @@ static bool xmb_load_image(void *userdata, void *data, enum menu_image_type type return true; } +static const char *xmb_texture_path(unsigned id) +{ + char *iconpath = (char*) malloc(PATH_MAX_LENGTH * sizeof(char)); + char *icon_name = (char*) malloc(PATH_MAX_LENGTH * sizeof(char)); + char *icon_fullpath = (char*) malloc(PATH_MAX_LENGTH * sizeof(char)); + + iconpath[0] = icon_name[0] = icon_fullpath[0] = '\0'; + + switch (id) + { + case XMB_TEXTURE_MAIN_MENU: +#if defined(HAVE_LAKKA) + icon_name = "lakka.png"; + break; +#else + icon_name = "retroarch.png"; + break; +#endif + case XMB_TEXTURE_SETTINGS: + icon_name = "settings.png"; + break; + case XMB_TEXTURE_HISTORY: + icon_name = "history.png"; + break; + case XMB_TEXTURE_FAVORITES: + icon_name = "favorites.png"; + break; + case XMB_TEXTURE_ADD_FAVORITE: + icon_name = "add-favorite.png"; + break; + case XMB_TEXTURE_MUSICS: + icon_name = "musics.png"; + break; +#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) + case XMB_TEXTURE_MOVIES: + icon_name = "movies.png"; + break; +#endif +#ifdef HAVE_IMAGEVIEWER + case XMB_TEXTURE_IMAGES: + icon_name = "images.png"; + break; +#endif + case XMB_TEXTURE_SETTING: + icon_name = "setting.png"; + break; + case XMB_TEXTURE_SUBSETTING: + icon_name = "subsetting.png"; + break; + case XMB_TEXTURE_ARROW: + icon_name = "arrow.png"; + break; + case XMB_TEXTURE_RUN: + icon_name = "run.png"; + break; + case XMB_TEXTURE_CLOSE: + icon_name = "close.png"; + break; + case XMB_TEXTURE_RESUME: + icon_name = "resume.png"; + break; + case XMB_TEXTURE_CLOCK: + icon_name = "clock.png"; + break; + case XMB_TEXTURE_BATTERY_FULL: + icon_name = "battery-full.png"; + break; + case XMB_TEXTURE_BATTERY_CHARGING: + icon_name = "battery-charging.png"; + break; + case XMB_TEXTURE_POINTER: + icon_name = "pointer.png"; + break; + case XMB_TEXTURE_SAVESTATE: + icon_name = "savestate.png"; + break; + case XMB_TEXTURE_LOADSTATE: + icon_name = "loadstate.png"; + break; + case XMB_TEXTURE_UNDO: + icon_name = "undo.png"; + break; + case XMB_TEXTURE_CORE_INFO: + icon_name = "core-infos.png"; + break; + case XMB_TEXTURE_WIFI: + icon_name = "wifi.png"; + break; + case XMB_TEXTURE_CORE_OPTIONS: + icon_name = "core-options.png"; + break; + case XMB_TEXTURE_INPUT_REMAPPING_OPTIONS: + icon_name = "core-input-remapping-options.png"; + break; + case XMB_TEXTURE_CHEAT_OPTIONS: + icon_name = "core-cheat-options.png"; + break; + case XMB_TEXTURE_DISK_OPTIONS: + icon_name = "core-disk-options.png"; + break; + case XMB_TEXTURE_SHADER_OPTIONS: + icon_name = "core-shader-options.png"; + break; + case XMB_TEXTURE_ACHIEVEMENT_LIST: + icon_name = "achievement-list.png"; + break; + case XMB_TEXTURE_SCREENSHOT: + icon_name = "screenshot.png"; + break; + case XMB_TEXTURE_RELOAD: + icon_name = "reload.png"; + break; + case XMB_TEXTURE_RENAME: + icon_name = "rename.png"; + break; + case XMB_TEXTURE_FILE: + icon_name = "file.png"; + break; + case XMB_TEXTURE_FOLDER: + icon_name = "folder.png"; + break; + case XMB_TEXTURE_ZIP: + icon_name = "zip.png"; + break; + case XMB_TEXTURE_MUSIC: + icon_name = "music.png"; + break; + case XMB_TEXTURE_FAVORITE: + icon_name = "favorites-content.png"; + break; + case XMB_TEXTURE_IMAGE: + icon_name = "image.png"; + break; + case XMB_TEXTURE_MOVIE: + icon_name = "movie.png"; + break; + case XMB_TEXTURE_CORE: + icon_name = "core.png"; + break; + case XMB_TEXTURE_RDB: + icon_name = "database.png"; + break; + case XMB_TEXTURE_CURSOR: + icon_name = "cursor.png"; + break; + case XMB_TEXTURE_SWITCH_ON: + icon_name = "on.png"; + break; + case XMB_TEXTURE_SWITCH_OFF: + icon_name = "off.png"; + break; + case XMB_TEXTURE_ADD: + icon_name = "add.png"; + break; +#ifdef HAVE_NETWORKING + case XMB_TEXTURE_NETPLAY: + icon_name = "netplay.png"; + break; + case XMB_TEXTURE_ROOM: + icon_name = "menu_room.png"; + break; + case XMB_TEXTURE_ROOM_LAN: + icon_name = "menu_room_lan.png"; + break; + case XMB_TEXTURE_ROOM_RELAY: + icon_name = "menu_room_relay.png"; + break; +#endif + case XMB_TEXTURE_KEY: + icon_name = "key.png"; + break; + case XMB_TEXTURE_KEY_HOVER: + icon_name = "key-hover.png"; + break; + case XMB_TEXTURE_DIALOG_SLICE: + icon_name = "dialog-slice.png"; + break; + case XMB_TEXTURE_ACHIEVEMENTS: + icon_name = "menu_achievements.png"; + break; + case XMB_TEXTURE_AUDIO: + icon_name = "menu_audio.png"; + break; + case XMB_TEXTURE_DRIVERS: + icon_name = "menu_drivers.png"; + break; + case XMB_TEXTURE_EXIT: + icon_name = "menu_exit.png"; + break; + case XMB_TEXTURE_FRAMESKIP: + icon_name = "menu_frameskip.png"; + break; + case XMB_TEXTURE_HELP: + icon_name = "menu_help.png"; + break; + case XMB_TEXTURE_INFO: + icon_name = "menu_info.png"; + break; + case XMB_TEXTURE_INPUT_SETTINGS: + icon_name = "Libretro - Pad.png"; + break; + case XMB_TEXTURE_LATENCY: + icon_name = "menu_latency.png"; + break; + case XMB_TEXTURE_NETWORK: + icon_name = "menu_network.png"; + break; + case XMB_TEXTURE_POWER: + icon_name = "menu_power.png"; + break; + case XMB_TEXTURE_RECORD: + icon_name = "menu_record.png"; + break; + case XMB_TEXTURE_SAVING: + icon_name = "menu_saving.png"; + break; + case XMB_TEXTURE_UPDATER: + icon_name = "menu_updater.png"; + break; + case XMB_TEXTURE_VIDEO: + icon_name = "menu_video.png"; + break; + case XMB_TEXTURE_MIXER: + icon_name = "menu_mixer.png"; + break; + case XMB_TEXTURE_LOG: + icon_name = "menu_log.png"; + break; + case XMB_TEXTURE_OSD: + icon_name = "menu_osd.png"; + break; + case XMB_TEXTURE_UI: + icon_name = "menu_ui.png"; + break; + case XMB_TEXTURE_USER: + icon_name = "menu_user.png"; + break; + case XMB_TEXTURE_PRIVACY: + icon_name = "menu_privacy.png"; + break; + case XMB_TEXTURE_PLAYLIST: + icon_name = "menu_playlist.png"; + break; + case XMB_TEXTURE_QUICKMENU: + icon_name = "menu_quickmenu.png"; + break; + case XMB_TEXTURE_REWIND: + icon_name = "menu_rewind.png"; + break; + case XMB_TEXTURE_OVERLAY: + icon_name = "menu_overlay.png"; + break; + case XMB_TEXTURE_OVERRIDE: + icon_name = "menu_override.png"; + break; + case XMB_TEXTURE_NOTIFICATIONS: + icon_name = "menu_notifications.png"; + break; + case XMB_TEXTURE_STREAM: + icon_name = "menu_stream.png"; + break; + case XMB_TEXTURE_SHUTDOWN: + icon_name = "menu_shutdown.png"; + break; + case XMB_TEXTURE_INPUT_DPAD_U: + icon_name = "input_DPAD-U.png"; + break; + case XMB_TEXTURE_INPUT_DPAD_D: + icon_name = "input_DPAD-D.png"; + break; + case XMB_TEXTURE_INPUT_DPAD_L: + icon_name = "input_DPAD-L.png"; + break; + case XMB_TEXTURE_INPUT_DPAD_R: + icon_name = "input_DPAD-R.png"; + break; + case XMB_TEXTURE_INPUT_STCK_U: + icon_name = "input_STCK-U.png"; + break; + case XMB_TEXTURE_INPUT_STCK_D: + icon_name = "input_STCK-D.png"; + break; + case XMB_TEXTURE_INPUT_STCK_L: + icon_name = "input_STCK-L.png"; + break; + case XMB_TEXTURE_INPUT_STCK_R: + icon_name = "input_STCK-R.png"; + break; + case XMB_TEXTURE_INPUT_STCK_P: + icon_name = "input_STCK-P.png"; + break; + case XMB_TEXTURE_INPUT_BTN_U: + icon_name = "input_BTN-U.png"; + break; + case XMB_TEXTURE_INPUT_BTN_D: + icon_name = "input_BTN-D.png"; + break; + case XMB_TEXTURE_INPUT_BTN_L: + icon_name = "input_BTN-L.png"; + break; + case XMB_TEXTURE_INPUT_BTN_R: + icon_name = "input_BTN-R.png"; + break; + case XMB_TEXTURE_INPUT_LB: + icon_name = "input_LB.png"; + break; + case XMB_TEXTURE_INPUT_RB: + icon_name = "input_RB.png"; + break; + case XMB_TEXTURE_INPUT_LT: + icon_name = "input_LT.png"; + break; + case XMB_TEXTURE_INPUT_RT: + icon_name = "input_RT.png"; + break; + case XMB_TEXTURE_INPUT_SELECT: + icon_name = "input_SELECT.png"; + break; + case XMB_TEXTURE_INPUT_START: + icon_name = "input_START.png"; + break; + case XMB_TEXTURE_CHECKMARK: + icon_name = "menu_check.png"; + break; + case XMB_TEXTURE_MENU_ADD: + icon_name = "menu_add.png"; + break; + case XMB_TEXTURE_BRIGHTNESS: + icon_name = "menu_brightness.png"; + break; + case XMB_TEXTURE_PAUSE: + icon_name = "menu_pause.png"; + break; + } + + fill_pathname_application_special(iconpath, + PATH_MAX_LENGTH * sizeof(char), + APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS); + + icon_fullpath = iconpath; + strlcat(icon_fullpath, icon_name, PATH_MAX_LENGTH * sizeof(char)); + + if (!filestream_exists(icon_fullpath)) + { + RARCH_WARN("[XMB] Asset missing: %s\n", icon_fullpath); + return NULL; + } + else + return icon_name; + +} + +static void xmb_context_reset_textures( + xmb_handle_t *xmb, const char *iconpath) +{ + unsigned i; + settings_t *settings = config_get_ptr(); + + for (i = 0; i < XMB_TEXTURE_LAST; i++) + { + if (xmb_texture_path(i) == NULL) + { + /* If the icon doesn't exist at least try to return the subsetting icon*/ + if (!(i == XMB_TEXTURE_DIALOG_SLICE || i == XMB_TEXTURE_KEY_HOVER || i == XMB_TEXTURE_KEY_HOVER)) + menu_display_reset_textures_list(xmb_texture_path(XMB_TEXTURE_SUBSETTING), iconpath, &xmb->textures.list[i], TEXTURE_FILTER_MIPMAP_LINEAR); + continue; + } + menu_display_reset_textures_list(xmb_texture_path(i), iconpath, &xmb->textures.list[i], TEXTURE_FILTER_MIPMAP_LINEAR); + } + + /* Warn only if critical assets are missing, some themes are incomplete */ + if ( + ((xmb_texture_path(XMB_TEXTURE_SUBSETTING) == NULL)) && !(settings->uints.menu_xmb_theme == XMB_ICON_THEME_CUSTOM) + ) + runloop_msg_queue_push(msg_hash_to_str(MSG_MISSING_ASSETS), 1, 256, false); + + menu_display_allocate_white_texture(); + + xmb->main_menu_node.icon = xmb->textures.list[XMB_TEXTURE_MAIN_MENU]; + xmb->main_menu_node.alpha = xmb->categories_active_alpha; + xmb->main_menu_node.zoom = xmb->categories_active_zoom; + + xmb->settings_tab_node.icon = xmb->textures.list[XMB_TEXTURE_SETTINGS]; + xmb->settings_tab_node.alpha = xmb->categories_active_alpha; + xmb->settings_tab_node.zoom = xmb->categories_active_zoom; + + xmb->history_tab_node.icon = xmb->textures.list[XMB_TEXTURE_HISTORY]; + xmb->history_tab_node.alpha = xmb->categories_active_alpha; + xmb->history_tab_node.zoom = xmb->categories_active_zoom; + + xmb->favorites_tab_node.icon = xmb->textures.list[XMB_TEXTURE_FAVORITES]; + xmb->favorites_tab_node.alpha = xmb->categories_active_alpha; + xmb->favorites_tab_node.zoom = xmb->categories_active_zoom; + + xmb->music_tab_node.icon = xmb->textures.list[XMB_TEXTURE_MUSICS]; + xmb->music_tab_node.alpha = xmb->categories_active_alpha; + xmb->music_tab_node.zoom = xmb->categories_active_zoom; + +#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) + xmb->video_tab_node.icon = xmb->textures.list[XMB_TEXTURE_MOVIES]; + xmb->video_tab_node.alpha = xmb->categories_active_alpha; + xmb->video_tab_node.zoom = xmb->categories_active_zoom; +#endif + +#ifdef HAVE_IMAGEVIEWER + xmb->images_tab_node.icon = xmb->textures.list[XMB_TEXTURE_IMAGES]; + xmb->images_tab_node.alpha = xmb->categories_active_alpha; + xmb->images_tab_node.zoom = xmb->categories_active_zoom; +#endif + + xmb->add_tab_node.icon = xmb->textures.list[XMB_TEXTURE_ADD]; + xmb->add_tab_node.alpha = xmb->categories_active_alpha; + xmb->add_tab_node.zoom = xmb->categories_active_zoom; + +#ifdef HAVE_NETWORKING + xmb->netplay_tab_node.icon = xmb->textures.list[XMB_TEXTURE_NETPLAY]; + xmb->netplay_tab_node.alpha = xmb->categories_active_alpha; + xmb->netplay_tab_node.zoom = xmb->categories_active_zoom; +#endif + +} + +static void xmb_context_reset_background(const char *iconpath) +{ + char *path = NULL; + settings_t *settings = config_get_ptr(); + const char *path_menu_wp = settings->paths.path_menu_wallpaper; + + if (!string_is_empty(path_menu_wp)) + path = strdup(path_menu_wp); + else if (!string_is_empty(iconpath)) + { + path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + path[0] = '\0'; + + fill_pathname_join(path, iconpath, "bg.png", + PATH_MAX_LENGTH * sizeof(char)); + } + + if (filestream_exists(path)) + task_push_image_load(path, + menu_display_handle_wallpaper_upload, NULL); + + if (path) + free(path); +} + +static void xmb_context_reset_internal(xmb_handle_t *xmb, + bool is_threaded, bool reinit_textures) +{ + char bg_file_path[PATH_MAX_LENGTH] = {0}; + char *iconpath = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + iconpath[0] = '\0'; + + fill_pathname_application_special(bg_file_path, + sizeof(bg_file_path), APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_BG); + + if (!string_is_empty(bg_file_path)) + { + if (!string_is_empty(xmb->bg_file_path)) + free(xmb->bg_file_path); + xmb->bg_file_path = strdup(bg_file_path); + } + + fill_pathname_application_special(iconpath, + PATH_MAX_LENGTH * sizeof(char), + APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS); + + xmb_layout(xmb); + if (xmb->font) + { + menu_display_font_free(xmb->font); + xmb->font = NULL; + } + if (xmb->font2) + { + menu_display_font_free(xmb->font2); + xmb->font2 = NULL; + } + xmb->font = menu_display_font(APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_FONT, + xmb->font_size, + is_threaded); + xmb->font2 = menu_display_font(APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_FONT, + xmb->font2_size, + is_threaded); + + if (reinit_textures) + { + xmb_context_reset_textures(xmb, iconpath); + xmb_context_reset_background(iconpath); + } + + xmb_context_reset_horizontal_list(xmb); + + if (!string_is_equal(xmb_thumbnails_ident('R'), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))) + { + xmb_update_thumbnail_path(xmb, 0, 'R'); + xmb_update_thumbnail_image(xmb); + } + if (!string_is_equal(xmb_thumbnails_ident('L'), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))) + { + xmb_update_thumbnail_path(xmb, 0, 'L'); + xmb_update_thumbnail_image(xmb); + } + xmb_update_savestate_thumbnail_image(xmb); + + free(iconpath); +} + +static void xmb_context_reset(void *data, bool is_threaded) +{ + xmb_handle_t *xmb = (xmb_handle_t*)data; + + if (xmb) + { + xmb_context_reset_internal(xmb, is_threaded, true); + xmb->context_just_reset = true; + } +} + static void xmb_navigation_clear(void *data, bool pending_push) { xmb_handle_t *xmb = (xmb_handle_t*)data; From f9c12866bfaadb6803abbf49b3fc3bb0d22f82f0 Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 25 Nov 2018 15:20:11 -0500 Subject: [PATCH 06/18] [record] add more recording options --- menu/menu_setting.c | 11 ++++- record/drivers/record_ffmpeg.c | 81 +++++++++++++++++++++++++++++++--- record/record_driver.c | 22 +++++++-- record/record_driver.h | 4 ++ 4 files changed, 106 insertions(+), 12 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1d76dedf57..56c444f7c7 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -375,6 +375,15 @@ static void setting_get_string_representation_video_record_quality(rarch_setting case 4: strlcpy(s, "Lossless", len); break; + case 5: + strlcpy(s, "WebM Fast", len); + break; + case 6: + strlcpy(s, "WebM High Quality", len); + break; + case 7: + strlcpy(s, "GIF", len); + break; } } @@ -6689,7 +6698,7 @@ static bool setting_append_list( (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_video_record_quality; - menu_settings_list_current_add_range(list, list_info, RECORD_CONFIG_TYPE_RECORDING_CUSTOM, RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY, 1, true, true); + menu_settings_list_current_add_range(list, list_info, RECORD_CONFIG_TYPE_RECORDING_CUSTOM, RECORD_CONFIG_TYPE_RECORDING_GIF, 1, true, true); CONFIG_PATH( list, list_info, diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index b181492bde..e12ccfc28f 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -97,6 +97,14 @@ extern "C" { #define PIX_FMT_BGR24 AV_PIX_FMT_BGR24 #endif +#ifndef PIX_FMT_RGB24 +#define PIX_FMT_RGB24 AV_PIX_FMT_RGB24 +#endif + +#ifndef PIX_FMT_RGB8 +#define PIX_FMT_RGB8 AV_PIX_FMT_RGB8 +#endif + #ifndef PIX_FMT_RGB565 #define PIX_FMT_RGB565 AV_PIX_FMT_RGB565 #endif @@ -556,7 +564,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p { case RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY: case RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY: - params->threads = 1; + params->threads = 2; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 75; @@ -572,7 +580,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p break; case RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY: case RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY: - params->threads = 1; + params->threads = 2; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 75; @@ -588,7 +596,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p break; case RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY: case RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY: - params->threads = 1; + params->threads = 2; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 100; @@ -603,10 +611,10 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p av_dict_set(¶ms->audio_opts, "audio_global_quality", "100", 0); break; case RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY: - params->threads = 1; + params->threads = 2; params->frame_drop_ratio = 1; params->audio_enable = true; - params->audio_global_quality = 100; + params->audio_global_quality = 80; params->out_pix_fmt = PIX_FMT_BGR24; strlcpy(params->vcodec, "libx264rgb", sizeof(params->vcodec)); @@ -615,10 +623,51 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p av_dict_set(¶ms->video_opts, "preset", "medium", 0); av_dict_set(¶ms->video_opts, "tune", "animation", 0); av_dict_set(¶ms->video_opts, "crf", "0", 0); - av_dict_set(¶ms->audio_opts, "audio_global_quality", "100", 0); + av_dict_set(¶ms->audio_opts, "audio_global_quality", "80", 0); + break; + case RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST: + params->threads = 2; + params->frame_drop_ratio = 1; + params->audio_enable = true; + params->audio_global_quality = 50; + params->out_pix_fmt = PIX_FMT_YUV420P; + + strlcpy(params->vcodec, "libvpx", sizeof(params->vcodec)); + strlcpy(params->acodec, "libopus", sizeof(params->acodec)); + + av_dict_set(¶ms->video_opts, "deadline", "realtime", 0); + av_dict_set(¶ms->video_opts, "crf", "14", 0); + av_dict_set(¶ms->audio_opts, "audio_global_quality", "50", 0); + break; + case RECORD_CONFIG_TYPE_RECORDING_WEBM_HIGH_QUALITY: + params->threads = 2; + params->frame_drop_ratio = 1; + params->audio_enable = true; + params->audio_global_quality = 75; + params->out_pix_fmt = PIX_FMT_YUV420P; + + strlcpy(params->vcodec, "libvpx", sizeof(params->vcodec)); + strlcpy(params->acodec, "libopus", sizeof(params->acodec)); + + av_dict_set(¶ms->video_opts, "deadline", "realtime", 0); + av_dict_set(¶ms->video_opts, "crf", "4", 0); + av_dict_set(¶ms->audio_opts, "audio_global_quality", "75", 0); + break; + case RECORD_CONFIG_TYPE_RECORDING_GIF: + params->threads = 2; + params->frame_drop_ratio = 1; + params->audio_enable = false; + params->audio_global_quality = 0; + params->out_pix_fmt = PIX_FMT_RGB8; + + strlcpy(params->vcodec, "gif", sizeof(params->vcodec)); + strlcpy(params->acodec, "", sizeof(params->acodec)); + + av_dict_set(¶ms->video_opts, "framerate", "50", 0); + av_dict_set(¶ms->audio_opts, "audio_global_quality", "0", 0); break; case RECORD_CONFIG_TYPE_STREAMING_NETPLAY: - params->threads = 1; + params->threads = 2; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 50; @@ -645,6 +694,24 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p params->scale_factor = 1; strlcpy(params->format, "matroska", sizeof(params->format)); } + else if (preset >= RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST && settings->uints.video_record_quality < RECORD_CONFIG_TYPE_RECORDING_GIF) + { + if (!settings->bools.video_gpu_record) + params->scale_factor = settings->uints.video_record_scale_factor > 0 ? + settings->uints.video_record_scale_factor : 1; + else + params->scale_factor = 1; + strlcpy(params->format, "webm", sizeof(params->format)); + } + else if (preset <= RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY) + { + if (!settings->bools.video_gpu_record) + params->scale_factor = settings->uints.video_record_scale_factor > 0 ? + settings->uints.video_record_scale_factor : 1; + else + params->scale_factor = 1; + strlcpy(params->format, "gif", sizeof(params->format)); + } else if (preset <= RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY) { if (!settings->bools.video_gpu_record) diff --git a/record/record_driver.c b/record/record_driver.c index 9426b58e2f..e92f0d8724 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -366,10 +366,24 @@ bool recording_init(void) else { const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME)); - fill_str_dated_filename(buf, game_name, - "mkv", sizeof(buf)); - fill_pathname_join(output, global->record.output_dir, buf, sizeof(output)); - + if (settings->uints.video_record_quality < RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST) + { + fill_str_dated_filename(buf, game_name, + "mkv", sizeof(buf)); + fill_pathname_join(output, global->record.output_dir, buf, sizeof(output)); + } + else if (settings->uints.video_record_quality >= RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST && settings->uints.video_record_quality < RECORD_CONFIG_TYPE_RECORDING_GIF) + { + fill_str_dated_filename(buf, game_name, + "webm", sizeof(buf)); + fill_pathname_join(output, global->record.output_dir, buf, sizeof(output)); + } + else + { + fill_str_dated_filename(buf, game_name, + "gif", sizeof(buf)); + fill_pathname_join(output, global->record.output_dir, buf, sizeof(output)); + } } } diff --git a/record/record_driver.h b/record/record_driver.h index 6f29831549..8d034f8939 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -46,11 +46,15 @@ enum record_config_type RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY, RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY, RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY, + RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST, + RECORD_CONFIG_TYPE_RECORDING_WEBM_HIGH_QUALITY, + RECORD_CONFIG_TYPE_RECORDING_GIF, RECORD_CONFIG_TYPE_STREAMING_CUSTOM, RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY, RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY, RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY, RECORD_CONFIG_TYPE_STREAMING_NETPLAY + }; /* Parameters passed to ffemu_new() */ From 0bf0e355ec51ce84584f262aa14d05bea9fa1f1f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 25 Nov 2018 21:51:09 +0100 Subject: [PATCH 07/18] This stops the crashes with video_get_output_size/next/prev --- gfx/video_thread_wrapper.c | 40 ++++++++------------------------------ 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index 147ec5782b..7f3b2a2c0e 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -48,9 +48,6 @@ enum thread_cmd CMD_POKE_SET_VIDEO_MODE, CMD_POKE_SET_FILTERING, - CMD_POKE_GET_VIDEO_OUTPUT_SIZE, - CMD_POKE_GET_VIDEO_OUTPUT_PREV, - CMD_POKE_GET_VIDEO_OUTPUT_NEXT, CMD_POKE_SET_FBO_STATE, CMD_POKE_GET_FBO_STATE, @@ -499,26 +496,6 @@ static bool video_thread_handle_packet( video_thread_reply(thr, &pkt); break; - case CMD_POKE_GET_VIDEO_OUTPUT_SIZE: - if (thr->poke && thr->poke->get_video_output_size) - thr->poke->get_video_output_size(thr->driver_data, - &pkt.data.output.width, - &pkt.data.output.height); - video_thread_reply(thr, &pkt); - break; - - case CMD_POKE_GET_VIDEO_OUTPUT_PREV: - if (thr->poke && thr->poke->get_video_output_prev) - thr->poke->get_video_output_prev(thr->driver_data); - video_thread_reply(thr, &pkt); - break; - - case CMD_POKE_GET_VIDEO_OUTPUT_NEXT: - if (thr->poke && thr->poke->get_video_output_next) - thr->poke->get_video_output_next(thr->driver_data); - video_thread_reply(thr, &pkt); - break; - case CMD_POKE_SET_ASPECT_RATIO: if (thr->poke && thr->poke->set_aspect_ratio) thr->poke->set_aspect_ratio(thr->driver_data, @@ -1107,37 +1084,36 @@ static void thread_get_video_output_size(void *data, unsigned *width, unsigned *height) { thread_video_t *thr = (thread_video_t*)data; - thread_packet_t pkt = { CMD_POKE_GET_VIDEO_OUTPUT_SIZE }; if (!thr) return; - video_thread_send_and_wait_user_to_thread(thr, &pkt); - - *width = pkt.data.output.width; - *height = pkt.data.output.height; + if (thr->poke && thr->poke->get_video_output_size) + thr->poke->get_video_output_size(thr->driver_data, + width, + height); } static void thread_get_video_output_prev(void *data) { thread_video_t *thr = (thread_video_t*)data; - thread_packet_t pkt = { CMD_POKE_GET_VIDEO_OUTPUT_PREV }; if (!thr) return; - video_thread_send_and_wait_user_to_thread(thr, &pkt); + if (thr->poke && thr->poke->get_video_output_prev) + thr->poke->get_video_output_prev(thr->driver_data); } static void thread_get_video_output_next(void *data) { thread_video_t *thr = (thread_video_t*)data; - thread_packet_t pkt = { CMD_POKE_GET_VIDEO_OUTPUT_NEXT }; if (!thr) return; - video_thread_send_and_wait_user_to_thread(thr, &pkt); + if (thr->poke && thr->poke->get_video_output_next) + thr->poke->get_video_output_next(thr->driver_data); } static void thread_set_aspect_ratio(void *data, unsigned aspectratio_idx) From 665be01b6b065b79d5a0e0a683de2548f21559df Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 25 Nov 2018 15:41:26 -0500 Subject: [PATCH 08/18] [record] add recording threads setting --- config.def.h | 4 ++++ configuration.c | 2 ++ configuration.h | 2 ++ intl/msg_hash_us.h | 4 ++++ menu/menu_displaylist.c | 4 ++++ menu/menu_setting.c | 27 +++++++++++++++++++++------ msg_hash.h | 1 + record/drivers/record_ffmpeg.c | 16 ++++++++-------- 8 files changed, 46 insertions(+), 14 deletions(-) diff --git a/config.def.h b/config.def.h index 618fba6174..85a7104506 100644 --- a/config.def.h +++ b/config.def.h @@ -125,6 +125,10 @@ static const unsigned window_height = 720; static const unsigned fullscreen_x = 0; static const unsigned fullscreen_y = 0; +/* Number of threads to use for video recording */ + +static const unsigned video_record_threads = 2; + /* Amount of transparency to use for the main window. * 1 is the most transparent while 100 is opaque. */ diff --git a/configuration.c b/configuration.c index 947011d30f..0d209a5940 100644 --- a/configuration.c +++ b/configuration.c @@ -1676,6 +1676,8 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, SETTING_UINT("video_windowed_position_width", &settings->uints.window_position_width, true, window_width, false); SETTING_UINT("video_windowed_position_height", &settings->uints.window_position_height, true, window_height, false); + SETTING_UINT("video_record_threads", &settings->uints.video_record_threads, true, video_record_threads, false); + *size = count; return tmp; diff --git a/configuration.h b/configuration.h index 7555118d62..dee5497cb8 100644 --- a/configuration.h +++ b/configuration.h @@ -443,6 +443,8 @@ typedef struct settings unsigned window_position_y; unsigned window_position_width; unsigned window_position_height; + + unsigned video_record_threads; } uints; struct diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index f400919e98..15bd1b26c3 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -3206,6 +3206,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, "Windowed Scale" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_THREADS, + "Recording Threads" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, "Integer Scale" diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 36a9713301..11150ebf71 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7316,6 +7316,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist MENU_ENUM_LABEL_STREAMING_MODE, PARSE_ONLY_UINT, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_VIDEO_RECORD_THREADS, + PARSE_ONLY_UINT, true) == 0) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_STREAMING_TITLE, PARSE_ONLY_STRING, false) == 0) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 56c444f7c7..edf7979b35 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -336,16 +336,16 @@ static void setting_get_string_representation_video_stream_quality( /* TODO/FIXME - localize this */ switch (*setting->value.target.unsigned_integer) { - case 5: + case 8: strlcpy(s, "Custom", len); break; - case 6: + case 9: strlcpy(s, "Low", len); break; - case 7: + case 10: strlcpy(s, "Medium", len); break; - case 8: + case 11: strlcpy(s, "High", len); break; } @@ -6759,7 +6759,7 @@ static bool setting_append_list( (*list)[list_info->index - 1].offset_by = 1; menu_settings_list_current_add_range(list, list_info, 1, 65536, 1, true, true); - CONFIG_UINT( + CONFIG_UINT( list, list_info, &settings->uints.video_stream_quality, MENU_ENUM_LABEL_VIDEO_STREAM_QUALITY, @@ -6773,7 +6773,6 @@ static bool setting_append_list( (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_video_stream_quality; - (*list)[list_info->index - 1].offset_by = 5; menu_settings_list_current_add_range(list, list_info, RECORD_CONFIG_TYPE_STREAMING_CUSTOM, RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY, 1, true, true); CONFIG_PATH( @@ -6804,6 +6803,22 @@ static bool setting_append_list( general_read_handler); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + + CONFIG_UINT( + list, list_info, + &settings->uints.video_record_threads, + MENU_ENUM_LABEL_VIDEO_RECORD_THREADS, + MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_THREADS, + video_record_threads, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special; + menu_settings_list_current_add_range(list, list_info, 1, 8, 1, true, true); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); + CONFIG_DIR( list, list_info, global->record.output_dir, diff --git a/msg_hash.h b/msg_hash.h index e457eb3c30..3c16be4e89 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -758,6 +758,7 @@ enum msg_hash_enums MENU_LABEL(VIDEO_FORCE_SRGB_DISABLE), MENU_LABEL(VIDEO_ROTATION), MENU_LABEL(VIDEO_SCALE), + MENU_LABEL(VIDEO_RECORD_THREADS), MENU_LABEL(VIDEO_SMOOTH), MENU_LABEL(VIDEO_CROP_OVERSCAN), diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index e12ccfc28f..f085a66a7e 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -564,7 +564,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p { case RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY: case RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY: - params->threads = 2; + params->threads = settings->uints.video_record_threads; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 75; @@ -580,7 +580,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p break; case RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY: case RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY: - params->threads = 2; + params->threads = settings->uints.video_record_threads; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 75; @@ -596,7 +596,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p break; case RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY: case RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY: - params->threads = 2; + params->threads = settings->uints.video_record_threads; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 100; @@ -611,7 +611,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p av_dict_set(¶ms->audio_opts, "audio_global_quality", "100", 0); break; case RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY: - params->threads = 2; + params->threads = settings->uints.video_record_threads; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 80; @@ -626,7 +626,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p av_dict_set(¶ms->audio_opts, "audio_global_quality", "80", 0); break; case RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST: - params->threads = 2; + params->threads = settings->uints.video_record_threads; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 50; @@ -640,7 +640,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p av_dict_set(¶ms->audio_opts, "audio_global_quality", "50", 0); break; case RECORD_CONFIG_TYPE_RECORDING_WEBM_HIGH_QUALITY: - params->threads = 2; + params->threads = settings->uints.video_record_threads; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 75; @@ -654,7 +654,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p av_dict_set(¶ms->audio_opts, "audio_global_quality", "75", 0); break; case RECORD_CONFIG_TYPE_RECORDING_GIF: - params->threads = 2; + params->threads = settings->uints.video_record_threads; params->frame_drop_ratio = 1; params->audio_enable = false; params->audio_global_quality = 0; @@ -667,7 +667,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p av_dict_set(¶ms->audio_opts, "audio_global_quality", "0", 0); break; case RECORD_CONFIG_TYPE_STREAMING_NETPLAY: - params->threads = 2; + params->threads = settings->uints.video_record_threads; params->frame_drop_ratio = 1; params->audio_enable = true; params->audio_global_quality = 50; From 1187df922a95b6e1f553a571d529e46176eac9bb Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 25 Nov 2018 17:24:54 -0500 Subject: [PATCH 09/18] restore old functionality till the change is done in other platforms --- gfx/video_driver.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index c3157f8c6c..e544ab2762 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -985,16 +985,25 @@ static bool video_driver_init_internal(bool *video_is_threaded) } else { - if (settings->bools.video_force_aspect) + /* To-Do: remove when the new window resizing core is hooked */ + if (settings->uints.window_position_width || settings->uints.window_position_height) { - /* Do rounding here to simplify integer scale correctness. */ - unsigned base_width = - roundf(geom->base_height * video_driver_get_aspect_ratio()); - width = roundf(base_width * settings->floats.video_scale); + width = settings->uints.window_position_width; + height = settings->uints.window_position_height; } else - width = roundf(geom->base_width * settings->floats.video_scale); - height = roundf(geom->base_height * settings->floats.video_scale); + { + if (settings->bools.video_force_aspect) + { + /* Do rounding here to simplify integer scale correctness. */ + unsigned base_width = + roundf(geom->base_height * video_driver_get_aspect_ratio()); + width = roundf(base_width * settings->floats.video_scale); + } + else + width = roundf(geom->base_width * settings->floats.video_scale); + height = roundf(geom->base_height * settings->floats.video_scale); +} } if (width && height) From 94211bf833e8ec19c7f6a86c92de07813b259b77 Mon Sep 17 00:00:00 2001 From: natinusala Date: Mon, 26 Nov 2018 00:13:11 +0100 Subject: [PATCH 10/18] xmb: fix hang when resizing with threaded video driver --- menu/drivers/xmb.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 4bb2b29ab8..34ce6f6e1f 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1,8 +1,8 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2014-2017 - Jean-André Santoni * Copyright (C) 2016-2017 - Brad Parker - * Copyright (C) 2018 - Alfredo Monclús + * Copyright (C) 2018 - Alfredo Monclús * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -3103,6 +3103,9 @@ static void xmb_draw_items( menu_display_blend_end(video_info); } +static void xmb_context_reset_internal(xmb_handle_t *xmb, + bool is_threaded, bool reinit_textures); + static void xmb_render(void *data, bool is_idle) { size_t i; @@ -3113,9 +3116,25 @@ static void xmb_render(void *data, bool is_idle) bool mouse_enable = settings->bools.menu_mouse_enable; bool pointer_enable = settings->bools.menu_pointer_enable; - if (!xmb) + unsigned width, height; + float scale_factor; + + if (!xmb) return; + video_driver_get_size(&width, &height); + + scale_factor = (settings->uints.menu_xmb_scale_factor * (float)width) / (1920.0 * 100); + + if (scale_factor != xmb->previous_scale_factor && !xmb->context_just_reset) + xmb_context_reset_internal(xmb, video_driver_is_threaded(), + false); + + if (xmb->context_just_reset) + xmb->context_just_reset = false; + + xmb->previous_scale_factor = scale_factor; + delta.current = menu_animation_get_delta_time(); if (menu_animation_get_ideal_delta_time(&delta)) @@ -3320,9 +3339,6 @@ static void xmb_draw_dark_layer( menu_display_blend_end(video_info); } -static void xmb_context_reset_internal(xmb_handle_t *xmb, - bool is_threaded, bool reinit_textures); - static void xmb_frame(void *data, video_frame_info_t *video_info) { math_matrix_4x4 mymat; @@ -3352,15 +3368,6 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) scale_factor = (settings->uints.menu_xmb_scale_factor * (float)width) / (1920.0 * 100); pseudo_font_length = xmb->icon_spacing_horizontal * 4 - xmb->icon_size / 4; - if (scale_factor != xmb->previous_scale_factor && !xmb->context_just_reset) - xmb_context_reset_internal(xmb, video_driver_is_threaded(), - false); - - if (xmb->context_just_reset) - xmb->context_just_reset = false; - - xmb->previous_scale_factor = scale_factor; - xmb->frame_count++; msg[0] = '\0'; From 48dcd9640e3cae4f338c7799893ccab0db7dea11 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 26 Nov 2018 01:48:26 +0100 Subject: [PATCH 11/18] Remove this --- menu/drivers/xmb.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 34ce6f6e1f..ca036873f2 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -233,7 +233,6 @@ typedef struct xmb_handle { bool mouse_show; bool use_ps3_layout; - bool context_just_reset; uint8_t system_tab_end; uint8_t tabs[XMB_SYSTEM_TAB_MAX_LENGTH]; @@ -3126,13 +3125,10 @@ static void xmb_render(void *data, bool is_idle) scale_factor = (settings->uints.menu_xmb_scale_factor * (float)width) / (1920.0 * 100); - if (scale_factor != xmb->previous_scale_factor && !xmb->context_just_reset) + if (scale_factor != xmb->previous_scale_factor) xmb_context_reset_internal(xmb, video_driver_is_threaded(), false); - if (xmb->context_just_reset) - xmb->context_just_reset = false; - xmb->previous_scale_factor = scale_factor; delta.current = menu_animation_get_delta_time(); @@ -5139,7 +5135,6 @@ static void xmb_context_reset(void *data, bool is_threaded) if (xmb) { xmb_context_reset_internal(xmb, is_threaded, true); - xmb->context_just_reset = true; } } From 83bf27ac9bb0a1739081f1b108578a1a7381c579 Mon Sep 17 00:00:00 2001 From: DEX357 Date: Mon, 26 Nov 2018 12:10:50 +0100 Subject: [PATCH 12/18] Update msg_hash_pl.h --- intl/msg_hash_pl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index e510a17a18..bc78042eb3 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3798,4 +3798,4 @@ MSG_HASH( "Brak ulubionych." ) MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, - "Remember Window Position and Size") + "ZapamiÄ™taj poÅ‚ożenie i rozmiar okna") From 136a9db13f8c67309288e3229b4faf612a12744e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 26 Nov 2018 12:14:13 +0100 Subject: [PATCH 13/18] Silence warning - variable too small --- cheevos/cheevos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index c4f637255f..18535b4232 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -1666,7 +1666,7 @@ static void cheevos_test_cheevo_set(const cheevoset_t *set) if (settings && settings->bools.cheevos_auto_screenshot) { - char shotname[256]; + char shotname[4200]; snprintf(shotname, sizeof(shotname), "%s/%s-cheevo-%u", settings->paths.directory_screenshot, From 098e62067e50a29f4fef9a09a1fbce818e01d9e0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 26 Nov 2018 13:37:35 +0100 Subject: [PATCH 14/18] Small cleanups --- gfx/common/x11_common.c | 9 +++++---- gfx/drivers_context/x_ctx.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gfx/common/x11_common.c b/gfx/common/x11_common.c index d8d3a353dd..d5cca29249 100644 --- a/gfx/common/x11_common.c +++ b/gfx/common/x11_common.c @@ -134,7 +134,8 @@ void x11_move_window(Display *dpy, Window win, int x, int y, { XEvent xev = {0}; - XA_NET_MOVERESIZE_WINDOW = XInternAtom(dpy, "_NET_MOVERESIZE_WINDOW", False); + XA_NET_MOVERESIZE_WINDOW = XInternAtom(dpy, + "_NET_MOVERESIZE_WINDOW", False); xev.xclient.type = ClientMessage; xev.xclient.send_event = True; @@ -170,12 +171,12 @@ static void x11_set_window_pid(Display *dpy, Window win) XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&pid, 1); errno = 0; - if((scret = sysconf(_SC_HOST_NAME_MAX)) == -1 && errno) + if ((scret = sysconf(_SC_HOST_NAME_MAX)) == -1 && errno) return; - if((hostname = (char*)malloc(scret + 1)) == NULL) + if ((hostname = (char*)malloc(scret + 1)) == NULL) return; - if(gethostname(hostname, scret + 1) == -1) + if (gethostname(hostname, scret + 1) == -1) RARCH_WARN("Failed to get hostname.\n"); else { diff --git a/gfx/drivers_context/x_ctx.c b/gfx/drivers_context/x_ctx.c index 4cd0388200..0f6296b820 100644 --- a/gfx/drivers_context/x_ctx.c +++ b/gfx/drivers_context/x_ctx.c @@ -1078,7 +1078,7 @@ static bool gfx_ctx_x_bind_api(void *data, enum gfx_ctx_api api, case GFX_CTX_OPENGL_ES_API: #ifdef HAVE_OPENGLES2 { - Display *dpy = XOpenDisplay(NULL); + Display *dpy = XOpenDisplay(NULL); const char *exts = glXQueryExtensionsString(dpy, DefaultScreen(dpy)); bool ret = exts && strstr(exts, "GLX_EXT_create_context_es2_profile"); From 6bf35ab6e84de5be4a0189c226ace16171d63802 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 26 Nov 2018 13:54:51 +0100 Subject: [PATCH 15/18] (x11_common.c) Cleanups --- gfx/common/x11_common.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/gfx/common/x11_common.c b/gfx/common/x11_common.c index d5cca29249..6007a9b794 100644 --- a/gfx/common/x11_common.c +++ b/gfx/common/x11_common.c @@ -753,22 +753,21 @@ bool x11_has_net_wm_fullscreen(Display *dpy) char *x11_get_wm_name(Display *dpy) { + Atom type; + int format; + Window window; Atom XA_NET_SUPPORTING_WM_CHECK = XInternAtom(g_x11_dpy, "_NET_SUPPORTING_WM_CHECK", False); Atom XA_NET_WM_NAME = XInternAtom(g_x11_dpy, "_NET_WM_NAME", False); Atom XA_UTF8_STRING = XInternAtom(g_x11_dpy, "UTF8_STRING", False); - int status; - Atom type; - int format; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *propdata; - char *title; - Window window; + unsigned long nitems = 0; + unsigned long bytes_after = 0; + char *title = NULL; + unsigned char *propdata = NULL; if (!XA_NET_SUPPORTING_WM_CHECK || !XA_NET_WM_NAME) return NULL; - status = XGetWindowProperty(dpy, + if (!(XGetWindowProperty(dpy, DefaultRootWindow(dpy), XA_NET_SUPPORTING_WM_CHECK, 0, @@ -779,16 +778,15 @@ char *x11_get_wm_name(Display *dpy) &format, &nitems, &bytes_after, - &propdata); + &propdata) == Success && + propdata)) + return NULL; - if (status == Success && propdata) - window = ((Window *) propdata)[0]; - else - return NULL; + window = ((Window *) propdata)[0]; XFree(propdata); - status = XGetWindowProperty(dpy, + if (!(XGetWindowProperty(dpy, window, XA_NET_WM_NAME, 0, @@ -799,13 +797,11 @@ char *x11_get_wm_name(Display *dpy) &format, &nitems, &bytes_after, - &propdata); - - if (status == Success && propdata) - title = strdup((char *) propdata); - else - return NULL; + &propdata) == Success + && propdata)) + return NULL; + title = strdup((char *) propdata); XFree(propdata); return title; From 04797d940667cdb5a100782458adbb23bed865a7 Mon Sep 17 00:00:00 2001 From: natinusala Date: Mon, 26 Nov 2018 14:01:56 +0100 Subject: [PATCH 16/18] ozone: fix flickering sidebar cursor --- menu/drivers/ozone/ozone.c | 1 - 1 file changed, 1 deletion(-) diff --git a/menu/drivers/ozone/ozone.c b/menu/drivers/ozone/ozone.c index 556b59fe20..a35feded9e 100644 --- a/menu/drivers/ozone/ozone.c +++ b/menu/drivers/ozone/ozone.c @@ -812,7 +812,6 @@ static void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozo else { ozone->selection_old = ozone->selection; - ozone->animations.cursor_alpha = 1.0f; ozone->animations.scroll_y = new_scroll; } } From e13efbd40046aac507d27e58a7767dd1f6805530 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 26 Nov 2018 17:39:04 +0100 Subject: [PATCH 17/18] Change custom_command_method_t returntype to int64_t --- gfx/drivers/d3d9.c | 4 ++-- gfx/drivers/gl.c | 8 ++++---- gfx/video_thread_wrapper.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gfx/drivers/d3d9.c b/gfx/drivers/d3d9.c index a383190b48..407f9731f1 100644 --- a/gfx/drivers/d3d9.c +++ b/gfx/drivers/d3d9.c @@ -1990,14 +1990,14 @@ static void d3d9_video_texture_load_d3d( *id = (uintptr_t)tex; } -static int d3d9_video_texture_load_wrap_d3d(void *data) +static int64_t d3d9_video_texture_load_wrap_d3d(void *data) { uintptr_t id = 0; struct d3d9_texture_info *info = (struct d3d9_texture_info*)data; if (!info) return 0; d3d9_video_texture_load_d3d(info, &id); - return id; + return (int64_t)(uintptr_t)id; } static uintptr_t d3d9_load_texture(void *video_data, void *data, diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index f9b93604fd..1c523db69d 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -2509,7 +2509,7 @@ static void video_texture_load_gl( } #ifdef HAVE_THREADS -static int video_texture_load_wrap_gl_mipmap(void *data) +static int64_t video_texture_load_wrap_gl_mipmap(void *data) { uintptr_t id = 0; @@ -2517,10 +2517,10 @@ static int video_texture_load_wrap_gl_mipmap(void *data) return 0; video_texture_load_gl((struct texture_image*)data, TEXTURE_FILTER_MIPMAP_LINEAR, &id); - return (int)id; + return (int64_t)(uintptr_t)id; } -static int video_texture_load_wrap_gl(void *data) +static int64_t video_texture_load_wrap_gl(void *data) { uintptr_t id = 0; @@ -2528,7 +2528,7 @@ static int video_texture_load_wrap_gl(void *data) return 0; video_texture_load_gl((struct texture_image*)data, TEXTURE_FILTER_LINEAR, &id); - return (int)id; + return (int64_t)(uintptr_t)id; } #endif diff --git a/gfx/video_thread_wrapper.h b/gfx/video_thread_wrapper.h index 3fd306590a..300517659c 100644 --- a/gfx/video_thread_wrapper.h +++ b/gfx/video_thread_wrapper.h @@ -27,7 +27,7 @@ RETRO_BEGIN_DECLS -typedef int (*custom_command_method_t)(void*); +typedef int64_t (*custom_command_method_t)(void*); typedef bool (*custom_font_command_method_t)(const void **font_driver, void **font_handle, void *video_data, const char *font_path, From c16a3a6b88b0ec4fb8538db7d967c828c240a9e5 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 26 Nov 2018 19:26:32 +0100 Subject: [PATCH 18/18] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 2621139e06..2bbfd5534d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ - SWITCH: Proper button labels. - VULKAN: Fix RGUI crashing at startup. - VULKAN: Fix secondary screens in overlays not working. +- WAYLAND: Implement idle-inhibit support (needed for screensaver suspend). - WINDOWS/WSA: Network Information info is blank until first network operation. - WIIU: Initial netplay peer-to-peer support. Network information working.