diff options
| author | 2020-10-08 08:18:50 -0400 | |
|---|---|---|
| committer | 2020-11-15 23:33:20 -0500 | |
| commit | e02ef3c3bed2f8e98ec9481cdea1a6253c34e9d1 (patch) | |
| tree | ba4f5aa2271139b0842751b86ee18fd083b542b5 /src | |
| parent | hid: Fix controller rumble based on new research (diff) | |
| download | yuzu-e02ef3c3bed2f8e98ec9481cdea1a6253c34e9d1.tar.gz yuzu-e02ef3c3bed2f8e98ec9481cdea1a6253c34e9d1.tar.xz yuzu-e02ef3c3bed2f8e98ec9481cdea1a6253c34e9d1.zip | |
controllers/npad: Stop games from vibrating incorrect controllers
Fixes vibration in 1-2 Switch and potentially other games where they would vibrate both players' joycons at the same time.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 8a5e5abcf..f865e3f5f 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -688,6 +688,16 @@ void Controller_NPad::VibrateController(const std::vector<DeviceHandle>& vibrati | |||
| 688 | continue; | 688 | continue; |
| 689 | } | 689 | } |
| 690 | 690 | ||
| 691 | // Some games try to send mismatched parameters in the device handle, block these. | ||
| 692 | if ((connected_controllers[npad_index].type == NPadControllerType::JoyLeft && | ||
| 693 | (vibration_device_handles[i].npad_type == NpadType::JoyconRight || | ||
| 694 | vibration_device_handles[i].device_index == DeviceIndex::Right)) || | ||
| 695 | (connected_controllers[npad_index].type == NPadControllerType::JoyRight && | ||
| 696 | (vibration_device_handles[i].npad_type == NpadType::JoyconLeft || | ||
| 697 | vibration_device_handles[i].device_index == DeviceIndex::Left))) { | ||
| 698 | continue; | ||
| 699 | } | ||
| 700 | |||
| 691 | using namespace Settings::NativeButton; | 701 | using namespace Settings::NativeButton; |
| 692 | const auto& button_state = buttons[npad_index]; | 702 | const auto& button_state = buttons[npad_index]; |
| 693 | 703 | ||