Rémi Bernon : dinput: Implement HID joystick IDirectInputDevice8_GetDeviceInfo.

Alexandre Julliard julliard at winehq.org
Fri Aug 27 15:03:33 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Aug 27 12:45:21 2021 +0200

dinput: Implement HID joystick IDirectInputDevice8_GetDeviceInfo.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;
 




More information about the wine-cvs mailing list