summaryrefslogtreecommitdiff
path: root/src/input_common/sdl/sdl_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/sdl/sdl_impl.cpp')
-rw-r--r--src/input_common/sdl/sdl_impl.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp
index d32eb732a..f67de37e3 100644
--- a/src/input_common/sdl/sdl_impl.cpp
+++ b/src/input_common/sdl/sdl_impl.cpp
@@ -81,10 +81,14 @@ public:
81 } 81 }
82 82
83 bool RumblePlay(u16 amp_low, u16 amp_high) { 83 bool RumblePlay(u16 amp_low, u16 amp_high) {
84 constexpr u32 rumble_max_duration_ms = 1000;
85
84 if (sdl_controller) { 86 if (sdl_controller) {
85 return SDL_GameControllerRumble(sdl_controller.get(), amp_low, amp_high, 0) == 0; 87 return SDL_GameControllerRumble(sdl_controller.get(), amp_low, amp_high,
88 rumble_max_duration_ms) == 0;
86 } else if (sdl_joystick) { 89 } else if (sdl_joystick) {
87 return SDL_JoystickRumble(sdl_joystick.get(), amp_low, amp_high, 0) == 0; 90 return SDL_JoystickRumble(sdl_joystick.get(), amp_low, amp_high,
91 rumble_max_duration_ms) == 0;
88 } 92 }
89 93
90 return false; 94 return false;
@@ -373,6 +377,16 @@ public:
373 return {}; 377 return {};
374 } 378 }
375 379
380 std::tuple<float, float> GetRawStatus() const override {
381 const float x = joystick->GetAxis(axis_x, range);
382 const float y = joystick->GetAxis(axis_y, range);
383 return {x, -y};
384 }
385
386 Input::AnalogProperties GetAnalogProperties() const override {
387 return {deadzone, range, 0.5f};
388 }
389
376 bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override { 390 bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override {
377 const auto [x, y] = GetStatus(); 391 const auto [x, y] = GetStatus();
378 const float directional_deadzone = 0.5f; 392 const float directional_deadzone = 0.5f;