[PATCH 2/6] windows.gaming.input: Return an empty vector from RawGameController_get_ForceFeedbackMotors.

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


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/tests/force_feedback.c            |  3 +--
 dlls/windows.gaming.input/controller.c        | 19 +++++++++++++++++--
 .../windows.gaming.input.forcefeedback.idl    |  3 +++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c
index 42f3bdc84c7..9880b65aca2 100644
--- a/dlls/dinput/tests/force_feedback.c
+++ b/dlls/dinput/tests/force_feedback.c
@@ -5284,10 +5284,8 @@ static void test_windows_gaming_input(void)
 
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IRawGameController_get_ForceFeedbackMotors( raw_controller, &motors_view );
-    todo_wine
     ok( hr == S_OK, "get_ForceFeedbackMotors returned %#lx\n", hr );
     wait_hid_expect_( __FILE__, __LINE__, file, 100, TRUE ); /* device gain reports are written asynchronously */
-    if (!motors_view) goto skip_tests;
 
     hr = IVectorView_ForceFeedbackMotor_get_Size( motors_view, &size );
     ok( hr == S_OK, "get_Size returned %#lx\n", hr );
@@ -5297,6 +5295,7 @@ static void test_windows_gaming_input(void)
     todo_wine
     ok( hr == S_OK, "GetAt returned %#lx\n", hr );
     IVectorView_ForceFeedbackMotor_Release( motors_view );
+    if (hr != S_OK) goto skip_tests;
 
     check_interface( motor, &IID_IUnknown, TRUE );
     check_interface( motor, &IID_IInspectable, TRUE );
diff --git a/dlls/windows.gaming.input/controller.c b/dlls/windows.gaming.input/controller.c
index 03a3ae398cf..d68da6b3142 100644
--- a/dlls/windows.gaming.input/controller.c
+++ b/dlls/windows.gaming.input/controller.c
@@ -229,8 +229,23 @@ static HRESULT WINAPI raw_controller_get_ButtonCount( IRawGameController *iface,
 
 static HRESULT WINAPI raw_controller_get_ForceFeedbackMotors( IRawGameController *iface, IVectorView_ForceFeedbackMotor **value )
 {
-    FIXME( "iface %p, value %p stub!\n", iface, value );
-    return E_NOTIMPL;
+    static const struct vector_iids iids =
+    {
+        .vector = &IID_IVector_ForceFeedbackMotor,
+        .view = &IID_IVectorView_ForceFeedbackMotor,
+        .iterable = &IID_IIterable_ForceFeedbackMotor,
+        .iterator = &IID_IIterator_ForceFeedbackMotor,
+    };
+    IVector_ForceFeedbackMotor *vector;
+    HRESULT hr;
+
+    TRACE( "iface %p, value %p\n", iface, value );
+
+    if (FAILED(hr = vector_create( &iids, (void **)&vector ))) return hr;
+    hr = IVector_ForceFeedbackMotor_GetView( vector, value );
+    IVector_ForceFeedbackMotor_Release( vector );
+
+    return hr;
 }
 
 static HRESULT WINAPI raw_controller_get_HardwareProductId( IRawGameController *iface, UINT16 *value )
diff --git a/include/windows.gaming.input.forcefeedback.idl b/include/windows.gaming.input.forcefeedback.idl
index 432b60a5592..639e0c5cd57 100644
--- a/include/windows.gaming.input.forcefeedback.idl
+++ b/include/windows.gaming.input.forcefeedback.idl
@@ -36,7 +36,10 @@ namespace Windows.Gaming.Input.ForceFeedback {
     declare {
         interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Gaming.Input.ForceFeedback.ForceFeedbackLoadEffectResult>;
         interface Windows.Foundation.IAsyncOperation<Windows.Gaming.Input.ForceFeedback.ForceFeedbackLoadEffectResult>;
+        interface Windows.Foundation.Collections.IIterator<Windows.Gaming.Input.ForceFeedback.ForceFeedbackMotor *>;
+        interface Windows.Foundation.Collections.IIterable<Windows.Gaming.Input.ForceFeedback.ForceFeedbackMotor *>;
         interface Windows.Foundation.Collections.IVectorView<Windows.Gaming.Input.ForceFeedback.ForceFeedbackMotor *>;
+        interface Windows.Foundation.Collections.IVector<Windows.Gaming.Input.ForceFeedback.ForceFeedbackMotor *>;
     }
 
     [
-- 
2.35.1




More information about the wine-devel mailing list