Commit 6a078850 authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

dinput: Explicitly define ASCII and Unicode methods in joystick base class. Use…

dinput: Explicitly define ASCII and Unicode methods in joystick base class. Use new methods in child classes.
parent 30ab6c17
......@@ -40,16 +40,21 @@ static inline JoystickGenericImpl *impl_from_IDirectInputDevice8W(IDirectInputDe
{
return (JoystickGenericImpl *) iface;
}
static inline IDirectInputDevice8A *IDirectInputDevice8A_from_impl(JoystickGenericImpl *This)
{
return (IDirectInputDevice8A *)This;
}
static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(JoystickGenericImpl *This)
{
return (IDirectInputDevice8W *)This;
}
/******************************************************************************
* SetProperty : change input device properties
*/
HRESULT WINAPI JoystickAGenericImpl_SetProperty(
LPDIRECTINPUTDEVICE8A iface,
REFGUID rguid,
LPCDIPROPHEADER ph)
HRESULT WINAPI JoystickWGenericImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER ph)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface);
DWORD i;
TRACE("(%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
......@@ -119,13 +124,19 @@ HRESULT WINAPI JoystickAGenericImpl_SetProperty(
break;
}
default:
return IDirectInputDevice2AImpl_SetProperty(iface, rguid, ph);
return IDirectInputDevice2WImpl_SetProperty(iface, rguid, ph);
}
}
return DI_OK;
}
HRESULT WINAPI JoystickAGenericImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER ph)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
return JoystickWGenericImpl_SetProperty(IDirectInputDevice8W_from_impl(This), rguid, ph);
}
void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps)
{
TRACE("dwSize: %d\n", lpDIDevCaps->dwSize);
......@@ -149,11 +160,9 @@ void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps)
}
}
HRESULT WINAPI JoystickAGenericImpl_GetCapabilities(
LPDIRECTINPUTDEVICE8A iface,
LPDIDEVCAPS lpDIDevCaps)
HRESULT WINAPI JoystickWGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, LPDIDEVCAPS lpDIDevCaps)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface);
int size;
TRACE("%p->(%p)\n",iface,lpDIDevCaps);
......@@ -179,6 +188,12 @@ HRESULT WINAPI JoystickAGenericImpl_GetCapabilities(
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
*/
......@@ -207,12 +222,13 @@ HRESULT WINAPI JoystickWGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
HRESULT WINAPI JoystickAGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8A iface,
LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
HRESULT res;
DIDEVICEOBJECTINSTANCEW didoiW;
DWORD dwSize = pdidoi->dwSize;
didoiW.dwSize = sizeof(didoiW);
res = JoystickWGenericImpl_GetObjectInfo((LPDIRECTINPUTDEVICE8W)iface, &didoiW, dwObj, dwHow);
res = JoystickWGenericImpl_GetObjectInfo(IDirectInputDevice8W_from_impl(This), &didoiW, dwObj, dwHow);
if (res != DI_OK) return res;
memset(pdidoi, 0, pdidoi->dwSize);
......@@ -227,12 +243,9 @@ HRESULT WINAPI JoystickAGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8A iface,
/******************************************************************************
* GetProperty : get input device properties
*/
HRESULT WINAPI JoystickAGenericImpl_GetProperty(
LPDIRECTINPUTDEVICE8A iface,
REFGUID rguid,
LPDIPROPHEADER pdiph)
HRESULT WINAPI JoystickWGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(rguid), pdiph);
......@@ -278,13 +291,19 @@ HRESULT WINAPI JoystickAGenericImpl_GetProperty(
break;
}
default:
return IDirectInputDevice2AImpl_GetProperty(iface, rguid, pdiph);
return IDirectInputDevice2WImpl_GetProperty(iface, rguid, pdiph);
}
}
return DI_OK;
}
HRESULT WINAPI JoystickAGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
return JoystickWGenericImpl_GetProperty(IDirectInputDevice8W_from_impl(This), rguid, pdiph);
}
/******************************************************************************
* GetDeviceInfo : get information about a device's identity
*/
......@@ -356,9 +375,9 @@ HRESULT WINAPI JoystickWGenericImpl_GetDeviceInfo(
return DI_OK;
}
HRESULT WINAPI JoystickAGenericImpl_Poll(LPDIRECTINPUTDEVICE8A iface)
HRESULT WINAPI JoystickWGenericImpl_Poll(LPDIRECTINPUTDEVICE8W iface)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface);
TRACE("(%p)\n",This);
......@@ -367,20 +386,23 @@ HRESULT WINAPI JoystickAGenericImpl_Poll(LPDIRECTINPUTDEVICE8A iface)
return DIERR_NOTACQUIRED;
}
This->joy_polldev(iface);
This->joy_polldev(IDirectInputDevice8A_from_impl(This));
return DI_OK;
}
HRESULT WINAPI JoystickAGenericImpl_Poll(LPDIRECTINPUTDEVICE8A iface)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
return JoystickWGenericImpl_Poll(IDirectInputDevice8W_from_impl(This));
}
/******************************************************************************
* GetDeviceState : returns the "state" of the joystick.
*
*/
HRESULT WINAPI JoystickAGenericImpl_GetDeviceState(
LPDIRECTINPUTDEVICE8A iface,
DWORD len,
LPVOID ptr)
HRESULT WINAPI JoystickWGenericImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface, DWORD len, LPVOID ptr)
{
JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface);
TRACE("(%p,0x%08x,%p)\n", This, len, ptr);
......@@ -390,7 +412,7 @@ HRESULT WINAPI JoystickAGenericImpl_GetDeviceState(
}
/* update joystick state */
This->joy_polldev(iface);
This->joy_polldev(IDirectInputDevice8A_from_impl(This));
/* convert and copy data to user supplied buffer */
fill_DataFormat(ptr, len, &This->js, &This->base.data_format);
......@@ -398,6 +420,12 @@ HRESULT WINAPI JoystickAGenericImpl_GetDeviceState(
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);
}
/*
* This maps the read value (from the input event) to a value in the
* 'wanted' range.
......
......@@ -676,13 +676,13 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
IDirectInputDevice2WImpl_QueryInterface,
IDirectInputDevice2WImpl_AddRef,
IDirectInputDevice2WImpl_Release,
XCAST(GetCapabilities)JoystickAGenericImpl_GetCapabilities,
JoystickWGenericImpl_GetCapabilities,
IDirectInputDevice2WImpl_EnumObjects,
XCAST(GetProperty)JoystickAGenericImpl_GetProperty,
XCAST(SetProperty)JoystickAGenericImpl_SetProperty,
JoystickWGenericImpl_GetProperty,
JoystickWGenericImpl_SetProperty,
XCAST(Acquire)JoystickLinuxAImpl_Acquire,
XCAST(Unacquire)JoystickLinuxAImpl_Unacquire,
XCAST(GetDeviceState)JoystickAGenericImpl_GetDeviceState,
JoystickWGenericImpl_GetDeviceState,
IDirectInputDevice2WImpl_GetDeviceData,
IDirectInputDevice2WImpl_SetDataFormat,
IDirectInputDevice2WImpl_SetEventNotification,
......@@ -698,7 +698,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
IDirectInputDevice2WImpl_SendForceFeedbackCommand,
IDirectInputDevice2WImpl_EnumCreatedEffectObjects,
IDirectInputDevice2WImpl_Escape,
XCAST(Poll)JoystickAGenericImpl_Poll,
JoystickWGenericImpl_Poll,
IDirectInputDevice2WImpl_SendDeviceData,
IDirectInputDevice7WImpl_EnumEffectsInFile,
IDirectInputDevice7WImpl_WriteEffectToFile,
......
......@@ -1366,13 +1366,13 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
IDirectInputDevice2WImpl_QueryInterface,
IDirectInputDevice2WImpl_AddRef,
IDirectInputDevice2WImpl_Release,
XCAST(GetCapabilities)JoystickAGenericImpl_GetCapabilities,
JoystickWGenericImpl_GetCapabilities,
IDirectInputDevice2WImpl_EnumObjects,
XCAST(GetProperty)JoystickAImpl_GetProperty,
XCAST(SetProperty)JoystickAImpl_SetProperty,
XCAST(Acquire)JoystickAImpl_Acquire,
XCAST(Unacquire)JoystickAImpl_Unacquire,
XCAST(GetDeviceState)JoystickAGenericImpl_GetDeviceState,
JoystickWGenericImpl_GetDeviceState,
IDirectInputDevice2WImpl_GetDeviceData,
IDirectInputDevice2WImpl_SetDataFormat,
IDirectInputDevice2WImpl_SetEventNotification,
......@@ -1388,7 +1388,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
XCAST(SendForceFeedbackCommand)JoystickAImpl_SendForceFeedbackCommand,
XCAST(EnumCreatedEffectObjects)JoystickAImpl_EnumCreatedEffectObjects,
IDirectInputDevice2WImpl_Escape,
XCAST(Poll)JoystickAGenericImpl_Poll,
JoystickWGenericImpl_Poll,
IDirectInputDevice2WImpl_SendDeviceData,
IDirectInputDevice7WImpl_EnumEffectsInFile,
IDirectInputDevice7WImpl_WriteEffectToFile,
......
......@@ -975,24 +975,18 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
IDirectInputDevice8AImpl_GetImageInfo
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(JoystickWvt.fun))
#else
# define XCAST(fun) (void*)
#endif
static const IDirectInputDevice8WVtbl JoystickWvt =
{
IDirectInputDevice2WImpl_QueryInterface,
IDirectInputDevice2WImpl_AddRef,
IDirectInputDevice2WImpl_Release,
XCAST(GetCapabilities)JoystickAGenericImpl_GetCapabilities,
JoystickWGenericImpl_GetCapabilities,
IDirectInputDevice2WImpl_EnumObjects,
XCAST(GetProperty)JoystickAGenericImpl_GetProperty,
XCAST(SetProperty)JoystickAGenericImpl_SetProperty,
JoystickWGenericImpl_GetProperty,
JoystickWGenericImpl_SetProperty,
IDirectInputDevice2WImpl_Acquire,
IDirectInputDevice2WImpl_Unacquire,
XCAST(GetDeviceState)JoystickAGenericImpl_GetDeviceState,
JoystickWGenericImpl_GetDeviceState,
IDirectInputDevice2WImpl_GetDeviceData,
IDirectInputDevice2WImpl_SetDataFormat,
IDirectInputDevice2WImpl_SetEventNotification,
......@@ -1008,7 +1002,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
IDirectInputDevice2WImpl_SendForceFeedbackCommand,
IDirectInputDevice2WImpl_EnumCreatedEffectObjects,
IDirectInputDevice2WImpl_Escape,
XCAST(Poll)JoystickAGenericImpl_Poll,
JoystickWGenericImpl_Poll,
IDirectInputDevice2WImpl_SendDeviceData,
IDirectInputDevice7WImpl_EnumEffectsInFile,
IDirectInputDevice7WImpl_WriteEffectToFile,
......@@ -1016,7 +1010,6 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
IDirectInputDevice8WImpl_SetActionMap,
IDirectInputDevice8WImpl_GetImageInfo
};
#undef XCAST
#else /* HAVE_IOHIDMANAGERCREATE */
......
......@@ -63,16 +63,16 @@ HRESULT WINAPI JoystickWGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
HRESULT WINAPI JoystickAGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8A iface,
LPDIDEVICEOBJECTINSTANCEA pdidoi, DWORD dwObj, DWORD dwHow);
HRESULT WINAPI JoystickAGenericImpl_GetProperty( LPDIRECTINPUTDEVICE8A iface,
REFGUID rguid, LPDIPROPHEADER pdiph);
HRESULT WINAPI JoystickAGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPDIPROPHEADER pdiph);
HRESULT WINAPI JoystickWGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph);
HRESULT WINAPI JoystickAGenericImpl_GetCapabilities( LPDIRECTINPUTDEVICE8A iface,
LPDIDEVCAPS lpDIDevCaps);
HRESULT WINAPI JoystickAGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps);
HRESULT WINAPI JoystickWGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, LPDIDEVCAPS lpDIDevCaps);
void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps);
HRESULT WINAPI JoystickAGenericImpl_SetProperty( LPDIRECTINPUTDEVICE8A iface,
REFGUID rguid, LPCDIPROPHEADER ph);
HRESULT WINAPI JoystickAGenericImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REFGUID rguid, LPCDIPROPHEADER ph);
HRESULT WINAPI JoystickWGenericImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER ph);
HRESULT WINAPI JoystickAGenericImpl_GetDeviceInfo( LPDIRECTINPUTDEVICE8A iface,
LPDIDEVICEINSTANCEA pdidi);
......@@ -81,8 +81,9 @@ HRESULT WINAPI JoystickWGenericImpl_GetDeviceInfo( LPDIRECTINPUTDEVICE8W iface,
LPDIDEVICEINSTANCEW pdidi);
HRESULT WINAPI JoystickAGenericImpl_Poll(LPDIRECTINPUTDEVICE8A iface);
HRESULT WINAPI JoystickWGenericImpl_Poll(LPDIRECTINPUTDEVICE8W iface);
HRESULT WINAPI JoystickAGenericImpl_GetDeviceState( LPDIRECTINPUTDEVICE8A iface,
DWORD len, LPVOID ptr);
HRESULT WINAPI JoystickAGenericImpl_GetDeviceState(LPDIRECTINPUTDEVICE8A iface, DWORD len, LPVOID ptr);
HRESULT WINAPI JoystickWGenericImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface, DWORD len, LPVOID ptr);
#endif /* __WINE_DLLS_DINPUT_JOYSTICK_PRIVATE_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment