diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/fs/fs_util.cpp | 4 | ||||
| -rw-r--r-- | src/common/fs/fs_util.h | 11 | ||||
| -rw-r--r-- | src/common/settings.h | 11 | ||||
| -rw-r--r-- | src/video_core/texture_cache/render_targets.h | 6 | ||||
| -rw-r--r-- | src/yuzu/applets/qt_web_browser.cpp | 15 | ||||
| -rw-r--r-- | src/yuzu/applets/qt_web_browser.h | 3 | ||||
| -rw-r--r-- | src/yuzu/applets/qt_web_browser_scripts.h | 6 | ||||
| -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_cpu.cpp | 17 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics_advanced.cpp | 20 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 4 |
16 files changed, 81 insertions, 67 deletions
diff --git a/src/common/fs/fs_util.cpp b/src/common/fs/fs_util.cpp index 357cf5855..9f8671982 100644 --- a/src/common/fs/fs_util.cpp +++ b/src/common/fs/fs_util.cpp | |||
| @@ -20,6 +20,10 @@ std::string ToUTF8String(std::u8string_view u8_string) { | |||
| 20 | return std::string{u8_string.begin(), u8_string.end()}; | 20 | return std::string{u8_string.begin(), u8_string.end()}; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | std::string BufferToUTF8String(std::span<const u8> buffer) { | ||
| 24 | return std::string{buffer.begin(), std::ranges::find(buffer, u8{0})}; | ||
| 25 | } | ||
| 26 | |||
| 23 | std::string PathToUTF8String(const std::filesystem::path& path) { | 27 | std::string PathToUTF8String(const std::filesystem::path& path) { |
| 24 | return ToUTF8String(path.u8string()); | 28 | return ToUTF8String(path.u8string()); |
| 25 | } | 29 | } |
diff --git a/src/common/fs/fs_util.h b/src/common/fs/fs_util.h index ec9950ee7..1ec82eb35 100644 --- a/src/common/fs/fs_util.h +++ b/src/common/fs/fs_util.h | |||
| @@ -47,6 +47,17 @@ concept IsChar = std::same_as<T, char>; | |||
| 47 | [[nodiscard]] std::string ToUTF8String(std::u8string_view u8_string); | 47 | [[nodiscard]] std::string ToUTF8String(std::u8string_view u8_string); |
| 48 | 48 | ||
| 49 | /** | 49 | /** |
| 50 | * Converts a buffer of bytes to a UTF8-encoded std::string. | ||
| 51 | * This converts from the start of the buffer until the first encountered null-terminator. | ||
| 52 | * If no null-terminator is found, this converts the entire buffer instead. | ||
| 53 | * | ||
| 54 | * @param buffer Buffer of bytes | ||
| 55 | * | ||
| 56 | * @returns UTF-8 encoded std::string. | ||
| 57 | */ | ||
| 58 | [[nodiscard]] std::string BufferToUTF8String(std::span<const u8> buffer); | ||
| 59 | |||
| 60 | /** | ||
| 50 | * Converts a filesystem path to a UTF-8 encoded std::string. | 61 | * Converts a filesystem path to a UTF-8 encoded std::string. |
| 51 | * | 62 | * |
| 52 | * @param path Filesystem path | 63 | * @param path Filesystem path |
diff --git a/src/common/settings.h b/src/common/settings.h index d8730f515..cfc1ab46f 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -42,6 +42,11 @@ enum class CPUAccuracy : u32 { | |||
| 42 | Unsafe = 2, | 42 | Unsafe = 2, |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | enum class FullscreenMode : u32 { | ||
| 46 | Borderless = 0, | ||
| 47 | Exclusive = 1, | ||
| 48 | }; | ||
| 49 | |||
| 45 | /** The BasicSetting class is a simple resource manager. It defines a label and default value | 50 | /** The BasicSetting class is a simple resource manager. It defines a label and default value |
| 46 | * alongside the actual value of the setting for simpler and less-error prone use with frontend | 51 | * alongside the actual value of the setting for simpler and less-error prone use with frontend |
| 47 | * configurations. Setting a default value and label is required, though subclasses may deviate from | 52 | * configurations. Setting a default value and label is required, though subclasses may deviate from |
| @@ -322,11 +327,11 @@ struct Values { | |||
| 322 | Setting<u16> resolution_factor{1, "resolution_factor"}; | 327 | Setting<u16> resolution_factor{1, "resolution_factor"}; |
| 323 | // *nix platforms may have issues with the borderless windowed fullscreen mode. | 328 | // *nix platforms may have issues with the borderless windowed fullscreen mode. |
| 324 | // Default to exclusive fullscreen on these platforms for now. | 329 | // Default to exclusive fullscreen on these platforms for now. |
| 325 | Setting<int> fullscreen_mode{ | 330 | Setting<FullscreenMode> fullscreen_mode{ |
| 326 | #ifdef _WIN32 | 331 | #ifdef _WIN32 |
| 327 | 0, | 332 | FullscreenMode::Borderless, |
| 328 | #else | 333 | #else |
| 329 | 1, | 334 | FullscreenMode::Exclusive, |
| 330 | #endif | 335 | #endif |
| 331 | "fullscreen_mode"}; | 336 | "fullscreen_mode"}; |
| 332 | Setting<int> aspect_ratio{0, "aspect_ratio"}; | 337 | Setting<int> aspect_ratio{0, "aspect_ratio"}; |
diff --git a/src/video_core/texture_cache/render_targets.h b/src/video_core/texture_cache/render_targets.h index 9b9544b07..0cb227d69 100644 --- a/src/video_core/texture_cache/render_targets.h +++ b/src/video_core/texture_cache/render_targets.h | |||
| @@ -24,10 +24,10 @@ struct RenderTargets { | |||
| 24 | return std::ranges::any_of(color_buffer_ids, contains) || contains(depth_buffer_id); | 24 | return std::ranges::any_of(color_buffer_ids, contains) || contains(depth_buffer_id); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | std::array<ImageViewId, NUM_RT> color_buffer_ids; | 27 | std::array<ImageViewId, NUM_RT> color_buffer_ids{}; |
| 28 | ImageViewId depth_buffer_id; | 28 | ImageViewId depth_buffer_id{}; |
| 29 | std::array<u8, NUM_RT> draw_buffers{}; | 29 | std::array<u8, NUM_RT> draw_buffers{}; |
| 30 | Extent2D size; | 30 | Extent2D size{}; |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | } // namespace VideoCommon | 33 | } // namespace VideoCommon |
diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp index b112dd7b0..652d99570 100644 --- a/src/yuzu/applets/qt_web_browser.cpp +++ b/src/yuzu/applets/qt_web_browser.cpp | |||
| @@ -107,6 +107,7 @@ void QtNXWebEngineView::LoadLocalWebPage(const std::string& main_url, | |||
| 107 | is_local = true; | 107 | is_local = true; |
| 108 | 108 | ||
| 109 | LoadExtractedFonts(); | 109 | LoadExtractedFonts(); |
| 110 | FocusFirstLinkElement(); | ||
| 110 | SetUserAgent(UserAgent::WebApplet); | 111 | SetUserAgent(UserAgent::WebApplet); |
| 111 | SetFinished(false); | 112 | SetFinished(false); |
| 112 | SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); | 113 | SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); |
| @@ -121,6 +122,7 @@ void QtNXWebEngineView::LoadExternalWebPage(const std::string& main_url, | |||
| 121 | const std::string& additional_args) { | 122 | const std::string& additional_args) { |
| 122 | is_local = false; | 123 | is_local = false; |
| 123 | 124 | ||
| 125 | FocusFirstLinkElement(); | ||
| 124 | SetUserAgent(UserAgent::WebApplet); | 126 | SetUserAgent(UserAgent::WebApplet); |
| 125 | SetFinished(false); | 127 | SetFinished(false); |
| 126 | SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); | 128 | SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); |
| @@ -208,7 +210,7 @@ void QtNXWebEngineView::HandleWindowFooterButtonPressedOnce() { | |||
| 208 | if (input_interpreter->IsButtonPressedOnce(button)) { | 210 | if (input_interpreter->IsButtonPressedOnce(button)) { |
| 209 | page()->runJavaScript( | 211 | page()->runJavaScript( |
| 210 | QStringLiteral("yuzu_key_callbacks[%1] == null;").arg(static_cast<u8>(button)), | 212 | QStringLiteral("yuzu_key_callbacks[%1] == null;").arg(static_cast<u8>(button)), |
| 211 | [&](const QVariant& variant) { | 213 | [this, button](const QVariant& variant) { |
| 212 | if (variant.toBool()) { | 214 | if (variant.toBool()) { |
| 213 | switch (button) { | 215 | switch (button) { |
| 214 | case HIDButton::A: | 216 | case HIDButton::A: |
| @@ -364,6 +366,17 @@ void QtNXWebEngineView::LoadExtractedFonts() { | |||
| 364 | Qt::QueuedConnection); | 366 | Qt::QueuedConnection); |
| 365 | } | 367 | } |
| 366 | 368 | ||
| 369 | void QtNXWebEngineView::FocusFirstLinkElement() { | ||
| 370 | QWebEngineScript focus_link_element; | ||
| 371 | |||
| 372 | focus_link_element.setName(QStringLiteral("focus_link_element.js")); | ||
| 373 | focus_link_element.setSourceCode(QString::fromStdString(FOCUS_LINK_ELEMENT_SCRIPT)); | ||
| 374 | focus_link_element.setWorldId(QWebEngineScript::MainWorld); | ||
| 375 | focus_link_element.setInjectionPoint(QWebEngineScript::Deferred); | ||
| 376 | focus_link_element.setRunsOnSubFrames(true); | ||
| 377 | default_profile->scripts()->insert(focus_link_element); | ||
| 378 | } | ||
| 379 | |||
| 367 | #endif | 380 | #endif |
| 368 | 381 | ||
| 369 | QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { | 382 | QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { |
diff --git a/src/yuzu/applets/qt_web_browser.h b/src/yuzu/applets/qt_web_browser.h index 7ad07409f..7e9f703fc 100644 --- a/src/yuzu/applets/qt_web_browser.h +++ b/src/yuzu/applets/qt_web_browser.h | |||
| @@ -161,6 +161,9 @@ private: | |||
| 161 | /// Loads the extracted fonts using JavaScript. | 161 | /// Loads the extracted fonts using JavaScript. |
| 162 | void LoadExtractedFonts(); | 162 | void LoadExtractedFonts(); |
| 163 | 163 | ||
| 164 | /// Brings focus to the first available link element. | ||
| 165 | void FocusFirstLinkElement(); | ||
| 166 | |||
| 164 | InputCommon::InputSubsystem* input_subsystem; | 167 | InputCommon::InputSubsystem* input_subsystem; |
| 165 | 168 | ||
| 166 | std::unique_ptr<UrlRequestInterceptor> url_interceptor; | 169 | std::unique_ptr<UrlRequestInterceptor> url_interceptor; |
diff --git a/src/yuzu/applets/qt_web_browser_scripts.h b/src/yuzu/applets/qt_web_browser_scripts.h index 992837a85..c4ba8d40f 100644 --- a/src/yuzu/applets/qt_web_browser_scripts.h +++ b/src/yuzu/applets/qt_web_browser_scripts.h | |||
| @@ -73,6 +73,12 @@ constexpr char LOAD_NX_FONT[] = R"( | |||
| 73 | })(); | 73 | })(); |
| 74 | )"; | 74 | )"; |
| 75 | 75 | ||
| 76 | constexpr char FOCUS_LINK_ELEMENT_SCRIPT[] = R"( | ||
| 77 | if (document.getElementsByTagName("a").length > 0) { | ||
| 78 | document.getElementsByTagName("a")[0].focus(); | ||
| 79 | } | ||
| 80 | )"; | ||
| 81 | |||
| 76 | constexpr char GAMEPAD_SCRIPT[] = R"( | 82 | constexpr char GAMEPAD_SCRIPT[] = R"( |
| 77 | window.addEventListener("gamepadconnected", function(e) { | 83 | window.addEventListener("gamepadconnected", function(e) { |
| 78 | console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.", | 84 | console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.", |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 72027e773..ecd5dfac1 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -1332,7 +1332,10 @@ void Config::SaveRendererValues() { | |||
| 1332 | static_cast<u32>(Settings::values.renderer_backend.GetDefault()), | 1332 | static_cast<u32>(Settings::values.renderer_backend.GetDefault()), |
| 1333 | Settings::values.renderer_backend.UsingGlobal()); | 1333 | Settings::values.renderer_backend.UsingGlobal()); |
| 1334 | WriteGlobalSetting(Settings::values.vulkan_device); | 1334 | WriteGlobalSetting(Settings::values.vulkan_device); |
| 1335 | WriteGlobalSetting(Settings::values.fullscreen_mode); | 1335 | WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()), |
| 1336 | static_cast<u32>(Settings::values.fullscreen_mode.GetValue(global)), | ||
| 1337 | static_cast<u32>(Settings::values.fullscreen_mode.GetDefault()), | ||
| 1338 | Settings::values.fullscreen_mode.UsingGlobal()); | ||
| 1336 | WriteGlobalSetting(Settings::values.aspect_ratio); | 1339 | WriteGlobalSetting(Settings::values.aspect_ratio); |
| 1337 | WriteGlobalSetting(Settings::values.max_anisotropy); | 1340 | WriteGlobalSetting(Settings::values.max_anisotropy); |
| 1338 | WriteGlobalSetting(Settings::values.use_speed_limit); | 1341 | WriteGlobalSetting(Settings::values.use_speed_limit); |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 4bbb9f1cd..c1d7feb9f 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -181,5 +181,6 @@ private: | |||
| 181 | // These metatype declarations cannot be in common/settings.h because core is devoid of QT | 181 | // These metatype declarations cannot be in common/settings.h because core is devoid of QT |
| 182 | Q_DECLARE_METATYPE(Settings::CPUAccuracy); | 182 | Q_DECLARE_METATYPE(Settings::CPUAccuracy); |
| 183 | Q_DECLARE_METATYPE(Settings::GPUAccuracy); | 183 | Q_DECLARE_METATYPE(Settings::GPUAccuracy); |
| 184 | Q_DECLARE_METATYPE(Settings::FullscreenMode); | ||
| 184 | Q_DECLARE_METATYPE(Settings::RendererBackend); | 185 | Q_DECLARE_METATYPE(Settings::RendererBackend); |
| 185 | Q_DECLARE_METATYPE(Settings::ShaderBackend); | 186 | Q_DECLARE_METATYPE(Settings::ShaderBackend); |
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_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp index 8d7171487..784b6484e 100644 --- a/src/yuzu/configuration/configure_cpu.cpp +++ b/src/yuzu/configuration/configure_cpu.cpp | |||
| @@ -65,6 +65,7 @@ void ConfigureCpu::UpdateGroup(int index) { | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | void ConfigureCpu::ApplyConfiguration() { | 67 | void ConfigureCpu::ApplyConfiguration() { |
| 68 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpu_accuracy, ui->accuracy); | ||
| 68 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_unfuse_fma, | 69 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_unfuse_fma, |
| 69 | ui->cpuopt_unsafe_unfuse_fma, | 70 | ui->cpuopt_unsafe_unfuse_fma, |
| 70 | cpuopt_unsafe_unfuse_fma); | 71 | cpuopt_unsafe_unfuse_fma); |
| @@ -80,22 +81,6 @@ void ConfigureCpu::ApplyConfiguration() { | |||
| 80 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_fastmem_check, | 81 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_fastmem_check, |
| 81 | ui->cpuopt_unsafe_fastmem_check, | 82 | ui->cpuopt_unsafe_fastmem_check, |
| 82 | cpuopt_unsafe_fastmem_check); | 83 | cpuopt_unsafe_fastmem_check); |
| 83 | |||
| 84 | if (Settings::IsConfiguringGlobal()) { | ||
| 85 | // Guard if during game and set to game-specific value | ||
| 86 | if (Settings::values.cpu_accuracy.UsingGlobal()) { | ||
| 87 | Settings::values.cpu_accuracy.SetValue( | ||
| 88 | static_cast<Settings::CPUAccuracy>(ui->accuracy->currentIndex())); | ||
| 89 | } | ||
| 90 | } else { | ||
| 91 | if (ui->accuracy->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 92 | Settings::values.cpu_accuracy.SetGlobal(true); | ||
| 93 | } else { | ||
| 94 | Settings::values.cpu_accuracy.SetGlobal(false); | ||
| 95 | Settings::values.cpu_accuracy.SetValue(static_cast<Settings::CPUAccuracy>( | ||
| 96 | ui->accuracy->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET)); | ||
| 97 | } | ||
| 98 | } | ||
| 99 | } | 84 | } |
| 100 | 85 | ||
| 101 | void ConfigureCpu::changeEvent(QEvent* event) { | 86 | void ConfigureCpu::changeEvent(QEvent* event) { |
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 1bc477c96..37e896258 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -98,7 +98,8 @@ void ConfigureGraphics::SetConfiguration() { | |||
| 98 | 98 | ||
| 99 | if (Settings::IsConfiguringGlobal()) { | 99 | if (Settings::IsConfiguringGlobal()) { |
| 100 | ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue())); | 100 | ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue())); |
| 101 | ui->fullscreen_mode_combobox->setCurrentIndex(Settings::values.fullscreen_mode.GetValue()); | 101 | ui->fullscreen_mode_combobox->setCurrentIndex( |
| 102 | static_cast<int>(Settings::values.fullscreen_mode.GetValue())); | ||
| 102 | ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); | 103 | ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); |
| 103 | } else { | 104 | } else { |
| 104 | ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); | 105 | ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); |
| @@ -310,8 +311,9 @@ void ConfigureGraphics::SetupPerGameUI() { | |||
| 310 | 311 | ||
| 311 | ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, | 312 | ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, |
| 312 | Settings::values.aspect_ratio.GetValue(true)); | 313 | Settings::values.aspect_ratio.GetValue(true)); |
| 313 | ConfigurationShared::SetColoredComboBox(ui->fullscreen_mode_combobox, ui->fullscreen_mode_label, | 314 | ConfigurationShared::SetColoredComboBox( |
| 314 | Settings::values.fullscreen_mode.GetValue(true)); | 315 | ui->fullscreen_mode_combobox, ui->fullscreen_mode_label, |
| 316 | static_cast<int>(Settings::values.fullscreen_mode.GetValue(true))); | ||
| 315 | ConfigurationShared::InsertGlobalItem( | 317 | ConfigurationShared::InsertGlobalItem( |
| 316 | ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true))); | 318 | ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true))); |
| 317 | } | 319 | } |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 38276feb1..a31b8e192 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp | |||
| @@ -48,11 +48,7 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { | |||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | void ConfigureGraphicsAdvanced::ApplyConfiguration() { | 50 | void ConfigureGraphicsAdvanced::ApplyConfiguration() { |
| 51 | // Subtract 2 if configuring per-game (separator and "use global configuration" take 2 slots) | 51 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.gpu_accuracy, ui->gpu_accuracy); |
| 52 | const auto gpu_accuracy = static_cast<Settings::GPUAccuracy>( | ||
| 53 | ui->gpu_accuracy->currentIndex() - | ||
| 54 | ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); | ||
| 55 | |||
| 56 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, | 52 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, |
| 57 | ui->anisotropic_filtering_combobox); | 53 | ui->anisotropic_filtering_combobox); |
| 58 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync); | 54 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync); |
| @@ -63,20 +59,6 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { | |||
| 63 | use_caches_gc); | 59 | use_caches_gc); |
| 64 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, | 60 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, |
| 65 | ui->use_fast_gpu_time, use_fast_gpu_time); | 61 | ui->use_fast_gpu_time, use_fast_gpu_time); |
| 66 | |||
| 67 | if (Settings::IsConfiguringGlobal()) { | ||
| 68 | // Must guard in case of a during-game configuration when set to be game-specific. | ||
| 69 | if (Settings::values.gpu_accuracy.UsingGlobal()) { | ||
| 70 | Settings::values.gpu_accuracy.SetValue(gpu_accuracy); | ||
| 71 | } | ||
| 72 | } else { | ||
| 73 | if (ui->gpu_accuracy->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 74 | Settings::values.gpu_accuracy.SetGlobal(true); | ||
| 75 | } else { | ||
| 76 | Settings::values.gpu_accuracy.SetGlobal(false); | ||
| 77 | Settings::values.gpu_accuracy.SetValue(gpu_accuracy); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | } | 62 | } |
| 81 | 63 | ||
| 82 | void ConfigureGraphicsAdvanced::changeEvent(QEvent* event) { | 64 | void ConfigureGraphicsAdvanced::changeEvent(QEvent* event) { |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index e172d2ff4..9544f0fb0 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2513,7 +2513,7 @@ void GMainWindow::ShowFullscreen() { | |||
| 2513 | ui.menubar->hide(); | 2513 | ui.menubar->hide(); |
| 2514 | statusBar()->hide(); | 2514 | statusBar()->hide(); |
| 2515 | 2515 | ||
| 2516 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2516 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2517 | showFullScreen(); | 2517 | showFullScreen(); |
| 2518 | return; | 2518 | return; |
| 2519 | } | 2519 | } |
| @@ -2528,7 +2528,7 @@ void GMainWindow::ShowFullscreen() { | |||
| 2528 | } else { | 2528 | } else { |
| 2529 | UISettings::values.renderwindow_geometry = render_window->saveGeometry(); | 2529 | UISettings::values.renderwindow_geometry = render_window->saveGeometry(); |
| 2530 | 2530 | ||
| 2531 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2531 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2532 | render_window->showFullScreen(); | 2532 | render_window->showFullScreen(); |
| 2533 | return; | 2533 | return; |
| 2534 | } | 2534 | } |
| @@ -2545,7 +2545,7 @@ void GMainWindow::ShowFullscreen() { | |||
| 2545 | 2545 | ||
| 2546 | void GMainWindow::HideFullscreen() { | 2546 | void GMainWindow::HideFullscreen() { |
| 2547 | if (ui.action_Single_Window_Mode->isChecked()) { | 2547 | if (ui.action_Single_Window_Mode->isChecked()) { |
| 2548 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2548 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2549 | showNormal(); | 2549 | showNormal(); |
| 2550 | restoreGeometry(UISettings::values.geometry); | 2550 | restoreGeometry(UISettings::values.geometry); |
| 2551 | } else { | 2551 | } else { |
| @@ -2559,7 +2559,7 @@ void GMainWindow::HideFullscreen() { | |||
| 2559 | statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); | 2559 | statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); |
| 2560 | ui.menubar->show(); | 2560 | ui.menubar->show(); |
| 2561 | } else { | 2561 | } else { |
| 2562 | if (Settings::values.fullscreen_mode.GetValue() == 1) { | 2562 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { |
| 2563 | render_window->showNormal(); | 2563 | render_window->showNormal(); |
| 2564 | render_window->restoreGeometry(UISettings::values.renderwindow_geometry); | 2564 | render_window->restoreGeometry(UISettings::values.renderwindow_geometry); |
| 2565 | } else { | 2565 | } 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 | } |