summaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorGravatar Morph2021-12-18 15:53:15 -0500
committerGravatar GitHub2021-12-18 15:53:15 -0500
commit8e33cf1c2bd1e15e33d94524835ba1d39c138afd (patch)
tree9a56f7230c676b5a79d5656df7bdd2e907c1ba59 /src/core/hid/emulated_controller.cpp
parentMerge pull request #7600 from bunnei/fix-kip-loading (diff)
parentcore/hid: Cancel any vibration after the test (diff)
downloadyuzu-8e33cf1c2bd1e15e33d94524835ba1d39c138afd.tar.gz
yuzu-8e33cf1c2bd1e15e33d94524835ba1d39c138afd.tar.xz
yuzu-8e33cf1c2bd1e15e33d94524835ba1d39c138afd.zip
Merge pull request #7593 from german77/brrr_test
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.cpp19
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
845bool EmulatedController::TestVibration(std::size_t device_index) { 845bool 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
865void EmulatedController::SetLedPattern() { 860void EmulatedController::SetLedPattern() {