Handle DIJOYSTATE and DIJOYSTATE2 structs, fail on unknown sizes.

oldstable
Marcus Meissner 2004-01-05 21:11:25 +00:00 committed by Alexandre Julliard
parent 6db772cd2e
commit 871ef4491a
2 changed files with 7 additions and 5 deletions

View File

@ -82,7 +82,7 @@ struct JoystickImpl
LONG lMin,lMax,deadzone;
LPDIDEVICEOBJECTDATA data_queue;
int queue_head, queue_tail, queue_len;
DIJOYSTATE js;
DIJOYSTATE2 js;
};
static GUID DInput_Wine_Joystick_GUID = { /* 9e573ed9-7734-11d2-8d4a-23903fb6bdf7 */
@ -368,8 +368,9 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceState(
joy_polldev(This);
TRACE("(this=%p,0x%08lx,%p)\n",This,len,ptr);
if (len != sizeof(DIJOYSTATE)) {
if ((len != sizeof(DIJOYSTATE)) && (len != sizeof(DIJOYSTATE2))) {
FIXME("len %ld is not sizeof(DIJOYSTATE), unsupported format.\n",len);
return E_FAIL;
}
memcpy(ptr,&(This->js),len);
This->queue_head = 0;

View File

@ -98,7 +98,7 @@ struct JoystickImpl
HANDLE hEvent;
LPDIDEVICEOBJECTDATA data_queue;
int queue_head, queue_tail, queue_len;
DIJOYSTATE js;
DIJOYSTATE2 js;
/* data returned by the EVIOCGABS() ioctl */
int axes[ABS_MAX+1][5];
@ -561,8 +561,9 @@ static HRESULT WINAPI JoystickAImpl_GetDeviceState(
joy_polldev(This);
TRACE("(this=%p,0x%08lx,%p)\n",This,len,ptr);
if (len != sizeof(DIJOYSTATE)) {
FIXME("len %ld is not sizeof(DIJOYSTATE), unsupported format.\n",len);
if ((len != sizeof(DIJOYSTATE)) && (len != sizeof(DIJOYSTATE2))) {
FIXME("len %ld is not sizeof(DIJOYSTATE) or DIJOYSTATE2, unsupported format.\n",len);
return E_FAIL;
}
memcpy(ptr,&(This->js),len);
This->queue_head = 0;