[DINPUT] Fix Tribes
Lionel Ulmer
lionel.ulmer at free.fr
Thu Jun 3 15:34:12 CDT 2004
Changelog:
- some new logging on device enumeration
- fix version setting in DirectInputCreate(A/W) functions
--
Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
? dlls/dinput/dinput.dll-UQrvOo.spec.c
Index: dlls/dinput/dinput_main.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/dinput_main.c,v
retrieving revision 1.39
diff -u -r1.39 dinput_main.c
--- dlls/dinput/dinput_main.c 6 Apr 2004 20:09:46 -0000 1.39
+++ dlls/dinput/dinput_main.c 3 Jun 2004 20:32:36 -0000
@@ -162,6 +162,12 @@
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
This->lpVtbl = &ddi7avt;
This->ref = 1;
+ if (dwVersion >= 0x0800) {
+ This->version = 8;
+ } else {
+ /* We do not differientiate between version 1, 2 and 7 */
+ This->version = 1;
+ }
*ppDI = (IDirectInputA*)This;
return 0;
@@ -177,9 +183,50 @@
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
This->lpVtbl = &ddi7wvt;
This->ref = 1;
+ if (dwVersion >= 0x0800) {
+ This->version = 8;
+ } else {
+ /* We do not differientiate between version 1, 2 and 7 */
+ This->version = 1;
+ }
*ppDI = (IDirectInputW*)This;
return 0;
+}
+static char *_dump_DIDEVTYPE_value(DWORD dwDevType) {
+ switch (dwDevType) {
+ case 0: return "All devices";
+ case DIDEVTYPE_MOUSE: return "DIDEVTYPE_MOUSE";
+ case DIDEVTYPE_KEYBOARD: return "DIDEVTYPE_KEYBOARD";
+ case DIDEVTYPE_JOYSTICK: return "DIDEVTYPE_JOYSTICK";
+ case DIDEVTYPE_DEVICE: return "DIDEVTYPE_DEVICE";
+ default: return "Unkown";
+ }
+}
+
+static void _dump_EnumDevices_dwFlags(DWORD dwFlags) {
+ if (TRACE_ON(dinput)) {
+ int i;
+ static const struct {
+ DWORD mask;
+ const char *name;
+ } flags[] = {
+#define FE(x) { x, #x}
+ FE(DIEDFL_ALLDEVICES),
+ FE(DIEDFL_ATTACHEDONLY),
+ FE(DIEDFL_FORCEFEEDBACK),
+ FE(DIEDFL_INCLUDEALIASES),
+ FE(DIEDFL_INCLUDEPHANTOMS)
+#undef FE
+ };
+ if (dwFlags == 0) {
+ DPRINTF("DIEDFL_ALLDEVICES");
+ return;
+ }
+ for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++)
+ if (flags[i].mask & dwFlags)
+ DPRINTF("%s ",flags[i].name);
+ }
}
/******************************************************************************
@@ -189,21 +236,25 @@
LPDIRECTINPUT7A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback,
LPVOID pvRef, DWORD dwFlags)
{
- ICOM_THIS(IDirectInputImpl,iface);
- DIDEVICEINSTANCEA devInstance;
- int i;
-
- TRACE("(this=%p,0x%04lx,%p,%p,%04lx)\n", This, dwDevType, lpCallback, pvRef, dwFlags);
-
- for (i = 0; i < nrof_dinput_devices; i++) {
- devInstance.dwSize = sizeof(devInstance);
- if (dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->version)) {
+ ICOM_THIS(IDirectInputImpl,iface);
+ DIDEVICEINSTANCEA devInstance;
+ int i;
+
+ TRACE("(this=%p,0x%04lx '%s',%p,%p,%04lx)\n",
+ This, dwDevType, _dump_DIDEVTYPE_value(dwDevType),
+ lpCallback, pvRef, dwFlags);
+ TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n");
+
+ for (i = 0; i < nrof_dinput_devices; i++) {
+ devInstance.dwSize = sizeof(devInstance);
+ TRACE(" - checking device %d ('%s')\n", i, dinput_devices[i]->name);
+ if (dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->version)) {
if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
- return 0;
- }
+ return 0;
}
-
- return 0;
+ }
+
+ return 0;
}
/******************************************************************************
* IDirectInputW_EnumDevices
@@ -212,21 +263,25 @@
LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback,
LPVOID pvRef, DWORD dwFlags)
{
- ICOM_THIS(IDirectInputImpl,iface);
- DIDEVICEINSTANCEW devInstance;
- int i;
-
- TRACE("(this=%p,0x%04lx,%p,%p,%04lx)\n", This, dwDevType, lpCallback, pvRef, dwFlags);
-
- for (i = 0; i < nrof_dinput_devices; i++) {
- devInstance.dwSize = sizeof(devInstance);
- if (dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->version)) {
+ ICOM_THIS(IDirectInputImpl,iface);
+ DIDEVICEINSTANCEW devInstance;
+ int i;
+
+ TRACE("(this=%p,0x%04lx '%s',%p,%p,%04lx)\n",
+ This, dwDevType, _dump_DIDEVTYPE_value(dwDevType),
+ lpCallback, pvRef, dwFlags);
+ TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n");
+
+ for (i = 0; i < nrof_dinput_devices; i++) {
+ devInstance.dwSize = sizeof(devInstance);
+ TRACE(" - checking device %d ('%s')\n", i, dinput_devices[i]->name);
+ if (dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->version)) {
if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
- return 0;
- }
+ return 0;
}
-
- return 0;
+ }
+
+ return 0;
}
static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface)
Index: dlls/dinput/dinput_private.h
===================================================================
RCS file: /home/wine/wine/dlls/dinput/dinput_private.h,v
retrieving revision 1.11
diff -u -r1.11 dinput_private.h
--- dlls/dinput/dinput_private.h 5 Sep 2003 23:08:40 -0000 1.11
+++ dlls/dinput/dinput_private.h 3 Jun 2004 20:32:36 -0000
@@ -40,11 +40,12 @@
/* Function called by all devices that Wine supports */
typedef struct dinput_device {
- INT pref;
- BOOL (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version);
- BOOL (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version);
- HRESULT (*create_deviceA)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev);
- HRESULT (*create_deviceW)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev);
+ INT pref;
+ const char *name;
+ BOOL (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version);
+ BOOL (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version);
+ HRESULT (*create_deviceA)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev);
+ HRESULT (*create_deviceW)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev);
} dinput_device;
extern void dinput_register_device(dinput_device *device);
Index: dlls/dinput/joystick_linux.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/joystick_linux.c,v
retrieving revision 1.4
diff -u -r1.4 joystick_linux.c
--- dlls/dinput/joystick_linux.c 2 Jun 2004 00:36:54 -0000 1.4
+++ dlls/dinput/joystick_linux.c 3 Jun 2004 20:32:36 -0000
@@ -219,6 +219,7 @@
static dinput_device joydev = {
10,
+ "Wine Linux joystick driver",
joydev_enum_deviceA,
joydev_enum_deviceW,
joydev_create_deviceA,
Index: dlls/dinput/joystick_linuxinput.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/joystick_linuxinput.c,v
retrieving revision 1.5
diff -u -r1.5 joystick_linuxinput.c
--- dlls/dinput/joystick_linuxinput.c 2 Jun 2004 00:36:54 -0000 1.5
+++ dlls/dinput/joystick_linuxinput.c 3 Jun 2004 20:32:37 -0000
@@ -310,6 +310,7 @@
static dinput_device joydev = {
20,
+ "Wine Linux-input joystick driver",
joydev_enum_deviceA,
joydev_enum_deviceW,
joydev_create_deviceA,
Index: dlls/dinput/keyboard.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/keyboard.c,v
retrieving revision 1.2
diff -u -r1.2 keyboard.c
--- dlls/dinput/keyboard.c 12 Apr 2004 22:07:12 -0000 1.2
+++ dlls/dinput/keyboard.c 3 Jun 2004 20:32:37 -0000
@@ -285,6 +285,7 @@
static dinput_device keyboarddev = {
100,
+ "Wine keyboard driver",
keyboarddev_enum_deviceA,
keyboarddev_enum_deviceW,
keyboarddev_create_deviceA,
Index: dlls/dinput/mouse.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/mouse.c,v
retrieving revision 1.2
diff -u -r1.2 mouse.c
--- dlls/dinput/mouse.c 2 Jun 2004 00:36:54 -0000 1.2
+++ dlls/dinput/mouse.c 3 Jun 2004 20:32:37 -0000
@@ -300,6 +300,7 @@
}
static dinput_device mousedev = {
100,
+ "Wine mouse driver",
mousedev_enum_deviceA,
mousedev_enum_deviceW,
mousedev_create_deviceA,
More information about the wine-patches
mailing list