Rémi Bernon : dinput: Implement IDirectInputDevice_GetEffectInfo WtoA conversion.
Alexandre Julliard
julliard at winehq.org
Wed May 26 15:46:27 CDT 2021
Module: wine
Branch: master
Commit: 70b25ccfaae48172278800f660fd92e40735ec69
URL: https://source.winehq.org/git/wine.git/?a=commit;h=70b25ccfaae48172278800f660fd92e40735ec69
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Wed May 26 11:23:05 2021 +0200
dinput: Implement IDirectInputDevice_GetEffectInfo WtoA conversion.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dinput/ansi.c | 25 +++++++++++++++++++++++++
dlls/dinput/device.c | 10 ----------
dlls/dinput/effect_linuxinput.c | 34 ----------------------------------
dlls/dinput/joystick_linuxinput.c | 18 +-----------------
4 files changed, 26 insertions(+), 61 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c
index eafbeafbf18..36b17812f32 100644
--- a/dlls/dinput/ansi.c
+++ b/dlls/dinput/ansi.c
@@ -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 );
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 16bf4c663a1..850a4a09c37 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -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,
diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c
index ec4b00b873a..486163aeffa 100644
--- a/dlls/dinput/effect_linuxinput.c
+++ b/dlls/dinput/effect_linuxinput.c
@@ -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,
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 49eaf3ed44d..dc7f5491c81 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -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,
More information about the wine-cvs
mailing list