diff options
| author | 2021-12-15 20:00:24 -0600 | |
|---|---|---|
| committer | 2021-12-16 13:35:15 -0600 | |
| commit | c82e6dc81048352475cd64968f8733040a35d944 (patch) | |
| tree | 1fd6749536362bfafc8ff33de7c1b27105ebea61 /src/core/hid/emulated_controller.cpp | |
| parent | Merge pull request #7588 from Wunkolo/gibibibi-bytes (diff) | |
| download | yuzu-c82e6dc81048352475cd64968f8733040a35d944.tar.gz yuzu-c82e6dc81048352475cd64968f8733040a35d944.tar.xz yuzu-c82e6dc81048352475cd64968f8733040a35d944.zip | |
core/hid: Cancel any vibration after the test
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 93372445b..ff9d7a7e3 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -843,23 +843,18 @@ bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue v | |||
| 843 | } | 843 | } |
| 844 | 844 | ||
| 845 | bool EmulatedController::TestVibration(std::size_t device_index) { | 845 | bool EmulatedController::TestVibration(std::size_t device_index) { |
| 846 | if (device_index >= output_devices.size()) { | 846 | static constexpr VibrationValue test_vibration = { |
| 847 | return false; | ||
| 848 | } | ||
| 849 | if (!output_devices[device_index]) { | ||
| 850 | return false; | ||
| 851 | } | ||
| 852 | |||
| 853 | // Send a slight vibration to test for rumble support | ||
| 854 | constexpr Common::Input::VibrationStatus status = { | ||
| 855 | .low_amplitude = 0.001f, | 847 | .low_amplitude = 0.001f, |
| 856 | .low_frequency = 160.0f, | 848 | .low_frequency = 160.0f, |
| 857 | .high_amplitude = 0.001f, | 849 | .high_amplitude = 0.001f, |
| 858 | .high_frequency = 320.0f, | 850 | .high_frequency = 320.0f, |
| 859 | .type = Common::Input::VibrationAmplificationType::Linear, | ||
| 860 | }; | 851 | }; |
| 861 | return output_devices[device_index]->SetVibration(status) == | 852 | |
| 862 | Common::Input::VibrationError::None; | 853 | // Send a slight vibration to test for rumble support |
| 854 | SetVibration(device_index, test_vibration); | ||
| 855 | |||
| 856 | // Stop any vibration and return the result | ||
| 857 | return SetVibration(device_index, DEFAULT_VIBRATION_VALUE); | ||
| 863 | } | 858 | } |
| 864 | 859 | ||
| 865 | void EmulatedController::SetLedPattern() { | 860 | void EmulatedController::SetLedPattern() { |