aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rumble.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rumble.c b/src/rumble.c
index 21a6a73..5e782b7 100644
--- a/src/rumble.c
+++ b/src/rumble.c
@@ -20,6 +20,12 @@ static fx32 timer = 0;
void set_rumble(f32 duration, f32 strength)
{
+ // Sanity check
+ if(strength > 1.0f)
+ strength = 1.0f;
+ else if(strength < 0.0f)
+ strength = 0.0f;
+
XINPUT_VIBRATION state = {};
state.wLeftMotorSpeed = (unsigned)(strength * 65535.0f);
state.wRightMotorSpeed = (unsigned)(strength * 65535.0f);