dinput: Move transform and offsets structures into base device class.

This commit is contained in:
Vitaliy Margolen 2006-12-12 08:57:54 -07:00 committed by Alexandre Julliard
parent 21be6a6c80
commit cd050bf25c
5 changed files with 114 additions and 119 deletions

View file

@ -282,9 +282,12 @@ void fill_DataFormat(void *out, const void *in, DataFormat *df) {
void release_DataFormat(DataFormat * format)
{
TRACE("Deleting DataTransform :\n");
TRACE("Deleting DataFormat: %p\n", format);
HeapFree(GetProcessHeap(), 0, format->dt);
format->dt = NULL;
HeapFree(GetProcessHeap(), 0, format->offsets);
format->offsets = NULL;
}
/* Make all instances sequential */
@ -329,9 +332,8 @@ static void calculate_ids(LPDIDATAFORMAT df)
}
}
DataFormat *create_DataFormat(LPCDIDATAFORMAT wine_format, LPDIDATAFORMAT asked_format, int *offset)
HRESULT create_DataFormat(LPCDIDATAFORMAT wine_format, LPDIDATAFORMAT asked_format, DataFormat *format)
{
DataFormat *ret;
DataTransform *dt;
unsigned int i, j;
int same = 1;
@ -339,18 +341,18 @@ DataFormat *create_DataFormat(LPCDIDATAFORMAT wine_format, LPDIDATAFORMAT asked_
int index = 0;
DWORD next = 0;
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
done = HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs);
memset(done, 0, sizeof(int) * asked_format->dwNumObjs);
done = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, asked_format->dwNumObjs * sizeof(int));
dt = HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform));
if (!dt || !done) goto failed;
if (!(format->offsets = HeapAlloc(GetProcessHeap(), 0, wine_format->dwNumObjs * sizeof(int))))
goto failed;
TRACE("Creating DataTransform :\n");
for (i = 0; i < wine_format->dwNumObjs; i++) {
offset[i] = -1;
format->offsets[i] = -1;
for (j = 0; j < asked_format->dwNumObjs; j++) {
if (done[j] == 1)
continue;
@ -397,7 +399,7 @@ DataFormat *create_DataFormat(LPCDIDATAFORMAT wine_format, LPDIDATAFORMAT asked_
dt[index].size = sizeof(DWORD);
dt[index].offset_in = wine_format->rgodf[i].dwOfs;
dt[index].offset_out = asked_format->rgodf[j].dwOfs;
offset[i] = asked_format->rgodf[j].dwOfs;
format->offsets[i] = asked_format->rgodf[j].dwOfs;
dt[index].value = 0;
next = next + dt[index].size;
@ -437,20 +439,28 @@ DataFormat *create_DataFormat(LPCDIDATAFORMAT wine_format, LPDIDATAFORMAT asked_
}
}
ret->internal_format_size = wine_format->dwDataSize;
ret->size = index;
format->internal_format_size = wine_format->dwDataSize;
format->size = index;
if (same) {
ret->dt = NULL;
HeapFree(GetProcessHeap(), 0, dt);
} else {
ret->dt = dt;
dt = NULL;
}
format->dt = dt;
HeapFree(GetProcessHeap(), 0, done);
/* Last step - reset all instances of the new format */
calculate_ids(asked_format);
return ret;
return DI_OK;
failed:
HeapFree(GetProcessHeap(), 0, done);
HeapFree(GetProcessHeap(), 0, dt);
format->dt = NULL;
HeapFree(GetProcessHeap(), 0, format->offsets);
format->offsets = NULL;
return DIERR_OUTOFMEMORY;
}
/* find an object by it's offset in a data format */

View file

@ -26,6 +26,23 @@
#include "winbase.h"
#include "dinput.h"
typedef struct
{
int size;
int offset_in;
int offset_out;
int value;
} DataTransform;
typedef struct
{
int size;
int internal_format_size;
DataTransform *dt;
int *offsets; /* object offsets */
} DataFormat;
/* Device implementation */
typedef struct IDirectInputDevice2AImpl IDirectInputDevice2AImpl;
struct IDirectInputDevice2AImpl
@ -44,23 +61,13 @@ struct IDirectInputDevice2AImpl
int queue_head; /* position to write new event into queue */
int queue_tail; /* next event to read from queue */
BOOL overflow; /* return DI_BUFFEROVERFLOW in 'GetDeviceData' */
DataFormat data_format; /* user data format and wine to user format converter */
};
/* Routines to do DataFormat / WineFormat conversions */
typedef struct {
int size;
int offset_in;
int offset_out;
int value;
} DataTransform;
typedef struct {
int size;
int internal_format_size;
DataTransform *dt;
} DataFormat;
extern void fill_DataFormat(void *out, const void *in, DataFormat *df) ;
extern DataFormat *create_DataFormat(LPCDIDATAFORMAT wine_format, LPDIDATAFORMAT asked_format, int *offset);
extern HRESULT create_DataFormat(LPCDIDATAFORMAT wine_format, LPDIDATAFORMAT asked_format, DataFormat *format);
extern void release_DataFormat(DataFormat *df) ;
extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int ofs, DWORD data, DWORD time, DWORD seq);
/* Helper functions to work with data format */

