Added device type constants and used them in device enumeration

function.
oldstable
Lionel Ulmer 1998-11-08 14:24:04 +00:00 committed by Alexandre Julliard
parent 877634420f
commit 12de3ea346
2 changed files with 53 additions and 17 deletions

View File

@ -117,6 +117,43 @@ typedef struct SysMouse32A SysMouse32A,*LPSYSMOUSE32A;
#define DIERR_UNPLUGGED 0x80040209L
#define DIERR_REPORTFULL 0x8004020AL
#define DIENUM_STOP 0
#define DIENUM_CONTINUE 1
#define DIDEVTYPE_DEVICE 1
#define DIDEVTYPE_MOUSE 2
#define DIDEVTYPE_KEYBOARD 3
#define DIDEVTYPE_JOYSTICK 4
#define DIDEVTYPE_HID 0x00010000
#define DIDEVTYPEMOUSE_UNKNOWN 1
#define DIDEVTYPEMOUSE_TRADITIONAL 2
#define DIDEVTYPEMOUSE_FINGERSTICK 3
#define DIDEVTYPEMOUSE_TOUCHPAD 4
#define DIDEVTYPEMOUSE_TRACKBALL 5
#define DIDEVTYPEKEYBOARD_UNKNOWN 0
#define DIDEVTYPEKEYBOARD_PCXT 1
#define DIDEVTYPEKEYBOARD_OLIVETTI 2
#define DIDEVTYPEKEYBOARD_PCAT 3
#define DIDEVTYPEKEYBOARD_PCENH 4
#define DIDEVTYPEKEYBOARD_NOKIA1050 5
#define DIDEVTYPEKEYBOARD_NOKIA9140 6
#define DIDEVTYPEKEYBOARD_NEC98 7
#define DIDEVTYPEKEYBOARD_NEC98LAPTOP 8
#define DIDEVTYPEKEYBOARD_NEC98106 9
#define DIDEVTYPEKEYBOARD_JAPAN106 10
#define DIDEVTYPEKEYBOARD_JAPANAX 11
#define DIDEVTYPEKEYBOARD_J3100 12
#define DIDEVTYPEJOYSTICK_UNKNOWN 1
#define DIDEVTYPEJOYSTICK_TRADITIONAL 2
#define DIDEVTYPEJOYSTICK_FLIGHTSTICK 3
#define DIDEVTYPEJOYSTICK_GAMEPAD 4
#define DIDEVTYPEJOYSTICK_RUDDER 5
#define DIDEVTYPEJOYSTICK_WHEEL 6
#define DIDEVTYPEJOYSTICK_HEADTRACKER 7
typedef struct {
DWORD dwSize;
GUID guidType;

View File

@ -36,6 +36,7 @@
#include "win.h"
#include "dinput.h"
#include "debug.h"
#include "message.h"
extern BYTE InputKeyStateTable[256];
extern int min_keycode, max_keycode;
@ -69,38 +70,36 @@ static HRESULT WINAPI IDirectInputA_EnumDevices(
TRACE(dinput, "(this=%p,0x%04lx,%p,%p,%04lx)\n", this, dwDevType, lpCallback, pvRef, dwFlags);
#if 0 /* Not compiled for the moment as long as I do not find
the needed constants */
/* Ignore this field for the moment */
if (dwDevType != 0) {
FIXME(dinput, "device filtering not supported.\n");
}
devInstance.dwSize = sizeof(DIDEVICEINSTANCE32A);
if ((dwDevType == 0) || (dwDevType == DIDEVTYPE_KEYBOARD)) {
/* Return keyboard */
devInstance.guidInstance = GUID_SysKeyboard;
devInstance.guidProduct = GUID_SysKeyboard;
devInstance.dwDevType = 1; /* Constant unknown :-( */
devInstance.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
strcpy(devInstance.tszInstanceName, "Keyboard");
strcpy(devInstance.tszProductName, "Wine Keyboard");
ret = lpCallback(&devInstance, pvRef);
TRACE(dinput, "Keyboard registered (%d)\n", ret);
TRACE(dinput, "Keyboard registered\n");
if (!ret)
if (ret == DIENUM_STOP)
return 0;
}
if ((dwDevType == 0) || (dwDevType == DIDEVTYPE_KEYBOARD)) {
/* Return mouse */
devInstance.guidInstance = GUID_SysMouse;
devInstance.guidProduct = GUID_SysMouse;
devInstance.dwDevType = 2; /* Constant unknown :-( */
devInstance.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_UNKNOWN << 8);
strcpy(devInstance.tszInstanceName, "Mouse");
strcpy(devInstance.tszProductName, "Wine Mouse");
ret = lpCallback(&devInstance, pvRef);
TRACE(dinput, "Mouse registered (%d)\n", ret);
#endif
TRACE(dinput, "Mouse registered\n");
}
/* Should also do joystick enumerations.... */
return 0;
}
@ -263,12 +262,12 @@ static HRESULT WINAPI IDirectInputDeviceA_GetDeviceData(
static HRESULT WINAPI IDirectInputDeviceA_Acquire(LPDIRECTINPUTDEVICE32A this) {
FIXME(dinput,"(this=%p): stub\n",this);
TRACE(dinput,"(this=%p): stub\n",this);
return 0;
}
static HRESULT WINAPI IDirectInputDeviceA_Unacquire(LPDIRECTINPUTDEVICE32A this) {
FIXME(dinput,"(this=%p): stub\n",this);
TRACE(dinput,"(this=%p): stub\n",this);
return 0;
}
@ -373,12 +372,12 @@ static HRESULT WINAPI SysKeyboardA_GetDeviceData(
}
static HRESULT WINAPI SysKeyboardA_Acquire(LPDIRECTINPUTDEVICE32A this) {
FIXME(dinput,"(this=%p): stub\n",this);
TRACE(dinput,"(this=%p): stub\n",this);
return 0;
}
static HRESULT WINAPI SysKeyboardA_Unacquire(LPDIRECTINPUTDEVICE32A this) {
FIXME(dinput,"(this=%p): stub\n",this);
TRACE(dinput,"(this=%p): stub\n",this);
return 0;
}