diff options
| author | 2021-01-10 22:09:56 -0700 | |
|---|---|---|
| committer | 2021-01-10 22:09:56 -0700 | |
| commit | 7a3c884e39fccfbb498b855080bffabc9ce2e7f1 (patch) | |
| tree | 5056f9406dec188439cb0deb87603498243a9412 /src/core/settings.h | |
| parent | More forgetting... duh (diff) | |
| parent | Merge pull request #5229 from Morph1984/fullscreen-opt (diff) | |
| download | yuzu-7a3c884e39fccfbb498b855080bffabc9ce2e7f1.tar.gz yuzu-7a3c884e39fccfbb498b855080bffabc9ce2e7f1.tar.xz yuzu-7a3c884e39fccfbb498b855080bffabc9ce2e7f1.zip | |
Merge remote-tracking branch 'upstream/master' into int-flags
Diffstat (limited to 'src/core/settings.h')
| -rw-r--r-- | src/core/settings.h | 87 |
1 files changed, 65 insertions, 22 deletions
diff --git a/src/core/settings.h b/src/core/settings.h index 9834f44bb..a324530bd 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -14,6 +14,10 @@ | |||
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "input_common/settings.h" | 15 | #include "input_common/settings.h" |
| 16 | 16 | ||
| 17 | namespace Core { | ||
| 18 | class System; | ||
| 19 | } | ||
| 20 | |||
| 17 | namespace Settings { | 21 | namespace Settings { |
| 18 | 22 | ||
| 19 | enum class RendererBackend { | 23 | enum class RendererBackend { |
| @@ -33,8 +37,6 @@ enum class CPUAccuracy { | |||
| 33 | DebugMode = 2, | 37 | DebugMode = 2, |
| 34 | }; | 38 | }; |
| 35 | 39 | ||
| 36 | extern bool configuring_global; | ||
| 37 | |||
| 38 | template <typename Type> | 40 | template <typename Type> |
| 39 | class Setting final { | 41 | class Setting final { |
| 40 | public: | 42 | public: |
| @@ -67,6 +69,38 @@ private: | |||
| 67 | Type local{}; | 69 | Type local{}; |
| 68 | }; | 70 | }; |
| 69 | 71 | ||
| 72 | /** | ||
| 73 | * The InputSetting class allows for getting a reference to either the global or local members. | ||
| 74 | * This is required as we cannot easily modify the values of user-defined types within containers | ||
| 75 | * using the SetValue() member function found in the Setting class. The primary purpose of this | ||
| 76 | * class is to store an array of 10 PlayerInput structs for both the global and local (per-game) | ||
| 77 | * setting and allows for easily accessing and modifying both settings. | ||
| 78 | */ | ||
| 79 | template <typename Type> | ||
| 80 | class InputSetting final { | ||
| 81 | public: | ||
| 82 | InputSetting() = default; | ||
| 83 | explicit InputSetting(Type val) : global{val} {} | ||
| 84 | ~InputSetting() = default; | ||
| 85 | void SetGlobal(bool to_global) { | ||
| 86 | use_global = to_global; | ||
| 87 | } | ||
| 88 | bool UsingGlobal() const { | ||
| 89 | return use_global; | ||
| 90 | } | ||
| 91 | Type& GetValue(bool need_global = false) { | ||
| 92 | if (use_global || need_global) { | ||
| 93 | return global; | ||
| 94 | } | ||
| 95 | return local; | ||
| 96 | } | ||
| 97 | |||
| 98 | private: | ||
| 99 | bool use_global = true; | ||
| 100 | Type global{}; | ||
| 101 | Type local{}; | ||
| 102 | }; | ||
| 103 | |||
| 70 | struct TouchFromButtonMap { | 104 | struct TouchFromButtonMap { |
| 71 | std::string name; | 105 | std::string name; |
| 72 | std::vector<std::string> buttons; | 106 | std::vector<std::string> buttons; |
| @@ -97,13 +131,14 @@ struct Values { | |||
| 97 | 131 | ||
| 98 | bool cpuopt_unsafe_unfuse_fma; | 132 | bool cpuopt_unsafe_unfuse_fma; |
| 99 | bool cpuopt_unsafe_reduce_fp_error; | 133 | bool cpuopt_unsafe_reduce_fp_error; |
| 134 | bool cpuopt_unsafe_inaccurate_nan; | ||
| 100 | 135 | ||
| 101 | // Renderer | 136 | // Renderer |
| 102 | Setting<RendererBackend> renderer_backend; | 137 | Setting<RendererBackend> renderer_backend; |
| 103 | bool renderer_debug; | 138 | bool renderer_debug; |
| 104 | Setting<int> vulkan_device; | 139 | Setting<int> vulkan_device; |
| 105 | 140 | ||
| 106 | Setting<u16> resolution_factor = Setting(static_cast<u16>(1)); | 141 | Setting<u16> resolution_factor{1}; |
| 107 | Setting<int> aspect_ratio; | 142 | Setting<int> aspect_ratio; |
| 108 | Setting<int> max_anisotropy; | 143 | Setting<int> max_anisotropy; |
| 109 | Setting<bool> use_frame_limit; | 144 | Setting<bool> use_frame_limit; |
| @@ -111,6 +146,7 @@ struct Values { | |||
| 111 | Setting<bool> use_disk_shader_cache; | 146 | Setting<bool> use_disk_shader_cache; |
| 112 | Setting<GPUAccuracy> gpu_accuracy; | 147 | Setting<GPUAccuracy> gpu_accuracy; |
| 113 | Setting<bool> use_asynchronous_gpu_emulation; | 148 | Setting<bool> use_asynchronous_gpu_emulation; |
| 149 | Setting<bool> use_nvdec_emulation; | ||
| 114 | Setting<bool> use_vsync; | 150 | Setting<bool> use_vsync; |
| 115 | Setting<bool> use_assembly_shaders; | 151 | Setting<bool> use_assembly_shaders; |
| 116 | Setting<bool> use_asynchronous_shaders; | 152 | Setting<bool> use_asynchronous_shaders; |
| @@ -134,9 +170,18 @@ struct Values { | |||
| 134 | Setting<s32> sound_index; | 170 | Setting<s32> sound_index; |
| 135 | 171 | ||
| 136 | // Controls | 172 | // Controls |
| 137 | std::array<PlayerInput, 10> players; | 173 | InputSetting<std::array<PlayerInput, 10>> players; |
| 174 | |||
| 175 | Setting<bool> use_docked_mode; | ||
| 176 | |||
| 177 | Setting<bool> vibration_enabled; | ||
| 178 | Setting<bool> enable_accurate_vibrations; | ||
| 179 | |||
| 180 | Setting<bool> motion_enabled; | ||
| 181 | std::string motion_device; | ||
| 182 | std::string udp_input_servers; | ||
| 138 | 183 | ||
| 139 | bool use_docked_mode; | 184 | bool emulate_analog_keyboard; |
| 140 | 185 | ||
| 141 | bool mouse_enabled; | 186 | bool mouse_enabled; |
| 142 | std::string mouse_device; | 187 | std::string mouse_device; |
| @@ -150,20 +195,15 @@ struct Values { | |||
| 150 | ButtonsRaw debug_pad_buttons; | 195 | ButtonsRaw debug_pad_buttons; |
| 151 | AnalogsRaw debug_pad_analogs; | 196 | AnalogsRaw debug_pad_analogs; |
| 152 | 197 | ||
| 153 | bool vibration_enabled; | ||
| 154 | |||
| 155 | bool motion_enabled; | ||
| 156 | std::string motion_device; | ||
| 157 | std::string touch_device; | ||
| 158 | TouchscreenInput touchscreen; | 198 | TouchscreenInput touchscreen; |
| 159 | std::atomic_bool is_device_reload_pending{true}; | 199 | |
| 160 | bool use_touch_from_button; | 200 | bool use_touch_from_button; |
| 201 | std::string touch_device; | ||
| 161 | int touch_from_button_map_index; | 202 | int touch_from_button_map_index; |
| 162 | std::string udp_input_address; | ||
| 163 | u16 udp_input_port; | ||
| 164 | u8 udp_pad_index; | ||
| 165 | std::vector<TouchFromButtonMap> touch_from_button_maps; | 203 | std::vector<TouchFromButtonMap> touch_from_button_maps; |
| 166 | 204 | ||
| 205 | std::atomic_bool is_device_reload_pending{true}; | ||
| 206 | |||
| 167 | // Data Storage | 207 | // Data Storage |
| 168 | bool use_virtual_sd; | 208 | bool use_virtual_sd; |
| 169 | bool gamecard_inserted; | 209 | bool gamecard_inserted; |
| @@ -180,8 +220,9 @@ struct Values { | |||
| 180 | bool reporting_services; | 220 | bool reporting_services; |
| 181 | bool quest_flag; | 221 | bool quest_flag; |
| 182 | bool disable_macro_jit; | 222 | bool disable_macro_jit; |
| 223 | bool extended_logging; | ||
| 183 | 224 | ||
| 184 | // Misceallaneous | 225 | // Miscellaneous |
| 185 | std::string log_filter; | 226 | std::string log_filter; |
| 186 | bool use_dev_keys; | 227 | bool use_dev_keys; |
| 187 | 228 | ||
| @@ -197,22 +238,24 @@ struct Values { | |||
| 197 | 238 | ||
| 198 | // Add-Ons | 239 | // Add-Ons |
| 199 | std::map<u64, std::vector<std::string>> disabled_addons; | 240 | std::map<u64, std::vector<std::string>> disabled_addons; |
| 200 | } extern values; | 241 | }; |
| 201 | 242 | ||
| 202 | float Volume(); | 243 | extern Values values; |
| 244 | |||
| 245 | bool IsConfiguringGlobal(); | ||
| 246 | void SetConfiguringGlobal(bool is_global); | ||
| 203 | 247 | ||
| 204 | bool IsGPULevelExtreme(); | 248 | bool IsGPULevelExtreme(); |
| 205 | bool IsGPULevelHigh(); | 249 | bool IsGPULevelHigh(); |
| 206 | 250 | ||
| 251 | float Volume(); | ||
| 252 | |||
| 207 | std::string GetTimeZoneString(); | 253 | std::string GetTimeZoneString(); |
| 208 | 254 | ||
| 209 | void Apply(); | 255 | void Apply(Core::System& system); |
| 210 | void LogSettings(); | 256 | void LogSettings(); |
| 211 | 257 | ||
| 212 | // Restore the global state of all applicable settings in the Values struct | 258 | // Restore the global state of all applicable settings in the Values struct |
| 213 | void RestoreGlobalState(); | 259 | void RestoreGlobalState(bool is_powered_on); |
| 214 | |||
| 215 | // Fixes settings that are known to cause issues with the emulator | ||
| 216 | void Sanitize(); | ||
| 217 | 260 | ||
| 218 | } // namespace Settings | 261 | } // namespace Settings |