Rémi Bernon : dinput: Move EnumCreatedEffectObjects checks to device.c.
Alexandre Julliard
julliard at winehq.org
Thu Oct 21 16:04:16 CDT 2021
Module: wine
Branch: master
Commit: df08662f8486726d9c4770f553a03750f53040d7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=df08662f8486726d9c4770f553a03750f53040d7
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Thu Oct 21 09:53:47 2021 +0200
dinput: Move EnumCreatedEffectObjects checks to device.c.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dinput/device.c | 18 +++++++++++++-----
dlls/dinput/device_private.h | 2 ++
dlls/dinput/joystick_hid.c | 12 +++++-------
dlls/dinput/keyboard.c | 1 +
dlls/dinput/mouse.c | 1 +
5 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index b8da627b1ea..d9b92e82271 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -1799,12 +1799,20 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand( IDirectInputDe
return hr;
}
-HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface,
- LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID lpvRef, DWORD dwFlags)
+HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects( IDirectInputDevice8W *iface,
+ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback,
+ void *context, DWORD flags )
{
- IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
- FIXME("(%p)0>(%p,%p,0x%08x): stub!\n", This, lpCallback, lpvRef, dwFlags);
- return DI_OK;
+ IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface );
+
+ TRACE( "iface %p, callback %p, context %p, flags %#x.\n", iface, callback, context, flags );
+
+ if (!callback) return DIERR_INVALIDPARAM;
+ if (flags) return DIERR_INVALIDPARAM;
+ if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) return DI_OK;
+ if (!impl->vtbl->enum_created_effect_objects) return DIERR_UNSUPPORTED;
+
+ return impl->vtbl->enum_created_effect_objects( iface, callback, context, flags );
}
HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc)
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
index b90c6bf2dcd..16d28323281 100644
--- a/dlls/dinput/device_private.h
+++ b/dlls/dinput/device_private.h
@@ -71,6 +71,8 @@ struct dinput_device_vtbl
HRESULT (*get_effect_info)( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, const GUID *guid );
HRESULT (*create_effect)( IDirectInputDevice8W *iface, IDirectInputEffect **out );
HRESULT (*send_force_feedback_command)( IDirectInputDevice8W *iface, DWORD command );
+ HRESULT (*enum_created_effect_objects)( IDirectInputDevice8W *iface, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback,
+ void *context, DWORD flags );
};
#define DEVICE_STATE_MAX_SIZE 1024
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index e9bbfa081e8..5fb4e9a2de9 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -982,18 +982,15 @@ static HRESULT hid_joystick_internal_send_force_feedback_command( IDirectInputDe
return DI_OK;
}
-static HRESULT WINAPI hid_joystick_EnumCreatedEffectObjects( IDirectInputDevice8W *iface,
- LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback,
- void *context, DWORD flags )
+static HRESULT hid_joystick_internal_enum_created_effect_objects( IDirectInputDevice8W *iface,
+ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback,
+ void *context, DWORD flags )
{
struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
struct hid_joystick_effect *effect, *next;
TRACE( "iface %p, callback %p, context %p, flags %#x.\n", iface, callback, context, flags );
- if (!callback) return DIERR_INVALIDPARAM;
- if (flags) return DIERR_INVALIDPARAM;
-
LIST_FOR_EACH_ENTRY_SAFE(effect, next, &impl->effect_list, struct hid_joystick_effect, entry)
if (callback( &effect->IDirectInputEffect_iface, context ) != DIENUM_CONTINUE) break;
@@ -1028,7 +1025,7 @@ static const IDirectInputDevice8WVtbl hid_joystick_vtbl =
IDirectInputDevice2WImpl_GetEffectInfo,
IDirectInputDevice2WImpl_GetForceFeedbackState,
IDirectInputDevice2WImpl_SendForceFeedbackCommand,
- hid_joystick_EnumCreatedEffectObjects,
+ IDirectInputDevice2WImpl_EnumCreatedEffectObjects,
IDirectInputDevice2WImpl_Escape,
IDirectInputDevice2WImpl_Poll,
IDirectInputDevice2WImpl_SendDeviceData,
@@ -1269,6 +1266,7 @@ static const struct dinput_device_vtbl hid_joystick_internal_vtbl =
hid_joystick_internal_get_effect_info,
hid_joystick_internal_create_effect,
hid_joystick_internal_send_force_feedback_command,
+ hid_joystick_internal_enum_created_effect_objects,
};
static DWORD device_type_for_version( DWORD type, DWORD version )
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index a04b59e9c0c..fb6cf33b911 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -341,6 +341,7 @@ static const struct dinput_device_vtbl keyboard_internal_vtbl =
NULL,
NULL,
NULL,
+ NULL,
};
static const IDirectInputDevice8WVtbl SysKeyboardWvt =
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index faf093489cf..1b91fa12189 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -654,6 +654,7 @@ static const struct dinput_device_vtbl mouse_internal_vtbl =
NULL,
NULL,
NULL,
+ NULL,
};
static const IDirectInputDevice8WVtbl SysMouseWvt =
More information about the wine-cvs
mailing list