diff options
Diffstat (limited to 'src/input_common/input_engine.h')
| -rw-r--r-- | src/input_common/input_engine.h | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h index 6cbcf5207..c2d0cbb34 100644 --- a/src/input_common/input_engine.h +++ b/src/input_common/input_engine.h | |||
| @@ -40,6 +40,7 @@ enum class EngineInputType { | |||
| 40 | Battery, | 40 | Battery, |
| 41 | Button, | 41 | Button, |
| 42 | Camera, | 42 | Camera, |
| 43 | Color, | ||
| 43 | HatButton, | 44 | HatButton, |
| 44 | Motion, | 45 | Motion, |
| 45 | Nfc, | 46 | Nfc, |
| @@ -104,14 +105,17 @@ public: | |||
| 104 | void EndConfiguration(); | 105 | void EndConfiguration(); |
| 105 | 106 | ||
| 106 | // Sets a led pattern for a controller | 107 | // Sets a led pattern for a controller |
| 107 | virtual void SetLeds([[maybe_unused]] const PadIdentifier& identifier, | 108 | virtual Common::Input::DriverResult SetLeds( |
| 108 | [[maybe_unused]] const Common::Input::LedStatus& led_status) {} | 109 | [[maybe_unused]] const PadIdentifier& identifier, |
| 110 | [[maybe_unused]] const Common::Input::LedStatus& led_status) { | ||
| 111 | return Common::Input::DriverResult::NotSupported; | ||
| 112 | } | ||
| 109 | 113 | ||
| 110 | // Sets rumble to a controller | 114 | // Sets rumble to a controller |
| 111 | virtual Common::Input::VibrationError SetVibration( | 115 | virtual Common::Input::DriverResult SetVibration( |
| 112 | [[maybe_unused]] const PadIdentifier& identifier, | 116 | [[maybe_unused]] const PadIdentifier& identifier, |
| 113 | [[maybe_unused]] const Common::Input::VibrationStatus& vibration) { | 117 | [[maybe_unused]] const Common::Input::VibrationStatus& vibration) { |
| 114 | return Common::Input::VibrationError::NotSupported; | 118 | return Common::Input::DriverResult::NotSupported; |
| 115 | } | 119 | } |
| 116 | 120 | ||
| 117 | // Returns true if device supports vibrations | 121 | // Returns true if device supports vibrations |
| @@ -120,17 +124,17 @@ public: | |||
| 120 | } | 124 | } |
| 121 | 125 | ||
| 122 | // Sets polling mode to a controller | 126 | // Sets polling mode to a controller |
| 123 | virtual Common::Input::PollingError SetPollingMode( | 127 | virtual Common::Input::DriverResult SetPollingMode( |
| 124 | [[maybe_unused]] const PadIdentifier& identifier, | 128 | [[maybe_unused]] const PadIdentifier& identifier, |
| 125 | [[maybe_unused]] const Common::Input::PollingMode polling_mode) { | 129 | [[maybe_unused]] const Common::Input::PollingMode polling_mode) { |
| 126 | return Common::Input::PollingError::NotSupported; | 130 | return Common::Input::DriverResult::NotSupported; |
| 127 | } | 131 | } |
| 128 | 132 | ||
| 129 | // Sets camera format to a controller | 133 | // Sets camera format to a controller |
| 130 | virtual Common::Input::CameraError SetCameraFormat( | 134 | virtual Common::Input::DriverResult SetCameraFormat( |
| 131 | [[maybe_unused]] const PadIdentifier& identifier, | 135 | [[maybe_unused]] const PadIdentifier& identifier, |
| 132 | [[maybe_unused]] Common::Input::CameraFormat camera_format) { | 136 | [[maybe_unused]] Common::Input::CameraFormat camera_format) { |
| 133 | return Common::Input::CameraError::NotSupported; | 137 | return Common::Input::DriverResult::NotSupported; |
| 134 | } | 138 | } |
| 135 | 139 | ||
| 136 | // Returns success if nfc is supported | 140 | // Returns success if nfc is supported |
| @@ -139,12 +143,46 @@ public: | |||
| 139 | return Common::Input::NfcState::NotSupported; | 143 | return Common::Input::NfcState::NotSupported; |
| 140 | } | 144 | } |
| 141 | 145 | ||
| 146 | // Start scanning for nfc tags | ||
| 147 | virtual Common::Input::NfcState StartNfcPolling( | ||
| 148 | [[maybe_unused]] const PadIdentifier& identifier_) { | ||
| 149 | return Common::Input::NfcState::NotSupported; | ||
| 150 | } | ||
| 151 | |||
| 152 | // Start scanning for nfc tags | ||
| 153 | virtual Common::Input::NfcState StopNfcPolling( | ||
| 154 | [[maybe_unused]] const PadIdentifier& identifier_) { | ||
| 155 | return Common::Input::NfcState::NotSupported; | ||
| 156 | } | ||
| 157 | |||
| 158 | // Reads data from amiibo tag | ||
| 159 | virtual Common::Input::NfcState ReadAmiiboData( | ||
| 160 | [[maybe_unused]] const PadIdentifier& identifier_, | ||
| 161 | [[maybe_unused]] std::vector<u8>& out_data) { | ||
| 162 | return Common::Input::NfcState::NotSupported; | ||
| 163 | } | ||
| 164 | |||
| 142 | // Writes data to an nfc tag | 165 | // Writes data to an nfc tag |
| 143 | virtual Common::Input::NfcState WriteNfcData([[maybe_unused]] const PadIdentifier& identifier, | 166 | virtual Common::Input::NfcState WriteNfcData([[maybe_unused]] const PadIdentifier& identifier, |
| 144 | [[maybe_unused]] const std::vector<u8>& data) { | 167 | [[maybe_unused]] const std::vector<u8>& data) { |
| 145 | return Common::Input::NfcState::NotSupported; | 168 | return Common::Input::NfcState::NotSupported; |
| 146 | } | 169 | } |
| 147 | 170 | ||
| 171 | // Reads data from mifare tag | ||
| 172 | virtual Common::Input::NfcState ReadMifareData( | ||
| 173 | [[maybe_unused]] const PadIdentifier& identifier_, | ||
| 174 | [[maybe_unused]] const Common::Input::MifareRequest& request, | ||
| 175 | [[maybe_unused]] Common::Input::MifareRequest& out_data) { | ||
| 176 | return Common::Input::NfcState::NotSupported; | ||
| 177 | } | ||
| 178 | |||
| 179 | // Write data to mifare tag | ||
| 180 | virtual Common::Input::NfcState WriteMifareData( | ||
| 181 | [[maybe_unused]] const PadIdentifier& identifier_, | ||
| 182 | [[maybe_unused]] const Common::Input::MifareRequest& request) { | ||
| 183 | return Common::Input::NfcState::NotSupported; | ||
| 184 | } | ||
| 185 | |||
| 148 | // Returns the engine name | 186 | // Returns the engine name |
| 149 | [[nodiscard]] const std::string& GetEngineName() const; | 187 | [[nodiscard]] const std::string& GetEngineName() const; |
| 150 | 188 | ||
| @@ -199,6 +237,7 @@ public: | |||
| 199 | bool GetHatButton(const PadIdentifier& identifier, int button, u8 direction) const; | 237 | bool GetHatButton(const PadIdentifier& identifier, int button, u8 direction) const; |
| 200 | f32 GetAxis(const PadIdentifier& identifier, int axis) const; | 238 | f32 GetAxis(const PadIdentifier& identifier, int axis) const; |
| 201 | Common::Input::BatteryLevel GetBattery(const PadIdentifier& identifier) const; | 239 | Common::Input::BatteryLevel GetBattery(const PadIdentifier& identifier) const; |
| 240 | Common::Input::BodyColorStatus GetColor(const PadIdentifier& identifier) const; | ||
| 202 | BasicMotion GetMotion(const PadIdentifier& identifier, int motion) const; | 241 | BasicMotion GetMotion(const PadIdentifier& identifier, int motion) const; |
| 203 | Common::Input::CameraStatus GetCamera(const PadIdentifier& identifier) const; | 242 | Common::Input::CameraStatus GetCamera(const PadIdentifier& identifier) const; |
| 204 | Common::Input::NfcStatus GetNfc(const PadIdentifier& identifier) const; | 243 | Common::Input::NfcStatus GetNfc(const PadIdentifier& identifier) const; |
| @@ -212,6 +251,7 @@ protected: | |||
| 212 | void SetHatButton(const PadIdentifier& identifier, int button, u8 value); | 251 | void SetHatButton(const PadIdentifier& identifier, int button, u8 value); |
| 213 | void SetAxis(const PadIdentifier& identifier, int axis, f32 value); | 252 | void SetAxis(const PadIdentifier& identifier, int axis, f32 value); |
| 214 | void SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value); | 253 | void SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value); |
| 254 | void SetColor(const PadIdentifier& identifier, Common::Input::BodyColorStatus value); | ||
| 215 | void SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value); | 255 | void SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value); |
| 216 | void SetCamera(const PadIdentifier& identifier, const Common::Input::CameraStatus& value); | 256 | void SetCamera(const PadIdentifier& identifier, const Common::Input::CameraStatus& value); |
| 217 | void SetNfc(const PadIdentifier& identifier, const Common::Input::NfcStatus& value); | 257 | void SetNfc(const PadIdentifier& identifier, const Common::Input::NfcStatus& value); |
| @@ -227,6 +267,7 @@ private: | |||
| 227 | std::unordered_map<int, float> axes; | 267 | std::unordered_map<int, float> axes; |
| 228 | std::unordered_map<int, BasicMotion> motions; | 268 | std::unordered_map<int, BasicMotion> motions; |
| 229 | Common::Input::BatteryLevel battery{}; | 269 | Common::Input::BatteryLevel battery{}; |
| 270 | Common::Input::BodyColorStatus color{}; | ||
| 230 | Common::Input::CameraStatus camera{}; | 271 | Common::Input::CameraStatus camera{}; |
| 231 | Common::Input::NfcStatus nfc{}; | 272 | Common::Input::NfcStatus nfc{}; |
| 232 | }; | 273 | }; |
| @@ -235,6 +276,8 @@ private: | |||
| 235 | void TriggerOnHatButtonChange(const PadIdentifier& identifier, int button, u8 value); | 276 | void TriggerOnHatButtonChange(const PadIdentifier& identifier, int button, u8 value); |
| 236 | void TriggerOnAxisChange(const PadIdentifier& identifier, int axis, f32 value); | 277 | void TriggerOnAxisChange(const PadIdentifier& identifier, int axis, f32 value); |
| 237 | void TriggerOnBatteryChange(const PadIdentifier& identifier, Common::Input::BatteryLevel value); | 278 | void TriggerOnBatteryChange(const PadIdentifier& identifier, Common::Input::BatteryLevel value); |
| 279 | void TriggerOnColorChange(const PadIdentifier& identifier, | ||
| 280 | Common::Input::BodyColorStatus value); | ||
| 238 | void TriggerOnMotionChange(const PadIdentifier& identifier, int motion, | 281 | void TriggerOnMotionChange(const PadIdentifier& identifier, int motion, |
| 239 | const BasicMotion& value); | 282 | const BasicMotion& value); |
| 240 | void TriggerOnCameraChange(const PadIdentifier& identifier, | 283 | void TriggerOnCameraChange(const PadIdentifier& identifier, |