diff options
Diffstat (limited to 'src')
20 files changed, 290 insertions, 302 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 702b6598d..e29cbf506 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -42,7 +42,7 @@ void LogSettings() { | |||
| 42 | log_setting("System_RegionIndex", values.region_index.GetValue()); | 42 | log_setting("System_RegionIndex", values.region_index.GetValue()); |
| 43 | log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue()); | 43 | log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue()); |
| 44 | log_setting("Core_UseMultiCore", values.use_multi_core.GetValue()); | 44 | log_setting("Core_UseMultiCore", values.use_multi_core.GetValue()); |
| 45 | log_setting("CPU_Accuracy", values.cpu_accuracy); | 45 | log_setting("CPU_Accuracy", values.cpu_accuracy.GetValue()); |
| 46 | log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue()); | 46 | log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue()); |
| 47 | log_setting("Renderer_UseFrameLimit", values.use_frame_limit.GetValue()); | 47 | log_setting("Renderer_UseFrameLimit", values.use_frame_limit.GetValue()); |
| 48 | log_setting("Renderer_FrameLimit", values.frame_limit.GetValue()); | 48 | log_setting("Renderer_FrameLimit", values.frame_limit.GetValue()); |
| @@ -106,6 +106,12 @@ void RestoreGlobalState(bool is_powered_on) { | |||
| 106 | // Core | 106 | // Core |
| 107 | values.use_multi_core.SetGlobal(true); | 107 | values.use_multi_core.SetGlobal(true); |
| 108 | 108 | ||
| 109 | // CPU | ||
| 110 | values.cpu_accuracy.SetGlobal(true); | ||
| 111 | values.cpuopt_unsafe_unfuse_fma.SetGlobal(true); | ||
| 112 | values.cpuopt_unsafe_reduce_fp_error.SetGlobal(true); | ||
| 113 | values.cpuopt_unsafe_inaccurate_nan.SetGlobal(true); | ||
| 114 | |||
| 109 | // Renderer | 115 | // Renderer |
| 110 | values.renderer_backend.SetGlobal(true); | 116 | values.renderer_backend.SetGlobal(true); |
| 111 | values.vulkan_device.SetGlobal(true); | 117 | values.vulkan_device.SetGlobal(true); |
| @@ -130,7 +136,6 @@ void RestoreGlobalState(bool is_powered_on) { | |||
| 130 | values.region_index.SetGlobal(true); | 136 | values.region_index.SetGlobal(true); |
| 131 | values.time_zone_index.SetGlobal(true); | 137 | values.time_zone_index.SetGlobal(true); |
| 132 | values.rng_seed.SetGlobal(true); | 138 | values.rng_seed.SetGlobal(true); |
| 133 | values.custom_rtc.SetGlobal(true); | ||
| 134 | values.sound_index.SetGlobal(true); | 139 | values.sound_index.SetGlobal(true); |
| 135 | 140 | ||
| 136 | // Controls | 141 | // Controls |
diff --git a/src/common/settings.h b/src/common/settings.h index d39b4aa45..48085b9a9 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -115,7 +115,7 @@ struct Values { | |||
| 115 | Setting<bool> use_multi_core; | 115 | Setting<bool> use_multi_core; |
| 116 | 116 | ||
| 117 | // Cpu | 117 | // Cpu |
| 118 | CPUAccuracy cpu_accuracy; | 118 | Setting<CPUAccuracy> cpu_accuracy; |
| 119 | 119 | ||
| 120 | bool cpuopt_page_tables; | 120 | bool cpuopt_page_tables; |
| 121 | bool cpuopt_block_linking; | 121 | bool cpuopt_block_linking; |
| @@ -126,9 +126,9 @@ struct Values { | |||
| 126 | bool cpuopt_misc_ir; | 126 | bool cpuopt_misc_ir; |
| 127 | bool cpuopt_reduce_misalign_checks; | 127 | bool cpuopt_reduce_misalign_checks; |
| 128 | 128 | ||
| 129 | bool cpuopt_unsafe_unfuse_fma; | 129 | Setting<bool> cpuopt_unsafe_unfuse_fma; |
| 130 | bool cpuopt_unsafe_reduce_fp_error; | 130 | Setting<bool> cpuopt_unsafe_reduce_fp_error; |
| 131 | bool cpuopt_unsafe_inaccurate_nan; | 131 | Setting<bool> cpuopt_unsafe_inaccurate_nan; |
| 132 | 132 | ||
| 133 | // Renderer | 133 | // Renderer |
| 134 | Setting<RendererBackend> renderer_backend; | 134 | Setting<RendererBackend> renderer_backend; |
| @@ -157,7 +157,7 @@ struct Values { | |||
| 157 | // System | 157 | // System |
| 158 | Setting<std::optional<u32>> rng_seed; | 158 | Setting<std::optional<u32>> rng_seed; |
| 159 | // Measured in seconds since epoch | 159 | // Measured in seconds since epoch |
| 160 | Setting<std::optional<std::chrono::seconds>> custom_rtc; | 160 | std::optional<std::chrono::seconds> custom_rtc; |
| 161 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` | 161 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` |
| 162 | std::chrono::seconds custom_rtc_differential; | 162 | std::chrono::seconds custom_rtc_differential; |
| 163 | 163 | ||
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index ab3266916..93d43e22e 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp | |||
| @@ -142,7 +142,7 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable* | |||
| 142 | config.far_code_offset = 256 * 1024 * 1024; | 142 | config.far_code_offset = 256 * 1024 * 1024; |
| 143 | 143 | ||
| 144 | // Safe optimizations | 144 | // Safe optimizations |
| 145 | if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::DebugMode) { | 145 | if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) { |
| 146 | if (!Settings::values.cpuopt_page_tables) { | 146 | if (!Settings::values.cpuopt_page_tables) { |
| 147 | config.page_table = nullptr; | 147 | config.page_table = nullptr; |
| 148 | } | 148 | } |
| @@ -170,15 +170,15 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable* | |||
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | // Unsafe optimizations | 172 | // Unsafe optimizations |
| 173 | if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::Unsafe) { | 173 | if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) { |
| 174 | config.unsafe_optimizations = true; | 174 | config.unsafe_optimizations = true; |
| 175 | if (Settings::values.cpuopt_unsafe_unfuse_fma) { | 175 | if (Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()) { |
| 176 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA; | 176 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA; |
| 177 | } | 177 | } |
| 178 | if (Settings::values.cpuopt_unsafe_reduce_fp_error) { | 178 | if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) { |
| 179 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP; | 179 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP; |
| 180 | } | 180 | } |
| 181 | if (Settings::values.cpuopt_unsafe_inaccurate_nan) { | 181 | if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) { |
| 182 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN; | 182 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN; |
| 183 | } | 183 | } |
| 184 | } | 184 | } |
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index a4d830e48..08fa85904 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp | |||
| @@ -182,7 +182,7 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable* | |||
| 182 | config.far_code_offset = 256 * 1024 * 1024; | 182 | config.far_code_offset = 256 * 1024 * 1024; |
| 183 | 183 | ||
| 184 | // Safe optimizations | 184 | // Safe optimizations |
| 185 | if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::DebugMode) { | 185 | if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) { |
| 186 | if (!Settings::values.cpuopt_page_tables) { | 186 | if (!Settings::values.cpuopt_page_tables) { |
| 187 | config.page_table = nullptr; | 187 | config.page_table = nullptr; |
| 188 | } | 188 | } |
| @@ -210,15 +210,15 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable* | |||
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | // Unsafe optimizations | 212 | // Unsafe optimizations |
| 213 | if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::Unsafe) { | 213 | if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) { |
| 214 | config.unsafe_optimizations = true; | 214 | config.unsafe_optimizations = true; |
| 215 | if (Settings::values.cpuopt_unsafe_unfuse_fma) { | 215 | if (Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()) { |
| 216 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA; | 216 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA; |
| 217 | } | 217 | } |
| 218 | if (Settings::values.cpuopt_unsafe_reduce_fp_error) { | 218 | if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) { |
| 219 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP; | 219 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP; |
| 220 | } | 220 | } |
| 221 | if (Settings::values.cpuopt_unsafe_inaccurate_nan) { | 221 | if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) { |
| 222 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN; | 222 | config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN; |
| 223 | } | 223 | } |
| 224 | } | 224 | } |
diff --git a/src/core/core.cpp b/src/core/core.cpp index 47e70c157..826a00ad6 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -173,7 +173,7 @@ struct System::Impl { | |||
| 173 | const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( | 173 | const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( |
| 174 | std::chrono::system_clock::now().time_since_epoch()); | 174 | std::chrono::system_clock::now().time_since_epoch()); |
| 175 | Settings::values.custom_rtc_differential = | 175 | Settings::values.custom_rtc_differential = |
| 176 | Settings::values.custom_rtc.GetValue().value_or(current_time) - current_time; | 176 | Settings::values.custom_rtc.value_or(current_time) - current_time; |
| 177 | 177 | ||
| 178 | // Create a default fs if one doesn't already exist. | 178 | // Create a default fs if one doesn't already exist. |
| 179 | if (virtual_filesystem == nullptr) | 179 | if (virtual_filesystem == nullptr) |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index e80a3df77..125feb86b 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -736,10 +736,16 @@ void Config::ReadPathValues() { | |||
| 736 | void Config::ReadCpuValues() { | 736 | void Config::ReadCpuValues() { |
| 737 | qt_config->beginGroup(QStringLiteral("Cpu")); | 737 | qt_config->beginGroup(QStringLiteral("Cpu")); |
| 738 | 738 | ||
| 739 | if (global) { | 739 | ReadSettingGlobal(Settings::values.cpu_accuracy, QStringLiteral("cpu_accuracy"), 0); |
| 740 | Settings::values.cpu_accuracy = static_cast<Settings::CPUAccuracy>( | 740 | |
| 741 | ReadSetting(QStringLiteral("cpu_accuracy"), 0).toInt()); | 741 | ReadSettingGlobal(Settings::values.cpuopt_unsafe_unfuse_fma, |
| 742 | QStringLiteral("cpuopt_unsafe_unfuse_fma"), true); | ||
| 743 | ReadSettingGlobal(Settings::values.cpuopt_unsafe_reduce_fp_error, | ||
| 744 | QStringLiteral("cpuopt_unsafe_reduce_fp_error"), true); | ||
| 745 | ReadSettingGlobal(Settings::values.cpuopt_unsafe_inaccurate_nan, | ||
| 746 | QStringLiteral("cpuopt_unsafe_inaccurate_nan"), true); | ||
| 742 | 747 | ||
| 748 | if (global) { | ||
| 743 | Settings::values.cpuopt_page_tables = | 749 | Settings::values.cpuopt_page_tables = |
| 744 | ReadSetting(QStringLiteral("cpuopt_page_tables"), true).toBool(); | 750 | ReadSetting(QStringLiteral("cpuopt_page_tables"), true).toBool(); |
| 745 | Settings::values.cpuopt_block_linking = | 751 | Settings::values.cpuopt_block_linking = |
| @@ -756,13 +762,6 @@ void Config::ReadCpuValues() { | |||
| 756 | ReadSetting(QStringLiteral("cpuopt_misc_ir"), true).toBool(); | 762 | ReadSetting(QStringLiteral("cpuopt_misc_ir"), true).toBool(); |
| 757 | Settings::values.cpuopt_reduce_misalign_checks = | 763 | Settings::values.cpuopt_reduce_misalign_checks = |
| 758 | ReadSetting(QStringLiteral("cpuopt_reduce_misalign_checks"), true).toBool(); | 764 | ReadSetting(QStringLiteral("cpuopt_reduce_misalign_checks"), true).toBool(); |
| 759 | |||
| 760 | Settings::values.cpuopt_unsafe_unfuse_fma = | ||
| 761 | ReadSetting(QStringLiteral("cpuopt_unsafe_unfuse_fma"), true).toBool(); | ||
| 762 | Settings::values.cpuopt_unsafe_reduce_fp_error = | ||
| 763 | ReadSetting(QStringLiteral("cpuopt_unsafe_reduce_fp_error"), true).toBool(); | ||
| 764 | Settings::values.cpuopt_unsafe_inaccurate_nan = | ||
| 765 | ReadSetting(QStringLiteral("cpuopt_unsafe_inaccurate_nan"), true).toBool(); | ||
| 766 | } | 765 | } |
| 767 | 766 | ||
| 768 | qt_config->endGroup(); | 767 | qt_config->endGroup(); |
| @@ -869,17 +868,14 @@ void Config::ReadSystemValues() { | |||
| 869 | } | 868 | } |
| 870 | } | 869 | } |
| 871 | 870 | ||
| 872 | bool custom_rtc_enabled; | 871 | if (global) { |
| 873 | ReadSettingGlobal(custom_rtc_enabled, QStringLiteral("custom_rtc_enabled"), false); | 872 | const auto custom_rtc_enabled = |
| 874 | bool custom_rtc_global = | 873 | ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool(); |
| 875 | global || qt_config->value(QStringLiteral("custom_rtc/use_global"), true).toBool(); | ||
| 876 | Settings::values.custom_rtc.SetGlobal(custom_rtc_global); | ||
| 877 | if (global || !custom_rtc_global) { | ||
| 878 | if (custom_rtc_enabled) { | 874 | if (custom_rtc_enabled) { |
| 879 | Settings::values.custom_rtc.SetValue( | 875 | Settings::values.custom_rtc = |
| 880 | std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong())); | 876 | std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong()); |
| 881 | } else { | 877 | } else { |
| 882 | Settings::values.custom_rtc.SetValue(std::nullopt); | 878 | Settings::values.custom_rtc = std::nullopt; |
| 883 | } | 879 | } |
| 884 | } | 880 | } |
| 885 | 881 | ||
| @@ -1313,10 +1309,19 @@ void Config::SavePathValues() { | |||
| 1313 | void Config::SaveCpuValues() { | 1309 | void Config::SaveCpuValues() { |
| 1314 | qt_config->beginGroup(QStringLiteral("Cpu")); | 1310 | qt_config->beginGroup(QStringLiteral("Cpu")); |
| 1315 | 1311 | ||
| 1316 | if (global) { | 1312 | WriteSettingGlobal(QStringLiteral("cpu_accuracy"), |
| 1317 | WriteSetting(QStringLiteral("cpu_accuracy"), | 1313 | static_cast<u32>(Settings::values.cpu_accuracy.GetValue(global)), |
| 1318 | static_cast<int>(Settings::values.cpu_accuracy), 0); | 1314 | Settings::values.cpu_accuracy.UsingGlobal(), |
| 1315 | static_cast<u32>(Settings::CPUAccuracy::Accurate)); | ||
| 1319 | 1316 | ||
| 1317 | WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_unfuse_fma"), | ||
| 1318 | Settings::values.cpuopt_unsafe_unfuse_fma, true); | ||
| 1319 | WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_reduce_fp_error"), | ||
| 1320 | Settings::values.cpuopt_unsafe_reduce_fp_error, true); | ||
| 1321 | WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_inaccurate_nan"), | ||
| 1322 | Settings::values.cpuopt_unsafe_inaccurate_nan, true); | ||
| 1323 | |||
| 1324 | if (global) { | ||
| 1320 | WriteSetting(QStringLiteral("cpuopt_page_tables"), Settings::values.cpuopt_page_tables, | 1325 | WriteSetting(QStringLiteral("cpuopt_page_tables"), Settings::values.cpuopt_page_tables, |
| 1321 | true); | 1326 | true); |
| 1322 | WriteSetting(QStringLiteral("cpuopt_block_linking"), Settings::values.cpuopt_block_linking, | 1327 | WriteSetting(QStringLiteral("cpuopt_block_linking"), Settings::values.cpuopt_block_linking, |
| @@ -1331,13 +1336,6 @@ void Config::SaveCpuValues() { | |||
| 1331 | WriteSetting(QStringLiteral("cpuopt_misc_ir"), Settings::values.cpuopt_misc_ir, true); | 1336 | WriteSetting(QStringLiteral("cpuopt_misc_ir"), Settings::values.cpuopt_misc_ir, true); |
| 1332 | WriteSetting(QStringLiteral("cpuopt_reduce_misalign_checks"), | 1337 | WriteSetting(QStringLiteral("cpuopt_reduce_misalign_checks"), |
| 1333 | Settings::values.cpuopt_reduce_misalign_checks, true); | 1338 | Settings::values.cpuopt_reduce_misalign_checks, true); |
| 1334 | |||
| 1335 | WriteSetting(QStringLiteral("cpuopt_unsafe_unfuse_fma"), | ||
| 1336 | Settings::values.cpuopt_unsafe_unfuse_fma, true); | ||
| 1337 | WriteSetting(QStringLiteral("cpuopt_unsafe_reduce_fp_error"), | ||
| 1338 | Settings::values.cpuopt_unsafe_reduce_fp_error, true); | ||
| 1339 | WriteSetting(QStringLiteral("cpuopt_unsafe_inaccurate_nan"), | ||
| 1340 | Settings::values.cpuopt_unsafe_inaccurate_nan, true); | ||
| 1341 | } | 1339 | } |
| 1342 | 1340 | ||
| 1343 | qt_config->endGroup(); | 1341 | qt_config->endGroup(); |
| @@ -1432,14 +1430,14 @@ void Config::SaveSystemValues() { | |||
| 1432 | Settings::values.rng_seed.GetValue(global).value_or(0), | 1430 | Settings::values.rng_seed.GetValue(global).value_or(0), |
| 1433 | Settings::values.rng_seed.UsingGlobal(), 0); | 1431 | Settings::values.rng_seed.UsingGlobal(), 0); |
| 1434 | 1432 | ||
| 1435 | WriteSettingGlobal(QStringLiteral("custom_rtc_enabled"), | 1433 | if (global) { |
| 1436 | Settings::values.custom_rtc.GetValue(global).has_value(), | 1434 | WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(), |
| 1437 | Settings::values.custom_rtc.UsingGlobal(), false); | 1435 | false); |
| 1438 | WriteSettingGlobal( | 1436 | WriteSetting(QStringLiteral("custom_rtc"), |
| 1439 | QStringLiteral("custom_rtc"), | 1437 | QVariant::fromValue<long long>( |
| 1440 | QVariant::fromValue<long long>( | 1438 | Settings::values.custom_rtc.value_or(std::chrono::seconds{}).count()), |
| 1441 | Settings::values.custom_rtc.GetValue(global).value_or(std::chrono::seconds{}).count()), | 1439 | 0); |
| 1442 | Settings::values.custom_rtc.UsingGlobal(), 0); | 1440 | } |
| 1443 | 1441 | ||
| 1444 | WriteSettingGlobal(QStringLiteral("sound_index"), Settings::values.sound_index, 1); | 1442 | WriteSettingGlobal(QStringLiteral("sound_index"), Settings::values.sound_index, 1); |
| 1445 | 1443 | ||
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 5a2c026b3..ce3355588 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -132,5 +132,6 @@ private: | |||
| 132 | }; | 132 | }; |
| 133 | 133 | ||
| 134 | // These metatype declarations cannot be in common/settings.h because core is devoid of QT | 134 | // These metatype declarations cannot be in common/settings.h because core is devoid of QT |
| 135 | Q_DECLARE_METATYPE(Settings::CPUAccuracy); | ||
| 135 | Q_DECLARE_METATYPE(Settings::RendererBackend); | 136 | Q_DECLARE_METATYPE(Settings::RendererBackend); |
| 136 | Q_DECLARE_METATYPE(Settings::GPUAccuracy); | 137 | Q_DECLARE_METATYPE(Settings::GPUAccuracy); |
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 89be4a62d..096e42e94 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp | |||
| @@ -13,32 +13,29 @@ | |||
| 13 | void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<bool>* setting, | 13 | void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<bool>* setting, |
| 14 | const QCheckBox* checkbox, | 14 | const QCheckBox* checkbox, |
| 15 | const CheckState& tracker) { | 15 | const CheckState& tracker) { |
| 16 | if (tracker == CheckState::Global) { | 16 | if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) { |
| 17 | setting->SetGlobal(true); | ||
| 18 | } else { | ||
| 19 | setting->SetGlobal(false); | ||
| 20 | setting->SetValue(checkbox->checkState()); | 17 | setting->SetValue(checkbox->checkState()); |
| 18 | } else if (!Settings::IsConfiguringGlobal()) { | ||
| 19 | if (tracker == CheckState::Global) { | ||
| 20 | setting->SetGlobal(true); | ||
| 21 | } else { | ||
| 22 | setting->SetGlobal(false); | ||
| 23 | setting->SetValue(checkbox->checkState()); | ||
| 24 | } | ||
| 21 | } | 25 | } |
| 22 | } | 26 | } |
| 23 | 27 | ||
| 24 | void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<int>* setting, | 28 | void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<int>* setting, |
| 25 | const QComboBox* combobox) { | 29 | const QComboBox* combobox) { |
| 26 | if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | 30 | if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) { |
| 27 | setting->SetGlobal(true); | 31 | setting->SetValue(combobox->currentIndex()); |
| 28 | } else { | 32 | } else if (!Settings::IsConfiguringGlobal()) { |
| 29 | setting->SetGlobal(false); | 33 | if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { |
| 30 | setting->SetValue(combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET); | 34 | setting->SetGlobal(true); |
| 31 | } | 35 | } else { |
| 32 | } | 36 | setting->SetGlobal(false); |
| 33 | 37 | setting->SetValue(combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET); | |
| 34 | void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting, | 38 | } |
| 35 | const QComboBox* combobox) { | ||
| 36 | if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 37 | setting->SetGlobal(true); | ||
| 38 | } else { | ||
| 39 | setting->SetGlobal(false); | ||
| 40 | setting->SetValue(static_cast<Settings::RendererBackend>( | ||
| 41 | combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET)); | ||
| 42 | } | 39 | } |
| 43 | } | 40 | } |
| 44 | 41 | ||
| @@ -51,27 +48,6 @@ void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox, | |||
| 51 | } | 48 | } |
| 52 | } | 49 | } |
| 53 | 50 | ||
| 54 | void ConfigurationShared::SetPerGameSetting(QComboBox* combobox, | ||
| 55 | const Settings::Setting<int>* setting) { | ||
| 56 | combobox->setCurrentIndex(setting->UsingGlobal() | ||
| 57 | ? ConfigurationShared::USE_GLOBAL_INDEX | ||
| 58 | : setting->GetValue() + ConfigurationShared::USE_GLOBAL_OFFSET); | ||
| 59 | } | ||
| 60 | |||
| 61 | void ConfigurationShared::SetPerGameSetting( | ||
| 62 | QComboBox* combobox, const Settings::Setting<Settings::RendererBackend>* setting) { | ||
| 63 | combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX | ||
| 64 | : static_cast<int>(setting->GetValue()) + | ||
| 65 | ConfigurationShared::USE_GLOBAL_OFFSET); | ||
| 66 | } | ||
| 67 | |||
| 68 | void ConfigurationShared::SetPerGameSetting( | ||
| 69 | QComboBox* combobox, const Settings::Setting<Settings::GPUAccuracy>* setting) { | ||
| 70 | combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX | ||
| 71 | : static_cast<int>(setting->GetValue()) + | ||
| 72 | ConfigurationShared::USE_GLOBAL_OFFSET); | ||
| 73 | } | ||
| 74 | |||
| 75 | void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) { | 51 | void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) { |
| 76 | if (highlighted) { | 52 | if (highlighted) { |
| 77 | widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }") | 53 | widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }") |
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 5b344cdbd..1e0ef01ca 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h | |||
| @@ -15,37 +15,45 @@ constexpr int USE_GLOBAL_INDEX = 0; | |||
| 15 | constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1; | 15 | constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1; |
| 16 | constexpr int USE_GLOBAL_OFFSET = 2; | 16 | constexpr int USE_GLOBAL_OFFSET = 2; |
| 17 | 17 | ||
| 18 | // CheckBoxes require a tracker for their state since we emulate a tristate CheckBox | ||
| 18 | enum class CheckState { | 19 | enum class CheckState { |
| 19 | Off, | 20 | Off, // Checkbox overrides to off/false |
| 20 | On, | 21 | On, // Checkbox overrides to on/true |
| 21 | Global, | 22 | Global, // Checkbox defers to the global state |
| 22 | Count, | 23 | Count, // Simply the number of states, not a valid checkbox state |
| 23 | }; | 24 | }; |
| 24 | 25 | ||
| 25 | // Global-aware apply and set functions | 26 | // Global-aware apply and set functions |
| 26 | 27 | ||
| 28 | // ApplyPerGameSetting, given a Settings::Setting and a Qt UI element, properly applies a Setting | ||
| 27 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, | 29 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, |
| 28 | const CheckState& tracker); | 30 | const CheckState& tracker); |
| 29 | void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox); | 31 | void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox); |
| 30 | void ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting, | ||
| 31 | const QComboBox* combobox); | ||
| 32 | void ApplyPerGameSetting(Settings::Setting<Settings::GPUAccuracy>* setting, | ||
| 33 | const QComboBox* combobox); | ||
| 34 | 32 | ||
| 33 | // Sets a Qt UI element given a Settings::Setting | ||
| 35 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); | 34 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); |
| 36 | void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<int>* setting); | ||
| 37 | void SetPerGameSetting(QComboBox* combobox, | ||
| 38 | const Settings::Setting<Settings::RendererBackend>* setting); | ||
| 39 | void SetPerGameSetting(QComboBox* combobox, | ||
| 40 | const Settings::Setting<Settings::GPUAccuracy>* setting); | ||
| 41 | 35 | ||
| 36 | template <typename Type> | ||
| 37 | void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<Type>* setting) { | ||
| 38 | combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX | ||
| 39 | : static_cast<int>(setting->GetValue()) + | ||
| 40 | ConfigurationShared::USE_GLOBAL_OFFSET); | ||
| 41 | } | ||
| 42 | |||
| 43 | // (Un)highlights a Qt UI element | ||
| 42 | void SetHighlight(QWidget* widget, bool highlighted); | 44 | void SetHighlight(QWidget* widget, bool highlighted); |
| 45 | |||
| 46 | // Sets up a QCheckBox like a tristate one, given a Setting | ||
| 43 | void SetColoredTristate(QCheckBox* checkbox, const Settings::Setting<bool>& setting, | 47 | void SetColoredTristate(QCheckBox* checkbox, const Settings::Setting<bool>& setting, |
| 44 | CheckState& tracker); | 48 | CheckState& tracker); |
| 45 | void SetColoredTristate(QCheckBox* checkbox, bool global, bool state, bool global_state, | 49 | void SetColoredTristate(QCheckBox* checkbox, bool global, bool state, bool global_state, |
| 46 | CheckState& tracker); | 50 | CheckState& tracker); |
| 51 | |||
| 52 | // Sets up coloring of a QWidget `target` based on the state of a QComboBox, and calls | ||
| 53 | // InsertGlobalItem | ||
| 47 | void SetColoredComboBox(QComboBox* combobox, QWidget* target, int global); | 54 | void SetColoredComboBox(QComboBox* combobox, QWidget* target, int global); |
| 48 | 55 | ||
| 56 | // Adds the "Use Global Configuration" selection and separator to the beginning of a QComboBox | ||
| 49 | void InsertGlobalItem(QComboBox* combobox, int global_index); | 57 | void InsertGlobalItem(QComboBox* combobox, int global_index); |
| 50 | 58 | ||
| 51 | } // namespace ConfigurationShared | 59 | } // namespace ConfigurationShared |
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index f9507e228..fc0191432 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp | |||
| @@ -99,6 +99,9 @@ void ConfigureAudio::SetVolumeIndicatorText(int percentage) { | |||
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | void ConfigureAudio::ApplyConfiguration() { | 101 | void ConfigureAudio::ApplyConfiguration() { |
| 102 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching, | ||
| 103 | ui->toggle_audio_stretching, enable_audio_stretching); | ||
| 104 | |||
| 102 | if (Settings::IsConfiguringGlobal()) { | 105 | if (Settings::IsConfiguringGlobal()) { |
| 103 | Settings::values.sink_id = | 106 | Settings::values.sink_id = |
| 104 | ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex()) | 107 | ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex()) |
| @@ -108,19 +111,12 @@ void ConfigureAudio::ApplyConfiguration() { | |||
| 108 | .toStdString(); | 111 | .toStdString(); |
| 109 | 112 | ||
| 110 | // Guard if during game and set to game-specific value | 113 | // Guard if during game and set to game-specific value |
| 111 | if (Settings::values.enable_audio_stretching.UsingGlobal()) { | ||
| 112 | Settings::values.enable_audio_stretching.SetValue( | ||
| 113 | ui->toggle_audio_stretching->isChecked()); | ||
| 114 | } | ||
| 115 | if (Settings::values.volume.UsingGlobal()) { | 114 | if (Settings::values.volume.UsingGlobal()) { |
| 116 | Settings::values.volume.SetValue( | 115 | Settings::values.volume.SetValue( |
| 117 | static_cast<float>(ui->volume_slider->sliderPosition()) / | 116 | static_cast<float>(ui->volume_slider->sliderPosition()) / |
| 118 | ui->volume_slider->maximum()); | 117 | ui->volume_slider->maximum()); |
| 119 | } | 118 | } |
| 120 | } else { | 119 | } else { |
| 121 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching, | ||
| 122 | ui->toggle_audio_stretching, | ||
| 123 | enable_audio_stretching); | ||
| 124 | if (ui->volume_combo_box->currentIndex() == 0) { | 120 | if (ui->volume_combo_box->currentIndex() == 0) { |
| 125 | Settings::values.volume.SetGlobal(true); | 121 | Settings::values.volume.SetGlobal(true); |
| 126 | } else { | 122 | } else { |
diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp index 4f99bc80f..525c42ff0 100644 --- a/src/yuzu/configuration/configure_cpu.cpp +++ b/src/yuzu/configuration/configure_cpu.cpp | |||
| @@ -10,11 +10,14 @@ | |||
| 10 | #include "common/settings.h" | 10 | #include "common/settings.h" |
| 11 | #include "core/core.h" | 11 | #include "core/core.h" |
| 12 | #include "ui_configure_cpu.h" | 12 | #include "ui_configure_cpu.h" |
| 13 | #include "yuzu/configuration/configuration_shared.h" | ||
| 13 | #include "yuzu/configuration/configure_cpu.h" | 14 | #include "yuzu/configuration/configure_cpu.h" |
| 14 | 15 | ||
| 15 | ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureCpu) { | 16 | ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureCpu) { |
| 16 | ui->setupUi(this); | 17 | ui->setupUi(this); |
| 17 | 18 | ||
| 19 | SetupPerGameUI(); | ||
| 20 | |||
| 18 | SetConfiguration(); | 21 | SetConfiguration(); |
| 19 | 22 | ||
| 20 | connect(ui->accuracy, qOverload<int>(&QComboBox::activated), this, | 23 | connect(ui->accuracy, qOverload<int>(&QComboBox::activated), this, |
| @@ -29,19 +32,29 @@ void ConfigureCpu::SetConfiguration() { | |||
| 29 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 32 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); |
| 30 | 33 | ||
| 31 | ui->accuracy->setEnabled(runtime_lock); | 34 | ui->accuracy->setEnabled(runtime_lock); |
| 32 | ui->accuracy->setCurrentIndex(static_cast<int>(Settings::values.cpu_accuracy)); | ||
| 33 | UpdateGroup(static_cast<int>(Settings::values.cpu_accuracy)); | ||
| 34 | |||
| 35 | ui->cpuopt_unsafe_unfuse_fma->setEnabled(runtime_lock); | 35 | ui->cpuopt_unsafe_unfuse_fma->setEnabled(runtime_lock); |
| 36 | ui->cpuopt_unsafe_unfuse_fma->setChecked(Settings::values.cpuopt_unsafe_unfuse_fma); | ||
| 37 | ui->cpuopt_unsafe_reduce_fp_error->setEnabled(runtime_lock); | 36 | ui->cpuopt_unsafe_reduce_fp_error->setEnabled(runtime_lock); |
| 38 | ui->cpuopt_unsafe_reduce_fp_error->setChecked(Settings::values.cpuopt_unsafe_reduce_fp_error); | ||
| 39 | ui->cpuopt_unsafe_inaccurate_nan->setEnabled(runtime_lock); | 37 | ui->cpuopt_unsafe_inaccurate_nan->setEnabled(runtime_lock); |
| 40 | ui->cpuopt_unsafe_inaccurate_nan->setChecked(Settings::values.cpuopt_unsafe_inaccurate_nan); | 38 | |
| 39 | ui->cpuopt_unsafe_unfuse_fma->setChecked(Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()); | ||
| 40 | ui->cpuopt_unsafe_reduce_fp_error->setChecked( | ||
| 41 | Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()); | ||
| 42 | ui->cpuopt_unsafe_inaccurate_nan->setChecked( | ||
| 43 | Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()); | ||
| 44 | |||
| 45 | if (Settings::IsConfiguringGlobal()) { | ||
| 46 | ui->accuracy->setCurrentIndex(static_cast<int>(Settings::values.cpu_accuracy.GetValue())); | ||
| 47 | } else { | ||
| 48 | ConfigurationShared::SetPerGameSetting(ui->accuracy, &Settings::values.cpu_accuracy); | ||
| 49 | ConfigurationShared::SetHighlight(ui->widget_accuracy, | ||
| 50 | !Settings::values.cpu_accuracy.UsingGlobal()); | ||
| 51 | } | ||
| 52 | UpdateGroup(ui->accuracy->currentIndex()); | ||
| 41 | } | 53 | } |
| 42 | 54 | ||
| 43 | void ConfigureCpu::AccuracyUpdated(int index) { | 55 | void ConfigureCpu::AccuracyUpdated(int index) { |
| 44 | if (static_cast<Settings::CPUAccuracy>(index) == Settings::CPUAccuracy::DebugMode) { | 56 | if (Settings::IsConfiguringGlobal() && |
| 57 | static_cast<Settings::CPUAccuracy>(index) == Settings::CPUAccuracy::DebugMode) { | ||
| 45 | const auto result = QMessageBox::warning(this, tr("Setting CPU to Debug Mode"), | 58 | const auto result = QMessageBox::warning(this, tr("Setting CPU to Debug Mode"), |
| 46 | tr("CPU Debug Mode is only intended for developer " | 59 | tr("CPU Debug Mode is only intended for developer " |
| 47 | "use. Are you sure you want to enable this?"), | 60 | "use. Are you sure you want to enable this?"), |
| @@ -54,16 +67,39 @@ void ConfigureCpu::AccuracyUpdated(int index) { | |||
| 54 | } | 67 | } |
| 55 | 68 | ||
| 56 | void ConfigureCpu::UpdateGroup(int index) { | 69 | void ConfigureCpu::UpdateGroup(int index) { |
| 57 | ui->unsafe_group->setVisible(static_cast<Settings::CPUAccuracy>(index) == | 70 | if (!Settings::IsConfiguringGlobal()) { |
| 58 | Settings::CPUAccuracy::Unsafe); | 71 | index -= ConfigurationShared::USE_GLOBAL_OFFSET; |
| 72 | } | ||
| 73 | const auto accuracy = static_cast<Settings::CPUAccuracy>(index); | ||
| 74 | ui->unsafe_group->setVisible(accuracy == Settings::CPUAccuracy::Unsafe); | ||
| 59 | } | 75 | } |
| 60 | 76 | ||
| 61 | void ConfigureCpu::ApplyConfiguration() { | 77 | void ConfigureCpu::ApplyConfiguration() { |
| 62 | Settings::values.cpu_accuracy = | 78 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_unfuse_fma, |
| 63 | static_cast<Settings::CPUAccuracy>(ui->accuracy->currentIndex()); | 79 | ui->cpuopt_unsafe_unfuse_fma, |
| 64 | Settings::values.cpuopt_unsafe_unfuse_fma = ui->cpuopt_unsafe_unfuse_fma->isChecked(); | 80 | cpuopt_unsafe_unfuse_fma); |
| 65 | Settings::values.cpuopt_unsafe_reduce_fp_error = ui->cpuopt_unsafe_reduce_fp_error->isChecked(); | 81 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_reduce_fp_error, |
| 66 | Settings::values.cpuopt_unsafe_inaccurate_nan = ui->cpuopt_unsafe_inaccurate_nan->isChecked(); | 82 | ui->cpuopt_unsafe_reduce_fp_error, |
| 83 | cpuopt_unsafe_reduce_fp_error); | ||
| 84 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_inaccurate_nan, | ||
| 85 | ui->cpuopt_unsafe_inaccurate_nan, | ||
| 86 | cpuopt_unsafe_inaccurate_nan); | ||
| 87 | |||
| 88 | if (Settings::IsConfiguringGlobal()) { | ||
| 89 | // Guard if during game and set to game-specific value | ||
| 90 | if (Settings::values.cpu_accuracy.UsingGlobal()) { | ||
| 91 | Settings::values.cpu_accuracy.SetValue( | ||
| 92 | static_cast<Settings::CPUAccuracy>(ui->accuracy->currentIndex())); | ||
| 93 | } | ||
| 94 | } else { | ||
| 95 | if (ui->accuracy->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 96 | Settings::values.cpu_accuracy.SetGlobal(true); | ||
| 97 | } else { | ||
| 98 | Settings::values.cpu_accuracy.SetGlobal(false); | ||
| 99 | Settings::values.cpu_accuracy.SetValue(static_cast<Settings::CPUAccuracy>( | ||
| 100 | ui->accuracy->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET)); | ||
| 101 | } | ||
| 102 | } | ||
| 67 | } | 103 | } |
| 68 | 104 | ||
| 69 | void ConfigureCpu::changeEvent(QEvent* event) { | 105 | void ConfigureCpu::changeEvent(QEvent* event) { |
| @@ -77,3 +113,25 @@ void ConfigureCpu::changeEvent(QEvent* event) { | |||
| 77 | void ConfigureCpu::RetranslateUI() { | 113 | void ConfigureCpu::RetranslateUI() { |
| 78 | ui->retranslateUi(this); | 114 | ui->retranslateUi(this); |
| 79 | } | 115 | } |
| 116 | |||
| 117 | void ConfigureCpu::SetupPerGameUI() { | ||
| 118 | if (Settings::IsConfiguringGlobal()) { | ||
| 119 | return; | ||
| 120 | } | ||
| 121 | |||
| 122 | ConfigurationShared::SetColoredComboBox( | ||
| 123 | ui->accuracy, ui->widget_accuracy, | ||
| 124 | static_cast<u32>(Settings::values.cpu_accuracy.GetValue(true))); | ||
| 125 | ui->accuracy->removeItem(static_cast<u32>(Settings::CPUAccuracy::DebugMode) + | ||
| 126 | ConfigurationShared::USE_GLOBAL_OFFSET); | ||
| 127 | |||
| 128 | ConfigurationShared::SetColoredTristate(ui->cpuopt_unsafe_unfuse_fma, | ||
| 129 | Settings::values.cpuopt_unsafe_unfuse_fma, | ||
| 130 | cpuopt_unsafe_unfuse_fma); | ||
| 131 | ConfigurationShared::SetColoredTristate(ui->cpuopt_unsafe_reduce_fp_error, | ||
| 132 | Settings::values.cpuopt_unsafe_reduce_fp_error, | ||
| 133 | cpuopt_unsafe_reduce_fp_error); | ||
| 134 | ConfigurationShared::SetColoredTristate(ui->cpuopt_unsafe_inaccurate_nan, | ||
| 135 | Settings::values.cpuopt_unsafe_inaccurate_nan, | ||
| 136 | cpuopt_unsafe_inaccurate_nan); | ||
| 137 | } | ||
diff --git a/src/yuzu/configuration/configure_cpu.h b/src/yuzu/configuration/configure_cpu.h index ef77b2e7e..8e2eeb7a6 100644 --- a/src/yuzu/configuration/configure_cpu.h +++ b/src/yuzu/configuration/configure_cpu.h | |||
| @@ -8,6 +8,10 @@ | |||
| 8 | #include <QWidget> | 8 | #include <QWidget> |
| 9 | #include "common/settings.h" | 9 | #include "common/settings.h" |
| 10 | 10 | ||
| 11 | namespace ConfigurationShared { | ||
| 12 | enum class CheckState; | ||
| 13 | } | ||
| 14 | |||
| 11 | namespace Ui { | 15 | namespace Ui { |
| 12 | class ConfigureCpu; | 16 | class ConfigureCpu; |
| 13 | } | 17 | } |
| @@ -30,5 +34,11 @@ private: | |||
| 30 | 34 | ||
| 31 | void SetConfiguration(); | 35 | void SetConfiguration(); |
| 32 | 36 | ||
| 37 | void SetupPerGameUI(); | ||
| 38 | |||
| 33 | std::unique_ptr<Ui::ConfigureCpu> ui; | 39 | std::unique_ptr<Ui::ConfigureCpu> ui; |
| 40 | |||
| 41 | ConfigurationShared::CheckState cpuopt_unsafe_unfuse_fma; | ||
| 42 | ConfigurationShared::CheckState cpuopt_unsafe_reduce_fp_error; | ||
| 43 | ConfigurationShared::CheckState cpuopt_unsafe_inaccurate_nan; | ||
| 34 | }; | 44 | }; |
diff --git a/src/yuzu/configuration/configure_cpu.ui b/src/yuzu/configuration/configure_cpu.ui index bcd0962e9..d0e7e7bfe 100644 --- a/src/yuzu/configuration/configure_cpu.ui +++ b/src/yuzu/configuration/configure_cpu.ui | |||
| @@ -23,42 +23,44 @@ | |||
| 23 | </property> | 23 | </property> |
| 24 | <layout class="QVBoxLayout"> | 24 | <layout class="QVBoxLayout"> |
| 25 | <item> | 25 | <item> |
| 26 | <layout class="QHBoxLayout"> | 26 | <widget class="QWidget" name="widget_accuracy" native="true"> |
| 27 | <item> | 27 | <layout class="QHBoxLayout" name="layout_accuracy"> |
| 28 | <widget class="QLabel"> | 28 | <item> |
| 29 | <property name="text"> | 29 | <widget class="QLabel" name="label"> |
| 30 | <string>Accuracy:</string> | ||
| 31 | </property> | ||
| 32 | </widget> | ||
| 33 | </item> | ||
| 34 | <item> | ||
| 35 | <widget class="QComboBox" name="accuracy"> | ||
| 36 | <item> | ||
| 37 | <property name="text"> | 30 | <property name="text"> |
| 38 | <string>Accurate</string> | 31 | <string>Accuracy:</string> |
| 39 | </property> | 32 | </property> |
| 40 | </item> | 33 | </widget> |
| 41 | <item> | 34 | </item> |
| 42 | <property name="text"> | 35 | <item> |
| 43 | <string>Unsafe</string> | 36 | <widget class="QComboBox" name="accuracy"> |
| 44 | </property> | 37 | <item> |
| 45 | </item> | 38 | <property name="text"> |
| 46 | <item> | 39 | <string>Accurate</string> |
| 47 | <property name="text"> | 40 | </property> |
| 48 | <string>Enable Debug Mode</string> | 41 | </item> |
| 49 | </property> | 42 | <item> |
| 50 | </item> | 43 | <property name="text"> |
| 51 | </widget> | 44 | <string>Unsafe</string> |
| 52 | </item> | 45 | </property> |
| 53 | </layout> | 46 | </item> |
| 47 | <item> | ||
| 48 | <property name="text"> | ||
| 49 | <string>Enable Debug Mode</string> | ||
| 50 | </property> | ||
| 51 | </item> | ||
| 52 | </widget> | ||
| 53 | </item> | ||
| 54 | </layout> | ||
| 55 | </widget> | ||
| 54 | </item> | 56 | </item> |
| 55 | <item> | 57 | <item> |
| 56 | <widget class="QLabel"> | 58 | <widget class="QLabel" name="label"> |
| 57 | <property name="wordWrap"> | ||
| 58 | <bool>1</bool> | ||
| 59 | </property> | ||
| 60 | <property name="text"> | 59 | <property name="text"> |
| 61 | <string>We recommend setting accuracy to "Accurate".</string> | 60 | <string>We recommend setting accuracy to "Accurate".</string> |
| 61 | </property> | ||
| 62 | <property name="wordWrap"> | ||
| 63 | <bool>false</bool> | ||
| 62 | </property> | 64 | </property> |
| 63 | </widget> | 65 | </widget> |
| 64 | </item> | 66 | </item> |
| @@ -76,49 +78,49 @@ | |||
| 76 | </property> | 78 | </property> |
| 77 | <layout class="QVBoxLayout"> | 79 | <layout class="QVBoxLayout"> |
| 78 | <item> | 80 | <item> |
| 79 | <widget class="QLabel"> | 81 | <widget class="QLabel" name="label"> |
| 80 | <property name="wordWrap"> | ||
| 81 | <bool>1</bool> | ||
| 82 | </property> | ||
| 83 | <property name="text"> | 82 | <property name="text"> |
| 84 | <string>These settings reduce accuracy for speed.</string> | 83 | <string>These settings reduce accuracy for speed.</string> |
| 85 | </property> | 84 | </property> |
| 85 | <property name="wordWrap"> | ||
| 86 | <bool>false</bool> | ||
| 87 | </property> | ||
| 86 | </widget> | 88 | </widget> |
| 87 | </item> | 89 | </item> |
| 88 | <item> | 90 | <item> |
| 89 | <widget class="QCheckBox" name="cpuopt_unsafe_unfuse_fma"> | 91 | <widget class="QCheckBox" name="cpuopt_unsafe_unfuse_fma"> |
| 90 | <property name="text"> | ||
| 91 | <string>Unfuse FMA (improve performance on CPUs without FMA)</string> | ||
| 92 | </property> | ||
| 93 | <property name="toolTip"> | 92 | <property name="toolTip"> |
| 94 | <string> | 93 | <string> |
| 95 | <div>This option improves speed by reducing accuracy of fused-multiply-add instructions on CPUs without native FMA support.</div> | 94 | <div>This option improves speed by reducing accuracy of fused-multiply-add instructions on CPUs without native FMA support.</div> |
| 96 | </string> | 95 | </string> |
| 97 | </property> | 96 | </property> |
| 97 | <property name="text"> | ||
| 98 | <string>Unfuse FMA (improve performance on CPUs without FMA)</string> | ||
| 99 | </property> | ||
| 98 | </widget> | 100 | </widget> |
| 99 | </item> | 101 | </item> |
| 100 | <item> | 102 | <item> |
| 101 | <widget class="QCheckBox" name="cpuopt_unsafe_reduce_fp_error"> | 103 | <widget class="QCheckBox" name="cpuopt_unsafe_reduce_fp_error"> |
| 102 | <property name="text"> | ||
| 103 | <string>Faster FRSQRTE and FRECPE</string> | ||
| 104 | </property> | ||
| 105 | <property name="toolTip"> | 104 | <property name="toolTip"> |
| 106 | <string> | 105 | <string> |
| 107 | <div>This option improves the speed of some approximate floating-point functions by using less accurate native approximations.</div> | 106 | <div>This option improves the speed of some approximate floating-point functions by using less accurate native approximations.</div> |
| 108 | </string> | 107 | </string> |
| 109 | </property> | 108 | </property> |
| 109 | <property name="text"> | ||
| 110 | <string>Faster FRSQRTE and FRECPE</string> | ||
| 111 | </property> | ||
| 110 | </widget> | 112 | </widget> |
| 111 | </item> | 113 | </item> |
| 112 | <item> | 114 | <item> |
| 113 | <widget class="QCheckBox" name="cpuopt_unsafe_inaccurate_nan"> | 115 | <widget class="QCheckBox" name="cpuopt_unsafe_inaccurate_nan"> |
| 114 | <property name="text"> | ||
| 115 | <string>Inaccurate NaN handling</string> | ||
| 116 | </property> | ||
| 117 | <property name="toolTip"> | 116 | <property name="toolTip"> |
| 118 | <string> | 117 | <string> |
| 119 | <div>This option improves speed by removing NaN checking. Please note this also reduces accuracy of certain floating-point instructions.</div> | 118 | <div>This option improves speed by removing NaN checking. Please note this also reduces accuracy of certain floating-point instructions.</div> |
| 120 | </string> | 119 | </string> |
| 121 | </property> | 120 | </property> |
| 121 | <property name="text"> | ||
| 122 | <string>Inaccurate NaN handling</string> | ||
| 123 | </property> | ||
| 122 | </widget> | 124 | </widget> |
| 123 | </item> | 125 | </item> |
| 124 | </layout> | 126 | </layout> |
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 2fa88dcec..55a6a37bd 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp | |||
| @@ -50,6 +50,9 @@ void ConfigureGeneral::SetConfiguration() { | |||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | void ConfigureGeneral::ApplyConfiguration() { | 52 | void ConfigureGeneral::ApplyConfiguration() { |
| 53 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, ui->use_multi_core, | ||
| 54 | use_multi_core); | ||
| 55 | |||
| 53 | if (Settings::IsConfiguringGlobal()) { | 56 | if (Settings::IsConfiguringGlobal()) { |
| 54 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); | 57 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); |
| 55 | UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); | 58 | UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); |
| @@ -62,13 +65,7 @@ void ConfigureGeneral::ApplyConfiguration() { | |||
| 62 | Qt::Checked); | 65 | Qt::Checked); |
| 63 | Settings::values.frame_limit.SetValue(ui->frame_limit->value()); | 66 | Settings::values.frame_limit.SetValue(ui->frame_limit->value()); |
| 64 | } | 67 | } |
| 65 | if (Settings::values.use_multi_core.UsingGlobal()) { | ||
| 66 | Settings::values.use_multi_core.SetValue(ui->use_multi_core->isChecked()); | ||
| 67 | } | ||
| 68 | } else { | 68 | } else { |
| 69 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, | ||
| 70 | ui->use_multi_core, use_multi_core); | ||
| 71 | |||
| 72 | bool global_frame_limit = use_frame_limit == ConfigurationShared::CheckState::Global; | 69 | bool global_frame_limit = use_frame_limit == ConfigurationShared::CheckState::Global; |
| 73 | Settings::values.use_frame_limit.SetGlobal(global_frame_limit); | 70 | Settings::values.use_frame_limit.SetGlobal(global_frame_limit); |
| 74 | Settings::values.frame_limit.SetGlobal(global_frame_limit); | 71 | Settings::values.frame_limit.SetGlobal(global_frame_limit); |
| @@ -94,6 +91,9 @@ void ConfigureGeneral::RetranslateUI() { | |||
| 94 | 91 | ||
| 95 | void ConfigureGeneral::SetupPerGameUI() { | 92 | void ConfigureGeneral::SetupPerGameUI() { |
| 96 | if (Settings::IsConfiguringGlobal()) { | 93 | if (Settings::IsConfiguringGlobal()) { |
| 94 | // Disables each setting if: | ||
| 95 | // - A game is running (thus settings in use), and | ||
| 96 | // - A non-global setting is applied. | ||
| 97 | ui->toggle_frame_limit->setEnabled(Settings::values.use_frame_limit.UsingGlobal()); | 97 | ui->toggle_frame_limit->setEnabled(Settings::values.use_frame_limit.UsingGlobal()); |
| 98 | ui->frame_limit->setEnabled(Settings::values.frame_limit.UsingGlobal()); | 98 | ui->frame_limit->setEnabled(Settings::values.frame_limit.UsingGlobal()); |
| 99 | 99 | ||
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 0a7536617..fb9ec093c 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -106,6 +106,19 @@ void ConfigureGraphics::SetConfiguration() { | |||
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | void ConfigureGraphics::ApplyConfiguration() { | 108 | void ConfigureGraphics::ApplyConfiguration() { |
| 109 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.fullscreen_mode, | ||
| 110 | ui->fullscreen_mode_combobox); | ||
| 111 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio, | ||
| 112 | ui->aspect_ratio_combobox); | ||
| 113 | |||
| 114 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache, | ||
| 115 | ui->use_disk_shader_cache, use_disk_shader_cache); | ||
| 116 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, | ||
| 117 | ui->use_asynchronous_gpu_emulation, | ||
| 118 | use_asynchronous_gpu_emulation); | ||
| 119 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_nvdec_emulation, | ||
| 120 | ui->use_nvdec_emulation, use_nvdec_emulation); | ||
| 121 | |||
| 109 | if (Settings::IsConfiguringGlobal()) { | 122 | if (Settings::IsConfiguringGlobal()) { |
| 110 | // Guard if during game and set to game-specific value | 123 | // Guard if during game and set to game-specific value |
| 111 | if (Settings::values.renderer_backend.UsingGlobal()) { | 124 | if (Settings::values.renderer_backend.UsingGlobal()) { |
| @@ -114,22 +127,6 @@ void ConfigureGraphics::ApplyConfiguration() { | |||
| 114 | if (Settings::values.vulkan_device.UsingGlobal()) { | 127 | if (Settings::values.vulkan_device.UsingGlobal()) { |
| 115 | Settings::values.vulkan_device.SetValue(vulkan_device); | 128 | Settings::values.vulkan_device.SetValue(vulkan_device); |
| 116 | } | 129 | } |
| 117 | if (Settings::values.fullscreen_mode.UsingGlobal()) { | ||
| 118 | Settings::values.fullscreen_mode.SetValue(ui->fullscreen_mode_combobox->currentIndex()); | ||
| 119 | } | ||
| 120 | if (Settings::values.aspect_ratio.UsingGlobal()) { | ||
| 121 | Settings::values.aspect_ratio.SetValue(ui->aspect_ratio_combobox->currentIndex()); | ||
| 122 | } | ||
| 123 | if (Settings::values.use_disk_shader_cache.UsingGlobal()) { | ||
| 124 | Settings::values.use_disk_shader_cache.SetValue(ui->use_disk_shader_cache->isChecked()); | ||
| 125 | } | ||
| 126 | if (Settings::values.use_asynchronous_gpu_emulation.UsingGlobal()) { | ||
| 127 | Settings::values.use_asynchronous_gpu_emulation.SetValue( | ||
| 128 | ui->use_asynchronous_gpu_emulation->isChecked()); | ||
| 129 | } | ||
| 130 | if (Settings::values.use_nvdec_emulation.UsingGlobal()) { | ||
| 131 | Settings::values.use_nvdec_emulation.SetValue(ui->use_nvdec_emulation->isChecked()); | ||
| 132 | } | ||
| 133 | if (Settings::values.bg_red.UsingGlobal()) { | 130 | if (Settings::values.bg_red.UsingGlobal()) { |
| 134 | Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF())); | 131 | Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF())); |
| 135 | Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF())); | 132 | Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF())); |
| @@ -150,19 +147,6 @@ void ConfigureGraphics::ApplyConfiguration() { | |||
| 150 | } | 147 | } |
| 151 | } | 148 | } |
| 152 | 149 | ||
| 153 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.fullscreen_mode, | ||
| 154 | ui->fullscreen_mode_combobox); | ||
| 155 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio, | ||
| 156 | ui->aspect_ratio_combobox); | ||
| 157 | |||
| 158 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache, | ||
| 159 | ui->use_disk_shader_cache, use_disk_shader_cache); | ||
| 160 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, | ||
| 161 | ui->use_asynchronous_gpu_emulation, | ||
| 162 | use_asynchronous_gpu_emulation); | ||
| 163 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_nvdec_emulation, | ||
| 164 | ui->use_nvdec_emulation, use_nvdec_emulation); | ||
| 165 | |||
| 166 | if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | 150 | if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { |
| 167 | Settings::values.bg_red.SetGlobal(true); | 151 | Settings::values.bg_red.SetGlobal(true); |
| 168 | Settings::values.bg_green.SetGlobal(true); | 152 | Settings::values.bg_green.SetGlobal(true); |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index c67609b0e..35bf9c6be 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp | |||
| @@ -54,47 +54,23 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { | |||
| 54 | ui->gpu_accuracy->currentIndex() - | 54 | ui->gpu_accuracy->currentIndex() - |
| 55 | ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); | 55 | ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET)); |
| 56 | 56 | ||
| 57 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, | ||
| 58 | ui->anisotropic_filtering_combobox); | ||
| 59 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync); | ||
| 60 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders, | ||
| 61 | ui->use_assembly_shaders, use_assembly_shaders); | ||
| 62 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, | ||
| 63 | ui->use_asynchronous_shaders, | ||
| 64 | use_asynchronous_shaders); | ||
| 65 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, | ||
| 66 | ui->use_fast_gpu_time, use_fast_gpu_time); | ||
| 67 | |||
| 57 | if (Settings::IsConfiguringGlobal()) { | 68 | if (Settings::IsConfiguringGlobal()) { |
| 58 | // Must guard in case of a during-game configuration when set to be game-specific. | 69 | // Must guard in case of a during-game configuration when set to be game-specific. |
| 59 | if (Settings::values.gpu_accuracy.UsingGlobal()) { | 70 | if (Settings::values.gpu_accuracy.UsingGlobal()) { |
| 60 | Settings::values.gpu_accuracy.SetValue(gpu_accuracy); | 71 | Settings::values.gpu_accuracy.SetValue(gpu_accuracy); |
| 61 | } | 72 | } |
| 62 | if (Settings::values.use_vsync.UsingGlobal()) { | ||
| 63 | Settings::values.use_vsync.SetValue(ui->use_vsync->isChecked()); | ||
| 64 | } | ||
| 65 | if (Settings::values.use_assembly_shaders.UsingGlobal()) { | ||
| 66 | Settings::values.use_assembly_shaders.SetValue(ui->use_assembly_shaders->isChecked()); | ||
| 67 | } | ||
| 68 | if (Settings::values.use_asynchronous_shaders.UsingGlobal()) { | ||
| 69 | Settings::values.use_asynchronous_shaders.SetValue( | ||
| 70 | ui->use_asynchronous_shaders->isChecked()); | ||
| 71 | } | ||
| 72 | if (Settings::values.use_asynchronous_shaders.UsingGlobal()) { | ||
| 73 | Settings::values.use_asynchronous_shaders.SetValue( | ||
| 74 | ui->use_asynchronous_shaders->isChecked()); | ||
| 75 | } | ||
| 76 | if (Settings::values.use_fast_gpu_time.UsingGlobal()) { | ||
| 77 | Settings::values.use_fast_gpu_time.SetValue(ui->use_fast_gpu_time->isChecked()); | ||
| 78 | } | ||
| 79 | if (Settings::values.max_anisotropy.UsingGlobal()) { | ||
| 80 | Settings::values.max_anisotropy.SetValue( | ||
| 81 | ui->anisotropic_filtering_combobox->currentIndex()); | ||
| 82 | } | ||
| 83 | } else { | 73 | } else { |
| 84 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, | ||
| 85 | ui->anisotropic_filtering_combobox); | ||
| 86 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, | ||
| 87 | use_vsync); | ||
| 88 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders, | ||
| 89 | ui->use_assembly_shaders, use_assembly_shaders); | ||
| 90 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, | ||
| 91 | ui->use_asynchronous_shaders, | ||
| 92 | use_asynchronous_shaders); | ||
| 93 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, | ||
| 94 | ui->use_fast_gpu_time, use_fast_gpu_time); | ||
| 95 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, | ||
| 96 | ui->anisotropic_filtering_combobox); | ||
| 97 | |||
| 98 | if (ui->gpu_accuracy->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | 74 | if (ui->gpu_accuracy->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { |
| 99 | Settings::values.gpu_accuracy.SetGlobal(true); | 75 | Settings::values.gpu_accuracy.SetGlobal(true); |
| 100 | } else { | 76 | } else { |
diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index bd91ebc42..f550567e2 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp | |||
| @@ -52,6 +52,7 @@ ConfigurePerGame::~ConfigurePerGame() = default; | |||
| 52 | void ConfigurePerGame::ApplyConfiguration() { | 52 | void ConfigurePerGame::ApplyConfiguration() { |
| 53 | ui->addonsTab->ApplyConfiguration(); | 53 | ui->addonsTab->ApplyConfiguration(); |
| 54 | ui->generalTab->ApplyConfiguration(); | 54 | ui->generalTab->ApplyConfiguration(); |
| 55 | ui->cpuTab->ApplyConfiguration(); | ||
| 55 | ui->systemTab->ApplyConfiguration(); | 56 | ui->systemTab->ApplyConfiguration(); |
| 56 | ui->graphicsTab->ApplyConfiguration(); | 57 | ui->graphicsTab->ApplyConfiguration(); |
| 57 | ui->graphicsAdvancedTab->ApplyConfiguration(); | 58 | ui->graphicsAdvancedTab->ApplyConfiguration(); |
diff --git a/src/yuzu/configuration/configure_per_game.ui b/src/yuzu/configuration/configure_per_game.ui index 25975b3b9..adf6d0b39 100644 --- a/src/yuzu/configuration/configure_per_game.ui +++ b/src/yuzu/configuration/configure_per_game.ui | |||
| @@ -235,6 +235,11 @@ | |||
| 235 | <string>System</string> | 235 | <string>System</string> |
| 236 | </attribute> | 236 | </attribute> |
| 237 | </widget> | 237 | </widget> |
| 238 | <widget class="ConfigureCpu" name="cpuTab"> | ||
| 239 | <attribute name="title"> | ||
| 240 | <string>CPU</string> | ||
| 241 | </attribute> | ||
| 242 | </widget> | ||
| 238 | <widget class="ConfigureGraphics" name="graphicsTab"> | 243 | <widget class="ConfigureGraphics" name="graphicsTab"> |
| 239 | <attribute name="title"> | 244 | <attribute name="title"> |
| 240 | <string>Graphics</string> | 245 | <string>Graphics</string> |
| @@ -311,6 +316,12 @@ | |||
| 311 | <header>configuration/configure_per_game_addons.h</header> | 316 | <header>configuration/configure_per_game_addons.h</header> |
| 312 | <container>1</container> | 317 | <container>1</container> |
| 313 | </customwidget> | 318 | </customwidget> |
| 319 | <customwidget> | ||
| 320 | <class>ConfigureCpu</class> | ||
| 321 | <extends>QWidget</extends> | ||
| 322 | <header>configuration/configure_cpu.h</header> | ||
| 323 | <container>1</container> | ||
| 324 | </customwidget> | ||
| 314 | </customwidgets> | 325 | </customwidgets> |
| 315 | <resources/> | 326 | <resources/> |
| 316 | <connections> | 327 | <connections> |
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 268ed44c3..85418f969 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -65,7 +65,7 @@ void ConfigureSystem::SetConfiguration() { | |||
| 65 | QStringLiteral("%1") | 65 | QStringLiteral("%1") |
| 66 | .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'}) | 66 | .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'}) |
| 67 | .toUpper(); | 67 | .toUpper(); |
| 68 | const auto rtc_time = Settings::values.custom_rtc.GetValue().value_or( | 68 | const auto rtc_time = Settings::values.custom_rtc.value_or( |
| 69 | std::chrono::seconds(QDateTime::currentSecsSinceEpoch())); | 69 | std::chrono::seconds(QDateTime::currentSecsSinceEpoch())); |
| 70 | 70 | ||
| 71 | ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); | 71 | ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); |
| @@ -73,9 +73,8 @@ void ConfigureSystem::SetConfiguration() { | |||
| 73 | Settings::values.rng_seed.UsingGlobal()); | 73 | Settings::values.rng_seed.UsingGlobal()); |
| 74 | ui->rng_seed_edit->setText(rng_seed); | 74 | ui->rng_seed_edit->setText(rng_seed); |
| 75 | 75 | ||
| 76 | ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.GetValue().has_value()); | 76 | ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value()); |
| 77 | ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() && | 77 | ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value()); |
| 78 | Settings::values.rng_seed.UsingGlobal()); | ||
| 79 | ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); | 78 | ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); |
| 80 | 79 | ||
| 81 | if (Settings::IsConfiguringGlobal()) { | 80 | if (Settings::IsConfiguringGlobal()) { |
| @@ -109,17 +108,17 @@ void ConfigureSystem::ApplyConfiguration() { | |||
| 109 | 108 | ||
| 110 | // Allow setting custom RTC even if system is powered on, | 109 | // Allow setting custom RTC even if system is powered on, |
| 111 | // to allow in-game time to be fast forwarded | 110 | // to allow in-game time to be fast forwarded |
| 112 | if (Settings::values.custom_rtc.UsingGlobal()) { | 111 | if (Settings::IsConfiguringGlobal()) { |
| 113 | if (ui->custom_rtc_checkbox->isChecked()) { | 112 | if (ui->custom_rtc_checkbox->isChecked()) { |
| 114 | Settings::values.custom_rtc.SetValue( | 113 | Settings::values.custom_rtc = |
| 115 | std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); | 114 | std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()); |
| 116 | if (system.IsPoweredOn()) { | 115 | if (system.IsPoweredOn()) { |
| 117 | const s64 posix_time{Settings::values.custom_rtc.GetValue()->count() + | 116 | const s64 posix_time{Settings::values.custom_rtc->count() + |
| 118 | Service::Time::TimeManager::GetExternalTimeZoneOffset()}; | 117 | Service::Time::TimeManager::GetExternalTimeZoneOffset()}; |
| 119 | system.GetTimeManager().UpdateLocalSystemClockTime(posix_time); | 118 | system.GetTimeManager().UpdateLocalSystemClockTime(posix_time); |
| 120 | } | 119 | } |
| 121 | } else { | 120 | } else { |
| 122 | Settings::values.custom_rtc.SetValue(std::nullopt); | 121 | Settings::values.custom_rtc = std::nullopt; |
| 123 | } | 122 | } |
| 124 | } | 123 | } |
| 125 | 124 | ||
| @@ -127,21 +126,14 @@ void ConfigureSystem::ApplyConfiguration() { | |||
| 127 | return; | 126 | return; |
| 128 | } | 127 | } |
| 129 | 128 | ||
| 129 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.language_index, ui->combo_language); | ||
| 130 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.region_index, ui->combo_region); | ||
| 131 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.time_zone_index, | ||
| 132 | ui->combo_time_zone); | ||
| 133 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound); | ||
| 134 | |||
| 130 | if (Settings::IsConfiguringGlobal()) { | 135 | if (Settings::IsConfiguringGlobal()) { |
| 131 | // Guard if during game and set to game-specific value | 136 | // Guard if during game and set to game-specific value |
| 132 | if (Settings::values.language_index.UsingGlobal()) { | ||
| 133 | Settings::values.language_index.SetValue(ui->combo_language->currentIndex()); | ||
| 134 | } | ||
| 135 | if (Settings::values.region_index.UsingGlobal()) { | ||
| 136 | Settings::values.region_index.SetValue(ui->combo_region->currentIndex()); | ||
| 137 | } | ||
| 138 | if (Settings::values.time_zone_index.UsingGlobal()) { | ||
| 139 | Settings::values.time_zone_index.SetValue(ui->combo_time_zone->currentIndex()); | ||
| 140 | } | ||
| 141 | if (Settings::values.sound_index.UsingGlobal()) { | ||
| 142 | Settings::values.sound_index.SetValue(ui->combo_sound->currentIndex()); | ||
| 143 | } | ||
| 144 | |||
| 145 | if (Settings::values.rng_seed.UsingGlobal()) { | 137 | if (Settings::values.rng_seed.UsingGlobal()) { |
| 146 | if (ui->rng_seed_checkbox->isChecked()) { | 138 | if (ui->rng_seed_checkbox->isChecked()) { |
| 147 | Settings::values.rng_seed.SetValue( | 139 | Settings::values.rng_seed.SetValue( |
| @@ -151,13 +143,6 @@ void ConfigureSystem::ApplyConfiguration() { | |||
| 151 | } | 143 | } |
| 152 | } | 144 | } |
| 153 | } else { | 145 | } else { |
| 154 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.language_index, | ||
| 155 | ui->combo_language); | ||
| 156 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.region_index, ui->combo_region); | ||
| 157 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.time_zone_index, | ||
| 158 | ui->combo_time_zone); | ||
| 159 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound); | ||
| 160 | |||
| 161 | switch (use_rng_seed) { | 146 | switch (use_rng_seed) { |
| 162 | case ConfigurationShared::CheckState::On: | 147 | case ConfigurationShared::CheckState::On: |
| 163 | case ConfigurationShared::CheckState::Off: | 148 | case ConfigurationShared::CheckState::Off: |
| @@ -177,26 +162,6 @@ void ConfigureSystem::ApplyConfiguration() { | |||
| 177 | case ConfigurationShared::CheckState::Count: | 162 | case ConfigurationShared::CheckState::Count: |
| 178 | break; | 163 | break; |
| 179 | } | 164 | } |
| 180 | |||
| 181 | switch (use_custom_rtc) { | ||
| 182 | case ConfigurationShared::CheckState::On: | ||
| 183 | case ConfigurationShared::CheckState::Off: | ||
| 184 | Settings::values.custom_rtc.SetGlobal(false); | ||
| 185 | if (ui->custom_rtc_checkbox->isChecked()) { | ||
| 186 | Settings::values.custom_rtc.SetValue( | ||
| 187 | std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); | ||
| 188 | } else { | ||
| 189 | Settings::values.custom_rtc.SetValue(std::nullopt); | ||
| 190 | } | ||
| 191 | break; | ||
| 192 | case ConfigurationShared::CheckState::Global: | ||
| 193 | Settings::values.custom_rtc.SetGlobal(false); | ||
| 194 | Settings::values.custom_rtc.SetValue(std::nullopt); | ||
| 195 | Settings::values.custom_rtc.SetGlobal(true); | ||
| 196 | break; | ||
| 197 | case ConfigurationShared::CheckState::Count: | ||
| 198 | break; | ||
| 199 | } | ||
| 200 | } | 165 | } |
| 201 | 166 | ||
| 202 | system.ApplySettings(); | 167 | system.ApplySettings(); |
| @@ -227,8 +192,6 @@ void ConfigureSystem::SetupPerGameUI() { | |||
| 227 | ui->combo_sound->setEnabled(Settings::values.sound_index.UsingGlobal()); | 192 | ui->combo_sound->setEnabled(Settings::values.sound_index.UsingGlobal()); |
| 228 | ui->rng_seed_checkbox->setEnabled(Settings::values.rng_seed.UsingGlobal()); | 193 | ui->rng_seed_checkbox->setEnabled(Settings::values.rng_seed.UsingGlobal()); |
| 229 | ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.UsingGlobal()); | 194 | ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.UsingGlobal()); |
| 230 | ui->custom_rtc_checkbox->setEnabled(Settings::values.custom_rtc.UsingGlobal()); | ||
| 231 | ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.UsingGlobal()); | ||
| 232 | 195 | ||
| 233 | return; | 196 | return; |
| 234 | } | 197 | } |
| @@ -246,8 +209,7 @@ void ConfigureSystem::SetupPerGameUI() { | |||
| 246 | ui->rng_seed_checkbox, Settings::values.rng_seed.UsingGlobal(), | 209 | ui->rng_seed_checkbox, Settings::values.rng_seed.UsingGlobal(), |
| 247 | Settings::values.rng_seed.GetValue().has_value(), | 210 | Settings::values.rng_seed.GetValue().has_value(), |
| 248 | Settings::values.rng_seed.GetValue(true).has_value(), use_rng_seed); | 211 | Settings::values.rng_seed.GetValue(true).has_value(), use_rng_seed); |
| 249 | ConfigurationShared::SetColoredTristate( | 212 | |
| 250 | ui->custom_rtc_checkbox, Settings::values.custom_rtc.UsingGlobal(), | 213 | ui->custom_rtc_checkbox->setVisible(false); |
| 251 | Settings::values.custom_rtc.GetValue().has_value(), | 214 | ui->custom_rtc_edit->setVisible(false); |
| 252 | Settings::values.custom_rtc.GetValue(true).has_value(), use_custom_rtc); | ||
| 253 | } | 215 | } |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 7e1d5f379..38d896d65 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -361,10 +361,10 @@ void Config::ReadValues() { | |||
| 361 | 361 | ||
| 362 | const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false); | 362 | const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false); |
| 363 | if (custom_rtc_enabled) { | 363 | if (custom_rtc_enabled) { |
| 364 | Settings::values.custom_rtc.SetValue( | 364 | Settings::values.custom_rtc = |
| 365 | std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0))); | 365 | std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0)); |
| 366 | } else { | 366 | } else { |
| 367 | Settings::values.custom_rtc.SetValue(std::nullopt); | 367 | Settings::values.custom_rtc = std::nullopt; |
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | Settings::values.language_index.SetValue( | 370 | Settings::values.language_index.SetValue( |