Commit b2422734 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Factor all IDirectInputDevice8W vtables together.

And remove "internal" suffix from internal functions. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent e85a5302
......@@ -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 */
......@@ -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
};
......@@ -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
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment