diff options
| author | 2022-12-26 11:11:01 -0600 | |
|---|---|---|
| committer | 2023-01-19 18:05:22 -0600 | |
| commit | 527dad70976a158e94defc51707347e064a31099 (patch) | |
| tree | d9e9e68799d0c051e8e6a8a2dda7170ea911831d /src/input_common/helpers/joycon_driver.cpp | |
| parent | Address review comments (diff) | |
| download | yuzu-527dad70976a158e94defc51707347e064a31099.tar.gz yuzu-527dad70976a158e94defc51707347e064a31099.tar.xz yuzu-527dad70976a158e94defc51707347e064a31099.zip | |
input_common: Use DriverResult on all engines
Diffstat (limited to 'src/input_common/helpers/joycon_driver.cpp')
| -rw-r--r-- | src/input_common/helpers/joycon_driver.cpp | 26 |
1 files changed, 13 insertions, 13 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 { | |||
| 459 | return handle_serial_number; | 459 | return handle_serial_number; |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | void JoyconDriver::SetCallbacks(const Joycon::JoyconCallbacks& callbacks) { | 462 | void JoyconDriver::SetCallbacks(const JoyconCallbacks& callbacks) { |
| 463 | joycon_poller->SetCallbacks(callbacks); | 463 | joycon_poller->SetCallbacks(callbacks); |
| 464 | } | 464 | } |
| 465 | 465 | ||
| 466 | Joycon::DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info, | 466 | DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info, |
| 467 | ControllerType& controller_type) { | 467 | ControllerType& controller_type) { |
| 468 | static constexpr std::array<std::pair<u32, Joycon::ControllerType>, 4> supported_devices{ | 468 | static constexpr std::array<std::pair<u32, ControllerType>, 4> supported_devices{ |
| 469 | std::pair<u32, Joycon::ControllerType>{0x2006, Joycon::ControllerType::Left}, | 469 | std::pair<u32, ControllerType>{0x2006, ControllerType::Left}, |
| 470 | {0x2007, Joycon::ControllerType::Right}, | 470 | {0x2007, ControllerType::Right}, |
| 471 | {0x2009, Joycon::ControllerType::Pro}, | 471 | {0x2009, ControllerType::Pro}, |
| 472 | {0x200E, Joycon::ControllerType::Grip}, | 472 | {0x200E, ControllerType::Grip}, |
| 473 | }; | 473 | }; |
| 474 | constexpr u16 nintendo_vendor_id = 0x057e; | 474 | constexpr u16 nintendo_vendor_id = 0x057e; |
| 475 | 475 | ||
| 476 | controller_type = Joycon::ControllerType::None; | 476 | controller_type = ControllerType::None; |
| 477 | if (device_info->vendor_id != nintendo_vendor_id) { | 477 | if (device_info->vendor_id != nintendo_vendor_id) { |
| 478 | return Joycon::DriverResult::UnsupportedControllerType; | 478 | return DriverResult::UnsupportedControllerType; |
| 479 | } | 479 | } |
| 480 | 480 | ||
| 481 | for (const auto& [product_id, type] : supported_devices) { | 481 | for (const auto& [product_id, type] : supported_devices) { |
| @@ -487,10 +487,10 @@ Joycon::DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_inf | |||
| 487 | return Joycon::DriverResult::UnsupportedControllerType; | 487 | return Joycon::DriverResult::UnsupportedControllerType; |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | Joycon::DriverResult JoyconDriver::GetSerialNumber(SDL_hid_device_info* device_info, | 490 | DriverResult JoyconDriver::GetSerialNumber(SDL_hid_device_info* device_info, |
| 491 | Joycon::SerialNumber& serial_number) { | 491 | SerialNumber& serial_number) { |
| 492 | if (device_info->serial_number == nullptr) { | 492 | if (device_info->serial_number == nullptr) { |
| 493 | return Joycon::DriverResult::Unknown; | 493 | return DriverResult::Unknown; |
| 494 | } | 494 | } |
| 495 | std::memcpy(&serial_number, device_info->serial_number, 15); | 495 | std::memcpy(&serial_number, device_info->serial_number, 15); |
| 496 | return Joycon::DriverResult::Success; | 496 | return Joycon::DriverResult::Success; |