From c77454b9d009e3e45b1b140743338f3063fc1656 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Thu, 1 Nov 2018 21:54:16 -0400 Subject: settings: Add settings for multiple players and controllers Uses the PlayerInput struct to represent all of the data that constitutes a player. --- src/core/settings.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) (limited to 'src/core/settings.h') 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; } // namespace NativeKeyboard +using ButtonsRaw = std::array; +using AnalogsRaw = std::array; +using MouseButtonsRaw = std::array; +using KeyboardKeysRaw = std::array; +using KeyboardModsRaw = std::array; + +constexpr u32 JOYCON_BODY_NEON_RED = 0xFF3C28; +constexpr u32 JOYCON_BUTTONS_NEON_RED = 0x1E0A0A; +constexpr u32 JOYCON_BODY_NEON_BLUE = 0x0AB9E6; +constexpr u32 JOYCON_BUTTONS_NEON_BLUE = 0x001E1E; + +enum class ControllerType { + ProController, + DualJoycon, + RightJoycon, + LeftJoycon, +}; + +struct PlayerInput { + bool connected; + ControllerType type; + ButtonsRaw buttons; + AnalogsRaw analogs; + + u32 body_color_right; + u32 button_color_right; + u32 body_color_left; + u32 button_color_left; +}; + +struct TouchscreenInput { + bool enabled; + std::string device; + + u32 finger; + u32 diameter_x; + u32 diameter_y; + u32 rotation_angle; +}; + struct Values { // System bool use_docked_mode; @@ -350,8 +390,8 @@ struct Values { s32 language_index; // Controls - std::array buttons; - std::array analogs; + std::array players; + bool mouse_enabled; std::string mouse_device; MouseButtonsRaw mouse_buttons; @@ -359,8 +399,13 @@ struct Values { bool keyboard_enabled; KeyboardKeysRaw keyboard_keys; KeyboardModsRaw keyboard_mods; + + bool debug_pad_enabled; + ButtonsRaw debug_pad_buttons; + AnalogsRaw debug_pad_analogs; + std::string motion_device; - std::string touch_device; + TouchscreenInput touchscreen; std::atomic_bool is_device_reload_pending{true}; // Core -- cgit v1.2.3