diff options
39 files changed, 940 insertions, 790 deletions
diff --git a/src/audio_core/audio_out.cpp b/src/audio_core/audio_out.cpp index 20a756dce..44a899d08 100644 --- a/src/audio_core/audio_out.cpp +++ b/src/audio_core/audio_out.cpp | |||
| @@ -30,7 +30,8 @@ StreamPtr AudioOut::OpenStream(Core::Timing::CoreTiming& core_timing, u32 sample | |||
| 30 | u32 num_channels, std::string&& name, | 30 | u32 num_channels, std::string&& name, |
| 31 | Stream::ReleaseCallback&& release_callback) { | 31 | Stream::ReleaseCallback&& release_callback) { |
| 32 | if (!sink) { | 32 | if (!sink) { |
| 33 | sink = CreateSinkFromID(Settings::values.sink_id, Settings::values.audio_device_id); | 33 | sink = CreateSinkFromID(Settings::values.sink_id.GetValue(), |
| 34 | Settings::values.audio_device_id.GetValue()); | ||
| 34 | } | 35 | } |
| 35 | 36 | ||
| 36 | return std::make_shared<Stream>( | 37 | return std::make_shared<Stream>( |
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index e1bb4b7ff..0061e29cc 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -41,7 +41,7 @@ void LogSettings() { | |||
| 41 | LOG_INFO(Config, "yuzu Configuration:"); | 41 | LOG_INFO(Config, "yuzu Configuration:"); |
| 42 | log_setting("Controls_UseDockedMode", values.use_docked_mode.GetValue()); | 42 | log_setting("Controls_UseDockedMode", values.use_docked_mode.GetValue()); |
| 43 | log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); | 43 | log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); |
| 44 | log_setting("System_CurrentUser", values.current_user); | 44 | log_setting("System_CurrentUser", values.current_user.GetValue()); |
| 45 | log_setting("System_LanguageIndex", values.language_index.GetValue()); | 45 | log_setting("System_LanguageIndex", values.language_index.GetValue()); |
| 46 | log_setting("System_RegionIndex", values.region_index.GetValue()); | 46 | log_setting("System_RegionIndex", values.region_index.GetValue()); |
| 47 | log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue()); | 47 | log_setting("System_TimeZoneIndex", values.time_zone_index.GetValue()); |
| @@ -61,18 +61,18 @@ void LogSettings() { | |||
| 61 | log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); | 61 | log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue()); |
| 62 | log_setting("Renderer_UseGarbageCollection", values.use_caches_gc.GetValue()); | 62 | log_setting("Renderer_UseGarbageCollection", values.use_caches_gc.GetValue()); |
| 63 | log_setting("Renderer_AnisotropicFilteringLevel", values.max_anisotropy.GetValue()); | 63 | log_setting("Renderer_AnisotropicFilteringLevel", values.max_anisotropy.GetValue()); |
| 64 | log_setting("Audio_OutputEngine", values.sink_id); | 64 | log_setting("Audio_OutputEngine", values.sink_id.GetValue()); |
| 65 | log_setting("Audio_EnableAudioStretching", values.enable_audio_stretching.GetValue()); | 65 | log_setting("Audio_EnableAudioStretching", values.enable_audio_stretching.GetValue()); |
| 66 | log_setting("Audio_OutputDevice", values.audio_device_id); | 66 | log_setting("Audio_OutputDevice", values.audio_device_id.GetValue()); |
| 67 | log_setting("DataStorage_UseVirtualSd", values.use_virtual_sd); | 67 | log_setting("DataStorage_UseVirtualSd", values.use_virtual_sd.GetValue()); |
| 68 | log_path("DataStorage_CacheDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir)); | 68 | log_path("DataStorage_CacheDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir)); |
| 69 | log_path("DataStorage_ConfigDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir)); | 69 | log_path("DataStorage_ConfigDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir)); |
| 70 | log_path("DataStorage_LoadDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::LoadDir)); | 70 | log_path("DataStorage_LoadDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::LoadDir)); |
| 71 | log_path("DataStorage_NANDDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir)); | 71 | log_path("DataStorage_NANDDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir)); |
| 72 | log_path("DataStorage_SDMCDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::SDMCDir)); | 72 | log_path("DataStorage_SDMCDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::SDMCDir)); |
| 73 | log_setting("Debugging_ProgramArgs", values.program_args); | 73 | log_setting("Debugging_ProgramArgs", values.program_args.GetValue()); |
| 74 | log_setting("Services_BCATBackend", values.bcat_backend); | 74 | log_setting("Services_BCATBackend", values.bcat_backend.GetValue()); |
| 75 | log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local); | 75 | log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local.GetValue()); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | bool IsConfiguringGlobal() { | 78 | bool IsConfiguringGlobal() { |
| @@ -94,7 +94,7 @@ bool IsGPULevelHigh() { | |||
| 94 | 94 | ||
| 95 | bool IsFastmemEnabled() { | 95 | bool IsFastmemEnabled() { |
| 96 | if (values.cpu_accuracy.GetValue() == CPUAccuracy::DebugMode) { | 96 | if (values.cpu_accuracy.GetValue() == CPUAccuracy::DebugMode) { |
| 97 | return values.cpuopt_fastmem; | 97 | return static_cast<bool>(values.cpuopt_fastmem); |
| 98 | } | 98 | } |
| 99 | return true; | 99 | return true; |
| 100 | } | 100 | } |
diff --git a/src/common/settings.h b/src/common/settings.h index 82ec18e27..bf83186f5 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -10,10 +10,12 @@ | |||
| 10 | #include <map> | 10 | #include <map> |
| 11 | #include <optional> | 11 | #include <optional> |
| 12 | #include <string> | 12 | #include <string> |
| 13 | #include <utility> | ||
| 13 | #include <vector> | 14 | #include <vector> |
| 14 | 15 | ||
| 15 | #include "common/common_types.h" | 16 | #include "common/common_types.h" |
| 16 | #include "common/settings_input.h" | 17 | #include "common/settings_input.h" |
| 18 | #include "input_common/udp/client.h" | ||
| 17 | 19 | ||
| 18 | namespace Settings { | 20 | namespace Settings { |
| 19 | 21 | ||
| @@ -34,68 +36,235 @@ enum class CPUAccuracy : u32 { | |||
| 34 | DebugMode = 2, | 36 | DebugMode = 2, |
| 35 | }; | 37 | }; |
| 36 | 38 | ||
| 39 | /** The BasicSetting class is a simple resource manager. It defines a label and default value | ||
| 40 | * alongside the actual value of the setting for simpler and less-error prone use with frontend | ||
| 41 | * configurations. Setting a default value and label is required, though subclasses may deviate from | ||
| 42 | * this requirement. | ||
| 43 | */ | ||
| 44 | template <typename Type> | ||
| 45 | class BasicSetting { | ||
| 46 | protected: | ||
| 47 | BasicSetting() = default; | ||
| 48 | |||
| 49 | /** | ||
| 50 | * Only sets the setting to the given initializer, leaving the other members to their default | ||
| 51 | * initializers. | ||
| 52 | * | ||
| 53 | * @param global_val Initial value of the setting | ||
| 54 | */ | ||
| 55 | explicit BasicSetting(const Type& global_val) : global{global_val} {} | ||
| 56 | |||
| 57 | public: | ||
| 58 | /** | ||
| 59 | * Sets a default value, label, and setting value. | ||
| 60 | * | ||
| 61 | * @param default_val Intial value of the setting, and default value of the setting | ||
| 62 | * @param name Label for the setting | ||
| 63 | */ | ||
| 64 | explicit BasicSetting(const Type& default_val, const std::string& name) | ||
| 65 | : default_value{default_val}, global{default_val}, label{name} {} | ||
| 66 | ~BasicSetting() = default; | ||
| 67 | |||
| 68 | /** | ||
| 69 | * Returns a reference to the setting's value. | ||
| 70 | * | ||
| 71 | * @returns A reference to the setting | ||
| 72 | */ | ||
| 73 | [[nodiscard]] const Type& GetValue() const { | ||
| 74 | return global; | ||
| 75 | } | ||
| 76 | |||
| 77 | /** | ||
| 78 | * Sets the setting to the given value. | ||
| 79 | * | ||
| 80 | * @param value The desired value | ||
| 81 | */ | ||
| 82 | void SetValue(const Type& value) { | ||
| 83 | Type temp{value}; | ||
| 84 | std::swap(global, temp); | ||
| 85 | } | ||
| 86 | |||
| 87 | /** | ||
| 88 | * Returns the value that this setting was created with. | ||
| 89 | * | ||
| 90 | * @returns A reference to the default value | ||
| 91 | */ | ||
| 92 | [[nodiscard]] const Type& GetDefault() const { | ||
| 93 | return default_value; | ||
| 94 | } | ||
| 95 | |||
| 96 | /** | ||
| 97 | * Returns the label this setting was created with. | ||
| 98 | * | ||
| 99 | * @returns A reference to the label | ||
| 100 | */ | ||
| 101 | [[nodiscard]] const std::string& GetLabel() const { | ||
| 102 | return label; | ||
| 103 | } | ||
| 104 | |||
| 105 | /** | ||
| 106 | * Assigns a value to the setting. | ||
| 107 | * | ||
| 108 | * @param value The desired setting value | ||
| 109 | * | ||
| 110 | * @returns A reference to the setting | ||
| 111 | */ | ||
| 112 | const Type& operator=(const Type& value) { | ||
| 113 | Type temp{value}; | ||
| 114 | std::swap(global, temp); | ||
| 115 | return global; | ||
| 116 | } | ||
| 117 | |||
| 118 | /** | ||
| 119 | * Returns a reference to the setting. | ||
| 120 | * | ||
| 121 | * @returns A reference to the setting | ||
| 122 | */ | ||
| 123 | explicit operator const Type&() const { | ||
| 124 | return global; | ||
| 125 | } | ||
| 126 | |||
| 127 | protected: | ||
| 128 | const Type default_value{}; ///< The default value | ||
| 129 | Type global{}; ///< The setting | ||
| 130 | const std::string label{}; ///< The setting's label | ||
| 131 | }; | ||
| 132 | |||
| 133 | /** | ||
| 134 | * The Setting class is a slightly more complex version of the BasicSetting class. This adds a | ||
| 135 | * custom setting to switch to when a guest application specifically requires it. The effect is that | ||
| 136 | * other components of the emulator can access the setting's intended value without any need for the | ||
| 137 | * component to ask whether the custom or global setting is needed at the moment. | ||
| 138 | * | ||
| 139 | * By default, the global setting is used. | ||
| 140 | * | ||
| 141 | * Like the BasicSetting, this requires setting a default value and label to use. | ||
| 142 | */ | ||
| 37 | template <typename Type> | 143 | template <typename Type> |
| 38 | class Setting final { | 144 | class Setting final : public BasicSetting<Type> { |
| 39 | public: | 145 | public: |
| 40 | Setting() = default; | 146 | /** |
| 41 | explicit Setting(Type val) : global{val} {} | 147 | * Sets a default value, label, and setting value. |
| 148 | * | ||
| 149 | * @param default_val Intial value of the setting, and default value of the setting | ||
| 150 | * @param name Label for the setting | ||
| 151 | */ | ||
| 152 | explicit Setting(const Type& default_val, const std::string& name) | ||
| 153 | : BasicSetting<Type>(default_val, name) {} | ||
| 42 | ~Setting() = default; | 154 | ~Setting() = default; |
| 155 | |||
| 156 | /** | ||
| 157 | * Tells this setting to represent either the global or custom setting when other member | ||
| 158 | * functions are used. | ||
| 159 | * | ||
| 160 | * @param to_global Whether to use the global or custom setting. | ||
| 161 | */ | ||
| 43 | void SetGlobal(bool to_global) { | 162 | void SetGlobal(bool to_global) { |
| 44 | use_global = to_global; | 163 | use_global = to_global; |
| 45 | } | 164 | } |
| 46 | bool UsingGlobal() const { | 165 | |
| 166 | /** | ||
| 167 | * Returns whether this setting is using the global setting or not. | ||
| 168 | * | ||
| 169 | * @returns The global state | ||
| 170 | */ | ||
| 171 | [[nodiscard]] bool UsingGlobal() const { | ||
| 47 | return use_global; | 172 | return use_global; |
| 48 | } | 173 | } |
| 49 | Type GetValue(bool need_global = false) const { | 174 | |
| 175 | /** | ||
| 176 | * Returns either the global or custom setting depending on the values of this setting's global | ||
| 177 | * state or if the global value was specifically requested. | ||
| 178 | * | ||
| 179 | * @param need_global Request global value regardless of setting's state; defaults to false | ||
| 180 | * | ||
| 181 | * @returns The required value of the setting | ||
| 182 | */ | ||
| 183 | [[nodiscard]] const Type& GetValue(bool need_global = false) const { | ||
| 50 | if (use_global || need_global) { | 184 | if (use_global || need_global) { |
| 51 | return global; | 185 | return this->global; |
| 52 | } | 186 | } |
| 53 | return local; | 187 | return custom; |
| 54 | } | 188 | } |
| 189 | |||
| 190 | /** | ||
| 191 | * Sets the current setting value depending on the global state. | ||
| 192 | * | ||
| 193 | * @param value The new value | ||
| 194 | */ | ||
| 55 | void SetValue(const Type& value) { | 195 | void SetValue(const Type& value) { |
| 196 | Type temp{value}; | ||
| 56 | if (use_global) { | 197 | if (use_global) { |
| 57 | global = value; | 198 | std::swap(this->global, temp); |
| 58 | } else { | 199 | } else { |
| 59 | local = value; | 200 | std::swap(custom, temp); |
| 201 | } | ||
| 202 | } | ||
| 203 | |||
| 204 | /** | ||
| 205 | * Assigns the current setting value depending on the global state. | ||
| 206 | * | ||
| 207 | * @param value The new value | ||
| 208 | * | ||
| 209 | * @returns A reference to the current setting value | ||
| 210 | */ | ||
| 211 | const Type& operator=(const Type& value) { | ||
| 212 | Type temp{value}; | ||
| 213 | if (use_global) { | ||
| 214 | std::swap(this->global, temp); | ||
| 215 | return this->global; | ||
| 216 | } | ||
| 217 | std::swap(custom, temp); | ||
| 218 | return custom; | ||
| 219 | } | ||
| 220 | |||
| 221 | /** | ||
| 222 | * Returns the current setting value depending on the global state. | ||
| 223 | * | ||
| 224 | * @returns A reference to the current setting value | ||
| 225 | */ | ||
| 226 | explicit operator const Type&() const { | ||
| 227 | if (use_global) { | ||
| 228 | return this->global; | ||
| 60 | } | 229 | } |
| 230 | return custom; | ||
| 61 | } | 231 | } |
| 62 | 232 | ||
| 63 | private: | 233 | private: |
| 64 | bool use_global = true; | 234 | bool use_global{true}; ///< The setting's global state |
| 65 | Type global{}; | 235 | Type custom{}; ///< The custom value of the setting |
| 66 | Type local{}; | ||
| 67 | }; | 236 | }; |
| 68 | 237 | ||
| 69 | /** | 238 | /** |
| 70 | * The InputSetting class allows for getting a reference to either the global or local members. | 239 | * The InputSetting class allows for getting a reference to either the global or custom members. |
| 71 | * This is required as we cannot easily modify the values of user-defined types within containers | 240 | * This is required as we cannot easily modify the values of user-defined types within containers |
| 72 | * using the SetValue() member function found in the Setting class. The primary purpose of this | 241 | * using the SetValue() member function found in the Setting class. The primary purpose of this |
| 73 | * class is to store an array of 10 PlayerInput structs for both the global and local (per-game) | 242 | * class is to store an array of 10 PlayerInput structs for both the global and custom setting and |
| 74 | * setting and allows for easily accessing and modifying both settings. | 243 | * allows for easily accessing and modifying both settings. |
| 75 | */ | 244 | */ |
| 76 | template <typename Type> | 245 | template <typename Type> |
| 77 | class InputSetting final { | 246 | class InputSetting final { |
| 78 | public: | 247 | public: |
| 79 | InputSetting() = default; | 248 | InputSetting() = default; |
| 80 | explicit InputSetting(Type val) : global{val} {} | 249 | explicit InputSetting(Type val) : BasicSetting<Type>(val) {} |
| 81 | ~InputSetting() = default; | 250 | ~InputSetting() = default; |
| 82 | void SetGlobal(bool to_global) { | 251 | void SetGlobal(bool to_global) { |
| 83 | use_global = to_global; | 252 | use_global = to_global; |
| 84 | } | 253 | } |
| 85 | bool UsingGlobal() const { | 254 | [[nodiscard]] bool UsingGlobal() const { |
| 86 | return use_global; | 255 | return use_global; |
| 87 | } | 256 | } |
| 88 | Type& GetValue(bool need_global = false) { | 257 | [[nodiscard]] Type& GetValue(bool need_global = false) { |
| 89 | if (use_global || need_global) { | 258 | if (use_global || need_global) { |
| 90 | return global; | 259 | return global; |
| 91 | } | 260 | } |
| 92 | return local; | 261 | return custom; |
| 93 | } | 262 | } |
| 94 | 263 | ||
| 95 | private: | 264 | private: |
| 96 | bool use_global = true; | 265 | bool use_global{true}; ///< The setting's global state |
| 97 | Type global{}; | 266 | Type global{}; ///< The setting |
| 98 | Type local{}; | 267 | Type custom{}; ///< The custom setting value |
| 99 | }; | 268 | }; |
| 100 | 269 | ||
| 101 | struct TouchFromButtonMap { | 270 | struct TouchFromButtonMap { |
| @@ -105,144 +274,155 @@ struct TouchFromButtonMap { | |||
| 105 | 274 | ||
| 106 | struct Values { | 275 | struct Values { |
| 107 | // Audio | 276 | // Audio |
| 108 | std::string audio_device_id; | 277 | BasicSetting<std::string> audio_device_id{"auto", "output_device"}; |
| 109 | std::string sink_id; | 278 | BasicSetting<std::string> sink_id{"auto", "output_engine"}; |
| 110 | bool audio_muted; | 279 | BasicSetting<bool> audio_muted{false, "audio_muted"}; |
| 111 | Setting<bool> enable_audio_stretching; | 280 | Setting<bool> enable_audio_stretching{true, "enable_audio_stretching"}; |
| 112 | Setting<float> volume; | 281 | Setting<float> volume{1.0f, "volume"}; |
| 113 | 282 | ||
| 114 | // Core | 283 | // Core |
| 115 | Setting<bool> use_multi_core; | 284 | Setting<bool> use_multi_core{true, "use_multi_core"}; |
| 116 | 285 | ||
| 117 | // Cpu | 286 | // Cpu |
| 118 | Setting<CPUAccuracy> cpu_accuracy; | 287 | Setting<CPUAccuracy> cpu_accuracy{CPUAccuracy::Accurate, "cpu_accuracy"}; |
| 119 | 288 | ||
| 120 | bool cpuopt_page_tables; | 289 | BasicSetting<bool> cpuopt_page_tables{true, "cpuopt_page_tables"}; |
| 121 | bool cpuopt_block_linking; | 290 | BasicSetting<bool> cpuopt_block_linking{true, "cpuopt_block_linking"}; |
| 122 | bool cpuopt_return_stack_buffer; | 291 | BasicSetting<bool> cpuopt_return_stack_buffer{true, "cpuopt_return_stack_buffer"}; |
| 123 | bool cpuopt_fast_dispatcher; | 292 | BasicSetting<bool> cpuopt_fast_dispatcher{true, "cpuopt_fast_dispatcher"}; |
| 124 | bool cpuopt_context_elimination; | 293 | BasicSetting<bool> cpuopt_context_elimination{true, "cpuopt_context_elimination"}; |
| 125 | bool cpuopt_const_prop; | 294 | BasicSetting<bool> cpuopt_const_prop{true, "cpuopt_const_prop"}; |
| 126 | bool cpuopt_misc_ir; | 295 | BasicSetting<bool> cpuopt_misc_ir{true, "cpuopt_misc_ir"}; |
| 127 | bool cpuopt_reduce_misalign_checks; | 296 | BasicSetting<bool> cpuopt_reduce_misalign_checks{true, "cpuopt_reduce_misalign_checks"}; |
| 128 | bool cpuopt_fastmem; | 297 | BasicSetting<bool> cpuopt_fastmem{true, "cpuopt_fastmem"}; |
| 129 | 298 | ||
| 130 | Setting<bool> cpuopt_unsafe_unfuse_fma; | 299 | Setting<bool> cpuopt_unsafe_unfuse_fma{true, "cpuopt_unsafe_unfuse_fma"}; |
| 131 | Setting<bool> cpuopt_unsafe_reduce_fp_error; | 300 | Setting<bool> cpuopt_unsafe_reduce_fp_error{true, "cpuopt_unsafe_reduce_fp_error"}; |
| 132 | Setting<bool> cpuopt_unsafe_ignore_standard_fpcr; | 301 | Setting<bool> cpuopt_unsafe_ignore_standard_fpcr{true, "cpuopt_unsafe_ignore_standard_fpcr"}; |
| 133 | Setting<bool> cpuopt_unsafe_inaccurate_nan; | 302 | Setting<bool> cpuopt_unsafe_inaccurate_nan{true, "cpuopt_unsafe_inaccurate_nan"}; |
| 134 | Setting<bool> cpuopt_unsafe_fastmem_check; | 303 | Setting<bool> cpuopt_unsafe_fastmem_check{true, "cpuopt_unsafe_fastmem_check"}; |
| 135 | 304 | ||
| 136 | // Renderer | 305 | // Renderer |
| 137 | Setting<RendererBackend> renderer_backend; | 306 | Setting<RendererBackend> renderer_backend{RendererBackend::OpenGL, "backend"}; |
| 138 | bool renderer_debug; | 307 | BasicSetting<bool> renderer_debug{false, "debug"}; |
| 139 | Setting<int> vulkan_device; | 308 | Setting<int> vulkan_device{0, "vulkan_device"}; |
| 140 | 309 | ||
| 141 | Setting<u16> resolution_factor{1}; | 310 | Setting<u16> resolution_factor{1, "resolution_factor"}; |
| 142 | Setting<int> fullscreen_mode; | 311 | // *nix platforms may have issues with the borderless windowed fullscreen mode. |
| 143 | Setting<int> aspect_ratio; | 312 | // Default to exclusive fullscreen on these platforms for now. |
| 144 | Setting<int> max_anisotropy; | 313 | Setting<int> fullscreen_mode{ |
| 145 | Setting<bool> use_frame_limit; | 314 | #ifdef _WIN32 |
| 146 | Setting<u16> frame_limit; | 315 | 0, |
| 147 | Setting<bool> use_disk_shader_cache; | 316 | #else |
| 148 | Setting<GPUAccuracy> gpu_accuracy; | 317 | 1, |
| 149 | Setting<bool> use_asynchronous_gpu_emulation; | 318 | #endif |
| 150 | Setting<bool> use_nvdec_emulation; | 319 | "fullscreen_mode"}; |
| 151 | Setting<bool> accelerate_astc; | 320 | Setting<int> aspect_ratio{0, "aspect_ratio"}; |
| 152 | Setting<bool> use_vsync; | 321 | Setting<int> max_anisotropy{0, "max_anisotropy"}; |
| 153 | Setting<bool> disable_fps_limit; | 322 | Setting<bool> use_frame_limit{true, "use_frame_limit"}; |
| 154 | Setting<bool> use_assembly_shaders; | 323 | Setting<u16> frame_limit{100, "frame_limit"}; |
| 155 | Setting<bool> use_asynchronous_shaders; | 324 | Setting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"}; |
| 156 | Setting<bool> use_fast_gpu_time; | 325 | Setting<GPUAccuracy> gpu_accuracy{GPUAccuracy::High, "gpu_accuracy"}; |
| 157 | Setting<bool> use_caches_gc; | 326 | Setting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; |
| 158 | 327 | Setting<bool> use_nvdec_emulation{true, "use_nvdec_emulation"}; | |
| 159 | Setting<float> bg_red; | 328 | Setting<bool> accelerate_astc{true, "accelerate_astc"}; |
| 160 | Setting<float> bg_green; | 329 | Setting<bool> use_vsync{true, "use_vsync"}; |
| 161 | Setting<float> bg_blue; | 330 | Setting<bool> disable_fps_limit{false, "disable_fps_limit"}; |
| 331 | Setting<bool> use_assembly_shaders{false, "use_assembly_shaders"}; | ||
| 332 | Setting<bool> use_asynchronous_shaders{false, "use_asynchronous_shaders"}; | ||
| 333 | Setting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"}; | ||
| 334 | Setting<bool> use_caches_gc{false, "use_caches_gc"}; | ||
| 335 | |||
| 336 | Setting<float> bg_red{0.0f, "bg_red"}; | ||
| 337 | Setting<float> bg_green{0.0f, "bg_green"}; | ||
| 338 | Setting<float> bg_blue{0.0f, "bg_blue"}; | ||
| 162 | 339 | ||
| 163 | // System | 340 | // System |
| 164 | Setting<std::optional<u32>> rng_seed; | 341 | Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; |
| 165 | // Measured in seconds since epoch | 342 | // Measured in seconds since epoch |
| 166 | std::optional<std::chrono::seconds> custom_rtc; | 343 | std::optional<std::chrono::seconds> custom_rtc; |
| 167 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` | 344 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` |
| 168 | std::chrono::seconds custom_rtc_differential; | 345 | std::chrono::seconds custom_rtc_differential; |
| 169 | 346 | ||
| 170 | s32 current_user; | 347 | BasicSetting<s32> current_user{0, "current_user"}; |
| 171 | Setting<s32> language_index; | 348 | Setting<s32> language_index{1, "language_index"}; |
| 172 | Setting<s32> region_index; | 349 | Setting<s32> region_index{1, "region_index"}; |
| 173 | Setting<s32> time_zone_index; | 350 | Setting<s32> time_zone_index{0, "time_zone_index"}; |
| 174 | Setting<s32> sound_index; | 351 | Setting<s32> sound_index{1, "sound_index"}; |
| 175 | 352 | ||
| 176 | // Controls | 353 | // Controls |
| 177 | InputSetting<std::array<PlayerInput, 10>> players; | 354 | InputSetting<std::array<PlayerInput, 10>> players; |
| 178 | 355 | ||
| 179 | Setting<bool> use_docked_mode; | 356 | Setting<bool> use_docked_mode{true, "use_docked_mode"}; |
| 180 | 357 | ||
| 181 | Setting<bool> vibration_enabled; | 358 | Setting<bool> vibration_enabled{true, "vibration_enabled"}; |
| 182 | Setting<bool> enable_accurate_vibrations; | 359 | Setting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"}; |
| 183 | 360 | ||
| 184 | Setting<bool> motion_enabled; | 361 | Setting<bool> motion_enabled{true, "motion_enabled"}; |
| 185 | std::string motion_device; | 362 | BasicSetting<std::string> motion_device{"engine:motion_emu,update_period:100,sensitivity:0.01", |
| 186 | std::string udp_input_servers; | 363 | "motion_device"}; |
| 364 | BasicSetting<std::string> udp_input_servers{InputCommon::CemuhookUDP::DEFAULT_SRV, | ||
| 365 | "udp_input_servers"}; | ||
| 187 | 366 | ||
| 188 | bool mouse_panning; | 367 | BasicSetting<bool> mouse_panning{false, "mouse_panning"}; |
| 189 | float mouse_panning_sensitivity; | 368 | BasicSetting<float> mouse_panning_sensitivity{1.0f, "mouse_panning_sensitivity"}; |
| 190 | bool mouse_enabled; | 369 | BasicSetting<bool> mouse_enabled{false, "mouse_enabled"}; |
| 191 | std::string mouse_device; | 370 | std::string mouse_device; |
| 192 | MouseButtonsRaw mouse_buttons; | 371 | MouseButtonsRaw mouse_buttons; |
| 193 | 372 | ||
| 194 | bool emulate_analog_keyboard; | 373 | BasicSetting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"}; |
| 195 | bool keyboard_enabled; | 374 | BasicSetting<bool> keyboard_enabled{false, "keyboard_enabled"}; |
| 196 | KeyboardKeysRaw keyboard_keys; | 375 | KeyboardKeysRaw keyboard_keys; |
| 197 | KeyboardModsRaw keyboard_mods; | 376 | KeyboardModsRaw keyboard_mods; |
| 198 | 377 | ||
| 199 | bool debug_pad_enabled; | 378 | BasicSetting<bool> debug_pad_enabled{false, "debug_pad_enabled"}; |
| 200 | ButtonsRaw debug_pad_buttons; | 379 | ButtonsRaw debug_pad_buttons; |
| 201 | AnalogsRaw debug_pad_analogs; | 380 | AnalogsRaw debug_pad_analogs; |
| 202 | 381 | ||
| 203 | TouchscreenInput touchscreen; | 382 | TouchscreenInput touchscreen; |
| 204 | 383 | ||
| 205 | bool use_touch_from_button; | 384 | BasicSetting<bool> use_touch_from_button{false, "use_touch_from_button"}; |
| 206 | std::string touch_device; | 385 | BasicSetting<std::string> touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850", |
| 207 | int touch_from_button_map_index; | 386 | "touch_device"}; |
| 387 | BasicSetting<int> touch_from_button_map_index{0, "touch_from_button_map"}; | ||
| 208 | std::vector<TouchFromButtonMap> touch_from_button_maps; | 388 | std::vector<TouchFromButtonMap> touch_from_button_maps; |
| 209 | 389 | ||
| 210 | std::atomic_bool is_device_reload_pending{true}; | 390 | std::atomic_bool is_device_reload_pending{true}; |
| 211 | 391 | ||
| 212 | // Data Storage | 392 | // Data Storage |
| 213 | bool use_virtual_sd; | 393 | BasicSetting<bool> use_virtual_sd{true, "use_virtual_sd"}; |
| 214 | bool gamecard_inserted; | 394 | BasicSetting<bool> gamecard_inserted{false, "gamecard_inserted"}; |
| 215 | bool gamecard_current_game; | 395 | BasicSetting<bool> gamecard_current_game{false, "gamecard_current_game"}; |
| 216 | std::string gamecard_path; | 396 | BasicSetting<std::string> gamecard_path{std::string(), "gamecard_path"}; |
| 217 | 397 | ||
| 218 | // Debugging | 398 | // Debugging |
| 219 | bool record_frame_times; | 399 | bool record_frame_times; |
| 220 | bool use_gdbstub; | 400 | BasicSetting<bool> use_gdbstub{false, "use_gdbstub"}; |
| 221 | u16 gdbstub_port; | 401 | BasicSetting<u16> gdbstub_port{0, "gdbstub_port"}; |
| 222 | std::string program_args; | 402 | BasicSetting<std::string> program_args{std::string(), "program_args"}; |
| 223 | bool dump_exefs; | 403 | BasicSetting<bool> dump_exefs{false, "dump_exefs"}; |
| 224 | bool dump_nso; | 404 | BasicSetting<bool> dump_nso{false, "dump_nso"}; |
| 225 | bool enable_fs_access_log; | 405 | BasicSetting<bool> enable_fs_access_log{false, "enable_fs_access_log"}; |
| 226 | bool reporting_services; | 406 | BasicSetting<bool> reporting_services{false, "reporting_services"}; |
| 227 | bool quest_flag; | 407 | BasicSetting<bool> quest_flag{false, "quest_flag"}; |
| 228 | bool disable_macro_jit; | 408 | BasicSetting<bool> disable_macro_jit{false, "disable_macro_jit"}; |
| 229 | bool extended_logging; | 409 | BasicSetting<bool> extended_logging{false, "extended_logging"}; |
| 230 | bool use_debug_asserts; | 410 | BasicSetting<bool> use_debug_asserts{false, "use_debug_asserts"}; |
| 231 | bool use_auto_stub; | 411 | BasicSetting<bool> use_auto_stub{false, "use_auto_stub"}; |
| 232 | 412 | ||
| 233 | // Miscellaneous | 413 | // Miscellaneous |
| 234 | std::string log_filter; | 414 | BasicSetting<std::string> log_filter{"*:Info", "log_filter"}; |
| 235 | bool use_dev_keys; | 415 | BasicSetting<bool> use_dev_keys{false, "use_dev_keys"}; |
| 236 | 416 | ||
| 237 | // Services | 417 | // Services |
| 238 | std::string bcat_backend; | 418 | BasicSetting<std::string> bcat_backend{"none", "bcat_backend"}; |
| 239 | bool bcat_boxcat_local; | 419 | BasicSetting<bool> bcat_boxcat_local{false, "bcat_boxcat_local"}; |
| 240 | 420 | ||
| 241 | // WebService | 421 | // WebService |
| 242 | bool enable_telemetry; | 422 | BasicSetting<bool> enable_telemetry{true, "enable_telemetry"}; |
| 243 | std::string web_api_url; | 423 | BasicSetting<std::string> web_api_url{"https://api.yuzu-emu.org", "web_api_url"}; |
| 244 | std::string yuzu_username; | 424 | BasicSetting<std::string> yuzu_username{std::string(), "yuzu_username"}; |
| 245 | std::string yuzu_token; | 425 | BasicSetting<std::string> yuzu_token{std::string(), "yuzu_token"}; |
| 246 | 426 | ||
| 247 | // Add-Ons | 427 | // Add-Ons |
| 248 | std::map<u64, std::vector<std::string>> disabled_addons; | 428 | std::map<u64, std::vector<std::string>> disabled_addons; |
diff --git a/src/core/core.cpp b/src/core/core.cpp index e6f1aa0e7..891f1cb49 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -263,9 +263,9 @@ struct System::Impl { | |||
| 263 | if (Settings::values.gamecard_inserted) { | 263 | if (Settings::values.gamecard_inserted) { |
| 264 | if (Settings::values.gamecard_current_game) { | 264 | if (Settings::values.gamecard_current_game) { |
| 265 | fs_controller.SetGameCard(GetGameFileFromPath(virtual_filesystem, filepath)); | 265 | fs_controller.SetGameCard(GetGameFileFromPath(virtual_filesystem, filepath)); |
| 266 | } else if (!Settings::values.gamecard_path.empty()) { | 266 | } else if (!Settings::values.gamecard_path.GetValue().empty()) { |
| 267 | fs_controller.SetGameCard( | 267 | const auto gamecard_path = Settings::values.gamecard_path.GetValue(); |
| 268 | GetGameFileFromPath(virtual_filesystem, Settings::values.gamecard_path)); | 268 | fs_controller.SetGameCard(GetGameFileFromPath(virtual_filesystem, gamecard_path)); |
| 269 | } | 269 | } |
| 270 | } | 270 | } |
| 271 | 271 | ||
diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp index 8d960d1ca..4c58c310f 100644 --- a/src/core/frontend/applets/profile_select.cpp +++ b/src/core/frontend/applets/profile_select.cpp | |||
| @@ -13,7 +13,7 @@ ProfileSelectApplet::~ProfileSelectApplet() = default; | |||
| 13 | void DefaultProfileSelectApplet::SelectProfile( | 13 | void DefaultProfileSelectApplet::SelectProfile( |
| 14 | std::function<void(std::optional<Common::UUID>)> callback) const { | 14 | std::function<void(std::optional<Common::UUID>)> callback) const { |
| 15 | Service::Account::ProfileManager manager; | 15 | Service::Account::ProfileManager manager; |
| 16 | callback(manager.GetUser(Settings::values.current_user).value_or(Common::UUID{})); | 16 | callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); |
| 17 | LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); | 17 | LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); |
| 18 | } | 18 | } |
| 19 | 19 | ||
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index f72d5d561..24a1c9157 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp | |||
| @@ -48,7 +48,8 @@ ProfileManager::ProfileManager() { | |||
| 48 | CreateNewUser(UUID::Generate(), "yuzu"); | 48 | CreateNewUser(UUID::Generate(), "yuzu"); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | auto current = std::clamp<int>(Settings::values.current_user, 0, MAX_USERS - 1); | 51 | auto current = |
| 52 | std::clamp<int>(static_cast<s32>(Settings::values.current_user), 0, MAX_USERS - 1); | ||
| 52 | 53 | ||
| 53 | // If user index don't exist. Load the first user and change the active user | 54 | // If user index don't exist. Load the first user and change the active user |
| 54 | if (!UserExistsIndex(current)) { | 55 | if (!UserExistsIndex(current)) { |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index b578153d3..23ebc1138 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -1443,7 +1443,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { | |||
| 1443 | params.is_account_selected = 1; | 1443 | params.is_account_selected = 1; |
| 1444 | 1444 | ||
| 1445 | Account::ProfileManager profile_manager{}; | 1445 | Account::ProfileManager profile_manager{}; |
| 1446 | const auto uuid = profile_manager.GetUser(Settings::values.current_user); | 1446 | const auto uuid = profile_manager.GetUser(static_cast<s32>(Settings::values.current_user)); |
| 1447 | ASSERT(uuid); | 1447 | ASSERT(uuid); |
| 1448 | params.current_user = uuid->uuid; | 1448 | params.current_user = uuid->uuid; |
| 1449 | 1449 | ||
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index 44e4d0509..f85444da8 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp | |||
| @@ -579,7 +579,7 @@ void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( | |||
| 579 | std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system, | 579 | std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system, |
| 580 | DirectoryGetter getter) { | 580 | DirectoryGetter getter) { |
| 581 | #ifdef YUZU_ENABLE_BOXCAT | 581 | #ifdef YUZU_ENABLE_BOXCAT |
| 582 | if (Settings::values.bcat_backend == "boxcat") { | 582 | if (Settings::values.bcat_backend.GetValue() == "boxcat") { |
| 583 | return std::make_unique<Boxcat>(system.GetAppletManager(), std::move(getter)); | 583 | return std::make_unique<Boxcat>(system.GetAppletManager(), std::move(getter)); |
| 584 | } | 584 | } |
| 585 | #endif | 585 | #endif |
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index f03b2666a..e742db48f 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp | |||
| @@ -179,7 +179,7 @@ private: | |||
| 179 | IPC::ResponseBuilder rb{ctx, 3}; | 179 | IPC::ResponseBuilder rb{ctx, 3}; |
| 180 | rb.Push(ResultSuccess); | 180 | rb.Push(ResultSuccess); |
| 181 | 181 | ||
| 182 | if (Settings::values.bcat_backend == "none") { | 182 | if (Settings::values.bcat_backend.GetValue() == "none") { |
| 183 | rb.PushEnum(RequestState::NotSubmitted); | 183 | rb.PushEnum(RequestState::NotSubmitted); |
| 184 | } else { | 184 | } else { |
| 185 | rb.PushEnum(RequestState::Connected); | 185 | rb.PushEnum(RequestState::Connected); |
| @@ -384,7 +384,7 @@ private: | |||
| 384 | 384 | ||
| 385 | IPC::ResponseBuilder rb{ctx, 3}; | 385 | IPC::ResponseBuilder rb{ctx, 3}; |
| 386 | rb.Push(ResultSuccess); | 386 | rb.Push(ResultSuccess); |
| 387 | if (Settings::values.bcat_backend == "none") { | 387 | if (Settings::values.bcat_backend.GetValue() == "none") { |
| 388 | rb.Push<u8>(0); | 388 | rb.Push<u8>(0); |
| 389 | } else { | 389 | } else { |
| 390 | rb.Push<u8>(1); | 390 | rb.Push<u8>(1); |
| @@ -395,7 +395,7 @@ private: | |||
| 395 | 395 | ||
| 396 | IPC::ResponseBuilder rb{ctx, 3}; | 396 | IPC::ResponseBuilder rb{ctx, 3}; |
| 397 | rb.Push(ResultSuccess); | 397 | rb.Push(ResultSuccess); |
| 398 | if (Settings::values.bcat_backend == "none") { | 398 | if (Settings::values.bcat_backend.GetValue() == "none") { |
| 399 | rb.Push<u8>(0); | 399 | rb.Push<u8>(0); |
| 400 | } else { | 400 | } else { |
| 401 | rb.Push<u8>(1); | 401 | rb.Push<u8>(1); |
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index ece2a74c6..522a604a5 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp | |||
| @@ -160,7 +160,7 @@ void SET::GetQuestFlag(Kernel::HLERequestContext& ctx) { | |||
| 160 | 160 | ||
| 161 | IPC::ResponseBuilder rb{ctx, 3}; | 161 | IPC::ResponseBuilder rb{ctx, 3}; |
| 162 | rb.Push(ResultSuccess); | 162 | rb.Push(ResultSuccess); |
| 163 | rb.Push(static_cast<u32>(Settings::values.quest_flag)); | 163 | rb.Push(static_cast<u32>(Settings::values.quest_flag.GetValue())); |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | void SET::GetLanguageCode(Kernel::HLERequestContext& ctx) { | 166 | void SET::GetLanguageCode(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 618555202..951ea966e 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -155,8 +155,8 @@ static bool LoadNroImpl(Kernel::KProcess& process, const std::vector<u8>& data) | |||
| 155 | codeset.segments[i].size = PageAlignSize(nro_header.segments[i].size); | 155 | codeset.segments[i].size = PageAlignSize(nro_header.segments[i].size); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | if (!Settings::values.program_args.empty()) { | 158 | if (!Settings::values.program_args.GetValue().empty()) { |
| 159 | const auto arg_data = Settings::values.program_args; | 159 | const auto arg_data = Settings::values.program_args.GetValue(); |
| 160 | codeset.DataSegment().size += NSO_ARGUMENT_DATA_ALLOCATION_SIZE; | 160 | codeset.DataSegment().size += NSO_ARGUMENT_DATA_ALLOCATION_SIZE; |
| 161 | NSOArgumentHeader args_header{ | 161 | NSOArgumentHeader args_header{ |
| 162 | NSO_ARGUMENT_DATA_ALLOCATION_SIZE, static_cast<u32_le>(arg_data.size()), {}}; | 162 | NSO_ARGUMENT_DATA_ALLOCATION_SIZE, static_cast<u32_le>(arg_data.size()), {}}; |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 0f5cfda68..4a2224c02 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -104,8 +104,8 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::KProcess& process, Core:: | |||
| 104 | codeset.segments[i].size = nso_header.segments[i].size; | 104 | codeset.segments[i].size = nso_header.segments[i].size; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | if (should_pass_arguments && !Settings::values.program_args.empty()) { | 107 | if (should_pass_arguments && !Settings::values.program_args.GetValue().empty()) { |
| 108 | const auto arg_data{Settings::values.program_args}; | 108 | const auto arg_data{Settings::values.program_args.GetValue()}; |
| 109 | 109 | ||
| 110 | codeset.DataSegment().size += NSO_ARGUMENT_DATA_ALLOCATION_SIZE; | 110 | codeset.DataSegment().size += NSO_ARGUMENT_DATA_ALLOCATION_SIZE; |
| 111 | NSOArgumentHeader args_header{ | 111 | NSOArgumentHeader args_header{ |
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index 82b0f535a..cfaf50105 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp | |||
| @@ -397,7 +397,7 @@ void Reporter::ClearFSAccessLog() const { | |||
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | bool Reporter::IsReportingEnabled() const { | 399 | bool Reporter::IsReportingEnabled() const { |
| 400 | return Settings::values.reporting_services; | 400 | return Settings::values.reporting_services.GetValue(); |
| 401 | } | 401 | } |
| 402 | 402 | ||
| 403 | } // namespace Core | 403 | } // namespace Core |
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index d4c23ced2..066cb23e4 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp | |||
| @@ -135,7 +135,7 @@ u64 RegenerateTelemetryId() { | |||
| 135 | 135 | ||
| 136 | bool VerifyLogin(const std::string& username, const std::string& token) { | 136 | bool VerifyLogin(const std::string& username, const std::string& token) { |
| 137 | #ifdef ENABLE_WEB_SERVICE | 137 | #ifdef ENABLE_WEB_SERVICE |
| 138 | return WebService::VerifyLogin(Settings::values.web_api_url, username, token); | 138 | return WebService::VerifyLogin(Settings::values.web_api_url.GetValue(), username, token); |
| 139 | #else | 139 | #else |
| 140 | return false; | 140 | return false; |
| 141 | #endif | 141 | #endif |
| @@ -152,7 +152,8 @@ TelemetrySession::~TelemetrySession() { | |||
| 152 | 152 | ||
| 153 | #ifdef ENABLE_WEB_SERVICE | 153 | #ifdef ENABLE_WEB_SERVICE |
| 154 | auto backend = std::make_unique<WebService::TelemetryJson>( | 154 | auto backend = std::make_unique<WebService::TelemetryJson>( |
| 155 | Settings::values.web_api_url, Settings::values.yuzu_username, Settings::values.yuzu_token); | 155 | Settings::values.web_api_url.GetValue(), Settings::values.yuzu_username.GetValue(), |
| 156 | Settings::values.yuzu_token.GetValue()); | ||
| 156 | #else | 157 | #else |
| 157 | auto backend = std::make_unique<Telemetry::NullVisitor>(); | 158 | auto backend = std::make_unique<Telemetry::NullVisitor>(); |
| 158 | #endif | 159 | #endif |
| @@ -212,7 +213,7 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader, | |||
| 212 | 213 | ||
| 213 | // Log user configuration information | 214 | // Log user configuration information |
| 214 | constexpr auto field_type = Telemetry::FieldType::UserConfig; | 215 | constexpr auto field_type = Telemetry::FieldType::UserConfig; |
| 215 | AddField(field_type, "Audio_SinkId", Settings::values.sink_id); | 216 | AddField(field_type, "Audio_SinkId", Settings::values.sink_id.GetValue()); |
| 216 | AddField(field_type, "Audio_EnableAudioStretching", | 217 | AddField(field_type, "Audio_EnableAudioStretching", |
| 217 | Settings::values.enable_audio_stretching.GetValue()); | 218 | Settings::values.enable_audio_stretching.GetValue()); |
| 218 | AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue()); | 219 | AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue()); |
| @@ -242,7 +243,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader, | |||
| 242 | bool TelemetrySession::SubmitTestcase() { | 243 | bool TelemetrySession::SubmitTestcase() { |
| 243 | #ifdef ENABLE_WEB_SERVICE | 244 | #ifdef ENABLE_WEB_SERVICE |
| 244 | auto backend = std::make_unique<WebService::TelemetryJson>( | 245 | auto backend = std::make_unique<WebService::TelemetryJson>( |
| 245 | Settings::values.web_api_url, Settings::values.yuzu_username, Settings::values.yuzu_token); | 246 | Settings::values.web_api_url.GetValue(), Settings::values.yuzu_username.GetValue(), |
| 247 | Settings::values.yuzu_token.GetValue()); | ||
| 246 | field_collection.Accept(*backend); | 248 | field_collection.Accept(*backend); |
| 247 | return backend->SubmitTestcase(); | 249 | return backend->SubmitTestcase(); |
| 248 | #else | 250 | #else |
diff --git a/src/input_common/mouse/mouse_poller.cpp b/src/input_common/mouse/mouse_poller.cpp index 758f7af1f..45b3d7340 100644 --- a/src/input_common/mouse/mouse_poller.cpp +++ b/src/input_common/mouse/mouse_poller.cpp | |||
| @@ -84,7 +84,8 @@ public: | |||
| 84 | std::lock_guard lock{mutex}; | 84 | std::lock_guard lock{mutex}; |
| 85 | const auto axis_value = | 85 | const auto axis_value = |
| 86 | static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis)); | 86 | static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis)); |
| 87 | return axis_value * Settings::values.mouse_panning_sensitivity / (100.0f * range); | 87 | const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue(); |
| 88 | return axis_value * sensitivity / (100.0f * range); | ||
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | std::pair<float, float> GetAnalog(u32 analog_axis_x, u32 analog_axis_y) const { | 91 | std::pair<float, float> GetAnalog(u32 analog_axis_x, u32 analog_axis_y) const { |
diff --git a/src/input_common/touch_from_button.cpp b/src/input_common/touch_from_button.cpp index 5b24fd8bf..7878a56d7 100644 --- a/src/input_common/touch_from_button.cpp +++ b/src/input_common/touch_from_button.cpp | |||
| @@ -13,7 +13,7 @@ class TouchFromButtonDevice final : public Input::TouchDevice { | |||
| 13 | public: | 13 | public: |
| 14 | TouchFromButtonDevice() { | 14 | TouchFromButtonDevice() { |
| 15 | const auto button_index = | 15 | const auto button_index = |
| 16 | static_cast<std::size_t>(Settings::values.touch_from_button_map_index); | 16 | static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue()); |
| 17 | const auto& buttons = Settings::values.touch_from_button_maps[button_index].buttons; | 17 | const auto& buttons = Settings::values.touch_from_button_maps[button_index].buttons; |
| 18 | 18 | ||
| 19 | for (const auto& config_entry : buttons) { | 19 | for (const auto& config_entry : buttons) { |
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp index bc1dfab3d..9b0aec797 100644 --- a/src/input_common/udp/client.cpp +++ b/src/input_common/udp/client.cpp | |||
| @@ -201,7 +201,7 @@ bool Client::DeviceConnected(std::size_t pad) const { | |||
| 201 | void Client::ReloadSockets() { | 201 | void Client::ReloadSockets() { |
| 202 | Reset(); | 202 | Reset(); |
| 203 | 203 | ||
| 204 | std::stringstream servers_ss(Settings::values.udp_input_servers); | 204 | std::stringstream servers_ss(static_cast<std::string>(Settings::values.udp_input_servers)); |
| 205 | std::string server_token; | 205 | std::string server_token; |
| 206 | std::size_t client = 0; | 206 | std::size_t client = 0; |
| 207 | while (std::getline(servers_ss, server_token, ',')) { | 207 | while (std::getline(servers_ss, server_token, ',')) { |
| @@ -370,7 +370,7 @@ std::optional<std::size_t> Client::GetUnusedFingerID() const { | |||
| 370 | 370 | ||
| 371 | void Client::UpdateTouchInput(Response::TouchPad& touch_pad, std::size_t client, std::size_t id) { | 371 | void Client::UpdateTouchInput(Response::TouchPad& touch_pad, std::size_t client, std::size_t id) { |
| 372 | // TODO: Use custom calibration per device | 372 | // TODO: Use custom calibration per device |
| 373 | const Common::ParamPackage touch_param(Settings::values.touch_device); | 373 | const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue()); |
| 374 | const u16 min_x = static_cast<u16>(touch_param.Get("min_x", 100)); | 374 | const u16 min_x = static_cast<u16>(touch_param.Get("min_x", 100)); |
| 375 | const u16 min_y = static_cast<u16>(touch_param.Get("min_y", 50)); | 375 | const u16 min_y = static_cast<u16>(touch_param.Get("min_y", 50)); |
| 376 | const u16 max_x = static_cast<u16>(touch_param.Get("max_x", 1800)); | 376 | const u16 max_x = static_cast<u16>(touch_param.Get("max_x", 1800)); |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 3986eb172..bec3a81d9 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -103,7 +103,7 @@ RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_, | |||
| 103 | gpu(gpu_), | 103 | gpu(gpu_), |
| 104 | library(OpenLibrary()), | 104 | library(OpenLibrary()), |
| 105 | instance(CreateInstance(library, dld, VK_API_VERSION_1_1, render_window.GetWindowInfo().type, | 105 | instance(CreateInstance(library, dld, VK_API_VERSION_1_1, render_window.GetWindowInfo().type, |
| 106 | true, Settings::values.renderer_debug)), | 106 | true, Settings::values.renderer_debug.GetValue())), |
| 107 | debug_callback(Settings::values.renderer_debug ? CreateDebugCallback(instance) : nullptr), | 107 | debug_callback(Settings::values.renderer_debug ? CreateDebugCallback(instance) : nullptr), |
| 108 | surface(CreateSurface(instance, render_window)), | 108 | surface(CreateSurface(instance, render_window)), |
| 109 | device(CreateDevice(instance, dld, *surface)), | 109 | device(CreateDevice(instance, dld, *surface)), |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 62bafc453..1a0f75373 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -272,6 +272,91 @@ void Config::Initialize(const std::string& config_name) { | |||
| 272 | } | 272 | } |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | /* {Read,Write}BasicSetting and WriteGlobalSetting templates must be defined here before their | ||
| 276 | * usages later in this file. This allows explicit definition of some types that don't work | ||
| 277 | * nicely with the general version. | ||
| 278 | */ | ||
| 279 | |||
| 280 | // Explicit std::string definition: Qt can't implicitly convert a std::string to a QVariant, nor | ||
| 281 | // can it implicitly convert a QVariant back to a {std::,Q}string | ||
| 282 | template <> | ||
| 283 | void Config::ReadBasicSetting(Settings::BasicSetting<std::string>& setting) { | ||
| 284 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 285 | const auto default_value = QString::fromStdString(setting.GetDefault()); | ||
| 286 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { | ||
| 287 | setting.SetValue(default_value.toStdString()); | ||
| 288 | } else { | ||
| 289 | setting.SetValue(qt_config->value(name, default_value).toString().toStdString()); | ||
| 290 | } | ||
| 291 | } | ||
| 292 | |||
| 293 | template <typename Type> | ||
| 294 | void Config::ReadBasicSetting(Settings::BasicSetting<Type>& setting) { | ||
| 295 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 296 | const Type default_value = setting.GetDefault(); | ||
| 297 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { | ||
| 298 | setting.SetValue(default_value); | ||
| 299 | } else { | ||
| 300 | setting.SetValue( | ||
| 301 | static_cast<QVariant>(qt_config->value(name, default_value)).value<Type>()); | ||
| 302 | } | ||
| 303 | } | ||
| 304 | |||
| 305 | // Explicit std::string definition: Qt can't implicitly convert a std::string to a QVariant | ||
| 306 | template <> | ||
| 307 | void Config::WriteBasicSetting(const Settings::BasicSetting<std::string>& setting) { | ||
| 308 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 309 | const std::string& value = setting.GetValue(); | ||
| 310 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); | ||
| 311 | qt_config->setValue(name, QString::fromStdString(value)); | ||
| 312 | } | ||
| 313 | |||
| 314 | // Explicit float definition: use a double as Qt doesn't write legible floats to config files | ||
| 315 | template <> | ||
| 316 | void Config::WriteBasicSetting(const Settings::BasicSetting<float>& setting) { | ||
| 317 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 318 | const double value = setting.GetValue(); | ||
| 319 | qt_config->setValue(name + QStringLiteral("/default"), | ||
| 320 | setting.GetValue() == setting.GetDefault()); | ||
| 321 | qt_config->setValue(name, value); | ||
| 322 | } | ||
| 323 | |||
| 324 | template <typename Type> | ||
| 325 | void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) { | ||
| 326 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 327 | const Type value = setting.GetValue(); | ||
| 328 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); | ||
| 329 | qt_config->setValue(name, value); | ||
| 330 | } | ||
| 331 | |||
| 332 | // Explicit float definition: use a double as Qt doesn't write legible floats to config files | ||
| 333 | template <> | ||
| 334 | void Config::WriteGlobalSetting(const Settings::Setting<float>& setting) { | ||
| 335 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 336 | const double value = setting.GetValue(global); | ||
| 337 | if (!global) { | ||
| 338 | qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal()); | ||
| 339 | } | ||
| 340 | if (global || !setting.UsingGlobal()) { | ||
| 341 | qt_config->setValue(name + QStringLiteral("/default"), | ||
| 342 | setting.GetValue(global) == setting.GetDefault()); | ||
| 343 | qt_config->setValue(name, value); | ||
| 344 | } | ||
| 345 | } | ||
| 346 | |||
| 347 | template <typename Type> | ||
| 348 | void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) { | ||
| 349 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 350 | const Type& value = setting.GetValue(global); | ||
| 351 | if (!global) { | ||
| 352 | qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal()); | ||
| 353 | } | ||
| 354 | if (global || !setting.UsingGlobal()) { | ||
| 355 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); | ||
| 356 | qt_config->setValue(name, value); | ||
| 357 | } | ||
| 358 | } | ||
| 359 | |||
| 275 | void Config::ReadPlayerValue(std::size_t player_index) { | 360 | void Config::ReadPlayerValue(std::size_t player_index) { |
| 276 | const QString player_prefix = [this, player_index] { | 361 | const QString player_prefix = [this, player_index] { |
| 277 | if (type == ConfigType::InputProfile) { | 362 | if (type == ConfigType::InputProfile) { |
| @@ -395,8 +480,7 @@ void Config::ReadPlayerValue(std::size_t player_index) { | |||
| 395 | } | 480 | } |
| 396 | 481 | ||
| 397 | void Config::ReadDebugValues() { | 482 | void Config::ReadDebugValues() { |
| 398 | Settings::values.debug_pad_enabled = | 483 | ReadBasicSetting(Settings::values.debug_pad_enabled); |
| 399 | ReadSetting(QStringLiteral("debug_pad_enabled"), false).toBool(); | ||
| 400 | 484 | ||
| 401 | for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { | 485 | for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { |
| 402 | const std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]); | 486 | const std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]); |
| @@ -432,8 +516,7 @@ void Config::ReadDebugValues() { | |||
| 432 | } | 516 | } |
| 433 | 517 | ||
| 434 | void Config::ReadKeyboardValues() { | 518 | void Config::ReadKeyboardValues() { |
| 435 | Settings::values.keyboard_enabled = | 519 | ReadBasicSetting(Settings::values.keyboard_enabled); |
| 436 | ReadSetting(QStringLiteral("keyboard_enabled"), false).toBool(); | ||
| 437 | 520 | ||
| 438 | std::transform(default_keyboard_keys.begin(), default_keyboard_keys.end(), | 521 | std::transform(default_keyboard_keys.begin(), default_keyboard_keys.end(), |
| 439 | Settings::values.keyboard_keys.begin(), InputCommon::GenerateKeyboardParam); | 522 | Settings::values.keyboard_keys.begin(), InputCommon::GenerateKeyboardParam); |
| @@ -446,7 +529,7 @@ void Config::ReadKeyboardValues() { | |||
| 446 | } | 529 | } |
| 447 | 530 | ||
| 448 | void Config::ReadMouseValues() { | 531 | void Config::ReadMouseValues() { |
| 449 | Settings::values.mouse_enabled = ReadSetting(QStringLiteral("mouse_enabled"), false).toBool(); | 532 | ReadBasicSetting(Settings::values.mouse_enabled); |
| 450 | 533 | ||
| 451 | for (int i = 0; i < Settings::NativeMouseButton::NumMouseButtons; ++i) { | 534 | for (int i = 0; i < Settings::NativeMouseButton::NumMouseButtons; ++i) { |
| 452 | const std::string default_param = | 535 | const std::string default_param = |
| @@ -481,18 +564,11 @@ void Config::ReadAudioValues() { | |||
| 481 | qt_config->beginGroup(QStringLiteral("Audio")); | 564 | qt_config->beginGroup(QStringLiteral("Audio")); |
| 482 | 565 | ||
| 483 | if (global) { | 566 | if (global) { |
| 484 | Settings::values.sink_id = | 567 | ReadBasicSetting(Settings::values.audio_device_id); |
| 485 | ReadSetting(QStringLiteral("output_engine"), QStringLiteral("auto")) | 568 | ReadBasicSetting(Settings::values.sink_id); |
| 486 | .toString() | ||
| 487 | .toStdString(); | ||
| 488 | Settings::values.audio_device_id = | ||
| 489 | ReadSetting(QStringLiteral("output_device"), QStringLiteral("auto")) | ||
| 490 | .toString() | ||
| 491 | .toStdString(); | ||
| 492 | } | 569 | } |
| 493 | ReadSettingGlobal(Settings::values.enable_audio_stretching, | 570 | ReadGlobalSetting(Settings::values.enable_audio_stretching); |
| 494 | QStringLiteral("enable_audio_stretching"), true); | 571 | ReadGlobalSetting(Settings::values.volume); |
| 495 | ReadSettingGlobal(Settings::values.volume, QStringLiteral("volume"), 1); | ||
| 496 | 572 | ||
| 497 | qt_config->endGroup(); | 573 | qt_config->endGroup(); |
| 498 | } | 574 | } |
| @@ -509,13 +585,11 @@ void Config::ReadControlValues() { | |||
| 509 | ReadTouchscreenValues(); | 585 | ReadTouchscreenValues(); |
| 510 | ReadMotionTouchValues(); | 586 | ReadMotionTouchValues(); |
| 511 | 587 | ||
| 512 | Settings::values.emulate_analog_keyboard = | 588 | ReadBasicSetting(Settings::values.emulate_analog_keyboard); |
| 513 | ReadSetting(QStringLiteral("emulate_analog_keyboard"), false).toBool(); | ||
| 514 | Settings::values.mouse_panning = false; | 589 | Settings::values.mouse_panning = false; |
| 515 | Settings::values.mouse_panning_sensitivity = | 590 | ReadBasicSetting(Settings::values.mouse_panning_sensitivity); |
| 516 | ReadSetting(QStringLiteral("mouse_panning_sensitivity"), 1).toFloat(); | ||
| 517 | 591 | ||
| 518 | ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), true); | 592 | ReadGlobalSetting(Settings::values.use_docked_mode); |
| 519 | 593 | ||
| 520 | // Disable docked mode if handheld is selected | 594 | // Disable docked mode if handheld is selected |
| 521 | const auto controller_type = Settings::values.players.GetValue()[0].controller_type; | 595 | const auto controller_type = Settings::values.players.GetValue()[0].controller_type; |
| @@ -523,11 +597,9 @@ void Config::ReadControlValues() { | |||
| 523 | Settings::values.use_docked_mode.SetValue(false); | 597 | Settings::values.use_docked_mode.SetValue(false); |
| 524 | } | 598 | } |
| 525 | 599 | ||
| 526 | ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"), | 600 | ReadGlobalSetting(Settings::values.vibration_enabled); |
| 527 | true); | 601 | ReadGlobalSetting(Settings::values.enable_accurate_vibrations); |
| 528 | ReadSettingGlobal(Settings::values.enable_accurate_vibrations, | 602 | ReadGlobalSetting(Settings::values.motion_enabled); |
| 529 | QStringLiteral("enable_accurate_vibrations"), false); | ||
| 530 | ReadSettingGlobal(Settings::values.motion_enabled, QStringLiteral("motion_enabled"), true); | ||
| 531 | 603 | ||
| 532 | qt_config->endGroup(); | 604 | qt_config->endGroup(); |
| 533 | } | 605 | } |
| @@ -565,33 +637,19 @@ void Config::ReadMotionTouchValues() { | |||
| 565 | } | 637 | } |
| 566 | qt_config->endArray(); | 638 | qt_config->endArray(); |
| 567 | 639 | ||
| 568 | Settings::values.motion_device = | 640 | ReadBasicSetting(Settings::values.motion_device); |
| 569 | ReadSetting(QStringLiteral("motion_device"), | 641 | ReadBasicSetting(Settings::values.touch_device); |
| 570 | QStringLiteral("engine:motion_emu,update_period:100,sensitivity:0.01")) | 642 | ReadBasicSetting(Settings::values.use_touch_from_button); |
| 571 | .toString() | 643 | ReadBasicSetting(Settings::values.touch_from_button_map_index); |
| 572 | .toStdString(); | 644 | Settings::values.touch_from_button_map_index = std::clamp( |
| 573 | Settings::values.touch_device = | 645 | Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1); |
| 574 | ReadSetting(QStringLiteral("touch_device"), | 646 | ReadBasicSetting(Settings::values.udp_input_servers); |
| 575 | QStringLiteral("min_x:100,min_y:50,max_x:1800,max_y:850")) | ||
| 576 | .toString() | ||
| 577 | .toStdString(); | ||
| 578 | Settings::values.use_touch_from_button = | ||
| 579 | ReadSetting(QStringLiteral("use_touch_from_button"), false).toBool(); | ||
| 580 | Settings::values.touch_from_button_map_index = | ||
| 581 | ReadSetting(QStringLiteral("touch_from_button_map"), 0).toInt(); | ||
| 582 | Settings::values.touch_from_button_map_index = | ||
| 583 | std::clamp(Settings::values.touch_from_button_map_index, 0, num_touch_from_button_maps - 1); | ||
| 584 | Settings::values.udp_input_servers = | ||
| 585 | ReadSetting(QStringLiteral("udp_input_servers"), | ||
| 586 | QString::fromUtf8(InputCommon::CemuhookUDP::DEFAULT_SRV)) | ||
| 587 | .toString() | ||
| 588 | .toStdString(); | ||
| 589 | } | 647 | } |
| 590 | 648 | ||
| 591 | void Config::ReadCoreValues() { | 649 | void Config::ReadCoreValues() { |
| 592 | qt_config->beginGroup(QStringLiteral("Core")); | 650 | qt_config->beginGroup(QStringLiteral("Core")); |
| 593 | 651 | ||
| 594 | ReadSettingGlobal(Settings::values.use_multi_core, QStringLiteral("use_multi_core"), true); | 652 | ReadGlobalSetting(Settings::values.use_multi_core); |
| 595 | 653 | ||
| 596 | qt_config->endGroup(); | 654 | qt_config->endGroup(); |
| 597 | } | 655 | } |
| @@ -599,7 +657,7 @@ void Config::ReadCoreValues() { | |||
| 599 | void Config::ReadDataStorageValues() { | 657 | void Config::ReadDataStorageValues() { |
| 600 | qt_config->beginGroup(QStringLiteral("Data Storage")); | 658 | qt_config->beginGroup(QStringLiteral("Data Storage")); |
| 601 | 659 | ||
| 602 | Settings::values.use_virtual_sd = ReadSetting(QStringLiteral("use_virtual_sd"), true).toBool(); | 660 | ReadBasicSetting(Settings::values.use_virtual_sd); |
| 603 | FS::SetYuzuPath( | 661 | FS::SetYuzuPath( |
| 604 | FS::YuzuPath::NANDDir, | 662 | FS::YuzuPath::NANDDir, |
| 605 | qt_config | 663 | qt_config |
| @@ -628,12 +686,9 @@ void Config::ReadDataStorageValues() { | |||
| 628 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir))) | 686 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir))) |
| 629 | .toString() | 687 | .toString() |
| 630 | .toStdString()); | 688 | .toStdString()); |
| 631 | Settings::values.gamecard_inserted = | 689 | ReadBasicSetting(Settings::values.gamecard_inserted); |
| 632 | ReadSetting(QStringLiteral("gamecard_inserted"), false).toBool(); | 690 | ReadBasicSetting(Settings::values.gamecard_current_game); |
| 633 | Settings::values.gamecard_current_game = | 691 | ReadBasicSetting(Settings::values.gamecard_path); |
| 634 | ReadSetting(QStringLiteral("gamecard_current_game"), false).toBool(); | ||
| 635 | Settings::values.gamecard_path = | ||
| 636 | ReadSetting(QStringLiteral("gamecard_path"), QString{}).toString().toStdString(); | ||
| 637 | 692 | ||
| 638 | qt_config->endGroup(); | 693 | qt_config->endGroup(); |
| 639 | } | 694 | } |
| @@ -644,34 +699,24 @@ void Config::ReadDebuggingValues() { | |||
| 644 | // Intentionally not using the QT default setting as this is intended to be changed in the ini | 699 | // Intentionally not using the QT default setting as this is intended to be changed in the ini |
| 645 | Settings::values.record_frame_times = | 700 | Settings::values.record_frame_times = |
| 646 | qt_config->value(QStringLiteral("record_frame_times"), false).toBool(); | 701 | qt_config->value(QStringLiteral("record_frame_times"), false).toBool(); |
| 647 | Settings::values.program_args = | 702 | ReadBasicSetting(Settings::values.program_args); |
| 648 | ReadSetting(QStringLiteral("program_args"), QString{}).toString().toStdString(); | 703 | ReadBasicSetting(Settings::values.dump_exefs); |
| 649 | Settings::values.dump_exefs = ReadSetting(QStringLiteral("dump_exefs"), false).toBool(); | 704 | ReadBasicSetting(Settings::values.dump_nso); |
| 650 | Settings::values.dump_nso = ReadSetting(QStringLiteral("dump_nso"), false).toBool(); | 705 | ReadBasicSetting(Settings::values.enable_fs_access_log); |
| 651 | Settings::values.enable_fs_access_log = | 706 | ReadBasicSetting(Settings::values.reporting_services); |
| 652 | ReadSetting(QStringLiteral("enable_fs_access_log"), false).toBool(); | 707 | ReadBasicSetting(Settings::values.quest_flag); |
| 653 | Settings::values.reporting_services = | 708 | ReadBasicSetting(Settings::values.disable_macro_jit); |
| 654 | ReadSetting(QStringLiteral("reporting_services"), false).toBool(); | 709 | ReadBasicSetting(Settings::values.extended_logging); |
| 655 | Settings::values.quest_flag = ReadSetting(QStringLiteral("quest_flag"), false).toBool(); | 710 | ReadBasicSetting(Settings::values.use_debug_asserts); |
| 656 | Settings::values.disable_macro_jit = | 711 | ReadBasicSetting(Settings::values.use_auto_stub); |
| 657 | ReadSetting(QStringLiteral("disable_macro_jit"), false).toBool(); | ||
| 658 | Settings::values.extended_logging = | ||
| 659 | ReadSetting(QStringLiteral("extended_logging"), false).toBool(); | ||
| 660 | Settings::values.use_debug_asserts = | ||
| 661 | ReadSetting(QStringLiteral("use_debug_asserts"), false).toBool(); | ||
| 662 | Settings::values.use_auto_stub = ReadSetting(QStringLiteral("use_auto_stub"), false).toBool(); | ||
| 663 | 712 | ||
| 664 | qt_config->endGroup(); | 713 | qt_config->endGroup(); |
| 665 | } | 714 | } |
| 666 | 715 | ||
| 667 | void Config::ReadServiceValues() { | 716 | void Config::ReadServiceValues() { |
| 668 | qt_config->beginGroup(QStringLiteral("Services")); | 717 | qt_config->beginGroup(QStringLiteral("Services")); |
| 669 | Settings::values.bcat_backend = | 718 | ReadBasicSetting(Settings::values.bcat_backend); |
| 670 | ReadSetting(QStringLiteral("bcat_backend"), QStringLiteral("none")) | 719 | ReadBasicSetting(Settings::values.bcat_boxcat_local); |
| 671 | .toString() | ||
| 672 | .toStdString(); | ||
| 673 | Settings::values.bcat_boxcat_local = | ||
| 674 | ReadSetting(QStringLiteral("bcat_boxcat_local"), false).toBool(); | ||
| 675 | qt_config->endGroup(); | 720 | qt_config->endGroup(); |
| 676 | } | 721 | } |
| 677 | 722 | ||
| @@ -697,11 +742,8 @@ void Config::ReadDisabledAddOnValues() { | |||
| 697 | void Config::ReadMiscellaneousValues() { | 742 | void Config::ReadMiscellaneousValues() { |
| 698 | qt_config->beginGroup(QStringLiteral("Miscellaneous")); | 743 | qt_config->beginGroup(QStringLiteral("Miscellaneous")); |
| 699 | 744 | ||
| 700 | Settings::values.log_filter = | 745 | ReadBasicSetting(Settings::values.log_filter); |
| 701 | ReadSetting(QStringLiteral("log_filter"), QStringLiteral("*:Info")) | 746 | ReadBasicSetting(Settings::values.use_dev_keys); |
| 702 | .toString() | ||
| 703 | .toStdString(); | ||
| 704 | Settings::values.use_dev_keys = ReadSetting(QStringLiteral("use_dev_keys"), false).toBool(); | ||
| 705 | 747 | ||
| 706 | qt_config->endGroup(); | 748 | qt_config->endGroup(); |
| 707 | } | 749 | } |
| @@ -751,38 +793,24 @@ void Config::ReadPathValues() { | |||
| 751 | void Config::ReadCpuValues() { | 793 | void Config::ReadCpuValues() { |
| 752 | qt_config->beginGroup(QStringLiteral("Cpu")); | 794 | qt_config->beginGroup(QStringLiteral("Cpu")); |
| 753 | 795 | ||
| 754 | ReadSettingGlobal(Settings::values.cpu_accuracy, QStringLiteral("cpu_accuracy"), 0); | 796 | ReadGlobalSetting(Settings::values.cpu_accuracy); |
| 755 | 797 | ||
| 756 | ReadSettingGlobal(Settings::values.cpuopt_unsafe_unfuse_fma, | 798 | ReadGlobalSetting(Settings::values.cpuopt_unsafe_unfuse_fma); |
| 757 | QStringLiteral("cpuopt_unsafe_unfuse_fma"), true); | 799 | ReadGlobalSetting(Settings::values.cpuopt_unsafe_reduce_fp_error); |
| 758 | ReadSettingGlobal(Settings::values.cpuopt_unsafe_reduce_fp_error, | 800 | ReadGlobalSetting(Settings::values.cpuopt_unsafe_ignore_standard_fpcr); |
| 759 | QStringLiteral("cpuopt_unsafe_reduce_fp_error"), true); | 801 | ReadGlobalSetting(Settings::values.cpuopt_unsafe_inaccurate_nan); |
| 760 | ReadSettingGlobal(Settings::values.cpuopt_unsafe_ignore_standard_fpcr, | 802 | ReadGlobalSetting(Settings::values.cpuopt_unsafe_fastmem_check); |
| 761 | QStringLiteral("cpuopt_unsafe_ignore_standard_fpcr"), true); | ||
| 762 | ReadSettingGlobal(Settings::values.cpuopt_unsafe_inaccurate_nan, | ||
| 763 | QStringLiteral("cpuopt_unsafe_inaccurate_nan"), true); | ||
| 764 | ReadSettingGlobal(Settings::values.cpuopt_unsafe_fastmem_check, | ||
| 765 | QStringLiteral("cpuopt_unsafe_fastmem_check"), true); | ||
| 766 | 803 | ||
| 767 | if (global) { | 804 | if (global) { |
| 768 | Settings::values.cpuopt_page_tables = | 805 | ReadBasicSetting(Settings::values.cpuopt_page_tables); |
| 769 | ReadSetting(QStringLiteral("cpuopt_page_tables"), true).toBool(); | 806 | ReadBasicSetting(Settings::values.cpuopt_block_linking); |
| 770 | Settings::values.cpuopt_block_linking = | 807 | ReadBasicSetting(Settings::values.cpuopt_return_stack_buffer); |
| 771 | ReadSetting(QStringLiteral("cpuopt_block_linking"), true).toBool(); | 808 | ReadBasicSetting(Settings::values.cpuopt_fast_dispatcher); |
| 772 | Settings::values.cpuopt_return_stack_buffer = | 809 | ReadBasicSetting(Settings::values.cpuopt_context_elimination); |
| 773 | ReadSetting(QStringLiteral("cpuopt_return_stack_buffer"), true).toBool(); | 810 | ReadBasicSetting(Settings::values.cpuopt_const_prop); |
| 774 | Settings::values.cpuopt_fast_dispatcher = | 811 | ReadBasicSetting(Settings::values.cpuopt_misc_ir); |
| 775 | ReadSetting(QStringLiteral("cpuopt_fast_dispatcher"), true).toBool(); | 812 | ReadBasicSetting(Settings::values.cpuopt_reduce_misalign_checks); |
| 776 | Settings::values.cpuopt_context_elimination = | 813 | ReadBasicSetting(Settings::values.cpuopt_fastmem); |
| 777 | ReadSetting(QStringLiteral("cpuopt_context_elimination"), true).toBool(); | ||
| 778 | Settings::values.cpuopt_const_prop = | ||
| 779 | ReadSetting(QStringLiteral("cpuopt_const_prop"), true).toBool(); | ||
| 780 | Settings::values.cpuopt_misc_ir = | ||
| 781 | ReadSetting(QStringLiteral("cpuopt_misc_ir"), true).toBool(); | ||
| 782 | Settings::values.cpuopt_reduce_misalign_checks = | ||
| 783 | ReadSetting(QStringLiteral("cpuopt_reduce_misalign_checks"), true).toBool(); | ||
| 784 | Settings::values.cpuopt_fastmem = | ||
| 785 | ReadSetting(QStringLiteral("cpuopt_fastmem"), true).toBool(); | ||
| 786 | } | 814 | } |
| 787 | 815 | ||
| 788 | qt_config->endGroup(); | 816 | qt_config->endGroup(); |
| @@ -791,41 +819,28 @@ void Config::ReadCpuValues() { | |||
| 791 | void Config::ReadRendererValues() { | 819 | void Config::ReadRendererValues() { |
| 792 | qt_config->beginGroup(QStringLiteral("Renderer")); | 820 | qt_config->beginGroup(QStringLiteral("Renderer")); |
| 793 | 821 | ||
| 794 | ReadSettingGlobal(Settings::values.renderer_backend, QStringLiteral("backend"), 0); | 822 | ReadGlobalSetting(Settings::values.renderer_backend); |
| 795 | ReadSettingGlobal(Settings::values.renderer_debug, QStringLiteral("debug"), false); | 823 | ReadBasicSetting(Settings::values.renderer_debug); |
| 796 | ReadSettingGlobal(Settings::values.vulkan_device, QStringLiteral("vulkan_device"), 0); | 824 | ReadGlobalSetting(Settings::values.vulkan_device); |
| 797 | #ifdef _WIN32 | 825 | ReadGlobalSetting(Settings::values.fullscreen_mode); |
| 798 | ReadSettingGlobal(Settings::values.fullscreen_mode, QStringLiteral("fullscreen_mode"), 0); | 826 | ReadGlobalSetting(Settings::values.aspect_ratio); |
| 799 | #else | 827 | ReadGlobalSetting(Settings::values.max_anisotropy); |
| 800 | // *nix platforms may have issues with the borderless windowed fullscreen mode. | 828 | ReadGlobalSetting(Settings::values.use_frame_limit); |
| 801 | // Default to exclusive fullscreen on these platforms for now. | 829 | ReadGlobalSetting(Settings::values.frame_limit); |
| 802 | ReadSettingGlobal(Settings::values.fullscreen_mode, QStringLiteral("fullscreen_mode"), 1); | 830 | ReadGlobalSetting(Settings::values.use_disk_shader_cache); |
| 803 | #endif | 831 | ReadGlobalSetting(Settings::values.gpu_accuracy); |
| 804 | ReadSettingGlobal(Settings::values.aspect_ratio, QStringLiteral("aspect_ratio"), 0); | 832 | ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation); |
| 805 | ReadSettingGlobal(Settings::values.max_anisotropy, QStringLiteral("max_anisotropy"), 0); | 833 | ReadGlobalSetting(Settings::values.use_nvdec_emulation); |
| 806 | ReadSettingGlobal(Settings::values.use_frame_limit, QStringLiteral("use_frame_limit"), true); | 834 | ReadGlobalSetting(Settings::values.accelerate_astc); |
| 807 | ReadSettingGlobal(Settings::values.frame_limit, QStringLiteral("frame_limit"), 100); | 835 | ReadGlobalSetting(Settings::values.use_vsync); |
| 808 | ReadSettingGlobal(Settings::values.use_disk_shader_cache, | 836 | ReadGlobalSetting(Settings::values.disable_fps_limit); |
| 809 | QStringLiteral("use_disk_shader_cache"), true); | 837 | ReadGlobalSetting(Settings::values.use_assembly_shaders); |
| 810 | ReadSettingGlobal(Settings::values.gpu_accuracy, QStringLiteral("gpu_accuracy"), 1); | 838 | ReadGlobalSetting(Settings::values.use_asynchronous_shaders); |
| 811 | ReadSettingGlobal(Settings::values.use_asynchronous_gpu_emulation, | 839 | ReadGlobalSetting(Settings::values.use_fast_gpu_time); |
| 812 | QStringLiteral("use_asynchronous_gpu_emulation"), true); | 840 | ReadGlobalSetting(Settings::values.use_caches_gc); |
| 813 | ReadSettingGlobal(Settings::values.use_nvdec_emulation, QStringLiteral("use_nvdec_emulation"), | 841 | ReadGlobalSetting(Settings::values.bg_red); |
| 814 | true); | 842 | ReadGlobalSetting(Settings::values.bg_green); |
| 815 | ReadSettingGlobal(Settings::values.accelerate_astc, QStringLiteral("accelerate_astc"), true); | 843 | ReadGlobalSetting(Settings::values.bg_blue); |
| 816 | ReadSettingGlobal(Settings::values.use_vsync, QStringLiteral("use_vsync"), true); | ||
| 817 | ReadSettingGlobal(Settings::values.disable_fps_limit, QStringLiteral("disable_fps_limit"), | ||
| 818 | false); | ||
| 819 | ReadSettingGlobal(Settings::values.use_assembly_shaders, QStringLiteral("use_assembly_shaders"), | ||
| 820 | false); | ||
| 821 | ReadSettingGlobal(Settings::values.use_asynchronous_shaders, | ||
| 822 | QStringLiteral("use_asynchronous_shaders"), false); | ||
| 823 | ReadSettingGlobal(Settings::values.use_fast_gpu_time, QStringLiteral("use_fast_gpu_time"), | ||
| 824 | true); | ||
| 825 | ReadSettingGlobal(Settings::values.use_caches_gc, QStringLiteral("use_caches_gc"), false); | ||
| 826 | ReadSettingGlobal(Settings::values.bg_red, QStringLiteral("bg_red"), 0.0); | ||
| 827 | ReadSettingGlobal(Settings::values.bg_green, QStringLiteral("bg_green"), 0.0); | ||
| 828 | ReadSettingGlobal(Settings::values.bg_blue, QStringLiteral("bg_blue"), 0.0); | ||
| 829 | 844 | ||
| 830 | qt_config->endGroup(); | 845 | qt_config->endGroup(); |
| 831 | } | 846 | } |
| @@ -870,15 +885,15 @@ void Config::ReadShortcutValues() { | |||
| 870 | void Config::ReadSystemValues() { | 885 | void Config::ReadSystemValues() { |
| 871 | qt_config->beginGroup(QStringLiteral("System")); | 886 | qt_config->beginGroup(QStringLiteral("System")); |
| 872 | 887 | ||
| 873 | ReadSettingGlobal(Settings::values.current_user, QStringLiteral("current_user"), 0); | 888 | ReadBasicSetting(Settings::values.current_user); |
| 874 | Settings::values.current_user = | 889 | Settings::values.current_user = std::clamp<int>(Settings::values.current_user.GetValue(), 0, |
| 875 | std::clamp<int>(Settings::values.current_user, 0, Service::Account::MAX_USERS - 1); | 890 | Service::Account::MAX_USERS - 1); |
| 876 | 891 | ||
| 877 | ReadSettingGlobal(Settings::values.language_index, QStringLiteral("language_index"), 1); | 892 | ReadGlobalSetting(Settings::values.language_index); |
| 878 | 893 | ||
| 879 | ReadSettingGlobal(Settings::values.region_index, QStringLiteral("region_index"), 1); | 894 | ReadGlobalSetting(Settings::values.region_index); |
| 880 | 895 | ||
| 881 | ReadSettingGlobal(Settings::values.time_zone_index, QStringLiteral("time_zone_index"), 0); | 896 | ReadGlobalSetting(Settings::values.time_zone_index); |
| 882 | 897 | ||
| 883 | bool rng_seed_enabled; | 898 | bool rng_seed_enabled; |
| 884 | ReadSettingGlobal(rng_seed_enabled, QStringLiteral("rng_seed_enabled"), false); | 899 | ReadSettingGlobal(rng_seed_enabled, QStringLiteral("rng_seed_enabled"), false); |
| @@ -904,7 +919,7 @@ void Config::ReadSystemValues() { | |||
| 904 | } | 919 | } |
| 905 | } | 920 | } |
| 906 | 921 | ||
| 907 | ReadSettingGlobal(Settings::values.sound_index, QStringLiteral("sound_index"), 1); | 922 | ReadGlobalSetting(Settings::values.sound_index); |
| 908 | 923 | ||
| 909 | qt_config->endGroup(); | 924 | qt_config->endGroup(); |
| 910 | } | 925 | } |
| @@ -915,10 +930,8 @@ void Config::ReadUIValues() { | |||
| 915 | UISettings::values.theme = | 930 | UISettings::values.theme = |
| 916 | ReadSetting(QStringLiteral("theme"), QString::fromUtf8(UISettings::themes[0].second)) | 931 | ReadSetting(QStringLiteral("theme"), QString::fromUtf8(UISettings::themes[0].second)) |
| 917 | .toString(); | 932 | .toString(); |
| 918 | UISettings::values.enable_discord_presence = | 933 | ReadBasicSetting(UISettings::values.enable_discord_presence); |
| 919 | ReadSetting(QStringLiteral("enable_discord_presence"), true).toBool(); | 934 | ReadBasicSetting(UISettings::values.select_user_on_boot); |
| 920 | UISettings::values.select_user_on_boot = | ||
| 921 | ReadSetting(QStringLiteral("select_user_on_boot"), false).toBool(); | ||
| 922 | 935 | ||
| 923 | ReadUIGamelistValues(); | 936 | ReadUIGamelistValues(); |
| 924 | ReadUILayoutValues(); | 937 | ReadUILayoutValues(); |
| @@ -926,24 +939,17 @@ void Config::ReadUIValues() { | |||
| 926 | ReadScreenshotValues(); | 939 | ReadScreenshotValues(); |
| 927 | ReadShortcutValues(); | 940 | ReadShortcutValues(); |
| 928 | 941 | ||
| 929 | UISettings::values.single_window_mode = | 942 | ReadBasicSetting(UISettings::values.single_window_mode); |
| 930 | ReadSetting(QStringLiteral("singleWindowMode"), true).toBool(); | 943 | ReadBasicSetting(UISettings::values.fullscreen); |
| 931 | UISettings::values.fullscreen = ReadSetting(QStringLiteral("fullscreen"), false).toBool(); | 944 | ReadBasicSetting(UISettings::values.display_titlebar); |
| 932 | UISettings::values.display_titlebar = | 945 | ReadBasicSetting(UISettings::values.show_filter_bar); |
| 933 | ReadSetting(QStringLiteral("displayTitleBars"), true).toBool(); | 946 | ReadBasicSetting(UISettings::values.show_status_bar); |
| 934 | UISettings::values.show_filter_bar = | 947 | ReadBasicSetting(UISettings::values.confirm_before_closing); |
| 935 | ReadSetting(QStringLiteral("showFilterBar"), true).toBool(); | 948 | ReadBasicSetting(UISettings::values.first_start); |
| 936 | UISettings::values.show_status_bar = | 949 | ReadBasicSetting(UISettings::values.callout_flags); |
| 937 | ReadSetting(QStringLiteral("showStatusBar"), true).toBool(); | 950 | ReadBasicSetting(UISettings::values.show_console); |
| 938 | UISettings::values.confirm_before_closing = | 951 | ReadBasicSetting(UISettings::values.pause_when_in_background); |
| 939 | ReadSetting(QStringLiteral("confirmClose"), true).toBool(); | 952 | ReadBasicSetting(UISettings::values.hide_mouse); |
| 940 | UISettings::values.first_start = ReadSetting(QStringLiteral("firstStart"), true).toBool(); | ||
| 941 | UISettings::values.callout_flags = ReadSetting(QStringLiteral("calloutFlags"), 0).toUInt(); | ||
| 942 | UISettings::values.show_console = ReadSetting(QStringLiteral("showConsole"), false).toBool(); | ||
| 943 | UISettings::values.pause_when_in_background = | ||
| 944 | ReadSetting(QStringLiteral("pauseWhenInBackground"), false).toBool(); | ||
| 945 | UISettings::values.hide_mouse = | ||
| 946 | ReadSetting(QStringLiteral("hideInactiveMouse"), false).toBool(); | ||
| 947 | 953 | ||
| 948 | qt_config->endGroup(); | 954 | qt_config->endGroup(); |
| 949 | } | 955 | } |
| @@ -951,12 +957,11 @@ void Config::ReadUIValues() { | |||
| 951 | void Config::ReadUIGamelistValues() { | 957 | void Config::ReadUIGamelistValues() { |
| 952 | qt_config->beginGroup(QStringLiteral("UIGameList")); | 958 | qt_config->beginGroup(QStringLiteral("UIGameList")); |
| 953 | 959 | ||
| 954 | UISettings::values.show_add_ons = ReadSetting(QStringLiteral("show_add_ons"), true).toBool(); | 960 | ReadBasicSetting(UISettings::values.show_add_ons); |
| 955 | UISettings::values.icon_size = ReadSetting(QStringLiteral("icon_size"), 64).toUInt(); | 961 | ReadBasicSetting(UISettings::values.icon_size); |
| 956 | UISettings::values.row_1_text_id = ReadSetting(QStringLiteral("row_1_text_id"), 3).toUInt(); | 962 | ReadBasicSetting(UISettings::values.row_1_text_id); |
| 957 | UISettings::values.row_2_text_id = ReadSetting(QStringLiteral("row_2_text_id"), 2).toUInt(); | 963 | ReadBasicSetting(UISettings::values.row_2_text_id); |
| 958 | UISettings::values.cache_game_list = | 964 | ReadBasicSetting(UISettings::values.cache_game_list); |
| 959 | ReadSetting(QStringLiteral("cache_game_list"), true).toBool(); | ||
| 960 | const int favorites_size = qt_config->beginReadArray(QStringLiteral("favorites")); | 965 | const int favorites_size = qt_config->beginReadArray(QStringLiteral("favorites")); |
| 961 | for (int i = 0; i < favorites_size; i++) { | 966 | for (int i = 0; i < favorites_size; i++) { |
| 962 | qt_config->setArrayIndex(i); | 967 | qt_config->setArrayIndex(i); |
| @@ -979,8 +984,7 @@ void Config::ReadUILayoutValues() { | |||
| 979 | ReadSetting(QStringLiteral("gameListHeaderState")).toByteArray(); | 984 | ReadSetting(QStringLiteral("gameListHeaderState")).toByteArray(); |
| 980 | UISettings::values.microprofile_geometry = | 985 | UISettings::values.microprofile_geometry = |
| 981 | ReadSetting(QStringLiteral("microProfileDialogGeometry")).toByteArray(); | 986 | ReadSetting(QStringLiteral("microProfileDialogGeometry")).toByteArray(); |
| 982 | UISettings::values.microprofile_visible = | 987 | ReadBasicSetting(UISettings::values.microprofile_visible); |
| 983 | ReadSetting(QStringLiteral("microProfileDialogVisible"), false).toBool(); | ||
| 984 | 988 | ||
| 985 | qt_config->endGroup(); | 989 | qt_config->endGroup(); |
| 986 | } | 990 | } |
| @@ -988,16 +992,10 @@ void Config::ReadUILayoutValues() { | |||
| 988 | void Config::ReadWebServiceValues() { | 992 | void Config::ReadWebServiceValues() { |
| 989 | qt_config->beginGroup(QStringLiteral("WebService")); | 993 | qt_config->beginGroup(QStringLiteral("WebService")); |
| 990 | 994 | ||
| 991 | Settings::values.enable_telemetry = | 995 | ReadBasicSetting(Settings::values.enable_telemetry); |
| 992 | ReadSetting(QStringLiteral("enable_telemetry"), true).toBool(); | 996 | ReadBasicSetting(Settings::values.web_api_url); |
| 993 | Settings::values.web_api_url = | 997 | ReadBasicSetting(Settings::values.yuzu_username); |
| 994 | ReadSetting(QStringLiteral("web_api_url"), QStringLiteral("https://api.yuzu-emu.org")) | 998 | ReadBasicSetting(Settings::values.yuzu_token); |
| 995 | .toString() | ||
| 996 | .toStdString(); | ||
| 997 | Settings::values.yuzu_username = | ||
| 998 | ReadSetting(QStringLiteral("yuzu_username")).toString().toStdString(); | ||
| 999 | Settings::values.yuzu_token = | ||
| 1000 | ReadSetting(QStringLiteral("yuzu_token")).toString().toStdString(); | ||
| 1001 | 999 | ||
| 1002 | qt_config->endGroup(); | 1000 | qt_config->endGroup(); |
| 1003 | } | 1001 | } |
| @@ -1083,7 +1081,7 @@ void Config::SavePlayerValue(std::size_t player_index) { | |||
| 1083 | } | 1081 | } |
| 1084 | 1082 | ||
| 1085 | void Config::SaveDebugValues() { | 1083 | void Config::SaveDebugValues() { |
| 1086 | WriteSetting(QStringLiteral("debug_pad_enabled"), Settings::values.debug_pad_enabled, false); | 1084 | WriteBasicSetting(Settings::values.debug_pad_enabled); |
| 1087 | for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { | 1085 | for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { |
| 1088 | const std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]); | 1086 | const std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]); |
| 1089 | WriteSetting(QStringLiteral("debug_pad_") + | 1087 | WriteSetting(QStringLiteral("debug_pad_") + |
| @@ -1103,7 +1101,7 @@ void Config::SaveDebugValues() { | |||
| 1103 | } | 1101 | } |
| 1104 | 1102 | ||
| 1105 | void Config::SaveMouseValues() { | 1103 | void Config::SaveMouseValues() { |
| 1106 | WriteSetting(QStringLiteral("mouse_enabled"), Settings::values.mouse_enabled, false); | 1104 | WriteBasicSetting(Settings::values.mouse_enabled); |
| 1107 | 1105 | ||
| 1108 | for (int i = 0; i < Settings::NativeMouseButton::NumMouseButtons; ++i) { | 1106 | for (int i = 0; i < Settings::NativeMouseButton::NumMouseButtons; ++i) { |
| 1109 | const std::string default_param = | 1107 | const std::string default_param = |
| @@ -1126,19 +1124,11 @@ void Config::SaveTouchscreenValues() { | |||
| 1126 | } | 1124 | } |
| 1127 | 1125 | ||
| 1128 | void Config::SaveMotionTouchValues() { | 1126 | void Config::SaveMotionTouchValues() { |
| 1129 | WriteSetting(QStringLiteral("motion_device"), | 1127 | WriteBasicSetting(Settings::values.motion_device); |
| 1130 | QString::fromStdString(Settings::values.motion_device), | 1128 | WriteBasicSetting(Settings::values.touch_device); |
| 1131 | QStringLiteral("engine:motion_emu,update_period:100,sensitivity:0.01")); | 1129 | WriteBasicSetting(Settings::values.use_touch_from_button); |
| 1132 | WriteSetting(QStringLiteral("touch_device"), | 1130 | WriteBasicSetting(Settings::values.touch_from_button_map_index); |
| 1133 | QString::fromStdString(Settings::values.touch_device), | 1131 | WriteBasicSetting(Settings::values.udp_input_servers); |
| 1134 | QStringLiteral("engine:emu_window")); | ||
| 1135 | WriteSetting(QStringLiteral("use_touch_from_button"), Settings::values.use_touch_from_button, | ||
| 1136 | false); | ||
| 1137 | WriteSetting(QStringLiteral("touch_from_button_map"), | ||
| 1138 | Settings::values.touch_from_button_map_index, 0); | ||
| 1139 | WriteSetting(QStringLiteral("udp_input_servers"), | ||
| 1140 | QString::fromStdString(Settings::values.udp_input_servers), | ||
| 1141 | QString::fromUtf8(InputCommon::CemuhookUDP::DEFAULT_SRV)); | ||
| 1142 | 1132 | ||
| 1143 | qt_config->beginWriteArray(QStringLiteral("touch_from_button_maps")); | 1133 | qt_config->beginWriteArray(QStringLiteral("touch_from_button_maps")); |
| 1144 | for (std::size_t p = 0; p < Settings::values.touch_from_button_maps.size(); ++p) { | 1134 | for (std::size_t p = 0; p < Settings::values.touch_from_button_maps.size(); ++p) { |
| @@ -1181,15 +1171,11 @@ void Config::SaveAudioValues() { | |||
| 1181 | qt_config->beginGroup(QStringLiteral("Audio")); | 1171 | qt_config->beginGroup(QStringLiteral("Audio")); |
| 1182 | 1172 | ||
| 1183 | if (global) { | 1173 | if (global) { |
| 1184 | WriteSetting(QStringLiteral("output_engine"), | 1174 | WriteBasicSetting(Settings::values.sink_id); |
| 1185 | QString::fromStdString(Settings::values.sink_id), QStringLiteral("auto")); | 1175 | WriteBasicSetting(Settings::values.audio_device_id); |
| 1186 | WriteSetting(QStringLiteral("output_device"), | ||
| 1187 | QString::fromStdString(Settings::values.audio_device_id), | ||
| 1188 | QStringLiteral("auto")); | ||
| 1189 | } | 1176 | } |
| 1190 | WriteSettingGlobal(QStringLiteral("enable_audio_stretching"), | 1177 | WriteGlobalSetting(Settings::values.enable_audio_stretching); |
| 1191 | Settings::values.enable_audio_stretching, true); | 1178 | WriteGlobalSetting(Settings::values.volume); |
| 1192 | WriteSettingGlobal(QStringLiteral("volume"), Settings::values.volume, 1.0f); | ||
| 1193 | 1179 | ||
| 1194 | qt_config->endGroup(); | 1180 | qt_config->endGroup(); |
| 1195 | } | 1181 | } |
| @@ -1205,30 +1191,21 @@ void Config::SaveControlValues() { | |||
| 1205 | SaveTouchscreenValues(); | 1191 | SaveTouchscreenValues(); |
| 1206 | SaveMotionTouchValues(); | 1192 | SaveMotionTouchValues(); |
| 1207 | 1193 | ||
| 1208 | WriteSettingGlobal(QStringLiteral("use_docked_mode"), Settings::values.use_docked_mode, true); | 1194 | WriteGlobalSetting(Settings::values.use_docked_mode); |
| 1209 | WriteSettingGlobal(QStringLiteral("vibration_enabled"), Settings::values.vibration_enabled, | 1195 | WriteGlobalSetting(Settings::values.vibration_enabled); |
| 1210 | true); | 1196 | WriteGlobalSetting(Settings::values.enable_accurate_vibrations); |
| 1211 | WriteSettingGlobal(QStringLiteral("enable_accurate_vibrations"), | 1197 | WriteGlobalSetting(Settings::values.motion_enabled); |
| 1212 | Settings::values.enable_accurate_vibrations, false); | 1198 | WriteBasicSetting(Settings::values.keyboard_enabled); |
| 1213 | WriteSettingGlobal(QStringLiteral("motion_enabled"), Settings::values.motion_enabled, true); | 1199 | WriteBasicSetting(Settings::values.emulate_analog_keyboard); |
| 1214 | WriteSetting(QStringLiteral("motion_device"), | 1200 | WriteBasicSetting(Settings::values.mouse_panning_sensitivity); |
| 1215 | QString::fromStdString(Settings::values.motion_device), | 1201 | |
| 1216 | QStringLiteral("engine:motion_emu,update_period:100,sensitivity:0.01")); | ||
| 1217 | WriteSetting(QStringLiteral("touch_device"), | ||
| 1218 | QString::fromStdString(Settings::values.touch_device), | ||
| 1219 | QStringLiteral("engine:emu_window")); | ||
| 1220 | WriteSetting(QStringLiteral("keyboard_enabled"), Settings::values.keyboard_enabled, false); | ||
| 1221 | WriteSetting(QStringLiteral("emulate_analog_keyboard"), | ||
| 1222 | Settings::values.emulate_analog_keyboard, false); | ||
| 1223 | WriteSetting(QStringLiteral("mouse_panning_sensitivity"), | ||
| 1224 | Settings::values.mouse_panning_sensitivity, 1.0f); | ||
| 1225 | qt_config->endGroup(); | 1202 | qt_config->endGroup(); |
| 1226 | } | 1203 | } |
| 1227 | 1204 | ||
| 1228 | void Config::SaveCoreValues() { | 1205 | void Config::SaveCoreValues() { |
| 1229 | qt_config->beginGroup(QStringLiteral("Core")); | 1206 | qt_config->beginGroup(QStringLiteral("Core")); |
| 1230 | 1207 | ||
| 1231 | WriteSettingGlobal(QStringLiteral("use_multi_core"), Settings::values.use_multi_core, true); | 1208 | WriteGlobalSetting(Settings::values.use_multi_core); |
| 1232 | 1209 | ||
| 1233 | qt_config->endGroup(); | 1210 | qt_config->endGroup(); |
| 1234 | } | 1211 | } |
| @@ -1236,7 +1213,7 @@ void Config::SaveCoreValues() { | |||
| 1236 | void Config::SaveDataStorageValues() { | 1213 | void Config::SaveDataStorageValues() { |
| 1237 | qt_config->beginGroup(QStringLiteral("Data Storage")); | 1214 | qt_config->beginGroup(QStringLiteral("Data Storage")); |
| 1238 | 1215 | ||
| 1239 | WriteSetting(QStringLiteral("use_virtual_sd"), Settings::values.use_virtual_sd, true); | 1216 | WriteBasicSetting(Settings::values.use_virtual_sd); |
| 1240 | WriteSetting(QStringLiteral("nand_directory"), | 1217 | WriteSetting(QStringLiteral("nand_directory"), |
| 1241 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::NANDDir)), | 1218 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::NANDDir)), |
| 1242 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::NANDDir))); | 1219 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::NANDDir))); |
| @@ -1249,11 +1226,9 @@ void Config::SaveDataStorageValues() { | |||
| 1249 | WriteSetting(QStringLiteral("dump_directory"), | 1226 | WriteSetting(QStringLiteral("dump_directory"), |
| 1250 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir)), | 1227 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir)), |
| 1251 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir))); | 1228 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir))); |
| 1252 | WriteSetting(QStringLiteral("gamecard_inserted"), Settings::values.gamecard_inserted, false); | 1229 | WriteBasicSetting(Settings::values.gamecard_inserted); |
| 1253 | WriteSetting(QStringLiteral("gamecard_current_game"), Settings::values.gamecard_current_game, | 1230 | WriteBasicSetting(Settings::values.gamecard_current_game); |
| 1254 | false); | 1231 | WriteBasicSetting(Settings::values.gamecard_path); |
| 1255 | WriteSetting(QStringLiteral("gamecard_path"), | ||
| 1256 | QString::fromStdString(Settings::values.gamecard_path), QString{}); | ||
| 1257 | 1232 | ||
| 1258 | qt_config->endGroup(); | 1233 | qt_config->endGroup(); |
| 1259 | } | 1234 | } |
| @@ -1263,24 +1238,23 @@ void Config::SaveDebuggingValues() { | |||
| 1263 | 1238 | ||
| 1264 | // Intentionally not using the QT default setting as this is intended to be changed in the ini | 1239 | // Intentionally not using the QT default setting as this is intended to be changed in the ini |
| 1265 | qt_config->setValue(QStringLiteral("record_frame_times"), Settings::values.record_frame_times); | 1240 | qt_config->setValue(QStringLiteral("record_frame_times"), Settings::values.record_frame_times); |
| 1266 | WriteSetting(QStringLiteral("program_args"), | 1241 | WriteBasicSetting(Settings::values.program_args); |
| 1267 | QString::fromStdString(Settings::values.program_args), QString{}); | 1242 | WriteBasicSetting(Settings::values.dump_exefs); |
| 1268 | WriteSetting(QStringLiteral("dump_exefs"), Settings::values.dump_exefs, false); | 1243 | WriteBasicSetting(Settings::values.dump_nso); |
| 1269 | WriteSetting(QStringLiteral("dump_nso"), Settings::values.dump_nso, false); | 1244 | WriteBasicSetting(Settings::values.enable_fs_access_log); |
| 1270 | WriteSetting(QStringLiteral("enable_fs_access_log"), Settings::values.enable_fs_access_log, | 1245 | WriteBasicSetting(Settings::values.quest_flag); |
| 1271 | false); | 1246 | WriteBasicSetting(Settings::values.use_debug_asserts); |
| 1272 | WriteSetting(QStringLiteral("quest_flag"), Settings::values.quest_flag, false); | 1247 | WriteBasicSetting(Settings::values.disable_macro_jit); |
| 1273 | WriteSetting(QStringLiteral("use_debug_asserts"), Settings::values.use_debug_asserts, false); | ||
| 1274 | WriteSetting(QStringLiteral("disable_macro_jit"), Settings::values.disable_macro_jit, false); | ||
| 1275 | 1248 | ||
| 1276 | qt_config->endGroup(); | 1249 | qt_config->endGroup(); |
| 1277 | } | 1250 | } |
| 1278 | 1251 | ||
| 1279 | void Config::SaveServiceValues() { | 1252 | void Config::SaveServiceValues() { |
| 1280 | qt_config->beginGroup(QStringLiteral("Services")); | 1253 | qt_config->beginGroup(QStringLiteral("Services")); |
| 1281 | WriteSetting(QStringLiteral("bcat_backend"), | 1254 | |
| 1282 | QString::fromStdString(Settings::values.bcat_backend), QStringLiteral("none")); | 1255 | WriteBasicSetting(Settings::values.bcat_backend); |
| 1283 | WriteSetting(QStringLiteral("bcat_boxcat_local"), Settings::values.bcat_boxcat_local, false); | 1256 | WriteBasicSetting(Settings::values.bcat_boxcat_local); |
| 1257 | |||
| 1284 | qt_config->endGroup(); | 1258 | qt_config->endGroup(); |
| 1285 | } | 1259 | } |
| 1286 | 1260 | ||
| @@ -1306,9 +1280,8 @@ void Config::SaveDisabledAddOnValues() { | |||
| 1306 | void Config::SaveMiscellaneousValues() { | 1280 | void Config::SaveMiscellaneousValues() { |
| 1307 | qt_config->beginGroup(QStringLiteral("Miscellaneous")); | 1281 | qt_config->beginGroup(QStringLiteral("Miscellaneous")); |
| 1308 | 1282 | ||
| 1309 | WriteSetting(QStringLiteral("log_filter"), QString::fromStdString(Settings::values.log_filter), | 1283 | WriteBasicSetting(Settings::values.log_filter); |
| 1310 | QStringLiteral("*:Info")); | 1284 | WriteBasicSetting(Settings::values.use_dev_keys); |
| 1311 | WriteSetting(QStringLiteral("use_dev_keys"), Settings::values.use_dev_keys, false); | ||
| 1312 | 1285 | ||
| 1313 | qt_config->endGroup(); | 1286 | qt_config->endGroup(); |
| 1314 | } | 1287 | } |
| @@ -1336,38 +1309,27 @@ void Config::SavePathValues() { | |||
| 1336 | void Config::SaveCpuValues() { | 1309 | void Config::SaveCpuValues() { |
| 1337 | qt_config->beginGroup(QStringLiteral("Cpu")); | 1310 | qt_config->beginGroup(QStringLiteral("Cpu")); |
| 1338 | 1311 | ||
| 1339 | WriteSettingGlobal(QStringLiteral("cpu_accuracy"), | 1312 | WriteSetting(QStringLiteral("cpu_accuracy"), |
| 1340 | static_cast<u32>(Settings::values.cpu_accuracy.GetValue(global)), | 1313 | static_cast<u32>(Settings::values.cpu_accuracy.GetValue(global)), |
| 1341 | Settings::values.cpu_accuracy.UsingGlobal(), | 1314 | static_cast<u32>(Settings::values.cpu_accuracy.GetDefault()), |
| 1342 | static_cast<u32>(Settings::CPUAccuracy::Accurate)); | 1315 | Settings::values.cpu_accuracy.UsingGlobal()); |
| 1343 | 1316 | ||
| 1344 | WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_unfuse_fma"), | 1317 | WriteGlobalSetting(Settings::values.cpuopt_unsafe_unfuse_fma); |
| 1345 | Settings::values.cpuopt_unsafe_unfuse_fma, true); | 1318 | WriteGlobalSetting(Settings::values.cpuopt_unsafe_reduce_fp_error); |
| 1346 | WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_reduce_fp_error"), | 1319 | WriteGlobalSetting(Settings::values.cpuopt_unsafe_ignore_standard_fpcr); |
| 1347 | Settings::values.cpuopt_unsafe_reduce_fp_error, true); | 1320 | WriteGlobalSetting(Settings::values.cpuopt_unsafe_inaccurate_nan); |
| 1348 | WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_ignore_standard_fpcr"), | 1321 | WriteGlobalSetting(Settings::values.cpuopt_unsafe_fastmem_check); |
| 1349 | Settings::values.cpuopt_unsafe_ignore_standard_fpcr, true); | ||
| 1350 | WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_inaccurate_nan"), | ||
| 1351 | Settings::values.cpuopt_unsafe_inaccurate_nan, true); | ||
| 1352 | WriteSettingGlobal(QStringLiteral("cpuopt_unsafe_fastmem_check"), | ||
| 1353 | Settings::values.cpuopt_unsafe_fastmem_check, true); | ||
| 1354 | 1322 | ||
| 1355 | if (global) { | 1323 | if (global) { |
| 1356 | WriteSetting(QStringLiteral("cpuopt_page_tables"), Settings::values.cpuopt_page_tables, | 1324 | WriteBasicSetting(Settings::values.cpuopt_page_tables); |
| 1357 | true); | 1325 | WriteBasicSetting(Settings::values.cpuopt_block_linking); |
| 1358 | WriteSetting(QStringLiteral("cpuopt_block_linking"), Settings::values.cpuopt_block_linking, | 1326 | WriteBasicSetting(Settings::values.cpuopt_return_stack_buffer); |
| 1359 | true); | 1327 | WriteBasicSetting(Settings::values.cpuopt_fast_dispatcher); |
| 1360 | WriteSetting(QStringLiteral("cpuopt_return_stack_buffer"), | 1328 | WriteBasicSetting(Settings::values.cpuopt_context_elimination); |
| 1361 | Settings::values.cpuopt_return_stack_buffer, true); | 1329 | WriteBasicSetting(Settings::values.cpuopt_const_prop); |
| 1362 | WriteSetting(QStringLiteral("cpuopt_fast_dispatcher"), | 1330 | WriteBasicSetting(Settings::values.cpuopt_misc_ir); |
| 1363 | Settings::values.cpuopt_fast_dispatcher, true); | 1331 | WriteBasicSetting(Settings::values.cpuopt_reduce_misalign_checks); |
| 1364 | WriteSetting(QStringLiteral("cpuopt_context_elimination"), | 1332 | WriteBasicSetting(Settings::values.cpuopt_fastmem); |
| 1365 | Settings::values.cpuopt_context_elimination, true); | ||
| 1366 | WriteSetting(QStringLiteral("cpuopt_const_prop"), Settings::values.cpuopt_const_prop, true); | ||
| 1367 | WriteSetting(QStringLiteral("cpuopt_misc_ir"), Settings::values.cpuopt_misc_ir, true); | ||
| 1368 | WriteSetting(QStringLiteral("cpuopt_reduce_misalign_checks"), | ||
| 1369 | Settings::values.cpuopt_reduce_misalign_checks, true); | ||
| 1370 | WriteSetting(QStringLiteral("cpuopt_fastmem"), Settings::values.cpuopt_fastmem, true); | ||
| 1371 | } | 1333 | } |
| 1372 | 1334 | ||
| 1373 | qt_config->endGroup(); | 1335 | qt_config->endGroup(); |
| @@ -1376,46 +1338,34 @@ void Config::SaveCpuValues() { | |||
| 1376 | void Config::SaveRendererValues() { | 1338 | void Config::SaveRendererValues() { |
| 1377 | qt_config->beginGroup(QStringLiteral("Renderer")); | 1339 | qt_config->beginGroup(QStringLiteral("Renderer")); |
| 1378 | 1340 | ||
| 1379 | WriteSettingGlobal(QStringLiteral("backend"), | 1341 | WriteSetting(QString::fromStdString(Settings::values.renderer_backend.GetLabel()), |
| 1380 | static_cast<int>(Settings::values.renderer_backend.GetValue(global)), | 1342 | static_cast<u32>(Settings::values.renderer_backend.GetValue(global)), |
| 1381 | Settings::values.renderer_backend.UsingGlobal(), 0); | 1343 | static_cast<u32>(Settings::values.renderer_backend.GetDefault()), |
| 1382 | WriteSetting(QStringLiteral("debug"), Settings::values.renderer_debug, false); | 1344 | Settings::values.renderer_backend.UsingGlobal()); |
| 1383 | WriteSettingGlobal(QStringLiteral("vulkan_device"), Settings::values.vulkan_device, 0); | 1345 | WriteBasicSetting(Settings::values.renderer_debug); |
| 1384 | #ifdef _WIN32 | 1346 | WriteGlobalSetting(Settings::values.vulkan_device); |
| 1385 | WriteSettingGlobal(QStringLiteral("fullscreen_mode"), Settings::values.fullscreen_mode, 0); | 1347 | WriteGlobalSetting(Settings::values.fullscreen_mode); |
| 1386 | #else | 1348 | WriteGlobalSetting(Settings::values.aspect_ratio); |
| 1387 | // *nix platforms may have issues with the borderless windowed fullscreen mode. | 1349 | WriteGlobalSetting(Settings::values.max_anisotropy); |
| 1388 | // Default to exclusive fullscreen on these platforms for now. | 1350 | WriteGlobalSetting(Settings::values.use_frame_limit); |
| 1389 | WriteSettingGlobal(QStringLiteral("fullscreen_mode"), Settings::values.fullscreen_mode, 1); | 1351 | WriteGlobalSetting(Settings::values.frame_limit); |
| 1390 | #endif | 1352 | WriteGlobalSetting(Settings::values.use_disk_shader_cache); |
| 1391 | WriteSettingGlobal(QStringLiteral("aspect_ratio"), Settings::values.aspect_ratio, 0); | 1353 | WriteSetting(QString::fromStdString(Settings::values.gpu_accuracy.GetLabel()), |
| 1392 | WriteSettingGlobal(QStringLiteral("max_anisotropy"), Settings::values.max_anisotropy, 0); | 1354 | static_cast<u32>(Settings::values.gpu_accuracy.GetValue(global)), |
| 1393 | WriteSettingGlobal(QStringLiteral("use_frame_limit"), Settings::values.use_frame_limit, true); | 1355 | static_cast<u32>(Settings::values.gpu_accuracy.GetDefault()), |
| 1394 | WriteSettingGlobal(QStringLiteral("frame_limit"), Settings::values.frame_limit, 100); | 1356 | Settings::values.gpu_accuracy.UsingGlobal()); |
| 1395 | WriteSettingGlobal(QStringLiteral("use_disk_shader_cache"), | 1357 | WriteGlobalSetting(Settings::values.use_asynchronous_gpu_emulation); |
| 1396 | Settings::values.use_disk_shader_cache, true); | 1358 | WriteGlobalSetting(Settings::values.use_nvdec_emulation); |
| 1397 | WriteSettingGlobal(QStringLiteral("gpu_accuracy"), | 1359 | WriteGlobalSetting(Settings::values.accelerate_astc); |
| 1398 | static_cast<int>(Settings::values.gpu_accuracy.GetValue(global)), | 1360 | WriteGlobalSetting(Settings::values.use_vsync); |
| 1399 | Settings::values.gpu_accuracy.UsingGlobal(), 1); | 1361 | WriteGlobalSetting(Settings::values.disable_fps_limit); |
| 1400 | WriteSettingGlobal(QStringLiteral("use_asynchronous_gpu_emulation"), | 1362 | WriteGlobalSetting(Settings::values.use_assembly_shaders); |
| 1401 | Settings::values.use_asynchronous_gpu_emulation, true); | 1363 | WriteGlobalSetting(Settings::values.use_asynchronous_shaders); |
| 1402 | WriteSettingGlobal(QStringLiteral("use_nvdec_emulation"), Settings::values.use_nvdec_emulation, | 1364 | WriteGlobalSetting(Settings::values.use_fast_gpu_time); |
| 1403 | true); | 1365 | WriteGlobalSetting(Settings::values.use_caches_gc); |
| 1404 | WriteSettingGlobal(QStringLiteral("accelerate_astc"), Settings::values.accelerate_astc, true); | 1366 | WriteGlobalSetting(Settings::values.bg_red); |
| 1405 | WriteSettingGlobal(QStringLiteral("use_vsync"), Settings::values.use_vsync, true); | 1367 | WriteGlobalSetting(Settings::values.bg_green); |
| 1406 | WriteSettingGlobal(QStringLiteral("disable_fps_limit"), Settings::values.disable_fps_limit, | 1368 | WriteGlobalSetting(Settings::values.bg_blue); |
| 1407 | false); | ||
| 1408 | WriteSettingGlobal(QStringLiteral("use_assembly_shaders"), | ||
| 1409 | Settings::values.use_assembly_shaders, false); | ||
| 1410 | WriteSettingGlobal(QStringLiteral("use_asynchronous_shaders"), | ||
| 1411 | Settings::values.use_asynchronous_shaders, false); | ||
| 1412 | WriteSettingGlobal(QStringLiteral("use_fast_gpu_time"), Settings::values.use_fast_gpu_time, | ||
| 1413 | true); | ||
| 1414 | WriteSettingGlobal(QStringLiteral("use_caches_gc"), Settings::values.use_caches_gc, false); | ||
| 1415 | // Cast to double because Qt's written float values are not human-readable | ||
| 1416 | WriteSettingGlobal(QStringLiteral("bg_red"), Settings::values.bg_red, 0.0); | ||
| 1417 | WriteSettingGlobal(QStringLiteral("bg_green"), Settings::values.bg_green, 0.0); | ||
| 1418 | WriteSettingGlobal(QStringLiteral("bg_blue"), Settings::values.bg_blue, 0.0); | ||
| 1419 | 1369 | ||
| 1420 | qt_config->endGroup(); | 1370 | qt_config->endGroup(); |
| 1421 | } | 1371 | } |
| @@ -1423,8 +1373,7 @@ void Config::SaveRendererValues() { | |||
| 1423 | void Config::SaveScreenshotValues() { | 1373 | void Config::SaveScreenshotValues() { |
| 1424 | qt_config->beginGroup(QStringLiteral("Screenshots")); | 1374 | qt_config->beginGroup(QStringLiteral("Screenshots")); |
| 1425 | 1375 | ||
| 1426 | WriteSetting(QStringLiteral("enable_screenshot_save_as"), | 1376 | WriteBasicSetting(UISettings::values.enable_screenshot_save_as); |
| 1427 | UISettings::values.enable_screenshot_save_as); | ||
| 1428 | WriteSetting(QStringLiteral("screenshot_path"), | 1377 | WriteSetting(QStringLiteral("screenshot_path"), |
| 1429 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::ScreenshotsDir))); | 1378 | QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::ScreenshotsDir))); |
| 1430 | 1379 | ||
| @@ -1454,17 +1403,16 @@ void Config::SaveShortcutValues() { | |||
| 1454 | void Config::SaveSystemValues() { | 1403 | void Config::SaveSystemValues() { |
| 1455 | qt_config->beginGroup(QStringLiteral("System")); | 1404 | qt_config->beginGroup(QStringLiteral("System")); |
| 1456 | 1405 | ||
| 1457 | WriteSetting(QStringLiteral("current_user"), Settings::values.current_user, 0); | 1406 | WriteBasicSetting(Settings::values.current_user); |
| 1458 | WriteSettingGlobal(QStringLiteral("language_index"), Settings::values.language_index, 1); | 1407 | WriteGlobalSetting(Settings::values.language_index); |
| 1459 | WriteSettingGlobal(QStringLiteral("region_index"), Settings::values.region_index, 1); | 1408 | WriteGlobalSetting(Settings::values.region_index); |
| 1460 | WriteSettingGlobal(QStringLiteral("time_zone_index"), Settings::values.time_zone_index, 0); | 1409 | WriteGlobalSetting(Settings::values.time_zone_index); |
| 1461 | 1410 | ||
| 1462 | WriteSettingGlobal(QStringLiteral("rng_seed_enabled"), | 1411 | WriteSetting(QStringLiteral("rng_seed_enabled"), |
| 1463 | Settings::values.rng_seed.GetValue(global).has_value(), | 1412 | Settings::values.rng_seed.GetValue(global).has_value(), false, |
| 1464 | Settings::values.rng_seed.UsingGlobal(), false); | 1413 | Settings::values.rng_seed.UsingGlobal()); |
| 1465 | WriteSettingGlobal(QStringLiteral("rng_seed"), | 1414 | WriteSetting(QStringLiteral("rng_seed"), Settings::values.rng_seed.GetValue(global).value_or(0), |
| 1466 | Settings::values.rng_seed.GetValue(global).value_or(0), | 1415 | 0, Settings::values.rng_seed.UsingGlobal()); |
| 1467 | Settings::values.rng_seed.UsingGlobal(), 0); | ||
| 1468 | 1416 | ||
| 1469 | if (global) { | 1417 | if (global) { |
| 1470 | WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(), | 1418 | WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(), |
| @@ -1475,7 +1423,7 @@ void Config::SaveSystemValues() { | |||
| 1475 | 0); | 1423 | 0); |
| 1476 | } | 1424 | } |
| 1477 | 1425 | ||
| 1478 | WriteSettingGlobal(QStringLiteral("sound_index"), Settings::values.sound_index, 1); | 1426 | WriteGlobalSetting(Settings::values.sound_index); |
| 1479 | 1427 | ||
| 1480 | qt_config->endGroup(); | 1428 | qt_config->endGroup(); |
| 1481 | } | 1429 | } |
| @@ -1485,10 +1433,8 @@ void Config::SaveUIValues() { | |||
| 1485 | 1433 | ||
| 1486 | WriteSetting(QStringLiteral("theme"), UISettings::values.theme, | 1434 | WriteSetting(QStringLiteral("theme"), UISettings::values.theme, |
| 1487 | QString::fromUtf8(UISettings::themes[0].second)); | 1435 | QString::fromUtf8(UISettings::themes[0].second)); |
| 1488 | WriteSetting(QStringLiteral("enable_discord_presence"), | 1436 | WriteBasicSetting(UISettings::values.enable_discord_presence); |
| 1489 | UISettings::values.enable_discord_presence, true); | 1437 | WriteBasicSetting(UISettings::values.select_user_on_boot); |
| 1490 | WriteSetting(QStringLiteral("select_user_on_boot"), UISettings::values.select_user_on_boot, | ||
| 1491 | false); | ||
| 1492 | 1438 | ||
| 1493 | SaveUIGamelistValues(); | 1439 | SaveUIGamelistValues(); |
| 1494 | SaveUILayoutValues(); | 1440 | SaveUILayoutValues(); |
| @@ -1496,18 +1442,17 @@ void Config::SaveUIValues() { | |||
| 1496 | SaveScreenshotValues(); | 1442 | SaveScreenshotValues(); |
| 1497 | SaveShortcutValues(); | 1443 | SaveShortcutValues(); |
| 1498 | 1444 | ||
| 1499 | WriteSetting(QStringLiteral("singleWindowMode"), UISettings::values.single_window_mode, true); | 1445 | WriteBasicSetting(UISettings::values.single_window_mode); |
| 1500 | WriteSetting(QStringLiteral("fullscreen"), UISettings::values.fullscreen, false); | 1446 | WriteBasicSetting(UISettings::values.fullscreen); |
| 1501 | WriteSetting(QStringLiteral("displayTitleBars"), UISettings::values.display_titlebar, true); | 1447 | WriteBasicSetting(UISettings::values.display_titlebar); |
| 1502 | WriteSetting(QStringLiteral("showFilterBar"), UISettings::values.show_filter_bar, true); | 1448 | WriteBasicSetting(UISettings::values.show_filter_bar); |
| 1503 | WriteSetting(QStringLiteral("showStatusBar"), UISettings::values.show_status_bar, true); | 1449 | WriteBasicSetting(UISettings::values.show_status_bar); |
| 1504 | WriteSetting(QStringLiteral("confirmClose"), UISettings::values.confirm_before_closing, true); | 1450 | WriteBasicSetting(UISettings::values.confirm_before_closing); |
| 1505 | WriteSetting(QStringLiteral("firstStart"), UISettings::values.first_start, true); | 1451 | WriteBasicSetting(UISettings::values.first_start); |
| 1506 | WriteSetting(QStringLiteral("calloutFlags"), UISettings::values.callout_flags, 0); | 1452 | WriteBasicSetting(UISettings::values.callout_flags); |
| 1507 | WriteSetting(QStringLiteral("showConsole"), UISettings::values.show_console, false); | 1453 | WriteBasicSetting(UISettings::values.show_console); |
| 1508 | WriteSetting(QStringLiteral("pauseWhenInBackground"), | 1454 | WriteBasicSetting(UISettings::values.pause_when_in_background); |
| 1509 | UISettings::values.pause_when_in_background, false); | 1455 | WriteBasicSetting(UISettings::values.hide_mouse); |
| 1510 | WriteSetting(QStringLiteral("hideInactiveMouse"), UISettings::values.hide_mouse, false); | ||
| 1511 | 1456 | ||
| 1512 | qt_config->endGroup(); | 1457 | qt_config->endGroup(); |
| 1513 | } | 1458 | } |
| @@ -1515,11 +1460,11 @@ void Config::SaveUIValues() { | |||
| 1515 | void Config::SaveUIGamelistValues() { | 1460 | void Config::SaveUIGamelistValues() { |
| 1516 | qt_config->beginGroup(QStringLiteral("UIGameList")); | 1461 | qt_config->beginGroup(QStringLiteral("UIGameList")); |
| 1517 | 1462 | ||
| 1518 | WriteSetting(QStringLiteral("show_add_ons"), UISettings::values.show_add_ons, true); | 1463 | WriteBasicSetting(UISettings::values.show_add_ons); |
| 1519 | WriteSetting(QStringLiteral("icon_size"), UISettings::values.icon_size, 64); | 1464 | WriteBasicSetting(UISettings::values.icon_size); |
| 1520 | WriteSetting(QStringLiteral("row_1_text_id"), UISettings::values.row_1_text_id, 3); | 1465 | WriteBasicSetting(UISettings::values.row_1_text_id); |
| 1521 | WriteSetting(QStringLiteral("row_2_text_id"), UISettings::values.row_2_text_id, 2); | 1466 | WriteBasicSetting(UISettings::values.row_2_text_id); |
| 1522 | WriteSetting(QStringLiteral("cache_game_list"), UISettings::values.cache_game_list, true); | 1467 | WriteBasicSetting(UISettings::values.cache_game_list); |
| 1523 | qt_config->beginWriteArray(QStringLiteral("favorites")); | 1468 | qt_config->beginWriteArray(QStringLiteral("favorites")); |
| 1524 | for (int i = 0; i < UISettings::values.favorited_ids.size(); i++) { | 1469 | for (int i = 0; i < UISettings::values.favorited_ids.size(); i++) { |
| 1525 | qt_config->setArrayIndex(i); | 1470 | qt_config->setArrayIndex(i); |
| @@ -1540,8 +1485,7 @@ void Config::SaveUILayoutValues() { | |||
| 1540 | WriteSetting(QStringLiteral("gameListHeaderState"), UISettings::values.gamelist_header_state); | 1485 | WriteSetting(QStringLiteral("gameListHeaderState"), UISettings::values.gamelist_header_state); |
| 1541 | WriteSetting(QStringLiteral("microProfileDialogGeometry"), | 1486 | WriteSetting(QStringLiteral("microProfileDialogGeometry"), |
| 1542 | UISettings::values.microprofile_geometry); | 1487 | UISettings::values.microprofile_geometry); |
| 1543 | WriteSetting(QStringLiteral("microProfileDialogVisible"), | 1488 | WriteBasicSetting(UISettings::values.microprofile_visible); |
| 1544 | UISettings::values.microprofile_visible, false); | ||
| 1545 | 1489 | ||
| 1546 | qt_config->endGroup(); | 1490 | qt_config->endGroup(); |
| 1547 | } | 1491 | } |
| @@ -1549,13 +1493,10 @@ void Config::SaveUILayoutValues() { | |||
| 1549 | void Config::SaveWebServiceValues() { | 1493 | void Config::SaveWebServiceValues() { |
| 1550 | qt_config->beginGroup(QStringLiteral("WebService")); | 1494 | qt_config->beginGroup(QStringLiteral("WebService")); |
| 1551 | 1495 | ||
| 1552 | WriteSetting(QStringLiteral("enable_telemetry"), Settings::values.enable_telemetry, true); | 1496 | WriteBasicSetting(Settings::values.enable_telemetry); |
| 1553 | WriteSetting(QStringLiteral("web_api_url"), | 1497 | WriteBasicSetting(Settings::values.web_api_url); |
| 1554 | QString::fromStdString(Settings::values.web_api_url), | 1498 | WriteBasicSetting(Settings::values.yuzu_username); |
| 1555 | QStringLiteral("https://api.yuzu-emu.org")); | 1499 | WriteBasicSetting(Settings::values.yuzu_token); |
| 1556 | WriteSetting(QStringLiteral("yuzu_username"), | ||
| 1557 | QString::fromStdString(Settings::values.yuzu_username)); | ||
| 1558 | WriteSetting(QStringLiteral("yuzu_token"), QString::fromStdString(Settings::values.yuzu_token)); | ||
| 1559 | 1500 | ||
| 1560 | qt_config->endGroup(); | 1501 | qt_config->endGroup(); |
| 1561 | } | 1502 | } |
| @@ -1575,21 +1516,14 @@ QVariant Config::ReadSetting(const QString& name, const QVariant& default_value) | |||
| 1575 | } | 1516 | } |
| 1576 | 1517 | ||
| 1577 | template <typename Type> | 1518 | template <typename Type> |
| 1578 | void Config::ReadSettingGlobal(Settings::Setting<Type>& setting, const QString& name) { | 1519 | void Config::ReadGlobalSetting(Settings::Setting<Type>& setting) { |
| 1579 | const bool use_global = qt_config->value(name + QStringLiteral("/use_global"), true).toBool(); | 1520 | QString name = QString::fromStdString(setting.GetLabel()); |
| 1580 | setting.SetGlobal(use_global); | ||
| 1581 | if (global || !use_global) { | ||
| 1582 | setting.SetValue(ReadSetting(name).value<Type>()); | ||
| 1583 | } | ||
| 1584 | } | ||
| 1585 | |||
| 1586 | template <typename Type> | ||
| 1587 | void Config::ReadSettingGlobal(Settings::Setting<Type>& setting, const QString& name, | ||
| 1588 | const QVariant& default_value) { | ||
| 1589 | const bool use_global = qt_config->value(name + QStringLiteral("/use_global"), true).toBool(); | 1521 | const bool use_global = qt_config->value(name + QStringLiteral("/use_global"), true).toBool(); |
| 1590 | setting.SetGlobal(use_global); | 1522 | setting.SetGlobal(use_global); |
| 1591 | if (global || !use_global) { | 1523 | if (global || !use_global) { |
| 1592 | setting.SetValue(ReadSetting(name, default_value).value<Type>()); | 1524 | setting.SetValue(static_cast<QVariant>( |
| 1525 | ReadSetting(name, QVariant::fromValue<Type>(setting.GetDefault()))) | ||
| 1526 | .value<Type>()); | ||
| 1593 | } | 1527 | } |
| 1594 | } | 1528 | } |
| 1595 | 1529 | ||
| @@ -1612,31 +1546,8 @@ void Config::WriteSetting(const QString& name, const QVariant& value, | |||
| 1612 | qt_config->setValue(name, value); | 1546 | qt_config->setValue(name, value); |
| 1613 | } | 1547 | } |
| 1614 | 1548 | ||
| 1615 | template <typename Type> | 1549 | void Config::WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value, |
| 1616 | void Config::WriteSettingGlobal(const QString& name, const Settings::Setting<Type>& setting) { | 1550 | bool use_global) { |
| 1617 | if (!global) { | ||
| 1618 | qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal()); | ||
| 1619 | } | ||
| 1620 | if (global || !setting.UsingGlobal()) { | ||
| 1621 | qt_config->setValue(name, setting.GetValue(global)); | ||
| 1622 | } | ||
| 1623 | } | ||
| 1624 | |||
| 1625 | template <typename Type> | ||
| 1626 | void Config::WriteSettingGlobal(const QString& name, const Settings::Setting<Type>& setting, | ||
| 1627 | const QVariant& default_value) { | ||
| 1628 | if (!global) { | ||
| 1629 | qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal()); | ||
| 1630 | } | ||
| 1631 | if (global || !setting.UsingGlobal()) { | ||
| 1632 | qt_config->setValue(name + QStringLiteral("/default"), | ||
| 1633 | setting.GetValue(global) == default_value.value<Type>()); | ||
| 1634 | qt_config->setValue(name, setting.GetValue(global)); | ||
| 1635 | } | ||
| 1636 | } | ||
| 1637 | |||
| 1638 | void Config::WriteSettingGlobal(const QString& name, const QVariant& value, bool use_global, | ||
| 1639 | const QVariant& default_value) { | ||
| 1640 | if (!global) { | 1551 | if (!global) { |
| 1641 | qt_config->setValue(name + QStringLiteral("/use_global"), use_global); | 1552 | qt_config->setValue(name + QStringLiteral("/use_global"), use_global); |
| 1642 | } | 1553 | } |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 3c1de0ac9..96f9b6de1 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -102,28 +102,75 @@ private: | |||
| 102 | void SaveUILayoutValues(); | 102 | void SaveUILayoutValues(); |
| 103 | void SaveWebServiceValues(); | 103 | void SaveWebServiceValues(); |
| 104 | 104 | ||
| 105 | /** | ||
| 106 | * Reads a setting from the qt_config. | ||
| 107 | * | ||
| 108 | * @param name The setting's identifier | ||
| 109 | * @param default_value The value to use when the setting is not already present in the config | ||
| 110 | */ | ||
| 105 | QVariant ReadSetting(const QString& name) const; | 111 | QVariant ReadSetting(const QString& name) const; |
| 106 | QVariant ReadSetting(const QString& name, const QVariant& default_value) const; | 112 | QVariant ReadSetting(const QString& name, const QVariant& default_value) const; |
| 107 | // Templated ReadSettingGlobal functions will also look for the use_global setting and set | 113 | |
| 108 | // both the value and the global state properly | 114 | /** |
| 109 | template <typename Type> | 115 | * Only reads a setting from the qt_config if the current config is a global config, or if the |
| 110 | void ReadSettingGlobal(Settings::Setting<Type>& setting, const QString& name); | 116 | * current config is a custom config and the setting is overriding the global setting. Otherwise |
| 111 | template <typename Type> | 117 | * it does nothing. |
| 112 | void ReadSettingGlobal(Settings::Setting<Type>& setting, const QString& name, | 118 | * |
| 113 | const QVariant& default_value); | 119 | * @param setting The variable to be modified |
| 120 | * @param name The setting's identifier | ||
| 121 | * @param default_value The value to use when the setting is not already present in the config | ||
| 122 | */ | ||
| 114 | template <typename Type> | 123 | template <typename Type> |
| 115 | void ReadSettingGlobal(Type& setting, const QString& name, const QVariant& default_value) const; | 124 | void ReadSettingGlobal(Type& setting, const QString& name, const QVariant& default_value) const; |
| 116 | // Templated WriteSettingGlobal functions will also write the global state if needed and will | 125 | |
| 117 | // skip writing the actual setting if it defers to the global value | 126 | /** |
| 127 | * Writes a setting to the qt_config. | ||
| 128 | * | ||
| 129 | * @param name The setting's idetentifier | ||
| 130 | * @param value Value of the setting | ||
| 131 | * @param default_value Default of the setting if not present in qt_config | ||
| 132 | * @param use_global Specifies if the custom or global config should be in use, for custom | ||
| 133 | * configs | ||
| 134 | */ | ||
| 118 | void WriteSetting(const QString& name, const QVariant& value); | 135 | void WriteSetting(const QString& name, const QVariant& value); |
| 119 | void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value); | 136 | void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value); |
| 137 | void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value, | ||
| 138 | bool use_global); | ||
| 139 | |||
| 140 | /** | ||
| 141 | * Reads a value from the qt_config and applies it to the setting, using its label and default | ||
| 142 | * value. If the config is a custom config, this will also read the global state of the setting | ||
| 143 | * and apply that information to it. | ||
| 144 | * | ||
| 145 | * @param The setting | ||
| 146 | */ | ||
| 120 | template <typename Type> | 147 | template <typename Type> |
| 121 | void WriteSettingGlobal(const QString& name, const Settings::Setting<Type>& setting); | 148 | void ReadGlobalSetting(Settings::Setting<Type>& setting); |
| 149 | |||
| 150 | /** | ||
| 151 | * Sets a value to the qt_config using the setting's label and default value. If the config is a | ||
| 152 | * custom config, it will apply the global state, and the custom value if needed. | ||
| 153 | * | ||
| 154 | * @param The setting | ||
| 155 | */ | ||
| 156 | template <typename Type> | ||
| 157 | void WriteGlobalSetting(const Settings::Setting<Type>& setting); | ||
| 158 | |||
| 159 | /** | ||
| 160 | * Reads a value from the qt_config using the setting's label and default value and applies the | ||
| 161 | * value to the setting. | ||
| 162 | * | ||
| 163 | * @param The setting | ||
| 164 | */ | ||
| 165 | template <typename Type> | ||
| 166 | void ReadBasicSetting(Settings::BasicSetting<Type>& setting); | ||
| 167 | |||
| 168 | /** Sets a value from the setting in the qt_config using the setting's label and default value. | ||
| 169 | * | ||
| 170 | * @param The setting | ||
| 171 | */ | ||
| 122 | template <typename Type> | 172 | template <typename Type> |
| 123 | void WriteSettingGlobal(const QString& name, const Settings::Setting<Type>& setting, | 173 | void WriteBasicSetting(const Settings::BasicSetting<Type>& setting); |
| 124 | const QVariant& default_value); | ||
| 125 | void WriteSettingGlobal(const QString& name, const QVariant& value, bool use_global, | ||
| 126 | const QVariant& default_value); | ||
| 127 | 174 | ||
| 128 | ConfigType type; | 175 | ConfigType type; |
| 129 | std::unique_ptr<QSettings> qt_config; | 176 | std::unique_ptr<QSettings> qt_config; |
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index fc0191432..5aba1a3b2 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp | |||
| @@ -69,7 +69,7 @@ void ConfigureAudio::SetOutputSinkFromSinkID() { | |||
| 69 | [[maybe_unused]] const QSignalBlocker blocker(ui->output_sink_combo_box); | 69 | [[maybe_unused]] const QSignalBlocker blocker(ui->output_sink_combo_box); |
| 70 | 70 | ||
| 71 | int new_sink_index = 0; | 71 | int new_sink_index = 0; |
| 72 | const QString sink_id = QString::fromStdString(Settings::values.sink_id); | 72 | const QString sink_id = QString::fromStdString(Settings::values.sink_id.GetValue()); |
| 73 | for (int index = 0; index < ui->output_sink_combo_box->count(); index++) { | 73 | for (int index = 0; index < ui->output_sink_combo_box->count(); index++) { |
| 74 | if (ui->output_sink_combo_box->itemText(index) == sink_id) { | 74 | if (ui->output_sink_combo_box->itemText(index) == sink_id) { |
| 75 | new_sink_index = index; | 75 | new_sink_index = index; |
| @@ -83,7 +83,7 @@ void ConfigureAudio::SetOutputSinkFromSinkID() { | |||
| 83 | void ConfigureAudio::SetAudioDeviceFromDeviceID() { | 83 | void ConfigureAudio::SetAudioDeviceFromDeviceID() { |
| 84 | int new_device_index = -1; | 84 | int new_device_index = -1; |
| 85 | 85 | ||
| 86 | const QString device_id = QString::fromStdString(Settings::values.audio_device_id); | 86 | const QString device_id = QString::fromStdString(Settings::values.audio_device_id.GetValue()); |
| 87 | for (int index = 0; index < ui->audio_device_combo_box->count(); index++) { | 87 | for (int index = 0; index < ui->audio_device_combo_box->count(); index++) { |
| 88 | if (ui->audio_device_combo_box->itemText(index) == device_id) { | 88 | if (ui->audio_device_combo_box->itemText(index) == device_id) { |
| 89 | new_device_index = index; | 89 | new_device_index = index; |
| @@ -106,9 +106,9 @@ void ConfigureAudio::ApplyConfiguration() { | |||
| 106 | Settings::values.sink_id = | 106 | Settings::values.sink_id = |
| 107 | ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex()) | 107 | ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex()) |
| 108 | .toStdString(); | 108 | .toStdString(); |
| 109 | Settings::values.audio_device_id = | 109 | Settings::values.audio_device_id.SetValue( |
| 110 | ui->audio_device_combo_box->itemText(ui->audio_device_combo_box->currentIndex()) | 110 | ui->audio_device_combo_box->itemText(ui->audio_device_combo_box->currentIndex()) |
| 111 | .toStdString(); | 111 | .toStdString()); |
| 112 | 112 | ||
| 113 | // Guard if during game and set to game-specific value | 113 | // Guard if during game and set to game-specific value |
| 114 | if (Settings::values.volume.UsingGlobal()) { | 114 | if (Settings::values.volume.UsingGlobal()) { |
diff --git a/src/yuzu/configuration/configure_cpu_debug.cpp b/src/yuzu/configuration/configure_cpu_debug.cpp index e25c52baf..98e2d2be5 100644 --- a/src/yuzu/configuration/configure_cpu_debug.cpp +++ b/src/yuzu/configuration/configure_cpu_debug.cpp | |||
| @@ -24,23 +24,26 @@ void ConfigureCpuDebug::SetConfiguration() { | |||
| 24 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 24 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); |
| 25 | 25 | ||
| 26 | ui->cpuopt_page_tables->setEnabled(runtime_lock); | 26 | ui->cpuopt_page_tables->setEnabled(runtime_lock); |
| 27 | ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables); | 27 | ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables.GetValue()); |
| 28 | ui->cpuopt_block_linking->setEnabled(runtime_lock); | 28 | ui->cpuopt_block_linking->setEnabled(runtime_lock); |
| 29 | ui->cpuopt_block_linking->setChecked(Settings::values.cpuopt_block_linking); | 29 | ui->cpuopt_block_linking->setChecked(Settings::values.cpuopt_block_linking.GetValue()); |
| 30 | ui->cpuopt_return_stack_buffer->setEnabled(runtime_lock); | 30 | ui->cpuopt_return_stack_buffer->setEnabled(runtime_lock); |
| 31 | ui->cpuopt_return_stack_buffer->setChecked(Settings::values.cpuopt_return_stack_buffer); | 31 | ui->cpuopt_return_stack_buffer->setChecked( |
| 32 | Settings::values.cpuopt_return_stack_buffer.GetValue()); | ||
| 32 | ui->cpuopt_fast_dispatcher->setEnabled(runtime_lock); | 33 | ui->cpuopt_fast_dispatcher->setEnabled(runtime_lock); |
| 33 | ui->cpuopt_fast_dispatcher->setChecked(Settings::values.cpuopt_fast_dispatcher); | 34 | ui->cpuopt_fast_dispatcher->setChecked(Settings::values.cpuopt_fast_dispatcher.GetValue()); |
| 34 | ui->cpuopt_context_elimination->setEnabled(runtime_lock); | 35 | ui->cpuopt_context_elimination->setEnabled(runtime_lock); |
| 35 | ui->cpuopt_context_elimination->setChecked(Settings::values.cpuopt_context_elimination); | 36 | ui->cpuopt_context_elimination->setChecked( |
| 37 | Settings::values.cpuopt_context_elimination.GetValue()); | ||
| 36 | ui->cpuopt_const_prop->setEnabled(runtime_lock); | 38 | ui->cpuopt_const_prop->setEnabled(runtime_lock); |
| 37 | ui->cpuopt_const_prop->setChecked(Settings::values.cpuopt_const_prop); | 39 | ui->cpuopt_const_prop->setChecked(Settings::values.cpuopt_const_prop.GetValue()); |
| 38 | ui->cpuopt_misc_ir->setEnabled(runtime_lock); | 40 | ui->cpuopt_misc_ir->setEnabled(runtime_lock); |
| 39 | ui->cpuopt_misc_ir->setChecked(Settings::values.cpuopt_misc_ir); | 41 | ui->cpuopt_misc_ir->setChecked(Settings::values.cpuopt_misc_ir.GetValue()); |
| 40 | ui->cpuopt_reduce_misalign_checks->setEnabled(runtime_lock); | 42 | ui->cpuopt_reduce_misalign_checks->setEnabled(runtime_lock); |
| 41 | ui->cpuopt_reduce_misalign_checks->setChecked(Settings::values.cpuopt_reduce_misalign_checks); | 43 | ui->cpuopt_reduce_misalign_checks->setChecked( |
| 44 | Settings::values.cpuopt_reduce_misalign_checks.GetValue()); | ||
| 42 | ui->cpuopt_fastmem->setEnabled(runtime_lock); | 45 | ui->cpuopt_fastmem->setEnabled(runtime_lock); |
| 43 | ui->cpuopt_fastmem->setChecked(Settings::values.cpuopt_fastmem); | 46 | ui->cpuopt_fastmem->setChecked(Settings::values.cpuopt_fastmem.GetValue()); |
| 44 | } | 47 | } |
| 45 | 48 | ||
| 46 | void ConfigureCpuDebug::ApplyConfiguration() { | 49 | void ConfigureCpuDebug::ApplyConfiguration() { |
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index 15d6a5ad7..cbe45a305 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp | |||
| @@ -31,20 +31,21 @@ void ConfigureDebug::SetConfiguration() { | |||
| 31 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 31 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); |
| 32 | 32 | ||
| 33 | ui->toggle_console->setEnabled(runtime_lock); | 33 | ui->toggle_console->setEnabled(runtime_lock); |
| 34 | ui->toggle_console->setChecked(UISettings::values.show_console); | 34 | ui->toggle_console->setChecked(UISettings::values.show_console.GetValue()); |
| 35 | ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter)); | 35 | ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue())); |
| 36 | ui->homebrew_args_edit->setText(QString::fromStdString(Settings::values.program_args)); | 36 | ui->homebrew_args_edit->setText( |
| 37 | QString::fromStdString(Settings::values.program_args.GetValue())); | ||
| 37 | ui->fs_access_log->setEnabled(runtime_lock); | 38 | ui->fs_access_log->setEnabled(runtime_lock); |
| 38 | ui->fs_access_log->setChecked(Settings::values.enable_fs_access_log); | 39 | ui->fs_access_log->setChecked(Settings::values.enable_fs_access_log.GetValue()); |
| 39 | ui->reporting_services->setChecked(Settings::values.reporting_services); | 40 | ui->reporting_services->setChecked(Settings::values.reporting_services.GetValue()); |
| 40 | ui->quest_flag->setChecked(Settings::values.quest_flag); | 41 | ui->quest_flag->setChecked(Settings::values.quest_flag.GetValue()); |
| 41 | ui->use_debug_asserts->setChecked(Settings::values.use_debug_asserts); | 42 | ui->use_debug_asserts->setChecked(Settings::values.use_debug_asserts.GetValue()); |
| 42 | ui->use_auto_stub->setChecked(Settings::values.use_auto_stub); | 43 | ui->use_auto_stub->setChecked(Settings::values.use_auto_stub.GetValue()); |
| 43 | ui->enable_graphics_debugging->setEnabled(runtime_lock); | 44 | ui->enable_graphics_debugging->setEnabled(runtime_lock); |
| 44 | ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug); | 45 | ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug.GetValue()); |
| 45 | ui->disable_macro_jit->setEnabled(runtime_lock); | 46 | ui->disable_macro_jit->setEnabled(runtime_lock); |
| 46 | ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit); | 47 | ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit.GetValue()); |
| 47 | ui->extended_logging->setChecked(Settings::values.extended_logging); | 48 | ui->extended_logging->setChecked(Settings::values.extended_logging.GetValue()); |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | void ConfigureDebug::ApplyConfiguration() { | 51 | void ConfigureDebug::ApplyConfiguration() { |
| @@ -61,7 +62,7 @@ void ConfigureDebug::ApplyConfiguration() { | |||
| 61 | Settings::values.extended_logging = ui->extended_logging->isChecked(); | 62 | Settings::values.extended_logging = ui->extended_logging->isChecked(); |
| 62 | Debugger::ToggleConsole(); | 63 | Debugger::ToggleConsole(); |
| 63 | Common::Log::Filter filter; | 64 | Common::Log::Filter filter; |
| 64 | filter.ParseFilterString(Settings::values.log_filter); | 65 | filter.ParseFilterString(Settings::values.log_filter.GetValue()); |
| 65 | Common::Log::SetGlobalFilter(filter); | 66 | Common::Log::SetGlobalFilter(filter); |
| 66 | } | 67 | } |
| 67 | 68 | ||
diff --git a/src/yuzu/configuration/configure_filesystem.cpp b/src/yuzu/configuration/configure_filesystem.cpp index d223c40ea..9cb317822 100644 --- a/src/yuzu/configuration/configure_filesystem.cpp +++ b/src/yuzu/configuration/configure_filesystem.cpp | |||
| @@ -43,18 +43,19 @@ void ConfigureFilesystem::setConfiguration() { | |||
| 43 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::NANDDir))); | 43 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::NANDDir))); |
| 44 | ui->sdmc_directory_edit->setText( | 44 | ui->sdmc_directory_edit->setText( |
| 45 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::SDMCDir))); | 45 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::SDMCDir))); |
| 46 | ui->gamecard_path_edit->setText(QString::fromStdString(Settings::values.gamecard_path)); | 46 | ui->gamecard_path_edit->setText( |
| 47 | QString::fromStdString(Settings::values.gamecard_path.GetValue())); | ||
| 47 | ui->dump_path_edit->setText( | 48 | ui->dump_path_edit->setText( |
| 48 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::DumpDir))); | 49 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::DumpDir))); |
| 49 | ui->load_path_edit->setText( | 50 | ui->load_path_edit->setText( |
| 50 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LoadDir))); | 51 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LoadDir))); |
| 51 | 52 | ||
| 52 | ui->gamecard_inserted->setChecked(Settings::values.gamecard_inserted); | 53 | ui->gamecard_inserted->setChecked(Settings::values.gamecard_inserted.GetValue()); |
| 53 | ui->gamecard_current_game->setChecked(Settings::values.gamecard_current_game); | 54 | ui->gamecard_current_game->setChecked(Settings::values.gamecard_current_game.GetValue()); |
| 54 | ui->dump_exefs->setChecked(Settings::values.dump_exefs); | 55 | ui->dump_exefs->setChecked(Settings::values.dump_exefs.GetValue()); |
| 55 | ui->dump_nso->setChecked(Settings::values.dump_nso); | 56 | ui->dump_nso->setChecked(Settings::values.dump_nso.GetValue()); |
| 56 | 57 | ||
| 57 | ui->cache_game_list->setChecked(UISettings::values.cache_game_list); | 58 | ui->cache_game_list->setChecked(UISettings::values.cache_game_list.GetValue()); |
| 58 | 59 | ||
| 59 | UpdateEnabledControls(); | 60 | UpdateEnabledControls(); |
| 60 | } | 61 | } |
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 38edb4d8d..18f25def6 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp | |||
| @@ -40,10 +40,10 @@ void ConfigureGeneral::SetConfiguration() { | |||
| 40 | ui->use_multi_core->setEnabled(runtime_lock); | 40 | ui->use_multi_core->setEnabled(runtime_lock); |
| 41 | ui->use_multi_core->setChecked(Settings::values.use_multi_core.GetValue()); | 41 | ui->use_multi_core->setChecked(Settings::values.use_multi_core.GetValue()); |
| 42 | 42 | ||
| 43 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); | 43 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing.GetValue()); |
| 44 | ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot); | 44 | ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot.GetValue()); |
| 45 | ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background); | 45 | ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background.GetValue()); |
| 46 | ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse); | 46 | ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue()); |
| 47 | 47 | ||
| 48 | ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue()); | 48 | ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue()); |
| 49 | ui->frame_limit->setValue(Settings::values.frame_limit.GetValue()); | 49 | ui->frame_limit->setValue(Settings::values.frame_limit.GetValue()); |
diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp index d8d3b83dc..2f1419b5b 100644 --- a/src/yuzu/configuration/configure_input_advanced.cpp +++ b/src/yuzu/configuration/configure_input_advanced.cpp | |||
| @@ -148,12 +148,12 @@ void ConfigureInputAdvanced::LoadConfiguration() { | |||
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | ui->debug_enabled->setChecked(Settings::values.debug_pad_enabled); | 151 | ui->debug_enabled->setChecked(Settings::values.debug_pad_enabled.GetValue()); |
| 152 | ui->mouse_enabled->setChecked(Settings::values.mouse_enabled); | 152 | ui->mouse_enabled->setChecked(Settings::values.mouse_enabled.GetValue()); |
| 153 | ui->keyboard_enabled->setChecked(Settings::values.keyboard_enabled); | 153 | ui->keyboard_enabled->setChecked(Settings::values.keyboard_enabled.GetValue()); |
| 154 | ui->emulate_analog_keyboard->setChecked(Settings::values.emulate_analog_keyboard); | 154 | ui->emulate_analog_keyboard->setChecked(Settings::values.emulate_analog_keyboard.GetValue()); |
| 155 | ui->mouse_panning->setChecked(Settings::values.mouse_panning); | 155 | ui->mouse_panning->setChecked(Settings::values.mouse_panning.GetValue()); |
| 156 | ui->mouse_panning_sensitivity->setValue(Settings::values.mouse_panning_sensitivity); | 156 | ui->mouse_panning_sensitivity->setValue(Settings::values.mouse_panning_sensitivity.GetValue()); |
| 157 | ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled); | 157 | ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled); |
| 158 | 158 | ||
| 159 | UpdateUIEnabled(); | 159 | UpdateUIEnabled(); |
diff --git a/src/yuzu/configuration/configure_motion_touch.cpp b/src/yuzu/configuration/configure_motion_touch.cpp index 6a5d625df..f8e08c422 100644 --- a/src/yuzu/configuration/configure_motion_touch.cpp +++ b/src/yuzu/configuration/configure_motion_touch.cpp | |||
| @@ -101,15 +101,16 @@ ConfigureMotionTouch::ConfigureMotionTouch(QWidget* parent, | |||
| 101 | ConfigureMotionTouch::~ConfigureMotionTouch() = default; | 101 | ConfigureMotionTouch::~ConfigureMotionTouch() = default; |
| 102 | 102 | ||
| 103 | void ConfigureMotionTouch::SetConfiguration() { | 103 | void ConfigureMotionTouch::SetConfiguration() { |
| 104 | const Common::ParamPackage motion_param(Settings::values.motion_device); | 104 | const Common::ParamPackage motion_param(Settings::values.motion_device.GetValue()); |
| 105 | const Common::ParamPackage touch_param(Settings::values.touch_device); | 105 | const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue()); |
| 106 | 106 | ||
| 107 | ui->touch_from_button_checkbox->setChecked(Settings::values.use_touch_from_button); | 107 | ui->touch_from_button_checkbox->setChecked(Settings::values.use_touch_from_button.GetValue()); |
| 108 | touch_from_button_maps = Settings::values.touch_from_button_maps; | 108 | touch_from_button_maps = Settings::values.touch_from_button_maps; |
| 109 | for (const auto& touch_map : touch_from_button_maps) { | 109 | for (const auto& touch_map : touch_from_button_maps) { |
| 110 | ui->touch_from_button_map->addItem(QString::fromStdString(touch_map.name)); | 110 | ui->touch_from_button_map->addItem(QString::fromStdString(touch_map.name)); |
| 111 | } | 111 | } |
| 112 | ui->touch_from_button_map->setCurrentIndex(Settings::values.touch_from_button_map_index); | 112 | ui->touch_from_button_map->setCurrentIndex( |
| 113 | Settings::values.touch_from_button_map_index.GetValue()); | ||
| 113 | ui->motion_sensitivity->setValue(motion_param.Get("sensitivity", 0.01f)); | 114 | ui->motion_sensitivity->setValue(motion_param.Get("sensitivity", 0.01f)); |
| 114 | 115 | ||
| 115 | min_x = touch_param.Get("min_x", 100); | 116 | min_x = touch_param.Get("min_x", 100); |
| @@ -124,7 +125,7 @@ void ConfigureMotionTouch::SetConfiguration() { | |||
| 124 | udp_server_list_model->setStringList({}); | 125 | udp_server_list_model->setStringList({}); |
| 125 | ui->udp_server_list->setModel(udp_server_list_model); | 126 | ui->udp_server_list->setModel(udp_server_list_model); |
| 126 | 127 | ||
| 127 | std::stringstream ss(Settings::values.udp_input_servers); | 128 | std::stringstream ss(Settings::values.udp_input_servers.GetValue()); |
| 128 | std::string token; | 129 | std::string token; |
| 129 | 130 | ||
| 130 | while (std::getline(ss, token, ',')) { | 131 | while (std::getline(ss, token, ',')) { |
diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp index f5881e58d..ac849b01d 100644 --- a/src/yuzu/configuration/configure_profile_manager.cpp +++ b/src/yuzu/configuration/configure_profile_manager.cpp | |||
| @@ -166,7 +166,7 @@ void ConfigureProfileManager::PopulateUserList() { | |||
| 166 | void ConfigureProfileManager::UpdateCurrentUser() { | 166 | void ConfigureProfileManager::UpdateCurrentUser() { |
| 167 | ui->pm_add->setEnabled(profile_manager->GetUserCount() < Service::Account::MAX_USERS); | 167 | ui->pm_add->setEnabled(profile_manager->GetUserCount() < Service::Account::MAX_USERS); |
| 168 | 168 | ||
| 169 | const auto& current_user = profile_manager->GetUser(Settings::values.current_user); | 169 | const auto& current_user = profile_manager->GetUser(Settings::values.current_user.GetValue()); |
| 170 | ASSERT(current_user); | 170 | ASSERT(current_user); |
| 171 | const auto username = GetAccountUsername(*profile_manager, *current_user); | 171 | const auto username = GetAccountUsername(*profile_manager, *current_user); |
| 172 | 172 | ||
| @@ -245,15 +245,18 @@ void ConfigureProfileManager::DeleteUser() { | |||
| 245 | this, tr("Confirm Delete"), | 245 | this, tr("Confirm Delete"), |
| 246 | tr("You are about to delete user with name \"%1\". Are you sure?").arg(username)); | 246 | tr("You are about to delete user with name \"%1\". Are you sure?").arg(username)); |
| 247 | 247 | ||
| 248 | if (confirm == QMessageBox::No) | 248 | if (confirm == QMessageBox::No) { |
| 249 | return; | 249 | return; |
| 250 | } | ||
| 250 | 251 | ||
| 251 | if (Settings::values.current_user == tree_view->currentIndex().row()) | 252 | if (Settings::values.current_user.GetValue() == tree_view->currentIndex().row()) { |
| 252 | Settings::values.current_user = 0; | 253 | Settings::values.current_user = 0; |
| 254 | } | ||
| 253 | UpdateCurrentUser(); | 255 | UpdateCurrentUser(); |
| 254 | 256 | ||
| 255 | if (!profile_manager->RemoveUser(*uuid)) | 257 | if (!profile_manager->RemoveUser(*uuid)) { |
| 256 | return; | 258 | return; |
| 259 | } | ||
| 257 | 260 | ||
| 258 | item_model->removeRows(tree_view->currentIndex().row(), 1); | 261 | item_model->removeRows(tree_view->currentIndex().row(), 1); |
| 259 | tree_view->clearSelection(); | 262 | tree_view->clearSelection(); |
diff --git a/src/yuzu/configuration/configure_service.cpp b/src/yuzu/configuration/configure_service.cpp index 6d954a67f..4aa424803 100644 --- a/src/yuzu/configuration/configure_service.cpp +++ b/src/yuzu/configuration/configure_service.cpp | |||
| @@ -65,7 +65,7 @@ void ConfigureService::RetranslateUi() { | |||
| 65 | 65 | ||
| 66 | void ConfigureService::SetConfiguration() { | 66 | void ConfigureService::SetConfiguration() { |
| 67 | const int index = | 67 | const int index = |
| 68 | ui->bcat_source->findData(QString::fromStdString(Settings::values.bcat_backend)); | 68 | ui->bcat_source->findData(QString::fromStdString(Settings::values.bcat_backend.GetValue())); |
| 69 | ui->bcat_source->setCurrentIndex(index == -1 ? 0 : index); | 69 | ui->bcat_source->setCurrentIndex(index == -1 ? 0 : index); |
| 70 | } | 70 | } |
| 71 | 71 | ||
diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 9674119e1..e8f41bf65 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp | |||
| @@ -113,11 +113,12 @@ void ConfigureUi::SetConfiguration() { | |||
| 113 | ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme)); | 113 | ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme)); |
| 114 | ui->language_combobox->setCurrentIndex( | 114 | ui->language_combobox->setCurrentIndex( |
| 115 | ui->language_combobox->findData(UISettings::values.language)); | 115 | ui->language_combobox->findData(UISettings::values.language)); |
| 116 | ui->show_add_ons->setChecked(UISettings::values.show_add_ons); | 116 | ui->show_add_ons->setChecked(UISettings::values.show_add_ons.GetValue()); |
| 117 | ui->icon_size_combobox->setCurrentIndex( | 117 | ui->icon_size_combobox->setCurrentIndex( |
| 118 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); | 118 | ui->icon_size_combobox->findData(UISettings::values.icon_size.GetValue())); |
| 119 | 119 | ||
| 120 | ui->enable_screenshot_save_as->setChecked(UISettings::values.enable_screenshot_save_as); | 120 | ui->enable_screenshot_save_as->setChecked( |
| 121 | UISettings::values.enable_screenshot_save_as.GetValue()); | ||
| 121 | ui->screenshot_path_edit->setText(QString::fromStdString( | 122 | ui->screenshot_path_edit->setText(QString::fromStdString( |
| 122 | Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir))); | 123 | Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir))); |
| 123 | } | 124 | } |
| @@ -178,7 +179,7 @@ void ConfigureUi::InitializeRowComboBoxes() { | |||
| 178 | 179 | ||
| 179 | void ConfigureUi::UpdateFirstRowComboBox(bool init) { | 180 | void ConfigureUi::UpdateFirstRowComboBox(bool init) { |
| 180 | const int currentIndex = | 181 | const int currentIndex = |
| 181 | init ? UISettings::values.row_1_text_id | 182 | init ? UISettings::values.row_1_text_id.GetValue() |
| 182 | : ui->row_1_text_combobox->findData(ui->row_1_text_combobox->currentData()); | 183 | : ui->row_1_text_combobox->findData(ui->row_1_text_combobox->currentData()); |
| 183 | 184 | ||
| 184 | ui->row_1_text_combobox->clear(); | 185 | ui->row_1_text_combobox->clear(); |
| @@ -197,7 +198,7 @@ void ConfigureUi::UpdateFirstRowComboBox(bool init) { | |||
| 197 | 198 | ||
| 198 | void ConfigureUi::UpdateSecondRowComboBox(bool init) { | 199 | void ConfigureUi::UpdateSecondRowComboBox(bool init) { |
| 199 | const int currentIndex = | 200 | const int currentIndex = |
| 200 | init ? UISettings::values.row_2_text_id | 201 | init ? UISettings::values.row_2_text_id.GetValue() |
| 201 | : ui->row_2_text_combobox->findData(ui->row_2_text_combobox->currentData()); | 202 | : ui->row_2_text_combobox->findData(ui->row_2_text_combobox->currentData()); |
| 202 | 203 | ||
| 203 | ui->row_2_text_combobox->clear(); | 204 | ui->row_2_text_combobox->clear(); |
diff --git a/src/yuzu/configuration/configure_web.cpp b/src/yuzu/configuration/configure_web.cpp index f3f3b54d6..d779251b4 100644 --- a/src/yuzu/configuration/configure_web.cpp +++ b/src/yuzu/configuration/configure_web.cpp | |||
| @@ -88,22 +88,22 @@ void ConfigureWeb::SetConfiguration() { | |||
| 88 | ui->web_signup_link->setOpenExternalLinks(true); | 88 | ui->web_signup_link->setOpenExternalLinks(true); |
| 89 | ui->web_token_info_link->setOpenExternalLinks(true); | 89 | ui->web_token_info_link->setOpenExternalLinks(true); |
| 90 | 90 | ||
| 91 | if (Settings::values.yuzu_username.empty()) { | 91 | if (Settings::values.yuzu_username.GetValue().empty()) { |
| 92 | ui->username->setText(tr("Unspecified")); | 92 | ui->username->setText(tr("Unspecified")); |
| 93 | } else { | 93 | } else { |
| 94 | ui->username->setText(QString::fromStdString(Settings::values.yuzu_username)); | 94 | ui->username->setText(QString::fromStdString(Settings::values.yuzu_username.GetValue())); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | ui->toggle_telemetry->setChecked(Settings::values.enable_telemetry); | 97 | ui->toggle_telemetry->setChecked(Settings::values.enable_telemetry.GetValue()); |
| 98 | ui->edit_token->setText(QString::fromStdString( | 98 | ui->edit_token->setText(QString::fromStdString(GenerateDisplayToken( |
| 99 | GenerateDisplayToken(Settings::values.yuzu_username, Settings::values.yuzu_token))); | 99 | Settings::values.yuzu_username.GetValue(), Settings::values.yuzu_token.GetValue()))); |
| 100 | 100 | ||
| 101 | // Connect after setting the values, to avoid calling OnLoginChanged now | 101 | // Connect after setting the values, to avoid calling OnLoginChanged now |
| 102 | connect(ui->edit_token, &QLineEdit::textChanged, this, &ConfigureWeb::OnLoginChanged); | 102 | connect(ui->edit_token, &QLineEdit::textChanged, this, &ConfigureWeb::OnLoginChanged); |
| 103 | 103 | ||
| 104 | user_verified = true; | 104 | user_verified = true; |
| 105 | 105 | ||
| 106 | ui->toggle_discordrpc->setChecked(UISettings::values.enable_discord_presence); | 106 | ui->toggle_discordrpc->setChecked(UISettings::values.enable_discord_presence.GetValue()); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | void ConfigureWeb::ApplyConfiguration() { | 109 | void ConfigureWeb::ApplyConfiguration() { |
diff --git a/src/yuzu/debugger/console.cpp b/src/yuzu/debugger/console.cpp index c11a326ac..22ca1285d 100644 --- a/src/yuzu/debugger/console.cpp +++ b/src/yuzu/debugger/console.cpp | |||
| @@ -15,10 +15,10 @@ | |||
| 15 | namespace Debugger { | 15 | namespace Debugger { |
| 16 | void ToggleConsole() { | 16 | void ToggleConsole() { |
| 17 | static bool console_shown = false; | 17 | static bool console_shown = false; |
| 18 | if (console_shown == UISettings::values.show_console) { | 18 | if (console_shown == UISettings::values.show_console.GetValue()) { |
| 19 | return; | 19 | return; |
| 20 | } else { | 20 | } else { |
| 21 | console_shown = UISettings::values.show_console; | 21 | console_shown = UISettings::values.show_console.GetValue(); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | #if defined(_WIN32) && !defined(_DEBUG) | 24 | #if defined(_WIN32) && !defined(_DEBUG) |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index e44907be8..218b4782b 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -244,7 +244,8 @@ void GameList::OnUpdateThemedIcons() { | |||
| 244 | for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); i++) { | 244 | for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); i++) { |
| 245 | QStandardItem* child = item_model->invisibleRootItem()->child(i); | 245 | QStandardItem* child = item_model->invisibleRootItem()->child(i); |
| 246 | 246 | ||
| 247 | const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64); | 247 | const int icon_size = |
| 248 | std::min(static_cast<int>(UISettings::values.icon_size.GetValue()), 64); | ||
| 248 | switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) { | 249 | switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) { |
| 249 | case GameListItemType::SdmcDir: | 250 | case GameListItemType::SdmcDir: |
| 250 | child->setData( | 251 | child->setData( |
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 978d27325..982c0789d 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h | |||
| @@ -80,7 +80,7 @@ public: | |||
| 80 | setData(qulonglong(program_id), ProgramIdRole); | 80 | setData(qulonglong(program_id), ProgramIdRole); |
| 81 | setData(game_type, FileTypeRole); | 81 | setData(game_type, FileTypeRole); |
| 82 | 82 | ||
| 83 | const u32 size = UISettings::values.icon_size; | 83 | const u32 size = UISettings::values.icon_size.GetValue(); |
| 84 | 84 | ||
| 85 | QPixmap picture; | 85 | QPixmap picture; |
| 86 | if (!picture.loadFromData(picture_data.data(), static_cast<u32>(picture_data.size()))) { | 86 | if (!picture.loadFromData(picture_data.data(), static_cast<u32>(picture_data.size()))) { |
| @@ -108,8 +108,8 @@ public: | |||
| 108 | data(TitleRole).toString(), | 108 | data(TitleRole).toString(), |
| 109 | }}; | 109 | }}; |
| 110 | 110 | ||
| 111 | const auto& row1 = row_data.at(UISettings::values.row_1_text_id); | 111 | const auto& row1 = row_data.at(UISettings::values.row_1_text_id.GetValue()); |
| 112 | const int row2_id = UISettings::values.row_2_text_id; | 112 | const int row2_id = UISettings::values.row_2_text_id.GetValue(); |
| 113 | 113 | ||
| 114 | if (role == SortRole) { | 114 | if (role == SortRole) { |
| 115 | return row1.toLower(); | 115 | return row1.toLower(); |
| @@ -233,7 +233,8 @@ public: | |||
| 233 | UISettings::GameDir* game_dir = &directory; | 233 | UISettings::GameDir* game_dir = &directory; |
| 234 | setData(QVariant(UISettings::values.game_dirs.indexOf(directory)), GameDirRole); | 234 | setData(QVariant(UISettings::values.game_dirs.indexOf(directory)), GameDirRole); |
| 235 | 235 | ||
| 236 | const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64); | 236 | const int icon_size = |
| 237 | std::min(static_cast<int>(UISettings::values.icon_size.GetValue()), 64); | ||
| 237 | switch (dir_type) { | 238 | switch (dir_type) { |
| 238 | case GameListItemType::SdmcDir: | 239 | case GameListItemType::SdmcDir: |
| 239 | setData( | 240 | setData( |
| @@ -294,7 +295,8 @@ public: | |||
| 294 | explicit GameListAddDir() { | 295 | explicit GameListAddDir() { |
| 295 | setData(type(), TypeRole); | 296 | setData(type(), TypeRole); |
| 296 | 297 | ||
| 297 | const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64); | 298 | const int icon_size = |
| 299 | std::min(static_cast<int>(UISettings::values.icon_size.GetValue()), 64); | ||
| 298 | setData(QIcon::fromTheme(QStringLiteral("plus")) | 300 | setData(QIcon::fromTheme(QStringLiteral("plus")) |
| 299 | .pixmap(icon_size) | 301 | .pixmap(icon_size) |
| 300 | .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | 302 | .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), |
| @@ -316,7 +318,8 @@ public: | |||
| 316 | explicit GameListFavorites() { | 318 | explicit GameListFavorites() { |
| 317 | setData(type(), TypeRole); | 319 | setData(type(), TypeRole); |
| 318 | 320 | ||
| 319 | const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64); | 321 | const int icon_size = |
| 322 | std::min(static_cast<int>(UISettings::values.icon_size.GetValue()), 64); | ||
| 320 | setData(QIcon::fromTheme(QStringLiteral("star")) | 323 | setData(QIcon::fromTheme(QStringLiteral("star")) |
| 321 | .pixmap(icon_size) | 324 | .pixmap(icon_size) |
| 322 | .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | 325 | .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f462cd072..5ed3b90b8 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -156,11 +156,13 @@ enum class CalloutFlag : uint32_t { | |||
| 156 | }; | 156 | }; |
| 157 | 157 | ||
| 158 | void GMainWindow::ShowTelemetryCallout() { | 158 | void GMainWindow::ShowTelemetryCallout() { |
| 159 | if (UISettings::values.callout_flags & static_cast<uint32_t>(CalloutFlag::Telemetry)) { | 159 | if (UISettings::values.callout_flags.GetValue() & |
| 160 | static_cast<uint32_t>(CalloutFlag::Telemetry)) { | ||
| 160 | return; | 161 | return; |
| 161 | } | 162 | } |
| 162 | 163 | ||
| 163 | UISettings::values.callout_flags |= static_cast<uint32_t>(CalloutFlag::Telemetry); | 164 | UISettings::values.callout_flags = |
| 165 | UISettings::values.callout_flags.GetValue() | static_cast<uint32_t>(CalloutFlag::Telemetry); | ||
| 164 | const QString telemetry_message = | 166 | const QString telemetry_message = |
| 165 | tr("<a href='https://yuzu-emu.org/help/feature/telemetry/'>Anonymous " | 167 | tr("<a href='https://yuzu-emu.org/help/feature/telemetry/'>Anonymous " |
| 166 | "data is collected</a> to help improve yuzu. " | 168 | "data is collected</a> to help improve yuzu. " |
| @@ -177,7 +179,7 @@ static void InitializeLogging() { | |||
| 177 | using namespace Common; | 179 | using namespace Common; |
| 178 | 180 | ||
| 179 | Log::Filter log_filter; | 181 | Log::Filter log_filter; |
| 180 | log_filter.ParseFilterString(Settings::values.log_filter); | 182 | log_filter.ParseFilterString(Settings::values.log_filter.GetValue()); |
| 181 | Log::SetGlobalFilter(log_filter); | 183 | Log::SetGlobalFilter(log_filter); |
| 182 | 184 | ||
| 183 | const auto log_dir = FS::GetYuzuPath(FS::YuzuPath::LogDir); | 185 | const auto log_dir = FS::GetYuzuPath(FS::YuzuPath::LogDir); |
| @@ -216,7 +218,7 @@ GMainWindow::GMainWindow() | |||
| 216 | default_theme_paths = QIcon::themeSearchPaths(); | 218 | default_theme_paths = QIcon::themeSearchPaths(); |
| 217 | UpdateUITheme(); | 219 | UpdateUITheme(); |
| 218 | 220 | ||
| 219 | SetDiscordEnabled(UISettings::values.enable_discord_presence); | 221 | SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue()); |
| 220 | discord_rpc->Update(); | 222 | discord_rpc->Update(); |
| 221 | 223 | ||
| 222 | RegisterMetaTypes(); | 224 | RegisterMetaTypes(); |
| @@ -1060,23 +1062,24 @@ void GMainWindow::RestoreUIState() { | |||
| 1060 | render_window->restoreGeometry(UISettings::values.renderwindow_geometry); | 1062 | render_window->restoreGeometry(UISettings::values.renderwindow_geometry); |
| 1061 | #if MICROPROFILE_ENABLED | 1063 | #if MICROPROFILE_ENABLED |
| 1062 | microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry); | 1064 | microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry); |
| 1063 | microProfileDialog->setVisible(UISettings::values.microprofile_visible); | 1065 | microProfileDialog->setVisible(UISettings::values.microprofile_visible.GetValue()); |
| 1064 | #endif | 1066 | #endif |
| 1065 | 1067 | ||
| 1066 | game_list->LoadInterfaceLayout(); | 1068 | game_list->LoadInterfaceLayout(); |
| 1067 | 1069 | ||
| 1068 | ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode); | 1070 | ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode.GetValue()); |
| 1069 | ToggleWindowMode(); | 1071 | ToggleWindowMode(); |
| 1070 | 1072 | ||
| 1071 | ui.action_Fullscreen->setChecked(UISettings::values.fullscreen); | 1073 | ui.action_Fullscreen->setChecked(UISettings::values.fullscreen.GetValue()); |
| 1072 | 1074 | ||
| 1073 | ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar); | 1075 | ui.action_Display_Dock_Widget_Headers->setChecked( |
| 1076 | UISettings::values.display_titlebar.GetValue()); | ||
| 1074 | OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); | 1077 | OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); |
| 1075 | 1078 | ||
| 1076 | ui.action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar); | 1079 | ui.action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue()); |
| 1077 | game_list->SetFilterVisible(ui.action_Show_Filter_Bar->isChecked()); | 1080 | game_list->SetFilterVisible(ui.action_Show_Filter_Bar->isChecked()); |
| 1078 | 1081 | ||
| 1079 | ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar); | 1082 | ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar.GetValue()); |
| 1080 | statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); | 1083 | statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); |
| 1081 | Debugger::ToggleConsole(); | 1084 | Debugger::ToggleConsole(); |
| 1082 | } | 1085 | } |
| @@ -1243,13 +1246,14 @@ bool GMainWindow::LoadROM(const QString& filename, std::size_t program_index) { | |||
| 1243 | const Core::System::ResultStatus result{ | 1246 | const Core::System::ResultStatus result{ |
| 1244 | system.Load(*render_window, filename.toStdString(), program_index)}; | 1247 | system.Load(*render_window, filename.toStdString(), program_index)}; |
| 1245 | 1248 | ||
| 1246 | const auto drd_callout = | 1249 | const auto drd_callout = (UISettings::values.callout_flags.GetValue() & |
| 1247 | (UISettings::values.callout_flags & static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0; | 1250 | static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0; |
| 1248 | 1251 | ||
| 1249 | if (result == Core::System::ResultStatus::Success && | 1252 | if (result == Core::System::ResultStatus::Success && |
| 1250 | system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory && | 1253 | system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory && |
| 1251 | drd_callout) { | 1254 | drd_callout) { |
| 1252 | UISettings::values.callout_flags |= static_cast<u32>(CalloutFlag::DRDDeprecation); | 1255 | UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() | |
| 1256 | static_cast<u32>(CalloutFlag::DRDDeprecation); | ||
| 1253 | QMessageBox::warning( | 1257 | QMessageBox::warning( |
| 1254 | this, tr("Warning Outdated Game Format"), | 1258 | this, tr("Warning Outdated Game Format"), |
| 1255 | tr("You are using the deconstructed ROM directory format for this game, which is an " | 1259 | tr("You are using the deconstructed ROM directory format for this game, which is an " |
| @@ -2453,7 +2457,8 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex | |||
| 2453 | } | 2457 | } |
| 2454 | 2458 | ||
| 2455 | void GMainWindow::OnMenuReportCompatibility() { | 2459 | void GMainWindow::OnMenuReportCompatibility() { |
| 2456 | if (!Settings::values.yuzu_token.empty() && !Settings::values.yuzu_username.empty()) { | 2460 | if (!Settings::values.yuzu_token.GetValue().empty() && |
| 2461 | !Settings::values.yuzu_username.GetValue().empty()) { | ||
| 2457 | CompatDB compatdb{this}; | 2462 | CompatDB compatdb{this}; |
| 2458 | compatdb.exec(); | 2463 | compatdb.exec(); |
| 2459 | } else { | 2464 | } else { |
| @@ -2618,7 +2623,7 @@ void GMainWindow::ResetWindowSize1080() { | |||
| 2618 | 2623 | ||
| 2619 | void GMainWindow::OnConfigure() { | 2624 | void GMainWindow::OnConfigure() { |
| 2620 | const auto old_theme = UISettings::values.theme; | 2625 | const auto old_theme = UISettings::values.theme; |
| 2621 | const bool old_discord_presence = UISettings::values.enable_discord_presence; | 2626 | const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); |
| 2622 | 2627 | ||
| 2623 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); | 2628 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); |
| 2624 | connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this, | 2629 | connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this, |
| @@ -2675,8 +2680,8 @@ void GMainWindow::OnConfigure() { | |||
| 2675 | if (UISettings::values.theme != old_theme) { | 2680 | if (UISettings::values.theme != old_theme) { |
| 2676 | UpdateUITheme(); | 2681 | UpdateUITheme(); |
| 2677 | } | 2682 | } |
| 2678 | if (UISettings::values.enable_discord_presence != old_discord_presence) { | 2683 | if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) { |
| 2679 | SetDiscordEnabled(UISettings::values.enable_discord_presence); | 2684 | SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue()); |
| 2680 | } | 2685 | } |
| 2681 | emit UpdateThemedIcons(); | 2686 | emit UpdateThemedIcons(); |
| 2682 | 2687 | ||
| @@ -2832,7 +2837,8 @@ void GMainWindow::OnCaptureScreenshot() { | |||
| 2832 | } | 2837 | } |
| 2833 | } | 2838 | } |
| 2834 | #endif | 2839 | #endif |
| 2835 | render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor, filename); | 2840 | render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor.GetValue(), |
| 2841 | filename); | ||
| 2836 | OnStartGame(); | 2842 | OnStartGame(); |
| 2837 | } | 2843 | } |
| 2838 | 2844 | ||
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index cdcb83f9f..7b9d2dd53 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <QStringList> | 13 | #include <QStringList> |
| 14 | #include <QVector> | 14 | #include <QVector> |
| 15 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 16 | #include "common/settings.h" | ||
| 16 | 17 | ||
| 17 | namespace UISettings { | 18 | namespace UISettings { |
| 18 | 19 | ||
| @@ -48,26 +49,26 @@ struct Values { | |||
| 48 | QByteArray gamelist_header_state; | 49 | QByteArray gamelist_header_state; |
| 49 | 50 | ||
| 50 | QByteArray microprofile_geometry; | 51 | QByteArray microprofile_geometry; |
| 51 | bool microprofile_visible; | 52 | Settings::BasicSetting<bool> microprofile_visible{false, "microProfileDialogVisible"}; |
| 52 | 53 | ||
| 53 | bool single_window_mode; | 54 | Settings::BasicSetting<bool> single_window_mode{true, "singleWindowMode"}; |
| 54 | bool fullscreen; | 55 | Settings::BasicSetting<bool> fullscreen{false, "fullscreen"}; |
| 55 | bool display_titlebar; | 56 | Settings::BasicSetting<bool> display_titlebar{true, "displayTitleBars"}; |
| 56 | bool show_filter_bar; | 57 | Settings::BasicSetting<bool> show_filter_bar{true, "showFilterBar"}; |
| 57 | bool show_status_bar; | 58 | Settings::BasicSetting<bool> show_status_bar{true, "showStatusBar"}; |
| 58 | 59 | ||
| 59 | bool confirm_before_closing; | 60 | Settings::BasicSetting<bool> confirm_before_closing{true, "confirmClose"}; |
| 60 | bool first_start; | 61 | Settings::BasicSetting<bool> first_start{true, "firstStart"}; |
| 61 | bool pause_when_in_background; | 62 | Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"}; |
| 62 | bool hide_mouse; | 63 | Settings::BasicSetting<bool> hide_mouse{false, "hideInactiveMouse"}; |
| 63 | 64 | ||
| 64 | bool select_user_on_boot; | 65 | Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"}; |
| 65 | 66 | ||
| 66 | // Discord RPC | 67 | // Discord RPC |
| 67 | bool enable_discord_presence; | 68 | Settings::BasicSetting<bool> enable_discord_presence{true, "enable_discord_presence"}; |
| 68 | 69 | ||
| 69 | bool enable_screenshot_save_as; | 70 | Settings::BasicSetting<bool> enable_screenshot_save_as{true, "enable_screenshot_save_as"}; |
| 70 | u16 screenshot_resolution_factor; | 71 | Settings::BasicSetting<u16> screenshot_resolution_factor{0, "screenshot_resolution_factor"}; |
| 71 | 72 | ||
| 72 | QString roms_path; | 73 | QString roms_path; |
| 73 | QString symbols_path; | 74 | QString symbols_path; |
| @@ -83,18 +84,18 @@ struct Values { | |||
| 83 | // Shortcut name <Shortcut, context> | 84 | // Shortcut name <Shortcut, context> |
| 84 | std::vector<Shortcut> shortcuts; | 85 | std::vector<Shortcut> shortcuts; |
| 85 | 86 | ||
| 86 | uint32_t callout_flags; | 87 | Settings::BasicSetting<uint32_t> callout_flags{0, "calloutFlags"}; |
| 87 | 88 | ||
| 88 | // logging | 89 | // logging |
| 89 | bool show_console; | 90 | Settings::BasicSetting<bool> show_console{false, "showConsole"}; |
| 90 | 91 | ||
| 91 | // Game List | 92 | // Game List |
| 92 | bool show_add_ons; | 93 | Settings::BasicSetting<bool> show_add_ons{true, "show_add_ons"}; |
| 93 | uint32_t icon_size; | 94 | Settings::BasicSetting<uint32_t> icon_size{64, "icon_size"}; |
| 94 | uint8_t row_1_text_id; | 95 | Settings::BasicSetting<uint8_t> row_1_text_id{3, "row_1_text_id"}; |
| 95 | uint8_t row_2_text_id; | 96 | Settings::BasicSetting<uint8_t> row_2_text_id{2, "row_2_text_id"}; |
| 96 | std::atomic_bool is_game_list_reload_pending{false}; | 97 | std::atomic_bool is_game_list_reload_pending{false}; |
| 97 | bool cache_game_list; | 98 | Settings::BasicSetting<bool> cache_game_list{true, "cache_game_list"}; |
| 98 | 99 | ||
| 99 | bool configuration_applied; | 100 | bool configuration_applied; |
| 100 | bool reset_to_defaults; | 101 | bool reset_to_defaults; |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 60bf66ec0..325584a1a 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -241,6 +241,24 @@ static const std::array<int, 8> keyboard_mods{ | |||
| 241 | SDL_SCANCODE_RCTRL, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_RALT, SDL_SCANCODE_RGUI, | 241 | SDL_SCANCODE_RCTRL, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_RALT, SDL_SCANCODE_RGUI, |
| 242 | }; | 242 | }; |
| 243 | 243 | ||
| 244 | template <> | ||
| 245 | void Config::ReadSetting(const std::string& group, Settings::BasicSetting<float>& setting) { | ||
| 246 | setting = sdl2_config->GetReal(group, setting.GetLabel(), setting.GetDefault()); | ||
| 247 | } | ||
| 248 | template <> | ||
| 249 | void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) { | ||
| 250 | setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault()); | ||
| 251 | } | ||
| 252 | template <> | ||
| 253 | void Config::ReadSetting(const std::string& group, Settings::BasicSetting<bool>& setting) { | ||
| 254 | setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault()); | ||
| 255 | } | ||
| 256 | template <typename Type> | ||
| 257 | void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting) { | ||
| 258 | setting = static_cast<Type>(sdl2_config->GetInteger(group, setting.GetLabel(), | ||
| 259 | static_cast<long>(setting.GetDefault()))); | ||
| 260 | } | ||
| 261 | |||
| 244 | void Config::ReadValues() { | 262 | void Config::ReadValues() { |
| 245 | // Controls | 263 | // Controls |
| 246 | for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) { | 264 | for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) { |
| @@ -264,8 +282,7 @@ void Config::ReadValues() { | |||
| 264 | } | 282 | } |
| 265 | } | 283 | } |
| 266 | 284 | ||
| 267 | Settings::values.mouse_enabled = | 285 | ReadSetting("ControlsGeneral", Settings::values.mouse_enabled); |
| 268 | sdl2_config->GetBoolean("ControlsGeneral", "mouse_enabled", false); | ||
| 269 | for (int i = 0; i < Settings::NativeMouseButton::NumMouseButtons; ++i) { | 286 | for (int i = 0; i < Settings::NativeMouseButton::NumMouseButtons; ++i) { |
| 270 | std::string default_param = InputCommon::GenerateKeyboardParam(default_mouse_buttons[i]); | 287 | std::string default_param = InputCommon::GenerateKeyboardParam(default_mouse_buttons[i]); |
| 271 | Settings::values.mouse_buttons[i] = sdl2_config->Get( | 288 | Settings::values.mouse_buttons[i] = sdl2_config->Get( |
| @@ -275,14 +292,11 @@ void Config::ReadValues() { | |||
| 275 | Settings::values.mouse_buttons[i] = default_param; | 292 | Settings::values.mouse_buttons[i] = default_param; |
| 276 | } | 293 | } |
| 277 | 294 | ||
| 278 | Settings::values.motion_device = sdl2_config->Get( | 295 | ReadSetting("ControlsGeneral", Settings::values.motion_device); |
| 279 | "ControlsGeneral", "motion_device", "engine:motion_emu,update_period:100,sensitivity:0.01"); | ||
| 280 | 296 | ||
| 281 | Settings::values.keyboard_enabled = | 297 | ReadSetting("ControlsGeneral", Settings::values.keyboard_enabled); |
| 282 | sdl2_config->GetBoolean("ControlsGeneral", "keyboard_enabled", false); | ||
| 283 | 298 | ||
| 284 | Settings::values.debug_pad_enabled = | 299 | ReadSetting("ControlsGeneral", Settings::values.debug_pad_enabled); |
| 285 | sdl2_config->GetBoolean("ControlsGeneral", "debug_pad_enabled", false); | ||
| 286 | for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { | 300 | for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) { |
| 287 | std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]); | 301 | std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]); |
| 288 | Settings::values.debug_pad_buttons[i] = sdl2_config->Get( | 302 | Settings::values.debug_pad_buttons[i] = sdl2_config->Get( |
| @@ -303,12 +317,9 @@ void Config::ReadValues() { | |||
| 303 | Settings::values.debug_pad_analogs[i] = default_param; | 317 | Settings::values.debug_pad_analogs[i] = default_param; |
| 304 | } | 318 | } |
| 305 | 319 | ||
| 306 | Settings::values.vibration_enabled.SetValue( | 320 | ReadSetting("ControlsGeneral", Settings::values.vibration_enabled); |
| 307 | sdl2_config->GetBoolean("ControlsGeneral", "vibration_enabled", true)); | 321 | ReadSetting("ControlsGeneral", Settings::values.enable_accurate_vibrations); |
| 308 | Settings::values.enable_accurate_vibrations.SetValue( | 322 | ReadSetting("ControlsGeneral", Settings::values.motion_enabled); |
| 309 | sdl2_config->GetBoolean("ControlsGeneral", "enable_accurate_vibrations", false)); | ||
| 310 | Settings::values.motion_enabled.SetValue( | ||
| 311 | sdl2_config->GetBoolean("ControlsGeneral", "motion_enabled", true)); | ||
| 312 | Settings::values.touchscreen.enabled = | 323 | Settings::values.touchscreen.enabled = |
| 313 | sdl2_config->GetBoolean("ControlsGeneral", "touch_enabled", true); | 324 | sdl2_config->GetBoolean("ControlsGeneral", "touch_enabled", true); |
| 314 | Settings::values.touchscreen.rotation_angle = | 325 | Settings::values.touchscreen.rotation_angle = |
| @@ -349,13 +360,11 @@ void Config::ReadValues() { | |||
| 349 | Settings::TouchFromButtonMap{"default", {}}); | 360 | Settings::TouchFromButtonMap{"default", {}}); |
| 350 | num_touch_from_button_maps = 1; | 361 | num_touch_from_button_maps = 1; |
| 351 | } | 362 | } |
| 352 | Settings::values.use_touch_from_button = | 363 | ReadSetting("ControlsGeneral", Settings::values.use_touch_from_button); |
| 353 | sdl2_config->GetBoolean("ControlsGeneral", "use_touch_from_button", false); | 364 | Settings::values.touch_from_button_map_index = std::clamp( |
| 354 | Settings::values.touch_from_button_map_index = | 365 | Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1); |
| 355 | std::clamp(Settings::values.touch_from_button_map_index, 0, num_touch_from_button_maps - 1); | ||
| 356 | 366 | ||
| 357 | Settings::values.udp_input_servers = | 367 | ReadSetting("ControlsGeneral", Settings::values.udp_input_servers); |
| 358 | sdl2_config->Get("Controls", "udp_input_address", InputCommon::CemuhookUDP::DEFAULT_SRV); | ||
| 359 | 368 | ||
| 360 | std::transform(keyboard_keys.begin(), keyboard_keys.end(), | 369 | std::transform(keyboard_keys.begin(), keyboard_keys.end(), |
| 361 | Settings::values.keyboard_keys.begin(), InputCommon::GenerateKeyboardParam); | 370 | Settings::values.keyboard_keys.begin(), InputCommon::GenerateKeyboardParam); |
| @@ -367,8 +376,7 @@ void Config::ReadValues() { | |||
| 367 | Settings::values.keyboard_mods.begin(), InputCommon::GenerateKeyboardParam); | 376 | Settings::values.keyboard_mods.begin(), InputCommon::GenerateKeyboardParam); |
| 368 | 377 | ||
| 369 | // Data Storage | 378 | // Data Storage |
| 370 | Settings::values.use_virtual_sd = | 379 | ReadSetting("Data Storage", Settings::values.use_virtual_sd); |
| 371 | sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); | ||
| 372 | FS::SetYuzuPath(FS::YuzuPath::NANDDir, | 380 | FS::SetYuzuPath(FS::YuzuPath::NANDDir, |
| 373 | sdl2_config->Get("Data Storage", "nand_directory", | 381 | sdl2_config->Get("Data Storage", "nand_directory", |
| 374 | FS::GetYuzuPathString(FS::YuzuPath::NANDDir))); | 382 | FS::GetYuzuPathString(FS::YuzuPath::NANDDir))); |
| @@ -381,18 +389,16 @@ void Config::ReadValues() { | |||
| 381 | FS::SetYuzuPath(FS::YuzuPath::DumpDir, | 389 | FS::SetYuzuPath(FS::YuzuPath::DumpDir, |
| 382 | sdl2_config->Get("Data Storage", "dump_directory", | 390 | sdl2_config->Get("Data Storage", "dump_directory", |
| 383 | FS::GetYuzuPathString(FS::YuzuPath::DumpDir))); | 391 | FS::GetYuzuPathString(FS::YuzuPath::DumpDir))); |
| 384 | Settings::values.gamecard_inserted = | 392 | ReadSetting("Data Storage", Settings::values.gamecard_inserted); |
| 385 | sdl2_config->GetBoolean("Data Storage", "gamecard_inserted", false); | 393 | ReadSetting("Data Storage", Settings::values.gamecard_current_game); |
| 386 | Settings::values.gamecard_current_game = | 394 | ReadSetting("Data Storage", Settings::values.gamecard_path); |
| 387 | sdl2_config->GetBoolean("Data Storage", "gamecard_current_game", false); | ||
| 388 | Settings::values.gamecard_path = sdl2_config->Get("Data Storage", "gamecard_path", ""); | ||
| 389 | 395 | ||
| 390 | // System | 396 | // System |
| 391 | Settings::values.use_docked_mode.SetValue( | 397 | ReadSetting("System", Settings::values.use_docked_mode); |
| 392 | sdl2_config->GetBoolean("System", "use_docked_mode", true)); | ||
| 393 | 398 | ||
| 394 | Settings::values.current_user = std::clamp<int>( | 399 | ReadSetting("System", Settings::values.current_user); |
| 395 | sdl2_config->GetInteger("System", "current_user", 0), 0, Service::Account::MAX_USERS - 1); | 400 | Settings::values.current_user = std::clamp<int>(Settings::values.current_user.GetValue(), 0, |
| 401 | Service::Account::MAX_USERS - 1); | ||
| 396 | 402 | ||
| 397 | const auto rng_seed_enabled = sdl2_config->GetBoolean("System", "rng_seed_enabled", false); | 403 | const auto rng_seed_enabled = sdl2_config->GetBoolean("System", "rng_seed_enabled", false); |
| 398 | if (rng_seed_enabled) { | 404 | if (rng_seed_enabled) { |
| @@ -409,89 +415,60 @@ void Config::ReadValues() { | |||
| 409 | Settings::values.custom_rtc = std::nullopt; | 415 | Settings::values.custom_rtc = std::nullopt; |
| 410 | } | 416 | } |
| 411 | 417 | ||
| 412 | Settings::values.language_index.SetValue( | 418 | ReadSetting("System", Settings::values.language_index); |
| 413 | sdl2_config->GetInteger("System", "language_index", 1)); | 419 | ReadSetting("System", Settings::values.time_zone_index); |
| 414 | Settings::values.time_zone_index.SetValue( | ||
| 415 | sdl2_config->GetInteger("System", "time_zone_index", 0)); | ||
| 416 | 420 | ||
| 417 | // Core | 421 | // Core |
| 418 | Settings::values.use_multi_core.SetValue( | 422 | ReadSetting("Core", Settings::values.use_multi_core); |
| 419 | sdl2_config->GetBoolean("Core", "use_multi_core", true)); | ||
| 420 | 423 | ||
| 421 | // Renderer | 424 | // Renderer |
| 422 | const int renderer_backend = sdl2_config->GetInteger( | 425 | ReadSetting("Renderer", Settings::values.renderer_backend); |
| 423 | "Renderer", "backend", static_cast<int>(Settings::RendererBackend::OpenGL)); | 426 | ReadSetting("Renderer", Settings::values.renderer_debug); |
| 424 | Settings::values.renderer_backend.SetValue( | 427 | ReadSetting("Renderer", Settings::values.vulkan_device); |
| 425 | static_cast<Settings::RendererBackend>(renderer_backend)); | 428 | |
| 426 | Settings::values.renderer_debug = sdl2_config->GetBoolean("Renderer", "debug", false); | 429 | ReadSetting("Renderer", Settings::values.aspect_ratio); |
| 427 | Settings::values.vulkan_device.SetValue( | 430 | ReadSetting("Renderer", Settings::values.max_anisotropy); |
| 428 | sdl2_config->GetInteger("Renderer", "vulkan_device", 0)); | 431 | ReadSetting("Renderer", Settings::values.use_frame_limit); |
| 429 | 432 | ReadSetting("Renderer", Settings::values.frame_limit); | |
| 430 | Settings::values.aspect_ratio.SetValue( | 433 | ReadSetting("Renderer", Settings::values.use_disk_shader_cache); |
| 431 | static_cast<int>(sdl2_config->GetInteger("Renderer", "aspect_ratio", 0))); | 434 | ReadSetting("Renderer", Settings::values.gpu_accuracy); |
| 432 | Settings::values.max_anisotropy.SetValue( | 435 | ReadSetting("Renderer", Settings::values.use_asynchronous_gpu_emulation); |
| 433 | static_cast<int>(sdl2_config->GetInteger("Renderer", "max_anisotropy", 0))); | 436 | ReadSetting("Renderer", Settings::values.use_vsync); |
| 434 | Settings::values.use_frame_limit.SetValue( | 437 | ReadSetting("Renderer", Settings::values.disable_fps_limit); |
| 435 | sdl2_config->GetBoolean("Renderer", "use_frame_limit", true)); | 438 | ReadSetting("Renderer", Settings::values.use_assembly_shaders); |
| 436 | Settings::values.frame_limit.SetValue( | 439 | ReadSetting("Renderer", Settings::values.use_asynchronous_shaders); |
| 437 | static_cast<u16>(sdl2_config->GetInteger("Renderer", "frame_limit", 100))); | 440 | ReadSetting("Renderer", Settings::values.use_nvdec_emulation); |
| 438 | Settings::values.use_disk_shader_cache.SetValue( | 441 | ReadSetting("Renderer", Settings::values.accelerate_astc); |
| 439 | sdl2_config->GetBoolean("Renderer", "use_disk_shader_cache", false)); | 442 | ReadSetting("Renderer", Settings::values.use_fast_gpu_time); |
| 440 | const int gpu_accuracy_level = sdl2_config->GetInteger("Renderer", "gpu_accuracy", 1); | 443 | |
| 441 | Settings::values.gpu_accuracy.SetValue(static_cast<Settings::GPUAccuracy>(gpu_accuracy_level)); | 444 | ReadSetting("Renderer", Settings::values.bg_red); |
| 442 | Settings::values.use_asynchronous_gpu_emulation.SetValue( | 445 | ReadSetting("Renderer", Settings::values.bg_green); |
| 443 | sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", true)); | 446 | ReadSetting("Renderer", Settings::values.bg_blue); |
| 444 | Settings::values.use_vsync.SetValue( | ||
| 445 | static_cast<u16>(sdl2_config->GetInteger("Renderer", "use_vsync", 1))); | ||
| 446 | Settings::values.disable_fps_limit.SetValue( | ||
| 447 | sdl2_config->GetBoolean("Renderer", "disable_fps_limit", false)); | ||
| 448 | Settings::values.use_assembly_shaders.SetValue( | ||
| 449 | sdl2_config->GetBoolean("Renderer", "use_assembly_shaders", true)); | ||
| 450 | Settings::values.use_asynchronous_shaders.SetValue( | ||
| 451 | sdl2_config->GetBoolean("Renderer", "use_asynchronous_shaders", false)); | ||
| 452 | Settings::values.use_nvdec_emulation.SetValue( | ||
| 453 | sdl2_config->GetBoolean("Renderer", "use_nvdec_emulation", true)); | ||
| 454 | Settings::values.accelerate_astc.SetValue( | ||
| 455 | sdl2_config->GetBoolean("Renderer", "accelerate_astc", true)); | ||
| 456 | Settings::values.use_fast_gpu_time.SetValue( | ||
| 457 | sdl2_config->GetBoolean("Renderer", "use_fast_gpu_time", true)); | ||
| 458 | |||
| 459 | Settings::values.bg_red.SetValue( | ||
| 460 | static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0))); | ||
| 461 | Settings::values.bg_green.SetValue( | ||
| 462 | static_cast<float>(sdl2_config->GetReal("Renderer", "bg_green", 0.0))); | ||
| 463 | Settings::values.bg_blue.SetValue( | ||
| 464 | static_cast<float>(sdl2_config->GetReal("Renderer", "bg_blue", 0.0))); | ||
| 465 | 447 | ||
| 466 | // Audio | 448 | // Audio |
| 467 | Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto"); | 449 | ReadSetting("Audio", Settings::values.sink_id); |
| 468 | Settings::values.enable_audio_stretching.SetValue( | 450 | ReadSetting("Audio", Settings::values.enable_audio_stretching); |
| 469 | sdl2_config->GetBoolean("Audio", "enable_audio_stretching", true)); | 451 | ReadSetting("Audio", Settings::values.audio_device_id); |
| 470 | Settings::values.audio_device_id = sdl2_config->Get("Audio", "output_device", "auto"); | 452 | ReadSetting("Audio", Settings::values.volume); |
| 471 | Settings::values.volume.SetValue( | ||
| 472 | static_cast<float>(sdl2_config->GetReal("Audio", "volume", 1))); | ||
| 473 | 453 | ||
| 474 | // Miscellaneous | 454 | // Miscellaneous |
| 475 | Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Trace"); | 455 | // log_filter has a different default here than from common |
| 476 | Settings::values.use_dev_keys = sdl2_config->GetBoolean("Miscellaneous", "use_dev_keys", false); | 456 | Settings::values.log_filter = |
| 457 | sdl2_config->Get("Miscellaneous", Settings::values.log_filter.GetLabel(), "*:Trace"); | ||
| 458 | ReadSetting("Miscellaneous", Settings::values.use_dev_keys); | ||
| 477 | 459 | ||
| 478 | // Debugging | 460 | // Debugging |
| 479 | Settings::values.record_frame_times = | 461 | Settings::values.record_frame_times = |
| 480 | sdl2_config->GetBoolean("Debugging", "record_frame_times", false); | 462 | sdl2_config->GetBoolean("Debugging", "record_frame_times", false); |
| 481 | Settings::values.program_args = sdl2_config->Get("Debugging", "program_args", ""); | 463 | ReadSetting("Debugging", Settings::values.program_args); |
| 482 | Settings::values.dump_exefs = sdl2_config->GetBoolean("Debugging", "dump_exefs", false); | 464 | ReadSetting("Debugging", Settings::values.dump_exefs); |
| 483 | Settings::values.dump_nso = sdl2_config->GetBoolean("Debugging", "dump_nso", false); | 465 | ReadSetting("Debugging", Settings::values.dump_nso); |
| 484 | Settings::values.enable_fs_access_log = | 466 | ReadSetting("Debugging", Settings::values.enable_fs_access_log); |
| 485 | sdl2_config->GetBoolean("Debugging", "enable_fs_access_log", false); | 467 | ReadSetting("Debugging", Settings::values.reporting_services); |
| 486 | Settings::values.reporting_services = | 468 | ReadSetting("Debugging", Settings::values.quest_flag); |
| 487 | sdl2_config->GetBoolean("Debugging", "reporting_services", false); | 469 | ReadSetting("Debugging", Settings::values.use_debug_asserts); |
| 488 | Settings::values.quest_flag = sdl2_config->GetBoolean("Debugging", "quest_flag", false); | 470 | ReadSetting("Debugging", Settings::values.use_auto_stub); |
| 489 | Settings::values.use_debug_asserts = | 471 | ReadSetting("Debugging", Settings::values.disable_macro_jit); |
| 490 | sdl2_config->GetBoolean("Debugging", "use_debug_asserts", false); | ||
| 491 | Settings::values.use_auto_stub = sdl2_config->GetBoolean("Debugging", "use_auto_stub", false); | ||
| 492 | |||
| 493 | Settings::values.disable_macro_jit = | ||
| 494 | sdl2_config->GetBoolean("Debugging", "disable_macro_jit", false); | ||
| 495 | 472 | ||
| 496 | const auto title_list = sdl2_config->Get("AddOns", "title_ids", ""); | 473 | const auto title_list = sdl2_config->Get("AddOns", "title_ids", ""); |
| 497 | std::stringstream ss(title_list); | 474 | std::stringstream ss(title_list); |
| @@ -511,17 +488,14 @@ void Config::ReadValues() { | |||
| 511 | } | 488 | } |
| 512 | 489 | ||
| 513 | // Web Service | 490 | // Web Service |
| 514 | Settings::values.enable_telemetry = | 491 | ReadSetting("WebService", Settings::values.enable_telemetry); |
| 515 | sdl2_config->GetBoolean("WebService", "enable_telemetry", true); | 492 | ReadSetting("WebService", Settings::values.web_api_url); |
| 516 | Settings::values.web_api_url = | 493 | ReadSetting("WebService", Settings::values.yuzu_username); |
| 517 | sdl2_config->Get("WebService", "web_api_url", "https://api.yuzu-emu.org"); | 494 | ReadSetting("WebService", Settings::values.yuzu_token); |
| 518 | Settings::values.yuzu_username = sdl2_config->Get("WebService", "yuzu_username", ""); | ||
| 519 | Settings::values.yuzu_token = sdl2_config->Get("WebService", "yuzu_token", ""); | ||
| 520 | 495 | ||
| 521 | // Services | 496 | // Services |
| 522 | Settings::values.bcat_backend = sdl2_config->Get("Services", "bcat_backend", "none"); | 497 | ReadSetting("Services", Settings::values.bcat_backend); |
| 523 | Settings::values.bcat_boxcat_local = | 498 | ReadSetting("Services", Settings::values.bcat_boxcat_local); |
| 524 | sdl2_config->GetBoolean("Services", "bcat_boxcat_local", false); | ||
| 525 | } | 499 | } |
| 526 | 500 | ||
| 527 | void Config::Reload() { | 501 | void Config::Reload() { |
diff --git a/src/yuzu_cmd/config.h b/src/yuzu_cmd/config.h index 807199278..1ee932be2 100644 --- a/src/yuzu_cmd/config.h +++ b/src/yuzu_cmd/config.h | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <string> | 9 | #include <string> |
| 10 | 10 | ||
| 11 | #include "common/settings.h" | ||
| 12 | |||
| 11 | class INIReader; | 13 | class INIReader; |
| 12 | 14 | ||
| 13 | class Config { | 15 | class Config { |
| @@ -22,4 +24,14 @@ public: | |||
| 22 | ~Config(); | 24 | ~Config(); |
| 23 | 25 | ||
| 24 | void Reload(); | 26 | void Reload(); |
| 27 | |||
| 28 | private: | ||
| 29 | /** | ||
| 30 | * Applies a value read from the sdl2_config to a BasicSetting. | ||
| 31 | * | ||
| 32 | * @param group The name of the INI group | ||
| 33 | * @param setting The yuzu setting to modify | ||
| 34 | */ | ||
| 35 | template <typename Type> | ||
| 36 | void ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting); | ||
| 25 | }; | 37 | }; |
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 50e388312..9607cdcb1 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp | |||
| @@ -78,7 +78,7 @@ static void InitializeLogging() { | |||
| 78 | using namespace Common; | 78 | using namespace Common; |
| 79 | 79 | ||
| 80 | Log::Filter log_filter(Log::Level::Debug); | 80 | Log::Filter log_filter(Log::Level::Debug); |
| 81 | log_filter.ParseFilterString(Settings::values.log_filter); | 81 | log_filter.ParseFilterString(static_cast<std::string>(Settings::values.log_filter)); |
| 82 | Log::SetGlobalFilter(log_filter); | 82 | Log::SetGlobalFilter(log_filter); |
| 83 | 83 | ||
| 84 | Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>()); | 84 | Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>()); |