diff options
Diffstat (limited to 'src/input_common/sdl/sdl_impl.cpp')
| -rw-r--r-- | src/input_common/sdl/sdl_impl.cpp | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index a2a83cdc9..a9f7e5103 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp | |||
| @@ -81,18 +81,6 @@ public: | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | bool RumblePlay(u16 amp_low, u16 amp_high) { | 83 | bool RumblePlay(u16 amp_low, u16 amp_high) { |
| 84 | using std::chrono::duration_cast; | ||
| 85 | using std::chrono::milliseconds; | ||
| 86 | using std::chrono::steady_clock; | ||
| 87 | |||
| 88 | // Block non-zero vibrations less than 10ms apart from each other. | ||
| 89 | if ((amp_low != 0 || amp_high != 0) && | ||
| 90 | duration_cast<milliseconds>(steady_clock::now() - last_vibration) < milliseconds(10)) { | ||
| 91 | return false; | ||
| 92 | } | ||
| 93 | |||
| 94 | last_vibration = steady_clock::now(); | ||
| 95 | |||
| 96 | if (sdl_controller) { | 84 | if (sdl_controller) { |
| 97 | return SDL_GameControllerRumble(sdl_controller.get(), amp_low, amp_high, 0) == 0; | 85 | return SDL_GameControllerRumble(sdl_controller.get(), amp_low, amp_high, 0) == 0; |
| 98 | } else if (sdl_joystick) { | 86 | } else if (sdl_joystick) { |
| @@ -171,9 +159,6 @@ private: | |||
| 171 | std::unique_ptr<SDL_GameController, decltype(&SDL_GameControllerClose)> sdl_controller; | 159 | std::unique_ptr<SDL_GameController, decltype(&SDL_GameControllerClose)> sdl_controller; |
| 172 | mutable std::mutex mutex; | 160 | mutable std::mutex mutex; |
| 173 | 161 | ||
| 174 | // This is the timepoint of the last vibration and is used to ensure vibrations are 10ms apart. | ||
| 175 | std::chrono::steady_clock::time_point last_vibration; | ||
| 176 | |||
| 177 | // Motion is initialized without PID values as motion input is not aviable for SDL2 | 162 | // Motion is initialized without PID values as motion input is not aviable for SDL2 |
| 178 | MotionInput motion{0.0f, 0.0f, 0.0f}; | 163 | MotionInput motion{0.0f, 0.0f, 0.0f}; |
| 179 | }; | 164 | }; |