Rémi Bernon : dinput: Implement HID joystick IDirectInputDevice8_EnumEffects.
Alexandre Julliard
julliard at winehq.org
Fri Oct 1 18:02:22 CDT 2021
Module: wine
Branch: master
Commit: 5b8daecabff01447e65db2df42fa165fbbe660b5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5b8daecabff01447e65db2df42fa165fbbe660b5
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Fri Oct 1 09:31:05 2021 +0200
dinput: Implement HID joystick IDirectInputDevice8_EnumEffects.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dinput/joystick_hid.c | 63 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 62 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index ac67625cddc..a43ecde0e9c 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -818,10 +818,71 @@ static HRESULT WINAPI hid_joystick_CreateEffect( IDirectInputDevice8W *iface, co
static HRESULT WINAPI hid_joystick_EnumEffects( IDirectInputDevice8W *iface, LPDIENUMEFFECTSCALLBACKW callback,
void *context, DWORD type )
{
- FIXME( "iface %p, callback %p, context %p, type %#x stub!\n", iface, callback, context, type );
+ DIEFFECTINFOW info = {.dwSize = sizeof(info)};
+ HRESULT hr;
+
+ TRACE( "iface %p, callback %p, context %p, type %#x.\n", iface, callback, context, type );
if (!callback) return DIERR_INVALIDPARAM;
+ type = DIEFT_GETTYPE( type );
+
+ if (type == DIEFT_ALL || type == DIEFT_CONSTANTFORCE)
+ {
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_ConstantForce );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+ }
+
+ if (type == DIEFT_ALL || type == DIEFT_RAMPFORCE)
+ {
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_RampForce );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+ }
+
+ if (type == DIEFT_ALL || type == DIEFT_PERIODIC)
+ {
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Square );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Sine );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Triangle );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_SawtoothUp );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_SawtoothDown );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+ }
+
+ if (type == DIEFT_ALL || type == DIEFT_CONDITION)
+ {
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Spring );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Damper );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Inertia );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+
+ hr = IDirectInputDevice8_GetEffectInfo( iface, &info, &GUID_Friction );
+ if (FAILED(hr) && hr != DIERR_DEVICENOTREG) return hr;
+ if (hr == DI_OK && callback( &info, context ) == DIENUM_STOP) return DI_OK;
+ }
+
return DI_OK;
}
More information about the wine-cvs
mailing list