diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/settings.h | 11 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 5 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.h | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.cpp | 14 | ||||
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.h | 15 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 4 |
8 files changed, 38 insertions, 28 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index ce1bc647d..fd2a263ec 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -36,6 +36,11 @@ enum class CPUAccuracy : u32 { | |||
| 36 | Unsafe = 2, | 36 | Unsafe = 2, |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | enum class FullscreenMode : u32 { | ||
| 40 | Borderless = 0, | ||
| 41 | Exclusive = 1, | ||
| 42 | }; | ||
| 43 | |||
| 39 | /** The BasicSetting class is a simple resource manager. It defines a label and default value | 44 | /** The BasicSetting class is a simple resource manager. It defines a label and default value |
| 40 | * alongside the actual value of the setting for simpler and less-error prone use with frontend | 45 | * alongside the actual value of the setting for simpler and less-error prone use with frontend |
| 41 | * configurations. Setting a default value and label is required, though subclasses may deviate from | 46 | * configurations. Setting a default value and label is required, though subclasses may deviate from |
| @@ -313,11 +318,11 @@ struct Values { | |||
| 313 | Setting<u16> resolution_factor{1, "resolution_factor"}; | 318 | Setting<u16> resolution_factor{1, "resolution_factor"}; |
| 314 | // *nix platforms may have issues with the borderless windowed fullscreen mode. | 319 | // *nix platforms may have issues with the borderless windowed fullscreen mode. |
| 315 | // Default to exclusive fullscreen on these platforms for now. | 320 | // Default to exclusive fullscreen on these platforms for now. |
| 316 | Setting<int> fullscreen_mode{ | 321 | Setting<FullscreenMode> fullscreen_mode{ |
| 317 | #ifdef _WIN32 | 322 | #ifdef _WIN32 |
| 318 | 0, | 323 | FullscreenMode::Borderless, |
| 319 | #else | 324 | #else |
| 320 | 1, | 325 | FullscreenMode::Exclusive, |
| 321 | #endif | 326 | #endif |
| 322 | "fullscreen_mode"}; | 327 | "fullscreen_mode"}; |
| 323 | Setting<int> aspect_ratio{0, "aspect_ratio"}; | 328 | Setting<int> aspect_ratio{0, "aspect_ratio"}; |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index a5e032959..9fe5613b6 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -1329,7 +1329,10 @@ void Config::SaveRendererValues() { | |||
| 1329 | static_cast<u32>(Settings::values.renderer_backend.GetDefault()), | 1329 | static_cast<u32>(Settings::values.renderer_backend.GetDefault()), |
| 1330 | Settings::values.renderer_backend.UsingGlobal()); | 1330 | Settings::values.renderer_backend.UsingGlobal()); |
| 1331 | WriteGlobalSetting(Settings::values.vulkan_device); | 1331 | WriteGlobalSetting(Settings::values.vulkan_device); |
| 1332 | WriteGlobalSetting(Settings::values.fullscreen_mode); | 1332 | WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()), |
| 1333 | static_cast<u32>(Settings::values.fullscreen_mode.GetValue(global)), | ||
| 1334 | static_cast<u32>(Settings::values.fullscreen_mode.GetDefault()), | ||
| 1335 | Settings::values.fullscreen_mode.UsingGlobal()); | ||
| 1333 | WriteGlobalSetting(Settings::values.aspect_ratio); | 1336 | WriteGlobalSetting(Settings::values.aspect_ratio); |
| 1334 | WriteGlobalSetting(Settings::values.max_anisotropy); | 1337 | WriteGlobalSetting(Settings::values.max_anisotropy); |
| 1335 | WriteGlobalSetting(Settings::values.use_frame_limit); | 1338 | WriteGlobalSetting(Settings::values.use_frame_limit); |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 96f9b6de1..24950e8f8 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -182,3 +182,4 @@ private: | |||
| 182 | Q_DECLARE_METATYPE(Settings::CPUAccuracy); | 182 | Q_DECLARE_METATYPE(Settings::CPUAccuracy); |
| 183 | Q_DECLARE_METATYPE(Settings::RendererBackend); | 183 | Q_DECLARE_METATYPE(Settings::RendererBackend); |
| 184 | Q_DECLARE_METATYPE(Settings::GPUAccuracy); | 184 | Q_DECLARE_METATYPE(Settings::GPUAccuracy); |
| 185 | Q_DECLARE_METATYPE(Settings::FullscreenMode); | ||
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 096e42e94..251aab912 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp | |||
| @@ -25,20 +25,6 @@ void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<bool>* setting, | |||
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<int>* setting, | ||
| 29 | const QComboBox* combobox) { | ||
| 30 | if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) { | ||
| 31 | setting->SetValue(combobox->currentIndex()); | ||
| 32 | } else if (!Settings::IsConfiguringGlobal()) { | ||
| 33 | if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 34 | setting->SetGlobal(true); | ||
| 35 | } else { | ||
| 36 | setting->SetGlobal(false); | ||
| 37 | setting->SetValue(combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET); | ||
| 38 | } | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox, | 28 | void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox, |
| 43 | const Settings::Setting<bool>* setting) { | 29 | const Settings::Setting<bool>* setting) { |
| 44 | if (setting->UsingGlobal()) { | 30 | if (setting->UsingGlobal()) { |
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 1e0ef01ca..5423dbc92 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h | |||
| @@ -28,7 +28,20 @@ enum class CheckState { | |||
| 28 | // ApplyPerGameSetting, given a Settings::Setting and a Qt UI element, properly applies a Setting | 28 | // ApplyPerGameSetting, given a Settings::Setting and a Qt UI element, properly applies a Setting |
| 29 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, | 29 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, |
| 30 | const CheckState& tracker); | 30 | const CheckState& tracker); |
| 31 | void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox); | 31 | template <typename Type> |
| 32 | void ApplyPerGameSetting(Settings::Setting<Type>* setting, const QComboBox* combobox) { | ||
| 33 | if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) { | ||
| 34 | setting->SetValue(static_cast<Type>(combobox->currentIndex())); | ||
| 35 | } else if (!Settings::IsConfiguringGlobal()) { | ||
| 36 | if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 37 | setting->SetGlobal(true); | ||
| 38 | } else { | ||
| 39 | setting->SetGlobal(false); | ||
| 40 | setting->SetValue(static_cast<Type>(combobox->currentIndex() - | ||
| 41 | ConfigurationShared::USE_GLOBAL_OFFSET)); | ||
| 42 | } | ||
| 43 | } | ||
| 44 | } | ||
| 32 | 45 | ||
| 33 | // Sets a Qt UI element given a Settings::Setting | 46 | // Sets a Qt UI element given a Settings::Setting |
| 34 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); | 47 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); |
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 4d5b4c0e6..6287a3caa 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -79,7 +79,8 @@ void ConfigureGraphics::SetConfiguration() { | |||
| 79 | 79 | ||
| 80 | if (Settings::IsConfiguringGlobal()) { | 80 | if (Settings::IsConfiguringGlobal()) { |
| 81 | ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue())); | 81 | ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue())); |
| 82 | ui->fullscreen_mode_combobox->setCurrentIndex(Settings::values.fullscreen_mode.GetValue()); | 82 | ui->fullscreen_mode_combobox->setCurrentIndex( |
| 83 | static_cast<int>(Settings::values.fullscreen_mode.GetValue())); | ||
| 83 | ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); | 84 | ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); |
| 84 | } else { | 85 | } else { |
| 85 | ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); | 86 | ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); |
| @@ -282,8 +283,9 @@ void ConfigureGraphics::SetupPerGameUI() { | |||
| 282 | 283 | ||
| 283 | ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, | 284 | ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, |
| 284 | Settings::values.aspect_ratio.GetValue(true)); | 285 | Settings::values.aspect_ratio.GetValue(true)); |
| 285 | ConfigurationShared::SetColoredComboBox(ui->fullscreen_mode_combobox, ui->fullscreen_mode_label, | 286 | ConfigurationShared::SetColoredComboBox( |
| 286 | Settings::values.fullscreen_mode.GetValue(true)); | 287 | ui->fullscreen_mode_combobox, ui->fullscreen_mode_label, |
| 288 | static_cast<int>(Settings::values.fullscreen_mode.GetValue(true))); | ||
| 287 | ConfigurationShared::InsertGlobalItem( | 289 | ConfigurationShared::InsertGlobalItem( |
| 288 | ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true))); | 290 | ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true))); |
| 289 | } | 291 | } |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 03a909d17..96a301dda 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2515,7 +2515,7 @@ void GMainWindow::ShowFullscreen() { | |||
| 2515 | ui.menubar->hide(); | 2515 | ui.menubar->hide(); |
| 2516 | statusBar()->hide(); | 2516 | statusBar()->hide(); |
| 2517 | 2517 | ||
| 2518 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2518 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2519 | showFullScreen(); | 2519 | showFullScreen(); |
| 2520 | return; | 2520 | return; |
| 2521 | } | 2521 | } |
| @@ -2530,7 +2530,7 @@ void GMainWindow::ShowFullscreen() { | |||
| 2530 | } else { | 2530 | } else { |
| 2531 | UISettings::values.renderwindow_geometry = render_window->saveGeometry(); | 2531 | UISettings::values.renderwindow_geometry = render_window->saveGeometry(); |
| 2532 | 2532 | ||
| 2533 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2533 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2534 | render_window->showFullScreen(); | 2534 | render_window->showFullScreen(); |
| 2535 | return; | 2535 | return; |
| 2536 | } | 2536 | } |
| @@ -2547,7 +2547,7 @@ void GMainWindow::ShowFullscreen() { | |||
| 2547 | 2547 | ||
| 2548 | void GMainWindow::HideFullscreen() { | 2548 | void GMainWindow::HideFullscreen() { |
| 2549 | if (ui.action_Single_Window_Mode->isChecked()) { | 2549 | if (ui.action_Single_Window_Mode->isChecked()) { |
| 2550 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2550 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2551 | showNormal(); | 2551 | showNormal(); |
| 2552 | restoreGeometry(UISettings::values.geometry); | 2552 | restoreGeometry(UISettings::values.geometry); |
| 2553 | } else { | 2553 | } else { |
| @@ -2561,7 +2561,7 @@ void GMainWindow::HideFullscreen() { | |||
| 2561 | statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); | 2561 | statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); |
| 2562 | ui.menubar->show(); | 2562 | ui.menubar->show(); |
| 2563 | } else { | 2563 | } else { |
| 2564 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2564 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2565 | render_window->showNormal(); | 2565 | render_window->showNormal(); |
| 2566 | render_window->restoreGeometry(UISettings::values.renderwindow_geometry); | 2566 | render_window->restoreGeometry(UISettings::values.renderwindow_geometry); |
| 2567 | } else { | 2567 | } else { |
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index 353e51ea7..ea3e0ada4 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | |||
| @@ -124,7 +124,7 @@ void EmuWindow_SDL2::OnResize() { | |||
| 124 | 124 | ||
| 125 | void EmuWindow_SDL2::Fullscreen() { | 125 | void EmuWindow_SDL2::Fullscreen() { |
| 126 | switch (Settings::values.fullscreen_mode.GetValue()) { | 126 | switch (Settings::values.fullscreen_mode.GetValue()) { |
| 127 | case 1: // Exclusive fullscreen | 127 | case Settings::FullscreenMode::Exclusive: |
| 128 | // Set window size to render size before entering fullscreen -- SDL does not resize to | 128 | // Set window size to render size before entering fullscreen -- SDL does not resize to |
| 129 | // display dimensions in this mode. | 129 | // display dimensions in this mode. |
| 130 | // TODO: Multiply the window size by resolution_factor (for both docked modes) | 130 | // TODO: Multiply the window size by resolution_factor (for both docked modes) |
| @@ -140,7 +140,7 @@ void EmuWindow_SDL2::Fullscreen() { | |||
| 140 | LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); | 140 | LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); |
| 141 | LOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); | 141 | LOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); |
| 142 | [[fallthrough]]; | 142 | [[fallthrough]]; |
| 143 | case 0: // Borderless window | 143 | case Settings::FullscreenMode::Borderless: |
| 144 | if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { | 144 | if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { |
| 145 | return; | 145 | return; |
| 146 | } | 146 | } |