dinput: Factor out IDirectInputDevice_GetDeviceState WtoA conversions.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-05-27 10:50:02 +02:00 committed by Alexandre Julliard
parent 5eb5f94fc0
commit 7713050c77
9 changed files with 13 additions and 38 deletions

View File

@ -192,6 +192,13 @@ HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire( IDirectInputDevice8A *iface_a
return IDirectInputDevice8_Unacquire( iface_w ); 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, HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceData( IDirectInputDevice8A *iface_a, DWORD data_size, DIDEVICEOBJECTDATA *data,
DWORD *entries, DWORD flags ) DWORD *entries, DWORD flags )
{ {

View File

@ -136,6 +136,7 @@ extern HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A ifa
extern HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
extern HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN; extern HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN;
extern HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W 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 IDirectInputDevice2AImpl_SetDataFormat(LPDIRECTINPUTDEVICE8A iface, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
extern HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W 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; extern HRESULT WINAPI IDirectInputDevice2AImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8A iface, HWND hwnd, DWORD dwflags) DECLSPEC_HIDDEN;

View File

@ -68,10 +68,6 @@ static inline JoystickGenericImpl *impl_from_IDirectInputDevice8W(IDirectInputDe
{ {
return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), JoystickGenericImpl, base); 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) DWORD typeFromGUID(REFGUID guid)
{ {
@ -773,13 +769,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface,
return DI_OK; 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, HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
LPDIACTIONFORMATW lpdiaf, LPDIACTIONFORMATW lpdiaf,
LPCWSTR lpszUserName, LPCWSTR lpszUserName,

View File

@ -913,7 +913,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire, IDirectInputDevice2AImpl_Unacquire,
JoystickAGenericImpl_GetDeviceState, IDirectInputDevice2AImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData, IDirectInputDevice2AImpl_GetDeviceData,
IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetEventNotification,

View File

@ -1344,7 +1344,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire, IDirectInputDevice2AImpl_Unacquire,
JoystickAGenericImpl_GetDeviceState, IDirectInputDevice2AImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData, IDirectInputDevice2AImpl_GetDeviceData,
IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetEventNotification,

View File

@ -1585,7 +1585,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire, IDirectInputDevice2AImpl_Unacquire,
JoystickAGenericImpl_GetDeviceState, IDirectInputDevice2AImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData, IDirectInputDevice2AImpl_GetDeviceData,
IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetEventNotification,

View File

@ -78,7 +78,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetDeviceInfo( LPDIRECTINPUTDEVICE8W iface,
HRESULT WINAPI JoystickWGenericImpl_Poll(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN; 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 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 JoystickAGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8A iface, LPDIACTIONFORMATA lpdiaf, LPCSTR lpszUserName, DWORD dwFlags) DECLSPEC_HIDDEN;

View File

@ -59,10 +59,6 @@ static inline SysKeyboardImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice
{ {
return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysKeyboardImpl, base); 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) 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; 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 * GetCapabilities : get the device capabilities
*/ */
@ -657,7 +647,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt =
IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire, IDirectInputDevice2AImpl_Unacquire,
SysKeyboardAImpl_GetDeviceState, IDirectInputDevice2AImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData, IDirectInputDevice2AImpl_GetDeviceData,
IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetEventNotification,

View File

@ -87,11 +87,6 @@ static inline SysMouseImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W
return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysMouseImpl, base); 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) static void _dump_mouse_state(const DIMOUSESTATE2 *m_state)
{ {
int i; int i;
@ -647,12 +642,6 @@ static HRESULT WINAPI SysMouseWImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface,
return DI_OK; 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. * GetDeviceData : gets buffered input data.
*/ */
@ -911,7 +900,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt =
IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire, IDirectInputDevice2AImpl_Unacquire,
SysMouseAImpl_GetDeviceState, IDirectInputDevice2AImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData, IDirectInputDevice2AImpl_GetDeviceData,
IDirectInputDevice2AImpl_SetDataFormat, IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification, IDirectInputDevice2AImpl_SetEventNotification,