View file

@ -103,8 +103,6 @@ struct JoystickImpl
int joyfd;
DIJOYSTATE2 js; /* wine data */
LPDIDATAFORMAT user_df; /* user defined format */
DataFormat *transform; /* wine to user format converter */
int *offsets; /* object offsets */
ObjProps *props;
char *name;
DIDEVCAPS devcaps;
@ -495,13 +493,9 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice->props[i].lSaturation = 0;
}
/* create an offsets array */
newDevice->offsets = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,c_dfDIJoystick2.dwNumObjs*sizeof(int));
if (newDevice->offsets == 0)
goto FAILED;
/* create the default transform filter */
newDevice->transform = create_DataFormat(&c_dfDIJoystick2, newDevice->user_df, newDevice->offsets);
hr = create_DataFormat(&c_dfDIJoystick2, newDevice->user_df, &newDevice->base.data_format);
if (hr != DI_OK) goto FAILED;
IDirectInputDevice_AddRef((LPDIRECTINPUTDEVICE8A)newDevice->dinput);
@ -633,11 +627,8 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
/* Free the properties */
HeapFree(GetProcessHeap(), 0, This->props);
/* Free the offsets array */
HeapFree(GetProcessHeap(),0,This->offsets);
/* release the data transform filter */
release_DataFormat(This->transform);
release_DataFormat(&This->base.data_format);
This->base.crit.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->base.crit);
@ -697,7 +688,7 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat(
HeapFree(GetProcessHeap(),0,This->user_df);
HeapFree(GetProcessHeap(),0,This->user_df->rgodf);
HeapFree(GetProcessHeap(),0,This->props);
release_DataFormat(This->transform);
release_DataFormat(&This->base.data_format);
This->user_df = new_df;
CopyMemory(This->user_df, df, df->dwSize);
@ -710,9 +701,8 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat(
This->props[i].lDeadZone = 1000;
This->props[i].lSaturation = 0;
}
This->transform = create_DataFormat(&c_dfDIJoystick2, This->user_df, This->offsets);
return DI_OK;
if (create_DataFormat(&c_dfDIJoystick2, This->user_df, &This->base.data_format) == DI_OK)
return DI_OK;
FAILED:
WARN("out of memory\n");
@ -840,7 +830,7 @@ static void joy_polldev(JoystickImpl *This) {
TRACE("js_event: type 0x%x, number %d, value %d\n",
jse.type,jse.number,jse.value);
if (jse.type & JS_EVENT_BUTTON) {
int offset = This->offsets[jse.number + 12];
int offset = This->base.data_format.offsets[jse.number + 12];
int value = jse.value?0x80:0x00;
This->js.rgbButtons[jse.number] = value;
@ -848,7 +838,7 @@ static void joy_polldev(JoystickImpl *This) {
} else if (jse.type & JS_EVENT_AXIS) {
int number = This->axis_map[jse.number]; /* wine format object index */
if (number < 12) {
int offset = This->offsets[number];
int offset = This->base.data_format.offsets[number];
int index = offset_to_object(This->user_df, offset);
LONG value = map_axis(This, jse.value, index);
@ -940,7 +930,7 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceState(
joy_polldev(This);
/* convert and copy data to user supplied buffer */
fill_DataFormat(ptr, &This->js, This->transform);
fill_DataFormat(ptr, &This->js, &This->base.data_format);
return DI_OK;
}
@ -1154,7 +1144,7 @@ static HRESULT WINAPI JoystickAImpl_EnumObjects(
ddoi.guidType = GUID_Unknown;
}
if (wine_obj < 8) {
user_offset = This->offsets[wine_obj]; /* get user offset from wine index */
user_offset = This->base.data_format.offsets[wine_obj]; /* get user offset from wine index */
user_object = offset_to_object(This->user_df, user_offset);
ddoi.dwType = This->user_df->rgodf[user_object].dwType & 0x00ffffff;
@ -1163,7 +1153,7 @@ static HRESULT WINAPI JoystickAImpl_EnumObjects(
axes++;
} else {
if (pov[wine_obj - 8] < 2) {
user_offset = This->offsets[wine_obj]; /* get user offset from wine index */
user_offset = This->base.data_format.offsets[wine_obj]; /* get user offset from wine index */
user_object = offset_to_object(This->user_df, user_offset);
ddoi.dwType = This->user_df->rgodf[user_object].dwType & 0x00ffffff;
@ -1188,7 +1178,7 @@ static HRESULT WINAPI JoystickAImpl_EnumObjects(
ddoi.guidType = GUID_Button;
for (i = 0; i < This->buttons; i++) {
user_offset = This->offsets[i + 12]; /* get user offset from wine index */
user_offset = This->base.data_format.offsets[i + 12]; /* get user offset from wine index */
user_object = offset_to_object(This->user_df, user_offset);
ddoi.guidType = GUID_Button;
ddoi.dwType = This->user_df->rgodf[user_object].dwType & 0x00ffffff;

View file

@ -137,8 +137,6 @@ struct JoystickImpl
int joyfd;
LPDIDATAFORMAT df;
DataFormat *transform; /* wine to user format converter */
int *offsets; /* object offsets */
DIJOYSTATE2 js;
/* Force feedback variables */
@ -404,15 +402,9 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
goto FAILED;
CopyMemory(newDevice->df->rgodf,c_dfDIJoystick2.rgodf,c_dfDIJoystick2.dwNumObjs*c_dfDIJoystick2.dwObjSize);
/* create an offsets array */
newDevice->offsets = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,c_dfDIJoystick2.dwNumObjs*sizeof(int));
if (newDevice->offsets == 0)
goto FAILED;
/* create the default transform filter */
newDevice->transform = create_DataFormat(&c_dfDIJoystick2, newDevice->df, newDevice->offsets);
return newDevice;
if (create_DataFormat(&c_dfDIJoystick2, newDevice->df, &newDevice->base.data_format) == DI_OK)
return newDevice;
FAILED:
HeapFree(GetProcessHeap(),0,newDevice->df->rgodf);
@ -514,11 +506,8 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
HeapFree(GetProcessHeap(), 0, This->df->rgodf);
HeapFree(GetProcessHeap(), 0, This->df);
/* Free the offsets array */
HeapFree(GetProcessHeap(),0,This->offsets);
/* release the data transform filter */
release_DataFormat(This->transform);
release_DataFormat(&This->base.data_format);
DeleteCriticalSection(&This->base.crit);
@ -557,7 +546,7 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat(
HeapFree(GetProcessHeap(),0,This->df->rgodf);
HeapFree(GetProcessHeap(),0,This->df);
release_DataFormat(This->transform);
release_DataFormat(&This->base.data_format);
/* Store the new data format */
This->df = HeapAlloc(GetProcessHeap(),0,df->dwSize);
@ -572,9 +561,7 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat(
}
memcpy(This->df->rgodf,df->rgodf,df->dwNumObjs*df->dwObjSize);
This->transform = create_DataFormat(&c_dfDIJoystick2, This->df, This->offsets);
return DI_OK;
return create_DataFormat(&c_dfDIJoystick2, This->df, &This->base.data_format);
}
/******************************************************************************
@ -744,7 +731,7 @@ lxinput_to_user_offset(JoystickImpl *This, int ie_type, int ie_code )
FIXME("Unhandled type(0x%02X)\n", ie_type);
return -1;
}
return This->offsets[offset];
return This->base.data_format.offsets[offset];
}
/* convert wine format offset to user format object index */
@ -892,7 +879,7 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceState(
joy_polldev(This);
/* convert and copy data to user supplied buffer */
fill_DataFormat(ptr, &This->js, This->transform);
fill_DataFormat(ptr, &This->js, &This->base.data_format);
return DI_OK;
}

View file

@ -87,9 +87,9 @@ static const DIOBJECTDATAFORMAT Wine_InternalMouseObjectFormat[WINE_INTERNALMOUS
};
static const DIDATAFORMAT Wine_InternalMouseFormat = {
0, /* dwSize - unused */
0, /* dwObjsize - unused */
0, /* dwFlags - unused */
sizeof(DIDATAFORMAT),
sizeof(DIOBJECTDATAFORMAT),
DIDF_RELAXIS,
sizeof(Wine_InternalMouseData),
WINE_INTERNALMOUSE_NUM_OBJS, /* dwNumObjs */
(LPDIOBJECTDATAFORMAT) Wine_InternalMouseObjectFormat
@ -115,8 +115,6 @@ struct SysMouseImpl
/* The current data format and the conversion between internal
and external data formats */
DIDATAFORMAT *df;
DataFormat *wine_df;
int offset_array[WINE_INTERNALMOUSE_NUM_OBJS];
/* SysMouseAImpl */
BYTE absolute;
@ -231,32 +229,35 @@ static BOOL mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINST
static SysMouseImpl *alloc_device(REFGUID rguid, const void *mvt, IDirectInputImpl *dinput)
{
int offset_array[WINE_INTERNALMOUSE_NUM_OBJS] = {
FIELD_OFFSET(Wine_InternalMouseData, lX),
FIELD_OFFSET(Wine_InternalMouseData, lY),
FIELD_OFFSET(Wine_InternalMouseData, lZ),
FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 0,
FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 1,
FIELD_OFFSET(Wine_InternalMouseData, rgbButtons) + 2
};
SysMouseImpl* newDevice;
newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysMouseImpl));
if (!newDevice) return NULL;
newDevice->base.lpVtbl = mvt;
newDevice->base.ref = 1;
newDevice->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
memcpy(&newDevice->base.guid, rguid, sizeof(*rguid));
InitializeCriticalSection(&newDevice->base.crit);
/* Per default, Wine uses its internal data format */
newDevice->df = (DIDATAFORMAT *) &Wine_InternalMouseFormat;
memcpy(newDevice->offset_array, offset_array, WINE_INTERNALMOUSE_NUM_OBJS * sizeof(int));
newDevice->wine_df = HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
newDevice->wine_df->size = 0;
newDevice->wine_df->internal_format_size = Wine_InternalMouseFormat.dwDataSize;
newDevice->wine_df->dt = NULL;
newDevice->dinput = dinput;
return newDevice;
newDevice->df = HeapAlloc(GetProcessHeap(), 0, Wine_InternalMouseFormat.dwSize);
if (!newDevice->df) goto FAILED;
memcpy(newDevice->df, &Wine_InternalMouseFormat, Wine_InternalMouseFormat.dwSize);
/* copy default objects */
newDevice->df->rgodf = HeapAlloc(GetProcessHeap(), 0, Wine_InternalMouseFormat.dwNumObjs*Wine_InternalMouseFormat.dwObjSize);
if (!newDevice->df->rgodf) goto FAILED;
memcpy(newDevice->df->rgodf, Wine_InternalMouseFormat.rgodf, Wine_InternalMouseFormat.dwNumObjs*Wine_InternalMouseFormat.dwObjSize);
if (create_DataFormat(&Wine_InternalMouseFormat, newDevice->df, &newDevice->base.data_format) == DI_OK)
return newDevice;
FAILED:
if (newDevice->df)
HeapFree(GetProcessHeap(), 0, newDevice->df->rgodf);
HeapFree(GetProcessHeap(), 0, newDevice->df);
HeapFree(GetProcessHeap(), 0, newDevice);
return NULL;
}
static HRESULT mousedev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
@ -270,6 +271,7 @@ static HRESULT mousedev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid,
IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
*pdev = (IDirectInputDeviceA*) alloc_device(rguid, &SysMouseAvt, dinput);
TRACE("Creating a Mouse device (%p)\n", *pdev);
if (!*pdev) return DIERR_OUTOFMEMORY;
return DI_OK;
} else
return DIERR_NOINTERFACE;
@ -289,6 +291,7 @@ static HRESULT mousedev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid,
IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
*pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysMouseWvt, dinput);
TRACE("Creating a Mouse device (%p)\n", *pdev);
if (!*pdev) return DIERR_OUTOFMEMORY;
return DI_OK;
} else
return DIERR_NOINTERFACE;
@ -366,9 +369,7 @@ static HRESULT WINAPI SysMouseAImpl_SetDataFormat(
memcpy(This->df->rgodf,df->rgodf,df->dwNumObjs*df->dwObjSize);
/* Prepare all the data-conversion filters */
This->wine_df = create_DataFormat(&Wine_InternalMouseFormat, This->df, This->offset_array);
return DI_OK;
return create_DataFormat(&Wine_InternalMouseFormat, This->df, &This->base.data_format);
}
/* low-level mouse hook */
@ -387,10 +388,10 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara
if (wparam == WM_MOUSEMOVE) {
if (This->absolute) {
if (hook->pt.x != This->prevX)
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_X_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_X_POSITION],
hook->pt.x, hook->time, This->dinput->evsequence);
if (hook->pt.y != This->prevY)
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_Y_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_Y_POSITION],
hook->pt.y, hook->time, This->dinput->evsequence);
} else {
/* Now, warp handling */
@ -405,22 +406,22 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara
if ((This->need_warp == WARP_NEEDED) ||
(This->need_warp == WARP_STARTED)) {
if (hook->pt.x != This->prevX)
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_X_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_X_POSITION],
hook->pt.x - This->prevX, hook->time, This->dinput->evsequence);
if (hook->pt.y != This->prevY)
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_Y_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_Y_POSITION],
hook->pt.y - This->prevY, hook->time, This->dinput->evsequence);
} else {
/* This is the first time the event handler has been called after a
GetDeviceData or GetDeviceState. */
if (hook->pt.x != This->mapped_center.x) {
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_X_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_X_POSITION],
hook->pt.x - This->mapped_center.x, hook->time, This->dinput->evsequence);
This->need_warp = WARP_NEEDED;
}
if (hook->pt.y != This->mapped_center.y) {
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_Y_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_Y_POSITION],
hook->pt.y - This->mapped_center.y, hook->time, This->dinput->evsequence);
This->need_warp = WARP_NEEDED;
}
@ -444,38 +445,38 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara
switch(wparam) {
case WM_LBUTTONDOWN:
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_L_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_L_POSITION],
0x80, hook->time, This->dinput->evsequence);
This->m_state.rgbButtons[0] = 0x80;
break;
case WM_LBUTTONUP:
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_L_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_L_POSITION],
0x00, hook->time, This->dinput->evsequence);
This->m_state.rgbButtons[0] = 0x00;
break;
case WM_RBUTTONDOWN:
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_R_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_R_POSITION],
0x80, hook->time, This->dinput->evsequence);
This->m_state.rgbButtons[1] = 0x80;
break;
case WM_RBUTTONUP:
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_R_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_R_POSITION],
0x00, hook->time, This->dinput->evsequence);
This->m_state.rgbButtons[1] = 0x00;
break;
case WM_MBUTTONDOWN:
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_M_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_M_POSITION],
0x80, hook->time, This->dinput->evsequence);
This->m_state.rgbButtons[2] = 0x80;
break;
case WM_MBUTTONUP:
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_M_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_M_POSITION],
0x00, hook->time, This->dinput->evsequence);
This->m_state.rgbButtons[2] = 0x00;
break;
case WM_MOUSEWHEEL:
wdata = (short)HIWORD(hook->mouseData);
queue_event((LPDIRECTINPUTDEVICE8A)This, This->offset_array[WINE_MOUSE_Z_POSITION],
queue_event((LPDIRECTINPUTDEVICE8A)This, This->base.data_format.offsets[WINE_MOUSE_Z_POSITION],
wdata, hook->time, This->dinput->evsequence);
This->m_state.lZ += wdata;
break;
@ -634,7 +635,7 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]);
/* Copy the current mouse state */
fill_DataFormat(ptr, &(This->m_state), This->wine_df);
fill_DataFormat(ptr, &(This->m_state), &This->base.data_format);
/* Initialize the buffer when in relative mode */
if (This->absolute == 0) {
@ -835,7 +836,7 @@ static HRESULT WINAPI SysMouseAImpl_EnumObjects(
(dwFlags & DIDFT_AXIS)) {
/* X axis */
ddoi.guidType = GUID_XAxis;
ddoi.dwOfs = This->offset_array[WINE_MOUSE_X_POSITION];
ddoi.dwOfs = This->base.data_format.offsets[WINE_MOUSE_X_POSITION];
ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS;
strcpy(ddoi.tszName, "X-Axis");
_dump_OBJECTINSTANCEA(&ddoi);
@ -843,7 +844,7 @@ static HRESULT WINAPI SysMouseAImpl_EnumObjects(
/* Y axis */
ddoi.guidType = GUID_YAxis;
ddoi.dwOfs = This->offset_array[WINE_MOUSE_Y_POSITION];
ddoi.dwOfs = This->base.data_format.offsets[WINE_MOUSE_Y_POSITION];
ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS;
strcpy(ddoi.tszName, "Y-Axis");
_dump_OBJECTINSTANCEA(&ddoi);
@ -851,7 +852,7 @@ static HRESULT WINAPI SysMouseAImpl_EnumObjects(
/* Z axis */
ddoi.guidType = GUID_ZAxis;
ddoi.dwOfs = This->offset_array[WINE_MOUSE_Z_POSITION];
ddoi.dwOfs = This->base.data_format.offsets[WINE_MOUSE_Z_POSITION];
ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS;
strcpy(ddoi.tszName, "Z-Axis");
_dump_OBJECTINSTANCEA(&ddoi);
@ -863,21 +864,21 @@ static HRESULT WINAPI SysMouseAImpl_EnumObjects(
ddoi.guidType = GUID_Button;
/* Left button */
ddoi.dwOfs = This->offset_array[WINE_MOUSE_L_POSITION];
ddoi.dwOfs = This->base.data_format.offsets[WINE_MOUSE_L_POSITION];
ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_L_BUTTON_INSTANCE) | DIDFT_PSHBUTTON;
strcpy(ddoi.tszName, "Left-Button");
_dump_OBJECTINSTANCEA(&ddoi);
if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
/* Right button */
ddoi.dwOfs = This->offset_array[WINE_MOUSE_R_POSITION];
ddoi.dwOfs = This->base.data_format.offsets[WINE_MOUSE_R_POSITION];
ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_R_BUTTON_INSTANCE) | DIDFT_PSHBUTTON;
strcpy(ddoi.tszName, "Right-Button");
_dump_OBJECTINSTANCEA(&ddoi);
if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
/* Middle button */
ddoi.dwOfs = This->offset_array[WINE_MOUSE_M_POSITION];
ddoi.dwOfs = This->base.data_format.offsets[WINE_MOUSE_M_POSITION];
ddoi.dwType = DIDFT_MAKEINSTANCE(WINE_MOUSE_M_BUTTON_INSTANCE) | DIDFT_PSHBUTTON;
strcpy(ddoi.tszName, "Middle-Button");
_dump_OBJECTINSTANCEA(&ddoi);