[PATCH 4/9] dinput: Implement HID joystick IDirectInputDevice8_GetCapabilities.

Rémi Bernon rbernon at codeweavers.com
Fri Aug 27 04:10:00 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 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;
-- 
2.33.0




More information about the wine-devel mailing list