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"
38 #ifdef HAVE_SYS_TIME_H
39 # include <sys/time.h>
42 #ifdef HAVE_SYS_IOCTL_H
43 # include <sys/ioctl.h>
46 #ifdef HAVE_SYS_ERRNO_H
47 # include <sys/errno.h>
49 #ifdef HAVE_LINUX_IOCTL_H
50 # include <linux/ioctl.h>
52 #ifdef HAVE_LINUX_JOYSTICK_H
53 # include <linux/joystick.h>
56 #ifdef HAVE_SYS_POLL_H
57 # include <sys/poll.h>
60 #include "wine/debug.h"
61 #include "wine/unicode.h"
67 #include "dinput_private.h"
68 #include "device_private.h"
69 #include "joystick_private.h"
71 WINE_DEFAULT_DEBUG_CHANNEL(dinput
);
73 #ifdef HAVE_LINUX_22_JOYSTICK_API
75 #define JOYDEV_NEW "/dev/input/js"
76 #define JOYDEV_OLD "/dev/js"
80 char device
[MAX_PATH
];
88 typedef struct JoystickImpl JoystickImpl
;
89 static const IDirectInputDevice8AVtbl JoystickAvt
;
90 static const IDirectInputDevice8WVtbl JoystickWvt
;
93 struct JoystickGenericImpl generic
;
95 struct JoyDev
*joydev
;
97 /* joystick private */
102 static const GUID DInput_Wine_Joystick_GUID
= { /* 9e573ed9-7734-11d2-8d4a-23903fb6bdf7 */
106 {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
109 #define MAX_JOYSTICKS 64
110 static INT joystick_devices_count
= -1;
111 static struct JoyDev
*joystick_devices
;
113 static void joy_polldev(LPDIRECTINPUTDEVICE8A iface
);
115 static INT
find_joystick_devices(void)
119 if (joystick_devices_count
!= -1) return joystick_devices_count
;
121 joystick_devices_count
= 0;
122 for (i
= 0; i
< MAX_JOYSTICKS
; i
++)
125 struct JoyDev joydev
, *new_joydevs
;
126 BYTE axes_map
[ABS_MAX
+ 1];
128 snprintf(joydev
.device
, sizeof(joydev
.device
), "%s%d", JOYDEV_NEW
, i
);
129 if ((fd
= open(joydev
.device
, O_RDONLY
)) < 0)
131 snprintf(joydev
.device
, sizeof(joydev
.device
), "%s%d", JOYDEV_OLD
, i
);
132 if ((fd
= open(joydev
.device
, O_RDONLY
)) < 0) continue;
135 strcpy(joydev
.name
, "Wine Joystick");
136 #if defined(JSIOCGNAME)
137 if (ioctl(fd
, JSIOCGNAME(sizeof(joydev
.name
)), joydev
.name
) < 0)
138 WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", joydev
.device
, strerror(errno
));
141 if (ioctl(fd
, JSIOCGAXES
, &joydev
.axis_count
) < 0)
143 WARN("ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2\n", joydev
.device
, strerror(errno
));
144 joydev
.axis_count
= 2;
148 if (ioctl(fd
, JSIOCGBUTTONS
, &joydev
.button_count
) < 0)
150 WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n", joydev
.device
, strerror(errno
));
151 joydev
.button_count
= 2;
155 if (ioctl(fd
, JSIOCGAXMAP
, axes_map
) < 0)
157 WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", joydev
.device
, strerror(errno
));
158 joydev
.dev_axes_map
= NULL
;
161 if ((joydev
.dev_axes_map
= HeapAlloc(GetProcessHeap(), 0, joydev
.axis_count
* sizeof(int))))
165 /* Remap to DI numbers */
166 for (j
= 0; j
< joydev
.axis_count
; j
++)
168 /* Axis match 1-to-1 */
169 joydev
.dev_axes_map
[j
] = j
;
170 else if (axes_map
[j
] == 16 ||
173 joydev
.dev_axes_map
[j
] = 8;
175 joydev
.dev_axes_map
[j
] = -1;
180 if (!joystick_devices_count
)
181 new_joydevs
= HeapAlloc(GetProcessHeap(), 0, sizeof(struct JoyDev
));
183 new_joydevs
= HeapReAlloc(GetProcessHeap(), 0, joystick_devices
,
184 (joystick_devices_count
+ 1) * sizeof(struct JoyDev
));
185 if (!new_joydevs
) continue;
187 TRACE("Found a joystick on %s: %s\n with %d axes and %d buttons\n", joydev
.device
,
188 joydev
.name
, joydev
.axis_count
, joydev
.button_count
);
190 joystick_devices
= new_joydevs
;
191 joystick_devices
[joystick_devices_count
++] = joydev
;
194 return joystick_devices_count
;
197 static BOOL
joydev_enum_deviceA(DWORD dwDevType
, DWORD dwFlags
, LPDIDEVICEINSTANCEA lpddi
, DWORD version
, int id
)
201 if (id
>= find_joystick_devices()) return FALSE
;
203 if (dwFlags
& DIEDFL_FORCEFEEDBACK
) {
204 WARN("force feedback not supported\n");
208 if ((dwDevType
== 0) ||
209 ((dwDevType
== DIDEVTYPE_JOYSTICK
) && (version
> 0x0300 && version
< 0x0800)) ||
210 (((dwDevType
== DI8DEVCLASS_GAMECTRL
) || (dwDevType
== DI8DEVTYPE_JOYSTICK
)) && (version
>= 0x0800))) {
211 /* check whether we have a joystick */
212 if ((fd
= open(joystick_devices
[id
].device
, O_RDONLY
)) < 0)
214 WARN("open(%s, O_RDONLY) failed: %s\n", joystick_devices
[id
].name
, strerror(errno
));
218 /* Return joystick */
219 lpddi
->guidInstance
= DInput_Wine_Joystick_GUID
;
220 lpddi
->guidInstance
.Data3
= id
;
221 lpddi
->guidProduct
= DInput_Wine_Joystick_GUID
;
222 /* we only support traditional joysticks for now */
223 if (version
>= 0x0800)
224 lpddi
->dwDevType
= DI8DEVTYPE_JOYSTICK
| (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
226 lpddi
->dwDevType
= DIDEVTYPE_JOYSTICK
| (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
228 strcpy(lpddi
->tszInstanceName
, joystick_devices
[id
].name
);
229 strcpy(lpddi
->tszProductName
, joystick_devices
[id
].name
);
231 lpddi
->guidFFDriver
= GUID_NULL
;
233 TRACE("Enumerating the linux Joystick device: %s (%s)\n", joystick_devices
[id
].device
, lpddi
->tszProductName
);
240 static BOOL
joydev_enum_deviceW(DWORD dwDevType
, DWORD dwFlags
, LPDIDEVICEINSTANCEW lpddi
, DWORD version
, int id
)
244 if (id
>= find_joystick_devices()) return FALSE
;
246 if (dwFlags
& DIEDFL_FORCEFEEDBACK
) {
247 WARN("force feedback not supported\n");
251 if ((dwDevType
== 0) ||
252 ((dwDevType
== DIDEVTYPE_JOYSTICK
) && (version
> 0x0300 && version
< 0x0800)) ||
253 (((dwDevType
== DI8DEVCLASS_GAMECTRL
) || (dwDevType
== DI8DEVTYPE_JOYSTICK
)) && (version
>= 0x0800))) {
254 /* check whether we have a joystick */
255 if ((fd
= open(joystick_devices
[id
].device
, O_RDONLY
)) < 0)
257 WARN("open(%s,O_RDONLY) failed: %s\n", joystick_devices
[id
].device
, strerror(errno
));
261 /* Return joystick */
262 lpddi
->guidInstance
= DInput_Wine_Joystick_GUID
;
263 lpddi
->guidInstance
.Data3
= id
;
264 lpddi
->guidProduct
= DInput_Wine_Joystick_GUID
;
265 /* we only support traditional joysticks for now */
266 if (version
>= 0x0800)
267 lpddi
->dwDevType
= DI8DEVTYPE_JOYSTICK
| (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
269 lpddi
->dwDevType
= DIDEVTYPE_JOYSTICK
| (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
271 MultiByteToWideChar(CP_ACP
, 0, joystick_devices
[id
].name
, -1, lpddi
->tszInstanceName
, MAX_PATH
);
272 MultiByteToWideChar(CP_ACP
, 0, joystick_devices
[id
].name
, -1, lpddi
->tszProductName
, MAX_PATH
);
273 lpddi
->guidFFDriver
= GUID_NULL
;
275 TRACE("Enumerating the linux Joystick device: %s (%s)\n", joystick_devices
[id
].device
, joystick_devices
[id
].name
);
282 static HRESULT
alloc_device(REFGUID rguid
, const void *jvt
, IDirectInputImpl
*dinput
,
283 LPDIRECTINPUTDEVICEA
* pdev
, unsigned short index
)
286 JoystickImpl
* newDevice
;
288 LPDIDATAFORMAT df
= NULL
;
291 TRACE("%s %p %p %p %hu\n", debugstr_guid(rguid
), jvt
, dinput
, pdev
, index
);
293 newDevice
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(JoystickImpl
));
294 if (newDevice
== 0) {
295 WARN("out of memory\n");
297 return DIERR_OUTOFMEMORY
;
300 newDevice
->joydev
= &joystick_devices
[index
];
301 newDevice
->joyfd
= -1;
302 newDevice
->generic
.guidInstance
= DInput_Wine_Joystick_GUID
;
303 newDevice
->generic
.guidInstance
.Data3
= index
;
304 newDevice
->generic
.guidProduct
= DInput_Wine_Joystick_GUID
;
305 newDevice
->generic
.joy_polldev
= joy_polldev
;
306 newDevice
->generic
.name
= newDevice
->joydev
->name
;
307 newDevice
->generic
.device_axis_count
= newDevice
->joydev
->axis_count
;
308 newDevice
->generic
.devcaps
.dwButtons
= newDevice
->joydev
->button_count
;
310 if (newDevice
->generic
.devcaps
.dwButtons
> 128)
312 WARN("Can't support %d buttons. Clamping down to 128\n", newDevice
->generic
.devcaps
.dwButtons
);
313 newDevice
->generic
.devcaps
.dwButtons
= 128;
316 newDevice
->generic
.base
.lpVtbl
= jvt
;
317 newDevice
->generic
.base
.ref
= 1;
318 newDevice
->generic
.base
.dinput
= dinput
;
319 newDevice
->generic
.base
.guid
= *rguid
;
320 InitializeCriticalSection(&newDevice
->generic
.base
.crit
);
321 newDevice
->generic
.base
.crit
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": JoystickImpl*->generic.base.crit");
323 /* setup_dinput_options may change these */
324 newDevice
->generic
.deadzone
= 0;
326 /* do any user specified configuration */
327 hr
= setup_dinput_options(&newDevice
->generic
, newDevice
->joydev
->dev_axes_map
);
331 /* Create copy of default data format */
332 if (!(df
= HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2
.dwSize
))) goto FAILED
;
333 memcpy(df
, &c_dfDIJoystick2
, c_dfDIJoystick2
.dwSize
);
335 df
->dwNumObjs
= newDevice
->generic
.devcaps
.dwAxes
+ newDevice
->generic
.devcaps
.dwPOVs
+ newDevice
->generic
.devcaps
.dwButtons
;
336 if (!(df
->rgodf
= HeapAlloc(GetProcessHeap(), 0, df
->dwNumObjs
* df
->dwObjSize
))) goto FAILED
;
338 for (i
= 0; i
< newDevice
->generic
.device_axis_count
; i
++)
340 int wine_obj
= newDevice
->generic
.axis_map
[i
];
342 if (wine_obj
< 0) continue;
344 memcpy(&df
->rgodf
[idx
], &c_dfDIJoystick2
.rgodf
[wine_obj
], df
->dwObjSize
);
346 df
->rgodf
[idx
++].dwType
= DIDFT_MAKEINSTANCE(wine_obj
) | DIDFT_ABSAXIS
;
349 df
->rgodf
[idx
++].dwType
= DIDFT_MAKEINSTANCE(wine_obj
- 8) | DIDFT_POV
;
350 i
++; /* POV takes 2 axes */
353 for (i
= 0; i
< newDevice
->generic
.devcaps
.dwButtons
; i
++)
355 memcpy(&df
->rgodf
[idx
], &c_dfDIJoystick2
.rgodf
[i
+ 12], df
->dwObjSize
);
356 df
->rgodf
[idx
].pguid
= &GUID_Button
;
357 df
->rgodf
[idx
++].dwType
= DIDFT_MAKEINSTANCE(i
) | DIDFT_PSHBUTTON
;
359 newDevice
->generic
.base
.data_format
.wine_df
= df
;
361 /* initialize default properties */
362 for (i
= 0; i
< c_dfDIJoystick2
.dwNumObjs
; i
++) {
363 newDevice
->generic
.props
[i
].lDevMin
= -32767;
364 newDevice
->generic
.props
[i
].lDevMax
= +32767;
365 newDevice
->generic
.props
[i
].lMin
= 0;
366 newDevice
->generic
.props
[i
].lMax
= 0xffff;
367 newDevice
->generic
.props
[i
].lDeadZone
= newDevice
->generic
.deadzone
; /* % * 1000 */
368 newDevice
->generic
.props
[i
].lSaturation
= 0;
371 IDirectInput_AddRef(&newDevice
->generic
.base
.dinput
->IDirectInput7A_iface
);
373 newDevice
->generic
.devcaps
.dwSize
= sizeof(newDevice
->generic
.devcaps
);
374 newDevice
->generic
.devcaps
.dwFlags
= DIDC_ATTACHED
;
375 if (newDevice
->generic
.base
.dinput
->dwVersion
>= 0x0800)
376 newDevice
->generic
.devcaps
.dwDevType
= DI8DEVTYPE_JOYSTICK
| (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
378 newDevice
->generic
.devcaps
.dwDevType
= DIDEVTYPE_JOYSTICK
| (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
379 newDevice
->generic
.devcaps
.dwFFSamplePeriod
= 0;
380 newDevice
->generic
.devcaps
.dwFFMinTimeResolution
= 0;
381 newDevice
->generic
.devcaps
.dwFirmwareRevision
= 0;
382 newDevice
->generic
.devcaps
.dwHardwareRevision
= 0;
383 newDevice
->generic
.devcaps
.dwFFDriverVersion
= 0;
385 if (TRACE_ON(dinput
)) {
386 _dump_DIDATAFORMAT(newDevice
->generic
.base
.data_format
.wine_df
);
387 for (i
= 0; i
< (newDevice
->generic
.device_axis_count
); i
++)
388 TRACE("axis_map[%d] = %d\n", i
, newDevice
->generic
.axis_map
[i
]);
389 _dump_DIDEVCAPS(&newDevice
->generic
.devcaps
);
392 *pdev
= (LPDIRECTINPUTDEVICEA
)newDevice
;
397 hr
= DIERR_OUTOFMEMORY
;
399 if (df
) HeapFree(GetProcessHeap(), 0, df
->rgodf
);
400 HeapFree(GetProcessHeap(), 0, df
);
401 release_DataFormat(&newDevice
->generic
.base
.data_format
);
402 HeapFree(GetProcessHeap(),0,newDevice
->generic
.axis_map
);
403 HeapFree(GetProcessHeap(),0,newDevice
);
409 /******************************************************************************
410 * get_joystick_index : Get the joystick index from a given GUID
412 static unsigned short get_joystick_index(REFGUID guid
)
414 GUID wine_joystick
= DInput_Wine_Joystick_GUID
;
415 GUID dev_guid
= *guid
;
417 wine_joystick
.Data3
= 0;
420 /* for the standard joystick GUID use index 0 */
421 if(IsEqualGUID(&GUID_Joystick
,guid
)) return 0;
423 /* for the wine joystick GUIDs use the index stored in Data3 */
424 if(IsEqualGUID(&wine_joystick
, &dev_guid
)) return guid
->Data3
;
426 return MAX_JOYSTICKS
;
429 static HRESULT
joydev_create_deviceA(IDirectInputImpl
*dinput
, REFGUID rguid
, REFIID riid
, LPDIRECTINPUTDEVICEA
* pdev
)
431 unsigned short index
;
433 TRACE("%p %s %p %p\n",dinput
, debugstr_guid(rguid
), riid
, pdev
);
434 find_joystick_devices();
437 if ((index
= get_joystick_index(rguid
)) < MAX_JOYSTICKS
&&
438 joystick_devices_count
&& index
< joystick_devices_count
)
440 if ((riid
== NULL
) ||
441 IsEqualGUID(&IID_IDirectInputDeviceA
, riid
) ||
442 IsEqualGUID(&IID_IDirectInputDevice2A
, riid
) ||
443 IsEqualGUID(&IID_IDirectInputDevice7A
, riid
) ||
444 IsEqualGUID(&IID_IDirectInputDevice8A
, riid
))
446 return alloc_device(rguid
, &JoystickAvt
, dinput
, pdev
, index
);
449 WARN("no interface\n");
450 return DIERR_NOINTERFACE
;
453 return DIERR_DEVICENOTREG
;
456 static HRESULT
joydev_create_deviceW(IDirectInputImpl
*dinput
, REFGUID rguid
, REFIID riid
, LPDIRECTINPUTDEVICEW
* pdev
)
458 unsigned short index
;
460 TRACE("%p %s %p %p\n",dinput
, debugstr_guid(rguid
), riid
, pdev
);
461 find_joystick_devices();
464 if ((index
= get_joystick_index(rguid
)) < MAX_JOYSTICKS
&&
465 joystick_devices_count
&& index
< joystick_devices_count
)
467 if ((riid
== NULL
) ||
468 IsEqualGUID(&IID_IDirectInputDeviceW
, riid
) ||
469 IsEqualGUID(&IID_IDirectInputDevice2W
, riid
) ||
470 IsEqualGUID(&IID_IDirectInputDevice7W
, riid
) ||
471 IsEqualGUID(&IID_IDirectInputDevice8W
, riid
))
473 return alloc_device(rguid
, &JoystickWvt
, dinput
, (LPDIRECTINPUTDEVICEA
*)pdev
, index
);
475 WARN("no interface\n");
476 return DIERR_NOINTERFACE
;
479 WARN("invalid device GUID %s\n",debugstr_guid(rguid
));
480 return DIERR_DEVICENOTREG
;
485 const struct dinput_device joystick_linux_device
= {
486 "Wine Linux joystick driver",
489 joydev_create_deviceA
,
490 joydev_create_deviceW
493 /******************************************************************************
494 * Acquire : gets exclusive control of the joystick
496 static HRESULT WINAPI
JoystickLinuxAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface
)
498 JoystickImpl
*This
= (JoystickImpl
*)iface
;
501 TRACE("(%p)\n",This
);
503 res
= IDirectInputDevice2AImpl_Acquire(iface
);
507 /* open the joystick device */
508 if (This
->joyfd
==-1) {
509 TRACE("opening joystick device %s\n", This
->joydev
->device
);
511 This
->joyfd
= open(This
->joydev
->device
, O_RDONLY
);
512 if (This
->joyfd
==-1) {
513 ERR("open(%s) failed: %s\n", This
->joydev
->device
, strerror(errno
));
514 IDirectInputDevice2AImpl_Unacquire(iface
);
515 return DIERR_NOTFOUND
;
522 /******************************************************************************
523 * Unacquire : frees the joystick
525 static HRESULT WINAPI
JoystickLinuxAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface
)
527 JoystickImpl
*This
= (JoystickImpl
*)iface
;
530 TRACE("(%p)\n",This
);
532 res
= IDirectInputDevice2AImpl_Unacquire(iface
);
537 if (This
->joyfd
!=-1) {
538 TRACE("closing joystick device\n");
547 static void joy_polldev(LPDIRECTINPUTDEVICE8A iface
)
551 JoystickImpl
*This
= (JoystickImpl
*) iface
;
553 TRACE("(%p)\n", This
);
555 if (This
->joyfd
==-1) {
564 plfd
.fd
= This
->joyfd
;
565 plfd
.events
= POLLIN
;
566 if (poll(&plfd
,1,0) != 1)
568 /* we have one event, so we can read */
569 if (sizeof(jse
)!=read(This
->joyfd
,&jse
,sizeof(jse
))) {
572 TRACE("js_event: type 0x%x, number %d, value %d\n",
573 jse
.type
,jse
.number
,jse
.value
);
574 if (jse
.type
& JS_EVENT_BUTTON
)
576 if (jse
.number
>= This
->generic
.devcaps
.dwButtons
) return;
578 inst_id
= DIDFT_MAKEINSTANCE(jse
.number
) | DIDFT_PSHBUTTON
;
579 This
->generic
.js
.rgbButtons
[jse
.number
] = value
= jse
.value
? 0x80 : 0x00;
581 else if (jse
.type
& JS_EVENT_AXIS
)
583 int number
= This
->generic
.axis_map
[jse
.number
]; /* wine format object index */
585 if (number
< 0) return;
586 inst_id
= number
< 8 ? DIDFT_MAKEINSTANCE(number
) | DIDFT_ABSAXIS
:
587 DIDFT_MAKEINSTANCE(number
- 8) | DIDFT_POV
;
588 value
= joystick_map_axis(&This
->generic
.props
[id_to_object(This
->generic
.base
.data_format
.wine_df
, inst_id
)], jse
.value
);
590 TRACE("changing axis %d => %d\n", jse
.number
, number
);
593 case 0: This
->generic
.js
.lX
= value
; break;
594 case 1: This
->generic
.js
.lY
= value
; break;
595 case 2: This
->generic
.js
.lZ
= value
; break;
596 case 3: This
->generic
.js
.lRx
= value
; break;
597 case 4: This
->generic
.js
.lRy
= value
; break;
598 case 5: This
->generic
.js
.lRz
= value
; break;
599 case 6: This
->generic
.js
.rglSlider
[0] = value
; break;
600 case 7: This
->generic
.js
.rglSlider
[1] = value
; break;
601 case 8: case 9: case 10: case 11:
603 int idx
= number
- 8;
606 This
->povs
[idx
].y
= jse
.value
;
608 This
->povs
[idx
].x
= jse
.value
;
610 This
->generic
.js
.rgdwPOV
[idx
] = value
= joystick_map_pov(&This
->povs
[idx
]);
614 WARN("axis %d not supported\n", number
);
618 queue_event((LPDIRECTINPUTDEVICE8A
)This
, inst_id
,
619 value
, jse
.time
, This
->generic
.base
.dinput
->evsequence
++);
623 static const IDirectInputDevice8AVtbl JoystickAvt
=
625 IDirectInputDevice2AImpl_QueryInterface
,
626 IDirectInputDevice2AImpl_AddRef
,
627 IDirectInputDevice2AImpl_Release
,
628 JoystickAGenericImpl_GetCapabilities
,
629 IDirectInputDevice2AImpl_EnumObjects
,
630 JoystickAGenericImpl_GetProperty
,
631 JoystickAGenericImpl_SetProperty
,
632 JoystickLinuxAImpl_Acquire
,
633 JoystickLinuxAImpl_Unacquire
,
634 JoystickAGenericImpl_GetDeviceState
,
635 IDirectInputDevice2AImpl_GetDeviceData
,
636 IDirectInputDevice2AImpl_SetDataFormat
,
637 IDirectInputDevice2AImpl_SetEventNotification
,
638 IDirectInputDevice2AImpl_SetCooperativeLevel
,
639 JoystickAGenericImpl_GetObjectInfo
,
640 JoystickAGenericImpl_GetDeviceInfo
,
641 IDirectInputDevice2AImpl_RunControlPanel
,
642 IDirectInputDevice2AImpl_Initialize
,
643 IDirectInputDevice2AImpl_CreateEffect
,
644 IDirectInputDevice2AImpl_EnumEffects
,
645 IDirectInputDevice2AImpl_GetEffectInfo
,
646 IDirectInputDevice2AImpl_GetForceFeedbackState
,
647 IDirectInputDevice2AImpl_SendForceFeedbackCommand
,
648 IDirectInputDevice2AImpl_EnumCreatedEffectObjects
,
649 IDirectInputDevice2AImpl_Escape
,
650 JoystickAGenericImpl_Poll
,
651 IDirectInputDevice2AImpl_SendDeviceData
,
652 IDirectInputDevice7AImpl_EnumEffectsInFile
,
653 IDirectInputDevice7AImpl_WriteEffectToFile
,
654 IDirectInputDevice8AImpl_BuildActionMap
,
655 IDirectInputDevice8AImpl_SetActionMap
,
656 IDirectInputDevice8AImpl_GetImageInfo
659 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
660 # define XCAST(fun) (typeof(JoystickWvt.fun))
662 # define XCAST(fun) (void*)
665 static const IDirectInputDevice8WVtbl JoystickWvt
=
667 IDirectInputDevice2WImpl_QueryInterface
,
668 XCAST(AddRef
)IDirectInputDevice2AImpl_AddRef
,
669 XCAST(Release
)IDirectInputDevice2AImpl_Release
,
670 XCAST(GetCapabilities
)JoystickAGenericImpl_GetCapabilities
,
671 IDirectInputDevice2WImpl_EnumObjects
,
672 XCAST(GetProperty
)JoystickAGenericImpl_GetProperty
,
673 XCAST(SetProperty
)JoystickAGenericImpl_SetProperty
,
674 XCAST(Acquire
)JoystickLinuxAImpl_Acquire
,
675 XCAST(Unacquire
)JoystickLinuxAImpl_Unacquire
,
676 XCAST(GetDeviceState
)JoystickAGenericImpl_GetDeviceState
,
677 XCAST(GetDeviceData
)IDirectInputDevice2AImpl_GetDeviceData
,
678 XCAST(SetDataFormat
)IDirectInputDevice2AImpl_SetDataFormat
,
679 XCAST(SetEventNotification
)IDirectInputDevice2AImpl_SetEventNotification
,
680 XCAST(SetCooperativeLevel
)IDirectInputDevice2AImpl_SetCooperativeLevel
,
681 JoystickWGenericImpl_GetObjectInfo
,
682 JoystickWGenericImpl_GetDeviceInfo
,
683 XCAST(RunControlPanel
)IDirectInputDevice2AImpl_RunControlPanel
,
684 XCAST(Initialize
)IDirectInputDevice2AImpl_Initialize
,
685 XCAST(CreateEffect
)IDirectInputDevice2AImpl_CreateEffect
,
686 IDirectInputDevice2WImpl_EnumEffects
,
687 IDirectInputDevice2WImpl_GetEffectInfo
,
688 XCAST(GetForceFeedbackState
)IDirectInputDevice2AImpl_GetForceFeedbackState
,
689 XCAST(SendForceFeedbackCommand
)IDirectInputDevice2AImpl_SendForceFeedbackCommand
,
690 XCAST(EnumCreatedEffectObjects
)IDirectInputDevice2AImpl_EnumCreatedEffectObjects
,
691 XCAST(Escape
)IDirectInputDevice2AImpl_Escape
,
692 XCAST(Poll
)JoystickAGenericImpl_Poll
,
693 XCAST(SendDeviceData
)IDirectInputDevice2AImpl_SendDeviceData
,
694 IDirectInputDevice7WImpl_EnumEffectsInFile
,
695 IDirectInputDevice7WImpl_WriteEffectToFile
,
696 IDirectInputDevice8WImpl_BuildActionMap
,
697 IDirectInputDevice8WImpl_SetActionMap
,
698 IDirectInputDevice8WImpl_GetImageInfo
702 #else /* HAVE_LINUX_22_JOYSTICK_API */
704 const struct dinput_device joystick_linux_device
= {
705 "Wine Linux joystick driver",
712 #endif /* HAVE_LINUX_22_JOYSTICK_API */