[PATCH v2 5/5] dinput: Implement hid_joystick_GetDeviceState.

Rémi Bernon rbernon at codeweavers.com
Tue Jun 29 08:15:24 CDT 2021


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/joystick_hid.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index f8d7c5d21ac..c8321829ea1 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -48,6 +48,7 @@ DEFINE_GUID( hid_joystick_guid, 0x9e573edb, 0x7734, 0x11d2, 0x8d, 0x4a, 0x23, 0x
 struct hid_joystick
 {
     IDirectInputDeviceImpl base;
+    DIJOYSTATE2 state;
 
     HANDLE device;
     PHIDP_PREPARSED_DATA preparsed;
@@ -180,11 +181,15 @@ static HRESULT WINAPI hid_joystick_Unacquire( IDirectInputDevice8W *iface )
 
 static HRESULT WINAPI hid_joystick_GetDeviceState( IDirectInputDevice8W *iface, DWORD len, void *ptr )
 {
-    FIXME( "iface %p, len %u, ptr %p stub!\n", iface, len, ptr );
+    struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
+
+    TRACE( "iface %p, len %u, ptr %p.\n", iface, len, ptr );
 
     if (!ptr) return DIERR_INVALIDPARAM;
 
-    return E_NOTIMPL;
+    fill_DataFormat( ptr, len, &impl->state, &impl->base.data_format );
+
+    return DI_OK;
 }
 
 static HRESULT WINAPI hid_joystick_GetObjectInfo( IDirectInputDevice8W *iface, DIDEVICEOBJECTINSTANCEW *instance,
-- 
2.32.0




More information about the wine-devel mailing list