From fbfdc6db650b6d1038dd193375b1880a95c0d535 Mon Sep 17 00:00:00 2001 From: Lucas Zawacki Date: Tue, 29 May 2012 13:42:26 -0300 Subject: [PATCH] dinput: Implement GetProperty for JOYSTICKID (Linux driver). --- dlls/dinput/joystick_linux.c | 40 ++++++++++++++++++++++++++++++++++++++-- include/dinput.h | 1 + 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index d951e767263..5afd07c626d 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -542,6 +542,42 @@ static HRESULT WINAPI JoystickLinuxAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) } /****************************************************************************** + * GetProperty : get input device properties + */ +static HRESULT WINAPI JoystickLinuxWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph) +{ + JoystickImpl *This = impl_from_IDirectInputDevice8W(iface); + + TRACE("(this=%p,%s,%p)\n", iface, debugstr_guid(rguid), pdiph); + _dump_DIPROPHEADER(pdiph); + + if (!IS_DIPROP(rguid)) return DI_OK; + + switch (LOWORD(rguid)) { + + case (DWORD_PTR) DIPROP_JOYSTICKID: + { + LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph; + + pd->dwData = get_joystick_index(&This->generic.base.guid); + TRACE("DIPROP_JOYSTICKID(%d)\n", pd->dwData); + break; + } + + default: + return JoystickWGenericImpl_GetProperty(iface, rguid, pdiph); + } + + return DI_OK; +} + +static HRESULT WINAPI JoystickLinuxAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph) +{ + JoystickImpl *This = impl_from_IDirectInputDevice8A(iface); + return JoystickLinuxWImpl_GetProperty(IDirectInputDevice8W_from_impl(This), rguid, pdiph); +} + +/****************************************************************************** * Unacquire : frees the joystick */ static HRESULT WINAPI JoystickLinuxWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface) @@ -655,7 +691,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_Release, JoystickAGenericImpl_GetCapabilities, IDirectInputDevice2AImpl_EnumObjects, - JoystickAGenericImpl_GetProperty, + JoystickLinuxAImpl_GetProperty, JoystickAGenericImpl_SetProperty, JoystickLinuxAImpl_Acquire, JoystickLinuxAImpl_Unacquire, @@ -691,7 +727,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt = IDirectInputDevice2WImpl_Release, JoystickWGenericImpl_GetCapabilities, IDirectInputDevice2WImpl_EnumObjects, - JoystickWGenericImpl_GetProperty, + JoystickLinuxWImpl_GetProperty, JoystickWGenericImpl_SetProperty, JoystickLinuxWImpl_Acquire, JoystickLinuxWImpl_Unacquire, diff --git a/include/dinput.h b/include/dinput.h index a6cf7e23b98..31258003366 100644 --- a/include/dinput.h +++ b/include/dinput.h @@ -905,6 +905,7 @@ typedef const DIPROPSTRING *LPCDIPROPSTRING; #define DIPROP_CALIBRATION MAKEDIPROP(11) #define DIPROP_GUIDANDPATH MAKEDIPROP(12) +#define DIPROP_JOYSTICKID MAKEDIPROP(15) #define DIPROP_KEYNAME MAKEDIPROP(20) #define DIPROP_VIDPID MAKEDIPROP(24) -- 2.11.4.GIT