diff options
| author | 2022-04-16 15:51:14 +0200 | |
|---|---|---|
| committer | 2022-04-16 15:51:14 +0200 | |
| commit | fd49b186fa13c74a61cdf70844486c75cfc0c930 (patch) | |
| tree | aff4d01b4a955e7928ed97cb979d80b596d013f3 /src/core/hid/emulated_devices.h | |
| parent | Merge pull request #8188 from merryhime/jit-race-page-table-changed (diff) | |
| parent | yuzu: Call ignore event after ensuring it's initialized (diff) | |
| download | yuzu-fd49b186fa13c74a61cdf70844486c75cfc0c930.tar.gz yuzu-fd49b186fa13c74a61cdf70844486c75cfc0c930.tar.xz yuzu-fd49b186fa13c74a61cdf70844486c75cfc0c930.zip | |
Merge pull request #6558 from german77/ringcon2
hidbus: Implement hidbus and ringcon
Diffstat (limited to 'src/core/hid/emulated_devices.h')
| -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 | |||
| 26 | using MouseAnalogDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, | 26 | using MouseAnalogDevices = std::array<std::unique_ptr<Common::Input::InputDevice>, |
| 27 | Settings::NativeMouseWheel::NumMouseWheels>; | 27 | Settings::NativeMouseWheel::NumMouseWheels>; |
| 28 | using MouseStickDevice = std::unique_ptr<Common::Input::InputDevice>; | 28 | using MouseStickDevice = std::unique_ptr<Common::Input::InputDevice>; |
| 29 | using RingAnalogDevice = std::unique_ptr<Common::Input::InputDevice>; | ||
| 29 | 30 | ||
| 30 | using MouseButtonParams = | 31 | using MouseButtonParams = |
| 31 | std::array<Common::ParamPackage, Settings::NativeMouseButton::NumMouseButtons>; | 32 | std::array<Common::ParamPackage, Settings::NativeMouseButton::NumMouseButtons>; |
| 33 | using RingAnalogParams = Common::ParamPackage; | ||
| 32 | 34 | ||
| 33 | using KeyboardValues = | 35 | using KeyboardValues = |
| 34 | std::array<Common::Input::ButtonStatus, Settings::NativeKeyboard::NumKeyboardKeys>; | 36 | std::array<Common::Input::ButtonStatus, Settings::NativeKeyboard::NumKeyboardKeys>; |
| @@ -39,12 +41,17 @@ using MouseButtonValues = | |||
| 39 | using MouseAnalogValues = | 41 | using MouseAnalogValues = |
| 40 | std::array<Common::Input::AnalogStatus, Settings::NativeMouseWheel::NumMouseWheels>; | 42 | std::array<Common::Input::AnalogStatus, Settings::NativeMouseWheel::NumMouseWheels>; |
| 41 | using MouseStickValue = Common::Input::TouchStatus; | 43 | using MouseStickValue = Common::Input::TouchStatus; |
| 44 | using RingAnalogValue = Common::Input::AnalogStatus; | ||
| 42 | 45 | ||
| 43 | struct MousePosition { | 46 | struct MousePosition { |
| 44 | f32 x; | 47 | f32 x; |
| 45 | f32 y; | 48 | f32 y; |
| 46 | }; | 49 | }; |
| 47 | 50 | ||
| 51 | struct RingSensorForce { | ||
| 52 | f32 force; | ||
| 53 | }; | ||
| 54 | |||
| 48 | struct DeviceStatus { | 55 | struct DeviceStatus { |
| 49 | // Data from input_common | 56 | // Data from input_common |
| 50 | KeyboardValues keyboard_values{}; | 57 | KeyboardValues keyboard_values{}; |
| @@ -52,6 +59,7 @@ struct DeviceStatus { | |||
| 52 | MouseButtonValues mouse_button_values{}; | 59 | MouseButtonValues mouse_button_values{}; |
| 53 | MouseAnalogValues mouse_analog_values{}; | 60 | MouseAnalogValues mouse_analog_values{}; |
| 54 | MouseStickValue mouse_stick_value{}; | 61 | MouseStickValue mouse_stick_value{}; |
| 62 | RingAnalogValue ring_analog_value{}; | ||
| 55 | 63 | ||
| 56 | // Data for HID serices | 64 | // Data for HID serices |
| 57 | KeyboardKey keyboard_state{}; | 65 | KeyboardKey keyboard_state{}; |
| @@ -59,12 +67,14 @@ struct DeviceStatus { | |||
| 59 | MouseButton mouse_button_state{}; | 67 | MouseButton mouse_button_state{}; |
| 60 | MousePosition mouse_position_state{}; | 68 | MousePosition mouse_position_state{}; |
| 61 | AnalogStickState mouse_wheel_state{}; | 69 | AnalogStickState mouse_wheel_state{}; |
| 70 | RingSensorForce ring_analog_state{}; | ||
| 62 | }; | 71 | }; |
| 63 | 72 | ||
| 64 | enum class DeviceTriggerType { | 73 | enum class DeviceTriggerType { |
| 65 | Keyboard, | 74 | Keyboard, |
| 66 | KeyboardModdifier, | 75 | KeyboardModdifier, |
| 67 | Mouse, | 76 | Mouse, |
| 77 | RingController, | ||
| 68 | }; | 78 | }; |
| 69 | 79 | ||
| 70 | struct InterfaceUpdateCallback { | 80 | struct InterfaceUpdateCallback { |
| @@ -110,6 +120,15 @@ public: | |||
| 110 | /// Reverts any mapped changes made that weren't saved | 120 | /// Reverts any mapped changes made that weren't saved |
| 111 | void RestoreConfig(); | 121 | void RestoreConfig(); |
| 112 | 122 | ||
| 123 | // Returns the current mapped ring device | ||
| 124 | Common::ParamPackage GetRingParam() const; | ||
| 125 | |||
| 126 | /** | ||
| 127 | * Updates the current mapped ring device | ||
| 128 | * @param param ParamPackage with ring sensor data to be mapped | ||
| 129 | */ | ||
| 130 | void SetRingParam(Common::ParamPackage param); | ||
| 131 | |||
| 113 | /// Returns the latest status of button input from the keyboard with parameters | 132 | /// Returns the latest status of button input from the keyboard with parameters |
| 114 | KeyboardValues GetKeyboardValues() const; | 133 | KeyboardValues GetKeyboardValues() const; |
| 115 | 134 | ||
| @@ -119,6 +138,9 @@ public: | |||
| 119 | /// Returns the latest status of button input from the mouse with parameters | 138 | /// Returns the latest status of button input from the mouse with parameters |
| 120 | MouseButtonValues GetMouseButtonsValues() const; | 139 | MouseButtonValues GetMouseButtonsValues() const; |
| 121 | 140 | ||
| 141 | /// Returns the latest status of analog input from the ring sensor with parameters | ||
| 142 | RingAnalogValue GetRingSensorValues() const; | ||
| 143 | |||
| 122 | /// Returns the latest status of button input from the keyboard | 144 | /// Returns the latest status of button input from the keyboard |
| 123 | KeyboardKey GetKeyboard() const; | 145 | KeyboardKey GetKeyboard() const; |
| 124 | 146 | ||
| @@ -134,6 +156,9 @@ public: | |||
| 134 | /// Returns the latest mouse wheel change | 156 | /// Returns the latest mouse wheel change |
| 135 | AnalogStickState GetMouseWheel() const; | 157 | AnalogStickState GetMouseWheel() const; |
| 136 | 158 | ||
| 159 | /// Returns the latest ringcon force sensor value | ||
| 160 | RingSensorForce GetRingSensorForce() const; | ||
| 161 | |||
| 137 | /** | 162 | /** |
| 138 | * Adds a callback to the list of events | 163 | * Adds a callback to the list of events |
| 139 | * @param update_callback InterfaceUpdateCallback that will be triggered | 164 | * @param update_callback InterfaceUpdateCallback that will be triggered |
| @@ -186,6 +211,12 @@ private: | |||
| 186 | void SetMouseStick(const Common::Input::CallbackStatus& callback); | 211 | void SetMouseStick(const Common::Input::CallbackStatus& callback); |
| 187 | 212 | ||
| 188 | /** | 213 | /** |
| 214 | * Updates the ring analog sensor status of the ring controller | ||
| 215 | * @param callback A CallbackStatus containing the force status | ||
| 216 | */ | ||
| 217 | void SetRingAnalog(const Common::Input::CallbackStatus& callback); | ||
| 218 | |||
| 219 | /** | ||
| 189 | * Triggers a callback that something has changed on the device status | 220 | * Triggers a callback that something has changed on the device status |
| 190 | * @param type Input type of the event to trigger | 221 | * @param type Input type of the event to trigger |
| 191 | */ | 222 | */ |
| @@ -193,11 +224,14 @@ private: | |||
| 193 | 224 | ||
| 194 | bool is_configuring{false}; | 225 | bool is_configuring{false}; |
| 195 | 226 | ||
| 227 | RingAnalogParams ring_params; | ||
| 228 | |||
| 196 | KeyboardDevices keyboard_devices; | 229 | KeyboardDevices keyboard_devices; |
| 197 | KeyboardModifierDevices keyboard_modifier_devices; | 230 | KeyboardModifierDevices keyboard_modifier_devices; |
| 198 | MouseButtonDevices mouse_button_devices; | 231 | MouseButtonDevices mouse_button_devices; |
| 199 | MouseAnalogDevices mouse_analog_devices; | 232 | MouseAnalogDevices mouse_analog_devices; |
| 200 | MouseStickDevice mouse_stick_device; | 233 | MouseStickDevice mouse_stick_device; |
| 234 | RingAnalogDevice ring_analog_device; | ||
| 201 | 235 | ||
| 202 | mutable std::mutex mutex; | 236 | mutable std::mutex mutex; |
| 203 | mutable std::mutex callback_mutex; | 237 | mutable std::mutex callback_mutex; |