diff options
| author | 2020-10-27 13:33:25 -0400 | |
|---|---|---|
| committer | 2020-11-15 23:33:21 -0500 | |
| commit | 97b2220a822548eed83993fceebe0e611dbec84b (patch) | |
| tree | e4e90772c0ca7cccf3dd95d9cb49a600d0fabfb8 /src/core | |
| parent | sdl_impl: Revert to the "old" method of mapping sticks (diff) | |
| download | yuzu-97b2220a822548eed83993fceebe0e611dbec84b.tar.gz yuzu-97b2220a822548eed83993fceebe0e611dbec84b.tar.xz yuzu-97b2220a822548eed83993fceebe0e611dbec84b.zip | |
general: Fix compiler warnings on linux and miscellaneous changes
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 17 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index cfafabbd8..30715267c 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -287,7 +287,7 @@ void Controller_NPad::OnLoadInputDevices() { | |||
| 287 | void Controller_NPad::OnRelease() { | 287 | void Controller_NPad::OnRelease() { |
| 288 | for (std::size_t npad_idx = 0; npad_idx < vibrations.size(); ++npad_idx) { | 288 | for (std::size_t npad_idx = 0; npad_idx < vibrations.size(); ++npad_idx) { |
| 289 | for (std::size_t device_idx = 0; device_idx < vibrations[npad_idx].size(); ++device_idx) { | 289 | for (std::size_t device_idx = 0; device_idx < vibrations[npad_idx].size(); ++device_idx) { |
| 290 | VibrateControllerAtIndex(npad_idx, device_idx); | 290 | VibrateControllerAtIndex(npad_idx, device_idx, {}); |
| 291 | } | 291 | } |
| 292 | } | 292 | } |
| 293 | } | 293 | } |
| @@ -720,11 +720,14 @@ bool Controller_NPad::VibrateControllerAtIndex(std::size_t npad_index, std::size | |||
| 720 | last_vibration_timepoints[npad_index][device_index] = now; | 720 | last_vibration_timepoints[npad_index][device_index] = now; |
| 721 | } | 721 | } |
| 722 | 722 | ||
| 723 | return vibrations[npad_index][device_index]->SetRumblePlay( | 723 | auto& vibration = vibrations[npad_index][device_index]; |
| 724 | std::min(vibration_value.amp_low * player.vibration_strength / 100.0f, 1.0f), | 724 | const auto player_vibration_strength = static_cast<f32>(player.vibration_strength); |
| 725 | vibration_value.freq_low, | 725 | const auto amp_low = |
| 726 | std::min(vibration_value.amp_high * player.vibration_strength / 100.0f, 1.0f), | 726 | std::min(vibration_value.amp_low * player_vibration_strength / 100.0f, 1.0f); |
| 727 | vibration_value.freq_high); | 727 | const auto amp_high = |
| 728 | std::min(vibration_value.amp_high * player_vibration_strength / 100.0f, 1.0f); | ||
| 729 | return vibration->SetRumblePlay(amp_low, vibration_value.freq_low, amp_high, | ||
| 730 | vibration_value.freq_high); | ||
| 728 | } | 731 | } |
| 729 | 732 | ||
| 730 | void Controller_NPad::VibrateController(const DeviceHandle& vibration_device_handle, | 733 | void Controller_NPad::VibrateController(const DeviceHandle& vibration_device_handle, |
| @@ -855,7 +858,7 @@ void Controller_NPad::DisconnectNpad(u32 npad_id) { | |||
| 855 | void Controller_NPad::DisconnectNpadAtIndex(std::size_t npad_index) { | 858 | void Controller_NPad::DisconnectNpadAtIndex(std::size_t npad_index) { |
| 856 | for (std::size_t device_idx = 0; device_idx < vibrations[npad_index].size(); ++device_idx) { | 859 | for (std::size_t device_idx = 0; device_idx < vibrations[npad_index].size(); ++device_idx) { |
| 857 | // Send an empty vibration to stop any vibrations. | 860 | // Send an empty vibration to stop any vibrations. |
| 858 | VibrateControllerAtIndex(npad_index, device_idx); | 861 | VibrateControllerAtIndex(npad_index, device_idx, {}); |
| 859 | vibration_devices_mounted[npad_index][device_idx] = false; | 862 | vibration_devices_mounted[npad_index][device_idx] = false; |
| 860 | } | 863 | } |
| 861 | 864 | ||
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index f5122124c..99384524b 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -149,7 +149,7 @@ public: | |||
| 149 | void SetNpadMode(u32 npad_id, NpadAssignments assignment_mode); | 149 | void SetNpadMode(u32 npad_id, NpadAssignments assignment_mode); |
| 150 | 150 | ||
| 151 | bool VibrateControllerAtIndex(std::size_t npad_index, std::size_t device_index, | 151 | bool VibrateControllerAtIndex(std::size_t npad_index, std::size_t device_index, |
| 152 | const VibrationValue& vibration_value = {}); | 152 | const VibrationValue& vibration_value); |
| 153 | 153 | ||
| 154 | void VibrateController(const DeviceHandle& vibration_device_handle, | 154 | void VibrateController(const DeviceHandle& vibration_device_handle, |
| 155 | const VibrationValue& vibration_value); | 155 | const VibrationValue& vibration_value); |