summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp13
-rw-r--r--src/core/settings.h1
2 files changed, 12 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index ba20d3f59..dc9954377 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -680,11 +680,19 @@ bool Controller_NPad::VibrateControllerAtIndex(std::size_t npad_index,
680 return false; 680 return false;
681 } 681 }
682 682
683 const auto& player = Settings::values.players.GetValue()[npad_index];
684
685 if (!player.vibration_enabled) {
686 return false;
687 }
688
683 using namespace Settings::NativeButton; 689 using namespace Settings::NativeButton;
684 const auto& button_state = buttons[npad_index]; 690 const auto& button_state = buttons[npad_index];
685 691
686 return button_state[A - BUTTON_HID_BEGIN]->SetRumblePlay( 692 return button_state[A - BUTTON_HID_BEGIN]->SetRumblePlay(
687 vibration_value.amp_low, vibration_value.freq_low, vibration_value.amp_high, 693 std::min(vibration_value.amp_low * player.vibration_strength / 100.0f, 1.0f),
694 vibration_value.freq_low,
695 std::min(vibration_value.amp_high * player.vibration_strength / 100.0f, 1.0f),
688 vibration_value.freq_high); 696 vibration_value.freq_high);
689} 697}
690 698
@@ -728,7 +736,8 @@ void Controller_NPad::VibrateControllers(const std::vector<DeviceHandle>& vibrat
728 } 736 }
729 737
730 // Filter out non-zero vibrations that are within 0.015625 absolute amplitude of each other. 738 // Filter out non-zero vibrations that are within 0.015625 absolute amplitude of each other.
731 if ((vibration_values[i].amp_low != 0.0f || vibration_values[i].amp_high != 0.0f) && 739 if (!Settings::values.enable_accurate_vibrations.GetValue() &&
740 (vibration_values[i].amp_low != 0.0f || vibration_values[i].amp_high != 0.0f) &&
732 (latest_vibration_values[npad_index][device_index].amp_low != 0.0f || 741 (latest_vibration_values[npad_index][device_index].amp_low != 0.0f ||
733 latest_vibration_values[npad_index][device_index].amp_high != 0.0f) && 742 latest_vibration_values[npad_index][device_index].amp_high != 0.0f) &&
734 (abs(vibration_values[i].amp_low - 743 (abs(vibration_values[i].amp_low -
diff --git a/src/core/settings.h b/src/core/settings.h
index edd2a00ca..476c3fdf3 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -170,6 +170,7 @@ struct Values {
170 Setting<bool> use_docked_mode; 170 Setting<bool> use_docked_mode;
171 171
172 Setting<bool> vibration_enabled; 172 Setting<bool> vibration_enabled;
173 Setting<bool> enable_accurate_vibrations;
173 174
174 Setting<bool> motion_enabled; 175 Setting<bool> motion_enabled;
175 std::string motion_device; 176 std::string motion_device;