[PATCH 3/9] dinput: Implement HID joystick IDirectInputDevice8_GetDeviceState.

Rémi Bernon rbernon at codeweavers.com
Fri Aug 27 04:09:59 CDT 2021


Removing the trace as it can get pretty verbose otherwise.

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

diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 01864bb91e5..53dc97177a1 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -51,6 +51,7 @@ DEFINE_DEVPROPKEY( DEVPROPKEY_HID_HANDLE, 0xbc62e415, 0xf4fe, 0x405c, 0x8e, 0xda
 struct hid_joystick
 {
     IDirectInputDeviceImpl base;
+    DIJOYSTATE2 state;
 
     HANDLE device;
     PHIDP_PREPARSED_DATA preparsed;
@@ -142,11 +143,13 @@ static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, con
 
 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 );
 
     if (!ptr) return DIERR_INVALIDPARAM;
 
-    return DIERR_UNSUPPORTED;
+    fill_DataFormat( ptr, len, &impl->state, &impl->base.data_format );
+
+    return DI_OK;
 }
 
 static HRESULT WINAPI hid_joystick_GetDeviceInfo( IDirectInputDevice8W *iface, DIDEVICEINSTANCEW *instance )
-- 
2.33.0




More information about the wine-devel mailing list