From 3b2f7433dbd8d69e03fa673533b5d375024cc9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 24 Nov 2021 16:09:40 +0100 Subject: [PATCH] dinput: Stub support for DIPROP_FFLOAD device property. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52062 Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- 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 );