diff options
author | german77 <juangerman-13@hotmail.com> | 2022-01-09 06:23:40 +0100 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2022-04-16 07:49:26 +0200 |
commit | d2f9412cf1717f884855af22793f3a1e5815c967 (patch) | |
tree | a1beab6c5d35dbfb8a58ef45f919e9d4a7d1d58d /src/core/hid/emulated_devices.h | |
parent | hidbus: Implement hidbus and ringcon (diff) | |
download | yuzu-d2f9412cf1717f884855af22793f3a1e5815c967.tar yuzu-d2f9412cf1717f884855af22793f3a1e5815c967.tar.gz yuzu-d2f9412cf1717f884855af22793f3a1e5815c967.tar.bz2 yuzu-d2f9412cf1717f884855af22793f3a1e5815c967.tar.lz yuzu-d2f9412cf1717f884855af22793f3a1e5815c967.tar.xz yuzu-d2f9412cf1717f884855af22793f3a1e5815c967.tar.zst yuzu-d2f9412cf1717f884855af22793f3a1e5815c967.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hid/emulated_devices.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/core/hid/emulated_devices.h b/src/core/hid/emulated_devices.h index 73e9f0293..fb6451e7a 100644 --- a/src/core/hid/emulated_devices.h +++ b/src/core/hid/emulated_devices.h @@ -26,9 +26,11 @@ using MouseButtonDevices = std::array<std::unique_ptr<Common::Input::InputDevice using MouseAnalogDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, Settings::NativeMouseWheel::NumMouseWheels>; using MouseStickDevice = std::unique_ptr<Common::Input::InputDevice>; +using RingAnalogDevice = std::unique_ptr<Common::Input::InputDevice>; using MouseButtonParams = std::array<Common::ParamPackage, Settings::NativeMouseButton::NumMouseButtons>; +using RingAnalogParams = Common::ParamPackage; using KeyboardValues = std::array<Common::Input::ButtonStatus, Settings::NativeKeyboard::NumKeyboardKeys>; @@ -39,12 +41,17 @@ using MouseButtonValues = using MouseAnalogValues = std::array<Common::Input::AnalogStatus, Settings::NativeMouseWheel::NumMouseWheels>; using MouseStickValue = Common::Input::TouchStatus; +using RingAnalogValue = Common::Input::AnalogStatus; struct MousePosition { f32 x; f32 y; }; +struct RingSensorForce { + f32 force; +}; + struct DeviceStatus { // Data from input_common KeyboardValues keyboard_values{}; @@ -52,6 +59,7 @@ struct DeviceStatus { MouseButtonValues mouse_button_values{}; MouseAnalogValues mouse_analog_values{}; MouseStickValue mouse_stick_value{}; + RingAnalogValue ring_analog_value{}; // Data for HID serices KeyboardKey keyboard_state{}; @@ -59,12 +67,14 @@ struct DeviceStatus { MouseButton mouse_button_state{}; MousePosition mouse_position_state{}; AnalogStickState mouse_wheel_state{}; + RingSensorForce ring_analog_state{}; }; enum class DeviceTriggerType { Keyboard, KeyboardModdifier, Mouse, + RingController, }; struct InterfaceUpdateCallback { @@ -110,6 +120,15 @@ public: /// Reverts any mapped changes made that weren't saved void RestoreConfig(); + // Returns the current mapped ring device + Common::ParamPackage GetRingParam() const; + + /** + * Updates the current mapped ring device + * @param param ParamPackage with ring sensor data to be mapped + */ + void SetRingParam(Common::ParamPackage param); + /// Returns the latest status of button input from the keyboard with parameters KeyboardValues GetKeyboardValues() const; @@ -119,6 +138,9 @@ public: /// Returns the latest status of button input from the mouse with parameters MouseButtonValues GetMouseButtonsValues() const; + /// Returns the latest status of analog input from the ring sensor with parameters + RingAnalogValue GetRingSensorValues() const; + /// Returns the latest status of button input from the keyboard KeyboardKey GetKeyboard() const; @@ -134,6 +156,9 @@ public: /// Returns the latest mouse wheel change AnalogStickState GetMouseWheel() const; + /// Returns the latest ringcon force sensor value + RingSensorForce GetRingSensorForce() const; + /** * Adds a callback to the list of events * @param update_callback InterfaceUpdateCallback that will be triggered @@ -186,6 +211,12 @@ private: void SetMouseStick(const Common::Input::CallbackStatus& callback); /** + * Updates the ring analog sensor status of the ring controller + * @param callback A CallbackStatus containing the force status + */ + void SetRingAnalog(const Common::Input::CallbackStatus& callback); + + /** * Triggers a callback that something has changed on the device status * @param type Input type of the event to trigger */ @@ -193,11 +224,14 @@ private: bool is_configuring{false}; + RingAnalogParams ring_params; + KeyboardDevices keyboard_devices; KeyboardModifierDevices keyboard_modifier_devices; MouseButtonDevices mouse_button_devices; MouseAnalogDevices mouse_analog_devices; MouseStickDevice mouse_stick_device; + RingAnalogDevice ring_analog_device; mutable std::mutex mutex; mutable std::mutex callback_mutex; |