diff --git a/Makefile.common b/Makefile.common index 4ed626d02a..786096ceff 100644 --- a/Makefile.common +++ b/Makefile.common @@ -866,6 +866,7 @@ ifeq ($(HAVE_WAYLAND), 1) 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 ifeq ($(HAVE_EGL), 1) LIBS += $(EGL_LIBS) 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/command.c b/command.c index a378a97de9..983bd8aae2 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,9 +1900,10 @@ bool command_event(enum event_command cmd, void *data) break; case CMD_EVENT_LOAD_CORE: { + bool success = false; subsystem_size = 0; content_clear_subsystem(); - bool success = command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL); + success = command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL); (void)success; #ifndef HAVE_DYNAMIC @@ -2186,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); 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 38882709db..362672ca6b 100644 --- a/config.def.h +++ b/config.def.h @@ -244,6 +244,11 @@ static const bool aspect_ratio_auto = false; 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 @@ -549,8 +554,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. */ @@ -581,7 +589,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 0d209a5940..e778f43a09 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); @@ -1678,6 +1682,10 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, 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; return tmp; @@ -3132,6 +3140,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 dee5497cb8..456fe8b953 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; @@ -445,6 +446,8 @@ typedef struct settings unsigned window_position_height; unsigned video_record_threads; + + unsigned libnx_overclock; } uints; struct diff --git a/dynamic.c b/dynamic.c index bacbefde07..a3092dd8cd 100644 --- a/dynamic.c +++ b/dynamic.c @@ -185,6 +185,7 @@ static bool environ_cb_get_system_info(unsigned cmd, void *data) 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_size = 0; @@ -206,7 +207,7 @@ static bool environ_cb_get_system_info(unsigned cmd, void *data) } RARCH_LOG("Subsystems: %d\n", i); - unsigned size = i; + size = i; if (system) { 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..b9416d2f13 100644 --- a/gfx/common/egl_common.c +++ b/gfx/common/egl_common.c @@ -315,7 +315,14 @@ bool egl_init_context(egl_ctx_data_t *egl, EGLint *major, EGLint *minor, EGLint *n, const EGLint *attrib_ptr) { - EGLDisplay dpy = get_egl_display(platform, display_data); + int i; + EGLint id; + 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 +336,49 @@ bool egl_init_context(egl_ctx_data_t *egl, RARCH_LOG("[EGL]: EGL version: %d.%d\n", *major, *minor); +#ifdef HAVE_GBM + 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 (!eglGetConfigAttrib(egl->dpy, + configs[i], EGL_NATIVE_VISUAL_ID, &id)) + continue; + + if (id == GBM_FORMAT_XRGB8888) + break; + } + + if (id != GBM_FORMAT_XRGB8888) + { + RARCH_ERR("[EGL]: No EGL configs with format XRGB8888\n"); + return false; + } + + config_index = i; + if (config_index != -1) + egl->config = configs[config_index]; + + free(configs); +#else if (!eglChooseConfig(egl->dpy, attrib_ptr, &egl->config, 1, n) || *n != 1) return false; +#endif egl->major = g_egl_major; egl->minor = g_egl_minor; 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/wayland/generate_wayland_protos.sh b/gfx/common/wayland/generate_wayland_protos.sh index e64ea58914..22e19281cf 100755 --- a/gfx/common/wayland/generate_wayland_protos.sh +++ b/gfx/common/wayland/generate_wayland_protos.sh @@ -7,6 +7,10 @@ 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 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 code $WAYLAND_PROTOS/stable/xdg-shell/xdg-shell.xml $OUTPUT/xdg-shell.c diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index f9314ada30..a9d96062e0 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -622,18 +622,24 @@ static LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message, 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; - g_win32_pos_height= settings->uints.window_position_height; + 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)); @@ -655,8 +661,8 @@ static void win32_save_position(void) { 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; - settings->uints.window_position_height = g_win32_pos_height; + 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); } } } 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..09769b1b0a 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1742,6 +1742,9 @@ static bool vulkan_frame(void *data, const void *frame, 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; @@ -1769,6 +1772,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/switch_ctx.c b/gfx/drivers_context/switch_ctx.c index ccf3c40d02..47ab760b47 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; @@ -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/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index ac083651a1..a7dbdc949f 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -50,6 +50,9 @@ /* 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" @@ -76,6 +79,9 @@ typedef struct gfx_ctx_wayland_data bool maximized; bool resize; bool configured; + bool activated; + int prev_width; + int prev_height; unsigned width; unsigned height; unsigned physical_width; @@ -84,8 +90,13 @@ typedef struct gfx_ctx_wayland_data struct wl_registry *registry; struct wl_compositor *compositor; 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 *shell; + struct xdg_wm_base *xdg_shell; struct xdg_toplevel *xdg_toplevel; struct wl_keyboard *wl_keyboard; struct wl_pointer *wl_pointer; @@ -311,8 +322,14 @@ static void pointer_handle_button(void *data, { wl->input.mouse.left = true; - if (BIT_GET(wl->input.key_state, KEY_LEFTALT) && wl->xdg_toplevel) - xdg_toplevel_move(wl->xdg_toplevel, 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; @@ -571,18 +588,149 @@ static const struct xdg_surface_listener xdg_surface_listener = { }; static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, - int width, int height, struct wl_array *states) + int32_t width, int32_t height, struct wl_array *states) { gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; - /* TODO: implement resizing */ - - wl->configured = false; + 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); } -/* TODO: implement xdg_toplevel close */ 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) +{ + (void)data; + wl_shell_surface_pong(shell_surface, serial); +} + +static void shell_surface_handle_configure(void *data, + struct wl_shell_surface *shell_surface, + uint32_t edges, int32_t width, int32_t height) +{ + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; + + (void)shell_surface; + (void)edges; + + wl->width = wl->buffer_scale * width; + wl->height = wl->buffer_scale * height; + + RARCH_LOG("[Wayland]: Surface configure: %u x %u.\n", + wl->width, wl->height); +} + +static void shell_surface_handle_popup_done(void *data, + struct wl_shell_surface *shell_surface) +{ + (void)data; + (void)shell_surface; +} + +static const struct wl_shell_surface_listener shell_surface_listener = { + shell_surface_handle_ping, + shell_surface_handle_configure, + shell_surface_handle_popup_done, }; static void display_handle_geometry(void *data, @@ -676,8 +824,14 @@ static void registry_handle_global(void *data, struct wl_registry *reg, wl_display_roundtrip(wl->input.dpy); } else if (string_is_equal(interface, "xdg_wm_base")) - wl->shell = (struct 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); else if (string_is_equal(interface, "wl_shm")) wl->shm = (struct wl_shm*)wl_registry_bind(reg, id, &wl_shm_interface, 1); else if (string_is_equal(interface, "wl_seat")) @@ -760,16 +914,28 @@ 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) - xdg_wm_base_destroy(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->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->idle_inhibitor) @@ -784,12 +950,17 @@ 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->xdg_surface = NULL; wl->surface = NULL; + wl->xdg_toplevel = NULL; + wl->zxdg_toplevel = NULL; + wl->shell_surf = NULL; wl->width = 0; wl->height = 0; @@ -910,8 +1081,14 @@ static void gfx_ctx_wl_update_title(void *data, void *data2) video_driver_get_window_title(title, sizeof(title)); - if (wl && title[0]) - xdg_toplevel_set_title (wl->xdg_toplevel, title); + if (wl && title[0]) { + if (wl->xdg_toplevel) + xdg_toplevel_set_title(wl->xdg_toplevel, title); + else if (wl->zxdg_toplevel) + zxdg_toplevel_v6_set_title(wl->zxdg_toplevel, title); + else if (wl->shell_surf) + wl_shell_surface_set_title(wl->shell_surf, title); + } } @@ -1071,10 +1248,20 @@ 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) @@ -1304,25 +1491,50 @@ static bool gfx_ctx_wl_set_video_mode(void *data, break; } - wl->xdg_surface = xdg_wm_base_get_xdg_surface(wl->shell, wl->surface); - xdg_surface_add_listener(wl->xdg_surface, &xdg_surface_listener, wl); + 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"); - wl->xdg_toplevel = xdg_surface_get_toplevel(wl->xdg_surface); - xdg_toplevel_add_listener(wl->xdg_toplevel, &xdg_toplevel_listener, wl); + 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"); - xdg_toplevel_set_app_id (wl->xdg_toplevel, "RetroArch"); - xdg_toplevel_set_title (wl->xdg_toplevel, "RetroArch"); - - /* 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); - - /* Waiting for the "initial" set of globals to appear */ - wl_display_roundtrip(wl->input.dpy); - xdg_wm_base_add_listener(wl->shell, &xdg_shell_listener, NULL); + 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) { @@ -1347,8 +1559,16 @@ static bool gfx_ctx_wl_set_video_mode(void *data, break; } - if (fullscreen) - xdg_toplevel_set_fullscreen(wl->xdg_toplevel, NULL); + 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); @@ -1414,8 +1634,9 @@ static bool gfx_ctx_wl_has_focus(void *data) static bool gfx_ctx_wl_suppress_screensaver(void *data, bool state) { (void)data; - gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; + gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; + if (!wl->idle_inhibit_manager) return false; if (state == (!!wl->idle_inhibitor)) 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_driver.c b/gfx/video_driver.c index e82e19d022..88ef1862ef 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2449,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, @@ -2461,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 @@ -2491,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 { @@ -2620,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/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 865fd63e2b..b4ba128781 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3432,7 +3432,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, diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 13f6fbb55a..328c18d273 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 超频" diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 3a6c051535..48ab449e73 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" diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index 3954649d49..c614822049 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -6224,7 +6224,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, diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index d60e909750..f3e9d8b2d3 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" diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 1571d7e991..d3d3be35a9 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 @@ -1551,6 +1553,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, diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index c63c4404f9..0dd39c521a 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" 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 15bd1b26c3..6fa546fe67 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" @@ -3630,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." @@ -6265,7 +6283,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, @@ -7789,4 +7807,4 @@ MSG_HASH( "Warning: Missing assets, use the Online Updater if available" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION, - "Remember Window Positions") + "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 7f8d37d4cc..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( @@ -906,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 a4d9230bce..0218028835 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2524,25 +2524,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) @@ -5187,6 +5196,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); @@ -5640,6 +5651,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 ca9b61fcb6..2a95e163d8 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -124,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) @@ -483,9 +485,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 @@ -1873,6 +1878,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; @@ -2028,10 +2039,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 b3dc2440b8..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; diff --git a/menu/drivers/ozone/ozone.c b/menu/drivers/ozone/ozone.c index eac8d269e3..909d293a67 100644 --- a/menu/drivers/ozone/ozone.c +++ b/menu/drivers/ozone/ozone.c @@ -109,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; @@ -184,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); @@ -206,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; @@ -352,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 */ @@ -363,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 */ @@ -372,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(); @@ -428,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]); @@ -589,7 +598,7 @@ static int ozone_list_push(void *data, void *userdata, if (subsystem_size > 0) { - const struct retro_subsystem_info* subsystem = system->subsystem.data; + const struct retro_subsystem_info* subsystem = subsystem_data; for (i = 0; i < subsystem_size; i++, subsystem++) { char s[PATH_MAX_LENGTH]; @@ -673,10 +682,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); @@ -779,7 +790,7 @@ static void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozo if (new_scroll > 0) new_scroll = 0; - + if (allow_animation) { /* Cursor animation */ @@ -845,7 +856,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); @@ -908,7 +919,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); @@ -1063,12 +1074,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); @@ -1197,9 +1208,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 ); @@ -1223,7 +1234,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, @@ -1433,7 +1444,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; @@ -1463,7 +1474,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; @@ -1703,7 +1714,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_texture.c b/menu/drivers/ozone/ozone_texture.c index 7af3843ee1..b1a34532a8 100644 --- a/menu/drivers/ozone/ozone_texture.c +++ b/menu/drivers/ozone/ozone_texture.c @@ -211,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]; @@ -274,6 +277,10 @@ menu_texture_item ozone_entries_icon_get_texture(ozone_handle_t *ozone, 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; } @@ -307,6 +314,7 @@ 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: + 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: @@ -448,351 +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: - icon_name = "menu_add.png"; - break; + return "menu_add.png"; case OZONE_ENTRIES_ICONS_TEXTURE_BRIGHTNESS: - icon_name = "menu_brightnes.png"; - break; + return "menu_brightness.png"; case OZONE_ENTRIES_ICONS_TEXTURE_PAUSE: - icon_name = "menu_pause.png"; - break; + 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) @@ -838,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 e06bea008f..5441732378 100644 --- a/menu/drivers/ozone/ozone_texture.h +++ b/menu/drivers/ozone/ozone_texture.h @@ -196,10 +196,12 @@ enum 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); @@ -207,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/xmb.c b/menu/drivers/xmb.c index 106da86156..ea131d5342 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -205,6 +205,10 @@ enum 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 }; @@ -234,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]; @@ -2450,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]; @@ -2512,6 +2520,10 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, 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; } @@ -2571,6 +2583,7 @@ 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: + 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: @@ -2954,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; @@ -2975,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, @@ -3752,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, @@ -3781,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]; @@ -3830,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, @@ -3852,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); + } } } @@ -4620,354 +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: - icon_name = "menu_add.png"; - break; + return "menu_add.png"; case XMB_TEXTURE_BRIGHTNESS: - icon_name = "menu_brightness.png"; - break; + return "menu_brightness.png"; case XMB_TEXTURE_PAUSE: - icon_name = "menu_pause.png"; - break; + 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( @@ -4975,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]; @@ -5038,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) @@ -5629,8 +5550,7 @@ static int xmb_list_push(void *data, void *userdata, menu_displaylist_setting(&entry); if (subsystem_size > 0) { - const struct retro_subsystem_info* subsystem = NULL; - subsystem = subsystem_data; + const struct retro_subsystem_info* subsystem = subsystem_data; for (i = 0; i < subsystem_size; i++, subsystem++) { char s[PATH_MAX_LENGTH]; @@ -5714,10 +5634,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_displaylist.c b/menu/menu_displaylist.c index 5249e21a91..e314c8ac54 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -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 @@ -4265,7 +4270,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; @@ -4274,17 +4279,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, "", @@ -4313,6 +4323,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; @@ -4330,7 +4341,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, "", @@ -4383,7 +4394,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]; @@ -5600,11 +5612,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, diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index a2a71f2af2..4d8f165351 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -183,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.h b/menu/menu_driver.h index 0e97b73a3f..6487d37248 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -245,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 diff --git a/menu/menu_setting.c b/menu/menu_setting.c index a009d79c31..daf67f6100 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3750,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, @@ -3759,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, @@ -5102,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, diff --git a/msg_hash.h b/msg_hash.h index 3c16be4e89..326c32c92e 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, @@ -1231,6 +1232,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), @@ -2170,7 +2172,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/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/retroarch.c b/retroarch.c index eb14ada97e..ba30250af1 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2522,6 +2522,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 +2930,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/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/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; }