PATCH: dinput joystick

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Bugreport 1684 reports that some programs use DIJOYSTATE2 structure in GetDeviceState.

No additional data is put into that structure, but it could now handle
force feedback, acceleration and velocity.

Ciao, Marcus

Changelog:
	Handle DIJOYSTATE and DIJOYSTATE2 structs, fail on unknown sizes.

Index: dlls/dinput/joystick/linux.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/joystick/linux.c,v
retrieving revision 1.18
diff -u -r1.18 linux.c
--- dlls/dinput/joystick/linux.c	30 Oct 2003 22:48:04 -0000	1.18
+++ dlls/dinput/joystick/linux.c	3 Jan 2004 10:54:24 -0000
@@ -82,7 +82,7 @@
 	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 @@
 
     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;
Index: dlls/dinput/joystick/linuxinput.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/joystick/linuxinput.c,v
retrieving revision 1.19
diff -u -r1.19 linuxinput.c
--- dlls/dinput/joystick/linuxinput.c	30 Oct 2003 22:48:04 -0000	1.19
+++ dlls/dinput/joystick/linuxinput.c	3 Jan 2004 10:54:24 -0000
@@ -98,7 +98,7 @@
         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 @@
     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;
-- 


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux