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

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


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

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

dinput: Implement HID joystick IDirectInputDevice8_GetCapabilities.

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 53dc97177a1..601de3b00b0 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -59,6 +59,7 @@ struct hid_joystick
     DIDEVICEINSTANCEW instance;
     WCHAR device_path[MAX_PATH];
     HIDD_ATTRIBUTES attrs;
+    DIDEVCAPS dev_caps;
 };
 
 static inline struct hid_joystick *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface )
@@ -84,11 +85,15 @@ static ULONG WINAPI hid_joystick_Release( IDirectInputDevice8W *iface )
 
 static HRESULT WINAPI hid_joystick_GetCapabilities( IDirectInputDevice8W *iface, DIDEVCAPS *caps )
 {
-    FIXME( "iface %p, caps %p stub!\n", iface, caps );
+    struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
+
+    TRACE( "iface %p, caps %p.\n", iface, caps );
 
     if (!caps) return E_POINTER;
 
-    return DIERR_UNSUPPORTED;
+    *caps = impl->dev_caps;
+
+    return DI_OK;
 }
 
 static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, const GUID *guid,
@@ -404,6 +409,9 @@ static HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID
 
     impl->instance = instance;
     impl->attrs = attrs;
+    impl->dev_caps.dwSize = sizeof(impl->dev_caps);
+    impl->dev_caps.dwFlags = DIDC_ATTACHED | DIDC_EMULATED;
+    impl->dev_caps.dwDevType = instance.dwDevType;
 
     *out = &impl->base.IDirectInputDevice8W_iface;
     return DI_OK;




More information about the wine-cvs mailing list