From 5693434b8ad74a5c46155f1e60fa0d3f475aa153 Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Mon, 15 May 2023 22:44:50 -0600 Subject: input_common: Fix pro controller amiibo support --- src/input_common/drivers/joycon.cpp | 9 +++++---- src/input_common/drivers/joycon.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/input_common/drivers') diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp index 8b57ebe07..653862a72 100644 --- a/src/input_common/drivers/joycon.cpp +++ b/src/input_common/drivers/joycon.cpp @@ -195,8 +195,8 @@ void Joycons::RegisterNewDevice(SDL_hid_device_info* device_info) { OnMotionUpdate(port, type, id, value); }}, .on_ring_data = {[this](f32 ring_data) { OnRingConUpdate(ring_data); }}, - .on_amiibo_data = {[this, port](const std::vector& amiibo_data) { - OnAmiiboUpdate(port, amiibo_data); + .on_amiibo_data = {[this, port, type](const std::vector& amiibo_data) { + OnAmiiboUpdate(port, type, amiibo_data); }}, .on_camera_data = {[this, port](const std::vector& camera_data, Joycon::IrsResolution format) { @@ -398,8 +398,9 @@ void Joycons::OnRingConUpdate(f32 ring_data) { SetAxis(identifier, 100, ring_data); } -void Joycons::OnAmiiboUpdate(std::size_t port, const std::vector& amiibo_data) { - const auto identifier = GetIdentifier(port, Joycon::ControllerType::Right); +void Joycons::OnAmiiboUpdate(std::size_t port, Joycon::ControllerType type, + const std::vector& amiibo_data) { + const auto identifier = GetIdentifier(port, type); const auto nfc_state = amiibo_data.empty() ? Common::Input::NfcState::AmiiboRemoved : Common::Input::NfcState::NewAmiibo; SetNfc(identifier, {nfc_state, amiibo_data}); diff --git a/src/input_common/drivers/joycon.h b/src/input_common/drivers/joycon.h index 5b40817e2..e3f0ad78f 100644 --- a/src/input_common/drivers/joycon.h +++ b/src/input_common/drivers/joycon.h @@ -81,7 +81,8 @@ private: void OnMotionUpdate(std::size_t port, Joycon::ControllerType type, int id, const Joycon::MotionData& value); void OnRingConUpdate(f32 ring_data); - void OnAmiiboUpdate(std::size_t port, const std::vector& amiibo_data); + void OnAmiiboUpdate(std::size_t port, Joycon::ControllerType type, + const std::vector& amiibo_data); void OnCameraUpdate(std::size_t port, const std::vector& camera_data, Joycon::IrsResolution format); -- cgit v1.2.3