dinput: Clamp lMagnitude to -10000..10000 range.
This commit is contained in:
parent
15a33ab209
commit
e5abaf9f97
|
@ -664,7 +664,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
|
||||||
if (peff->cbTypeSpecificParams != sizeof(DICONSTANTFORCE))
|
if (peff->cbTypeSpecificParams != sizeof(DICONSTANTFORCE))
|
||||||
return DIERR_INVALIDPARAM;
|
return DIERR_INVALIDPARAM;
|
||||||
tsp = (LPCDICONSTANTFORCE)(peff->lpvTypeSpecificParams);
|
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) {
|
} else if (type == DIEFT_RAMPFORCE) {
|
||||||
LPCDIRAMPFORCE tsp;
|
LPCDIRAMPFORCE tsp;
|
||||||
if (peff->cbTypeSpecificParams != sizeof(DIRAMPFORCE))
|
if (peff->cbTypeSpecificParams != sizeof(DIRAMPFORCE))
|
||||||
|
|
Loading…
Reference in New Issue