Commit 7d88a12d authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

dinput: Fix calculation of too small periods for periodic effect.

Based on ideas by Elias Vanderstuyft. Signed-off-by: 's avatarBruno Jesus <00cpxxx@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f68e131e
......@@ -588,19 +588,29 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
if (dwFlags & DIEP_TRIGGERREPEATINTERVAL)
This->effect.trigger.interval = peff->dwTriggerRepeatInterval / 1000;
if (dwFlags & DIEP_TYPESPECIFICPARAMS) {
if (!(peff->lpvTypeSpecificParams))
return DIERR_INCOMPLETEEFFECT;
if (type == DIEFT_PERIODIC) {
LPCDIPERIODIC tsp;
if (dwFlags & DIEP_TYPESPECIFICPARAMS)
{
if (!(peff->lpvTypeSpecificParams))
return DIERR_INCOMPLETEEFFECT;
if (type == DIEFT_PERIODIC)
{
DIPERIODIC *tsp;
if (peff->cbTypeSpecificParams != sizeof(DIPERIODIC))
return DIERR_INVALIDPARAM;
tsp = peff->lpvTypeSpecificParams;
This->effect.u.periodic.magnitude = (tsp->dwMagnitude / 10) * 32;
This->effect.u.periodic.offset = (tsp->lOffset / 10) * 32;
This->effect.u.periodic.phase = (tsp->dwPhase / 9) * 8; /* == (/ 36 * 32) */
This->effect.u.periodic.period = tsp->dwPeriod / 1000;
} else if (type == DIEFT_CONSTANTFORCE) {
This->effect.u.periodic.magnitude = (tsp->dwMagnitude / 10) * 32;
This->effect.u.periodic.offset = (tsp->lOffset / 10) * 32;
This->effect.u.periodic.phase = (tsp->dwPhase / 9) * 8; /* == (/ 36 * 32) */
/* dinput uses microseconds, linux uses miliseconds */
if (tsp->dwPeriod <= 1000)
This->effect.u.periodic.period = 1;
else
This->effect.u.periodic.period = tsp->dwPeriod / 1000;
}
else if (type == DIEFT_CONSTANTFORCE)
{
LPCDICONSTANTFORCE tsp;
if (peff->cbTypeSpecificParams != sizeof(DICONSTANTFORCE))
return DIERR_INVALIDPARAM;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment