Rémi Bernon : windows.gaming.input: Add a type parameter to force_feedback_effect_create.
Alexandre Julliard
julliard at winehq.org
Mon May 16 15:37:57 CDT 2022
Module: wine
Branch: master
Commit: 7a82be5d977154bca942dbcd0de3ad537bda1c3f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=7a82be5d977154bca942dbcd0de3ad537bda1c3f
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Fri Apr 29 13:53:35 2022 +0200
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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/windows.gaming.input/constant_effect.c | 2 +-
dlls/windows.gaming.input/force_feedback.c | 28 +++++++++++++++++++++++++++-
dlls/windows.gaming.input/private.h | 2 +-
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/dlls/windows.gaming.input/constant_effect.c b/dlls/windows.gaming.input/constant_effect.c
index ae0c0f9904d..928927144b9 100644
--- a/dlls/windows.gaming.input/constant_effect.c
+++ b/dlls/windows.gaming.input/constant_effect.c
@@ -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 );
diff --git a/dlls/windows.gaming.input/force_feedback.c b/dlls/windows.gaming.input/force_feedback.c
index ab29a179c6a..9d3ead5fc2b 100644
--- a/dlls/windows.gaming.input/force_feedback.c
+++ b/dlls/windows.gaming.input/force_feedback.c
@@ -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;
diff --git a/dlls/windows.gaming.input/private.h b/dlls/windows.gaming.input/private.h
index 58378304a26..f8edff61455 100644
--- a/dlls/windows.gaming.input/private.h
+++ b/dlls/windows.gaming.input/private.h
@@ -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,
More information about the wine-cvs
mailing list