diff options
| author | 2020-10-20 13:55:25 -0400 | |
|---|---|---|
| committer | 2020-11-15 23:33:20 -0500 | |
| commit | e9e1876e821b8bd1bb5c8254ec93e2cc479e16dd (patch) | |
| tree | 344b40a5a874cb188c6e7aa7d1622c77a215090d /src/input_common/gcadapter/gc_adapter.cpp | |
| parent | configure_input: Add per-player vibration (diff) | |
| download | yuzu-e9e1876e821b8bd1bb5c8254ec93e2cc479e16dd.tar.gz yuzu-e9e1876e821b8bd1bb5c8254ec93e2cc479e16dd.tar.xz yuzu-e9e1876e821b8bd1bb5c8254ec93e2cc479e16dd.zip | |
input_common: Add VibrationDevice and VibrationDeviceFactory
A vibration device is an input device that returns an unsigned byte as status.
It represents whether the vibration device supports vibration or not.
If the status returns 1, it supports vibration. Otherwise, it does not support vibration.
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/gcadapter/gc_adapter.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp index b912188b6..d80195c82 100644 --- a/src/input_common/gcadapter/gc_adapter.cpp +++ b/src/input_common/gcadapter/gc_adapter.cpp | |||
| @@ -230,10 +230,8 @@ void Adapter::SendVibrations() { | |||
| 230 | vibration_changed = false; | 230 | vibration_changed = false; |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | bool Adapter::RumblePlay(std::size_t port, f32 amplitude) { | 233 | bool Adapter::RumblePlay(std::size_t port, u8 amplitude) { |
| 234 | amplitude = std::clamp(amplitude, 0.0f, 1.0f); | 234 | pads[port].rumble_amplitude = amplitude; |
| 235 | const auto raw_amp = static_cast<u8>(amplitude * 0x8); | ||
| 236 | pads[port].rumble_amplitude = raw_amp; | ||
| 237 | 235 | ||
| 238 | return rumble_enabled; | 236 | return rumble_enabled; |
| 239 | } | 237 | } |