diff options
| author | 2018-11-01 21:54:16 -0400 | |
|---|---|---|
| committer | 2018-11-18 23:21:33 -0500 | |
| commit | c77454b9d009e3e45b1b140743338f3063fc1656 (patch) | |
| tree | e42c10b46f0ccd50f90388ac9b26b1ff9c334d19 | |
| parent | settings: Add Native type for keyboard (diff) | |
| download | yuzu-c77454b9d009e3e45b1b140743338f3063fc1656.tar.gz yuzu-c77454b9d009e3e45b1b140743338f3063fc1656.tar.xz yuzu-c77454b9d009e3e45b1b140743338f3063fc1656.zip | |
settings: Add settings for multiple players and controllers
Uses the PlayerInput struct to represent all of the data that constitutes a player.
| -rw-r--r-- | src/core/settings.h | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/src/core/settings.h b/src/core/settings.h index 54a4859b9..9cc3c1dc8 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -341,6 +341,46 @@ constexpr int NUM_KEYBOARD_MODS_HID = NumKeyboardMods; | |||
| 341 | 341 | ||
| 342 | } // namespace NativeKeyboard | 342 | } // namespace NativeKeyboard |
| 343 | 343 | ||
| 344 | using ButtonsRaw = std::array<std::string, NativeButton::NumButtons>; | ||
| 345 | using AnalogsRaw = std::array<std::string, NativeAnalog::NumAnalogs>; | ||
| 346 | using MouseButtonsRaw = std::array<std::string, NativeMouseButton::NumMouseButtons>; | ||
| 347 | using KeyboardKeysRaw = std::array<std::string, NativeKeyboard::NumKeyboardKeys>; | ||
| 348 | using KeyboardModsRaw = std::array<std::string, NativeKeyboard::NumKeyboardMods>; | ||
| 349 | |||
| 350 | constexpr u32 JOYCON_BODY_NEON_RED = 0xFF3C28; | ||
| 351 | constexpr u32 JOYCON_BUTTONS_NEON_RED = 0x1E0A0A; | ||
| 352 | constexpr u32 JOYCON_BODY_NEON_BLUE = 0x0AB9E6; | ||
| 353 | constexpr u32 JOYCON_BUTTONS_NEON_BLUE = 0x001E1E; | ||
| 354 | |||
| 355 | enum class ControllerType { | ||
| 356 | ProController, | ||
| 357 | DualJoycon, | ||
| 358 | RightJoycon, | ||
| 359 | LeftJoycon, | ||
| 360 | }; | ||
| 361 | |||
| 362 | struct PlayerInput { | ||
| 363 | bool connected; | ||
| 364 | ControllerType type; | ||
| 365 | ButtonsRaw buttons; | ||
| 366 | AnalogsRaw analogs; | ||
| 367 | |||
| 368 | u32 body_color_right; | ||
| 369 | u32 button_color_right; | ||
| 370 | u32 body_color_left; | ||
| 371 | u32 button_color_left; | ||
| 372 | }; | ||
| 373 | |||
| 374 | struct TouchscreenInput { | ||
| 375 | bool enabled; | ||
| 376 | std::string device; | ||
| 377 | |||
| 378 | u32 finger; | ||
| 379 | u32 diameter_x; | ||
| 380 | u32 diameter_y; | ||
| 381 | u32 rotation_angle; | ||
| 382 | }; | ||
| 383 | |||
| 344 | struct Values { | 384 | struct Values { |
| 345 | // System | 385 | // System |
| 346 | bool use_docked_mode; | 386 | bool use_docked_mode; |
| @@ -350,8 +390,8 @@ struct Values { | |||
| 350 | s32 language_index; | 390 | s32 language_index; |
| 351 | 391 | ||
| 352 | // Controls | 392 | // Controls |
| 353 | std::array<std::string, NativeButton::NumButtons> buttons; | 393 | std::array<PlayerInput, 10> players; |
| 354 | std::array<std::string, NativeAnalog::NumAnalogs> analogs; | 394 | |
| 355 | bool mouse_enabled; | 395 | bool mouse_enabled; |
| 356 | std::string mouse_device; | 396 | std::string mouse_device; |
| 357 | MouseButtonsRaw mouse_buttons; | 397 | MouseButtonsRaw mouse_buttons; |
| @@ -359,8 +399,13 @@ struct Values { | |||
| 359 | bool keyboard_enabled; | 399 | bool keyboard_enabled; |
| 360 | KeyboardKeysRaw keyboard_keys; | 400 | KeyboardKeysRaw keyboard_keys; |
| 361 | KeyboardModsRaw keyboard_mods; | 401 | KeyboardModsRaw keyboard_mods; |
| 402 | |||
| 403 | bool debug_pad_enabled; | ||
| 404 | ButtonsRaw debug_pad_buttons; | ||
| 405 | AnalogsRaw debug_pad_analogs; | ||
| 406 | |||
| 362 | std::string motion_device; | 407 | std::string motion_device; |
| 363 | std::string touch_device; | 408 | TouchscreenInput touchscreen; |
| 364 | std::atomic_bool is_device_reload_pending{true}; | 409 | std::atomic_bool is_device_reload_pending{true}; |
| 365 | 410 | ||
| 366 | // Core | 411 | // Core |