From e5abaf9f97b169536029ef8a0d73cf484ae61c3b Mon Sep 17 00:00:00 2001 From: Vincent Pelletier Date: Sat, 24 Jan 2009 03:45:11 +0100 Subject: [PATCH] dinput: Clamp lMagnitude to -10000..10000 range. --- dlls/dinput/effect_linuxinput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c index 7302d7fccea..2854b34d445 100644 --- a/dlls/dinput/effect_linuxinput.c +++ b/dlls/dinput/effect_linuxinput.c @@ -664,7 +664,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters( if (peff->cbTypeSpecificParams != sizeof(DICONSTANTFORCE)) return DIERR_INVALIDPARAM; tsp = (LPCDICONSTANTFORCE)(peff->lpvTypeSpecificParams); - This->effect.u.constant.level = (tsp->lMagnitude / 10) * 32; + This->effect.u.constant.level = (max(min(tsp->lMagnitude, 10000), -10000) / 10) * 32; } else if (type == DIEFT_RAMPFORCE) { LPCDIRAMPFORCE tsp; if (peff->cbTypeSpecificParams != sizeof(DIRAMPFORCE))