From 1563dffd46f199cd24479f401bfe29cdf8782fb3 Mon Sep 17 00:00:00 2001 From: Xphalnos <164882787+Xphalnos@users.noreply.github.com> Date: Sun, 9 Jun 2024 12:25:00 +0200 Subject: [PATCH] Added Fullscreen mode (#173) * Added Fullscreen mode * fix for config.toml * fix for config.toml * Apply review comment --- src/common/config.cpp | 8 ++++++++ src/common/config.h | 1 + src/sdl_window.cpp | 6 +++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/common/config.cpp b/src/common/config.cpp index 0d117c21..ca271316 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -10,6 +10,7 @@ namespace Config { static bool isNeo = false; +static bool isFullscreen = true; static u32 screenWidth = 1280; static u32 screenHeight = 720; static s32 gpuId = -1; // Vulkan physical device index. Set to negative for auto select @@ -27,10 +28,15 @@ static bool vkValidationSync = false; bool isLleLibc() { return isLibc; } + bool isNeoMode() { return isNeo; } +bool isFullscreenMode() { + return isFullscreen; +} + u32 getScreenWidth() { return screenWidth; } @@ -102,6 +108,7 @@ void load(const std::filesystem::path& path) { auto general = generalResult.unwrap(); isNeo = toml::find_or(general, "isPS4Pro", false); + isFullscreen = toml::find_or(general, "Fullscreen", true); logFilter = toml::find_or(general, "logFilter", ""); logType = toml::find_or(general, "logType", "sync"); isShowSplash = toml::find_or(general, "showSplash", true); @@ -166,6 +173,7 @@ void save(const std::filesystem::path& path) { } data["General"]["isPS4Pro"] = isNeo; + data["General"]["Fullscreen"] = isFullscreen; data["General"]["logFilter"] = logFilter; data["General"]["logType"] = logType; data["General"]["showSplash"] = isShowSplash; diff --git a/src/common/config.h b/src/common/config.h index 8da3c6de..7af028dc 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -11,6 +11,7 @@ void load(const std::filesystem::path& path); void save(const std::filesystem::path& path); bool isNeoMode(); +bool isFullscreenMode(); std::string getLogFilter(); std::string getLogType(); diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 6e765b7f..51369c79 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -4,6 +4,7 @@ #include #include "common/assert.h" +#include "common/config.h" #include "common/version.h" #include "core/libraries/pad/pad.h" #include "input/controller.h" @@ -17,7 +18,7 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_ UNREACHABLE_MSG("Failed to initialize SDL video subsystem: {}", SDL_GetError()); } - const std::string title = "shadps4 v" + std::string(Common::VERSION); + const std::string title = "shadPS4 v" + std::string(Common::VERSION); SDL_PropertiesID props = SDL_CreateProperties(); SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, title.c_str()); SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, SDL_WINDOWPOS_CENTERED); @@ -31,8 +32,7 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_ UNREACHABLE_MSG("Failed to create window handle: {}", SDL_GetError()); } - // We don't support resizable at the moment. - SDL_SetWindowResizable(window, SDL_FALSE); + SDL_SetWindowFullscreen(window, Config::isFullscreenMode()); #if defined(SDL_PLATFORM_WIN32) window_info.type = WindowSystemType::Windows;