[PATCH] dinput: Allow setting DIPROP_AUTOCENTER when exclusively acquired.

Rémi Bernon rbernon at codeweavers.com
Fri Mar 18 04:23:03 CDT 2022


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/device.c               | 2 ++
 dlls/dinput/tests/force_feedback.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 6cc190ee7fb..d881669c06f 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -1009,6 +1009,8 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con
         switch (LOWORD( guid ))
         {
         case (DWORD_PTR)DIPROP_AUTOCENTER:
+            if (impl->status == STATUS_ACQUIRED && !is_exclusively_acquired( impl )) return DIERR_ACQUIRED;
+            break;
         case (DWORD_PTR)DIPROP_AXISMODE:
         case (DWORD_PTR)DIPROP_BUFFERSIZE:
         case (DWORD_PTR)DIPROP_PHYSICALRANGE:
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c
index 97aed4c993b..ce460147f9d 100644
--- a/dlls/dinput/tests/force_feedback.c
+++ b/dlls/dinput/tests/force_feedback.c
@@ -2924,6 +2924,9 @@ static BOOL test_force_feedback_joystick( DWORD version )
     ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE );
     ok( hr == DI_OK, "SetCooperativeLevel returned: %#lx\n", hr );
+    prop_dword.dwData = DIPROPAUTOCENTER_ON;
+    hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
+    ok( hr == DI_OK, "SetProperty DIPROP_AUTOCENTER returned %#lx\n", hr );
 
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IDirectInputDevice8_Acquire( device );
-- 
2.35.1




More information about the wine-devel mailing list