From b242273482616a3f98fb2cf0ce7a648bf4caf16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 22 Oct 2021 09:33:54 +0200 Subject: [PATCH] dinput: Factor all IDirectInputDevice8W vtables together. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And remove "internal" suffix from internal functions. Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/dinput/device.c | 189 ++++++++++++++++++++--------------- dlls/dinput/device_private.h | 80 +-------------- dlls/dinput/joystick_hid.c | 108 ++++++-------------- dlls/dinput/keyboard.c | 73 ++++---------- dlls/dinput/mouse.c | 73 ++++---------- 5 files changed, 181 insertions(+), 342 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index d9b92e82271..705aec2baca 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -178,23 +178,9 @@ static void _dump_EnumObjects_flags(DWORD dwFlags) { } } -void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) { - if (TRACE_ON(dinput)) { - TRACE(" - dwObj = 0x%08x\n", diph->dwObj); - TRACE(" - dwHow = %s\n", - ((diph->dwHow == DIPH_DEVICE) ? "DIPH_DEVICE" : - ((diph->dwHow == DIPH_BYOFFSET) ? "DIPH_BYOFFSET" : - ((diph->dwHow == DIPH_BYID)) ? "DIPH_BYID" : "unknown"))); - } -} - -void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi) { - TRACE(" - enumerating : %s ('%s'), - %2d - 0x%08x - %s - 0x%x\n", - debugstr_guid(&ddoi->guidType), _dump_dinput_GUID(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, debugstr_w(ddoi->tszName), ddoi->dwFlags); -} - /* This function is a helper to convert a GUID into any possible DInput GUID out there */ -const char *_dump_dinput_GUID(const GUID *guid) { +static const char *_dump_dinput_GUID( const GUID *guid ) +{ unsigned int i; static const struct { const GUID *guid; @@ -239,7 +225,8 @@ const char *_dump_dinput_GUID(const GUID *guid) { return debugstr_guid(guid); } -void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) { +static void _dump_DIDATAFORMAT( const DIDATAFORMAT *df ) +{ unsigned int i; TRACE("Dumping DIDATAFORMAT structure:\n"); @@ -368,7 +355,7 @@ BOOL device_instance_is_disabled( DIDEVICEINSTANCEW *instance, BOOL *override ) } /* Conversion between internal data buffer and external data buffer */ -void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) +static void fill_DataFormat( void *out, DWORD size, const void *in, const DataFormat *df ) { int i; const char *in_c = in; @@ -886,7 +873,7 @@ void queue_event( IDirectInputDevice8W *iface, int inst_id, DWORD data, DWORD ti * Acquire */ -HRESULT WINAPI IDirectInputDevice2WImpl_Acquire( IDirectInputDevice8W *iface ) +static HRESULT WINAPI IDirectInputDevice2WImpl_Acquire( IDirectInputDevice8W *iface ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr = DI_OK; @@ -918,7 +905,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_Acquire( IDirectInputDevice8W *iface ) * Unacquire */ -HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire( IDirectInputDevice8W *iface ) +static HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire( IDirectInputDevice8W *iface ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr = DI_OK; @@ -942,7 +929,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire( IDirectInputDevice8W *iface ) * IDirectInputDeviceA */ -HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df) +static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice8W *iface, LPCDIDATAFORMAT df ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); HRESULT res = DI_OK; @@ -973,7 +960,8 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W ifac * * Set cooperative level and the source window for the events. */ -HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags) +static HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel( IDirectInputDevice8W *iface, + HWND hwnd, DWORD dwflags ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); HRESULT hr; @@ -1015,7 +1003,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8 return hr; } -HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo( IDirectInputDevice8W *iface, DIDEVICEINSTANCEW *instance ) +static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo( IDirectInputDevice8W *iface, DIDEVICEINSTANCEW *instance ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); DWORD size; @@ -1037,7 +1025,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo( IDirectInputDevice8W *ifa /****************************************************************************** * SetEventNotification : specifies event to be sent on state change */ -HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE event) +static HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification( IDirectInputDevice8W *iface, HANDLE event ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); @@ -1076,7 +1064,7 @@ void direct_input_device_destroy( IDirectInputDevice8W *iface ) free( This ); } -ULONG WINAPI IDirectInputDevice2WImpl_Release( IDirectInputDevice8W *iface ) +static ULONG WINAPI IDirectInputDevice2WImpl_Release( IDirectInputDevice8W *iface ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); ULONG ref = InterlockedDecrement( &impl->ref ); @@ -1092,7 +1080,7 @@ ULONG WINAPI IDirectInputDevice2WImpl_Release( IDirectInputDevice8W *iface ) return ref; } -HRESULT WINAPI IDirectInputDevice2WImpl_GetCapabilities( IDirectInputDevice8W *iface, DIDEVCAPS *caps ) +static HRESULT WINAPI IDirectInputDevice2WImpl_GetCapabilities( IDirectInputDevice8W *iface, DIDEVCAPS *caps ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); DWORD size; @@ -1111,7 +1099,8 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetCapabilities( IDirectInputDevice8W *i return DI_OK; } -HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj) +static HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface( IDirectInputDevice8W *iface, + REFIID riid, LPVOID *ppobj ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); @@ -1142,7 +1131,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W ifa return E_NOINTERFACE; } -ULONG WINAPI IDirectInputDevice2WImpl_AddRef( IDirectInputDevice8W *iface ) +static ULONG WINAPI IDirectInputDevice2WImpl_AddRef( IDirectInputDevice8W *iface ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); ULONG ref = InterlockedIncrement( &impl->ref ); @@ -1150,8 +1139,9 @@ ULONG WINAPI IDirectInputDevice2WImpl_AddRef( IDirectInputDevice8W *iface ) return ref; } -HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( IDirectInputDevice8W *iface, LPDIENUMDEVICEOBJECTSCALLBACKW callback, - void *context, DWORD flags ) +static HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( IDirectInputDevice8W *iface, + LPDIENUMDEVICEOBJECTSCALLBACKW callback, + void *context, DWORD flags ) { static const DIPROPHEADER filter = { @@ -1220,8 +1210,8 @@ static BOOL CALLBACK find_object( const DIDEVICEOBJECTINSTANCEW *instance, void return DIENUM_STOP; } -HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty( IDirectInputDevice8W *iface, const GUID *guid, - DIPROPHEADER *header ) +static HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty( IDirectInputDevice8W *iface, + const GUID *guid, DIPROPHEADER *header ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); DWORD object_mask = DIDFT_AXIS | DIDFT_BUTTON | DIDFT_POV; @@ -1344,8 +1334,8 @@ static BOOL CALLBACK set_object_property( const DIDEVICEOBJECTINSTANCEW *instanc return DIENUM_CONTINUE; } -HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty( IDirectInputDevice8W *iface, const GUID *guid, - const DIPROPHEADER *header ) +static HRESULT WINAPI IDirectInputDevice2WImpl_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 ); @@ -1505,8 +1495,9 @@ static BOOL CALLBACK get_object_info( const DIDEVICEOBJECTINSTANCEW *instance, v return DIENUM_STOP; } -HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo( IDirectInputDevice8W *iface, DIDEVICEOBJECTINSTANCEW *instance, - DWORD obj, DWORD how ) +static HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo( IDirectInputDevice8W *iface, + DIDEVICEOBJECTINSTANCEW *instance, + DWORD obj, DWORD how ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); DIPROPHEADER filter = @@ -1538,7 +1529,7 @@ static BOOL CALLBACK reset_axis_data( const DIDEVICEOBJECTINSTANCEW *instance, v return DIENUM_CONTINUE; } -HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceState( IDirectInputDevice8W *iface, DWORD size, void *data ) +static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceState( IDirectInputDevice8W *iface, DWORD size, void *data ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); DIPROPHEADER filter = @@ -1573,8 +1564,9 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceState( IDirectInputDevice8W *if return hr; } -HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, - LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags) +static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice8W *iface, + DWORD dodsize, LPDIDEVICEOBJECTDATA dod, + LPDWORD entries, DWORD flags ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); HRESULT ret = DI_OK; @@ -1629,7 +1621,8 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W ifac return ret; } -HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags) +static HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel( IDirectInputDevice8W *iface, + HWND hwndOwner, DWORD dwFlags ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME("%p)->(%p,0x%08x): stub!\n", This, hwndOwner, dwFlags); @@ -1637,17 +1630,17 @@ HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W if return DI_OK; } -HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion, - REFGUID rguid) +static HRESULT WINAPI IDirectInputDevice2WImpl_Initialize( IDirectInputDevice8W *iface, HINSTANCE hinst, + DWORD dwVersion, REFGUID rguid ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME("(%p)->(%p,%d,%s): stub!\n", This, hinst, dwVersion, debugstr_guid(rguid)); return DI_OK; } -HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect( IDirectInputDevice8W *iface, const GUID *guid, - const DIEFFECT *params, IDirectInputEffect **out, - IUnknown *outer ) +static HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect( IDirectInputDevice8W *iface, + const GUID *guid, const DIEFFECT *params, + IDirectInputEffect **out, IUnknown *outer ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); DWORD flags = DIEP_ALLPARAMS; @@ -1678,8 +1671,9 @@ failed: return hr; } -HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( IDirectInputDevice8W *iface, LPDIENUMEFFECTSCALLBACKW callback, - void *context, DWORD type ) +static HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( IDirectInputDevice8W *iface, + LPDIENUMEFFECTSCALLBACKW callback, + void *context, DWORD type ) { DIEFFECTINFOW info = {.dwSize = sizeof(info)}; HRESULT hr; @@ -1749,8 +1743,8 @@ HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( IDirectInputDevice8W *iface return DI_OK; } -HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, - const GUID *guid ) +static HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo( IDirectInputDevice8W *iface, + DIEFFECTINFOW *info, const GUID *guid ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); @@ -1763,14 +1757,14 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo( IDirectInputDevice8W *ifa return impl->vtbl->get_effect_info( iface, info, guid ); } -HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState( IDirectInputDevice8W *iface, DWORD *out ) +static HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState( IDirectInputDevice8W *iface, DWORD *out ) { FIXME( "iface %p, out %p stub!\n", iface, out ); if (!out) return E_POINTER; return DIERR_UNSUPPORTED; } -HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand( IDirectInputDevice8W *iface, DWORD command ) +static HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand( IDirectInputDevice8W *iface, DWORD command ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr; @@ -1799,9 +1793,9 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand( IDirectInputDe return hr; } -HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects( IDirectInputDevice8W *iface, - LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, - void *context, DWORD flags ) +static HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects( IDirectInputDevice8W *iface, + LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, + void *context, DWORD flags ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); @@ -1815,14 +1809,14 @@ HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects( IDirectInputDe return impl->vtbl->enum_created_effect_objects( iface, callback, context, flags ); } -HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc) +static HRESULT WINAPI IDirectInputDevice2WImpl_Escape( IDirectInputDevice8W *iface, LPDIEFFESCAPE lpDIEEsc ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME("(%p)->(%p): stub!\n", This, lpDIEEsc); return DI_OK; } -HRESULT WINAPI IDirectInputDevice2WImpl_Poll( IDirectInputDevice8W *iface ) +static HRESULT WINAPI IDirectInputDevice2WImpl_Poll( IDirectInputDevice8W *iface ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr = DI_NOEFFECT; @@ -1836,9 +1830,9 @@ HRESULT WINAPI IDirectInputDevice2WImpl_Poll( IDirectInputDevice8W *iface ) return DI_OK; } -HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData, - LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, - DWORD dwFlags) +static HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData( IDirectInputDevice8W *iface, DWORD cbObjectData, + LPCDIDEVICEOBJECTDATA rgdod, + LPDWORD pdwInOut, DWORD dwFlags ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME("(%p)->(0x%08x,%p,%p,0x%08x): stub!\n", This, cbObjectData, rgdod, pdwInOut, dwFlags); @@ -1846,11 +1840,9 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W ifa return DI_OK; } -HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface, - LPCWSTR lpszFileName, - LPDIENUMEFFECTSINFILECALLBACK pec, - LPVOID pvRef, - DWORD dwFlags) +static HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile( IDirectInputDevice8W *iface, LPCWSTR lpszFileName, + LPDIENUMEFFECTSINFILECALLBACK pec, + LPVOID pvRef, DWORD dwFlags ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", This, debugstr_w(lpszFileName), pec, pvRef, dwFlags); @@ -1858,11 +1850,9 @@ HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W return DI_OK; } -HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface, - LPCWSTR lpszFileName, - DWORD dwEntries, - LPDIFILEEFFECT rgDiFileEft, - DWORD dwFlags) +static HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile( IDirectInputDevice8W *iface, + LPCWSTR lpszFileName, DWORD dwEntries, + LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", This, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags); @@ -1870,8 +1860,9 @@ HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W return DI_OK; } -HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format, - const WCHAR *username, DWORD flags ) +static HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap( IDirectInputDevice8W *iface, + DIACTIONFORMATW *format, + const WCHAR *username, DWORD flags ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); BOOL load_success = FALSE, has_actions = FALSE; @@ -1957,8 +1948,8 @@ HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap( IDirectInputDevice8W *if return DI_OK; } -HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format, - const WCHAR *username, DWORD flags ) +static HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format, + const WCHAR *username, DWORD flags ) { IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); DIDATAFORMAT data_format; @@ -2080,8 +2071,8 @@ HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap( IDirectInputDevice8W *ifac return DI_OK; } -HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface, - LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader) +static HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo( IDirectInputDevice8W *iface, + LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); FIXME("(%p)->(%p): stub !\n", This, lpdiDevImageInfoHeader); @@ -2089,7 +2080,49 @@ HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface return DI_OK; } -HRESULT direct_input_device_alloc( SIZE_T size, const IDirectInputDevice8WVtbl *vtbl, const struct dinput_device_vtbl *internal_vtbl, +extern const IDirectInputDevice8AVtbl dinput_device_a_vtbl; +static const IDirectInputDevice8WVtbl dinput_device_w_vtbl = +{ + /*** IUnknown methods ***/ + IDirectInputDevice2WImpl_QueryInterface, + IDirectInputDevice2WImpl_AddRef, + IDirectInputDevice2WImpl_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, + /*** IDirectInputDevice2 methods ***/ + IDirectInputDevice2WImpl_CreateEffect, + IDirectInputDevice2WImpl_EnumEffects, + IDirectInputDevice2WImpl_GetEffectInfo, + IDirectInputDevice2WImpl_GetForceFeedbackState, + IDirectInputDevice2WImpl_SendForceFeedbackCommand, + IDirectInputDevice2WImpl_EnumCreatedEffectObjects, + IDirectInputDevice2WImpl_Escape, + IDirectInputDevice2WImpl_Poll, + IDirectInputDevice2WImpl_SendDeviceData, + /*** IDirectInputDevice7 methods ***/ + IDirectInputDevice7WImpl_EnumEffectsInFile, + IDirectInputDevice7WImpl_WriteEffectToFile, + /*** IDirectInputDevice8 methods ***/ + IDirectInputDevice8WImpl_BuildActionMap, + IDirectInputDevice8WImpl_SetActionMap, + IDirectInputDevice8WImpl_GetImageInfo, +}; + +HRESULT direct_input_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid, IDirectInputImpl *dinput, void **out ) { IDirectInputDeviceImpl *This; @@ -2103,7 +2136,7 @@ HRESULT direct_input_device_alloc( SIZE_T size, const IDirectInputDevice8WVtbl * } This->IDirectInputDevice8A_iface.lpVtbl = &dinput_device_a_vtbl; - This->IDirectInputDevice8W_iface.lpVtbl = vtbl; + This->IDirectInputDevice8W_iface.lpVtbl = &dinput_device_w_vtbl; This->ref = 1; This->guid = *guid; This->instance.dwSize = sizeof(DIDEVICEINSTANCEW); @@ -2113,7 +2146,7 @@ HRESULT direct_input_device_alloc( SIZE_T size, const IDirectInputDevice8WVtbl * InitializeCriticalSection( &This->crit ); This->dinput = dinput; IDirectInput_AddRef( &dinput->IDirectInput7A_iface ); - This->vtbl = internal_vtbl; + This->vtbl = vtbl; *out = This; return DI_OK; diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 16d28323281..49819c95096 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -53,8 +53,6 @@ typedef struct UINT_PTR uAppData; } ActionMap; -typedef HRESULT dinput_device_read_state( IDirectInputDevice8W *iface ); - struct dinput_device_vtbl { void (*release)( IDirectInputDevice8W *iface ); @@ -119,94 +117,18 @@ struct IDirectInputDeviceImpl BYTE device_state[DEVICE_STATE_MAX_SIZE]; }; -extern HRESULT direct_input_device_alloc( SIZE_T size, const IDirectInputDevice8WVtbl *vtbl, const struct dinput_device_vtbl *internal_vtbl, +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 const IDirectInputDevice8AVtbl dinput_device_a_vtbl DECLSPEC_HIDDEN; extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN; extern DWORD get_config_key( HKEY, HKEY, const WCHAR *, WCHAR *, DWORD ) DECLSPEC_HIDDEN; extern BOOL device_instance_is_disabled( DIDEVICEINSTANCEW *instance, BOOL *override ) DECLSPEC_HIDDEN; /* Routines to do DataFormat / WineFormat conversions */ -extern void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df) DECLSPEC_HIDDEN; extern void queue_event( IDirectInputDevice8W *iface, int inst_id, DWORD data, DWORD time, DWORD seq ) DECLSPEC_HIDDEN; extern const GUID dinput_pidvid_guid DECLSPEC_HIDDEN; -/* Various debug tools */ -extern void _dump_DIPROPHEADER(LPCDIPROPHEADER diph) DECLSPEC_HIDDEN; -extern void _dump_OBJECTINSTANCEW(const DIDEVICEOBJECTINSTANCEW *ddoi) DECLSPEC_HIDDEN; -extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) DECLSPEC_HIDDEN; -extern const char *_dump_dinput_GUID(const GUID *guid) DECLSPEC_HIDDEN; - -/* And the stubs */ -extern HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_GetCapabilities( IDirectInputDevice8W *iface, DIDEVCAPS *caps ); -extern HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W iface, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo( IDirectInputDevice8W *iface, - DIDEVICEINSTANCEW *instance ); -extern HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE hnd) DECLSPEC_HIDDEN; -extern ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; -extern ULONG WINAPI IDirectInputDevice2WImpl_AddRef(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( - LPDIRECTINPUTDEVICE8W iface, - LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, - LPVOID lpvRef, - DWORD dwFlags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIPROPHEADER pdiph) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, - LPDIDEVICEOBJECTINSTANCEW pdidoi, - DWORD dwObj, - DWORD dwHow) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceState( IDirectInputDevice8W *iface, DWORD len, void *ptr ); -extern HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, - LPDWORD entries, DWORD flags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel(LPDIRECTINPUTDEVICE8W iface, HWND hwndOwner, DWORD dwFlags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_Initialize(LPDIRECTINPUTDEVICE8W iface, HINSTANCE hinst, DWORD dwVersion, - REFGUID rguid) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPCDIEFFECT lpeff, - LPDIRECTINPUTEFFECT *ppdef, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( - LPDIRECTINPUTDEVICE8W iface, - LPDIENUMEFFECTSCALLBACKW lpCallback, - LPVOID lpvRef, - DWORD dwFlags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo( - LPDIRECTINPUTDEVICE8W iface, - LPDIEFFECTINFOW lpdei, - REFGUID rguid) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState(LPDIRECTINPUTDEVICE8W iface, LPDWORD pdwOut) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE8W iface, - LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, - LPVOID lpvRef, DWORD dwFlags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_Escape(LPDIRECTINPUTDEVICE8W iface, LPDIEFFESCAPE lpDIEEsc) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_Poll(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData(LPDIRECTINPUTDEVICE8W iface, DWORD cbObjectData, - LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile(LPDIRECTINPUTDEVICE8W iface, - LPCWSTR lpszFileName, - LPDIENUMEFFECTSINFILECALLBACK pec, - LPVOID pvRef, - DWORD dwFlags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE8W iface, - LPCWSTR lpszFileName, - DWORD dwEntries, - LPDIFILEEFFECT rgDiFileEft, - DWORD dwFlags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, - LPDIACTIONFORMATW lpdiaf, - LPCWSTR lpszUserName, - DWORD dwFlags) DECLSPEC_HIDDEN; -extern HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format, - const WCHAR *username, DWORD flags ); -extern HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface, - LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader) DECLSPEC_HIDDEN; - #endif /* __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H */ diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 5fb4e9a2de9..2bd527e7000 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -608,14 +608,14 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *filter, return DIENUM_CONTINUE; } -static void hid_joystick_internal_addref( IDirectInputDevice8W *iface ) +static void hid_joystick_addref( IDirectInputDevice8W *iface ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); ULONG ref = InterlockedIncrement( &impl->internal_ref ); TRACE( "iface %p, internal ref %u.\n", iface, ref ); } -static void hid_joystick_internal_release( IDirectInputDevice8W *iface ) +static void hid_joystick_release( IDirectInputDevice8W *iface ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); ULONG ref = InterlockedDecrement( &impl->internal_ref ); @@ -634,8 +634,8 @@ static void hid_joystick_internal_release( IDirectInputDevice8W *iface ) } } -static HRESULT hid_joystick_internal_get_property( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header, - DIDEVICEOBJECTINSTANCEW *instance ) +static HRESULT hid_joystick_get_property( IDirectInputDevice8W *iface, DWORD property, + DIPROPHEADER *header, DIDEVICEOBJECTINSTANCEW *instance ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); struct extra_caps *extra = NULL; @@ -728,8 +728,8 @@ static void set_extra_caps_range( struct hid_joystick *impl, const DIDEVICEOBJEC } } -static HRESULT hid_joystick_internal_set_property( IDirectInputDevice8W *iface, DWORD property, const DIPROPHEADER *header, - const DIDEVICEOBJECTINSTANCEW *instance ) +static HRESULT hid_joystick_set_property( IDirectInputDevice8W *iface, DWORD property, + const DIPROPHEADER *header, const DIDEVICEOBJECTINSTANCEW *instance ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); struct extra_caps *extra = NULL; @@ -761,7 +761,7 @@ static HRESULT hid_joystick_internal_set_property( IDirectInputDevice8W *iface, return DIERR_UNSUPPORTED; } -static HRESULT hid_joystick_internal_acquire( IDirectInputDevice8W *iface ) +static HRESULT hid_joystick_acquire( IDirectInputDevice8W *iface ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); ULONG report_len = impl->caps.InputReportByteLength; @@ -788,7 +788,7 @@ static HRESULT hid_joystick_internal_acquire( IDirectInputDevice8W *iface ) return DI_OK; } -static HRESULT hid_joystick_internal_unacquire( IDirectInputDevice8W *iface ) +static HRESULT hid_joystick_unacquire( IDirectInputDevice8W *iface ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); BOOL ret; @@ -803,10 +803,9 @@ static HRESULT hid_joystick_internal_unacquire( IDirectInputDevice8W *iface ) return DI_OK; } -static HRESULT hid_joystick_internal_create_effect( IDirectInputDevice8W *iface, IDirectInputEffect **out ); +static HRESULT hid_joystick_create_effect( IDirectInputDevice8W *iface, IDirectInputEffect **out ); -static HRESULT hid_joystick_internal_get_effect_info( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, - const GUID *guid ) +static HRESULT hid_joystick_get_effect_info( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, const GUID *guid ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); struct pid_effect_update *effect_update = &impl->pid_effect_update; @@ -946,7 +945,7 @@ static BOOL CALLBACK unload_effect_object( IDirectInputEffect *effect, void *con return DIENUM_CONTINUE; } -static HRESULT hid_joystick_internal_send_force_feedback_command( IDirectInputDevice8W *iface, DWORD command ) +static HRESULT hid_joystick_send_force_feedback_command( IDirectInputDevice8W *iface, DWORD command ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); struct pid_control_report *report = &impl->pid_device_control; @@ -982,9 +981,9 @@ static HRESULT hid_joystick_internal_send_force_feedback_command( IDirectInputDe return DI_OK; } -static HRESULT hid_joystick_internal_enum_created_effect_objects( IDirectInputDevice8W *iface, - LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, - void *context, DWORD flags ) +static HRESULT hid_joystick_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; @@ -997,47 +996,6 @@ static HRESULT hid_joystick_internal_enum_created_effect_objects( IDirectInputDe return DI_OK; } -static const IDirectInputDevice8WVtbl hid_joystick_vtbl = -{ - /*** IUnknown methods ***/ - IDirectInputDevice2WImpl_QueryInterface, - IDirectInputDevice2WImpl_AddRef, - IDirectInputDevice2WImpl_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, - /*** IDirectInputDevice2 methods ***/ - IDirectInputDevice2WImpl_CreateEffect, - IDirectInputDevice2WImpl_EnumEffects, - IDirectInputDevice2WImpl_GetEffectInfo, - IDirectInputDevice2WImpl_GetForceFeedbackState, - IDirectInputDevice2WImpl_SendForceFeedbackCommand, - IDirectInputDevice2WImpl_EnumCreatedEffectObjects, - IDirectInputDevice2WImpl_Escape, - IDirectInputDevice2WImpl_Poll, - IDirectInputDevice2WImpl_SendDeviceData, - /*** IDirectInputDevice7 methods ***/ - IDirectInputDevice7WImpl_EnumEffectsInFile, - IDirectInputDevice7WImpl_WriteEffectToFile, - /*** IDirectInputDevice8 methods ***/ - IDirectInputDevice8WImpl_BuildActionMap, - IDirectInputDevice8WImpl_SetActionMap, - IDirectInputDevice8WImpl_GetImageInfo, -}; - struct parse_device_state_params { BYTE old_state[DEVICE_STATE_MAX_SIZE]; @@ -1147,7 +1105,7 @@ static BOOL read_device_state_value( struct hid_joystick *impl, struct hid_value return DIENUM_CONTINUE; } -static HRESULT hid_joystick_internal_read( IDirectInputDevice8W *iface ) +static HRESULT hid_joystick_read( IDirectInputDevice8W *iface ) { static const DIPROPHEADER filter = { @@ -1245,28 +1203,28 @@ static BOOL enum_objects_callback( struct hid_joystick *impl, struct hid_value_c return params->callback( instance, params->context ); } -static HRESULT hid_joystick_internal_enum_objects( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, DWORD flags, - LPDIENUMDEVICEOBJECTSCALLBACKW callback, void *context ) +static HRESULT hid_joystick_enum_objects( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, + DWORD flags, LPDIENUMDEVICEOBJECTSCALLBACKW callback, void *context ) { struct enum_objects_params params = {.callback = callback, .context = context}; struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); return enum_objects( impl, filter, flags, enum_objects_callback, ¶ms ); } -static const struct dinput_device_vtbl hid_joystick_internal_vtbl = +static const struct dinput_device_vtbl hid_joystick_vtbl = { - hid_joystick_internal_release, + hid_joystick_release, NULL, - hid_joystick_internal_read, - hid_joystick_internal_acquire, - hid_joystick_internal_unacquire, - hid_joystick_internal_enum_objects, - hid_joystick_internal_get_property, - hid_joystick_internal_set_property, - 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, + hid_joystick_read, + hid_joystick_acquire, + hid_joystick_unacquire, + hid_joystick_enum_objects, + hid_joystick_get_property, + hid_joystick_set_property, + hid_joystick_get_effect_info, + hid_joystick_create_effect, + hid_joystick_send_force_feedback_command, + hid_joystick_enum_created_effect_objects, }; static DWORD device_type_for_version( DWORD type, DWORD version ) @@ -1824,7 +1782,7 @@ static HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID else return DIERR_DEVICENOTREG; - hr = direct_input_device_alloc( sizeof(struct hid_joystick), &hid_joystick_vtbl, &hid_joystick_internal_vtbl, + hr = direct_input_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"); @@ -1953,7 +1911,7 @@ static ULONG WINAPI hid_joystick_effect_Release( IDirectInputEffect *iface ) EnterCriticalSection( &impl->joystick->base.crit ); list_remove( &impl->entry ); LeaveCriticalSection( &impl->joystick->base.crit ); - hid_joystick_internal_release( &impl->joystick->base.IDirectInputDevice8W_iface ); + hid_joystick_release( &impl->joystick->base.IDirectInputDevice8W_iface ); free( impl->type_specific_buf[1] ); free( impl->type_specific_buf[0] ); free( impl->effect_update_buf ); @@ -2781,7 +2739,7 @@ static IDirectInputEffectVtbl hid_joystick_effect_vtbl = hid_joystick_effect_Escape, }; -static HRESULT hid_joystick_internal_create_effect( IDirectInputDevice8W *iface, IDirectInputEffect **out ) +static HRESULT hid_joystick_create_effect( IDirectInputDevice8W *iface, IDirectInputEffect **out ) { struct hid_joystick *joystick = impl_from_IDirectInputDevice8W( iface ); struct hid_joystick_effect *impl; @@ -2791,7 +2749,7 @@ static HRESULT hid_joystick_internal_create_effect( IDirectInputDevice8W *iface, impl->IDirectInputEffect_iface.lpVtbl = &hid_joystick_effect_vtbl; impl->ref = 1; impl->joystick = joystick; - hid_joystick_internal_addref( &joystick->base.IDirectInputDevice8W_iface ); + hid_joystick_addref( &joystick->base.IDirectInputDevice8W_iface ); EnterCriticalSection( &joystick->base.crit ); list_add_tail( &joystick->effect_list, &impl->entry ); diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 804ce8b7808..35e55be4f4b 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -34,8 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); -static const IDirectInputDevice8WVtbl SysKeyboardWvt; -static const struct dinput_device_vtbl keyboard_internal_vtbl; +static const struct dinput_device_vtbl keyboard_vtbl; typedef struct SysKeyboardImpl SysKeyboardImpl; struct SysKeyboardImpl @@ -185,7 +184,7 @@ static HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *gui *out = NULL; if (!IsEqualGUID( &GUID_SysKeyboard, guid )) return DIERR_DEVICENOTREG; - if (FAILED(hr = direct_input_device_alloc( sizeof(SysKeyboardImpl), &SysKeyboardWvt, &keyboard_internal_vtbl, + if (FAILED(hr = direct_input_device_alloc( sizeof(SysKeyboardImpl), &keyboard_vtbl, guid, dinput, (void **)&impl ))) return hr; impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysKeyboardImpl*->base.crit"); @@ -211,18 +210,18 @@ const struct dinput_device keyboard_device = { keyboard_create_device }; -static HRESULT keyboard_internal_poll( IDirectInputDevice8W *iface ) +static HRESULT keyboard_poll( IDirectInputDevice8W *iface ) { check_dinput_events(); return DI_OK; } -static HRESULT keyboard_internal_acquire( IDirectInputDevice8W *iface ) +static HRESULT keyboard_acquire( IDirectInputDevice8W *iface ) { return DI_OK; } -static HRESULT keyboard_internal_unacquire( IDirectInputDevice8W *iface ) +static HRESULT keyboard_unacquire( IDirectInputDevice8W *iface ) { SysKeyboardImpl *This = impl_from_IDirectInputDevice8W( iface ); memset( This->base.device_state, 0, sizeof(This->base.device_state) ); @@ -249,8 +248,8 @@ static BOOL try_enum_object( const DIPROPHEADER *filter, DWORD flags, LPDIENUMDE return DIENUM_CONTINUE; } -static HRESULT keyboard_internal_enum_objects( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, DWORD flags, - LPDIENUMDEVICEOBJECTSCALLBACKW callback, void *context ) +static HRESULT keyboard_enum_objects( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, + DWORD flags, LPDIENUMDEVICEOBJECTSCALLBACKW callback, void *context ) { SysKeyboardImpl *impl = impl_from_IDirectInputDevice8W( iface ); BYTE subtype = GET_DIDEVICE_SUBTYPE( impl->base.instance.dwDevType ); @@ -277,8 +276,8 @@ static HRESULT keyboard_internal_enum_objects( IDirectInputDevice8W *iface, cons return DIENUM_CONTINUE; } -static HRESULT keyboard_internal_get_property( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header, - DIDEVICEOBJECTINSTANCEW *instance ) +static HRESULT keyboard_get_property( IDirectInputDevice8W *iface, DWORD property, + DIPROPHEADER *header, DIDEVICEOBJECTINSTANCEW *instance ) { switch (property) { @@ -292,60 +291,24 @@ static HRESULT keyboard_internal_get_property( IDirectInputDevice8W *iface, DWOR return DIERR_UNSUPPORTED; } -static HRESULT keyboard_internal_set_property( IDirectInputDevice8W *iface, DWORD property, const DIPROPHEADER *header, - const DIDEVICEOBJECTINSTANCEW *instance ) +static HRESULT keyboard_set_property( IDirectInputDevice8W *iface, DWORD property, + const DIPROPHEADER *header, const DIDEVICEOBJECTINSTANCEW *instance ) { return DIERR_UNSUPPORTED; } -static const struct dinput_device_vtbl keyboard_internal_vtbl = +static const struct dinput_device_vtbl keyboard_vtbl = { NULL, - keyboard_internal_poll, + keyboard_poll, NULL, - keyboard_internal_acquire, - keyboard_internal_unacquire, - keyboard_internal_enum_objects, - keyboard_internal_get_property, - keyboard_internal_set_property, + keyboard_acquire, + keyboard_unacquire, + keyboard_enum_objects, + keyboard_get_property, + keyboard_set_property, NULL, NULL, NULL, NULL, }; - -static const IDirectInputDevice8WVtbl SysKeyboardWvt = -{ - IDirectInputDevice2WImpl_QueryInterface, - IDirectInputDevice2WImpl_AddRef, - IDirectInputDevice2WImpl_Release, - 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, - IDirectInputDevice2WImpl_CreateEffect, - IDirectInputDevice2WImpl_EnumEffects, - IDirectInputDevice2WImpl_GetEffectInfo, - IDirectInputDevice2WImpl_GetForceFeedbackState, - IDirectInputDevice2WImpl_SendForceFeedbackCommand, - IDirectInputDevice2WImpl_EnumCreatedEffectObjects, - IDirectInputDevice2WImpl_Escape, - IDirectInputDevice2WImpl_Poll, - IDirectInputDevice2WImpl_SendDeviceData, - IDirectInputDevice7WImpl_EnumEffectsInFile, - IDirectInputDevice7WImpl_WriteEffectToFile, - IDirectInputDevice8WImpl_BuildActionMap, - IDirectInputDevice8WImpl_SetActionMap, - IDirectInputDevice8WImpl_GetImageInfo -}; diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 4e353dba200..d871722e0a9 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -43,8 +43,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); #define WINE_MOUSE_Z_AXIS_INSTANCE 2 #define WINE_MOUSE_BUTTONS_INSTANCE 3 -static const IDirectInputDevice8WVtbl SysMouseWvt; -static const struct dinput_device_vtbl mouse_internal_vtbl; +static const struct dinput_device_vtbl mouse_vtbl; typedef struct SysMouseImpl SysMouseImpl; @@ -117,7 +116,7 @@ static HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, *out = NULL; if (!IsEqualGUID( &GUID_SysMouse, guid )) return DIERR_DEVICENOTREG; - if (FAILED(hr = direct_input_device_alloc( sizeof(SysMouseImpl), &SysMouseWvt, &mouse_internal_vtbl, + if (FAILED(hr = direct_input_device_alloc( sizeof(SysMouseImpl), &mouse_vtbl, guid, dinput, (void **)&impl ))) return hr; impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit"); @@ -410,7 +409,7 @@ static void warp_check( SysMouseImpl* This, BOOL force ) } } -static HRESULT mouse_internal_poll( IDirectInputDevice8W *iface ) +static HRESULT mouse_poll( IDirectInputDevice8W *iface ) { SysMouseImpl *impl = impl_from_IDirectInputDevice8W( iface ); check_dinput_events(); @@ -418,7 +417,7 @@ static HRESULT mouse_internal_poll( IDirectInputDevice8W *iface ) return DI_OK; } -static HRESULT mouse_internal_acquire( IDirectInputDevice8W *iface ) +static HRESULT mouse_acquire( IDirectInputDevice8W *iface ) { SysMouseImpl *impl = impl_from_IDirectInputDevice8W( iface ); DIMOUSESTATE2 *state = (DIMOUSESTATE2 *)impl->base.device_state; @@ -462,7 +461,7 @@ static HRESULT mouse_internal_acquire( IDirectInputDevice8W *iface ) return DI_OK; } -static HRESULT mouse_internal_unacquire( IDirectInputDevice8W *iface ) +static HRESULT mouse_unacquire( IDirectInputDevice8W *iface ) { SysMouseImpl *impl = impl_from_IDirectInputDevice8W( iface ); @@ -503,8 +502,8 @@ static BOOL try_enum_object( const DIPROPHEADER *filter, DWORD flags, LPDIENUMDE return DIENUM_CONTINUE; } -static HRESULT mouse_internal_enum_objects( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, DWORD flags, - LPDIENUMDEVICEOBJECTSCALLBACKW callback, void *context ) +static HRESULT mouse_enum_objects( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, + DWORD flags, LPDIENUMDEVICEOBJECTSCALLBACKW callback, void *context ) { DIDEVICEOBJECTINSTANCEW instances[] = { @@ -580,8 +579,8 @@ static HRESULT mouse_internal_enum_objects( IDirectInputDevice8W *iface, const D return DIENUM_CONTINUE; } -static HRESULT mouse_internal_get_property( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header, - DIDEVICEOBJECTINSTANCEW *instance ) +static HRESULT mouse_get_property( IDirectInputDevice8W *iface, DWORD property, + DIPROPHEADER *header, DIDEVICEOBJECTINSTANCEW *instance ) { switch (property) { @@ -603,60 +602,24 @@ static HRESULT mouse_internal_get_property( IDirectInputDevice8W *iface, DWORD p return DIERR_UNSUPPORTED; } -static HRESULT mouse_internal_set_property( IDirectInputDevice8W *iface, DWORD property, const DIPROPHEADER *header, - const DIDEVICEOBJECTINSTANCEW *instance ) +static HRESULT mouse_set_property( IDirectInputDevice8W *iface, DWORD property, + const DIPROPHEADER *header, const DIDEVICEOBJECTINSTANCEW *instance ) { return DIERR_UNSUPPORTED; } -static const struct dinput_device_vtbl mouse_internal_vtbl = +static const struct dinput_device_vtbl mouse_vtbl = { NULL, - mouse_internal_poll, + mouse_poll, NULL, - mouse_internal_acquire, - mouse_internal_unacquire, - mouse_internal_enum_objects, - mouse_internal_get_property, - mouse_internal_set_property, + mouse_acquire, + mouse_unacquire, + mouse_enum_objects, + mouse_get_property, + mouse_set_property, NULL, NULL, NULL, NULL, }; - -static const IDirectInputDevice8WVtbl SysMouseWvt = -{ - IDirectInputDevice2WImpl_QueryInterface, - IDirectInputDevice2WImpl_AddRef, - IDirectInputDevice2WImpl_Release, - 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, - IDirectInputDevice2WImpl_CreateEffect, - IDirectInputDevice2WImpl_EnumEffects, - IDirectInputDevice2WImpl_GetEffectInfo, - IDirectInputDevice2WImpl_GetForceFeedbackState, - IDirectInputDevice2WImpl_SendForceFeedbackCommand, - IDirectInputDevice2WImpl_EnumCreatedEffectObjects, - IDirectInputDevice2WImpl_Escape, - IDirectInputDevice2WImpl_Poll, - IDirectInputDevice2WImpl_SendDeviceData, - IDirectInputDevice7WImpl_EnumEffectsInFile, - IDirectInputDevice7WImpl_WriteEffectToFile, - IDirectInputDevice8WImpl_BuildActionMap, - IDirectInputDevice8WImpl_SetActionMap, - IDirectInputDevice8WImpl_GetImageInfo -};