diff options
Diffstat (limited to '')
| -rw-r--r-- | src/common/settings.h | 101 |
1 files changed, 57 insertions, 44 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 82ec18e27..dd2d8d4d8 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -37,8 +37,9 @@ enum class CPUAccuracy : u32 { | |||
| 37 | template <typename Type> | 37 | template <typename Type> |
| 38 | class Setting final { | 38 | class Setting final { |
| 39 | public: | 39 | public: |
| 40 | Setting() = default; | 40 | explicit Setting(Type val) : global{val} { |
| 41 | explicit Setting(Type val) : global{val} {} | 41 | default_value = val; |
| 42 | } | ||
| 42 | ~Setting() = default; | 43 | ~Setting() = default; |
| 43 | void SetGlobal(bool to_global) { | 44 | void SetGlobal(bool to_global) { |
| 44 | use_global = to_global; | 45 | use_global = to_global; |
| @@ -59,11 +60,15 @@ public: | |||
| 59 | local = value; | 60 | local = value; |
| 60 | } | 61 | } |
| 61 | } | 62 | } |
| 63 | Type GetDefault() const { | ||
| 64 | return default_value; | ||
| 65 | } | ||
| 62 | 66 | ||
| 63 | private: | 67 | private: |
| 64 | bool use_global = true; | 68 | bool use_global = true; |
| 65 | Type global{}; | 69 | Type global{}; |
| 66 | Type local{}; | 70 | Type local{}; |
| 71 | Type default_value{}; | ||
| 67 | }; | 72 | }; |
| 68 | 73 | ||
| 69 | /** | 74 | /** |
| @@ -108,14 +113,14 @@ struct Values { | |||
| 108 | std::string audio_device_id; | 113 | std::string audio_device_id; |
| 109 | std::string sink_id; | 114 | std::string sink_id; |
| 110 | bool audio_muted; | 115 | bool audio_muted; |
| 111 | Setting<bool> enable_audio_stretching; | 116 | Setting<bool> enable_audio_stretching{true}; |
| 112 | Setting<float> volume; | 117 | Setting<float> volume{1.0f}; |
| 113 | 118 | ||
| 114 | // Core | 119 | // Core |
| 115 | Setting<bool> use_multi_core; | 120 | Setting<bool> use_multi_core{true}; |
| 116 | 121 | ||
| 117 | // Cpu | 122 | // Cpu |
| 118 | Setting<CPUAccuracy> cpu_accuracy; | 123 | Setting<CPUAccuracy> cpu_accuracy{CPUAccuracy::Accurate}; |
| 119 | 124 | ||
| 120 | bool cpuopt_page_tables; | 125 | bool cpuopt_page_tables; |
| 121 | bool cpuopt_block_linking; | 126 | bool cpuopt_block_linking; |
| @@ -127,61 +132,69 @@ struct Values { | |||
| 127 | bool cpuopt_reduce_misalign_checks; | 132 | bool cpuopt_reduce_misalign_checks; |
| 128 | bool cpuopt_fastmem; | 133 | bool cpuopt_fastmem; |
| 129 | 134 | ||
| 130 | Setting<bool> cpuopt_unsafe_unfuse_fma; | 135 | Setting<bool> cpuopt_unsafe_unfuse_fma{true}; |
| 131 | Setting<bool> cpuopt_unsafe_reduce_fp_error; | 136 | Setting<bool> cpuopt_unsafe_reduce_fp_error{true}; |
| 132 | Setting<bool> cpuopt_unsafe_ignore_standard_fpcr; | 137 | Setting<bool> cpuopt_unsafe_ignore_standard_fpcr{true}; |
| 133 | Setting<bool> cpuopt_unsafe_inaccurate_nan; | 138 | Setting<bool> cpuopt_unsafe_inaccurate_nan{true}; |
| 134 | Setting<bool> cpuopt_unsafe_fastmem_check; | 139 | Setting<bool> cpuopt_unsafe_fastmem_check{true}; |
| 135 | 140 | ||
| 136 | // Renderer | 141 | // Renderer |
| 137 | Setting<RendererBackend> renderer_backend; | 142 | Setting<RendererBackend> renderer_backend{RendererBackend::OpenGL}; |
| 138 | bool renderer_debug; | 143 | bool renderer_debug; |
| 139 | Setting<int> vulkan_device; | 144 | Setting<int> vulkan_device{0}; |
| 140 | 145 | ||
| 141 | Setting<u16> resolution_factor{1}; | 146 | Setting<u16> resolution_factor{0}; |
| 142 | Setting<int> fullscreen_mode; | 147 | // *nix platforms may have issues with the borderless windowed fullscreen mode. |
| 143 | Setting<int> aspect_ratio; | 148 | // Default to exclusive fullscreen on these platforms for now. |
| 144 | Setting<int> max_anisotropy; | 149 | Setting<int> fullscreen_mode{ |
| 145 | Setting<bool> use_frame_limit; | 150 | #ifdef _WIN32 |
| 146 | Setting<u16> frame_limit; | 151 | 0 |
| 147 | Setting<bool> use_disk_shader_cache; | 152 | #else |
| 148 | Setting<GPUAccuracy> gpu_accuracy; | 153 | 1 |
| 149 | Setting<bool> use_asynchronous_gpu_emulation; | 154 | #endif |
| 150 | Setting<bool> use_nvdec_emulation; | 155 | }; |
| 151 | Setting<bool> accelerate_astc; | 156 | Setting<int> aspect_ratio{0}; |
| 152 | Setting<bool> use_vsync; | 157 | Setting<int> max_anisotropy{0}; |
| 153 | Setting<bool> disable_fps_limit; | 158 | Setting<bool> use_frame_limit{true}; |
| 154 | Setting<bool> use_assembly_shaders; | 159 | Setting<u16> frame_limit{100}; |
| 155 | Setting<bool> use_asynchronous_shaders; | 160 | Setting<bool> use_disk_shader_cache{true}; |
| 156 | Setting<bool> use_fast_gpu_time; | 161 | Setting<GPUAccuracy> gpu_accuracy{GPUAccuracy::High}; |
| 157 | Setting<bool> use_caches_gc; | 162 | Setting<bool> use_asynchronous_gpu_emulation{true}; |
| 158 | 163 | Setting<bool> use_nvdec_emulation{true}; | |
| 159 | Setting<float> bg_red; | 164 | Setting<bool> accelerate_astc{true}; |
| 160 | Setting<float> bg_green; | 165 | Setting<bool> use_vsync{true}; |
| 161 | Setting<float> bg_blue; | 166 | Setting<bool> disable_fps_limit{false}; |
| 167 | Setting<bool> use_assembly_shaders{false}; | ||
| 168 | Setting<bool> use_asynchronous_shaders{false}; | ||
| 169 | Setting<bool> use_fast_gpu_time{true}; | ||
| 170 | Setting<bool> use_caches_gc{false}; | ||
| 171 | |||
| 172 | Setting<float> bg_red{0.0f}; | ||
| 173 | Setting<float> bg_green{0.0f}; | ||
| 174 | Setting<float> bg_blue{0.0f}; | ||
| 162 | 175 | ||
| 163 | // System | 176 | // System |
| 164 | Setting<std::optional<u32>> rng_seed; | 177 | Setting<std::optional<u32>> rng_seed{std::optional<u32>()}; |
| 165 | // Measured in seconds since epoch | 178 | // Measured in seconds since epoch |
| 166 | std::optional<std::chrono::seconds> custom_rtc; | 179 | std::optional<std::chrono::seconds> custom_rtc; |
| 167 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` | 180 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` |
| 168 | std::chrono::seconds custom_rtc_differential; | 181 | std::chrono::seconds custom_rtc_differential; |
| 169 | 182 | ||
| 170 | s32 current_user; | 183 | s32 current_user; |
| 171 | Setting<s32> language_index; | 184 | Setting<s32> language_index{1}; |
| 172 | Setting<s32> region_index; | 185 | Setting<s32> region_index{1}; |
| 173 | Setting<s32> time_zone_index; | 186 | Setting<s32> time_zone_index{0}; |
| 174 | Setting<s32> sound_index; | 187 | Setting<s32> sound_index{1}; |
| 175 | 188 | ||
| 176 | // Controls | 189 | // Controls |
| 177 | InputSetting<std::array<PlayerInput, 10>> players; | 190 | InputSetting<std::array<PlayerInput, 10>> players; |
| 178 | 191 | ||
| 179 | Setting<bool> use_docked_mode; | 192 | Setting<bool> use_docked_mode{true}; |
| 180 | 193 | ||
| 181 | Setting<bool> vibration_enabled; | 194 | Setting<bool> vibration_enabled{true}; |
| 182 | Setting<bool> enable_accurate_vibrations; | 195 | Setting<bool> enable_accurate_vibrations{false}; |
| 183 | 196 | ||
| 184 | Setting<bool> motion_enabled; | 197 | Setting<bool> motion_enabled{true}; |
| 185 | std::string motion_device; | 198 | std::string motion_device; |
| 186 | std::string udp_input_servers; | 199 | std::string udp_input_servers; |
| 187 | 200 | ||