Commit 1d314d54 authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

dinput: Move joystick user data format into base class.

parent 3446caab
......@@ -102,7 +102,6 @@ struct JoystickImpl
/* joystick private */
int joyfd;
DIJOYSTATE2 js; /* wine data */
LPDIDATAFORMAT user_df; /* user defined format */
ObjProps *props;
char *name;
DIDEVCAPS devcaps;
......@@ -465,21 +464,6 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice->axis_map[i] = i;
}
/* wine uses DIJOYSTATE2 as it's internal format so copy
* the already defined format c_dfDIJoystick2 */
newDevice->user_df = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwSize);
if (newDevice->user_df == 0)
goto FAILED;
CopyMemory(newDevice->user_df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize);
/* copy default objects */
newDevice->user_df->rgodf = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwNumObjs*c_dfDIJoystick2.dwObjSize);
if (newDevice->user_df->rgodf == 0)
goto FAILED;
CopyMemory(newDevice->user_df->rgodf,c_dfDIJoystick2.rgodf,c_dfDIJoystick2.dwNumObjs*c_dfDIJoystick2.dwObjSize);
/* create default properties */
newDevice->props = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwNumObjs*sizeof(ObjProps));
if (newDevice->props == 0)
......@@ -493,8 +477,11 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice->props[i].lSaturation = 0;
}
/* wine uses DIJOYSTATE2 as it's internal format */
newDevice->base.data_format.wine_df = &c_dfDIJoystick2;
/* create the default transform filter */
hr = create_DataFormat(&c_dfDIJoystick2, newDevice->user_df, &newDevice->base.data_format);
hr = create_DataFormat(&c_dfDIJoystick2, &c_dfDIJoystick2, &newDevice->base.data_format);
if (hr != DI_OK) goto FAILED;
IDirectInputDevice_AddRef((LPDIRECTINPUTDEVICE8A)newDevice->dinput);
......@@ -512,7 +499,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice->devcaps.dwFFDriverVersion = 0;
if (TRACE_ON(dinput)) {
_dump_DIDATAFORMAT(newDevice->user_df);
_dump_DIDATAFORMAT(newDevice->base.data_format.user_df);
for (i = 0; i < (newDevice->axes); i++)
TRACE("axis_map[%d] = %d\n", i, newDevice->axis_map[i]);
_dump_DIDEVCAPS(&newDevice->devcaps);
......@@ -525,11 +512,10 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
FAILED:
hr = DIERR_OUTOFMEMORY;
FAILED1:
release_DataFormat(&newDevice->base.data_format);
HeapFree(GetProcessHeap(),0,newDevice->axis_map);
HeapFree(GetProcessHeap(),0,newDevice->name);
HeapFree(GetProcessHeap(),0,newDevice->props);
HeapFree(GetProcessHeap(),0,newDevice->user_df->rgodf);
HeapFree(GetProcessHeap(),0,newDevice->user_df);
HeapFree(GetProcessHeap(),0,newDevice);
*pdev = 0;
......@@ -620,10 +606,6 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
/* Free the data queue */
HeapFree(GetProcessHeap(), 0, This->base.data_queue);
/* Free the DataFormat */
HeapFree(GetProcessHeap(), 0, This->user_df->rgodf);
HeapFree(GetProcessHeap(), 0, This->user_df);
/* Free the properties */
HeapFree(GetProcessHeap(), 0, This->props);
......@@ -648,52 +630,19 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat(
{
JoystickImpl *This = (JoystickImpl *)iface;
unsigned int i;
LPDIDATAFORMAT new_df = 0;
LPDIOBJECTDATAFORMAT new_rgodf = 0;
ObjProps * new_props = 0;
HRESULT hr;
TRACE("(%p,%p)\n",This,df);
if (df == NULL) {
WARN("invalid pointer\n");
return E_POINTER;
}
if (df->dwSize != sizeof(*df)) {
WARN("invalid argument\n");
return DIERR_INVALIDPARAM;
}
if (This->base.acquired) {
WARN("acquired\n");
return DIERR_ACQUIRED;
}
if (TRACE_ON(dinput))
_dump_DIDATAFORMAT(df);
/* Store the new data format */
new_df = HeapAlloc(GetProcessHeap(),0,df->dwSize);
if (new_df == 0)
goto FAILED;
new_rgodf = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*df->dwObjSize);
if (new_rgodf == 0)
goto FAILED;
hr = IDirectInputDevice2AImpl_SetDataFormat(iface, df);
if (FAILED(hr)) return hr;
new_props = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*sizeof(ObjProps));
if (new_props == 0)
goto FAILED;
if (!new_props) return DIERR_OUTOFMEMORY;
HeapFree(GetProcessHeap(),0,This->user_df);
HeapFree(GetProcessHeap(),0,This->user_df->rgodf);
HeapFree(GetProcessHeap(),0,This->props);
release_DataFormat(&This->base.data_format);
This->user_df = new_df;
CopyMemory(This->user_df, df, df->dwSize);
This->user_df->rgodf = new_rgodf;
CopyMemory(This->user_df->rgodf,df->rgodf,df->dwNumObjs*df->dwObjSize);
This->props = new_props;
for (i = 0; i < df->dwNumObjs; i++) {
This->props[i].lMin = 0;
......@@ -701,15 +650,8 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat(
This->props[i].lDeadZone = 1000;
This->props[i].lSaturation = 0;
}
if (create_DataFormat(&c_dfDIJoystick2, This->user_df, &This->base.data_format) == DI_OK)
return DI_OK;
FAILED:
WARN("out of memory\n");
HeapFree(GetProcessHeap(),0,new_props);
HeapFree(GetProcessHeap(),0,new_rgodf);
HeapFree(GetProcessHeap(),0,new_df);
return DIERR_OUTOFMEMORY;
return DI_OK;
}
/******************************************************************************
......@@ -839,7 +781,7 @@ static void joy_polldev(JoystickImpl *This) {
int number = This->axis_map[jse.number]; /* wine format object index */
if (number < 12) {
int offset = This->base.data_format.offsets[number];
int index = offset_to_object(This->user_df, offset);
int index = offset_to_object(This->base.data_format.user_df, offset);
LONG value = map_axis(This, jse.value, index);
/* FIXME do deadzone and saturation here */
......@@ -962,12 +904,12 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(
LPCDIPROPRANGE pr = (LPCDIPROPRANGE)ph;
if (ph->dwHow == DIPH_DEVICE) {
TRACE("proprange(%d,%d) all\n", pr->lMin, pr->lMax);
for (i = 0; i < This->user_df->dwNumObjs; i++) {
for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++) {
This->props[i].lMin = pr->lMin;
This->props[i].lMax = pr->lMax;
}
} else {
int obj = find_property(This->user_df, ph);
int obj = find_property(This->base.data_format.user_df, ph);
TRACE("proprange(%d,%d) obj=%d\n", pr->lMin, pr->lMax, obj);
if (obj >= 0) {
This->props[obj].lMin = pr->lMin;
......@@ -981,10 +923,10 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
if (ph->dwHow == DIPH_DEVICE) {
TRACE("deadzone(%d) all\n", pd->dwData);
for (i = 0; i < This->user_df->dwNumObjs; i++)
for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++)
This->props[i].lDeadZone = pd->dwData;
} else {
int obj = find_property(This->user_df, ph);
int obj = find_property(This->base.data_format.user_df, ph);
TRACE("deadzone(%d) obj=%d\n", pd->dwData, obj);
if (obj >= 0) {
This->props[obj].lDeadZone = pd->dwData;
......@@ -997,10 +939,10 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
if (ph->dwHow == DIPH_DEVICE) {
TRACE("saturation(%d) all\n", pd->dwData);
for (i = 0; i < This->user_df->dwNumObjs; i++)
for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++)
This->props[i].lSaturation = pd->dwData;
} else {
int obj = find_property(This->user_df, ph);
int obj = find_property(This->base.data_format.user_df, ph);
TRACE("saturation(%d) obj=%d\n", pd->dwData, obj);
if (obj >= 0) {
This->props[obj].lSaturation = pd->dwData;
......@@ -1145,19 +1087,19 @@ static HRESULT WINAPI JoystickAImpl_EnumObjects(
}
if (wine_obj < 8) {
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);
user_object = offset_to_object(This->base.data_format.user_df, user_offset);
ddoi.dwType = This->user_df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->user_df->rgodf[user_object].dwOfs;
ddoi.dwType = This->base.data_format.user_df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->base.data_format.user_df->rgodf[user_object].dwOfs;
sprintf(ddoi.tszName, "Axis %d", axes);
axes++;
} else {
if (pov[wine_obj - 8] < 2) {
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);
user_object = offset_to_object(This->base.data_format.user_df, user_offset);
ddoi.dwType = This->user_df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->user_df->rgodf[user_object].dwOfs;
ddoi.dwType = This->base.data_format.user_df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->base.data_format.user_df->rgodf[user_object].dwOfs;
sprintf(ddoi.tszName, "POV %d", povs);
povs++;
} else
......@@ -1179,10 +1121,10 @@ static HRESULT WINAPI JoystickAImpl_EnumObjects(
for (i = 0; i < This->buttons; i++) {
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);
user_object = offset_to_object(This->base.data_format.user_df, user_offset);
ddoi.guidType = GUID_Button;
ddoi.dwType = This->user_df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->user_df->rgodf[user_object].dwOfs;
ddoi.dwType = This->base.data_format.user_df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->base.data_format.user_df->rgodf[user_object].dwOfs;
sprintf(ddoi.tszName, "Button %d", i);
_dump_OBJECTINSTANCEA(&ddoi);
if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
......@@ -1230,7 +1172,7 @@ static HRESULT WINAPI JoystickAImpl_GetProperty(
switch (LOWORD(rguid)) {
case (DWORD) DIPROP_RANGE: {
LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph;
int obj = find_property(This->user_df, pdiph);
int obj = find_property(This->base.data_format.user_df, pdiph);
/* The app is querying the current range of the axis
* return the lMin and lMax values */
if (obj >= 0) {
......@@ -1243,7 +1185,7 @@ static HRESULT WINAPI JoystickAImpl_GetProperty(
}
case (DWORD) DIPROP_DEADZONE: {
LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
int obj = find_property(This->user_df, pdiph);
int obj = find_property(This->base.data_format.user_df, pdiph);
if (obj >= 0) {
pd->dwData = This->props[obj].lDeadZone;
TRACE("deadzone(%d) obj=%d\n", pd->dwData, obj);
......@@ -1253,7 +1195,7 @@ static HRESULT WINAPI JoystickAImpl_GetProperty(
}
case (DWORD) DIPROP_SATURATION: {
LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
int obj = find_property(This->user_df, pdiph);
int obj = find_property(This->base.data_format.user_df, pdiph);
if (obj >= 0) {
pd->dwData = This->props[obj].lSaturation;
TRACE("saturation(%d) obj=%d\n", pd->dwData, obj);
......@@ -1310,33 +1252,33 @@ HRESULT WINAPI JoystickAImpl_GetObjectInfo(
int axis = 0;
int pov = 0;
int button = 0;
for (i = 0; i < This->user_df->dwNumObjs; i++) {
if (This->user_df->rgodf[i].dwOfs == dwObj) {
if (This->user_df->rgodf[i].pguid)
didoiA.guidType = *This->user_df->rgodf[i].pguid;
for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++) {
if (This->base.data_format.user_df->rgodf[i].dwOfs == dwObj) {
if (This->base.data_format.user_df->rgodf[i].pguid)
didoiA.guidType = *This->base.data_format.user_df->rgodf[i].pguid;
else
didoiA.guidType = GUID_NULL;
didoiA.dwOfs = dwObj;
didoiA.dwType = This->user_df->rgodf[i].dwType;
didoiA.dwFlags = This->user_df->rgodf[i].dwFlags;
didoiA.dwType = This->base.data_format.user_df->rgodf[i].dwType;
didoiA.dwFlags = This->base.data_format.user_df->rgodf[i].dwFlags;
if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_AXIS)
if (DIDFT_GETTYPE(This->base.data_format.user_df->rgodf[i].dwType) & DIDFT_AXIS)
sprintf(didoiA.tszName, "Axis %d", axis);
else if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_POV)
else if (DIDFT_GETTYPE(This->base.data_format.user_df->rgodf[i].dwType) & DIDFT_POV)
sprintf(didoiA.tszName, "POV %d", pov);
else if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_BUTTON)
else if (DIDFT_GETTYPE(This->base.data_format.user_df->rgodf[i].dwType) & DIDFT_BUTTON)
sprintf(didoiA.tszName, "Button %d", button);
CopyMemory(pdidoi, &didoiA, pdidoi->dwSize);
return DI_OK;
}
if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_AXIS)
if (DIDFT_GETTYPE(This->base.data_format.user_df->rgodf[i].dwType) & DIDFT_AXIS)
axis++;
else if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_POV)
else if (DIDFT_GETTYPE(This->base.data_format.user_df->rgodf[i].dwType) & DIDFT_POV)
pov++;
else if (DIDFT_GETTYPE(This->user_df->rgodf[i].dwType) & DIDFT_BUTTON)
else if (DIDFT_GETTYPE(This->base.data_format.user_df->rgodf[i].dwType) & DIDFT_BUTTON)
button++;
}
break;
......
......@@ -136,7 +136,6 @@ struct JoystickImpl
int joyfd;
LPDIDATAFORMAT df;
DIJOYSTATE2 js;
/* Force feedback variables */
......@@ -389,26 +388,13 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
}
fake_current_js_state(newDevice);
/* wine uses DIJOYSTATE2 as it's internal format so copy
* the already defined format c_dfDIJoystick2 */
newDevice->df = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwSize);
if (newDevice->df == 0)
goto FAILED;
CopyMemory(newDevice->df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize);
/* copy default objects */
newDevice->df->rgodf = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwNumObjs*c_dfDIJoystick2.dwObjSize);
if (newDevice->df->rgodf == 0)
goto FAILED;
CopyMemory(newDevice->df->rgodf,c_dfDIJoystick2.rgodf,c_dfDIJoystick2.dwNumObjs*c_dfDIJoystick2.dwObjSize);
/* wine uses DIJOYSTATE2 as it's internal format */
newDevice->base.data_format.wine_df = &c_dfDIJoystick2;
/* create the default transform filter */
if (create_DataFormat(&c_dfDIJoystick2, newDevice->df, &newDevice->base.data_format) == DI_OK)
if (create_DataFormat(&c_dfDIJoystick2, &c_dfDIJoystick2, &newDevice->base.data_format) == DI_OK)
return newDevice;
FAILED:
HeapFree(GetProcessHeap(),0,newDevice->df->rgodf);
HeapFree(GetProcessHeap(),0,newDevice->df);
HeapFree(GetProcessHeap(),0,newDevice);
return NULL;
}
......@@ -502,10 +488,6 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
/* Free the data queue */
HeapFree(GetProcessHeap(), 0, This->base.data_queue);
/* Free the DataFormat */
HeapFree(GetProcessHeap(), 0, This->df->rgodf);
HeapFree(GetProcessHeap(), 0, This->df);
/* release the data transform filter */
release_DataFormat(&This->base.data_format);
......@@ -516,55 +498,6 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
}
/******************************************************************************
* SetDataFormat : the application can choose the format of the data
* the device driver sends back with GetDeviceState.
*/
static HRESULT WINAPI JoystickAImpl_SetDataFormat(
LPDIRECTINPUTDEVICE8A iface,LPCDIDATAFORMAT df
)
{
JoystickImpl *This = (JoystickImpl *)iface;
TRACE("(this=%p,%p)\n",This,df);
if (df == NULL) {
WARN("invalid pointer\n");
return E_POINTER;
}
if (df->dwSize != sizeof(*df)) {
WARN("invalid argument\n");
return DIERR_INVALIDPARAM;
}
_dump_DIDATAFORMAT(df);
if (This->joyfd!=-1) {
WARN("acquired\n");
return DIERR_ACQUIRED;
}
HeapFree(GetProcessHeap(),0,This->df->rgodf);
HeapFree(GetProcessHeap(),0,This->df);
release_DataFormat(&This->base.data_format);
/* Store the new data format */
This->df = HeapAlloc(GetProcessHeap(),0,df->dwSize);
if (This->df==NULL) {
return DIERR_OUTOFMEMORY;
}
memcpy(This->df, df, df->dwSize);
This->df->rgodf = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*df->dwObjSize);
if (This->df->rgodf==NULL) {
HeapFree(GetProcessHeap(), 0, This->df);
return DIERR_OUTOFMEMORY;
}
memcpy(This->df->rgodf,df->rgodf,df->dwNumObjs*df->dwObjSize);
return create_DataFormat(&c_dfDIJoystick2, This->df, &This->base.data_format);
}
/******************************************************************************
* Acquire : gets exclusive control of the joystick
*/
static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
......@@ -574,9 +507,6 @@ static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
TRACE("(this=%p)\n",This);
if (This->df==NULL) {
return DIERR_INVALIDPARAM;
}
res = IDirectInputDevice2AImpl_Acquire(iface);
if (res==DI_OK) {
if (-1==(This->joyfd=open(This->joydev->device,O_RDWR))) {
......@@ -910,12 +840,12 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface,
if (ph->dwHow == DIPH_DEVICE) {
int i;
TRACE("proprange(%d,%d) all\n", pr->lMin, pr->lMax);
for (i = 0; i < This->df->dwNumObjs; i++) {
for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++) {
This->wantmin[i] = pr->lMin;
This->wantmax[i] = pr->lMax;
}
} else {
int obj = find_property(This->df, ph);
int obj = find_property(This->base.data_format.user_df, ph);
TRACE("proprange(%d,%d) obj=%d\n", pr->lMin, pr->lMax, obj);
if (obj >= 0) {
This->wantmin[obj] = pr->lMin;
......@@ -930,11 +860,11 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface,
if (ph->dwHow == DIPH_DEVICE) {
int i;
TRACE("deadzone(%d) all\n", pd->dwData);
for (i = 0; i < This->df->dwNumObjs; i++) {
for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++) {
This->deadz[i] = pd->dwData;
}
} else {
int obj = find_property(This->df, ph);
int obj = find_property(This->base.data_format.user_df, ph);
TRACE("deadzone(%d) obj=%d\n", pd->dwData, obj);
if (obj >= 0) {
This->deadz[obj] = pd->dwData;
......@@ -1093,9 +1023,9 @@ static HRESULT WINAPI JoystickAImpl_EnumObjects(
if ((user_offset = lxinput_to_user_offset(This, EV_ABS, i)) == -1) {
continue;
}
user_object = offset_to_object(This->df, user_offset);
ddoi.dwType = This->df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->df->rgodf[user_object].dwOfs;
user_object = offset_to_object(This->base.data_format.user_df, user_offset);
ddoi.dwType = This->base.data_format.user_df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->base.data_format.user_df->rgodf[user_object].dwOfs;
/* Linux event force feedback supports only (and always) x and y axes */
if (i == ABS_X || i == ABS_Y) {
if (This->joydev->has_ff)
......@@ -1118,9 +1048,9 @@ static HRESULT WINAPI JoystickAImpl_EnumObjects(
if ((user_offset = lxinput_to_user_offset(This, EV_ABS, ABS_HAT0X+i))== -1) {
continue;
}
user_object = offset_to_object(This->df, user_offset);
ddoi.dwType = This->df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->df->rgodf[user_object].dwOfs;
user_object = offset_to_object(This->base.data_format.user_df, user_offset);
ddoi.dwType = This->base.data_format.user_df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->base.data_format.user_df->rgodf[user_object].dwOfs;
sprintf(ddoi.tszName, "%d-POV", i);
_dump_OBJECTINSTANCEA(&ddoi);
if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) {
......@@ -1143,9 +1073,9 @@ static HRESULT WINAPI JoystickAImpl_EnumObjects(
if ((user_offset = lxinput_to_user_offset(This, EV_KEY, btncount)) == -1) {
continue;
}
user_object = offset_to_object(This->df, user_offset);
ddoi.dwType = This->df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->df->rgodf[user_object].dwOfs;
user_object = offset_to_object(This->base.data_format.user_df, user_offset);
ddoi.dwType = This->base.data_format.user_df->rgodf[user_object].dwType & 0x00ffffff;
ddoi.dwOfs = This->base.data_format.user_df->rgodf[user_object].dwOfs;
sprintf(ddoi.tszName, "%d-Button", btncount);
btncount++;
_dump_OBJECTINSTANCEA(&ddoi);
......@@ -1192,7 +1122,7 @@ static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
switch (LOWORD(rguid)) {
case (DWORD) DIPROP_RANGE: {
LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph;
int obj = find_property(This->df, pdiph);
int obj = find_property(This->base.data_format.user_df, pdiph);
if (obj >= 0) {
pr->lMin = This->joydev->havemin[obj];
pr->lMax = This->joydev->havemax[obj];
......@@ -1555,7 +1485,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
JoystickAImpl_Unacquire,
JoystickAImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData,
JoystickAImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification,
IDirectInputDevice2AImpl_SetCooperativeLevel,
IDirectInputDevice2AImpl_GetObjectInfo,
......@@ -1597,7 +1527,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
XCAST(Unacquire)JoystickAImpl_Unacquire,
XCAST(GetDeviceState)JoystickAImpl_GetDeviceState,
XCAST(GetDeviceData)IDirectInputDevice2AImpl_GetDeviceData,
XCAST(SetDataFormat)JoystickAImpl_SetDataFormat,
XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
IDirectInputDevice2WImpl_GetObjectInfo,
......
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