Commit 7a82be5d authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

windows.gaming.input: Add a type parameter to force_feedback_effect_create.

And convert it to IDirectInputEffect type GUID. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d5edf656
......@@ -205,7 +205,7 @@ static HRESULT WINAPI activation_ActivateInstance( IActivationFactory *iface, II
impl->IConstantForceEffect_iface.lpVtbl = &effect_vtbl;
impl->ref = 1;
if (FAILED(hr = force_feedback_effect_create( (IInspectable *)&impl->IConstantForceEffect_iface,
if (FAILED(hr = force_feedback_effect_create( WineForceFeedbackEffectType_Constant, (IInspectable *)&impl->IConstantForceEffect_iface,
&impl->IWineForceFeedbackEffectImpl_inner )))
{
free( impl );
......
......@@ -33,6 +33,12 @@ struct effect
IForceFeedbackEffect IForceFeedbackEffect_iface;
IInspectable *IInspectable_outer;
LONG ref;
GUID type;
DWORD axes[3];
LONG directions[3];
DICONSTANTFORCE constant_force;
DIEFFECT params;
};
static inline struct effect *impl_from_IWineForceFeedbackEffectImpl( IWineForceFeedbackEffectImpl *iface )
......@@ -143,7 +149,7 @@ static const struct IForceFeedbackEffectVtbl effect_vtbl =
effect_Stop,
};
HRESULT force_feedback_effect_create( IInspectable *outer, IWineForceFeedbackEffectImpl **out )
HRESULT force_feedback_effect_create( enum WineForceFeedbackEffectType type, IInspectable *outer, IWineForceFeedbackEffectImpl **out )
{
struct effect *impl;
......@@ -155,6 +161,26 @@ HRESULT force_feedback_effect_create( IInspectable *outer, IWineForceFeedbackEff
impl->IInspectable_outer = outer;
impl->ref = 1;
switch (type)
{
case WineForceFeedbackEffectType_Constant:
impl->type = GUID_ConstantForce;
impl->params.lpvTypeSpecificParams = &impl->constant_force;
impl->params.cbTypeSpecificParams = sizeof(impl->constant_force);
break;
}
impl->params.dwSize = sizeof(DIEFFECT);
impl->params.rgdwAxes = impl->axes;
impl->params.rglDirection = impl->directions;
impl->params.dwTriggerButton = -1;
impl->params.dwGain = 10000;
impl->params.dwFlags = DIEFF_CARTESIAN|DIEFF_OBJECTOFFSETS;
impl->params.cAxes = 0;
impl->axes[0] = DIJOFS_X;
impl->axes[1] = DIJOFS_Y;
impl->axes[2] = DIJOFS_Z;
*out = &impl->IWineForceFeedbackEffectImpl_iface;
TRACE( "created ForceFeedbackEffect %p\n", *out );
return S_OK;
......
......@@ -71,7 +71,7 @@ extern HRESULT event_handlers_remove( struct list *list, EventRegistrationToken
extern void event_handlers_notify( struct list *list, IInspectable *element );
extern HRESULT force_feedback_motor_create( IDirectInputDevice8W *device, IForceFeedbackMotor **out );
extern HRESULT force_feedback_effect_create( IInspectable *outer, IWineForceFeedbackEffectImpl **out );
extern HRESULT force_feedback_effect_create( enum WineForceFeedbackEffectType type, IInspectable *outer, IWineForceFeedbackEffectImpl **out );
typedef HRESULT (WINAPI *async_operation_callback)( IUnknown *invoker, IUnknown *param, PROPVARIANT *result );
extern HRESULT async_operation_boolean_create( IUnknown *invoker, IUnknown *param, async_operation_callback callback,
......
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