Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- dlls/dinput/tests/joystick.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c index a3d7440367..810707c02a 100644 --- a/dlls/dinput/tests/joystick.c +++ b/dlls/dinput/tests/joystick.c @@ -600,6 +600,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef) struct DIPROPDWORD diprop_word; void *tmp; GUID guid = {0}; + DIEFFECT effect_empty;
hr = IDirectInputEffect_Initialize(effect, hInstance, data->version, &effect_data.guid); @@ -658,7 +659,15 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef) hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status); ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr); ok(effect_status==0,"IDirectInputEffect_GetEffectStatus() reported effect as started\n"); - hr = IDirectInputEffect_SetParameters(effect, &effect_data.eff, DIEP_START); + /* SetParameters with a zeroed-out DIEFFECT and flags=0 should do nothing. */ + memset(&effect_empty, 0, sizeof(effect_empty)); + effect_empty.dwSize = sizeof(effect_empty); + hr = IDirectInputEffect_SetParameters(effect, &effect_empty, 0); + todo_wine + ok(hr==DI_NOEFFECT,"IDirectInputEffect_SetParameters failed: %08x\n", hr); + /* Start effect with SetParameters and a zeroed-out DIEFFECT. */ + hr = IDirectInputEffect_SetParameters(effect, &effect_empty, DIEP_START); + todo_wine ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %08x\n", hr); hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status); ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr);
Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- I can't find any reference for why this code treats flags=0 as "set everything", my best guess is that it's an internal behavior meant for calling SetParameters() from CreateEffect(). It's not correct though, flags=0 really means "set nothing".
dlls/dinput/effect_linuxinput.c | 10 +++------- dlls/dinput/joystick_linuxinput.c | 5 ++++- dlls/dinput/tests/joystick.c | 2 -- 3 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c index ef21ecaa30..ec4b00b873 100644 --- a/dlls/dinput/effect_linuxinput.c +++ b/dlls/dinput/effect_linuxinput.c @@ -489,15 +489,11 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
TRACE("(this=%p,%p,%d)\n", This, peff, dwFlags);
- if ((dwFlags & ~DIEP_NORESTART & ~DIEP_NODOWNLOAD & ~DIEP_START) == 0) { - /* set everything */ - dwFlags = DIEP_AXES | DIEP_DIRECTION | DIEP_DURATION | DIEP_ENVELOPE | - DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_STARTDELAY | DIEP_TRIGGERBUTTON | - DIEP_TRIGGERREPEATINTERVAL | DIEP_TYPESPECIFICPARAMS; - } - dump_DIEFFECT(peff, &This->guid, dwFlags);
+ if (!dwFlags) + return DI_NOEFFECT; + if (dwFlags & DIEP_AXES) { if (!(peff->rgdwAxes)) return DIERR_INVALIDPARAM; diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index b5418d805c..b61913119c 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -1097,7 +1097,10 @@ static HRESULT WINAPI JoystickWImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, RE
if (lpeff != NULL) { - retval = IDirectInputEffect_SetParameters(new_effect->ref, lpeff, 0); + retval = IDirectInputEffect_SetParameters(new_effect->ref, lpeff, + DIEP_AXES | DIEP_DIRECTION | DIEP_DURATION | DIEP_ENVELOPE | + DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_STARTDELAY | DIEP_TRIGGERBUTTON | + DIEP_TRIGGERREPEATINTERVAL | DIEP_TYPESPECIFICPARAMS);
if (retval != DI_OK && retval != DI_DOWNLOADSKIPPED) { diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c index 810707c02a..f082c612b0 100644 --- a/dlls/dinput/tests/joystick.c +++ b/dlls/dinput/tests/joystick.c @@ -663,11 +663,9 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef) memset(&effect_empty, 0, sizeof(effect_empty)); effect_empty.dwSize = sizeof(effect_empty); hr = IDirectInputEffect_SetParameters(effect, &effect_empty, 0); - todo_wine ok(hr==DI_NOEFFECT,"IDirectInputEffect_SetParameters failed: %08x\n", hr); /* Start effect with SetParameters and a zeroed-out DIEFFECT. */ hr = IDirectInputEffect_SetParameters(effect, &effect_empty, DIEP_START); - todo_wine ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %08x\n", hr); hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status); ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr);