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

And convert it to IDirectInputEffect type GUID.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-04-29 13:53:35 +02:00 committed by Alexandre Julliard
parent d5edf656ef
commit 7a82be5d97
3 changed files with 29 additions and 3 deletions

View File

@ -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 );

View File

@ -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;

View File

@ -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,