Commit 5b8daeca authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Implement HID joystick IDirectInputDevice8_EnumEffects.

parent 84e58612
......@@ -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;
}
......
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