diff options
Diffstat (limited to 'src/input_common/input_engine.h')
| -rw-r--r-- | src/input_common/input_engine.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h index f6b3c4610..d4c264a8e 100644 --- a/src/input_common/input_engine.h +++ b/src/input_common/input_engine.h | |||
| @@ -42,6 +42,7 @@ enum class EngineInputType { | |||
| 42 | Camera, | 42 | Camera, |
| 43 | HatButton, | 43 | HatButton, |
| 44 | Motion, | 44 | Motion, |
| 45 | Nfc, | ||
| 45 | }; | 46 | }; |
| 46 | 47 | ||
| 47 | namespace std { | 48 | namespace std { |
| @@ -107,12 +108,17 @@ public: | |||
| 107 | [[maybe_unused]] const Common::Input::LedStatus& led_status) {} | 108 | [[maybe_unused]] const Common::Input::LedStatus& led_status) {} |
| 108 | 109 | ||
| 109 | // Sets rumble to a controller | 110 | // Sets rumble to a controller |
| 110 | virtual Common::Input::VibrationError SetRumble( | 111 | virtual Common::Input::VibrationError SetVibration( |
| 111 | [[maybe_unused]] const PadIdentifier& identifier, | 112 | [[maybe_unused]] const PadIdentifier& identifier, |
| 112 | [[maybe_unused]] const Common::Input::VibrationStatus& vibration) { | 113 | [[maybe_unused]] const Common::Input::VibrationStatus& vibration) { |
| 113 | return Common::Input::VibrationError::NotSupported; | 114 | return Common::Input::VibrationError::NotSupported; |
| 114 | } | 115 | } |
| 115 | 116 | ||
| 117 | // Returns true if device supports vibrations | ||
| 118 | virtual bool IsVibrationEnabled([[maybe_unused]] const PadIdentifier& identifier) { | ||
| 119 | return false; | ||
| 120 | } | ||
| 121 | |||
| 116 | // Sets polling mode to a controller | 122 | // Sets polling mode to a controller |
| 117 | virtual Common::Input::PollingError SetPollingMode( | 123 | virtual Common::Input::PollingError SetPollingMode( |
| 118 | [[maybe_unused]] const PadIdentifier& identifier, | 124 | [[maybe_unused]] const PadIdentifier& identifier, |
| @@ -127,6 +133,18 @@ public: | |||
| 127 | return Common::Input::CameraError::NotSupported; | 133 | return Common::Input::CameraError::NotSupported; |
| 128 | } | 134 | } |
| 129 | 135 | ||
| 136 | // Request nfc data from a controller | ||
| 137 | virtual Common::Input::NfcState SupportsNfc( | ||
| 138 | [[maybe_unused]] const PadIdentifier& identifier) const { | ||
| 139 | return Common::Input::NfcState::NotSupported; | ||
| 140 | } | ||
| 141 | |||
| 142 | // Writes data to an nfc tag | ||
| 143 | virtual Common::Input::NfcState WriteNfcData([[maybe_unused]] const PadIdentifier& identifier, | ||
| 144 | [[maybe_unused]] const std::vector<u8>& data) { | ||
| 145 | return Common::Input::NfcState::NotSupported; | ||
| 146 | } | ||
| 147 | |||
| 130 | // Returns the engine name | 148 | // Returns the engine name |
| 131 | [[nodiscard]] const std::string& GetEngineName() const; | 149 | [[nodiscard]] const std::string& GetEngineName() const; |
| 132 | 150 | ||
| @@ -183,6 +201,7 @@ public: | |||
| 183 | Common::Input::BatteryLevel GetBattery(const PadIdentifier& identifier) const; | 201 | Common::Input::BatteryLevel GetBattery(const PadIdentifier& identifier) const; |
| 184 | BasicMotion GetMotion(const PadIdentifier& identifier, int motion) const; | 202 | BasicMotion GetMotion(const PadIdentifier& identifier, int motion) const; |
| 185 | Common::Input::CameraStatus GetCamera(const PadIdentifier& identifier) const; | 203 | Common::Input::CameraStatus GetCamera(const PadIdentifier& identifier) const; |
| 204 | Common::Input::NfcStatus GetNfc(const PadIdentifier& identifier) const; | ||
| 186 | 205 | ||
| 187 | int SetCallback(InputIdentifier input_identifier); | 206 | int SetCallback(InputIdentifier input_identifier); |
| 188 | void SetMappingCallback(MappingCallback callback); | 207 | void SetMappingCallback(MappingCallback callback); |
| @@ -195,6 +214,7 @@ protected: | |||
| 195 | void SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value); | 214 | void SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value); |
| 196 | void SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value); | 215 | void SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value); |
| 197 | void SetCamera(const PadIdentifier& identifier, const Common::Input::CameraStatus& value); | 216 | void SetCamera(const PadIdentifier& identifier, const Common::Input::CameraStatus& value); |
| 217 | void SetNfc(const PadIdentifier& identifier, const Common::Input::NfcStatus& value); | ||
| 198 | 218 | ||
| 199 | virtual std::string GetHatButtonName([[maybe_unused]] u8 direction_value) const { | 219 | virtual std::string GetHatButtonName([[maybe_unused]] u8 direction_value) const { |
| 200 | return "Unknown"; | 220 | return "Unknown"; |
| @@ -208,6 +228,7 @@ private: | |||
| 208 | std::unordered_map<int, BasicMotion> motions; | 228 | std::unordered_map<int, BasicMotion> motions; |
| 209 | Common::Input::BatteryLevel battery{}; | 229 | Common::Input::BatteryLevel battery{}; |
| 210 | Common::Input::CameraStatus camera{}; | 230 | Common::Input::CameraStatus camera{}; |
| 231 | Common::Input::NfcStatus nfc{}; | ||
| 211 | }; | 232 | }; |
| 212 | 233 | ||
| 213 | void TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value); | 234 | void TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value); |
| @@ -218,6 +239,7 @@ private: | |||
| 218 | const BasicMotion& value); | 239 | const BasicMotion& value); |
| 219 | void TriggerOnCameraChange(const PadIdentifier& identifier, | 240 | void TriggerOnCameraChange(const PadIdentifier& identifier, |
| 220 | const Common::Input::CameraStatus& value); | 241 | const Common::Input::CameraStatus& value); |
| 242 | void TriggerOnNfcChange(const PadIdentifier& identifier, const Common::Input::NfcStatus& value); | ||
| 221 | 243 | ||
| 222 | bool IsInputIdentifierEqual(const InputIdentifier& input_identifier, | 244 | bool IsInputIdentifierEqual(const InputIdentifier& input_identifier, |
| 223 | const PadIdentifier& identifier, EngineInputType type, | 245 | const PadIdentifier& identifier, EngineInputType type, |