summaryrefslogtreecommitdiffstats
path: root/src/core/hid
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-10-27 06:37:46 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:26 +0100
commit7348e205d94e2fff777781498a2ef7931163703a (patch)
treee0a29217bbc2108d2ee0841652d1f37dd7a65060 /src/core/hid
parentcore/hid: Rework battery mappings (diff)
downloadyuzu-7348e205d94e2fff777781498a2ef7931163703a.tar
yuzu-7348e205d94e2fff777781498a2ef7931163703a.tar.gz
yuzu-7348e205d94e2fff777781498a2ef7931163703a.tar.bz2
yuzu-7348e205d94e2fff777781498a2ef7931163703a.tar.lz
yuzu-7348e205d94e2fff777781498a2ef7931163703a.tar.xz
yuzu-7348e205d94e2fff777781498a2ef7931163703a.tar.zst
yuzu-7348e205d94e2fff777781498a2ef7931163703a.zip
Diffstat (limited to 'src/core/hid')
-rw-r--r--src/core/hid/emulated_controller.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 83ced5635..916368c68 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -251,7 +251,8 @@ void EmulatedController::RestoreConfig() {
ReloadFromSettings();
}
-std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices(DeviceIndex device_index) const {
+std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices(
+ DeviceIndex device_index) const {
std::vector<Common::ParamPackage> devices;
for (const auto& param : button_params) {
if (!param.Has("engine")) {
@@ -658,6 +659,10 @@ bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue v
const auto& player = Settings::values.players.GetValue()[player_index];
const f32 strength = static_cast<f32>(player.vibration_strength) / 100.0f;
+ if (!player.vibration_enabled) {
+ return false;
+ }
+
// Exponential amplification is too strong at low amplitudes. Switch to a linear
// amplification if strength is set below 0.7f
const Input::VibrationAmplificationType type =
@@ -860,6 +865,9 @@ AnalogSticks EmulatedController::GetSticks() const {
}
// Some drivers like stick from buttons need constant refreshing
for (auto& device : stick_devices) {
+ if (!device) {
+ continue;
+ }
device->SoftUpdate();
}
return controller.analog_stick_state;