summaryrefslogtreecommitdiff
path: root/src/common/settings.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/settings.h')
-rw-r--r--src/common/settings.h860
1 files changed, 387 insertions, 473 deletions
diff --git a/src/common/settings.h b/src/common/settings.h
index 59e96e74f..b0bc6519a 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -6,95 +6,21 @@
6#include <algorithm> 6#include <algorithm>
7#include <array> 7#include <array>
8#include <map> 8#include <map>
9#include <optional> 9#include <memory>
10#include <stdexcept>
10#include <string> 11#include <string>
11#include <utility> 12#include <utility>
12#include <vector> 13#include <vector>
13 14
14#include "common/common_types.h" 15#include "common/common_types.h"
16#include "common/settings_common.h"
17#include "common/settings_enums.h"
15#include "common/settings_input.h" 18#include "common/settings_input.h"
19#include "common/settings_setting.h"
16 20
17namespace Settings { 21namespace Settings {
18 22
19enum class VSyncMode : u32 { 23const char* TranslateCategory(Settings::Category category);
20 Immediate = 0,
21 Mailbox = 1,
22 FIFO = 2,
23 FIFORelaxed = 3,
24};
25
26enum class RendererBackend : u32 {
27 OpenGL = 0,
28 Vulkan = 1,
29 Null = 2,
30};
31
32enum class ShaderBackend : u32 {
33 GLSL = 0,
34 GLASM = 1,
35 SPIRV = 2,
36};
37
38enum class GPUAccuracy : u32 {
39 Normal = 0,
40 High = 1,
41 Extreme = 2,
42};
43
44enum class CPUAccuracy : u32 {
45 Auto = 0,
46 Accurate = 1,
47 Unsafe = 2,
48 Paranoid = 3,
49};
50
51enum class FullscreenMode : u32 {
52 Borderless = 0,
53 Exclusive = 1,
54};
55
56enum class NvdecEmulation : u32 {
57 Off = 0,
58 CPU = 1,
59 GPU = 2,
60};
61
62enum class ResolutionSetup : u32 {
63 Res1_2X = 0,
64 Res3_4X = 1,
65 Res1X = 2,
66 Res3_2X = 3,
67 Res2X = 4,
68 Res3X = 5,
69 Res4X = 6,
70 Res5X = 7,
71 Res6X = 8,
72 Res7X = 9,
73 Res8X = 10,
74};
75
76enum class ScalingFilter : u32 {
77 NearestNeighbor = 0,
78 Bilinear = 1,
79 Bicubic = 2,
80 Gaussian = 3,
81 ScaleForce = 4,
82 Fsr = 5,
83 LastFilter = Fsr,
84};
85
86enum class AntiAliasing : u32 {
87 None = 0,
88 Fxaa = 1,
89 Smaa = 2,
90 LastAA = Smaa,
91};
92
93enum class AstcRecompression : u32 {
94 Uncompressed = 0,
95 Bc1 = 1,
96 Bc3 = 2,
97};
98 24
99struct ResolutionScalingInfo { 25struct ResolutionScalingInfo {
100 u32 up_scale{1}; 26 u32 up_scale{1};
@@ -119,239 +45,47 @@ struct ResolutionScalingInfo {
119 } 45 }
120}; 46};
121 47
122/** The Setting class is a simple resource manager. It defines a label and default value alongside 48#ifndef CANNOT_EXPLICITLY_INSTANTIATE
123 * the actual value of the setting for simpler and less-error prone use with frontend 49// Instantiate the classes elsewhere (settings.cpp) to reduce compiler/linker work
124 * configurations. Specifying a default value and label is required. A minimum and maximum range can 50#define SETTING(TYPE, RANGED) extern template class Setting<TYPE, RANGED>
125 * be specified for sanitization. 51#define SWITCHABLE(TYPE, RANGED) extern template class SwitchableSetting<TYPE, RANGED>
126 */ 52
127template <typename Type, bool ranged = false> 53SETTING(AudioEngine, false);
128class Setting { 54SETTING(bool, false);
129protected: 55SETTING(int, false);
130 Setting() = default; 56SETTING(s32, false);
131 57SETTING(std::string, false);
132 /** 58SETTING(std::string, false);
133 * Only sets the setting to the given initializer, leaving the other members to their default 59SETTING(u16, false);
134 * initializers. 60SWITCHABLE(AnisotropyMode, true);
135 * 61SWITCHABLE(AntiAliasing, false);
136 * @param global_val Initial value of the setting 62SWITCHABLE(AspectRatio, true);
137 */ 63SWITCHABLE(AstcDecodeMode, true);
138 explicit Setting(const Type& val) : value{val} {} 64SWITCHABLE(AstcRecompression, true);
139 65SWITCHABLE(AudioMode, true);
140public: 66SWITCHABLE(CpuAccuracy, true);
141 /** 67SWITCHABLE(FullscreenMode, true);
142 * Sets a default value, label, and setting value. 68SWITCHABLE(GpuAccuracy, true);
143 * 69SWITCHABLE(Language, true);
144 * @param default_val Initial value of the setting, and default value of the setting 70SWITCHABLE(NvdecEmulation, false);
145 * @param name Label for the setting 71SWITCHABLE(Region, true);
146 */ 72SWITCHABLE(RendererBackend, true);
147 explicit Setting(const Type& default_val, const std::string& name) 73SWITCHABLE(ScalingFilter, false);
148 requires(!ranged) 74SWITCHABLE(ShaderBackend, true);
149 : value{default_val}, default_value{default_val}, label{name} {} 75SWITCHABLE(TimeZone, true);
150 virtual ~Setting() = default; 76SETTING(VSyncMode, true);
151 77SWITCHABLE(bool, false);
152 /** 78SWITCHABLE(int, false);
153 * Sets a default value, minimum value, maximum value, and label. 79SWITCHABLE(int, true);
154 * 80SWITCHABLE(s64, false);
155 * @param default_val Initial value of the setting, and default value of the setting 81SWITCHABLE(u16, true);
156 * @param min_val Sets the minimum allowed value of the setting 82SWITCHABLE(u32, false);
157 * @param max_val Sets the maximum allowed value of the setting 83SWITCHABLE(u8, false);
158 * @param name Label for the setting 84SWITCHABLE(u8, true);
159 */ 85
160 explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val, 86#undef SETTING
161 const std::string& name) 87#undef SWITCHABLE
162 requires(ranged) 88#endif
163 : value{default_val},
164 default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {}
165
166 /**
167 * Returns a reference to the setting's value.
168 *
169 * @returns A reference to the setting
170 */
171 [[nodiscard]] virtual const Type& GetValue() const {
172 return value;
173 }
174
175 /**
176 * Sets the setting to the given value.
177 *
178 * @param val The desired value
179 */
180 virtual void SetValue(const Type& val) {
181 Type temp{ranged ? std::clamp(val, minimum, maximum) : val};
182 std::swap(value, temp);
183 }
184
185 /**
186 * Returns the value that this setting was created with.
187 *
188 * @returns A reference to the default value
189 */
190 [[nodiscard]] const Type& GetDefault() const {
191 return default_value;
192 }
193
194 /**
195 * Returns the label this setting was created with.
196 *
197 * @returns A reference to the label
198 */
199 [[nodiscard]] const std::string& GetLabel() const {
200 return label;
201 }
202
203 /**
204 * Assigns a value to the setting.
205 *
206 * @param val The desired setting value
207 *
208 * @returns A reference to the setting
209 */
210 virtual const Type& operator=(const Type& val) {
211 Type temp{ranged ? std::clamp(val, minimum, maximum) : val};
212 std::swap(value, temp);
213 return value;
214 }
215
216 /**
217 * Returns a reference to the setting.
218 *
219 * @returns A reference to the setting
220 */
221 explicit virtual operator const Type&() const {
222 return value;
223 }
224
225protected:
226 Type value{}; ///< The setting
227 const Type default_value{}; ///< The default value
228 const Type maximum{}; ///< Maximum allowed value of the setting
229 const Type minimum{}; ///< Minimum allowed value of the setting
230 const std::string label{}; ///< The setting's label
231};
232
233/**
234 * The SwitchableSetting class is a slightly more complex version of the Setting class. This adds a
235 * custom setting to switch to when a guest application specifically requires it. The effect is that
236 * other components of the emulator can access the setting's intended value without any need for the
237 * component to ask whether the custom or global setting is needed at the moment.
238 *
239 * By default, the global setting is used.
240 */
241template <typename Type, bool ranged = false>
242class SwitchableSetting : virtual public Setting<Type, ranged> {
243public:
244 /**
245 * Sets a default value, label, and setting value.
246 *
247 * @param default_val Initial value of the setting, and default value of the setting
248 * @param name Label for the setting
249 */
250 explicit SwitchableSetting(const Type& default_val, const std::string& name)
251 requires(!ranged)
252 : Setting<Type>{default_val, name} {}
253 virtual ~SwitchableSetting() = default;
254
255 /**
256 * Sets a default value, minimum value, maximum value, and label.
257 *
258 * @param default_val Initial value of the setting, and default value of the setting
259 * @param min_val Sets the minimum allowed value of the setting
260 * @param max_val Sets the maximum allowed value of the setting
261 * @param name Label for the setting
262 */
263 explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val,
264 const std::string& name)
265 requires(ranged)
266 : Setting<Type, true>{default_val, min_val, max_val, name} {}
267
268 /**
269 * Tells this setting to represent either the global or custom setting when other member
270 * functions are used.
271 *
272 * @param to_global Whether to use the global or custom setting.
273 */
274 void SetGlobal(bool to_global) {
275 use_global = to_global;
276 }
277
278 /**
279 * Returns whether this setting is using the global setting or not.
280 *
281 * @returns The global state
282 */
283 [[nodiscard]] bool UsingGlobal() const {
284 return use_global;
285 }
286
287 /**
288 * Returns either the global or custom setting depending on the values of this setting's global
289 * state or if the global value was specifically requested.
290 *
291 * @param need_global Request global value regardless of setting's state; defaults to false
292 *
293 * @returns The required value of the setting
294 */
295 [[nodiscard]] virtual const Type& GetValue() const override {
296 if (use_global) {
297 return this->value;
298 }
299 return custom;
300 }
301 [[nodiscard]] virtual const Type& GetValue(bool need_global) const {
302 if (use_global || need_global) {
303 return this->value;
304 }
305 return custom;
306 }
307
308 /**
309 * Sets the current setting value depending on the global state.
310 *
311 * @param val The new value
312 */
313 void SetValue(const Type& val) override {
314 Type temp{ranged ? std::clamp(val, this->minimum, this->maximum) : val};
315 if (use_global) {
316 std::swap(this->value, temp);
317 } else {
318 std::swap(custom, temp);
319 }
320 }
321
322 /**
323 * Assigns the current setting value depending on the global state.
324 *
325 * @param val The new value
326 *
327 * @returns A reference to the current setting value
328 */
329 const Type& operator=(const Type& val) override {
330 Type temp{ranged ? std::clamp(val, this->minimum, this->maximum) : val};
331 if (use_global) {
332 std::swap(this->value, temp);
333 return this->value;
334 }
335 std::swap(custom, temp);
336 return custom;
337 }
338
339 /**
340 * Returns the current setting value depending on the global state.
341 *
342 * @returns A reference to the current setting value
343 */
344 virtual explicit operator const Type&() const override {
345 if (use_global) {
346 return this->value;
347 }
348 return custom;
349 }
350
351protected:
352 bool use_global{true}; ///< The setting's global state
353 Type custom{}; ///< The custom value of the setting
354};
355 89
356/** 90/**
357 * The InputSetting class allows for getting a reference to either the global or custom members. 91 * The InputSetting class allows for getting a reference to either the global or custom members.
@@ -391,208 +125,388 @@ struct TouchFromButtonMap {
391}; 125};
392 126
393struct Values { 127struct Values {
128 Linkage linkage{};
129
394 // Audio 130 // Audio
395 Setting<std::string> sink_id{"auto", "output_engine"}; 131 Setting<AudioEngine> sink_id{linkage, AudioEngine::Auto, "output_engine", Category::Audio,
396 Setting<std::string> audio_output_device_id{"auto", "output_device"}; 132 Specialization::RuntimeList};
397 Setting<std::string> audio_input_device_id{"auto", "input_device"}; 133 Setting<std::string> audio_output_device_id{linkage, "auto", "output_device", Category::Audio,
398 Setting<bool> audio_muted{false, "audio_muted"}; 134 Specialization::RuntimeList};
399 SwitchableSetting<u8, true> volume{100, 0, 200, "volume"}; 135 Setting<std::string> audio_input_device_id{linkage, "auto", "input_device", Category::Audio,
400 Setting<bool> dump_audio_commands{false, "dump_audio_commands"}; 136 Specialization::RuntimeList};
137 SwitchableSetting<AudioMode, true> sound_index{
138 linkage, AudioMode::Stereo, AudioMode::Mono, AudioMode::Surround,
139 "sound_index", Category::SystemAudio, Specialization::Default, true,
140 true};
141 SwitchableSetting<u8, true> volume{linkage,
142 100,
143 0,
144 200,
145 "volume",
146 Category::Audio,
147 Specialization::Scalar | Specialization::Percentage,
148 true,
149 true};
150 Setting<bool, false> audio_muted{
151 linkage, false, "audio_muted", Category::Audio, Specialization::Default, false, true};
152 Setting<bool, false> dump_audio_commands{
153 linkage, false, "dump_audio_commands", Category::Audio, Specialization::Default, false};
401 154
402 // Core 155 // Core
403 SwitchableSetting<bool> use_multi_core{true, "use_multi_core"}; 156 SwitchableSetting<bool> use_multi_core{linkage, true, "use_multi_core", Category::Core};
404 SwitchableSetting<bool> use_unsafe_extended_memory_layout{false, 157 SwitchableSetting<MemoryLayout, true> memory_layout_mode{linkage,
405 "use_unsafe_extended_memory_layout"}; 158 MemoryLayout::Memory_4Gb,
159 MemoryLayout::Memory_4Gb,
160 MemoryLayout::Memory_8Gb,
161 "memory_layout_mode",
162 Category::Core};
163 SwitchableSetting<bool> use_speed_limit{
164 linkage, true, "use_speed_limit", Category::Core, Specialization::Paired, false, true};
165 SwitchableSetting<u16, true> speed_limit{linkage,
166 100,
167 0,
168 9999,
169 "speed_limit",
170 Category::Core,
171 Specialization::Countable | Specialization::Percentage,
172 true,
173 true,
174 &use_speed_limit};
406 175
407 // Cpu 176 // Cpu
408 SwitchableSetting<CPUAccuracy, true> cpu_accuracy{CPUAccuracy::Auto, CPUAccuracy::Auto, 177 SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto,
409 CPUAccuracy::Paranoid, "cpu_accuracy"}; 178 CpuAccuracy::Auto, CpuAccuracy::Paranoid,
410 // TODO: remove cpu_accuracy_first_time, migration setting added 8 July 2021 179 "cpu_accuracy", Category::Cpu};
411 Setting<bool> cpu_accuracy_first_time{true, "cpu_accuracy_first_time"}; 180 Setting<bool> cpu_debug_mode{linkage, false, "cpu_debug_mode", Category::CpuDebug};
412 Setting<bool> cpu_debug_mode{false, "cpu_debug_mode"}; 181
413 182 Setting<bool> cpuopt_page_tables{linkage, true, "cpuopt_page_tables", Category::CpuDebug};
414 Setting<bool> cpuopt_page_tables{true, "cpuopt_page_tables"}; 183 Setting<bool> cpuopt_block_linking{linkage, true, "cpuopt_block_linking", Category::CpuDebug};
415 Setting<bool> cpuopt_block_linking{true, "cpuopt_block_linking"}; 184 Setting<bool> cpuopt_return_stack_buffer{linkage, true, "cpuopt_return_stack_buffer",
416 Setting<bool> cpuopt_return_stack_buffer{true, "cpuopt_return_stack_buffer"}; 185 Category::CpuDebug};
417 Setting<bool> cpuopt_fast_dispatcher{true, "cpuopt_fast_dispatcher"}; 186 Setting<bool> cpuopt_fast_dispatcher{linkage, true, "cpuopt_fast_dispatcher",
418 Setting<bool> cpuopt_context_elimination{true, "cpuopt_context_elimination"}; 187 Category::CpuDebug};
419 Setting<bool> cpuopt_const_prop{true, "cpuopt_const_prop"}; 188 Setting<bool> cpuopt_context_elimination{linkage, true, "cpuopt_context_elimination",
420 Setting<bool> cpuopt_misc_ir{true, "cpuopt_misc_ir"}; 189 Category::CpuDebug};
421 Setting<bool> cpuopt_reduce_misalign_checks{true, "cpuopt_reduce_misalign_checks"}; 190 Setting<bool> cpuopt_const_prop{linkage, true, "cpuopt_const_prop", Category::CpuDebug};
422 Setting<bool> cpuopt_fastmem{true, "cpuopt_fastmem"}; 191 Setting<bool> cpuopt_misc_ir{linkage, true, "cpuopt_misc_ir", Category::CpuDebug};
423 Setting<bool> cpuopt_fastmem_exclusives{true, "cpuopt_fastmem_exclusives"}; 192 Setting<bool> cpuopt_reduce_misalign_checks{linkage, true, "cpuopt_reduce_misalign_checks",
424 Setting<bool> cpuopt_recompile_exclusives{true, "cpuopt_recompile_exclusives"}; 193 Category::CpuDebug};
425 Setting<bool> cpuopt_ignore_memory_aborts{true, "cpuopt_ignore_memory_aborts"}; 194 Setting<bool> cpuopt_fastmem{linkage, true, "cpuopt_fastmem", Category::CpuDebug};
426 195 Setting<bool> cpuopt_fastmem_exclusives{linkage, true, "cpuopt_fastmem_exclusives",
427 SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{true, "cpuopt_unsafe_unfuse_fma"}; 196 Category::CpuDebug};
428 SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{true, "cpuopt_unsafe_reduce_fp_error"}; 197 Setting<bool> cpuopt_recompile_exclusives{linkage, true, "cpuopt_recompile_exclusives",
198 Category::CpuDebug};
199 Setting<bool> cpuopt_ignore_memory_aborts{linkage, true, "cpuopt_ignore_memory_aborts",
200 Category::CpuDebug};
201
202 SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{linkage, true, "cpuopt_unsafe_unfuse_fma",
203 Category::CpuUnsafe};
204 SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{
205 linkage, true, "cpuopt_unsafe_reduce_fp_error", Category::CpuUnsafe};
429 SwitchableSetting<bool> cpuopt_unsafe_ignore_standard_fpcr{ 206 SwitchableSetting<bool> cpuopt_unsafe_ignore_standard_fpcr{
430 true, "cpuopt_unsafe_ignore_standard_fpcr"}; 207 linkage, true, "cpuopt_unsafe_ignore_standard_fpcr", Category::CpuUnsafe};
431 SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{true, "cpuopt_unsafe_inaccurate_nan"}; 208 SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{
432 SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{true, "cpuopt_unsafe_fastmem_check"}; 209 linkage, true, "cpuopt_unsafe_inaccurate_nan", Category::CpuUnsafe};
210 SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{
211 linkage, true, "cpuopt_unsafe_fastmem_check", Category::CpuUnsafe};
433 SwitchableSetting<bool> cpuopt_unsafe_ignore_global_monitor{ 212 SwitchableSetting<bool> cpuopt_unsafe_ignore_global_monitor{
434 true, "cpuopt_unsafe_ignore_global_monitor"}; 213 linkage, true, "cpuopt_unsafe_ignore_global_monitor", Category::CpuUnsafe};
435 214
436 // Renderer 215 // Renderer
437 SwitchableSetting<RendererBackend, true> renderer_backend{ 216 SwitchableSetting<RendererBackend, true> renderer_backend{
438 RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, "backend"}; 217 linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null,
439 SwitchableSetting<bool> async_presentation{false, "async_presentation"}; 218 "backend", Category::Renderer};
440 SwitchableSetting<bool> renderer_force_max_clock{false, "force_max_clock"}; 219 SwitchableSetting<ShaderBackend, true> shader_backend{
441 Setting<bool> renderer_debug{false, "debug"}; 220 linkage, ShaderBackend::Glsl, ShaderBackend::Glsl, ShaderBackend::SpirV,
442 Setting<bool> renderer_shader_feedback{false, "shader_feedback"}; 221 "shader_backend", Category::Renderer, Specialization::RuntimeList};
443 Setting<bool> enable_nsight_aftermath{false, "nsight_aftermath"}; 222 SwitchableSetting<int> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer,
444 Setting<bool> disable_shader_loop_safety_checks{false, "disable_shader_loop_safety_checks"}; 223 Specialization::RuntimeList};
445 SwitchableSetting<int> vulkan_device{0, "vulkan_device"}; 224
446 225 SwitchableSetting<bool> use_disk_shader_cache{linkage, true, "use_disk_shader_cache",
447 ResolutionScalingInfo resolution_info{}; 226 Category::Renderer};
448 SwitchableSetting<ResolutionSetup> resolution_setup{ResolutionSetup::Res1X, "resolution_setup"}; 227 SwitchableSetting<bool> use_asynchronous_gpu_emulation{
449 SwitchableSetting<ScalingFilter> scaling_filter{ScalingFilter::Bilinear, "scaling_filter"}; 228 linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer};
450 SwitchableSetting<int, true> fsr_sharpening_slider{25, 0, 200, "fsr_sharpening_slider"}; 229 SwitchableSetting<AstcDecodeMode, true> accelerate_astc{linkage,
451 SwitchableSetting<AntiAliasing> anti_aliasing{AntiAliasing::None, "anti_aliasing"}; 230 AstcDecodeMode::Gpu,
231 AstcDecodeMode::Cpu,
232 AstcDecodeMode::CpuAsynchronous,
233 "accelerate_astc",
234 Category::Renderer};
235 Setting<VSyncMode, true> vsync_mode{
236 linkage, VSyncMode::Fifo, VSyncMode::Immediate, VSyncMode::FifoRelaxed,
237 "use_vsync", Category::Renderer, Specialization::RuntimeList, true,
238 true};
239 SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::Gpu,
240 "nvdec_emulation", Category::Renderer};
452 // *nix platforms may have issues with the borderless windowed fullscreen mode. 241 // *nix platforms may have issues with the borderless windowed fullscreen mode.
453 // Default to exclusive fullscreen on these platforms for now. 242 // Default to exclusive fullscreen on these platforms for now.
454 SwitchableSetting<FullscreenMode, true> fullscreen_mode{ 243 SwitchableSetting<FullscreenMode, true> fullscreen_mode{linkage,
455#ifdef _WIN32 244#ifdef _WIN32
456 FullscreenMode::Borderless, 245 FullscreenMode::Borderless,
457#else 246#else
458 FullscreenMode::Exclusive, 247 FullscreenMode::Exclusive,
459#endif 248#endif
460 FullscreenMode::Borderless, FullscreenMode::Exclusive, "fullscreen_mode"}; 249 FullscreenMode::Borderless,
461 SwitchableSetting<int, true> aspect_ratio{0, 0, 4, "aspect_ratio"}; 250 FullscreenMode::Exclusive,
462 SwitchableSetting<int, true> max_anisotropy{0, 0, 5, "max_anisotropy"}; 251 "fullscreen_mode",
463 SwitchableSetting<bool> use_speed_limit{true, "use_speed_limit"}; 252 Category::Renderer,
464 SwitchableSetting<u16, true> speed_limit{100, 0, 9999, "speed_limit"}; 253 Specialization::Default,
465 SwitchableSetting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"}; 254 true,
466 SwitchableSetting<GPUAccuracy, true> gpu_accuracy{GPUAccuracy::High, GPUAccuracy::Normal, 255 true};
467 GPUAccuracy::Extreme, "gpu_accuracy"}; 256 SwitchableSetting<AspectRatio, true> aspect_ratio{linkage,
468 SwitchableSetting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; 257 AspectRatio::R16_9,
469 SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; 258 AspectRatio::R16_9,
470 SwitchableSetting<bool> accelerate_astc{true, "accelerate_astc"}; 259 AspectRatio::Stretch,
471 SwitchableSetting<bool> async_astc{false, "async_astc"}; 260 "aspect_ratio",
472 Setting<VSyncMode, true> vsync_mode{VSyncMode::FIFO, VSyncMode::Immediate, 261 Category::Renderer,
473 VSyncMode::FIFORelaxed, "use_vsync"}; 262 Specialization::Default,
474 SwitchableSetting<bool> use_reactive_flushing{true, "use_reactive_flushing"}; 263 true,
475 SwitchableSetting<ShaderBackend, true> shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL, 264 true};
476 ShaderBackend::SPIRV, "shader_backend"}; 265
477 SwitchableSetting<bool> use_asynchronous_shaders{false, "use_asynchronous_shaders"}; 266 ResolutionScalingInfo resolution_info{};
478 SwitchableSetting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"}; 267 SwitchableSetting<ResolutionSetup> resolution_setup{linkage, ResolutionSetup::Res1X,
479 SwitchableSetting<bool> use_vulkan_driver_pipeline_cache{true, 268 "resolution_setup", Category::Renderer};
480 "use_vulkan_driver_pipeline_cache"}; 269 SwitchableSetting<ScalingFilter> scaling_filter{linkage,
481 SwitchableSetting<bool> enable_compute_pipelines{false, "enable_compute_pipelines"}; 270 ScalingFilter::Bilinear,
482 SwitchableSetting<AstcRecompression, true> astc_recompression{ 271 "scaling_filter",
483 AstcRecompression::Uncompressed, AstcRecompression::Uncompressed, AstcRecompression::Bc3, 272 Category::Renderer,
484 "astc_recompression"}; 273 Specialization::Default,
485 SwitchableSetting<bool> use_video_framerate{false, "use_video_framerate"}; 274 true,
486 SwitchableSetting<bool> barrier_feedback_loops{true, "barrier_feedback_loops"}; 275 true};
487 276 SwitchableSetting<AntiAliasing> anti_aliasing{linkage,
488 SwitchableSetting<u8> bg_red{0, "bg_red"}; 277 AntiAliasing::None,
489 SwitchableSetting<u8> bg_green{0, "bg_green"}; 278 "anti_aliasing",
490 SwitchableSetting<u8> bg_blue{0, "bg_blue"}; 279 Category::Renderer,
280 Specialization::Default,
281 true,
282 true};
283 SwitchableSetting<int, true> fsr_sharpening_slider{linkage,
284 25,
285 0,
286 200,
287 "fsr_sharpening_slider",
288 Category::Renderer,
289 Specialization::Scalar |
290 Specialization::Percentage,
291 true,
292 true};
293
294 SwitchableSetting<u8, false> bg_red{
295 linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true};
296 SwitchableSetting<u8, false> bg_green{
297 linkage, 0, "bg_green", Category::Renderer, Specialization::Default, true, true};
298 SwitchableSetting<u8, false> bg_blue{
299 linkage, 0, "bg_blue", Category::Renderer, Specialization::Default, true, true};
300
301 SwitchableSetting<GpuAccuracy, true> gpu_accuracy{linkage,
302 GpuAccuracy::High,
303 GpuAccuracy::Normal,
304 GpuAccuracy::Extreme,
305 "gpu_accuracy",
306 Category::RendererAdvanced,
307 Specialization::Default,
308 true,
309 true};
310 SwitchableSetting<AnisotropyMode, true> max_anisotropy{
311 linkage, AnisotropyMode::Automatic, AnisotropyMode::Automatic, AnisotropyMode::X16,
312 "max_anisotropy", Category::RendererAdvanced};
313 SwitchableSetting<AstcRecompression, true> astc_recompression{linkage,
314 AstcRecompression::Uncompressed,
315 AstcRecompression::Uncompressed,
316 AstcRecompression::Bc3,
317 "astc_recompression",
318 Category::RendererAdvanced};
319 SwitchableSetting<bool> async_presentation{linkage, false, "async_presentation",
320 Category::RendererAdvanced};
321 SwitchableSetting<bool> renderer_force_max_clock{linkage, false, "force_max_clock",
322 Category::RendererAdvanced};
323 SwitchableSetting<bool> use_reactive_flushing{linkage, true, "use_reactive_flushing",
324 Category::RendererAdvanced};
325 SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
326 Category::RendererAdvanced};
327 SwitchableSetting<bool> use_fast_gpu_time{
328 linkage, true, "use_fast_gpu_time", Category::RendererAdvanced, Specialization::Default,
329 true, true};
330 SwitchableSetting<bool> use_vulkan_driver_pipeline_cache{linkage,
331 true,
332 "use_vulkan_driver_pipeline_cache",
333 Category::RendererAdvanced,
334 Specialization::Default,
335 true,
336 true};
337 SwitchableSetting<bool> enable_compute_pipelines{linkage, false, "enable_compute_pipelines",
338 Category::RendererAdvanced};
339 SwitchableSetting<bool> use_video_framerate{linkage, false, "use_video_framerate",
340 Category::RendererAdvanced};
341 SwitchableSetting<bool> barrier_feedback_loops{linkage, true, "barrier_feedback_loops",
342 Category::RendererAdvanced};
343
344 Setting<bool> renderer_debug{linkage, false, "debug", Category::RendererDebug};
345 Setting<bool> renderer_shader_feedback{linkage, false, "shader_feedback",
346 Category::RendererDebug};
347 Setting<bool> enable_nsight_aftermath{linkage, false, "nsight_aftermath",
348 Category::RendererDebug};
349 Setting<bool> disable_shader_loop_safety_checks{
350 linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug};
491 351
492 // System 352 // System
493 SwitchableSetting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; 353 SwitchableSetting<Language, true> language_index{linkage,
494 Setting<std::string> device_name{"Yuzu", "device_name"}; 354 Language::EnglishAmerican,
355 Language::Japanese,
356 Language::PortugueseBrazilian,
357 "language_index",
358 Category::System};
359 SwitchableSetting<Region, true> region_index{linkage, Region::Usa, Region::Japan,
360 Region::Taiwan, "region_index", Category::System};
361 SwitchableSetting<TimeZone, true> time_zone_index{linkage, TimeZone::Auto,
362 TimeZone::Auto, TimeZone::Zulu,
363 "time_zone_index", Category::System};
495 // Measured in seconds since epoch 364 // Measured in seconds since epoch
496 std::optional<s64> custom_rtc; 365 SwitchableSetting<bool> custom_rtc_enabled{
366 linkage, false, "custom_rtc_enabled", Category::System, Specialization::Paired, true, true};
367 SwitchableSetting<s64> custom_rtc{
368 linkage, 0, "custom_rtc", Category::System, Specialization::Time,
369 true, true, &custom_rtc_enabled};
497 // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` 370 // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc`
498 s64 custom_rtc_differential; 371 s64 custom_rtc_differential;
372 SwitchableSetting<bool> rng_seed_enabled{
373 linkage, false, "rng_seed_enabled", Category::System, Specialization::Paired, true, true};
374 SwitchableSetting<u32> rng_seed{
375 linkage, 0, "rng_seed", Category::System, Specialization::Hex,
376 true, true, &rng_seed_enabled};
377 Setting<std::string> device_name{
378 linkage, "yuzu", "device_name", Category::System, Specialization::Default, true, true};
499 379
500 Setting<s32> current_user{0, "current_user"}; 380 Setting<s32> current_user{linkage, 0, "current_user", Category::System};
501 SwitchableSetting<s32, true> language_index{1, 0, 17, "language_index"}; 381
502 SwitchableSetting<s32, true> region_index{1, 0, 6, "region_index"}; 382 SwitchableSetting<bool> use_docked_mode{linkage, true, "use_docked_mode", Category::System};
503 SwitchableSetting<s32, true> time_zone_index{0, 0, 45, "time_zone_index"};
504 SwitchableSetting<s32, true> sound_index{1, 0, 2, "sound_index"};
505 383
506 // Controls 384 // Controls
507 InputSetting<std::array<PlayerInput, 10>> players; 385 InputSetting<std::array<PlayerInput, 10>> players;
508 386
509 SwitchableSetting<bool> use_docked_mode{true, "use_docked_mode"}; 387 Setting<bool> enable_raw_input{
510 388 linkage, false, "enable_raw_input", Category::Controls, Specialization::Default,
511 Setting<bool> enable_raw_input{false, "enable_raw_input"}; 389// Only read/write enable_raw_input on Windows platforms
512 Setting<bool> controller_navigation{true, "controller_navigation"}; 390#ifdef _WIN32
513 Setting<bool> enable_joycon_driver{true, "enable_joycon_driver"}; 391 true
514 Setting<bool> enable_procon_driver{false, "enable_procon_driver"}; 392#else
515 393 false
516 SwitchableSetting<bool> vibration_enabled{true, "vibration_enabled"}; 394#endif
517 SwitchableSetting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"}; 395 };
518 396 Setting<bool> controller_navigation{linkage, true, "controller_navigation", Category::Controls};
519 SwitchableSetting<bool> motion_enabled{true, "motion_enabled"}; 397 Setting<bool> enable_joycon_driver{linkage, true, "enable_joycon_driver", Category::Controls};
520 Setting<std::string> udp_input_servers{"127.0.0.1:26760", "udp_input_servers"}; 398 Setting<bool> enable_procon_driver{linkage, false, "enable_procon_driver", Category::Controls};
521 Setting<bool> enable_udp_controller{false, "enable_udp_controller"}; 399
522 400 SwitchableSetting<bool> vibration_enabled{linkage, true, "vibration_enabled",
523 Setting<bool> pause_tas_on_load{true, "pause_tas_on_load"}; 401 Category::Controls};
524 Setting<bool> tas_enable{false, "tas_enable"}; 402 SwitchableSetting<bool> enable_accurate_vibrations{linkage, false, "enable_accurate_vibrations",
525 Setting<bool> tas_loop{false, "tas_loop"}; 403 Category::Controls};
526 404
527 Setting<bool> mouse_panning{false, "mouse_panning"}; 405 SwitchableSetting<bool> motion_enabled{linkage, true, "motion_enabled", Category::Controls};
528 Setting<u8, true> mouse_panning_x_sensitivity{50, 1, 100, "mouse_panning_x_sensitivity"}; 406 Setting<std::string> udp_input_servers{linkage, "127.0.0.1:26760", "udp_input_servers",
529 Setting<u8, true> mouse_panning_y_sensitivity{50, 1, 100, "mouse_panning_y_sensitivity"}; 407 Category::Controls};
530 Setting<u8, true> mouse_panning_deadzone_counterweight{20, 0, 100, 408 Setting<bool> enable_udp_controller{linkage, false, "enable_udp_controller",
531 "mouse_panning_deadzone_counterweight"}; 409 Category::Controls};
532 Setting<u8, true> mouse_panning_decay_strength{18, 0, 100, "mouse_panning_decay_strength"}; 410
533 Setting<u8, true> mouse_panning_min_decay{6, 0, 100, "mouse_panning_min_decay"}; 411 Setting<bool> pause_tas_on_load{linkage, true, "pause_tas_on_load", Category::Controls};
534 412 Setting<bool> tas_enable{linkage, false, "tas_enable", Category::Controls};
535 Setting<bool> mouse_enabled{false, "mouse_enabled"}; 413 Setting<bool> tas_loop{linkage, false, "tas_loop", Category::Controls};
536 Setting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"}; 414
537 Setting<bool> keyboard_enabled{false, "keyboard_enabled"}; 415 Setting<bool> mouse_panning{
538 416 linkage, false, "mouse_panning", Category::Controls, Specialization::Default, false};
539 Setting<bool> debug_pad_enabled{false, "debug_pad_enabled"}; 417 Setting<u8, true> mouse_panning_sensitivity{
418 linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls};
419 Setting<bool> mouse_enabled{linkage, false, "mouse_enabled", Category::Controls};
420
421 Setting<u8, true> mouse_panning_x_sensitivity{
422 linkage, 50, 1, 100, "mouse_panning_x_sensitivity", Category::Controls};
423 Setting<u8, true> mouse_panning_y_sensitivity{
424 linkage, 50, 1, 100, "mouse_panning_y_sensitivity", Category::Controls};
425 Setting<u8, true> mouse_panning_deadzone_counterweight{
426 linkage, 20, 0, 100, "mouse_panning_deadzone_counterweight", Category::Controls};
427 Setting<u8, true> mouse_panning_decay_strength{
428 linkage, 18, 0, 100, "mouse_panning_decay_strength", Category::Controls};
429 Setting<u8, true> mouse_panning_min_decay{
430 linkage, 6, 0, 100, "mouse_panning_min_decay", Category::Controls};
431
432 Setting<bool> emulate_analog_keyboard{linkage, false, "emulate_analog_keyboard",
433 Category::Controls};
434 Setting<bool> keyboard_enabled{linkage, false, "keyboard_enabled", Category::Controls};
435
436 Setting<bool> debug_pad_enabled{linkage, false, "debug_pad_enabled", Category::Controls};
540 ButtonsRaw debug_pad_buttons; 437 ButtonsRaw debug_pad_buttons;
541 AnalogsRaw debug_pad_analogs; 438 AnalogsRaw debug_pad_analogs;
542 439
543 TouchscreenInput touchscreen; 440 TouchscreenInput touchscreen;
544 441
545 Setting<std::string> touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850", "touch_device"}; 442 Setting<std::string> touch_device{linkage, "min_x:100,min_y:50,max_x:1800,max_y:850",
546 Setting<int> touch_from_button_map_index{0, "touch_from_button_map"}; 443 "touch_device", Category::Controls};
444 Setting<int> touch_from_button_map_index{linkage, 0, "touch_from_button_map",
445 Category::Controls};
547 std::vector<TouchFromButtonMap> touch_from_button_maps; 446 std::vector<TouchFromButtonMap> touch_from_button_maps;
548 447
549 Setting<bool> enable_ring_controller{true, "enable_ring_controller"}; 448 Setting<bool> enable_ring_controller{linkage, true, "enable_ring_controller",
449 Category::Controls};
550 RingconRaw ringcon_analogs; 450 RingconRaw ringcon_analogs;
551 451
552 Setting<bool> enable_ir_sensor{false, "enable_ir_sensor"}; 452 Setting<bool> enable_ir_sensor{linkage, false, "enable_ir_sensor", Category::Controls};
553 Setting<std::string> ir_sensor_device{"auto", "ir_sensor_device"}; 453 Setting<std::string> ir_sensor_device{linkage, "auto", "ir_sensor_device", Category::Controls};
554 454
555 Setting<bool> random_amiibo_id{false, "random_amiibo_id"}; 455 Setting<bool> random_amiibo_id{linkage, false, "random_amiibo_id", Category::Controls};
556 456
557 // Data Storage 457 // Data Storage
558 Setting<bool> use_virtual_sd{true, "use_virtual_sd"}; 458 Setting<bool> use_virtual_sd{linkage, true, "use_virtual_sd", Category::DataStorage};
559 Setting<bool> gamecard_inserted{false, "gamecard_inserted"}; 459 Setting<bool> gamecard_inserted{linkage, false, "gamecard_inserted", Category::DataStorage};
560 Setting<bool> gamecard_current_game{false, "gamecard_current_game"}; 460 Setting<bool> gamecard_current_game{linkage, false, "gamecard_current_game",
561 Setting<std::string> gamecard_path{std::string(), "gamecard_path"}; 461 Category::DataStorage};
462 Setting<std::string> gamecard_path{linkage, std::string(), "gamecard_path",
463 Category::DataStorage};
562 464
563 // Debugging 465 // Debugging
564 bool record_frame_times; 466 bool record_frame_times;
565 Setting<bool> use_gdbstub{false, "use_gdbstub"}; 467 Setting<bool> use_gdbstub{linkage, false, "use_gdbstub", Category::Debugging};
566 Setting<u16> gdbstub_port{6543, "gdbstub_port"}; 468 Setting<u16> gdbstub_port{linkage, 6543, "gdbstub_port", Category::Debugging};
567 Setting<std::string> program_args{std::string(), "program_args"}; 469 Setting<std::string> program_args{linkage, std::string(), "program_args", Category::Debugging};
568 Setting<bool> dump_exefs{false, "dump_exefs"}; 470 Setting<bool> dump_exefs{linkage, false, "dump_exefs", Category::Debugging};
569 Setting<bool> dump_nso{false, "dump_nso"}; 471 Setting<bool> dump_nso{linkage, false, "dump_nso", Category::Debugging};
570 Setting<bool> dump_shaders{false, "dump_shaders"}; 472 Setting<bool> dump_shaders{
571 Setting<bool> dump_macros{false, "dump_macros"}; 473 linkage, false, "dump_shaders", Category::DebuggingGraphics, Specialization::Default,
572 Setting<bool> enable_fs_access_log{false, "enable_fs_access_log"}; 474 false};
573 Setting<bool> reporting_services{false, "reporting_services"}; 475 Setting<bool> dump_macros{
574 Setting<bool> quest_flag{false, "quest_flag"}; 476 linkage, false, "dump_macros", Category::DebuggingGraphics, Specialization::Default, false};
575 Setting<bool> disable_macro_jit{false, "disable_macro_jit"}; 477 Setting<bool> enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging};
576 Setting<bool> disable_macro_hle{false, "disable_macro_hle"}; 478 Setting<bool> reporting_services{
577 Setting<bool> extended_logging{false, "extended_logging"}; 479 linkage, false, "reporting_services", Category::Debugging, Specialization::Default, false};
578 Setting<bool> use_debug_asserts{false, "use_debug_asserts"}; 480 Setting<bool> quest_flag{linkage, false, "quest_flag", Category::Debugging};
579 Setting<bool> use_auto_stub{false, "use_auto_stub"}; 481 Setting<bool> disable_macro_jit{linkage, false, "disable_macro_jit",
580 Setting<bool> enable_all_controllers{false, "enable_all_controllers"}; 482 Category::DebuggingGraphics};
581 Setting<bool> create_crash_dumps{false, "create_crash_dumps"}; 483 Setting<bool> disable_macro_hle{linkage, false, "disable_macro_hle",
582 Setting<bool> perform_vulkan_check{true, "perform_vulkan_check"}; 484 Category::DebuggingGraphics};
485 Setting<bool> extended_logging{
486 linkage, false, "extended_logging", Category::Debugging, Specialization::Default, false};
487 Setting<bool> use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging};
488 Setting<bool> use_auto_stub{
489 linkage, false, "use_auto_stub", Category::Debugging, Specialization::Default, false};
490 Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers",
491 Category::Debugging};
492 Setting<bool> create_crash_dumps{linkage, false, "create_crash_dumps", Category::Debugging};
493 Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging};
583 494
584 // Miscellaneous 495 // Miscellaneous
585 Setting<std::string> log_filter{"*:Info", "log_filter"}; 496 Setting<std::string> log_filter{linkage, "*:Info", "log_filter", Category::Miscellaneous};
586 Setting<bool> use_dev_keys{false, "use_dev_keys"}; 497 Setting<bool> use_dev_keys{linkage, false, "use_dev_keys", Category::Miscellaneous};
587 498
588 // Network 499 // Network
589 Setting<std::string> network_interface{std::string(), "network_interface"}; 500 Setting<std::string> network_interface{linkage, std::string(), "network_interface",
501 Category::Network};
590 502
591 // WebService 503 // WebService
592 Setting<bool> enable_telemetry{true, "enable_telemetry"}; 504 Setting<bool> enable_telemetry{linkage, true, "enable_telemetry", Category::WebService};
593 Setting<std::string> web_api_url{"https://api.yuzu-emu.org", "web_api_url"}; 505 Setting<std::string> web_api_url{linkage, "https://api.yuzu-emu.org", "web_api_url",
594 Setting<std::string> yuzu_username{std::string(), "yuzu_username"}; 506 Category::WebService};
595 Setting<std::string> yuzu_token{std::string(), "yuzu_token"}; 507 Setting<std::string> yuzu_username{linkage, std::string(), "yuzu_username",
508 Category::WebService};
509 Setting<std::string> yuzu_token{linkage, std::string(), "yuzu_token", Category::WebService};
596 510
597 // Add-Ons 511 // Add-Ons
598 std::map<u64, std::vector<std::string>> disabled_addons; 512 std::map<u64, std::vector<std::string>> disabled_addons;
@@ -600,9 +514,6 @@ struct Values {
600 514
601extern Values values; 515extern Values values;
602 516
603bool IsConfiguringGlobal();
604void SetConfiguringGlobal(bool is_global);
605
606bool IsGPULevelExtreme(); 517bool IsGPULevelExtreme();
607bool IsGPULevelHigh(); 518bool IsGPULevelHigh();
608 519
@@ -610,7 +521,7 @@ bool IsFastmemEnabled();
610 521
611float Volume(); 522float Volume();
612 523
613std::string GetTimeZoneString(); 524std::string GetTimeZoneString(TimeZone time_zone);
614 525
615void LogSettings(); 526void LogSettings();
616 527
@@ -619,4 +530,7 @@ void UpdateRescalingInfo();
619// Restore the global state of all applicable settings in the Values struct 530// Restore the global state of all applicable settings in the Values struct
620void RestoreGlobalState(bool is_powered_on); 531void RestoreGlobalState(bool is_powered_on);
621 532
533bool IsConfiguringGlobal();
534void SetConfiguringGlobal(bool is_global);
535
622} // namespace Settings 536} // namespace Settings