Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/ansi.c | 19 ++++++++++++++++++ dlls/dinput/device.c | 32 ------------------------------- dlls/dinput/joystick.c | 27 -------------------------- dlls/dinput/joystick_linux.c | 2 +- dlls/dinput/joystick_linuxinput.c | 2 +- dlls/dinput/joystick_osx.c | 2 +- dlls/dinput/joystick_private.h | 3 --- dlls/dinput/keyboard.c | 25 +----------------------- dlls/dinput/mouse.c | 29 +--------------------------- 9 files changed, 24 insertions(+), 117 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index 5158d326073..eafbeafbf18 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -169,6 +169,25 @@ HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel( IDirectInputDevice8 return IDirectInputDevice8_SetCooperativeLevel( iface_w, window, flags ); }
+HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo( IDirectInputDevice8A *iface_a, DIDEVICEOBJECTINSTANCEA *instance_a, + DWORD obj, DWORD how ) +{ + IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); + DIDEVICEOBJECTINSTANCEW instance_w = {sizeof(instance_w)}; + HRESULT hr; + + if (!instance_a) return E_POINTER; + if (instance_a->dwSize != sizeof(DIDEVICEOBJECTINSTANCEA) && + instance_a->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3A)) + return DIERR_INVALIDPARAM; + + hr = IDirectInputDevice8_GetObjectInfo( iface_w, &instance_w, obj, how ); + dideviceobjectinstance_wtoa( &instance_w, instance_a ); + + return hr; +} + HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel( IDirectInputDevice8A *iface_a, HWND owner, DWORD flags ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index c1388551644..16bf4c663a1 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1447,38 +1447,6 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty( return DI_OK; }
-HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo( - LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEOBJECTINSTANCEA pdidoi, - DWORD dwObj, - DWORD dwHow) -{ - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface); - DIDEVICEOBJECTINSTANCEW didoiW; - HRESULT res; - - if (!pdidoi) return E_POINTER; - if (pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEA) && - pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3A)) - return DIERR_INVALIDPARAM; - - didoiW.dwSize = sizeof(didoiW); - res = IDirectInputDevice2WImpl_GetObjectInfo(IDirectInputDevice8W_from_impl(This), &didoiW, dwObj, dwHow); - if (res == DI_OK) - { - DWORD dwSize = pdidoi->dwSize; - - memset(pdidoi, 0, pdidoi->dwSize); - pdidoi->dwSize = dwSize; - pdidoi->guidType = didoiW.guidType; - pdidoi->dwOfs = didoiW.dwOfs; - pdidoi->dwType = didoiW.dwType; - pdidoi->dwFlags = didoiW.dwFlags; - } - - return res; -} - HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo( LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index ab8b87f552b..b79935ede7c 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -574,33 +574,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, return res; }
-HRESULT WINAPI JoystickAGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) -{ - JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface); - HRESULT res; - DIDEVICEOBJECTINSTANCEW didoiW; - DWORD dwSize; - - if (!pdidoi) return E_POINTER; - if (pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEA) && - pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3A)) - return DIERR_INVALIDPARAM; - - didoiW.dwSize = sizeof(didoiW); - res = JoystickWGenericImpl_GetObjectInfo(IDirectInputDevice8W_from_impl(This), &didoiW, dwObj, dwHow); - if (res != DI_OK) return res; - - dwSize = pdidoi->dwSize; - memset(pdidoi, 0, pdidoi->dwSize); - memcpy(pdidoi, &didoiW, FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW, tszName)); - pdidoi->dwSize = dwSize; - WideCharToMultiByte(CP_ACP, 0, didoiW.tszName, -1, pdidoi->tszName, - sizeof(pdidoi->tszName), NULL, NULL); - - return res; -} - /****************************************************************************** * GetProperty : get input device properties */ diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index ec4cb94c034..091e1f2152e 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -918,7 +918,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetCooperativeLevel, - JoystickAGenericImpl_GetObjectInfo, + IDirectInputDevice2AImpl_GetObjectInfo, JoystickLinuxAImpl_GetDeviceInfo, IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize, diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 14acbb5cd8c..49eaf3ed44d 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -1439,7 +1439,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetCooperativeLevel, - JoystickAGenericImpl_GetObjectInfo, + IDirectInputDevice2AImpl_GetObjectInfo, JoystickAImpl_GetDeviceInfo, IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize, diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index 174a78b7fd4..78e041daf92 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -1590,7 +1590,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetCooperativeLevel, - JoystickAGenericImpl_GetObjectInfo, + IDirectInputDevice2AImpl_GetObjectInfo, JoystickAGenericImpl_GetDeviceInfo, IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize, diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h index 0f191787158..2a25bf4eb23 100644 --- a/dlls/dinput/joystick_private.h +++ b/dlls/dinput/joystick_private.h @@ -62,9 +62,6 @@ BOOL device_disabled_registry(const char* name) DECLSPEC_HIDDEN; HRESULT WINAPI JoystickWGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) DECLSPEC_HIDDEN;
-HRESULT WINAPI JoystickAGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) DECLSPEC_HIDDEN; - HRESULT WINAPI JoystickWGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph) DECLSPEC_HIDDEN;
HRESULT WINAPI JoystickAGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index ca3b1dad669..b1914d057bd 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -463,29 +463,6 @@ static DWORD map_dik_to_scan(DWORD dik_code, DWORD subtype) * GetObjectInfo : get information about a device object such as a button * or axis */ -static HRESULT WINAPI -SysKeyboardAImpl_GetObjectInfo( - LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEOBJECTINSTANCEA pdidoi, - DWORD dwObj, - DWORD dwHow) -{ - SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface); - HRESULT res; - LONG scan; - - res = IDirectInputDevice2AImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow); - if (res != DI_OK) return res; - - scan = map_dik_to_scan(DIDFT_GETINSTANCE(pdidoi->dwType), This->subtype); - if (!GetKeyNameTextA((scan & 0x80) << 17 | (scan & 0x7f) << 16, - pdidoi->tszName, sizeof(pdidoi->tszName))) - return DIERR_OBJECTNOTFOUND; - - _dump_OBJECTINSTANCEA(pdidoi); - return res; -} - static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, @@ -691,7 +668,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt = IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetCooperativeLevel, - SysKeyboardAImpl_GetObjectInfo, + IDirectInputDevice2AImpl_GetObjectInfo, SysKeyboardAImpl_GetDeviceInfo, IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize, diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index bc99ea37c68..9267d92d6e9 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -796,33 +796,6 @@ static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, return res; }
-static HRESULT WINAPI SysMouseAImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow) -{ - SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface); - HRESULT res; - DIDEVICEOBJECTINSTANCEW didoiW; - DWORD dwSize; - - if (!pdidoi) return E_POINTER; - if (pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCEA) && - pdidoi->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3A)) - return DIERR_INVALIDPARAM; - - didoiW.dwSize = sizeof(didoiW); - res = SysMouseWImpl_GetObjectInfo(IDirectInputDevice8W_from_impl(This), &didoiW, dwObj, dwHow); - if (res != DI_OK) return res; - - dwSize = pdidoi->dwSize; - memset(pdidoi, 0, pdidoi->dwSize); - memcpy(pdidoi, &didoiW, FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW, tszName)); - pdidoi->dwSize = dwSize; - WideCharToMultiByte(CP_ACP, 0, didoiW.tszName, -1, pdidoi->tszName, - sizeof(pdidoi->tszName), NULL, NULL); - - return res; -} - /****************************************************************************** * GetDeviceInfo : get information about a device's identity */ @@ -949,7 +922,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt = IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetCooperativeLevel, - SysMouseAImpl_GetObjectInfo, + IDirectInputDevice2AImpl_GetObjectInfo, SysMouseAImpl_GetDeviceInfo, IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize,