From a5f5e4fe73cf81de9bd7833ac3f3322bdf3036c4 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 22 Jul 2021 08:09:56 +0200 Subject: [PATCH] early-access version 1908 --- README.md | 2 +- src/yuzu_cmd/config.cpp | 1 + src/yuzu_cmd/default_ini.h | 4 ++ src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 48 +++++++++++++-------- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index ba1429227..1b1f6f652 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1907. +This is the source code for early-access 1908. ## Legal Notice diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 207535ae5..640d7d111 100755 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -448,6 +448,7 @@ void Config::ReadValues() { ReadSetting("Renderer", Settings::values.disable_shader_loop_safety_checks); ReadSetting("Renderer", Settings::values.vulkan_device); + ReadSetting("Renderer", Settings::values.fullscreen_mode); ReadSetting("Renderer", Settings::values.aspect_ratio); ReadSetting("Renderer", Settings::values.max_anisotropy); ReadSetting("Renderer", Settings::values.use_frame_limit); diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index fe7cd8384..b7115b06a 100755 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h @@ -232,6 +232,10 @@ disable_shader_loop_safety_checks = # Which Vulkan physical device to use (defaults to 0) vulkan_device = +# Whether to use fullscreen or borderless window mode +# 0 (Windows default): Borderless window, 1 (All other default): Exclusive fullscreen +fullscreen_mode = + # Aspect ratio # 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Stretch to Window aspect_ratio = diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index 8dfc09393..353e51ea7 100755 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp @@ -6,6 +6,7 @@ #include "common/logging/log.h" #include "common/scm_rev.h" +#include "common/settings.h" #include "core/core.h" #include "core/perf_stats.h" #include "input_common/keyboard.h" @@ -122,24 +123,37 @@ void EmuWindow_SDL2::OnResize() { } void EmuWindow_SDL2::Fullscreen() { - // Try a different fullscreening method - LOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); - if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { - return; + switch (Settings::values.fullscreen_mode.GetValue()) { + case 1: // Exclusive fullscreen + // Set window size to render size before entering fullscreen -- SDL does not resize to + // display dimensions in this mode. + // TODO: Multiply the window size by resolution_factor (for both docked modes) + if (Settings::values.use_docked_mode) { + SDL_SetWindowSize(render_window, Layout::ScreenDocked::Width, + Layout::ScreenDocked::Height); + } + + if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) { + return; + } + + LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); + LOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); + [[fallthrough]]; + case 0: // Borderless window + if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { + return; + } + + LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError()); + [[fallthrough]]; + default: + // Fallback algorithm: Maximise window. + // Works on all systems (unless something is seriously wrong), so no fallback for this one. + LOG_INFO(Frontend, "Falling back on a maximised window..."); + SDL_MaximizeWindow(render_window); + break; } - - LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError()); - - if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) { - return; - } - - LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); - - // Fallback algorithm: Maximise window. - // Works on all systems (unless something is seriously wrong), so no fallback for this one. - LOG_INFO(Frontend, "Falling back on a maximised window..."); - SDL_MaximizeWindow(render_window); } void EmuWindow_SDL2::WaitEvent() {