dinput: Implement IDirectInputDevice_GetEffectInfo WtoA conversion.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
08d07c4cc2
commit
70b25ccfaa
|
@ -64,6 +64,15 @@ static void dideviceobjectinstance_wtoa( const DIDEVICEOBJECTINSTANCEW *in, DIDE
|
|||
out->wReserved = in->wReserved;
|
||||
}
|
||||
|
||||
static void dieffectinfo_wtoa( const DIEFFECTINFOW *in, DIEFFECTINFOA *out )
|
||||
{
|
||||
out->guid = in->guid;
|
||||
out->dwEffType = in->dwEffType;
|
||||
out->dwStaticParams = in->dwStaticParams;
|
||||
out->dwDynamicParams = in->dwDynamicParams;
|
||||
WideCharToMultiByte( CP_ACP, 0, in->tszName, -1, out->tszName, sizeof(out->tszName), NULL, NULL );
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface( IDirectInputDevice8A *iface_a, REFIID iid, void **out )
|
||||
{
|
||||
IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a );
|
||||
|
@ -210,6 +219,22 @@ HRESULT WINAPI IDirectInputDevice2AImpl_CreateEffect( IDirectInputDevice8A *ifac
|
|||
return IDirectInputDevice8_CreateEffect( iface_w, guid, effect, out, outer );
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo( IDirectInputDevice8A *iface_a, DIEFFECTINFOA *info_a, REFGUID guid )
|
||||
{
|
||||
IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a );
|
||||
IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl );
|
||||
DIEFFECTINFOW info_w = {sizeof(info_w)};
|
||||
HRESULT hr;
|
||||
|
||||
if (!info_a) return E_POINTER;
|
||||
if (info_a->dwSize != sizeof(DIEFFECTINFOA)) return DIERR_INVALIDPARAM;
|
||||
|
||||
hr = IDirectInputDevice8_GetEffectInfo( iface_w, &info_w, guid );
|
||||
dieffectinfo_wtoa( &info_w, info_a );
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirectInputDevice2AImpl_GetForceFeedbackState( IDirectInputDevice8A *iface_a, DWORD *state )
|
||||
{
|
||||
IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a );
|
||||
|
|
|
@ -1611,16 +1611,6 @@ HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects(
|
|||
return DI_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirectInputDevice2AImpl_GetEffectInfo(
|
||||
LPDIRECTINPUTDEVICE8A iface,
|
||||
LPDIEFFECTINFOA lpdei,
|
||||
REFGUID rguid)
|
||||
{
|
||||
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
|
||||
FIXME("(%p)->(%p,%s): stub!\n", This, lpdei, debugstr_guid(rguid));
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo(
|
||||
LPDIRECTINPUTDEVICE8W iface,
|
||||
LPDIEFFECTINFOW lpdei,
|
||||
|
|
|
@ -852,40 +852,6 @@ DECLSPEC_HIDDEN HRESULT linuxinput_create_effect(
|
|||
return DI_OK;
|
||||
}
|
||||
|
||||
DECLSPEC_HIDDEN HRESULT linuxinput_get_info_A(
|
||||
int fd,
|
||||
REFGUID rguid,
|
||||
LPDIEFFECTINFOA info)
|
||||
{
|
||||
DWORD type = typeFromGUID(rguid);
|
||||
|
||||
TRACE("(%d, %s, %p) type=%d\n", fd, _dump_dinput_GUID(rguid), info, type);
|
||||
|
||||
if (!info) return E_POINTER;
|
||||
|
||||
if (info->dwSize != sizeof(DIEFFECTINFOA)) return DIERR_INVALIDPARAM;
|
||||
|
||||
info->guid = *rguid;
|
||||
|
||||
info->dwEffType = type;
|
||||
/* the event device API does not support querying for all these things
|
||||
* therefore we assume that we have support for them
|
||||
* that's not as dangerous as it sounds, since drivers are allowed to
|
||||
* ignore parameters they claim to support anyway */
|
||||
info->dwEffType |= DIEFT_DEADBAND | DIEFT_FFATTACK | DIEFT_FFFADE
|
||||
| DIEFT_POSNEGCOEFFICIENTS | DIEFT_POSNEGSATURATION
|
||||
| DIEFT_SATURATION | DIEFT_STARTDELAY;
|
||||
|
||||
/* again, assume we have support for everything */
|
||||
info->dwStaticParams = DIEP_ALLPARAMS;
|
||||
info->dwDynamicParams = info->dwStaticParams;
|
||||
|
||||
/* yes, this is windows behavior (print the GUID_Name for name) */
|
||||
strcpy(info->tszName, _dump_dinput_GUID(rguid));
|
||||
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
DECLSPEC_HIDDEN HRESULT linuxinput_get_info_W(
|
||||
int fd,
|
||||
REFGUID rguid,
|
||||
|
|
|
@ -86,7 +86,6 @@ struct wine_input_absinfo {
|
|||
|
||||
/* implemented in effect_linuxinput.c */
|
||||
HRESULT linuxinput_create_effect(int* fd, REFGUID rguid, struct list *parent_list_entry, LPDIRECTINPUTEFFECT* peff);
|
||||
HRESULT linuxinput_get_info_A(int fd, REFGUID rguid, LPDIEFFECTINFOA info);
|
||||
HRESULT linuxinput_get_info_W(int fd, REFGUID rguid, LPDIEFFECTINFOW info);
|
||||
|
||||
static HRESULT WINAPI JoystickWImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags);
|
||||
|
@ -1251,21 +1250,6 @@ static HRESULT WINAPI JoystickWImpl_EnumEffects(LPDIRECTINPUTDEVICE8W iface,
|
|||
/*******************************************************************************
|
||||
* GetEffectInfo - Get information about a particular effect
|
||||
*/
|
||||
static HRESULT WINAPI JoystickAImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8A iface,
|
||||
LPDIEFFECTINFOA pdei,
|
||||
REFGUID guid)
|
||||
{
|
||||
JoystickImpl* This = impl_from_IDirectInputDevice8A(iface);
|
||||
|
||||
TRACE("(this=%p,%p,%s)\n", This, pdei, _dump_dinput_GUID(guid));
|
||||
|
||||
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
||||
return linuxinput_get_info_A(This->joyfd, guid, pdei);
|
||||
#else
|
||||
return DI_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JoystickWImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8W iface,
|
||||
LPDIEFFECTINFOW pdei,
|
||||
REFGUID guid)
|
||||
|
@ -1445,7 +1429,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
|
|||
IDirectInputDevice2AImpl_Initialize,
|
||||
IDirectInputDevice2AImpl_CreateEffect,
|
||||
JoystickAImpl_EnumEffects,
|
||||
JoystickAImpl_GetEffectInfo,
|
||||
IDirectInputDevice2AImpl_GetEffectInfo,
|
||||
IDirectInputDevice2AImpl_GetForceFeedbackState,
|
||||
IDirectInputDevice2AImpl_SendForceFeedbackCommand,
|
||||
IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
|
||||
|
|
Loading…
Reference in New Issue