diff options
Diffstat (limited to 'src/core/settings.h')
| -rw-r--r-- | src/core/settings.h | 171 |
1 files changed, 98 insertions, 73 deletions
diff --git a/src/core/settings.h b/src/core/settings.h index a598ccbc1..3eb336f75 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -346,31 +346,6 @@ struct TouchscreenInput { | |||
| 346 | u32 rotation_angle; | 346 | u32 rotation_angle; |
| 347 | }; | 347 | }; |
| 348 | 348 | ||
| 349 | enum class NANDTotalSize : u64 { | ||
| 350 | S29_1GB = 0x747C00000ULL, | ||
| 351 | }; | ||
| 352 | |||
| 353 | enum class NANDUserSize : u64 { | ||
| 354 | S26GB = 0x680000000ULL, | ||
| 355 | }; | ||
| 356 | |||
| 357 | enum class NANDSystemSize : u64 { | ||
| 358 | S2_5GB = 0xA0000000, | ||
| 359 | }; | ||
| 360 | |||
| 361 | enum class SDMCSize : u64 { | ||
| 362 | S1GB = 0x40000000, | ||
| 363 | S2GB = 0x80000000, | ||
| 364 | S4GB = 0x100000000ULL, | ||
| 365 | S8GB = 0x200000000ULL, | ||
| 366 | S16GB = 0x400000000ULL, | ||
| 367 | S32GB = 0x800000000ULL, | ||
| 368 | S64GB = 0x1000000000ULL, | ||
| 369 | S128GB = 0x2000000000ULL, | ||
| 370 | S256GB = 0x4000000000ULL, | ||
| 371 | S1TB = 0x10000000000ULL, | ||
| 372 | }; | ||
| 373 | |||
| 374 | enum class RendererBackend { | 349 | enum class RendererBackend { |
| 375 | OpenGL = 0, | 350 | OpenGL = 0, |
| 376 | Vulkan = 1, | 351 | Vulkan = 1, |
| @@ -382,20 +357,102 @@ enum class GPUAccuracy : u32 { | |||
| 382 | Extreme = 2, | 357 | Extreme = 2, |
| 383 | }; | 358 | }; |
| 384 | 359 | ||
| 360 | enum class CPUAccuracy { | ||
| 361 | Accurate = 0, | ||
| 362 | DebugMode = 1, | ||
| 363 | }; | ||
| 364 | |||
| 365 | extern bool configuring_global; | ||
| 366 | |||
| 367 | template <typename Type> | ||
| 368 | class Setting final { | ||
| 369 | public: | ||
| 370 | Setting() = default; | ||
| 371 | explicit Setting(Type val) : global{val} {} | ||
| 372 | ~Setting() = default; | ||
| 373 | void SetGlobal(bool to_global) { | ||
| 374 | use_global = to_global; | ||
| 375 | } | ||
| 376 | bool UsingGlobal() const { | ||
| 377 | return use_global; | ||
| 378 | } | ||
| 379 | Type GetValue(bool need_global = false) const { | ||
| 380 | if (use_global || need_global) { | ||
| 381 | return global; | ||
| 382 | } | ||
| 383 | return local; | ||
| 384 | } | ||
| 385 | void SetValue(const Type& value) { | ||
| 386 | if (use_global) { | ||
| 387 | global = value; | ||
| 388 | } else { | ||
| 389 | local = value; | ||
| 390 | } | ||
| 391 | } | ||
| 392 | |||
| 393 | private: | ||
| 394 | bool use_global = true; | ||
| 395 | Type global{}; | ||
| 396 | Type local{}; | ||
| 397 | }; | ||
| 398 | |||
| 385 | struct Values { | 399 | struct Values { |
| 400 | // Audio | ||
| 401 | std::string audio_device_id; | ||
| 402 | std::string sink_id; | ||
| 403 | bool audio_muted; | ||
| 404 | Setting<bool> enable_audio_stretching; | ||
| 405 | Setting<float> volume; | ||
| 406 | |||
| 407 | // Core | ||
| 408 | Setting<bool> use_multi_core; | ||
| 409 | |||
| 410 | // Cpu | ||
| 411 | CPUAccuracy cpu_accuracy; | ||
| 412 | |||
| 413 | bool cpuopt_page_tables; | ||
| 414 | bool cpuopt_block_linking; | ||
| 415 | bool cpuopt_return_stack_buffer; | ||
| 416 | bool cpuopt_fast_dispatcher; | ||
| 417 | bool cpuopt_context_elimination; | ||
| 418 | bool cpuopt_const_prop; | ||
| 419 | bool cpuopt_misc_ir; | ||
| 420 | bool cpuopt_reduce_misalign_checks; | ||
| 421 | |||
| 422 | // Renderer | ||
| 423 | Setting<RendererBackend> renderer_backend; | ||
| 424 | bool renderer_debug; | ||
| 425 | Setting<int> vulkan_device; | ||
| 426 | |||
| 427 | Setting<u16> resolution_factor = Setting(static_cast<u16>(1)); | ||
| 428 | Setting<int> aspect_ratio; | ||
| 429 | Setting<int> max_anisotropy; | ||
| 430 | Setting<bool> use_frame_limit; | ||
| 431 | Setting<u16> frame_limit; | ||
| 432 | Setting<bool> use_disk_shader_cache; | ||
| 433 | Setting<GPUAccuracy> gpu_accuracy; | ||
| 434 | Setting<bool> use_asynchronous_gpu_emulation; | ||
| 435 | Setting<bool> use_vsync; | ||
| 436 | Setting<bool> use_assembly_shaders; | ||
| 437 | Setting<bool> force_30fps_mode; | ||
| 438 | Setting<bool> use_fast_gpu_time; | ||
| 439 | |||
| 440 | Setting<float> bg_red; | ||
| 441 | Setting<float> bg_green; | ||
| 442 | Setting<float> bg_blue; | ||
| 443 | |||
| 386 | // System | 444 | // System |
| 387 | bool use_docked_mode; | 445 | Setting<std::optional<u32>> rng_seed; |
| 388 | std::optional<u32> rng_seed; | ||
| 389 | // Measured in seconds since epoch | 446 | // Measured in seconds since epoch |
| 390 | std::optional<std::chrono::seconds> custom_rtc; | 447 | Setting<std::optional<std::chrono::seconds>> custom_rtc; |
| 391 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` | 448 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` |
| 392 | std::chrono::seconds custom_rtc_differential; | 449 | std::chrono::seconds custom_rtc_differential; |
| 393 | 450 | ||
| 394 | s32 current_user; | 451 | s32 current_user; |
| 395 | s32 language_index; | 452 | Setting<s32> language_index; |
| 396 | s32 region_index; | 453 | Setting<s32> region_index; |
| 397 | s32 time_zone_index; | 454 | Setting<s32> time_zone_index; |
| 398 | s32 sound_index; | 455 | Setting<s32> sound_index; |
| 399 | 456 | ||
| 400 | // Controls | 457 | // Controls |
| 401 | std::array<PlayerInput, 10> players; | 458 | std::array<PlayerInput, 10> players; |
| @@ -419,51 +476,13 @@ struct Values { | |||
| 419 | u16 udp_input_port; | 476 | u16 udp_input_port; |
| 420 | u8 udp_pad_index; | 477 | u8 udp_pad_index; |
| 421 | 478 | ||
| 422 | // Core | 479 | bool use_docked_mode; |
| 423 | bool use_multi_core; | ||
| 424 | 480 | ||
| 425 | // Data Storage | 481 | // Data Storage |
| 426 | bool use_virtual_sd; | 482 | bool use_virtual_sd; |
| 427 | bool gamecard_inserted; | 483 | bool gamecard_inserted; |
| 428 | bool gamecard_current_game; | 484 | bool gamecard_current_game; |
| 429 | std::string gamecard_path; | 485 | std::string gamecard_path; |
| 430 | NANDTotalSize nand_total_size; | ||
| 431 | NANDSystemSize nand_system_size; | ||
| 432 | NANDUserSize nand_user_size; | ||
| 433 | SDMCSize sdmc_size; | ||
| 434 | |||
| 435 | // Renderer | ||
| 436 | RendererBackend renderer_backend; | ||
| 437 | bool renderer_debug; | ||
| 438 | int vulkan_device; | ||
| 439 | |||
| 440 | u16 resolution_factor{1}; | ||
| 441 | int aspect_ratio; | ||
| 442 | int max_anisotropy; | ||
| 443 | bool use_frame_limit; | ||
| 444 | u16 frame_limit; | ||
| 445 | bool use_disk_shader_cache; | ||
| 446 | GPUAccuracy gpu_accuracy; | ||
| 447 | bool use_asynchronous_gpu_emulation; | ||
| 448 | bool use_vsync; | ||
| 449 | bool use_assembly_shaders; | ||
| 450 | bool force_30fps_mode; | ||
| 451 | bool use_fast_gpu_time; | ||
| 452 | |||
| 453 | float bg_red; | ||
| 454 | float bg_green; | ||
| 455 | float bg_blue; | ||
| 456 | |||
| 457 | std::string log_filter; | ||
| 458 | |||
| 459 | bool use_dev_keys; | ||
| 460 | |||
| 461 | // Audio | ||
| 462 | bool audio_muted; | ||
| 463 | std::string sink_id; | ||
| 464 | bool enable_audio_stretching; | ||
| 465 | std::string audio_device_id; | ||
| 466 | float volume; | ||
| 467 | 486 | ||
| 468 | // Debugging | 487 | // Debugging |
| 469 | bool record_frame_times; | 488 | bool record_frame_times; |
| @@ -474,10 +493,13 @@ struct Values { | |||
| 474 | bool dump_nso; | 493 | bool dump_nso; |
| 475 | bool reporting_services; | 494 | bool reporting_services; |
| 476 | bool quest_flag; | 495 | bool quest_flag; |
| 477 | bool disable_cpu_opt; | ||
| 478 | bool disable_macro_jit; | 496 | bool disable_macro_jit; |
| 479 | 497 | ||
| 480 | // BCAT | 498 | // Misceallaneous |
| 499 | std::string log_filter; | ||
| 500 | bool use_dev_keys; | ||
| 501 | |||
| 502 | // Services | ||
| 481 | std::string bcat_backend; | 503 | std::string bcat_backend; |
| 482 | bool bcat_boxcat_local; | 504 | bool bcat_boxcat_local; |
| 483 | 505 | ||
| @@ -501,4 +523,7 @@ std::string GetTimeZoneString(); | |||
| 501 | void Apply(); | 523 | void Apply(); |
| 502 | void LogSettings(); | 524 | void LogSettings(); |
| 503 | 525 | ||
| 526 | // Restore the global state of all applicable settings in the Values struct | ||
| 527 | void RestoreGlobalState(); | ||
| 528 | |||
| 504 | } // namespace Settings | 529 | } // namespace Settings |