Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/ansi.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ dlls/dinput/device.c | 13 ---------- 2 files changed, 57 insertions(+), 13 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index 5d1ea9f0b4e..4e9a9af7a83 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -73,6 +73,42 @@ static void dieffectinfo_wtoa( const DIEFFECTINFOW *in, DIEFFECTINFOA *out ) WideCharToMultiByte( CP_ACP, 0, in->tszName, -1, out->tszName, sizeof(out->tszName), NULL, NULL ); }
+static void dideviceimageinfo_wtoa( const DIDEVICEIMAGEINFOW *in, DIDEVICEIMAGEINFOA *out ) +{ + WideCharToMultiByte( CP_ACP, 0, in->tszImagePath, -1, out->tszImagePath, + sizeof(out->tszImagePath), NULL, NULL ); + + out->dwFlags = in->dwFlags; + out->dwViewID = in->dwViewID; + out->rcOverlay = in->rcOverlay; + out->dwObjID = in->dwObjID; + out->dwcValidPts = in->dwcValidPts; + out->rgptCalloutLine[0] = in->rgptCalloutLine[0]; + out->rgptCalloutLine[1] = in->rgptCalloutLine[1]; + out->rgptCalloutLine[2] = in->rgptCalloutLine[2]; + out->rgptCalloutLine[3] = in->rgptCalloutLine[3]; + out->rgptCalloutLine[4] = in->rgptCalloutLine[4]; + out->rcCalloutRect = in->rcCalloutRect; + out->dwTextAlign = in->dwTextAlign; +} + +static void dideviceimageinfoheader_wtoa( const DIDEVICEIMAGEINFOHEADERW *in, DIDEVICEIMAGEINFOHEADERA *out ) +{ + DWORD i; + + out->dwcViews = in->dwcViews; + out->dwcButtons = in->dwcButtons; + out->dwcAxes = in->dwcAxes; + out->dwcPOVs = in->dwcPOVs; + out->dwBufferUsed = 0; + + for (i = 0; i < in->dwBufferUsed / sizeof(DIDEVICEIMAGEINFOW); ++i) + { + dideviceimageinfo_wtoa( &in->lprgImageInfoArray[i], &out->lprgImageInfoArray[i] ); + out->dwBufferUsed += sizeof(DIDEVICEIMAGEINFOA); + } +} + HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface( IDirectInputDevice8A *iface_a, REFIID iid, void **out ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); @@ -331,3 +367,24 @@ HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile( IDirectInputDevice8A
return IDirectInputDevice8_WriteEffectToFile( iface_w, filename_w, entries, file_effect, flags ); } + +HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo( IDirectInputDevice8A *iface_a, DIDEVICEIMAGEINFOHEADERA *header_a ) +{ + IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); + DIDEVICEIMAGEINFOHEADERW header_w = {sizeof(header_w), sizeof(DIDEVICEIMAGEINFOW)}; + HRESULT hr; + + if (!header_a) return E_POINTER; + if (header_a->dwSize != sizeof(DIDEVICEIMAGEINFOHEADERA)) return DIERR_INVALIDPARAM; + if (header_a->dwSizeImageInfo != sizeof(DIDEVICEIMAGEINFOA)) return DIERR_INVALIDPARAM; + + header_w.dwBufferSize = (header_a->dwBufferSize / sizeof(DIDEVICEIMAGEINFOA)) * sizeof(DIDEVICEIMAGEINFOW); + header_w.lprgImageInfoArray = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, header_w.dwBufferSize ); + if (!header_w.lprgImageInfoArray) return DIERR_OUTOFMEMORY; + + hr = IDirectInputDevice8_GetImageInfo( iface_w, &header_w ); + dideviceimageinfoheader_wtoa( &header_w, header_a ); + HeapFree( GetProcessHeap(), 0, header_w.lprgImageInfoArray ); + return hr; +} diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 541f39954f6..5da58b85126 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -43,10 +43,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
-static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) -{ - return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface); -} static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface); @@ -1699,15 +1695,6 @@ HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W ifa return DI_OK; }
-HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader) -{ - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface); - FIXME("(%p)->(%p): stub !\n", This, lpdiDevImageInfoHeader); - - return DI_OK; -} - HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader) {
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/ansi.c | 7 +++++++ dlls/dinput/device_private.h | 1 + dlls/dinput/joystick.c | 6 ------ dlls/dinput/joystick_linux.c | 2 +- dlls/dinput/joystick_linuxinput.c | 2 +- dlls/dinput/joystick_osx.c | 2 +- dlls/dinput/joystick_private.h | 1 - dlls/dinput/keyboard.c | 8 +------- dlls/dinput/mouse.c | 8 +------- 9 files changed, 13 insertions(+), 24 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index 4e9a9af7a83..d61fdb07e4f 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -130,6 +130,13 @@ ULONG WINAPI IDirectInputDevice2AImpl_Release( IDirectInputDevice8A *iface_a ) return IDirectInputDevice8_Release( iface_w ); }
+HRESULT WINAPI IDirectInputDevice2AImpl_GetCapabilities( IDirectInputDevice8A *iface_a, DIDEVCAPS *caps ) +{ + IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); + return IDirectInputDevice8_GetCapabilities( iface_w, caps ); +} + struct enum_objects_wtoa_params { LPDIENUMDEVICEOBJECTSCALLBACKA callback; diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 56718790040..f8cfd98f9b3 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -144,6 +144,7 @@ extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(LPDIRECTINPU extern HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE hnd) DECLSPEC_HIDDEN; extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN; extern ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN; +extern HRESULT WINAPI IDirectInputDevice2AImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, DIDEVCAPS *caps) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index b79935ede7c..60a61d1ea6b 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -542,12 +542,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, return DI_OK; }
-HRESULT WINAPI JoystickAGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) -{ - JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface); - return JoystickWGenericImpl_GetCapabilities(IDirectInputDevice8W_from_impl(This), lpDIDevCaps); -} - /****************************************************************************** * GetObjectInfo : get object info */ diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index 091e1f2152e..8196102f9bb 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -907,7 +907,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_QueryInterface, IDirectInputDevice2AImpl_AddRef, IDirectInputDevice2AImpl_Release, - JoystickAGenericImpl_GetCapabilities, + IDirectInputDevice2AImpl_GetCapabilities, IDirectInputDevice2AImpl_EnumObjects, IDirectInputDevice2AImpl_GetProperty, IDirectInputDevice2AImpl_SetProperty, diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 307b447d237..9a41e798642 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -1338,7 +1338,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_QueryInterface, IDirectInputDevice2AImpl_AddRef, IDirectInputDevice2AImpl_Release, - JoystickAGenericImpl_GetCapabilities, + IDirectInputDevice2AImpl_GetCapabilities, IDirectInputDevice2AImpl_EnumObjects, IDirectInputDevice2AImpl_GetProperty, IDirectInputDevice2AImpl_SetProperty, diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index 78e041daf92..a663c438c35 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -1579,7 +1579,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_QueryInterface, IDirectInputDevice2AImpl_AddRef, IDirectInputDevice2AImpl_Release, - JoystickAGenericImpl_GetCapabilities, + IDirectInputDevice2AImpl_GetCapabilities, IDirectInputDevice2AImpl_EnumObjects, IDirectInputDevice2AImpl_GetProperty, IDirectInputDevice2AImpl_SetProperty, diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h index 2a25bf4eb23..60cea6197c6 100644 --- a/dlls/dinput/joystick_private.h +++ b/dlls/dinput/joystick_private.h @@ -64,7 +64,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
HRESULT WINAPI JoystickWGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph) DECLSPEC_HIDDEN;
-HRESULT WINAPI JoystickAGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) DECLSPEC_HIDDEN; HRESULT WINAPI JoystickWGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, LPDIDEVCAPS lpDIDevCaps) DECLSPEC_HIDDEN;
void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index b1914d057bd..3a81b7e58fb 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -419,12 +419,6 @@ static HRESULT WINAPI SysKeyboardWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W ifa return DI_OK; }
-static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) -{ - SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface); - return SysKeyboardWImpl_GetCapabilities(IDirectInputDevice8W_from_impl(This), lpDIDevCaps); -} - static DWORD map_dik_to_scan(DWORD dik_code, DWORD subtype) { if (dik_code == DIK_PAUSE || dik_code == DIK_NUMLOCK) dik_code ^= 0x80; @@ -657,7 +651,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt = IDirectInputDevice2AImpl_QueryInterface, IDirectInputDevice2AImpl_AddRef, IDirectInputDevice2AImpl_Release, - SysKeyboardAImpl_GetCapabilities, + IDirectInputDevice2AImpl_GetCapabilities, IDirectInputDevice2AImpl_EnumObjects, IDirectInputDevice2AImpl_GetProperty, IDirectInputDevice2AImpl_SetProperty, diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 9267d92d6e9..68cc5059ec8 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -761,12 +761,6 @@ static HRESULT WINAPI SysMouseWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, return DI_OK; }
-static HRESULT WINAPI SysMouseAImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) -{ - SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface); - return SysMouseWImpl_GetCapabilities(IDirectInputDevice8W_from_impl(This), lpDIDevCaps); -} - /****************************************************************************** * GetObjectInfo : get information about a device object such as a button * or axis @@ -911,7 +905,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt = IDirectInputDevice2AImpl_QueryInterface, IDirectInputDevice2AImpl_AddRef, IDirectInputDevice2AImpl_Release, - SysMouseAImpl_GetCapabilities, + IDirectInputDevice2AImpl_GetCapabilities, IDirectInputDevice2AImpl_EnumObjects, IDirectInputDevice2AImpl_GetProperty, IDirectInputDevice2AImpl_SetProperty,
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/ansi.c | 7 +++++++ dlls/dinput/device_private.h | 1 + dlls/dinput/joystick.c | 11 ----------- dlls/dinput/joystick_linux.c | 2 +- dlls/dinput/joystick_linuxinput.c | 2 +- dlls/dinput/joystick_osx.c | 2 +- dlls/dinput/joystick_private.h | 1 - dlls/dinput/keyboard.c | 12 +----------- dlls/dinput/mouse.c | 13 +------------ 9 files changed, 13 insertions(+), 38 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index d61fdb07e4f..c488353aa12 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -192,6 +192,13 @@ HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire( IDirectInputDevice8A *iface_a return IDirectInputDevice8_Unacquire( iface_w ); }
+HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceState( IDirectInputDevice8A *iface_a, DWORD count, void *data ) +{ + IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); + return IDirectInputDevice8_GetDeviceState( iface_w, count, data ); +} + HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData( IDirectInputDevice8A *iface_a, DWORD data_size, DIDEVICEOBJECTDATA *data, DWORD *entries, DWORD flags ) { diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index f8cfd98f9b3..425b0971351 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -136,6 +136,7 @@ extern HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A ifa extern HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN; +extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceState(LPDIRECTINPUTDEVICE8A iface, DWORD count, void *data) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(LPDIRECTINPUTDEVICE8A iface, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8A iface, HWND hwnd, DWORD dwflags) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index 60a61d1ea6b..906f47087fb 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -68,10 +68,6 @@ static inline JoystickGenericImpl *impl_from_IDirectInputDevice8W(IDirectInputDe { return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), JoystickGenericImpl, base); } -static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(JoystickGenericImpl *This) -{ - return &This->base.IDirectInputDevice8W_iface; -}
DWORD typeFromGUID(REFGUID guid) { @@ -773,13 +769,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface, return DI_OK; }
-HRESULT WINAPI JoystickAGenericImpl_GetDeviceState(LPDIRECTINPUTDEVICE8A iface, DWORD len, LPVOID ptr) -{ - JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface); - return JoystickWGenericImpl_GetDeviceState(IDirectInputDevice8W_from_impl(This), len, ptr); -} - - HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index 8196102f9bb..e81733a74dd 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -913,7 +913,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Unacquire, - JoystickAGenericImpl_GetDeviceState, + IDirectInputDevice2AImpl_GetDeviceState, IDirectInputDevice2AImpl_GetDeviceData, IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetEventNotification, diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 9a41e798642..2a6c73766f4 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -1344,7 +1344,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Unacquire, - JoystickAGenericImpl_GetDeviceState, + IDirectInputDevice2AImpl_GetDeviceState, IDirectInputDevice2AImpl_GetDeviceData, IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetEventNotification, diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index a663c438c35..98865253570 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -1585,7 +1585,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Unacquire, - JoystickAGenericImpl_GetDeviceState, + IDirectInputDevice2AImpl_GetDeviceState, IDirectInputDevice2AImpl_GetDeviceData, IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetEventNotification, diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h index 60cea6197c6..62e453a7835 100644 --- a/dlls/dinput/joystick_private.h +++ b/dlls/dinput/joystick_private.h @@ -78,7 +78,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetDeviceInfo( LPDIRECTINPUTDEVICE8W iface,
HRESULT WINAPI JoystickWGenericImpl_Poll(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
-HRESULT WINAPI JoystickAGenericImpl_GetDeviceState(LPDIRECTINPUTDEVICE8A iface, DWORD len, LPVOID ptr) DECLSPEC_HIDDEN; HRESULT WINAPI JoystickWGenericImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface, DWORD len, LPVOID ptr) DECLSPEC_HIDDEN;
HRESULT WINAPI JoystickAGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 3a81b7e58fb..010722efd8c 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -59,10 +59,6 @@ static inline SysKeyboardImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice { return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysKeyboardImpl, base); } -static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(SysKeyboardImpl *This) -{ - return &This->base.IDirectInputDevice8W_iface; -}
static BYTE map_dik_code(DWORD scanCode, DWORD vkCode, DWORD subType, DWORD version) { @@ -378,12 +374,6 @@ static HRESULT WINAPI SysKeyboardWImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W ifac return DI_OK; }
-static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(LPDIRECTINPUTDEVICE8A iface, DWORD len, LPVOID ptr) -{ - SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface); - return SysKeyboardWImpl_GetDeviceState(IDirectInputDevice8W_from_impl(This), len, ptr); -} - /****************************************************************************** * GetCapabilities : get the device capabilities */ @@ -657,7 +647,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt = IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Unacquire, - SysKeyboardAImpl_GetDeviceState, + IDirectInputDevice2AImpl_GetDeviceState, IDirectInputDevice2AImpl_GetDeviceData, IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetEventNotification, diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 68cc5059ec8..849712a49ca 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -87,11 +87,6 @@ static inline SysMouseImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysMouseImpl, base); }
-static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(SysMouseImpl *This) -{ - return &This->base.IDirectInputDevice8W_iface; -} - static void _dump_mouse_state(const DIMOUSESTATE2 *m_state) { int i; @@ -647,12 +642,6 @@ static HRESULT WINAPI SysMouseWImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface, return DI_OK; }
-static HRESULT WINAPI SysMouseAImpl_GetDeviceState(LPDIRECTINPUTDEVICE8A iface, DWORD len, LPVOID ptr) -{ - SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface); - return SysMouseWImpl_GetDeviceState(IDirectInputDevice8W_from_impl(This), len, ptr); -} - /****************************************************************************** * GetDeviceData : gets buffered input data. */ @@ -911,7 +900,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt = IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Unacquire, - SysMouseAImpl_GetDeviceState, + IDirectInputDevice2AImpl_GetDeviceState, IDirectInputDevice2AImpl_GetDeviceData, IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetEventNotification,
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/ansi.c | 34 ++++++++++++++++++++++ dlls/dinput/device_private.h | 1 + dlls/dinput/joystick.c | 48 ------------------------------- dlls/dinput/joystick_linux.c | 26 +---------------- dlls/dinput/joystick_linuxinput.c | 27 +---------------- dlls/dinput/joystick_osx.c | 7 +---- dlls/dinput/joystick_private.h | 3 -- dlls/dinput/keyboard.c | 14 +-------- dlls/dinput/mouse.c | 14 +-------- 9 files changed, 40 insertions(+), 134 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index c488353aa12..a8e5256bfc6 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -64,6 +64,23 @@ static void dideviceobjectinstance_wtoa( const DIDEVICEOBJECTINSTANCEW *in, DIDE out->wReserved = in->wReserved; }
+static void dideviceinstance_wtoa( const DIDEVICEINSTANCEW *in, DIDEVICEINSTANCEA *out ) +{ + out->guidInstance = in->guidInstance; + out->guidProduct = in->guidProduct; + out->dwDevType = in->dwDevType; + WideCharToMultiByte( CP_ACP, 0, in->tszInstanceName, -1, out->tszInstanceName, + sizeof(out->tszInstanceName), NULL, NULL ); + WideCharToMultiByte( CP_ACP, 0, in->tszProductName, -1, out->tszProductName, + sizeof(out->tszProductName), NULL, NULL ); + + if (out->dwSize <= FIELD_OFFSET( DIDEVICEINSTANCEA, guidFFDriver )) return; + + out->guidFFDriver = in->guidFFDriver; + out->wUsagePage = in->wUsagePage; + out->wUsage = in->wUsage; +} + static void dieffectinfo_wtoa( const DIEFFECTINFOW *in, DIEFFECTINFOA *out ) { out->guid = in->guid; @@ -247,6 +264,23 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo( IDirectInputDevice8A *ifa return hr; }
+HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo( IDirectInputDevice8A *iface_a, DIDEVICEINSTANCEA *instance_a ) +{ + IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); + DIDEVICEINSTANCEW instance_w = {sizeof(instance_w)}; + HRESULT hr; + + if (!instance_a) return E_POINTER; + if (instance_a->dwSize != sizeof(DIDEVICEINSTANCEA) && instance_a->dwSize != sizeof(DIDEVICEINSTANCE_DX3A)) + return DIERR_INVALIDPARAM; + + hr = IDirectInputDevice8_GetDeviceInfo( iface_w, &instance_w ); + dideviceinstance_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_private.h b/dlls/dinput/device_private.h index 425b0971351..0bebc36076d 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -173,6 +173,7 @@ extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow) DECLSPEC_HIDDEN; +extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8A iface, DIDEVICEINSTANCEA *instance ) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index 906f47087fb..d048e0f821f 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -637,54 +637,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REF return DI_OK; }
-/****************************************************************************** - * GetDeviceInfo : get information about a device's identity - */ -HRESULT WINAPI JoystickAGenericImpl_GetDeviceInfo( - LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEINSTANCEA pdidi) -{ - JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface); - DIPROPDWORD pd; - DWORD index = 0; - - TRACE("(%p,%p)\n", This, pdidi); - - if (pdidi == NULL) { - WARN("invalid pointer\n"); - return E_POINTER; - } - - if ((pdidi->dwSize != sizeof(DIDEVICEINSTANCE_DX3A)) && - (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA))) { - WARN("invalid parameter: pdidi->dwSize = %d\n", pdidi->dwSize); - return DIERR_INVALIDPARAM; - } - - /* Try to get joystick index */ - pd.diph.dwSize = sizeof(pd); - pd.diph.dwHeaderSize = sizeof(pd.diph); - pd.diph.dwObj = 0; - pd.diph.dwHow = DIPH_DEVICE; - if (SUCCEEDED(IDirectInputDevice2_GetProperty(iface, DIPROP_JOYSTICKID, &pd.diph))) - index = pd.dwData; - - /* Return joystick */ - pdidi->guidInstance = This->base.guid; - pdidi->guidProduct = This->guidProduct; - /* we only support traditional joysticks for now */ - pdidi->dwDevType = This->devcaps.dwDevType; - snprintf(pdidi->tszInstanceName, MAX_PATH, "Joystick %d", index); - lstrcpynA(pdidi->tszProductName, This->name, MAX_PATH); - if (pdidi->dwSize > sizeof(DIDEVICEINSTANCE_DX3A)) { - pdidi->guidFFDriver = GUID_NULL; - pdidi->wUsagePage = 0; - pdidi->wUsage = 0; - } - - return DI_OK; -} - /****************************************************************************** * GetDeviceInfo : get information about a device's identity */ diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index e81733a74dd..8290eef0bcb 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -103,11 +103,6 @@ struct JoystickImpl POINTL povs[4]; };
-static inline JoystickImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) -{ - return CONTAINING_RECORD(CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface), - JoystickGenericImpl, base), JoystickImpl, generic); -} static inline JoystickImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { return CONTAINING_RECORD(CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), @@ -764,25 +759,6 @@ static HRESULT WINAPI JoystickLinuxWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface /****************************************************************************** * GetDeviceInfo : get information about a device's identity */ -static HRESULT WINAPI JoystickLinuxAImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEINSTANCEA ddi) -{ - JoystickImpl *This = impl_from_IDirectInputDevice8A(iface); - - TRACE("(%p) %p\n", This, ddi); - - if (ddi == NULL) return E_POINTER; - if ((ddi->dwSize != sizeof(DIDEVICEINSTANCE_DX3A)) && - (ddi->dwSize != sizeof(DIDEVICEINSTANCEA))) - return DIERR_INVALIDPARAM; - - fill_joystick_dideviceinstanceA( ddi, This->generic.base.dinput->dwVersion, - get_joystick_index(&This->generic.base.guid) ); - - ddi->guidInstance = This->generic.base.guid; - - return DI_OK; -} - static HRESULT WINAPI JoystickLinuxWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW ddi) { JoystickImpl *This = impl_from_IDirectInputDevice8W(iface); @@ -919,7 +895,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetCooperativeLevel, IDirectInputDevice2AImpl_GetObjectInfo, - JoystickLinuxAImpl_GetDeviceInfo, + IDirectInputDevice2AImpl_GetDeviceInfo, IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize, IDirectInputDevice2AImpl_CreateEffect, diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 2a6c73766f4..dd59976719a 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -136,11 +136,6 @@ struct JoystickImpl int ff_gain; };
-static inline JoystickImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) -{ - return CONTAINING_RECORD(CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface), - JoystickGenericImpl, base), JoystickImpl, generic); -} static inline JoystickImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { return CONTAINING_RECORD(CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), @@ -1293,26 +1288,6 @@ static HRESULT WINAPI JoystickWImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE /****************************************************************************** * GetDeviceInfo : get information about a device's identity */ -static HRESULT WINAPI JoystickAImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEINSTANCEA pdidi) -{ - JoystickImpl *This = impl_from_IDirectInputDevice8A(iface); - - TRACE("(%p) %p\n", This, pdidi); - - if (pdidi == NULL) return E_POINTER; - if ((pdidi->dwSize != sizeof(DIDEVICEINSTANCE_DX3A)) && - (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA))) - return DIERR_INVALIDPARAM; - - fill_joystick_dideviceinstanceA(pdidi, This->generic.base.dinput->dwVersion, - get_joystick_index(&This->generic.base.guid)); - - pdidi->guidInstance = This->generic.base.guid; - - return DI_OK; -} - static HRESULT WINAPI JoystickWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi) { @@ -1350,7 +1325,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetCooperativeLevel, IDirectInputDevice2AImpl_GetObjectInfo, - JoystickAImpl_GetDeviceInfo, + IDirectInputDevice2AImpl_GetDeviceInfo, IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize, IDirectInputDevice2AImpl_CreateEffect, diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index 98865253570..b72322e0bd6 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -116,11 +116,6 @@ struct JoystickImpl struct list effects; };
-static inline JoystickImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) -{ - return CONTAINING_RECORD(CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface), - JoystickGenericImpl, base), JoystickImpl, generic); -} static inline JoystickImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { return CONTAINING_RECORD(CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), @@ -1591,7 +1586,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetCooperativeLevel, IDirectInputDevice2AImpl_GetObjectInfo, - JoystickAGenericImpl_GetDeviceInfo, + IDirectInputDevice2AImpl_GetDeviceInfo, IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize, IDirectInputDevice2AImpl_CreateEffect, diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h index 62e453a7835..235ec962fb8 100644 --- a/dlls/dinput/joystick_private.h +++ b/dlls/dinput/joystick_private.h @@ -70,9 +70,6 @@ void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps) DECLSPEC_HIDDEN;
HRESULT WINAPI JoystickWGenericImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER ph) DECLSPEC_HIDDEN;
-HRESULT WINAPI JoystickAGenericImpl_GetDeviceInfo( LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEINSTANCEA pdidi) DECLSPEC_HIDDEN; - HRESULT WINAPI JoystickWGenericImpl_GetDeviceInfo( LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi) DECLSPEC_HIDDEN;
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 010722efd8c..d9c3f02e669 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -471,18 +471,6 @@ static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface /****************************************************************************** * GetDeviceInfo : get information about a device's identity */ -static HRESULT WINAPI SysKeyboardAImpl_GetDeviceInfo( - LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEINSTANCEA pdidi) -{ - SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface); - TRACE("(this=%p,%p)\n", This, pdidi); - - fill_keyboard_dideviceinstanceA(pdidi, This->base.dinput->dwVersion, This->subtype); - - return DI_OK; -} - static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi) { SysKeyboardImpl *This = impl_from_IDirectInputDevice8W(iface); @@ -653,7 +641,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt = IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetCooperativeLevel, IDirectInputDevice2AImpl_GetObjectInfo, - SysKeyboardAImpl_GetDeviceInfo, + IDirectInputDevice2AImpl_GetDeviceInfo, IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize, IDirectInputDevice2AImpl_CreateEffect, diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 849712a49ca..f5f6bf2214a 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -782,18 +782,6 @@ static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, /****************************************************************************** * GetDeviceInfo : get information about a device's identity */ -static HRESULT WINAPI SysMouseAImpl_GetDeviceInfo( - LPDIRECTINPUTDEVICE8A iface, - LPDIDEVICEINSTANCEA pdidi) -{ - SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface); - TRACE("(this=%p,%p)\n", This, pdidi); - - fill_mouse_dideviceinstanceA(pdidi, This->base.dinput->dwVersion); - - return DI_OK; -} - static HRESULT WINAPI SysMouseWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi) { SysMouseImpl *This = impl_from_IDirectInputDevice8W(iface); @@ -906,7 +894,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt = IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetCooperativeLevel, IDirectInputDevice2AImpl_GetObjectInfo, - SysMouseAImpl_GetDeviceInfo, + IDirectInputDevice2AImpl_GetDeviceInfo, IDirectInputDevice2AImpl_RunControlPanel, IDirectInputDevice2AImpl_Initialize, IDirectInputDevice2AImpl_CreateEffect,
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/ansi.c | 105 ++++++++++++++++++++++++++++++ dlls/dinput/device_private.h | 2 + dlls/dinput/joystick.c | 30 --------- dlls/dinput/joystick_linux.c | 2 +- dlls/dinput/joystick_linuxinput.c | 2 +- dlls/dinput/joystick_osx.c | 2 +- dlls/dinput/joystick_private.h | 1 - dlls/dinput/keyboard.c | 32 +-------- dlls/dinput/mouse.c | 32 +-------- 9 files changed, 112 insertions(+), 96 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index a8e5256bfc6..cc29bf8f6a4 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -90,6 +90,82 @@ static void dieffectinfo_wtoa( const DIEFFECTINFOW *in, DIEFFECTINFOA *out ) WideCharToMultiByte( CP_ACP, 0, in->tszName, -1, out->tszName, sizeof(out->tszName), NULL, NULL ); }
+static HRESULT string_atow( const char *in, WCHAR **out ) +{ + int len; + + *out = NULL; + if (!in) return DI_OK; + + len = MultiByteToWideChar( CP_ACP, 0, in, -1, NULL, 0 ); + if (!(*out = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return DIERR_OUTOFMEMORY; + + MultiByteToWideChar( CP_ACP, 0, in, -1, *out, len ); + return DI_OK; +} + +static void diactionformat_wtoa( const DIACTIONFORMATW *in, DIACTIONFORMATA *out ) +{ + DWORD i; + + out->dwDataSize = in->dwDataSize; + out->dwNumActions = in->dwNumActions; + + for (i = 0; i < in->dwNumActions; ++i) + { + out->rgoAction[i].uAppData = in->rgoAction[i].uAppData; + out->rgoAction[i].dwSemantic = in->rgoAction[i].dwSemantic; + out->rgoAction[i].dwFlags = in->rgoAction[i].dwFlags; + out->rgoAction[i].guidInstance = in->rgoAction[i].guidInstance; + out->rgoAction[i].dwObjID = in->rgoAction[i].dwObjID; + out->rgoAction[i].dwHow = in->rgoAction[i].dwHow; + out->rgoAction[i].lptszActionName = 0; + } + + out->guidActionMap = in->guidActionMap; + out->dwGenre = in->dwGenre; + out->dwBufferSize = in->dwBufferSize; + out->lAxisMin = in->lAxisMin; + out->lAxisMax = in->lAxisMax; + out->hInstString = in->hInstString; + out->ftTimeStamp = in->ftTimeStamp; + out->dwCRC = in->dwCRC; + + WideCharToMultiByte( CP_ACP, 0, in->tszActionMap, -1, out->tszActionMap, + sizeof(out->tszActionMap), NULL, NULL ); +} + +static void diactionformat_atow( const DIACTIONFORMATA *in, DIACTIONFORMATW *out ) +{ + DWORD i; + + out->dwDataSize = in->dwDataSize; + out->dwNumActions = in->dwNumActions; + + for (i = 0; i < out->dwNumActions; ++i) + { + out->rgoAction[i].uAppData = in->rgoAction[i].uAppData; + out->rgoAction[i].dwSemantic = in->rgoAction[i].dwSemantic; + out->rgoAction[i].dwFlags = in->rgoAction[i].dwFlags; + out->rgoAction[i].guidInstance = in->rgoAction[i].guidInstance; + out->rgoAction[i].dwObjID = in->rgoAction[i].dwObjID; + out->rgoAction[i].dwHow = in->rgoAction[i].dwHow; + out->rgoAction[i].lptszActionName = 0; + } + + out->guidActionMap = in->guidActionMap; + out->dwGenre = in->dwGenre; + out->dwBufferSize = in->dwBufferSize; + out->lAxisMin = in->lAxisMin; + out->lAxisMax = in->lAxisMax; + out->hInstString = in->hInstString; + out->ftTimeStamp = in->ftTimeStamp; + out->dwCRC = in->dwCRC; + + MultiByteToWideChar( CP_ACP, 0, in->tszActionMap, -1, out->tszActionMap, + sizeof(out->tszActionMap) / sizeof(WCHAR) ); +} + static void dideviceimageinfo_wtoa( const DIDEVICEIMAGEINFOW *in, DIDEVICEIMAGEINFOA *out ) { WideCharToMultiByte( CP_ACP, 0, in->tszImagePath, -1, out->tszImagePath, @@ -416,6 +492,35 @@ HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile( IDirectInputDevice8A return IDirectInputDevice8_WriteEffectToFile( iface_w, filename_w, entries, file_effect, flags ); }
+HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap( IDirectInputDevice8A *iface_a, DIACTIONFORMATA *format_a, + const char *username_a, DWORD flags ) +{ + IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); + DIACTIONFORMATW format_w = {sizeof(format_w), sizeof(DIACTIONW)}; + HRESULT hr; + WCHAR *username_w; + + if (!format_a) return E_POINTER; + if (format_a->dwSize != sizeof(DIACTIONFORMATA)) return DIERR_INVALIDPARAM; + if (format_a->dwActionSize != sizeof(DIACTIONA)) return DIERR_INVALIDPARAM; + if (FAILED(hr = string_atow( username_a, &username_w ))) return hr; + + format_w.dwNumActions = format_a->dwNumActions; + format_w.rgoAction = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, format_a->dwNumActions * sizeof(DIACTIONW) ); + if (!format_w.rgoAction) hr = DIERR_OUTOFMEMORY; + else + { + diactionformat_atow( format_a, &format_w ); + hr = IDirectInputDevice8_BuildActionMap( iface_w, &format_w, username_w, flags ); + diactionformat_wtoa( &format_w, format_a ); + HeapFree( GetProcessHeap(), 0, format_w.rgoAction ); + } + + HeapFree( GetProcessHeap(), 0, username_w ); + return hr; +} + HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo( IDirectInputDevice8A *iface_a, DIDEVICEIMAGEINFOHEADERA *header_a ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 0bebc36076d..1e5a2e1b836 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -248,6 +248,8 @@ extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVIC LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) DECLSPEC_HIDDEN; +extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap( LPDIRECTINPUTDEVICE8A iface, DIACTIONFORMATA *format, + const char *username, DWORD flags ) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface, diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index d048e0f821f..708bee44857 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -773,36 +773,6 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, return IDirectInputDevice8WImpl_BuildActionMap(iface, lpdiaf, lpszUserName, dwFlags); }
-HRESULT WINAPI JoystickAGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, - LPDIACTIONFORMATA lpdiaf, - LPCSTR lpszUserName, - DWORD dwFlags) -{ - JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface); - DIACTIONFORMATW diafW; - HRESULT hr; - WCHAR *lpszUserNameW = NULL; - int username_size; - - diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions); - _copy_diactionformatAtoW(&diafW, lpdiaf); - - if (lpszUserName != NULL) - { - username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0); - lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size); - MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size); - } - - hr = JoystickWGenericImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags); - - _copy_diactionformatWtoA(lpdiaf, &diafW); - HeapFree(GetProcessHeap(), 0, diafW.rgoAction); - HeapFree(GetProcessHeap(), 0, lpszUserNameW); - - return hr; -} - HRESULT WINAPI JoystickWGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index 8290eef0bcb..e0102ec1f4e 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -909,7 +909,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SendDeviceData, IDirectInputDevice7AImpl_EnumEffectsInFile, IDirectInputDevice7AImpl_WriteEffectToFile, - JoystickAGenericImpl_BuildActionMap, + IDirectInputDevice8AImpl_BuildActionMap, JoystickAGenericImpl_SetActionMap, IDirectInputDevice8AImpl_GetImageInfo }; diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index dd59976719a..0ef18de968e 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -1339,7 +1339,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SendDeviceData, IDirectInputDevice7AImpl_EnumEffectsInFile, IDirectInputDevice7AImpl_WriteEffectToFile, - JoystickAGenericImpl_BuildActionMap, + IDirectInputDevice8AImpl_BuildActionMap, JoystickAGenericImpl_SetActionMap, IDirectInputDevice8AImpl_GetImageInfo }; diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index b72322e0bd6..56886a6904d 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -1600,7 +1600,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice2AImpl_SendDeviceData, IDirectInputDevice7AImpl_EnumEffectsInFile, IDirectInputDevice7AImpl_WriteEffectToFile, - JoystickAGenericImpl_BuildActionMap, + IDirectInputDevice8AImpl_BuildActionMap, JoystickAGenericImpl_SetActionMap, IDirectInputDevice8AImpl_GetImageInfo }; diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h index 235ec962fb8..d4dabcb5dbd 100644 --- a/dlls/dinput/joystick_private.h +++ b/dlls/dinput/joystick_private.h @@ -77,7 +77,6 @@ HRESULT WINAPI JoystickWGenericImpl_Poll(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_H
HRESULT WINAPI JoystickWGenericImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface, DWORD len, LPVOID ptr) DECLSPEC_HIDDEN;
-HRESULT WINAPI JoystickAGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags) DECLSPEC_HIDDEN; HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) DECLSPEC_HIDDEN;
HRESULT WINAPI JoystickAGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index d9c3f02e669..5143eb4752c 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -554,36 +554,6 @@ static HRESULT WINAPI SysKeyboardWImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W ifac return _build_action_map(iface, lpdiaf, lpszUserName, dwFlags, DIKEYBOARD_MASK, &c_dfDIKeyboard); }
-static HRESULT WINAPI SysKeyboardAImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, - LPDIACTIONFORMATA lpdiaf, - LPCSTR lpszUserName, - DWORD dwFlags) -{ - SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface); - DIACTIONFORMATW diafW; - HRESULT hr; - WCHAR *lpszUserNameW = NULL; - int username_size; - - diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions); - _copy_diactionformatAtoW(&diafW, lpdiaf); - - if (lpszUserName != NULL) - { - username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0); - lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size); - MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size); - } - - hr = SysKeyboardWImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags); - - _copy_diactionformatWtoA(lpdiaf, &diafW); - HeapFree(GetProcessHeap(), 0, diafW.rgoAction); - HeapFree(GetProcessHeap(), 0, lpszUserNameW); - - return hr; -} - static HRESULT WINAPI SysKeyboardWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, @@ -655,7 +625,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt = IDirectInputDevice2AImpl_SendDeviceData, IDirectInputDevice7AImpl_EnumEffectsInFile, IDirectInputDevice7AImpl_WriteEffectToFile, - SysKeyboardAImpl_BuildActionMap, + IDirectInputDevice8AImpl_BuildActionMap, SysKeyboardAImpl_SetActionMap, IDirectInputDevice8AImpl_GetImageInfo }; diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index f5f6bf2214a..62bc6b1f006 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -807,36 +807,6 @@ static HRESULT WINAPI SysMouseWImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, return _build_action_map(iface, lpdiaf, lpszUserName, dwFlags, DIMOUSE_MASK, &c_dfDIMouse2); }
-static HRESULT WINAPI SysMouseAImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, - LPDIACTIONFORMATA lpdiaf, - LPCSTR lpszUserName, - DWORD dwFlags) -{ - SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface); - DIACTIONFORMATW diafW; - HRESULT hr; - WCHAR *lpszUserNameW = NULL; - int username_size; - - diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions); - _copy_diactionformatAtoW(&diafW, lpdiaf); - - if (lpszUserName != NULL) - { - username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0); - lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size); - MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size); - } - - hr = SysMouseWImpl_BuildActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags); - - _copy_diactionformatWtoA(lpdiaf, &diafW); - HeapFree(GetProcessHeap(), 0, diafW.rgoAction); - HeapFree(GetProcessHeap(), 0, lpszUserNameW); - - return hr; -} - static HRESULT WINAPI SysMouseWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, @@ -908,7 +878,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt = IDirectInputDevice2AImpl_SendDeviceData, IDirectInputDevice7AImpl_EnumEffectsInFile, IDirectInputDevice7AImpl_WriteEffectToFile, - SysMouseAImpl_BuildActionMap, + IDirectInputDevice8AImpl_BuildActionMap, SysMouseAImpl_SetActionMap, IDirectInputDevice8AImpl_GetImageInfo };
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/ansi.c | 29 +++++++++++++++++++++++++ dlls/dinput/device_private.h | 2 ++ dlls/dinput/joystick.c | 33 ----------------------------- dlls/dinput/joystick_linux.c | 2 +- dlls/dinput/joystick_linuxinput.c | 2 +- dlls/dinput/joystick_osx.c | 2 +- dlls/dinput/joystick_private.h | 1 - dlls/dinput/keyboard.c | 35 +------------------------------ dlls/dinput/mouse.c | 35 +------------------------------ 9 files changed, 36 insertions(+), 105 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index cc29bf8f6a4..77b535746a2 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -521,6 +521,35 @@ HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap( IDirectInputDevice8A *if return hr; }
+HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap( IDirectInputDevice8A *iface_a, DIACTIONFORMATA *format_a, + const char *username_a, DWORD flags ) +{ + IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); + DIACTIONFORMATW format_w = {sizeof(format_w), sizeof(DIACTIONW)}; + HRESULT hr; + WCHAR *username_w; + + if (!format_a) return E_POINTER; + if (format_a->dwSize != sizeof(DIACTIONFORMATA)) return DIERR_INVALIDPARAM; + if (format_a->dwActionSize != sizeof(DIACTIONA)) return DIERR_INVALIDPARAM; + if (FAILED(hr = string_atow( username_a, &username_w ))) return hr; + + format_w.dwNumActions = format_a->dwNumActions; + format_w.rgoAction = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, format_a->dwNumActions * sizeof(DIACTIONW) ); + if (!format_w.rgoAction) hr = DIERR_OUTOFMEMORY; + else + { + diactionformat_atow( format_a, &format_w ); + hr = IDirectInputDevice8_SetActionMap( iface_w, &format_w, username_w, flags ); + diactionformat_wtoa( &format_w, format_a ); + HeapFree( GetProcessHeap(), 0, format_w.rgoAction ); + } + + HeapFree( GetProcessHeap(), 0, username_w ); + return hr; +} + HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo( IDirectInputDevice8A *iface_a, DIDEVICEIMAGEINFOHEADERA *header_a ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 1e5a2e1b836..e9168712fd9 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -250,6 +250,8 @@ extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVIC DWORD dwFlags) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice8AImpl_BuildActionMap( LPDIRECTINPUTDEVICE8A iface, DIACTIONFORMATA *format, const char *username, DWORD flags ) DECLSPEC_HIDDEN; +extern HRESULT WINAPI IDirectInputDevice8AImpl_SetActionMap( LPDIRECTINPUTDEVICE8A iface, DIACTIONFORMATA *format, + const char *username, DWORD flags ) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice8AImpl_GetImageInfo(LPDIRECTINPUTDEVICE8A iface, LPDIDEVICEIMAGEINFOHEADERA lpdiDevImageInfoHeader) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface, diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index 708bee44857..a68c4df20e6 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -60,10 +60,6 @@ const GUID DInput_PIDVID_Product_GUID = { /* device_pidvid-0000-0000-0000-504944 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44} };
-static inline JoystickGenericImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) -{ - return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface), JoystickGenericImpl, base); -} static inline JoystickGenericImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), JoystickGenericImpl, base); @@ -785,35 +781,6 @@ HRESULT WINAPI JoystickWGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, return _set_action_map(iface, lpdiaf, lpszUserName, dwFlags, This->base.data_format.wine_df); }
-HRESULT WINAPI JoystickAGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface, - LPDIACTIONFORMATA lpdiaf, - LPCSTR lpszUserName, - DWORD dwFlags) -{ - JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface); - DIACTIONFORMATW diafW; - HRESULT hr; - WCHAR *lpszUserNameW = NULL; - int username_size; - - diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions); - _copy_diactionformatAtoW(&diafW, lpdiaf); - - if (lpszUserName != NULL) - { - username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0); - lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size); - MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size); - } - - hr = JoystickWGenericImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags); - - HeapFree(GetProcessHeap(), 0, diafW.rgoAction); - HeapFree(GetProcessHeap(), 0, lpszUserNameW); - - return hr; -} - /* * This maps the read value (from the input event) to a value in the * 'wanted' range. diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index e0102ec1f4e..a33b16454b0 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -910,7 +910,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice7AImpl_EnumEffectsInFile, IDirectInputDevice7AImpl_WriteEffectToFile, IDirectInputDevice8AImpl_BuildActionMap, - JoystickAGenericImpl_SetActionMap, + IDirectInputDevice8AImpl_SetActionMap, IDirectInputDevice8AImpl_GetImageInfo };
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 0ef18de968e..2e2c8a87261 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -1340,7 +1340,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice7AImpl_EnumEffectsInFile, IDirectInputDevice7AImpl_WriteEffectToFile, IDirectInputDevice8AImpl_BuildActionMap, - JoystickAGenericImpl_SetActionMap, + IDirectInputDevice8AImpl_SetActionMap, IDirectInputDevice8AImpl_GetImageInfo };
diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index 56886a6904d..e2212557180 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -1601,7 +1601,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt = IDirectInputDevice7AImpl_EnumEffectsInFile, IDirectInputDevice7AImpl_WriteEffectToFile, IDirectInputDevice8AImpl_BuildActionMap, - JoystickAGenericImpl_SetActionMap, + IDirectInputDevice8AImpl_SetActionMap, IDirectInputDevice8AImpl_GetImageInfo };
diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h index d4dabcb5dbd..78d5d721808 100644 --- a/dlls/dinput/joystick_private.h +++ b/dlls/dinput/joystick_private.h @@ -79,7 +79,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface,
HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) DECLSPEC_HIDDEN;
-HRESULT WINAPI JoystickAGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags) DECLSPEC_HIDDEN; HRESULT WINAPI JoystickWGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags) DECLSPEC_HIDDEN;
DWORD typeFromGUID(REFGUID guid) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 5143eb4752c..9d4ceda3edc 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -51,10 +51,6 @@ struct SysKeyboardImpl DWORD subtype; };
-static inline SysKeyboardImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) -{ - return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface), SysKeyboardImpl, base); -} static inline SysKeyboardImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysKeyboardImpl, base); @@ -565,35 +561,6 @@ static HRESULT WINAPI SysKeyboardWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, return _set_action_map(iface, lpdiaf, lpszUserName, dwFlags, &c_dfDIKeyboard); }
-static HRESULT WINAPI SysKeyboardAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface, - LPDIACTIONFORMATA lpdiaf, - LPCSTR lpszUserName, - DWORD dwFlags) -{ - SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface); - DIACTIONFORMATW diafW; - HRESULT hr; - WCHAR *lpszUserNameW = NULL; - int username_size; - - diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions); - _copy_diactionformatAtoW(&diafW, lpdiaf); - - if (lpszUserName != NULL) - { - username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0); - lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size); - MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size); - } - - hr = SysKeyboardWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags); - - HeapFree(GetProcessHeap(), 0, diafW.rgoAction); - HeapFree(GetProcessHeap(), 0, lpszUserNameW); - - return hr; -} - static const IDirectInputDevice8AVtbl SysKeyboardAvt = { IDirectInputDevice2AImpl_QueryInterface, @@ -626,7 +593,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt = IDirectInputDevice7AImpl_EnumEffectsInFile, IDirectInputDevice7AImpl_WriteEffectToFile, IDirectInputDevice8AImpl_BuildActionMap, - SysKeyboardAImpl_SetActionMap, + IDirectInputDevice8AImpl_SetActionMap, IDirectInputDevice8AImpl_GetImageInfo };
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 62bc6b1f006..e5bd697a0ea 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -78,10 +78,6 @@ struct SysMouseImpl WARP_MOUSE warp_override; };
-static inline SysMouseImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) -{ - return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface), SysMouseImpl, base); -} static inline SysMouseImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysMouseImpl, base); @@ -818,35 +814,6 @@ static HRESULT WINAPI SysMouseWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, return _set_action_map(iface, lpdiaf, lpszUserName, dwFlags, &c_dfDIMouse2); }
-static HRESULT WINAPI SysMouseAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface, - LPDIACTIONFORMATA lpdiaf, - LPCSTR lpszUserName, - DWORD dwFlags) -{ - SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface); - DIACTIONFORMATW diafW; - HRESULT hr; - WCHAR *lpszUserNameW = NULL; - int username_size; - - diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiaf->dwNumActions); - _copy_diactionformatAtoW(&diafW, lpdiaf); - - if (lpszUserName != NULL) - { - username_size = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0); - lpszUserNameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*username_size); - MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, lpszUserNameW, username_size); - } - - hr = SysMouseWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags); - - HeapFree(GetProcessHeap(), 0, diafW.rgoAction); - HeapFree(GetProcessHeap(), 0, lpszUserNameW); - - return hr; -} - static const IDirectInputDevice8AVtbl SysMouseAvt = { IDirectInputDevice2AImpl_QueryInterface, @@ -879,7 +846,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt = IDirectInputDevice7AImpl_EnumEffectsInFile, IDirectInputDevice7AImpl_WriteEffectToFile, IDirectInputDevice8AImpl_BuildActionMap, - SysMouseAImpl_SetActionMap, + IDirectInputDevice8AImpl_SetActionMap, IDirectInputDevice8AImpl_GetImageInfo };