summaryrefslogtreecommitdiffstats
path: root/src/input_common/helpers
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2022-12-26 18:11:01 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2023-01-20 01:05:22 +0100
commit527dad70976a158e94defc51707347e064a31099 (patch)
treed9e9e68799d0c051e8e6a8a2dda7170ea911831d /src/input_common/helpers
parentAddress review comments (diff)
downloadyuzu-527dad70976a158e94defc51707347e064a31099.tar
yuzu-527dad70976a158e94defc51707347e064a31099.tar.gz
yuzu-527dad70976a158e94defc51707347e064a31099.tar.bz2
yuzu-527dad70976a158e94defc51707347e064a31099.tar.lz
yuzu-527dad70976a158e94defc51707347e064a31099.tar.xz
yuzu-527dad70976a158e94defc51707347e064a31099.tar.zst
yuzu-527dad70976a158e94defc51707347e064a31099.zip
Diffstat (limited to 'src/input_common/helpers')
-rw-r--r--src/input_common/helpers/joycon_driver.cpp26
-rw-r--r--src/input_common/helpers/joycon_driver.h10
-rw-r--r--src/input_common/helpers/joycon_protocol/joycon_types.h1
3 files changed, 19 insertions, 18 deletions
diff --git a/src/input_common/helpers/joycon_driver.cpp b/src/input_common/helpers/joycon_driver.cpp
index 8982a2397..b00b6110b 100644
--- a/src/input_common/helpers/joycon_driver.cpp
+++ b/src/input_common/helpers/joycon_driver.cpp
@@ -459,23 +459,23 @@ SerialNumber JoyconDriver::GetHandleSerialNumber() const {
return handle_serial_number;
}
-void JoyconDriver::SetCallbacks(const Joycon::JoyconCallbacks& callbacks) {
+void JoyconDriver::SetCallbacks(const JoyconCallbacks& callbacks) {
joycon_poller->SetCallbacks(callbacks);
}
-Joycon::DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info,
- ControllerType& controller_type) {
- static constexpr std::array<std::pair<u32, Joycon::ControllerType>, 4> supported_devices{
- std::pair<u32, Joycon::ControllerType>{0x2006, Joycon::ControllerType::Left},
- {0x2007, Joycon::ControllerType::Right},
- {0x2009, Joycon::ControllerType::Pro},
- {0x200E, Joycon::ControllerType::Grip},
+DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info,
+ ControllerType& controller_type) {
+ static constexpr std::array<std::pair<u32, ControllerType>, 4> supported_devices{
+ std::pair<u32, ControllerType>{0x2006, ControllerType::Left},
+ {0x2007, ControllerType::Right},
+ {0x2009, ControllerType::Pro},
+ {0x200E, ControllerType::Grip},
};
constexpr u16 nintendo_vendor_id = 0x057e;
- controller_type = Joycon::ControllerType::None;
+ controller_type = ControllerType::None;
if (device_info->vendor_id != nintendo_vendor_id) {
- return Joycon::DriverResult::UnsupportedControllerType;
+ return DriverResult::UnsupportedControllerType;
}
for (const auto& [product_id, type] : supported_devices) {
@@ -487,10 +487,10 @@ Joycon::DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_inf
return Joycon::DriverResult::UnsupportedControllerType;
}
-Joycon::DriverResult JoyconDriver::GetSerialNumber(SDL_hid_device_info* device_info,
- Joycon::SerialNumber& serial_number) {
+DriverResult JoyconDriver::GetSerialNumber(SDL_hid_device_info* device_info,
+ SerialNumber& serial_number) {
if (device_info->serial_number == nullptr) {
- return Joycon::DriverResult::Unknown;
+ return DriverResult::Unknown;
}
std::memcpy(&serial_number, device_info->serial_number, 15);
return Joycon::DriverResult::Success;
diff --git a/src/input_common/helpers/joycon_driver.h b/src/input_common/helpers/joycon_driver.h
index c9118ee93..bf38a3009 100644
--- a/src/input_common/helpers/joycon_driver.h
+++ b/src/input_common/helpers/joycon_driver.h
@@ -46,15 +46,15 @@ public:
DriverResult SetNfcMode();
DriverResult SetRingConMode();
- void SetCallbacks(const Joycon::JoyconCallbacks& callbacks);
+ void SetCallbacks(const JoyconCallbacks& callbacks);
// Returns device type from hidapi handle
- static Joycon::DriverResult GetDeviceType(SDL_hid_device_info* device_info,
- Joycon::ControllerType& controller_type);
+ static DriverResult GetDeviceType(SDL_hid_device_info* device_info,
+ ControllerType& controller_type);
// Returns serial number from hidapi handle
- static Joycon::DriverResult GetSerialNumber(SDL_hid_device_info* device_info,
- Joycon::SerialNumber& serial_number);
+ static DriverResult GetSerialNumber(SDL_hid_device_info* device_info,
+ SerialNumber& serial_number);
private:
struct SupportedFeatures {
diff --git a/src/input_common/helpers/joycon_protocol/joycon_types.h b/src/input_common/helpers/joycon_protocol/joycon_types.h
index de512fe63..36c00a8d7 100644
--- a/src/input_common/helpers/joycon_protocol/joycon_types.h
+++ b/src/input_common/helpers/joycon_protocol/joycon_types.h
@@ -284,6 +284,7 @@ enum class DriverResult {
NoDeviceDetected,
InvalidHandle,
NotSupported,
+ Disabled,
Unknown,
};