diff --git a/.gitignore b/.gitignore index 1773b66a74..369bb4d452 100644 --- a/.gitignore +++ b/.gitignore @@ -163,7 +163,13 @@ retroarch_switch.lst retroarch_switch.nacp retroarch_switch.nro retroarch_switch.nso -/pkg/msvc/x64/Debug QT -/pkg/msvc/msvc-2017/x64/Debug QT -/pkg/msvc/msvc-2017/MetaObjects -/.vs + +# Wayland +gfx/common/wayland/idle-inhibit-unstable-v1.c +gfx/common/wayland/idle-inhibit-unstable-v1.h +gfx/common/wayland/xdg-shell-unstable-v6.c +gfx/common/wayland/xdg-shell-unstable-v6.h +gfx/common/wayland/xdg-decoration-unstable-v1.h +gfx/common/wayland/xdg-decoration-unstable-v1.c +gfx/common/wayland/xdg-shell.c +gfx/common/wayland/xdg-shell.h diff --git a/.vscode/settings.json b/.vscode/settings.json index c44832dca4..386e8341f9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -41,6 +41,8 @@ "ozone_texture.h": "c", "string_list.h": "c", "core_info.h": "c" + "thread": "c", + "xlocale": "c" }, "C_Cpp.dimInactiveRegions": false, } \ No newline at end of file diff --git a/10bpc-gl.diff b/10bpc-gl.diff new file mode 100644 index 0000000000..9436f12f82 --- /dev/null +++ b/10bpc-gl.diff @@ -0,0 +1,96 @@ +diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c +index b90a8e40c3..e57c4df194 100644 +--- a/gfx/drivers_context/wgl_ctx.c ++++ b/gfx/drivers_context/wgl_ctx.c +@@ -78,6 +78,47 @@ + #ifndef WGL_CONTEXT_DEBUG_BIT_ARB + #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 + #endif ++ ++#ifndef WGL_ACCELERATION_ARB ++#define WGL_ACCELERATION_ARB 0x2003 ++#endif ++ ++#ifndef WGL_FULL_ACCELERATION_ARB ++#define WGL_FULL_ACCELERATION_ARB 0x2027 ++#endif ++ ++#ifndef WGL_DRAW_TO_WINDOW_ARB ++#define WGL_DRAW_TO_WINDOW_ARB 0x2001 ++#endif ++ ++#ifndef WGL_DOUBLE_BUFFER_ARB ++#define WGL_DOUBLE_BUFFER_ARB 0x2011 ++#endif ++ ++#ifndef WGL_RED_BITS_ARB ++#define WGL_RED_BITS_ARB 0x2015 ++#endif ++ ++#ifndef WGL_GREEN_BITS_ARB ++#define WGL_GREEN_BITS_ARB 0x2017 ++#endif ++ ++#ifndef WGL_BLUE_BITS_ARB ++#define WGL_BLUE_BITS_ARB 0x2019 ++#endif ++ ++#ifndef WGL_ALPHA_BITS_ARB ++#define WGL_ALPHA_BITS_ARB 0x201B ++#endif ++ ++#ifndef WGL_PIXEL_TYPE_ARB ++#define WGL_PIXEL_TYPE_ARB 0x2013 ++#endif ++ ++#ifndef WGL_TYPE_RGBA_ARB ++#define WGL_TYPE_RGBA_ARB 0x202B ++#endif ++ + #endif + + #if defined(HAVE_OPENGL) +@@ -313,6 +354,43 @@ static void create_gl_context(HWND hwnd, bool *quit) + RARCH_LOG("[WGL]: Adaptive VSync supported.\n"); + wgl_adaptive_vsync = true; + } ++ if (wgl_has_extension("WGL_ARB_pixel_format", extensions)) ++ { ++ BOOL (WINAPI * wglChoosePixelFormatARB) ++ (HDC hdc, ++ const int *piAttribIList, ++ const FLOAT *pfAttribFList, ++ UINT nMaxFormats, ++ int *piFormats, ++ UINT *nNumFormats); ++ UINT nMatchingFormats; ++ int index = 0; ++ int attribsDesired[] = { ++ WGL_DRAW_TO_WINDOW_ARB, 1, ++ WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB, ++ WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB, ++ WGL_RED_BITS_ARB, 10, ++ WGL_GREEN_BITS_ARB, 10, ++ WGL_BLUE_BITS_ARB, 10, ++ WGL_ALPHA_BITS_ARB, 2, ++ WGL_DOUBLE_BUFFER_ARB, 1, ++ 0,0 ++ }; ++ wglChoosePixelFormatARB = (BOOL (WINAPI *) (HDC, const int *, ++ const FLOAT*, UINT, int*, UINT*)) ++ gfx_ctx_wgl_get_proc_address("wglChoosePixelFormatARB"); ++ ++ RARCH_LOG("[WGL]: ARB pixel format supported.\n"); ++ ++ if (wglChoosePixelFormatARB(win32_hdc, attribsDesired, ++ NULL, 1, &index, &nMatchingFormats)) ++ { ++ if (nMatchingFormats == 0) ++ { ++ RARCH_WARN("No 10bpc WGL_ARB_pixel_formats found!\n"); ++ } ++ } ++ } + } + } + #endif 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. diff --git a/Makefile.common b/Makefile.common index 5bf02a93ab..283c95bb72 100644 --- a/Makefile.common +++ b/Makefile.common @@ -863,13 +863,18 @@ ifeq ($(TARGET), retroarch_switch) endif ifeq ($(HAVE_WAYLAND), 1) - OBJ += gfx/drivers_context/wayland_ctx.o \ - input/drivers/wayland_input.o - ifeq ($(HAVE_EGL), 1) - LIBS += $(EGL_LIBS) - endif - DEFINES += $(WAYLAND_CFLAGS) $(WAYLAND_CURSOR_CFLAGS) - LIBS += $(WAYLAND_LIBS) $(WAYLAND_CURSOR_LIBS) + OBJ += gfx/drivers_context/wayland_ctx.o \ + input/drivers/wayland_input.o \ + gfx/common/wayland/xdg-shell.o \ + gfx/common/wayland/xdg-shell-unstable-v6.o \ + gfx/common/wayland/idle-inhibit-unstable-v1.o \ + gfx/common/wayland/xdg-decoration-unstable-v1.o + ifeq ($(HAVE_EGL), 1) + LIBS += $(EGL_LIBS) + endif + DEFINES += $(WAYLAND_CFLAGS) $(WAYLAND_CURSOR_CFLAGS) + LIBS += $(WAYLAND_LIBS) $(WAYLAND_CURSOR_LIBS) + endif #Input @@ -900,7 +905,7 @@ ifeq ($(HAVE_X11), 1) gfx/common/xinerama_common.o \ gfx/display_servers/dispserv_x11.o - LIBS += $(X11_LIBS) $(XEXT_LIBS) $(XF86VM_LIBS) $(XINERAMA_LIBS) + LIBS += $(X11_LIBS) $(XEXT_LIBS) $(XF86VM_LIBS) $(XINERAMA_LIBS) $(XRANDR_LIBS) DEFINES += -DHAVE_X11 $(X11_CFLAGS) $(XEXT_CFLAGS) $(XF86VM_CFLAGS) $(XINERAMA_CFLAGS) ifeq ($(HAVE_XCB),1) LIBS += -lX11-xcb diff --git a/audio/drivers/gx_audio.c b/audio/drivers/gx_audio.c index f28cd06bdc..e41f15f916 100644 --- a/audio/drivers/gx_audio.c +++ b/audio/drivers/gx_audio.c @@ -39,7 +39,6 @@ typedef struct volatile unsigned dma_write; size_t write_ptr; - OSCond cond; bool nonblock; bool is_paused; } gx_audio_t; @@ -63,8 +62,6 @@ static void dma_callback(void) DCFlushRange(wa->data[wa->dma_next], CHUNK_SIZE); AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE); - - OSSignalCond(wa->cond); } static void *gx_audio_init(const char *device, @@ -95,8 +92,6 @@ static void *gx_audio_init(const char *device, *new_rate = 48000; } - OSInitThreadQueue(&wa->cond); - wa->dma_write = BLOCKS - 1; DCFlushRange(wa->data, sizeof(wa->data)); stop_audio = false; @@ -133,8 +128,7 @@ static ssize_t gx_audio_write(void *data, const void *buf_, size_t size) /* FIXME: Nonblocking audio should break out of loop * when it has nothing to write. */ while ((wa->dma_write == wa->dma_next || - wa->dma_write == wa->dma_busy) && !wa->nonblock) - OSSleepThread(wa->cond); + wa->dma_write == wa->dma_busy) && !wa->nonblock); copy_swapped(wa->data[wa->dma_write] + wa->write_ptr, buf, to_write); @@ -205,10 +199,6 @@ static void gx_audio_free(void *data) AIStopDMA(); AIRegisterDMACallback(NULL); - if (wa->cond) - OSCloseThreadQueue(wa->cond); - wa->cond = 0; - free(data); } 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, diff --git a/command.c b/command.c index a87a52e1e4..0f0ad1969d 100644 --- a/command.c +++ b/command.c @@ -220,6 +220,7 @@ static const struct cmd_map map[] = { { "SCREENSHOT", RARCH_SCREENSHOT }, { "MUTE", RARCH_MUTE }, { "OSK", RARCH_OSK }, + { "FPS_TOGGLE", RARCH_FPS_TOGGLE }, { "NETPLAY_GAME_WATCH", RARCH_NETPLAY_GAME_WATCH }, { "VOLUME_UP", RARCH_VOLUME_UP }, { "VOLUME_DOWN", RARCH_VOLUME_DOWN }, @@ -1899,7 +1900,10 @@ bool command_event(enum event_command cmd, void *data) break; case CMD_EVENT_LOAD_CORE: { - bool success = command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL); + bool success = false; + subsystem_current_count = 0; + content_clear_subsystem(); + success = command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL); (void)success; #ifndef HAVE_DYNAMIC @@ -2019,8 +2023,10 @@ bool command_event(enum event_command cmd, void *data) command_event(CMD_EVENT_RESTORE_REMAPS, NULL); if (is_inited) + { if (!task_push_start_dummy_core(&content_info)) return false; + } #ifdef HAVE_DYNAMIC path_clear(RARCH_PATH_CORE); rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL); @@ -2037,6 +2043,11 @@ bool command_event(enum event_command cmd, void *data) command_event(CMD_EVENT_DISCORD_UPDATE, &userdata); } #endif + if (is_inited) + { + subsystem_current_count = 0; + content_clear_subsystem(); + } } break; case CMD_EVENT_QUIT: @@ -2177,6 +2188,12 @@ TODO: Add a setting for these tweaks */ RARCH_LOG("%s\n", msg); } break; + case CMD_EVENT_FPS_TOGGLE: + { + settings_t *settings = config_get_ptr(); + settings->bools.video_fps_show = !(settings->bools.video_fps_show); + } + break; case CMD_EVENT_OVERLAY_DEINIT: #ifdef HAVE_OVERLAY input_overlay_free(overlay_ptr); @@ -2728,9 +2745,12 @@ TODO: Add a setting for these tweaks */ settings_t *settings = config_get_ptr(); bool new_fullscreen_state = !settings->bools.video_fullscreen && !retroarch_is_forced_fullscreen(); + if (!video_driver_has_windowed()) return false; + retroarch_set_switching_display_mode(); + /* we toggled manually, write the new value to settings */ configuration_set_bool(settings, settings->bools.video_fullscreen, new_fullscreen_state); @@ -2746,6 +2766,8 @@ TODO: Add a setting for these tweaks */ video_driver_hide_mouse(); else video_driver_show_mouse(); + + retroarch_unset_switching_display_mode(); } break; case CMD_EVENT_COMMAND_DEINIT: diff --git a/command.h b/command.h index 134504cadb..7659ea605a 100644 --- a/command.h +++ b/command.h @@ -85,6 +85,8 @@ enum event_command CMD_EVENT_AUDIO_START, /* Mutes audio. */ CMD_EVENT_AUDIO_MUTE_TOGGLE, + /* Toggles FPS counter. */ + CMD_EVENT_FPS_TOGGLE, /* Initializes overlay. */ CMD_EVENT_OVERLAY_INIT, /* Deinitializes overlay. */ diff --git a/config.def.h b/config.def.h index f0ee60d58b..f3dcfa0078 100644 --- a/config.def.h +++ b/config.def.h @@ -117,14 +117,18 @@ static const unsigned monitor_index = 0; /* Window */ /* Window size. A value of 0 uses window scale * multiplied by the core framebuffer size. */ -static const unsigned window_x = 0; -static const unsigned window_y = 0; +static const unsigned window_width = 1280; +static const unsigned window_height = 720; /* Fullscreen resolution. A value of 0 uses the desktop * resolution. */ 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. */ @@ -236,10 +240,15 @@ static const float aspect_ratio = DEFAULT_ASPECT_RATIO; /* 1:1 PAR */ static const bool aspect_ratio_auto = false; -#if defined(__CELLOS_LV2) || defined(_XBOX360) || defined(ANDROID_AARCH64) +#if defined(__CELLOS_LV2) || defined(_XBOX360) static unsigned aspect_ratio_idx = ASPECT_RATIO_16_9; #elif defined(PSP) static unsigned aspect_ratio_idx = ASPECT_RATIO_CORE; +#elif defined(_3DS) +/* Previously defaulted to ASPECT_RATIO_4_3. + * Non-4:3 content looks dreadful when stretched + * to 4:3 on the 3DS screen... */ +static unsigned aspect_ratio_idx = ASPECT_RATIO_CORE; #elif defined(RARCH_CONSOLE) static unsigned aspect_ratio_idx = ASPECT_RATIO_4_3; #else @@ -276,6 +285,7 @@ static bool quick_menu_show_take_screenshot = true; static bool quick_menu_show_save_load_state = true; static bool quick_menu_show_undo_save_load_state = true; static bool quick_menu_show_add_to_favorites = true; +static bool quick_menu_show_reset_core_association = true; static bool quick_menu_show_options = true; static bool quick_menu_show_controls = true; static bool quick_menu_show_cheats = true; @@ -545,8 +555,11 @@ static const int wasapi_sh_buffer_length = -16; /* auto */ /* Enables displaying the current frames per second. */ static const bool fps_show = false; -/* Show frame count on FPS display */ -static const bool framecount_show = true; +/* Enables displaying the current frame count. */ +static const bool framecount_show = false; + +/* Includes displaying the current memory usage/total with FPS/Frames. */ +static const bool memory_show = false; /* Enables use of rewind. This will incur some memory footprint * depending on the save state buffer. */ @@ -577,7 +590,13 @@ static const bool pause_nonactive = true; /* Saves non-volatile SRAM at a regular interval. * It is measured in seconds. A value of 0 disables autosave. */ +#if defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(__x86_64__) || defined(_M_X64) || defined(_WIN32) || defined(OSX) || defined(ANDROID) || defined(IOS) +/* Flush to file every 10 seconds on modern platforms by default */ +static const unsigned autosave_interval = 10; +#else +/* Default to disabled on I/O-constrained platforms */ static const unsigned autosave_interval = 0; +#endif /* Publicly announce netplay */ static const bool netplay_public_announce = true; diff --git a/config.def.keybinds.h b/config.def.keybinds.h index 169cc7b5fc..c2994122a3 100644 --- a/config.def.keybinds.h +++ b/config.def.keybinds.h @@ -87,6 +87,7 @@ static const struct retro_keybind retro_keybinds_1[] = { { true, RARCH_SCREENSHOT, MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE }, { true, RARCH_MUTE, MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE }, { true, RARCH_OSK, MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE }, + { true, RARCH_FPS_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE }, { true, RARCH_NETPLAY_GAME_WATCH, MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE }, { true, RARCH_ENABLE_HOTKEY, MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE }, { true, RARCH_VOLUME_UP, MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE }, @@ -165,6 +166,7 @@ static const struct retro_keybind retro_keybinds_1[] = { { true, RARCH_SCREENSHOT, MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, RETROK_F8, NO_BTN, NO_BTN, 0, AXIS_NONE }, { true, RARCH_MUTE, MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE, RETROK_F9, NO_BTN, NO_BTN, 0, AXIS_NONE }, { true, RARCH_OSK, MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, RETROK_F12, NO_BTN, NO_BTN, 0, AXIS_NONE }, + { true, RARCH_FPS_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE, RETROK_F3, NO_BTN, NO_BTN, 0, AXIS_NONE }, { true, RARCH_NETPLAY_GAME_WATCH, MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, RETROK_i, NO_BTN, NO_BTN, 0, AXIS_NONE }, { true, RARCH_ENABLE_HOTKEY, MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, RETROK_UNKNOWN, NO_BTN, NO_BTN, 0, AXIS_NONE }, { true, RARCH_VOLUME_UP, MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, RETROK_KP_PLUS, NO_BTN, NO_BTN, 0, AXIS_NONE }, diff --git a/configuration.c b/configuration.c index 299f475e99..b8d3896d3f 100644 --- a/configuration.c +++ b/configuration.c @@ -543,6 +543,9 @@ static enum location_driver_enum LOCATION_DEFAULT_DRIVER = LOCATION_CORELOCATION static enum location_driver_enum LOCATION_DEFAULT_DRIVER = LOCATION_NULL; #endif +#if defined(_3DS) && defined(HAVE_RGUI) +static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_RGUI; +#else #if defined(HAVE_XUI) static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XUI; #elif defined(HAVE_MATERIALUI) && defined(RARCH_MOBILE) @@ -556,7 +559,7 @@ static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_RGUI; #else static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_NULL; #endif - +#endif #define GENERAL_SETTING(key, configval, default_enable, default_setting, type, handle_setting) \ { \ @@ -678,7 +681,7 @@ const char *config_get_default_audio(void) case AUDIO_PS2: return "ps2"; case AUDIO_CTR: - return "csnd"; + return "dsp"; case AUDIO_SWITCH: return "switch"; case AUDIO_RWEBAUDIO: @@ -1317,7 +1320,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("builtin_imageviewer_enable", &settings->bools.multimedia_builtin_imageviewer_enable, true, true, false); SETTING_BOOL("fps_show", &settings->bools.video_fps_show, true, false, false); SETTING_BOOL("statistics_show", &settings->bools.video_statistics_show, true, false, false); - SETTING_BOOL("framecount_show", &settings->bools.video_framecount_show, true, true, false); + SETTING_BOOL("framecount_show", &settings->bools.video_framecount_show, true, false, false); + SETTING_BOOL("memory_show", &settings->bools.video_memory_show, true, false, false); SETTING_BOOL("ui_menubar_enable", &settings->bools.ui_menubar_enable, true, true, false); SETTING_BOOL("suspend_screensaver_enable", &settings->bools.ui_suspend_screensaver_enable, true, true, false); SETTING_BOOL("rewind_enable", &settings->bools.rewind_enable, true, rewind_enable, false); @@ -1398,6 +1402,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("quick_menu_show_save_load_state", &settings->bools.quick_menu_show_save_load_state, true, quick_menu_show_save_load_state, false); SETTING_BOOL("quick_menu_show_undo_save_load_state", &settings->bools.quick_menu_show_undo_save_load_state, true, quick_menu_show_undo_save_load_state, false); SETTING_BOOL("quick_menu_show_add_to_favorites", &settings->bools.quick_menu_show_add_to_favorites, true, quick_menu_show_add_to_favorites, false); + SETTING_BOOL("quick_menu_show_reset_core_association", &settings->bools.quick_menu_show_reset_core_association, true, quick_menu_show_reset_core_association, false); SETTING_BOOL("quick_menu_show_options", &settings->bools.quick_menu_show_options, true, quick_menu_show_options, false); SETTING_BOOL("quick_menu_show_controls", &settings->bools.quick_menu_show_controls, true, quick_menu_show_controls, false); SETTING_BOOL("quick_menu_show_cheats", &settings->bools.quick_menu_show_cheats, true, quick_menu_show_cheats, false); @@ -1514,6 +1519,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("video_msg_bgcolor_enable", &settings->bools.video_msg_bgcolor_enable, true, message_bgcolor_enable, false); SETTING_BOOL("video_window_show_decorations", &settings->bools.video_window_show_decorations, true, window_decorations, false); + SETTING_BOOL("video_window_save_positions", &settings->bools.video_window_save_positions, true, false, false); SETTING_BOOL("sustained_performance_mode", &settings->bools.sustained_performance_mode, true, sustained_performance_mode, false); @@ -1589,8 +1595,6 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, SETTING_UINT("video_monitor_index", &settings->uints.video_monitor_index, true, monitor_index, false); SETTING_UINT("video_fullscreen_x", &settings->uints.video_fullscreen_x, true, fullscreen_x, false); SETTING_UINT("video_fullscreen_y", &settings->uints.video_fullscreen_y, true, fullscreen_y, false); - SETTING_UINT("video_window_x", &settings->uints.video_window_x, true, fullscreen_x, false); - SETTING_UINT("video_window_y", &settings->uints.video_window_y, true, fullscreen_y, false); SETTING_UINT("video_window_opacity", &settings->uints.video_window_opacity, true, window_opacity, false); #ifdef HAVE_COMMAND SETTING_UINT("network_cmd_port", &settings->uints.network_cmd_port, true, network_cmd_port, false); @@ -1672,6 +1676,16 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, SETTING_UINT("video_stream_quality", &settings->uints.video_stream_quality, true, RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY, false); SETTING_UINT("video_record_scale_factor", &settings->uints.video_record_scale_factor, true, 1, false); SETTING_UINT("video_stream_scale_factor", &settings->uints.video_stream_scale_factor, true, 1, false); + SETTING_UINT("video_windowed_position_x", &settings->uints.window_position_x, true, 0, false); + SETTING_UINT("video_windowed_position_y", &settings->uints.window_position_y, true, 0, false); + 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); + +#ifdef HAVE_LIBNX + SETTING_UINT("libnx_overclock", &settings->uints.libnx_overclock, true, SWITCH_DEFAULT_CPU_PROFILE, false); +#endif *size = count; @@ -3127,6 +3141,12 @@ static bool config_load_file(const char *path, bool set_defaults, strlcpy(settings->arrays.menu_driver, "rgui", sizeof(settings->arrays.menu_driver)); #endif +#ifdef HAVE_LIBNX + // Apply initial clocks + extern void libnx_apply_overclock(); + libnx_apply_overclock(); +#endif + frontend_driver_set_sustained_performance_mode(settings->bools.sustained_performance_mode); recording_driver_update_streaming_url(); diff --git a/configuration.h b/configuration.h index 5ca67844fb..16930cf1a1 100644 --- a/configuration.h +++ b/configuration.h @@ -103,6 +103,7 @@ typedef struct settings bool video_fps_show; bool video_statistics_show; bool video_framecount_show; + bool video_memory_show; bool video_msg_bgcolor_enable; bool video_3ds_lcd_bottom; @@ -183,6 +184,7 @@ typedef struct settings bool quick_menu_show_save_load_state; bool quick_menu_show_undo_save_load_state; bool quick_menu_show_add_to_favorites; + bool quick_menu_show_reset_core_association; bool quick_menu_show_options; bool quick_menu_show_controls; bool quick_menu_show_cheats; @@ -293,6 +295,7 @@ typedef struct settings bool automatically_add_content_to_playlist; bool video_window_show_decorations; + bool video_window_save_positions; bool sustained_performance_mode; } bools; @@ -372,8 +375,6 @@ typedef struct settings unsigned network_cmd_port; unsigned network_remote_base_port; unsigned keymapper_port; - unsigned video_window_x; - unsigned video_window_y; unsigned video_window_opacity; unsigned crt_switch_resolution; unsigned crt_switch_resolution_super; @@ -439,6 +440,15 @@ typedef struct settings unsigned midi_volume; unsigned streaming_mode; + + unsigned window_position_x; + unsigned window_position_y; + unsigned window_position_width; + unsigned window_position_height; + + unsigned video_record_threads; + + unsigned libnx_overclock; } uints; struct diff --git a/dynamic.c b/dynamic.c index 04698748e3..274d5c61a5 100644 --- a/dynamic.c +++ b/dynamic.c @@ -176,12 +176,89 @@ void libretro_free_system_info(struct retro_system_info *info) static bool environ_cb_get_system_info(unsigned cmd, void *data) { + rarch_system_info_t *system = runloop_get_system_info(); switch (cmd) { case RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME: *load_no_content_hook = *(const bool*)data; break; + case RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO: + { + unsigned i, j; + unsigned size = i; + const struct retro_subsystem_info *info = + (const struct retro_subsystem_info*)data; + subsystem_current_count = 0; + RARCH_LOG("Environ SET_SUBSYSTEM_INFO.\n"); + for (i = 0; info[i].ident; i++) + { + RARCH_LOG("Subsystem ID: %d\n", i); + RARCH_LOG("Special game type: %s\n", info[i].desc); + RARCH_LOG(" Ident: %s\n", info[i].ident); + RARCH_LOG(" ID: %u\n", info[i].id); + RARCH_LOG(" Content:\n"); + for (j = 0; j < info[i].num_roms; j++) + { + RARCH_LOG(" %s (%s)\n", + info[i].roms[j].desc, info[i].roms[j].required ? + "required" : "optional"); + } + } + + RARCH_LOG("Subsystems: %d\n", i); + size = i; + + if (size > SUBSYSTEM_MAX_SUBSYSTEMS) + RARCH_WARN("Subsystems exceed subsystem max, clamping to %d\n", SUBSYSTEM_MAX_SUBSYSTEMS); + + if (system) + { + for (i = 0; i < size && i < SUBSYSTEM_MAX_SUBSYSTEMS; i++) + { + subsystem_data[i].desc = strdup(info[i].desc); + subsystem_data[i].ident = strdup(info[i].ident); + subsystem_data[i].id = info[i].id; + subsystem_data[i].num_roms = info[i].num_roms; + + if (subsystem_data[i].num_roms > SUBSYSTEM_MAX_SUBSYSTEM_ROMS) + RARCH_WARN("Subsystems exceed subsystem max roms, clamping to %d\n", SUBSYSTEM_MAX_SUBSYSTEM_ROMS); + + for (j = 0; j < subsystem_data[i].num_roms && j < SUBSYSTEM_MAX_SUBSYSTEM_ROMS; j++) + { + subsystem_data_roms[i][j].desc = strdup(info[i].roms[j].desc); + subsystem_data_roms[i][j].valid_extensions = strdup(info[i].roms[j].valid_extensions); + subsystem_data_roms[i][j].required = info[i].roms[j].required; + subsystem_data_roms[i][j].block_extract = info[i].roms[j].block_extract; + subsystem_data_roms[i][j].need_fullpath = info[i].roms[j].need_fullpath; + } + subsystem_data[i].roms = subsystem_data_roms[i]; + } + + + subsystem_current_count = size <= SUBSYSTEM_MAX_SUBSYSTEMS ? size : SUBSYSTEM_MAX_SUBSYSTEMS; +#if 0 + RARCH_LOG("Subsystems: %d\n", subsystem_current_count); + + for (i = 0; i < subsystem_current_count; i++) + { + RARCH_LOG("Subsystem ID: %d\n", i); + RARCH_LOG("Special game type: %s\n", subsystem_data[i].desc); + RARCH_LOG(" Ident: %s\n", subsystem_data[i].ident); + RARCH_LOG(" ID: %u\n", subsystem_data[i].id); + RARCH_LOG(" Content:\n"); + + for (j = 0; j < subsystem_data[i].num_roms; j++) + { + RARCH_LOG(" %s (%s)\n", + subsystem_data[i].roms[j].desc, subsystem_data[i].roms[j].required ? + "required" : "optional"); + } + } +#endif + } + break; + } default: return false; } @@ -396,7 +473,6 @@ bool libretro_get_system_info(const char *path, #ifdef HAVE_DYNAMIC dylib_close(lib); #endif - return true; } @@ -1393,7 +1469,6 @@ bool rarch_environment_cb(unsigned cmd, void *data) cb, offsetof(struct retro_hw_render_callback, stencil)); memset(hwr + offsetof(struct retro_hw_render_callback, stencil), 0, sizeof(*cb) - offsetof(struct retro_hw_render_callback, stencil)); - } else memcpy(hwr, cb, sizeof(*cb)); diff --git a/dynamic.h b/dynamic.h index e930a2edc8..79b7d50fff 100644 --- a/dynamic.h +++ b/dynamic.h @@ -146,6 +146,15 @@ bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *cu **/ void uninit_libretro_sym(struct retro_core_t *core); +/* Arbitrary twenty subsystems limite */ +#define SUBSYSTEM_MAX_SUBSYSTEMS 20 +/* Arbitrary 10 roms for each subsystem limit */ +#define SUBSYSTEM_MAX_SUBSYSTEM_ROMS 10 + +struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS]; +struct retro_subsystem_rom_info subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS][SUBSYSTEM_MAX_SUBSYSTEM_ROMS]; +unsigned subsystem_current_count; + RETRO_END_DECLS #endif diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index 68110a0f28..58fb331736 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -240,13 +240,15 @@ static void frontend_ctr_exec(const char* path, bool should_load_game) } else { - RARCH_LOG("\n"); - RARCH_LOG("\n"); - RARCH_LOG("Warning:\n"); - RARCH_LOG("First core launch may take 20 seconds!\n"); - RARCH_LOG("Do not force quit before then or your memory card may be corrupted!\n"); - RARCH_LOG("\n"); - RARCH_LOG("\n"); + RARCH_WARN("\n"); + RARCH_WARN("\n"); + RARCH_WARN("Warning:\n"); + RARCH_WARN("First core launch may take 20\n"); + RARCH_WARN("seconds! Do not force quit\n"); + RARCH_WARN("before then or your memory\n"); + RARCH_WARN("card may be corrupted!\n"); + RARCH_WARN("\n"); + RARCH_WARN("\n"); exec_cia(path, arg_data); } @@ -356,6 +358,17 @@ static void ctr_check_dspfirm(void) } fclose(code_fp); } + else + { + RARCH_WARN("\n"); + RARCH_WARN("\n"); + RARCH_WARN("Warning:\n"); + RARCH_WARN("3DS DSP dump is missing.\n"); + RARCH_WARN("A working DSP dump is required\n"); + RARCH_WARN("for correct operation.\n"); + RARCH_WARN("\n"); + RARCH_WARN("\n"); + } } } diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index 756c9b8151..59e38b6d44 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -13,6 +13,9 @@ #ifdef HAVE_LIBNX #include +#include "../../switch_performance_profiles.h" +#include "../../configuration.h" +#include #else #include #include @@ -55,6 +58,8 @@ static const char *elf_path_cst = "/switch/retroarch_switch.nro"; static uint64_t frontend_switch_get_mem_used(void); +bool platform_switch_has_focus = true; + #ifdef HAVE_LIBNX /* Splash */ @@ -68,10 +73,46 @@ static AppletHookCookie applet_hook_cookie; extern bool nxlink_connected; #endif -static void on_applet_hook(AppletHookType hook, void* param) { - if(hook == AppletHookType_OnExitRequest) { +void libnx_apply_overclock() { + const size_t profiles_count = sizeof(SWITCH_CPU_PROFILES) / sizeof(SWITCH_CPU_PROFILES[1]); + if (config_get_ptr()->uints.libnx_overclock >= 0 && config_get_ptr()->uints.libnx_overclock <= profiles_count) + pcvSetClockRate(PcvModule_Cpu, SWITCH_CPU_SPEEDS_VALUES[config_get_ptr()->uints.libnx_overclock]); +} + +static void on_applet_hook(AppletHookType hook, void *param) { + u32 performance_mode; + AppletFocusState focus_state; + + /* Exit request */ + switch (hook) + { + case AppletHookType_OnExitRequest: RARCH_LOG("Got AppletHook OnExitRequest, exiting.\n"); retroarch_main_quit(); + break; + + /* Focus state*/ + case AppletHookType_OnFocusState: + focus_state = appletGetFocusState(); + RARCH_LOG("Got AppletHook OnFocusState - new focus state is %d\n", focus_state); + platform_switch_has_focus = focus_state == AppletFocusState_Focused; + if(!platform_switch_has_focus) { + pcvSetClockRate(PcvModule_Cpu, 1020000000); + } else { + libnx_apply_overclock(); + } + break; + + /* Performance mode */ + case AppletHookType_OnPerformanceMode: + // 0 == Handheld, 1 == Docked + // Since CPU doesn't change we just re-apply + performance_mode = appletGetPerformanceMode(); + libnx_apply_overclock(); + break; + + default: + break; } } @@ -201,6 +242,8 @@ static void frontend_switch_deinit(void *data) #ifdef HAVE_LIBNX nifmExit(); + pcvSetClockRate(PcvModule_Cpu, 1020000000); // Always 1020 MHz, unless SDEV + pcvExit(); #if defined(SWITCH) && defined(NXLINK) socketExit(); #endif @@ -225,7 +268,7 @@ static void frontend_switch_deinit(void *data) #ifdef HAVE_LIBNX static void frontend_switch_exec(const char *path, bool should_load_game) { - char game_path[PATH_MAX]; + char game_path[PATH_MAX-4]; const char *arg_data[3]; char error_string[200 + PATH_MAX]; int args = 0; @@ -613,14 +656,20 @@ static void frontend_switch_shutdown(bool unused) /* runloop_get_system_info isnt initialized that early.. */ extern void retro_get_system_info(struct retro_system_info *info); + static void frontend_switch_init(void *data) { + (void)data; #ifdef HAVE_LIBNX nifmInitialize(); + pcvInitialize(); + appletLockExit(); appletHook(&applet_hook_cookie, on_applet_hook, NULL); + appletSetFocusHandlingMode(AppletFocusHandlingMode_NoSuspend); + #ifndef HAVE_OPENGL /* Init Resolution before initDefault */ gfxInitResolution(1280, 720); @@ -631,7 +680,10 @@ static void frontend_switch_init(void *data) gfxConfigureTransform(0); #endif /* HAVE_OPENGL */ - appletInitializeGamePlayRecording(); + bool recording_supported = false; + appletIsGamePlayRecordingSupported(&recording_supported); + if(recording_supported) + appletInitializeGamePlayRecording(); #ifdef NXLINK socketInitializeDefault(); @@ -776,6 +828,8 @@ static enum frontend_powerstate frontend_switch_get_powerstate(int *seconds, int case ChargerType_Charger: case ChargerType_Usb: return FRONTEND_POWERSTATE_CHARGING; + default: + break; } return FRONTEND_POWERSTATE_NO_SOURCE; diff --git a/gfx/common/dxgi_common.c b/gfx/common/dxgi_common.c index e7065979fc..3d935f41d2 100644 --- a/gfx/common/dxgi_common.c +++ b/gfx/common/dxgi_common.c @@ -305,8 +305,9 @@ void dxgi_copy( void dxgi_update_title(video_frame_info_t* video_info) { const ui_window_t* window = ui_companion_driver_get_window_ptr(); + const settings_t *settings = config_get_ptr(); - if (video_info->fps_show) + if (settings->bools.video_memory_show) { MEMORYSTATUS stat; char mem[128]; @@ -315,7 +316,7 @@ void dxgi_update_title(video_frame_info_t* video_info) GlobalMemoryStatus(&stat); snprintf( - mem, sizeof(mem), "|| MEM: %.2f/%.2fMB", stat.dwAvailPhys / (1024.0f * 1024.0f), + mem, sizeof(mem), " || MEM: %.2f/%.2fMB", stat.dwAvailPhys / (1024.0f * 1024.0f), stat.dwTotalPhys / (1024.0f * 1024.0f)); strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text)); } diff --git a/gfx/common/egl_common.c b/gfx/common/egl_common.c index f3c579af21..348d1bafe4 100644 --- a/gfx/common/egl_common.c +++ b/gfx/common/egl_common.c @@ -309,13 +309,37 @@ static EGLDisplay get_egl_display(EGLenum platform, void *native) return eglGetDisplay((EGLNativeDisplayType) native); } +bool egl_default_accept_config_cb(void *display_data, EGLDisplay dpy, EGLConfig config) +{ + /* Makes sure we have 8 bit color. */ + EGLint r, g, b; + if (!eglGetConfigAttrib(dpy, config, EGL_RED_SIZE, &r)) + return false; + if (!eglGetConfigAttrib(dpy, config, EGL_GREEN_SIZE, &g)) + return false; + if (!eglGetConfigAttrib(dpy, config, EGL_BLUE_SIZE, &b)) + return false; + + if (r != 8 || g != 8 || b != 8) + return false; + + return true; +} + bool egl_init_context(egl_ctx_data_t *egl, EGLenum platform, void *display_data, EGLint *major, EGLint *minor, - EGLint *n, const EGLint *attrib_ptr) + EGLint *n, const EGLint *attrib_ptr, + egl_accept_config_cb_t cb) { - EGLDisplay dpy = get_egl_display(platform, display_data); + EGLint i; + EGLConfig *configs = NULL; + EGLint count = 0; + EGLint matched = 0; + int config_index = -1; + EGLDisplay dpy = get_egl_display(platform, display_data); + if (dpy == EGL_NO_DISPLAY) { RARCH_ERR("[EGL]: Couldn't get EGL display.\n"); @@ -329,8 +353,39 @@ bool egl_init_context(egl_ctx_data_t *egl, RARCH_LOG("[EGL]: EGL version: %d.%d\n", *major, *minor); - if (!eglChooseConfig(egl->dpy, attrib_ptr, &egl->config, 1, n) || *n != 1) + if (!eglGetConfigs(egl->dpy, NULL, 0, &count) || count < 1) + { + RARCH_ERR("[EGL]: No configs to choose from.\n"); return false; + } + + configs = malloc(count * sizeof(*configs)); + if (!configs) + return false; + + if (!eglChooseConfig(egl->dpy, attrib_ptr, + configs, count, &matched) || !matched) + { + RARCH_ERR("[EGL]: No EGL configs with appropriate attributes.\n"); + return false; + } + + for (i = 0; i < count; i++) + { + if (!cb || cb(display_data, egl->dpy, configs[i])) + { + egl->config = configs[i]; + break; + } + } + + free(configs); + + if (i == count) + { + RARCH_ERR("[EGL]: No EGL config found which satifies requirements.\n"); + return false; + } egl->major = g_egl_major; egl->minor = g_egl_minor; diff --git a/gfx/common/egl_common.h b/gfx/common/egl_common.h index 5481efc937..5fe4bec6e8 100644 --- a/gfx/common/egl_common.h +++ b/gfx/common/egl_common.h @@ -88,13 +88,17 @@ void egl_set_swap_interval(egl_ctx_data_t *egl, int interval); void egl_get_video_size(egl_ctx_data_t *egl, unsigned *width, unsigned *height); +typedef bool (*egl_accept_config_cb_t)(void *display_data, EGLDisplay dpy, EGLConfig config); +bool egl_default_accept_config_cb(void *display_data, EGLDisplay dpy, EGLConfig config); + bool egl_init_context(egl_ctx_data_t *egl, EGLenum platform, void *display_data, EGLint *major, EGLint *minor, EGLint *n, - const EGLint *attrib_ptr); + const EGLint *attrib_ptr, + egl_accept_config_cb_t cb); bool egl_create_context(egl_ctx_data_t *egl, const EGLint *egl_attribs); diff --git a/gfx/common/metal/Context.h b/gfx/common/metal/Context.h index 5068df92a2..2897367664 100644 --- a/gfx/common/metal/Context.h +++ b/gfx/common/metal/Context.h @@ -76,6 +76,7 @@ typedef struct /*! @brief end commits the command buffer */ - (void)end; +- (void)setRotation:(unsigned)rotation; - (bool)readBackBuffer:(uint8_t *)buffer; @end diff --git a/gfx/common/metal/Context.m b/gfx/common/metal/Context.m index 69d1c059f6..34fc099afc 100644 --- a/gfx/common/metal/Context.m +++ b/gfx/common/metal/Context.m @@ -53,10 +53,16 @@ id _states[GFX_MAX_SHADERS][2]; id _clearState; - Uniforms _uniforms; bool _captureEnabled; id _backBuffer; + + unsigned _rotation; + matrix_float4x4 _mvp_no_rot; + matrix_float4x4 _mvp; + + Uniforms _uniforms; + Uniforms _uniformsNoRotate; } - (instancetype)initWithDevice:(id)d @@ -75,6 +81,11 @@ _commandQueue = [_device newCommandQueue]; _clearColor = MTLClearColorMake(0, 0, 0, 1); _uniforms.projectionMatrix = matrix_proj_ortho(0, 1, 0, 1); + + _rotation = 0; + [self setRotation:0]; + _mvp_no_rot = matrix_proj_ortho(0, 1, 0, 1); + _mvp = matrix_proj_ortho(0, 1, 0, 1); { MTLSamplerDescriptor *sd = [MTLSamplerDescriptor new]; @@ -130,6 +141,27 @@ return &_uniforms; } +- (void)setRotation:(unsigned)rotation +{ + _rotation = 270 * rotation; + + /* Calculate projection. */ + _mvp_no_rot = matrix_proj_ortho(0, 1, 0, 1); + + bool allow_rotate = true; + if (!allow_rotate) + { + _mvp = _mvp_no_rot; + return; + } + + matrix_float4x4 rot = matrix_rotate_z((float)(M_PI * _rotation / 180.0f)); + _mvp = simd_mul(rot, _mvp_no_rot); + + _uniforms.projectionMatrix = _mvp; + _uniformsNoRotate.projectionMatrix = _mvp_no_rot; +} + - (void)setDisplaySyncEnabled:(bool)displaySyncEnabled { #if TARGET_OS_OSX diff --git a/gfx/common/metal/RendererCommon.h b/gfx/common/metal/RendererCommon.h index 977cf7b607..f0835f271e 100644 --- a/gfx/common/metal/RendererCommon.h +++ b/gfx/common/metal/RendererCommon.h @@ -55,6 +55,7 @@ typedef NS_ENUM(NSUInteger, RTextureFilter) }; extern matrix_float4x4 matrix_proj_ortho(float left, float right, float top, float bottom); +extern matrix_float4x4 matrix_rotate_z(float rot); extern matrix_float4x4 make_matrix_float4x4(const float *v); #endif /* RendererCommon_h */ diff --git a/gfx/common/metal/RendererCommon.m b/gfx/common/metal/RendererCommon.m index c3be58dc86..95ff5c889c 100644 --- a/gfx/common/metal/RendererCommon.m +++ b/gfx/common/metal/RendererCommon.m @@ -86,3 +86,17 @@ matrix_float4x4 matrix_proj_ortho(float left, float right, float top, float bott matrix_float4x4 mat = {P, Q, R, S}; return mat; } + +matrix_float4x4 matrix_rotate_z(float rot) +{ + float cz, sz; + __sincosf(rot, &sz, &cz); + + simd_float4 P = simd_make_float4(cz, -sz, 0, 0); + simd_float4 Q = simd_make_float4(sz, cz, 0, 0); + simd_float4 R = simd_make_float4( 0, 0, 1, 0); + simd_float4 S = simd_make_float4( 0, 0, 0, 1); + + matrix_float4x4 mat = {P, Q, R, S}; + return mat; +} diff --git a/gfx/common/metal_common.h b/gfx/common/metal_common.h index 66b7f08b92..4fbefa25ac 100644 --- a/gfx/common/metal_common.h +++ b/gfx/common/metal_common.h @@ -96,6 +96,8 @@ extern MTLPixelFormat SelectOptimalPixelFormat(MTLPixelFormat fmt); /*! @brief setNeedsResize triggers a display resize */ - (void)setNeedsResize; +- (void)setViewportWidth:(unsigned)width height:(unsigned)height forceFull:(BOOL)forceFull allowRotate:(BOOL)allowRotate; +- (void)setRotation:(unsigned)rotation; @end diff --git a/gfx/common/metal_common.m b/gfx/common/metal_common.m index 2c2129d911..d2afec6184 100644 --- a/gfx/common/metal_common.m +++ b/gfx/common/metal_common.m @@ -216,21 +216,19 @@ return YES; } -- (void)_updateUniforms +- (void)setViewportWidth:(unsigned)width height:(unsigned)height forceFull:(BOOL)forceFull allowRotate:(BOOL)allowRotate { - _uniforms.projectionMatrix = matrix_proj_ortho(0, 1, 0, 1); -} - -- (void)_updateViewport:(CGSize)size -{ - RARCH_LOG("[Metal]: _updateViewport size %.0fx%.0f\n", size.width, size.height); +#if 0 + RARCH_LOG("[Metal]: setViewportWidth size %dx%d\n", width, height); +#endif - _viewport->full_width = (unsigned int)size.width; - _viewport->full_height = (unsigned int)size.height; + _viewport->full_width = width; + _viewport->full_height = height; video_driver_set_size(&_viewport->full_width, &_viewport->full_height); - _layer.drawableSize = size; - video_driver_update_viewport(_viewport, NO, _keepAspect); + _layer.drawableSize = CGSizeMake(width, height); + video_driver_update_viewport(_viewport, forceFull, _keepAspect); + // update matrix _context.viewport = _viewport; _viewportMVP.outputSize = simd_make_float2(_viewport->full_width, _viewport->full_height); @@ -256,8 +254,10 @@ [self _beginFrame]; _frameView.frameCount = frameCount; - _frameView.size = CGSizeMake(width, height); - [_frameView updateFrame:data pitch:pitch]; + if (data && width && height) { + _frameView.size = CGSizeMake(width, height); + [_frameView updateFrame:data pitch:pitch]; + } [self _drawViews:video_info]; @@ -277,7 +277,7 @@ id rce = _context.rce; [rce pushDebugGroup:@"overlay"]; [rce setRenderPipelineState:[_context getStockShader:VIDEO_SHADER_STOCK_BLEND blend:YES]]; - [rce setVertexBytes:&_uniforms length:sizeof(_uniforms) atIndex:BufferIndexUniforms]; + [rce setVertexBytes:_context.uniforms length:sizeof(*_context.uniforms) atIndex:BufferIndexUniforms]; [rce setFragmentSamplerState:_samplerStateLinear atIndex:SamplerIndexDraw]; [_overlay drawWithEncoder:rce]; [rce popDebugGroup]; @@ -338,7 +338,6 @@ _context.viewport = _viewport; } [_context begin]; - [self _updateUniforms]; } - (void)_drawViews:(video_frame_info_t *)video_info @@ -351,7 +350,7 @@ if ((_frameView.drawState & ViewDrawStateEncoder) != 0) { - [rce setVertexBytes:&_uniforms length:sizeof(_uniforms) atIndex:BufferIndexUniforms]; + [rce setVertexBytes:_context.uniforms length:sizeof(*_context.uniforms) atIndex:BufferIndexUniforms]; [rce setRenderPipelineState:_t_pipelineStateNoAlpha]; if (_frameView.filter == RTextureFilterNearest) { @@ -410,6 +409,11 @@ // TODO(sgc): resize all drawables } +- (void)setRotation:(unsigned)rotation +{ + [_context setRotation:rotation]; +} + - (Uniforms *)viewportMVP { return &_viewportMVP; @@ -419,7 +423,7 @@ - (void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size { - [self _updateViewport:size]; + [self setViewportWidth:(unsigned int)size.width height:(unsigned int)size.height forceFull:NO allowRotate:YES]; } - (void)drawInMTKView:(MTKView *)view @@ -897,7 +901,7 @@ typedef struct MTLALIGN(16) rce = [cb renderCommandEncoderWithDescriptor:rpd]; } -#if METAL_DEBUG +#if DEBUG && METAL_DEBUG rce.label = [NSString stringWithFormat:@"pass %d", i]; #endif @@ -1126,6 +1130,8 @@ typedef struct MTLALIGN(16) texture_t *source = &_engine.frame.texture[0]; for (unsigned i = 0; i < shader->passes; source = &_engine.pass[i++].rt) { + matrix_float4x4 *mvp = (i == shader->passes-1) ? &_context.uniforms->projectionMatrix : &_engine.mvp; + /* clang-format off */ semantics_map_t semantics_map = { { @@ -1154,7 +1160,7 @@ typedef struct MTLALIGN(16) &_engine.luts[0].size_data, sizeof(*_engine.luts)}, }, { - &_engine.mvp, /* MVP */ + mvp, /* MVP */ &_engine.pass[i].rt.size_data, /* OutputSize */ &_engine.frame.output_size, /* FinalViewportSize */ &_engine.pass[i].frame_count, /* FrameCount */ diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index 24402cddba..9958f7526b 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -42,7 +42,7 @@ #define VENDOR_ID_NV 0x10DE #define VENDOR_ID_INTEL 0x8086 -#ifdef _WIN32 +#if defined(_WIN32) || defined(ANDROID) #define VULKAN_EMULATE_MAILBOX #endif diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index a66544af6a..69c9758819 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -342,6 +342,7 @@ typedef struct vk struct video_viewport vp; struct vk_per_frame *chain; struct vk_per_frame swapchain[VULKAN_MAX_SWAPCHAIN_IMAGES]; + struct vk_texture default_texture; /* Currently active command buffer. */ VkCommandBuffer cmd; diff --git a/gfx/common/wayland/generate_wayland_protos.sh b/gfx/common/wayland/generate_wayland_protos.sh new file mode 100755 index 0000000000..8c0cc7f155 --- /dev/null +++ b/gfx/common/wayland/generate_wayland_protos.sh @@ -0,0 +1,24 @@ +#!/bin/sh +WAYSCAN=/usr/bin/wayland-scanner +WAYLAND_PROTOS=/usr/share/wayland-protocols +OUTPUT=gfx/common/wayland + +if [ ! -d $OUTPUT ]; then + mkdir $OUTPUT +fi + +#Generate xdg-shell_v6 header and .c files +$WAYSCAN client-header $WAYLAND_PROTOS/unstable/xdg-shell/xdg-shell-unstable-v6.xml $OUTPUT/xdg-shell-unstable-v6.h +$WAYSCAN private-code $WAYLAND_PROTOS/unstable/xdg-shell/xdg-shell-unstable-v6.xml $OUTPUT/xdg-shell-unstable-v6.c + +#Generate xdg-shell header and .c files +$WAYSCAN client-header $WAYLAND_PROTOS/stable/xdg-shell/xdg-shell.xml $OUTPUT/xdg-shell.h +$WAYSCAN private-code $WAYLAND_PROTOS/stable/xdg-shell/xdg-shell.xml $OUTPUT/xdg-shell.c + +#Generate idle-inhibit header and .c files +$WAYSCAN client-header $WAYLAND_PROTOS/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml $OUTPUT/idle-inhibit-unstable-v1.h +$WAYSCAN private-code $WAYLAND_PROTOS/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml $OUTPUT/idle-inhibit-unstable-v1.c + +#Generate xdg-decoration header and .c files +$WAYSCAN client-header $WAYLAND_PROTOS/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml $OUTPUT/xdg-decoration-unstable-v1.h +$WAYSCAN private-code $WAYLAND_PROTOS/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml $OUTPUT/xdg-decoration-unstable-v1.c diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index b580a1bcb0..79f3dd6b9e 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -200,6 +200,8 @@ static bool g_win32_quit = false; static int g_win32_pos_x = CW_USEDEFAULT; static int g_win32_pos_y = CW_USEDEFAULT; +static unsigned g_win32_pos_width = 0; +static unsigned g_win32_pos_height = 0; unsigned g_win32_resize_width = 0; unsigned g_win32_resize_height = 0; @@ -617,6 +619,54 @@ static LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message, } #endif +static void win32_set_position_from_config(void) +{ + settings_t *settings = config_get_ptr(); + int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); + int title_bar_height = GetSystemMetrics(SM_CYCAPTION); + int menu_bar_height = GetSystemMetrics(SM_CYMENU); + if (!settings->bools.video_window_save_positions) + return; + + g_win32_pos_x = settings->uints.window_position_x; + g_win32_pos_y = settings->uints.window_position_y; + g_win32_pos_width = settings->uints.window_position_width + border_thickness * 2; + g_win32_pos_height= settings->uints.window_position_height + border_thickness * 2 + title_bar_height; +} + +static void win32_save_position(void) +{ + RECT rect; + int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); + int title_bar_height = GetSystemMetrics(SM_CYCAPTION); + int menu_bar_height = GetSystemMetrics(SM_CYMENU); + WINDOWPLACEMENT placement; + settings_t *settings = config_get_ptr(); + memset(&placement, 0, sizeof(placement)); + placement.length = sizeof(placement); + + GetWindowPlacement(main_window.hwnd, &placement); + + g_win32_pos_x = placement.rcNormalPosition.left; + g_win32_pos_y = placement.rcNormalPosition.top; + + if (GetWindowRect(main_window.hwnd, &rect)) + { + g_win32_pos_width = rect.right - rect.left; + g_win32_pos_height = rect.bottom - rect.top; + } + if (settings && settings->bools.video_window_save_positions) + { + if (!settings->bools.video_fullscreen && !retroarch_is_forced_fullscreen() && !retroarch_is_switching_display_mode()) + { + settings->uints.window_position_x = g_win32_pos_x; + settings->uints.window_position_y = g_win32_pos_y; + settings->uints.window_position_width = g_win32_pos_width - border_thickness * 2; + settings->uints.window_position_height = g_win32_pos_height - border_thickness * 2 - title_bar_height - (settings->bools.ui_menubar_enable ? menu_bar_height : 0); + } + } +} + static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { @@ -649,21 +699,16 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, *quit = true; return win32_handle_keyboard_event(hwnd, message, wparam, lparam); + case WM_MOVE: + win32_save_position(); + break; case WM_CLOSE: case WM_DESTROY: case WM_QUIT: - { - WINDOWPLACEMENT placement; - memset(&placement, 0, sizeof(placement)); - placement.length = sizeof(placement); + win32_save_position(); - GetWindowPlacement(main_window.hwnd, &placement); - - g_win32_pos_x = placement.rcNormalPosition.left; - g_win32_pos_y = placement.rcNormalPosition.top; - g_win32_quit = true; - *quit = true; - } + g_win32_quit = true; + *quit = true; break; case WM_SIZE: /* Do not send resize message if we minimize. */ @@ -680,7 +725,7 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, } *quit = true; break; - case WM_COMMAND: + case WM_COMMAND: { settings_t *settings = config_get_ptr(); if (settings && settings->bools.ui_menubar_enable) @@ -719,6 +764,7 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, case WM_CLOSE: case WM_DESTROY: case WM_QUIT: + case WM_MOVE: case WM_SIZE: case WM_COMMAND: ret = WndProcCommon(&quit, hwnd, message, wparam, lparam); @@ -779,6 +825,7 @@ LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message, case WM_CLOSE: case WM_DESTROY: case WM_QUIT: + case WM_MOVE: case WM_SIZE: case WM_COMMAND: ret = WndProcCommon(&quit, @@ -878,6 +925,7 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, case WM_CLOSE: case WM_DESTROY: case WM_QUIT: + case WM_MOVE: case WM_SIZE: case WM_COMMAND: ret = WndProcCommon(&quit, hwnd, message, wparam, lparam); @@ -918,12 +966,22 @@ bool win32_window_create(void *data, unsigned style, #endif settings_t *settings = config_get_ptr(); #ifndef _XBOX + unsigned user_width = width; + unsigned user_height = height; + + if (settings->bools.video_window_save_positions + && !fullscreen) + { + user_width = g_win32_pos_width; + user_height= g_win32_pos_height; + } main_window.hwnd = CreateWindowEx(0, "RetroArch", "RetroArch", style, fullscreen ? mon_rect->left : g_win32_pos_x, fullscreen ? mon_rect->top : g_win32_pos_y, - width, height, + user_width, + user_height, NULL, NULL, NULL, data); if (!main_window.hwnd) return false; @@ -1139,9 +1197,10 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, RECT *rect, RECT *mon_rect, DWORD *style) { #if !defined(_XBOX) + bool position_set_from_config = false; + settings_t *settings = config_get_ptr(); if (fullscreen) { - settings_t *settings = config_get_ptr(); /* Windows only reports the refresh rates for modelines as * an integer, so video_refresh_rate needs to be rounded. Also, account * for black frame insertion using video_refresh_rate set to half @@ -1176,8 +1235,23 @@ void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, AdjustWindowRect(rect, *style, FALSE); - g_win32_resize_width = *width = rect->right - rect->left; - g_win32_resize_height = *height = rect->bottom - rect->top; + if (settings->bools.video_window_save_positions) + { + win32_set_position_from_config(); + if (g_win32_pos_width != 0 && g_win32_pos_height != 0) + position_set_from_config = true; + } + + if (position_set_from_config) + { + g_win32_resize_width = *width = g_win32_pos_width; + g_win32_resize_height = *height = g_win32_pos_height; + } + else + { + g_win32_resize_width = *width = rect->right - rect->left; + g_win32_resize_height = *height = rect->bottom - rect->top; + } } #endif } @@ -1256,6 +1330,7 @@ bool win32_set_video_mode(void *data, &mon_rect, width, height, fullscreen)) return false; + win32_set_window(&width, &height, fullscreen, windowed_full, &rect); @@ -1353,15 +1428,13 @@ void win32_get_video_output_prev( unsigned curr_width = 0; unsigned curr_height = 0; - memset(&dm, 0, sizeof(dm)); + if (win32_get_video_output(&dm, -1, sizeof(dm))) + { + curr_width = dm.dmPelsWidth; + curr_height = dm.dmPelsHeight; + } - dm.dmSize = sizeof(dm); - - win32_get_video_output_size(&curr_width, &curr_height); - - for (i = 0; - EnumDisplaySettings(NULL, i, &dm) != 0; - i++) + for (i = 0; win32_get_video_output(&dm, i, sizeof(dm)); i++) { if ( dm.dmPelsWidth == curr_width && dm.dmPelsHeight == curr_height) @@ -1458,14 +1531,13 @@ void win32_get_video_output_next( unsigned curr_width = 0; unsigned curr_height = 0; - memset(&dm, 0, sizeof(dm)); - dm.dmSize = sizeof(dm); + if (win32_get_video_output(&dm, -1, sizeof(dm))) + { + curr_width = dm.dmPelsWidth; + curr_height = dm.dmPelsHeight; + } - win32_get_video_output_size(&curr_width, &curr_height); - - for (i = 0; - EnumDisplaySettings(NULL, i, &dm) != 0; - i++) + for (i = 0; win32_get_video_output(&dm, i, sizeof(dm)); i++) { if (found) { @@ -1480,13 +1552,23 @@ void win32_get_video_output_next( } } +bool win32_get_video_output(DEVMODE *dm, int mode, size_t len) +{ + memset(dm, 0, len); + dm->dmSize = len; + + if (EnumDisplaySettings(NULL, + (mode == -1) ? ENUM_CURRENT_SETTINGS : mode, dm) == 0) + return false; + + return true; +} + void win32_get_video_output_size(unsigned *width, unsigned *height) { DEVMODE dm; - memset(&dm, 0, sizeof(dm)); - dm.dmSize = sizeof(dm); - if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm) != 0) + if (win32_get_video_output(&dm, -1, sizeof(dm))) { *width = dm.dmPelsWidth; *height = dm.dmPelsHeight; diff --git a/gfx/common/win32_common.h b/gfx/common/win32_common.h index 04eeeef936..6f899ad491 100644 --- a/gfx/common/win32_common.h +++ b/gfx/common/win32_common.h @@ -101,6 +101,8 @@ void win32_check_window(bool *quit, void win32_set_window(unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, void *rect_data); +bool win32_get_video_output(DEVMODE *dm, int mode, size_t len); + void win32_get_video_output_size( unsigned *width, unsigned *height); diff --git a/gfx/common/x11_common.c b/gfx/common/x11_common.c index d8d3a353dd..6007a9b794 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 { @@ -752,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, @@ -778,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, @@ -798,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; diff --git a/gfx/display_servers/dispserv_null.c b/gfx/display_servers/dispserv_null.c index 22b326cbda..8e17292762 100644 --- a/gfx/display_servers/dispserv_null.c +++ b/gfx/display_servers/dispserv_null.c @@ -48,9 +48,10 @@ const video_display_server_t dispserv_null = { null_display_server_destroy, null_display_server_set_window_opacity, null_display_server_set_window_progress, - NULL, - NULL, - NULL, + NULL, /* set_window_decorations */ + NULL, /* set_resolution */ + NULL, /* get_resolution_list */ + NULL, /* get_output_options */ "null" }; diff --git a/gfx/display_servers/dispserv_win32.c b/gfx/display_servers/dispserv_win32.c index 54c3a79d02..6563441bd5 100644 --- a/gfx/display_servers/dispserv_win32.c +++ b/gfx/display_servers/dispserv_win32.c @@ -107,7 +107,7 @@ static void win32_display_server_destroy(void *data) dispserv_win32_t *dispserv = (dispserv_win32_t*)data; if (win32_orig_width > 0 && win32_orig_height > 0) - video_display_server_switch_resolution(win32_orig_width, win32_orig_height, + video_display_server_set_resolution(win32_orig_width, win32_orig_height, win32_orig_refresh, (float)win32_orig_refresh, crt_center ); #ifdef HAS_TASKBAR_EXT @@ -204,20 +204,16 @@ static bool win32_display_server_set_window_decorations(void *data, bool on) static bool win32_display_server_set_resolution(void *data, unsigned width, unsigned height, int int_hz, float hz, int center) { - LONG res; DEVMODE curDevmode; - DEVMODE devmode; - int iModeNum; int freq = int_hz; - DWORD flags = 0; int depth = 0; dispserv_win32_t *serv = (dispserv_win32_t*)data; if (!serv) return false; - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &curDevmode); + win32_get_video_output(&curDevmode, -1, sizeof(curDevmode)); if (win32_orig_width == 0) win32_orig_width = GetSystemMetrics(SM_CXSCREEN); @@ -239,7 +235,10 @@ static bool win32_display_server_set_resolution(void *data, for (iModeNum = 0;; iModeNum++) { - if (!EnumDisplaySettings(NULL, iModeNum, &devmode)) + LONG res; + DEVMODE devmode; + + if (!win32_get_video_output(&devmode, iModeNum, sizeof(devmode))) break; if (devmode.dmPelsWidth != width) @@ -262,15 +261,15 @@ static bool win32_display_server_set_resolution(void *data, switch (res) { case DISP_CHANGE_SUCCESSFUL: - res = win32_change_display_settings(NULL, &devmode, flags); + res = win32_change_display_settings(NULL, &devmode, 0); switch (res) { - case DISP_CHANGE_SUCCESSFUL: - return true; - case DISP_CHANGE_NOTUPDATED: - return true; - default: - break; + case DISP_CHANGE_SUCCESSFUL: + return true; + case DISP_CHANGE_NOTUPDATED: + return true; + default: + break; } break; case DISP_CHANGE_RESTART: @@ -283,6 +282,62 @@ static bool win32_display_server_set_resolution(void *data, return true; } +void *win32_display_server_get_resolution_list(void *data, + unsigned *len) +{ + DEVMODE dm; + unsigned i, count = 0; + unsigned curr_width = 0; + unsigned curr_height = 0; + unsigned curr_bpp = 0; + unsigned curr_refreshrate = 0; + struct video_display_config *conf = NULL; + + for (i = 0;; i++) + { + if (!win32_get_video_output(&dm, i, sizeof(dm))) + break; + + count++; + } + + if (win32_get_video_output(&dm, -1, sizeof(dm))) + { + curr_width = dm.dmPelsWidth; + curr_height = dm.dmPelsHeight; + curr_bpp = dm.dmBitsPerPel; + curr_refreshrate = dm.dmDisplayFrequency; + } + + *len = count; + conf = (struct video_display_config*)calloc(*len, sizeof(struct video_display_config)); + + if (!conf) + return NULL; + + for (i = 0;; i++) + { + if (!win32_get_video_output(&dm, i, sizeof(dm))) + break; + + conf[i].width = dm.dmPelsWidth; + conf[i].height = dm.dmPelsHeight; + conf[i].bpp = dm.dmBitsPerPel; + conf[i].refreshrate = dm.dmDisplayFrequency; + conf[i].idx = i; + conf[i].current = false; + + if ( (conf[i].width == curr_width) + && (conf[i].height == curr_height) + && (conf[i].refreshrate == curr_refreshrate) + && (conf[i].bpp == curr_bpp) + ) + conf[i].current = true; + } + + return conf; +} + const video_display_server_t dispserv_win32 = { win32_display_server_init, win32_display_server_destroy, @@ -290,6 +345,7 @@ const video_display_server_t dispserv_win32 = { win32_display_server_set_window_progress, win32_display_server_set_window_decorations, win32_display_server_set_resolution, + win32_display_server_get_resolution_list, NULL, /* get_output_options */ "win32" }; diff --git a/gfx/display_servers/dispserv_x11.c b/gfx/display_servers/dispserv_x11.c index f4f6f16f7a..a4d727ddc1 100644 --- a/gfx/display_servers/dispserv_x11.c +++ b/gfx/display_servers/dispserv_x11.c @@ -14,9 +14,18 @@ * You should have received a copy of the GNU General Public License along with RetroArch. * If not, see . */ + +#include + #include #include +#include "../../config.h" + +#ifdef HAVE_XRANDR +#include +#endif + #include "../video_display_server.h" #include "../common/x11_common.h" #include "../../configuration.h" @@ -29,7 +38,7 @@ static char old_mode[250] = {0}; static char new_mode[250] = {0}; static char xrandr[250] = {0}; static char fbset[150] = {0}; -static char output[250] = {0}; +static char output[500] = {0}; static bool crt_en = false; typedef struct @@ -55,23 +64,28 @@ static void x11_display_server_destroy(void *data) if (crt_en) { - sprintf(output, "xrandr -s %dx%d", orig_width, orig_height); + snprintf(output, sizeof(output), + "xrandr -s %dx%d", orig_width, orig_height); system(output); for (i = 0; i < 3; i++) { - sprintf(output, "xrandr --delmode %s%d %s", "VGA", i, old_mode); + snprintf(output, sizeof(output), + "xrandr --delmode %s%d %s", "VGA", i, old_mode); system(output); - sprintf(output, "xrandr --delmode %s-%d %s", "VGA", i, old_mode); + snprintf(output, sizeof(output), + "xrandr --delmode %s-%d %s", "VGA", i, old_mode); system(output); - sprintf(output, "xrandr --delmode %s%d %s", "DVI", i, old_mode); + snprintf(output, sizeof(output), + "xrandr --delmode %s%d %s", "DVI", i, old_mode); system(output); - sprintf(output, "xrandr --delmode %s-%d %s", "DVI", i, old_mode); + snprintf(output, sizeof(output), + "xrandr --delmode %s-%d %s", "DVI", i, old_mode); system(output); } - sprintf(output, "xrandr --rmmode %s", old_mode); + snprintf(output, sizeof(output), "xrandr --rmmode %s", old_mode); system(output); } @@ -92,7 +106,8 @@ static bool x11_display_server_set_window_opacity(void *data, unsigned opacity) if (opacity == (unsigned)-1) XDeleteProperty(g_x11_dpy, g_x11_win, net_wm_opacity); else - XChangeProperty(g_x11_dpy, g_x11_win, net_wm_opacity, cardinal, 32, PropModeReplace, (const unsigned char*)&opacity, 1); + XChangeProperty(g_x11_dpy, g_x11_win, net_wm_opacity, cardinal, + 32, PropModeReplace, (const unsigned char*)&opacity, 1); return true; } @@ -101,9 +116,11 @@ static bool x11_display_server_set_window_decorations(void *data, bool on) { dispserv_x11_t *serv = (dispserv_x11_t*)data; - serv->decorations = on; + if (serv) + serv->decorations = on; - /* menu_setting performs a reinit instead to properly apply decoration changes */ + /* menu_setting performs a reinit instead to properly apply + * decoration changes */ return true; } @@ -131,7 +148,7 @@ static bool x11_display_server_set_resolution(void *data, /* set core refresh from hz */ video_monitor_set_refresh_rate(hz); - /* following code is the mode line genorator */ + /* following code is the mode line generator */ hsp = width * 1.140; hfp = width * 1.055; @@ -144,9 +161,7 @@ static bool x11_display_server_set_resolution(void *data, roundw = roundf((float)pwidth / (float)height * 100) / 100; if (height > width) - { roundw = roundf((float)height / (float)width * 100) / 100; - } if (roundw > 1.35) roundw = 1.25; @@ -158,111 +173,88 @@ static bool x11_display_server_set_resolution(void *data, hmax = hbp; if (height < 241) - { vmax = 261; - } if (height < 241 && hz > 56 && hz < 58) - { vmax = 280; - } if (height < 241 && hz < 55) - { vmax = 313; - } if (height > 250 && height < 260 && hz > 54) - { vmax = 296; - } if (height > 250 && height < 260 && hz > 52 && hz < 54) - { vmax = 285; - } if (height > 250 && height < 260 && hz < 52) - { vmax = 313; - } if (height > 260 && height < 300) - { vmax = 318; - } if (height > 400 && hz > 56) - { vmax = 533; - } if (height > 520 && hz < 57) - { vmax = 580; - } if (height > 300 && hz < 56) - { vmax = 615; - } if (height > 500 && hz < 56) - { vmax = 624; - } if (height > 300) - { pdefault = pdefault * 2; - } vfp = height + ((vmax - height) / 2) - pdefault; if (height < 300) - { - vsp = vfp + 3; /* needs to me 3 for progressive */ - } + vsp = vfp + 3; /* needs to be 3 for progressive */ if (height > 300) - { - vsp = vfp + 6; /* needs to me 6 for interlaced */ - } + vsp = vfp + 6; /* needs to be 6 for interlaced */ vbp = vmax; if (height < 300) - { pixel_clock = (hmax * vmax * hz) / 1000000; - } if (height > 300) - { pixel_clock = ((hmax * vmax * hz) / 1000000) / 2; - } - /* above code is the modeline genorator */ + /* above code is the modeline generator */ /* create interlaced newmode from modline variables */ if (height < 300) { - snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%dx%d_%0.2f\" %lf %d %d %d %d %d %d %d %d -hsync -vsync", width, height, hz, pixel_clock, width, hfp, hsp, hbp, height, vfp, vsp, vbp); + snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%dx%d_%0.2f\" %lf %d %d %d %d %d %d %d %d -hsync -vsync", width, height, hz, pixel_clock, + width, hfp, hsp, hbp, height, vfp, vsp, vbp); system(xrandr); } /* create interlaced newmode from modline variables */ if (height > 300) { - snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%dx%d_%0.2f\" %lf %d %d %d %d %d %d %d %d interlace -hsync -vsync", width, height, hz, pixel_clock, width, hfp, hsp, hbp, height, vfp, vsp, vbp); + snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%dx%d_%0.2f\" %lf %d %d %d %d %d %d %d %d interlace -hsync -vsync", width, height, hz, pixel_clock, + width, hfp, hsp, hbp, height, vfp, vsp, vbp); system(xrandr); } /* variable for new mode */ snprintf(new_mode, sizeof(new_mode), "%dx%d_%0.2f", width, height, hz); - /* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to add and delete modes */ + /* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to + * add and delete modes */ for (i = 0; i < 3; i++) { - snprintf(output, sizeof(output), "xrandr --addmode %s%d %s", "DVI", i, new_mode); + snprintf(output, sizeof(output), "xrandr --addmode %s%d %s", "DVI", i, + new_mode); system(output); - snprintf(output, sizeof(output), "xrandr --delmode %s%d %s", "DVI", i, old_mode); + snprintf(output, sizeof(output), "xrandr --delmode %s%d %s", "DVI", i, + old_mode); system(output); } + for (i = 0; i < 3; i++) { - snprintf(output, sizeof(output), "xrandr --addmode %s-%d %s", "DVI", i, new_mode); + snprintf(output, sizeof(output), "xrandr --addmode %s-%d %s", "DVI", i, + new_mode); system(output); - snprintf(output, sizeof(output), "xrandr --delmode %s-%d %s", "DVI", i, old_mode); + snprintf(output, sizeof(output), "xrandr --delmode %s-%d %s", "DVI", i, + old_mode); system(output); } + for (i = 0; i < 3; i++) { snprintf(output, sizeof(output), "xrandr --addmode %s%d %s", "VGA", i, new_mode); @@ -270,6 +262,7 @@ static bool x11_display_server_set_resolution(void *data, snprintf(output, sizeof(output), "xrandr --delmode %s%d %s", "VGA", i, old_mode); system(output); } + for (i = 0; i < 3; i++) { snprintf(output, sizeof(output), "xrandr --addmode %s-%d %s", "VGA", i, new_mode); @@ -285,30 +278,62 @@ static bool x11_display_server_set_resolution(void *data, snprintf(output, sizeof(output), "xrandr --rmmode %s", old_mode); system(output); - system("xdotool windowactivate $(xdotool search --class RetroArch)"); /* needs xdotool installed. needed to recapture window. */ + /* needs xdotool installed. needed to recapture window. */ + system("xdotool windowactivate $(xdotool search --class RetroArch)"); /* variable for old mode */ snprintf(old_mode, sizeof(old_mode), "%s", new_mode); - system("xdotool windowactivate $(xdotool search --class RetroArch)"); /* needs xdotool installed. needed to recapture window. */ + /* needs xdotool installed. needed to recapture window. */ + system("xdotool windowactivate $(xdotool search --class RetroArch)"); /* Second run needed as some times it runs to fast to capture first time */ return true; } -const char *x11_display_server_get_output_options(void) +const char *x11_display_server_get_output_options(void *data) { +#ifdef HAVE_XRANDR + Display *dpy; + XRRScreenResources *res; + XRROutputInfo *info; + Window root; + int i; + static char s[PATH_MAX_LENGTH]; + + if (!(dpy = XOpenDisplay(0))) + return NULL; + + root = RootWindow(dpy, DefaultScreen(dpy)); + + if (!(res = XRRGetScreenResources(dpy, root))) + return NULL; + + for (i = 0; i < res->noutput; i++) + { + if (!(info = XRRGetOutputInfo(dpy, res, res->outputs[i]))) + return NULL; + + strlcat(s, info->name, sizeof(s)); + if ((i+1) < res->noutput) + strlcat(s, "|", sizeof(s)); + } + + return s; +#else /* TODO/FIXME - hardcoded for now; list should be built up dynamically later */ return "HDMI-0|HDMI-1|HDMI-2|HDMI-3|DVI-0|DVI-1|DVI-2|DVI-3|VGA-0|VGA-1|VGA-2|VGA-3|Config"; +#endif } const video_display_server_t dispserv_x11 = { x11_display_server_init, x11_display_server_destroy, x11_display_server_set_window_opacity, - NULL, + NULL, /* set_window_progress */ x11_display_server_set_window_decorations, x11_display_server_set_resolution, + NULL, /* get_resolution_list */ x11_display_server_get_output_options, "x11" }; diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index f9b93604fd..d62bd67cf4 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -957,12 +957,6 @@ static bool gl_frame(void *data, const void *frame, if (!gl) return false; -#ifdef HAVE_LIBNX - // Should be called once per frame - if(!appletMainLoop()) - return false; -#endif - gl_context_bind_hw_render(gl, false); if (gl->core_context_in_use && gl->renderchain_driver->bind_vao) diff --git a/gfx/drivers/metal.m b/gfx/drivers/metal.m index 3496d035bf..29c792c9ab 100644 --- a/gfx/drivers/metal.m +++ b/gfx/drivers/metal.m @@ -151,16 +151,22 @@ static void metal_free(void *data) static void metal_set_viewport(void *data, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate) { -#if 0 - RARCH_LOG("[Metal]: set_viewport size: %dx%d full: %s rotate: %s\n", - viewport_width, viewport_height, - force_full ? "YES" : "NO", - allow_rotate ? "YES" : "NO"); -#endif + MetalDriver *md = (__bridge MetalDriver *)data; + if (md == nil) { + return; + } + + [md setViewportWidth:viewport_width height:viewport_height forceFull:force_full allowRotate:allow_rotate]; } static void metal_set_rotation(void *data, unsigned rotation) { + MetalDriver *md = (__bridge MetalDriver *)data; + if (md == nil) { + return; + } + + [md setRotation:rotation]; } static void metal_viewport_info(void *data, struct video_viewport *vp) diff --git a/gfx/drivers/sixel_gfx.c b/gfx/drivers/sixel_gfx.c index 8daecdaa32..d49c3dd74f 100644 --- a/gfx/drivers/sixel_gfx.c +++ b/gfx/drivers/sixel_gfx.c @@ -30,6 +30,7 @@ #include "../../driver.h" #include "../../configuration.h" +#include "../../retroarch.h" #include "../../verbosity.h" #include "../../frontend/frontend_driver.h" #include "../common/sixel_common.h" diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 140dbff7b7..9ca988f1a1 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -645,6 +645,7 @@ static void vulkan_deinit_descriptor_pool(vk_t *vk) static void vulkan_init_textures(vk_t *vk) { unsigned i; + const uint32_t zero = 0; vulkan_init_samplers(vk); if (!vk->hw.enable) @@ -665,6 +666,10 @@ static void vulkan_init_textures(vk_t *vk) NULL, NULL, VULKAN_TEXTURE_DYNAMIC); } } + + vk->default_texture = vulkan_create_texture(vk, NULL, + 1, 1, VK_FORMAT_B8G8R8A8_UNORM, + &zero, NULL, VULKAN_TEXTURE_STATIC); } static void vulkan_deinit_textures(vk_t *vk) @@ -683,6 +688,9 @@ static void vulkan_deinit_textures(vk_t *vk) vulkan_destroy_texture( vk->context->device, &vk->swapchain[i].texture_optimal); } + + if (vk->default_texture.memory != VK_NULL_HANDLE) + vulkan_destroy_texture(vk->context->device, &vk->default_texture); } static void vulkan_deinit_command_buffers(vk_t *vk) @@ -1732,25 +1740,43 @@ static bool vulkan_frame(void *data, const void *frame, if (vk->hw.enable) { /* Does this make that this can happen at all? */ - if (!vk->hw.image) + if (vk->hw.image) { - RARCH_ERR("[Vulkan]: HW image is not set. Buggy core?\n"); - return false; - } + input.image = vk->hw.image->create_info.image; + input.view = vk->hw.image->image_view; + input.layout = vk->hw.image->image_layout; - input.image = vk->hw.image->create_info.image; - input.view = vk->hw.image->image_view; - input.layout = vk->hw.image->image_layout; + /* The format can change on a whim. */ + input.format = vk->hw.image->create_info.format; - if (frame) - { - input.width = frame_width; - input.height = frame_height; + if (frame) + { + input.width = frame_width; + input.height = frame_height; + } + else + { + input.width = vk->hw.last_width; + input.height = vk->hw.last_height; + } + + input.image = vk->hw.image->create_info.image; + input.view = vk->hw.image->image_view; + input.layout = vk->hw.image->image_layout; + + /* The format can change on a whim. */ + input.format = vk->hw.image->create_info.format; } else { - input.width = vk->hw.last_width; - input.height = vk->hw.last_height; + /* Fall back to the default, black texture. + * This can happen if we restart the video driver while in the menu. */ + input.image = vk->default_texture.image; + input.view = vk->default_texture.view; + input.layout = vk->default_texture.layout; + input.format = vk->default_texture.format; + input.width = vk->default_texture.width; + input.height = vk->default_texture.height; } vk->hw.last_width = input.width; @@ -1769,6 +1795,7 @@ static bool vulkan_frame(void *data, const void *frame, input.layout = tex->layout; input.width = tex->width; input.height = tex->height; + input.format = VK_FORMAT_UNDEFINED; /* It's already configured. */ } vulkan_filter_chain_set_input_texture((vulkan_filter_chain_t*)vk->filter_chain, &input); diff --git a/gfx/drivers_context/android_ctx.c b/gfx/drivers_context/android_ctx.c index 69b9c2a389..116a6a9fdf 100644 --- a/gfx/drivers_context/android_ctx.c +++ b/gfx/drivers_context/android_ctx.c @@ -137,7 +137,7 @@ static void *android_gfx_ctx_init(video_frame_info_t *video_info, void *video_dr RARCH_LOG("Android EGL: GLES version = %d.\n", g_es3 ? 3 : 2); if (!egl_init_context(&and->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, - &major, &minor, &n, attribs)) + &major, &minor, &n, attribs, NULL)) { egl_report_error(); goto error; diff --git a/gfx/drivers_context/drm_ctx.c b/gfx/drivers_context/drm_ctx.c index bd81479792..d362bb745a 100644 --- a/gfx/drivers_context/drm_ctx.c +++ b/gfx/drivers_context/drm_ctx.c @@ -497,6 +497,28 @@ static EGLint *gfx_ctx_drm_egl_fill_attribs( } #ifdef HAVE_EGL +static bool gbm_choose_xrgb8888_cb(void *display_data, EGLDisplay dpy, EGLConfig config) +{ + EGLint r, g, b, id; + (void)display_data; + + /* Makes sure we have 8 bit color. */ + if (!eglGetConfigAttrib(dpy, config, EGL_RED_SIZE, &r)) + return false; + if (!eglGetConfigAttrib(dpy, config, EGL_GREEN_SIZE, &g)) + return false; + if (!eglGetConfigAttrib(dpy, config, EGL_BLUE_SIZE, &b)) + return false; + + if (r != 8 || g != 8 || b != 8) + return false; + + if (!eglGetConfigAttrib(dpy, config, EGL_NATIVE_VISUAL_ID, &id)) + return false; + + return id == GBM_FORMAT_XRGB8888; +} + #define DRM_EGL_ATTRIBS_BASE \ EGL_SURFACE_TYPE, EGL_WINDOW_BIT, \ EGL_RED_SIZE, 1, \ @@ -575,7 +597,7 @@ static bool gfx_ctx_drm_egl_set_video_mode(gfx_ctx_drm_data_t *drm) #ifdef HAVE_EGL if (!egl_init_context(&drm->egl, EGL_PLATFORM_GBM_KHR, (EGLNativeDisplayType)g_gbm_dev, &major, - &minor, &n, attrib_ptr)) + &minor, &n, attrib_ptr, gbm_choose_xrgb8888_cb)) goto error; attr = gfx_ctx_drm_egl_fill_attribs(drm, egl_attribs); diff --git a/gfx/drivers_context/emscriptenegl_ctx.c b/gfx/drivers_context/emscriptenegl_ctx.c index b2eb2b7100..46410ba68d 100644 --- a/gfx/drivers_context/emscriptenegl_ctx.c +++ b/gfx/drivers_context/emscriptenegl_ctx.c @@ -212,7 +212,7 @@ static void *gfx_ctx_emscripten_init(video_frame_info_t *video_info, } if (!egl_init_context(&emscripten->egl, EGL_NONE, - (void *)EGL_DEFAULT_DISPLAY, &major, &minor, &n, attribute_list)) + (void *)EGL_DEFAULT_DISPLAY, &major, &minor, &n, attribute_list, NULL)) { egl_report_error(); goto error; diff --git a/gfx/drivers_context/mali_fbdev_ctx.c b/gfx/drivers_context/mali_fbdev_ctx.c index cb86849d95..363e3c0182 100644 --- a/gfx/drivers_context/mali_fbdev_ctx.c +++ b/gfx/drivers_context/mali_fbdev_ctx.c @@ -116,7 +116,7 @@ static void *gfx_ctx_mali_fbdev_init(video_frame_info_t *video_info, void *video #ifdef HAVE_EGL if (!egl_init_context(&mali->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, - &major, &minor, &n, attribs)) + &major, &minor, &n, attribs, NULL)) { egl_report_error(); goto error; diff --git a/gfx/drivers_context/opendingux_fbdev_ctx.c b/gfx/drivers_context/opendingux_fbdev_ctx.c index 41d6e34aae..f774c9c34b 100644 --- a/gfx/drivers_context/opendingux_fbdev_ctx.c +++ b/gfx/drivers_context/opendingux_fbdev_ctx.c @@ -87,7 +87,7 @@ static void *gfx_ctx_opendingux_init(video_frame_info_t *video_info, void *video if (!egl_init_context(&viv->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, &major, &minor, - &n, attribs)) + &n, attribs, NULL)) { egl_report_error(); goto error; diff --git a/gfx/drivers_context/qnx_ctx.c b/gfx/drivers_context/qnx_ctx.c index 7ce06b5f28..f71c2f50b3 100644 --- a/gfx/drivers_context/qnx_ctx.c +++ b/gfx/drivers_context/qnx_ctx.c @@ -134,7 +134,7 @@ static void *gfx_ctx_qnx_init(video_frame_info_t *video_info, void *video_driver #ifdef HAVE_EGL if (!egl_init_context(&qnx->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, &major, &minor, - &n, attribs)) + &n, attribs, NULL)) { egl_report_error(); goto error; diff --git a/gfx/drivers_context/switch_ctx.c b/gfx/drivers_context/switch_ctx.c index ccf3c40d02..6a8e075cd6 100644 --- a/gfx/drivers_context/switch_ctx.c +++ b/gfx/drivers_context/switch_ctx.c @@ -27,6 +27,8 @@ static enum gfx_ctx_api ctx_nx_api = GFX_CTX_OPENGL_API; switch_ctx_data_t *nx_ctx_ptr = NULL; +extern bool platform_switch_has_focus; + void switch_ctx_destroy(void *data) { switch_ctx_data_t *ctx_nx = (switch_ctx_data_t *)data; @@ -86,7 +88,7 @@ static void *switch_ctx_init(video_frame_info_t *video_info, void *video_driver) #ifdef HAVE_EGL if (!egl_init_context(&ctx_nx->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, - &major, &minor, &n, attribs)) + &major, &minor, &n, attribs, NULL)) { egl_report_error(); goto error; @@ -190,7 +192,7 @@ static bool switch_ctx_bind_api(void *data, static bool switch_ctx_has_focus(void *data) { (void)data; - return true; + return platform_switch_has_focus; } static bool switch_ctx_suppress_screensaver(void *data, bool enable) diff --git a/gfx/drivers_context/vc_egl_ctx.c b/gfx/drivers_context/vc_egl_ctx.c index 04aaf3ee1f..183ab77557 100644 --- a/gfx/drivers_context/vc_egl_ctx.c +++ b/gfx/drivers_context/vc_egl_ctx.c @@ -210,7 +210,7 @@ static void *gfx_ctx_vc_init(video_frame_info_t *video_info, void *video_driver) #ifdef HAVE_EGL if (!egl_init_context(&vc->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, - &major, &minor, &n, attribute_list)) + &major, &minor, &n, attribute_list, NULL)) { egl_report_error(); goto error; diff --git a/gfx/drivers_context/vivante_fbdev_ctx.c b/gfx/drivers_context/vivante_fbdev_ctx.c index 2270ee003c..4eff7b8835 100644 --- a/gfx/drivers_context/vivante_fbdev_ctx.c +++ b/gfx/drivers_context/vivante_fbdev_ctx.c @@ -93,7 +93,7 @@ static void *gfx_ctx_vivante_init(video_frame_info_t *video_info, void *video_dr #ifdef HAVE_EGL if (!egl_init_context(&viv->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, &major, &minor, - &n, attribs)) + &n, attribs, NULL)) { egl_report_error(); goto error; diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index f22d184849..01a5e52133 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -42,15 +42,23 @@ #include "../common/gl_common.h" #endif -#ifdef HAVE_DBUS -#include "../common/dbus_common.h" -#endif - #include "../common/wayland_common.h" #include "../../frontend/frontend_driver.h" #include "../../input/input_driver.h" #include "../../input/input_keymaps.h" +/* Generated from idle-inhibit-unstable-v1.xml */ +#include "../common/wayland/idle-inhibit-unstable-v1.h" + +/* Generated from xdg-shell-unstable-v6.xml */ +#include "../common/wayland/xdg-shell-unstable-v6.h" + +/* Generated from xdg-shell.xml */ +#include "../common/wayland/xdg-shell.h" + +/* Generated from xdg-decoration-unstable-v1.h */ +#include "../common/wayland/xdg-decoration-unstable-v1.h" + typedef struct touch_pos { @@ -70,7 +78,13 @@ typedef struct gfx_ctx_wayland_data egl_ctx_data_t egl; struct wl_egl_window *win; #endif + bool fullscreen; + bool maximized; bool resize; + bool configured; + bool activated; + int prev_width; + int prev_height; unsigned width; unsigned height; unsigned physical_width; @@ -81,11 +95,21 @@ typedef struct gfx_ctx_wayland_data struct wl_surface *surface; struct wl_shell_surface *shell_surf; struct wl_shell *shell; + struct zxdg_surface_v6 *zxdg_surface; + struct zxdg_shell_v6 *zxdg_shell; + struct zxdg_toplevel_v6 *zxdg_toplevel; + struct xdg_surface *xdg_surface; + struct xdg_wm_base *xdg_shell; + struct xdg_toplevel *xdg_toplevel; struct wl_keyboard *wl_keyboard; struct wl_pointer *wl_pointer; struct wl_touch *wl_touch; struct wl_seat *seat; struct wl_shm *shm; + struct zxdg_decoration_manager_v1 *deco_manager; + struct zxdg_toplevel_decoration_v1 *deco; + struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager; + struct zwp_idle_inhibitor_v1 *idle_inhibitor; int swap_interval; bool core_hw_context_enable; @@ -303,9 +327,14 @@ static void pointer_handle_button(void *data, { wl->input.mouse.left = true; - /* This behavior matches mpv, seems like a decent way to support window moving for now. */ - if (BIT_GET(wl->input.key_state, KEY_LEFTALT) && wl->shell_surf) - wl_shell_surface_move(wl->shell_surf, wl->seat, serial); + if (BIT_GET(wl->input.key_state, KEY_LEFTALT) && wl->xdg_toplevel) { + if (wl->xdg_toplevel) + xdg_toplevel_move(wl->xdg_toplevel, wl->seat, serial); + else if (wl->zxdg_toplevel) + zxdg_toplevel_v6_move(wl->zxdg_toplevel, wl->seat, serial); + else if (wl->shell) + wl_shell_surface_move(wl->shell_surf, wl->seat, serial); + } } else if (button == BTN_RIGHT) wl->input.mouse.right = true; @@ -344,6 +373,8 @@ static const struct wl_pointer_listener pointer_listener = { pointer_handle_axis, }; +/* TODO: implement check for resize */ + static void touch_handle_down(void *data, struct wl_touch *wl_touch, uint32_t serial, @@ -542,6 +573,134 @@ bool wayland_context_gettouchpos(void *data, unsigned id, /* Shell surface callbacks. */ +static void xdg_shell_ping(void *data, struct xdg_wm_base *shell, uint32_t serial) +{ + xdg_wm_base_pong(shell, serial); +} + +static const struct xdg_wm_base_listener xdg_shell_listener = { + xdg_shell_ping, +}; + +static void handle_surface_config(void *data, struct xdg_surface *surface, + uint32_t serial) +{ + xdg_surface_ack_configure(surface, serial); +} + +static const struct xdg_surface_listener xdg_surface_listener = { + handle_surface_config, +}; + +static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, + int32_t width, int32_t height, struct wl_array *states) +{ + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; + + wl->fullscreen = false; + wl->maximized = false; + const uint32_t *state; + wl_array_for_each(state, states) { + switch (*state) { + case XDG_TOPLEVEL_STATE_FULLSCREEN: + wl->fullscreen = true; + break; + case XDG_TOPLEVEL_STATE_MAXIMIZED: + wl->maximized = true; + break; + case XDG_TOPLEVEL_STATE_RESIZING: + wl->resize = true; + break; + case XDG_TOPLEVEL_STATE_ACTIVATED: + wl->activated = true; + break; + } + } + if (width > 0 && height > 0) { + wl->prev_width = width; + wl->prev_height = height; + wl->width = width; + wl->height = height; + } + + wl->configured = false; +} + +static void handle_toplevel_close(void *data, struct xdg_toplevel *xdg_toplevel) +{ + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; + BIT_SET(wl->input.key_state, KEY_ESC); +} + +static const struct xdg_toplevel_listener xdg_toplevel_listener = { + handle_toplevel_config, + handle_toplevel_close, +}; + +static void zxdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial) +{ + zxdg_shell_v6_pong(shell, serial); +} + +static const struct zxdg_shell_v6_listener zxdg_shell_v6_listener = { + zxdg_shell_ping, +}; + +static void handle_zxdg_surface_config(void *data, struct zxdg_surface_v6 *surface, + uint32_t serial) +{ + zxdg_surface_v6_ack_configure(surface, serial); +} + +static const struct zxdg_surface_v6_listener zxdg_surface_v6_listener = { + handle_zxdg_surface_config, +}; + +static void handle_zxdg_toplevel_config(void *data, struct zxdg_toplevel_v6 *toplevel, + int32_t width, int32_t height, struct wl_array *states) +{ + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; + + wl->fullscreen = false; + wl->maximized = false; + const uint32_t *state; + wl_array_for_each(state, states) { + switch (*state) { + case XDG_TOPLEVEL_STATE_FULLSCREEN: + wl->fullscreen = true; + break; + case XDG_TOPLEVEL_STATE_MAXIMIZED: + wl->maximized = true; + break; + case XDG_TOPLEVEL_STATE_RESIZING: + wl->resize = true; + break; + case XDG_TOPLEVEL_STATE_ACTIVATED: + wl->activated = true; + break; + } + } + if (width > 0 && height > 0) { + wl->prev_width = width; + wl->prev_height = height; + wl->width = width; + wl->height = height; + } + + wl->configured = false; +} + +static void handle_zxdg_toplevel_close(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel) +{ + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; + BIT_SET(wl->input.key_state, KEY_ESC); +} + +static const struct zxdg_toplevel_v6_listener zxdg_toplevel_v6_listener = { + handle_zxdg_toplevel_config, + handle_zxdg_toplevel_close, +}; + static void shell_surface_handle_ping(void *data, struct wl_shell_surface *shell_surface, uint32_t serial) @@ -669,6 +828,12 @@ static void registry_handle_global(void *data, struct wl_registry *reg, wl_output_add_listener(output, &output_listener, wl); wl_display_roundtrip(wl->input.dpy); } + else if (string_is_equal(interface, "xdg_wm_base")) + wl->xdg_shell = (struct xdg_wm_base*) + wl_registry_bind(reg, id, &xdg_wm_base_interface, 1); + else if (string_is_equal(interface, "zxdg_shell_v6")) + wl->zxdg_shell = (struct zxdg_shell_v6*) + wl_registry_bind(reg, id, &zxdg_shell_v6_interface, 1); else if (string_is_equal(interface, "wl_shell")) wl->shell = (struct wl_shell*) wl_registry_bind(reg, id, &wl_shell_interface, 1); @@ -679,6 +844,12 @@ static void registry_handle_global(void *data, struct wl_registry *reg, wl->seat = (struct wl_seat*)wl_registry_bind(reg, id, &wl_seat_interface, 2); wl_seat_add_listener(wl->seat, &seat_listener, wl); } + else if (string_is_equal(interface, "zwp_idle_inhibit_manager_v1")) + wl->idle_inhibit_manager = (struct zwp_idle_inhibit_manager_v1*)wl_registry_bind( + reg, id, &zwp_idle_inhibit_manager_v1_interface, 1); + else if (string_is_equal(interface, "zxdg_decoration_manager_v1")) + wl->deco_manager = (struct zxdg_decoration_manager_v1*)wl_registry_bind( + reg, id, &zxdg_decoration_manager_v1_interface, 1); } static void registry_handle_global_remove(void *data, @@ -751,16 +922,36 @@ static void gfx_ctx_wl_destroy_resources(gfx_ctx_wayland_data_t *wl) if (wl->seat) wl_seat_destroy(wl->seat); + if (wl->xdg_shell) + xdg_wm_base_destroy(wl->xdg_shell); + if (wl->zxdg_shell) + zxdg_shell_v6_destroy(wl->zxdg_shell); if (wl->shell) wl_shell_destroy(wl->shell); if (wl->compositor) wl_compositor_destroy(wl->compositor); if (wl->registry) wl_registry_destroy(wl->registry); - if (wl->shell_surf) - wl_shell_surface_destroy(wl->shell_surf); + if (wl->xdg_surface) + xdg_surface_destroy(wl->xdg_surface); + if (wl->zxdg_surface) + zxdg_surface_v6_destroy(wl->zxdg_surface); if (wl->surface) wl_surface_destroy(wl->surface); + if (wl->xdg_toplevel) + xdg_toplevel_destroy(wl->xdg_toplevel); + if (wl->zxdg_toplevel) + zxdg_toplevel_v6_destroy(wl->zxdg_toplevel); + if (wl->shell_surf) + wl_shell_surface_destroy(wl->shell_surf); + if (wl->idle_inhibit_manager) + zwp_idle_inhibit_manager_v1_destroy(wl->idle_inhibit_manager); + if (wl->deco) + zxdg_toplevel_decoration_v1_destroy(wl->deco); + if (wl->deco_manager) + zxdg_decoration_manager_v1_destroy(wl->deco_manager); + if (wl->idle_inhibitor) + zwp_idle_inhibitor_v1_destroy(wl->idle_inhibitor); if (wl->input.dpy) { @@ -771,20 +962,21 @@ static void gfx_ctx_wl_destroy_resources(gfx_ctx_wayland_data_t *wl) #ifdef HAVE_EGL wl->win = NULL; #endif - wl->shell = NULL; + wl->xdg_shell = NULL; + wl->zxdg_shell = NULL; + wl->shell = NULL; wl->compositor = NULL; wl->registry = NULL; wl->input.dpy = NULL; - wl->shell_surf = NULL; + wl->xdg_surface = NULL; wl->surface = NULL; + wl->xdg_toplevel = NULL; + wl->zxdg_toplevel = NULL; + wl->shell_surf = NULL; wl->width = 0; wl->height = 0; -#ifdef HAVE_DBUS - dbus_screensaver_uninhibit(); - dbus_close_connection(); -#endif } void flush_wayland_fd(void *data) @@ -901,8 +1093,22 @@ static void gfx_ctx_wl_update_title(void *data, void *data2) video_driver_get_window_title(title, sizeof(title)); - if (wl && title[0]) - wl_shell_surface_set_title(wl->shell_surf, title); + if (wl && title[0]) { + if (wl->xdg_toplevel) { + if (wl->deco) { + zxdg_toplevel_decoration_v1_set_mode(wl->deco, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + } + xdg_toplevel_set_title(wl->xdg_toplevel, title); + } + else if (wl->zxdg_toplevel) { + if (wl->deco) { + zxdg_toplevel_decoration_v1_set_mode(wl->deco, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + } + zxdg_toplevel_v6_set_title(wl->zxdg_toplevel, title); + } + else if (wl->shell_surf) + wl_shell_surface_set_title(wl->shell_surf, title); + } } @@ -1062,10 +1268,30 @@ static void *gfx_ctx_wl_init(video_frame_info_t *video_info, void *video_driver) goto error; } - if (!wl->shell) + if (!wl->xdg_shell) { - RARCH_ERR("[Wayland]: Failed to create shell.\n"); - goto error; + RARCH_LOG("[Wayland]: Using zxdg_shell_v6 interface.\n"); + } + + if (!wl->xdg_shell && !wl->zxdg_shell) + { + RARCH_WARN("[Wayland]: Fallback to deprecated wl_shell interface!.\n"); + } + + if (!wl->xdg_shell && !wl->zxdg_shell && !wl->shell) + { + RARCH_ERR("[Wayland]: Failed to create shell.\n"); + goto error; + } + + if (!wl->idle_inhibit_manager) + { + RARCH_WARN("[Wayland]: Compositor doesn't support zwp_idle_inhibit_manager_v1 protocol!\n"); + } + + if (!wl->deco_manager) + { + RARCH_WARN("[Wayland]: Compositor doesn't support zxdg_decoration_manager_v1 protocol!\n"); } wl->input.fd = wl_display_get_fd(wl->input.dpy); @@ -1079,7 +1305,8 @@ static void *gfx_ctx_wl_init(video_frame_info_t *video_info, void *video_driver) if (!egl_init_context(&wl->egl, EGL_PLATFORM_WAYLAND_KHR, (EGLNativeDisplayType)wl->input.dpy, - &major, &minor, &n, attrib_ptr)) + &major, &minor, &n, attrib_ptr, + egl_default_accept_config_cb)) { egl_report_error(); goto error; @@ -1119,10 +1346,6 @@ static void *gfx_ctx_wl_init(video_frame_info_t *video_info, void *video_driver) flush_wayland_fd(&wl->input); -#ifdef HAVE_DBUS - dbus_ensure_connection(); -#endif - return wl; error: @@ -1293,12 +1516,63 @@ static bool gfx_ctx_wl_set_video_mode(void *data, default: break; } - wl->shell_surf = wl_shell_get_shell_surface(wl->shell, wl->surface); - - wl_shell_surface_add_listener(wl->shell_surf, &shell_surface_listener, wl); - wl_shell_surface_set_toplevel(wl->shell_surf); - wl_shell_surface_set_class(wl->shell_surf, "RetroArch"); - wl_shell_surface_set_title(wl->shell_surf, "RetroArch"); + + if (wl->xdg_shell) { + wl->xdg_surface = xdg_wm_base_get_xdg_surface(wl->xdg_shell, wl->surface); + xdg_surface_add_listener(wl->xdg_surface, &xdg_surface_listener, wl); + + wl->xdg_toplevel = xdg_surface_get_toplevel(wl->xdg_surface); + xdg_toplevel_add_listener(wl->xdg_toplevel, &xdg_toplevel_listener, wl); + + xdg_toplevel_set_app_id(wl->xdg_toplevel, "RetroArch"); + xdg_toplevel_set_title(wl->xdg_toplevel, "RetroArch"); + + if (wl->deco_manager) { + wl->deco = zxdg_decoration_manager_v1_get_toplevel_decoration( + wl->deco_manager, wl->xdg_toplevel); + } + + /* Waiting for xdg_toplevel to be configured before starting to draw */ + wl_surface_commit(wl->surface); + wl->configured = true; + + while (wl->configured) { + wl_display_dispatch(wl->input.dpy); + } + wl_display_roundtrip(wl->input.dpy); + xdg_wm_base_add_listener(wl->xdg_shell, &xdg_shell_listener, NULL); + } else if (wl->zxdg_shell) { + wl->zxdg_surface = zxdg_shell_v6_get_xdg_surface(wl->zxdg_shell, wl->surface); + zxdg_surface_v6_add_listener(wl->zxdg_surface, &zxdg_surface_v6_listener, wl); + + wl->zxdg_toplevel = zxdg_surface_v6_get_toplevel(wl->zxdg_surface); + zxdg_toplevel_v6_add_listener(wl->zxdg_toplevel, &zxdg_toplevel_v6_listener, wl); + + zxdg_toplevel_v6_set_app_id(wl->zxdg_toplevel, "RetroArch"); + zxdg_toplevel_v6_set_title(wl->zxdg_toplevel, "RetroArch"); + + if (wl->deco_manager) { + wl->deco = zxdg_decoration_manager_v1_get_toplevel_decoration( + wl->deco_manager, wl->xdg_toplevel); + } + + /* Waiting for xdg_toplevel to be configured before starting to draw */ + wl_surface_commit(wl->surface); + wl->configured = true; + + while (wl->configured) { + wl_display_dispatch(wl->input.dpy); + } + wl_display_roundtrip(wl->input.dpy); + zxdg_shell_v6_add_listener(wl->zxdg_shell, &zxdg_shell_v6_listener, NULL); + } else if (wl->shell) { + wl->shell_surf = wl_shell_get_shell_surface(wl->shell, wl->surface); + wl_shell_surface_add_listener(wl->shell_surf, &shell_surface_listener, wl); + wl_shell_surface_set_toplevel(wl->shell_surf); + wl_shell_surface_set_class(wl->shell_surf, "RetroArch"); + wl_shell_surface_set_title(wl->shell_surf, "RetroArch"); + } + switch (wl_api) { @@ -1323,9 +1597,16 @@ static bool gfx_ctx_wl_set_video_mode(void *data, break; } - if (fullscreen) - wl_shell_surface_set_fullscreen(wl->shell_surf, + if (fullscreen) { + if (wl->xdg_toplevel) { + xdg_toplevel_set_fullscreen(wl->xdg_toplevel, NULL); + } else if (wl->zxdg_toplevel) { + zxdg_toplevel_v6_set_fullscreen(wl->zxdg_toplevel, NULL); + } else if (wl->shell) { + wl_shell_surface_set_fullscreen(wl->shell_surf, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, NULL); + } + } flush_wayland_fd(&wl->input); @@ -1388,16 +1669,26 @@ static bool gfx_ctx_wl_has_focus(void *data) return wl->input.keyboard_focus; } -static bool gfx_ctx_wl_suppress_screensaver(void *data, bool enable) +static bool gfx_ctx_wl_suppress_screensaver(void *data, bool state) { - (void)data; - (void)enable; + (void)data; + + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; -#ifdef HAVE_DBUS - return dbus_suspend_screensaver(enable); -#endif - - return true; + if (!wl->idle_inhibit_manager) + return false; + if (state == (!!wl->idle_inhibitor)) + return true; + if (state) { + RARCH_LOG("[Wayland]: Enabling idle inhibitor\n"); + struct zwp_idle_inhibit_manager_v1 *mgr = wl->idle_inhibit_manager; + wl->idle_inhibitor = zwp_idle_inhibit_manager_v1_create_inhibitor(mgr, wl->surface); + } else { + RARCH_LOG("[Wayland]: Disabling the idle inhibitor\n"); + zwp_idle_inhibitor_v1_destroy(wl->idle_inhibitor); + wl->idle_inhibitor = NULL; + } + return true; } static bool gfx_ctx_wl_has_windowed(void *data) 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"); diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index ad21ce4644..24d2546c53 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -172,7 +172,7 @@ static void *gfx_ctx_xegl_init(video_frame_info_t *video_info, void *video_drive #ifdef HAVE_EGL if (!egl_init_context(&xegl->egl, EGL_PLATFORM_X11_KHR, - (EGLNativeDisplayType)g_x11_dpy, &major, &minor, &n, attrib_ptr)) + (EGLNativeDisplayType)g_x11_dpy, &major, &minor, &n, attrib_ptr, egl_default_accept_config_cb)) { egl_report_error(); goto error; diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c index 784cf41c7f..f9bed812e8 100644 --- a/gfx/drivers_shader/shader_glsl.c +++ b/gfx/drivers_shader/shader_glsl.c @@ -480,11 +480,11 @@ error: return false; } -static void gl_glsl_strip_parameter_pragmas(char *source) +static void gl_glsl_strip_parameter_pragmas(char *source, const char *str) { /* #pragma parameter lines tend to have " characters in them, * which is not legal GLSL. */ - char *s = strstr(source, "#pragma parameter"); + char *s = strstr(source, str); while (s) { @@ -492,7 +492,7 @@ static void gl_glsl_strip_parameter_pragmas(char *source) * so we can just replace the entire line with spaces. */ while (*s != '\0' && *s != '\n') *s++ = ' '; - s = strstr(s, "#pragma parameter"); + s = strstr(s, str); } } @@ -506,7 +506,7 @@ static bool gl_glsl_load_source_path(struct video_shader_pass *pass, if (nitems <= 0 || len <= 0) return false; - gl_glsl_strip_parameter_pragmas(pass->source.string.vertex); + gl_glsl_strip_parameter_pragmas(pass->source.string.vertex, "#pragma parameter"); pass->source.string.fragment = strdup(pass->source.string.vertex); return pass->source.string.fragment && pass->source.string.vertex; } diff --git a/gfx/drivers_shader/shader_vulkan.cpp b/gfx/drivers_shader/shader_vulkan.cpp index 57559d3258..cc587083d4 100644 --- a/gfx/drivers_shader/shader_vulkan.cpp +++ b/gfx/drivers_shader/shader_vulkan.cpp @@ -210,9 +210,10 @@ class Framebuffer Framebuffer(Framebuffer&&) = delete; void operator=(Framebuffer&&) = delete; - void set_size(DeferredDisposer &disposer, const Size2D &size); + void set_size(DeferredDisposer &disposer, const Size2D &size, VkFormat format = VK_FORMAT_UNDEFINED); const Size2D &get_size() const { return size; } + VkFormat get_format() const { return format; } VkImage get_image() const { return image; } VkImageView get_view() const { return view; } VkFramebuffer get_framebuffer() const { return framebuffer; } @@ -1009,9 +1010,10 @@ void vulkan_filter_chain::update_history(DeferredDisposer &disposer, VkCommandBu swap(back, tmp); if (input_texture.width != tmp->get_size().width || - input_texture.height != tmp->get_size().height) + input_texture.height != tmp->get_size().height || + (input_texture.format != VK_FORMAT_UNDEFINED && input_texture.format != tmp->get_format())) { - tmp->set_size(disposer, { input_texture.width, input_texture.height }); + tmp->set_size(disposer, { input_texture.width, input_texture.height }, input_texture.format); } tmp->copy(cmd, input_texture.image, src_layout); @@ -2422,12 +2424,14 @@ void Framebuffer::init_framebuffer() vkCreateFramebuffer(device, &info, nullptr, &framebuffer); } -void Framebuffer::set_size(DeferredDisposer &disposer, const Size2D &size) +void Framebuffer::set_size(DeferredDisposer &disposer, const Size2D &size, VkFormat format) { this->size = size; + if (format != VK_FORMAT_UNDEFINED) + this->format = format; - RARCH_LOG("[Vulkan filter chain]: Updating framebuffer size %u x %u.\n", - size.width, size.height); + RARCH_LOG("[Vulkan filter chain]: Updating framebuffer size %u x %u (format: %u).\n", + size.width, size.height, (unsigned)this->format); { // The current framebuffers, etc, might still be in use diff --git a/gfx/drivers_shader/shader_vulkan.h b/gfx/drivers_shader/shader_vulkan.h index 79ac7f2d8f..7c7e07ad91 100644 --- a/gfx/drivers_shader/shader_vulkan.h +++ b/gfx/drivers_shader/shader_vulkan.h @@ -53,6 +53,7 @@ struct vulkan_filter_chain_texture VkImageLayout layout; unsigned width; unsigned height; + VkFormat format; }; enum vulkan_filter_chain_scale diff --git a/gfx/video_crt_switch.c b/gfx/video_crt_switch.c index 282d2aea39..d154cfa41b 100644 --- a/gfx/video_crt_switch.c +++ b/gfx/video_crt_switch.c @@ -88,7 +88,7 @@ static void switch_res_crt(unsigned width, unsigned height) { if (height > 100) { - video_display_server_switch_resolution(width, height, + video_display_server_set_resolution(width, height, ra_set_core_hz, ra_core_hz, crt_center_adjust); video_driver_apply_state_changes(); } diff --git a/gfx/video_display_server.c b/gfx/video_display_server.c index 98fd57eca1..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) @@ -90,14 +90,21 @@ bool video_display_server_set_window_decorations(bool on) } -bool video_display_server_switch_resolution(unsigned width, unsigned height, +bool video_display_server_set_resolution(unsigned width, unsigned height, int int_hz, float hz, int center) { - if (current_display_server && current_display_server->switch_resolution) - return current_display_server->switch_resolution(current_display_server_data, width, height, int_hz, hz, center); + if (current_display_server && current_display_server->set_resolution) + return current_display_server->set_resolution(current_display_server_data, width, height, int_hz, hz, center); return false; } +void *video_display_server_get_resolution_list(unsigned *size) +{ + if (current_display_server && current_display_server->get_resolution_list) + return current_display_server->get_resolution_list(current_display_server_data, size); + return NULL; +} + const char *video_display_server_get_output_options(void) { if (current_display_server && current_display_server->get_output_options) diff --git a/gfx/video_display_server.h b/gfx/video_display_server.h index 9a39100807..2824b4b4ee 100644 --- a/gfx/video_display_server.h +++ b/gfx/video_display_server.h @@ -23,6 +23,16 @@ RETRO_BEGIN_DECLS +typedef struct video_display_config +{ + unsigned width; + unsigned height; + unsigned bpp; + unsigned refreshrate; + unsigned idx; + bool current; +} video_display_config_t; + typedef struct video_display_server { void *(*init)(void); @@ -30,8 +40,10 @@ typedef struct video_display_server bool (*set_window_opacity)(void *data, unsigned opacity); bool (*set_window_progress)(void *data, int progress, bool finished); bool (*set_window_decorations)(void *data, bool on); - bool (*switch_resolution)(void *data, unsigned width, + bool (*set_resolution)(void *data, unsigned width, unsigned height, int int_hz, float hz, int center); + void *(*get_resolution_list)(void *data, + unsigned *size); const char *(*get_output_options)(void *data); const char *ident; } video_display_server_t; @@ -46,10 +58,12 @@ bool video_display_server_set_window_progress(int progress, bool finished); bool video_display_server_set_window_decorations(bool on); -bool video_display_server_switch_resolution( +bool video_display_server_set_resolution( unsigned width, unsigned height, int int_hz, float hz, int center); +void *video_display_server_get_resolution_list(unsigned *size); + const char *video_display_server_get_output_options(void); const char *video_display_server_get_ident(void); diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 75f2f46bfb..88ef1862ef 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -985,10 +985,12 @@ static bool video_driver_init_internal(bool *video_is_threaded) } else { - if (settings->uints.video_window_x || settings->uints.video_window_y) + /* To-Do: remove when the new window resizing core is hooked */ + if (settings->bools.video_window_save_positions && + (settings->uints.window_position_width || settings->uints.window_position_height)) { - width = settings->uints.video_window_x; - height = settings->uints.video_window_y; + width = settings->uints.window_position_width; + height = settings->uints.window_position_height; } else { @@ -1002,7 +1004,7 @@ static bool video_driver_init_internal(bool *video_is_threaded) else width = roundf(geom->base_width * settings->floats.video_scale); height = roundf(geom->base_height * settings->floats.video_scale); - } +} } if (width && height) @@ -1491,15 +1493,6 @@ void video_driver_menu_settings(void **list_data, void *list_info_data, (void)subgroup_info; (void)global; -#if defined(GEKKO) || defined(__CELLOS_LV2__) - CONFIG_ACTION( - list, list_info, - MENU_ENUM_LABEL_SCREEN_RESOLUTION, - MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION, - group_info, - subgroup_info, - parent_group); -#endif #if defined(__CELLOS_LV2__) CONFIG_BOOL( list, list_info, @@ -2456,10 +2449,13 @@ void video_driver_frame(const void *data, unsigned width, char frames_text[64]; last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL); - if (video_info.fps_show) + if (video_info.fps_show || video_info.framecount_show) { - snprintf(video_info.fps_text, sizeof(video_info.fps_text), - "|| FPS: %6.1f ", last_fps); + if (video_info.fps_show) + { + snprintf(video_info.fps_text, sizeof(video_info.fps_text), + " || FPS: %6.1f ", last_fps); + } if (video_info.framecount_show) { snprintf(frames_text, @@ -2468,7 +2464,8 @@ void video_driver_frame(const void *data, unsigned width, (uint64_t)video_driver_frame_count); } snprintf(video_driver_window_title, sizeof(video_driver_window_title), - "%s%s%s", title, video_info.fps_text, + "%s%s%s", title, + video_info.fps_show ? video_info.fps_text : "", video_info.framecount_show ? frames_text : ""); } else @@ -2498,6 +2495,28 @@ void video_driver_frame(const void *data, unsigned width, "FPS: %6.1f", last_fps); } + + if (video_info.fps_show && video_info.framecount_show) + snprintf( + video_info.fps_text, + sizeof(video_info.fps_text), + "FPS: %6.1f || %s: %" PRIu64, + last_fps, + msg_hash_to_str(MSG_FRAMES), + (uint64_t)video_driver_frame_count); + else if (video_info.framecount_show) + snprintf( + video_info.fps_text, + sizeof(video_info.fps_text), + "%s: %" PRIu64, + msg_hash_to_str(MSG_FRAMES), + (uint64_t)video_driver_frame_count); + else if (video_info.fps_show) + snprintf( + video_info.fps_text, + sizeof(video_info.fps_text), + "FPS: %6.1f", + last_fps); } else { @@ -2627,7 +2646,7 @@ void video_driver_frame(const void *data, unsigned width, video_driver_frame_count++; /* Display the FPS, with a higher priority. */ - if (video_info.fps_show) + if (video_info.fps_show || video_info.framecount_show) runloop_msg_queue_push(video_info.fps_text, 2, 1, true); /* trigger set resolution*/ 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) diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index 6a9050381f..3e0339e9a0 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -1057,8 +1057,17 @@ static void handle_hotplug(android_input_t *android, * This device is composed of two hid devices * We make it look like one device */ - else if((strstr(device_model, "R800") || strstr(device_model, "Xperia Play")) && + else if( ( + strstr(device_model, "R800x") || + strstr(device_model, "R800at") || + strstr(device_model, "R800i") || + strstr(device_model, "R800a") || + strstr(device_model, "R800") || + strstr(device_model, "Xperia Play") || + strstr(device_model, "Play") || + strstr(device_model, "SO-01D") + ) && ( strstr(device_name, "keypad-game-zeus") || strstr(device_name, "keypad-zeus") || strstr(device_name, "Android Gamepad") diff --git a/input/drivers_joypad/switch_joypad.c b/input/drivers_joypad/switch_joypad.c index 67a4556196..b92397779b 100644 --- a/input/drivers_joypad/switch_joypad.c +++ b/input/drivers_joypad/switch_joypad.c @@ -170,6 +170,7 @@ static void switch_joypad_poll(void) { hidSetNpadJoyAssignmentModeSingleByDefault(i); hidSetNpadJoyAssignmentModeSingleByDefault(i + 1); + hidSetNpadJoyHoldType(HidJoyHoldType_Horizontal); } } lastMode = 1; @@ -185,6 +186,7 @@ static void switch_joypad_poll(void) { hidSetNpadJoyAssignmentModeDual(i); hidSetNpadJoyAssignmentModeDual(i + 1); + hidMergeSingleJoyAsDualJoy(i, i + 1); } } lastMode = 0; diff --git a/input/input_defines.h b/input/input_defines.h index ea52a3c890..891d850bdd 100644 --- a/input/input_defines.h +++ b/input/input_defines.h @@ -97,6 +97,7 @@ enum RARCH_SCREENSHOT, RARCH_MUTE, RARCH_OSK, + RARCH_FPS_TOGGLE, RARCH_NETPLAY_GAME_WATCH, RARCH_ENABLE_HOTKEY, RARCH_VOLUME_UP, diff --git a/input/input_driver.c b/input/input_driver.c index 7261a4ca27..2e0c055fb9 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -343,6 +343,7 @@ const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = { DECLARE_META_BIND(2, screenshot, RARCH_SCREENSHOT, MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT), DECLARE_META_BIND(2, audio_mute, RARCH_MUTE, MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE), DECLARE_META_BIND(2, osk_toggle, RARCH_OSK, MENU_ENUM_LABEL_VALUE_INPUT_META_OSK), + DECLARE_META_BIND(2, fps_toggle, RARCH_FPS_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE), DECLARE_META_BIND(2, netplay_game_watch, RARCH_NETPLAY_GAME_WATCH, MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH), DECLARE_META_BIND(2, enable_hotkey, RARCH_ENABLE_HOTKEY, MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY), DECLARE_META_BIND(2, volume_up, RARCH_VOLUME_UP, MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP), diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 88b3ade95b..d16d7dbe7b 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -2669,9 +2669,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, "Set the custom height size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution.") + "Set the custom width size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution") + "Set the custom height size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, "Specify custom X axis position for onscreen text.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, @@ -3369,6 +3369,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show Add to Favorites") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show/hide the 'Add to Favorites' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Show Options") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3432,7 +3436,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE, "Notification Blue Color") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, - "Show frame count on FPS display") + "Display Frame Count") MSG_HASH(MSG_CONFIG_OVERRIDE_LOADED, "Configuration override loaded.") MSG_HASH(MSG_GAME_REMAP_FILE_LOADED, @@ -3722,3 +3726,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 813689be7c..c1a67fc089 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -15,6 +15,8 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, "调整 Switch çš„å±å¹•亮度" ) +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) MSG_HASH( MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, "CPU 超频" @@ -210,7 +212,7 @@ MSG_HASH( MSG_HASH( MENU_ENUM_LABEL_VALUE_ACHIEVEMENT_LIST_HARDCORE, - "æˆå°±åˆ—表(硬核)" /*FIXME:"Achievement List (Hardcore)"*/ + "æˆå°±åˆ—表(硬核模å¼ï¼‰" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST, @@ -650,9 +652,11 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ENTRY_HOVER_COLOR, MSG_HASH(MENU_ENUM_LABEL_VALUE_ENTRY_NORMAL_COLOR, "èœå•项正常颜色") MSG_HASH(MENU_ENUM_LABEL_VALUE_FALSE, - "å‡") + "å¦") MSG_HASH(MENU_ENUM_LABEL_VALUE_FASTFORWARD_RATIO, "最大è¿è¡Œé€Ÿåº¦") +MSG_HASH(MENU_ENUM_LABEL_VALUE_FAVORITES_TAB, + "æ”¶è—夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_FPS_SHOW, "显示帧率") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, @@ -1707,7 +1711,7 @@ MSG_HASH( MSG_HASH(MENU_ENUM_LABEL_VALUE_TITLE_COLOR, "èœå•标题颜色") MSG_HASH(MENU_ENUM_LABEL_VALUE_TRUE, - "真") + "是") MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_ENABLE, "UI Companion Enable") MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT, @@ -3642,6 +3646,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "显示「添加到收è—夹ã€") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "显示或éšè—「添加到收è—夹ã€é€‰é¡¹ã€‚") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "显示「核心选项ã€") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -4613,7 +4621,7 @@ MSG_HASH( "Output Display ID") MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_START_RECORDING, - "Start Recording" + "开始录制" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_START_RECORDING, @@ -4621,7 +4629,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_STOP_RECORDING, - "Stop Recording" + "åœæ­¢å½•制" ) MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_STOP_RECORDING, @@ -4676,11 +4684,11 @@ MSG_HASH( "YouTube" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, - "Twitch Stream Key") + "Twitch 直播密钥") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, - "YouTube Stream Key") + "YouTube 直播密钥") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, - "Streaming Mode") + "直播模å¼") MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_TITLE, "直播标题") MSG_HASH( @@ -4700,46 +4708,52 @@ MSG_HASH( "OK" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME, - "èœå•颜色主题") + "èœå•主题颜色") MSG_HASH( MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_WHITE, - "Basic White" + "白色" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_OZONE_COLOR_THEME_BASIC_BLACK, - "Basic Black" + "黑色" ) MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, - "Select a different color theme." + "选择ä¸åŒçš„主题颜色。" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use preferred system color theme") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, "Use your operating system's color theme (if any) - overrides theme settings.") MSG_HASH(MSG_RESAMPLER_QUALITY_LOWEST, - "Lowest") + "最低") MSG_HASH(MSG_RESAMPLER_QUALITY_LOWER, - "Lower") + "较低") MSG_HASH(MSG_RESAMPLER_QUALITY_NORMAL, - "Normal") + "一般") MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHER, - "Higher") + "较高") MSG_HASH(MSG_RESAMPLER_QUALITY_HIGHEST, - "Highest") + "最高") MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_MUSIC_AVAILABLE, - "No music available." + "没有音ä¹ã€‚" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_VIDEOS_AVAILABLE, - "No videos available." + "没有视频。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_IMAGES_AVAILABLE, - "No images available." + "没有图片。" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, - "No favorites available." + "没有收è—。" ) +MSG_HASH( + MSG_MISSING_ASSETS, + "Warning: Missing assets, use the Online Updater if available" + ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index c025ffed0a..2a70764f89 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -2499,9 +2499,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, "Set the custom height size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution.") + "Set the custom width size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution") + "Set the custom height size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, "Specify custom X axis position for onscreen text.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, @@ -3177,6 +3177,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "顯示 Add to Favorites") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "顯示/éš±è— the 'Add to Favorites' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "顯示 Options") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3500,3 +3504,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index f87411aa60..0c7e2d15a8 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -15,6 +15,8 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, "Anpassen der Switch Bildschirmhelligkeit" ) +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) MSG_HASH( MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, "CPU Übertakten" @@ -3295,6 +3297,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Zeige 'Zu Favoriten hinzufügen'") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Zeige/verstecke die Option 'Zu Favoriten hinzufügen'.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Zeige 'Optionen'") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3636,3 +3642,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index e3bc73e9e9..f7a4cf468e 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -4862,11 +4862,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution." + "Set the custom width size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution" + "Set the custom height size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, @@ -6098,6 +6098,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show/hide the 'Add to Favorites' option." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Show Options" @@ -6224,7 +6232,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, - "Show frame count on FPS display" + "Display Frame Count" ) MSG_HASH( MSG_CONFIG_OVERRIDE_LOADED, @@ -7730,3 +7738,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index c28eff54ef..06ac75250e 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -2372,9 +2372,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, "Set the custom height size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution.") + "Set the custom width size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution") + "Set the custom height size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, "Specify custom X axis position for onscreen text.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, @@ -3052,6 +3052,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show Add to Favorites") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show/hide the 'Add to Favorites' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Show Options") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3375,3 +3379,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 19ac3b8b90..aca567dfcb 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -15,6 +15,8 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, "Ajusta el brillo de la pantalla" ) +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) MSG_HASH( MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, "CPU Overclock" @@ -6099,6 +6101,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Mostrar/ocultar la opción de 'Agregar a favoritos'" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Mostrar opciones" @@ -7747,4 +7757,6 @@ MSG_HASH( MSG_HASH( MSG_MISSING_ASSETS, "ADVERTENCIA: Faltan recursos, use el Actualizador si está disponible" - ) \ No newline at end of file + ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 2d9a560a34..d73c584f7e 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3211,6 +3211,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show Add to Favorites") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show/hide the 'Add to Favorites' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Show Options") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3534,3 +3538,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index fe7be6d34a..ad0cafed43 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3271,6 +3271,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Visualizza Aggiungi a Preferiti") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Mostra/nasconde l'opzione Aggiungi a Preferiti.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Visualizza Opzioni") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3594,3 +3598,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "Nessun preferito disponibile." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 813efe054a..2fa257e0d4 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3397,6 +3397,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "ã€ŒãŠæ°—ã«å…¥ã‚Šã«è¿½åŠ ã€ã‚’表示") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "ã€ŒãŠæ°—ã«å…¥ã‚Šã«è¿½åŠ ã€ã‚ªãƒ—ションを表示/éžè¡¨ç¤ºã«ã™ã‚‹ã€‚") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "「オプションã€ã‚’表示") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -4043,3 +4047,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 60b669cbfb..9442c78d3b 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3172,6 +3172,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show Add to Favorites") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show/hide the 'Add to Favorites' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Show Options") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3495,3 +3499,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 9ac9cf2db7..55bada0865 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -3,6 +3,8 @@ MSG_HASH(MENU_ENUM_LABEL_SWITCH_GPU_PROFILE, "switch_gpu_profile") MSG_HASH(MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL, "switch_backlight_control") +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) MSG_HASH(MENU_ENUM_LABEL_SWITCH_CPU_PROFILE, "switch_cpu_profile") #endif @@ -259,6 +261,8 @@ MSG_HASH(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST, "deferred_dropdown_box_list") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL, "deferred_dropdown_box_list_special") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION, + "deferred_dropdown_box_list_resolution") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST, "deferred_configurations_list") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST, @@ -1511,6 +1515,8 @@ MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE, "quick_menu_show_undo_save_load_state") MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "quick_menu_show_add_to_favorites") +MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "quick_menu_show_reset_core_association") MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_OPTIONS, "quick_menu_show_options") MSG_HASH(MENU_ENUM_LABEL_QUICK_MENU_SHOW_CONTROLS, @@ -1549,6 +1555,8 @@ MSG_HASH(MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_BLUE, "video_msg_color_blue") MSG_HASH(MENU_ENUM_LABEL_FRAMECOUNT_SHOW, "framecount_show") +MSG_HASH(MENU_ENUM_LABEL_MEMORY_SHOW, + "memory_show") MSG_HASH(MENU_ENUM_LABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST, "automatically_add_content_to_playlist") MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY, @@ -1565,6 +1573,8 @@ MSG_HASH(MENU_ENUM_LABEL_INPUT_DRIVER_LINUXRAW, "linuxraw") MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS, "video_window_show_decorations") +MSG_HASH(MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION, + "video_window_save_position") MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_BORDER_FILLER_ENABLE, "menu_rgui_border_filler_enable") MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index b32f6d954e..5b84c6c849 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -2388,9 +2388,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, "Set the custom height size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution.") + "Set the custom width size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution") + "Set the custom height size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, "Specify custom X axis position for onscreen text.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, @@ -3066,6 +3066,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show Add to Favorites") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show/hide the 'Add to Favorites' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Toon Opties") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3381,3 +3385,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "Geen favorieten beschikbaar." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 882a39f1bc..0de82669c5 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3438,6 +3438,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Pokaż dodaj do ulubionych") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Pokaż/ukryj opcjÄ™ 'Dodaj do ulubionych'.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Pokaż opcje") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3797,3 +3801,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "Brak ulubionych." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "ZapamiÄ™taj poÅ‚ożenie i rozmiar okna") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index adcad4badf..a9c4bc8d89 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -15,6 +15,8 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, "Aumentar ou diminuir o brilho da tela do Switch" ) +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) MSG_HASH( MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, "Overclock da CPU" @@ -6131,6 +6133,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Exibir/ocultar a opção 'Adicionar aos Favoritos'." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Exibir Opções" @@ -7779,4 +7789,6 @@ MSG_HASH( MSG_HASH( MSG_MISSING_ASSETS, "Aviso: Recursos ausentes, use o Atualizador Online se disponível" - ) \ No newline at end of file + ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 056b071dca..6b05ed4ea2 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3146,6 +3146,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Mostrar 'Adicionar aos favoritos'") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Mostrar/esconder a opção 'Adicionar aos favoritos'.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Mostrar 'Opções'") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3461,3 +3465,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 51bb95d1de..ba735cba78 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3220,6 +3220,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Показать Добавить в избранное") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Показать/Ñкрыть наÑтройку 'Добавить в избранное'.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Показать ÐаÑтройки") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3664,3 +3668,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index 83db0a6a8e..6f46d28063 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -104,6 +104,10 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "Toggles onscreen keyboard."); break; + case RARCH_FPS_TOGGLE: + snprintf(s, len, + "Toggles frames per second counter."); + break; case RARCH_NETPLAY_GAME_WATCH: snprintf(s, len, "Netplay toggle play/spectate mode."); @@ -567,6 +571,11 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) "Enables displaying the current frames \n" "per second."); break; + case MENU_ENUM_LABEL_MEMORY_SHOW: + snprintf(s, len, + "Includes displaying the current memory \n" + "usage/total with FPS/Frames."); + break; case MENU_ENUM_LABEL_VIDEO_FONT_ENABLE: snprintf(s, len, "Show and/or hide onscreen messages."); diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index bf9b3fe806..41f76c5d83 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -15,6 +15,8 @@ MSG_HASH( MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, "Increase or decrease the Switch screen brightness" ) +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) MSG_HASH( MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, "CPU Overclock" @@ -843,6 +845,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_FPS_SHOW, "Display Framerate" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MEMORY_SHOW, + "Include Memory Details" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, "Limit Maximum Run Speed" @@ -1247,6 +1253,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_FRAMEADVANCE, "Frameadvance" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE, + "FPS toggle" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY, "Fullscreen toggle" @@ -3206,6 +3216,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" @@ -3626,6 +3640,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_FPS_SHOW, "Displays the current framerate per second onscreen." ) +MSG_HASH( + MENU_ENUM_SUBLABEL_FRAMECOUNT_SHOW, + "Displays the current frame count onscreen." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MEMORY_SHOW, + "Includes the current memory usage/total onscreen with FPS/Frames." + ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, "Configure hotkey settings." @@ -4886,19 +4908,23 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, - "Set the custom width size for the display window. Leaving it at 0 will attempt to scale the window as large as possible." + "Set the custom width for the display window." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, - "Set the custom height size for the display window. Leaving it at 0 will attempt to scale the window as large as possible." + "Set the custom height for the display window." + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SAVE_POSITION, + "Remember window size and position, enabling this has precedence over Windowed Scale" ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution." + "Set the custom width size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution" + "Set the custom height size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution." ) MSG_HASH( MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, @@ -6131,6 +6157,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show/hide the 'Add to Favorites' option." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Show Options" @@ -6257,7 +6291,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, - "Show frame count on FPS display" + "Display Frame Count" ) MSG_HASH( MSG_CONFIG_OVERRIDE_LOADED, @@ -7788,3 +7822,7 @@ MSG_HASH( MSG_MISSING_ASSETS, "Warning: Missing assets, use the Online Updater if available" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size" + ) diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 56937789be..b0ec9bed99 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -2537,9 +2537,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, "Set the custom height size for the display window. Leaving it at 0 will attempt to scale the window as large as possible.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, - "Set the custom width size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution.") + "Set the custom width size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y, - "Set the custom height size for the non-windowed fullscreen mode. Leaving it at 0 will use the desktop resolution") + "Set the custom height size for the non-windowed fullscreen mode. Leaving it unset will use the desktop resolution.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X, "Specify custom X axis position for onscreen text.") MSG_HASH(MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y, @@ -3209,6 +3209,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show Add to Favorites") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, "Show/hide the 'Add to Favorites' option.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show Reset Core Association") +MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + "Show/hide the 'Reset Core Association' option.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, "Show Options") MSG_HASH(MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS, @@ -3534,3 +3538,5 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_NO_FAVORITES_AVAILABLE, "No favorites available." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + "Remember Window Position and Size") diff --git a/lakka.h b/lakka.h index 0447aa6ed5..2b6073ead4 100644 --- a/lakka.h +++ b/lakka.h @@ -24,67 +24,6 @@ #define LAKKA_UPDATE_DIR "/storage/.update/" #define LAKKA_CONNMAN_DIR "/storage/.cache/connman/" -#ifdef HAVE_LAKKA_SWITCH -static char* SWITCH_GPU_PROFILES[] = { - "docked-overclock-3", - "docked-overclock-2", - "docked-overclock-1", - "docked", - "non-docked-overclock-5", - "non-docked-overclock-4", - "non-docked-overclock-3", - "non-docked-overclock-2", - "non-docked-overclock-1", - "non-docked", - "non-docked-underclock-1", - "non-docked-underclock-2", - "non-docked-underclock-3", -}; - -static char* SWITCH_GPU_SPEEDS[] = { - "998 Mhz", - "921 Mhz", - "844 Mhz", - "768 Mhz", - "691 Mhz", - "614 Mhz", - "537 Mhz", - "460 Mhz", - "384 Mhz", - "307 Mhz", - "230 Mhz", - "153 Mhz", - "76 Mhz" -}; - -static int SWITCH_BRIGHTNESS[] = { - 10, - 20, - 30, - 40, - 50, - 60, - 70, - 80, - 90, - 100 -}; - -static char* SWITCH_CPU_PROFILES[] = { - "overclock-4", - "overclock-3", - "overclock-2", - "overclock-1", - "default", -}; - -static char* SWITCH_CPU_SPEEDS[] = { - "1912 MHz", - "1734 MHz", - "1530 MHz", - "1224 MHz", - "1020 MHz" -}; -#endif +#include "switch_performance_profiles.h" #endif diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 39fd92b9ff..79e1aee9b2 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -187,10 +187,13 @@ generic_deferred_push(deferred_push_core_content_dirs_subdir_list, DISPLAYLIST_ generic_deferred_push(deferred_push_lakka_list, DISPLAYLIST_LAKKA) #endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) +generic_deferred_push(deferred_push_switch_cpu_profile, DISPLAYLIST_SWITCH_CPU_PROFILE) +#endif + #ifdef HAVE_LAKKA_SWITCH generic_deferred_push(deferred_push_switch_gpu_profile, DISPLAYLIST_SWITCH_GPU_PROFILE) generic_deferred_push(deferred_push_switch_backlight_control, DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL) -generic_deferred_push(deferred_push_switch_cpu_profile, DISPLAYLIST_SWITCH_CPU_PROFILE) #endif static int deferred_push_cursor_manager_list_deferred( @@ -613,6 +616,7 @@ generic_deferred_push_clear_general(deferred_image_history_list, PUSH_DEFAULT, D generic_deferred_push_clear_general(deferred_video_history_list, PUSH_DEFAULT, DISPLAYLIST_VIDEO_HISTORY) generic_deferred_push_clear_general(deferred_push_dropdown_box_list, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST) generic_deferred_push_clear_general(deferred_push_dropdown_box_list_special, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_SPECIAL) +generic_deferred_push_clear_general(deferred_push_dropdown_box_list_resolution, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_RESOLUTION) static int menu_cbs_init_bind_deferred_push_compare_label( menu_file_list_cbs_t *cbs, @@ -633,6 +637,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label( BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_dropdown_box_list_special); return 0; } + else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION))) + { + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_dropdown_box_list_resolution); + return 0; + } else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_LIST))) { BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_browse_url_list); @@ -900,6 +909,8 @@ static int menu_cbs_init_bind_deferred_push_compare_label( { BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_switch_backlight_control); } +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) else if (strstr(label, msg_hash_to_str(MENU_ENUM_LABEL_SWITCH_CPU_PROFILE))) { diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 577e7d993e..fa24a25936 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -60,6 +60,7 @@ #include "../../verbosity.h" #include "../../lakka.h" #include "../../wifi/wifi_driver.h" +#include "../../gfx/video_display_server.h" #include @@ -150,6 +151,8 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl) return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST; case ACTION_OK_DL_DROPDOWN_BOX_LIST_SPECIAL: return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL; + case ACTION_OK_DL_DROPDOWN_BOX_LIST_RESOLUTION: + return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION; case ACTION_OK_DL_MIXER_STREAM_SETTINGS_LIST: return MENU_ENUM_LABEL_DEFERRED_MIXER_STREAM_SETTINGS_LIST; case ACTION_OK_DL_ACCOUNTS_LIST: @@ -323,6 +326,15 @@ int generic_action_ok_displaylist_push(const char *path, info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL; dl_type = DISPLAYLIST_GENERIC; break; + case ACTION_OK_DL_DROPDOWN_BOX_LIST_RESOLUTION: + info.type = type; + info.directory_ptr = idx; + info_path = path; + info_label = msg_hash_to_str( + MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION); + info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION; + dl_type = DISPLAYLIST_GENERIC; + break; case ACTION_OK_DL_USER_BINDS_LIST: info.type = type; info.directory_ptr = idx; @@ -509,24 +521,36 @@ int generic_action_ok_displaylist_push(const char *path, } break; case ACTION_OK_DL_DISK_IMAGE_APPEND_LIST: - filebrowser_clear_type(); - info.type = type; - info.directory_ptr = idx; - info_path = settings->paths.directory_menu_content; - info_label = label; - dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; + { + char game_dir[PATH_MAX_LENGTH]; + filebrowser_clear_type(); + strlcpy(game_dir, path_get(RARCH_PATH_CONTENT), sizeof(game_dir)); + path_basedir(game_dir); + + info.type = type; + info.directory_ptr = idx; + info_path = !string_is_empty(game_dir) ? game_dir : settings->paths.directory_menu_content; + info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; + } break; case ACTION_OK_DL_SUBSYSTEM_ADD_LIST: - filebrowser_clear_type(); - if (content_get_subsystem() != type - MENU_SETTINGS_SUBSYSTEM_ADD) - content_clear_subsystem(); - content_set_subsystem(type - MENU_SETTINGS_SUBSYSTEM_ADD); - filebrowser_set_type(FILEBROWSER_SELECT_FILE_SUBSYSTEM); - info.type = type; - info.directory_ptr = idx; - info_path = settings->paths.directory_menu_content; - info_label = label; - dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; + { + char game_dir[PATH_MAX_LENGTH]; + filebrowser_clear_type(); + strlcpy(game_dir, path_get(RARCH_PATH_CONTENT), sizeof(game_dir)); + path_basedir(game_dir); + + if (content_get_subsystem() != type - MENU_SETTINGS_SUBSYSTEM_ADD) + content_clear_subsystem(); + content_set_subsystem(type - MENU_SETTINGS_SUBSYSTEM_ADD); + filebrowser_set_type(FILEBROWSER_SELECT_FILE_SUBSYSTEM); + info.type = type; + info.directory_ptr = idx; + info_path = !string_is_empty(game_dir) ? game_dir : settings->paths.directory_menu_content; + info_label = label; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; + } break; case ACTION_OK_DL_SUBSYSTEM_LOAD: { @@ -2512,25 +2536,34 @@ static int action_ok_deferred_list_stub(const char *path, return 0; } -#ifdef HAVE_LAKKA_SWITCH +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) static int action_ok_set_switch_cpu_profile(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { char* profile_name = SWITCH_CPU_PROFILES[entry_idx]; - char command[PATH_MAX_LENGTH] = {0}; +#ifdef HAVE_LAKKA_SWITCH snprintf(command, sizeof(command), "cpu-profile set %s", profile_name); system(command); - snprintf(command, sizeof(command), "Current profile set to %s", profile_name); - +#else + config_get_ptr()->uints.libnx_overclock = entry_idx; + + unsigned profile_clock = SWITCH_CPU_SPEEDS_VALUES[entry_idx]; + pcvSetClockRate(PcvModule_Cpu, (u32)profile_clock); + snprintf(command, sizeof(command), "Current Clock set to %i", profile_clock); +#endif + runloop_msg_queue_push(command, 1, 90, true); return menu_cbs_exit(); } +#endif + +#ifdef HAVE_LAKKA_SWITCH static int action_ok_set_switch_gpu_profile(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) @@ -4449,6 +4482,45 @@ static int action_ok_push_dropdown_item(const char *path, return 0; } +static int action_ok_push_dropdown_item_resolution(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + char str[100]; + char *pch = NULL; + unsigned width = 0; + unsigned height = 0; + unsigned refreshrate = 0; + + snprintf(str, sizeof(str), "%s", path); + + pch = strtok(str, "x"); + if (pch) + width = strtoul(pch, NULL, 0); + pch = strtok(NULL, " "); + if (pch) + height = strtoul(pch, NULL, 0); + pch = strtok(NULL, "("); + if (pch) + refreshrate = strtoul(pch, NULL, 0); + + if (video_display_server_set_resolution(width, height, + refreshrate, (float)refreshrate, 0)) + { + settings_t *settings = config_get_ptr(); + + video_monitor_set_refresh_rate((float)refreshrate); + + settings->uints.video_fullscreen_x = width; + settings->uints.video_fullscreen_y = height; + + /* TODO/FIXME - menu drivers like XMB don't rescale + * automatically */ + return menu_cbs_exit(); + } + + return 0; +} + static int action_ok_push_default(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -4587,6 +4659,7 @@ default_action_ok_help(action_ok_help_load_content, MENU_ENUM_LABEL_HELP_LOADING static int action_ok_video_resolution(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { +#if defined(__CELLOS_LV2__) || defined(GEKKO) unsigned width = 0; unsigned height = 0; @@ -4610,6 +4683,12 @@ static int action_ok_video_resolution(const char *path, width, height); runloop_msg_queue_push(msg, 1, 100, true); } +#else + generic_action_ok_displaylist_push( + NULL, + NULL, NULL, 0, 0, 0, + ACTION_OK_DL_DROPDOWN_BOX_LIST_RESOLUTION); +#endif return 0; } @@ -5129,6 +5208,8 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, #ifdef HAVE_LAKKA_SWITCH case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL: +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: #endif BIND_ACTION_OK(cbs, action_ok_push_default); @@ -5555,6 +5636,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, case MENU_SETTING_DROPDOWN_ITEM: BIND_ACTION_OK(cbs, action_ok_push_dropdown_item); break; + case MENU_SETTING_DROPDOWN_ITEM_RESOLUTION: + BIND_ACTION_OK(cbs, action_ok_push_dropdown_item_resolution); + break; case MENU_SETTING_ACTION_CORE_DISK_OPTIONS: BIND_ACTION_OK(cbs, action_ok_push_default); break; @@ -5579,6 +5663,8 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, case MENU_SET_SWITCH_BRIGHTNESS: BIND_ACTION_OK(cbs, action_ok_set_switch_backlight); break; +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) case MENU_SET_SWITCH_CPU_PROFILE: BIND_ACTION_OK(cbs, action_ok_set_switch_cpu_profile); break; diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index c4ff5f6cf5..defe0e2dd6 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -40,6 +40,7 @@ #include "../../retroarch.h" #include "../../content.h" +#include "../../dynamic.h" #include "../../configuration.h" #include "../../managers/cheat_manager.h" @@ -123,6 +124,8 @@ default_sublabel_macro(action_bind_sublabel_user_language, MENU_ default_sublabel_macro(action_bind_sublabel_max_swapchain_images, MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES ) default_sublabel_macro(action_bind_sublabel_online_updater, MENU_ENUM_SUBLABEL_ONLINE_UPDATER) default_sublabel_macro(action_bind_sublabel_fps_show, MENU_ENUM_SUBLABEL_FPS_SHOW) +default_sublabel_macro(action_bind_sublabel_framecount_show, MENU_ENUM_SUBLABEL_FRAMECOUNT_SHOW) +default_sublabel_macro(action_bind_sublabel_memory_show, MENU_ENUM_SUBLABEL_MEMORY_SHOW) default_sublabel_macro(action_bind_sublabel_statistics_show, MENU_ENUM_SUBLABEL_STATISTICS_SHOW) default_sublabel_macro(action_bind_sublabel_netplay_settings, MENU_ENUM_SUBLABEL_NETPLAY) default_sublabel_macro(action_bind_sublabel_user_bind_settings, MENU_ENUM_SUBLABEL_INPUT_USER_BINDS) @@ -194,6 +197,7 @@ default_sublabel_macro(action_bind_sublabel_video_window_width, MENU_ default_sublabel_macro(action_bind_sublabel_video_window_height, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT) default_sublabel_macro(action_bind_sublabel_video_fullscreen_x, MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X) default_sublabel_macro(action_bind_sublabel_video_fullscreen_y, MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_Y) +default_sublabel_macro(action_bind_sublabel_video_save_window_position, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SAVE_POSITION) default_sublabel_macro(action_bind_sublabel_video_message_pos_x, MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X) default_sublabel_macro(action_bind_sublabel_video_message_pos_y, MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y) default_sublabel_macro(action_bind_sublabel_video_font_size, MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE) @@ -384,6 +388,7 @@ default_sublabel_macro(action_bind_sublabel_quick_menu_show_take_screenshot, default_sublabel_macro(action_bind_sublabel_quick_menu_show_save_load_state, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_LOAD_STATE) default_sublabel_macro(action_bind_sublabel_quick_menu_show_undo_save_load_state, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE) default_sublabel_macro(action_bind_sublabel_quick_menu_show_add_to_favorites, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES) +default_sublabel_macro(action_bind_sublabel_quick_menu_show_reset_core_association, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION) default_sublabel_macro(action_bind_sublabel_quick_menu_show_options, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS) default_sublabel_macro(action_bind_sublabel_quick_menu_show_controls, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CONTROLS) default_sublabel_macro(action_bind_sublabel_quick_menu_show_cheats, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CHEATS) @@ -481,9 +486,12 @@ default_sublabel_macro(action_bind_sublabel_show_wimp, #endif default_sublabel_macro(action_bind_sublabel_discord_allow, MENU_ENUM_SUBLABEL_DISCORD_ALLOW) +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) +default_sublabel_macro(action_bind_sublabel_switch_cpu_profile, MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE) +#endif + #ifdef HAVE_LAKKA_SWITCH default_sublabel_macro(action_bind_sublabel_switch_gpu_profile, MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE) -default_sublabel_macro(action_bind_sublabel_switch_cpu_profile, MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE) default_sublabel_macro(action_bind_sublabel_switch_backlight_control, MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL) #endif @@ -513,14 +521,23 @@ static int action_bind_sublabel_subsystem_add( char *s, size_t len) { rarch_system_info_t *system = runloop_get_system_info(); - const struct retro_subsystem_info *subsystem = (system && system->subsystem.data) ? - system->subsystem.data + (type - MENU_SETTINGS_SUBSYSTEM_ADD) : NULL; + const struct retro_subsystem_info *subsystem; - if (subsystem && content_get_subsystem_rom_id() < subsystem->num_roms) - snprintf(s, len, " Current Content: %s", - content_get_subsystem() == type - MENU_SETTINGS_SUBSYSTEM_ADD - ? subsystem->roms[content_get_subsystem_rom_id()].desc - : subsystem->roms[0].desc); + /* Core fully loaded, use the subsystem data */ + if (system->subsystem.data) + subsystem = system->subsystem.data + (type - MENU_SETTINGS_SUBSYSTEM_ADD); + /* Core not loaded completely, use the data we peeked on load core */ + else + subsystem = subsystem_data + (type - MENU_SETTINGS_SUBSYSTEM_ADD); + + if (subsystem && subsystem_current_count > 0) + { + if (content_get_subsystem_rom_id() < subsystem->num_roms) + snprintf(s, len, " Current Content: %s", + content_get_subsystem() == type - MENU_SETTINGS_SUBSYSTEM_ADD + ? subsystem->roms[content_get_subsystem_rom_id()].desc + : subsystem->roms[0].desc); + } return 0; } @@ -539,8 +556,8 @@ static int action_bind_sublabel_remap_kbd_sublabel( input_config_get_device_display_name(user_idx) ? input_config_get_device_display_name(user_idx) : (input_config_get_device_name(user_idx) ? - input_config_get_device_name(user_idx) : - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); + input_config_get_device_name(user_idx) : + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE))); return 0; } @@ -981,6 +998,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quick_menu_show_add_to_favorites); break; + case MENU_ENUM_LABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quick_menu_show_reset_core_association); + break; case MENU_ENUM_LABEL_QUICK_MENU_SHOW_OPTIONS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quick_menu_show_options); break; @@ -1624,6 +1644,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_VIDEO_FULLSCREEN_Y: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_fullscreen_y); break; + case MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_save_window_position); + break; case MENU_ENUM_LABEL_QUIT_RETROARCH: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_quit_retroarch); break; @@ -1868,6 +1891,12 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_FPS_SHOW: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_fps_show); break; + case MENU_ENUM_LABEL_FRAMECOUNT_SHOW: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_framecount_show); + break; + case MENU_ENUM_LABEL_MEMORY_SHOW: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_memory_show); + break; case MENU_ENUM_LABEL_MENU_VIEWS_SETTINGS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_views_settings_list); break; @@ -2023,10 +2052,12 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_show_wimp); break; #endif -#ifdef HAVE_LAKKA_SWITCH +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_switch_cpu_profile); break; +#endif +#ifdef HAVE_LAKKA_SWITCH case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_switch_gpu_profile); break; diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index de5b97afa9..9b3e3be0b7 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -210,9 +210,12 @@ default_title_copy_macro(action_get_title_cheevos_list, MENU_ENUM_LABE default_title_copy_macro(action_get_title_video_shader_parameters,MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS) default_title_copy_macro(action_get_title_video_shader_preset_parameters,MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_PARAMETERS) +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) +default_title_macro(action_get_title_switch_cpu_profile, MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE) +#endif + #ifdef HAVE_LAKKA_SWITCH default_title_macro(action_get_title_switch_gpu_profile, MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE) -default_title_macro(action_get_title_switch_cpu_profile, MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE) default_title_macro(action_get_title_switch_backlight_control, MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL) #endif @@ -879,13 +882,15 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_LIBRETRO_INFO_PATH: BIND_ACTION_GET_TITLE(cbs, action_get_title_core_info_directory); break; +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) + case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: + BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_cpu_profile); + break; +#endif #ifdef HAVE_LAKKA_SWITCH case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_gpu_profile); break; - case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: - BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_cpu_profile); - break; case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL: BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_backlight_control); break; @@ -1176,13 +1181,15 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_LIBRETRO_INFO_PATH: BIND_ACTION_GET_TITLE(cbs, action_get_title_core_info_directory); break; +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) + case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: + BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_cpu_profile); + break; +#endif #ifdef HAVE_LAKKA_SWITCH case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_gpu_profile); break; - case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: - BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_cpu_profile); - break; case MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL: BIND_ACTION_GET_TITLE(cbs, action_get_title_switch_backlight_control); break; @@ -1251,6 +1258,12 @@ int menu_cbs_init_bind_title(menu_file_list_cbs_t *cbs, BIND_ACTION_GET_TITLE(cbs, action_get_title_dropdown_item); return 0; } + if (string_is_equal(label, + msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION))) + { + BIND_ACTION_GET_TITLE(cbs, action_get_title_dropdown_item); + return 0; + } if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS))) { BIND_ACTION_GET_TITLE(cbs, action_get_quick_menu_views_settings_list); diff --git a/menu/drivers/nuklear/nk_common.c b/menu/drivers/nuklear/nk_common.c index 67323c0cf1..61800585fd 100644 --- a/menu/drivers/nuklear/nk_common.c +++ b/menu/drivers/nuklear/nk_common.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2014-2017 - Jean-Andr� Santoni - * Copyright (C) 2016-2017 - Andr�s Su�rez + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2016-2017 - Andrés Suárez * * 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- diff --git a/menu/drivers/ozone/ozone.c b/menu/drivers/ozone/ozone.c index 556b59fe20..c3a8324c55 100644 --- a/menu/drivers/ozone/ozone.c +++ b/menu/drivers/ozone/ozone.c @@ -45,6 +45,7 @@ #include "../../../core.h" #include "../../../verbosity.h" #include "../../../tasks/tasks_internal.h" +#include "../../../dynamic.h" ozone_node_t *ozone_alloc_node() { @@ -108,7 +109,7 @@ void ozone_free_list_nodes(file_list_t *list, bool actiondata) } } -static void *ozone_init(void **userdata, bool video_is_threaded) +static void *ozone_init(void **userdata, bool video_is_threaded) { bool fallback_color_theme = false; unsigned width, height, color_theme = 0; @@ -183,7 +184,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) if (settings->bools.menu_use_preferred_system_color_theme) { #ifdef HAVE_LIBNX - if (R_SUCCEEDED(setsysInitialize())) + if (R_SUCCEEDED(setsysInitialize())) { ColorSetId theme; setsysGetColorSetId(&theme); @@ -205,7 +206,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) color_theme = settings->uints.menu_ozone_color_theme; ozone_set_color_theme(ozone, color_theme); } - + ozone->need_compute = false; ozone->animations.scroll_y = 0.0f; ozone->animations.scroll_y_sidebar = 0.0f; @@ -351,7 +352,10 @@ static void ozone_context_reset(void *data, bool is_threaded) strlcat(filename, ".png", sizeof(filename)); if (!menu_display_reset_textures_list(filename, ozone->png_path, &ozone->textures[i], TEXTURE_FILTER_MIPMAP_LINEAR)) + { ozone->has_all_assets = false; + RARCH_WARN("[OZONE] Asset missing: %s%s%s\n", ozone->png_path, path_default_slash(), filename); + } } /* Sidebar textures */ @@ -362,7 +366,10 @@ static void ozone_context_reset(void *data, bool is_threaded) strlcat(filename, ".png", sizeof(filename)); if (!menu_display_reset_textures_list(filename, ozone->tab_path, &ozone->tab_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR)) + { ozone->has_all_assets = false; + RARCH_WARN("[OZONE] Asset missing: %s%s%s\n", ozone->tab_path, path_default_slash(), filename); + } } /* Theme textures */ @@ -371,8 +378,11 @@ static void ozone_context_reset(void *data, bool is_threaded) /* Icons textures init */ for (i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) - if (!menu_display_reset_textures_list(ozone_entries_icon_texture_path(ozone, i), ozone->icons_path, &ozone->icons_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR)) + if (!menu_display_reset_textures_list(ozone_entries_icon_texture_path(i), ozone->icons_path, &ozone->icons_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR)) + { ozone->has_all_assets = false; + RARCH_WARN("[OZONE] Asset missing: %s%s%s\n", ozone->icons_path, path_default_slash(), ozone_entries_icon_texture_path(i)); + } menu_display_allocate_white_texture(); @@ -427,7 +437,7 @@ static void ozone_context_destroy(void *data) /* Textures */ for (i = 0; i < OZONE_TEXTURE_LAST; i++) video_driver_texture_unload(&ozone->textures[i]); - + /* Icons */ for (i = 0; i < OZONE_TAB_TEXTURE_LAST; i++) video_driver_texture_unload(&ozone->tab_textures[i]); @@ -492,6 +502,7 @@ static int ozone_list_push(void *data, void *userdata, unsigned i = 0; core_info_list_t *list = NULL; menu_handle_t *menu = (menu_handle_t*)data; + const struct retro_subsystem_info* subsystem; switch (type) { @@ -583,62 +594,17 @@ static int ozone_list_push(void *data, void *userdata, if (settings->bools.menu_show_load_content) { - const struct retro_subsystem_info* subsystem = NULL; - entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST; menu_displaylist_setting(&entry); - subsystem = system->subsystem.data; + /* Core fully loaded, use the subsystem data */ + if (system->subsystem.data) + subsystem = system->subsystem.data; + /* Core not loaded completely, use the data we peeked on load core */ + else + subsystem = subsystem_data; - if (subsystem) - { - for (i = 0; i < (unsigned)system->subsystem.size; i++, subsystem++) - { - char s[PATH_MAX_LENGTH]; - if (content_get_subsystem() == i) - { - if (content_get_subsystem_rom_id() < subsystem->num_roms) - { - snprintf(s, sizeof(s), - "Load %s %s", - subsystem->desc, - i == content_get_subsystem() - ? "\u2605" : " "); - menu_entries_append_enum(info->list, - s, - msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), - MENU_ENUM_LABEL_SUBSYSTEM_ADD, - MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0); - } - else - { - snprintf(s, sizeof(s), - "Start %s %s", - subsystem->desc, - i == content_get_subsystem() - ? "\u2605" : " "); - menu_entries_append_enum(info->list, - s, - msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_LOAD), - MENU_ENUM_LABEL_SUBSYSTEM_LOAD, - MENU_SETTINGS_SUBSYSTEM_LOAD, 0, 0); - } - } - else - { - snprintf(s, sizeof(s), - "Load %s %s", - subsystem->desc, - i == content_get_subsystem() - ? "\u2605" : " "); - menu_entries_append_enum(info->list, - s, - msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), - MENU_ENUM_LABEL_SUBSYSTEM_ADD, - MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0); - } - } - } + menu_subsystem_populate(subsystem, info); } entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST; @@ -675,10 +641,12 @@ static int ozone_list_push(void *data, void *userdata, menu_displaylist_setting(&entry); } -#ifdef HAVE_LAKKA_SWITCH +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) entry.enum_idx = MENU_ENUM_LABEL_SWITCH_CPU_PROFILE; menu_displaylist_setting(&entry); +#endif +#ifdef HAVE_LAKKA_SWITCH entry.enum_idx = MENU_ENUM_LABEL_SWITCH_GPU_PROFILE; menu_displaylist_setting(&entry); @@ -774,15 +742,14 @@ static void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozo bottom_boundary = video_info_height - 87 - 78; entries_middle = video_info_height/2; - if (current_selection_middle_onscreen != entries_middle) - new_scroll = ozone->animations.scroll_y - (current_selection_middle_onscreen - entries_middle); - + new_scroll = ozone->animations.scroll_y - (current_selection_middle_onscreen - entries_middle); + if (new_scroll + ozone->entries_height < bottom_boundary) new_scroll = -(78 + ozone->entries_height - bottom_boundary); if (new_scroll > 0) new_scroll = 0; - + if (allow_animation) { /* Cursor animation */ @@ -812,7 +779,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; } } @@ -849,7 +815,7 @@ static void ozone_compute_entries_position(ozone_handle_t *ozone) /* Entry */ menu_entry_t entry; ozone_node_t *node = NULL; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)i, NULL, true); @@ -912,7 +878,7 @@ static void ozone_render(void *data, bool is_idle) ozone_handle_t *ozone = (ozone_handle_t*)data; if (!data) return; - + if (ozone->need_compute) { ozone_compute_entries_position(ozone); @@ -1067,12 +1033,12 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i menu_display_blend_end(video_info); ozone_draw_text(video_info, ozone, - do_swap ? + do_swap ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK), video_info->width - back_width, video_info->height - back_height + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba, false); ozone_draw_text(video_info, ozone, - do_swap ? + do_swap ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_OK), video_info->width - ok_width, video_info->height - ok_height + FONT_SIZE_FOOTER, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.footer, ozone->theme->text_rgba, false); @@ -1201,9 +1167,9 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) ozone->raster_blocks.sidebar.carr.coords.vertices = 0; /* Background */ - menu_display_draw_quad(video_info, - 0, 0, video_info->width, video_info->height, - video_info->width, video_info->height, + menu_display_draw_quad(video_info, + 0, 0, video_info->width, video_info->height, + video_info->width, video_info->height, !video_info->libretro_running ? ozone->theme->background : ozone->theme->background_libretro_running ); @@ -1227,7 +1193,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) ozone->animations.scroll_y, ozone->is_playlist ); - + /* Old list */ if (ozone->draw_old_list) ozone_draw_entries(ozone, @@ -1437,7 +1403,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act if (!ozone) return generic_menu_iterate(menu, userdata, action); - + selection_buf = menu_entries_get_selection_buf_ptr(0); tag = (uintptr_t)selection_buf; new_action = action; @@ -1467,7 +1433,7 @@ static int ozone_menu_iterate(menu_handle_t *menu, void *userdata, enum menu_act tag = (uintptr_t)ozone; new_selection = ozone->categories_selection_ptr - 1; - + if (new_selection < 0) new_selection = horizontal_list_size + ozone->system_tab_end; @@ -1707,7 +1673,7 @@ static void ozone_list_cache(void *data, bottom_boundary = video_info_height - 87 - 78; for (i = 0; i < entries_end; i++) - { + { ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, i); if (!node) 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_entries.c b/menu/drivers/ozone/ozone_entries.c index 7fb8ba0814..bb166168d8 100644 --- a/menu/drivers/ozone/ozone_entries.c +++ b/menu/drivers/ozone/ozone_entries.c @@ -244,7 +244,7 @@ border_iterate: sublabel_str = menu_entry_get_sublabel(&entry); - if (node->wrap) + if (node->wrap && sublabel_str) word_wrap(sublabel_str, sublabel_str, (video_info->width - 548) / ozone->sublabel_font_glyph_width, false); /* Icon */ @@ -271,19 +271,28 @@ border_iterate: )) { icon_color = ozone->theme_dynamic.entries_icon; - ozone_color_alpha(ozone->theme_dynamic.entries_icon, alpha); } + else + { + icon_color = ozone_pure_white; + } + + ozone_color_alpha(icon_color, alpha); menu_display_blend_begin(video_info); ozone_draw_icon(video_info, 46, 46, texture, x_offset + 451+5+10, y + scroll_y, video_info->width, video_info->height, 0, 1, icon_color); menu_display_blend_end(video_info); + if (icon_color == ozone_pure_white) + ozone_color_alpha(icon_color, 1.0f); + text_offset = 0; } /* Draw text */ ozone_draw_text(video_info, ozone, rich_label, text_offset + x_offset + 521, y + FONT_SIZE_ENTRIES_LABEL + 8 - 1 + scroll_y, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.entries_label, COLOR_TEXT_ALPHA(ozone->theme->text_rgba, alpha_uint32), false); - ozone_draw_text(video_info, ozone, sublabel_str, x_offset + 470, y + FONT_SIZE_ENTRIES_SUBLABEL + 80 - 20 - 3 + scroll_y, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.entries_sublabel, COLOR_TEXT_ALPHA(ozone->theme->text_sublabel_rgba, alpha_uint32), false); + if (sublabel_str) + ozone_draw_text(video_info, ozone, sublabel_str, x_offset + 470, y + FONT_SIZE_ENTRIES_SUBLABEL + 80 - 20 - 3 + scroll_y, TEXT_ALIGN_LEFT, video_info->width, video_info->height, ozone->fonts.entries_sublabel, COLOR_TEXT_ALPHA(ozone->theme->text_sublabel_rgba, alpha_uint32), false); /* Value */ ticker.idx = ozone->frame_count / 20; @@ -296,7 +305,9 @@ border_iterate: ozone_draw_entry_value(ozone, video_info, entry_value_ticker, x_offset + 426 + entry_width, y + FONT_SIZE_ENTRIES_LABEL + 8 - 1 + scroll_y,alpha_uint32, &entry); free(entry_rich_label); - free(sublabel_str); + + if (sublabel_str) + free(sublabel_str); icons_iterate: y += node->height; diff --git a/menu/drivers/ozone/ozone_texture.c b/menu/drivers/ozone/ozone_texture.c index 19b0654be7..b1a34532a8 100644 --- a/menu/drivers/ozone/ozone_texture.c +++ b/menu/drivers/ozone/ozone_texture.c @@ -45,6 +45,9 @@ menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone, case MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CHEAT_OPTIONS]; case MENU_ENUM_LABEL_DISK_OPTIONS: + case MENU_ENUM_LABEL_DISK_CYCLE_TRAY_STATUS: + case MENU_ENUM_LABEL_DISK_IMAGE_APPEND: + case MENU_ENUM_LABEL_DISK_INDEX: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_DISK_OPTIONS]; case MENU_ENUM_LABEL_SHADER_OPTIONS: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SHADER_OPTIONS]; @@ -208,7 +211,10 @@ menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone, return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_UI]; #ifdef HAVE_LAKKA_SWITCH case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: + return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_POWER]; #endif case MENU_ENUM_LABEL_POWER_MANAGEMENT_SETTINGS: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_POWER]; @@ -266,6 +272,15 @@ menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone, case MENU_ENUM_LABEL_CHEAT_APPLY_CHANGES: case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CHECKMARK]; + case MENU_ENUM_LABEL_CHEAT_ADD_NEW_AFTER: + case MENU_ENUM_LABEL_CHEAT_ADD_NEW_BEFORE: + case MENU_ENUM_LABEL_CHEAT_ADD_NEW_TOP: + case MENU_ENUM_LABEL_CHEAT_ADD_NEW_BOTTOM: + return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_MENU_ADD]; + case MENU_ENUM_LABEL_CHEAT_APPLY_AFTER_TOGGLE: + return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_MENU_APPLY_TOGGLE]; + case MENU_ENUM_LABEL_CHEAT_APPLY_AFTER_LOAD: + return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_MENU_APPLY_COG]; default: break; } @@ -299,8 +314,9 @@ menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone, return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CURSOR]; case FILE_TYPE_PLAYLIST_ENTRY: case MENU_SETTING_ACTION_RUN: - case MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_RUN]; + case MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS: + return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_RESUME]; case MENU_SETTING_ACTION_CLOSE: case MENU_SETTING_ACTION_DELETE_ENTRY: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CLOSE]; @@ -326,13 +342,13 @@ menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone, case MENU_SETTING_ACTION_RESET: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_RELOAD]; case MENU_SETTING_ACTION_PAUSE_ACHIEVEMENTS: - return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_RESUME]; - + return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_PAUSE]; case MENU_SETTING_GROUP: + return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SETTING]; #ifdef HAVE_LAKKA_SWITCH case MENU_SET_SWITCH_BRIGHTNESS: + return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_BRIGHTNESS]; #endif - return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SETTING]; case MENU_INFO_MESSAGE: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO]; case MENU_WIFI: @@ -440,342 +456,234 @@ menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone, return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING]; } -const char *ozone_entries_icon_texture_path(ozone_handle_t *ozone, unsigned id) +const char *ozone_entries_icon_texture_path(unsigned id) { - char icon_fullpath[255]; - char *icon_name = NULL; - switch (id) { case OZONE_ENTRIES_ICONS_TEXTURE_MAIN_MENU: #if defined(HAVE_LAKKA) - icon_name = "lakka.png"; - break; + return "lakka.png"; #else - icon_name = "retroarch.png"; - break; + return "retroarch.png"; #endif case OZONE_ENTRIES_ICONS_TEXTURE_SETTINGS: - icon_name = "settings.png"; - break; + return "settings.png"; case OZONE_ENTRIES_ICONS_TEXTURE_HISTORY: - icon_name = "history.png"; - break; + return "history.png"; case OZONE_ENTRIES_ICONS_TEXTURE_FAVORITES: - icon_name = "favorites.png"; - break; + return "favorites.png"; case OZONE_ENTRIES_ICONS_TEXTURE_ADD_FAVORITE: - icon_name = "add-favorite.png"; - break; + return "add-favorite.png"; case OZONE_ENTRIES_ICONS_TEXTURE_MUSICS: - icon_name = "musics.png"; - break; + return "musics.png"; #if defined(HAVE_FFMPEG) || defined(HAVE_MPV) case OZONE_ENTRIES_ICONS_TEXTURE_MOVIES: - icon_name = "movies.png"; - break; + return "movies.png"; #endif #ifdef HAVE_IMAGEVIEWER case OZONE_ENTRIES_ICONS_TEXTURE_IMAGES: - icon_name = "images.png"; - break; + return "images.png"; #endif case OZONE_ENTRIES_ICONS_TEXTURE_SETTING: - icon_name = "setting.png"; - break; + return "setting.png"; case OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING: - icon_name = "subsetting.png"; - break; + return "subsetting.png"; case OZONE_ENTRIES_ICONS_TEXTURE_ARROW: - icon_name = "arrow.png"; - break; + return "arrow.png"; case OZONE_ENTRIES_ICONS_TEXTURE_RUN: - icon_name = "run.png"; - break; + return "run.png"; case OZONE_ENTRIES_ICONS_TEXTURE_CLOSE: - icon_name = "close.png"; - break; + return "close.png"; case OZONE_ENTRIES_ICONS_TEXTURE_RESUME: - icon_name = "resume.png"; - break; + return "resume.png"; case OZONE_ENTRIES_ICONS_TEXTURE_CLOCK: - icon_name = "clock.png"; - break; + return "clock.png"; case OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_FULL: - icon_name = "battery-full.png"; - break; + return "battery-full.png"; case OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_CHARGING: - icon_name = "battery-charging.png"; - break; + return "battery-charging.png"; case OZONE_ENTRIES_ICONS_TEXTURE_POINTER: - icon_name = "pointer.png"; - break; + return "pointer.png"; case OZONE_ENTRIES_ICONS_TEXTURE_SAVESTATE: - icon_name = "savestate.png"; - break; + return "savestate.png"; case OZONE_ENTRIES_ICONS_TEXTURE_LOADSTATE: - icon_name = "loadstate.png"; - break; + return "loadstate.png"; case OZONE_ENTRIES_ICONS_TEXTURE_UNDO: - icon_name = "undo.png"; - break; + return "undo.png"; case OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO: - icon_name = "core-infos.png"; - break; + return "core-infos.png"; case OZONE_ENTRIES_ICONS_TEXTURE_WIFI: - icon_name = "wifi.png"; - break; + return "wifi.png"; case OZONE_ENTRIES_ICONS_TEXTURE_CORE_OPTIONS: - icon_name = "core-options.png"; - break; + return "core-options.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_REMAPPING_OPTIONS: - icon_name = "core-input-remapping-options.png"; - break; + return "core-input-remapping-options.png"; case OZONE_ENTRIES_ICONS_TEXTURE_CHEAT_OPTIONS: - icon_name = "core-cheat-options.png"; - break; + return "core-cheat-options.png"; case OZONE_ENTRIES_ICONS_TEXTURE_DISK_OPTIONS: - icon_name = "core-disk-options.png"; - break; + return "core-disk-options.png"; case OZONE_ENTRIES_ICONS_TEXTURE_SHADER_OPTIONS: - icon_name = "core-shader-options.png"; - break; + return "core-shader-options.png"; case OZONE_ENTRIES_ICONS_TEXTURE_ACHIEVEMENT_LIST: - icon_name = "achievement-list.png"; - break; + return "achievement-list.png"; case OZONE_ENTRIES_ICONS_TEXTURE_SCREENSHOT: - icon_name = "screenshot.png"; - break; + return "screenshot.png"; case OZONE_ENTRIES_ICONS_TEXTURE_RELOAD: - icon_name = "reload.png"; - break; + return "reload.png"; case OZONE_ENTRIES_ICONS_TEXTURE_RENAME: - icon_name = "rename.png"; - break; + return "rename.png"; case OZONE_ENTRIES_ICONS_TEXTURE_FILE: - icon_name = "file.png"; - break; + return "file.png"; case OZONE_ENTRIES_ICONS_TEXTURE_FOLDER: - icon_name = "folder.png"; - break; + return "folder.png"; case OZONE_ENTRIES_ICONS_TEXTURE_ZIP: - icon_name = "zip.png"; - break; + return "zip.png"; case OZONE_ENTRIES_ICONS_TEXTURE_MUSIC: - icon_name = "music.png"; - break; + return "music.png"; case OZONE_ENTRIES_ICONS_TEXTURE_FAVORITE: - icon_name = "favorites-content.png"; - break; + return "favorites-content.png"; case OZONE_ENTRIES_ICONS_TEXTURE_IMAGE: - icon_name = "image.png"; - break; + return "image.png"; case OZONE_ENTRIES_ICONS_TEXTURE_MOVIE: - icon_name = "movie.png"; - break; + return "movie.png"; case OZONE_ENTRIES_ICONS_TEXTURE_CORE: - icon_name = "core.png"; - break; + return "core.png"; case OZONE_ENTRIES_ICONS_TEXTURE_RDB: - icon_name = "database.png"; - break; + return "database.png"; case OZONE_ENTRIES_ICONS_TEXTURE_CURSOR: - icon_name = "cursor.png"; - break; + return "cursor.png"; case OZONE_ENTRIES_ICONS_TEXTURE_SWITCH_ON: - icon_name = "on.png"; - break; + return "on.png"; case OZONE_ENTRIES_ICONS_TEXTURE_SWITCH_OFF: - icon_name = "off.png"; - break; + return "off.png"; case OZONE_ENTRIES_ICONS_TEXTURE_ADD: - icon_name = "add.png"; - break; + return "add.png"; #ifdef HAVE_NETWORKING case OZONE_ENTRIES_ICONS_TEXTURE_NETPLAY: - icon_name = "netplay.png"; - break; + return "netplay.png"; case OZONE_ENTRIES_ICONS_TEXTURE_ROOM: - icon_name = "menu_room.png"; - break; + return "menu_room.png"; case OZONE_ENTRIES_ICONS_TEXTURE_ROOM_LAN: - icon_name = "menu_room_lan.png"; - break; + return "menu_room_lan.png"; case OZONE_ENTRIES_ICONS_TEXTURE_ROOM_RELAY: - icon_name = "menu_room_relay.png"; - break; + return "menu_room_relay.png"; #endif case OZONE_ENTRIES_ICONS_TEXTURE_KEY: - icon_name = "key.png"; - break; + return "key.png"; case OZONE_ENTRIES_ICONS_TEXTURE_KEY_HOVER: - icon_name = "key-hover.png"; - break; + return "key-hover.png"; case OZONE_ENTRIES_ICONS_TEXTURE_DIALOG_SLICE: - icon_name = "dialog-slice.png"; - break; + return "dialog-slice.png"; case OZONE_ENTRIES_ICONS_TEXTURE_ACHIEVEMENTS: - icon_name = "menu_achievements.png"; - break; + return "menu_achievements.png"; case OZONE_ENTRIES_ICONS_TEXTURE_AUDIO: - icon_name = "menu_audio.png"; - break; + return "menu_audio.png"; case OZONE_ENTRIES_ICONS_TEXTURE_DRIVERS: - icon_name = "menu_drivers.png"; - break; + return "menu_drivers.png"; case OZONE_ENTRIES_ICONS_TEXTURE_EXIT: - icon_name = "menu_exit.png"; - break; + return "menu_exit.png"; case OZONE_ENTRIES_ICONS_TEXTURE_FRAMESKIP: - icon_name = "menu_frameskip.png"; - break; + return "menu_frameskip.png"; case OZONE_ENTRIES_ICONS_TEXTURE_HELP: - icon_name = "menu_help.png"; - break; + return "menu_help.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INFO: - icon_name = "menu_info.png"; - break; + return "menu_info.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_SETTINGS: - icon_name = "Libretro - Pad.png"; - break; + return "Libretro - Pad.png"; case OZONE_ENTRIES_ICONS_TEXTURE_LATENCY: - icon_name = "menu_latency.png"; - break; + return "menu_latency.png"; case OZONE_ENTRIES_ICONS_TEXTURE_NETWORK: - icon_name = "menu_network.png"; - break; + return "menu_network.png"; case OZONE_ENTRIES_ICONS_TEXTURE_POWER: - icon_name = "menu_power.png"; - break; + return "menu_power.png"; case OZONE_ENTRIES_ICONS_TEXTURE_RECORD: - icon_name = "menu_record.png"; - break; + return "menu_record.png"; case OZONE_ENTRIES_ICONS_TEXTURE_SAVING: - icon_name = "menu_saving.png"; - break; + return "menu_saving.png"; case OZONE_ENTRIES_ICONS_TEXTURE_UPDATER: - icon_name = "menu_updater.png"; - break; + return "menu_updater.png"; case OZONE_ENTRIES_ICONS_TEXTURE_VIDEO: - icon_name = "menu_video.png"; - break; + return "menu_video.png"; case OZONE_ENTRIES_ICONS_TEXTURE_MIXER: - icon_name = "menu_mixer.png"; - break; + return "menu_mixer.png"; case OZONE_ENTRIES_ICONS_TEXTURE_LOG: - icon_name = "menu_log.png"; - break; + return "menu_log.png"; case OZONE_ENTRIES_ICONS_TEXTURE_OSD: - icon_name = "menu_osd.png"; - break; + return "menu_osd.png"; case OZONE_ENTRIES_ICONS_TEXTURE_UI: - icon_name = "menu_ui.png"; - break; + return "menu_ui.png"; case OZONE_ENTRIES_ICONS_TEXTURE_USER: - icon_name = "menu_user.png"; - break; + return "menu_user.png"; case OZONE_ENTRIES_ICONS_TEXTURE_PRIVACY: - icon_name = "menu_privacy.png"; - break; + return "menu_privacy.png"; case OZONE_ENTRIES_ICONS_TEXTURE_PLAYLIST: - icon_name = "menu_playlist.png"; - break; + return "menu_playlist.png"; case OZONE_ENTRIES_ICONS_TEXTURE_QUICKMENU: - icon_name = "menu_quickmenu.png"; - break; + return "menu_quickmenu.png"; case OZONE_ENTRIES_ICONS_TEXTURE_REWIND: - icon_name = "menu_rewind.png"; - break; + return "menu_rewind.png"; case OZONE_ENTRIES_ICONS_TEXTURE_OVERLAY: - icon_name = "menu_overlay.png"; - break; + return "menu_overlay.png"; case OZONE_ENTRIES_ICONS_TEXTURE_OVERRIDE: - icon_name = "menu_override.png"; - break; + return "menu_override.png"; case OZONE_ENTRIES_ICONS_TEXTURE_NOTIFICATIONS: - icon_name = "menu_notifications.png"; - break; + return "menu_notifications.png"; case OZONE_ENTRIES_ICONS_TEXTURE_STREAM: - icon_name = "menu_stream.png"; - break; + return "menu_stream.png"; case OZONE_ENTRIES_ICONS_TEXTURE_SHUTDOWN: - icon_name = "menu_shutdown.png"; - break; + return "menu_shutdown.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_DPAD_U: - icon_name = "input_DPAD-U.png"; - break; + return "input_DPAD-U.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_DPAD_D: - icon_name = "input_DPAD-D.png"; - break; + return "input_DPAD-D.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_DPAD_L: - icon_name = "input_DPAD-L.png"; - break; + return "input_DPAD-L.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_DPAD_R: - icon_name = "input_DPAD-R.png"; - break; + return "input_DPAD-R.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_STCK_U: - icon_name = "input_STCK-U.png"; - break; + return "input_STCK-U.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_STCK_D: - icon_name = "input_STCK-D.png"; - break; + return "input_STCK-D.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_STCK_L: - icon_name = "input_STCK-L.png"; - break; + return "input_STCK-L.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_STCK_R: - icon_name = "input_STCK-R.png"; - break; + return "input_STCK-R.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_STCK_P: - icon_name = "input_STCK-P.png"; - break; + return "input_STCK-P.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_U: - icon_name = "input_BTN-U.png"; - break; + return "input_BTN-U.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_D: - icon_name = "input_BTN-D.png"; - break; + return "input_BTN-D.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_L: - icon_name = "input_BTN-L.png"; - break; + return "input_BTN-L.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_R: - icon_name = "input_BTN-R.png"; - break; + return "input_BTN-R.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_LB: - icon_name = "input_LB.png"; - break; + return "input_LB.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_RB: - icon_name = "input_RB.png"; - break; + return "input_RB.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_LT: - icon_name = "input_LT.png"; - break; + return "input_LT.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_RT: - icon_name = "input_RT.png"; - break; + return "input_RT.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_SELECT: - icon_name = "input_SELECT.png"; - break; + return "input_SELECT.png"; case OZONE_ENTRIES_ICONS_TEXTURE_INPUT_START: - icon_name = "input_START.png"; - break; + return "input_START.png"; case OZONE_ENTRIES_ICONS_TEXTURE_CHECKMARK: - icon_name = "menu_check.png"; - break; + return "menu_check.png"; + case OZONE_ENTRIES_ICONS_TEXTURE_MENU_ADD: + return "menu_add.png"; + case OZONE_ENTRIES_ICONS_TEXTURE_BRIGHTNESS: + return "menu_brightness.png"; + case OZONE_ENTRIES_ICONS_TEXTURE_PAUSE: + return "menu_pause.png"; + case OZONE_ENTRIES_ICONS_TEXTURE_MENU_APPLY_TOGGLE: + return "menu_apply_toggle.png"; + case OZONE_ENTRIES_ICONS_TEXTURE_MENU_APPLY_COG: + return "menu_apply_cog.png"; } - - fill_pathname_join( - icon_fullpath, - ozone->icons_path, - icon_name, - sizeof(icon_fullpath) - ); - - if (!filestream_exists(icon_fullpath)) - { - return "subsetting.png"; - } - else - return icon_name; + return NULL; } void ozone_unload_theme_textures(ozone_handle_t *ozone) @@ -821,4 +729,4 @@ bool ozone_reset_theme_textures(ozone_handle_t *ozone) } return result; -} \ No newline at end of file +} diff --git a/menu/drivers/ozone/ozone_texture.h b/menu/drivers/ozone/ozone_texture.h index 0ef5828667..5441732378 100644 --- a/menu/drivers/ozone/ozone_texture.h +++ b/menu/drivers/ozone/ozone_texture.h @@ -193,10 +193,15 @@ enum OZONE_ENTRIES_ICONS_TEXTURE_INPUT_LT, OZONE_ENTRIES_ICONS_TEXTURE_INPUT_RT, OZONE_ENTRIES_ICONS_TEXTURE_CHECKMARK, + OZONE_ENTRIES_ICONS_TEXTURE_MENU_ADD, + OZONE_ENTRIES_ICONS_TEXTURE_BRIGHTNESS, + OZONE_ENTRIES_ICONS_TEXTURE_PAUSE, + OZONE_ENTRIES_ICONS_TEXTURE_MENU_APPLY_TOGGLE, + OZONE_ENTRIES_ICONS_TEXTURE_MENU_APPLY_COG, OZONE_ENTRIES_ICONS_TEXTURE_LAST }; -const char *ozone_entries_icon_texture_path(ozone_handle_t *ozone, unsigned id); +const char *ozone_entries_icon_texture_path(unsigned id); menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone, enum msg_hash_enums enum_idx, unsigned type, bool active); @@ -204,4 +209,4 @@ menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone, bool ozone_reset_theme_textures(ozone_handle_t *ozone); void ozone_unload_theme_textures(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 +} diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 9993d46512..4b0fd88e60 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -55,6 +55,7 @@ #include "../widgets/menu_filebrowser.h" #include "../../verbosity.h" +#include "../../dynamic.h" #include "../../configuration.h" #include "../../playlist.h" #include "../../retroarch.h" @@ -201,6 +202,13 @@ enum XMB_TEXTURE_INPUT_LT, XMB_TEXTURE_INPUT_RT, XMB_TEXTURE_CHECKMARK, + XMB_TEXTURE_MENU_ADD, + XMB_TEXTURE_BRIGHTNESS, + XMB_TEXTURE_PAUSE, + XMB_TEXTURE_DEFAULT, + XMB_TEXTURE_DEFAULT_CONTENT, + XMB_TEXTURE_MENU_APPLY_TOGGLE, + XMB_TEXTURE_MENU_APPLY_COG, XMB_TEXTURE_LAST }; @@ -230,6 +238,7 @@ typedef struct xmb_handle { bool mouse_show; bool use_ps3_layout; + bool assets_missing; uint8_t system_tab_end; uint8_t tabs[XMB_SYSTEM_TAB_MAX_LENGTH]; @@ -264,6 +273,7 @@ typedef struct xmb_handle float shadow_offset; float font_size; float font2_size; + float previous_scale_factor; float margins_screen_left; float margins_screen_top; @@ -2270,6 +2280,9 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, case MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS: return xmb->textures.list[XMB_TEXTURE_CHEAT_OPTIONS]; case MENU_ENUM_LABEL_DISK_OPTIONS: + case MENU_ENUM_LABEL_DISK_CYCLE_TRAY_STATUS: + case MENU_ENUM_LABEL_DISK_IMAGE_APPEND: + case MENU_ENUM_LABEL_DISK_INDEX: return xmb->textures.list[XMB_TEXTURE_DISK_OPTIONS]; case MENU_ENUM_LABEL_SHADER_OPTIONS: return xmb->textures.list[XMB_TEXTURE_SHADER_OPTIONS]; @@ -2442,7 +2455,10 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, return xmb->textures.list[XMB_TEXTURE_UI]; #ifdef HAVE_LAKKA_SWITCH case MENU_ENUM_LABEL_SWITCH_GPU_PROFILE: +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) case MENU_ENUM_LABEL_SWITCH_CPU_PROFILE: + return xmb->textures.list[XMB_TEXTURE_POWER]; #endif case MENU_ENUM_LABEL_POWER_MANAGEMENT_SETTINGS: return xmb->textures.list[XMB_TEXTURE_POWER]; @@ -2499,6 +2515,15 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, case MENU_ENUM_LABEL_CHEAT_APPLY_CHANGES: case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES: return xmb->textures.list[XMB_TEXTURE_CHECKMARK]; + case MENU_ENUM_LABEL_CHEAT_ADD_NEW_AFTER: + case MENU_ENUM_LABEL_CHEAT_ADD_NEW_BEFORE: + case MENU_ENUM_LABEL_CHEAT_ADD_NEW_TOP: + case MENU_ENUM_LABEL_CHEAT_ADD_NEW_BOTTOM: + return xmb->textures.list[XMB_TEXTURE_MENU_ADD]; + case MENU_ENUM_LABEL_CHEAT_APPLY_AFTER_TOGGLE: + return xmb->textures.list[XMB_TEXTURE_MENU_APPLY_TOGGLE]; + case MENU_ENUM_LABEL_CHEAT_APPLY_AFTER_LOAD: + return xmb->textures.list[XMB_TEXTURE_MENU_APPLY_COG]; default: break; } @@ -2558,8 +2583,9 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, return xmb->textures.list[XMB_TEXTURE_CURSOR]; case FILE_TYPE_PLAYLIST_ENTRY: case MENU_SETTING_ACTION_RUN: - case MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS: return xmb->textures.list[XMB_TEXTURE_RUN]; + case MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS: + return xmb->textures.list[XMB_TEXTURE_RESUME]; case MENU_SETTING_ACTION_CLOSE: case MENU_SETTING_ACTION_DELETE_ENTRY: return xmb->textures.list[XMB_TEXTURE_CLOSE]; @@ -2585,12 +2611,12 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, case MENU_SETTING_ACTION_RESET: return xmb->textures.list[XMB_TEXTURE_RELOAD]; case MENU_SETTING_ACTION_PAUSE_ACHIEVEMENTS: - return xmb->textures.list[XMB_TEXTURE_RESUME]; - - case MENU_SETTING_GROUP: + return xmb->textures.list[XMB_TEXTURE_PAUSE]; #ifdef HAVE_LAKKA_SWITCH case MENU_SET_SWITCH_BRIGHTNESS: + return xmb->textures.list[XMB_TEXTURE_BRIGHTNESS]; #endif + case MENU_SETTING_GROUP: return xmb->textures.list[XMB_TEXTURE_SETTING]; case MENU_INFO_MESSAGE: return xmb->textures.list[XMB_TEXTURE_CORE_INFO]; @@ -2941,7 +2967,14 @@ static int xmb_draw_item( menu_display_set_alpha(color, MIN(node->alpha, xmb->alpha)); - if (color[3] != 0) + if ( + (!xmb->assets_missing) && + (color[3] != 0) && + ( + (entry->checked) || + !((entry_type >= MENU_SETTING_DROPDOWN_ITEM) && (entry_type <= MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL)) + ) + ) { math_matrix_4x4 mymat_tmp; menu_display_ctx_rotate_draw_t rotate_draw; @@ -2962,31 +2995,24 @@ static int xmb_draw_item( menu_display_rotate_z(&rotate_draw, video_info); - if ( - (entry->checked) || - !((entry_type >= MENU_SETTING_DROPDOWN_ITEM) && - (entry_type <= MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL)) - ) - { - xmb_draw_icon(video_info, - xmb->icon_size, - &mymat_tmp, - texture, - x, - y, - width, - height, - 1.0, - rotation, - scale_factor, - &color[0], - xmb->shadow_offset); - } + xmb_draw_icon(video_info, + xmb->icon_size, + &mymat_tmp, + texture, + x, + y, + width, + height, + 1.0, + rotation, + scale_factor, + &color[0], + xmb->shadow_offset); } menu_display_set_alpha(color, MIN(node->alpha, xmb->alpha)); - if (texture_switch != 0 && color[3] != 0) + if (texture_switch != 0 && color[3] != 0 && !xmb->assets_missing) xmb_draw_icon(video_info, xmb->icon_size, mymat, @@ -3090,6 +3116,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; @@ -3100,9 +3129,22 @@ 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_reset_internal(xmb, video_driver_is_threaded(), + false); + + xmb->previous_scale_factor = scale_factor; + delta.current = menu_animation_get_delta_time(); if (menu_animation_get_ideal_delta_time(&delta)) @@ -3723,7 +3765,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) size_t x_pos = xmb->icon_size / 6; size_t x_pos_icon = xmb->margins_title_left; - if (coord_white[3] != 0) + if (coord_white[3] != 0 && !xmb->assets_missing) xmb_draw_icon(video_info, xmb->icon_size, &mymat, @@ -3752,7 +3794,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) } } - if (video_info->timedate_enable) + if (video_info->timedate_enable && !xmb->assets_missing) { menu_display_ctx_datetime_t datetime; char timedate[255]; @@ -3801,7 +3843,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) menu_display_set_alpha(coord_white, MIN(xmb->textures_arrow_alpha, xmb->alpha)); - if (coord_white[3] != 0) + if (coord_white[3] != 0 && !xmb->assets_missing) xmb_draw_icon(video_info, xmb->icon_size, &mymat, @@ -3823,52 +3865,55 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) menu_display_blend_begin(video_info); /* Horizontal tab icons */ - for (i = 0; i <= xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) - + xmb->system_tab_end; i++) + if (!xmb->assets_missing) { - xmb_node_t *node = xmb_get_node(xmb, i); - - if (!node) - continue; - - menu_display_set_alpha(item_color, MIN(node->alpha, xmb->alpha)); - - if (item_color[3] != 0) + for (i = 0; i <= xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + + xmb->system_tab_end; i++) { - menu_display_ctx_rotate_draw_t rotate_draw; - math_matrix_4x4 mymat; - uintptr_t texture = node->icon; - float x = xmb->x + xmb->categories_x_pos + - xmb->margins_screen_left + - xmb->icon_spacing_horizontal - * (i + 1) - xmb->icon_size / 2.0; - float y = xmb->margins_screen_top - + xmb->icon_size / 2.0; - float rotation = 0; - float scale_factor = node->zoom; + xmb_node_t *node = xmb_get_node(xmb, i); - rotate_draw.matrix = &mymat; - rotate_draw.rotation = rotation; - rotate_draw.scale_x = scale_factor; - rotate_draw.scale_y = scale_factor; - rotate_draw.scale_z = 1; - rotate_draw.scale_enable = true; + if (!node) + continue; - menu_display_rotate_z(&rotate_draw, video_info); + menu_display_set_alpha(item_color, MIN(node->alpha, xmb->alpha)); - xmb_draw_icon(video_info, - xmb->icon_size, - &mymat, - texture, - x, - y, - width, - height, - 1.0, - rotation, - scale_factor, - &item_color[0], - xmb->shadow_offset); + if (item_color[3] != 0) + { + menu_display_ctx_rotate_draw_t rotate_draw; + math_matrix_4x4 mymat; + uintptr_t texture = node->icon; + float x = xmb->x + xmb->categories_x_pos + + xmb->margins_screen_left + + xmb->icon_spacing_horizontal + * (i + 1) - xmb->icon_size / 2.0; + float y = xmb->margins_screen_top + + xmb->icon_size / 2.0; + float rotation = 0; + float scale_factor = node->zoom; + + rotate_draw.matrix = &mymat; + rotate_draw.rotation = rotation; + rotate_draw.scale_x = scale_factor; + rotate_draw.scale_y = scale_factor; + rotate_draw.scale_z = 1; + rotate_draw.scale_enable = true; + + menu_display_rotate_z(&rotate_draw, video_info); + + xmb_draw_icon(video_info, + xmb->icon_size, + &mymat, + texture, + x, + y, + width, + height, + 1.0, + rotation, + scale_factor, + &item_color[0], + xmb->shadow_offset); + } } } @@ -4591,345 +4636,236 @@ static bool xmb_load_image(void *userdata, void *data, enum menu_image_type type 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; + return "lakka.png"; #else - icon_name = "retroarch.png"; - break; + return "retroarch.png"; #endif case XMB_TEXTURE_SETTINGS: - icon_name = "settings.png"; - break; + return "settings.png"; case XMB_TEXTURE_HISTORY: - icon_name = "history.png"; - break; + return "history.png"; case XMB_TEXTURE_FAVORITES: - icon_name = "favorites.png"; - break; + return "favorites.png"; case XMB_TEXTURE_ADD_FAVORITE: - icon_name = "add-favorite.png"; - break; + return "add-favorite.png"; case XMB_TEXTURE_MUSICS: - icon_name = "musics.png"; - break; + return "musics.png"; #if defined(HAVE_FFMPEG) || defined(HAVE_MPV) case XMB_TEXTURE_MOVIES: - icon_name = "movies.png"; - break; + return "movies.png"; #endif #ifdef HAVE_IMAGEVIEWER case XMB_TEXTURE_IMAGES: - icon_name = "images.png"; - break; + return "images.png"; #endif case XMB_TEXTURE_SETTING: - icon_name = "setting.png"; - break; + return "setting.png"; case XMB_TEXTURE_SUBSETTING: - icon_name = "subsetting.png"; - break; + return "subsetting.png"; case XMB_TEXTURE_ARROW: - icon_name = "arrow.png"; - break; + return "arrow.png"; case XMB_TEXTURE_RUN: - icon_name = "run.png"; - break; + return "run.png"; case XMB_TEXTURE_CLOSE: - icon_name = "close.png"; - break; + return "close.png"; case XMB_TEXTURE_RESUME: - icon_name = "resume.png"; - break; + return "resume.png"; case XMB_TEXTURE_CLOCK: - icon_name = "clock.png"; - break; + return "clock.png"; case XMB_TEXTURE_BATTERY_FULL: - icon_name = "battery-full.png"; - break; + return "battery-full.png"; case XMB_TEXTURE_BATTERY_CHARGING: - icon_name = "battery-charging.png"; - break; + return "battery-charging.png"; case XMB_TEXTURE_POINTER: - icon_name = "pointer.png"; - break; + return "pointer.png"; case XMB_TEXTURE_SAVESTATE: - icon_name = "savestate.png"; - break; + return "savestate.png"; case XMB_TEXTURE_LOADSTATE: - icon_name = "loadstate.png"; - break; + return "loadstate.png"; case XMB_TEXTURE_UNDO: - icon_name = "undo.png"; - break; + return "undo.png"; case XMB_TEXTURE_CORE_INFO: - icon_name = "core-infos.png"; - break; + return "core-infos.png"; case XMB_TEXTURE_WIFI: - icon_name = "wifi.png"; - break; + return "wifi.png"; case XMB_TEXTURE_CORE_OPTIONS: - icon_name = "core-options.png"; - break; + return "core-options.png"; case XMB_TEXTURE_INPUT_REMAPPING_OPTIONS: - icon_name = "core-input-remapping-options.png"; - break; + return "core-input-remapping-options.png"; case XMB_TEXTURE_CHEAT_OPTIONS: - icon_name = "core-cheat-options.png"; - break; + return "core-cheat-options.png"; case XMB_TEXTURE_DISK_OPTIONS: - icon_name = "core-disk-options.png"; - break; + return "core-disk-options.png"; case XMB_TEXTURE_SHADER_OPTIONS: - icon_name = "core-shader-options.png"; - break; + return "core-shader-options.png"; case XMB_TEXTURE_ACHIEVEMENT_LIST: - icon_name = "achievement-list.png"; - break; + return "achievement-list.png"; case XMB_TEXTURE_SCREENSHOT: - icon_name = "screenshot.png"; - break; + return "screenshot.png"; case XMB_TEXTURE_RELOAD: - icon_name = "reload.png"; - break; + return "reload.png"; case XMB_TEXTURE_RENAME: - icon_name = "rename.png"; - break; + return "rename.png"; case XMB_TEXTURE_FILE: - icon_name = "file.png"; - break; + return "file.png"; case XMB_TEXTURE_FOLDER: - icon_name = "folder.png"; - break; + return "folder.png"; case XMB_TEXTURE_ZIP: - icon_name = "zip.png"; - break; + return "zip.png"; case XMB_TEXTURE_MUSIC: - icon_name = "music.png"; - break; + return "music.png"; case XMB_TEXTURE_FAVORITE: - icon_name = "favorites-content.png"; - break; + return "favorites-content.png"; case XMB_TEXTURE_IMAGE: - icon_name = "image.png"; - break; + return "image.png"; case XMB_TEXTURE_MOVIE: - icon_name = "movie.png"; - break; + return "movie.png"; case XMB_TEXTURE_CORE: - icon_name = "core.png"; - break; + return "core.png"; case XMB_TEXTURE_RDB: - icon_name = "database.png"; - break; + return "database.png"; case XMB_TEXTURE_CURSOR: - icon_name = "cursor.png"; - break; + return "cursor.png"; case XMB_TEXTURE_SWITCH_ON: - icon_name = "on.png"; - break; + return "on.png"; case XMB_TEXTURE_SWITCH_OFF: - icon_name = "off.png"; - break; + return "off.png"; case XMB_TEXTURE_ADD: - icon_name = "add.png"; - break; + return "add.png"; #ifdef HAVE_NETWORKING case XMB_TEXTURE_NETPLAY: - icon_name = "netplay.png"; - break; + return "netplay.png"; case XMB_TEXTURE_ROOM: - icon_name = "menu_room.png"; - break; + return "menu_room.png"; case XMB_TEXTURE_ROOM_LAN: - icon_name = "menu_room_lan.png"; - break; + return "menu_room_lan.png"; case XMB_TEXTURE_ROOM_RELAY: - icon_name = "menu_room_relay.png"; - break; + return "menu_room_relay.png"; #endif case XMB_TEXTURE_KEY: - icon_name = "key.png"; - break; + return "key.png"; case XMB_TEXTURE_KEY_HOVER: - icon_name = "key-hover.png"; - break; + return "key-hover.png"; case XMB_TEXTURE_DIALOG_SLICE: - icon_name = "dialog-slice.png"; - break; + return "dialog-slice.png"; case XMB_TEXTURE_ACHIEVEMENTS: - icon_name = "menu_achievements.png"; - break; + return "menu_achievements.png"; case XMB_TEXTURE_AUDIO: - icon_name = "menu_audio.png"; - break; + return "menu_audio.png"; case XMB_TEXTURE_DRIVERS: - icon_name = "menu_drivers.png"; - break; + return "menu_drivers.png"; case XMB_TEXTURE_EXIT: - icon_name = "menu_exit.png"; - break; + return "menu_exit.png"; case XMB_TEXTURE_FRAMESKIP: - icon_name = "menu_frameskip.png"; - break; + return "menu_frameskip.png"; case XMB_TEXTURE_HELP: - icon_name = "menu_help.png"; - break; + return "menu_help.png"; case XMB_TEXTURE_INFO: - icon_name = "menu_info.png"; - break; + return "menu_info.png"; case XMB_TEXTURE_INPUT_SETTINGS: - icon_name = "Libretro - Pad.png"; - break; + return "Libretro - Pad.png"; case XMB_TEXTURE_LATENCY: - icon_name = "menu_latency.png"; - break; + return "menu_latency.png"; case XMB_TEXTURE_NETWORK: - icon_name = "menu_network.png"; - break; + return "menu_network.png"; case XMB_TEXTURE_POWER: - icon_name = "menu_power.png"; - break; + return "menu_power.png"; case XMB_TEXTURE_RECORD: - icon_name = "menu_record.png"; - break; + return "menu_record.png"; case XMB_TEXTURE_SAVING: - icon_name = "menu_saving.png"; - break; + return "menu_saving.png"; case XMB_TEXTURE_UPDATER: - icon_name = "menu_updater.png"; - break; + return "menu_updater.png"; case XMB_TEXTURE_VIDEO: - icon_name = "menu_video.png"; - break; + return "menu_video.png"; case XMB_TEXTURE_MIXER: - icon_name = "menu_mixer.png"; - break; + return "menu_mixer.png"; case XMB_TEXTURE_LOG: - icon_name = "menu_log.png"; - break; + return "menu_log.png"; case XMB_TEXTURE_OSD: - icon_name = "menu_osd.png"; - break; + return "menu_osd.png"; case XMB_TEXTURE_UI: - icon_name = "menu_ui.png"; - break; + return "menu_ui.png"; case XMB_TEXTURE_USER: - icon_name = "menu_user.png"; - break; + return "menu_user.png"; case XMB_TEXTURE_PRIVACY: - icon_name = "menu_privacy.png"; - break; + return "menu_privacy.png"; case XMB_TEXTURE_PLAYLIST: - icon_name = "menu_playlist.png"; - break; + return "menu_playlist.png"; case XMB_TEXTURE_QUICKMENU: - icon_name = "menu_quickmenu.png"; - break; + return "menu_quickmenu.png"; case XMB_TEXTURE_REWIND: - icon_name = "menu_rewind.png"; - break; + return "menu_rewind.png"; case XMB_TEXTURE_OVERLAY: - icon_name = "menu_overlay.png"; - break; + return "menu_overlay.png"; case XMB_TEXTURE_OVERRIDE: - icon_name = "menu_override.png"; - break; + return "menu_override.png"; case XMB_TEXTURE_NOTIFICATIONS: - icon_name = "menu_notifications.png"; - break; + return "menu_notifications.png"; case XMB_TEXTURE_STREAM: - icon_name = "menu_stream.png"; - break; + return "menu_stream.png"; case XMB_TEXTURE_SHUTDOWN: - icon_name = "menu_shutdown.png"; - break; + return "menu_shutdown.png"; case XMB_TEXTURE_INPUT_DPAD_U: - icon_name = "input_DPAD-U.png"; - break; + return "input_DPAD-U.png"; case XMB_TEXTURE_INPUT_DPAD_D: - icon_name = "input_DPAD-D.png"; - break; + return "input_DPAD-D.png"; case XMB_TEXTURE_INPUT_DPAD_L: - icon_name = "input_DPAD-L.png"; - break; + return "input_DPAD-L.png"; case XMB_TEXTURE_INPUT_DPAD_R: - icon_name = "input_DPAD-R.png"; - break; + return "input_DPAD-R.png"; case XMB_TEXTURE_INPUT_STCK_U: - icon_name = "input_STCK-U.png"; - break; + return "input_STCK-U.png"; case XMB_TEXTURE_INPUT_STCK_D: - icon_name = "input_STCK-D.png"; - break; + return "input_STCK-D.png"; case XMB_TEXTURE_INPUT_STCK_L: - icon_name = "input_STCK-L.png"; - break; + return "input_STCK-L.png"; case XMB_TEXTURE_INPUT_STCK_R: - icon_name = "input_STCK-R.png"; - break; + return "input_STCK-R.png"; case XMB_TEXTURE_INPUT_STCK_P: - icon_name = "input_STCK-P.png"; - break; + return "input_STCK-P.png"; case XMB_TEXTURE_INPUT_BTN_U: - icon_name = "input_BTN-U.png"; - break; + return "input_BTN-U.png"; case XMB_TEXTURE_INPUT_BTN_D: - icon_name = "input_BTN-D.png"; - break; + return "input_BTN-D.png"; case XMB_TEXTURE_INPUT_BTN_L: - icon_name = "input_BTN-L.png"; - break; + return "input_BTN-L.png"; case XMB_TEXTURE_INPUT_BTN_R: - icon_name = "input_BTN-R.png"; - break; + return "input_BTN-R.png"; case XMB_TEXTURE_INPUT_LB: - icon_name = "input_LB.png"; - break; + return "input_LB.png"; case XMB_TEXTURE_INPUT_RB: - icon_name = "input_RB.png"; - break; + return "input_RB.png"; case XMB_TEXTURE_INPUT_LT: - icon_name = "input_LT.png"; - break; + return "input_LT.png"; case XMB_TEXTURE_INPUT_RT: - icon_name = "input_RT.png"; - break; + return "input_RT.png"; case XMB_TEXTURE_INPUT_SELECT: - icon_name = "input_SELECT.png"; - break; + return "input_SELECT.png"; case XMB_TEXTURE_INPUT_START: - icon_name = "input_START.png"; - break; + return "input_START.png"; case XMB_TEXTURE_CHECKMARK: - icon_name = "menu_check.png"; - break; + return "menu_check.png"; + case XMB_TEXTURE_MENU_ADD: + return "menu_add.png"; + case XMB_TEXTURE_BRIGHTNESS: + return "menu_brightness.png"; + case XMB_TEXTURE_PAUSE: + return "menu_pause.png"; + case XMB_TEXTURE_DEFAULT: + return "default.png"; + case XMB_TEXTURE_DEFAULT_CONTENT: + return "default-content.png"; + case XMB_TEXTURE_MENU_APPLY_TOGGLE: + return "menu_apply_toggle.png"; + case XMB_TEXTURE_MENU_APPLY_COG: + return "menu_apply_cog.png"; } - - 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; - + return NULL; } static void xmb_context_reset_textures( @@ -4937,25 +4873,42 @@ static void xmb_context_reset_textures( { unsigned i; settings_t *settings = config_get_ptr(); + xmb->assets_missing = false; for (i = 0; i < XMB_TEXTURE_LAST; i++) { - if (xmb_texture_path(i) == NULL) + if (!menu_display_reset_textures_list(xmb_texture_path(i), iconpath, &xmb->textures.list[i], TEXTURE_FILTER_MIPMAP_LINEAR)) { - /* 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; + RARCH_WARN("[XMB] Asset missing: %s%s\n", iconpath, xmb_texture_path(i)); + /* If the icon is missing return the subsetting (because some themes are incomplete) */ + if (!(i == XMB_TEXTURE_DIALOG_SLICE || i == XMB_TEXTURE_KEY_HOVER || i == XMB_TEXTURE_KEY)) + { + /* OSD Warning only if subsetting icon is missing */ + if ( + !menu_display_reset_textures_list(xmb_texture_path(XMB_TEXTURE_SUBSETTING), iconpath, &xmb->textures.list[i], TEXTURE_FILTER_MIPMAP_LINEAR) + && !(settings->uints.menu_xmb_theme == XMB_ICON_THEME_CUSTOM) + ) + { + runloop_msg_queue_push(msg_hash_to_str(MSG_MISSING_ASSETS), 1, 256, false); + /* Do not draw icons if subsetting is missing */ + goto error; + } + /* Do not draw icons if this ones are is missing */ + switch (i) + { + case XMB_TEXTURE_POINTER: + case XMB_TEXTURE_ARROW: + case XMB_TEXTURE_CLOCK: + case XMB_TEXTURE_BATTERY_CHARGING: + case XMB_TEXTURE_BATTERY_FULL: + case XMB_TEXTURE_DEFAULT: + case XMB_TEXTURE_DEFAULT_CONTENT: + goto error; + } + } } - 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]; @@ -5000,6 +4953,12 @@ static void xmb_context_reset_textures( xmb->netplay_tab_node.zoom = xmb->categories_active_zoom; #endif +return; + +error: + xmb->assets_missing = true ; + RARCH_WARN("[XMB] Critical asset missing, no icons will be drawn\n"); + return; } static void xmb_context_reset_background(const char *iconpath) @@ -5027,56 +4986,77 @@ static void xmb_context_reset_background(const char *iconpath) 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) { - 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); - 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); - 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); + xmb_context_reset_internal(xmb, is_threaded, true); } } @@ -5473,6 +5453,7 @@ static int xmb_list_push(void *data, void *userdata, unsigned i = 0; core_info_list_t *list = NULL; menu_handle_t *menu = (menu_handle_t*)data; + const struct retro_subsystem_info* subsystem; switch (type) { @@ -5564,62 +5545,18 @@ static int xmb_list_push(void *data, void *userdata, if (settings->bools.menu_show_load_content) { - const struct retro_subsystem_info* subsystem = NULL; + entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST; menu_displaylist_setting(&entry); + /* Core fully loaded, use the subsystem data */ + if (system->subsystem.data) + subsystem = system->subsystem.data; + /* Core not loaded completely, use the data we peeked on load core */ + else + subsystem = subsystem_data; - subsystem = system->subsystem.data; - - if (subsystem) - { - for (i = 0; i < (unsigned)system->subsystem.size; i++, subsystem++) - { - char s[PATH_MAX_LENGTH]; - if (content_get_subsystem() == i) - { - if (content_get_subsystem_rom_id() < subsystem->num_roms) - { - snprintf(s, sizeof(s), - "Load %s %s", - subsystem->desc, - i == content_get_subsystem() - ? "\u2605" : " "); - menu_entries_append_enum(info->list, - s, - msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), - MENU_ENUM_LABEL_SUBSYSTEM_ADD, - MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0); - } - else - { - snprintf(s, sizeof(s), - "Start %s %s", - subsystem->desc, - i == content_get_subsystem() - ? "\u2605" : " "); - menu_entries_append_enum(info->list, - s, - msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_LOAD), - MENU_ENUM_LABEL_SUBSYSTEM_LOAD, - MENU_SETTINGS_SUBSYSTEM_LOAD, 0, 0); - } - } - else - { - snprintf(s, sizeof(s), - "Load %s %s", - subsystem->desc, - i == content_get_subsystem() - ? "\u2605" : " "); - menu_entries_append_enum(info->list, - s, - msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), - MENU_ENUM_LABEL_SUBSYSTEM_ADD, - MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0); - } - } - } + menu_subsystem_populate(subsystem, info); } entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST; @@ -5656,10 +5593,12 @@ static int xmb_list_push(void *data, void *userdata, menu_displaylist_setting(&entry); } -#ifdef HAVE_LAKKA_SWITCH +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) entry.enum_idx = MENU_ENUM_LABEL_SWITCH_CPU_PROFILE; menu_displaylist_setting(&entry); +#endif +#ifdef HAVE_LAKKA_SWITCH entry.enum_idx = MENU_ENUM_LABEL_SWITCH_GPU_PROFILE; menu_displaylist_setting(&entry); diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 1b69dffcd7..ed34b73021 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -45,6 +45,7 @@ enum ACTION_OK_DL_DEFAULT = 0, ACTION_OK_DL_DROPDOWN_BOX_LIST, ACTION_OK_DL_DROPDOWN_BOX_LIST_SPECIAL, + ACTION_OK_DL_DROPDOWN_BOX_LIST_RESOLUTION, ACTION_OK_DL_OPEN_ARCHIVE, ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE, ACTION_OK_DL_MUSIC, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index ac59ae52a7..b97034d1f0 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1,7 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2014-2017 - Jean-André Santoni - * Copyright (C) 2015-2017 - Andrés Suárez + * Copyright (C) 2014-2017 - Jean-André Santoni + * Copyright (C) 2015-2017 - Andrés Suárez * Copyright (C) 2016-2017 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms @@ -51,6 +51,11 @@ #include "../../lakka.h" #endif +#ifdef HAVE_LIBNX +#include +#include "../../switch_performance_profiles.h" +#endif + #if defined(__linux__) || (defined(BSD) && !defined(__MACH__)) #include "../frontend/drivers/platform_unix.h" #endif @@ -373,7 +378,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 +437,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 +1450,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'; @@ -2584,25 +2589,6 @@ static int menu_displaylist_parse_load_content_settings( #endif rarch_system_info_t *system = runloop_get_system_info(); -#if 0 - const struct retro_subsystem_info* subsystem = system ? system->subsystem.data : NULL; - - if (subsystem) - { - unsigned p; - - for (p = 0; p < system->subsystem.size; p++, subsystem++) - { - char s[PATH_MAX_LENGTH]; - snprintf(s, sizeof(s), "%s (%s)", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST), subsystem->desc); - menu_entries_append_enum(info->list, - s, - msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_SPECIAL), - MENU_ENUM_LABEL_LOAD_CONTENT_SPECIAL, - MENU_SETTING_ACTION, 0, 0); - } - } -#endif menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RESUME_CONTENT), msg_hash_to_str(MENU_ENUM_LABEL_RESUME_CONTENT), @@ -2633,7 +2619,7 @@ static int menu_displaylist_parse_load_content_settings( if (settings->bools.quick_menu_show_save_load_state #ifdef HAVE_CHEEVOS - && !cheevos_hardcore_active + && !cheevos_hardcore_active #endif ) { @@ -2901,7 +2887,7 @@ static int menu_displaylist_parse_horizontal_content_actions( MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST, FILE_TYPE_PLAYLIST_ENTRY, 0, 0); } - if (settings->bools.quick_menu_show_add_to_favorites) + if (settings->bools.quick_menu_show_reset_core_association) { menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION), @@ -3381,8 +3367,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; @@ -3472,16 +3458,19 @@ static int menu_displaylist_parse_playlists( if (!horizontal) { #ifdef HAVE_LIBRETRODB - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), - msg_hash_to_str(MENU_ENUM_LABEL_SCAN_DIRECTORY), - MENU_ENUM_LABEL_SCAN_DIRECTORY, - MENU_SETTING_ACTION, 0, 0); - menu_entries_append_enum(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_FILE), - msg_hash_to_str(MENU_ENUM_LABEL_SCAN_FILE), - MENU_ENUM_LABEL_SCAN_FILE, - MENU_SETTING_ACTION, 0, 0); + if (settings->bools.menu_content_show_add) + { + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY), + msg_hash_to_str(MENU_ENUM_LABEL_SCAN_DIRECTORY), + MENU_ENUM_LABEL_SCAN_DIRECTORY, + MENU_SETTING_ACTION, 0, 0); + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_FILE), + msg_hash_to_str(MENU_ENUM_LABEL_SCAN_FILE), + MENU_ENUM_LABEL_SCAN_FILE, + MENU_SETTING_ACTION, 0, 0); + } #endif if (settings->bools.menu_content_show_favorites) menu_entries_append_enum(info->list, @@ -4284,7 +4273,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist switch (type) { -#ifdef HAVE_LAKKA_SWITCH +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) case DISPLAYLIST_SWITCH_CPU_PROFILE: { unsigned i; @@ -4293,17 +4282,22 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist FILE *profile = NULL; const size_t profiles_count = sizeof(SWITCH_CPU_PROFILES)/sizeof(SWITCH_CPU_PROFILES[1]); - runloop_msg_queue_push("Warning : extented overclocking can damage the Switch", 1, 90, true); + runloop_msg_queue_push("Warning : extended overclocking can damage the Switch", 1, 90, true); + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + +#ifdef HAVE_LAKKA_SWITCH profile = popen("cpu-profile get", "r"); fgets(current_profile, PATH_MAX_LENGTH, profile); pclose(profile); + - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); - - snprintf(text, sizeof(text), - "Current profile : %s", current_profile); - + snprintf(text, sizeof(text), "Current profile : %s", current_profile); +#else + u32 currentClock = 0; + pcvGetClockRate(PcvModule_Cpu, ¤tClock); + snprintf(text, sizeof(text), "Current Clock : %i", currentClock); +#endif menu_entries_append_enum(info->list, text, "", @@ -4332,6 +4326,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist break; } +#if defined(HAVE_LAKKA_SWITCH) case DISPLAYLIST_SWITCH_GPU_PROFILE: { unsigned i; @@ -4349,7 +4344,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); snprintf(text, sizeof(text), "Current profile : %s", current_profile); - + menu_entries_append_enum(info->list, text, "", @@ -4402,7 +4397,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist break; } -#endif +#endif // HAVE_LAKKA_SWITCH +#endif // HAVE_LAKKA_SWITCH || HAVE_LIBNX case DISPLAYLIST_MUSIC_LIST: { char combined_path[PATH_MAX_LENGTH]; @@ -5619,11 +5615,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_FPS_SHOW, PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_FRAMECOUNT_SHOW, + PARSE_ONLY_BOOL, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_STATISTICS_SHOW, PARSE_ONLY_BOOL, false); menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_FRAMECOUNT_SHOW, + MENU_ENUM_LABEL_MEMORY_SHOW, PARSE_ONLY_BOOL, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_VIDEO_FONT_PATH, @@ -5838,6 +5837,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist MENU_ENUM_LABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES, PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_QUICK_MENU_SHOW_OPTIONS, PARSE_ONLY_BOOL, false); @@ -6546,9 +6549,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); - menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_SCREEN_RESOLUTION, - PARSE_ACTION, 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); @@ -6570,6 +6580,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_VIDEO_WINDOWED_FULLSCREEN, PARSE_ONLY_BOOL, false); + 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_VIDEO_FULLSCREEN_X, PARSE_ONLY_UINT, false); @@ -6609,18 +6622,21 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_VIDEO_SCALE, PARSE_ONLY_FLOAT, false); - menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_VIDEO_WINDOW_WIDTH, - PARSE_ONLY_UINT, false); - menu_displaylist_parse_settings_enum(menu, info, - MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT, - PARSE_ONLY_UINT, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY, PARSE_ONLY_UINT, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_VIDEO_WINDOW_SHOW_DECORATIONS, PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION, + PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_VIDEO_WINDOW_WIDTH, + PARSE_ONLY_UINT, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT, + PARSE_ONLY_UINT, false); menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER, PARSE_ONLY_BOOL, false); @@ -7303,6 +7319,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) @@ -8322,56 +8342,204 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist info->need_push = true; } break; - case DISPLAYLIST_DROPDOWN_LIST_SPECIAL: + case DISPLAYLIST_DROPDOWN_LIST_RESOLUTION: + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); { - menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + unsigned i, size = 0; + struct video_display_config *list = video_display_server_get_resolution_list(&size); - if (strstr(info->path, "core_option_")) + if (list) { - struct string_list *tmp_str_list = string_split(info->path, "_"); - - if (tmp_str_list && tmp_str_list->size > 0) + for (i = 0; i < size; i++) { - core_option_manager_t *coreopts = NULL; + char val_d[256], str[256]; + snprintf(str, sizeof(str), "%dx%d (%d Hz)", list[i].width, list[i].height, list[i].refreshrate); + snprintf(val_d, sizeof(val_d), "%d", i); + menu_entries_append_enum(info->list, + str, + val_d, + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_DROPDOWN_ITEM_RESOLUTION, list[i].idx, 0); - rarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts); + if (list[i].current) + menu_entries_set_checked(info->list, i, true); + } - if (coreopts) + free(list); + } + else + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY), + msg_hash_to_str(MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY), + MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY, + FILE_TYPE_NONE, 0, 0); + + } + info->need_refresh = true; + info->need_push = true; + break; + case DISPLAYLIST_DROPDOWN_LIST_SPECIAL: + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); + + if (strstr(info->path, "core_option_")) + { + struct string_list *tmp_str_list = string_split(info->path, "_"); + + if (tmp_str_list && tmp_str_list->size > 0) + { + core_option_manager_t *coreopts = NULL; + + rarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts); + + if (coreopts) + { + unsigned size = (unsigned)tmp_str_list->size; + unsigned i = atoi(tmp_str_list->elems[size-1].data); + struct core_option *option = NULL; + bool checked_found = false; + unsigned checked = 0; + const char *val = core_option_manager_get_val(coreopts, i-1); + + i--; + + option = (struct core_option*)&coreopts->opts[i]; + + if (option) { - unsigned size = (unsigned)tmp_str_list->size; - unsigned i = atoi(tmp_str_list->elems[size-1].data); - struct core_option *option = NULL; - bool checked_found = false; - unsigned checked = 0; - const char *val = core_option_manager_get_val(coreopts, i-1); - - i--; - - option = (struct core_option*)&coreopts->opts[i]; - - if (option) + unsigned k; + for (k = 0; k < option->vals->size; k++) { - unsigned k; - for (k = 0; k < option->vals->size; k++) - { - const char *str = option->vals->elems[k].data; + const char *str = option->vals->elems[k].data; - if (!string_is_empty(str)) + if (!string_is_empty(str)) + { + char val_d[256]; + snprintf(val_d, sizeof(val_d), "%d", i); + menu_entries_append_enum(info->list, + str, + val_d, + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM_SPECIAL, k, 0); + + if (!checked_found && string_is_equal(str, val)) + { + checked = k; + checked_found = true; + } + + count++; + } + } + + if (checked_found) + menu_entries_set_checked(info->list, checked, true); + } + } + } + + } + else + { + enum msg_hash_enums enum_idx = (enum msg_hash_enums)atoi(info->path); + rarch_setting_t *setting = menu_setting_find_enum(enum_idx); + + if (setting) + { + switch (setting->type) + { + case ST_STRING_OPTIONS: + { + struct string_list *tmp_str_list = string_split(setting->values, "|"); + + if (tmp_str_list && tmp_str_list->size > 0) + { + unsigned i; + unsigned size = (unsigned)tmp_str_list->size; + bool checked_found = false; + unsigned checked = 0; + + for (i = 0; i < size; i++) { char val_d[256]; - snprintf(val_d, sizeof(val_d), "%d", i); + snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); menu_entries_append_enum(info->list, - str, + tmp_str_list->elems[i].data, val_d, MENU_ENUM_LABEL_NO_ITEMS, - MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM_SPECIAL, k, 0); + MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM_SPECIAL, i, 0); - if (!checked_found && string_is_equal(str, val)) + if (!checked_found && string_is_equal(tmp_str_list->elems[i].data, setting->value.target.string)) { - checked = k; + checked = i; checked_found = true; } + } + if (checked_found) + menu_entries_set_checked(info->list, checked, true); + } + } + break; + case ST_INT: + { + float i; + int32_t orig_value = *setting->value.target.integer; + unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_INT_ITEM_SPECIAL; + float step = setting->step; + double min = setting->enforce_minrange ? setting->min : 0.00; + double max = setting->enforce_maxrange ? setting->max : 999.00; + bool checked_found = false; + unsigned checked = 0; + + if (setting->get_string_representation) + { + for (i = min; i <= max; i += step) + { + char val_s[256], val_d[256]; + int val = (int)i; + + *setting->value.target.integer = val; + + setting->get_string_representation(setting, + val_s, sizeof(val_s)); + snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); + menu_entries_append_enum(info->list, + val_s, + val_d, + MENU_ENUM_LABEL_NO_ITEMS, + setting_type, val, 0); + + if (!checked_found && val == orig_value) + { + checked = count; + checked_found = true; + } + count++; + } + + *setting->value.target.integer = orig_value; + } + else + { + for (i = min; i <= max; i += step) + { + char val_s[16], val_d[16]; + int val = (int)i; + + snprintf(val_s, sizeof(val_s), "%d", val); + snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); + + menu_entries_append_enum(info->list, + val_s, + val_d, + MENU_ENUM_LABEL_NO_ITEMS, + setting_type, val, 0); + + if (!checked_found && val == orig_value) + { + checked = count; + checked_found = true; + } count++; } } @@ -8379,263 +8547,149 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist if (checked_found) menu_entries_set_checked(info->list, checked, true); } - } - } + break; + case ST_FLOAT: + { + float i; + float orig_value = *setting->value.target.fraction; + unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM_SPECIAL; + float step = setting->step; + double min = setting->enforce_minrange ? setting->min : 0.00; + double max = setting->enforce_maxrange ? setting->max : 999.00; + bool checked_found = false; + unsigned checked = 0; - } - else - { - enum msg_hash_enums enum_idx = (enum msg_hash_enums)atoi(info->path); - rarch_setting_t *setting = menu_setting_find_enum(enum_idx); - - if (setting) - { - switch (setting->type) - { - case ST_STRING_OPTIONS: + if (setting->get_string_representation) { - struct string_list *tmp_str_list = string_split(setting->values, "|"); - - if (tmp_str_list && tmp_str_list->size > 0) + for (i = min; i <= max; i += step) { - unsigned i; - unsigned size = (unsigned)tmp_str_list->size; - bool checked_found = false; - unsigned checked = 0; + char val_s[256], val_d[256]; - for (i = 0; i < size; i++) + *setting->value.target.fraction = i; + + setting->get_string_representation(setting, + val_s, sizeof(val_s)); + snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); + menu_entries_append_enum(info->list, + val_s, + val_d, + MENU_ENUM_LABEL_NO_ITEMS, + setting_type, 0, 0); + + if (!checked_found && fabs(i - orig_value) <= 0.01f) { - char val_d[256]; - snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); - menu_entries_append_enum(info->list, - tmp_str_list->elems[i].data, - val_d, - MENU_ENUM_LABEL_NO_ITEMS, - MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM_SPECIAL, i, 0); - - if (!checked_found && string_is_equal(tmp_str_list->elems[i].data, setting->value.target.string)) - { - checked = i; - checked_found = true; - } + checked = count; + checked_found = true; } + count++; + } - if (checked_found) - menu_entries_set_checked(info->list, checked, true); + *setting->value.target.fraction = orig_value; + } + else + { + for (i = min; i <= max; i += step) + { + char val_s[16], val_d[16]; + + snprintf(val_s, sizeof(val_s), "%.2f", i); + snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); + + menu_entries_append_enum(info->list, + val_s, + val_d, + MENU_ENUM_LABEL_NO_ITEMS, + setting_type, 0, 0); + + if (!checked_found && fabs(i - orig_value) <= 0.01f) + { + checked = count; + checked_found = true; + } + count++; } } - break; - case ST_INT: + + if (checked_found) + menu_entries_set_checked(info->list, checked, true); + } + break; + case ST_UINT: + { + float i; + unsigned orig_value = *setting->value.target.unsigned_integer; + unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL; + float step = setting->step; + double min = setting->enforce_minrange ? setting->min : 0.00; + double max = setting->enforce_maxrange ? setting->max : 999.00; + bool checked_found = false; + unsigned checked = 0; + + if (setting->get_string_representation) { - float i; - int32_t orig_value = *setting->value.target.integer; - unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_INT_ITEM_SPECIAL; - float step = setting->step; - double min = setting->enforce_minrange ? setting->min : 0.00; - double max = setting->enforce_maxrange ? setting->max : 999.00; - bool checked_found = false; - unsigned checked = 0; - - if (setting->get_string_representation) + for (i = min; i <= max; i += step) { - for (i = min; i <= max; i += step) + char val_s[256], val_d[256]; + int val = (int)i; + + *setting->value.target.unsigned_integer = val; + + setting->get_string_representation(setting, + val_s, sizeof(val_s)); + snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); + menu_entries_append_enum(info->list, + val_s, + val_d, + MENU_ENUM_LABEL_NO_ITEMS, + setting_type, val, 0); + + if (!checked_found && val == orig_value) { - char val_s[256], val_d[256]; - int val = (int)i; - - *setting->value.target.integer = val; - - setting->get_string_representation(setting, - val_s, sizeof(val_s)); - snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); - menu_entries_append_enum(info->list, - val_s, - val_d, - MENU_ENUM_LABEL_NO_ITEMS, - setting_type, val, 0); - - if (!checked_found && val == orig_value) - { - checked = count; - checked_found = true; - } - count++; - } - - *setting->value.target.integer = orig_value; - } - else - { - for (i = min; i <= max; i += step) - { - char val_s[16], val_d[16]; - int val = (int)i; - - snprintf(val_s, sizeof(val_s), "%d", val); - snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); - - menu_entries_append_enum(info->list, - val_s, - val_d, - MENU_ENUM_LABEL_NO_ITEMS, - setting_type, val, 0); - - if (!checked_found && val == orig_value) - { - checked = count; - checked_found = true; - } - count++; + checked = count; + checked_found = true; } + count++; } - if (checked_found) - menu_entries_set_checked(info->list, checked, true); + *setting->value.target.unsigned_integer = orig_value; } - break; - case ST_FLOAT: + else { - float i; - float orig_value = *setting->value.target.fraction; - unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM_SPECIAL; - float step = setting->step; - double min = setting->enforce_minrange ? setting->min : 0.00; - double max = setting->enforce_maxrange ? setting->max : 999.00; - bool checked_found = false; - unsigned checked = 0; - - if (setting->get_string_representation) + for (i = min; i <= max; i += step) { - for (i = min; i <= max; i += step) + char val_s[16], val_d[16]; + int val = (int)i; + + snprintf(val_s, sizeof(val_s), "%d", val); + snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); + + menu_entries_append_enum(info->list, + val_s, + val_d, + MENU_ENUM_LABEL_NO_ITEMS, + setting_type, val, 0); + + if (!checked_found && val == orig_value) { - char val_s[256], val_d[256]; - - *setting->value.target.fraction = i; - - setting->get_string_representation(setting, - val_s, sizeof(val_s)); - snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); - menu_entries_append_enum(info->list, - val_s, - val_d, - MENU_ENUM_LABEL_NO_ITEMS, - setting_type, 0, 0); - - if (!checked_found && fabs(i - orig_value) <= 0.01f) - { - checked = count; - checked_found = true; - } - count++; + checked = count; + checked_found = true; } - - *setting->value.target.fraction = orig_value; + count++; } - else - { - for (i = min; i <= max; i += step) - { - char val_s[16], val_d[16]; - - snprintf(val_s, sizeof(val_s), "%.2f", i); - snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); - - menu_entries_append_enum(info->list, - val_s, - val_d, - MENU_ENUM_LABEL_NO_ITEMS, - setting_type, 0, 0); - - if (!checked_found && fabs(i - orig_value) <= 0.01f) - { - checked = count; - checked_found = true; - } - count++; - } - } - - if (checked_found) - menu_entries_set_checked(info->list, checked, true); } - break; - case ST_UINT: - { - float i; - unsigned orig_value = *setting->value.target.unsigned_integer; - unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL; - float step = setting->step; - double min = setting->enforce_minrange ? setting->min : 0.00; - double max = setting->enforce_maxrange ? setting->max : 999.00; - bool checked_found = false; - unsigned checked = 0; - if (setting->get_string_representation) - { - for (i = min; i <= max; i += step) - { - char val_s[256], val_d[256]; - int val = (int)i; - - *setting->value.target.unsigned_integer = val; - - setting->get_string_representation(setting, - val_s, sizeof(val_s)); - snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); - menu_entries_append_enum(info->list, - val_s, - val_d, - MENU_ENUM_LABEL_NO_ITEMS, - setting_type, val, 0); - - if (!checked_found && val == orig_value) - { - checked = count; - checked_found = true; - } - count++; - } - - *setting->value.target.unsigned_integer = orig_value; - } - else - { - for (i = min; i <= max; i += step) - { - char val_s[16], val_d[16]; - int val = (int)i; - - snprintf(val_s, sizeof(val_s), "%d", val); - snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx); - - menu_entries_append_enum(info->list, - val_s, - val_d, - MENU_ENUM_LABEL_NO_ITEMS, - setting_type, val, 0); - - if (!checked_found && val == orig_value) - { - checked = count; - checked_found = true; - } - count++; - } - } - - if (checked_found) - menu_entries_set_checked(info->list, checked, true); - } - break; - default: - break; - } + if (checked_found) + menu_entries_set_checked(info->list, checked, true); + } + break; + default: + break; } } - - info->need_refresh = true; - info->need_push = true; } + + info->need_refresh = true; + info->need_push = true; break; case DISPLAYLIST_NONE: break; diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 79b8603dbd..4d8f165351 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -56,6 +56,7 @@ enum menu_displaylist_ctl_state DISPLAYLIST_NONE = 0, DISPLAYLIST_DROPDOWN_LIST, DISPLAYLIST_DROPDOWN_LIST_SPECIAL, + DISPLAYLIST_DROPDOWN_LIST_RESOLUTION, DISPLAYLIST_INFO, DISPLAYLIST_HELP, DISPLAYLIST_HELP_SCREEN_LIST, @@ -182,6 +183,8 @@ enum menu_displaylist_ctl_state #ifdef HAVE_LAKKA_SWITCH DISPLAYLIST_SWITCH_GPU_PROFILE, DISPLAYLIST_SWITCH_BACKLIGHT_CONTROL, +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) DISPLAYLIST_SWITCH_CPU_PROFILE, #endif DISPLAYLIST_PENDING_CLEAR diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 8ca72c132e..fbbfe10227 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -2654,3 +2654,57 @@ void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha) rgba[2] = rgba[6] = rgba[10] = rgba[14] = ((hex >> 0 ) & 0xFF) * (1.0f / 255.0f); /* b */ rgba[3] = rgba[7] = rgba[11] = rgba[15] = alpha; } + +void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_displaylist_info_t *info) +{ + int i = 0; + if (subsystem && subsystem_current_count > 0) + { + for (i = 0; i < subsystem_current_count; i++, subsystem++) + { + char s[PATH_MAX_LENGTH]; + if (content_get_subsystem() == i) + { + if (content_get_subsystem_rom_id() < subsystem->num_roms) + { + snprintf(s, sizeof(s), + "Load %s %s", + subsystem->desc, + i == content_get_subsystem() + ? "\u2605" : " "); + menu_entries_append_enum(info->list, + s, + msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), + MENU_ENUM_LABEL_SUBSYSTEM_ADD, + MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0); + } + else + { + snprintf(s, sizeof(s), + "Start %s %s", + subsystem->desc, + i == content_get_subsystem() + ? "\u2605" : " "); + menu_entries_append_enum(info->list, + s, + msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_LOAD), + MENU_ENUM_LABEL_SUBSYSTEM_LOAD, + MENU_SETTINGS_SUBSYSTEM_LOAD, 0, 0); + } + } + else + { + snprintf(s, sizeof(s), + "Load %s %s", + subsystem->desc, + i == content_get_subsystem() + ? "\u2605" : " "); + menu_entries_append_enum(info->list, + s, + msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), + MENU_ENUM_LABEL_SUBSYSTEM_ADD, + MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0); + } + } + } +} \ No newline at end of file diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 25fc929b50..33f111a8ca 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -143,6 +143,7 @@ enum menu_settings_type MENU_ADD_TAB, MENU_PLAYLISTS_TAB, MENU_SETTING_DROPDOWN_ITEM, + MENU_SETTING_DROPDOWN_ITEM_RESOLUTION, MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM, MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM, MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM, @@ -244,6 +245,8 @@ enum menu_settings_type #ifdef HAVE_LAKKA_SWITCH MENU_SET_SWITCH_GPU_PROFILE, MENU_SET_SWITCH_BRIGHTNESS, +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) MENU_SET_SWITCH_CPU_PROFILE, #endif @@ -841,6 +844,8 @@ void menu_driver_destroy(void); void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha); +void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_displaylist_info_t *info); + extern uintptr_t menu_display_white_texture; extern menu_display_ctx_driver_t menu_display_ctx_gl; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index b7af68fac5..1889ea6291 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; } @@ -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; } } @@ -3741,8 +3750,7 @@ static bool setting_append_list( menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_QUIT); #endif -#if defined(HAVE_LAKKA) -#ifdef HAVE_LAKKA_SWITCH +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) CONFIG_ACTION( list, list_info, MENU_ENUM_LABEL_SWITCH_CPU_PROFILE, @@ -3750,7 +3758,10 @@ static bool setting_append_list( &group_info, &subgroup_info, parent_group); +#endif +#if defined(HAVE_LAKKA) +#ifdef HAVE_LAKKA_SWITCH CONFIG_ACTION( list, list_info, MENU_ENUM_LABEL_SWITCH_GPU_PROFILE, @@ -5093,6 +5104,21 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); + CONFIG_BOOL( + list, list_info, + &settings->bools.video_memory_show, + MENU_ENUM_LABEL_MEMORY_SHOW, + MENU_ENUM_LABEL_VALUE_MEMORY_SHOW, + memory_show, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); + CONFIG_BOOL( list, list_info, &settings->bools.video_statistics_show, @@ -5381,6 +5407,21 @@ static bool setting_append_list( CMD_EVENT_VIDEO_APPLY_STATE_CHANGES); settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); +#if defined(GEKKO) || defined(__CELLOS_LV2__) + if (true) +#else + if (!string_is_equal(video_display_server_get_ident(), "null")) +#endif + { + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_SCREEN_RESOLUTION, + MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION, + &group_info, + &subgroup_info, + parent_group); + } + CONFIG_UINT( list, list_info, &custom_vp->width, @@ -5449,10 +5490,10 @@ static bool setting_append_list( settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); CONFIG_UINT( list, list_info, - &settings->uints.video_window_x, + &settings->uints.window_position_width, MENU_ENUM_LABEL_VIDEO_WINDOW_WIDTH, MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_WIDTH, - 0, + window_width, &group_info, &subgroup_info, parent_group, @@ -5463,10 +5504,10 @@ static bool setting_append_list( settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); CONFIG_UINT( list, list_info, - &settings->uints.video_window_y, + &settings->uints.window_position_height, MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT, MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_HEIGHT, - 0, + window_height, &group_info, &subgroup_info, parent_group, @@ -5508,6 +5549,21 @@ static bool setting_append_list( SD_FLAG_NONE); menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_REINIT); + CONFIG_BOOL( + list, list_info, + &settings->bools.video_window_save_positions, + MENU_ENUM_LABEL_VIDEO_WINDOW_SAVE_POSITION, + MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, + false, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); + CONFIG_BOOL( list, list_info, &settings->bools.video_scale_integer, @@ -6666,7 +6722,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, @@ -6727,7 +6783,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, @@ -6741,7 +6797,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( @@ -6772,6 +6827,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, @@ -8796,6 +8867,21 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); + CONFIG_BOOL( + list, list_info, + &settings->bools.quick_menu_show_reset_core_association, + MENU_ENUM_LABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, + quick_menu_show_reset_core_association, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); + #if 0 CONFIG_BOOL( list, list_info, diff --git a/menu/widgets/menu_filebrowser.c b/menu/widgets/menu_filebrowser.c index 89fe44c091..4999bcca5e 100644 --- a/menu/widgets/menu_filebrowser.c +++ b/menu/widgets/menu_filebrowser.c @@ -39,6 +39,7 @@ #include "../../core.h" #include "../../content.h" #include "../../verbosity.h" +#include "../../dynamic.h" static enum filebrowser_enums filebrowser_types = FILEBROWSER_NONE; @@ -73,6 +74,16 @@ void filebrowser_parse(menu_displaylist_info_t *info, unsigned type_data) bool filter_ext = settings->bools.menu_navigation_browser_filter_supported_extensions_enable; + rarch_system_info_t *system = runloop_get_system_info(); + const struct retro_subsystem_info *subsystem; + + /* Core fully loaded, use the subsystem data */ + if (system->subsystem.data) + subsystem = system->subsystem.data + content_get_subsystem(); + /* Core not loaded completely, use the data we peeked on load core */ + else + subsystem = subsystem_data + content_get_subsystem(); + if (info && string_is_equal(info->label, msg_hash_to_str(MENU_ENUM_LABEL_SCAN_FILE))) filter_ext = false; @@ -81,24 +92,14 @@ void filebrowser_parse(menu_displaylist_info_t *info, unsigned type_data) { if (filebrowser_types != FILEBROWSER_SELECT_FILE_SUBSYSTEM) str_list = file_archive_get_file_list(path, info->exts); - else - { - rarch_system_info_t *system = runloop_get_system_info(); - const struct retro_subsystem_info *subsystem = system->subsystem.data + content_get_subsystem(); - - if (subsystem) - str_list = file_archive_get_file_list(path, subsystem->roms[content_get_subsystem_rom_id()].valid_extensions); - } + else if (subsystem && subsystem_current_count > 0) + str_list = file_archive_get_file_list(path, subsystem->roms[content_get_subsystem_rom_id()].valid_extensions); } else if (!string_is_empty(path)) { if (filebrowser_types == FILEBROWSER_SELECT_FILE_SUBSYSTEM) { - rarch_system_info_t *system = runloop_get_system_info(); - const struct retro_subsystem_info *subsystem = - system->subsystem.data + content_get_subsystem(); - - if (subsystem && content_get_subsystem_rom_id() < subsystem->num_roms) + if (subsystem && subsystem_current_count > 0 && content_get_subsystem_rom_id() < subsystem->num_roms) str_list = dir_list_new(path, (filter_ext && info) ? subsystem->roms[content_get_subsystem_rom_id()].valid_extensions : NULL, true, settings->bools.show_hidden_files, true, false); diff --git a/msg_hash.h b/msg_hash.h index 93cac5f1ce..2834aff445 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -671,6 +671,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_INPUT_META_SCREENSHOT, MENU_ENUM_LABEL_VALUE_INPUT_META_MUTE, MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, + MENU_ENUM_LABEL_VALUE_INPUT_META_FPS_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_GAME_WATCH, MENU_ENUM_LABEL_VALUE_INPUT_META_ENABLE_HOTKEY, MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_UP, @@ -758,6 +759,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), @@ -857,6 +859,7 @@ enum msg_hash_enums MENU_LABEL(QUICK_MENU_SHOW_SAVE_LOAD_STATE), MENU_LABEL(QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE), MENU_LABEL(QUICK_MENU_SHOW_ADD_TO_FAVORITES), + MENU_LABEL(QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION), MENU_LABEL(QUICK_MENU_SHOW_OPTIONS), MENU_LABEL(QUICK_MENU_SHOW_CONTROLS), MENU_LABEL(QUICK_MENU_SHOW_CHEATS), @@ -1015,6 +1018,7 @@ enum msg_hash_enums /* Deferred */ MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST, MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL, + MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION, MENU_ENUM_LABEL_DEFERRED_MIXER_STREAM_SETTINGS_LIST, MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST, MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST, @@ -1229,6 +1233,7 @@ enum msg_hash_enums MENU_LABEL(SHADER_PREV), MENU_LABEL(FRAME_ADVANCE), MENU_LABEL(FPS_SHOW), + MENU_LABEL(MEMORY_SHOW), MENU_LABEL(STATISTICS_SHOW), MENU_LABEL(FRAMECOUNT_SHOW), MENU_LABEL(BSV_RECORD_TOGGLE), @@ -1940,6 +1945,7 @@ enum msg_hash_enums MENU_LABEL(NETPLAY_USE_MITM_SERVER), MENU_LABEL(NETPLAY_MITM_SERVER), MENU_LABEL(VIDEO_WINDOW_SHOW_DECORATIONS), + MENU_LABEL(VIDEO_WINDOW_SAVE_POSITION), MENU_ENUM_LABEL_VALUE_QT_INFO, MENU_ENUM_LABEL_VALUE_QT_MENU_FILE, @@ -2169,7 +2175,8 @@ enum msg_hash_enums MENU_ENUM_LABEL_SWITCH_BACKLIGHT_CONTROL, MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL, MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL, - +#endif +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) MENU_ENUM_LABEL_SWITCH_CPU_PROFILE, MENU_ENUM_LABEL_VALUE_SWITCH_CPU_PROFILE, MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE, diff --git a/network/netplay/netplay.h b/network/netplay/netplay.h index 06428696e8..23536bdbbc 100644 --- a/network/netplay/netplay.h +++ b/network/netplay/netplay.h @@ -37,6 +37,7 @@ typedef struct mitm_server { static const mitm_server_t netplay_mitm_server_list[] = { { "nyc", "New York City, USA" }, { "madrid", "Madrid, Spain" }, + { "montreal", "Montreal, Canada" }, }; enum rarch_netplay_ctl_state 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_handshake.c b/network/netplay/netplay_handshake.c index 7b52bbb9c9..f8400e5d89 100644 --- a/network/netplay/netplay_handshake.c +++ b/network/netplay/netplay_handshake.c @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -274,15 +275,18 @@ static void handshake_password(void *ignore, const char *line) { struct password_buf_s password_buf; char password[8+NETPLAY_PASS_LEN]; /* 8 for salt, 128 for password */ + char hash[NETPLAY_PASS_HASH_LEN+1]; /* + NULL terminator */ netplay_t *netplay = handshake_password_netplay; struct netplay_connection *connection = &netplay->connections[0]; snprintf(password, sizeof(password), "%08X", connection->salt); - strlcpy(password + 8, line, sizeof(password)-8); + if (!string_is_empty(line)) + strlcpy(password + 8, line, sizeof(password)-8); password_buf.cmd[0] = htonl(NETPLAY_CMD_PASSWORD); password_buf.cmd[1] = htonl(sizeof(password_buf.password)); - sha256_hash(password_buf.password, (uint8_t *) password, strlen(password)); + sha256_hash(hash, (uint8_t *) password, strlen(password)); + memcpy(password_buf.password, hash, NETPLAY_PASS_HASH_LEN); /* We have no way to handle an error here, so we'll let the next function error out */ if (netplay_send(&connection->send_packet_buffer, connection->fd, &password_buf, sizeof(password_buf))) @@ -750,8 +754,9 @@ bool netplay_handshake_pre_nick(netplay_t *netplay, bool netplay_handshake_pre_password(netplay_t *netplay, struct netplay_connection *connection, bool *had_input) { - struct password_buf_s password_buf, corr_password_buf; + struct password_buf_s password_buf; char password[8+NETPLAY_PASS_LEN]; /* 8 for salt */ + char hash[NETPLAY_PASS_HASH_LEN+1]; /* + NULL terminator */ ssize_t recvd; char msg[512]; bool correct = false; @@ -787,11 +792,9 @@ bool netplay_handshake_pre_password(netplay_t *netplay, strlcpy(password + 8, settings->paths.netplay_password, sizeof(password)-8); - sha256_hash(corr_password_buf.password, - (uint8_t *) password, strlen(password)); + sha256_hash(hash, (uint8_t *) password, strlen(password)); - if (!memcmp(password_buf.password, - corr_password_buf.password, sizeof(password_buf.password))) + if (!memcmp(password_buf.password, hash, NETPLAY_PASS_HASH_LEN)) { correct = true; connection->can_play = true; @@ -802,11 +805,9 @@ bool netplay_handshake_pre_password(netplay_t *netplay, strlcpy(password + 8, settings->paths.netplay_spectate_password, sizeof(password)-8); - sha256_hash(corr_password_buf.password, - (uint8_t *) password, strlen(password)); + sha256_hash(hash, (uint8_t *) password, strlen(password)); - if (!memcmp(password_buf.password, - corr_password_buf.password, sizeof(password_buf.password))) + if (!memcmp(password_buf.password, hash, NETPLAY_PASS_HASH_LEN)) correct = true; } 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/paths.c b/paths.c index b956989638..869d6b8e34 100644 --- a/paths.c +++ b/paths.c @@ -311,7 +311,7 @@ static bool path_init_subsystem(void) /* For subsystems, we know exactly which RAM types are supported. */ info = libretro_find_subsystem_info( - system->subsystem.data, + subsystem_data, system->subsystem.size, path_get(RARCH_PATH_SUBSYSTEM)); diff --git a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj index a97c52c3f8..5ca7fea33a 100644 --- a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj @@ -88,6 +88,17 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 05132C6621A74D7A00379846 /* ozone_texture.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ozone_texture.c; sourceTree = ""; }; + 05132C6721A74D7B00379846 /* ozone_theme.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ozone_theme.h; sourceTree = ""; }; + 05132C6821A74D7B00379846 /* ozone.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ozone.h; sourceTree = ""; }; + 05132C6921A74D7B00379846 /* ozone_entries.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ozone_entries.c; sourceTree = ""; }; + 05132C6A21A74D7B00379846 /* ozone.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ozone.c; sourceTree = ""; }; + 05132C6B21A74D7B00379846 /* ozone_theme.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ozone_theme.c; sourceTree = ""; }; + 05132C6C21A74D7B00379846 /* ozone_sidebar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ozone_sidebar.c; sourceTree = ""; }; + 05132C6D21A74D7B00379846 /* ozone_sidebar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ozone_sidebar.h; sourceTree = ""; }; + 05132C6E21A74D7B00379846 /* ozone_display.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ozone_display.c; sourceTree = ""; }; + 05132C6F21A74D7B00379846 /* ozone_texture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ozone_texture.h; sourceTree = ""; }; + 05132C7021A74D7B00379846 /* ozone_display.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ozone_display.h; sourceTree = ""; }; 05269A6120ABF20500C29F1E /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; }; 05366512213F8BE5007E7EA0 /* thumbnailpackdownload.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = thumbnailpackdownload.cpp; sourceTree = ""; }; 05366513213F8BE5007E7EA0 /* ui_qt_application.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ui_qt_application.cpp; sourceTree = ""; }; @@ -514,7 +525,6 @@ 05D7753320A5678300646447 /* griffin_cpp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = griffin_cpp.cpp; path = ../../griffin/griffin_cpp.cpp; sourceTree = ""; }; 05D7753420A5678400646447 /* griffin_glslang.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = griffin_glslang.cpp; path = ../../griffin/griffin_glslang.cpp; sourceTree = ""; }; 05EFAFC22191D64200D27059 /* stripes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stripes.c; sourceTree = ""; }; - 05EFAFC32191D64200D27059 /* ozone.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ozone.c; sourceTree = ""; }; 05F2872F20F2BEEA00632D47 /* task_autodetect.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = task_autodetect.c; sourceTree = ""; }; 05F2873020F2BEEA00632D47 /* task_netplay_find_content.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = task_netplay_find_content.c; sourceTree = ""; }; 05F2873120F2BEEA00632D47 /* task_netplay_nat_traversal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = task_netplay_nat_traversal.c; sourceTree = ""; }; @@ -610,6 +620,24 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 05132C6521A74D5100379846 /* ozone */ = { + isa = PBXGroup; + children = ( + 05132C6E21A74D7B00379846 /* ozone_display.c */, + 05132C7021A74D7B00379846 /* ozone_display.h */, + 05132C6921A74D7B00379846 /* ozone_entries.c */, + 05132C6C21A74D7B00379846 /* ozone_sidebar.c */, + 05132C6D21A74D7B00379846 /* ozone_sidebar.h */, + 05132C6621A74D7A00379846 /* ozone_texture.c */, + 05132C6F21A74D7B00379846 /* ozone_texture.h */, + 05132C6B21A74D7B00379846 /* ozone_theme.c */, + 05132C6721A74D7B00379846 /* ozone_theme.h */, + 05132C6A21A74D7B00379846 /* ozone.c */, + 05132C6821A74D7B00379846 /* ozone.h */, + ); + path = ozone; + sourceTree = ""; + }; 05366511213F8BE5007E7EA0 /* qt */ = { isa = PBXGroup; children = ( @@ -801,12 +829,12 @@ isa = PBXGroup; children = ( 05A8C53520DB72F000FF7857 /* nuklear */, + 05132C6521A74D5100379846 /* ozone */, 05A8C54020DB72F000FF7857 /* materialui.c */, 05A8C53420DB72F000FF7857 /* menu_generic.c */, 05A8C53320DB72F000FF7857 /* menu_generic.h */, 05A8C53D20DB72F000FF7857 /* nuklear.c */, 05A8C53E20DB72F000FF7857 /* null.c */, - 05EFAFC32191D64200D27059 /* ozone.c */, 05A8C53C20DB72F000FF7857 /* rgui.c */, 05EFAFC22191D64200D27059 /* stripes.c */, 05A8C53220DB72F000FF7857 /* xmb.c */, diff --git a/qb/config.libs.sh b/qb/config.libs.sh index a679058d35..9542d643ab 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -455,8 +455,9 @@ check_pkgconf V4L2 libv4l2 check_pkgconf FREETYPE freetype2 check_pkgconf X11 x11 check_pkgconf XCB xcb -check_pkgconf WAYLAND wayland-egl -check_pkgconf WAYLAND_CURSOR wayland-cursor +check_pkgconf WAYLAND wayland-egl 1.15 +check_pkgconf WAYLAND_CURSOR wayland-cursor 1.15 +check_pkgconf WAYLAND_PROTOS wayland-protocols 1.15 check_pkgconf XKBCOMMON xkbcommon 0.3.2 check_pkgconf DBUS dbus-1 check_pkgconf XEXT xext @@ -472,10 +473,19 @@ check_val '' XKBCOMMON -lxkbcommon check_val '' XEXT -lXext check_val '' XF86VM -lXxf86vm -if [ "$HAVE_X11" = 'no' ]; then - HAVE_XEXT=no; HAVE_XF86VM=no; HAVE_XINERAMA=no; HAVE_XSHM=no +if [ "$HAVE_WAYLAND_PROTOS" = yes ] && [ "$HAVE_WAYLAND" = yes ]; then + check_pkgconf WAYLAND_SCANNER wayland-scanner 1.15 + ./gfx/common/wayland/generate_wayland_protos.sh +else + die : 'Notice: wayland-egl or wayland-protocols not present. Skiping Wayland code paths.' + HAVE_WAYLAND='no' fi +if [ "$HAVE_X11" = 'no' ]; then + HAVE_XEXT=no; HAVE_XF86VM=no; HAVE_XINERAMA=no; HAVE_XSHM=no; HAVE_XRANDR=no +fi + +check_lib '' XRANDR -lXrandr check_pkgconf XINERAMA xinerama check_val '' XINERAMA -lXinerama diff --git a/qb/config.params.sh b/qb/config.params.sh index daf9206eaf..9c1f3d7ef3 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -59,6 +59,7 @@ HAVE_OPENDINGUX_FBDEV=no # Opendingux fbdev context support HAVE_OPENGLES=no # Use GLESv2 instead of desktop GL HAVE_OPENGLES3=no # OpenGLES3 support HAVE_X11=auto # everything X11. +HAVE_XRANDR=auto # Xrandr support. HAVE_OMAP=no # OMAP video support HAVE_XINERAMA=auto # Xinerama support. HAVE_KMS=auto # KMS context support diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index b181492bde..f085a66a7e 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 = settings->uints.video_record_threads; 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 = settings->uints.video_record_threads; 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 = settings->uints.video_record_threads; 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 = settings->uints.video_record_threads; 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 = settings->uints.video_record_threads; + 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 = settings->uints.video_record_threads; + 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 = settings->uints.video_record_threads; + 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 = settings->uints.video_record_threads; 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() */ diff --git a/retroarch.c b/retroarch.c index eb14ada97e..49d35b45bb 100644 --- a/retroarch.c +++ b/retroarch.c @@ -210,6 +210,7 @@ static bool rarch_is_inited = false; static bool rarch_error_on_init = false; static bool rarch_block_config_read = false; static bool rarch_force_fullscreen = false; +static bool rarch_is_switching_display_mode = false; static bool has_set_verbosity = false; static bool has_set_libretro = false; static bool has_set_libretro_directory = false; @@ -2025,6 +2026,21 @@ void retroarch_unset_forced_fullscreen(void) rarch_force_fullscreen = false; } +bool retroarch_is_switching_display_mode(void) +{ + return rarch_is_switching_display_mode; +} + +void retroarch_set_switching_display_mode(void) +{ + rarch_is_switching_display_mode = true; +} + +void retroarch_unset_switching_display_mode(void) +{ + rarch_is_switching_display_mode = false; +} + /* set a runtime shader preset without overwriting the settings value */ void retroarch_set_shader_preset(const char* preset) { @@ -2522,6 +2538,12 @@ static enum runloop_state runloop_check_state( bool menu_is_alive = menu_driver_is_alive(); #endif +#ifdef HAVE_LIBNX + // Should be called once per frame + if(!appletMainLoop()) + return RUNLOOP_STATE_QUIT; +#endif + BIT256_CLEAR_ALL_PTR(¤t_input); #ifdef HAVE_MENU @@ -2924,6 +2946,18 @@ static enum runloop_state runloop_check_state( old_pressed = pressed; } + /* Check FPS toggle */ + { + static bool old_pressed = false; + bool pressed = BIT256_GET( + current_input, RARCH_FPS_TOGGLE); + + if (pressed && !old_pressed) + command_event(CMD_EVENT_FPS_TOGGLE, NULL); + + old_pressed = pressed; + } + /* Check recording toggle */ { static bool old_pressed = false; diff --git a/retroarch.cfg b/retroarch.cfg index 671fa4a73c..da36413bda 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -124,6 +124,9 @@ # Display framerate. # fps_show = false +# Display memory. +# memory_show = false + # Display total number of frames rendered. (only displays if fps_show is enabled) # framecount_show = diff --git a/retroarch.h b/retroarch.h index a3667fde88..50f481ea6c 100644 --- a/retroarch.h +++ b/retroarch.h @@ -330,6 +330,12 @@ void retroarch_unset_shader_preset(void); char* retroarch_get_shader_preset(void); +bool retroarch_is_switching_display_mode(void); + +void retroarch_set_switching_display_mode(void); + +void retroarch_unset_switching_display_mode(void); + /** * retroarch_fail: * @error_code : Error code. diff --git a/switch_performance_profiles.h b/switch_performance_profiles.h new file mode 100644 index 0000000000..316e0bc122 --- /dev/null +++ b/switch_performance_profiles.h @@ -0,0 +1,125 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018-2018 - Natinusala + * Copyright (C) 2018-2018 - M4xw + * + * 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- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __SWITCH_PERFORMANCE_PROFILES_H +#define __SWITCH_PERFORMANCE_PROFILES_H + +#if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) +#ifdef HAVE_LAKKA_SWITCH +static char *SWITCH_GPU_PROFILES[] = { + "docked-overclock-3", + "docked-overclock-2", + "docked-overclock-1", + "docked", + "non-docked-overclock-5", + "non-docked-overclock-4", + "non-docked-overclock-3", + "non-docked-overclock-2", + "non-docked-overclock-1", + "non-docked", + "non-docked-underclock-1", + "non-docked-underclock-2", + "non-docked-underclock-3", +}; + +static char *SWITCH_GPU_SPEEDS[] = { + "998 Mhz", + "921 Mhz", + "844 Mhz", + "768 Mhz", + "691 Mhz", + "614 Mhz", + "537 Mhz", + "460 Mhz", + "384 Mhz", + "307 Mhz", + "230 Mhz", + "153 Mhz", + "76 Mhz"}; + +static int SWITCH_BRIGHTNESS[] = { + 10, + 20, + 30, + 40, + 50, + 60, + 70, + 80, + 90, + 100}; +#endif + +static char *SWITCH_CPU_PROFILES[] = { +#ifndef HAVE_LIBNX + "overclock-4", + "overclock-3", + "overclock-2", + "overclock-1", + "default", +#else + "Maximum Performance", + "High Performance", + "Boost Performance", + "Stock Performance", + "Powersaving Mode 1", + "Powersaving Mode 2", + "Powersaving Mode 3", +#endif +}; + +#define SWITCH_DEFAULT_CPU_PROFILE 3 /* Stock Performance */ +#define LIBNX_MAX_CPU_PROFILE 0 /* Max Performance */ + +static char *SWITCH_CPU_SPEEDS[] = { +#ifndef HAVE_LIBNX + "1912 MHz", + "1734 MHz", + "1530 MHz", + "1224 MHz", + "1020 MHz" +#else + "1785 MHz", + "1581 MHz", + "1224 MHz", + "1020 MHz", + "918 MHz", + "816 MHz", + "714 MHz" +#endif +}; + +static unsigned SWITCH_CPU_SPEEDS_VALUES[] = { +#ifndef HAVE_LIBNX + 1912000000, + 1734000000, + 1530000000, + 1224000000, + 1020000000 +#else + 1785000000, + 1581000000, + 1224000000, + 1020000000, + 918000000, + 816000000, + 714000000 +#endif +}; + +#endif + +#endif \ No newline at end of file diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index 4f8ac88943..00bb990b85 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -114,6 +114,11 @@ static bool input_autoconfigured[MAX_USERS]; static unsigned input_device_name_index[MAX_INPUT_DEVICES]; static bool input_autoconfigure_swap_override; +/* TODO/FIXME - Not thread safe to access this + * on main thread as well in its current state - + * menu_input.c - menu_event calls this function + * right now, while the underlying variable can + * be modified by a task thread. */ bool input_autoconfigure_get_swap_override(void) { return input_autoconfigure_swap_override; diff --git a/tasks/task_content.c b/tasks/task_content.c index af28c4fcac..36883c1adb 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -663,7 +663,7 @@ error: static const struct retro_subsystem_info *content_file_init_subsystem( const struct retro_subsystem_info *subsystem_data, - size_t subsystem_size, + size_t subsystem_current_count, char **error_string, bool *ret) { @@ -671,7 +671,7 @@ retro_subsystem_info *content_file_init_subsystem( char *msg = (char*)malloc(path_size); struct string_list *subsystem = path_get_subsystem_list(); const struct retro_subsystem_info *special = libretro_find_subsystem_info( - subsystem_data, subsystem_size, + subsystem_data, subsystem_current_count, path_get(RARCH_PATH_SUBSYSTEM)); msg[0] = '\0'; @@ -1781,12 +1781,18 @@ int content_get_subsystem() void content_set_subsystem(unsigned idx) { rarch_system_info_t *system = runloop_get_system_info(); - const struct retro_subsystem_info *subsystem = system ? - system->subsystem.data + idx : NULL; + const struct retro_subsystem_info *subsystem; - pending_subsystem_id = idx; + /* Core fully loaded, use the subsystem data */ + if (system->subsystem.data) + subsystem = system->subsystem.data + idx; + /* Core not loaded completely, use the data we peeked on load core */ + else + subsystem = subsystem_data + idx; - if (subsystem) + pending_subsystem_id = idx; + + if (subsystem && subsystem_current_count > 0) { strlcpy(pending_subsystem_ident, subsystem->ident, sizeof(pending_subsystem_ident)); 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; diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index b356ffed58..428e467835 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -153,12 +153,53 @@ void *glkitview_init(void); } #elif defined(HAVE_COCOATOUCH) +- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures +{ + return UIRectEdgeBottom; +} + +-(BOOL)prefersHomeIndicatorAutoHidden +{ + return NO; +} + - (void)viewDidAppear:(BOOL)animated { /* Pause Menus. */ [self showPauseIndicator]; + if (@available(iOS 11.0, *)) { + [self setNeedsUpdateOfHomeIndicatorAutoHidden]; + } } +-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + if (@available(iOS 11, *)) { + [coordinator animateAlongsideTransition:^(id _Nonnull context) { + [self adjustViewFrameForSafeArea]; + } completion:^(id _Nonnull context) { + }]; + } +} + +-(void)adjustViewFrameForSafeArea { + // This is for adjusting the view frame to account for the notch in iPhone X phones + if (@available(iOS 11, *)) { + RAScreen *screen = (__bridge RAScreen*)get_chosen_screen(); + CGRect screenSize = [screen bounds]; + UIEdgeInsets inset = [[UIApplication sharedApplication] delegate].window.safeAreaInsets; + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; + CGRect newFrame = screenSize; + if ( orientation == UIInterfaceOrientationPortrait ) { + newFrame = CGRectMake(screenSize.origin.x, screenSize.origin.y + inset.top, screenSize.size.width, screenSize.size.height - inset.top); + } else if ( orientation == UIInterfaceOrientationLandscapeLeft ) { + newFrame = CGRectMake(screenSize.origin.x, screenSize.origin.y, screenSize.size.width - inset.right, screenSize.size.height); + } else if ( orientation == UIInterfaceOrientationLandscapeRight ) { + newFrame = CGRectMake(screenSize.origin.x + inset.left, screenSize.origin.y, screenSize.size.width - inset.left, screenSize.size.height); + } + self.view.frame = newFrame; + } +} - (void)showPauseIndicator { g_pause_indicator_view.alpha = 1.0f; @@ -191,6 +232,7 @@ void *glkitview_init(void); g_pause_indicator_view.frame = CGRectMake(tenpctw * 4.0f, 0.0f, tenpctw * 2.0f, tenpcth); [g_pause_indicator_view viewWithTag:1].frame = CGRectMake(0, 0, tenpctw * 2.0f, tenpcth); + [self adjustViewFrameForSafeArea]; } #define ALMOST_INVISIBLE (.021f) diff --git a/ui/drivers/cocoa/cocoa_common_metal.m b/ui/drivers/cocoa/cocoa_common_metal.m index f5ddaceb08..9f4d9d7e57 100644 --- a/ui/drivers/cocoa/cocoa_common_metal.m +++ b/ui/drivers/cocoa/cocoa_common_metal.m @@ -172,10 +172,23 @@ void *glkitview_init(void); } #elif defined(HAVE_COCOATOUCH) +- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures +{ + return UIRectEdgeBottom; +} + +-(BOOL)prefersHomeIndicatorAutoHidden +{ + return NO; +} + - (void)viewDidAppear:(BOOL)animated { /* Pause Menus. */ [self showPauseIndicator]; + if (@available(iOS 11.0, *)) { + [self setNeedsUpdateOfHomeIndicatorAutoHidden]; + } } - (void)showPauseIndicator diff --git a/verbosity.c b/verbosity.c index 823607b583..42a79f4977 100644 --- a/verbosity.c +++ b/verbosity.c @@ -126,9 +126,12 @@ void retro_main_log_file_init(const char *path) void retro_main_log_file_deinit(void) { if (log_file_fp && log_file_fp != stderr) + { fclose(log_file_fp); - if (log_file_buf) free(log_file_buf); - log_file_fp = NULL; + log_file_fp = NULL; + } + if (log_file_buf) + free(log_file_buf); log_file_buf = NULL; }