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

dinput: Factor out IDirectInputDevice ansi vtable.

parent 8d791496
...@@ -1704,16 +1704,13 @@ HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface ...@@ -1704,16 +1704,13 @@ HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo(LPDIRECTINPUTDEVICE8W iface
return DI_OK; return DI_OK;
} }
HRESULT direct_input_device_alloc( SIZE_T size, const IDirectInputDevice8WVtbl *vtblw, HRESULT direct_input_device_alloc( SIZE_T size, const IDirectInputDevice8WVtbl *vtbl,
const IDirectInputDevice8AVtbl *vtbla, const GUID *guid, const GUID *guid, IDirectInputImpl *dinput, void **out )
IDirectInputImpl *dinput, void **out )
{ {
IDirectInputDeviceImpl *This; IDirectInputDeviceImpl *This;
if (!(This = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size ))) return DIERR_OUTOFMEMORY; if (!(This = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size ))) return DIERR_OUTOFMEMORY;
This->IDirectInputDevice8A_iface.lpVtbl = &dinput_device_a_vtbl;
This->IDirectInputDevice8A_iface.lpVtbl = vtbla; This->IDirectInputDevice8W_iface.lpVtbl = vtbl;
This->IDirectInputDevice8W_iface.lpVtbl = vtblw;
This->ref = 1; This->ref = 1;
This->guid = *guid; This->guid = *guid;
InitializeCriticalSection( &This->crit ); InitializeCriticalSection( &This->crit );
......
...@@ -90,7 +90,6 @@ struct JoyDev ...@@ -90,7 +90,6 @@ struct JoyDev
}; };
typedef struct JoystickImpl JoystickImpl; typedef struct JoystickImpl JoystickImpl;
static const IDirectInputDevice8AVtbl JoystickAvt;
static const IDirectInputDevice8WVtbl JoystickWvt; static const IDirectInputDevice8WVtbl JoystickWvt;
struct JoystickImpl struct JoystickImpl
{ {
...@@ -462,7 +461,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm ...@@ -462,7 +461,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm
TRACE( "%s %p %p %hu\n", debugstr_guid( rguid ), dinput, out, index ); TRACE( "%s %p %p %hu\n", debugstr_guid( rguid ), dinput, out, index );
if (FAILED(hr = direct_input_device_alloc( sizeof(JoystickImpl), &JoystickWvt, &JoystickAvt, rguid, dinput, (void **)&newDevice ))) if (FAILED(hr = direct_input_device_alloc( sizeof(JoystickImpl), &JoystickWvt, rguid, dinput, (void **)&newDevice )))
return hr; return hr;
newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->generic.base.crit"); newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->generic.base.crit");
...@@ -862,42 +861,6 @@ static void joy_polldev( IDirectInputDevice8W *iface ) ...@@ -862,42 +861,6 @@ static void joy_polldev( IDirectInputDevice8W *iface )
} }
} }
static const IDirectInputDevice8AVtbl JoystickAvt =
{
IDirectInputDevice2AImpl_QueryInterface,
IDirectInputDevice2AImpl_AddRef,
IDirectInputDevice2AImpl_Release,
IDirectInputDevice2AImpl_GetCapabilities,
IDirectInputDevice2AImpl_EnumObjects,
IDirectInputDevice2AImpl_GetProperty,
IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire,
IDirectInputDevice2AImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData,
IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification,
IDirectInputDevice2AImpl_SetCooperativeLevel,
IDirectInputDevice2AImpl_GetObjectInfo,
IDirectInputDevice2AImpl_GetDeviceInfo,
IDirectInputDevice2AImpl_RunControlPanel,
IDirectInputDevice2AImpl_Initialize,
IDirectInputDevice2AImpl_CreateEffect,
IDirectInputDevice2AImpl_EnumEffects,
IDirectInputDevice2AImpl_GetEffectInfo,
IDirectInputDevice2AImpl_GetForceFeedbackState,
IDirectInputDevice2AImpl_SendForceFeedbackCommand,
IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
IDirectInputDevice2AImpl_Escape,
IDirectInputDevice2AImpl_Poll,
IDirectInputDevice2AImpl_SendDeviceData,
IDirectInputDevice7AImpl_EnumEffectsInFile,
IDirectInputDevice7AImpl_WriteEffectToFile,
IDirectInputDevice8AImpl_BuildActionMap,
IDirectInputDevice8AImpl_SetActionMap,
IDirectInputDevice8AImpl_GetImageInfo
};
static const IDirectInputDevice8WVtbl JoystickWvt = static const IDirectInputDevice8WVtbl JoystickWvt =
{ {
IDirectInputDevice2WImpl_QueryInterface, IDirectInputDevice2WImpl_QueryInterface,
......
...@@ -86,12 +86,12 @@ struct wine_input_absinfo { ...@@ -86,12 +86,12 @@ struct wine_input_absinfo {
/* implemented in effect_linuxinput.c */ /* implemented in effect_linuxinput.c */
HRESULT linuxinput_create_effect(int* fd, REFGUID rguid, struct list *parent_list_entry, LPDIRECTINPUTEFFECT* peff); HRESULT linuxinput_create_effect(int* fd, REFGUID rguid, struct list *parent_list_entry, LPDIRECTINPUTEFFECT* peff);
HRESULT linuxinput_get_info_A(int fd, REFGUID rguid, LPDIEFFECTINFOA info);
HRESULT linuxinput_get_info_W(int fd, REFGUID rguid, LPDIEFFECTINFOW info); HRESULT linuxinput_get_info_W(int fd, REFGUID rguid, LPDIEFFECTINFOW info);
static HRESULT WINAPI JoystickWImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags); static HRESULT WINAPI JoystickWImpl_SendForceFeedbackCommand(LPDIRECTINPUTDEVICE8W iface, DWORD dwFlags);
typedef struct JoystickImpl JoystickImpl; typedef struct JoystickImpl JoystickImpl;
static const IDirectInputDevice8AVtbl JoystickAvt;
static const IDirectInputDevice8WVtbl JoystickWvt; static const IDirectInputDevice8WVtbl JoystickWvt;
struct JoyDev { struct JoyDev {
...@@ -453,7 +453,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm ...@@ -453,7 +453,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm
DIDEVICEINSTANCEW ddi; DIDEVICEINSTANCEW ddi;
HRESULT hr; HRESULT hr;
if (FAILED(hr = direct_input_device_alloc( sizeof(JoystickImpl), &JoystickWvt, &JoystickAvt, rguid, dinput, (void **)&newDevice ))) if (FAILED(hr = direct_input_device_alloc( sizeof(JoystickImpl), &JoystickWvt, rguid, dinput, (void **)&newDevice )))
return hr; return hr;
newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->base.crit"); newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->base.crit");
...@@ -1302,42 +1302,6 @@ static HRESULT WINAPI JoystickWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, ...@@ -1302,42 +1302,6 @@ static HRESULT WINAPI JoystickWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface,
return DI_OK; return DI_OK;
} }
static const IDirectInputDevice8AVtbl JoystickAvt =
{
IDirectInputDevice2AImpl_QueryInterface,
IDirectInputDevice2AImpl_AddRef,
IDirectInputDevice2AImpl_Release,
IDirectInputDevice2AImpl_GetCapabilities,
IDirectInputDevice2AImpl_EnumObjects,
IDirectInputDevice2AImpl_GetProperty,
IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire,
IDirectInputDevice2AImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData,
IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification,
IDirectInputDevice2AImpl_SetCooperativeLevel,
IDirectInputDevice2AImpl_GetObjectInfo,
IDirectInputDevice2AImpl_GetDeviceInfo,
IDirectInputDevice2AImpl_RunControlPanel,
IDirectInputDevice2AImpl_Initialize,
IDirectInputDevice2AImpl_CreateEffect,
IDirectInputDevice2AImpl_EnumEffects,
IDirectInputDevice2AImpl_GetEffectInfo,
IDirectInputDevice2AImpl_GetForceFeedbackState,
IDirectInputDevice2AImpl_SendForceFeedbackCommand,
IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
IDirectInputDevice2AImpl_Escape,
IDirectInputDevice2AImpl_Poll,
IDirectInputDevice2AImpl_SendDeviceData,
IDirectInputDevice7AImpl_EnumEffectsInFile,
IDirectInputDevice7AImpl_WriteEffectToFile,
IDirectInputDevice8AImpl_BuildActionMap,
IDirectInputDevice8AImpl_SetActionMap,
IDirectInputDevice8AImpl_GetImageInfo
};
static const IDirectInputDevice8WVtbl JoystickWvt = static const IDirectInputDevice8WVtbl JoystickWvt =
{ {
IDirectInputDevice2WImpl_QueryInterface, IDirectInputDevice2WImpl_QueryInterface,
......
...@@ -101,7 +101,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); ...@@ -101,7 +101,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);
static CFMutableArrayRef device_main_elements = NULL; static CFMutableArrayRef device_main_elements = NULL;
typedef struct JoystickImpl JoystickImpl; typedef struct JoystickImpl JoystickImpl;
static const IDirectInputDevice8AVtbl JoystickAvt;
static const IDirectInputDevice8WVtbl JoystickWvt; static const IDirectInputDevice8WVtbl JoystickWvt;
struct JoystickImpl struct JoystickImpl
...@@ -1120,7 +1119,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm ...@@ -1120,7 +1119,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm
TRACE( "%s %p %p %hu\n", debugstr_guid( rguid ), dinput, out, index ); TRACE( "%s %p %p %hu\n", debugstr_guid( rguid ), dinput, out, index );
if (FAILED(hr = direct_input_device_alloc( sizeof(JoystickImpl), &JoystickWvt, &JoystickAvt, rguid, dinput, (void **)&newDevice ))) if (FAILED(hr = direct_input_device_alloc( sizeof(JoystickImpl), &JoystickWvt, rguid, dinput, (void **)&newDevice )))
return hr; return hr;
newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->generic.base.crit"); newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->generic.base.crit");
...@@ -1553,42 +1552,6 @@ const struct dinput_device joystick_osx_device = { ...@@ -1553,42 +1552,6 @@ const struct dinput_device joystick_osx_device = {
joydev_create_device joydev_create_device
}; };
static const IDirectInputDevice8AVtbl JoystickAvt =
{
IDirectInputDevice2AImpl_QueryInterface,
IDirectInputDevice2AImpl_AddRef,
IDirectInputDevice2AImpl_Release,
IDirectInputDevice2AImpl_GetCapabilities,
IDirectInputDevice2AImpl_EnumObjects,
IDirectInputDevice2AImpl_GetProperty,
IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire,
IDirectInputDevice2AImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData,
IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification,
IDirectInputDevice2AImpl_SetCooperativeLevel,
IDirectInputDevice2AImpl_GetObjectInfo,
IDirectInputDevice2AImpl_GetDeviceInfo,
IDirectInputDevice2AImpl_RunControlPanel,
IDirectInputDevice2AImpl_Initialize,
IDirectInputDevice2AImpl_CreateEffect,
IDirectInputDevice2AImpl_EnumEffects,
IDirectInputDevice2AImpl_GetEffectInfo,
IDirectInputDevice2AImpl_GetForceFeedbackState,
IDirectInputDevice2AImpl_SendForceFeedbackCommand,
IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
IDirectInputDevice2AImpl_Escape,
IDirectInputDevice2AImpl_Poll,
IDirectInputDevice2AImpl_SendDeviceData,
IDirectInputDevice7AImpl_EnumEffectsInFile,
IDirectInputDevice7AImpl_WriteEffectToFile,
IDirectInputDevice8AImpl_BuildActionMap,
IDirectInputDevice8AImpl_SetActionMap,
IDirectInputDevice8AImpl_GetImageInfo
};
static const IDirectInputDevice8WVtbl JoystickWvt = static const IDirectInputDevice8WVtbl JoystickWvt =
{ {
IDirectInputDevice2WImpl_QueryInterface, IDirectInputDevice2WImpl_QueryInterface,
......
...@@ -40,7 +40,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); ...@@ -40,7 +40,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);
#define WINE_DINPUT_KEYBOARD_MAX_KEYS 256 #define WINE_DINPUT_KEYBOARD_MAX_KEYS 256
static const IDirectInputDevice8AVtbl SysKeyboardAvt;
static const IDirectInputDevice8WVtbl SysKeyboardWvt; static const IDirectInputDevice8WVtbl SysKeyboardWvt;
typedef struct SysKeyboardImpl SysKeyboardImpl; typedef struct SysKeyboardImpl SysKeyboardImpl;
...@@ -247,7 +246,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysKeyboar ...@@ -247,7 +246,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysKeyboar
int i, idx = 0; int i, idx = 0;
HRESULT hr; HRESULT hr;
if (FAILED(hr = direct_input_device_alloc( sizeof(SysKeyboardImpl), &SysKeyboardWvt, &SysKeyboardAvt, rguid, dinput, (void **)&newDevice ))) if (FAILED(hr = direct_input_device_alloc( sizeof(SysKeyboardImpl), &SysKeyboardWvt, rguid, dinput, (void **)&newDevice )))
return hr; return hr;
newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysKeyboardImpl*->base.crit"); newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysKeyboardImpl*->base.crit");
...@@ -558,42 +557,6 @@ static HRESULT WINAPI SysKeyboardWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, ...@@ -558,42 +557,6 @@ static HRESULT WINAPI SysKeyboardWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
return _set_action_map(iface, lpdiaf, lpszUserName, dwFlags, &c_dfDIKeyboard); return _set_action_map(iface, lpdiaf, lpszUserName, dwFlags, &c_dfDIKeyboard);
} }
static const IDirectInputDevice8AVtbl SysKeyboardAvt =
{
IDirectInputDevice2AImpl_QueryInterface,
IDirectInputDevice2AImpl_AddRef,
IDirectInputDevice2AImpl_Release,
IDirectInputDevice2AImpl_GetCapabilities,
IDirectInputDevice2AImpl_EnumObjects,
IDirectInputDevice2AImpl_GetProperty,
IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire,
IDirectInputDevice2AImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData,
IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification,
IDirectInputDevice2AImpl_SetCooperativeLevel,
IDirectInputDevice2AImpl_GetObjectInfo,
IDirectInputDevice2AImpl_GetDeviceInfo,
IDirectInputDevice2AImpl_RunControlPanel,
IDirectInputDevice2AImpl_Initialize,
IDirectInputDevice2AImpl_CreateEffect,
IDirectInputDevice2AImpl_EnumEffects,
IDirectInputDevice2AImpl_GetEffectInfo,
IDirectInputDevice2AImpl_GetForceFeedbackState,
IDirectInputDevice2AImpl_SendForceFeedbackCommand,
IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
IDirectInputDevice2AImpl_Escape,
IDirectInputDevice2AImpl_Poll,
IDirectInputDevice2AImpl_SendDeviceData,
IDirectInputDevice7AImpl_EnumEffectsInFile,
IDirectInputDevice7AImpl_WriteEffectToFile,
IDirectInputDevice8AImpl_BuildActionMap,
IDirectInputDevice8AImpl_SetActionMap,
IDirectInputDevice8AImpl_GetImageInfo
};
static const IDirectInputDevice8WVtbl SysKeyboardWvt = static const IDirectInputDevice8WVtbl SysKeyboardWvt =
{ {
IDirectInputDevice2WImpl_QueryInterface, IDirectInputDevice2WImpl_QueryInterface,
......
...@@ -47,7 +47,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); ...@@ -47,7 +47,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);
#define WINE_MOUSE_Z_AXIS_INSTANCE 2 #define WINE_MOUSE_Z_AXIS_INSTANCE 2
#define WINE_MOUSE_BUTTONS_INSTANCE 3 #define WINE_MOUSE_BUTTONS_INSTANCE 3
static const IDirectInputDevice8AVtbl SysMouseAvt;
static const IDirectInputDevice8WVtbl SysMouseWvt; static const IDirectInputDevice8WVtbl SysMouseWvt;
typedef struct SysMouseImpl SysMouseImpl; typedef struct SysMouseImpl SysMouseImpl;
...@@ -193,7 +192,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysMouseIm ...@@ -193,7 +192,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysMouseIm
HKEY hkey, appkey; HKEY hkey, appkey;
HRESULT hr; HRESULT hr;
if (FAILED(hr = direct_input_device_alloc( sizeof(SysMouseImpl), &SysMouseWvt, &SysMouseAvt, rguid, dinput, (void **)&newDevice ))) if (FAILED(hr = direct_input_device_alloc( sizeof(SysMouseImpl), &SysMouseWvt, rguid, dinput, (void **)&newDevice )))
return hr; return hr;
newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit"); newDevice->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit");
...@@ -809,42 +808,6 @@ static HRESULT WINAPI SysMouseWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface, ...@@ -809,42 +808,6 @@ static HRESULT WINAPI SysMouseWImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface,
return _set_action_map(iface, lpdiaf, lpszUserName, dwFlags, &c_dfDIMouse2); return _set_action_map(iface, lpdiaf, lpszUserName, dwFlags, &c_dfDIMouse2);
} }
static const IDirectInputDevice8AVtbl SysMouseAvt =
{
IDirectInputDevice2AImpl_QueryInterface,
IDirectInputDevice2AImpl_AddRef,
IDirectInputDevice2AImpl_Release,
IDirectInputDevice2AImpl_GetCapabilities,
IDirectInputDevice2AImpl_EnumObjects,
IDirectInputDevice2AImpl_GetProperty,
IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire,
IDirectInputDevice2AImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData,
IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification,
IDirectInputDevice2AImpl_SetCooperativeLevel,
IDirectInputDevice2AImpl_GetObjectInfo,
IDirectInputDevice2AImpl_GetDeviceInfo,
IDirectInputDevice2AImpl_RunControlPanel,
IDirectInputDevice2AImpl_Initialize,
IDirectInputDevice2AImpl_CreateEffect,
IDirectInputDevice2AImpl_EnumEffects,
IDirectInputDevice2AImpl_GetEffectInfo,
IDirectInputDevice2AImpl_GetForceFeedbackState,
IDirectInputDevice2AImpl_SendForceFeedbackCommand,
IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
IDirectInputDevice2AImpl_Escape,
IDirectInputDevice2AImpl_Poll,
IDirectInputDevice2AImpl_SendDeviceData,
IDirectInputDevice7AImpl_EnumEffectsInFile,
IDirectInputDevice7AImpl_WriteEffectToFile,
IDirectInputDevice8AImpl_BuildActionMap,
IDirectInputDevice8AImpl_SetActionMap,
IDirectInputDevice8AImpl_GetImageInfo
};
static const IDirectInputDevice8WVtbl SysMouseWvt = static const IDirectInputDevice8WVtbl SysMouseWvt =
{ {
IDirectInputDevice2WImpl_QueryInterface, IDirectInputDevice2WImpl_QueryInterface,
......
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