Rémi Bernon : dinput: Stub support for DIPROP_FFLOAD device property.

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


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

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

dinput: Stub support for DIPROP_FFLOAD device property.

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       | 5 +++++
 dlls/dinput/joystick_hid.c | 8 ++++++++
 dlls/dinput8/tests/hid.c   | 9 ---------
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 6240d640e0d..02a71e6923c 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -1056,6 +1056,10 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con
             if (!impl->object_properties) return DIERR_UNSUPPORTED;
             break;
 
+        case (DWORD_PTR)DIPROP_FFLOAD:
+            if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED;
+            if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) return DIERR_NOTEXCLUSIVEACQUIRED;
+            /* fallthrough */
         case (DWORD_PTR)DIPROP_PRODUCTNAME:
         case (DWORD_PTR)DIPROP_INSTANCENAME:
         case (DWORD_PTR)DIPROP_VIDPID:
@@ -1173,6 +1177,7 @@ static HRESULT dinput_device_get_property( IDirectInputDevice8W *iface, const GU
     case (DWORD_PTR)DIPROP_VIDPID:
     case (DWORD_PTR)DIPROP_JOYSTICKID:
     case (DWORD_PTR)DIPROP_GUIDANDPATH:
+    case (DWORD_PTR)DIPROP_FFLOAD:
         return impl->vtbl->get_property( iface, LOWORD( guid ), header, NULL );
 
     case (DWORD_PTR)DIPROP_RANGE:
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 99436bd8b05..971e775867f 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -824,6 +824,14 @@ static HRESULT hid_joystick_get_property( IDirectInputDevice8W *iface, DWORD pro
         lstrcpynW( value->wszPath, impl->device_path, MAX_PATH );
         return DI_OK;
     }
+    case (DWORD_PTR)DIPROP_FFLOAD:
+    {
+        DIPROPDWORD *value = (DIPROPDWORD *)header;
+        if (!(impl->base.caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED;
+        if (!impl->base.acquired || !(impl->base.dwCoopLevel & DISCL_EXCLUSIVE)) return DIERR_NOTEXCLUSIVEACQUIRED;
+        value->dwData = 0;
+        return DI_OK;
+    }
     }
 
     return DIERR_UNSUPPORTED;
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index f3d35e57ce1..bcff4b59846 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -7990,7 +7990,6 @@ static void test_force_feedback_joystick( DWORD version )
     ok( prop_dword.dwData == 10000, "got %u expected %u\n", prop_dword.dwData, 10000 );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    todo_wine
     ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
 
     hr = IDirectInputDevice8_EnumObjects( device, check_objects, &check_objects_params, DIDFT_ALL );
@@ -8061,7 +8060,6 @@ static void test_force_feedback_joystick( DWORD version )
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
     ok( hr == DIERR_READONLY, "SetProperty DIPROP_FFLOAD returned %#x\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    todo_wine
     ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
     todo_wine
@@ -8819,7 +8817,6 @@ static void test_device_managed_effect(void)
     ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    todo_wine
     ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
     todo_wine
@@ -8835,9 +8832,7 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    todo_wine
     ok( hr == DI_OK, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
-    todo_wine
     ok( prop_dword.dwData == 0, "got DIPROP_FFLOAD %#x\n", prop_dword.dwData );
     set_hid_expect( file, NULL, 0 );
 
@@ -8854,9 +8849,7 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    todo_wine
     ok( hr == DI_OK, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
-    todo_wine
     ok( prop_dword.dwData == 0, "got DIPROP_FFLOAD %#x\n", prop_dword.dwData );
     set_hid_expect( file, NULL, 0 );
 
@@ -8948,9 +8941,7 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    todo_wine
     ok( hr == DI_OK, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
-    todo_wine
     ok( prop_dword.dwData == 0, "got DIPROP_FFLOAD %#x\n", prop_dword.dwData );
     set_hid_expect( file, NULL, 0 );
 




More information about the wine-cvs mailing list