[PATCH v2 02/10] dinput: Implement HID joystick IDirectInputDevice8_GetDeviceInfo.

Rémi Bernon rbernon at codeweavers.com
Fri Aug 27 05:45:21 CDT 2021


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

diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 0d362cf9af3..d7efc44e806 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -54,6 +54,8 @@ struct hid_joystick
 
     HANDLE device;
     PHIDP_PREPARSED_DATA preparsed;
+
+    DIDEVICEINSTANCEW instance;
 };
 
 static inline struct hid_joystick *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface )
@@ -97,14 +99,18 @@ static HRESULT WINAPI hid_joystick_GetDeviceState( IDirectInputDevice8W *iface,
 
 static HRESULT WINAPI hid_joystick_GetDeviceInfo( IDirectInputDevice8W *iface, DIDEVICEINSTANCEW *instance )
 {
-    FIXME( "iface %p, instance %p stub!\n", iface, instance );
+    struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
+
+    TRACE( "iface %p, instance %p.\n", iface, instance );
 
     if (!instance) return E_POINTER;
     if (instance->dwSize != sizeof(DIDEVICEINSTANCE_DX3W) &&
         instance->dwSize != sizeof(DIDEVICEINSTANCEW))
         return DIERR_INVALIDPARAM;
 
-    return DIERR_UNSUPPORTED;
+    memcpy( instance, &impl->instance, instance->dwSize );
+
+    return S_OK;
 }
 
 static HRESULT WINAPI hid_joystick_BuildActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format,
@@ -342,6 +348,8 @@ static HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID
                                    &attrs, &caps, dinput->dwVersion );
     if (hr != DI_OK) goto failed;
 
+    impl->instance = instance;
+
     *out = &impl->base.IDirectInputDevice8W_iface;
     return DI_OK;
 
-- 
2.33.0




More information about the wine-devel mailing list