diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/settings.h | 136 | ||||
| -rw-r--r-- | src/common/settings_common.cpp | 11 | ||||
| -rw-r--r-- | src/common/settings_common.h | 20 | ||||
| -rw-r--r-- | src/common/settings_setting.h | 27 |
4 files changed, 130 insertions, 64 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 0ae71dd1b..c78dd85c8 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -128,25 +128,31 @@ struct Values { | |||
| 128 | Linkage linkage{}; | 128 | Linkage linkage{}; |
| 129 | 129 | ||
| 130 | // Audio | 130 | // Audio |
| 131 | Setting<AudioEngine> sink_id{linkage, AudioEngine::Auto, "output_engine", Category::Audio}; | 131 | Setting<AudioEngine> sink_id{linkage, AudioEngine::Auto, "output_engine", Category::Audio, |
| 132 | Setting<std::string> audio_output_device_id{linkage, "auto", "output_device", Category::Audio}; | 132 | Specialization::RuntimeList}; |
| 133 | Setting<std::string> audio_input_device_id{linkage, "auto", "input_device", Category::Audio}; | 133 | Setting<std::string> audio_output_device_id{linkage, "auto", "output_device", Category::Audio, |
| 134 | Specialization::RuntimeList}; | ||
| 135 | Setting<std::string> audio_input_device_id{linkage, "auto", "input_device", Category::Audio, | ||
| 136 | Specialization::RuntimeList}; | ||
| 134 | SwitchableSetting<AudioMode, true> sound_index{linkage, AudioMode::Stereo, | 137 | SwitchableSetting<AudioMode, true> sound_index{linkage, AudioMode::Stereo, |
| 135 | AudioMode::Mono, AudioMode::Surround, | 138 | AudioMode::Mono, AudioMode::Surround, |
| 136 | "sound_index", Category::SystemAudio}; | 139 | "sound_index", Category::SystemAudio}; |
| 137 | SwitchableSetting<u8, true> volume{linkage, 100, 0, 200, "volume", Category::Audio, true, true}; | 140 | SwitchableSetting<u8, true> volume{ |
| 138 | Setting<bool, false> audio_muted{linkage, false, "audio_muted", Category::Audio, false}; | 141 | linkage, 100, 0, 200, "volume", Category::Audio, Specialization::Scalar, true, true}; |
| 139 | Setting<bool, false> dump_audio_commands{linkage, false, "dump_audio_commands", Category::Audio, | 142 | Setting<bool, false> audio_muted{ |
| 140 | false}; | 143 | linkage, false, "audio_muted", Category::Audio, Specialization::Default, false}; |
| 144 | Setting<bool, false> dump_audio_commands{ | ||
| 145 | linkage, false, "dump_audio_commands", Category::Audio, Specialization::Default, false}; | ||
| 141 | 146 | ||
| 142 | // Core | 147 | // Core |
| 143 | SwitchableSetting<bool> use_multi_core{linkage, true, "use_multi_core", Category::Core}; | 148 | SwitchableSetting<bool> use_multi_core{linkage, true, "use_multi_core", Category::Core}; |
| 144 | SwitchableSetting<bool> use_unsafe_extended_memory_layout{ | 149 | SwitchableSetting<bool> use_unsafe_extended_memory_layout{ |
| 145 | linkage, false, "use_unsafe_extended_memory_layout", Category::Core}; | 150 | linkage, false, "use_unsafe_extended_memory_layout", Category::Core}; |
| 146 | SwitchableSetting<bool> use_speed_limit{linkage, true, "use_speed_limit", | 151 | SwitchableSetting<bool> use_speed_limit{ |
| 147 | Category::Core, false, true}; | 152 | linkage, true, "use_speed_limit", Category::Core, Specialization::Paired, false, true}; |
| 148 | SwitchableSetting<u16, true> speed_limit{linkage, 100, 0, 9999, "speed_limit", | 153 | SwitchableSetting<u16, true> speed_limit{ |
| 149 | Category::Core, true, true}; | 154 | linkage, 100, 0, 9999, "speed_limit", Category::Core, Specialization::Countable, |
| 155 | true, true}; | ||
| 150 | 156 | ||
| 151 | // Cpu | 157 | // Cpu |
| 152 | SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto, | 158 | SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto, |
| @@ -192,9 +198,10 @@ struct Values { | |||
| 192 | linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, | 198 | linkage, RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, |
| 193 | "backend", Category::Renderer}; | 199 | "backend", Category::Renderer}; |
| 194 | SwitchableSetting<ShaderBackend, true> shader_backend{ | 200 | SwitchableSetting<ShaderBackend, true> shader_backend{ |
| 195 | linkage, ShaderBackend::Glsl, ShaderBackend::Glsl, ShaderBackend::SpirV, | 201 | linkage, ShaderBackend::Glsl, ShaderBackend::Glsl, ShaderBackend::SpirV, |
| 196 | "shader_backend", Category::Renderer}; | 202 | "shader_backend", Category::Renderer, Specialization::RuntimeList}; |
| 197 | SwitchableSetting<int> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer}; | 203 | SwitchableSetting<int> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer, |
| 204 | Specialization::RuntimeList}; | ||
| 198 | 205 | ||
| 199 | SwitchableSetting<bool> use_disk_shader_cache{linkage, true, "use_disk_shader_cache", | 206 | SwitchableSetting<bool> use_disk_shader_cache{linkage, true, "use_disk_shader_cache", |
| 200 | Category::Renderer}; | 207 | Category::Renderer}; |
| @@ -206,14 +213,10 @@ struct Values { | |||
| 206 | AstcDecodeMode::CpuAsynchronous, | 213 | AstcDecodeMode::CpuAsynchronous, |
| 207 | "accelerate_astc", | 214 | "accelerate_astc", |
| 208 | Category::Renderer}; | 215 | Category::Renderer}; |
| 209 | Setting<VSyncMode, true> vsync_mode{linkage, | 216 | Setting<VSyncMode, true> vsync_mode{ |
| 210 | VSyncMode::Fifo, | 217 | linkage, VSyncMode::Fifo, VSyncMode::Immediate, VSyncMode::FifoRelaxed, |
| 211 | VSyncMode::Immediate, | 218 | "use_vsync", Category::Renderer, Specialization::RuntimeList, true, |
| 212 | VSyncMode::FifoRelaxed, | 219 | true}; |
| 213 | "use_vsync", | ||
| 214 | Category::Renderer, | ||
| 215 | true, | ||
| 216 | true}; | ||
| 217 | SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::Gpu, | 220 | SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::Gpu, |
| 218 | "nvdec_emulation", Category::Renderer}; | 221 | "nvdec_emulation", Category::Renderer}; |
| 219 | // *nix platforms may have issues with the borderless windowed fullscreen mode. | 222 | // *nix platforms may have issues with the borderless windowed fullscreen mode. |
| @@ -228,6 +231,7 @@ struct Values { | |||
| 228 | FullscreenMode::Exclusive, | 231 | FullscreenMode::Exclusive, |
| 229 | "fullscreen_mode", | 232 | "fullscreen_mode", |
| 230 | Category::Renderer, | 233 | Category::Renderer, |
| 234 | Specialization::Default, | ||
| 231 | true, | 235 | true, |
| 232 | true}; | 236 | true}; |
| 233 | SwitchableSetting<AspectRatio, true> aspect_ratio{linkage, | 237 | SwitchableSetting<AspectRatio, true> aspect_ratio{linkage, |
| @@ -236,22 +240,37 @@ struct Values { | |||
| 236 | AspectRatio::Stretch, | 240 | AspectRatio::Stretch, |
| 237 | "aspect_ratio", | 241 | "aspect_ratio", |
| 238 | Category::Renderer, | 242 | Category::Renderer, |
| 243 | Specialization::Default, | ||
| 239 | true, | 244 | true, |
| 240 | true}; | 245 | true}; |
| 241 | 246 | ||
| 242 | ResolutionScalingInfo resolution_info{}; | 247 | ResolutionScalingInfo resolution_info{}; |
| 243 | SwitchableSetting<ResolutionSetup> resolution_setup{linkage, ResolutionSetup::Res1X, | 248 | SwitchableSetting<ResolutionSetup> resolution_setup{linkage, ResolutionSetup::Res1X, |
| 244 | "resolution_setup", Category::Renderer}; | 249 | "resolution_setup", Category::Renderer}; |
| 245 | SwitchableSetting<ScalingFilter> scaling_filter{ | 250 | SwitchableSetting<ScalingFilter> scaling_filter{linkage, |
| 246 | linkage, ScalingFilter::Bilinear, "scaling_filter", Category::Renderer, true, true}; | 251 | ScalingFilter::Bilinear, |
| 247 | SwitchableSetting<AntiAliasing> anti_aliasing{ | 252 | "scaling_filter", |
| 248 | linkage, AntiAliasing::None, "anti_aliasing", Category::Renderer, true, true}; | 253 | Category::Renderer, |
| 254 | Specialization::Default, | ||
| 255 | true, | ||
| 256 | true}; | ||
| 257 | SwitchableSetting<AntiAliasing> anti_aliasing{linkage, | ||
| 258 | AntiAliasing::None, | ||
| 259 | "anti_aliasing", | ||
| 260 | Category::Renderer, | ||
| 261 | Specialization::Default, | ||
| 262 | true, | ||
| 263 | true}; | ||
| 249 | SwitchableSetting<int, true> fsr_sharpening_slider{ | 264 | SwitchableSetting<int, true> fsr_sharpening_slider{ |
| 250 | linkage, 25, 0, 200, "fsr_sharpening_slider", Category::Renderer, true, true}; | 265 | linkage, 25, 0, 200, "fsr_sharpening_slider", Category::Renderer, Specialization::Scalar, |
| 266 | true, true}; | ||
| 251 | 267 | ||
| 252 | SwitchableSetting<u8, false> bg_red{linkage, 0, "bg_red", Category::Renderer, true, true}; | 268 | SwitchableSetting<u8, false> bg_red{ |
| 253 | SwitchableSetting<u8, false> bg_green{linkage, 0, "bg_green", Category::Renderer, true, true}; | 269 | linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true}; |
| 254 | SwitchableSetting<u8, false> bg_blue{linkage, 0, "bg_blue", Category::Renderer, true, true}; | 270 | SwitchableSetting<u8, false> bg_green{ |
| 271 | linkage, 0, "bg_green", Category::Renderer, Specialization::Default, true, true}; | ||
| 272 | SwitchableSetting<u8, false> bg_blue{ | ||
| 273 | linkage, 0, "bg_blue", Category::Renderer, Specialization::Default, true, true}; | ||
| 255 | 274 | ||
| 256 | SwitchableSetting<GpuAccuracy, true> gpu_accuracy{linkage, | 275 | SwitchableSetting<GpuAccuracy, true> gpu_accuracy{linkage, |
| 257 | GpuAccuracy::High, | 276 | GpuAccuracy::High, |
| @@ -259,6 +278,7 @@ struct Values { | |||
| 259 | GpuAccuracy::Extreme, | 278 | GpuAccuracy::Extreme, |
| 260 | "gpu_accuracy", | 279 | "gpu_accuracy", |
| 261 | Category::RendererAdvanced, | 280 | Category::RendererAdvanced, |
| 281 | Specialization::Default, | ||
| 262 | true, | 282 | true, |
| 263 | true}; | 283 | true}; |
| 264 | SwitchableSetting<AnisotropyMode, true> max_anisotropy{ | 284 | SwitchableSetting<AnisotropyMode, true> max_anisotropy{ |
| @@ -279,9 +299,15 @@ struct Values { | |||
| 279 | SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders", | 299 | SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders", |
| 280 | Category::RendererAdvanced}; | 300 | Category::RendererAdvanced}; |
| 281 | SwitchableSetting<bool> use_fast_gpu_time{ | 301 | SwitchableSetting<bool> use_fast_gpu_time{ |
| 282 | linkage, true, "use_fast_gpu_time", Category::RendererAdvanced, true, true}; | 302 | linkage, true, "use_fast_gpu_time", Category::RendererAdvanced, Specialization::Default, |
| 283 | SwitchableSetting<bool> use_vulkan_driver_pipeline_cache{ | 303 | true, true}; |
| 284 | linkage, true, "use_vulkan_driver_pipeline_cache", Category::RendererAdvanced, true, true}; | 304 | SwitchableSetting<bool> use_vulkan_driver_pipeline_cache{linkage, |
| 305 | true, | ||
| 306 | "use_vulkan_driver_pipeline_cache", | ||
| 307 | Category::RendererAdvanced, | ||
| 308 | Specialization::Default, | ||
| 309 | true, | ||
| 310 | true}; | ||
| 285 | SwitchableSetting<bool> enable_compute_pipelines{linkage, false, "enable_compute_pipelines", | 311 | SwitchableSetting<bool> enable_compute_pipelines{linkage, false, "enable_compute_pipelines", |
| 286 | Category::RendererAdvanced}; | 312 | Category::RendererAdvanced}; |
| 287 | SwitchableSetting<bool> use_video_framerate{linkage, false, "use_video_framerate", | 313 | SwitchableSetting<bool> use_video_framerate{linkage, false, "use_video_framerate", |
| @@ -310,15 +336,18 @@ struct Values { | |||
| 310 | TimeZone::Auto, TimeZone::Zulu, | 336 | TimeZone::Auto, TimeZone::Zulu, |
| 311 | "time_zone_index", Category::System}; | 337 | "time_zone_index", Category::System}; |
| 312 | // Measured in seconds since epoch | 338 | // Measured in seconds since epoch |
| 313 | SwitchableSetting<bool> custom_rtc_enabled{linkage, false, "custom_rtc_enabled", | 339 | SwitchableSetting<bool> custom_rtc_enabled{ |
| 314 | Category::System, true, true}; | 340 | linkage, false, "custom_rtc_enabled", Category::System, Specialization::Paired, true, true}; |
| 315 | SwitchableSetting<s64> custom_rtc{linkage, 0, "custom_rtc", Category::System, true, true}; | 341 | SwitchableSetting<s64> custom_rtc{ |
| 342 | linkage, 0, "custom_rtc", Category::System, Specialization::Time, true, true}; | ||
| 316 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` | 343 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` |
| 317 | s64 custom_rtc_differential; | 344 | s64 custom_rtc_differential; |
| 318 | SwitchableSetting<bool> rng_seed_enabled{linkage, false, "rng_seed_enabled", | 345 | SwitchableSetting<bool> rng_seed_enabled{ |
| 319 | Category::System, true, true}; | 346 | linkage, false, "rng_seed_enabled", Category::System, Specialization::Paired, true, true}; |
| 320 | SwitchableSetting<u32> rng_seed{linkage, 0, "rng_seed", Category::System, true, true}; | 347 | SwitchableSetting<u32> rng_seed{linkage, 0, "rng_seed", Category::System, Specialization::Hex, |
| 321 | Setting<std::string> device_name{linkage, "yuzu", "device_name", Category::System, true, true}; | 348 | true, true}; |
| 349 | Setting<std::string> device_name{ | ||
| 350 | linkage, "yuzu", "device_name", Category::System, Specialization::Default, true, true}; | ||
| 322 | 351 | ||
| 323 | Setting<s32> current_user{linkage, 0, "current_user", Category::System}; | 352 | Setting<s32> current_user{linkage, 0, "current_user", Category::System}; |
| 324 | 353 | ||
| @@ -327,12 +356,13 @@ struct Values { | |||
| 327 | // Controls | 356 | // Controls |
| 328 | InputSetting<std::array<PlayerInput, 10>> players; | 357 | InputSetting<std::array<PlayerInput, 10>> players; |
| 329 | 358 | ||
| 330 | Setting<bool> enable_raw_input{linkage, false, "enable_raw_input", Category::Controls, | 359 | Setting<bool> enable_raw_input{ |
| 360 | linkage, false, "enable_raw_input", Category::Controls, Specialization::Default, | ||
| 331 | // Only read/write enable_raw_input on Windows platforms | 361 | // Only read/write enable_raw_input on Windows platforms |
| 332 | #ifdef _WIN32 | 362 | #ifdef _WIN32 |
| 333 | true | 363 | true |
| 334 | #else | 364 | #else |
| 335 | false | 365 | false |
| 336 | #endif | 366 | #endif |
| 337 | }; | 367 | }; |
| 338 | Setting<bool> controller_navigation{linkage, true, "controller_navigation", Category::Controls}; | 368 | Setting<bool> controller_navigation{linkage, true, "controller_navigation", Category::Controls}; |
| @@ -354,7 +384,8 @@ struct Values { | |||
| 354 | Setting<bool> tas_enable{linkage, false, "tas_enable", Category::Controls}; | 384 | Setting<bool> tas_enable{linkage, false, "tas_enable", Category::Controls}; |
| 355 | Setting<bool> tas_loop{linkage, false, "tas_loop", Category::Controls}; | 385 | Setting<bool> tas_loop{linkage, false, "tas_loop", Category::Controls}; |
| 356 | 386 | ||
| 357 | Setting<bool> mouse_panning{linkage, false, "mouse_panning", Category::Controls, false}; | 387 | Setting<bool> mouse_panning{ |
| 388 | linkage, false, "mouse_panning", Category::Controls, Specialization::Default, false}; | ||
| 358 | Setting<u8, true> mouse_panning_sensitivity{ | 389 | Setting<u8, true> mouse_panning_sensitivity{ |
| 359 | linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls}; | 390 | linkage, 50, 1, 100, "mouse_panning_sensitivity", Category::Controls}; |
| 360 | Setting<bool> mouse_enabled{linkage, false, "mouse_enabled", Category::Controls}; | 391 | Setting<bool> mouse_enabled{linkage, false, "mouse_enabled", Category::Controls}; |
| @@ -410,19 +441,24 @@ struct Values { | |||
| 410 | Setting<std::string> program_args{linkage, std::string(), "program_args", Category::Debugging}; | 441 | Setting<std::string> program_args{linkage, std::string(), "program_args", Category::Debugging}; |
| 411 | Setting<bool> dump_exefs{linkage, false, "dump_exefs", Category::Debugging}; | 442 | Setting<bool> dump_exefs{linkage, false, "dump_exefs", Category::Debugging}; |
| 412 | Setting<bool> dump_nso{linkage, false, "dump_nso", Category::Debugging}; | 443 | Setting<bool> dump_nso{linkage, false, "dump_nso", Category::Debugging}; |
| 413 | Setting<bool> dump_shaders{linkage, false, "dump_shaders", Category::DebuggingGraphics, false}; | 444 | Setting<bool> dump_shaders{ |
| 414 | Setting<bool> dump_macros{linkage, false, "dump_macros", Category::DebuggingGraphics, false}; | 445 | linkage, false, "dump_shaders", Category::DebuggingGraphics, Specialization::Default, |
| 446 | false}; | ||
| 447 | Setting<bool> dump_macros{ | ||
| 448 | linkage, false, "dump_macros", Category::DebuggingGraphics, Specialization::Default, false}; | ||
| 415 | Setting<bool> enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging}; | 449 | Setting<bool> enable_fs_access_log{linkage, false, "enable_fs_access_log", Category::Debugging}; |
| 416 | Setting<bool> reporting_services{linkage, false, "reporting_services", Category::Debugging, | 450 | Setting<bool> reporting_services{ |
| 417 | false}; | 451 | linkage, false, "reporting_services", Category::Debugging, Specialization::Default, false}; |
| 418 | Setting<bool> quest_flag{linkage, false, "quest_flag", Category::Debugging}; | 452 | Setting<bool> quest_flag{linkage, false, "quest_flag", Category::Debugging}; |
| 419 | Setting<bool> disable_macro_jit{linkage, false, "disable_macro_jit", | 453 | Setting<bool> disable_macro_jit{linkage, false, "disable_macro_jit", |
| 420 | Category::DebuggingGraphics}; | 454 | Category::DebuggingGraphics}; |
| 421 | Setting<bool> disable_macro_hle{linkage, false, "disable_macro_hle", | 455 | Setting<bool> disable_macro_hle{linkage, false, "disable_macro_hle", |
| 422 | Category::DebuggingGraphics}; | 456 | Category::DebuggingGraphics}; |
| 423 | Setting<bool> extended_logging{linkage, false, "extended_logging", Category::Debugging, false}; | 457 | Setting<bool> extended_logging{ |
| 458 | linkage, false, "extended_logging", Category::Debugging, Specialization::Default, false}; | ||
| 424 | Setting<bool> use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging}; | 459 | Setting<bool> use_debug_asserts{linkage, false, "use_debug_asserts", Category::Debugging}; |
| 425 | Setting<bool> use_auto_stub{linkage, false, "use_auto_stub", Category::Debugging, false}; | 460 | Setting<bool> use_auto_stub{ |
| 461 | linkage, false, "use_auto_stub", Category::Debugging, Specialization::Default, false}; | ||
| 426 | Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers", | 462 | Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers", |
| 427 | Category::Debugging}; | 463 | Category::Debugging}; |
| 428 | Setting<bool> create_crash_dumps{linkage, false, "create_crash_dumps", Category::Debugging}; | 464 | Setting<bool> create_crash_dumps{linkage, false, "create_crash_dumps", Category::Debugging}; |
diff --git a/src/common/settings_common.cpp b/src/common/settings_common.cpp index fb42991fa..3e86c7347 100644 --- a/src/common/settings_common.cpp +++ b/src/common/settings_common.cpp | |||
| @@ -7,9 +7,10 @@ | |||
| 7 | namespace Settings { | 7 | namespace Settings { |
| 8 | 8 | ||
| 9 | BasicSetting::BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, | 9 | BasicSetting::BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, |
| 10 | bool save_, bool runtime_modifiable_) | 10 | bool save_, bool runtime_modifiable_, |
| 11 | : label{name}, category{category_}, id{linkage.count}, save{save_}, runtime_modifiable{ | 11 | enum Specialization specialization_) |
| 12 | runtime_modifiable_} { | 12 | : label{name}, category{category_}, id{linkage.count}, save{save_}, |
| 13 | runtime_modifiable{runtime_modifiable_}, specialization{specialization_} { | ||
| 13 | linkage.by_category[category].push_front(this); | 14 | linkage.by_category[category].push_front(this); |
| 14 | linkage.count++; | 15 | linkage.count++; |
| 15 | } | 16 | } |
| @@ -38,6 +39,10 @@ Category BasicSetting::Category() const { | |||
| 38 | return category; | 39 | return category; |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 42 | Specialization BasicSetting::Specialization() const { | ||
| 43 | return specialization; | ||
| 44 | } | ||
| 45 | |||
| 41 | const std::string& BasicSetting::GetLabel() const { | 46 | const std::string& BasicSetting::GetLabel() const { |
| 42 | return label; | 47 | return label; |
| 43 | } | 48 | } |
diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 2b5c72f41..664c807f1 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h | |||
| @@ -43,6 +43,17 @@ enum class Category : u32 { | |||
| 43 | MaxEnum, | 43 | MaxEnum, |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | enum class Specialization : u32 { | ||
| 47 | Default, | ||
| 48 | Time, | ||
| 49 | Hex, | ||
| 50 | List, | ||
| 51 | RuntimeList, | ||
| 52 | Scalar, | ||
| 53 | Countable, | ||
| 54 | Paired, | ||
| 55 | }; | ||
| 56 | |||
| 46 | bool IsConfiguringGlobal(); | 57 | bool IsConfiguringGlobal(); |
| 47 | void SetConfiguringGlobal(bool is_global); | 58 | void SetConfiguringGlobal(bool is_global); |
| 48 | 59 | ||
| @@ -64,7 +75,7 @@ public: | |||
| 64 | class BasicSetting { | 75 | class BasicSetting { |
| 65 | protected: | 76 | protected: |
| 66 | explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, | 77 | explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, |
| 67 | bool save_, bool runtime_modifiable_); | 78 | bool save_, bool runtime_modifiable_, Specialization spec); |
| 68 | 79 | ||
| 69 | public: | 80 | public: |
| 70 | virtual ~BasicSetting(); | 81 | virtual ~BasicSetting(); |
| @@ -181,6 +192,11 @@ public: | |||
| 181 | [[nodiscard]] enum Category Category() const; | 192 | [[nodiscard]] enum Category Category() const; |
| 182 | 193 | ||
| 183 | /** | 194 | /** |
| 195 | * @returns Extra metadata for data representation in frontend implementations. | ||
| 196 | */ | ||
| 197 | [[nodiscard]] enum Specialization Specialization() const; | ||
| 198 | |||
| 199 | /** | ||
| 184 | * Returns the label this setting was created with. | 200 | * Returns the label this setting was created with. |
| 185 | * | 201 | * |
| 186 | * @returns A reference to the label | 202 | * @returns A reference to the label |
| @@ -219,6 +235,8 @@ private: | |||
| 219 | const bool save; ///< Suggests if the setting should be saved and read to a frontend config | 235 | const bool save; ///< Suggests if the setting should be saved and read to a frontend config |
| 220 | const bool | 236 | const bool |
| 221 | runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running | 237 | runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running |
| 238 | const enum Specialization | ||
| 239 | specialization; ///< Extra data to identify representation of a setting | ||
| 222 | }; | 240 | }; |
| 223 | 241 | ||
| 224 | } // namespace Settings | 242 | } // namespace Settings |
diff --git a/src/common/settings_setting.h b/src/common/settings_setting.h index a0a05da54..9805a5b5d 100644 --- a/src/common/settings_setting.h +++ b/src/common/settings_setting.h | |||
| @@ -35,10 +35,12 @@ public: | |||
| 35 | * @param category_ Category of the setting AKA INI group | 35 | * @param category_ Category of the setting AKA INI group |
| 36 | */ | 36 | */ |
| 37 | explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name, | 37 | explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name, |
| 38 | enum Category category_, bool save_ = true, bool runtime_modifiable_ = false) | 38 | enum Category category_, |
| 39 | enum Specialization specialization = Specialization::Default, | ||
| 40 | bool save_ = true, bool runtime_modifiable_ = false) | ||
| 39 | requires(!ranged) | 41 | requires(!ranged) |
| 40 | : BasicSetting(linkage, name, category_, save_, runtime_modifiable_), value{default_val}, | 42 | : BasicSetting(linkage, name, category_, save_, runtime_modifiable_, specialization), |
| 41 | default_value{default_val} {} | 43 | value{default_val}, default_value{default_val} {} |
| 42 | virtual ~Setting() = default; | 44 | virtual ~Setting() = default; |
| 43 | 45 | ||
| 44 | /** | 46 | /** |
| @@ -53,10 +55,11 @@ public: | |||
| 53 | */ | 55 | */ |
| 54 | explicit Setting(Linkage& linkage, const Type& default_val, const Type& min_val, | 56 | explicit Setting(Linkage& linkage, const Type& default_val, const Type& min_val, |
| 55 | const Type& max_val, const std::string& name, enum Category category_, | 57 | const Type& max_val, const std::string& name, enum Category category_, |
| 58 | enum Specialization specialization = Specialization::Default, | ||
| 56 | bool save_ = true, bool runtime_modifiable_ = false) | 59 | bool save_ = true, bool runtime_modifiable_ = false) |
| 57 | requires(ranged) | 60 | requires(ranged) |
| 58 | : BasicSetting(linkage, name, category_, save_, runtime_modifiable_), value{default_val}, | 61 | : BasicSetting(linkage, name, category_, save_, runtime_modifiable_, specialization), |
| 59 | default_value{default_val}, maximum{max_val}, minimum{min_val} {} | 62 | value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val} {} |
| 60 | 63 | ||
| 61 | /** | 64 | /** |
| 62 | * Returns a reference to the setting's value. | 65 | * Returns a reference to the setting's value. |
| @@ -230,10 +233,12 @@ public: | |||
| 230 | * @param category_ Category of the setting AKA INI group | 233 | * @param category_ Category of the setting AKA INI group |
| 231 | */ | 234 | */ |
| 232 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name, | 235 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name, |
| 233 | Category category_, bool save_ = true, | 236 | Category category_, |
| 234 | bool runtime_modifiable_ = false) | 237 | enum Specialization specialization = Specialization::Default, |
| 238 | bool save_ = true, bool runtime_modifiable_ = false) | ||
| 235 | requires(!ranged) | 239 | requires(!ranged) |
| 236 | : Setting<Type, false>{linkage, default_val, name, category_, save_, runtime_modifiable_} { | 240 | : Setting<Type, false>{linkage, default_val, name, category_, specialization, |
| 241 | save_, runtime_modifiable_} { | ||
| 237 | linkage.restore_functions.emplace_back([this]() { this->SetGlobal(true); }); | 242 | linkage.restore_functions.emplace_back([this]() { this->SetGlobal(true); }); |
| 238 | } | 243 | } |
| 239 | virtual ~SwitchableSetting() = default; | 244 | virtual ~SwitchableSetting() = default; |
| @@ -250,10 +255,12 @@ public: | |||
| 250 | */ | 255 | */ |
| 251 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val, | 256 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val, |
| 252 | const Type& max_val, const std::string& name, Category category_, | 257 | const Type& max_val, const std::string& name, Category category_, |
| 258 | enum Specialization specialization = Specialization::Default, | ||
| 253 | bool save_ = true, bool runtime_modifiable_ = false) | 259 | bool save_ = true, bool runtime_modifiable_ = false) |
| 254 | requires(ranged) | 260 | requires(ranged) |
| 255 | : Setting<Type, true>{linkage, default_val, min_val, max_val, | 261 | : Setting<Type, true>{linkage, default_val, min_val, |
| 256 | name, category_, save_, runtime_modifiable_} { | 262 | max_val, name, category_, |
| 263 | specialization, save_, runtime_modifiable_} { | ||
| 257 | linkage.restore_functions.emplace_back([this]() { this->SetGlobal(true); }); | 264 | linkage.restore_functions.emplace_back([this]() { this->SetGlobal(true); }); |
| 258 | } | 265 | } |
| 259 | 266 | ||