[DINPUT] DX8 joysticks enumeration fix

Christian Costa titan.costa at wanadoo.fr
Mon Dec 6 12:54:06 CST 2004


Hi,

I remember someone complaining about Xplane & DX8.
This may help a little bit.

Bye,

Changelog:
Fixed enumeration of joysticks in DX8.
Fixed some traces.

Christian Costa   titan.costa at wanadoo.fr

-------------- next part --------------
Index: dinput_main.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/dinput_main.c,v
retrieving revision 1.48
diff -u -r1.48 dinput_main.c
--- dinput_main.c	7 Oct 2004 03:06:51 -0000	1.48
+++ dinput_main.c	6 Dec 2004 18:41:15 -0000
@@ -704,13 +704,13 @@
 HRESULT WINAPI DINPUT_DllGetClassObject(REFCLSID rclsid, REFIID riid,
 					LPVOID *ppv)
 {
-    TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
+    TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
     if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
     	*ppv = (LPVOID)&DINPUT_CF;
 	IClassFactory_AddRef((IClassFactory*)*ppv);
     return S_OK;
     }
 
-    FIXME("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
+    FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
     return CLASS_E_CLASSNOTAVAILABLE;
 }
Index: joystick_linux.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/joystick_linux.c,v
retrieving revision 1.17
diff -u -r1.17 joystick_linux.c
--- joystick_linux.c	17 Sep 2004 18:10:41 -0000	1.17
+++ joystick_linux.c	6 Dec 2004 18:41:18 -0000
@@ -157,7 +157,9 @@
         return FALSE;
     }
 
-    if ((dwDevType==0) || (GET_DIDEVICE_TYPE(dwDevType)==DIDEVTYPE_JOYSTICK)) {
+    if ((dwDevType == 0) ||
+	((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) ||
+	((dwDevType == DI8DEVTYPE_JOYSTICK) && (version >= 8))) {
         /* check whether we have a joystick */
         sprintf(dev, "%s%d", JOYDEV, id);
         if ((fd = open(dev,O_RDONLY)) < 0) {
@@ -205,7 +207,9 @@
         return FALSE;
     }
 
-    if ((dwDevType==0) || (GET_DIDEVICE_TYPE(dwDevType)==DIDEVTYPE_JOYSTICK)) {
+    if ((dwDevType == 0) ||
+	((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) ||
+	((dwDevType == DI8DEVTYPE_JOYSTICK) && (version >= 8))) {
         /* check whether we have a joystick */
         sprintf(dev, "%s%d", JOYDEV, id);
         if ((fd = open(dev,O_RDONLY)) < 0) {
Index: joystick_linuxinput.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/joystick_linuxinput.c,v
retrieving revision 1.12
diff -u -r1.12 joystick_linuxinput.c
--- joystick_linuxinput.c	17 Sep 2004 18:10:41 -0000	1.12
+++ joystick_linuxinput.c	6 Dec 2004 18:41:21 -0000
@@ -175,8 +175,10 @@
   if (id != 0)
       return FALSE;
 
-  if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK))
-      return FALSE;
+  if (!((dwDevType == 0) ||
+        ((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) ||
+        ((dwDevType == DI8DEVTYPE_JOYSTICK) && (version >= 8))))
+    return FALSE;
 
   if (dwFlags & DIEDFL_FORCEFEEDBACK)
     return FALSE;
@@ -211,8 +213,10 @@
   if (id != 0)
       return FALSE;
 
-  if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK))
-      return FALSE;
+  if (!((dwDevType == 0) ||
+        ((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) ||
+        ((dwDevType == DI8DEVTYPE_JOYSTICK) && (version >= 8))))
+    return FALSE;
 
   if (dwFlags & DIEDFL_FORCEFEEDBACK)
     return FALSE;


More information about the wine-patches mailing list