summaryrefslogtreecommitdiffstats
path: root/src/yuzu_cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu_cmd')
-rw-r--r--src/yuzu_cmd/config.cpp1
-rw-r--r--src/yuzu_cmd/default_ini.h4
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.cpp44
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp6
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h2
-rw-r--r--src/yuzu_cmd/yuzu.cpp2
6 files changed, 41 insertions, 18 deletions
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index b18056baf..3e22fee37 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -446,6 +446,7 @@ void Config::ReadValues() {
ReadSetting("Renderer", Settings::values.renderer_debug);
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 b362f10b4..88d33ecab 100644
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -224,6 +224,10 @@ debug =
# 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 896181f0b..353e51ea7 100644
--- 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() {
- if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) {
- return;
- }
-
- LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError());
+ 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);
+ }
- // Try a different fullscreening method
- LOG_INFO(Frontend, "Attempting to use borderless fullscreen...");
- if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) {
- return;
- }
+ if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) {
+ return;
+ }
- LOG_ERROR(Frontend, "Borderless 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;
+ }
- // 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);
+ 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;
+ }
}
void EmuWindow_SDL2::WaitEvent() {
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
index 152e56db8..d1473dbab 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
@@ -24,7 +24,7 @@
#include <SDL.h>
#include <SDL_syswm.h>
-EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem)
+EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem, bool fullscreen)
: EmuWindow_SDL2{input_subsystem} {
const std::string window_title = fmt::format("yuzu {} | {}-{} (Vulkan)", Common::g_build_name,
Common::g_scm_branch, Common::g_scm_desc);
@@ -42,6 +42,10 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
SetWindowIcon();
+ if (fullscreen) {
+ Fullscreen();
+ }
+
switch (wm.subsystem) {
#ifdef SDL_VIDEO_DRIVER_WINDOWS
case SDL_SYSWM_TYPE::SDL_SYSWM_WINDOWS:
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h
index bdfdc3c6f..de53844f0 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h
@@ -19,7 +19,7 @@ class InputSubsystem;
class EmuWindow_SDL2_VK final : public EmuWindow_SDL2 {
public:
- explicit EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem);
+ explicit EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem, bool fullscreen);
~EmuWindow_SDL2_VK() override;
std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override;
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 9607cdcb1..ac4ea88d3 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -175,7 +175,7 @@ int main(int argc, char** argv) {
emu_window = std::make_unique<EmuWindow_SDL2_GL>(&input_subsystem, fullscreen);
break;
case Settings::RendererBackend::Vulkan:
- emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem);
+ emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem, fullscreen);
break;
}