diff options
Diffstat (limited to 'src/core/settings.h')
| -rw-r--r-- | src/core/settings.h | 58 |
1 files changed, 47 insertions, 11 deletions
diff --git a/src/core/settings.h b/src/core/settings.h index 28616a574..476c3fdf3 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -65,6 +65,38 @@ private: | |||
| 65 | Type local{}; | 65 | Type local{}; |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | /** | ||
| 69 | * The InputSetting class allows for getting a reference to either the global or local members. | ||
| 70 | * This is required as we cannot easily modify the values of user-defined types within containers | ||
| 71 | * using the SetValue() member function found in the Setting class. The primary purpose of this | ||
| 72 | * class is to store an array of 10 PlayerInput structs for both the global and local (per-game) | ||
| 73 | * setting and allows for easily accessing and modifying both settings. | ||
| 74 | */ | ||
| 75 | template <typename Type> | ||
| 76 | class InputSetting final { | ||
| 77 | public: | ||
| 78 | InputSetting() = default; | ||
| 79 | explicit InputSetting(Type val) : global{val} {} | ||
| 80 | ~InputSetting() = default; | ||
| 81 | void SetGlobal(bool to_global) { | ||
| 82 | use_global = to_global; | ||
| 83 | } | ||
| 84 | bool UsingGlobal() const { | ||
| 85 | return use_global; | ||
| 86 | } | ||
| 87 | Type& GetValue(bool need_global = false) { | ||
| 88 | if (use_global || need_global) { | ||
| 89 | return global; | ||
| 90 | } | ||
| 91 | return local; | ||
| 92 | } | ||
| 93 | |||
| 94 | private: | ||
| 95 | bool use_global = true; | ||
| 96 | Type global{}; | ||
| 97 | Type local{}; | ||
| 98 | }; | ||
| 99 | |||
| 68 | struct TouchFromButtonMap { | 100 | struct TouchFromButtonMap { |
| 69 | std::string name; | 101 | std::string name; |
| 70 | std::vector<std::string> buttons; | 102 | std::vector<std::string> buttons; |
| @@ -133,9 +165,18 @@ struct Values { | |||
| 133 | Setting<s32> sound_index; | 165 | Setting<s32> sound_index; |
| 134 | 166 | ||
| 135 | // Controls | 167 | // Controls |
| 136 | std::array<PlayerInput, 10> players; | 168 | InputSetting<std::array<PlayerInput, 10>> players; |
| 169 | |||
| 170 | Setting<bool> use_docked_mode; | ||
| 137 | 171 | ||
| 138 | bool use_docked_mode; | 172 | Setting<bool> vibration_enabled; |
| 173 | Setting<bool> enable_accurate_vibrations; | ||
| 174 | |||
| 175 | Setting<bool> motion_enabled; | ||
| 176 | std::string motion_device; | ||
| 177 | std::string udp_input_address; | ||
| 178 | u16 udp_input_port; | ||
| 179 | u8 udp_pad_index; | ||
| 139 | 180 | ||
| 140 | bool mouse_enabled; | 181 | bool mouse_enabled; |
| 141 | std::string mouse_device; | 182 | std::string mouse_device; |
| @@ -149,20 +190,15 @@ struct Values { | |||
| 149 | ButtonsRaw debug_pad_buttons; | 190 | ButtonsRaw debug_pad_buttons; |
| 150 | AnalogsRaw debug_pad_analogs; | 191 | AnalogsRaw debug_pad_analogs; |
| 151 | 192 | ||
| 152 | bool vibration_enabled; | ||
| 153 | |||
| 154 | bool motion_enabled; | ||
| 155 | std::string motion_device; | ||
| 156 | std::string touch_device; | ||
| 157 | TouchscreenInput touchscreen; | 193 | TouchscreenInput touchscreen; |
| 158 | std::atomic_bool is_device_reload_pending{true}; | 194 | |
| 159 | bool use_touch_from_button; | 195 | bool use_touch_from_button; |
| 196 | std::string touch_device; | ||
| 160 | int touch_from_button_map_index; | 197 | int touch_from_button_map_index; |
| 161 | std::string udp_input_address; | ||
| 162 | u16 udp_input_port; | ||
| 163 | u8 udp_pad_index; | ||
| 164 | std::vector<TouchFromButtonMap> touch_from_button_maps; | 198 | std::vector<TouchFromButtonMap> touch_from_button_maps; |
| 165 | 199 | ||
| 200 | std::atomic_bool is_device_reload_pending{true}; | ||
| 201 | |||
| 166 | // Data Storage | 202 | // Data Storage |
| 167 | bool use_virtual_sd; | 203 | bool use_virtual_sd; |
| 168 | bool gamecard_inserted; | 204 | bool gamecard_inserted; |