Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/ansi.c | 27 +++++++++++ dlls/dinput/device.c | 12 ----- dlls/dinput/joystick_linuxinput.c | 76 +------------------------------ 3 files changed, 28 insertions(+), 87 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index 36b17812f32..eb331891f25 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -219,6 +219,33 @@ HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect( IDirectInputDevice8A *ifac return IDirectInputDevice8_CreateEffect( iface_w, guid, effect, out, outer ); }
+struct enum_effects_wtoa_params +{ + LPDIENUMEFFECTSCALLBACKA callback; + void *ref; +}; + +static BOOL CALLBACK enum_effects_wtoa_callback( const DIEFFECTINFOW *info_w, void *ref ) +{ + struct enum_effects_wtoa_params *params = ref; + DIEFFECTINFOA info_a = {sizeof(info_a)}; + + dieffectinfo_wtoa( info_w, &info_a ); + return params->callback( &info_a, params->ref ); +} + +HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects( IDirectInputDevice8A *iface_a, LPDIENUMEFFECTSCALLBACKA callback, + void *ref, DWORD type ) +{ + struct enum_effects_wtoa_params params = {callback, ref}; + IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); + + if (!callback) return DIERR_INVALIDPARAM; + + return IDirectInputDevice8_EnumEffects( iface_w, enum_effects_wtoa_callback, ¶ms, type ); +} + HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo( IDirectInputDevice8A *iface_a, DIEFFECTINFOA *info_a, REFGUID guid ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 850a4a09c37..abdb235c097 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1587,18 +1587,6 @@ HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface return DIERR_UNSUPPORTED; }
-HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects( - LPDIRECTINPUTDEVICE8A iface, - LPDIENUMEFFECTSCALLBACKA lpCallback, - LPVOID lpvRef, - DWORD dwFlags) -{ - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface); - FIXME("%p)->(%p,%p,0x%08x): stub!\n", This, lpCallback, lpvRef, dwFlags); - - return DI_OK; -} - HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( LPDIRECTINPUTDEVICE8W iface, LPDIENUMEFFECTSCALLBACKW lpCallback, diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index dc7f5491c81..307b447d237 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -1093,80 +1093,6 @@ static HRESULT WINAPI JoystickWImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, RE /******************************************************************************* * EnumEffects - Enumerate available FF effects */ -static HRESULT WINAPI JoystickAImpl_EnumEffects(LPDIRECTINPUTDEVICE8A iface, - LPDIENUMEFFECTSCALLBACKA lpCallback, - LPVOID pvRef, - DWORD dwEffType) -{ -#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION - DIEFFECTINFOA dei; /* feif */ - DWORD type = DIEFT_GETTYPE(dwEffType); - JoystickImpl* This = impl_from_IDirectInputDevice8A(iface); - - TRACE("(this=%p,%p,%d) type=%d\n", This, pvRef, dwEffType, type); - - dei.dwSize = sizeof(DIEFFECTINFOA); - - if ((type == DIEFT_ALL || type == DIEFT_CONSTANTFORCE) - && test_bit(This->joydev->ffbits, FF_CONSTANT)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_ConstantForce); - (*lpCallback)(&dei, pvRef); - } - - if ((type == DIEFT_ALL || type == DIEFT_PERIODIC) - && test_bit(This->joydev->ffbits, FF_PERIODIC)) { - if (test_bit(This->joydev->ffbits, FF_SQUARE)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Square); - (*lpCallback)(&dei, pvRef); - } - if (test_bit(This->joydev->ffbits, FF_SINE)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Sine); - (*lpCallback)(&dei, pvRef); - } - if (test_bit(This->joydev->ffbits, FF_TRIANGLE)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Triangle); - (*lpCallback)(&dei, pvRef); - } - if (test_bit(This->joydev->ffbits, FF_SAW_UP)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_SawtoothUp); - (*lpCallback)(&dei, pvRef); - } - if (test_bit(This->joydev->ffbits, FF_SAW_DOWN)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_SawtoothDown); - (*lpCallback)(&dei, pvRef); - } - } - - if ((type == DIEFT_ALL || type == DIEFT_RAMPFORCE) - && test_bit(This->joydev->ffbits, FF_RAMP)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_RampForce); - (*lpCallback)(&dei, pvRef); - } - - if (type == DIEFT_ALL || type == DIEFT_CONDITION) { - if (test_bit(This->joydev->ffbits, FF_SPRING)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Spring); - (*lpCallback)(&dei, pvRef); - } - if (test_bit(This->joydev->ffbits, FF_DAMPER)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Damper); - (*lpCallback)(&dei, pvRef); - } - if (test_bit(This->joydev->ffbits, FF_INERTIA)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Inertia); - (*lpCallback)(&dei, pvRef); - } - if (test_bit(This->joydev->ffbits, FF_FRICTION)) { - IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Friction); - (*lpCallback)(&dei, pvRef); - } - } - -#endif - - return DI_OK; -} - static HRESULT WINAPI JoystickWImpl_EnumEffects(LPDIRECTINPUTDEVICE8W iface, LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID pvRef, @@ -1428,7 +1354,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize, IDirectInputDevice2AImpl_CreateEffect, - JoystickAImpl_EnumEffects, + IDirectInputDevice2AImpl_EnumEffects, IDirectInputDevice2AImpl_GetEffectInfo, IDirectInputDevice2AImpl_GetForceFeedbackState, IDirectInputDevice2AImpl_SendForceFeedbackCommand,