forked from ShuriZma/suyu
1
0
Fork 0

Merge pull request #6693 from lat9nq/cmd-fullscreen-mode-2

yuzu_cmd: Make use of fullscreen_mode setting
This commit is contained in:
Morph 2021-07-22 00:55:01 -04:00 committed by GitHub
commit 233bf018d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 17 deletions

View File

@ -446,6 +446,7 @@ void Config::ReadValues() {
ReadSetting("Renderer", Settings::values.renderer_debug); ReadSetting("Renderer", Settings::values.renderer_debug);
ReadSetting("Renderer", Settings::values.vulkan_device); ReadSetting("Renderer", Settings::values.vulkan_device);
ReadSetting("Renderer", Settings::values.fullscreen_mode);
ReadSetting("Renderer", Settings::values.aspect_ratio); ReadSetting("Renderer", Settings::values.aspect_ratio);
ReadSetting("Renderer", Settings::values.max_anisotropy); ReadSetting("Renderer", Settings::values.max_anisotropy);
ReadSetting("Renderer", Settings::values.use_frame_limit); ReadSetting("Renderer", Settings::values.use_frame_limit);

View File

@ -224,6 +224,10 @@ debug =
# Which Vulkan physical device to use (defaults to 0) # Which Vulkan physical device to use (defaults to 0)
vulkan_device = 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 # Aspect ratio
# 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Stretch to Window # 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Stretch to Window
aspect_ratio = aspect_ratio =

View File

@ -6,6 +6,7 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/scm_rev.h" #include "common/scm_rev.h"
#include "common/settings.h"
#include "core/core.h" #include "core/core.h"
#include "core/perf_stats.h" #include "core/perf_stats.h"
#include "input_common/keyboard.h" #include "input_common/keyboard.h"
@ -122,24 +123,37 @@ void EmuWindow_SDL2::OnResize() {
} }
void EmuWindow_SDL2::Fullscreen() { void EmuWindow_SDL2::Fullscreen() {
// Try a different fullscreening method switch (Settings::values.fullscreen_mode.GetValue()) {
LOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); case 1: // Exclusive fullscreen
if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { // Set window size to render size before entering fullscreen -- SDL does not resize to
return; // 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);
} }
LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError());
if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) { if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) {
return; return;
} }
LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); 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. // Fallback algorithm: Maximise window.
// Works on all systems (unless something is seriously wrong), so no fallback for this one. // Works on all systems (unless something is seriously wrong), so no fallback for this one.
LOG_INFO(Frontend, "Falling back on a maximised window..."); LOG_INFO(Frontend, "Falling back on a maximised window...");
SDL_MaximizeWindow(render_window); SDL_MaximizeWindow(render_window);
break;
}
} }
void EmuWindow_SDL2::WaitEvent() { void EmuWindow_SDL2::WaitEvent() {