[PATCH 6/6] windows.gaming.input: Implement IForceFeedbackMotor_(Pause|Resume|StopAll)Effects.

Rémi Bernon rbernon at codeweavers.com
Mon Apr 25 07:56:20 CDT 2022


And IForceFeedbackMotor_get_AreEffectsPaused.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/tests/force_feedback.c         |  8 -----
 dlls/windows.gaming.input/force_feedback.c | 34 +++++++++++++++++-----
 2 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c
index 5b4bfade9bc..51a6df7222d 100644
--- a/dlls/dinput/tests/force_feedback.c
+++ b/dlls/dinput/tests/force_feedback.c
@@ -5070,7 +5070,6 @@ static void test_windows_gaming_input(void)
         .report_id = 1,
         .report_len = 2,
         .report_buf = {1, 0x02},
-        .todo = TRUE,
     };
     static struct hid_expect expect_resume =
     {
@@ -5078,7 +5077,6 @@ static void test_windows_gaming_input(void)
         .report_id = 1,
         .report_len = 2,
         .report_buf = {1, 0x03},
-        .todo = TRUE,
     };
     static struct hid_expect expect_stop =
     {
@@ -5086,7 +5084,6 @@ static void test_windows_gaming_input(void)
         .report_id = 1,
         .report_len = 2,
         .report_buf = {1, 0x06},
-        .todo = TRUE,
     };
     static struct hid_expect expect_disable =
     {
@@ -5299,9 +5296,7 @@ static void test_windows_gaming_input(void)
 
     paused = TRUE;
     hr = IForceFeedbackMotor_get_AreEffectsPaused( motor, &paused );
-    todo_wine
     ok( hr == S_OK, "get_AreEffectsPaused returned %#lx\n", hr );
-    todo_wine
     ok( paused == FALSE, "got paused %u\n", paused );
 
     gain = 12345.6;
@@ -5329,15 +5324,12 @@ static void test_windows_gaming_input(void)
 
     set_hid_expect( file, &expect_pause, sizeof(expect_pause) );
     hr = IForceFeedbackMotor_PauseAllEffects( motor );
-    todo_wine
     ok( hr == S_OK, "PauseAllEffects returned %#lx\n", hr );
     set_hid_expect( file, &expect_resume, sizeof(expect_resume) );
     hr = IForceFeedbackMotor_ResumeAllEffects( motor );
-    todo_wine
     ok( hr == S_OK, "ResumeAllEffects returned %#lx\n", hr );
     set_hid_expect( file, &expect_stop, sizeof(expect_stop) );
     hr = IForceFeedbackMotor_StopAllEffects( motor );
-    todo_wine
     ok( hr == S_OK, "StopAllEffects returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
diff --git a/dlls/windows.gaming.input/force_feedback.c b/dlls/windows.gaming.input/force_feedback.c
index 6d4e533bc77..fad5ade402c 100644
--- a/dlls/windows.gaming.input/force_feedback.c
+++ b/dlls/windows.gaming.input/force_feedback.c
@@ -105,8 +105,17 @@ static HRESULT WINAPI motor_GetTrustLevel( IForceFeedbackMotor *iface, TrustLeve
 
 static HRESULT WINAPI motor_get_AreEffectsPaused( IForceFeedbackMotor *iface, BOOLEAN *value )
 {
-    FIXME( "iface %p, value %p stub!\n", iface, value );
-    return E_NOTIMPL;
+    struct motor *impl = impl_from_IForceFeedbackMotor( iface );
+    DWORD state;
+    HRESULT hr;
+
+    TRACE( "iface %p, value %p.\n", iface, value );
+
+    if (FAILED(hr = IDirectInputDevice8_GetForceFeedbackState( impl->device, &state )))
+        return hr;
+
+    *value = (state & DIGFFS_PAUSED);
+    return S_OK;
 }
 
 static HRESULT WINAPI motor_get_MasterGain( IForceFeedbackMotor *iface, double *value )
@@ -171,20 +180,29 @@ static HRESULT WINAPI motor_LoadEffectAsync( IForceFeedbackMotor *iface, IForceF
 
 static HRESULT WINAPI motor_PauseAllEffects( IForceFeedbackMotor *iface )
 {
-    FIXME( "iface %p stub!\n", iface );
-    return E_NOTIMPL;
+    struct motor *impl = impl_from_IForceFeedbackMotor( iface );
+
+    TRACE( "iface %p.\n", iface );
+
+    return IDirectInputDevice8_SendForceFeedbackCommand( impl->device, DISFFC_PAUSE );
 }
 
 static HRESULT WINAPI motor_ResumeAllEffects( IForceFeedbackMotor *iface )
 {
-    FIXME( "iface %p stub!\n", iface );
-    return E_NOTIMPL;
+    struct motor *impl = impl_from_IForceFeedbackMotor( iface );
+
+    TRACE( "iface %p.\n", iface );
+
+    return IDirectInputDevice8_SendForceFeedbackCommand( impl->device, DISFFC_CONTINUE );
 }
 
 static HRESULT WINAPI motor_StopAllEffects( IForceFeedbackMotor *iface )
 {
-    FIXME( "iface %p stub!\n", iface );
-    return E_NOTIMPL;
+    struct motor *impl = impl_from_IForceFeedbackMotor( iface );
+
+    TRACE( "iface %p.\n", iface );
+
+    return IDirectInputDevice8_SendForceFeedbackCommand( impl->device, DISFFC_STOPALL );
 }
 
 static HRESULT WINAPI motor_TryDisableAsync( IForceFeedbackMotor *iface, IAsyncOperation_boolean **async_op )
-- 
2.35.1




More information about the wine-devel mailing list