diff options
| author | 2021-12-18 13:57:14 +0800 | |
|---|---|---|
| committer | 2021-12-18 13:57:14 +0800 | |
| commit | e49184e6069a9d791d2df3c1958f5c4b1187e124 (patch) | |
| tree | b776caf722e0be0e680f67b0ad0842628162ef1c /src/yuzu_cmd/config.cpp | |
| parent | Implement convert legacy to generic (diff) | |
| parent | Merge pull request #7570 from ameerj/favorites-expanded (diff) | |
| download | yuzu-e49184e6069a9d791d2df3c1958f5c4b1187e124.tar.gz yuzu-e49184e6069a9d791d2df3c1958f5c4b1187e124.tar.xz yuzu-e49184e6069a9d791d2df3c1958f5c4b1187e124.zip | |
Merge branch 'yuzu-emu:master' into convert_legacy
Diffstat (limited to 'src/yuzu_cmd/config.cpp')
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 178 |
1 files changed, 0 insertions, 178 deletions
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 33241ea98..8e9c7d211 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include "common/settings.h" | 24 | #include "common/settings.h" |
| 25 | #include "core/hle/service/acc/profile_manager.h" | 25 | #include "core/hle/service/acc/profile_manager.h" |
| 26 | #include "input_common/main.h" | 26 | #include "input_common/main.h" |
| 27 | #include "input_common/udp/client.h" | ||
| 28 | #include "yuzu_cmd/config.h" | 27 | #include "yuzu_cmd/config.h" |
| 29 | #include "yuzu_cmd/default_ini.h" | 28 | #include "yuzu_cmd/default_ini.h" |
| 30 | 29 | ||
| @@ -84,163 +83,6 @@ static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> | |||
| 84 | }, | 83 | }, |
| 85 | }}; | 84 | }}; |
| 86 | 85 | ||
| 87 | static const std::array<int, Settings::NativeMouseButton::NumMouseButtons> default_mouse_buttons = { | ||
| 88 | SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_APOSTROPHE, | ||
| 89 | SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, | ||
| 90 | }; | ||
| 91 | |||
| 92 | static const std::array<int, 0x8A> keyboard_keys = { | ||
| 93 | 0, | ||
| 94 | 0, | ||
| 95 | 0, | ||
| 96 | 0, | ||
| 97 | SDL_SCANCODE_A, | ||
| 98 | SDL_SCANCODE_B, | ||
| 99 | SDL_SCANCODE_C, | ||
| 100 | SDL_SCANCODE_D, | ||
| 101 | SDL_SCANCODE_E, | ||
| 102 | SDL_SCANCODE_F, | ||
| 103 | SDL_SCANCODE_G, | ||
| 104 | SDL_SCANCODE_H, | ||
| 105 | SDL_SCANCODE_I, | ||
| 106 | SDL_SCANCODE_J, | ||
| 107 | SDL_SCANCODE_K, | ||
| 108 | SDL_SCANCODE_L, | ||
| 109 | SDL_SCANCODE_M, | ||
| 110 | SDL_SCANCODE_N, | ||
| 111 | SDL_SCANCODE_O, | ||
| 112 | SDL_SCANCODE_P, | ||
| 113 | SDL_SCANCODE_Q, | ||
| 114 | SDL_SCANCODE_R, | ||
| 115 | SDL_SCANCODE_S, | ||
| 116 | SDL_SCANCODE_T, | ||
| 117 | SDL_SCANCODE_U, | ||
| 118 | SDL_SCANCODE_V, | ||
| 119 | SDL_SCANCODE_W, | ||
| 120 | SDL_SCANCODE_X, | ||
| 121 | SDL_SCANCODE_Y, | ||
| 122 | SDL_SCANCODE_Z, | ||
| 123 | SDL_SCANCODE_1, | ||
| 124 | SDL_SCANCODE_2, | ||
| 125 | SDL_SCANCODE_3, | ||
| 126 | SDL_SCANCODE_4, | ||
| 127 | SDL_SCANCODE_5, | ||
| 128 | SDL_SCANCODE_6, | ||
| 129 | SDL_SCANCODE_7, | ||
| 130 | SDL_SCANCODE_8, | ||
| 131 | SDL_SCANCODE_9, | ||
| 132 | SDL_SCANCODE_0, | ||
| 133 | SDL_SCANCODE_RETURN, | ||
| 134 | SDL_SCANCODE_ESCAPE, | ||
| 135 | SDL_SCANCODE_BACKSPACE, | ||
| 136 | SDL_SCANCODE_TAB, | ||
| 137 | SDL_SCANCODE_SPACE, | ||
| 138 | SDL_SCANCODE_MINUS, | ||
| 139 | SDL_SCANCODE_EQUALS, | ||
| 140 | SDL_SCANCODE_LEFTBRACKET, | ||
| 141 | SDL_SCANCODE_RIGHTBRACKET, | ||
| 142 | SDL_SCANCODE_BACKSLASH, | ||
| 143 | 0, | ||
| 144 | SDL_SCANCODE_SEMICOLON, | ||
| 145 | SDL_SCANCODE_APOSTROPHE, | ||
| 146 | SDL_SCANCODE_GRAVE, | ||
| 147 | SDL_SCANCODE_COMMA, | ||
| 148 | SDL_SCANCODE_PERIOD, | ||
| 149 | SDL_SCANCODE_SLASH, | ||
| 150 | SDL_SCANCODE_CAPSLOCK, | ||
| 151 | |||
| 152 | SDL_SCANCODE_F1, | ||
| 153 | SDL_SCANCODE_F2, | ||
| 154 | SDL_SCANCODE_F3, | ||
| 155 | SDL_SCANCODE_F4, | ||
| 156 | SDL_SCANCODE_F5, | ||
| 157 | SDL_SCANCODE_F6, | ||
| 158 | SDL_SCANCODE_F7, | ||
| 159 | SDL_SCANCODE_F8, | ||
| 160 | SDL_SCANCODE_F9, | ||
| 161 | SDL_SCANCODE_F10, | ||
| 162 | SDL_SCANCODE_F11, | ||
| 163 | SDL_SCANCODE_F12, | ||
| 164 | |||
| 165 | 0, | ||
| 166 | SDL_SCANCODE_SCROLLLOCK, | ||
| 167 | SDL_SCANCODE_PAUSE, | ||
| 168 | SDL_SCANCODE_INSERT, | ||
| 169 | SDL_SCANCODE_HOME, | ||
| 170 | SDL_SCANCODE_PAGEUP, | ||
| 171 | SDL_SCANCODE_DELETE, | ||
| 172 | SDL_SCANCODE_END, | ||
| 173 | SDL_SCANCODE_PAGEDOWN, | ||
| 174 | SDL_SCANCODE_RIGHT, | ||
| 175 | SDL_SCANCODE_LEFT, | ||
| 176 | SDL_SCANCODE_DOWN, | ||
| 177 | SDL_SCANCODE_UP, | ||
| 178 | |||
| 179 | SDL_SCANCODE_NUMLOCKCLEAR, | ||
| 180 | SDL_SCANCODE_KP_DIVIDE, | ||
| 181 | SDL_SCANCODE_KP_MULTIPLY, | ||
| 182 | SDL_SCANCODE_KP_MINUS, | ||
| 183 | SDL_SCANCODE_KP_PLUS, | ||
| 184 | SDL_SCANCODE_KP_ENTER, | ||
| 185 | SDL_SCANCODE_KP_1, | ||
| 186 | SDL_SCANCODE_KP_2, | ||
| 187 | SDL_SCANCODE_KP_3, | ||
| 188 | SDL_SCANCODE_KP_4, | ||
| 189 | SDL_SCANCODE_KP_5, | ||
| 190 | SDL_SCANCODE_KP_6, | ||
| 191 | SDL_SCANCODE_KP_7, | ||
| 192 | SDL_SCANCODE_KP_8, | ||
| 193 | SDL_SCANCODE_KP_9, | ||
| 194 | SDL_SCANCODE_KP_0, | ||
| 195 | SDL_SCANCODE_KP_PERIOD, | ||
| 196 | |||
| 197 | 0, | ||
| 198 | 0, | ||
| 199 | SDL_SCANCODE_POWER, | ||
| 200 | SDL_SCANCODE_KP_EQUALS, | ||
| 201 | |||
| 202 | SDL_SCANCODE_F13, | ||
| 203 | SDL_SCANCODE_F14, | ||
| 204 | SDL_SCANCODE_F15, | ||
| 205 | SDL_SCANCODE_F16, | ||
| 206 | SDL_SCANCODE_F17, | ||
| 207 | SDL_SCANCODE_F18, | ||
| 208 | SDL_SCANCODE_F19, | ||
| 209 | SDL_SCANCODE_F20, | ||
| 210 | SDL_SCANCODE_F21, | ||
| 211 | SDL_SCANCODE_F22, | ||
| 212 | SDL_SCANCODE_F23, | ||
| 213 | SDL_SCANCODE_F24, | ||
| 214 | |||
| 215 | 0, | ||
| 216 | SDL_SCANCODE_HELP, | ||
| 217 | SDL_SCANCODE_MENU, | ||
| 218 | 0, | ||
| 219 | 0, | ||
| 220 | 0, | ||
| 221 | 0, | ||
| 222 | 0, | ||
| 223 | 0, | ||
| 224 | 0, | ||
| 225 | 0, | ||
| 226 | 0, | ||
| 227 | 0, | ||
| 228 | 0, | ||
| 229 | 0, | ||
| 230 | SDL_SCANCODE_KP_COMMA, | ||
| 231 | SDL_SCANCODE_KP_LEFTPAREN, | ||
| 232 | SDL_SCANCODE_KP_RIGHTPAREN, | ||
| 233 | 0, | ||
| 234 | 0, | ||
| 235 | 0, | ||
| 236 | 0, | ||
| 237 | }; | ||
| 238 | |||
| 239 | static const std::array<int, 8> keyboard_mods{ | ||
| 240 | SDL_SCANCODE_LCTRL, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_LALT, SDL_SCANCODE_LGUI, | ||
| 241 | SDL_SCANCODE_RCTRL, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_RALT, SDL_SCANCODE_RGUI, | ||
| 242 | }; | ||
| 243 | |||
| 244 | template <> | 86 | template <> |
| 245 | void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) { | 87 | void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) { |
| 246 | setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault()); | 88 | setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault()); |
| @@ -284,16 +126,6 @@ void Config::ReadValues() { | |||
| 284 | } | 126 | } |
| 285 | 127 | ||
| 286 | ReadSetting("ControlsGeneral", Settings::values.mouse_enabled); | 128 | ReadSetting("ControlsGeneral", Settings::values.mouse_enabled); |
| 287 | for (int i = 0; i < Settings::NativeMouseButton::NumMouseButtons; ++i) { | ||
| 288 | std::string default_param = InputCommon::GenerateKeyboardParam(default_mouse_buttons[i]); | ||
| 289 | Settings::values.mouse_buttons[i] = sdl2_config->Get( | ||
| 290 | "ControlsGeneral", std::string("mouse_") + Settings::NativeMouseButton::mapping[i], | ||
| 291 | default_param); | ||
| 292 | if (Settings::values.mouse_buttons[i].empty()) | ||
| 293 | Settings::values.mouse_buttons[i] = default_param; | ||
| 294 | } | ||
| 295 | |||
| 296 | ReadSetting("ControlsGeneral", Settings::values.motion_device); | ||
| 297 | 129 | ||
| 298 | ReadSetting("ControlsGeneral", Settings::values.touch_device); | 130 | ReadSetting("ControlsGeneral", Settings::values.touch_device); |
| 299 | 131 | ||
| @@ -363,21 +195,11 @@ void Config::ReadValues() { | |||
| 363 | Settings::TouchFromButtonMap{"default", {}}); | 195 | Settings::TouchFromButtonMap{"default", {}}); |
| 364 | num_touch_from_button_maps = 1; | 196 | num_touch_from_button_maps = 1; |
| 365 | } | 197 | } |
| 366 | ReadSetting("ControlsGeneral", Settings::values.use_touch_from_button); | ||
| 367 | Settings::values.touch_from_button_map_index = std::clamp( | 198 | Settings::values.touch_from_button_map_index = std::clamp( |
| 368 | Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1); | 199 | Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1); |
| 369 | 200 | ||
| 370 | ReadSetting("ControlsGeneral", Settings::values.udp_input_servers); | 201 | ReadSetting("ControlsGeneral", Settings::values.udp_input_servers); |
| 371 | 202 | ||
| 372 | std::transform(keyboard_keys.begin(), keyboard_keys.end(), | ||
| 373 | Settings::values.keyboard_keys.begin(), InputCommon::GenerateKeyboardParam); | ||
| 374 | std::transform(keyboard_mods.begin(), keyboard_mods.end(), | ||
| 375 | Settings::values.keyboard_keys.begin() + | ||
| 376 | Settings::NativeKeyboard::LeftControlKey, | ||
| 377 | InputCommon::GenerateKeyboardParam); | ||
| 378 | std::transform(keyboard_mods.begin(), keyboard_mods.end(), | ||
| 379 | Settings::values.keyboard_mods.begin(), InputCommon::GenerateKeyboardParam); | ||
| 380 | |||
| 381 | // Data Storage | 203 | // Data Storage |
| 382 | ReadSetting("Data Storage", Settings::values.use_virtual_sd); | 204 | ReadSetting("Data Storage", Settings::values.use_virtual_sd); |
| 383 | FS::SetYuzuPath(FS::YuzuPath::NANDDir, | 205 | FS::SetYuzuPath(FS::YuzuPath::NANDDir, |