summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/settings.cpp52
-rw-r--r--src/common/settings.h620
-rw-r--r--src/yuzu/configuration/config.cpp586
-rw-r--r--src/yuzu/configuration/config.h13
-rw-r--r--src/yuzu/configuration/configuration_shared.cpp19
-rw-r--r--src/yuzu/configuration/configuration_shared.h22
-rw-r--r--src/yuzu/uisettings.h90
-rw-r--r--src/yuzu_cmd/config.cpp167
-rw-r--r--src/yuzu_cmd/config.h1
9 files changed, 700 insertions, 870 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 696929479..59934803e 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -144,6 +144,56 @@ float Volume() {
return values.volume.GetValue() / static_cast<f32>(values.volume.GetDefault());
}
+const char* TranslateCategory(Category category) {
+ switch (category) {
+ case Category::Audio:
+ return "Audio";
+ case Category::Core:
+ return "Core";
+ case Category::Cpu:
+ return "Cpu";
+ case Category::Renderer:
+ return "Renderer";
+ case Category::System:
+ return "System";
+ case Category::DataStorage:
+ return "Data Storage";
+ case Category::Debugging:
+ return "Debugging";
+ case Category::Miscellaneous:
+ return "Miscellaneous";
+ case Category::Network:
+ return "Network";
+ case Category::WebService:
+ return "WebService";
+ case Category::AddOns:
+ return "DisabledAddOns";
+ case Category::Controls:
+ return "Controls";
+ case Category::Ui:
+ return "UI";
+ case Category::UiLayout:
+ return "UiLayout";
+ case Category::UiGameList:
+ return "UiGameList";
+ case Category::Screenshots:
+ return "Screenshots";
+ case Category::Shortcuts:
+ return "Shortcuts";
+ case Category::Multiplayer:
+ return "Multiplayer";
+ case Category::Services:
+ return "Services";
+ case Category::Paths:
+ return "Paths";
+ case Category::MaxEnum:
+ break;
+ case Category::AdvancedGraphics:
+ return "Renderer";
+ }
+ return "Miscellaneous";
+}
+
void UpdateRescalingInfo() {
const auto setup = values.resolution_setup.GetValue();
auto& info = values.resolution_info;
@@ -212,7 +262,7 @@ void RestoreGlobalState(bool is_powered_on) {
return;
}
- for (const auto& reset : global_reset_registry) {
+ for (const auto& reset : values.linkage.restore_functions) {
reset();
}
}
diff --git a/src/common/settings.h b/src/common/settings.h
index 999f8b5be..df4bcb053 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -9,7 +9,9 @@
#include <functional>
#include <map>
#include <optional>
+#include <stdexcept>
#include <string>
+#include <typeindex>
#include <utility>
#include <vector>
@@ -104,6 +106,33 @@ enum class AstcRecompression : u32 {
Bc3 = 2,
};
+enum class Category : u32 {
+ Audio,
+ Core,
+ Cpu,
+ Renderer,
+ AdvancedGraphics,
+ System,
+ DataStorage,
+ Debugging,
+ Miscellaneous,
+ Network,
+ WebService,
+ AddOns,
+ Controls,
+ Ui,
+ UiLayout,
+ UiGameList,
+ Screenshots,
+ Shortcuts,
+ Multiplayer,
+ Services,
+ Paths,
+ MaxEnum,
+};
+
+const char* TranslateCategory(Settings::Category category);
+
struct ResolutionScalingInfo {
u32 up_scale{1};
u32 down_shift{0};
@@ -127,15 +156,40 @@ struct ResolutionScalingInfo {
}
};
-static std::forward_list<std::function<void()>> global_reset_registry;
+class BasicSetting {
+protected:
+ explicit BasicSetting() = default;
+
+public:
+ virtual ~BasicSetting() = default;
+
+ virtual Category Category() const = 0;
+ virtual constexpr bool Switchable() const = 0;
+ virtual std::string ToString() const = 0;
+ virtual void LoadString(const std::string& load) = 0;
+ virtual const std::string& GetLabel() const = 0;
+ virtual std::string DefaultToString() const = 0;
+ virtual bool Save() const = 0;
+ virtual std::type_index TypeId() const = 0;
+ virtual void SetGlobal(bool global) {}
+ virtual bool UsingGlobal() const {
+ return false;
+ }
+};
+
+class Linkage {
+public:
+ std::map<Category, std::forward_list<BasicSetting*>> by_category;
+ std::vector<std::function<void()>> restore_functions;
+};
-/** The Setting class is a simple resource manager. It defines a label and default value alongside
- * the actual value of the setting for simpler and less-error prone use with frontend
- * configurations. Specifying a default value and label is required. A minimum and maximum range can
- * be specified for sanitization.
+/** The Setting class is a simple resource manager. It defines a label and default value
+ * alongside the actual value of the setting for simpler and less-error prone use with frontend
+ * configurations. Specifying a default value and label is required. A minimum and maximum range
+ * can be specified for sanitization.
*/
-template <typename Type, bool ranged = false>
-class Setting {
+template <typename Type, bool ranged = false, bool save = true>
+class Setting : public BasicSetting {
protected:
Setting() = default;
@@ -151,27 +205,36 @@ public:
/**
* Sets a default value, label, and setting value.
*
+ * @param linkage Setting registry
* @param default_val Initial value of the setting, and default value of the setting
* @param name Label for the setting
+ * @param category_ Category of the setting AKA INI group
*/
- explicit Setting(const Type& default_val, const std::string& name)
+ explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name,
+ enum Category category_)
requires(!ranged)
- : value{default_val}, default_value{default_val}, label{name} {}
+ : value{default_val}, default_value{default_val}, label{name}, category{category_} {
+ linkage.by_category[category].push_front(this);
+ }
virtual ~Setting() = default;
/**
* Sets a default value, minimum value, maximum value, and label.
*
+ * @param linkage Setting registry
* @param default_val Initial value of the setting, and default value of the setting
* @param min_val Sets the minimum allowed value of the setting
* @param max_val Sets the maximum allowed value of the setting
* @param name Label for the setting
+ * @param category_ Category of the setting AKA INI group
*/
- explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val,
- const std::string& name)
+ explicit Setting(Linkage& linkage, const Type& default_val, const Type& min_val,
+ const Type& max_val, const std::string& name, enum Category category_)
requires(ranged)
- : value{default_val},
- default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {}
+ : value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val},
+ label{name}, category{category_} {
+ linkage.by_category[category].push_front(this);
+ }
/**
* Returns a reference to the setting's value.
@@ -206,11 +269,62 @@ public:
*
* @returns A reference to the label
*/
- [[nodiscard]] const std::string& GetLabel() const {
+ [[nodiscard]] const std::string& GetLabel() const override {
return label;
}
/**
+ * Returns the setting's category AKA INI group.
+ *
+ * @returns The setting's category
+ */
+ [[nodiscard]] enum Category Category() const override {
+ return category;
+ }
+
+ /**
+ * Returns whether the current setting is Switchable.
+ *
+ * @returns If the setting is a SwitchableSetting
+ */
+ [[nodiscard]] virtual constexpr bool Switchable() const override {
+ return false;
+ }
+
+private:
+ std::string ToString(const Type& value_) const {
+ if constexpr (std::is_same<Type, std::string>()) {
+ return value_;
+ } else if constexpr (std::is_same<Type, std::optional<u32>>()) {
+ return value_.has_value() ? std::to_string(*value_) : "0";
+ } else if constexpr (std::is_same<Type, bool>()) {
+ return value_ ? "true" : "false";
+ } else {
+ return std::to_string(static_cast<u64>(value_));
+ }
+ }
+
+public:
+ /**
+ * Converts the value of the setting to a std::string. Respects the global state if the setting
+ * has one.
+ *
+ * @returns The current setting as a std::string
+ */
+ std::string ToString() const override {
+ return ToString(this->GetValue());
+ }
+
+ /**
+ * Returns the default value of the setting as a std::string.
+ *
+ * @returns The default value as a string.
+ */
+ std::string DefaultToString() const override {
+ return ToString(default_value);
+ }
+
+ /**
* Assigns a value to the setting.
*
* @param val The desired setting value
@@ -232,12 +346,58 @@ public:
return value;
}
+ /**
+ * Converts the given value to the Setting's type of value. Uses SetValue to enter the setting,
+ * thus respecting its constraints.
+ *
+ * @param input The desired value
+ */
+ void LoadString(const std::string& input) override {
+ if (input.empty()) {
+ this->SetValue(this->GetDefault());
+ return;
+ }
+ try {
+ if constexpr (std::is_same<Type, std::string>()) {
+ this->SetValue(input);
+ } else if constexpr (std::is_same<Type, std::optional<u32>>()) {
+ this->SetValue(static_cast<u32>(std::stoll(input)));
+ } else if constexpr (std::is_same<Type, bool>()) {
+ this->SetValue(input == "true");
+ } else {
+ this->SetValue(static_cast<Type>(std::stoll(input)));
+ }
+ } catch (std::invalid_argument) {
+ this->SetValue(this->GetDefault());
+ }
+ }
+
+ /**
+ * Returns the save preference of the setting i.e. when saving or reading the setting from a
+ * frontend, whether this setting should be skipped.
+ *
+ * @returns The save preference
+ */
+ virtual bool Save() const override {
+ return save;
+ }
+
+ /**
+ * Gives us another way to identify the setting without having to go through a string.
+ *
+ * @returns the type_index of the setting's type
+ */
+ virtual std::type_index TypeId() const override {
+ return std::type_index(typeid(Type));
+ }
+
protected:
- Type value{}; ///< The setting
- const Type default_value{}; ///< The default value
- const Type maximum{}; ///< Maximum allowed value of the setting
- const Type minimum{}; ///< Minimum allowed value of the setting
- const std::string label{}; ///< The setting's label
+ Type value{}; ///< The setting
+ const Type default_value{}; ///< The default value
+ const Type maximum{}; ///< Maximum allowed value of the setting
+ const Type minimum{}; ///< Minimum allowed value of the setting
+ const std::string label{}; ///< The setting's label
+ const enum Category category; ///< The setting's category AKA INI group
};
/**
@@ -248,35 +408,40 @@ protected:
*
* By default, the global setting is used.
*/
-template <typename Type, bool ranged = false>
-class SwitchableSetting : virtual public Setting<Type, ranged> {
+template <typename Type, bool ranged = false, bool save = true>
+class SwitchableSetting : virtual public Setting<Type, ranged, save> {
public:
/**
* Sets a default value, label, and setting value.
*
+ * @param linkage Setting registry
* @param default_val Initial value of the setting, and default value of the setting
* @param name Label for the setting
+ * @param category_ Category of the setting AKA INI group
*/
- explicit SwitchableSetting(const Type& default_val, const std::string& name)
+ explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name,
+ Category category)
requires(!ranged)
- : Setting<Type>{default_val, name} {
- global_reset_registry.push_front([this]() { this->SetGlobal(true); });
+ : Setting<Type, false, save>{linkage, default_val, name, category} {
+ linkage.restore_functions.emplace_back([this]() { this->SetGlobal(true); });
}
virtual ~SwitchableSetting() = default;
/**
* Sets a default value, minimum value, maximum value, and label.
*
+ * @param linkage Setting registry
* @param default_val Initial value of the setting, and default value of the setting
* @param min_val Sets the minimum allowed value of the setting
* @param max_val Sets the maximum allowed value of the setting
* @param name Label for the setting
+ * @param category_ Category of the setting AKA INI group
*/
- explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val,
- const std::string& name)
+ explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val,
+ const Type& max_val, const std::string& name, Category category)
requires(ranged)
- : Setting<Type, true>{default_val, min_val, max_val, name} {
- global_reset_registry.push_front([this]() { this->SetGlobal(true); });
+ : Setting<Type, true, save>{linkage, default_val, min_val, max_val, name, category} {
+ linkage.restore_functions.emplace_back([this]() { this->SetGlobal(true); });
}
/**
@@ -285,7 +450,7 @@ public:
*
* @param to_global Whether to use the global or custom setting.
*/
- void SetGlobal(bool to_global) {
+ void SetGlobal(bool to_global) override {
use_global = to_global;
}
@@ -294,7 +459,7 @@ public:
*
* @returns The global state
*/
- [[nodiscard]] bool UsingGlobal() const {
+ [[nodiscard]] bool UsingGlobal() const override {
return use_global;
}
@@ -333,6 +498,10 @@ public:
}
}
+ [[nodiscard]] virtual constexpr bool Switchable() const override {
+ return true;
+ }
+
/**
* Assigns the current setting value depending on the global state.
*
@@ -405,211 +574,290 @@ struct TouchFromButtonMap {
};
struct Values {
+ Linkage linkage{};
+
// Audio
- Setting<std::string> sink_id{"auto", "output_engine"};
- Setting<std::string> audio_output_device_id{"auto", "output_device"};
- Setting<std::string> audio_input_device_id{"auto", "input_device"};
- Setting<bool> audio_muted{false, "audio_muted"};
- SwitchableSetting<u8, true> volume{100, 0, 200, "volume"};
- Setting<bool> dump_audio_commands{false, "dump_audio_commands"};
+ Setting<std::string> sink_id{linkage, "auto", "output_engine", Category::Audio};
+ Setting<std::string> audio_output_device_id{linkage, "auto", "output_device", Category::Audio};
+ Setting<std::string> audio_input_device_id{linkage, "auto", "input_device", Category::Audio};
+ Setting<bool, false, false> audio_muted{linkage, false, "audio_muted", Category::Audio};
+ SwitchableSetting<u8, true> volume{linkage, 100, 0, 200, "volume", Category::Audio};
+ Setting<bool, false, false> dump_audio_commands{linkage, false, "dump_audio_commands",
+ Category::Audio};
// Core
- SwitchableSetting<bool> use_multi_core{true, "use_multi_core"};
- SwitchableSetting<bool> use_unsafe_extended_memory_layout{false,
- "use_unsafe_extended_memory_layout"};
+ SwitchableSetting<bool> use_multi_core{linkage, true, "use_multi_core", Category::Core};
+ SwitchableSetting<bool> use_unsafe_extended_memory_layout{
+ linkage, false, "use_unsafe_extended_memory_layout", Category::Core};
// Cpu
- SwitchableSetting<CPUAccuracy, true> cpu_accuracy{CPUAccuracy::Auto, CPUAccuracy::Auto,
- CPUAccuracy::Paranoid, "cpu_accuracy"};
+ SwitchableSetting<CPUAccuracy, true> cpu_accuracy{linkage, CPUAccuracy::Auto,
+ CPUAccuracy::Auto, CPUAccuracy::Paranoid,
+ "cpu_accuracy", Category::Cpu};
// TODO: remove cpu_accuracy_first_time, migration setting added 8 July 2021
- Setting<bool> cpu_accuracy_first_time{true, "cpu_accuracy_first_time"};
- Setting<bool> cpu_debug_mode{false, "cpu_debug_mode"};
-
- Setting<bool> cpuopt_page_tables{true, "cpuopt_page_tables"};
- Setting<bool> cpuopt_block_linking{true, "cpuopt_block_linking"};
- Setting<bool> cpuopt_return_stack_buffer{true, "cpuopt_return_stack_buffer"};
- Setting<bool> cpuopt_fast_dispatcher{true, "cpuopt_fast_dispatcher"};
- Setting<bool> cpuopt_context_elimination{true, "cpuopt_context_elimination"};
- Setting<bool> cpuopt_const_prop{true, "cpuopt_const_prop"};
- Setting<bool> cpuopt_misc_ir{true, "cpuopt_misc_ir"};
- Setting<bool> cpuopt_reduce_misalign_checks{true, "cpuopt_reduce_misalign_checks"};
- Setting<bool> cpuopt_fastmem{true, "cpuopt_fastmem"};
- Setting<bool> cpuopt_fastmem_exclusives{true, "cpuopt_fastmem_exclusives"};
- Setting<bool> cpuopt_recompile_exclusives{true, "cpuopt_recompile_exclusives"};
- Setting<bool> cpuopt_ignore_memory_aborts{true, "cpuopt_ignore_memory_aborts"};
-
- SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{true, "cpuopt_unsafe_unfuse_fma"};
- SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{true, "cpuopt_unsafe_reduce_fp_error"};
+ Setting<bool> cpu_accuracy_first_time{linkage, true, "cpu_accuracy_first_time", Category::Cpu};
+ Setting<bool> cpu_debug_mode{linkage, false, "cpu_debug_mode", Category::Cpu};
+
+ Setting<bool> cpuopt_page_tables{linkage, true, "cpuopt_page_tables", Category::Cpu};
+ Setting<bool> cpuopt_block_linking{linkage, true, "cpuopt_block_linking", Category::Cpu};
+ Setting<bool> cpuopt_return_stack_buffer{linkage, true, "cpuopt_return_stack_buffer",
+ Category::Cpu};
+ Setting<bool> cpuopt_fast_dispatcher{linkage, true, "cpuopt_fast_dispatcher", Category::Cpu};
+ Setting<bool> cpuopt_context_elimination{linkage, true, "cpuopt_context_elimination",
+ Category::Cpu};
+ Setting<bool> cpuopt_const_prop{linkage, true, "cpuopt_const_prop", Category::Cpu};
+ Setting<bool> cpuopt_misc_ir{linkage, true, "cpuopt_misc_ir", Category::Cpu};
+ Setting<bool> cpuopt_reduce_misalign_checks{linkage, true, "cpuopt_reduce_misalign_checks",
+ Category::Cpu};
+ Setting<bool> cpuopt_fastmem{linkage, true, "cpuopt_fastmem", Category::Cpu};
+ Setting<bool> cpuopt_fastmem_exclusives{linkage, true, "cpuopt_fastmem_exclusives",
+ Category::Cpu};
+ Setting<bool> cpuopt_recompile_exclusives{linkage, true, "cpuopt_recompile_exclusives",
+ Category::Cpu};
+ Setting<bool> cpuopt_ignore_memory_aborts{linkage, true, "cpuopt_ignore_memory_aborts",
+ Category::Cpu};
+
+ SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{linkage, true, "cpuopt_unsafe_unfuse_fma",
+ Category::Cpu};
+ SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{
+ linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::Cpu};
SwitchableSetting<bool> cpuopt_unsafe_ignore_standard_fpcr{
- true, "cpuopt_unsafe_ignore_standard_fpcr"};
- SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{true, "cpuopt_unsafe_inaccurate_nan"};
- SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{true, "cpuopt_unsafe_fastmem_check"};
+ linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::Cpu};
+ SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{
+ linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::Cpu};
+ SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{
+ linkage, true, "cpuopt_unsafe_fastmem_check", Category::Cpu};
SwitchableSetting<bool> cpuopt_unsafe_ignore_global_monitor{
- true, "cpuopt_unsafe_ignore_global_monitor"};
+ linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::Cpu};
// Renderer
SwitchableSetting<RendererBackend, true> renderer_backend{
- RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, "backend"};
- SwitchableSetting<bool> async_presentation{false, "async_presentation"};
- SwitchableSetting<bool> renderer_force_max_clock{false, "force_max_clock"};
- Setting<bool> renderer_debug{false, "debug"};
- Setting<bool> renderer_shader_feedback{false, "shader_feedback"};
- Setting<bool> enable_nsight_aftermath{false, "nsight_aftermath"};
- Setting<bool> disable_shader_loop_safety_checks{false, "disable_shader_loop_safety_checks"};
- SwitchableSetting<int> vulkan_device{0, "vulkan_device"};
+ linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null,
+ "backend", Category::Renderer};
+ SwitchableSetting<bool> async_presentation{linkage, false, "async_presentation",
+ Category::AdvancedGraphics};
+ SwitchableSetting<bool> renderer_force_max_clock{linkage, false, "force_max_clock",
+ Category::AdvancedGraphics};
+ Setting<bool> renderer_debug{linkage, false, "debug", Category::Renderer};
+ Setting<bool> renderer_shader_feedback{linkage, false, "shader_feedback", Category::Renderer};
+ Setting<bool> enable_nsight_aftermath{linkage, false, "nsight_aftermath", Category::Renderer};
+ Setting<bool> disable_shader_loop_safety_checks{
+ linkage, false, "disable_shader_loop_safety_checks", Category::Renderer};
+ SwitchableSetting<int> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer};
ResolutionScalingInfo resolution_info{};
- SwitchableSetting<ResolutionSetup> resolution_setup{ResolutionSetup::Res1X, "resolution_setup"};
- SwitchableSetting<ScalingFilter> scaling_filter{ScalingFilter::Bilinear, "scaling_filter"};
- SwitchableSetting<int, true> fsr_sharpening_slider{25, 0, 200, "fsr_sharpening_slider"};
- SwitchableSetting<AntiAliasing> anti_aliasing{AntiAliasing::None, "anti_aliasing"};
+ SwitchableSetting<ResolutionSetup> resolution_setup{linkage, ResolutionSetup::Res1X,
+ "resolution_setup", Category::Renderer};
+ SwitchableSetting<ScalingFilter> scaling_filter{linkage, ScalingFilter::Bilinear,
+ "scaling_filter", Category::Renderer};
+ SwitchableSetting<int, true> fsr_sharpening_slider{
+ linkage, 25, 0, 200, "fsr_sharpening_slider", Category::Renderer};
+ SwitchableSetting<AntiAliasing> anti_aliasing{linkage, AntiAliasing::None, "anti_aliasing",
+ Category::Renderer};
// *nix platforms may have issues with the borderless windowed fullscreen mode.
// Default to exclusive fullscreen on these platforms for now.
- SwitchableSetting<FullscreenMode, true> fullscreen_mode{
+ SwitchableSetting<FullscreenMode, true> fullscreen_mode{linkage,
#ifdef _WIN32
- FullscreenMode::Borderless,
+ FullscreenMode::Borderless,
#else
- FullscreenMode::Exclusive,
+ FullscreenMode::Exclusive,
#endif
- FullscreenMode::Borderless, FullscreenMode::Exclusive, "fullscreen_mode"};
- SwitchableSetting<int, true> aspect_ratio{0, 0, 4, "aspect_ratio"};
- SwitchableSetting<int, true> max_anisotropy{0, 0, 5, "max_anisotropy"};
- SwitchableSetting<bool> use_speed_limit{true, "use_speed_limit"};
- SwitchableSetting<u16, true> speed_limit{100, 0, 9999, "speed_limit"};
- SwitchableSetting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"};
- SwitchableSetting<GPUAccuracy, true> gpu_accuracy{GPUAccuracy::High, GPUAccuracy::Normal,
- GPUAccuracy::Extreme, "gpu_accuracy"};
- SwitchableSetting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"};
- SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"};
- SwitchableSetting<AstcDecodeMode, true> accelerate_astc{
- AstcDecodeMode::CPU, AstcDecodeMode::CPU, AstcDecodeMode::CPUAsynchronous,
- "accelerate_astc"};
- Setting<VSyncMode, true> vsync_mode{VSyncMode::FIFO, VSyncMode::Immediate,
- VSyncMode::FIFORelaxed, "use_vsync"};
- SwitchableSetting<bool> use_reactive_flushing{true, "use_reactive_flushing"};
- SwitchableSetting<ShaderBackend, true> shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL,
- ShaderBackend::SPIRV, "shader_backend"};
- SwitchableSetting<bool> use_asynchronous_shaders{false, "use_asynchronous_shaders"};
- SwitchableSetting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"};
- SwitchableSetting<bool> use_vulkan_driver_pipeline_cache{true,
- "use_vulkan_driver_pipeline_cache"};
- SwitchableSetting<bool> enable_compute_pipelines{false, "enable_compute_pipelines"};
- SwitchableSetting<AstcRecompression, true> astc_recompression{
- AstcRecompression::Uncompressed, AstcRecompression::Uncompressed, AstcRecompression::Bc3,
- "astc_recompression"};
- SwitchableSetting<bool> use_video_framerate{false, "use_video_framerate"};
- SwitchableSetting<bool> barrier_feedback_loops{true, "barrier_feedback_loops"};
-
- SwitchableSetting<u8> bg_red{0, "bg_red"};
- SwitchableSetting<u8> bg_green{0, "bg_green"};
- SwitchableSetting<u8> bg_blue{0, "bg_blue"};
+ FullscreenMode::Borderless,
+ FullscreenMode::Exclusive,
+ "fullscreen_mode",
+ Category::Renderer};
+ SwitchableSetting<int, true> aspect_ratio{linkage, 0, 0, 4, "aspect_ratio", Category::Renderer};
+ SwitchableSetting<int, true> max_anisotropy{
+ linkage, 0, 0, 5, "max_anisotropy", Category::AdvancedGraphics};
+ SwitchableSetting<bool, false, false> use_speed_limit{linkage, true, "use_speed_limit",
+ Category::Renderer};
+ SwitchableSetting<u16, true> speed_limit{linkage, 100, 0,
+ 9999, "speed_limit", Category::Renderer};
+ SwitchableSetting<bool> use_disk_shader_cache{linkage, true, "use_disk_shader_cache",
+ Category::Renderer};
+ SwitchableSetting<GPUAccuracy, true> gpu_accuracy{
+ linkage, GPUAccuracy::High, GPUAccuracy::Normal, GPUAccuracy::Extreme,
+ "gpu_accuracy", Category::AdvancedGraphics};
+ SwitchableSetting<bool> use_asynchronous_gpu_emulation{
+ linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer};
+ SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::GPU,
+ "nvdec_emulation", Category::Renderer};
+ SwitchableSetting<AstcDecodeMode, true> accelerate_astc{linkage,
+ AstcDecodeMode::CPU,
+ AstcDecodeMode::CPU,
+ AstcDecodeMode::CPUAsynchronous,
+ "accelerate_astc",
+ Category::Renderer};
+ Setting<VSyncMode, true> vsync_mode{
+ linkage, VSyncMode::FIFO, VSyncMode::Immediate, VSyncMode::FIFORelaxed,
+ "use_vsync", Category::Renderer};
+ SwitchableSetting<bool> use_reactive_flushing{linkage, true, "use_reactive_flushing",
+ Category::Renderer};
+ SwitchableSetting<ShaderBackend, true> shader_backend{
+ linkage, ShaderBackend::GLSL, ShaderBackend::GLSL, ShaderBackend::SPIRV,
+ "shader_backend", Category::Renderer};
+ SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
+ Category::Renderer};
+ SwitchableSetting<bool> use_fast_gpu_time{linkage, true, "use_fast_gpu_time",
+ Category::AdvancedGraphics};
+ SwitchableSetting<bool> use_vulkan_driver_pipeline_cache{
+ linkage, true, "use_vulkan_driver_pipeline_cache", Category::AdvancedGraphics};
+ SwitchableSetting<bool> enable_compute_pipelines{linkage, false, "enable_compute_pipelines",
+ Category::AdvancedGraphics};
+ SwitchableSetting<AstcRecompression, true> astc_recompression{linkage,
+ AstcRecompression::Uncompressed,
+ AstcRecompression::Uncompressed,
+ AstcRecompression::Bc3,
+ "astc_recompression",
+ Category::AdvancedGraphics};
+ SwitchableSetting<bool> use_video_framerate{linkage, false, "use_video_framerate",
+ Category::AdvancedGraphics};
+ SwitchableSetting<bool> barrier_feedback_loops{linkage, true, "barrier_feedback_loops",
+ Category::AdvancedGraphics};
+
+ SwitchableSetting<u8> bg_red{linkage, 0, "bg_red", Category::Renderer};
+ SwitchableSetting<u8> bg_green{linkage, 0, "bg_green", Category::Renderer};
+ SwitchableSetting<u8> bg_blue{linkage, 0, "bg_blue", Category::Renderer};
// System
- SwitchableSetting<bool> rng_seed_enabled{false, "rng_seed_enabled"};
- SwitchableSetting<u32> rng_seed{0, "rng_seed"};
- Setting<std::string> device_name{"Yuzu", "device_name"};
+ SwitchableSetting<bool> rng_seed_enabled{linkage, false, "rng_seed_enabled", Category::System};
+ SwitchableSetting<u32> rng_seed{linkage, 0, "rng_seed", Category::System};
+ Setting<std::string> device_name{linkage, "Yuzu", "device_name", Category::System};
// Measured in seconds since epoch
- SwitchableSetting<bool> custom_rtc_enabled{false, "custom_rtc_enabled"};
- SwitchableSetting<s64> custom_rtc{0, "custom_rtc"};
+ Setting<bool> custom_rtc_enabled{linkage, false, "custom_rtc_enabled", Category::System};
+ Setting<s64> custom_rtc{linkage, 0, "custom_rtc", Category::System};
// Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc`
s64 custom_rtc_differential;
- Setting<s32> current_user{0, "current_user"};
- SwitchableSetting<s32, true> language_index{1, 0, 17, "language_index"};
- SwitchableSetting<s32, true> region_index{1, 0, 6, "region_index"};
- SwitchableSetting<s32, true> time_zone_index{0, 0, 45, "time_zone_index"};
- SwitchableSetting<s32, true> sound_index{1, 0, 2, "sound_index"};
+ Setting<s32> current_user{linkage, 0, "current_user", Category::System};
+ SwitchableSetting<s32, true> language_index{linkage, 1, 0, 17, "language_index",
+ Category::System};
+ SwitchableSetting<s32, true> region_index{linkage, 1, 0, 6, "region_index", Category::System};
+ SwitchableSetting<s32, true> time_zone_index{linkage, 0, 0, 45, "time_zone_index",
+ Category::System};
+ SwitchableSetting<s32, true> sound_index{linkage, 1, 0, 2, "sound_index", Category::System};
+
+ SwitchableSetting<bool> use_docked_mode{linkage, true, "use_docked_mode", Category::System};
// Controls
InputSetting<std::array<PlayerInput, 10>> players;
- SwitchableSetting<bool> use_docked_mode{true, "use_docked_mode"};
-
- Setting<bool> enable_raw_input{false, "enable_raw_input"};
- Setting<bool> controller_navigation{true, "controller_navigation"};
- Setting<bool> enable_joycon_driver{true, "enable_joycon_driver"};
- Setting<bool> enable_procon_driver{false, "enable_procon_driver"};
-
- SwitchableSetting<bool> vibration_enabled{true, "vibration_enabled"};
- SwitchableSetting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"};
-
- SwitchableSetting<bool> motion_enabled{true, "motion_enabled"};
- Setting<std::string> udp_input_servers{"127.0.0.1:26760", "udp_input_servers"};
- Setting<bool> enable_udp_controller{false, "enable_udp_controller"};
-
- Setting<bool> pause_tas_on_load{true, "pause_tas_on_load"};
- Setting<bool> tas_enable{false, "tas_enable"};
- Setting<bool> tas_loop{false, "tas_loop"};
-
- Setting<bool> mouse_panning{false, "mouse_panning"};
- Setting<u8, true> mouse_panning_x_sensitivity{50, 1, 100, "mouse_panning_x_sensitivity"};
- Setting<u8, true> mouse_panning_y_sensitivity{50, 1, 100, "mouse_panning_y_sensitivity"};
- Setting<u8, true> mouse_panning_deadzone_counterweight{20, 0, 100,
- "mouse_panning_deadzone_counterweight"};
- Setting<u8, true> mouse_panning_decay_strength{18, 0, 100, "mouse_panning_decay_strength"};
- Setting<u8, true> mouse_panning_min_decay{6, 0, 100, "mouse_panning_min_decay"};
-
- Setting<bool> mouse_enabled{false, "mouse_enabled"};
- Setting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"};
- Setting<bool> keyboard_enabled{false, "keyboard_enabled"};
-
- Setting<bool> debug_pad_enabled{false, "debug_pad_enabled"};
+ Setting<bool, false,
+// Only read/write enable_raw_input on Windows platforms
+#ifdef _WIN32
+ true
+#else
+ false
+#endif
+ >
+ enable_raw_input{linkage, false, "enable_raw_input", Category::Controls};
+ Setting<bool> controller_navigation{linkage, true, "controller_navigation", Category::Controls};
+ Setting<bool> enable_joycon_driver{linkage, true, "enable_joycon_driver", Category::Controls};
+ Setting<bool> enable_procon_driver{linkage, false, "enable_procon_driver", Category::Controls};
+
+ SwitchableSetting<bool> vibration_enabled{linkage, true, "vibration_enabled",
+ Category::Controls};
+ SwitchableSetting<bool> enable_accurate_vibrations{linkage, false, "enable_accurate_vibrations",
+ Category::Controls};
+
+ SwitchableSetting<bool> motion_enabled{linkage, true, "motion_enabled", Category::Controls};
+ Setting<std::string> udp_input_servers{linkage, "127.0.0.1:26760", "udp_input_servers",
+ Category::Controls};
+ Setting<bool> enable_udp_controller{linkage, false, "enable_udp_controller",
+ Category::Controls};
+
+ Setting<bool> pause_tas_on_load{linkage, true, "pause_tas_on_load", Category::Controls};
+ Setting<bool> tas_enable{linkage, false, "tas_enable", Category::Controls};
+ Setting<bool> tas_loop{linkage, false, "tas_loop", Category::Controls};
+
+ Setting<bool, false, false> mouse_panning{linkage, false, "mouse_panning", Category::Controls};
+ Setting<u8, true> mouse_panning_sensitivity{
+ linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls};
+ Setting<bool> mouse_enabled{linkage, false, "mouse_enabled", Category::Controls};
+
+ Setting<u8, true> mouse_panning_x_sensitivity{
+ linkage, 50, 1, 100, "mouse_panning_x_sensitivity", Category::Controls};
+ Setting<u8, true> mouse_panning_y_sensitivity{
+ linkage, 50, 1, 100, "mouse_panning_y_sensitivity", Category::Controls};
+ Setting<u8, true> mouse_panning_deadzone_counterweight{
+ linkage, 20, 0, 100, "mouse_panning_deadzone_counterweight", Category::Controls};
+ Setting<u8, true> mouse_panning_decay_strength{
+ linkage, 18, 0, 100, "mouse_panning_decay_strength", Category::Controls};
+ Setting<u8, true> mouse_panning_min_decay{
+ linkage, 6, 0, 100, "mouse_panning_min_decay", Category::Controls};
+
+ Setting<bool> emulate_analog_keyboard{linkage, false, "emulate_analog_keyboard",
+ Category::Controls};
+ Setting<bool> keyboard_enabled{linkage, false, "keyboard_enabled", Category::Controls};
+
+ Setting<bool> debug_pad_enabled{linkage, false, "debug_pad_enabled", Category::Controls};
ButtonsRaw debug_pad_buttons;
AnalogsRaw debug_pad_analogs;
TouchscreenInput touchscreen;
- Setting<std::string> touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850", "touch_device"};
- Setting<int> touch_from_button_map_index{0, "touch_from_button_map"};
+ Setting<std::string> touch_device{linkage, "min_x:100,min_y:50,max_x:1800,max_y:850",
+ "touch_device", Category::Controls};
+ Setting<int> touch_from_button_map_index{linkage, 0, "touch_from_button_map",
+ Category::Controls};
std::vector<TouchFromButtonMap> touch_from_button_maps;
- Setting<bool> enable_ring_controller{true, "enable_ring_controller"};
+ Setting<bool> enable_ring_controller{linkage, true, "enable_ring_controller",
+ Category::Controls};
RingconRaw ringcon_analogs;
- Setting<bool> enable_ir_sensor{false, "enable_ir_sensor"};
- Setting<std::string> ir_sensor_device{"auto", "ir_sensor_device"};
+ Setting<bool> enable_ir_sensor{linkage, false, "enable_ir_sensor", Category::Controls};
+ Setting<std::string> ir_sensor_device{linkage, "auto", "ir_sensor_device", Category::Controls};
- Setting<bool> random_amiibo_id{false, "random_amiibo_id"};
+ Setting<bool> random_amiibo_id{linkage, false, "random_amiibo_id", Category::Controls};
// Data Storage
- Setting<bool> use_virtual_sd{true, "use_virtual_sd"};
- Setting<bool> gamecard_inserted{false, "gamecard_inserted"};
- Setting<bool> gamecard_current_game{false, "gamecard_current_game"};
- Setting<std::string> gamecard_path{std::string(), "gamecard_path"};
+ Setting<bool> use_virtual_sd{linkage, true, "use_virtual_sd", Category::DataStorage};
+ Setting<bool> gamecard_inserted{linkage, false, "gamecard_inserted", Category::DataStorage};
+ Setting<bool> gamecard_current_game{linkage, false, "gamecard_current_game",
+ Category::DataStorage};
+ Setting<std::string> gamecard_path{linkage, std::string(), "gamecard_path",
+ Category::DataStorage};
// Debugging
bool record_frame_times;
- Setting<bool> use_gdbstub{false, "use_gdbstub"};
- Setting<u16> gdbstub_port{6543, "gdbstub_port"};
- Setting<std::string> program_args{std::string(), "program_args"};
- Setting<bool> dump_exefs{false, "dump_exefs"};
- Setting<bool> dump_nso{false, "dump_nso"};
- Setting<bool> dump_shaders{false, "dump_shaders"};
- Setting<bool> dump_macros{false, "dump_macros"};
- Setting<bool> enable_fs_access_log{false, "enable_fs_access_log"};
- Setting<bool> reporting_services{false, "reporting_services"};
- Setting<bool> quest_flag{false, "quest_flag"};
- Setting<bool> disable_macro_jit{false, "disable_macro_jit"};
- Setting<bool> disable_macro_hle{false, "disable_macro_hle"};
- Setting<bool> extended_logging{false, "extended_logging"};
- Setting<bool> use_debug_asserts{false, "use_debug_asserts"};
- Setting<bool> use_auto_stub{false, "use_auto_stub"};
- Setting<bool> enable_all_controllers{false, "enable_all_controllers"};
- Setting<bool> create_crash_dumps{false, "create_crash_dumps"};
- Setting<bool> perform_vulkan_check{true, "perform_vulkan_check"};
+ Setting<bool> use_gdbstub{linkage, false, "use_gdbstub", Category::Debugging};
+ Setting<u16> gdbstub_port{linkage, 6543, "gdbstub_port", Category::Debugging};
+ Setting<std::string> program_args{linkage, std::string(), "program_args", Category::Debugging};
+ Setting<bool> dump_exefs{linkage, false, "dump_exefs", Category::Debugging};
+ Setting<bool> dump_nso{linkage, false, "dump_nso", Category::Debugging};
+ Setting<bool, false, false> dump_shaders{linkage, false, "dump_shaders", Category::Debugging};
+ Setting<bool, false, false> dump_macros{linkage, false, "dump_macros", Category::Debugging};
+ Setting<bool> enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging};
+ Setting<bool, false, false> reporting_services{linkage, false, "reporting_services",
+ Category::Debugging};
+ Setting<bool> quest_flag{linkage, false, "quest_flag", Category::Debugging};
+ Setting<bool> disable_macro_jit{linkage, false, "disable_macro_jit", Category::Debugging};
+ Setting<bool> disable_macro_hle{linkage, false, "disable_macro_hle", Category::Debugging};
+ Setting<bool, false, false> extended_logging{linkage, false, "extended_logging",
+ Category::Debugging};
+ Setting<bool> use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging};
+ Setting<bool, false, false> use_auto_stub{linkage, false, "use_auto_stub", Category::Debugging};
+ Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers",
+ Category::Debugging};
+ Setting<bool> create_crash_dumps{linkage, false, "create_crash_dumps", Category::Debugging};
+ Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging};
// Miscellaneous
- Setting<std::string> log_filter{"*:Info", "log_filter"};
- Setting<bool> use_dev_keys{false, "use_dev_keys"};
+ Setting<std::string> log_filter{linkage, "*:Info", "log_filter", Category::Miscellaneous};
+ Setting<bool> use_dev_keys{linkage, false, "use_dev_keys", Category::Miscellaneous};
// Network
- Setting<std::string> network_interface{std::string(), "network_interface"};
+ Setting<std::string> network_interface{linkage, std::string(), "network_interface",
+ Category::Network};
// WebService
- Setting<bool> enable_telemetry{true, "enable_telemetry"};
- Setting<std::string> web_api_url{"https://api.yuzu-emu.org", "web_api_url"};
- Setting<std::string> yuzu_username{std::string(), "yuzu_username"};
- Setting<std::string> yuzu_token{std::string(), "yuzu_token"};
+ Setting<bool> enable_telemetry{linkage, true, "enable_telemetry", Category::WebService};
+ Setting<std::string> web_api_url{linkage, "https://api.yuzu-emu.org", "web_api_url",
+ Category::WebService};
+ Setting<std::string> yuzu_username{linkage, std::string(), "yuzu_username",
+ Category::WebService};
+ Setting<std::string> yuzu_token{linkage, std::string(), "yuzu_token", Category::WebService};
// Add-Ons
std::map<u64, std::vector<std::string>> disabled_addons;
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 786c1222f..f274fe4ea 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include <algorithm>
#include <array>
#include <QKeySequence>
#include <QSettings>
@@ -16,8 +17,11 @@
namespace FS = Common::FS;
-Config::Config(const std::string& config_name, ConfigType config_type) : type(config_type) {
- global = config_type == ConfigType::GlobalConfig;
+Config::Config(const std::string& config_name, ConfigType config_type)
+ : type(config_type), global{config_type == ConfigType::GlobalConfig} {
+
+ settings_map = Settings::values.linkage.by_category;
+ settings_map.merge(UISettings::values.linkage.by_category);
Initialize(config_name);
}
@@ -351,15 +355,9 @@ void Config::ReadPlayerValue(std::size_t player_index) {
player_motions = default_param;
}
}
-
- if (player_index == 0) {
- ReadMousePanningValues();
- }
}
void Config::ReadDebugValues() {
- ReadBasicSetting(Settings::values.debug_pad_enabled);
-
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
const std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
auto& debug_pad_buttons = Settings::values.debug_pad_buttons[i];
@@ -393,14 +391,6 @@ void Config::ReadDebugValues() {
}
}
-void Config::ReadKeyboardValues() {
- ReadBasicSetting(Settings::values.keyboard_enabled);
-}
-
-void Config::ReadMouseValues() {
- ReadBasicSetting(Settings::values.mouse_enabled);
-}
-
void Config::ReadTouchscreenValues() {
Settings::values.touchscreen.enabled =
ReadSetting(QStringLiteral("touchscreen_enabled"), true).toBool();
@@ -414,9 +404,6 @@ void Config::ReadTouchscreenValues() {
}
void Config::ReadHidbusValues() {
- Settings::values.enable_ring_controller =
- ReadSetting(QStringLiteral("enable_ring_controller"), true).toBool();
-
const std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
0, 0, default_ringcon_analogs[0], default_ringcon_analogs[1], 0, 0.05f);
auto& ringcon_analogs = Settings::values.ringcon_analogs;
@@ -430,20 +417,10 @@ void Config::ReadHidbusValues() {
}
}
-void Config::ReadIrCameraValues() {
- ReadBasicSetting(Settings::values.enable_ir_sensor);
- ReadBasicSetting(Settings::values.ir_sensor_device);
-}
-
void Config::ReadAudioValues() {
qt_config->beginGroup(QStringLiteral("Audio"));
- if (global) {
- ReadBasicSetting(Settings::values.sink_id);
- ReadBasicSetting(Settings::values.audio_output_device_id);
- ReadBasicSetting(Settings::values.audio_input_device_id);
- }
- ReadGlobalSetting(Settings::values.volume);
+ ReadCategory(Settings::Category::Audio);
qt_config->endGroup();
}
@@ -451,11 +428,12 @@ void Config::ReadAudioValues() {
void Config::ReadControlValues() {
qt_config->beginGroup(QStringLiteral("Controls"));
+ ReadCategory(Settings::Category::Controls);
+
Settings::values.players.SetGlobal(!IsCustomConfig());
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
ReadPlayerValue(p);
}
- ReadGlobalSetting(Settings::values.use_docked_mode);
// Disable docked mode if handheld is selected
const auto controller_type = Settings::values.players.GetValue()[0].controller_type;
@@ -464,50 +442,18 @@ void Config::ReadControlValues() {
Settings::values.use_docked_mode.SetValue(false);
}
- ReadGlobalSetting(Settings::values.vibration_enabled);
- ReadGlobalSetting(Settings::values.enable_accurate_vibrations);
- ReadGlobalSetting(Settings::values.motion_enabled);
if (IsCustomConfig()) {
qt_config->endGroup();
return;
}
ReadDebugValues();
- ReadKeyboardValues();
- ReadMouseValues();
ReadTouchscreenValues();
- ReadMousePanningValues();
ReadMotionTouchValues();
ReadHidbusValues();
- ReadIrCameraValues();
-
-#ifdef _WIN32
- ReadBasicSetting(Settings::values.enable_raw_input);
-#else
- Settings::values.enable_raw_input = false;
-#endif
- ReadBasicSetting(Settings::values.emulate_analog_keyboard);
- ReadBasicSetting(Settings::values.enable_joycon_driver);
- ReadBasicSetting(Settings::values.enable_procon_driver);
- ReadBasicSetting(Settings::values.random_amiibo_id);
-
- ReadBasicSetting(Settings::values.tas_enable);
- ReadBasicSetting(Settings::values.tas_loop);
- ReadBasicSetting(Settings::values.pause_tas_on_load);
-
- ReadBasicSetting(Settings::values.controller_navigation);
qt_config->endGroup();
}
-void Config::ReadMousePanningValues() {
- ReadBasicSetting(Settings::values.mouse_panning);
- ReadBasicSetting(Settings::values.mouse_panning_x_sensitivity);
- ReadBasicSetting(Settings::values.mouse_panning_y_sensitivity);
- ReadBasicSetting(Settings::values.mouse_panning_deadzone_counterweight);
- ReadBasicSetting(Settings::values.mouse_panning_decay_strength);
- ReadBasicSetting(Settings::values.mouse_panning_min_decay);
-}
-
void Config::ReadMotionTouchValues() {
int num_touch_from_button_maps =
qt_config->beginReadArray(QStringLiteral("touch_from_button_maps"));
@@ -541,19 +487,14 @@ void Config::ReadMotionTouchValues() {
}
qt_config->endArray();
- ReadBasicSetting(Settings::values.touch_device);
- ReadBasicSetting(Settings::values.touch_from_button_map_index);
Settings::values.touch_from_button_map_index = std::clamp(
Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1);
- ReadBasicSetting(Settings::values.udp_input_servers);
- ReadBasicSetting(Settings::values.enable_udp_controller);
}
void Config::ReadCoreValues() {
qt_config->beginGroup(QStringLiteral("Core"));
- ReadGlobalSetting(Settings::values.use_multi_core);
- ReadGlobalSetting(Settings::values.use_unsafe_extended_memory_layout);
+ ReadCategory(Settings::Category::Core);
qt_config->endGroup();
}
@@ -561,7 +502,6 @@ void Config::ReadCoreValues() {
void Config::ReadDataStorageValues() {
qt_config->beginGroup(QStringLiteral("Data Storage"));
- ReadBasicSetting(Settings::values.use_virtual_sd);
FS::SetYuzuPath(
FS::YuzuPath::NANDDir,
qt_config
@@ -597,9 +537,7 @@ void Config::ReadDataStorageValues() {
.toString()
.toStdString());
- ReadBasicSetting(Settings::values.gamecard_inserted);
- ReadBasicSetting(Settings::values.gamecard_current_game);
- ReadBasicSetting(Settings::values.gamecard_path);
+ ReadCategory(Settings::Category::DataStorage);
qt_config->endGroup();
}
@@ -611,29 +549,16 @@ void Config::ReadDebuggingValues() {
Settings::values.record_frame_times =
qt_config->value(QStringLiteral("record_frame_times"), false).toBool();
- ReadBasicSetting(Settings::values.use_gdbstub);
- ReadBasicSetting(Settings::values.gdbstub_port);
- ReadBasicSetting(Settings::values.program_args);
- ReadBasicSetting(Settings::values.dump_exefs);
- ReadBasicSetting(Settings::values.dump_nso);
- ReadBasicSetting(Settings::values.enable_fs_access_log);
- ReadBasicSetting(Settings::values.reporting_services);
- ReadBasicSetting(Settings::values.quest_flag);
- ReadBasicSetting(Settings::values.disable_macro_jit);
- ReadBasicSetting(Settings::values.disable_macro_hle);
- ReadBasicSetting(Settings::values.extended_logging);
- ReadBasicSetting(Settings::values.use_debug_asserts);
- ReadBasicSetting(Settings::values.use_auto_stub);
- ReadBasicSetting(Settings::values.enable_all_controllers);
- ReadBasicSetting(Settings::values.create_crash_dumps);
- ReadBasicSetting(Settings::values.perform_vulkan_check);
+ ReadCategory(Settings::Category::Debugging);
qt_config->endGroup();
}
void Config::ReadServiceValues() {
qt_config->beginGroup(QStringLiteral("Services"));
- ReadBasicSetting(Settings::values.network_interface);
+
+ ReadCategory(Settings::Category::Services);
+
qt_config->endGroup();
}
@@ -659,8 +584,7 @@ void Config::ReadDisabledAddOnValues() {
void Config::ReadMiscellaneousValues() {
qt_config->beginGroup(QStringLiteral("Miscellaneous"));
- ReadBasicSetting(Settings::values.log_filter);
- ReadBasicSetting(Settings::values.use_dev_keys);
+ ReadCategory(Settings::Category::Miscellaneous);
qt_config->endGroup();
}
@@ -710,35 +634,11 @@ void Config::ReadPathValues() {
void Config::ReadCpuValues() {
qt_config->beginGroup(QStringLiteral("Cpu"));
- ReadBasicSetting(Settings::values.cpu_accuracy_first_time);
+ ReadCategory(Settings::Category::Cpu);
+
if (Settings::values.cpu_accuracy_first_time) {
Settings::values.cpu_accuracy.SetValue(Settings::values.cpu_accuracy.GetDefault());
Settings::values.cpu_accuracy_first_time.SetValue(false);
- } else {
- ReadGlobalSetting(Settings::values.cpu_accuracy);
- }
-
- ReadGlobalSetting(Settings::values.cpuopt_unsafe_unfuse_fma);
- ReadGlobalSetting(Settings::values.cpuopt_unsafe_reduce_fp_error);
- ReadGlobalSetting(Settings::values.cpuopt_unsafe_ignore_standard_fpcr);
- ReadGlobalSetting(Settings::values.cpuopt_unsafe_inaccurate_nan);
- ReadGlobalSetting(Settings::values.cpuopt_unsafe_fastmem_check);
- ReadGlobalSetting(Settings::values.cpuopt_unsafe_ignore_global_monitor);
-
- if (global) {
- ReadBasicSetting(Settings::values.cpu_debug_mode);
- ReadBasicSetting(Settings::values.cpuopt_page_tables);
- ReadBasicSetting(Settings::values.cpuopt_block_linking);
- ReadBasicSetting(Settings::values.cpuopt_return_stack_buffer);
- ReadBasicSetting(Settings::values.cpuopt_fast_dispatcher);
- ReadBasicSetting(Settings::values.cpuopt_context_elimination);
- ReadBasicSetting(Settings::values.cpuopt_const_prop);
- ReadBasicSetting(Settings::values.cpuopt_misc_ir);
- ReadBasicSetting(Settings::values.cpuopt_reduce_misalign_checks);
- ReadBasicSetting(Settings::values.cpuopt_fastmem);
- ReadBasicSetting(Settings::values.cpuopt_fastmem_exclusives);
- ReadBasicSetting(Settings::values.cpuopt_recompile_exclusives);
- ReadBasicSetting(Settings::values.cpuopt_ignore_memory_aborts);
}
qt_config->endGroup();
@@ -747,45 +647,8 @@ void Config::ReadCpuValues() {
void Config::ReadRendererValues() {
qt_config->beginGroup(QStringLiteral("Renderer"));
- ReadGlobalSetting(Settings::values.renderer_backend);
- ReadGlobalSetting(Settings::values.async_presentation);
- ReadGlobalSetting(Settings::values.renderer_force_max_clock);
- ReadGlobalSetting(Settings::values.vulkan_device);
- ReadGlobalSetting(Settings::values.fullscreen_mode);
- ReadGlobalSetting(Settings::values.aspect_ratio);
- ReadGlobalSetting(Settings::values.resolution_setup);
- ReadGlobalSetting(Settings::values.scaling_filter);
- ReadGlobalSetting(Settings::values.fsr_sharpening_slider);
- ReadGlobalSetting(Settings::values.anti_aliasing);
- ReadGlobalSetting(Settings::values.max_anisotropy);
- ReadGlobalSetting(Settings::values.speed_limit);
- ReadGlobalSetting(Settings::values.use_disk_shader_cache);
- ReadGlobalSetting(Settings::values.gpu_accuracy);
- ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation);
- ReadGlobalSetting(Settings::values.nvdec_emulation);
- ReadGlobalSetting(Settings::values.accelerate_astc);
- ReadGlobalSetting(Settings::values.astc_recompression);
- ReadGlobalSetting(Settings::values.use_reactive_flushing);
- ReadGlobalSetting(Settings::values.use_asynchronous_shaders);
- ReadGlobalSetting(Settings::values.use_fast_gpu_time);
- ReadGlobalSetting(Settings::values.use_vulkan_driver_pipeline_cache);
- ReadGlobalSetting(Settings::values.enable_compute_pipelines);
- ReadGlobalSetting(Settings::values.use_video_framerate);
- ReadGlobalSetting(Settings::values.barrier_feedback_loops);
- ReadGlobalSetting(Settings::values.bg_red);
- ReadGlobalSetting(Settings::values.bg_green);
- ReadGlobalSetting(Settings::values.bg_blue);
-
- if (global) {
- Settings::values.vsync_mode.SetValue(static_cast<Settings::VSyncMode>(
- ReadSetting(QString::fromStdString(Settings::values.vsync_mode.GetLabel()),
- static_cast<u32>(Settings::values.vsync_mode.GetDefault()))
- .value<u32>()));
- ReadBasicSetting(Settings::values.renderer_debug);
- ReadBasicSetting(Settings::values.renderer_shader_feedback);
- ReadBasicSetting(Settings::values.enable_nsight_aftermath);
- ReadBasicSetting(Settings::values.disable_shader_loop_safety_checks);
- }
+ ReadCategory(Settings::Category::Renderer);
+ ReadCategory(Settings::Category::AdvancedGraphics);
qt_config->endGroup();
}
@@ -832,41 +695,7 @@ void Config::ReadShortcutValues() {
void Config::ReadSystemValues() {
qt_config->beginGroup(QStringLiteral("System"));
- ReadGlobalSetting(Settings::values.language_index);
-
- ReadGlobalSetting(Settings::values.region_index);
-
- ReadGlobalSetting(Settings::values.time_zone_index);
-
- bool rng_seed_enabled;
- ReadSettingGlobal(rng_seed_enabled, QStringLiteral("rng_seed_enabled"), false);
- bool rng_seed_global =
- global || qt_config->value(QStringLiteral("rng_seed/use_global"), true).toBool();
- Settings::values.rng_seed.SetGlobal(rng_seed_global);
- if (global || !rng_seed_global) {
- if (rng_seed_enabled) {
- Settings::values.rng_seed.SetValue(ReadSetting(QStringLiteral("rng_seed"), 0).toUInt());
- } else {
- Settings::values.rng_seed.SetValue(std::nullopt);
- }
- }
-
- if (global) {
- ReadBasicSetting(Settings::values.current_user);
- Settings::values.current_user = std::clamp<int>(Settings::values.current_user.GetValue(), 0,
- Service::Account::MAX_USERS - 1);
-
- const auto custom_rtc_enabled =
- ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool();
- if (custom_rtc_enabled) {
- Settings::values.custom_rtc = ReadSetting(QStringLiteral("custom_rtc"), 0).toLongLong();
- } else {
- Settings::values.custom_rtc = std::nullopt;
- }
- ReadBasicSetting(Settings::values.device_name);
- }
-
- ReadGlobalSetting(Settings::values.sound_index);
+ ReadCategory(Settings::Category::System);
qt_config->endGroup();
}
@@ -879,8 +708,6 @@ void Config::ReadUIValues() {
QStringLiteral("theme"),
QString::fromUtf8(UISettings::themes[static_cast<size_t>(default_theme)].second))
.toString();
- ReadBasicSetting(UISettings::values.enable_discord_presence);
- ReadBasicSetting(UISettings::values.select_user_on_boot);
ReadUIGamelistValues();
ReadUILayoutValues();
@@ -889,20 +716,7 @@ void Config::ReadUIValues() {
ReadShortcutValues();
ReadMultiplayerValues();
- ReadBasicSetting(UISettings::values.single_window_mode);
- ReadBasicSetting(UISettings::values.fullscreen);
- ReadBasicSetting(UISettings::values.display_titlebar);
- ReadBasicSetting(UISettings::values.show_filter_bar);
- ReadBasicSetting(UISettings::values.show_status_bar);
- ReadBasicSetting(UISettings::values.confirm_before_closing);
- ReadBasicSetting(UISettings::values.first_start);
- ReadBasicSetting(UISettings::values.callout_flags);
- ReadBasicSetting(UISettings::values.show_console);
- ReadBasicSetting(UISettings::values.pause_when_in_background);
- ReadBasicSetting(UISettings::values.mute_when_in_background);
- ReadBasicSetting(UISettings::values.hide_mouse);
- ReadBasicSetting(UISettings::values.controller_applet_disabled);
- ReadBasicSetting(UISettings::values.disable_web_applet);
+ ReadCategory(Settings::Category::Ui);
qt_config->endGroup();
}
@@ -910,16 +724,8 @@ void Config::ReadUIValues() {
void Config::ReadUIGamelistValues() {
qt_config->beginGroup(QStringLiteral("UIGameList"));
- ReadBasicSetting(UISettings::values.show_add_ons);
- ReadBasicSetting(UISettings::values.show_compat);
- ReadBasicSetting(UISettings::values.show_size);
- ReadBasicSetting(UISettings::values.show_types);
- ReadBasicSetting(UISettings::values.game_icon_size);
- ReadBasicSetting(UISettings::values.folder_icon_size);
- ReadBasicSetting(UISettings::values.row_1_text_id);
- ReadBasicSetting(UISettings::values.row_2_text_id);
- ReadBasicSetting(UISettings::values.cache_game_list);
- ReadBasicSetting(UISettings::values.favorites_expanded);
+ ReadCategory(Settings::Category::UiGameList);
+
const int favorites_size = qt_config->beginReadArray(QStringLiteral("favorites"));
for (int i = 0; i < favorites_size; i++) {
qt_config->setArrayIndex(i);
@@ -942,7 +748,8 @@ void Config::ReadUILayoutValues() {
ReadSetting(QStringLiteral("gameListHeaderState")).toByteArray();
UISettings::values.microprofile_geometry =
ReadSetting(QStringLiteral("microProfileDialogGeometry")).toByteArray();
- ReadBasicSetting(UISettings::values.microprofile_visible);
+
+ ReadCategory(Settings::Category::UiLayout);
qt_config->endGroup();
}
@@ -950,10 +757,7 @@ void Config::ReadUILayoutValues() {
void Config::ReadWebServiceValues() {
qt_config->beginGroup(QStringLiteral("WebService"));
- ReadBasicSetting(Settings::values.enable_telemetry);
- ReadBasicSetting(Settings::values.web_api_url);
- ReadBasicSetting(Settings::values.yuzu_username);
- ReadBasicSetting(Settings::values.yuzu_token);
+ ReadCategory(Settings::Category::WebService);
qt_config->endGroup();
}
@@ -961,17 +765,7 @@ void Config::ReadWebServiceValues() {
void Config::ReadMultiplayerValues() {
qt_config->beginGroup(QStringLiteral("Multiplayer"));
- ReadBasicSetting(UISettings::values.multiplayer_nickname);
- ReadBasicSetting(UISettings::values.multiplayer_ip);
- ReadBasicSetting(UISettings::values.multiplayer_port);
- ReadBasicSetting(UISettings::values.multiplayer_room_nickname);
- ReadBasicSetting(UISettings::values.multiplayer_room_name);
- ReadBasicSetting(UISettings::values.multiplayer_room_port);
- ReadBasicSetting(UISettings::values.multiplayer_host_type);
- ReadBasicSetting(UISettings::values.multiplayer_port);
- ReadBasicSetting(UISettings::values.multiplayer_max_player);
- ReadBasicSetting(UISettings::values.multiplayer_game_id);
- ReadBasicSetting(UISettings::values.multiplayer_room_description);
+ ReadCategory(Settings::Category::Multiplayer);
// Read ban list back
int size = qt_config->beginReadArray(QStringLiteral("username_ban_list"));
@@ -1075,14 +869,9 @@ void Config::SavePlayerValue(std::size_t player_index) {
QString::fromStdString(player.motions[i]),
QString::fromStdString(default_param));
}
-
- if (player_index == 0) {
- SaveMousePanningValues();
- }
}
void Config::SaveDebugValues() {
- WriteBasicSetting(Settings::values.debug_pad_enabled);
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
const std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
WriteSetting(QStringLiteral("debug_pad_") +
@@ -1101,10 +890,6 @@ void Config::SaveDebugValues() {
}
}
-void Config::SaveMouseValues() {
- WriteBasicSetting(Settings::values.mouse_enabled);
-}
-
void Config::SaveTouchscreenValues() {
const auto& touchscreen = Settings::values.touchscreen;
@@ -1115,21 +900,7 @@ void Config::SaveTouchscreenValues() {
WriteSetting(QStringLiteral("touchscreen_diameter_y"), touchscreen.diameter_y, 15);
}
-void Config::SaveMousePanningValues() {
- // Don't overwrite values.mouse_panning
- WriteBasicSetting(Settings::values.mouse_panning_x_sensitivity);
- WriteBasicSetting(Settings::values.mouse_panning_y_sensitivity);
- WriteBasicSetting(Settings::values.mouse_panning_deadzone_counterweight);
- WriteBasicSetting(Settings::values.mouse_panning_decay_strength);
- WriteBasicSetting(Settings::values.mouse_panning_min_decay);
-}
-
void Config::SaveMotionTouchValues() {
- WriteBasicSetting(Settings::values.touch_device);
- WriteBasicSetting(Settings::values.touch_from_button_map_index);
- WriteBasicSetting(Settings::values.udp_input_servers);
- WriteBasicSetting(Settings::values.enable_udp_controller);
-
qt_config->beginWriteArray(QStringLiteral("touch_from_button_maps"));
for (std::size_t p = 0; p < Settings::values.touch_from_button_maps.size(); ++p) {
qt_config->setArrayIndex(static_cast<int>(p));
@@ -1150,8 +921,6 @@ void Config::SaveMotionTouchValues() {
}
void Config::SaveHidbusValues() {
- WriteBasicSetting(Settings::values.enable_ring_controller);
-
const std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
0, 0, default_ringcon_analogs[0], default_ringcon_analogs[1], 0, 0.05f);
WriteSetting(QStringLiteral("ring_controller"),
@@ -1159,11 +928,6 @@ void Config::SaveHidbusValues() {
QString::fromStdString(default_param));
}
-void Config::SaveIrCameraValues() {
- WriteBasicSetting(Settings::values.enable_ir_sensor);
- WriteBasicSetting(Settings::values.ir_sensor_device);
-}
-
void Config::SaveValues() {
if (global) {
SaveDataStorageValues();
@@ -1180,18 +944,14 @@ void Config::SaveValues() {
SaveRendererValues();
SaveAudioValues();
SaveSystemValues();
+
qt_config->sync();
}
void Config::SaveAudioValues() {
qt_config->beginGroup(QStringLiteral("Audio"));
- if (global) {
- WriteBasicSetting(Settings::values.sink_id);
- WriteBasicSetting(Settings::values.audio_output_device_id);
- WriteBasicSetting(Settings::values.audio_input_device_id);
- }
- WriteGlobalSetting(Settings::values.volume);
+ WriteCategory(Settings::Category::Audio);
qt_config->endGroup();
}
@@ -1199,6 +959,8 @@ void Config::SaveAudioValues() {
void Config::SaveControlValues() {
qt_config->beginGroup(QStringLiteral("Controls"));
+ WriteCategory(Settings::Category::Controls);
+
Settings::values.players.SetGlobal(!IsCustomConfig());
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
SavePlayerValue(p);
@@ -1208,28 +970,9 @@ void Config::SaveControlValues() {
return;
}
SaveDebugValues();
- SaveMouseValues();
SaveTouchscreenValues();
- SaveMousePanningValues();
SaveMotionTouchValues();
SaveHidbusValues();
- SaveIrCameraValues();
-
- WriteGlobalSetting(Settings::values.use_docked_mode);
- WriteGlobalSetting(Settings::values.vibration_enabled);
- WriteGlobalSetting(Settings::values.enable_accurate_vibrations);
- WriteGlobalSetting(Settings::values.motion_enabled);
- WriteBasicSetting(Settings::values.enable_raw_input);
- WriteBasicSetting(Settings::values.enable_joycon_driver);
- WriteBasicSetting(Settings::values.enable_procon_driver);
- WriteBasicSetting(Settings::values.random_amiibo_id);
- WriteBasicSetting(Settings::values.keyboard_enabled);
- WriteBasicSetting(Settings::values.emulate_analog_keyboard);
- WriteBasicSetting(Settings::values.controller_navigation);
-
- WriteBasicSetting(Settings::values.tas_enable);
- WriteBasicSetting(Settings::values.tas_loop);
- WriteBasicSetting(Settings::values.pause_tas_on_load);
qt_config->endGroup();
}
@@ -1237,8 +980,7 @@ void Config::SaveControlValues() {
void Config::SaveCoreValues() {
qt_config->beginGroup(QStringLiteral("Core"));
- WriteGlobalSetting(Settings::values.use_multi_core);
- WriteGlobalSetting(Settings::values.use_unsafe_extended_memory_layout);
+ WriteCategory(Settings::Category::Core);
qt_config->endGroup();
}
@@ -1246,7 +988,6 @@ void Config::SaveCoreValues() {
void Config::SaveDataStorageValues() {
qt_config->beginGroup(QStringLiteral("Data Storage"));
- WriteBasicSetting(Settings::values.use_virtual_sd);
WriteSetting(QStringLiteral("nand_directory"),
QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::NANDDir)),
QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::NANDDir)));
@@ -1263,9 +1004,7 @@ void Config::SaveDataStorageValues() {
QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::TASDir)),
QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::TASDir)));
- WriteBasicSetting(Settings::values.gamecard_inserted);
- WriteBasicSetting(Settings::values.gamecard_current_game);
- WriteBasicSetting(Settings::values.gamecard_path);
+ WriteCategory(Settings::Category::DataStorage);
qt_config->endGroup();
}
@@ -1275,19 +1014,8 @@ void Config::SaveDebuggingValues() {
// Intentionally not using the QT default setting as this is intended to be changed in the ini
qt_config->setValue(QStringLiteral("record_frame_times"), Settings::values.record_frame_times);
- WriteBasicSetting(Settings::values.use_gdbstub);
- WriteBasicSetting(Settings::values.gdbstub_port);
- WriteBasicSetting(Settings::values.program_args);
- WriteBasicSetting(Settings::values.dump_exefs);
- WriteBasicSetting(Settings::values.dump_nso);
- WriteBasicSetting(Settings::values.enable_fs_access_log);
- WriteBasicSetting(Settings::values.quest_flag);
- WriteBasicSetting(Settings::values.use_debug_asserts);
- WriteBasicSetting(Settings::values.disable_macro_jit);
- WriteBasicSetting(Settings::values.disable_macro_hle);
- WriteBasicSetting(Settings::values.enable_all_controllers);
- WriteBasicSetting(Settings::values.create_crash_dumps);
- WriteBasicSetting(Settings::values.perform_vulkan_check);
+
+ WriteCategory(Settings::Category::Debugging);
qt_config->endGroup();
}
@@ -1295,7 +1023,7 @@ void Config::SaveDebuggingValues() {
void Config::SaveNetworkValues() {
qt_config->beginGroup(QStringLiteral("Services"));
- WriteBasicSetting(Settings::values.network_interface);
+ WriteCategory(Settings::Category::Network);
qt_config->endGroup();
}
@@ -1322,8 +1050,7 @@ void Config::SaveDisabledAddOnValues() {
void Config::SaveMiscellaneousValues() {
qt_config->beginGroup(QStringLiteral("Miscellaneous"));
- WriteBasicSetting(Settings::values.log_filter);
- WriteBasicSetting(Settings::values.use_dev_keys);
+ WriteCategory(Settings::Category::Miscellaneous);
qt_config->endGroup();
}
@@ -1351,34 +1078,7 @@ void Config::SavePathValues() {
void Config::SaveCpuValues() {
qt_config->beginGroup(QStringLiteral("Cpu"));
- WriteBasicSetting(Settings::values.cpu_accuracy_first_time);
- WriteSetting(QStringLiteral("cpu_accuracy"),
- static_cast<u32>(Settings::values.cpu_accuracy.GetValue(global)),
- static_cast<u32>(Settings::values.cpu_accuracy.GetDefault()),
- Settings::values.cpu_accuracy.UsingGlobal());
-
- WriteGlobalSetting(Settings::values.cpuopt_unsafe_unfuse_fma);
- WriteGlobalSetting(Settings::values.cpuopt_unsafe_reduce_fp_error);
- WriteGlobalSetting(Settings::values.cpuopt_unsafe_ignore_standard_fpcr);
- WriteGlobalSetting(Settings::values.cpuopt_unsafe_inaccurate_nan);
- WriteGlobalSetting(Settings::values.cpuopt_unsafe_fastmem_check);
- WriteGlobalSetting(Settings::values.cpuopt_unsafe_ignore_global_monitor);
-
- if (global) {
- WriteBasicSetting(Settings::values.cpu_debug_mode);
- WriteBasicSetting(Settings::values.cpuopt_page_tables);
- WriteBasicSetting(Settings::values.cpuopt_block_linking);
- WriteBasicSetting(Settings::values.cpuopt_return_stack_buffer);
- WriteBasicSetting(Settings::values.cpuopt_fast_dispatcher);
- WriteBasicSetting(Settings::values.cpuopt_context_elimination);
- WriteBasicSetting(Settings::values.cpuopt_const_prop);
- WriteBasicSetting(Settings::values.cpuopt_misc_ir);
- WriteBasicSetting(Settings::values.cpuopt_reduce_misalign_checks);
- WriteBasicSetting(Settings::values.cpuopt_fastmem);
- WriteBasicSetting(Settings::values.cpuopt_fastmem_exclusives);
- WriteBasicSetting(Settings::values.cpuopt_recompile_exclusives);
- WriteBasicSetting(Settings::values.cpuopt_ignore_memory_aborts);
- }
+ WriteCategory(Settings::Category::Cpu);
qt_config->endGroup();
}
@@ -1386,82 +1086,8 @@ void Config::SaveCpuValues() {
void Config::SaveRendererValues() {
qt_config->beginGroup(QStringLiteral("Renderer"));
- WriteSetting(QString::fromStdString(Settings::values.renderer_backend.GetLabel()),
- static_cast<u32>(Settings::values.renderer_backend.GetValue(global)),
- static_cast<u32>(Settings::values.renderer_backend.GetDefault()),
- Settings::values.renderer_backend.UsingGlobal());
- WriteGlobalSetting(Settings::values.async_presentation);
- WriteGlobalSetting(Settings::values.renderer_force_max_clock);
- WriteGlobalSetting(Settings::values.vulkan_device);
- WriteSetting(QString::fromStdString(Settings::values.fullscreen_mode.GetLabel()),
- static_cast<u32>(Settings::values.fullscreen_mode.GetValue(global)),
- static_cast<u32>(Settings::values.fullscreen_mode.GetDefault()),
- Settings::values.fullscreen_mode.UsingGlobal());
- WriteGlobalSetting(Settings::values.aspect_ratio);
- WriteSetting(QString::fromStdString(Settings::values.resolution_setup.GetLabel()),
- static_cast<u32>(Settings::values.resolution_setup.GetValue(global)),
- static_cast<u32>(Settings::values.resolution_setup.GetDefault()),
- Settings::values.resolution_setup.UsingGlobal());
- WriteSetting(QString::fromStdString(Settings::values.scaling_filter.GetLabel()),
- static_cast<u32>(Settings::values.scaling_filter.GetValue(global)),
- static_cast<u32>(Settings::values.scaling_filter.GetDefault()),
- Settings::values.scaling_filter.UsingGlobal());
- WriteSetting(QString::fromStdString(Settings::values.fsr_sharpening_slider.GetLabel()),
- static_cast<u32>(Settings::values.fsr_sharpening_slider.GetValue(global)),
- static_cast<u32>(Settings::values.fsr_sharpening_slider.GetDefault()),
- Settings::values.fsr_sharpening_slider.UsingGlobal());
- WriteSetting(QString::fromStdString(Settings::values.anti_aliasing.GetLabel()),
- static_cast<u32>(Settings::values.anti_aliasing.GetValue(global)),
- static_cast<u32>(Settings::values.anti_aliasing.GetDefault()),
- Settings::values.anti_aliasing.UsingGlobal());
- WriteGlobalSetting(Settings::values.max_anisotropy);
- WriteGlobalSetting(Settings::values.speed_limit);
- WriteGlobalSetting(Settings::values.use_disk_shader_cache);
- WriteSetting(QString::fromStdString(Settings::values.gpu_accuracy.GetLabel()),
- static_cast<u32>(Settings::values.gpu_accuracy.GetValue(global)),
- static_cast<u32>(Settings::values.gpu_accuracy.GetDefault()),
- Settings::values.gpu_accuracy.UsingGlobal());
- WriteGlobalSetting(Settings::values.use_asynchronous_gpu_emulation);
- WriteSetting(QString::fromStdString(Settings::values.nvdec_emulation.GetLabel()),
- static_cast<u32>(Settings::values.nvdec_emulation.GetValue(global)),
- static_cast<u32>(Settings::values.nvdec_emulation.GetDefault()),
- Settings::values.nvdec_emulation.UsingGlobal());
- WriteSetting(QString::fromStdString(Settings::values.accelerate_astc.GetLabel()),
- static_cast<u32>(Settings::values.accelerate_astc.GetValue(global)),
- static_cast<u32>(Settings::values.accelerate_astc.GetDefault()),
- Settings::values.accelerate_astc.UsingGlobal());
- WriteSetting(QString::fromStdString(Settings::values.astc_recompression.GetLabel()),
- static_cast<u32>(Settings::values.astc_recompression.GetValue(global)),
- static_cast<u32>(Settings::values.astc_recompression.GetDefault()),
- Settings::values.astc_recompression.UsingGlobal());
- WriteGlobalSetting(Settings::values.use_reactive_flushing);
- WriteSetting(QString::fromStdString(Settings::values.accelerate_astc.GetLabel()),
- static_cast<u32>(Settings::values.accelerate_astc.GetValue(global)),
- static_cast<u32>(Settings::values.accelerate_astc.GetDefault()),
- Settings::values.shader_backend.UsingGlobal());
- WriteSetting(QString::fromStdString(Settings::values.shader_backend.GetLabel()),
- static_cast<u32>(Settings::values.shader_backend.GetValue(global)),
- static_cast<u32>(Settings::values.shader_backend.GetDefault()),
- Settings::values.shader_backend.UsingGlobal());
- WriteGlobalSetting(Settings::values.use_asynchronous_shaders);
- WriteGlobalSetting(Settings::values.use_fast_gpu_time);
- WriteGlobalSetting(Settings::values.use_vulkan_driver_pipeline_cache);
- WriteGlobalSetting(Settings::values.enable_compute_pipelines);
- WriteGlobalSetting(Settings::values.use_video_framerate);
- WriteGlobalSetting(Settings::values.barrier_feedback_loops);
- WriteGlobalSetting(Settings::values.bg_red);
- WriteGlobalSetting(Settings::values.bg_green);
- WriteGlobalSetting(Settings::values.bg_blue);
-
- if (global) {
- WriteSetting(QString::fromStdString(Settings::values.vsync_mode.GetLabel()),
- static_cast<u32>(Settings::values.vsync_mode.GetValue()),
- static_cast<u32>(Settings::values.vsync_mode.GetDefault()));
- WriteBasicSetting(Settings::values.renderer_debug);
- WriteBasicSetting(Settings::values.renderer_shader_feedback);
- WriteBasicSetting(Settings::values.enable_nsight_aftermath);
- WriteBasicSetting(Settings::values.disable_shader_loop_safety_checks);
- }
+ WriteCategory(Settings::Category::AdvancedGraphics);
+ WriteCategory(Settings::Category::Renderer);
qt_config->endGroup();
}
@@ -1469,9 +1095,9 @@ void Config::SaveRendererValues() {
void Config::SaveScreenshotValues() {
qt_config->beginGroup(QStringLiteral("Screenshots"));
- WriteBasicSetting(UISettings::values.enable_screenshot_save_as);
WriteSetting(QStringLiteral("screenshot_path"),
QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::ScreenshotsDir)));
+ WriteCategory(Settings::Category::Screenshots);
qt_config->endGroup();
}
@@ -1502,27 +1128,7 @@ void Config::SaveShortcutValues() {
void Config::SaveSystemValues() {
qt_config->beginGroup(QStringLiteral("System"));
- WriteGlobalSetting(Settings::values.language_index);
- WriteGlobalSetting(Settings::values.region_index);
- WriteGlobalSetting(Settings::values.time_zone_index);
-
- WriteSetting(QStringLiteral("rng_seed_enabled"),
- Settings::values.rng_seed.GetValue(global).has_value(), false,
- Settings::values.rng_seed.UsingGlobal());
- WriteSetting(QStringLiteral("rng_seed"), Settings::values.rng_seed.GetValue(global).value_or(0),
- 0, Settings::values.rng_seed.UsingGlobal());
-
- if (global) {
- WriteBasicSetting(Settings::values.current_user);
-
- 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(0)), 0);
- WriteBasicSetting(Settings::values.device_name);
- }
-
- WriteGlobalSetting(Settings::values.sound_index);
+ WriteCategory(Settings::Category::System);
qt_config->endGroup();
}
@@ -1530,10 +1136,10 @@ void Config::SaveSystemValues() {
void Config::SaveUIValues() {
qt_config->beginGroup(QStringLiteral("UI"));
+ WriteCategory(Settings::Category::Ui);
+
WriteSetting(QStringLiteral("theme"), UISettings::values.theme,
QString::fromUtf8(UISettings::themes[static_cast<size_t>(default_theme)].second));
- WriteBasicSetting(UISettings::values.enable_discord_presence);
- WriteBasicSetting(UISettings::values.select_user_on_boot);
SaveUIGamelistValues();
SaveUILayoutValues();
@@ -1542,37 +1148,14 @@ void Config::SaveUIValues() {
SaveShortcutValues();
SaveMultiplayerValues();
- WriteBasicSetting(UISettings::values.single_window_mode);
- WriteBasicSetting(UISettings::values.fullscreen);
- WriteBasicSetting(UISettings::values.display_titlebar);
- WriteBasicSetting(UISettings::values.show_filter_bar);
- WriteBasicSetting(UISettings::values.show_status_bar);
- WriteBasicSetting(UISettings::values.confirm_before_closing);
- WriteBasicSetting(UISettings::values.first_start);
- WriteBasicSetting(UISettings::values.callout_flags);
- WriteBasicSetting(UISettings::values.show_console);
- WriteBasicSetting(UISettings::values.pause_when_in_background);
- WriteBasicSetting(UISettings::values.mute_when_in_background);
- WriteBasicSetting(UISettings::values.hide_mouse);
- WriteBasicSetting(UISettings::values.controller_applet_disabled);
- WriteBasicSetting(UISettings::values.disable_web_applet);
-
qt_config->endGroup();
}
void Config::SaveUIGamelistValues() {
qt_config->beginGroup(QStringLiteral("UIGameList"));
- WriteBasicSetting(UISettings::values.show_add_ons);
- WriteBasicSetting(UISettings::values.show_compat);
- WriteBasicSetting(UISettings::values.show_size);
- WriteBasicSetting(UISettings::values.show_types);
- WriteBasicSetting(UISettings::values.game_icon_size);
- WriteBasicSetting(UISettings::values.folder_icon_size);
- WriteBasicSetting(UISettings::values.row_1_text_id);
- WriteBasicSetting(UISettings::values.row_2_text_id);
- WriteBasicSetting(UISettings::values.cache_game_list);
- WriteBasicSetting(UISettings::values.favorites_expanded);
+ WriteCategory(Settings::Category::UiGameList);
+
qt_config->beginWriteArray(QStringLiteral("favorites"));
for (int i = 0; i < UISettings::values.favorited_ids.size(); i++) {
qt_config->setArrayIndex(i);
@@ -1593,7 +1176,8 @@ void Config::SaveUILayoutValues() {
WriteSetting(QStringLiteral("gameListHeaderState"), UISettings::values.gamelist_header_state);
WriteSetting(QStringLiteral("microProfileDialogGeometry"),
UISettings::values.microprofile_geometry);
- WriteBasicSetting(UISettings::values.microprofile_visible);
+
+ WriteCategory(Settings::Category::UiLayout);
qt_config->endGroup();
}
@@ -1601,10 +1185,7 @@ void Config::SaveUILayoutValues() {
void Config::SaveWebServiceValues() {
qt_config->beginGroup(QStringLiteral("WebService"));
- WriteBasicSetting(Settings::values.enable_telemetry);
- WriteBasicSetting(Settings::values.web_api_url);
- WriteBasicSetting(Settings::values.yuzu_username);
- WriteBasicSetting(Settings::values.yuzu_token);
+ WriteCategory(Settings::Category::WebService);
qt_config->endGroup();
}
@@ -1612,17 +1193,7 @@ void Config::SaveWebServiceValues() {
void Config::SaveMultiplayerValues() {
qt_config->beginGroup(QStringLiteral("Multiplayer"));
- WriteBasicSetting(UISettings::values.multiplayer_nickname);
- WriteBasicSetting(UISettings::values.multiplayer_ip);
- WriteBasicSetting(UISettings::values.multiplayer_port);
- WriteBasicSetting(UISettings::values.multiplayer_room_nickname);
- WriteBasicSetting(UISettings::values.multiplayer_room_name);
- WriteBasicSetting(UISettings::values.multiplayer_room_port);
- WriteBasicSetting(UISettings::values.multiplayer_host_type);
- WriteBasicSetting(UISettings::values.multiplayer_port);
- WriteBasicSetting(UISettings::values.multiplayer_max_player);
- WriteBasicSetting(UISettings::values.multiplayer_game_id);
- WriteBasicSetting(UISettings::values.multiplayer_room_description);
+ WriteCategory(Settings::Category::Multiplayer);
// Write ban list
qt_config->beginWriteArray(QStringLiteral("username_ban_list"));
@@ -1731,3 +1302,58 @@ void Config::ClearControlPlayerValues() {
const std::string& Config::GetConfigFilePath() const {
return qt_config_loc;
}
+
+void Config::ReadCategory(Settings::Category category) {
+ const auto& settings = settings_map[category];
+ std::for_each(settings.begin(), settings.end(),
+ [&](const auto& setting) { ReadSettingGeneric(setting); });
+}
+
+void Config::WriteCategory(Settings::Category category) {
+ const auto& settings = settings_map[category];
+ std::for_each(settings.begin(), settings.end(),
+ [&](const auto& setting) { WriteSettingGeneric(setting); });
+}
+
+void Config::ReadSettingGeneric(Settings::BasicSetting* const setting) {
+ if (!setting->Save()) {
+ return;
+ }
+ const QString name = QString::fromStdString(setting->GetLabel());
+ const auto default_value =
+ QVariant::fromValue<QString>(QString::fromStdString(setting->DefaultToString()));
+
+ if (setting->Switchable()) {
+ const bool use_global =
+ qt_config->value(name + QStringLiteral("/use_global"), true).value<bool>();
+ setting->SetGlobal(use_global);
+
+ if (global || !use_global) {
+ setting->LoadString(ReadSetting(name, default_value).value<QString>().toStdString());
+ }
+ } else if (global) {
+ setting->LoadString(ReadSetting(name, default_value).value<QString>().toStdString());
+ }
+}
+
+void Config::WriteSettingGeneric(Settings::BasicSetting* const setting) const {
+ if (!setting->Save()) {
+ return;
+ }
+ const QVariant value = QVariant::fromValue(QString::fromStdString(setting->ToString()));
+ const QVariant default_value =
+ QVariant::fromValue(QString::fromStdString(setting->DefaultToString()));
+ const QString label = QString::fromStdString(setting->GetLabel());
+ if (setting->Switchable()) {
+ if (!global) {
+ qt_config->setValue(label + QStringLiteral("/use_global"), setting->UsingGlobal());
+ }
+ if (global || !setting->UsingGlobal()) {
+ qt_config->setValue(label + QStringLiteral("/default"), value == default_value);
+ qt_config->setValue(label, value);
+ }
+ } else if (global) {
+ qt_config->setValue(label + QStringLiteral("/default"), value == default_value);
+ qt_config->setValue(label, value);
+ }
+}
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h
index e066f7552..ec748bf0c 100644
--- a/src/yuzu/configuration/config.h
+++ b/src/yuzu/configuration/config.h
@@ -74,7 +74,6 @@ private:
void ReadKeyboardValues();
void ReadMouseValues();
void ReadTouchscreenValues();
- void ReadMousePanningValues();
void ReadMotionTouchValues();
void ReadHidbusValues();
void ReadIrCameraValues();
@@ -105,7 +104,6 @@ private:
void SaveDebugValues();
void SaveMouseValues();
void SaveTouchscreenValues();
- void SaveMousePanningValues();
void SaveMotionTouchValues();
void SaveHidbusValues();
void SaveIrCameraValues();
@@ -201,10 +199,17 @@ private:
template <typename Type, bool ranged>
void WriteBasicSetting(const Settings::Setting<Type, ranged>& setting);
- ConfigType type;
+ void ReadCategory(Settings::Category category);
+ void WriteCategory(Settings::Category category);
+ void ReadSettingGeneric(Settings::BasicSetting* const setting);
+ void WriteSettingGeneric(Settings::BasicSetting* const setting) const;
+
+ std::map<Settings::Category, std::forward_list<Settings::BasicSetting*>> settings_map;
+
+ const ConfigType type;
std::unique_ptr<QSettings> qt_config;
std::string qt_config_loc;
- bool global;
+ const bool global;
};
// These metatype declarations cannot be in common/settings.h because core is devoid of QT
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp
index ac42cc7fc..8fd12c9e8 100644
--- a/src/yuzu/configuration/configuration_shared.cpp
+++ b/src/yuzu/configuration/configuration_shared.cpp
@@ -43,25 +43,6 @@ void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) {
widget->show();
}
-void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox,
- const Settings::SwitchableSetting<bool>& setting,
- CheckState& tracker) {
- if (setting.UsingGlobal()) {
- tracker = CheckState::Global;
- } else {
- tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off;
- }
- SetHighlight(checkbox, tracker != CheckState::Global);
- QObject::connect(checkbox, &QCheckBox::clicked, checkbox, [checkbox, setting, &tracker] {
- tracker = static_cast<CheckState>((static_cast<int>(tracker) + 1) %
- static_cast<int>(CheckState::Count));
- if (tracker == CheckState::Global) {
- checkbox->setChecked(setting.GetValue(true));
- }
- SetHighlight(checkbox, tracker != CheckState::Global);
- });
-}
-
void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, bool global, bool state,
bool global_state, CheckState& tracker) {
if (global) {
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h
index 04c88758c..1e61bcbeb 100644
--- a/src/yuzu/configuration/configuration_shared.h
+++ b/src/yuzu/configuration/configuration_shared.h
@@ -57,8 +57,26 @@ void SetPerGameSetting(QComboBox* combobox,
void SetHighlight(QWidget* widget, bool highlighted);
// Sets up a QCheckBox like a tristate one, given a Setting
-void SetColoredTristate(QCheckBox* checkbox, const Settings::SwitchableSetting<bool>& setting,
- CheckState& tracker);
+template <bool ranged, bool save>
+void SetColoredTristate(QCheckBox* checkbox,
+ const Settings::SwitchableSetting<bool, ranged, save>& setting,
+ CheckState& tracker) {
+ if (setting.UsingGlobal()) {
+ tracker = CheckState::Global;
+ } else {
+ tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off;
+ }
+ SetHighlight(checkbox, tracker != CheckState::Global);
+ QObject::connect(checkbox, &QCheckBox::clicked, checkbox, [checkbox, setting, &tracker] {
+ tracker = static_cast<CheckState>((static_cast<int>(tracker) + 1) %
+ static_cast<int>(CheckState::Count));
+ if (tracker == CheckState::Global) {
+ checkbox->setChecked(setting.GetValue(true));
+ }
+ SetHighlight(checkbox, tracker != CheckState::Global);
+ });
+}
+
void SetColoredTristate(QCheckBox* checkbox, bool global, bool state, bool global_state,
CheckState& tracker);
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h
index 0be8ee369..53cdd7fcb 100644
--- a/src/yuzu/uisettings.h
+++ b/src/yuzu/uisettings.h
@@ -14,6 +14,7 @@
#include "common/common_types.h"
#include "common/settings.h"
+using Settings::Category;
using Settings::Setting;
namespace UISettings {
@@ -58,6 +59,8 @@ struct GameDir {
};
struct Values {
+ Settings::Linkage linkage{};
+
QByteArray geometry;
QByteArray state;
@@ -66,33 +69,36 @@ struct Values {
QByteArray gamelist_header_state;
QByteArray microprofile_geometry;
- Setting<bool> microprofile_visible{false, "microProfileDialogVisible"};
-
- Setting<bool> single_window_mode{true, "singleWindowMode"};
- Setting<bool> fullscreen{false, "fullscreen"};
- Setting<bool> display_titlebar{true, "displayTitleBars"};
- Setting<bool> show_filter_bar{true, "showFilterBar"};
- Setting<bool> show_status_bar{true, "showStatusBar"};
-
- Setting<bool> confirm_before_closing{true, "confirmClose"};
- Setting<bool> first_start{true, "firstStart"};
- Setting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
- Setting<bool> mute_when_in_background{false, "muteWhenInBackground"};
- Setting<bool> hide_mouse{true, "hideInactiveMouse"};
- Setting<bool> controller_applet_disabled{false, "disableControllerApplet"};
+ Setting<bool> microprofile_visible{linkage, false, "microProfileDialogVisible",
+ Category::UiLayout};
+
+ Setting<bool> single_window_mode{linkage, true, "singleWindowMode", Category::Ui};
+ Setting<bool> fullscreen{linkage, false, "fullscreen", Category::Ui};
+ Setting<bool> display_titlebar{linkage, true, "displayTitleBars", Category::Ui};
+ Setting<bool> show_filter_bar{linkage, true, "showFilterBar", Category::Ui};
+ Setting<bool> show_status_bar{linkage, true, "showStatusBar", Category::Ui};
+
+ Setting<bool> confirm_before_closing{linkage, true, "confirmClose", Category::Ui};
+ Setting<bool> first_start{linkage, true, "firstStart", Category::Ui};
+ Setting<bool> pause_when_in_background{linkage, false, "pauseWhenInBackground", Category::Ui};
+ Setting<bool> mute_when_in_background{linkage, false, "muteWhenInBackground", Category::Ui};
+ Setting<bool> hide_mouse{linkage, true, "hideInactiveMouse", Category::Ui};
+ Setting<bool> controller_applet_disabled{linkage, false, "disableControllerApplet",
+ Category::Ui};
// Set when Vulkan is known to crash the application
bool has_broken_vulkan = false;
- Setting<bool> select_user_on_boot{false, "select_user_on_boot"};
- Setting<bool> disable_web_applet{true, "disable_web_applet"};
+ Setting<bool> select_user_on_boot{linkage, false, "select_user_on_boot", Category::Ui};
+ Setting<bool> disable_web_applet{linkage, true, "disable_web_applet", Category::Ui};
// Discord RPC
- Setting<bool> enable_discord_presence{true, "enable_discord_presence"};
+ Setting<bool> enable_discord_presence{linkage, true, "enable_discord_presence", Category::Ui};
// logging
- Setting<bool> show_console{false, "showConsole"};
+ Setting<bool> show_console{linkage, false, "showConsole", Category::Ui};
- Setting<bool> enable_screenshot_save_as{true, "enable_screenshot_save_as"};
+ Setting<bool> enable_screenshot_save_as{linkage, true, "enable_screenshot_save_as",
+ Category::Screenshots};
QString roms_path;
QString symbols_path;
@@ -107,38 +113,42 @@ struct Values {
// Shortcut name <Shortcut, context>
std::vector<Shortcut> shortcuts;
- Setting<u32> callout_flags{0, "calloutFlags"};
+ Setting<u32> callout_flags{linkage, 0, "calloutFlags", Category::Ui};
// multiplayer settings
- Setting<std::string> multiplayer_nickname{{}, "nickname"};
- Setting<std::string> multiplayer_ip{{}, "ip"};
- Setting<u16, true> multiplayer_port{24872, 0, UINT16_MAX, "port"};
- Setting<std::string> multiplayer_room_nickname{{}, "room_nickname"};
- Setting<std::string> multiplayer_room_name{{}, "room_name"};
- Setting<u8, true> multiplayer_max_player{8, 0, 8, "max_player"};
- Setting<u16, true> multiplayer_room_port{24872, 0, UINT16_MAX, "room_port"};
- Setting<u8, true> multiplayer_host_type{0, 0, 1, "host_type"};
- Setting<unsigned long long> multiplayer_game_id{{}, "game_id"};
- Setting<std::string> multiplayer_room_description{{}, "room_description"};
+ Setting<std::string> multiplayer_nickname{linkage, {}, "nickname", Category::Multiplayer};
+ Setting<std::string> multiplayer_ip{linkage, {}, "ip", Category::Multiplayer};
+ Setting<u16, true> multiplayer_port{linkage, 24872, 0,
+ UINT16_MAX, "port", Category::Multiplayer};
+ Setting<std::string> multiplayer_room_nickname{
+ linkage, {}, "room_nickname", Category::Multiplayer};
+ Setting<std::string> multiplayer_room_name{linkage, {}, "room_name", Category::Multiplayer};
+ Setting<u8, true> multiplayer_max_player{linkage, 8, 0, 8, "max_player", Category::Multiplayer};
+ Setting<u16, true> multiplayer_room_port{linkage, 24872, 0,
+ UINT16_MAX, "room_port", Category::Multiplayer};
+ Setting<u8, true> multiplayer_host_type{linkage, 0, 0, 1, "host_type", Category::Multiplayer};
+ Setting<unsigned long long> multiplayer_game_id{linkage, {}, "game_id", Category::Multiplayer};
+ Setting<std::string> multiplayer_room_description{
+ linkage, {}, "room_description", Category::Multiplayer};
std::pair<std::vector<std::string>, std::vector<std::string>> multiplayer_ban_list;
// Game List
- Setting<bool> show_add_ons{true, "show_add_ons"};
- Setting<u32> game_icon_size{64, "game_icon_size"};
- Setting<u32> folder_icon_size{48, "folder_icon_size"};
- Setting<u8> row_1_text_id{3, "row_1_text_id"};
- Setting<u8> row_2_text_id{2, "row_2_text_id"};
+ Setting<bool> show_add_ons{linkage, true, "show_add_ons", Category::UiGameList};
+ Setting<u32> game_icon_size{linkage, 64, "game_icon_size", Category::UiGameList};
+ Setting<u32> folder_icon_size{linkage, 48, "folder_icon_size", Category::UiGameList};
+ Setting<u8> row_1_text_id{linkage, 3, "row_1_text_id", Category::UiGameList};
+ Setting<u8> row_2_text_id{linkage, 2, "row_2_text_id", Category::UiGameList};
std::atomic_bool is_game_list_reload_pending{false};
- Setting<bool> cache_game_list{true, "cache_game_list"};
- Setting<bool> favorites_expanded{true, "favorites_expanded"};
+ Setting<bool> cache_game_list{linkage, true, "cache_game_list", Category::UiGameList};
+ Setting<bool> favorites_expanded{linkage, true, "favorites_expanded", Category::UiGameList};
QVector<u64> favorited_ids;
// Compatibility List
- Setting<bool> show_compat{false, "show_compat"};
+ Setting<bool> show_compat{linkage, false, "show_compat", Category::UiGameList};
// Size & File Types Column
- Setting<bool> show_size{true, "show_size"};
- Setting<bool> show_types{true, "show_types"};
+ Setting<bool> show_size{linkage, true, "show_size", Category::UiGameList};
+ Setting<bool> show_types{linkage, true, "show_types", Category::UiGameList};
bool configuration_applied;
bool reset_to_defaults;
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index b2049ae57..cfc1a5d81 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -98,8 +98,26 @@ void Config::ReadSetting(const std::string& group, Settings::Setting<Type, range
static_cast<long>(setting.GetDefault())));
}
+void Config::ReadCategory(Settings::Category category) {
+ for (const auto setting : Settings::values.linkage.by_category[category]) {
+ const char* category_name = [&]() {
+ if (category == Settings::Category::Controls) {
+ // For compatibility with older configs
+ return "ControlsGeneral";
+ } else {
+ return Settings::TranslateCategory(category);
+ }
+ }();
+ std::string setting_value =
+ sdl2_config->Get(category_name, setting->GetLabel(), setting->DefaultToString());
+ setting->LoadString(setting_value);
+ }
+}
+
void Config::ReadValues() {
// Controls
+ ReadCategory(Settings::Category::Controls);
+
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
auto& player = Settings::values.players.GetValue()[p];
@@ -139,13 +157,6 @@ void Config::ReadValues() {
player.connected = sdl2_config->GetBoolean(group, "connected", false);
}
- ReadSetting("ControlsGeneral", Settings::values.mouse_enabled);
-
- ReadSetting("ControlsGeneral", Settings::values.touch_device);
-
- ReadSetting("ControlsGeneral", Settings::values.keyboard_enabled);
-
- ReadSetting("ControlsGeneral", Settings::values.debug_pad_enabled);
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
Settings::values.debug_pad_buttons[i] = sdl2_config->Get(
@@ -166,14 +177,6 @@ void Config::ReadValues() {
Settings::values.debug_pad_analogs[i] = default_param;
}
- ReadSetting("ControlsGeneral", Settings::values.enable_raw_input);
- ReadSetting("ControlsGeneral", Settings::values.enable_joycon_driver);
- ReadSetting("ControlsGeneral", Settings::values.enable_procon_driver);
- ReadSetting("ControlsGeneral", Settings::values.random_amiibo_id);
- ReadSetting("ControlsGeneral", Settings::values.emulate_analog_keyboard);
- ReadSetting("ControlsGeneral", Settings::values.vibration_enabled);
- ReadSetting("ControlsGeneral", Settings::values.enable_accurate_vibrations);
- ReadSetting("ControlsGeneral", Settings::values.motion_enabled);
Settings::values.touchscreen.enabled =
sdl2_config->GetBoolean("ControlsGeneral", "touch_enabled", true);
Settings::values.touchscreen.rotation_angle =
@@ -217,10 +220,19 @@ void Config::ReadValues() {
Settings::values.touch_from_button_map_index = std::clamp(
Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1);
- ReadSetting("ControlsGeneral", Settings::values.udp_input_servers);
+ ReadCategory(Settings::Category::Audio);
+ ReadCategory(Settings::Category::Core);
+ ReadCategory(Settings::Category::Cpu);
+ ReadCategory(Settings::Category::Renderer);
+ ReadCategory(Settings::Category::AdvancedGraphics);
+ ReadCategory(Settings::Category::System);
+ ReadCategory(Settings::Category::DataStorage);
+ ReadCategory(Settings::Category::Debugging);
+ ReadCategory(Settings::Category::Miscellaneous);
+ ReadCategory(Settings::Category::Network);
+ ReadCategory(Settings::Category::WebService);
// Data Storage
- ReadSetting("Data Storage", Settings::values.use_virtual_sd);
FS::SetYuzuPath(FS::YuzuPath::NANDDir,
sdl2_config->Get("Data Storage", "nand_directory",
FS::GetYuzuPathString(FS::YuzuPath::NANDDir)));
@@ -233,122 +245,10 @@ void Config::ReadValues() {
FS::SetYuzuPath(FS::YuzuPath::DumpDir,
sdl2_config->Get("Data Storage", "dump_directory",
FS::GetYuzuPathString(FS::YuzuPath::DumpDir)));
- ReadSetting("Data Storage", Settings::values.gamecard_inserted);
- ReadSetting("Data Storage", Settings::values.gamecard_current_game);
- ReadSetting("Data Storage", Settings::values.gamecard_path);
-
- // System
- ReadSetting("System", Settings::values.use_docked_mode);
-
- ReadSetting("System", Settings::values.current_user);
- Settings::values.current_user = std::clamp<int>(Settings::values.current_user.GetValue(), 0,
- Service::Account::MAX_USERS - 1);
-
- const auto rng_seed_enabled = sdl2_config->GetBoolean("System", "rng_seed_enabled", false);
- if (rng_seed_enabled) {
- Settings::values.rng_seed.SetValue(sdl2_config->GetInteger("System", "rng_seed", 0));
- } else {
- Settings::values.rng_seed.SetValue(std::nullopt);
- }
-
- const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false);
- if (custom_rtc_enabled) {
- Settings::values.custom_rtc = sdl2_config->GetInteger("System", "custom_rtc", 0);
- } else {
- Settings::values.custom_rtc = std::nullopt;
- }
-
- ReadSetting("System", Settings::values.language_index);
- ReadSetting("System", Settings::values.region_index);
- ReadSetting("System", Settings::values.time_zone_index);
- ReadSetting("System", Settings::values.sound_index);
-
- // Core
- ReadSetting("Core", Settings::values.use_multi_core);
- ReadSetting("Core", Settings::values.use_unsafe_extended_memory_layout);
-
- // Cpu
- ReadSetting("Cpu", Settings::values.cpu_accuracy);
- ReadSetting("Cpu", Settings::values.cpu_debug_mode);
- ReadSetting("Cpu", Settings::values.cpuopt_page_tables);
- ReadSetting("Cpu", Settings::values.cpuopt_block_linking);
- ReadSetting("Cpu", Settings::values.cpuopt_return_stack_buffer);
- ReadSetting("Cpu", Settings::values.cpuopt_fast_dispatcher);
- ReadSetting("Cpu", Settings::values.cpuopt_context_elimination);
- ReadSetting("Cpu", Settings::values.cpuopt_const_prop);
- ReadSetting("Cpu", Settings::values.cpuopt_misc_ir);
- ReadSetting("Cpu", Settings::values.cpuopt_reduce_misalign_checks);
- ReadSetting("Cpu", Settings::values.cpuopt_fastmem);
- ReadSetting("Cpu", Settings::values.cpuopt_fastmem_exclusives);
- ReadSetting("Cpu", Settings::values.cpuopt_recompile_exclusives);
- ReadSetting("Cpu", Settings::values.cpuopt_ignore_memory_aborts);
- ReadSetting("Cpu", Settings::values.cpuopt_unsafe_unfuse_fma);
- ReadSetting("Cpu", Settings::values.cpuopt_unsafe_reduce_fp_error);
- ReadSetting("Cpu", Settings::values.cpuopt_unsafe_ignore_standard_fpcr);
- ReadSetting("Cpu", Settings::values.cpuopt_unsafe_inaccurate_nan);
- ReadSetting("Cpu", Settings::values.cpuopt_unsafe_fastmem_check);
- ReadSetting("Cpu", Settings::values.cpuopt_unsafe_ignore_global_monitor);
-
- // Renderer
- ReadSetting("Renderer", Settings::values.renderer_backend);
- ReadSetting("Renderer", Settings::values.async_presentation);
- ReadSetting("Renderer", Settings::values.renderer_force_max_clock);
- ReadSetting("Renderer", Settings::values.renderer_debug);
- ReadSetting("Renderer", Settings::values.renderer_shader_feedback);
- ReadSetting("Renderer", Settings::values.enable_nsight_aftermath);
- ReadSetting("Renderer", Settings::values.disable_shader_loop_safety_checks);
- ReadSetting("Renderer", Settings::values.vulkan_device);
-
- ReadSetting("Renderer", Settings::values.resolution_setup);
- ReadSetting("Renderer", Settings::values.scaling_filter);
- ReadSetting("Renderer", Settings::values.fsr_sharpening_slider);
- ReadSetting("Renderer", Settings::values.anti_aliasing);
- ReadSetting("Renderer", Settings::values.fullscreen_mode);
- ReadSetting("Renderer", Settings::values.aspect_ratio);
- ReadSetting("Renderer", Settings::values.max_anisotropy);
- ReadSetting("Renderer", Settings::values.use_speed_limit);
- ReadSetting("Renderer", Settings::values.speed_limit);
- ReadSetting("Renderer", Settings::values.use_disk_shader_cache);
- ReadSetting("Renderer", Settings::values.gpu_accuracy);
- ReadSetting("Renderer", Settings::values.use_asynchronous_gpu_emulation);
- ReadSetting("Renderer", Settings::values.vsync_mode);
- ReadSetting("Renderer", Settings::values.shader_backend);
- ReadSetting("Renderer", Settings::values.use_reactive_flushing);
- ReadSetting("Renderer", Settings::values.use_asynchronous_shaders);
- ReadSetting("Renderer", Settings::values.nvdec_emulation);
- ReadSetting("Renderer", Settings::values.accelerate_astc);
- ReadSetting("Renderer", Settings::values.astc_recompression);
- ReadSetting("Renderer", Settings::values.use_vulkan_driver_pipeline_cache);
-
- ReadSetting("Renderer", Settings::values.bg_red);
- ReadSetting("Renderer", Settings::values.bg_green);
- ReadSetting("Renderer", Settings::values.bg_blue);
-
- // Audio
- ReadSetting("Audio", Settings::values.sink_id);
- ReadSetting("Audio", Settings::values.audio_output_device_id);
- ReadSetting("Audio", Settings::values.volume);
-
- // Miscellaneous
- // log_filter has a different default here than from common
- Settings::values.log_filter =
- sdl2_config->Get("Miscellaneous", Settings::values.log_filter.GetLabel(), "*:Trace");
- ReadSetting("Miscellaneous", Settings::values.use_dev_keys);
// Debugging
Settings::values.record_frame_times =
sdl2_config->GetBoolean("Debugging", "record_frame_times", false);
- ReadSetting("Debugging", Settings::values.dump_exefs);
- ReadSetting("Debugging", Settings::values.dump_nso);
- ReadSetting("Debugging", Settings::values.enable_fs_access_log);
- ReadSetting("Debugging", Settings::values.reporting_services);
- ReadSetting("Debugging", Settings::values.quest_flag);
- ReadSetting("Debugging", Settings::values.use_debug_asserts);
- ReadSetting("Debugging", Settings::values.use_auto_stub);
- ReadSetting("Debugging", Settings::values.disable_macro_jit);
- ReadSetting("Debugging", Settings::values.disable_macro_hle);
- ReadSetting("Debugging", Settings::values.use_gdbstub);
- ReadSetting("Debugging", Settings::values.gdbstub_port);
const auto title_list = sdl2_config->Get("AddOns", "title_ids", "");
std::stringstream ss(title_list);
@@ -366,15 +266,6 @@ void Config::ReadValues() {
Settings::values.disabled_addons.insert_or_assign(title_id, out);
}
-
- // Web Service
- ReadSetting("WebService", Settings::values.enable_telemetry);
- ReadSetting("WebService", Settings::values.web_api_url);
- ReadSetting("WebService", Settings::values.yuzu_username);
- ReadSetting("WebService", Settings::values.yuzu_token);
-
- // Network
- ReadSetting("Network", Settings::values.network_interface);
}
void Config::Reload() {
diff --git a/src/yuzu_cmd/config.h b/src/yuzu_cmd/config.h
index 021438b17..512591a39 100644
--- a/src/yuzu_cmd/config.h
+++ b/src/yuzu_cmd/config.h
@@ -34,4 +34,5 @@ private:
*/
template <typename Type, bool ranged>
void ReadSetting(const std::string& group, Settings::Setting<Type, ranged>& setting);
+ void ReadCategory(Settings::Category category);
};