dinput: Support DIPROP_AUTOCENTER for OSX joysticks.

This commit is contained in:
Andrew Eikum 2013-05-23 14:58:24 -05:00 committed by Alexandre Julliard
parent 4ce1da041f
commit 0ba2a2f70b
1 changed files with 47 additions and 2 deletions

View File

@ -1118,6 +1118,51 @@ static HRESULT joydev_create_device(IDirectInputImpl *dinput, REFGUID rguid, REF
return DIERR_DEVICENOTREG; return DIERR_DEVICENOTREG;
} }
static HRESULT osx_set_autocenter(JoystickImpl *This,
const DIPROPDWORD *header)
{
UInt32 v;
HRESULT hr;
if(!This->ff)
return DIERR_UNSUPPORTED;
v = header->dwData;
hr = osx_to_win32_hresult(FFDeviceSetForceFeedbackProperty(This->ff, FFPROP_AUTOCENTER, &v));
TRACE("returning: %08x\n", hr);
return hr;
}
static HRESULT WINAPI JoystickWImpl_SetProperty(IDirectInputDevice8W *iface,
const GUID *prop, const DIPROPHEADER *header)
{
JoystickImpl *This = impl_from_IDirectInputDevice8W(iface);
TRACE("%p %s %p\n", This, debugstr_guid(prop), header);
switch(LOWORD(prop))
{
case (DWORD_PTR)DIPROP_AUTOCENTER:
return osx_set_autocenter(This, (const DIPROPDWORD *)header);
}
return JoystickWGenericImpl_SetProperty(iface, prop, header);
}
static HRESULT WINAPI JoystickAImpl_SetProperty(IDirectInputDevice8A *iface,
const GUID *prop, const DIPROPHEADER *header)
{
JoystickImpl *This = impl_from_IDirectInputDevice8A(iface);
TRACE("%p %s %p\n", This, debugstr_guid(prop), header);
switch(LOWORD(prop))
{
case (DWORD_PTR)DIPROP_AUTOCENTER:
return osx_set_autocenter(This, (const DIPROPDWORD *)header);
}
return JoystickAGenericImpl_SetProperty(iface, prop, header);
}
static CFUUIDRef effect_win_to_mac(const GUID *effect) static CFUUIDRef effect_win_to_mac(const GUID *effect)
{ {
#define DO_MAP(X) \ #define DO_MAP(X) \
@ -1240,7 +1285,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
JoystickAGenericImpl_GetCapabilities, JoystickAGenericImpl_GetCapabilities,
IDirectInputDevice2AImpl_EnumObjects, IDirectInputDevice2AImpl_EnumObjects,
JoystickAGenericImpl_GetProperty, JoystickAGenericImpl_GetProperty,
JoystickAGenericImpl_SetProperty, JoystickAImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire, IDirectInputDevice2AImpl_Unacquire,
JoystickAGenericImpl_GetDeviceState, JoystickAGenericImpl_GetDeviceState,
@ -1276,7 +1321,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
JoystickWGenericImpl_GetCapabilities, JoystickWGenericImpl_GetCapabilities,
IDirectInputDevice2WImpl_EnumObjects, IDirectInputDevice2WImpl_EnumObjects,
JoystickWGenericImpl_GetProperty, JoystickWGenericImpl_GetProperty,
JoystickWGenericImpl_SetProperty, JoystickWImpl_SetProperty,
IDirectInputDevice2WImpl_Acquire, IDirectInputDevice2WImpl_Acquire,
IDirectInputDevice2WImpl_Unacquire, IDirectInputDevice2WImpl_Unacquire,
JoystickWGenericImpl_GetDeviceState, JoystickWGenericImpl_GetDeviceState,