summaryrefslogtreecommitdiffstats
path: root/src/hid_core/frontend/emulated_controller.cpp
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2024-01-26 15:57:40 +0100
committerGitHub <noreply@github.com>2024-01-26 15:57:40 +0100
commit4349cdba070b159181d7090a27beb794bb83e481 (patch)
tree1bd25e48ffeb2dcc0d033fdf3a900d91fa1e4360 /src/hid_core/frontend/emulated_controller.cpp
parentMerge pull request #12809 from t895/error-message (diff)
parentcore: hid: Skip duplicated vibrations (diff)
downloadyuzu-4349cdba070b159181d7090a27beb794bb83e481.tar
yuzu-4349cdba070b159181d7090a27beb794bb83e481.tar.gz
yuzu-4349cdba070b159181d7090a27beb794bb83e481.tar.bz2
yuzu-4349cdba070b159181d7090a27beb794bb83e481.tar.lz
yuzu-4349cdba070b159181d7090a27beb794bb83e481.tar.xz
yuzu-4349cdba070b159181d7090a27beb794bb83e481.tar.zst
yuzu-4349cdba070b159181d7090a27beb794bb83e481.zip
Diffstat (limited to 'src/hid_core/frontend/emulated_controller.cpp')
-rw-r--r--src/hid_core/frontend/emulated_controller.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/hid_core/frontend/emulated_controller.cpp b/src/hid_core/frontend/emulated_controller.cpp
index e12e5a77e..819460eb5 100644
--- a/src/hid_core/frontend/emulated_controller.cpp
+++ b/src/hid_core/frontend/emulated_controller.cpp
@@ -110,7 +110,11 @@ void EmulatedController::ReloadFromSettings() {
original_npad_type = npad_type;
}
- SetPollingMode(EmulatedDeviceIndex::RightIndex, Common::Input::PollingMode::Active);
+ // Disable special features before disconnecting
+ if (controller.right_polling_mode != Common::Input::PollingMode::Active) {
+ SetPollingMode(EmulatedDeviceIndex::RightIndex, Common::Input::PollingMode::Active);
+ }
+
Disconnect();
if (player.connected) {
Connect();
@@ -1241,7 +1245,12 @@ bool EmulatedController::SetVibration(DeviceIndex device_index, const VibrationV
return false;
}
- last_vibration_value = vibration;
+ // Skip duplicated vibrations
+ if (last_vibration_value[index] == vibration) {
+ return Settings::values.vibration_enabled.GetValue();
+ }
+
+ last_vibration_value[index] = vibration;
if (!Settings::values.vibration_enabled) {
return false;
@@ -1272,7 +1281,10 @@ bool EmulatedController::SetVibration(DeviceIndex device_index, const VibrationV
}
VibrationValue EmulatedController::GetActualVibrationValue(DeviceIndex device_index) const {
- return last_vibration_value;
+ if (device_index >= DeviceIndex::MaxDeviceIndex) {
+ return Core::HID::DEFAULT_VIBRATION_VALUE;
+ }
+ return last_vibration_value[static_cast<std::size_t>(device_index)];
}
bool EmulatedController::IsVibrationEnabled(std::size_t device_index) {