summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/parent_of_member.h3
-rw-r--r--src/common/settings.cpp9
-rw-r--r--src/common/settings.h10
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_32.cpp10
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_64.cpp10
-rw-r--r--src/core/core.cpp2
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp16
-rw-r--r--src/core/hle/kernel/hle_ipc.h7
-rw-r--r--src/input_common/udp/client.cpp23
-rw-r--r--src/yuzu/configuration/config.cpp72
-rw-r--r--src/yuzu/configuration/config.h1
-rw-r--r--src/yuzu/configuration/configuration_shared.cpp58
-rw-r--r--src/yuzu/configuration/configuration_shared.h34
-rw-r--r--src/yuzu/configuration/configure_audio.cpp10
-rw-r--r--src/yuzu/configuration/configure_cpu.cpp86
-rw-r--r--src/yuzu/configuration/configure_cpu.h10
-rw-r--r--src/yuzu/configuration/configure_cpu.ui90
-rw-r--r--src/yuzu/configuration/configure_general.cpp12
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp42
-rw-r--r--src/yuzu/configuration/configure_graphics_advanced.cpp46
-rw-r--r--src/yuzu/configuration/configure_per_game.cpp1
-rw-r--r--src/yuzu/configuration/configure_per_game.ui11
-rw-r--r--src/yuzu/configuration/configure_system.cpp72
-rw-r--r--src/yuzu_cmd/config.cpp6
24 files changed, 329 insertions, 312 deletions
diff --git a/src/common/parent_of_member.h b/src/common/parent_of_member.h
index e0f8ab5c8..58c70b0e7 100644
--- a/src/common/parent_of_member.h
+++ b/src/common/parent_of_member.h
@@ -109,7 +109,8 @@ struct OffsetOfCalculator {
}
}
- return (next - start) * sizeof(MemberType) + Offset;
+ return static_cast<ptrdiff_t>(static_cast<size_t>(next - start) * sizeof(MemberType) +
+ Offset);
}
static constexpr std::ptrdiff_t OffsetOf(MemberType ParentType::*member) {
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() {
log_setting("System_RegionIndex", values.region_index.GetValue());
log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue());
log_setting("Core_UseMultiCore", values.use_multi_core.GetValue());
- log_setting("CPU_Accuracy", values.cpu_accuracy);
+ log_setting("CPU_Accuracy", values.cpu_accuracy.GetValue());
log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue());
log_setting("Renderer_UseFrameLimit", values.use_frame_limit.GetValue());
log_setting("Renderer_FrameLimit", values.frame_limit.GetValue());
@@ -106,6 +106,12 @@ void RestoreGlobalState(bool is_powered_on) {
// Core
values.use_multi_core.SetGlobal(true);
+ // CPU
+ values.cpu_accuracy.SetGlobal(true);
+ values.cpuopt_unsafe_unfuse_fma.SetGlobal(true);
+ values.cpuopt_unsafe_reduce_fp_error.SetGlobal(true);
+ values.cpuopt_unsafe_inaccurate_nan.SetGlobal(true);
+
// Renderer
values.renderer_backend.SetGlobal(true);
values.vulkan_device.SetGlobal(true);
@@ -130,7 +136,6 @@ void RestoreGlobalState(bool is_powered_on) {
values.region_index.SetGlobal(true);
values.time_zone_index.SetGlobal(true);
values.rng_seed.SetGlobal(true);
- values.custom_rtc.SetGlobal(true);
values.sound_index.SetGlobal(true);
// 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 {
Setting<bool> use_multi_core;
// Cpu
- CPUAccuracy cpu_accuracy;
+ Setting<CPUAccuracy> cpu_accuracy;
bool cpuopt_page_tables;
bool cpuopt_block_linking;
@@ -126,9 +126,9 @@ struct Values {
bool cpuopt_misc_ir;
bool cpuopt_reduce_misalign_checks;
- bool cpuopt_unsafe_unfuse_fma;
- bool cpuopt_unsafe_reduce_fp_error;
- bool cpuopt_unsafe_inaccurate_nan;
+ Setting<bool> cpuopt_unsafe_unfuse_fma;
+ Setting<bool> cpuopt_unsafe_reduce_fp_error;
+ Setting<bool> cpuopt_unsafe_inaccurate_nan;
// Renderer
Setting<RendererBackend> renderer_backend;
@@ -157,7 +157,7 @@ struct Values {
// System
Setting<std::optional<u32>> rng_seed;
// Measured in seconds since epoch
- Setting<std::optional<std::chrono::seconds>> custom_rtc;
+ std::optional<std::chrono::seconds> custom_rtc;
// Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc`
std::chrono::seconds custom_rtc_differential;
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*
config.far_code_offset = 256 * 1024 * 1024;
// Safe optimizations
- if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::DebugMode) {
+ if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
if (!Settings::values.cpuopt_page_tables) {
config.page_table = nullptr;
}
@@ -170,15 +170,15 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
}
// Unsafe optimizations
- if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::Unsafe) {
+ if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) {
config.unsafe_optimizations = true;
- if (Settings::values.cpuopt_unsafe_unfuse_fma) {
+ if (Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA;
}
- if (Settings::values.cpuopt_unsafe_reduce_fp_error) {
+ if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP;
}
- if (Settings::values.cpuopt_unsafe_inaccurate_nan) {
+ if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN;
}
}
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*
config.far_code_offset = 256 * 1024 * 1024;
// Safe optimizations
- if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::DebugMode) {
+ if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
if (!Settings::values.cpuopt_page_tables) {
config.page_table = nullptr;
}
@@ -210,15 +210,15 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable*
}
// Unsafe optimizations
- if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::Unsafe) {
+ if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) {
config.unsafe_optimizations = true;
- if (Settings::values.cpuopt_unsafe_unfuse_fma) {
+ if (Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA;
}
- if (Settings::values.cpuopt_unsafe_reduce_fp_error) {
+ if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP;
}
- if (Settings::values.cpuopt_unsafe_inaccurate_nan) {
+ if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN;
}
}
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 {
const auto current_time = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch());
Settings::values.custom_rtc_differential =
- Settings::values.custom_rtc.GetValue().value_or(current_time) - current_time;
+ Settings::values.custom_rtc.value_or(current_time) - current_time;
// Create a default fs if one doesn't already exist.
if (virtual_filesystem == nullptr)
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index ce3466df8..24700f7a5 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -64,7 +64,7 @@ void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32
if (command_header->enable_handle_descriptor) {
handle_descriptor_header = rp.PopRaw<IPC::HandleDescriptorHeader>();
if (handle_descriptor_header->send_current_pid) {
- rp.Skip(2, false);
+ pid = rp.Pop<u64>();
}
if (incoming) {
// Populate the object lists with the data in the IPC request.
@@ -86,16 +86,16 @@ void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32
}
}
- for (unsigned i = 0; i < command_header->num_buf_x_descriptors; ++i) {
+ for (u32 i = 0; i < command_header->num_buf_x_descriptors; ++i) {
buffer_x_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorX>());
}
- for (unsigned i = 0; i < command_header->num_buf_a_descriptors; ++i) {
+ for (u32 i = 0; i < command_header->num_buf_a_descriptors; ++i) {
buffer_a_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorABW>());
}
- for (unsigned i = 0; i < command_header->num_buf_b_descriptors; ++i) {
+ for (u32 i = 0; i < command_header->num_buf_b_descriptors; ++i) {
buffer_b_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorABW>());
}
- for (unsigned i = 0; i < command_header->num_buf_w_descriptors; ++i) {
+ for (u32 i = 0; i < command_header->num_buf_w_descriptors; ++i) {
buffer_w_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorABW>());
}
@@ -148,14 +148,14 @@ void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32
IPC::CommandHeader::BufferDescriptorCFlag::OneDescriptor) {
buffer_c_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorC>());
} else {
- unsigned num_buf_c_descriptors =
- static_cast<unsigned>(command_header->buf_c_descriptor_flags.Value()) - 2;
+ u32 num_buf_c_descriptors =
+ static_cast<u32>(command_header->buf_c_descriptor_flags.Value()) - 2;
// This is used to detect possible underflows, in case something is broken
// with the two ifs above and the flags value is == 0 || == 1.
ASSERT(num_buf_c_descriptors < 14);
- for (unsigned i = 0; i < num_buf_c_descriptors; ++i) {
+ for (u32 i = 0; i < num_buf_c_descriptors; ++i) {
buffer_c_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorC>());
}
}
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 4fba300dc..e1b128281 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -150,6 +150,10 @@ public:
return command_header->type;
}
+ u64 GetPID() const {
+ return pid;
+ }
+
u32 GetDataPayloadOffset() const {
return data_payload_offset;
}
@@ -305,11 +309,12 @@ private:
std::vector<IPC::BufferDescriptorABW> buffer_w_desciptors;
std::vector<IPC::BufferDescriptorC> buffer_c_desciptors;
+ u32_le command{};
+ u64 pid{};
u32 data_payload_offset{};
u32 handles_offset{};
u32 domain_offset{};
u32 data_size{};
- u32_le command{};
std::vector<std::shared_ptr<SessionRequestHandler>> domain_request_handlers;
bool is_thread_waiting{};
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp
index 8a38a380d..bc1dfab3d 100644
--- a/src/input_common/udp/client.cpp
+++ b/src/input_common/udp/client.cpp
@@ -86,6 +86,7 @@ private:
case Type::PadData: {
Response::PadData pad_data;
std::memcpy(&pad_data, &receive_buffer[sizeof(Header)], sizeof(Response::PadData));
+ SanitizeMotion(pad_data);
callback.pad_data(std::move(pad_data));
break;
}
@@ -114,6 +115,28 @@ private:
StartSend(timer.expiry());
}
+ void SanitizeMotion(Response::PadData& data) {
+ // Zero out any non number value
+ if (!std::isnormal(data.gyro.pitch)) {
+ data.gyro.pitch = 0;
+ }
+ if (!std::isnormal(data.gyro.roll)) {
+ data.gyro.roll = 0;
+ }
+ if (!std::isnormal(data.gyro.yaw)) {
+ data.gyro.yaw = 0;
+ }
+ if (!std::isnormal(data.accel.x)) {
+ data.accel.x = 0;
+ }
+ if (!std::isnormal(data.accel.y)) {
+ data.accel.y = 0;
+ }
+ if (!std::isnormal(data.accel.z)) {
+ data.accel.z = 0;
+ }
+ }
+
SocketCallback callback;
boost::asio::io_service io_service;
boost::asio::basic_waitable_timer<clock> timer;
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() {
void Config::ReadCpuValues() {
qt_config->beginGroup(QStringLiteral("Cpu"));
- if (global) {
- Settings::values.cpu_accuracy = static_cast<Settings::CPUAccuracy>(
- ReadSetting(QStringLiteral("cpu_accuracy"), 0).toInt());
+ ReadSettingGlobal(Settings::values.cpu_accuracy, QStringLiteral("cpu_accuracy"), 0);
+
+ ReadSettingGlobal(Settings::values.cpuopt_unsafe_unfuse_fma,
+ QStringLiteral("cpuopt_unsafe_unfuse_fma"), true);
+ ReadSettingGlobal(Settings::values.cpuopt_unsafe_reduce_fp_error,
+ QStringLiteral("cpuopt_unsafe_reduce_fp_error"), true);
+ ReadSettingGlobal(Settings::values.cpuopt_unsafe_inaccurate_nan,
+ QStringLiteral("cpuopt_unsafe_inaccurate_nan"), true);
+ if (global) {
Settings::values.cpuopt_page_tables =
ReadSetting(QStringLiteral("cpuopt_page_tables"), true).toBool();
Settings::values.cpuopt_block_linking =
@@ -756,13 +762,6 @@ void Config::ReadCpuValues() {
ReadSetting(QStringLiteral("cpuopt_misc_ir"), true).toBool();
Settings::values.cpuopt_reduce_misalign_checks =
ReadSetting(QStringLiteral("cpuopt_reduce_misalign_checks"), true).toBool();
-
- Settings::values.cpuopt_unsafe_unfuse_fma =
- ReadSetting(QStringLiteral("cpuopt_unsafe_unfuse_fma"), true).toBool();
- Settings::values.cpuopt_unsafe_reduce_fp_error =
- ReadSetting(QStringLiteral("cpuopt_unsafe_reduce_fp_error"), true).toBool();
- Settings::values.cpuopt_unsafe_inaccurate_nan =
- ReadSetting(QStringLiteral("cpuopt_unsafe_inaccurate_nan"), true).toBool();
}
qt_config->endGroup();
@@ -869,17 +868,14 @@ void Config::ReadSystemValues() {
}
}
- bool custom_rtc_enabled;
- ReadSettingGlobal(custom_rtc_enabled, QStringLiteral("custom_rtc_enabled"), false);
- bool custom_rtc_global =
- global || qt_config->value(QStringLiteral("custom_rtc/use_global"), true).toBool();
- Settings::values.custom_rtc.SetGlobal(custom_rtc_global);
- if (global || !custom_rtc_global) {
+ if (global) {
+ const auto custom_rtc_enabled =
+ ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool();
if (custom_rtc_enabled) {
- Settings::values.custom_rtc.SetValue(
- std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong()));
+ Settings::values.custom_rtc =
+ std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong());
} else {
- Settings::values.custom_rtc.SetValue(std::nullopt);
+ Settings::values.custom_rtc = std::nullopt;
}
}
@@ -1313,10 +1309,19 @@ void Config::SavePathValues() {
void Config::SaveCpuValues() {
qt_config->beginGroup(QStringLiteral("Cpu"));
- if (global) {
- WriteSetting(QStringLiteral("cpu_accuracy"),
- static_cast<int>(Settings::values.cpu_accuracy), 0);
+ WriteSettingGlobal(QStringLiteral("cpu_accuracy"),
+ static_cast<u32>(Settings::values.cpu_accuracy.GetValue(global)),
+ Settings::values.cpu_accuracy.UsingGlobal(),
+ static_cast<u32>(Settings::CPUAccuracy::Accurate));
+ WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_unfuse_fma"),
+ Settings::values.cpuopt_unsafe_unfuse_fma, true);
+ WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_reduce_fp_error"),
+ Settings::values.cpuopt_unsafe_reduce_fp_error, true);
+ WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_inaccurate_nan"),
+ Settings::values.cpuopt_unsafe_inaccurate_nan, true);
+
+ if (global) {
WriteSetting(QStringLiteral("cpuopt_page_tables"), Settings::values.cpuopt_page_tables,
true);
WriteSetting(QStringLiteral("cpuopt_block_linking"), Settings::values.cpuopt_block_linking,
@@ -1331,13 +1336,6 @@ void Config::SaveCpuValues() {
WriteSetting(QStringLiteral("cpuopt_misc_ir"), Settings::values.cpuopt_misc_ir, true);
WriteSetting(QStringLiteral("cpuopt_reduce_misalign_checks"),
Settings::values.cpuopt_reduce_misalign_checks, true);
-
- WriteSetting(QStringLiteral("cpuopt_unsafe_unfuse_fma"),
- Settings::values.cpuopt_unsafe_unfuse_fma, true);
- WriteSetting(QStringLiteral("cpuopt_unsafe_reduce_fp_error"),
- Settings::values.cpuopt_unsafe_reduce_fp_error, true);
- WriteSetting(QStringLiteral("cpuopt_unsafe_inaccurate_nan"),
- Settings::values.cpuopt_unsafe_inaccurate_nan, true);
}
qt_config->endGroup();
@@ -1432,14 +1430,14 @@ void Config::SaveSystemValues() {
Settings::values.rng_seed.GetValue(global).value_or(0),
Settings::values.rng_seed.UsingGlobal(), 0);
- WriteSettingGlobal(QStringLiteral("custom_rtc_enabled"),
- Settings::values.custom_rtc.GetValue(global).has_value(),
- Settings::values.custom_rtc.UsingGlobal(), false);
- WriteSettingGlobal(
- QStringLiteral("custom_rtc"),
- QVariant::fromValue<long long>(
- Settings::values.custom_rtc.GetValue(global).value_or(std::chrono::seconds{}).count()),
- Settings::values.custom_rtc.UsingGlobal(), 0);
+ if (global) {
+ WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(),
+ false);
+ WriteSetting(QStringLiteral("custom_rtc"),
+ QVariant::fromValue<long long>(
+ Settings::values.custom_rtc.value_or(std::chrono::seconds{}).count()),
+ 0);
+ }
WriteSettingGlobal(QStringLiteral("sound_index"), Settings::values.sound_index, 1);
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:
};
// These metatype declarations cannot be in common/settings.h because core is devoid of QT
+Q_DECLARE_METATYPE(Settings::CPUAccuracy);
Q_DECLARE_METATYPE(Settings::RendererBackend);
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 @@
void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<bool>* setting,
const QCheckBox* checkbox,
const CheckState& tracker) {
- if (tracker == CheckState::Global) {
- setting->SetGlobal(true);
- } else {
- setting->SetGlobal(false);
+ if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) {
setting->SetValue(checkbox->checkState());
+ } else if (!Settings::IsConfiguringGlobal()) {
+ if (tracker == CheckState::Global) {
+ setting->SetGlobal(true);
+ } else {
+ setting->SetGlobal(false);
+ setting->SetValue(checkbox->checkState());
+ }
}
}
void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<int>* setting,
const QComboBox* combobox) {
- if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
- setting->SetGlobal(true);
- } else {
- setting->SetGlobal(false);
- setting->SetValue(combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET);
- }
-}
-
-void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting,
- const QComboBox* combobox) {
- if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
- setting->SetGlobal(true);
- } else {
- setting->SetGlobal(false);
- setting->SetValue(static_cast<Settings::RendererBackend>(
- combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET));
+ if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) {
+ setting->SetValue(combobox->currentIndex());
+ } else if (!Settings::IsConfiguringGlobal()) {
+ if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
+ setting->SetGlobal(true);
+ } else {
+ setting->SetGlobal(false);
+ setting->SetValue(combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET);
+ }
}
}
@@ -51,27 +48,6 @@ void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox,
}
}
-void ConfigurationShared::SetPerGameSetting(QComboBox* combobox,
- const Settings::Setting<int>* setting) {
- combobox->setCurrentIndex(setting->UsingGlobal()
- ? ConfigurationShared::USE_GLOBAL_INDEX
- : setting->GetValue() + ConfigurationShared::USE_GLOBAL_OFFSET);
-}
-
-void ConfigurationShared::SetPerGameSetting(
- QComboBox* combobox, const Settings::Setting<Settings::RendererBackend>* setting) {
- combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX
- : static_cast<int>(setting->GetValue()) +
- ConfigurationShared::USE_GLOBAL_OFFSET);
-}
-
-void ConfigurationShared::SetPerGameSetting(
- QComboBox* combobox, const Settings::Setting<Settings::GPUAccuracy>* setting) {
- combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX
- : static_cast<int>(setting->GetValue()) +
- ConfigurationShared::USE_GLOBAL_OFFSET);
-}
-
void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) {
if (highlighted) {
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;
constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1;
constexpr int USE_GLOBAL_OFFSET = 2;
+// CheckBoxes require a tracker for their state since we emulate a tristate CheckBox
enum class CheckState {
- Off,
- On,
- Global,
- Count,
+ Off, // Checkbox overrides to off/false
+ On, // Checkbox overrides to on/true
+ Global, // Checkbox defers to the global state
+ Count, // Simply the number of states, not a valid checkbox state
};
// Global-aware apply and set functions
+// ApplyPerGameSetting, given a Settings::Setting and a Qt UI element, properly applies a Setting
void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox,
const CheckState& tracker);
void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox);
-void ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting,
- const QComboBox* combobox);
-void ApplyPerGameSetting(Settings::Setting<Settings::GPUAccuracy>* setting,
- const QComboBox* combobox);
+// Sets a Qt UI element given a Settings::Setting
void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting);
-void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<int>* setting);
-void SetPerGameSetting(QComboBox* combobox,
- const Settings::Setting<Settings::RendererBackend>* setting);
-void SetPerGameSetting(QComboBox* combobox,
- const Settings::Setting<Settings::GPUAccuracy>* setting);
+template <typename Type>
+void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<Type>* setting) {
+ combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX
+ : static_cast<int>(setting->GetValue()) +
+ ConfigurationShared::USE_GLOBAL_OFFSET);
+}
+
+// (Un)highlights a Qt UI element
void SetHighlight(QWidget* widget, bool highlighted);
+
+// Sets up a QCheckBox like a tristate one, given a Setting
void SetColoredTristate(QCheckBox* checkbox, const Settings::Setting<bool>& setting,
CheckState& tracker);
void SetColoredTristate(QCheckBox* checkbox, bool global, bool state, bool global_state,
CheckState& tracker);
+
+// Sets up coloring of a QWidget `target` based on the state of a QComboBox, and calls
+// InsertGlobalItem
void SetColoredComboBox(QComboBox* combobox, QWidget* target, int global);
+// Adds the "Use Global Configuration" selection and separator to the beginning of a QComboBox
void InsertGlobalItem(QComboBox* combobox, int global_index);
} // 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) {
}
void ConfigureAudio::ApplyConfiguration() {
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching,
+ ui->toggle_audio_stretching, enable_audio_stretching);
+
if (Settings::IsConfiguringGlobal()) {
Settings::values.sink_id =
ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex())
@@ -108,19 +111,12 @@ void ConfigureAudio::ApplyConfiguration() {
.toStdString();
// Guard if during game and set to game-specific value
- if (Settings::values.enable_audio_stretching.UsingGlobal()) {
- Settings::values.enable_audio_stretching.SetValue(
- ui->toggle_audio_stretching->isChecked());
- }
if (Settings::values.volume.UsingGlobal()) {
Settings::values.volume.SetValue(
static_cast<float>(ui->volume_slider->sliderPosition()) /
ui->volume_slider->maximum());
}
} else {
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching,
- ui->toggle_audio_stretching,
- enable_audio_stretching);
if (ui->volume_combo_box->currentIndex() == 0) {
Settings::values.volume.SetGlobal(true);
} 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 @@
#include "common/settings.h"
#include "core/core.h"
#include "ui_configure_cpu.h"
+#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_cpu.h"
ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureCpu) {
ui->setupUi(this);
+ SetupPerGameUI();
+
SetConfiguration();
connect(ui->accuracy, qOverload<int>(&QComboBox::activated), this,
@@ -29,19 +32,29 @@ void ConfigureCpu::SetConfiguration() {
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
ui->accuracy->setEnabled(runtime_lock);
- ui->accuracy->setCurrentIndex(static_cast<int>(Settings::values.cpu_accuracy));
- UpdateGroup(static_cast<int>(Settings::values.cpu_accuracy));
-
ui->cpuopt_unsafe_unfuse_fma->setEnabled(runtime_lock);
- ui->cpuopt_unsafe_unfuse_fma->setChecked(Settings::values.cpuopt_unsafe_unfuse_fma);
ui->cpuopt_unsafe_reduce_fp_error->setEnabled(runtime_lock);
- ui->cpuopt_unsafe_reduce_fp_error->setChecked(Settings::values.cpuopt_unsafe_reduce_fp_error);
ui->cpuopt_unsafe_inaccurate_nan->setEnabled(runtime_lock);
- ui->cpuopt_unsafe_inaccurate_nan->setChecked(Settings::values.cpuopt_unsafe_inaccurate_nan);
+
+ ui->cpuopt_unsafe_unfuse_fma->setChecked(Settings::values.cpuopt_unsafe_unfuse_fma.GetValue());
+ ui->cpuopt_unsafe_reduce_fp_error->setChecked(
+ Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue());
+ ui->cpuopt_unsafe_inaccurate_nan->setChecked(
+ Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue());
+
+ if (Settings::IsConfiguringGlobal()) {
+ ui->accuracy->setCurrentIndex(static_cast<int>(Settings::values.cpu_accuracy.GetValue()));
+ } else {
+ ConfigurationShared::SetPerGameSetting(ui->accuracy, &Settings::values.cpu_accuracy);
+ ConfigurationShared::SetHighlight(ui->widget_accuracy,
+ !Settings::values.cpu_accuracy.UsingGlobal());
+ }
+ UpdateGroup(ui->accuracy->currentIndex());
}
void ConfigureCpu::AccuracyUpdated(int index) {
- if (static_cast<Settings::CPUAccuracy>(index) == Settings::CPUAccuracy::DebugMode) {
+ if (Settings::IsConfiguringGlobal() &&
+ static_cast<Settings::CPUAccuracy>(index) == Settings::CPUAccuracy::DebugMode) {
const auto result = QMessageBox::warning(this, tr("Setting CPU to Debug Mode"),
tr("CPU Debug Mode is only intended for developer "
"use. Are you sure you want to enable this?"),
@@ -54,16 +67,39 @@ void ConfigureCpu::AccuracyUpdated(int index) {
}
void ConfigureCpu::UpdateGroup(int index) {
- ui->unsafe_group->setVisible(static_cast<Settings::CPUAccuracy>(index) ==
- Settings::CPUAccuracy::Unsafe);
+ if (!Settings::IsConfiguringGlobal()) {
+ index -= ConfigurationShared::USE_GLOBAL_OFFSET;
+ }
+ const auto accuracy = static_cast<Settings::CPUAccuracy>(index);
+ ui->unsafe_group->setVisible(accuracy == Settings::CPUAccuracy::Unsafe);
}
void ConfigureCpu::ApplyConfiguration() {
- Settings::values.cpu_accuracy =
- static_cast<Settings::CPUAccuracy>(ui->accuracy->currentIndex());
- Settings::values.cpuopt_unsafe_unfuse_fma = ui->cpuopt_unsafe_unfuse_fma->isChecked();
- Settings::values.cpuopt_unsafe_reduce_fp_error = ui->cpuopt_unsafe_reduce_fp_error->isChecked();
- Settings::values.cpuopt_unsafe_inaccurate_nan = ui->cpuopt_unsafe_inaccurate_nan->isChecked();
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_unfuse_fma,
+ ui->cpuopt_unsafe_unfuse_fma,
+ cpuopt_unsafe_unfuse_fma);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_reduce_fp_error,
+ ui->cpuopt_unsafe_reduce_fp_error,
+ cpuopt_unsafe_reduce_fp_error);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.cpuopt_unsafe_inaccurate_nan,
+ ui->cpuopt_unsafe_inaccurate_nan,
+ cpuopt_unsafe_inaccurate_nan);
+
+ if (Settings::IsConfiguringGlobal()) {
+ // Guard if during game and set to game-specific value
+ if (Settings::values.cpu_accuracy.UsingGlobal()) {
+ Settings::values.cpu_accuracy.SetValue(
+ static_cast<Settings::CPUAccuracy>(ui->accuracy->currentIndex()));
+ }
+ } else {
+ if (ui->accuracy->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
+ Settings::values.cpu_accuracy.SetGlobal(true);
+ } else {
+ Settings::values.cpu_accuracy.SetGlobal(false);
+ Settings::values.cpu_accuracy.SetValue(static_cast<Settings::CPUAccuracy>(
+ ui->accuracy->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET));
+ }
+ }
}
void ConfigureCpu::changeEvent(QEvent* event) {
@@ -77,3 +113,25 @@ void ConfigureCpu::changeEvent(QEvent* event) {
void ConfigureCpu::RetranslateUI() {
ui->retranslateUi(this);
}
+
+void ConfigureCpu::SetupPerGameUI() {
+ if (Settings::IsConfiguringGlobal()) {
+ return;
+ }
+
+ ConfigurationShared::SetColoredComboBox(
+ ui->accuracy, ui->widget_accuracy,
+ static_cast<u32>(Settings::values.cpu_accuracy.GetValue(true)));
+ ui->accuracy->removeItem(static_cast<u32>(Settings::CPUAccuracy::DebugMode) +
+ ConfigurationShared::USE_GLOBAL_OFFSET);
+
+ ConfigurationShared::SetColoredTristate(ui->cpuopt_unsafe_unfuse_fma,
+ Settings::values.cpuopt_unsafe_unfuse_fma,
+ cpuopt_unsafe_unfuse_fma);
+ ConfigurationShared::SetColoredTristate(ui->cpuopt_unsafe_reduce_fp_error,
+ Settings::values.cpuopt_unsafe_reduce_fp_error,
+ cpuopt_unsafe_reduce_fp_error);
+ ConfigurationShared::SetColoredTristate(ui->cpuopt_unsafe_inaccurate_nan,
+ Settings::values.cpuopt_unsafe_inaccurate_nan,
+ cpuopt_unsafe_inaccurate_nan);
+}
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 @@
#include <QWidget>
#include "common/settings.h"
+namespace ConfigurationShared {
+enum class CheckState;
+}
+
namespace Ui {
class ConfigureCpu;
}
@@ -30,5 +34,11 @@ private:
void SetConfiguration();
+ void SetupPerGameUI();
+
std::unique_ptr<Ui::ConfigureCpu> ui;
+
+ ConfigurationShared::CheckState cpuopt_unsafe_unfuse_fma;
+ ConfigurationShared::CheckState cpuopt_unsafe_reduce_fp_error;
+ ConfigurationShared::CheckState cpuopt_unsafe_inaccurate_nan;
};
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 @@
</property>
<layout class="QVBoxLayout">
<item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="QLabel">
- <property name="text">
- <string>Accuracy:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="accuracy">
- <item>
+ <widget class="QWidget" name="widget_accuracy" native="true">
+ <layout class="QHBoxLayout" name="layout_accuracy">
+ <item>
+ <widget class="QLabel" name="label">
<property name="text">
- <string>Accurate</string>
+ <string>Accuracy:</string>
</property>
- </item>
- <item>
- <property name="text">
- <string>Unsafe</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Enable Debug Mode</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="accuracy">
+ <item>
+ <property name="text">
+ <string>Accurate</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Unsafe</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Enable Debug Mode</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</item>
<item>
- <widget class="QLabel">
- <property name="wordWrap">
- <bool>1</bool>
- </property>
+ <widget class="QLabel" name="label">
<property name="text">
- <string>We recommend setting accuracy to "Accurate".</string>
+ <string>We recommend setting accuracy to &quot;Accurate&quot;.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
</property>
</widget>
</item>
@@ -76,49 +78,49 @@
</property>
<layout class="QVBoxLayout">
<item>
- <widget class="QLabel">
- <property name="wordWrap">
- <bool>1</bool>
- </property>
+ <widget class="QLabel" name="label">
<property name="text">
<string>These settings reduce accuracy for speed.</string>
</property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cpuopt_unsafe_unfuse_fma">
- <property name="text">
- <string>Unfuse FMA (improve performance on CPUs without FMA)</string>
- </property>
<property name="toolTip">
<string>
&lt;div&gt;This option improves speed by reducing accuracy of fused-multiply-add instructions on CPUs without native FMA support.&lt;/div&gt;
</string>
</property>
+ <property name="text">
+ <string>Unfuse FMA (improve performance on CPUs without FMA)</string>
+ </property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cpuopt_unsafe_reduce_fp_error">
- <property name="text">
- <string>Faster FRSQRTE and FRECPE</string>
- </property>
<property name="toolTip">
<string>
&lt;div&gt;This option improves the speed of some approximate floating-point functions by using less accurate native approximations.&lt;/div&gt;
</string>
</property>
+ <property name="text">
+ <string>Faster FRSQRTE and FRECPE</string>
+ </property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cpuopt_unsafe_inaccurate_nan">
- <property name="text">
- <string>Inaccurate NaN handling</string>
- </property>
<property name="toolTip">
<string>
&lt;div&gt;This option improves speed by removing NaN checking. Please note this also reduces accuracy of certain floating-point instructions.&lt;/div&gt;
</string>
</property>
+ <property name="text">
+ <string>Inaccurate NaN handling</string>
+ </property>
</widget>
</item>
</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() {
}
void ConfigureGeneral::ApplyConfiguration() {
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, ui->use_multi_core,
+ use_multi_core);
+
if (Settings::IsConfiguringGlobal()) {
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked();
@@ -62,13 +65,7 @@ void ConfigureGeneral::ApplyConfiguration() {
Qt::Checked);
Settings::values.frame_limit.SetValue(ui->frame_limit->value());
}
- if (Settings::values.use_multi_core.UsingGlobal()) {
- Settings::values.use_multi_core.SetValue(ui->use_multi_core->isChecked());
- }
} else {
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core,
- ui->use_multi_core, use_multi_core);
-
bool global_frame_limit = use_frame_limit == ConfigurationShared::CheckState::Global;
Settings::values.use_frame_limit.SetGlobal(global_frame_limit);
Settings::values.frame_limit.SetGlobal(global_frame_limit);
@@ -94,6 +91,9 @@ void ConfigureGeneral::RetranslateUI() {
void ConfigureGeneral::SetupPerGameUI() {
if (Settings::IsConfiguringGlobal()) {
+ // Disables each setting if:
+ // - A game is running (thus settings in use), and
+ // - A non-global setting is applied.
ui->toggle_frame_limit->setEnabled(Settings::values.use_frame_limit.UsingGlobal());
ui->frame_limit->setEnabled(Settings::values.frame_limit.UsingGlobal());
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() {
}
void ConfigureGraphics::ApplyConfiguration() {
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.fullscreen_mode,
+ ui->fullscreen_mode_combobox);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio,
+ ui->aspect_ratio_combobox);
+
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache,
+ ui->use_disk_shader_cache, use_disk_shader_cache);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation,
+ ui->use_asynchronous_gpu_emulation,
+ use_asynchronous_gpu_emulation);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_nvdec_emulation,
+ ui->use_nvdec_emulation, use_nvdec_emulation);
+
if (Settings::IsConfiguringGlobal()) {
// Guard if during game and set to game-specific value
if (Settings::values.renderer_backend.UsingGlobal()) {
@@ -114,22 +127,6 @@ void ConfigureGraphics::ApplyConfiguration() {
if (Settings::values.vulkan_device.UsingGlobal()) {
Settings::values.vulkan_device.SetValue(vulkan_device);
}
- if (Settings::values.fullscreen_mode.UsingGlobal()) {
- Settings::values.fullscreen_mode.SetValue(ui->fullscreen_mode_combobox->currentIndex());
- }
- if (Settings::values.aspect_ratio.UsingGlobal()) {
- Settings::values.aspect_ratio.SetValue(ui->aspect_ratio_combobox->currentIndex());
- }
- if (Settings::values.use_disk_shader_cache.UsingGlobal()) {
- Settings::values.use_disk_shader_cache.SetValue(ui->use_disk_shader_cache->isChecked());
- }
- if (Settings::values.use_asynchronous_gpu_emulation.UsingGlobal()) {
- Settings::values.use_asynchronous_gpu_emulation.SetValue(
- ui->use_asynchronous_gpu_emulation->isChecked());
- }
- if (Settings::values.use_nvdec_emulation.UsingGlobal()) {
- Settings::values.use_nvdec_emulation.SetValue(ui->use_nvdec_emulation->isChecked());
- }
if (Settings::values.bg_red.UsingGlobal()) {
Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF()));
Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF()));
@@ -150,19 +147,6 @@ void ConfigureGraphics::ApplyConfiguration() {
}
}
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.fullscreen_mode,
- ui->fullscreen_mode_combobox);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio,
- ui->aspect_ratio_combobox);
-
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache,
- ui->use_disk_shader_cache, use_disk_shader_cache);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation,
- ui->use_asynchronous_gpu_emulation,
- use_asynchronous_gpu_emulation);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_nvdec_emulation,
- ui->use_nvdec_emulation, use_nvdec_emulation);
-
if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
Settings::values.bg_red.SetGlobal(true);
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() {
ui->gpu_accuracy->currentIndex() -
((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET));
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy,
+ ui->anisotropic_filtering_combobox);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, use_vsync);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders,
+ ui->use_assembly_shaders, use_assembly_shaders);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders,
+ ui->use_asynchronous_shaders,
+ use_asynchronous_shaders);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time,
+ ui->use_fast_gpu_time, use_fast_gpu_time);
+
if (Settings::IsConfiguringGlobal()) {
// Must guard in case of a during-game configuration when set to be game-specific.
if (Settings::values.gpu_accuracy.UsingGlobal()) {
Settings::values.gpu_accuracy.SetValue(gpu_accuracy);
}
- if (Settings::values.use_vsync.UsingGlobal()) {
- Settings::values.use_vsync.SetValue(ui->use_vsync->isChecked());
- }
- if (Settings::values.use_assembly_shaders.UsingGlobal()) {
- Settings::values.use_assembly_shaders.SetValue(ui->use_assembly_shaders->isChecked());
- }
- if (Settings::values.use_asynchronous_shaders.UsingGlobal()) {
- Settings::values.use_asynchronous_shaders.SetValue(
- ui->use_asynchronous_shaders->isChecked());
- }
- if (Settings::values.use_asynchronous_shaders.UsingGlobal()) {
- Settings::values.use_asynchronous_shaders.SetValue(
- ui->use_asynchronous_shaders->isChecked());
- }
- if (Settings::values.use_fast_gpu_time.UsingGlobal()) {
- Settings::values.use_fast_gpu_time.SetValue(ui->use_fast_gpu_time->isChecked());
- }
- if (Settings::values.max_anisotropy.UsingGlobal()) {
- Settings::values.max_anisotropy.SetValue(
- ui->anisotropic_filtering_combobox->currentIndex());
- }
} else {
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy,
- ui->anisotropic_filtering_combobox);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync,
- use_vsync);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders,
- ui->use_assembly_shaders, use_assembly_shaders);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders,
- ui->use_asynchronous_shaders,
- use_asynchronous_shaders);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time,
- ui->use_fast_gpu_time, use_fast_gpu_time);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy,
- ui->anisotropic_filtering_combobox);
-
if (ui->gpu_accuracy->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
Settings::values.gpu_accuracy.SetGlobal(true);
} 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;
void ConfigurePerGame::ApplyConfiguration() {
ui->addonsTab->ApplyConfiguration();
ui->generalTab->ApplyConfiguration();
+ ui->cpuTab->ApplyConfiguration();
ui->systemTab->ApplyConfiguration();
ui->graphicsTab->ApplyConfiguration();
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 @@
<string>System</string>
</attribute>
</widget>
+ <widget class="ConfigureCpu" name="cpuTab">
+ <attribute name="title">
+ <string>CPU</string>
+ </attribute>
+ </widget>
<widget class="ConfigureGraphics" name="graphicsTab">
<attribute name="title">
<string>Graphics</string>
@@ -311,6 +316,12 @@
<header>configuration/configure_per_game_addons.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>ConfigureCpu</class>
+ <extends>QWidget</extends>
+ <header>configuration/configure_cpu.h</header>
+ <container>1</container>
+ </customwidget>
</customwidgets>
<resources/>
<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() {
QStringLiteral("%1")
.arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'})
.toUpper();
- const auto rtc_time = Settings::values.custom_rtc.GetValue().value_or(
+ const auto rtc_time = Settings::values.custom_rtc.value_or(
std::chrono::seconds(QDateTime::currentSecsSinceEpoch()));
ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value());
@@ -73,9 +73,8 @@ void ConfigureSystem::SetConfiguration() {
Settings::values.rng_seed.UsingGlobal());
ui->rng_seed_edit->setText(rng_seed);
- ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.GetValue().has_value());
- ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() &&
- Settings::values.rng_seed.UsingGlobal());
+ ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value());
+ ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value());
ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count()));
if (Settings::IsConfiguringGlobal()) {
@@ -109,17 +108,17 @@ void ConfigureSystem::ApplyConfiguration() {
// Allow setting custom RTC even if system is powered on,
// to allow in-game time to be fast forwarded
- if (Settings::values.custom_rtc.UsingGlobal()) {
+ if (Settings::IsConfiguringGlobal()) {
if (ui->custom_rtc_checkbox->isChecked()) {
- Settings::values.custom_rtc.SetValue(
- std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()));
+ Settings::values.custom_rtc =
+ std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch());
if (system.IsPoweredOn()) {
- const s64 posix_time{Settings::values.custom_rtc.GetValue()->count() +
+ const s64 posix_time{Settings::values.custom_rtc->count() +
Service::Time::TimeManager::GetExternalTimeZoneOffset()};
system.GetTimeManager().UpdateLocalSystemClockTime(posix_time);
}
} else {
- Settings::values.custom_rtc.SetValue(std::nullopt);
+ Settings::values.custom_rtc = std::nullopt;
}
}
@@ -127,21 +126,14 @@ void ConfigureSystem::ApplyConfiguration() {
return;
}
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.language_index, ui->combo_language);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.region_index, ui->combo_region);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.time_zone_index,
+ ui->combo_time_zone);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound);
+
if (Settings::IsConfiguringGlobal()) {
// Guard if during game and set to game-specific value
- if (Settings::values.language_index.UsingGlobal()) {
- Settings::values.language_index.SetValue(ui->combo_language->currentIndex());
- }
- if (Settings::values.region_index.UsingGlobal()) {
- Settings::values.region_index.SetValue(ui->combo_region->currentIndex());
- }
- if (Settings::values.time_zone_index.UsingGlobal()) {
- Settings::values.time_zone_index.SetValue(ui->combo_time_zone->currentIndex());
- }
- if (Settings::values.sound_index.UsingGlobal()) {
- Settings::values.sound_index.SetValue(ui->combo_sound->currentIndex());
- }
-
if (Settings::values.rng_seed.UsingGlobal()) {
if (ui->rng_seed_checkbox->isChecked()) {
Settings::values.rng_seed.SetValue(
@@ -151,13 +143,6 @@ void ConfigureSystem::ApplyConfiguration() {
}
}
} else {
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.language_index,
- ui->combo_language);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.region_index, ui->combo_region);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.time_zone_index,
- ui->combo_time_zone);
- ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound);
-
switch (use_rng_seed) {
case ConfigurationShared::CheckState::On:
case ConfigurationShared::CheckState::Off:
@@ -177,26 +162,6 @@ void ConfigureSystem::ApplyConfiguration() {
case ConfigurationShared::CheckState::Count:
break;
}
-
- switch (use_custom_rtc) {
- case ConfigurationShared::CheckState::On:
- case ConfigurationShared::CheckState::Off:
- Settings::values.custom_rtc.SetGlobal(false);
- if (ui->custom_rtc_checkbox->isChecked()) {
- Settings::values.custom_rtc.SetValue(
- std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()));
- } else {
- Settings::values.custom_rtc.SetValue(std::nullopt);
- }
- break;
- case ConfigurationShared::CheckState::Global:
- Settings::values.custom_rtc.SetGlobal(false);
- Settings::values.custom_rtc.SetValue(std::nullopt);
- Settings::values.custom_rtc.SetGlobal(true);
- break;
- case ConfigurationShared::CheckState::Count:
- break;
- }
}
system.ApplySettings();
@@ -227,8 +192,6 @@ void ConfigureSystem::SetupPerGameUI() {
ui->combo_sound->setEnabled(Settings::values.sound_index.UsingGlobal());
ui->rng_seed_checkbox->setEnabled(Settings::values.rng_seed.UsingGlobal());
ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.UsingGlobal());
- ui->custom_rtc_checkbox->setEnabled(Settings::values.custom_rtc.UsingGlobal());
- ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.UsingGlobal());
return;
}
@@ -246,8 +209,7 @@ void ConfigureSystem::SetupPerGameUI() {
ui->rng_seed_checkbox, Settings::values.rng_seed.UsingGlobal(),
Settings::values.rng_seed.GetValue().has_value(),
Settings::values.rng_seed.GetValue(true).has_value(), use_rng_seed);
- ConfigurationShared::SetColoredTristate(
- ui->custom_rtc_checkbox, Settings::values.custom_rtc.UsingGlobal(),
- Settings::values.custom_rtc.GetValue().has_value(),
- Settings::values.custom_rtc.GetValue(true).has_value(), use_custom_rtc);
+
+ ui->custom_rtc_checkbox->setVisible(false);
+ ui->custom_rtc_edit->setVisible(false);
}
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() {
const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false);
if (custom_rtc_enabled) {
- Settings::values.custom_rtc.SetValue(
- std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0)));
+ Settings::values.custom_rtc =
+ std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0));
} else {
- Settings::values.custom_rtc.SetValue(std::nullopt);
+ Settings::values.custom_rtc = std::nullopt;
}
Settings::values.language_index.SetValue(