1 /* DirectInput Joystick device
3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998,1999 Lionel Ulmer
5 * Copyright 2000-2001 TransGaming Technologies Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/port.h"
39 #ifdef HAVE_SYS_TIME_H
40 # include <sys/time.h>
42 #include <sys/fcntl.h>
43 #ifdef HAVE_SYS_IOCTL_H
44 # include <sys/ioctl.h>
47 #ifdef HAVE_SYS_ERRNO_H
48 # include <sys/errno.h>
50 #ifdef HAVE_LINUX_IOCTL_H
51 # include <linux/ioctl.h>
53 #ifdef HAVE_LINUX_JOYSTICK_H
54 # include <linux/joystick.h>
57 #ifdef HAVE_SYS_POLL_H
58 # include <sys/poll.h>
61 #include "wine/debug.h"
62 #include "wine/unicode.h"
69 #include "dinput_private.h"
70 #include "device_private.h"
72 WINE_DEFAULT_DEBUG_CHANNEL(dinput
);
74 #ifdef HAVE_LINUX_22_JOYSTICK_API
76 #define JOYDEV_NEW "/dev/input/js"
77 #define JOYDEV_OLD "/dev/js"
91 typedef struct JoystickImpl JoystickImpl
;
92 static const IDirectInputDevice8AVtbl JoystickAvt
;
93 static const IDirectInputDevice8WVtbl JoystickWvt
;
96 struct IDirectInputDevice2AImpl base
;
100 /* The 'parent' DInput */
101 IDirectInputImpl
*dinput
;
103 /* joystick private */
105 DIJOYSTATE2 js
; /* wine data */
116 static const GUID DInput_Wine_Joystick_GUID
= { /* 9e573ed9-7734-11d2-8d4a-23903fb6bdf7 */
120 {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
123 static void _dump_DIDEVCAPS(const DIDEVCAPS
*lpDIDevCaps
)
125 TRACE("dwSize: %d\n", lpDIDevCaps
->dwSize
);
126 TRACE("dwFlags: %08x\n", lpDIDevCaps
->dwFlags
);
127 TRACE("dwDevType: %08x %s\n", lpDIDevCaps
->dwDevType
,
128 lpDIDevCaps
->dwDevType
== DIDEVTYPE_DEVICE
? "DIDEVTYPE_DEVICE" :
129 lpDIDevCaps
->dwDevType
== DIDEVTYPE_DEVICE
? "DIDEVTYPE_DEVICE" :
130 lpDIDevCaps
->dwDevType
== DIDEVTYPE_MOUSE
? "DIDEVTYPE_MOUSE" :
131 lpDIDevCaps
->dwDevType
== DIDEVTYPE_KEYBOARD
? "DIDEVTYPE_KEYBOARD" :
132 lpDIDevCaps
->dwDevType
== DIDEVTYPE_JOYSTICK
? "DIDEVTYPE_JOYSTICK" :
133 lpDIDevCaps
->dwDevType
== DIDEVTYPE_HID
? "DIDEVTYPE_HID" : "UNKNOWN");
134 TRACE("dwAxes: %d\n", lpDIDevCaps
->dwAxes
);
135 TRACE("dwButtons: %d\n", lpDIDevCaps
->dwButtons
);
136 TRACE("dwPOVs: %d\n", lpDIDevCaps
->dwPOVs
);
137 if (lpDIDevCaps
->dwSize
> sizeof(DIDEVCAPS_DX3
)) {
138 TRACE("dwFFSamplePeriod: %d\n", lpDIDevCaps
->dwFFSamplePeriod
);
139 TRACE("dwFFMinTimeResolution: %d\n", lpDIDevCaps
->dwFFMinTimeResolution
);
140 TRACE("dwFirmwareRevision: %d\n", lpDIDevCaps
->dwFirmwareRevision
);
141 TRACE("dwHardwareRevision: %d\n", lpDIDevCaps
->dwHardwareRevision
);
142 TRACE("dwFFDriverVersion: %d\n", lpDIDevCaps
->dwFFDriverVersion
);
146 #define MAX_JOYSTICKS 64
147 static INT joystick_devices_count
= -1;
148 static LPSTR joystick_devices
[MAX_JOYSTICKS
];
150 static INT
find_joystick_devices(void)
154 if (joystick_devices_count
!= -1) return joystick_devices_count
;
156 for (i
= 0; i
< MAX_JOYSTICKS
; i
++)
158 CHAR device_name
[MAX_PATH
], *str
;
162 len
= sprintf(device_name
, "%s%d", JOYDEV_NEW
, i
) + 1;
163 if ((fd
= open(device_name
, O_RDONLY
)) < 0)
165 len
= sprintf(device_name
, "%s%d", JOYDEV_OLD
, i
) + 1;
166 if ((fd
= open(device_name
, O_RDONLY
)) < 0) continue;
169 if (!(str
= HeapAlloc(GetProcessHeap(), 0, len
))) break;
170 memcpy(str
, device_name
, len
);
172 joystick_devices
[++joystick_devices_count
] = str
;
175 return joystick_devices_count
;
179 static BOOL
joydev_enum_deviceA(DWORD dwDevType
, DWORD dwFlags
, LPDIDEVICEINSTANCEA lpddi
, DWORD version
, int id
)
183 if (id
> find_joystick_devices()) return FALSE
;
185 if (dwFlags
& DIEDFL_FORCEFEEDBACK
) {
186 WARN("force feedback not supported\n");
190 if ((dwDevType
== 0) ||
191 ((dwDevType
== DIDEVTYPE_JOYSTICK
) && (version
> 0x0300 && version
< 0x0800)) ||
192 (((dwDevType
== DI8DEVCLASS_GAMECTRL
) || (dwDevType
== DI8DEVTYPE_JOYSTICK
)) && (version
>= 0x0800))) {
193 /* check whether we have a joystick */
194 if ((fd
= open(joystick_devices
[id
], O_RDONLY
)) < 0)
196 WARN("open(%s, O_RDONLY) failed: %s\n", joystick_devices
[id
], strerror(errno
));
200 /* Return joystick */
201 lpddi
->guidInstance
= DInput_Wine_Joystick_GUID
;
202 lpddi
->guidInstance
.Data3
= id
;
203 lpddi
->guidProduct
= DInput_Wine_Joystick_GUID
;
204 /* we only support traditional joysticks for now */
205 if (version
>= 0x0800)
206 lpddi
->dwDevType
= DI8DEVTYPE_JOYSTICK
| (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
208 lpddi
->dwDevType
= DIDEVTYPE_JOYSTICK
| (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
209 sprintf(lpddi
->tszInstanceName
, "Joystick %d", id
);
210 #if defined(JSIOCGNAME)
211 if (ioctl(fd
,JSIOCGNAME(sizeof(lpddi
->tszProductName
)),lpddi
->tszProductName
) < 0) {
212 WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", joystick_devices
[id
], strerror(errno
));
213 strcpy(lpddi
->tszProductName
, "Wine Joystick");
216 strcpy(lpddi
->tszProductName
, "Wine Joystick");
219 lpddi
->guidFFDriver
= GUID_NULL
;
221 TRACE("Enumerating the linux Joystick device: %s (%s)\n", joystick_devices
[id
], lpddi
->tszProductName
);
228 static BOOL
joydev_enum_deviceW(DWORD dwDevType
, DWORD dwFlags
, LPDIDEVICEINSTANCEW lpddi
, DWORD version
, int id
)
234 if (id
> find_joystick_devices()) return FALSE
;
236 if (dwFlags
& DIEDFL_FORCEFEEDBACK
) {
237 WARN("force feedback not supported\n");
241 if ((dwDevType
== 0) ||
242 ((dwDevType
== DIDEVTYPE_JOYSTICK
) && (version
> 0x0300 && version
< 0x0800)) ||
243 (((dwDevType
== DI8DEVCLASS_GAMECTRL
) || (dwDevType
== DI8DEVTYPE_JOYSTICK
)) && (version
>= 0x0800))) {
244 /* check whether we have a joystick */
245 if ((fd
= open(joystick_devices
[id
], O_RDONLY
)) < 0)
247 WARN("open(%s,O_RDONLY) failed: %s\n", joystick_devices
[id
], strerror(errno
));
251 /* Return joystick */
252 lpddi
->guidInstance
= DInput_Wine_Joystick_GUID
;
253 lpddi
->guidInstance
.Data3
= id
;
254 lpddi
->guidProduct
= DInput_Wine_Joystick_GUID
;
255 /* we only support traditional joysticks for now */
256 if (version
>= 0x0800)
257 lpddi
->dwDevType
= DI8DEVTYPE_JOYSTICK
| (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
259 lpddi
->dwDevType
= DIDEVTYPE_JOYSTICK
| (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
260 sprintf(friendly
, "Joystick %d", id
);
261 MultiByteToWideChar(CP_ACP
, 0, friendly
, -1, lpddi
->tszInstanceName
, MAX_PATH
);
262 #if defined(JSIOCGNAME)
263 if (ioctl(fd
,JSIOCGNAME(sizeof(name
)),name
) < 0) {
264 WARN("ioctl(%s, JSIOCGNAME) failed: %s\n", joystick_devices
[id
], strerror(errno
));
265 strcpy(name
, "Wine Joystick");
268 strcpy(name
, "Wine Joystick");
270 MultiByteToWideChar(CP_ACP
, 0, name
, -1, lpddi
->tszProductName
, MAX_PATH
);
271 lpddi
->guidFFDriver
= GUID_NULL
;
273 TRACE("Enumerating the linux Joystick device: %s (%s)\n", joystick_devices
[id
], name
);
281 * Get a config key from either the app-specific or the default config
284 static inline DWORD
get_config_key( HKEY defkey
, HKEY appkey
, const char *name
,
285 char *buffer
, DWORD size
)
287 if (appkey
&& !RegQueryValueExA( appkey
, name
, 0, NULL
, (LPBYTE
)buffer
, &size
))
290 if (defkey
&& !RegQueryValueExA( defkey
, name
, 0, NULL
, (LPBYTE
)buffer
, &size
))
293 return ERROR_FILE_NOT_FOUND
;
297 * Setup the dinput options.
300 static HRESULT
setup_dinput_options(JoystickImpl
* device
)
302 char buffer
[MAX_PATH
+16];
303 HKEY hkey
, appkey
= 0;
306 buffer
[MAX_PATH
]='\0';
308 /* @@ Wine registry key: HKCU\Software\Wine\DirectInput */
309 if (RegOpenKeyA( HKEY_CURRENT_USER
, "Software\\Wine\\DirectInput", &hkey
)) hkey
= 0;
311 len
= GetModuleFileNameA( 0, buffer
, MAX_PATH
);
312 if (len
&& len
< MAX_PATH
) {
314 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectInput */
315 if (!RegOpenKeyA( HKEY_CURRENT_USER
, "Software\\Wine\\AppDefaults", &tmpkey
))
317 char *p
, *appname
= buffer
;
318 if ((p
= strrchr( appname
, '/' ))) appname
= p
+ 1;
319 if ((p
= strrchr( appname
, '\\' ))) appname
= p
+ 1;
320 strcat( appname
, "\\DirectInput" );
321 if (RegOpenKeyA( tmpkey
, appname
, &appkey
)) appkey
= 0;
322 RegCloseKey( tmpkey
);
328 if (!get_config_key( hkey
, appkey
, "DefaultDeadZone", buffer
, MAX_PATH
)) {
329 device
->deadzone
= atoi(buffer
);
330 TRACE("setting default deadzone to: \"%s\" %d\n", buffer
, device
->deadzone
);
333 if (!get_config_key( hkey
, appkey
, device
->name
, buffer
, MAX_PATH
)) {
337 const char *delim
= ",";
339 TRACE("\"%s\" = \"%s\"\n", device
->name
, buffer
);
341 device
->axis_map
= HeapAlloc(GetProcessHeap(), 0, device
->axes
* sizeof(int));
342 if (device
->axis_map
== 0)
343 return DIERR_OUTOFMEMORY
;
345 if ((ptr
= strtok(buffer
, delim
)) != NULL
) {
347 if (strcmp(ptr
, "X") == 0) {
348 device
->axis_map
[tokens
] = 0;
350 } else if (strcmp(ptr
, "Y") == 0) {
351 device
->axis_map
[tokens
] = 1;
353 } else if (strcmp(ptr
, "Z") == 0) {
354 device
->axis_map
[tokens
] = 2;
356 } else if (strcmp(ptr
, "Rx") == 0) {
357 device
->axis_map
[tokens
] = 3;
359 } else if (strcmp(ptr
, "Ry") == 0) {
360 device
->axis_map
[tokens
] = 4;
362 } else if (strcmp(ptr
, "Rz") == 0) {
363 device
->axis_map
[tokens
] = 5;
365 } else if (strcmp(ptr
, "Slider1") == 0) {
366 device
->axis_map
[tokens
] = 6;
368 } else if (strcmp(ptr
, "Slider2") == 0) {
369 device
->axis_map
[tokens
] = 7;
371 } else if (strcmp(ptr
, "POV1") == 0) {
372 device
->axis_map
[tokens
++] = 8;
373 device
->axis_map
[tokens
] = 8;
375 } else if (strcmp(ptr
, "POV2") == 0) {
376 device
->axis_map
[tokens
++] = 9;
377 device
->axis_map
[tokens
] = 9;
379 } else if (strcmp(ptr
, "POV3") == 0) {
380 device
->axis_map
[tokens
++] = 10;
381 device
->axis_map
[tokens
] = 10;
383 } else if (strcmp(ptr
, "POV4") == 0) {
384 device
->axis_map
[tokens
++] = 11;
385 device
->axis_map
[tokens
] = 11;
388 ERR("invalid joystick axis type: %s\n", ptr
);
389 device
->axis_map
[tokens
] = tokens
;
394 } while ((ptr
= strtok(NULL
, delim
)) != NULL
);
396 if (tokens
!= device
->devcaps
.dwAxes
) {
397 ERR("not all joystick axes mapped: %d axes(%d,%d), %d arguments\n", device
->axes
, axis
, pov
,tokens
);
398 while (tokens
< device
->axes
) {
399 device
->axis_map
[tokens
] = tokens
;
405 device
->devcaps
.dwAxes
= axis
;
406 device
->devcaps
.dwPOVs
= pov
;
410 RegCloseKey( appkey
);
418 static HRESULT
alloc_device(REFGUID rguid
, const void *jvt
, IDirectInputImpl
*dinput
, LPDIRECTINPUTDEVICEA
* pdev
)
421 JoystickImpl
* newDevice
;
424 LPDIDATAFORMAT df
= NULL
;
427 newDevice
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(JoystickImpl
));
428 if (newDevice
== 0) {
429 WARN("out of memory\n");
431 return DIERR_OUTOFMEMORY
;
434 if (!lstrcpynA(newDevice
->dev
, joystick_devices
[rguid
->Data3
], sizeof(newDevice
->dev
)) ||
435 (newDevice
->joyfd
= open(newDevice
->dev
, O_RDONLY
)) < 0)
437 WARN("open(%s, O_RDONLY) failed: %s\n", newDevice
->dev
, strerror(errno
));
438 HeapFree(GetProcessHeap(), 0, newDevice
);
439 return DIERR_DEVICENOTREG
;
442 /* get the device name */
443 #if defined(JSIOCGNAME)
444 if (ioctl(newDevice
->joyfd
,JSIOCGNAME(MAX_PATH
),name
) < 0) {
445 WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", newDevice
->dev
, strerror(errno
));
446 strcpy(name
, "Wine Joystick");
449 strcpy(name
, "Wine Joystick");
452 /* copy the device name */
453 newDevice
->name
= HeapAlloc(GetProcessHeap(),0,strlen(name
) + 1);
454 strcpy(newDevice
->name
, name
);
457 if (ioctl(newDevice
->joyfd
,JSIOCGAXES
,&newDevice
->axes
) < 0) {
458 WARN("ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2\n", newDevice
->dev
, strerror(errno
));
463 if (ioctl(newDevice
->joyfd
,JSIOCGBUTTONS
,&newDevice
->buttons
) < 0) {
464 WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n", newDevice
->dev
, strerror(errno
));
465 newDevice
->buttons
= 2;
469 newDevice
->base
.lpVtbl
= jvt
;
470 newDevice
->base
.ref
= 1;
471 newDevice
->dinput
= dinput
;
472 CopyMemory(&newDevice
->base
.guid
, rguid
, sizeof(*rguid
));
473 InitializeCriticalSection(&newDevice
->base
.crit
);
474 newDevice
->base
.crit
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": JoystickImpl*->base.crit");
476 /* setup_dinput_options may change these */
477 newDevice
->deadzone
= 0;
478 newDevice
->devcaps
.dwButtons
= newDevice
->buttons
;
479 newDevice
->devcaps
.dwAxes
= newDevice
->axes
;
480 newDevice
->devcaps
.dwPOVs
= 0;
482 /* do any user specified configuration */
483 hr
= setup_dinput_options(newDevice
);
487 if (newDevice
->axis_map
== 0) {
488 newDevice
->axis_map
= HeapAlloc(GetProcessHeap(), 0, newDevice
->axes
* sizeof(int));
489 if (newDevice
->axis_map
== 0)
492 for (i
= 0; i
< newDevice
->axes
; i
++)
493 newDevice
->axis_map
[i
] = i
;
496 /* Create copy of default data format */
497 if (!(df
= HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2
.dwSize
))) goto FAILED
;
498 memcpy(df
, &c_dfDIJoystick2
, c_dfDIJoystick2
.dwSize
);
500 /* Axes include POVs */
501 df
->dwNumObjs
= newDevice
->axes
+ newDevice
->buttons
;
502 if (!(df
->rgodf
= HeapAlloc(GetProcessHeap(), 0, df
->dwNumObjs
* df
->dwObjSize
))) goto FAILED
;
504 for (i
= 0; i
< newDevice
->axes
; i
++)
506 int wine_obj
= newDevice
->axis_map
[i
];
508 memcpy(&df
->rgodf
[idx
], &c_dfDIJoystick2
.rgodf
[wine_obj
], df
->dwObjSize
);
510 df
->rgodf
[idx
++].dwType
= DIDFT_MAKEINSTANCE(wine_obj
) | DIDFT_ABSAXIS
;
512 df
->rgodf
[idx
++].dwType
= DIDFT_MAKEINSTANCE(wine_obj
- 8) | DIDFT_POV
;
514 for (i
= 0; i
< newDevice
->buttons
; i
++)
516 memcpy(&df
->rgodf
[idx
], &c_dfDIJoystick2
.rgodf
[i
+ 12], df
->dwObjSize
);
517 df
->rgodf
[idx
++].dwType
= DIDFT_MAKEINSTANCE(i
) | DIDFT_PSHBUTTON
;
519 newDevice
->base
.data_format
.wine_df
= df
;
521 /* create default properties */
522 newDevice
->props
= HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2
.dwNumObjs
*sizeof(ObjProps
));
523 if (newDevice
->props
== 0)
526 /* initialize default properties */
527 for (i
= 0; i
< c_dfDIJoystick2
.dwNumObjs
; i
++) {
528 newDevice
->props
[i
].lMin
= 0;
529 newDevice
->props
[i
].lMax
= 0xffff;
530 newDevice
->props
[i
].lDeadZone
= newDevice
->deadzone
; /* % * 1000 */
531 newDevice
->props
[i
].lSaturation
= 0;
534 IDirectInput_AddRef((LPDIRECTINPUTDEVICE8A
)newDevice
->dinput
);
536 newDevice
->devcaps
.dwSize
= sizeof(newDevice
->devcaps
);
537 newDevice
->devcaps
.dwFlags
= DIDC_ATTACHED
;
538 if (newDevice
->dinput
->dwVersion
>= 0x0800)
539 newDevice
->devcaps
.dwDevType
= DI8DEVTYPE_JOYSTICK
| (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
541 newDevice
->devcaps
.dwDevType
= DIDEVTYPE_JOYSTICK
| (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
542 newDevice
->devcaps
.dwFFSamplePeriod
= 0;
543 newDevice
->devcaps
.dwFFMinTimeResolution
= 0;
544 newDevice
->devcaps
.dwFirmwareRevision
= 0;
545 newDevice
->devcaps
.dwHardwareRevision
= 0;
546 newDevice
->devcaps
.dwFFDriverVersion
= 0;
548 if (TRACE_ON(dinput
)) {
549 _dump_DIDATAFORMAT(newDevice
->base
.data_format
.wine_df
);
550 for (i
= 0; i
< (newDevice
->axes
); i
++)
551 TRACE("axis_map[%d] = %d\n", i
, newDevice
->axis_map
[i
]);
552 _dump_DIDEVCAPS(&newDevice
->devcaps
);
555 *pdev
= (LPDIRECTINPUTDEVICEA
)newDevice
;
560 hr
= DIERR_OUTOFMEMORY
;
562 if (df
) HeapFree(GetProcessHeap(), 0, df
->rgodf
);
563 HeapFree(GetProcessHeap(), 0, df
);
564 release_DataFormat(&newDevice
->base
.data_format
);
565 HeapFree(GetProcessHeap(),0,newDevice
->axis_map
);
566 HeapFree(GetProcessHeap(),0,newDevice
->name
);
567 HeapFree(GetProcessHeap(),0,newDevice
->props
);
568 HeapFree(GetProcessHeap(),0,newDevice
);
574 static BOOL
IsJoystickGUID(REFGUID guid
)
576 GUID wine_joystick
= DInput_Wine_Joystick_GUID
;
577 GUID dev_guid
= *guid
;
579 wine_joystick
.Data3
= 0;
582 return IsEqualGUID(&wine_joystick
, &dev_guid
);
585 static HRESULT
joydev_create_deviceA(IDirectInputImpl
*dinput
, REFGUID rguid
, REFIID riid
, LPDIRECTINPUTDEVICEA
* pdev
)
587 if ((IsEqualGUID(&GUID_Joystick
,rguid
)) ||
588 (IsJoystickGUID(rguid
))) {
589 if ((riid
== NULL
) ||
590 IsEqualGUID(&IID_IDirectInputDeviceA
,riid
) ||
591 IsEqualGUID(&IID_IDirectInputDevice2A
,riid
) ||
592 IsEqualGUID(&IID_IDirectInputDevice7A
,riid
) ||
593 IsEqualGUID(&IID_IDirectInputDevice8A
,riid
)) {
594 return alloc_device(rguid
, &JoystickAvt
, dinput
, pdev
);
596 WARN("no interface\n");
598 return DIERR_NOINTERFACE
;
602 WARN("invalid device GUID\n");
604 return DIERR_DEVICENOTREG
;
607 static HRESULT
joydev_create_deviceW(IDirectInputImpl
*dinput
, REFGUID rguid
, REFIID riid
, LPDIRECTINPUTDEVICEW
* pdev
)
609 if ((IsEqualGUID(&GUID_Joystick
,rguid
)) ||
610 (IsJoystickGUID(rguid
))) {
611 if ((riid
== NULL
) ||
612 IsEqualGUID(&IID_IDirectInputDeviceW
,riid
) ||
613 IsEqualGUID(&IID_IDirectInputDevice2W
,riid
) ||
614 IsEqualGUID(&IID_IDirectInputDevice7W
,riid
) ||
615 IsEqualGUID(&IID_IDirectInputDevice8W
,riid
)) {
616 return alloc_device(rguid
, &JoystickWvt
, dinput
, (LPDIRECTINPUTDEVICEA
*)pdev
);
618 WARN("no interface\n");
620 return DIERR_NOINTERFACE
;
624 WARN("invalid device GUID\n");
626 return DIERR_DEVICENOTREG
;
629 const struct dinput_device joystick_linux_device
= {
630 "Wine Linux joystick driver",
633 joydev_create_deviceA
,
634 joydev_create_deviceW
637 /******************************************************************************
640 static ULONG WINAPI
JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface
)
642 JoystickImpl
*This
= (JoystickImpl
*)iface
;
645 ref
= InterlockedDecrement(&This
->base
.ref
);
649 IDirectInputDevice_Unacquire(iface
);
651 /* Free the device name */
652 HeapFree(GetProcessHeap(),0,This
->name
);
654 /* Free the axis map */
655 HeapFree(GetProcessHeap(),0,This
->axis_map
);
657 /* Free the data queue */
658 HeapFree(GetProcessHeap(), 0, This
->base
.data_queue
);
660 /* Free the properties */
661 HeapFree(GetProcessHeap(), 0, This
->props
);
663 /* release the data transform filter */
664 HeapFree(GetProcessHeap(), 0, This
->base
.data_format
.wine_df
->rgodf
);
665 HeapFree(GetProcessHeap(), 0, This
->base
.data_format
.wine_df
);
666 release_DataFormat(&This
->base
.data_format
);
668 This
->base
.crit
.DebugInfo
->Spare
[0] = 0;
669 IDirectInput_Release((LPDIRECTINPUTDEVICE8A
)This
->dinput
);
670 DeleteCriticalSection(&This
->base
.crit
);
672 HeapFree(GetProcessHeap(),0,This
);
676 /******************************************************************************
677 * Acquire : gets exclusive control of the joystick
679 static HRESULT WINAPI
JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface
)
681 JoystickImpl
*This
= (JoystickImpl
*)iface
;
683 TRACE("(%p)\n",This
);
685 if (This
->base
.acquired
) {
686 WARN("already acquired\n");
690 /* open the joystick device */
691 if (This
->joyfd
==-1) {
692 TRACE("opening joystick device %s\n", This
->dev
);
694 This
->joyfd
=open(This
->dev
,O_RDONLY
);
695 if (This
->joyfd
==-1) {
696 ERR("open(%s) failed: %s\n", This
->dev
, strerror(errno
));
697 return DIERR_NOTFOUND
;
701 This
->base
.acquired
= 1;
706 /******************************************************************************
707 * Unacquire : frees the joystick
709 static HRESULT WINAPI
JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface
)
711 JoystickImpl
*This
= (JoystickImpl
*)iface
;
714 TRACE("(%p)\n",This
);
716 if ((res
= IDirectInputDevice2AImpl_Unacquire(iface
)) != DI_OK
) return res
;
718 if (This
->joyfd
!=-1) {
719 TRACE("closing joystick device\n");
728 static LONG
map_axis(JoystickImpl
* This
, short val
, short index
)
731 double fmin
= This
->props
[index
].lMin
;
732 double fmax
= This
->props
[index
].lMax
;
735 fret
= (((fval
+ 32767.0) * (fmax
- fmin
)) / (32767.0*2.0)) + fmin
;
745 static LONG
calculate_pov(JoystickImpl
*This
, int index
)
747 if (This
->povs
[index
].lX
< -16384) {
748 if (This
->povs
[index
].lY
< -16384)
749 This
->js
.rgdwPOV
[index
] = 31500;
750 else if (This
->povs
[index
].lY
> 16384)
751 This
->js
.rgdwPOV
[index
] = 22500;
753 This
->js
.rgdwPOV
[index
] = 27000;
754 } else if (This
->povs
[index
].lX
> 16384) {
755 if (This
->povs
[index
].lY
< -16384)
756 This
->js
.rgdwPOV
[index
] = 4500;
757 else if (This
->povs
[index
].lY
> 16384)
758 This
->js
.rgdwPOV
[index
] = 13500;
760 This
->js
.rgdwPOV
[index
] = 9000;
762 if (This
->povs
[index
].lY
< -16384)
763 This
->js
.rgdwPOV
[index
] = 0;
764 else if (This
->povs
[index
].lY
> 16384)
765 This
->js
.rgdwPOV
[index
] = 18000;
767 This
->js
.rgdwPOV
[index
] = -1;
770 return This
->js
.rgdwPOV
[index
];
773 static void joy_polldev(JoystickImpl
*This
) {
776 TRACE("(%p)\n", This
);
778 if (This
->joyfd
==-1) {
787 plfd
.fd
= This
->joyfd
;
788 plfd
.events
= POLLIN
;
789 if (poll(&plfd
,1,0) != 1)
791 /* we have one event, so we can read */
792 if (sizeof(jse
)!=read(This
->joyfd
,&jse
,sizeof(jse
))) {
795 TRACE("js_event: type 0x%x, number %d, value %d\n",
796 jse
.type
,jse
.number
,jse
.value
);
797 if (jse
.type
& JS_EVENT_BUTTON
)
799 inst_id
= DIDFT_MAKEINSTANCE(jse
.number
) | DIDFT_PSHBUTTON
;
800 This
->js
.rgbButtons
[jse
.number
] = value
= jse
.value
? 0x80 : 0x00;
802 else if (jse
.type
& JS_EVENT_AXIS
)
804 int number
= This
->axis_map
[jse
.number
]; /* wine format object index */
808 inst_id
= DIDFT_MAKEINSTANCE(jse
.number
) | (number
< 8 ? DIDFT_ABSAXIS
: DIDFT_POV
);
809 value
= map_axis(This
, jse
.value
, number
);
810 /* FIXME do deadzone and saturation here */
812 TRACE("changing axis %d => %d\n", jse
.number
, number
);
824 This
->js
.lRx
= value
;
827 This
->js
.lRy
= value
;
830 This
->js
.lRz
= value
;
833 This
->js
.rglSlider
[0] = value
;
836 This
->js
.rglSlider
[1] = value
;
839 /* FIXME don't go off array */
840 if (This
->axis_map
[jse
.number
+ 1] == number
)
841 This
->povs
[0].lX
= jse
.value
;
842 else if (This
->axis_map
[jse
.number
- 1] == number
)
843 This
->povs
[0].lY
= jse
.value
;
844 value
= calculate_pov(This
, 0);
847 if (This
->axis_map
[jse
.number
+ 1] == number
)
848 This
->povs
[1].lX
= jse
.value
;
849 else if (This
->axis_map
[jse
.number
- 1] == number
)
850 This
->povs
[1].lY
= jse
.value
;
851 value
= calculate_pov(This
, 1);
854 if (This
->axis_map
[jse
.number
+ 1] == number
)
855 This
->povs
[2].lX
= jse
.value
;
856 else if (This
->axis_map
[jse
.number
- 1] == number
)
857 This
->povs
[2].lY
= jse
.value
;
858 value
= calculate_pov(This
, 2);
861 if (This
->axis_map
[jse
.number
+ 1] == number
)
862 This
->povs
[3].lX
= jse
.value
;
863 else if (This
->axis_map
[jse
.number
- 1] == number
)
864 This
->povs
[3].lY
= jse
.value
;
865 value
= calculate_pov(This
, 3);
869 WARN("axis %d not supported\n", number
);
872 queue_event((LPDIRECTINPUTDEVICE8A
)This
,
873 id_to_offset(&This
->base
.data_format
, inst_id
),
874 value
, jse
.time
, This
->dinput
->evsequence
++);
878 /******************************************************************************
879 * GetDeviceState : returns the "state" of the joystick.
882 static HRESULT WINAPI
JoystickAImpl_GetDeviceState(
883 LPDIRECTINPUTDEVICE8A iface
,
887 JoystickImpl
*This
= (JoystickImpl
*)iface
;
889 TRACE("(%p,0x%08x,%p)\n", This
, len
, ptr
);
891 if (!This
->base
.acquired
) {
892 WARN("not acquired\n");
893 return DIERR_NOTACQUIRED
;
896 /* update joystick state */
899 /* convert and copy data to user supplied buffer */
900 fill_DataFormat(ptr
, &This
->js
, &This
->base
.data_format
);
905 /******************************************************************************
906 * SetProperty : change input device properties
908 static HRESULT WINAPI
JoystickAImpl_SetProperty(
909 LPDIRECTINPUTDEVICE8A iface
,
913 JoystickImpl
*This
= (JoystickImpl
*)iface
;
916 TRACE("(%p,%s,%p)\n",This
,debugstr_guid(rguid
),ph
);
919 WARN("invalid parameter: ph == NULL\n");
920 return DIERR_INVALIDPARAM
;
923 if (TRACE_ON(dinput
))
924 _dump_DIPROPHEADER(ph
);
926 if (!HIWORD(rguid
)) {
927 switch (LOWORD(rguid
)) {
928 case (DWORD
)DIPROP_RANGE
: {
929 LPCDIPROPRANGE pr
= (LPCDIPROPRANGE
)ph
;
930 if (ph
->dwHow
== DIPH_DEVICE
) {
931 TRACE("proprange(%d,%d) all\n", pr
->lMin
, pr
->lMax
);
932 for (i
= 0; i
< This
->base
.data_format
.wine_df
->dwNumObjs
; i
++) {
933 This
->props
[i
].lMin
= pr
->lMin
;
934 This
->props
[i
].lMax
= pr
->lMax
;
937 int obj
= find_property(&This
->base
.data_format
, ph
);
939 TRACE("proprange(%d,%d) obj=%d\n", pr
->lMin
, pr
->lMax
, obj
);
941 This
->props
[obj
].lMin
= pr
->lMin
;
942 This
->props
[obj
].lMax
= pr
->lMax
;
948 case (DWORD
)DIPROP_DEADZONE
: {
949 LPCDIPROPDWORD pd
= (LPCDIPROPDWORD
)ph
;
950 if (ph
->dwHow
== DIPH_DEVICE
) {
951 TRACE("deadzone(%d) all\n", pd
->dwData
);
952 for (i
= 0; i
< This
->base
.data_format
.wine_df
->dwNumObjs
; i
++)
953 This
->props
[i
].lDeadZone
= pd
->dwData
;
955 int obj
= find_property(&This
->base
.data_format
, ph
);
957 TRACE("deadzone(%d) obj=%d\n", pd
->dwData
, obj
);
959 This
->props
[obj
].lDeadZone
= pd
->dwData
;
965 case (DWORD
)DIPROP_SATURATION
: {
966 LPCDIPROPDWORD pd
= (LPCDIPROPDWORD
)ph
;
967 if (ph
->dwHow
== DIPH_DEVICE
) {
968 TRACE("saturation(%d) all\n", pd
->dwData
);
969 for (i
= 0; i
< This
->base
.data_format
.wine_df
->dwNumObjs
; i
++)
970 This
->props
[i
].lSaturation
= pd
->dwData
;
972 int obj
= find_property(&This
->base
.data_format
, ph
);
974 TRACE("saturation(%d) obj=%d\n", pd
->dwData
, obj
);
976 This
->props
[obj
].lSaturation
= pd
->dwData
;
983 return IDirectInputDevice2AImpl_SetProperty(iface
, rguid
, ph
);
990 static HRESULT WINAPI
JoystickAImpl_GetCapabilities(
991 LPDIRECTINPUTDEVICE8A iface
,
992 LPDIDEVCAPS lpDIDevCaps
)
994 JoystickImpl
*This
= (JoystickImpl
*)iface
;
997 TRACE("%p->(%p)\n",iface
,lpDIDevCaps
);
999 if (lpDIDevCaps
== NULL
) {
1000 WARN("invalid pointer\n");
1004 size
= lpDIDevCaps
->dwSize
;
1006 if (!(size
== sizeof(DIDEVCAPS
) || size
== sizeof(DIDEVCAPS_DX3
))) {
1007 WARN("invalid parameter\n");
1008 return DIERR_INVALIDPARAM
;
1011 CopyMemory(lpDIDevCaps
, &This
->devcaps
, size
);
1012 lpDIDevCaps
->dwSize
= size
;
1014 if (TRACE_ON(dinput
))
1015 _dump_DIDEVCAPS(lpDIDevCaps
);
1020 static HRESULT WINAPI
JoystickAImpl_Poll(LPDIRECTINPUTDEVICE8A iface
)
1022 JoystickImpl
*This
= (JoystickImpl
*)iface
;
1024 TRACE("(%p)\n",This
);
1026 if (!This
->base
.acquired
) {
1027 WARN("not acquired\n");
1028 return DIERR_NOTACQUIRED
;
1035 /******************************************************************************
1036 * GetProperty : get input device properties
1038 static HRESULT WINAPI
JoystickAImpl_GetProperty(
1039 LPDIRECTINPUTDEVICE8A iface
,
1041 LPDIPROPHEADER pdiph
)
1043 JoystickImpl
*This
= (JoystickImpl
*)iface
;
1045 TRACE("(%p,%s,%p)\n", iface
, debugstr_guid(rguid
), pdiph
);
1047 if (TRACE_ON(dinput
))
1048 _dump_DIPROPHEADER(pdiph
);
1050 if (!HIWORD(rguid
)) {
1051 switch (LOWORD(rguid
)) {
1052 case (DWORD
) DIPROP_RANGE
: {
1053 LPDIPROPRANGE pr
= (LPDIPROPRANGE
)pdiph
;
1054 int obj
= find_property(&This
->base
.data_format
, pdiph
);
1056 /* The app is querying the current range of the axis
1057 * return the lMin and lMax values */
1059 pr
->lMin
= This
->props
[obj
].lMin
;
1060 pr
->lMax
= This
->props
[obj
].lMax
;
1061 TRACE("range(%d, %d) obj=%d\n", pr
->lMin
, pr
->lMax
, obj
);
1066 case (DWORD
) DIPROP_DEADZONE
: {
1067 LPDIPROPDWORD pd
= (LPDIPROPDWORD
)pdiph
;
1068 int obj
= find_property(&This
->base
.data_format
, pdiph
);
1071 pd
->dwData
= This
->props
[obj
].lDeadZone
;
1072 TRACE("deadzone(%d) obj=%d\n", pd
->dwData
, obj
);
1077 case (DWORD
) DIPROP_SATURATION
: {
1078 LPDIPROPDWORD pd
= (LPDIPROPDWORD
)pdiph
;
1079 int obj
= find_property(&This
->base
.data_format
, pdiph
);
1082 pd
->dwData
= This
->props
[obj
].lSaturation
;
1083 TRACE("saturation(%d) obj=%d\n", pd
->dwData
, obj
);
1089 return IDirectInputDevice2AImpl_GetProperty(iface
, rguid
, pdiph
);
1096 /******************************************************************************
1097 * GetObjectInfo : get object info
1099 static HRESULT WINAPI
JoystickWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface
,
1100 LPDIDEVICEOBJECTINSTANCEW pdidoi
, DWORD dwObj
, DWORD dwHow
)
1102 static const WCHAR axisW
[] = {'A','x','i','s',' ','%','d',0};
1103 static const WCHAR povW
[] = {'P','O','V',' ','%','d',0};
1104 static const WCHAR buttonW
[] = {'B','u','t','t','o','n',' ','%','d',0};
1107 res
= IDirectInputDevice2WImpl_GetObjectInfo(iface
, pdidoi
, dwObj
, dwHow
);
1108 if (res
!= DI_OK
) return res
;
1110 if (pdidoi
->dwType
& DIDFT_AXIS
)
1111 sprintfW(pdidoi
->tszName
, axisW
, DIDFT_GETINSTANCE(pdidoi
->dwType
));
1112 else if (pdidoi
->dwType
& DIDFT_POV
)
1113 sprintfW(pdidoi
->tszName
, povW
, DIDFT_GETINSTANCE(pdidoi
->dwType
));
1114 else if (pdidoi
->dwType
& DIDFT_BUTTON
)
1115 sprintfW(pdidoi
->tszName
, buttonW
, DIDFT_GETINSTANCE(pdidoi
->dwType
));
1117 _dump_OBJECTINSTANCEW(pdidoi
);
1121 static HRESULT WINAPI
JoystickAImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8A iface
,
1122 LPDIDEVICEOBJECTINSTANCEA pdidoi
, DWORD dwObj
, DWORD dwHow
)
1125 DIDEVICEOBJECTINSTANCEW didoiW
;
1126 DWORD dwSize
= pdidoi
->dwSize
;
1128 didoiW
.dwSize
= sizeof(didoiW
);
1129 res
= JoystickWImpl_GetObjectInfo((LPDIRECTINPUTDEVICE8W
)iface
, &didoiW
, dwObj
, dwHow
);
1130 if (res
!= DI_OK
) return res
;
1132 memset(pdidoi
, 0, pdidoi
->dwSize
);
1133 memcpy(pdidoi
, &didoiW
, FIELD_OFFSET(DIDEVICEOBJECTINSTANCEW
, tszName
));
1134 pdidoi
->dwSize
= dwSize
;
1135 WideCharToMultiByte(CP_ACP
, 0, didoiW
.tszName
, -1, pdidoi
->tszName
,
1136 sizeof(pdidoi
->tszName
), NULL
, NULL
);
1141 /******************************************************************************
1142 * GetDeviceInfo : get information about a device's identity
1144 static HRESULT WINAPI
JoystickAImpl_GetDeviceInfo(
1145 LPDIRECTINPUTDEVICE8A iface
,
1146 LPDIDEVICEINSTANCEA pdidi
)
1148 JoystickImpl
*This
= (JoystickImpl
*)iface
;
1150 TRACE("(%p,%p)\n", iface
, pdidi
);
1152 if (pdidi
== NULL
) {
1153 WARN("invalid pointer\n");
1157 if ((pdidi
->dwSize
!= sizeof(DIDEVICEINSTANCE_DX3A
)) &&
1158 (pdidi
->dwSize
!= sizeof(DIDEVICEINSTANCEA
))) {
1159 WARN("invalid parameter: pdidi->dwSize = %d != %d or %d\n",
1160 pdidi
->dwSize
, sizeof(DIDEVICEINSTANCE_DX3A
),
1161 sizeof(DIDEVICEINSTANCEA
));
1162 return DIERR_INVALIDPARAM
;
1165 /* Return joystick */
1166 pdidi
->guidInstance
= GUID_Joystick
;
1167 pdidi
->guidProduct
= DInput_Wine_Joystick_GUID
;
1168 /* we only support traditional joysticks for now */
1169 pdidi
->dwDevType
= This
->devcaps
.dwDevType
;
1170 strcpy(pdidi
->tszInstanceName
, "Joystick");
1171 strcpy(pdidi
->tszProductName
, This
->name
);
1172 if (pdidi
->dwSize
> sizeof(DIDEVICEINSTANCE_DX3A
)) {
1173 pdidi
->guidFFDriver
= GUID_NULL
;
1174 pdidi
->wUsagePage
= 0;
1181 /******************************************************************************
1182 * GetDeviceInfo : get information about a device's identity
1184 static HRESULT WINAPI
JoystickWImpl_GetDeviceInfo(
1185 LPDIRECTINPUTDEVICE8W iface
,
1186 LPDIDEVICEINSTANCEW pdidi
)
1188 JoystickImpl
*This
= (JoystickImpl
*)iface
;
1190 TRACE("(%p,%p)\n", iface
, pdidi
);
1192 if ((pdidi
->dwSize
!= sizeof(DIDEVICEINSTANCE_DX3W
)) &&
1193 (pdidi
->dwSize
!= sizeof(DIDEVICEINSTANCEW
))) {
1194 WARN("invalid parameter: pdidi->dwSize = %d != %d or %d\n",
1195 pdidi
->dwSize
, sizeof(DIDEVICEINSTANCE_DX3W
),
1196 sizeof(DIDEVICEINSTANCEW
));
1197 return DIERR_INVALIDPARAM
;
1200 /* Return joystick */
1201 pdidi
->guidInstance
= GUID_Joystick
;
1202 pdidi
->guidProduct
= DInput_Wine_Joystick_GUID
;
1203 /* we only support traditional joysticks for now */
1204 pdidi
->dwDevType
= This
->devcaps
.dwDevType
;
1205 MultiByteToWideChar(CP_ACP
, 0, "Joystick", -1, pdidi
->tszInstanceName
, MAX_PATH
);
1206 MultiByteToWideChar(CP_ACP
, 0, This
->name
, -1, pdidi
->tszProductName
, MAX_PATH
);
1207 if (pdidi
->dwSize
> sizeof(DIDEVICEINSTANCE_DX3W
)) {
1208 pdidi
->guidFFDriver
= GUID_NULL
;
1209 pdidi
->wUsagePage
= 0;
1216 static const IDirectInputDevice8AVtbl JoystickAvt
=
1218 IDirectInputDevice2AImpl_QueryInterface
,
1219 IDirectInputDevice2AImpl_AddRef
,
1220 JoystickAImpl_Release
,
1221 JoystickAImpl_GetCapabilities
,
1222 IDirectInputDevice2AImpl_EnumObjects
,
1223 JoystickAImpl_GetProperty
,
1224 JoystickAImpl_SetProperty
,
1225 JoystickAImpl_Acquire
,
1226 JoystickAImpl_Unacquire
,
1227 JoystickAImpl_GetDeviceState
,
1228 IDirectInputDevice2AImpl_GetDeviceData
,
1229 IDirectInputDevice2AImpl_SetDataFormat
,
1230 IDirectInputDevice2AImpl_SetEventNotification
,
1231 IDirectInputDevice2AImpl_SetCooperativeLevel
,
1232 JoystickAImpl_GetObjectInfo
,
1233 JoystickAImpl_GetDeviceInfo
,
1234 IDirectInputDevice2AImpl_RunControlPanel
,
1235 IDirectInputDevice2AImpl_Initialize
,
1236 IDirectInputDevice2AImpl_CreateEffect
,
1237 IDirectInputDevice2AImpl_EnumEffects
,
1238 IDirectInputDevice2AImpl_GetEffectInfo
,
1239 IDirectInputDevice2AImpl_GetForceFeedbackState
,
1240 IDirectInputDevice2AImpl_SendForceFeedbackCommand
,
1241 IDirectInputDevice2AImpl_EnumCreatedEffectObjects
,
1242 IDirectInputDevice2AImpl_Escape
,
1244 IDirectInputDevice2AImpl_SendDeviceData
,
1245 IDirectInputDevice7AImpl_EnumEffectsInFile
,
1246 IDirectInputDevice7AImpl_WriteEffectToFile
,
1247 IDirectInputDevice8AImpl_BuildActionMap
,
1248 IDirectInputDevice8AImpl_SetActionMap
,
1249 IDirectInputDevice8AImpl_GetImageInfo
1252 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1253 # define XCAST(fun) (typeof(SysJoystickWvt.fun))
1255 # define XCAST(fun) (void*)
1258 static const IDirectInputDevice8WVtbl SysJoystickWvt
=
1260 IDirectInputDevice2WImpl_QueryInterface
,
1261 XCAST(AddRef
)IDirectInputDevice2AImpl_AddRef
,
1262 XCAST(Release
)JoystickAImpl_Release
,
1263 XCAST(GetCapabilities
)JoystickAImpl_GetCapabilities
,
1264 IDirectInputDevice2WImpl_EnumObjects
,
1265 XCAST(GetProperty
)JoystickAImpl_GetProperty
,
1266 XCAST(SetProperty
)JoystickAImpl_SetProperty
,
1267 XCAST(Acquire
)JoystickAImpl_Acquire
,
1268 XCAST(Unacquire
)JoystickAImpl_Unacquire
,
1269 XCAST(GetDeviceState
)JoystickAImpl_GetDeviceState
,
1270 XCAST(GetDeviceData
)IDirectInputDevice2AImpl_GetDeviceData
,
1271 XCAST(SetDataFormat
)IDirectInputDevice2AImpl_SetDataFormat
,
1272 XCAST(SetEventNotification
)IDirectInputDevice2AImpl_SetEventNotification
,
1273 XCAST(SetCooperativeLevel
)IDirectInputDevice2AImpl_SetCooperativeLevel
,
1274 IDirectInputDevice2WImpl_GetObjectInfo
,
1275 JoystickWImpl_GetDeviceInfo
,
1276 XCAST(RunControlPanel
)IDirectInputDevice2AImpl_RunControlPanel
,
1277 XCAST(Initialize
)IDirectInputDevice2AImpl_Initialize
,
1278 XCAST(CreateEffect
)IDirectInputDevice2AImpl_CreateEffect
,
1279 IDirectInputDevice2WImpl_EnumEffects
,
1280 IDirectInputDevice2WImpl_GetEffectInfo
,
1281 XCAST(GetForceFeedbackState
)IDirectInputDevice2AImpl_GetForceFeedbackState
,
1282 XCAST(SendForceFeedbackCommand
)IDirectInputDevice2AImpl_SendForceFeedbackCommand
,
1283 XCAST(EnumCreatedEffectObjects
)IDirectInputDevice2AImpl_EnumCreatedEffectObjects
,
1284 XCAST(Escape
)IDirectInputDevice2AImpl_Escape
,
1285 XCAST(Poll
)JoystickAImpl_Poll
,
1286 XCAST(SendDeviceData
)IDirectInputDevice2AImpl_SendDeviceData
,
1287 IDirectInputDevice7WImpl_EnumEffectsInFile
,
1288 IDirectInputDevice7WImpl_WriteEffectToFile
,
1289 IDirectInputDevice8WImpl_BuildActionMap
,
1290 IDirectInputDevice8WImpl_SetActionMap
,
1291 IDirectInputDevice8WImpl_GetImageInfo
1295 #else /* HAVE_LINUX_22_JOYSTICK_API */
1297 const struct dinput_device joystick_linux_device
= {
1298 "Wine Linux joystick driver",
1305 #endif /* HAVE_LINUX_22_JOYSTICK_API */