diff options
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/helpers/joycon_driver.h | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/input_common/helpers/joycon_driver.h b/src/input_common/helpers/joycon_driver.h index e9b2fccbb..335e12cc3 100644 --- a/src/input_common/helpers/joycon_driver.h +++ b/src/input_common/helpers/joycon_driver.h | |||
| @@ -11,6 +11,10 @@ | |||
| 11 | 11 | ||
| 12 | #include "input_common/helpers/joycon_protocol/joycon_types.h" | 12 | #include "input_common/helpers/joycon_protocol/joycon_types.h" |
| 13 | 13 | ||
| 14 | namespace Common::Input { | ||
| 15 | enum class DriverResult; | ||
| 16 | } | ||
| 17 | |||
| 14 | namespace InputCommon::Joycon { | 18 | namespace InputCommon::Joycon { |
| 15 | class CalibrationProtocol; | 19 | class CalibrationProtocol; |
| 16 | class GenericProtocol; | 20 | class GenericProtocol; |
| @@ -26,8 +30,8 @@ public: | |||
| 26 | 30 | ||
| 27 | ~JoyconDriver(); | 31 | ~JoyconDriver(); |
| 28 | 32 | ||
| 29 | DriverResult RequestDeviceAccess(SDL_hid_device_info* device_info); | 33 | Common::Input::DriverResult RequestDeviceAccess(SDL_hid_device_info* device_info); |
| 30 | DriverResult InitializeDevice(); | 34 | Common::Input::DriverResult InitializeDevice(); |
| 31 | void Stop(); | 35 | void Stop(); |
| 32 | 36 | ||
| 33 | bool IsConnected() const; | 37 | bool IsConnected() const; |
| @@ -41,25 +45,31 @@ public: | |||
| 41 | SerialNumber GetSerialNumber() const; | 45 | SerialNumber GetSerialNumber() const; |
| 42 | SerialNumber GetHandleSerialNumber() const; | 46 | SerialNumber GetHandleSerialNumber() const; |
| 43 | 47 | ||
| 44 | DriverResult SetVibration(const VibrationValue& vibration); | 48 | Common::Input::DriverResult SetVibration(const VibrationValue& vibration); |
| 45 | DriverResult SetLedConfig(u8 led_pattern); | 49 | Common::Input::DriverResult SetLedConfig(u8 led_pattern); |
| 46 | DriverResult SetIrsConfig(IrsMode mode_, IrsResolution format_); | 50 | Common::Input::DriverResult SetIrsConfig(IrsMode mode_, IrsResolution format_); |
| 47 | DriverResult SetPassiveMode(); | 51 | Common::Input::DriverResult SetPassiveMode(); |
| 48 | DriverResult SetActiveMode(); | 52 | Common::Input::DriverResult SetActiveMode(); |
| 49 | DriverResult SetIrMode(); | 53 | Common::Input::DriverResult SetIrMode(); |
| 50 | DriverResult SetNfcMode(); | 54 | Common::Input::DriverResult SetNfcMode(); |
| 51 | DriverResult SetRingConMode(); | 55 | Common::Input::DriverResult SetRingConMode(); |
| 52 | DriverResult WriteNfcData(std::span<const u8> data); | 56 | Common::Input::DriverResult StartNfcPolling(); |
| 57 | Common::Input::DriverResult StopNfcPolling(); | ||
| 58 | Common::Input::DriverResult ReadAmiiboData(std::vector<u8>& out_data); | ||
| 59 | Common::Input::DriverResult WriteNfcData(std::span<const u8> data); | ||
| 60 | Common::Input::DriverResult ReadMifareData(std::span<const MifareReadChunk> request, | ||
| 61 | std::span<MifareReadData> out_data); | ||
| 62 | Common::Input::DriverResult WriteMifareData(std::span<const MifareWriteChunk> request); | ||
| 53 | 63 | ||
| 54 | void SetCallbacks(const JoyconCallbacks& callbacks); | 64 | void SetCallbacks(const JoyconCallbacks& callbacks); |
| 55 | 65 | ||
| 56 | // Returns device type from hidapi handle | 66 | // Returns device type from hidapi handle |
| 57 | static DriverResult GetDeviceType(SDL_hid_device_info* device_info, | 67 | static Common::Input::DriverResult GetDeviceType(SDL_hid_device_info* device_info, |
| 58 | ControllerType& controller_type); | 68 | ControllerType& controller_type); |
| 59 | 69 | ||
| 60 | // Returns serial number from hidapi handle | 70 | // Returns serial number from hidapi handle |
| 61 | static DriverResult GetSerialNumber(SDL_hid_device_info* device_info, | 71 | static Common::Input::DriverResult GetSerialNumber(SDL_hid_device_info* device_info, |
| 62 | SerialNumber& serial_number); | 72 | SerialNumber& serial_number); |
| 63 | 73 | ||
| 64 | private: | 74 | private: |
| 65 | struct SupportedFeatures { | 75 | struct SupportedFeatures { |
| @@ -78,7 +88,7 @@ private: | |||
| 78 | void OnNewData(std::span<u8> buffer); | 88 | void OnNewData(std::span<u8> buffer); |
| 79 | 89 | ||
| 80 | /// Updates device configuration to enable or disable features | 90 | /// Updates device configuration to enable or disable features |
| 81 | DriverResult SetPollingMode(); | 91 | Common::Input::DriverResult SetPollingMode(); |
| 82 | 92 | ||
| 83 | /// Returns true if input thread is valid and doesn't need to be stopped | 93 | /// Returns true if input thread is valid and doesn't need to be stopped |
| 84 | bool IsInputThreadValid() const; | 94 | bool IsInputThreadValid() const; |
| @@ -114,6 +124,7 @@ private: | |||
| 114 | // Hardware configuration | 124 | // Hardware configuration |
| 115 | u8 leds{}; | 125 | u8 leds{}; |
| 116 | ReportMode mode{}; | 126 | ReportMode mode{}; |
| 127 | bool input_only_device{}; | ||
| 117 | bool passive_enabled{}; // Low power mode, Ideal for multiple controllers at the same time | 128 | bool passive_enabled{}; // Low power mode, Ideal for multiple controllers at the same time |
| 118 | bool hidbus_enabled{}; // External device support | 129 | bool hidbus_enabled{}; // External device support |
| 119 | bool irs_enabled{}; // Infrared camera input | 130 | bool irs_enabled{}; // Infrared camera input |