From 60773194a039fced8cf2da308e1b8220d08a1636 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Mon, 5 Jun 2023 21:05:22 -0400 Subject: settings: Add a registry of settings LoadString: Sanitize input settings: Handle empty string, remove redundant category settings: Rename Input to Controls, FS to DataStorage settings: Fix Controls groups information settings: Move use_docked_mode to System (again) settings: Document settings: Add type identification function settings: Move registry into values settings: Move global_reset_registry into values settings: Separate AdvGraphics from Renderer settings: More document squash settings: Use linkage object uisettings: Move registry into settings Probably wont build without uisettings: Use settings linkage object config: Load settings with a map Uses the new all_settings vector to load settings. qt-config: Rename settings category qt config: Rename to read category config: Read/write contols category with for_each This is extremely limited due to the complexity of the Controls group, but this handles the the settings that use the interface. qt-config: Use new settings registry qt-config: Read/write advgrphics qt-config: Use settings linkage object yuzu_cmd: Load setting off of vector cmd-config: Finish settings rename config: Read controls settings group with for_each cmd/config: Move registry into values cmd: Read adv graphics cmd-config: Use settings linkage object --- src/common/settings.h | 620 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 434 insertions(+), 186 deletions(-) (limited to 'src/common/settings.h') 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 #include #include +#include #include +#include #include #include @@ -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> 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> by_category; + std::vector> 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 -class Setting { +template +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,10 +269,61 @@ 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()) { + return value_; + } else if constexpr (std::is_same>()) { + return value_.has_value() ? std::to_string(*value_) : "0"; + } else if constexpr (std::is_same()) { + return value_ ? "true" : "false"; + } else { + return std::to_string(static_cast(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. * @@ -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()) { + this->SetValue(input); + } else if constexpr (std::is_same>()) { + this->SetValue(static_cast(std::stoll(input))); + } else if constexpr (std::is_same()) { + this->SetValue(input == "true"); + } else { + this->SetValue(static_cast(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 -class SwitchableSetting : virtual public Setting { +template +class SwitchableSetting : virtual public Setting { 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{default_val, name} { - global_reset_registry.push_front([this]() { this->SetGlobal(true); }); + : Setting{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{default_val, min_val, max_val, name} { - global_reset_registry.push_front([this]() { this->SetGlobal(true); }); + : Setting{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 sink_id{"auto", "output_engine"}; - Setting audio_output_device_id{"auto", "output_device"}; - Setting audio_input_device_id{"auto", "input_device"}; - Setting audio_muted{false, "audio_muted"}; - SwitchableSetting volume{100, 0, 200, "volume"}; - Setting dump_audio_commands{false, "dump_audio_commands"}; + Setting sink_id{linkage, "auto", "output_engine", Category::Audio}; + Setting audio_output_device_id{linkage, "auto", "output_device", Category::Audio}; + Setting audio_input_device_id{linkage, "auto", "input_device", Category::Audio}; + Setting audio_muted{linkage, false, "audio_muted", Category::Audio}; + SwitchableSetting volume{linkage, 100, 0, 200, "volume", Category::Audio}; + Setting dump_audio_commands{linkage, false, "dump_audio_commands", + Category::Audio}; // Core - SwitchableSetting use_multi_core{true, "use_multi_core"}; - SwitchableSetting use_unsafe_extended_memory_layout{false, - "use_unsafe_extended_memory_layout"}; + SwitchableSetting use_multi_core{linkage, true, "use_multi_core", Category::Core}; + SwitchableSetting use_unsafe_extended_memory_layout{ + linkage, false, "use_unsafe_extended_memory_layout", Category::Core}; // Cpu - SwitchableSetting cpu_accuracy{CPUAccuracy::Auto, CPUAccuracy::Auto, - CPUAccuracy::Paranoid, "cpu_accuracy"}; + SwitchableSetting 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 cpu_accuracy_first_time{true, "cpu_accuracy_first_time"}; - Setting cpu_debug_mode{false, "cpu_debug_mode"}; - - Setting cpuopt_page_tables{true, "cpuopt_page_tables"}; - Setting cpuopt_block_linking{true, "cpuopt_block_linking"}; - Setting cpuopt_return_stack_buffer{true, "cpuopt_return_stack_buffer"}; - Setting cpuopt_fast_dispatcher{true, "cpuopt_fast_dispatcher"}; - Setting cpuopt_context_elimination{true, "cpuopt_context_elimination"}; - Setting cpuopt_const_prop{true, "cpuopt_const_prop"}; - Setting cpuopt_misc_ir{true, "cpuopt_misc_ir"}; - Setting cpuopt_reduce_misalign_checks{true, "cpuopt_reduce_misalign_checks"}; - Setting cpuopt_fastmem{true, "cpuopt_fastmem"}; - Setting cpuopt_fastmem_exclusives{true, "cpuopt_fastmem_exclusives"}; - Setting cpuopt_recompile_exclusives{true, "cpuopt_recompile_exclusives"}; - Setting cpuopt_ignore_memory_aborts{true, "cpuopt_ignore_memory_aborts"}; - - SwitchableSetting cpuopt_unsafe_unfuse_fma{true, "cpuopt_unsafe_unfuse_fma"}; - SwitchableSetting cpuopt_unsafe_reduce_fp_error{true, "cpuopt_unsafe_reduce_fp_error"}; + Setting cpu_accuracy_first_time{linkage, true, "cpu_accuracy_first_time", Category::Cpu}; + Setting cpu_debug_mode{linkage, false, "cpu_debug_mode", Category::Cpu}; + + Setting cpuopt_page_tables{linkage, true, "cpuopt_page_tables", Category::Cpu}; + Setting cpuopt_block_linking{linkage, true, "cpuopt_block_linking", Category::Cpu}; + Setting cpuopt_return_stack_buffer{linkage, true, "cpuopt_return_stack_buffer", + Category::Cpu}; + Setting cpuopt_fast_dispatcher{linkage, true, "cpuopt_fast_dispatcher", Category::Cpu}; + Setting cpuopt_context_elimination{linkage, true, "cpuopt_context_elimination", + Category::Cpu}; + Setting cpuopt_const_prop{linkage, true, "cpuopt_const_prop", Category::Cpu}; + Setting cpuopt_misc_ir{linkage, true, "cpuopt_misc_ir", Category::Cpu}; + Setting cpuopt_reduce_misalign_checks{linkage, true, "cpuopt_reduce_misalign_checks", + Category::Cpu}; + Setting cpuopt_fastmem{linkage, true, "cpuopt_fastmem", Category::Cpu}; + Setting cpuopt_fastmem_exclusives{linkage, true, "cpuopt_fastmem_exclusives", + Category::Cpu}; + Setting cpuopt_recompile_exclusives{linkage, true, "cpuopt_recompile_exclusives", + Category::Cpu}; + Setting cpuopt_ignore_memory_aborts{linkage, true, "cpuopt_ignore_memory_aborts", + Category::Cpu}; + + SwitchableSetting cpuopt_unsafe_unfuse_fma{linkage, true, "cpuopt_unsafe_unfuse_fma", + Category::Cpu}; + SwitchableSetting cpuopt_unsafe_reduce_fp_error{ + linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::Cpu}; SwitchableSetting cpuopt_unsafe_ignore_standard_fpcr{ - true, "cpuopt_unsafe_ignore_standard_fpcr"}; - SwitchableSetting cpuopt_unsafe_inaccurate_nan{true, "cpuopt_unsafe_inaccurate_nan"}; - SwitchableSetting cpuopt_unsafe_fastmem_check{true, "cpuopt_unsafe_fastmem_check"}; + linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::Cpu}; + SwitchableSetting cpuopt_unsafe_inaccurate_nan{ + linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::Cpu}; + SwitchableSetting cpuopt_unsafe_fastmem_check{ + linkage, true, "cpuopt_unsafe_fastmem_check", Category::Cpu}; SwitchableSetting cpuopt_unsafe_ignore_global_monitor{ - true, "cpuopt_unsafe_ignore_global_monitor"}; + linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::Cpu}; // Renderer SwitchableSetting renderer_backend{ - RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, "backend"}; - SwitchableSetting async_presentation{false, "async_presentation"}; - SwitchableSetting renderer_force_max_clock{false, "force_max_clock"}; - Setting renderer_debug{false, "debug"}; - Setting renderer_shader_feedback{false, "shader_feedback"}; - Setting enable_nsight_aftermath{false, "nsight_aftermath"}; - Setting disable_shader_loop_safety_checks{false, "disable_shader_loop_safety_checks"}; - SwitchableSetting vulkan_device{0, "vulkan_device"}; + linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, + "backend", Category::Renderer}; + SwitchableSetting async_presentation{linkage, false, "async_presentation", + Category::AdvancedGraphics}; + SwitchableSetting renderer_force_max_clock{linkage, false, "force_max_clock", + Category::AdvancedGraphics}; + Setting renderer_debug{linkage, false, "debug", Category::Renderer}; + Setting renderer_shader_feedback{linkage, false, "shader_feedback", Category::Renderer}; + Setting enable_nsight_aftermath{linkage, false, "nsight_aftermath", Category::Renderer}; + Setting disable_shader_loop_safety_checks{ + linkage, false, "disable_shader_loop_safety_checks", Category::Renderer}; + SwitchableSetting vulkan_device{linkage, 0, "vulkan_device", Category::Renderer}; ResolutionScalingInfo resolution_info{}; - SwitchableSetting resolution_setup{ResolutionSetup::Res1X, "resolution_setup"}; - SwitchableSetting scaling_filter{ScalingFilter::Bilinear, "scaling_filter"}; - SwitchableSetting fsr_sharpening_slider{25, 0, 200, "fsr_sharpening_slider"}; - SwitchableSetting anti_aliasing{AntiAliasing::None, "anti_aliasing"}; + SwitchableSetting resolution_setup{linkage, ResolutionSetup::Res1X, + "resolution_setup", Category::Renderer}; + SwitchableSetting scaling_filter{linkage, ScalingFilter::Bilinear, + "scaling_filter", Category::Renderer}; + SwitchableSetting fsr_sharpening_slider{ + linkage, 25, 0, 200, "fsr_sharpening_slider", Category::Renderer}; + SwitchableSetting 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 fullscreen_mode{ + SwitchableSetting fullscreen_mode{linkage, #ifdef _WIN32 - FullscreenMode::Borderless, + FullscreenMode::Borderless, #else - FullscreenMode::Exclusive, + FullscreenMode::Exclusive, #endif - FullscreenMode::Borderless, FullscreenMode::Exclusive, "fullscreen_mode"}; - SwitchableSetting aspect_ratio{0, 0, 4, "aspect_ratio"}; - SwitchableSetting max_anisotropy{0, 0, 5, "max_anisotropy"}; - SwitchableSetting use_speed_limit{true, "use_speed_limit"}; - SwitchableSetting speed_limit{100, 0, 9999, "speed_limit"}; - SwitchableSetting use_disk_shader_cache{true, "use_disk_shader_cache"}; - SwitchableSetting gpu_accuracy{GPUAccuracy::High, GPUAccuracy::Normal, - GPUAccuracy::Extreme, "gpu_accuracy"}; - SwitchableSetting use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; - SwitchableSetting nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; - SwitchableSetting accelerate_astc{ - AstcDecodeMode::CPU, AstcDecodeMode::CPU, AstcDecodeMode::CPUAsynchronous, - "accelerate_astc"}; - Setting vsync_mode{VSyncMode::FIFO, VSyncMode::Immediate, - VSyncMode::FIFORelaxed, "use_vsync"}; - SwitchableSetting use_reactive_flushing{true, "use_reactive_flushing"}; - SwitchableSetting shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL, - ShaderBackend::SPIRV, "shader_backend"}; - SwitchableSetting use_asynchronous_shaders{false, "use_asynchronous_shaders"}; - SwitchableSetting use_fast_gpu_time{true, "use_fast_gpu_time"}; - SwitchableSetting use_vulkan_driver_pipeline_cache{true, - "use_vulkan_driver_pipeline_cache"}; - SwitchableSetting enable_compute_pipelines{false, "enable_compute_pipelines"}; - SwitchableSetting astc_recompression{ - AstcRecompression::Uncompressed, AstcRecompression::Uncompressed, AstcRecompression::Bc3, - "astc_recompression"}; - SwitchableSetting use_video_framerate{false, "use_video_framerate"}; - SwitchableSetting barrier_feedback_loops{true, "barrier_feedback_loops"}; - - SwitchableSetting bg_red{0, "bg_red"}; - SwitchableSetting bg_green{0, "bg_green"}; - SwitchableSetting bg_blue{0, "bg_blue"}; + FullscreenMode::Borderless, + FullscreenMode::Exclusive, + "fullscreen_mode", + Category::Renderer}; + SwitchableSetting aspect_ratio{linkage, 0, 0, 4, "aspect_ratio", Category::Renderer}; + SwitchableSetting max_anisotropy{ + linkage, 0, 0, 5, "max_anisotropy", Category::AdvancedGraphics}; + SwitchableSetting use_speed_limit{linkage, true, "use_speed_limit", + Category::Renderer}; + SwitchableSetting speed_limit{linkage, 100, 0, + 9999, "speed_limit", Category::Renderer}; + SwitchableSetting use_disk_shader_cache{linkage, true, "use_disk_shader_cache", + Category::Renderer}; + SwitchableSetting gpu_accuracy{ + linkage, GPUAccuracy::High, GPUAccuracy::Normal, GPUAccuracy::Extreme, + "gpu_accuracy", Category::AdvancedGraphics}; + SwitchableSetting use_asynchronous_gpu_emulation{ + linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer}; + SwitchableSetting nvdec_emulation{linkage, NvdecEmulation::GPU, + "nvdec_emulation", Category::Renderer}; + SwitchableSetting accelerate_astc{linkage, + AstcDecodeMode::CPU, + AstcDecodeMode::CPU, + AstcDecodeMode::CPUAsynchronous, + "accelerate_astc", + Category::Renderer}; + Setting vsync_mode{ + linkage, VSyncMode::FIFO, VSyncMode::Immediate, VSyncMode::FIFORelaxed, + "use_vsync", Category::Renderer}; + SwitchableSetting use_reactive_flushing{linkage, true, "use_reactive_flushing", + Category::Renderer}; + SwitchableSetting shader_backend{ + linkage, ShaderBackend::GLSL, ShaderBackend::GLSL, ShaderBackend::SPIRV, + "shader_backend", Category::Renderer}; + SwitchableSetting use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders", + Category::Renderer}; + SwitchableSetting use_fast_gpu_time{linkage, true, "use_fast_gpu_time", + Category::AdvancedGraphics}; + SwitchableSetting use_vulkan_driver_pipeline_cache{ + linkage, true, "use_vulkan_driver_pipeline_cache", Category::AdvancedGraphics}; + SwitchableSetting enable_compute_pipelines{linkage, false, "enable_compute_pipelines", + Category::AdvancedGraphics}; + SwitchableSetting astc_recompression{linkage, + AstcRecompression::Uncompressed, + AstcRecompression::Uncompressed, + AstcRecompression::Bc3, + "astc_recompression", + Category::AdvancedGraphics}; + SwitchableSetting use_video_framerate{linkage, false, "use_video_framerate", + Category::AdvancedGraphics}; + SwitchableSetting barrier_feedback_loops{linkage, true, "barrier_feedback_loops", + Category::AdvancedGraphics}; + + SwitchableSetting bg_red{linkage, 0, "bg_red", Category::Renderer}; + SwitchableSetting bg_green{linkage, 0, "bg_green", Category::Renderer}; + SwitchableSetting bg_blue{linkage, 0, "bg_blue", Category::Renderer}; // System - SwitchableSetting rng_seed_enabled{false, "rng_seed_enabled"}; - SwitchableSetting rng_seed{0, "rng_seed"}; - Setting device_name{"Yuzu", "device_name"}; + SwitchableSetting rng_seed_enabled{linkage, false, "rng_seed_enabled", Category::System}; + SwitchableSetting rng_seed{linkage, 0, "rng_seed", Category::System}; + Setting device_name{linkage, "Yuzu", "device_name", Category::System}; // Measured in seconds since epoch - SwitchableSetting custom_rtc_enabled{false, "custom_rtc_enabled"}; - SwitchableSetting custom_rtc{0, "custom_rtc"}; + Setting custom_rtc_enabled{linkage, false, "custom_rtc_enabled", Category::System}; + Setting 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 current_user{0, "current_user"}; - SwitchableSetting language_index{1, 0, 17, "language_index"}; - SwitchableSetting region_index{1, 0, 6, "region_index"}; - SwitchableSetting time_zone_index{0, 0, 45, "time_zone_index"}; - SwitchableSetting sound_index{1, 0, 2, "sound_index"}; + Setting current_user{linkage, 0, "current_user", Category::System}; + SwitchableSetting language_index{linkage, 1, 0, 17, "language_index", + Category::System}; + SwitchableSetting region_index{linkage, 1, 0, 6, "region_index", Category::System}; + SwitchableSetting time_zone_index{linkage, 0, 0, 45, "time_zone_index", + Category::System}; + SwitchableSetting sound_index{linkage, 1, 0, 2, "sound_index", Category::System}; + + SwitchableSetting use_docked_mode{linkage, true, "use_docked_mode", Category::System}; // Controls InputSetting> players; - SwitchableSetting use_docked_mode{true, "use_docked_mode"}; - - Setting enable_raw_input{false, "enable_raw_input"}; - Setting controller_navigation{true, "controller_navigation"}; - Setting enable_joycon_driver{true, "enable_joycon_driver"}; - Setting enable_procon_driver{false, "enable_procon_driver"}; - - SwitchableSetting vibration_enabled{true, "vibration_enabled"}; - SwitchableSetting enable_accurate_vibrations{false, "enable_accurate_vibrations"}; - - SwitchableSetting motion_enabled{true, "motion_enabled"}; - Setting udp_input_servers{"127.0.0.1:26760", "udp_input_servers"}; - Setting enable_udp_controller{false, "enable_udp_controller"}; - - Setting pause_tas_on_load{true, "pause_tas_on_load"}; - Setting tas_enable{false, "tas_enable"}; - Setting tas_loop{false, "tas_loop"}; - - Setting mouse_panning{false, "mouse_panning"}; - Setting mouse_panning_x_sensitivity{50, 1, 100, "mouse_panning_x_sensitivity"}; - Setting mouse_panning_y_sensitivity{50, 1, 100, "mouse_panning_y_sensitivity"}; - Setting mouse_panning_deadzone_counterweight{20, 0, 100, - "mouse_panning_deadzone_counterweight"}; - Setting mouse_panning_decay_strength{18, 0, 100, "mouse_panning_decay_strength"}; - Setting mouse_panning_min_decay{6, 0, 100, "mouse_panning_min_decay"}; - - Setting mouse_enabled{false, "mouse_enabled"}; - Setting emulate_analog_keyboard{false, "emulate_analog_keyboard"}; - Setting keyboard_enabled{false, "keyboard_enabled"}; - - Setting debug_pad_enabled{false, "debug_pad_enabled"}; + Setting + enable_raw_input{linkage, false, "enable_raw_input", Category::Controls}; + Setting controller_navigation{linkage, true, "controller_navigation", Category::Controls}; + Setting enable_joycon_driver{linkage, true, "enable_joycon_driver", Category::Controls}; + Setting enable_procon_driver{linkage, false, "enable_procon_driver", Category::Controls}; + + SwitchableSetting vibration_enabled{linkage, true, "vibration_enabled", + Category::Controls}; + SwitchableSetting enable_accurate_vibrations{linkage, false, "enable_accurate_vibrations", + Category::Controls}; + + SwitchableSetting motion_enabled{linkage, true, "motion_enabled", Category::Controls}; + Setting udp_input_servers{linkage, "127.0.0.1:26760", "udp_input_servers", + Category::Controls}; + Setting enable_udp_controller{linkage, false, "enable_udp_controller", + Category::Controls}; + + Setting pause_tas_on_load{linkage, true, "pause_tas_on_load", Category::Controls}; + Setting tas_enable{linkage, false, "tas_enable", Category::Controls}; + Setting tas_loop{linkage, false, "tas_loop", Category::Controls}; + + Setting mouse_panning{linkage, false, "mouse_panning", Category::Controls}; + Setting mouse_panning_sensitivity{ + linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls}; + Setting mouse_enabled{linkage, false, "mouse_enabled", Category::Controls}; + + Setting mouse_panning_x_sensitivity{ + linkage, 50, 1, 100, "mouse_panning_x_sensitivity", Category::Controls}; + Setting mouse_panning_y_sensitivity{ + linkage, 50, 1, 100, "mouse_panning_y_sensitivity", Category::Controls}; + Setting mouse_panning_deadzone_counterweight{ + linkage, 20, 0, 100, "mouse_panning_deadzone_counterweight", Category::Controls}; + Setting mouse_panning_decay_strength{ + linkage, 18, 0, 100, "mouse_panning_decay_strength", Category::Controls}; + Setting mouse_panning_min_decay{ + linkage, 6, 0, 100, "mouse_panning_min_decay", Category::Controls}; + + Setting emulate_analog_keyboard{linkage, false, "emulate_analog_keyboard", + Category::Controls}; + Setting keyboard_enabled{linkage, false, "keyboard_enabled", Category::Controls}; + + Setting debug_pad_enabled{linkage, false, "debug_pad_enabled", Category::Controls}; ButtonsRaw debug_pad_buttons; AnalogsRaw debug_pad_analogs; TouchscreenInput touchscreen; - Setting touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850", "touch_device"}; - Setting touch_from_button_map_index{0, "touch_from_button_map"}; + Setting touch_device{linkage, "min_x:100,min_y:50,max_x:1800,max_y:850", + "touch_device", Category::Controls}; + Setting touch_from_button_map_index{linkage, 0, "touch_from_button_map", + Category::Controls}; std::vector touch_from_button_maps; - Setting enable_ring_controller{true, "enable_ring_controller"}; + Setting enable_ring_controller{linkage, true, "enable_ring_controller", + Category::Controls}; RingconRaw ringcon_analogs; - Setting enable_ir_sensor{false, "enable_ir_sensor"}; - Setting ir_sensor_device{"auto", "ir_sensor_device"}; + Setting enable_ir_sensor{linkage, false, "enable_ir_sensor", Category::Controls}; + Setting ir_sensor_device{linkage, "auto", "ir_sensor_device", Category::Controls}; - Setting random_amiibo_id{false, "random_amiibo_id"}; + Setting random_amiibo_id{linkage, false, "random_amiibo_id", Category::Controls}; // Data Storage - Setting use_virtual_sd{true, "use_virtual_sd"}; - Setting gamecard_inserted{false, "gamecard_inserted"}; - Setting gamecard_current_game{false, "gamecard_current_game"}; - Setting gamecard_path{std::string(), "gamecard_path"}; + Setting use_virtual_sd{linkage, true, "use_virtual_sd", Category::DataStorage}; + Setting gamecard_inserted{linkage, false, "gamecard_inserted", Category::DataStorage}; + Setting gamecard_current_game{linkage, false, "gamecard_current_game", + Category::DataStorage}; + Setting gamecard_path{linkage, std::string(), "gamecard_path", + Category::DataStorage}; // Debugging bool record_frame_times; - Setting use_gdbstub{false, "use_gdbstub"}; - Setting gdbstub_port{6543, "gdbstub_port"}; - Setting program_args{std::string(), "program_args"}; - Setting dump_exefs{false, "dump_exefs"}; - Setting dump_nso{false, "dump_nso"}; - Setting dump_shaders{false, "dump_shaders"}; - Setting dump_macros{false, "dump_macros"}; - Setting enable_fs_access_log{false, "enable_fs_access_log"}; - Setting reporting_services{false, "reporting_services"}; - Setting quest_flag{false, "quest_flag"}; - Setting disable_macro_jit{false, "disable_macro_jit"}; - Setting disable_macro_hle{false, "disable_macro_hle"}; - Setting extended_logging{false, "extended_logging"}; - Setting use_debug_asserts{false, "use_debug_asserts"}; - Setting use_auto_stub{false, "use_auto_stub"}; - Setting enable_all_controllers{false, "enable_all_controllers"}; - Setting create_crash_dumps{false, "create_crash_dumps"}; - Setting perform_vulkan_check{true, "perform_vulkan_check"}; + Setting use_gdbstub{linkage, false, "use_gdbstub", Category::Debugging}; + Setting gdbstub_port{linkage, 6543, "gdbstub_port", Category::Debugging}; + Setting program_args{linkage, std::string(), "program_args", Category::Debugging}; + Setting dump_exefs{linkage, false, "dump_exefs", Category::Debugging}; + Setting dump_nso{linkage, false, "dump_nso", Category::Debugging}; + Setting dump_shaders{linkage, false, "dump_shaders", Category::Debugging}; + Setting dump_macros{linkage, false, "dump_macros", Category::Debugging}; + Setting enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging}; + Setting reporting_services{linkage, false, "reporting_services", + Category::Debugging}; + Setting quest_flag{linkage, false, "quest_flag", Category::Debugging}; + Setting disable_macro_jit{linkage, false, "disable_macro_jit", Category::Debugging}; + Setting disable_macro_hle{linkage, false, "disable_macro_hle", Category::Debugging}; + Setting extended_logging{linkage, false, "extended_logging", + Category::Debugging}; + Setting use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging}; + Setting use_auto_stub{linkage, false, "use_auto_stub", Category::Debugging}; + Setting enable_all_controllers{linkage, false, "enable_all_controllers", + Category::Debugging}; + Setting create_crash_dumps{linkage, false, "create_crash_dumps", Category::Debugging}; + Setting perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging}; // Miscellaneous - Setting log_filter{"*:Info", "log_filter"}; - Setting use_dev_keys{false, "use_dev_keys"}; + Setting log_filter{linkage, "*:Info", "log_filter", Category::Miscellaneous}; + Setting use_dev_keys{linkage, false, "use_dev_keys", Category::Miscellaneous}; // Network - Setting network_interface{std::string(), "network_interface"}; + Setting network_interface{linkage, std::string(), "network_interface", + Category::Network}; // WebService - Setting enable_telemetry{true, "enable_telemetry"}; - Setting web_api_url{"https://api.yuzu-emu.org", "web_api_url"}; - Setting yuzu_username{std::string(), "yuzu_username"}; - Setting yuzu_token{std::string(), "yuzu_token"}; + Setting enable_telemetry{linkage, true, "enable_telemetry", Category::WebService}; + Setting web_api_url{linkage, "https://api.yuzu-emu.org", "web_api_url", + Category::WebService}; + Setting yuzu_username{linkage, std::string(), "yuzu_username", + Category::WebService}; + Setting yuzu_token{linkage, std::string(), "yuzu_token", Category::WebService}; // Add-Ons std::map> disabled_addons; -- cgit v1.2.3