Rémi Bernon : dinput: Stub HID joystick GetEffectStatus implementation.

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


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

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

dinput: Stub HID joystick GetEffectStatus 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/joystick_hid.c | 17 +++++++++++++++--
 dlls/dinput8/tests/hid.c   | 14 --------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 971e775867f..06be759b685 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -2707,11 +2707,24 @@ static HRESULT WINAPI hid_joystick_effect_Stop( IDirectInputEffect *iface )
 
 static HRESULT WINAPI hid_joystick_effect_GetEffectStatus( IDirectInputEffect *iface, DWORD *status )
 {
-    FIXME( "iface %p, status %p stub!\n", iface, status );
+    struct hid_joystick_effect *impl = impl_from_IDirectInputEffect( iface );
+    HRESULT hr;
+
+    FIXME( "iface %p, status %p semi-stub!\n", iface, status );
 
     if (!status) return E_POINTER;
+    *status = 0;
 
-    return DIERR_UNSUPPORTED;
+    EnterCriticalSection( &impl->joystick->base.crit );
+    if (!impl->joystick->base.acquired || !(impl->joystick->base.dwCoopLevel & DISCL_EXCLUSIVE))
+        hr = DIERR_NOTEXCLUSIVEACQUIRED;
+    else if (!impl->index)
+        hr = DIERR_NOTDOWNLOADED;
+    else
+        hr = DI_OK;
+    LeaveCriticalSection( &impl->joystick->base.crit );
+
+    return hr;
 }
 
 static void set_parameter_value( struct hid_joystick_effect *impl, char *report_buf,
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index bda738bc178..a8ea8eaea9f 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -8873,9 +8873,7 @@ static void test_device_managed_effect(void)
     ok( hr == E_POINTER, "GetEffectStatus returned %#x\n", hr );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    todo_wine
     ok( hr == DIERR_NOTDOWNLOADED, "GetEffectStatus returned %#x\n", hr );
-    todo_wine
     ok( res == 0, "got status %#x\n", res );
 
     flags = DIEP_ALLPARAMS;
@@ -8888,7 +8886,6 @@ static void test_device_managed_effect(void)
     set_hid_expect( file, NULL, 0 );
 
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    todo_wine
     ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetEffectStatus returned %#x\n", hr );
 
     set_hid_expect( file, expect_reset, sizeof(expect_reset) );
@@ -8898,9 +8895,7 @@ static void test_device_managed_effect(void)
 
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    todo_wine
     ok( hr == DIERR_NOTDOWNLOADED, "GetEffectStatus returned %#x\n", hr );
-    todo_wine
     ok( res == 0, "got status %#x\n", res );
 
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
@@ -8919,9 +8914,7 @@ static void test_device_managed_effect(void)
 
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    todo_wine
     ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    todo_wine
     ok( res == 0, "got status %#x\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
@@ -8946,7 +8939,6 @@ static void test_device_managed_effect(void)
 
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    todo_wine
     ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
     todo_wine
     ok( res == DIEGES_PLAYING, "got status %#x\n", res );
@@ -8956,7 +8948,6 @@ static void test_device_managed_effect(void)
     ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    todo_wine
     ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
     todo_wine
     ok( res == DIEGES_PLAYING, "got status %#x\n", res );
@@ -8974,7 +8965,6 @@ static void test_device_managed_effect(void)
     ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    todo_wine
     ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
     todo_wine
     ok( res == DIEGES_PLAYING, "got status %#x\n", res );
@@ -8994,9 +8984,7 @@ static void test_device_managed_effect(void)
 
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    todo_wine
     ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    todo_wine
     ok( res == 0, "got status %#x\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
@@ -9014,9 +9002,7 @@ static void test_device_managed_effect(void)
 
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    todo_wine
     ok( hr == DIERR_NOTDOWNLOADED, "GetEffectStatus returned %#x\n", hr );
-    todo_wine
     ok( res == 0, "got status %#x\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;




More information about the wine-cvs mailing list