Rémi Bernon : dinput: Stub IDirectInputDevice8_GetForceFeedbackState implementation.

Alexandre Julliard julliard at winehq.org
Wed Nov 24 15:17:18 CST 2021


Module: wine
Branch: master
Commit: 5abf6efcd96bd2edfce6b69b099c86f525b606cc
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5abf6efcd96bd2edfce6b69b099c86f525b606cc

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed Nov 24 16:09:41 2021 +0100

dinput: Stub IDirectInputDevice8_GetForceFeedbackState implementation.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52062
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput/device.c     | 12 ++++++++++--
 dlls/dinput8/tests/hid.c | 10 ----------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 02a71e6923c..19fbe724b56 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -1762,9 +1762,17 @@ static HRESULT WINAPI dinput_device_GetEffectInfo( IDirectInputDevice8W *iface,
 
 static HRESULT WINAPI dinput_device_GetForceFeedbackState( IDirectInputDevice8W *iface, DWORD *out )
 {
-    FIXME( "iface %p, out %p stub!\n", iface, out );
+    struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface );
+
+    FIXME( "iface %p, out %p semi-stub!\n", iface, out );
+
     if (!out) return E_POINTER;
-    return DIERR_UNSUPPORTED;
+    *out = 0;
+
+    if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED;
+    if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) return DIERR_NOTEXCLUSIVEACQUIRED;
+
+    return DI_OK;
 }
 
 static HRESULT WINAPI dinput_device_SendForceFeedbackCommand( IDirectInputDevice8W *iface, DWORD command )
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index bcff4b59846..bda738bc178 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -8062,7 +8062,6 @@ static void test_force_feedback_joystick( DWORD version )
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
     ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    todo_wine
     ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetForceFeedbackState returned %#x\n", hr );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_RESET );
     ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "SendForceFeedbackCommand returned %#x\n", hr );
@@ -8819,7 +8818,6 @@ static void test_device_managed_effect(void)
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
     ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    todo_wine
     ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetForceFeedbackState returned %#x\n", hr );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_RESET );
     ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "SendForceFeedbackCommand returned %#x\n", hr );
@@ -8839,7 +8837,6 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    todo_wine
     ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
     flags = DIGFFS_STOPPED|DIGFFS_EMPTY;
     todo_wine
@@ -8863,7 +8860,6 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    todo_wine
     ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
     flags = DIGFFS_PAUSED|DIGFFS_EMPTY|DIGFFS_ACTUATORSON|DIGFFS_POWERON|DIGFFS_SAFETYSWITCHON|DIGFFS_USERFFSWITCHON;
     todo_wine
@@ -8910,7 +8906,6 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    todo_wine
     ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
     flags = DIGFFS_STOPPED|DIGFFS_EMPTY;
     todo_wine
@@ -8931,7 +8926,6 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    todo_wine
     ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
     flags = DIGFFS_STOPPED;
     todo_wine
@@ -8969,7 +8963,6 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    todo_wine
     ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
     flags = DIGFFS_ACTUATORSOFF|DIGFFS_POWEROFF|DIGFFS_SAFETYSWITCHOFF|DIGFFS_USERFFSWITCHOFF;
     todo_wine
@@ -8988,7 +8981,6 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    todo_wine
     ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
     flags = DIGFFS_PAUSED|DIGFFS_ACTUATORSON|DIGFFS_POWEROFF|DIGFFS_SAFETYSWITCHOFF|DIGFFS_USERFFSWITCHOFF;
     todo_wine
@@ -9009,7 +9001,6 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    todo_wine
     ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
     flags = DIGFFS_PAUSED|DIGFFS_ACTUATORSON|DIGFFS_POWEROFF|DIGFFS_SAFETYSWITCHOFF|DIGFFS_USERFFSWITCHOFF;
     todo_wine
@@ -9030,7 +9021,6 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    todo_wine
     ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
     flags = DIGFFS_EMPTY|DIGFFS_PAUSED|DIGFFS_ACTUATORSON|DIGFFS_POWEROFF|DIGFFS_SAFETYSWITCHOFF|DIGFFS_USERFFSWITCHOFF;
     todo_wine




More information about the wine-cvs mailing list