diff options
| author | 2023-01-02 22:11:03 -0600 | |
|---|---|---|
| committer | 2023-01-19 18:05:22 -0600 | |
| commit | d05ea2f3ebdf62e328d2edbfc5b9bc01e3453569 (patch) | |
| tree | 5863733770eb47f15aa528438e47a1cab2e794b4 /src/input_common/helpers/joycon_driver.cpp | |
| parent | input_common: Implement joycon ir camera (diff) | |
| download | yuzu-d05ea2f3ebdf62e328d2edbfc5b9bc01e3453569.tar.gz yuzu-d05ea2f3ebdf62e328d2edbfc5b9bc01e3453569.tar.xz yuzu-d05ea2f3ebdf62e328d2edbfc5b9bc01e3453569.zip | |
input_common: Fix issue where ring and irs are enabled at the same time
Diffstat (limited to 'src/input_common/helpers/joycon_driver.cpp')
| -rw-r--r-- | src/input_common/helpers/joycon_driver.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/input_common/helpers/joycon_driver.cpp b/src/input_common/helpers/joycon_driver.cpp index 040832a4b..e8aef028a 100644 --- a/src/input_common/helpers/joycon_driver.cpp +++ b/src/input_common/helpers/joycon_driver.cpp | |||
| @@ -262,6 +262,16 @@ DriverResult JoyconDriver::SetPollingMode() { | |||
| 262 | irs_protocol->DisableIrs(); | 262 | irs_protocol->DisableIrs(); |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | if (nfc_protocol->IsEnabled()) { | ||
| 266 | amiibo_detected = false; | ||
| 267 | nfc_protocol->DisableNfc(); | ||
| 268 | } | ||
| 269 | |||
| 270 | if (ring_protocol->IsEnabled()) { | ||
| 271 | ring_connected = false; | ||
| 272 | ring_protocol->DisableRingCon(); | ||
| 273 | } | ||
| 274 | |||
| 265 | if (irs_enabled && supported_features.irs) { | 275 | if (irs_enabled && supported_features.irs) { |
| 266 | auto result = irs_protocol->EnableIrs(); | 276 | auto result = irs_protocol->EnableIrs(); |
| 267 | if (result == DriverResult::Success) { | 277 | if (result == DriverResult::Success) { |
| @@ -272,11 +282,6 @@ DriverResult JoyconDriver::SetPollingMode() { | |||
| 272 | LOG_ERROR(Input, "Error enabling IRS"); | 282 | LOG_ERROR(Input, "Error enabling IRS"); |
| 273 | } | 283 | } |
| 274 | 284 | ||
| 275 | if (nfc_protocol->IsEnabled()) { | ||
| 276 | amiibo_detected = false; | ||
| 277 | nfc_protocol->DisableNfc(); | ||
| 278 | } | ||
| 279 | |||
| 280 | if (nfc_enabled && supported_features.nfc) { | 285 | if (nfc_enabled && supported_features.nfc) { |
| 281 | auto result = nfc_protocol->EnableNfc(); | 286 | auto result = nfc_protocol->EnableNfc(); |
| 282 | if (result == DriverResult::Success) { | 287 | if (result == DriverResult::Success) { |
| @@ -290,11 +295,6 @@ DriverResult JoyconDriver::SetPollingMode() { | |||
| 290 | LOG_ERROR(Input, "Error enabling NFC"); | 295 | LOG_ERROR(Input, "Error enabling NFC"); |
| 291 | } | 296 | } |
| 292 | 297 | ||
| 293 | if (ring_protocol->IsEnabled()) { | ||
| 294 | ring_connected = false; | ||
| 295 | ring_protocol->DisableRingCon(); | ||
| 296 | } | ||
| 297 | |||
| 298 | if (hidbus_enabled && supported_features.hidbus) { | 298 | if (hidbus_enabled && supported_features.hidbus) { |
| 299 | auto result = ring_protocol->EnableRingCon(); | 299 | auto result = ring_protocol->EnableRingCon(); |
| 300 | if (result == DriverResult::Success) { | 300 | if (result == DriverResult::Success) { |
| @@ -418,6 +418,12 @@ DriverResult JoyconDriver::SetPasiveMode() { | |||
| 418 | } | 418 | } |
| 419 | 419 | ||
| 420 | DriverResult JoyconDriver::SetActiveMode() { | 420 | DriverResult JoyconDriver::SetActiveMode() { |
| 421 | if (is_ring_disabled_by_irs) { | ||
| 422 | is_ring_disabled_by_irs = false; | ||
| 423 | SetActiveMode(); | ||
| 424 | return SetRingConMode(); | ||
| 425 | } | ||
| 426 | |||
| 421 | std::scoped_lock lock{mutex}; | 427 | std::scoped_lock lock{mutex}; |
| 422 | motion_enabled = true; | 428 | motion_enabled = true; |
| 423 | hidbus_enabled = false; | 429 | hidbus_enabled = false; |
| @@ -434,6 +440,10 @@ DriverResult JoyconDriver::SetIrMode() { | |||
| 434 | return DriverResult::NotSupported; | 440 | return DriverResult::NotSupported; |
| 435 | } | 441 | } |
| 436 | 442 | ||
| 443 | if (ring_connected) { | ||
| 444 | is_ring_disabled_by_irs = true; | ||
| 445 | } | ||
| 446 | |||
| 437 | motion_enabled = false; | 447 | motion_enabled = false; |
| 438 | hidbus_enabled = false; | 448 | hidbus_enabled = false; |
| 439 | nfc_enabled = false; | 449 | nfc_enabled = false; |