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"
68 #include "dinput_private.h"
69 #include "device_private.h"
70 #include "joystick_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"
79 typedef struct JoystickImpl JoystickImpl;
80 static const IDirectInputDevice8AVtbl JoystickAvt;
81 static const IDirectInputDevice8WVtbl JoystickWvt;
84 struct JoystickGenericImpl generic;
88 /* joystick private */
94 static const GUID DInput_Wine_Joystick_GUID = { /* 9e573ed9-7734-11d2-8d4a-23903fb6bdf7 */
98 {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
101 #define MAX_JOYSTICKS 64
102 static INT joystick_devices_count = -1;
103 static LPSTR joystick_devices[MAX_JOYSTICKS];
105 static void joy_polldev(JoystickGenericImpl *This);
107 static INT find_joystick_devices(void)
111 if (joystick_devices_count != -1) return joystick_devices_count;
113 joystick_devices_count = 0;
114 for (i = 0; i < MAX_JOYSTICKS; i++)
116 CHAR device_name[MAX_PATH], *str;
120 len = sprintf(device_name, "%s%d", JOYDEV_NEW, i) + 1;
121 if ((fd = open(device_name, O_RDONLY)) < 0)
123 len = sprintf(device_name, "%s%d", JOYDEV_OLD, i) + 1;
124 if ((fd = open(device_name, O_RDONLY)) < 0) continue;
129 if (!(str = HeapAlloc(GetProcessHeap(), 0, len))) break;
130 memcpy(str, device_name, len);
132 joystick_devices[joystick_devices_count++] = str;
135 return joystick_devices_count;
138 static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
142 if (id >= find_joystick_devices()) return FALSE;
144 if (dwFlags & DIEDFL_FORCEFEEDBACK) {
145 WARN("force feedback not supported\n");
149 if ((dwDevType == 0) ||
150 ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) ||
151 (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))) {
152 /* check whether we have a joystick */
153 if ((fd = open(joystick_devices[id], O_RDONLY)) < 0)
155 WARN("open(%s, O_RDONLY) failed: %s\n", joystick_devices[id], strerror(errno));
159 /* Return joystick */
160 lpddi->guidInstance = DInput_Wine_Joystick_GUID;
161 lpddi->guidInstance.Data3 = id;
162 lpddi->guidProduct = DInput_Wine_Joystick_GUID;
163 /* we only support traditional joysticks for now */
164 if (version >= 0x0800)
165 lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
167 lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);
168 sprintf(lpddi->tszInstanceName, "Joystick %d", id);
169 #if defined(JSIOCGNAME)
170 if (ioctl(fd,JSIOCGNAME(sizeof(lpddi->tszProductName)),lpddi->tszProductName) < 0) {
171 WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", joystick_devices[id], strerror(errno));
172 strcpy(lpddi->tszProductName, "Wine Joystick");
175 strcpy(lpddi->tszProductName, "Wine Joystick");
178 lpddi->guidFFDriver = GUID_NULL;
180 TRACE("Enumerating the linux Joystick device: %s (%s)\n", joystick_devices[id], lpddi->tszProductName);
187 static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
193 if (id >= find_joystick_devices()) return FALSE;
195 if (dwFlags & DIEDFL_FORCEFEEDBACK) {
196 WARN("force feedback not supported\n");
200 if ((dwDevType == 0) ||
201 ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) ||
202 (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))) {
203 /* check whether we have a joystick */
204 if ((fd = open(joystick_devices[id], O_RDONLY)) < 0)
206 WARN("open(%s,O_RDONLY) failed: %s\n", joystick_devices[id], strerror(errno));
210 /* Return joystick */
211 lpddi->guidInstance = DInput_Wine_Joystick_GUID;
212 lpddi->guidInstance.Data3 = id;
213 lpddi->guidProduct = DInput_Wine_Joystick_GUID;
214 /* we only support traditional joysticks for now */
215 if (version >= 0x0800)
216 lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
218 lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);
219 sprintf(friendly, "Joystick %d", id);
220 MultiByteToWideChar(CP_ACP, 0, friendly, -1, lpddi->tszInstanceName, MAX_PATH);
221 #if defined(JSIOCGNAME)
222 if (ioctl(fd,JSIOCGNAME(sizeof(name)),name) < 0) {
223 WARN("ioctl(%s, JSIOCGNAME) failed: %s\n", joystick_devices[id], strerror(errno));
224 strcpy(name, "Wine Joystick");
227 strcpy(name, "Wine Joystick");
229 MultiByteToWideChar(CP_ACP, 0, name, -1, lpddi->tszProductName, MAX_PATH);
230 lpddi->guidFFDriver = GUID_NULL;
232 TRACE("Enumerating the linux Joystick device: %s (%s)\n", joystick_devices[id], name);
240 * Setup the dinput options.
243 static HRESULT setup_dinput_options(JoystickImpl * device)
245 char buffer[MAX_PATH+16];
251 buffer[MAX_PATH]='\0';
253 get_app_key(&hkey, &appkey);
257 if (!get_config_key( hkey, appkey, "DefaultDeadZone", buffer, MAX_PATH )) {
258 device->generic.deadzone = atoi(buffer);
259 TRACE("setting default deadzone to: \"%s\" %d\n", buffer, device->generic.deadzone);
262 device->generic.axis_map = HeapAlloc(GetProcessHeap(), 0, device->axes * sizeof(int));
263 if (!device->generic.axis_map) return DIERR_OUTOFMEMORY;
265 if (!get_config_key( hkey, appkey, device->generic.name, buffer, MAX_PATH )) {
266 static const char *axis_names[] = {"X", "Y", "Z", "Rx", "Ry", "Rz",
267 "Slider1", "Slider2",
268 "POV1", "POV2", "POV3", "POV4"};
269 const char *delim = ",";
271 TRACE("\"%s\" = \"%s\"\n", device->generic.name, buffer);
273 if ((ptr = strtok(buffer, delim)) != NULL) {
277 for (i = 0; i < sizeof(axis_names) / sizeof(axis_names[0]); i++)
278 if (!strcmp(ptr, axis_names[i]))
280 if (!strncmp(ptr, "POV", 3))
284 WARN("Only 4 POVs supported - ignoring extra\n");
289 /* Pov takes two axes */
290 device->generic.axis_map[tokens++] = i;
298 FIXME("Only 8 Axes supported - ignoring extra\n");
307 if (i == sizeof(axis_names) / sizeof(axis_names[0]))
309 ERR("invalid joystick axis type: \"%s\"\n", ptr);
313 device->generic.axis_map[tokens] = i;
315 } while ((ptr = strtok(NULL, delim)) != NULL);
317 if (tokens != device->axes) {
318 ERR("not all joystick axes mapped: %d axes(%d,%d), %d arguments\n", device->axes, axis, pov,tokens);
319 while (tokens < device->axes) {
320 device->generic.axis_map[tokens] = -1;
328 for (tokens = 0; tokens < device->axes; tokens++)
331 device->generic.axis_map[tokens] = axis++;
332 else if (tokens < 16)
334 device->generic.axis_map[tokens++] = 8 + pov;
335 device->generic.axis_map[tokens ] = 8 + pov++;
338 device->generic.axis_map[tokens] = -1;
341 device->generic.devcaps.dwAxes = axis;
342 device->generic.devcaps.dwPOVs = pov;
345 RegCloseKey( appkey );
353 static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *dinput,
354 LPDIRECTINPUTDEVICEA* pdev, unsigned short index)
357 JoystickImpl* newDevice;
360 LPDIDATAFORMAT df = NULL;
363 TRACE("%s %p %p %p %hu\n", debugstr_guid(rguid), jvt, dinput, pdev, index);
365 newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(JoystickImpl));
366 if (newDevice == 0) {
367 WARN("out of memory\n");
369 return DIERR_OUTOFMEMORY;
372 if (!lstrcpynA(newDevice->dev, joystick_devices[index], sizeof(newDevice->dev)) ||
373 (newDevice->joyfd = open(newDevice->dev, O_RDONLY)) < 0)
375 WARN("open(%s, O_RDONLY) failed: %s\n", newDevice->dev, strerror(errno));
376 HeapFree(GetProcessHeap(), 0, newDevice);
377 return DIERR_DEVICENOTREG;
380 newDevice->generic.guidInstance = DInput_Wine_Joystick_GUID;
381 newDevice->generic.guidInstance.Data3 = index;
382 newDevice->generic.guidProduct = DInput_Wine_Joystick_GUID;
383 newDevice->generic.joy_polldev = joy_polldev;
385 /* get the device name */
386 #if defined(JSIOCGNAME)
387 if (ioctl(newDevice->joyfd,JSIOCGNAME(MAX_PATH),name) < 0) {
388 WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", newDevice->dev, strerror(errno));
389 strcpy(name, "Wine Joystick");
392 strcpy(name, "Wine Joystick");
395 /* copy the device name */
396 newDevice->generic.name = HeapAlloc(GetProcessHeap(),0,strlen(name) + 1);
397 strcpy(newDevice->generic.name, name);
400 if (ioctl(newDevice->joyfd,JSIOCGAXES,&newDevice->axes) < 0) {
401 WARN("ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2\n", newDevice->dev, strerror(errno));
406 if (ioctl(newDevice->joyfd, JSIOCGBUTTONS, &newDevice->generic.devcaps.dwButtons) < 0) {
407 WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n", newDevice->dev, strerror(errno));
408 newDevice->generic.devcaps.dwButtons = 2;
412 if (newDevice->generic.devcaps.dwButtons > 128)
414 WARN("Can't support %d buttons. Clamping down to 128\n", newDevice->generic.devcaps.dwButtons);
415 newDevice->generic.devcaps.dwButtons = 128;
418 newDevice->generic.base.lpVtbl = jvt;
419 newDevice->generic.base.ref = 1;
420 newDevice->generic.base.dinput = dinput;
421 newDevice->generic.base.guid = *rguid;
422 InitializeCriticalSection(&newDevice->generic.base.crit);
423 newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->generic.base.crit");
425 /* setup_dinput_options may change these */
426 newDevice->generic.deadzone = 0;
428 /* do any user specified configuration */
429 hr = setup_dinput_options(newDevice);
433 /* Create copy of default data format */
434 if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2.dwSize))) goto FAILED;
435 memcpy(df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize);
437 df->dwNumObjs = newDevice->generic.devcaps.dwAxes + newDevice->generic.devcaps.dwPOVs + newDevice->generic.devcaps.dwButtons;
438 if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto FAILED;
440 for (i = 0; i < newDevice->axes; i++)
442 int wine_obj = newDevice->generic.axis_map[i];
444 if (wine_obj < 0) continue;
446 memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[wine_obj], df->dwObjSize);
448 df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(wine_obj) | DIDFT_ABSAXIS;
451 df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(wine_obj - 8) | DIDFT_POV;
452 i++; /* POV takes 2 axes */
455 for (i = 0; i < newDevice->generic.devcaps.dwButtons; i++)
457 memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[i + 12], df->dwObjSize);
458 df->rgodf[idx ].pguid = &GUID_Button;
459 df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_PSHBUTTON;
461 newDevice->generic.base.data_format.wine_df = df;
463 /* initialize default properties */
464 for (i = 0; i < c_dfDIJoystick2.dwNumObjs; i++) {
465 newDevice->generic.props[i].lDevMin = -32767;
466 newDevice->generic.props[i].lDevMax = +32767;
467 newDevice->generic.props[i].lMin = 0;
468 newDevice->generic.props[i].lMax = 0xffff;
469 newDevice->generic.props[i].lDeadZone = newDevice->generic.deadzone; /* % * 1000 */
470 newDevice->generic.props[i].lSaturation = 0;
473 IDirectInput_AddRef((LPDIRECTINPUTDEVICE8A)newDevice->generic.base.dinput);
475 newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps);
476 newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED;
477 if (newDevice->generic.base.dinput->dwVersion >= 0x0800)
478 newDevice->generic.devcaps.dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
480 newDevice->generic.devcaps.dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);
481 newDevice->generic.devcaps.dwFFSamplePeriod = 0;
482 newDevice->generic.devcaps.dwFFMinTimeResolution = 0;
483 newDevice->generic.devcaps.dwFirmwareRevision = 0;
484 newDevice->generic.devcaps.dwHardwareRevision = 0;
485 newDevice->generic.devcaps.dwFFDriverVersion = 0;
487 if (TRACE_ON(dinput)) {
488 _dump_DIDATAFORMAT(newDevice->generic.base.data_format.wine_df);
489 for (i = 0; i < (newDevice->axes); i++)
490 TRACE("axis_map[%d] = %d\n", i, newDevice->generic.axis_map[i]);
491 _dump_DIDEVCAPS(&newDevice->generic.devcaps);
494 *pdev = (LPDIRECTINPUTDEVICEA)newDevice;
499 hr = DIERR_OUTOFMEMORY;
501 if (df) HeapFree(GetProcessHeap(), 0, df->rgodf);
502 HeapFree(GetProcessHeap(), 0, df);
503 release_DataFormat(&newDevice->generic.base.data_format);
504 HeapFree(GetProcessHeap(),0,newDevice->generic.axis_map);
505 HeapFree(GetProcessHeap(),0,newDevice->generic.name);
506 HeapFree(GetProcessHeap(),0,newDevice);
512 /******************************************************************************
513 * get_joystick_index : Get the joystick index from a given GUID
515 static unsigned short get_joystick_index(REFGUID guid)
517 GUID wine_joystick = DInput_Wine_Joystick_GUID;
518 GUID dev_guid = *guid;
520 wine_joystick.Data3 = 0;
523 /* for the standard joystick GUID use index 0 */
524 if(IsEqualGUID(&GUID_Joystick,guid)) return 0;
526 /* for the wine joystick GUIDs use the index stored in Data3 */
527 if(IsEqualGUID(&wine_joystick, &dev_guid)) return guid->Data3;
529 return MAX_JOYSTICKS;
532 static HRESULT joydev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
534 unsigned short index;
536 TRACE("%p %s %p %p\n",dinput, debugstr_guid(rguid), riid, pdev);
537 find_joystick_devices();
540 if ((index = get_joystick_index(rguid)) < MAX_JOYSTICKS &&
541 joystick_devices_count && index < joystick_devices_count)
543 if ((riid == NULL) ||
544 IsEqualGUID(&IID_IDirectInputDeviceA, riid) ||
545 IsEqualGUID(&IID_IDirectInputDevice2A, riid) ||
546 IsEqualGUID(&IID_IDirectInputDevice7A, riid) ||
547 IsEqualGUID(&IID_IDirectInputDevice8A, riid))
549 return alloc_device(rguid, &JoystickAvt, dinput, pdev, index);
552 WARN("no interface\n");
553 return DIERR_NOINTERFACE;
556 return DIERR_DEVICENOTREG;
559 static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
561 unsigned short index;
563 TRACE("%p %s %p %p\n",dinput, debugstr_guid(rguid), riid, pdev);
564 find_joystick_devices();
567 if ((index = get_joystick_index(rguid)) < MAX_JOYSTICKS &&
568 joystick_devices_count && index < joystick_devices_count)
570 if ((riid == NULL) ||
571 IsEqualGUID(&IID_IDirectInputDeviceW, riid) ||
572 IsEqualGUID(&IID_IDirectInputDevice2W, riid) ||
573 IsEqualGUID(&IID_IDirectInputDevice7W, riid) ||
574 IsEqualGUID(&IID_IDirectInputDevice8W, riid))
576 return alloc_device(rguid, &JoystickWvt, dinput, (LPDIRECTINPUTDEVICEA *)pdev, index);
578 WARN("no interface\n");
579 return DIERR_NOINTERFACE;
582 WARN("invalid device GUID %s\n",debugstr_guid(rguid));
583 return DIERR_DEVICENOTREG;
588 const struct dinput_device joystick_linux_device = {
589 "Wine Linux joystick driver",
592 joydev_create_deviceA,
593 joydev_create_deviceW
596 /******************************************************************************
597 * Acquire : gets exclusive control of the joystick
599 static HRESULT WINAPI JoystickLinuxAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
601 JoystickImpl *This = (JoystickImpl *)iface;
604 TRACE("(%p)\n",This);
606 res = IDirectInputDevice2AImpl_Acquire(iface);
610 /* open the joystick device */
611 if (This->joyfd==-1) {
612 TRACE("opening joystick device %s\n", This->dev);
614 This->joyfd=open(This->dev,O_RDONLY);
615 if (This->joyfd==-1) {
616 ERR("open(%s) failed: %s\n", This->dev, strerror(errno));
617 IDirectInputDevice2AImpl_Unacquire(iface);
618 return DIERR_NOTFOUND;
625 /******************************************************************************
626 * Unacquire : frees the joystick
628 static HRESULT WINAPI JoystickLinuxAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
630 JoystickImpl *This = (JoystickImpl *)iface;
633 TRACE("(%p)\n",This);
635 res = IDirectInputDevice2AImpl_Unacquire(iface);
640 if (This->joyfd!=-1) {
641 TRACE("closing joystick device\n");
650 static void joy_polldev(JoystickGenericImpl *This_in) {
653 JoystickImpl *This = (JoystickImpl*) This_in;
655 TRACE("(%p)\n", This);
657 if (This->joyfd==-1) {
666 plfd.fd = This->joyfd;
667 plfd.events = POLLIN;
668 if (poll(&plfd,1,0) != 1)
670 /* we have one event, so we can read */
671 if (sizeof(jse)!=read(This->joyfd,&jse,sizeof(jse))) {
674 TRACE("js_event: type 0x%x, number %d, value %d\n",
675 jse.type,jse.number,jse.value);
676 if (jse.type & JS_EVENT_BUTTON)
678 if (jse.number >= This->generic.devcaps.dwButtons) return;
680 inst_id = DIDFT_MAKEINSTANCE(jse.number) | DIDFT_PSHBUTTON;
681 This->generic.js.rgbButtons[jse.number] = value = jse.value ? 0x80 : 0x00;
683 else if (jse.type & JS_EVENT_AXIS)
685 int number = This->generic.axis_map[jse.number]; /* wine format object index */
687 if (number < 0) return;
688 inst_id = DIDFT_MAKEINSTANCE(number) | (number < 8 ? DIDFT_ABSAXIS : DIDFT_POV);
689 value = joystick_map_axis(&This->generic.props[id_to_object(This->generic.base.data_format.wine_df, inst_id)], jse.value);
691 TRACE("changing axis %d => %d\n", jse.number, number);
694 case 0: This->generic.js.lX = value; break;
695 case 1: This->generic.js.lY = value; break;
696 case 2: This->generic.js.lZ = value; break;
697 case 3: This->generic.js.lRx = value; break;
698 case 4: This->generic.js.lRy = value; break;
699 case 5: This->generic.js.lRz = value; break;
700 case 6: This->generic.js.rglSlider[0] = value; break;
701 case 7: This->generic.js.rglSlider[1] = value; break;
702 case 8: case 9: case 10: case 11:
704 int idx = number - 8;
707 This->povs[idx].y = jse.value;
709 This->povs[idx].x = jse.value;
711 This->generic.js.rgdwPOV[idx] = value = joystick_map_pov(&This->povs[idx]);
715 WARN("axis %d not supported\n", number);
719 queue_event((LPDIRECTINPUTDEVICE8A)This,
720 id_to_offset(&This->generic.base.data_format, inst_id),
721 value, jse.time, This->generic.base.dinput->evsequence++);
725 static const IDirectInputDevice8AVtbl JoystickAvt =
727 IDirectInputDevice2AImpl_QueryInterface,
728 IDirectInputDevice2AImpl_AddRef,
729 IDirectInputDevice2AImpl_Release,
730 JoystickAGenericImpl_GetCapabilities,
731 IDirectInputDevice2AImpl_EnumObjects,
732 JoystickAGenericImpl_GetProperty,
733 JoystickAGenericImpl_SetProperty,
734 JoystickLinuxAImpl_Acquire,
735 JoystickLinuxAImpl_Unacquire,
736 JoystickAGenericImpl_GetDeviceState,
737 IDirectInputDevice2AImpl_GetDeviceData,
738 IDirectInputDevice2AImpl_SetDataFormat,
739 IDirectInputDevice2AImpl_SetEventNotification,
740 IDirectInputDevice2AImpl_SetCooperativeLevel,
741 JoystickAGenericImpl_GetObjectInfo,
742 JoystickAGenericImpl_GetDeviceInfo,
743 IDirectInputDevice2AImpl_RunControlPanel,
744 IDirectInputDevice2AImpl_Initialize,
745 IDirectInputDevice2AImpl_CreateEffect,
746 IDirectInputDevice2AImpl_EnumEffects,
747 IDirectInputDevice2AImpl_GetEffectInfo,
748 IDirectInputDevice2AImpl_GetForceFeedbackState,
749 IDirectInputDevice2AImpl_SendForceFeedbackCommand,
750 IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
751 IDirectInputDevice2AImpl_Escape,
752 JoystickAGenericImpl_Poll,
753 IDirectInputDevice2AImpl_SendDeviceData,
754 IDirectInputDevice7AImpl_EnumEffectsInFile,
755 IDirectInputDevice7AImpl_WriteEffectToFile,
756 IDirectInputDevice8AImpl_BuildActionMap,
757 IDirectInputDevice8AImpl_SetActionMap,
758 IDirectInputDevice8AImpl_GetImageInfo
761 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
762 # define XCAST(fun) (typeof(JoystickWvt.fun))
764 # define XCAST(fun) (void*)
767 static const IDirectInputDevice8WVtbl JoystickWvt =
769 IDirectInputDevice2WImpl_QueryInterface,
770 XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
771 XCAST(Release)IDirectInputDevice2AImpl_Release,
772 XCAST(GetCapabilities)JoystickAGenericImpl_GetCapabilities,
773 IDirectInputDevice2WImpl_EnumObjects,
774 XCAST(GetProperty)JoystickAGenericImpl_GetProperty,
775 XCAST(SetProperty)JoystickAGenericImpl_SetProperty,
776 XCAST(Acquire)JoystickLinuxAImpl_Acquire,
777 XCAST(Unacquire)JoystickLinuxAImpl_Unacquire,
778 XCAST(GetDeviceState)JoystickAGenericImpl_GetDeviceState,
779 XCAST(GetDeviceData)IDirectInputDevice2AImpl_GetDeviceData,
780 XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
781 XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
782 XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
783 JoystickWGenericImpl_GetObjectInfo,
784 JoystickWGenericImpl_GetDeviceInfo,
785 XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
786 XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
787 XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
788 IDirectInputDevice2WImpl_EnumEffects,
789 IDirectInputDevice2WImpl_GetEffectInfo,
790 XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
791 XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
792 XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
793 XCAST(Escape)IDirectInputDevice2AImpl_Escape,
794 XCAST(Poll)JoystickAGenericImpl_Poll,
795 XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
796 IDirectInputDevice7WImpl_EnumEffectsInFile,
797 IDirectInputDevice7WImpl_WriteEffectToFile,
798 IDirectInputDevice8WImpl_BuildActionMap,
799 IDirectInputDevice8WImpl_SetActionMap,
800 IDirectInputDevice8WImpl_GetImageInfo
804 #else /* HAVE_LINUX_22_JOYSTICK_API */
806 const struct dinput_device joystick_linux_device = {
807 "Wine Linux joystick driver",
814 #endif /* HAVE_LINUX_22_JOYSTICK_API */