diff --git a/src/common/emulatorConfig.cpp b/src/common/emulatorConfig.cpp index 128b6f7f4..65c599af7 100644 --- a/src/common/emulatorConfig.cpp +++ b/src/common/emulatorConfig.cpp @@ -33,6 +33,10 @@ uint32_t GetScreenHeight() { return g_config->screen_height; } +bool FullscreenEnabled() { + return g_config->fullscreen_enabled; +} + uint32_t GetVblankFrequency() { return std::clamp(g_config->vblank_frequency, 30u, 360u); } diff --git a/src/common/emulatorConfig.h b/src/common/emulatorConfig.h index 4e7c40b1b..3b7f1d2fc 100644 --- a/src/common/emulatorConfig.h +++ b/src/common/emulatorConfig.h @@ -24,6 +24,7 @@ constexpr uint32_t MAX_CONSOLE_LANGUAGE = 29; struct ConfigOptions { uint32_t screen_width = 1280; uint32_t screen_height = 720; + bool fullscreen_enabled = false; uint32_t vblank_frequency = 60; uint32_t console_language = DEFAULT_CONSOLE_LANGUAGE; bool vulkan_validation_enabled = false; @@ -46,6 +47,7 @@ void Load(const ConfigOptions& cfg); uint32_t GetScreenWidth(); uint32_t GetScreenHeight(); +bool FullscreenEnabled(); uint32_t GetVblankFrequency(); uint32_t GetConsoleLanguage(); bool VulkanValidationEnabled(); diff --git a/src/graphics/presentation/window/window.cpp b/src/graphics/presentation/window/window.cpp index e74c5d9f4..59d0b2d91 100644 --- a/src/graphics/presentation/window/window.cpp +++ b/src/graphics/presentation/window/window.cpp @@ -799,6 +799,9 @@ static void WindowCreate(WindowContext& context) { LOGF("WindowCreate(): width = %d, height = %d\n", width, height); uint32_t window_flags = KYTY_SDL_WINDOW_FLAGS; + if (Config::FullscreenEnabled()) { + window_flags |= static_cast(SDL_WINDOW_FULLSCREEN_DESKTOP); + } #if defined(__APPLE__) // macOS 26 window chrome (CoreUI asset decode, SwiftUI titlebar) has been observed // throwing NSExceptions under Rosetta during the first CATransaction commit. A diff --git a/src/launcher/forms/configuration_edit_dialog.ui b/src/launcher/forms/configuration_edit_dialog.ui index 6fa5d0ca7..e94c74241 100644 --- a/src/launcher/forms/configuration_edit_dialog.ui +++ b/src/launcher/forms/configuration_edit_dialog.ui @@ -78,6 +78,16 @@ + + + + Run in borderless desktop fullscreen + + + Fullscreen + + + diff --git a/src/launcher/include/configuration.h b/src/launcher/include/configuration.h index 5a997bd4c..81033583c 100644 --- a/src/launcher/include/configuration.h +++ b/src/launcher/include/configuration.h @@ -85,6 +85,7 @@ public: QString game_comment; Resolution screen_resolution = Resolution::R1280X720; + bool fullscreen_enabled = false; int vblank_frequency = 60; int console_language = DEFAULT_CONSOLE_LANGUAGE; bool vulkan_validation_enabled = true; @@ -103,6 +104,7 @@ public: void CopyEmulatorSettingsFrom(const Configuration& other) { screen_resolution = other.screen_resolution; + fullscreen_enabled = other.fullscreen_enabled; vblank_frequency = other.vblank_frequency; console_language = other.console_language; vulkan_validation_enabled = other.vulkan_validation_enabled; @@ -138,6 +140,7 @@ public: KYTY_CFG_SET(game_path); KYTY_CFG_SET(custom_settings); KYTY_CFG_SET(screen_resolution); + KYTY_CFG_SET(fullscreen_enabled); KYTY_CFG_SET(vblank_frequency); KYTY_CFG_SET(console_language); KYTY_CFG_SET(vulkan_validation_enabled); @@ -160,6 +163,7 @@ public: KYTY_CFG_GET(game_path); KYTY_CFG_GET(custom_settings); KYTY_CFG_GET(screen_resolution); + KYTY_CFG_GET(fullscreen_enabled); vblank_frequency = s->value("vblank_frequency", vblank_frequency).toInt(); console_language = s->value("console_language", console_language).toInt(); if (console_language < 0 || console_language > MAX_CONSOLE_LANGUAGE) { diff --git a/src/launcher/src/configurationEditDialog.cpp b/src/launcher/src/configurationEditDialog.cpp index 2b28c3c8f..4975b6525 100644 --- a/src/launcher/src/configurationEditDialog.cpp +++ b/src/launcher/src/configurationEditDialog.cpp @@ -153,6 +153,7 @@ static void ListInit(QComboBox* combo, T value) { void ConfigurationEditDialog::Init(const Configuration& info) { ListInit(m_ui->comboBox_screen_resolution, info.screen_resolution); + m_ui->checkBox_fullscreen->setChecked(info.fullscreen_enabled); m_ui->spinBox_vblank_frequency->setValue(info.vblank_frequency); m_ui->comboBox_console_language->clear(); m_ui->comboBox_console_language->addItems(CONSOLE_LANGUAGE_NAMES); @@ -279,6 +280,7 @@ void ConfigurationEditDialog::moveEvent(QMoveEvent* event) { static void UpdateInfo(Configuration& info, Ui::ConfigurationEditDialog& ui) { info.screen_resolution = TextToEnum(ui.comboBox_screen_resolution->currentText()); + info.fullscreen_enabled = ui.checkBox_fullscreen->isChecked(); info.vblank_frequency = ui.spinBox_vblank_frequency->value(); info.console_language = ui.comboBox_console_language->currentIndex(); info.vulkan_validation_enabled = ui.checkBox_vulkan_validation->isChecked(); diff --git a/src/launcher/src/mainDialog.cpp b/src/launcher/src/mainDialog.cpp index 0f236be92..b35302546 100644 --- a/src/launcher/src/mainDialog.cpp +++ b/src/launcher/src/mainDialog.cpp @@ -204,6 +204,9 @@ static QStringList CreateEmulatorArgs(const Configuration& info) { args << "--screen-width" << r.at(0); args << "--screen-height" << r.at(1); + if (info.fullscreen_enabled) { + args << "--fullscreen"; + } args << "--vblank-frequency" << QString::number(info.vblank_frequency); args << "--console-language" << QString::number(info.console_language); args << "--vulkan-validation" << BoolArg(info.vulkan_validation_enabled); diff --git a/src/main.cpp b/src/main.cpp index 157de8f14..21ad8bf02 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -47,6 +47,7 @@ static void PrintUsage() { " --game-patch Validated patch plan to apply before entry.\n"); ::printf(" --screen-width Window width. Default: 1280.\n"); ::printf(" --screen-height Window height. Default: 720.\n"); + ::printf(" --fullscreen Run in borderless desktop fullscreen.\n"); ::printf(" --vblank-frequency Virtual vblank frequency. Default: 60.\n"); ::printf(" --console-language <0-29> Console language. Default: 1 (English US).\n"); ::printf(" --vulkan-validation Enable Vulkan validation.\n"); @@ -131,6 +132,11 @@ static bool ParseArgs(int argc, char* argv[], RunOptions& options, bool& show_he continue; } + if (arg == "--fullscreen") { + options.config.fullscreen_enabled = true; + continue; + } + if (!Common::StartsWith(arg, "--")) { ::printf("game input must be provided with --game\n"); return false;