From 787d4af53b739d843d804fbb9ba6ddc4c343f3f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 27 Aug 2021 12:45:21 +0200 Subject: [PATCH] dinput: Implement HID joystick IDirectInputDevice8_GetDeviceInfo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- 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;