- some new logging on device enumeration
- fix version setting in DirectInputCreate(A/W) functions
This commit is contained in:
parent
667ac7ff5e
commit
4f640697bd
|
@ -162,6 +162,12 @@ HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPU
|
||||||
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||||
This->lpVtbl = &ddi7avt;
|
This->lpVtbl = &ddi7avt;
|
||||||
This->ref = 1;
|
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;
|
*ppDI = (IDirectInputA*)This;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -177,9 +183,50 @@ HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPU
|
||||||
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||||
This->lpVtbl = &ddi7wvt;
|
This->lpVtbl = &ddi7wvt;
|
||||||
This->ref = 1;
|
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;
|
*ppDI = (IDirectInputW*)This;
|
||||||
return 0;
|
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 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices(
|
||||||
LPDIRECTINPUT7A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback,
|
LPDIRECTINPUT7A iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKA lpCallback,
|
||||||
LPVOID pvRef, DWORD dwFlags)
|
LPVOID pvRef, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
ICOM_THIS(IDirectInputImpl,iface);
|
ICOM_THIS(IDirectInputImpl,iface);
|
||||||
DIDEVICEINSTANCEA devInstance;
|
DIDEVICEINSTANCEA devInstance;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
TRACE("(this=%p,0x%04lx,%p,%p,%04lx)\n", This, dwDevType, lpCallback, pvRef, dwFlags);
|
TRACE("(this=%p,0x%04lx '%s',%p,%p,%04lx)\n",
|
||||||
|
This, dwDevType, _dump_DIDEVTYPE_value(dwDevType),
|
||||||
for (i = 0; i < nrof_dinput_devices; i++) {
|
lpCallback, pvRef, dwFlags);
|
||||||
devInstance.dwSize = sizeof(devInstance);
|
TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n");
|
||||||
if (dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->version)) {
|
|
||||||
|
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)
|
if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* IDirectInputW_EnumDevices
|
* IDirectInputW_EnumDevices
|
||||||
|
@ -212,21 +263,25 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
|
||||||
LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback,
|
LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback,
|
||||||
LPVOID pvRef, DWORD dwFlags)
|
LPVOID pvRef, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
ICOM_THIS(IDirectInputImpl,iface);
|
ICOM_THIS(IDirectInputImpl,iface);
|
||||||
DIDEVICEINSTANCEW devInstance;
|
DIDEVICEINSTANCEW devInstance;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
TRACE("(this=%p,0x%04lx,%p,%p,%04lx)\n", This, dwDevType, lpCallback, pvRef, dwFlags);
|
TRACE("(this=%p,0x%04lx '%s',%p,%p,%04lx)\n",
|
||||||
|
This, dwDevType, _dump_DIDEVTYPE_value(dwDevType),
|
||||||
for (i = 0; i < nrof_dinput_devices; i++) {
|
lpCallback, pvRef, dwFlags);
|
||||||
devInstance.dwSize = sizeof(devInstance);
|
TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n");
|
||||||
if (dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->version)) {
|
|
||||||
|
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)
|
if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface)
|
static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface)
|
||||||
|
|
|
@ -40,11 +40,12 @@ struct IDirectInputImpl
|
||||||
|
|
||||||
/* Function called by all devices that Wine supports */
|
/* Function called by all devices that Wine supports */
|
||||||
typedef struct dinput_device {
|
typedef struct dinput_device {
|
||||||
INT pref;
|
INT pref;
|
||||||
BOOL (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version);
|
const char *name;
|
||||||
BOOL (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version);
|
BOOL (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version);
|
||||||
HRESULT (*create_deviceA)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev);
|
BOOL (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version);
|
||||||
HRESULT (*create_deviceW)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev);
|
HRESULT (*create_deviceA)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev);
|
||||||
|
HRESULT (*create_deviceW)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev);
|
||||||
} dinput_device;
|
} dinput_device;
|
||||||
|
|
||||||
extern void dinput_register_device(dinput_device *device);
|
extern void dinput_register_device(dinput_device *device);
|
||||||
|
|
|
@ -219,6 +219,7 @@ static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, RE
|
||||||
|
|
||||||
static dinput_device joydev = {
|
static dinput_device joydev = {
|
||||||
10,
|
10,
|
||||||
|
"Wine Linux joystick driver",
|
||||||
joydev_enum_deviceA,
|
joydev_enum_deviceA,
|
||||||
joydev_enum_deviceW,
|
joydev_enum_deviceW,
|
||||||
joydev_create_deviceA,
|
joydev_create_deviceA,
|
||||||
|
|
|
@ -310,6 +310,7 @@ static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, RE
|
||||||
|
|
||||||
static dinput_device joydev = {
|
static dinput_device joydev = {
|
||||||
20,
|
20,
|
||||||
|
"Wine Linux-input joystick driver",
|
||||||
joydev_enum_deviceA,
|
joydev_enum_deviceA,
|
||||||
joydev_enum_deviceW,
|
joydev_enum_deviceW,
|
||||||
joydev_create_deviceA,
|
joydev_create_deviceA,
|
||||||
|
|
|
@ -285,6 +285,7 @@ static HRESULT keyboarddev_create_deviceW(IDirectInputImpl *dinput, REFGUID rgui
|
||||||
|
|
||||||
static dinput_device keyboarddev = {
|
static dinput_device keyboarddev = {
|
||||||
100,
|
100,
|
||||||
|
"Wine keyboard driver",
|
||||||
keyboarddev_enum_deviceA,
|
keyboarddev_enum_deviceA,
|
||||||
keyboarddev_enum_deviceW,
|
keyboarddev_enum_deviceW,
|
||||||
keyboarddev_create_deviceA,
|
keyboarddev_create_deviceA,
|
||||||
|
|
|
@ -300,6 +300,7 @@ static HRESULT mousedev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid,
|
||||||
}
|
}
|
||||||
static dinput_device mousedev = {
|
static dinput_device mousedev = {
|
||||||
100,
|
100,
|
||||||
|
"Wine mouse driver",
|
||||||
mousedev_enum_deviceA,
|
mousedev_enum_deviceA,
|
||||||
mousedev_enum_deviceW,
|
mousedev_enum_deviceW,
|
||||||
mousedev_create_deviceA,
|
mousedev_create_deviceA,
|
||||||
|
|
Loading…
Reference in New Issue