summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/settings.cpp52
-rw-r--r--src/common/settings.h620
2 files changed, 485 insertions, 187 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 696929479..59934803e 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -144,6 +144,56 @@ float Volume() {
144 return values.volume.GetValue() / static_cast<f32>(values.volume.GetDefault()); 144 return values.volume.GetValue() / static_cast<f32>(values.volume.GetDefault());
145} 145}
146 146
147const char* TranslateCategory(Category category) {
148 switch (category) {
149 case Category::Audio:
150 return "Audio";
151 case Category::Core:
152 return "Core";
153 case Category::Cpu:
154 return "Cpu";
155 case Category::Renderer:
156 return "Renderer";
157 case Category::System:
158 return "System";
159 case Category::DataStorage:
160 return "Data Storage";
161 case Category::Debugging:
162 return "Debugging";
163 case Category::Miscellaneous:
164 return "Miscellaneous";
165 case Category::Network:
166 return "Network";
167 case Category::WebService:
168 return "WebService";
169 case Category::AddOns:
170 return "DisabledAddOns";
171 case Category::Controls:
172 return "Controls";
173 case Category::Ui:
174 return "UI";
175 case Category::UiLayout:
176 return "UiLayout";
177 case Category::UiGameList:
178 return "UiGameList";
179 case Category::Screenshots:
180 return "Screenshots";
181 case Category::Shortcuts:
182 return "Shortcuts";
183 case Category::Multiplayer:
184 return "Multiplayer";
185 case Category::Services:
186 return "Services";
187 case Category::Paths:
188 return "Paths";
189 case Category::MaxEnum:
190 break;
191 case Category::AdvancedGraphics:
192 return "Renderer";
193 }
194 return "Miscellaneous";
195}
196
147void UpdateRescalingInfo() { 197void UpdateRescalingInfo() {
148 const auto setup = values.resolution_setup.GetValue(); 198 const auto setup = values.resolution_setup.GetValue();
149 auto& info = values.resolution_info; 199 auto& info = values.resolution_info;
@@ -212,7 +262,7 @@ void RestoreGlobalState(bool is_powered_on) {
212 return; 262 return;
213 } 263 }
214 264
215 for (const auto& reset : global_reset_registry) { 265 for (const auto& reset : values.linkage.restore_functions) {
216 reset(); 266 reset();
217 } 267 }
218} 268}
diff --git a/src/common/settings.h b/src/common/settings.h
index 999f8b5be..df4bcb053 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -9,7 +9,9 @@
9#include <functional> 9#include <functional>
10#include <map> 10#include <map>
11#include <optional> 11#include <optional>
12#include <stdexcept>
12#include <string> 13#include <string>
14#include <typeindex>
13#include <utility> 15#include <utility>
14#include <vector> 16#include <vector>
15 17
@@ -104,6 +106,33 @@ enum class AstcRecompression : u32 {
104 Bc3 = 2, 106 Bc3 = 2,
105}; 107};
106 108
109enum class Category : u32 {
110 Audio,
111 Core,
112 Cpu,
113 Renderer,
114 AdvancedGraphics,
115 System,
116 DataStorage,
117 Debugging,
118 Miscellaneous,
119 Network,
120 WebService,
121 AddOns,
122 Controls,
123 Ui,
124 UiLayout,
125 UiGameList,
126 Screenshots,
127 Shortcuts,
128 Multiplayer,
129 Services,
130 Paths,
131 MaxEnum,
132};
133
134const char* TranslateCategory(Settings::Category category);
135
107struct ResolutionScalingInfo { 136struct ResolutionScalingInfo {
108 u32 up_scale{1}; 137 u32 up_scale{1};
109 u32 down_shift{0}; 138 u32 down_shift{0};
@@ -127,15 +156,40 @@ struct ResolutionScalingInfo {
127 } 156 }
128}; 157};
129 158
130static std::forward_list<std::function<void()>> global_reset_registry; 159class BasicSetting {
160protected:
161 explicit BasicSetting() = default;
162
163public:
164 virtual ~BasicSetting() = default;
165
166 virtual Category Category() const = 0;
167 virtual constexpr bool Switchable() const = 0;
168 virtual std::string ToString() const = 0;
169 virtual void LoadString(const std::string& load) = 0;
170 virtual const std::string& GetLabel() const = 0;
171 virtual std::string DefaultToString() const = 0;
172 virtual bool Save() const = 0;
173 virtual std::type_index TypeId() const = 0;
174 virtual void SetGlobal(bool global) {}
175 virtual bool UsingGlobal() const {
176 return false;
177 }
178};
179
180class Linkage {
181public:
182 std::map<Category, std::forward_list<BasicSetting*>> by_category;
183 std::vector<std::function<void()>> restore_functions;
184};
131 185
132/** The Setting class is a simple resource manager. It defines a label and default value alongside 186/** The Setting class is a simple resource manager. It defines a label and default value
133 * the actual value of the setting for simpler and less-error prone use with frontend 187 * alongside the actual value of the setting for simpler and less-error prone use with frontend
134 * configurations. Specifying a default value and label is required. A minimum and maximum range can 188 * configurations. Specifying a default value and label is required. A minimum and maximum range
135 * be specified for sanitization. 189 * can be specified for sanitization.
136 */ 190 */
137template <typename Type, bool ranged = false> 191template <typename Type, bool ranged = false, bool save = true>
138class Setting { 192class Setting : public BasicSetting {
139protected: 193protected:
140 Setting() = default; 194 Setting() = default;
141 195
@@ -151,27 +205,36 @@ public:
151 /** 205 /**
152 * Sets a default value, label, and setting value. 206 * Sets a default value, label, and setting value.
153 * 207 *
208 * @param linkage Setting registry
154 * @param default_val Initial value of the setting, and default value of the setting 209 * @param default_val Initial value of the setting, and default value of the setting
155 * @param name Label for the setting 210 * @param name Label for the setting
211 * @param category_ Category of the setting AKA INI group
156 */ 212 */
157 explicit Setting(const Type& default_val, const std::string& name) 213 explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name,
214 enum Category category_)
158 requires(!ranged) 215 requires(!ranged)
159 : value{default_val}, default_value{default_val}, label{name} {} 216 : value{default_val}, default_value{default_val}, label{name}, category{category_} {
217 linkage.by_category[category].push_front(this);
218 }
160 virtual ~Setting() = default; 219 virtual ~Setting() = default;
161 220
162 /** 221 /**
163 * Sets a default value, minimum value, maximum value, and label. 222 * Sets a default value, minimum value, maximum value, and label.
164 * 223 *
224 * @param linkage Setting registry
165 * @param default_val Initial value of the setting, and default value of the setting 225 * @param default_val Initial value of the setting, and default value of the setting
166 * @param min_val Sets the minimum allowed value of the setting 226 * @param min_val Sets the minimum allowed value of the setting
167 * @param max_val Sets the maximum allowed value of the setting 227 * @param max_val Sets the maximum allowed value of the setting
168 * @param name Label for the setting 228 * @param name Label for the setting
229 * @param category_ Category of the setting AKA INI group
169 */ 230 */
170 explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val, 231 explicit Setting(Linkage& linkage, const Type& default_val, const Type& min_val,
171 const std::string& name) 232 const Type& max_val, const std::string& name, enum Category category_)
172 requires(ranged) 233 requires(ranged)
173 : value{default_val}, 234 : value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val},
174 default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {} 235 label{name}, category{category_} {
236 linkage.by_category[category].push_front(this);
237 }
175 238
176 /** 239 /**
177 * Returns a reference to the setting's value. 240 * Returns a reference to the setting's value.
@@ -206,11 +269,62 @@ public:
206 * 269 *
207 * @returns A reference to the label 270 * @returns A reference to the label
208 */ 271 */
209 [[nodiscard]] const std::string& GetLabel() const { 272 [[nodiscard]] const std::string& GetLabel() const override {
210 return label; 273 return label;
211 } 274 }
212 275
213 /** 276 /**
277 * Returns the setting's category AKA INI group.
278 *
279 * @returns The setting's category
280 */
281 [[nodiscard]] enum Category Category() const override {
282 return category;
283 }
284
285 /**
286 * Returns whether the current setting is Switchable.
287 *
288 * @returns If the setting is a SwitchableSetting
289 */
290 [[nodiscard]] virtual constexpr bool Switchable() const override {
291 return false;
292 }
293
294private:
295 std::string ToString(const Type& value_) const {
296 if constexpr (std::is_same<Type, std::string>()) {
297 return value_;
298 } else if constexpr (std::is_same<Type, std::optional<u32>>()) {
299 return value_.has_value() ? std::to_string(*value_) : "0";
300 } else if constexpr (std::is_same<Type, bool>()) {
301 return value_ ? "true" : "false";
302 } else {
303 return std::to_string(static_cast<u64>(value_));
304 }
305 }
306
307public:
308 /**
309 * Converts the value of the setting to a std::string. Respects the global state if the setting
310 * has one.
311 *
312 * @returns The current setting as a std::string
313 */
314 std::string ToString() const override {
315 return ToString(this->GetValue());
316 }
317
318 /**
319 * Returns the default value of the setting as a std::string.
320 *
321 * @returns The default value as a string.
322 */
323 std::string DefaultToString() const override {
324 return ToString(default_value);
325 }
326
327 /**
214 * Assigns a value to the setting. 328 * Assigns a value to the setting.
215 * 329 *
216 * @param val The desired setting value 330 * @param val The desired setting value
@@ -232,12 +346,58 @@ public:
232 return value; 346 return value;
233 } 347 }
234 348
349 /**
350 * Converts the given value to the Setting's type of value. Uses SetValue to enter the setting,
351 * thus respecting its constraints.
352 *
353 * @param input The desired value
354 */
355 void LoadString(const std::string& input) override {
356 if (input.empty()) {
357 this->SetValue(this->GetDefault());
358 return;
359 }
360 try {
361 if constexpr (std::is_same<Type, std::string>()) {
362 this->SetValue(input);
363 } else if constexpr (std::is_same<Type, std::optional<u32>>()) {
364 this->SetValue(static_cast<u32>(std::stoll(input)));
365 } else if constexpr (std::is_same<Type, bool>()) {
366 this->SetValue(input == "true");
367 } else {
368 this->SetValue(static_cast<Type>(std::stoll(input)));
369 }
370 } catch (std::invalid_argument) {
371 this->SetValue(this->GetDefault());
372 }
373 }
374
375 /**
376 * Returns the save preference of the setting i.e. when saving or reading the setting from a
377 * frontend, whether this setting should be skipped.
378 *
379 * @returns The save preference
380 */
381 virtual bool Save() const override {
382 return save;
383 }
384
385 /**
386 * Gives us another way to identify the setting without having to go through a string.
387 *
388 * @returns the type_index of the setting's type
389 */
390 virtual std::type_index TypeId() const override {
391 return std::type_index(typeid(Type));
392 }
393
235protected: 394protected:
236 Type value{}; ///< The setting 395 Type value{}; ///< The setting
237 const Type default_value{}; ///< The default value 396 const Type default_value{}; ///< The default value
238 const Type maximum{}; ///< Maximum allowed value of the setting 397 const Type maximum{}; ///< Maximum allowed value of the setting
239 const Type minimum{}; ///< Minimum allowed value of the setting 398 const Type minimum{}; ///< Minimum allowed value of the setting
240 const std::string label{}; ///< The setting's label 399 const std::string label{}; ///< The setting's label
400 const enum Category category; ///< The setting's category AKA INI group
241}; 401};
242 402
243/** 403/**
@@ -248,35 +408,40 @@ protected:
248 * 408 *
249 * By default, the global setting is used. 409 * By default, the global setting is used.
250 */ 410 */
251template <typename Type, bool ranged = false> 411template <typename Type, bool ranged = false, bool save = true>
252class SwitchableSetting : virtual public Setting<Type, ranged> { 412class SwitchableSetting : virtual public Setting<Type, ranged, save> {
253public: 413public:
254 /** 414 /**
255 * Sets a default value, label, and setting value. 415 * Sets a default value, label, and setting value.
256 * 416 *
417 * @param linkage Setting registry
257 * @param default_val Initial value of the setting, and default value of the setting 418 * @param default_val Initial value of the setting, and default value of the setting
258 * @param name Label for the setting 419 * @param name Label for the setting
420 * @param category_ Category of the setting AKA INI group
259 */ 421 */
260 explicit SwitchableSetting(const Type& default_val, const std::string& name) 422 explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name,
423 Category category)
261 requires(!ranged) 424 requires(!ranged)
262 : Setting<Type>{default_val, name} { 425 : Setting<Type, false, save>{linkage, default_val, name, category} {
263 global_reset_registry.push_front([this]() { this->SetGlobal(true); }); 426 linkage.restore_functions.emplace_back([this]() { this->SetGlobal(true); });
264 } 427 }
265 virtual ~SwitchableSetting() = default; 428 virtual ~SwitchableSetting() = default;
266 429
267 /** 430 /**
268 * Sets a default value, minimum value, maximum value, and label. 431 * Sets a default value, minimum value, maximum value, and label.
269 * 432 *
433 * @param linkage Setting registry
270 * @param default_val Initial value of the setting, and default value of the setting 434 * @param default_val Initial value of the setting, and default value of the setting
271 * @param min_val Sets the minimum allowed value of the setting 435 * @param min_val Sets the minimum allowed value of the setting
272 * @param max_val Sets the maximum allowed value of the setting 436 * @param max_val Sets the maximum allowed value of the setting
273 * @param name Label for the setting 437 * @param name Label for the setting
438 * @param category_ Category of the setting AKA INI group
274 */ 439 */
275 explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val, 440 explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val,
276 const std::string& name) 441 const Type& max_val, const std::string& name, Category category)
277 requires(ranged) 442 requires(ranged)
278 : Setting<Type, true>{default_val, min_val, max_val, name} { 443 : Setting<Type, true, save>{linkage, default_val, min_val, max_val, name, category} {
279 global_reset_registry.push_front([this]() { this->SetGlobal(true); }); 444 linkage.restore_functions.emplace_back([this]() { this->SetGlobal(true); });
280 } 445 }
281 446
282 /** 447 /**
@@ -285,7 +450,7 @@ public:
285 * 450 *
286 * @param to_global Whether to use the global or custom setting. 451 * @param to_global Whether to use the global or custom setting.
287 */ 452 */
288 void SetGlobal(bool to_global) { 453 void SetGlobal(bool to_global) override {
289 use_global = to_global; 454 use_global = to_global;
290 } 455 }
291 456
@@ -294,7 +459,7 @@ public:
294 * 459 *
295 * @returns The global state 460 * @returns The global state
296 */ 461 */
297 [[nodiscard]] bool UsingGlobal() const { 462 [[nodiscard]] bool UsingGlobal() const override {
298 return use_global; 463 return use_global;
299 } 464 }
300 465
@@ -333,6 +498,10 @@ public:
333 } 498 }
334 } 499 }
335 500
501 [[nodiscard]] virtual constexpr bool Switchable() const override {
502 return true;
503 }
504
336 /** 505 /**
337 * Assigns the current setting value depending on the global state. 506 * Assigns the current setting value depending on the global state.
338 * 507 *
@@ -405,211 +574,290 @@ struct TouchFromButtonMap {
405}; 574};
406 575
407struct Values { 576struct Values {
577 Linkage linkage{};
578
408 // Audio 579 // Audio
409 Setting<std::string> sink_id{"auto", "output_engine"}; 580 Setting<std::string> sink_id{linkage, "auto", "output_engine", Category::Audio};
410 Setting<std::string> audio_output_device_id{"auto", "output_device"}; 581 Setting<std::string> audio_output_device_id{linkage, "auto", "output_device", Category::Audio};
411 Setting<std::string> audio_input_device_id{"auto", "input_device"}; 582 Setting<std::string> audio_input_device_id{linkage, "auto", "input_device", Category::Audio};
412 Setting<bool> audio_muted{false, "audio_muted"}; 583 Setting<bool, false, false> audio_muted{linkage, false, "audio_muted", Category::Audio};
413 SwitchableSetting<u8, true> volume{100, 0, 200, "volume"}; 584 SwitchableSetting<u8, true> volume{linkage, 100, 0, 200, "volume", Category::Audio};
414 Setting<bool> dump_audio_commands{false, "dump_audio_commands"}; 585 Setting<bool, false, false> dump_audio_commands{linkage, false, "dump_audio_commands",
586 Category::Audio};
415 587
416 // Core 588 // Core
417 SwitchableSetting<bool> use_multi_core{true, "use_multi_core"}; 589 SwitchableSetting<bool> use_multi_core{linkage, true, "use_multi_core", Category::Core};
418 SwitchableSetting<bool> use_unsafe_extended_memory_layout{false, 590 SwitchableSetting<bool> use_unsafe_extended_memory_layout{
419 "use_unsafe_extended_memory_layout"}; 591 linkage, false, "use_unsafe_extended_memory_layout", Category::Core};
420 592
421 // Cpu 593 // Cpu
422 SwitchableSetting<CPUAccuracy, true> cpu_accuracy{CPUAccuracy::Auto, CPUAccuracy::Auto, 594 SwitchableSetting<CPUAccuracy, true> cpu_accuracy{linkage, CPUAccuracy::Auto,
423 CPUAccuracy::Paranoid, "cpu_accuracy"}; 595 CPUAccuracy::Auto, CPUAccuracy::Paranoid,
596 "cpu_accuracy", Category::Cpu};
424 // TODO: remove cpu_accuracy_first_time, migration setting added 8 July 2021 597 // TODO: remove cpu_accuracy_first_time, migration setting added 8 July 2021
425 Setting<bool> cpu_accuracy_first_time{true, "cpu_accuracy_first_time"}; 598 Setting<bool> cpu_accuracy_first_time{linkage, true, "cpu_accuracy_first_time", Category::Cpu};
426 Setting<bool> cpu_debug_mode{false, "cpu_debug_mode"}; 599 Setting<bool> cpu_debug_mode{linkage, false, "cpu_debug_mode", Category::Cpu};
427 600
428 Setting<bool> cpuopt_page_tables{true, "cpuopt_page_tables"}; 601 Setting<bool> cpuopt_page_tables{linkage, true, "cpuopt_page_tables", Category::Cpu};
429 Setting<bool> cpuopt_block_linking{true, "cpuopt_block_linking"}; 602 Setting<bool> cpuopt_block_linking{linkage, true, "cpuopt_block_linking", Category::Cpu};
430 Setting<bool> cpuopt_return_stack_buffer{true, "cpuopt_return_stack_buffer"}; 603 Setting<bool> cpuopt_return_stack_buffer{linkage, true, "cpuopt_return_stack_buffer",
431 Setting<bool> cpuopt_fast_dispatcher{true, "cpuopt_fast_dispatcher"}; 604 Category::Cpu};
432 Setting<bool> cpuopt_context_elimination{true, "cpuopt_context_elimination"}; 605 Setting<bool> cpuopt_fast_dispatcher{linkage, true, "cpuopt_fast_dispatcher", Category::Cpu};
433 Setting<bool> cpuopt_const_prop{true, "cpuopt_const_prop"}; 606 Setting<bool> cpuopt_context_elimination{linkage, true, "cpuopt_context_elimination",
434 Setting<bool> cpuopt_misc_ir{true, "cpuopt_misc_ir"}; 607 Category::Cpu};
435 Setting<bool> cpuopt_reduce_misalign_checks{true, "cpuopt_reduce_misalign_checks"}; 608 Setting<bool> cpuopt_const_prop{linkage, true, "cpuopt_const_prop", Category::Cpu};
436 Setting<bool> cpuopt_fastmem{true, "cpuopt_fastmem"}; 609 Setting<bool> cpuopt_misc_ir{linkage, true, "cpuopt_misc_ir", Category::Cpu};
437 Setting<bool> cpuopt_fastmem_exclusives{true, "cpuopt_fastmem_exclusives"}; 610 Setting<bool> cpuopt_reduce_misalign_checks{linkage, true, "cpuopt_reduce_misalign_checks",
438 Setting<bool> cpuopt_recompile_exclusives{true, "cpuopt_recompile_exclusives"}; 611 Category::Cpu};
439 Setting<bool> cpuopt_ignore_memory_aborts{true, "cpuopt_ignore_memory_aborts"}; 612 Setting<bool> cpuopt_fastmem{linkage, true, "cpuopt_fastmem", Category::Cpu};
440 613 Setting<bool> cpuopt_fastmem_exclusives{linkage, true, "cpuopt_fastmem_exclusives",
441 SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{true, "cpuopt_unsafe_unfuse_fma"}; 614 Category::Cpu};
442 SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{true, "cpuopt_unsafe_reduce_fp_error"}; 615 Setting<bool> cpuopt_recompile_exclusives{linkage, true, "cpuopt_recompile_exclusives",
616 Category::Cpu};
617 Setting<bool> cpuopt_ignore_memory_aborts{linkage, true, "cpuopt_ignore_memory_aborts",
618 Category::Cpu};
619
620 SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{linkage, true, "cpuopt_unsafe_unfuse_fma",
621 Category::Cpu};
622 SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{
623 linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::Cpu};
443 SwitchableSetting<bool> cpuopt_unsafe_ignore_standard_fpcr{ 624 SwitchableSetting<bool> cpuopt_unsafe_ignore_standard_fpcr{
444 true, "cpuopt_unsafe_ignore_standard_fpcr"}; 625 linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::Cpu};
445 SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{true, "cpuopt_unsafe_inaccurate_nan"}; 626 SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{
446 SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{true, "cpuopt_unsafe_fastmem_check"}; 627 linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::Cpu};
628 SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{
629 linkage, true, "cpuopt_unsafe_fastmem_check", Category::Cpu};
447 SwitchableSetting<bool> cpuopt_unsafe_ignore_global_monitor{ 630 SwitchableSetting<bool> cpuopt_unsafe_ignore_global_monitor{
448 true, "cpuopt_unsafe_ignore_global_monitor"}; 631 linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::Cpu};
449 632
450 // Renderer 633 // Renderer
451 SwitchableSetting<RendererBackend, true> renderer_backend{ 634 SwitchableSetting<RendererBackend, true> renderer_backend{
452 RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, "backend"}; 635 linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null,
453 SwitchableSetting<bool> async_presentation{false, "async_presentation"}; 636 "backend", Category::Renderer};
454 SwitchableSetting<bool> renderer_force_max_clock{false, "force_max_clock"}; 637 SwitchableSetting<bool> async_presentation{linkage, false, "async_presentation",
455 Setting<bool> renderer_debug{false, "debug"}; 638 Category::AdvancedGraphics};
456 Setting<bool> renderer_shader_feedback{false, "shader_feedback"}; 639 SwitchableSetting<bool> renderer_force_max_clock{linkage, false, "force_max_clock",
457 Setting<bool> enable_nsight_aftermath{false, "nsight_aftermath"}; 640 Category::AdvancedGraphics};
458 Setting<bool> disable_shader_loop_safety_checks{false, "disable_shader_loop_safety_checks"}; 641 Setting<bool> renderer_debug{linkage, false, "debug", Category::Renderer};
459 SwitchableSetting<int> vulkan_device{0, "vulkan_device"}; 642 Setting<bool> renderer_shader_feedback{linkage, false, "shader_feedback", Category::Renderer};
643 Setting<bool> enable_nsight_aftermath{linkage, false, "nsight_aftermath", Category::Renderer};
644 Setting<bool> disable_shader_loop_safety_checks{
645 linkage, false, "disable_shader_loop_safety_checks", Category::Renderer};
646 SwitchableSetting<int> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer};
460 647
461 ResolutionScalingInfo resolution_info{}; 648 ResolutionScalingInfo resolution_info{};
462 SwitchableSetting<ResolutionSetup> resolution_setup{ResolutionSetup::Res1X, "resolution_setup"}; 649 SwitchableSetting<ResolutionSetup> resolution_setup{linkage, ResolutionSetup::Res1X,
463 SwitchableSetting<ScalingFilter> scaling_filter{ScalingFilter::Bilinear, "scaling_filter"}; 650 "resolution_setup", Category::Renderer};
464 SwitchableSetting<int, true> fsr_sharpening_slider{25, 0, 200, "fsr_sharpening_slider"}; 651 SwitchableSetting<ScalingFilter> scaling_filter{linkage, ScalingFilter::Bilinear,
465 SwitchableSetting<AntiAliasing> anti_aliasing{AntiAliasing::None, "anti_aliasing"}; 652 "scaling_filter", Category::Renderer};
653 SwitchableSetting<int, true> fsr_sharpening_slider{
654 linkage, 25, 0, 200, "fsr_sharpening_slider", Category::Renderer};
655 SwitchableSetting<AntiAliasing> anti_aliasing{linkage, AntiAliasing::None, "anti_aliasing",
656 Category::Renderer};
466 // *nix platforms may have issues with the borderless windowed fullscreen mode. 657 // *nix platforms may have issues with the borderless windowed fullscreen mode.
467 // Default to exclusive fullscreen on these platforms for now. 658 // Default to exclusive fullscreen on these platforms for now.
468 SwitchableSetting<FullscreenMode, true> fullscreen_mode{ 659 SwitchableSetting<FullscreenMode, true> fullscreen_mode{linkage,
469#ifdef _WIN32 660#ifdef _WIN32
470 FullscreenMode::Borderless, 661 FullscreenMode::Borderless,
471#else 662#else
472 FullscreenMode::Exclusive, 663 FullscreenMode::Exclusive,
473#endif 664#endif
474 FullscreenMode::Borderless, FullscreenMode::Exclusive, "fullscreen_mode"}; 665 FullscreenMode::Borderless,
475 SwitchableSetting<int, true> aspect_ratio{0, 0, 4, "aspect_ratio"}; 666 FullscreenMode::Exclusive,
476 SwitchableSetting<int, true> max_anisotropy{0, 0, 5, "max_anisotropy"}; 667 "fullscreen_mode",
477 SwitchableSetting<bool> use_speed_limit{true, "use_speed_limit"}; 668 Category::Renderer};
478 SwitchableSetting<u16, true> speed_limit{100, 0, 9999, "speed_limit"}; 669 SwitchableSetting<int, true> aspect_ratio{linkage, 0, 0, 4, "aspect_ratio", Category::Renderer};
479 SwitchableSetting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"}; 670 SwitchableSetting<int, true> max_anisotropy{
480 SwitchableSetting<GPUAccuracy, true> gpu_accuracy{GPUAccuracy::High, GPUAccuracy::Normal, 671 linkage, 0, 0, 5, "max_anisotropy", Category::AdvancedGraphics};
481 GPUAccuracy::Extreme, "gpu_accuracy"}; 672 SwitchableSetting<bool, false, false> use_speed_limit{linkage, true, "use_speed_limit",
482 SwitchableSetting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; 673 Category::Renderer};
483 SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; 674 SwitchableSetting<u16, true> speed_limit{linkage, 100, 0,
484 SwitchableSetting<AstcDecodeMode, true> accelerate_astc{ 675 9999, "speed_limit", Category::Renderer};
485 AstcDecodeMode::CPU, AstcDecodeMode::CPU, AstcDecodeMode::CPUAsynchronous, 676 SwitchableSetting<bool> use_disk_shader_cache{linkage, true, "use_disk_shader_cache",
486 "accelerate_astc"}; 677 Category::Renderer};
487 Setting<VSyncMode, true> vsync_mode{VSyncMode::FIFO, VSyncMode::Immediate, 678 SwitchableSetting<GPUAccuracy, true> gpu_accuracy{
488 VSyncMode::FIFORelaxed, "use_vsync"}; 679 linkage, GPUAccuracy::High, GPUAccuracy::Normal, GPUAccuracy::Extreme,
489 SwitchableSetting<bool> use_reactive_flushing{true, "use_reactive_flushing"}; 680 "gpu_accuracy", Category::AdvancedGraphics};
490 SwitchableSetting<ShaderBackend, true> shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL, 681 SwitchableSetting<bool> use_asynchronous_gpu_emulation{
491 ShaderBackend::SPIRV, "shader_backend"}; 682 linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer};
492 SwitchableSetting<bool> use_asynchronous_shaders{false, "use_asynchronous_shaders"}; 683 SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::GPU,
493 SwitchableSetting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"}; 684 "nvdec_emulation", Category::Renderer};
494 SwitchableSetting<bool> use_vulkan_driver_pipeline_cache{true, 685 SwitchableSetting<AstcDecodeMode, true> accelerate_astc{linkage,
495 "use_vulkan_driver_pipeline_cache"}; 686 AstcDecodeMode::CPU,
496 SwitchableSetting<bool> enable_compute_pipelines{false, "enable_compute_pipelines"}; 687 AstcDecodeMode::CPU,
497 SwitchableSetting<AstcRecompression, true> astc_recompression{ 688 AstcDecodeMode::CPUAsynchronous,
498 AstcRecompression::Uncompressed, AstcRecompression::Uncompressed, AstcRecompression::Bc3, 689 "accelerate_astc",
499 "astc_recompression"}; 690 Category::Renderer};
500 SwitchableSetting<bool> use_video_framerate{false, "use_video_framerate"}; 691 Setting<VSyncMode, true> vsync_mode{
501 SwitchableSetting<bool> barrier_feedback_loops{true, "barrier_feedback_loops"}; 692 linkage, VSyncMode::FIFO, VSyncMode::Immediate, VSyncMode::FIFORelaxed,
502 693 "use_vsync", Category::Renderer};
503 SwitchableSetting<u8> bg_red{0, "bg_red"}; 694 SwitchableSetting<bool> use_reactive_flushing{linkage, true, "use_reactive_flushing",
504 SwitchableSetting<u8> bg_green{0, "bg_green"}; 695 Category::Renderer};
505 SwitchableSetting<u8> bg_blue{0, "bg_blue"}; 696 SwitchableSetting<ShaderBackend, true> shader_backend{
697 linkage, ShaderBackend::GLSL, ShaderBackend::GLSL, ShaderBackend::SPIRV,
698 "shader_backend", Category::Renderer};
699 SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
700 Category::Renderer};
701 SwitchableSetting<bool> use_fast_gpu_time{linkage, true, "use_fast_gpu_time",
702 Category::AdvancedGraphics};
703 SwitchableSetting<bool> use_vulkan_driver_pipeline_cache{
704 linkage, true, "use_vulkan_driver_pipeline_cache", Category::AdvancedGraphics};
705 SwitchableSetting<bool> enable_compute_pipelines{linkage, false, "enable_compute_pipelines",
706 Category::AdvancedGraphics};
707 SwitchableSetting<AstcRecompression, true> astc_recompression{linkage,
708 AstcRecompression::Uncompressed,
709 AstcRecompression::Uncompressed,
710 AstcRecompression::Bc3,
711 "astc_recompression",
712 Category::AdvancedGraphics};
713 SwitchableSetting<bool> use_video_framerate{linkage, false, "use_video_framerate",
714 Category::AdvancedGraphics};
715 SwitchableSetting<bool> barrier_feedback_loops{linkage, true, "barrier_feedback_loops",
716 Category::AdvancedGraphics};
717
718 SwitchableSetting<u8> bg_red{linkage, 0, "bg_red", Category::Renderer};
719 SwitchableSetting<u8> bg_green{linkage, 0, "bg_green", Category::Renderer};
720 SwitchableSetting<u8> bg_blue{linkage, 0, "bg_blue", Category::Renderer};
506 721
507 // System 722 // System
508 SwitchableSetting<bool> rng_seed_enabled{false, "rng_seed_enabled"}; 723 SwitchableSetting<bool> rng_seed_enabled{linkage, false, "rng_seed_enabled", Category::System};
509 SwitchableSetting<u32> rng_seed{0, "rng_seed"}; 724 SwitchableSetting<u32> rng_seed{linkage, 0, "rng_seed", Category::System};
510 Setting<std::string> device_name{"Yuzu", "device_name"}; 725 Setting<std::string> device_name{linkage, "Yuzu", "device_name", Category::System};
511 // Measured in seconds since epoch 726 // Measured in seconds since epoch
512 SwitchableSetting<bool> custom_rtc_enabled{false, "custom_rtc_enabled"}; 727 Setting<bool> custom_rtc_enabled{linkage, false, "custom_rtc_enabled", Category::System};
513 SwitchableSetting<s64> custom_rtc{0, "custom_rtc"}; 728 Setting<s64> custom_rtc{linkage, 0, "custom_rtc", Category::System};
514 // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` 729 // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc`
515 s64 custom_rtc_differential; 730 s64 custom_rtc_differential;
516 731
517 Setting<s32> current_user{0, "current_user"}; 732 Setting<s32> current_user{linkage, 0, "current_user", Category::System};
518 SwitchableSetting<s32, true> language_index{1, 0, 17, "language_index"}; 733 SwitchableSetting<s32, true> language_index{linkage, 1, 0, 17, "language_index",
519 SwitchableSetting<s32, true> region_index{1, 0, 6, "region_index"}; 734 Category::System};
520 SwitchableSetting<s32, true> time_zone_index{0, 0, 45, "time_zone_index"}; 735 SwitchableSetting<s32, true> region_index{linkage, 1, 0, 6, "region_index", Category::System};
521 SwitchableSetting<s32, true> sound_index{1, 0, 2, "sound_index"}; 736 SwitchableSetting<s32, true> time_zone_index{linkage, 0, 0, 45, "time_zone_index",
737 Category::System};
738 SwitchableSetting<s32, true> sound_index{linkage, 1, 0, 2, "sound_index", Category::System};
739
740 SwitchableSetting<bool> use_docked_mode{linkage, true, "use_docked_mode", Category::System};
522 741
523 // Controls 742 // Controls
524 InputSetting<std::array<PlayerInput, 10>> players; 743 InputSetting<std::array<PlayerInput, 10>> players;
525 744
526 SwitchableSetting<bool> use_docked_mode{true, "use_docked_mode"}; 745 Setting<bool, false,
527 746// Only read/write enable_raw_input on Windows platforms
528 Setting<bool> enable_raw_input{false, "enable_raw_input"}; 747#ifdef _WIN32
529 Setting<bool> controller_navigation{true, "controller_navigation"}; 748 true
530 Setting<bool> enable_joycon_driver{true, "enable_joycon_driver"}; 749#else
531 Setting<bool> enable_procon_driver{false, "enable_procon_driver"}; 750 false
532 751#endif
533 SwitchableSetting<bool> vibration_enabled{true, "vibration_enabled"}; 752 >
534 SwitchableSetting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"}; 753 enable_raw_input{linkage, false, "enable_raw_input", Category::Controls};
535 754 Setting<bool> controller_navigation{linkage, true, "controller_navigation", Category::Controls};
536 SwitchableSetting<bool> motion_enabled{true, "motion_enabled"}; 755 Setting<bool> enable_joycon_driver{linkage, true, "enable_joycon_driver", Category::Controls};
537 Setting<std::string> udp_input_servers{"127.0.0.1:26760", "udp_input_servers"}; 756 Setting<bool> enable_procon_driver{linkage, false, "enable_procon_driver", Category::Controls};
538 Setting<bool> enable_udp_controller{false, "enable_udp_controller"}; 757
539 758 SwitchableSetting<bool> vibration_enabled{linkage, true, "vibration_enabled",
540 Setting<bool> pause_tas_on_load{true, "pause_tas_on_load"}; 759 Category::Controls};
541 Setting<bool> tas_enable{false, "tas_enable"}; 760 SwitchableSetting<bool> enable_accurate_vibrations{linkage, false, "enable_accurate_vibrations",
542 Setting<bool> tas_loop{false, "tas_loop"}; 761 Category::Controls};
543 762
544 Setting<bool> mouse_panning{false, "mouse_panning"}; 763 SwitchableSetting<bool> motion_enabled{linkage, true, "motion_enabled", Category::Controls};
545 Setting<u8, true> mouse_panning_x_sensitivity{50, 1, 100, "mouse_panning_x_sensitivity"}; 764 Setting<std::string> udp_input_servers{linkage, "127.0.0.1:26760", "udp_input_servers",
546 Setting<u8, true> mouse_panning_y_sensitivity{50, 1, 100, "mouse_panning_y_sensitivity"}; 765 Category::Controls};
547 Setting<u8, true> mouse_panning_deadzone_counterweight{20, 0, 100, 766 Setting<bool> enable_udp_controller{linkage, false, "enable_udp_controller",
548 "mouse_panning_deadzone_counterweight"}; 767 Category::Controls};
549 Setting<u8, true> mouse_panning_decay_strength{18, 0, 100, "mouse_panning_decay_strength"}; 768
550 Setting<u8, true> mouse_panning_min_decay{6, 0, 100, "mouse_panning_min_decay"}; 769 Setting<bool> pause_tas_on_load{linkage, true, "pause_tas_on_load", Category::Controls};
551 770 Setting<bool> tas_enable{linkage, false, "tas_enable", Category::Controls};
552 Setting<bool> mouse_enabled{false, "mouse_enabled"}; 771 Setting<bool> tas_loop{linkage, false, "tas_loop", Category::Controls};
553 Setting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"}; 772
554 Setting<bool> keyboard_enabled{false, "keyboard_enabled"}; 773 Setting<bool, false, false> mouse_panning{linkage, false, "mouse_panning", Category::Controls};
555 774 Setting<u8, true> mouse_panning_sensitivity{
556 Setting<bool> debug_pad_enabled{false, "debug_pad_enabled"}; 775 linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls};
776 Setting<bool> mouse_enabled{linkage, false, "mouse_enabled", Category::Controls};
777
778 Setting<u8, true> mouse_panning_x_sensitivity{
779 linkage, 50, 1, 100, "mouse_panning_x_sensitivity", Category::Controls};
780 Setting<u8, true> mouse_panning_y_sensitivity{
781 linkage, 50, 1, 100, "mouse_panning_y_sensitivity", Category::Controls};
782 Setting<u8, true> mouse_panning_deadzone_counterweight{
783 linkage, 20, 0, 100, "mouse_panning_deadzone_counterweight", Category::Controls};
784 Setting<u8, true> mouse_panning_decay_strength{
785 linkage, 18, 0, 100, "mouse_panning_decay_strength", Category::Controls};
786 Setting<u8, true> mouse_panning_min_decay{
787 linkage, 6, 0, 100, "mouse_panning_min_decay", Category::Controls};
788
789 Setting<bool> emulate_analog_keyboard{linkage, false, "emulate_analog_keyboard",
790 Category::Controls};
791 Setting<bool> keyboard_enabled{linkage, false, "keyboard_enabled", Category::Controls};
792
793 Setting<bool> debug_pad_enabled{linkage, false, "debug_pad_enabled", Category::Controls};
557 ButtonsRaw debug_pad_buttons; 794 ButtonsRaw debug_pad_buttons;
558 AnalogsRaw debug_pad_analogs; 795 AnalogsRaw debug_pad_analogs;
559 796
560 TouchscreenInput touchscreen; 797 TouchscreenInput touchscreen;
561 798
562 Setting<std::string> touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850", "touch_device"}; 799 Setting<std::string> touch_device{linkage, "min_x:100,min_y:50,max_x:1800,max_y:850",
563 Setting<int> touch_from_button_map_index{0, "touch_from_button_map"}; 800 "touch_device", Category::Controls};
801 Setting<int> touch_from_button_map_index{linkage, 0, "touch_from_button_map",
802 Category::Controls};
564 std::vector<TouchFromButtonMap> touch_from_button_maps; 803 std::vector<TouchFromButtonMap> touch_from_button_maps;
565 804
566 Setting<bool> enable_ring_controller{true, "enable_ring_controller"}; 805 Setting<bool> enable_ring_controller{linkage, true, "enable_ring_controller",
806 Category::Controls};
567 RingconRaw ringcon_analogs; 807 RingconRaw ringcon_analogs;
568 808
569 Setting<bool> enable_ir_sensor{false, "enable_ir_sensor"}; 809 Setting<bool> enable_ir_sensor{linkage, false, "enable_ir_sensor", Category::Controls};
570 Setting<std::string> ir_sensor_device{"auto", "ir_sensor_device"}; 810 Setting<std::string> ir_sensor_device{linkage, "auto", "ir_sensor_device", Category::Controls};
571 811
572 Setting<bool> random_amiibo_id{false, "random_amiibo_id"}; 812 Setting<bool> random_amiibo_id{linkage, false, "random_amiibo_id", Category::Controls};
573 813
574 // Data Storage 814 // Data Storage
575 Setting<bool> use_virtual_sd{true, "use_virtual_sd"}; 815 Setting<bool> use_virtual_sd{linkage, true, "use_virtual_sd", Category::DataStorage};
576 Setting<bool> gamecard_inserted{false, "gamecard_inserted"}; 816 Setting<bool> gamecard_inserted{linkage, false, "gamecard_inserted", Category::DataStorage};
577 Setting<bool> gamecard_current_game{false, "gamecard_current_game"}; 817 Setting<bool> gamecard_current_game{linkage, false, "gamecard_current_game",
578 Setting<std::string> gamecard_path{std::string(), "gamecard_path"}; 818 Category::DataStorage};
819 Setting<std::string> gamecard_path{linkage, std::string(), "gamecard_path",
820 Category::DataStorage};
579 821
580 // Debugging 822 // Debugging
581 bool record_frame_times; 823 bool record_frame_times;
582 Setting<bool> use_gdbstub{false, "use_gdbstub"}; 824 Setting<bool> use_gdbstub{linkage, false, "use_gdbstub", Category::Debugging};
583 Setting<u16> gdbstub_port{6543, "gdbstub_port"}; 825 Setting<u16> gdbstub_port{linkage, 6543, "gdbstub_port", Category::Debugging};
584 Setting<std::string> program_args{std::string(), "program_args"}; 826 Setting<std::string> program_args{linkage, std::string(), "program_args", Category::Debugging};
585 Setting<bool> dump_exefs{false, "dump_exefs"}; 827 Setting<bool> dump_exefs{linkage, false, "dump_exefs", Category::Debugging};
586 Setting<bool> dump_nso{false, "dump_nso"}; 828 Setting<bool> dump_nso{linkage, false, "dump_nso", Category::Debugging};
587 Setting<bool> dump_shaders{false, "dump_shaders"}; 829 Setting<bool, false, false> dump_shaders{linkage, false, "dump_shaders", Category::Debugging};
588 Setting<bool> dump_macros{false, "dump_macros"}; 830 Setting<bool, false, false> dump_macros{linkage, false, "dump_macros", Category::Debugging};
589 Setting<bool> enable_fs_access_log{false, "enable_fs_access_log"}; 831 Setting<bool> enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging};
590 Setting<bool> reporting_services{false, "reporting_services"}; 832 Setting<bool, false, false> reporting_services{linkage, false, "reporting_services",
591 Setting<bool> quest_flag{false, "quest_flag"}; 833 Category::Debugging};
592 Setting<bool> disable_macro_jit{false, "disable_macro_jit"}; 834 Setting<bool> quest_flag{linkage, false, "quest_flag", Category::Debugging};
593 Setting<bool> disable_macro_hle{false, "disable_macro_hle"}; 835 Setting<bool> disable_macro_jit{linkage, false, "disable_macro_jit", Category::Debugging};
594 Setting<bool> extended_logging{false, "extended_logging"}; 836 Setting<bool> disable_macro_hle{linkage, false, "disable_macro_hle", Category::Debugging};
595 Setting<bool> use_debug_asserts{false, "use_debug_asserts"}; 837 Setting<bool, false, false> extended_logging{linkage, false, "extended_logging",
596 Setting<bool> use_auto_stub{false, "use_auto_stub"}; 838 Category::Debugging};
597 Setting<bool> enable_all_controllers{false, "enable_all_controllers"}; 839 Setting<bool> use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging};
598 Setting<bool> create_crash_dumps{false, "create_crash_dumps"}; 840 Setting<bool, false, false> use_auto_stub{linkage, false, "use_auto_stub", Category::Debugging};
599 Setting<bool> perform_vulkan_check{true, "perform_vulkan_check"}; 841 Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers",
842 Category::Debugging};
843 Setting<bool> create_crash_dumps{linkage, false, "create_crash_dumps", Category::Debugging};
844 Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging};
600 845
601 // Miscellaneous 846 // Miscellaneous
602 Setting<std::string> log_filter{"*:Info", "log_filter"}; 847 Setting<std::string> log_filter{linkage, "*:Info", "log_filter", Category::Miscellaneous};
603 Setting<bool> use_dev_keys{false, "use_dev_keys"}; 848 Setting<bool> use_dev_keys{linkage, false, "use_dev_keys", Category::Miscellaneous};
604 849
605 // Network 850 // Network
606 Setting<std::string> network_interface{std::string(), "network_interface"}; 851 Setting<std::string> network_interface{linkage, std::string(), "network_interface",
852 Category::Network};
607 853
608 // WebService 854 // WebService
609 Setting<bool> enable_telemetry{true, "enable_telemetry"}; 855 Setting<bool> enable_telemetry{linkage, true, "enable_telemetry", Category::WebService};
610 Setting<std::string> web_api_url{"https://api.yuzu-emu.org", "web_api_url"}; 856 Setting<std::string> web_api_url{linkage, "https://api.yuzu-emu.org", "web_api_url",
611 Setting<std::string> yuzu_username{std::string(), "yuzu_username"}; 857 Category::WebService};
612 Setting<std::string> yuzu_token{std::string(), "yuzu_token"}; 858 Setting<std::string> yuzu_username{linkage, std::string(), "yuzu_username",
859 Category::WebService};
860 Setting<std::string> yuzu_token{linkage, std::string(), "yuzu_token", Category::WebService};
613 861
614 // Add-Ons 862 // Add-Ons
615 std::map<u64, std::vector<std::string>> disabled_addons; 863 std::map<u64, std::vector<std::string>> disabled_addons;