From dac2e0b18779f8713681b88929a415eb7b5d2a19 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Bernon?= Date: Wed, 27 Oct 2021 09:40:59 +0200 Subject: [PATCH] dinput: Rename IDirectInputDeviceImpl to struct dinput_device. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/dinput/ansi.c | 72 ++++++------ dlls/dinput/device.c | 258 +++++++++++++++++++++---------------------- dlls/dinput/device_private.h | 11 +- dlls/dinput/dinput_main.c | 124 ++++++++++----------- dlls/dinput/dinput_private.h | 6 +- dlls/dinput/joystick_hid.c | 12 +- dlls/dinput/keyboard.c | 10 +- dlls/dinput/mouse.c | 9 +- 8 files changed, 244 insertions(+), 258 deletions(-) diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index 3d2d82b0f36..3c7b6ced169 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -33,12 +33,12 @@ #include "wine/debug.h" -static IDirectInputDeviceImpl *impl_from_IDirectInputDevice8A( IDirectInputDevice8A *iface ) +static struct dinput_device *impl_from_IDirectInputDevice8A( IDirectInputDevice8A *iface ) { - return CONTAINING_RECORD( iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface ); + return CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8A_iface ); } -static IDirectInputDevice8W *IDirectInputDevice8W_from_impl( IDirectInputDeviceImpl *impl ) +static IDirectInputDevice8W *IDirectInputDevice8W_from_impl( struct dinput_device *impl ) { return &impl->IDirectInputDevice8W_iface; } @@ -46,7 +46,7 @@ static IDirectInputDevice8W *IDirectInputDevice8W_from_impl( IDirectInputDeviceI static inline IDirectInputDevice8A *IDirectInputDevice8A_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) { if (!iface) return NULL; - return &CONTAINING_RECORD( iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface )->IDirectInputDevice8A_iface; + return &CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface )->IDirectInputDevice8A_iface; } static inline IDirectInputDeviceA *IDirectInputDeviceA_from_IDirectInputDeviceW( IDirectInputDeviceW *iface ) @@ -269,28 +269,28 @@ static HRESULT diconfiguredevicesparams_atow( const DICONFIGUREDEVICESPARAMSA *i static HRESULT WINAPI dinput_device_a_QueryInterface( IDirectInputDevice8A *iface_a, REFIID iid, void **out ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_QueryInterface( iface_w, iid, out ); } static ULONG WINAPI dinput_device_a_AddRef( IDirectInputDevice8A *iface_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_AddRef( iface_w ); } static ULONG WINAPI dinput_device_a_Release( IDirectInputDevice8A *iface_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Release( iface_w ); } static HRESULT WINAPI dinput_device_a_GetCapabilities( IDirectInputDevice8A *iface_a, DIDEVCAPS *caps ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_GetCapabilities( iface_w, caps ); } @@ -314,7 +314,7 @@ static HRESULT WINAPI dinput_device_a_EnumObjects( IDirectInputDevice8A *iface_a void *ref, DWORD flags ) { struct enum_objects_wtoa_params params = {callback, ref}; - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); if (!callback) return DIERR_INVALIDPARAM; @@ -324,35 +324,35 @@ static HRESULT WINAPI dinput_device_a_EnumObjects( IDirectInputDevice8A *iface_a static HRESULT WINAPI dinput_device_a_GetProperty( IDirectInputDevice8A *iface_a, REFGUID guid, DIPROPHEADER *header ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_GetProperty( iface_w, guid, header ); } static HRESULT WINAPI dinput_device_a_SetProperty( IDirectInputDevice8A *iface_a, REFGUID guid, const DIPROPHEADER *header ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SetProperty( iface_w, guid, header ); } static HRESULT WINAPI dinput_device_a_Acquire( IDirectInputDevice8A *iface_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Acquire( iface_w ); } static HRESULT WINAPI dinput_device_a_Unacquire( IDirectInputDevice8A *iface_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Unacquire( iface_w ); } static HRESULT WINAPI dinput_device_a_GetDeviceState( IDirectInputDevice8A *iface_a, DWORD count, void *data ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_GetDeviceState( iface_w, count, data ); } @@ -360,28 +360,28 @@ static HRESULT WINAPI dinput_device_a_GetDeviceState( IDirectInputDevice8A *ifac static HRESULT WINAPI dinput_device_a_GetDeviceData( IDirectInputDevice8A *iface_a, DWORD data_size, DIDEVICEOBJECTDATA *data, DWORD *entries, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_GetDeviceData( iface_w, data_size, data, entries, flags ); } static HRESULT WINAPI dinput_device_a_SetDataFormat( IDirectInputDevice8A *iface_a, const DIDATAFORMAT *format ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SetDataFormat( iface_w, format ); } static HRESULT WINAPI dinput_device_a_SetEventNotification( IDirectInputDevice8A *iface_a, HANDLE event ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SetEventNotification( iface_w, event ); } static HRESULT WINAPI dinput_device_a_SetCooperativeLevel( IDirectInputDevice8A *iface_a, HWND window, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SetCooperativeLevel( iface_w, window, flags ); } @@ -389,7 +389,7 @@ static HRESULT WINAPI dinput_device_a_SetCooperativeLevel( IDirectInputDevice8A static HRESULT WINAPI dinput_device_a_GetObjectInfo( IDirectInputDevice8A *iface_a, DIDEVICEOBJECTINSTANCEA *instance_a, DWORD obj, DWORD how ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIDEVICEOBJECTINSTANCEW instance_w = {sizeof(instance_w)}; HRESULT hr; @@ -407,7 +407,7 @@ static HRESULT WINAPI dinput_device_a_GetObjectInfo( IDirectInputDevice8A *iface static HRESULT WINAPI dinput_device_a_GetDeviceInfo( IDirectInputDevice8A *iface_a, DIDEVICEINSTANCEA *instance_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIDEVICEINSTANCEW instance_w = {sizeof(instance_w)}; HRESULT hr; @@ -424,14 +424,14 @@ static HRESULT WINAPI dinput_device_a_GetDeviceInfo( IDirectInputDevice8A *iface static HRESULT WINAPI dinput_device_a_RunControlPanel( IDirectInputDevice8A *iface_a, HWND owner, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_RunControlPanel( iface_w, owner, flags ); } static HRESULT WINAPI dinput_device_a_Initialize( IDirectInputDevice8A *iface_a, HINSTANCE instance, DWORD version, REFGUID guid ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Initialize( iface_w, instance, version, guid ); } @@ -439,7 +439,7 @@ static HRESULT WINAPI dinput_device_a_Initialize( IDirectInputDevice8A *iface_a, static HRESULT WINAPI dinput_device_a_CreateEffect( IDirectInputDevice8A *iface_a, REFGUID guid, const DIEFFECT *effect, IDirectInputEffect **out, IUnknown *outer ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_CreateEffect( iface_w, guid, effect, out, outer ); } @@ -463,7 +463,7 @@ static HRESULT WINAPI dinput_device_a_EnumEffects( IDirectInputDevice8A *iface_a void *ref, DWORD type ) { struct enum_effects_wtoa_params params = {callback, ref}; - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); if (!callback) return DIERR_INVALIDPARAM; @@ -473,7 +473,7 @@ static HRESULT WINAPI dinput_device_a_EnumEffects( IDirectInputDevice8A *iface_a static HRESULT WINAPI dinput_device_a_GetEffectInfo( IDirectInputDevice8A *iface_a, DIEFFECTINFOA *info_a, REFGUID guid ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIEFFECTINFOW info_w = {sizeof(info_w)}; HRESULT hr; @@ -489,14 +489,14 @@ static HRESULT WINAPI dinput_device_a_GetEffectInfo( IDirectInputDevice8A *iface static HRESULT WINAPI dinput_device_a_GetForceFeedbackState( IDirectInputDevice8A *iface_a, DWORD *state ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_GetForceFeedbackState( iface_w, state ); } static HRESULT WINAPI dinput_device_a_SendForceFeedbackCommand( IDirectInputDevice8A *iface_a, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SendForceFeedbackCommand( iface_w, flags ); } @@ -504,21 +504,21 @@ static HRESULT WINAPI dinput_device_a_SendForceFeedbackCommand( IDirectInputDevi static HRESULT WINAPI dinput_device_a_EnumCreatedEffectObjects( IDirectInputDevice8A *iface_a, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, void *ref, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_EnumCreatedEffectObjects( iface_w, callback, ref, flags ); } static HRESULT WINAPI dinput_device_a_Escape( IDirectInputDevice8A *iface_a, DIEFFESCAPE *escape ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Escape( iface_w, escape ); } static HRESULT WINAPI dinput_device_a_Poll( IDirectInputDevice8A *iface_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Poll( iface_w ); } @@ -526,7 +526,7 @@ static HRESULT WINAPI dinput_device_a_Poll( IDirectInputDevice8A *iface_a ) static HRESULT WINAPI dinput_device_a_SendDeviceData( IDirectInputDevice8A *iface_a, DWORD count, const DIDEVICEOBJECTDATA *data, DWORD *inout, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SendDeviceData( iface_w, count, data, inout, flags ); } @@ -534,7 +534,7 @@ static HRESULT WINAPI dinput_device_a_SendDeviceData( IDirectInputDevice8A *ifac static HRESULT WINAPI dinput_device_a_EnumEffectsInFile( IDirectInputDevice8A *iface_a, const char *filename_a, LPDIENUMEFFECTSINFILECALLBACK callback, void *ref, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); WCHAR buffer[MAX_PATH], *filename_w = buffer; @@ -547,7 +547,7 @@ static HRESULT WINAPI dinput_device_a_EnumEffectsInFile( IDirectInputDevice8A *i static HRESULT WINAPI dinput_device_a_WriteEffectToFile( IDirectInputDevice8A *iface_a, const char *filename_a, DWORD entries, DIFILEEFFECT *file_effect, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); WCHAR buffer[MAX_PATH], *filename_w = buffer; @@ -560,7 +560,7 @@ static HRESULT WINAPI dinput_device_a_WriteEffectToFile( IDirectInputDevice8A *i static HRESULT WINAPI dinput_device_a_BuildActionMap( IDirectInputDevice8A *iface_a, DIACTIONFORMATA *format_a, const char *username_a, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIACTIONFORMATW format_w = {sizeof(format_w), sizeof(DIACTIONW)}; HRESULT hr; @@ -589,7 +589,7 @@ static HRESULT WINAPI dinput_device_a_BuildActionMap( IDirectInputDevice8A *ifac static HRESULT WINAPI dinput_device_a_SetActionMap( IDirectInputDevice8A *iface_a, DIACTIONFORMATA *format_a, const char *username_a, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIACTIONFORMATW format_w = {sizeof(format_w), sizeof(DIACTIONW)}; HRESULT hr; @@ -617,7 +617,7 @@ static HRESULT WINAPI dinput_device_a_SetActionMap( IDirectInputDevice8A *iface_ static HRESULT WINAPI dinput_device_a_GetImageInfo( IDirectInputDevice8A *iface_a, DIDEVICEIMAGEINFOHEADERA *header_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIDEVICEIMAGEINFOHEADERW header_w = {sizeof(header_w), sizeof(DIDEVICEIMAGEINFOW)}; HRESULT hr; diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 679f907f2de..040a97eb06b 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -53,16 +53,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); */ DEFINE_GUID( dinput_pidvid_guid, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 'P', 'I', 'D', 'V', 'I', 'D' ); -static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) +static inline struct dinput_device *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) { - return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface); + return CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ); } -static inline IDirectInputDevice8A *IDirectInputDevice8A_from_impl(IDirectInputDeviceImpl *This) +static inline IDirectInputDevice8A *IDirectInputDevice8A_from_impl( struct dinput_device *This ) { return &This->IDirectInputDevice8A_iface; } -static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This) +static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl( struct dinput_device *This ) { return &This->IDirectInputDevice8W_iface; } @@ -636,7 +636,7 @@ static int id_to_offset(const DataFormat *df, int id) return obj >= 0 && df->offsets ? df->offsets[obj] : -1; } -static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic) +static DWORD semantic_to_obj_id( struct dinput_device *This, DWORD dwSemantic ) { DWORD type = (0x0000ff00 & dwSemantic) >> 8; BOOL byofs = (dwSemantic & 0x80000000) != 0; @@ -730,7 +730,7 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM return DI_OK; } -static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username) +static BOOL load_mapping_settings( struct dinput_device *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username ) { HKEY hkey; WCHAR *guid_str; @@ -774,7 +774,7 @@ static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMAT return mapped > 0; } -static BOOL set_app_data(IDirectInputDeviceImpl *dev, int offset, UINT_PTR app_data) +static BOOL set_app_data( struct dinput_device *dev, int offset, UINT_PTR app_data ) { int num_actions = dev->num_actions; ActionMap *action_map = dev->action_map, *target_map = NULL; @@ -821,7 +821,7 @@ static BOOL set_app_data(IDirectInputDeviceImpl *dev, int offset, UINT_PTR app_d void queue_event( IDirectInputDevice8W *iface, int inst_id, DWORD data, DWORD time, DWORD seq ) { static ULONGLONG notify_ms = 0; - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); int next_pos, ofs = id_to_offset(&This->data_format, inst_id); ULONGLONG time_ms = GetTickCount64(); @@ -873,9 +873,9 @@ void queue_event( IDirectInputDevice8W *iface, int inst_id, DWORD data, DWORD ti * Acquire */ -static HRESULT WINAPI IDirectInputDevice2WImpl_Acquire( IDirectInputDevice8W *iface ) +static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr = DI_OK; TRACE( "iface %p.\n", iface ); @@ -905,9 +905,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_Acquire( IDirectInputDevice8W *if * Unacquire */ -static HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire( IDirectInputDevice8W *iface ) +static HRESULT WINAPI dinput_device_Unacquire( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr = DI_OK; TRACE( "iface %p.\n", iface ); @@ -929,9 +929,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire( IDirectInputDevice8W * * IDirectInputDeviceA */ -static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice8W *iface, const DIDATAFORMAT *format ) +static HRESULT WINAPI dinput_device_SetDataFormat( IDirectInputDevice8W *iface, const DIDATAFORMAT *format ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); HRESULT res = DI_OK; TRACE( "iface %p, format %p.\n", iface, format ); @@ -961,10 +961,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice * * Set cooperative level and the source window for the events. */ -static HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel( IDirectInputDevice8W *iface, - HWND hwnd, DWORD flags ) +static HRESULT WINAPI dinput_device_SetCooperativeLevel( IDirectInputDevice8W *iface, HWND hwnd, DWORD flags ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); HRESULT hr; TRACE( "iface %p, hwnd %p, flags %#x.\n", iface, hwnd, flags ); @@ -1003,9 +1002,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel( IDirectInput return hr; } -static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo( IDirectInputDevice8W *iface, DIDEVICEINSTANCEW *instance ) +static HRESULT WINAPI dinput_device_GetDeviceInfo( IDirectInputDevice8W *iface, DIDEVICEINSTANCEW *instance ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DWORD size; TRACE( "iface %p, instance %p.\n", iface, instance ); @@ -1025,9 +1024,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo( IDirectInputDevice /****************************************************************************** * SetEventNotification : specifies event to be sent on state change */ -static HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification( IDirectInputDevice8W *iface, HANDLE event ) +static HRESULT WINAPI dinput_device_SetEventNotification( IDirectInputDevice8W *iface, HANDLE event ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); TRACE( "iface %p, event %p.\n", iface, event ); @@ -1037,9 +1036,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification( IDirectInpu return DI_OK; } -void direct_input_device_destroy( IDirectInputDevice8W *iface ) +void dinput_device_destroy( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); TRACE( "iface %p.\n", iface ); @@ -1064,9 +1063,9 @@ void direct_input_device_destroy( IDirectInputDevice8W *iface ) free( This ); } -static ULONG WINAPI IDirectInputDevice2WImpl_Release( IDirectInputDevice8W *iface ) +static ULONG WINAPI dinput_device_Release( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); ULONG ref = InterlockedDecrement( &impl->ref ); TRACE( "iface %p, ref %u.\n", iface, ref ); @@ -1074,15 +1073,15 @@ static ULONG WINAPI IDirectInputDevice2WImpl_Release( IDirectInputDevice8W *ifac if (!ref) { if (impl->vtbl->release) impl->vtbl->release( iface ); - else direct_input_device_destroy( iface ); + else dinput_device_destroy( iface ); } return ref; } -static HRESULT WINAPI IDirectInputDevice2WImpl_GetCapabilities( IDirectInputDevice8W *iface, DIDEVCAPS *caps ) +static HRESULT WINAPI dinput_device_GetCapabilities( IDirectInputDevice8W *iface, DIDEVCAPS *caps ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DWORD size; TRACE( "iface %p, caps %p.\n", iface, caps ); @@ -1099,10 +1098,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetCapabilities( IDirectInputDevi return DI_OK; } -static HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface( IDirectInputDevice8W *iface, - const GUID *iid, void **out ) +static HRESULT WINAPI dinput_device_QueryInterface( IDirectInputDevice8W *iface, const GUID *iid, void **out ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out ); @@ -1131,17 +1129,17 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface( IDirectInputDevic return E_NOINTERFACE; } -static ULONG WINAPI IDirectInputDevice2WImpl_AddRef( IDirectInputDevice8W *iface ) +static ULONG WINAPI dinput_device_AddRef( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); ULONG ref = InterlockedIncrement( &impl->ref ); TRACE( "iface %p, ref %u.\n", iface, ref ); return ref; } -static HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( IDirectInputDevice8W *iface, - LPDIENUMDEVICEOBJECTSCALLBACKW callback, - void *context, DWORD flags ) +static HRESULT WINAPI dinput_device_EnumObjects( IDirectInputDevice8W *iface, + LPDIENUMDEVICEOBJECTSCALLBACKW callback, + void *context, DWORD flags ) { static const DIPROPHEADER filter = { @@ -1149,7 +1147,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( IDirectInputDevice8W .dwHeaderSize = sizeof(filter), .dwHow = DIPH_DEVICE, }; - struct IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr; TRACE( "iface %p, callback %p, context %p, flags %#x.\n", iface, callback, context, flags ); @@ -1186,7 +1184,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( IDirectInputDevice8W return DI_OK; } -static HRESULT enum_object_filter_init( IDirectInputDeviceImpl *impl, DIPROPHEADER *filter ) +static HRESULT enum_object_filter_init( struct dinput_device *impl, DIPROPHEADER *filter ) { DIDATAFORMAT *format = impl->data_format.wine_df; int i, *offsets = impl->data_format.offsets; @@ -1210,10 +1208,9 @@ static BOOL CALLBACK find_object( const DIDEVICEOBJECTINSTANCEW *instance, void return DIENUM_STOP; } -static HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty( IDirectInputDevice8W *iface, - const GUID *guid, DIPROPHEADER *header ) +static HRESULT WINAPI dinput_device_GetProperty( IDirectInputDevice8W *iface, const GUID *guid, DIPROPHEADER *header ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DWORD object_mask = DIDFT_AXIS | DIDFT_BUTTON | DIDFT_POV; DIDEVICEOBJECTINSTANCEW instance; DIPROPHEADER filter; @@ -1329,16 +1326,16 @@ struct set_object_property_params static BOOL CALLBACK set_object_property( const DIDEVICEOBJECTINSTANCEW *instance, void *context ) { struct set_object_property_params *params = context; - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( params->iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( params->iface ); impl->vtbl->set_property( params->iface, params->property, params->header, instance ); return DIENUM_CONTINUE; } -static HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty( IDirectInputDevice8W *iface, - const GUID *guid, const DIPROPHEADER *header ) +static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, const GUID *guid, + const DIPROPHEADER *header ) { struct set_object_property_params params = {.iface = iface, .header = header, .property = LOWORD( guid )}; - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIPROPHEADER filter; HRESULT hr; @@ -1462,7 +1459,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty( IDirectInputDevice8W return DI_OK; } -static void dinput_device_set_username( IDirectInputDeviceImpl *impl, const DIPROPSTRING *value ) +static void dinput_device_set_username( struct dinput_device *impl, const DIPROPSTRING *value ) { struct DevicePlayer *device_player; BOOL found = FALSE; @@ -1495,11 +1492,10 @@ static BOOL CALLBACK get_object_info( const DIDEVICEOBJECTINSTANCEW *instance, v return DIENUM_STOP; } -static HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo( IDirectInputDevice8W *iface, - DIDEVICEOBJECTINSTANCEW *instance, - DWORD obj, DWORD how ) +static HRESULT WINAPI dinput_device_GetObjectInfo( IDirectInputDevice8W *iface, + DIDEVICEOBJECTINSTANCEW *instance, DWORD obj, DWORD how ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIPROPHEADER filter = { .dwSize = sizeof(filter), @@ -1529,9 +1525,9 @@ static BOOL CALLBACK reset_axis_data( const DIDEVICEOBJECTINSTANCEW *instance, v return DIENUM_CONTINUE; } -static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceState( IDirectInputDevice8W *iface, DWORD size, void *data ) +static HRESULT WINAPI dinput_device_GetDeviceState( IDirectInputDevice8W *iface, DWORD size, void *data ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIPROPHEADER filter = { .dwSize = sizeof(filter), @@ -1564,10 +1560,10 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceState( IDirectInputDevic return hr; } -static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice8W *iface, DWORD size, - DIDEVICEOBJECTDATA *data, DWORD *count, DWORD flags ) +static HRESULT WINAPI dinput_device_GetDeviceData( IDirectInputDevice8W *iface, DWORD size, DIDEVICEOBJECTDATA *data, + DWORD *count, DWORD flags ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); HRESULT ret = DI_OK; int len; @@ -1618,25 +1614,25 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice return ret; } -static HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel( IDirectInputDevice8W *iface, HWND hwnd, DWORD flags ) +static HRESULT WINAPI dinput_device_RunControlPanel( IDirectInputDevice8W *iface, HWND hwnd, DWORD flags ) { FIXME( "iface %p, hwnd %p, flags %#x stub!\n", iface, hwnd, flags ); return DI_OK; } -static HRESULT WINAPI IDirectInputDevice2WImpl_Initialize( IDirectInputDevice8W *iface, HINSTANCE instance, - DWORD version, const GUID *guid ) +static HRESULT WINAPI dinput_device_Initialize( IDirectInputDevice8W *iface, HINSTANCE instance, + DWORD version, const GUID *guid ) { FIXME( "iface %p, instance %p, version %#x, guid %s stub!\n", iface, instance, version, debugstr_guid( guid ) ); return DI_OK; } -static HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect( IDirectInputDevice8W *iface, - const GUID *guid, const DIEFFECT *params, - IDirectInputEffect **out, IUnknown *outer ) +static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, const GUID *guid, + const DIEFFECT *params, IDirectInputEffect **out, + IUnknown *outer ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DWORD flags = DIEP_ALLPARAMS; HRESULT hr; @@ -1665,9 +1661,8 @@ failed: return hr; } -static HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( IDirectInputDevice8W *iface, - LPDIENUMEFFECTSCALLBACKW callback, - void *context, DWORD type ) +static HRESULT WINAPI dinput_device_EnumEffects( IDirectInputDevice8W *iface, LPDIENUMEFFECTSCALLBACKW callback, + void *context, DWORD type ) { DIEFFECTINFOW info = {.dwSize = sizeof(info)}; HRESULT hr; @@ -1737,10 +1732,10 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( IDirectInputDevice8W return DI_OK; } -static HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo( IDirectInputDevice8W *iface, - DIEFFECTINFOW *info, const GUID *guid ) +static HRESULT WINAPI dinput_device_GetEffectInfo( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, + const GUID *guid ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); TRACE( "iface %p, info %p, guid %s.\n", iface, info, debugstr_guid( guid ) ); @@ -1751,16 +1746,16 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo( IDirectInputDevice return impl->vtbl->get_effect_info( iface, info, guid ); } -static HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState( IDirectInputDevice8W *iface, DWORD *out ) +static HRESULT WINAPI dinput_device_GetForceFeedbackState( IDirectInputDevice8W *iface, DWORD *out ) { FIXME( "iface %p, out %p stub!\n", iface, out ); if (!out) return E_POINTER; return DIERR_UNSUPPORTED; } -static HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand( IDirectInputDevice8W *iface, DWORD command ) +static HRESULT WINAPI dinput_device_SendForceFeedbackCommand( IDirectInputDevice8W *iface, DWORD command ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr; TRACE( "iface %p, flags %x.\n", iface, command ); @@ -1787,11 +1782,11 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand( IDirect return hr; } -static HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects( IDirectInputDevice8W *iface, - LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, - void *context, DWORD flags ) +static HRESULT WINAPI dinput_device_EnumCreatedEffectObjects( IDirectInputDevice8W *iface, + LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, + void *context, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); TRACE( "iface %p, callback %p, context %p, flags %#x.\n", iface, callback, context, flags ); @@ -1803,15 +1798,15 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects( IDirect return impl->vtbl->enum_created_effect_objects( iface, callback, context, flags ); } -static HRESULT WINAPI IDirectInputDevice2WImpl_Escape( IDirectInputDevice8W *iface, DIEFFESCAPE *escape ) +static HRESULT WINAPI dinput_device_Escape( IDirectInputDevice8W *iface, DIEFFESCAPE *escape ) { FIXME( "iface %p, escape %p stub!\n", iface, escape ); return DI_OK; } -static HRESULT WINAPI IDirectInputDevice2WImpl_Poll( IDirectInputDevice8W *iface ) +static HRESULT WINAPI dinput_device_Poll( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr = DI_NOEFFECT; EnterCriticalSection( &impl->crit ); @@ -1823,38 +1818,34 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_Poll( IDirectInputDevice8W *iface return DI_OK; } -static HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData( IDirectInputDevice8W *iface, DWORD size, - const DIDEVICEOBJECTDATA *data, - DWORD *count, DWORD flags ) +static HRESULT WINAPI dinput_device_SendDeviceData( IDirectInputDevice8W *iface, DWORD size, + const DIDEVICEOBJECTDATA *data, DWORD *count, DWORD flags ) { FIXME( "iface %p, size %u, data %p, count %p, flags %#x stub!\n", iface, size, data, count, flags ); return DI_OK; } -static HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile( IDirectInputDevice8W *iface, - const WCHAR *filename, - LPDIENUMEFFECTSINFILECALLBACK callback, - void *context, DWORD flags ) +static HRESULT WINAPI dinput_device_EnumEffectsInFile( IDirectInputDevice8W *iface, const WCHAR *filename, + LPDIENUMEFFECTSINFILECALLBACK callback, + void *context, DWORD flags ) { FIXME( "iface %p, filename %s, callback %p, context %p, flags %#x stub!\n", iface, debugstr_w(filename), callback, context, flags ); return DI_OK; } -static HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile( IDirectInputDevice8W *iface, - const WCHAR *filename, DWORD count, - DIFILEEFFECT *effects, DWORD flags ) +static HRESULT WINAPI dinput_device_WriteEffectToFile( IDirectInputDevice8W *iface, const WCHAR *filename, + DWORD count, DIFILEEFFECT *effects, DWORD flags ) { FIXME( "iface %p, filename %s, count %u, effects %p, flags %#x stub!\n", iface, debugstr_w(filename), count, effects, flags ); return DI_OK; } -static HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap( IDirectInputDevice8W *iface, - DIACTIONFORMATW *format, - const WCHAR *username, DWORD flags ) +static HRESULT WINAPI dinput_device_BuildActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format, + const WCHAR *username, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); BOOL load_success = FALSE, has_actions = FALSE; DWORD genre, username_len = MAX_PATH; WCHAR username_buf[MAX_PATH]; @@ -1938,10 +1929,10 @@ static HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap( IDirectInputDevic return DI_OK; } -static HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format, - const WCHAR *username, DWORD flags ) +static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format, + const WCHAR *username, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIDATAFORMAT data_format; DIOBJECTDATAFORMAT *obj_df = NULL; DIPROPDWORD dp; @@ -2061,8 +2052,7 @@ static HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap( IDirectInputDevice8 return DI_OK; } -static HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo( IDirectInputDevice8W *iface, - DIDEVICEIMAGEINFOHEADERW *header ) +static HRESULT WINAPI dinput_device_GetImageInfo( IDirectInputDevice8W *iface, DIDEVICEIMAGEINFOHEADERW *header ) { FIXME( "iface %p, header %p stub!\n", iface, header ); return DI_OK; @@ -2072,48 +2062,48 @@ extern const IDirectInputDevice8AVtbl dinput_device_a_vtbl; static const IDirectInputDevice8WVtbl dinput_device_w_vtbl = { /*** IUnknown methods ***/ - IDirectInputDevice2WImpl_QueryInterface, - IDirectInputDevice2WImpl_AddRef, - IDirectInputDevice2WImpl_Release, + dinput_device_QueryInterface, + dinput_device_AddRef, + dinput_device_Release, /*** IDirectInputDevice methods ***/ - IDirectInputDevice2WImpl_GetCapabilities, - IDirectInputDevice2WImpl_EnumObjects, - IDirectInputDevice2WImpl_GetProperty, - IDirectInputDevice2WImpl_SetProperty, - IDirectInputDevice2WImpl_Acquire, - IDirectInputDevice2WImpl_Unacquire, - IDirectInputDevice2WImpl_GetDeviceState, - IDirectInputDevice2WImpl_GetDeviceData, - IDirectInputDevice2WImpl_SetDataFormat, - IDirectInputDevice2WImpl_SetEventNotification, - IDirectInputDevice2WImpl_SetCooperativeLevel, - IDirectInputDevice2WImpl_GetObjectInfo, - IDirectInputDevice2WImpl_GetDeviceInfo, - IDirectInputDevice2WImpl_RunControlPanel, - IDirectInputDevice2WImpl_Initialize, + dinput_device_GetCapabilities, + dinput_device_EnumObjects, + dinput_device_GetProperty, + dinput_device_SetProperty, + dinput_device_Acquire, + dinput_device_Unacquire, + dinput_device_GetDeviceState, + dinput_device_GetDeviceData, + dinput_device_SetDataFormat, + dinput_device_SetEventNotification, + dinput_device_SetCooperativeLevel, + dinput_device_GetObjectInfo, + dinput_device_GetDeviceInfo, + dinput_device_RunControlPanel, + dinput_device_Initialize, /*** IDirectInputDevice2 methods ***/ - IDirectInputDevice2WImpl_CreateEffect, - IDirectInputDevice2WImpl_EnumEffects, - IDirectInputDevice2WImpl_GetEffectInfo, - IDirectInputDevice2WImpl_GetForceFeedbackState, - IDirectInputDevice2WImpl_SendForceFeedbackCommand, - IDirectInputDevice2WImpl_EnumCreatedEffectObjects, - IDirectInputDevice2WImpl_Escape, - IDirectInputDevice2WImpl_Poll, - IDirectInputDevice2WImpl_SendDeviceData, + dinput_device_CreateEffect, + dinput_device_EnumEffects, + dinput_device_GetEffectInfo, + dinput_device_GetForceFeedbackState, + dinput_device_SendForceFeedbackCommand, + dinput_device_EnumCreatedEffectObjects, + dinput_device_Escape, + dinput_device_Poll, + dinput_device_SendDeviceData, /*** IDirectInputDevice7 methods ***/ - IDirectInputDevice7WImpl_EnumEffectsInFile, - IDirectInputDevice7WImpl_WriteEffectToFile, + dinput_device_EnumEffectsInFile, + dinput_device_WriteEffectToFile, /*** IDirectInputDevice8 methods ***/ - IDirectInputDevice8WImpl_BuildActionMap, - IDirectInputDevice8WImpl_SetActionMap, - IDirectInputDevice8WImpl_GetImageInfo, + dinput_device_BuildActionMap, + dinput_device_SetActionMap, + dinput_device_GetImageInfo, }; -HRESULT direct_input_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, +HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid, IDirectInputImpl *dinput, void **out ) { - IDirectInputDeviceImpl *This; + struct dinput_device *This; DIDATAFORMAT *format; if (!(This = calloc( 1, size ))) return DIERR_OUTOFMEMORY; @@ -2157,7 +2147,7 @@ static const GUID *object_instance_guid( const DIDEVICEOBJECTINSTANCEW *instance static BOOL CALLBACK enum_objects_init( const DIDEVICEOBJECTINSTANCEW *instance, void *data ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( data ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( data ); DIDATAFORMAT *format = impl->data_format.wine_df; DIOBJECTDATAFORMAT *obj_format; @@ -2188,9 +2178,9 @@ static BOOL CALLBACK enum_objects_init( const DIDEVICEOBJECTINSTANCEW *instance, return DIENUM_CONTINUE; } -HRESULT direct_input_device_init( IDirectInputDevice8W *iface ) +HRESULT dinput_device_init( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIDATAFORMAT *format = impl->data_format.wine_df; ULONG size; diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 49819c95096..7ee0ef312c0 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -76,8 +76,7 @@ struct dinput_device_vtbl #define DEVICE_STATE_MAX_SIZE 1024 /* Device implementation */ -typedef struct IDirectInputDeviceImpl IDirectInputDeviceImpl; -struct IDirectInputDeviceImpl +struct dinput_device { IDirectInputDevice8W IDirectInputDevice8W_iface; IDirectInputDevice8A IDirectInputDevice8A_iface; @@ -117,10 +116,10 @@ struct IDirectInputDeviceImpl BYTE device_state[DEVICE_STATE_MAX_SIZE]; }; -extern HRESULT direct_input_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, - const GUID *guid, IDirectInputImpl *dinput, void **out ) DECLSPEC_HIDDEN; -extern HRESULT direct_input_device_init( IDirectInputDevice8W *iface ); -extern void direct_input_device_destroy( IDirectInputDevice8W *iface ); +extern HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid, + IDirectInputImpl *dinput, void **out ) DECLSPEC_HIDDEN; +extern HRESULT dinput_device_init( IDirectInputDevice8W *iface ); +extern void dinput_device_destroy( IDirectInputDevice8W *iface ); extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN; extern DWORD get_config_key( HKEY, HKEY, const WCHAR *, WCHAR *, DWORD ) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index bc033a1baca..3286e887662 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -69,9 +69,9 @@ static inline IDirectInputImpl *impl_from_IDirectInput8W( IDirectInput8W *iface return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInput8W_iface ); } -static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) +static inline struct dinput_device *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) { - return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface); + return CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ); } HINSTANCE DINPUT_instance; @@ -89,32 +89,32 @@ static struct list acquired_device_list = LIST_INIT( acquired_device_list ); static HRESULT initialize_directinput_instance(IDirectInputImpl *This, DWORD dwVersion); static void uninitialize_directinput_instance(IDirectInputImpl *This); -void dinput_hooks_acquire_device(LPDIRECTINPUTDEVICE8W iface) +void dinput_hooks_acquire_device( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *dev = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); EnterCriticalSection( &dinput_hook_crit ); - if (IsEqualGUID( &dev->guid, &GUID_SysMouse )) - list_add_tail( dev->use_raw_input ? &acquired_rawmouse_list : &acquired_mouse_list, &dev->entry ); - else if (IsEqualGUID( &dev->guid, &GUID_SysKeyboard )) - list_add_tail( &acquired_keyboard_list, &dev->entry ); + if (IsEqualGUID( &impl->guid, &GUID_SysMouse )) + list_add_tail( impl->use_raw_input ? &acquired_rawmouse_list : &acquired_mouse_list, &impl->entry ); + else if (IsEqualGUID( &impl->guid, &GUID_SysKeyboard )) + list_add_tail( &acquired_keyboard_list, &impl->entry ); else - list_add_tail( &acquired_device_list, &dev->entry ); + list_add_tail( &acquired_device_list, &impl->entry ); LeaveCriticalSection( &dinput_hook_crit ); } -void dinput_hooks_unacquire_device(LPDIRECTINPUTDEVICE8W iface) +void dinput_hooks_unacquire_device( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *dev = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); EnterCriticalSection( &dinput_hook_crit ); - list_remove( &dev->entry ); + list_remove( &impl->entry ); LeaveCriticalSection( &dinput_hook_crit ); } static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); TRACE( "iface %p.\n", iface ); @@ -422,7 +422,7 @@ static HRESULT WINAPI IDirectInputWImpl_QueryInterface( IDirectInput7W *iface, R static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - IDirectInputDeviceImpl *dev; + struct dinput_device *impl; RAWINPUT ri; UINT size = sizeof(ri); int rim = GET_RAWINPUT_CODE_WPARAM( wparam ); @@ -437,8 +437,8 @@ static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR else if (ri.header.dwType == RIM_TYPEMOUSE) { EnterCriticalSection( &dinput_hook_crit ); - LIST_FOR_EACH_ENTRY( dev, &acquired_rawmouse_list, IDirectInputDeviceImpl, entry ) - dinput_mouse_rawinput_hook( &dev->IDirectInputDevice8W_iface, wparam, lparam, &ri ); + LIST_FOR_EACH_ENTRY( impl, &acquired_rawmouse_list, struct dinput_device, entry ) + dinput_mouse_rawinput_hook( &impl->IDirectInputDevice8W_iface, wparam, lparam, &ri ); LeaveCriticalSection( &dinput_hook_crit ); } } @@ -1132,22 +1132,22 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam ) { - IDirectInputDeviceImpl *dev; + struct dinput_device *impl; int skip = 0; if (code != HC_ACTION) return CallNextHookEx( 0, code, wparam, lparam ); EnterCriticalSection( &dinput_hook_crit ); - LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY( impl, &acquired_mouse_list, struct dinput_device, entry ) { - TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam); - skip |= dinput_mouse_hook( &dev->IDirectInputDevice8W_iface, wparam, lparam ); + TRACE( "calling dinput_mouse_hook (%p %lx %lx)\n", impl, wparam, lparam ); + skip |= dinput_mouse_hook( &impl->IDirectInputDevice8W_iface, wparam, lparam ); } - LIST_FOR_EACH_ENTRY( dev, &acquired_keyboard_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY( impl, &acquired_keyboard_list, struct dinput_device, entry ) { - if (dev->use_raw_input) continue; - TRACE("calling dinput_keyboard_hook (%p %lx %lx)\n", dev, wparam, lparam); - skip |= dinput_keyboard_hook( &dev->IDirectInputDevice8W_iface, wparam, lparam ); + if (impl->use_raw_input) continue; + TRACE( "calling dinput_keyboard_hook (%p %lx %lx)\n", impl, wparam, lparam ); + skip |= dinput_keyboard_hook( &impl->IDirectInputDevice8W_iface, wparam, lparam ); } LeaveCriticalSection( &dinput_hook_crit ); @@ -1156,7 +1156,7 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam ) static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam ) { - IDirectInputDeviceImpl *dev, *next; + struct dinput_device *impl, *next; CWPSTRUCT *msg = (CWPSTRUCT *)lparam; HWND foreground; @@ -1167,36 +1167,36 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam foreground = GetForegroundWindow(); EnterCriticalSection( &dinput_hook_crit ); - LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_device_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, struct dinput_device, entry ) { - if (msg->hwnd == dev->win && msg->hwnd != foreground) + if (msg->hwnd == impl->win && msg->hwnd != foreground) { - TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev ); - dinput_device_internal_unacquire( &dev->IDirectInputDevice8W_iface ); + TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); } } - LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_mouse_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_mouse_list, struct dinput_device, entry ) { - if (msg->hwnd == dev->win && msg->hwnd != foreground) + if (msg->hwnd == impl->win && msg->hwnd != foreground) { - TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev ); - dinput_device_internal_unacquire( &dev->IDirectInputDevice8W_iface ); + TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); } } - LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_rawmouse_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_rawmouse_list, struct dinput_device, entry ) { - if (msg->hwnd == dev->win && msg->hwnd != foreground) + if (msg->hwnd == impl->win && msg->hwnd != foreground) { - TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev ); - dinput_device_internal_unacquire( &dev->IDirectInputDevice8W_iface ); + TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); } } - LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_keyboard_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry ) { - if (msg->hwnd == dev->win && msg->hwnd != foreground) + if (msg->hwnd == impl->win && msg->hwnd != foreground) { - TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev ); - dinput_device_internal_unacquire( &dev->IDirectInputDevice8W_iface ); + TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); } } LeaveCriticalSection( &dinput_hook_crit ); @@ -1207,7 +1207,7 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam static DWORD WINAPI hook_thread_proc(void *param) { static HHOOK kbd_hook, mouse_hook; - IDirectInputDeviceImpl *impl, *next; + struct dinput_device *impl, *next; SIZE_T events_count = 0; HANDLE finished_event; HANDLE events[128]; @@ -1228,7 +1228,7 @@ static DWORD WINAPI hook_thread_proc(void *param) if (ret < events_count) { EnterCriticalSection( &dinput_hook_crit ); - LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, struct dinput_device, entry ) { if (impl->read_event == events[ret]) { @@ -1265,7 +1265,7 @@ static DWORD WINAPI hook_thread_proc(void *param) EnterCriticalSection( &dinput_hook_crit ); kbd_cnt = list_count( &acquired_keyboard_list ); mice_cnt = list_count( &acquired_mouse_list ); - LIST_FOR_EACH_ENTRY( impl, &acquired_device_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY( impl, &acquired_device_list, struct dinput_device, entry ) { if (!impl->read_event || !impl->vtbl->read) continue; if (events_count >= ARRAY_SIZE(events)) break; @@ -1353,16 +1353,16 @@ static BOOL check_hook_thread(void) return hook_thread_id != 0; } -void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired) +void check_dinput_hooks( IDirectInputDevice8W *iface, BOOL acquired ) { static HHOOK callwndproc_hook; static ULONG foreground_cnt; - IDirectInputDeviceImpl *dev = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HANDLE hook_change_finished_event = NULL; EnterCriticalSection(&dinput_hook_crit); - if (dev->dwCoopLevel & DISCL_FOREGROUND) + if (impl->dwCoopLevel & DISCL_FOREGROUND) { if (acquired) foreground_cnt++; @@ -1386,29 +1386,29 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired) hook_thread_event = NULL; } - if (dev->use_raw_input) + if (impl->use_raw_input) { if (acquired) { - dev->raw_device.dwFlags = 0; - if (dev->dwCoopLevel & DISCL_BACKGROUND) - dev->raw_device.dwFlags |= RIDEV_INPUTSINK; - if (dev->dwCoopLevel & DISCL_EXCLUSIVE) - dev->raw_device.dwFlags |= RIDEV_NOLEGACY; - if ((dev->dwCoopLevel & DISCL_EXCLUSIVE) && dev->raw_device.usUsage == 2) - dev->raw_device.dwFlags |= RIDEV_CAPTUREMOUSE; - if ((dev->dwCoopLevel & DISCL_EXCLUSIVE) && dev->raw_device.usUsage == 6) - dev->raw_device.dwFlags |= RIDEV_NOHOTKEYS; - dev->raw_device.hwndTarget = di_em_win; + impl->raw_device.dwFlags = 0; + if (impl->dwCoopLevel & DISCL_BACKGROUND) + impl->raw_device.dwFlags |= RIDEV_INPUTSINK; + if (impl->dwCoopLevel & DISCL_EXCLUSIVE) + impl->raw_device.dwFlags |= RIDEV_NOLEGACY; + if ((impl->dwCoopLevel & DISCL_EXCLUSIVE) && impl->raw_device.usUsage == 2) + impl->raw_device.dwFlags |= RIDEV_CAPTUREMOUSE; + if ((impl->dwCoopLevel & DISCL_EXCLUSIVE) && impl->raw_device.usUsage == 6) + impl->raw_device.dwFlags |= RIDEV_NOHOTKEYS; + impl->raw_device.hwndTarget = di_em_win; } else { - dev->raw_device.dwFlags = RIDEV_REMOVE; - dev->raw_device.hwndTarget = NULL; + impl->raw_device.dwFlags = RIDEV_REMOVE; + impl->raw_device.hwndTarget = NULL; } - if (!RegisterRawInputDevices( &dev->raw_device, 1, sizeof(RAWINPUTDEVICE) )) - WARN( "Unable to (un)register raw device %x:%x\n", dev->raw_device.usUsagePage, dev->raw_device.usUsage ); + if (!RegisterRawInputDevices( &impl->raw_device, 1, sizeof(RAWINPUTDEVICE) )) + WARN( "Unable to (un)register raw device %x:%x\n", impl->raw_device.usUsagePage, impl->raw_device.usUsage ); } hook_change_finished_event = CreateEventW( NULL, FALSE, FALSE, NULL ); diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index 461af021a30..a9777dc8dbb 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -65,14 +65,14 @@ struct DevicePlayer { struct list entry; }; -extern void dinput_hooks_acquire_device(LPDIRECTINPUTDEVICE8W iface); -extern void dinput_hooks_unacquire_device(LPDIRECTINPUTDEVICE8W iface); +extern void dinput_hooks_acquire_device( IDirectInputDevice8W *iface ); +extern void dinput_hooks_unacquire_device( IDirectInputDevice8W *iface ); extern int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam ); extern int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam ); extern void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam, RAWINPUT *raw ); -extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8W, BOOL) DECLSPEC_HIDDEN; +extern void check_dinput_hooks( IDirectInputDevice8W *iface, BOOL acquired ) DECLSPEC_HIDDEN; extern void check_dinput_events(void) DECLSPEC_HIDDEN; extern HRESULT _configure_devices(IDirectInput8W *iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 4632109a35b..3a8c7213ebc 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -157,7 +157,7 @@ struct pid_set_ramp_force struct hid_joystick { - IDirectInputDeviceImpl base; + struct dinput_device base; LONG internal_ref; HANDLE device; @@ -189,7 +189,7 @@ struct hid_joystick static inline struct hid_joystick *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) { - return CONTAINING_RECORD( CONTAINING_RECORD( iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface ), + return CONTAINING_RECORD( CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ), struct hid_joystick, base ); } @@ -630,7 +630,7 @@ static void hid_joystick_release( IDirectInputDevice8W *iface ) HidD_FreePreparsedData( impl->preparsed ); CloseHandle( impl->base.read_event ); CloseHandle( impl->device ); - direct_input_device_destroy( iface ); + dinput_device_destroy( iface ); } } @@ -1781,8 +1781,7 @@ HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID *guid, else return DIERR_DEVICENOTREG; - hr = direct_input_device_alloc( sizeof(struct hid_joystick), &hid_joystick_vtbl, - guid, dinput, (void **)&impl ); + hr = dinput_device_alloc( sizeof(struct hid_joystick), &hid_joystick_vtbl, guid, dinput, (void **)&impl ); if (FAILED(hr)) return hr; impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": hid_joystick.base.crit"); impl->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND; @@ -1856,8 +1855,7 @@ HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID *guid, impl->base.caps.dwFFDriverVersion = 1; } - if (FAILED(hr = direct_input_device_init( &impl->base.IDirectInputDevice8W_iface ))) - goto failed; + if (FAILED(hr = dinput_device_init( &impl->base.IDirectInputDevice8W_iface ))) goto failed; *out = &impl->base.IDirectInputDevice8W_iface; return DI_OK; diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index a6032cbd0a4..713c5310322 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -39,12 +39,13 @@ static const struct dinput_device_vtbl keyboard_vtbl; typedef struct SysKeyboardImpl SysKeyboardImpl; struct SysKeyboardImpl { - struct IDirectInputDeviceImpl base; + struct dinput_device base; }; static inline SysKeyboardImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { - return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysKeyboardImpl, base); + return CONTAINING_RECORD( CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ), + SysKeyboardImpl, base ); } static BYTE map_dik_code(DWORD scanCode, DWORD vkCode, DWORD subType, DWORD version) @@ -184,8 +185,7 @@ HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDir *out = NULL; if (!IsEqualGUID( &GUID_SysKeyboard, guid )) return DIERR_DEVICENOTREG; - if (FAILED(hr = direct_input_device_alloc( sizeof(SysKeyboardImpl), &keyboard_vtbl, - guid, dinput, (void **)&impl ))) + if (FAILED(hr = dinput_device_alloc( sizeof(SysKeyboardImpl), &keyboard_vtbl, guid, dinput, (void **)&impl ))) return hr; impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysKeyboardImpl*->base.crit"); @@ -194,7 +194,7 @@ HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDir impl->base.caps.dwFirmwareRevision = 100; impl->base.caps.dwHardwareRevision = 100; - if (FAILED(hr = direct_input_device_init( &impl->base.IDirectInputDevice8W_iface ))) + if (FAILED(hr = dinput_device_init( &impl->base.IDirectInputDevice8W_iface ))) { IDirectInputDevice_Release( &impl->base.IDirectInputDevice8W_iface ); return hr; diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 84b5410bb36..9cf8ab07463 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -56,7 +56,7 @@ typedef enum struct SysMouseImpl { - struct IDirectInputDeviceImpl base; + struct dinput_device base; /* SysMouseAImpl */ /* These are used in case of relative -> absolute transitions */ @@ -72,7 +72,7 @@ struct SysMouseImpl static inline SysMouseImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { - return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysMouseImpl, base); + return CONTAINING_RECORD( CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ), SysMouseImpl, base ); } HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index ) @@ -116,8 +116,7 @@ HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirect *out = NULL; if (!IsEqualGUID( &GUID_SysMouse, guid )) return DIERR_DEVICENOTREG; - if (FAILED(hr = direct_input_device_alloc( sizeof(SysMouseImpl), &mouse_vtbl, - guid, dinput, (void **)&impl ))) + if (FAILED(hr = dinput_device_alloc( sizeof(SysMouseImpl), &mouse_vtbl, guid, dinput, (void **)&impl ))) return hr; impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit"); @@ -136,7 +135,7 @@ HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirect if (appkey) RegCloseKey(appkey); if (hkey) RegCloseKey(hkey); - if (FAILED(hr = direct_input_device_init( &impl->base.IDirectInputDevice8W_iface ))) + if (FAILED(hr = dinput_device_init( &impl->base.IDirectInputDevice8W_iface ))) { IDirectInputDevice_Release( &impl->base.IDirectInputDevice8W_iface ); return hr; -- 2.11.4.GIT