diff options
Diffstat (limited to 'src/input_common')
-rw-r--r-- | src/input_common/main.h | 10 | ||||
-rw-r--r-- | src/input_common/settings.cpp | 7 | ||||
-rw-r--r-- | src/input_common/settings.h | 17 |
3 files changed, 33 insertions, 1 deletions
diff --git a/src/input_common/main.h b/src/input_common/main.h index f3fbf696e..18f44dcc3 100644 --- a/src/input_common/main.h +++ b/src/input_common/main.h @@ -21,10 +21,14 @@ namespace Settings::NativeButton { enum Values : int; } +namespace Settings::NativeMotion { +enum Values : int; +} + namespace InputCommon { namespace Polling { -enum class DeviceType { Button, AnalogPreferred }; +enum class DeviceType { Button, AnalogPreferred, Motion }; /** * A class that can be used to get inputs from an input device like controllers without having to @@ -59,6 +63,7 @@ class MotionEmu; */ using AnalogMapping = std::unordered_map<Settings::NativeAnalog::Values, Common::ParamPackage>; using ButtonMapping = std::unordered_map<Settings::NativeButton::Values, Common::ParamPackage>; +using MotionMapping = std::unordered_map<Settings::NativeMotion::Values, Common::ParamPackage>; class InputSubsystem { public: @@ -103,6 +108,9 @@ public: /// Retrieves the button mappings for the given device. [[nodiscard]] ButtonMapping GetButtonMappingForDevice(const Common::ParamPackage& device) const; + /// Retrieves the motion mappings for the given device. + [[nodiscard]] MotionMapping GetMotionMappingForDevice(const Common::ParamPackage& device) const; + /// Retrieves the underlying GameCube analog handler. [[nodiscard]] GCAnalogFactory* GetGCAnalogs(); diff --git a/src/input_common/settings.cpp b/src/input_common/settings.cpp index 80c719cf4..b66c05856 100644 --- a/src/input_common/settings.cpp +++ b/src/input_common/settings.cpp @@ -14,6 +14,13 @@ const std::array<const char*, NumButtons> mapping = {{ }}; } +namespace NativeMotion { +const std::array<const char*, NumMotions> mapping = {{ + "motionleft", + "motionright", +}}; +} + namespace NativeAnalog { const std::array<const char*, NumAnalogs> mapping = {{ "lstick", diff --git a/src/input_common/settings.h b/src/input_common/settings.h index 2d258960b..ab0b95cf1 100644 --- a/src/input_common/settings.h +++ b/src/input_common/settings.h @@ -66,6 +66,21 @@ constexpr int NUM_STICKS_HID = NumAnalogs; extern const std::array<const char*, NumAnalogs> mapping; } // namespace NativeAnalog +namespace NativeMotion { +enum Values : int { + MOTIONLEFT, + MOTIONRIGHT, + + NumMotions, +}; + +constexpr int MOTION_HID_BEGIN = MOTIONLEFT; +constexpr int MOTION_HID_END = NumMotions; +constexpr int NUM_MOTION_HID = NumMotions; + +extern const std::array<const char*, NumMotions> mapping; +} // namespace NativeMotion + namespace NativeMouseButton { enum Values { Left, @@ -292,6 +307,7 @@ constexpr int NUM_KEYBOARD_MODS_HID = NumKeyboardMods; using ButtonsRaw = std::array<std::string, NativeButton::NumButtons>; using AnalogsRaw = std::array<std::string, NativeAnalog::NumAnalogs>; +using MotionRaw = std::array<std::string, NativeMotion::NumMotions>; using MouseButtonsRaw = std::array<std::string, NativeMouseButton::NumMouseButtons>; using KeyboardKeysRaw = std::array<std::string, NativeKeyboard::NumKeyboardKeys>; using KeyboardModsRaw = std::array<std::string, NativeKeyboard::NumKeyboardMods>; @@ -314,6 +330,7 @@ struct PlayerInput { ControllerType controller_type; ButtonsRaw buttons; AnalogsRaw analogs; + MotionRaw motions; std::string lstick_mod; std::string rstick_mod; |