dinput: Clamp lMagnitude to -10000..10000 range.

This commit is contained in:
Vincent Pelletier 2009-01-24 03:45:11 +01:00 committed by Alexandre Julliard
parent 15a33ab209
commit e5abaf9f97
1 changed files with 1 additions and 1 deletions

View File

@ -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))