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 GUID DInput_Wine_Joystick_GUID
= { /* 9e573ed9-7734-11d2-8d4a-23903fb6bdf7 */
120 {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
123 static void _dump_DIDEVCAPS(LPDIDEVCAPS 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 static int joydev_get_device(char *dev
, int id
)
149 sprintf(dev
, "%s%d", JOYDEV_NEW
, id
);
150 if ((ret
= open(dev
, O_RDONLY
)) < 0) {
151 sprintf(dev
, "%s%d", JOYDEV_OLD
, id
);
152 if ((ret
= open(dev
, O_RDONLY
)) < 0) {
159 static BOOL
joydev_enum_deviceA(DWORD dwDevType
, DWORD dwFlags
, LPDIDEVICEINSTANCEA lpddi
, DWORD version
, int id
)
164 if (dwFlags
& DIEDFL_FORCEFEEDBACK
) {
165 WARN("force feedback not supported\n");
169 if ((dwDevType
== 0) ||
170 ((dwDevType
== DIDEVTYPE_JOYSTICK
) && (version
> 0x0300 && version
< 0x0800)) ||
171 (((dwDevType
== DI8DEVCLASS_GAMECTRL
) || (dwDevType
== DI8DEVTYPE_JOYSTICK
)) && (version
>= 0x0800))) {
172 /* check whether we have a joystick */
173 if ((fd
= joydev_get_device(dev
, id
)) < 0) {
174 WARN("open(%s,O_RDONLY) failed: %s\n", dev
, strerror(errno
));
178 /* Return joystick */
179 lpddi
->guidInstance
= DInput_Wine_Joystick_GUID
;
180 lpddi
->guidInstance
.Data3
= id
;
181 lpddi
->guidProduct
= DInput_Wine_Joystick_GUID
;
182 /* we only support traditional joysticks for now */
183 if (version
>= 0x0800)
184 lpddi
->dwDevType
= DI8DEVTYPE_JOYSTICK
| (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
186 lpddi
->dwDevType
= DIDEVTYPE_JOYSTICK
| (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
187 sprintf(lpddi
->tszInstanceName
, "Joystick %d", id
);
188 #if defined(JSIOCGNAME)
189 if (ioctl(fd
,JSIOCGNAME(sizeof(lpddi
->tszProductName
)),lpddi
->tszProductName
) < 0) {
190 WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", dev
, strerror(errno
));
191 strcpy(lpddi
->tszProductName
, "Wine Joystick");
194 strcpy(lpddi
->tszProductName
, "Wine Joystick");
197 lpddi
->guidFFDriver
= GUID_NULL
;
199 TRACE("Enumerating the linux Joystick device: %s (%s)\n", dev
, lpddi
->tszProductName
);
206 static BOOL
joydev_enum_deviceW(DWORD dwDevType
, DWORD dwFlags
, LPDIDEVICEINSTANCEW lpddi
, DWORD version
, int id
)
213 if (dwFlags
& DIEDFL_FORCEFEEDBACK
) {
214 WARN("force feedback not supported\n");
218 if ((dwDevType
== 0) ||
219 ((dwDevType
== DIDEVTYPE_JOYSTICK
) && (version
> 0x0300 && version
< 0x0800)) ||
220 (((dwDevType
== DI8DEVCLASS_GAMECTRL
) || (dwDevType
== DI8DEVTYPE_JOYSTICK
)) && (version
>= 0x0800))) {
221 /* check whether we have a joystick */
222 if ((fd
= joydev_get_device(dev
, id
)) < 0) {
223 WARN("open(%s,O_RDONLY) failed: %s\n", dev
, strerror(errno
));
227 /* Return joystick */
228 lpddi
->guidInstance
= DInput_Wine_Joystick_GUID
;
229 lpddi
->guidInstance
.Data3
= id
;
230 lpddi
->guidProduct
= DInput_Wine_Joystick_GUID
;
231 /* we only support traditional joysticks for now */
232 if (version
>= 0x0800)
233 lpddi
->dwDevType
= DI8DEVTYPE_JOYSTICK
| (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
235 lpddi
->dwDevType
= DIDEVTYPE_JOYSTICK
| (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
236 sprintf(friendly
, "Joystick %d", id
);
237 MultiByteToWideChar(CP_ACP
, 0, friendly
, -1, lpddi
->tszInstanceName
, MAX_PATH
);
238 #if defined(JSIOCGNAME)
239 if (ioctl(fd
,JSIOCGNAME(sizeof(name
)),name
) < 0) {
240 WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", dev
, strerror(errno
));
241 strcpy(name
, "Wine Joystick");
244 strcpy(name
, "Wine Joystick");
246 MultiByteToWideChar(CP_ACP
, 0, name
, -1, lpddi
->tszProductName
, MAX_PATH
);
247 lpddi
->guidFFDriver
= GUID_NULL
;
249 TRACE("Enumerating the linux Joystick device: %s (%s)\n",dev
,name
);
257 * Get a config key from either the app-specific or the default config
260 inline static DWORD
get_config_key( HKEY defkey
, HKEY appkey
, const char *name
,
261 char *buffer
, DWORD size
)
263 if (appkey
&& !RegQueryValueExA( appkey
, name
, 0, NULL
, (LPBYTE
)buffer
, &size
))
266 if (defkey
&& !RegQueryValueExA( defkey
, name
, 0, NULL
, (LPBYTE
)buffer
, &size
))
269 return ERROR_FILE_NOT_FOUND
;
273 * Setup the dinput options.
276 static HRESULT
setup_dinput_options(JoystickImpl
* device
)
278 char buffer
[MAX_PATH
+16];
279 HKEY hkey
, appkey
= 0;
282 buffer
[MAX_PATH
]='\0';
284 /* @@ Wine registry key: HKCU\Software\Wine\DirectInput */
285 if (RegOpenKeyA( HKEY_CURRENT_USER
, "Software\\Wine\\DirectInput", &hkey
)) hkey
= 0;
287 len
= GetModuleFileNameA( 0, buffer
, MAX_PATH
);
288 if (len
&& len
< MAX_PATH
) {
290 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectInput */
291 if (!RegOpenKeyA( HKEY_CURRENT_USER
, "Software\\Wine\\AppDefaults", &tmpkey
))
293 char *p
, *appname
= buffer
;
294 if ((p
= strrchr( appname
, '/' ))) appname
= p
+ 1;
295 if ((p
= strrchr( appname
, '\\' ))) appname
= p
+ 1;
296 strcat( appname
, "\\DirectInput" );
297 if (RegOpenKeyA( tmpkey
, appname
, &appkey
)) appkey
= 0;
298 RegCloseKey( tmpkey
);
304 if (!get_config_key( hkey
, appkey
, "DefaultDeadZone", buffer
, MAX_PATH
)) {
305 device
->deadzone
= atoi(buffer
);
306 TRACE("setting default deadzone to: \"%s\" %d\n", buffer
, device
->deadzone
);
309 if (!get_config_key( hkey
, appkey
, device
->name
, buffer
, MAX_PATH
)) {
313 const char *delim
= ",";
315 TRACE("\"%s\" = \"%s\"\n", device
->name
, buffer
);
317 device
->axis_map
= HeapAlloc(GetProcessHeap(), 0, device
->axes
* sizeof(int));
318 if (device
->axis_map
== 0)
319 return DIERR_OUTOFMEMORY
;
321 if ((ptr
= strtok(buffer
, delim
)) != NULL
) {
323 if (strcmp(ptr
, "X") == 0) {
324 device
->axis_map
[tokens
] = 0;
326 } else if (strcmp(ptr
, "Y") == 0) {
327 device
->axis_map
[tokens
] = 1;
329 } else if (strcmp(ptr
, "Z") == 0) {
330 device
->axis_map
[tokens
] = 2;
332 } else if (strcmp(ptr
, "Rx") == 0) {
333 device
->axis_map
[tokens
] = 3;
335 } else if (strcmp(ptr
, "Ry") == 0) {
336 device
->axis_map
[tokens
] = 4;
338 } else if (strcmp(ptr
, "Rz") == 0) {
339 device
->axis_map
[tokens
] = 5;
341 } else if (strcmp(ptr
, "Slider1") == 0) {
342 device
->axis_map
[tokens
] = 6;
344 } else if (strcmp(ptr
, "Slider2") == 0) {
345 device
->axis_map
[tokens
] = 7;
347 } else if (strcmp(ptr
, "POV1") == 0) {
348 device
->axis_map
[tokens
++] = 8;
349 device
->axis_map
[tokens
] = 8;
351 } else if (strcmp(ptr
, "POV2") == 0) {
352 device
->axis_map
[tokens
++] = 9;
353 device
->axis_map
[tokens
] = 9;
355 } else if (strcmp(ptr
, "POV3") == 0) {
356 device
->axis_map
[tokens
++] = 10;
357 device
->axis_map
[tokens
] = 10;
359 } else if (strcmp(ptr
, "POV4") == 0) {
360 device
->axis_map
[tokens
++] = 11;
361 device
->axis_map
[tokens
] = 11;
364 ERR("invalid joystick axis type: %s\n", ptr
);
365 device
->axis_map
[tokens
] = tokens
;
370 } while ((ptr
= strtok(NULL
, delim
)) != NULL
);
372 if (tokens
!= device
->devcaps
.dwAxes
) {
373 ERR("not all joystick axes mapped: %d axes(%d,%d), %d arguments\n", device
->axes
, axis
, pov
,tokens
);
374 while (tokens
< device
->axes
) {
375 device
->axis_map
[tokens
] = tokens
;
381 device
->devcaps
.dwAxes
= axis
;
382 device
->devcaps
.dwPOVs
= pov
;
386 RegCloseKey( appkey
);
394 static HRESULT
alloc_device(REFGUID rguid
, const void *jvt
, IDirectInputImpl
*dinput
, LPDIRECTINPUTDEVICEA
* pdev
)
397 JoystickImpl
* newDevice
;
400 LPDIDATAFORMAT df
= NULL
;
403 newDevice
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(JoystickImpl
));
404 if (newDevice
== 0) {
405 WARN("out of memory\n");
407 return DIERR_OUTOFMEMORY
;
410 if ((newDevice
->joyfd
= joydev_get_device(newDevice
->dev
, rguid
->Data3
)) < 0) {
411 WARN("open(%s,O_RDONLY) failed: %s\n", newDevice
->dev
, strerror(errno
));
412 HeapFree(GetProcessHeap(), 0, newDevice
);
413 return DIERR_DEVICENOTREG
;
416 /* get the device name */
417 #if defined(JSIOCGNAME)
418 if (ioctl(newDevice
->joyfd
,JSIOCGNAME(MAX_PATH
),name
) < 0) {
419 WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", newDevice
->dev
, strerror(errno
));
420 strcpy(name
, "Wine Joystick");
423 strcpy(name
, "Wine Joystick");
426 /* copy the device name */
427 newDevice
->name
= HeapAlloc(GetProcessHeap(),0,strlen(name
) + 1);
428 strcpy(newDevice
->name
, name
);
431 if (ioctl(newDevice
->joyfd
,JSIOCGAXES
,&newDevice
->axes
) < 0) {
432 WARN("ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2\n", newDevice
->dev
, strerror(errno
));
437 if (ioctl(newDevice
->joyfd
,JSIOCGBUTTONS
,&newDevice
->buttons
) < 0) {
438 WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n", newDevice
->dev
, strerror(errno
));
439 newDevice
->buttons
= 2;
443 newDevice
->base
.lpVtbl
= jvt
;
444 newDevice
->base
.ref
= 1;
445 newDevice
->dinput
= dinput
;
446 CopyMemory(&newDevice
->base
.guid
, rguid
, sizeof(*rguid
));
447 InitializeCriticalSection(&newDevice
->base
.crit
);
448 newDevice
->base
.crit
.DebugInfo
->Spare
[0] = (DWORD_PTR
)"DINPUT_joystick";
450 /* setup_dinput_options may change these */
451 newDevice
->deadzone
= 5000;
452 newDevice
->devcaps
.dwButtons
= newDevice
->buttons
;
453 newDevice
->devcaps
.dwAxes
= newDevice
->axes
;
454 newDevice
->devcaps
.dwPOVs
= 0;
456 /* do any user specified configuration */
457 hr
= setup_dinput_options(newDevice
);
461 if (newDevice
->axis_map
== 0) {
462 newDevice
->axis_map
= HeapAlloc(GetProcessHeap(), 0, newDevice
->axes
* sizeof(int));
463 if (newDevice
->axis_map
== 0)
466 for (i
= 0; i
< newDevice
->axes
; i
++)
467 newDevice
->axis_map
[i
] = i
;
470 /* Create copy of default data format */
471 if (!(df
= HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2
.dwSize
))) goto FAILED
;
472 memcpy(df
, &c_dfDIJoystick2
, c_dfDIJoystick2
.dwSize
);
474 /* Axes include POVs */
475 df
->dwNumObjs
= newDevice
->axes
+ newDevice
->buttons
;
476 if (!(df
->rgodf
= HeapAlloc(GetProcessHeap(), 0, df
->dwNumObjs
* df
->dwObjSize
))) goto FAILED
;
478 for (i
= 0; i
< newDevice
->axes
; i
++)
480 int wine_obj
= newDevice
->axis_map
[i
];
482 memcpy(&df
->rgodf
[idx
], &c_dfDIJoystick2
.rgodf
[wine_obj
], df
->dwObjSize
);
484 df
->rgodf
[idx
++].dwType
= DIDFT_MAKEINSTANCE(wine_obj
) | DIDFT_ABSAXIS
;
486 df
->rgodf
[idx
++].dwType
= DIDFT_MAKEINSTANCE(wine_obj
- 8) | DIDFT_POV
;
488 for (i
= 0; i
< newDevice
->buttons
; i
++)
490 memcpy(&df
->rgodf
[idx
], &c_dfDIJoystick2
.rgodf
[i
+ 12], df
->dwObjSize
);
491 df
->rgodf
[idx
++].dwType
= DIDFT_MAKEINSTANCE(i
) | DIDFT_PSHBUTTON
;
493 newDevice
->base
.data_format
.wine_df
= df
;
495 /* create default properties */
496 newDevice
->props
= HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2
.dwNumObjs
*sizeof(ObjProps
));
497 if (newDevice
->props
== 0)
500 /* initialize default properties */
501 for (i
= 0; i
< c_dfDIJoystick2
.dwNumObjs
; i
++) {
502 newDevice
->props
[i
].lMin
= 0;
503 newDevice
->props
[i
].lMax
= 0xffff;
504 newDevice
->props
[i
].lDeadZone
= newDevice
->deadzone
; /* % * 1000 */
505 newDevice
->props
[i
].lSaturation
= 0;
508 IDirectInput_AddRef((LPDIRECTINPUTDEVICE8A
)newDevice
->dinput
);
510 newDevice
->devcaps
.dwSize
= sizeof(newDevice
->devcaps
);
511 newDevice
->devcaps
.dwFlags
= DIDC_ATTACHED
;
512 if (newDevice
->dinput
->dwVersion
>= 0x0800)
513 newDevice
->devcaps
.dwDevType
= DI8DEVTYPE_JOYSTICK
| (DI8DEVTYPEJOYSTICK_STANDARD
<< 8);
515 newDevice
->devcaps
.dwDevType
= DIDEVTYPE_JOYSTICK
| (DIDEVTYPEJOYSTICK_TRADITIONAL
<< 8);
516 newDevice
->devcaps
.dwFFSamplePeriod
= 0;
517 newDevice
->devcaps
.dwFFMinTimeResolution
= 0;
518 newDevice
->devcaps
.dwFirmwareRevision
= 0;
519 newDevice
->devcaps
.dwHardwareRevision
= 0;
520 newDevice
->devcaps
.dwFFDriverVersion
= 0;
522 if (TRACE_ON(dinput
)) {
523 _dump_DIDATAFORMAT(newDevice
->base
.data_format
.wine_df
);
524 for (i
= 0; i
< (newDevice
->axes
); i
++)
525 TRACE("axis_map[%d] = %d\n", i
, newDevice
->axis_map
[i
]);
526 _dump_DIDEVCAPS(&newDevice
->devcaps
);
529 *pdev
= (LPDIRECTINPUTDEVICEA
)newDevice
;
534 hr
= DIERR_OUTOFMEMORY
;
536 if (df
) HeapFree(GetProcessHeap(), 0, df
->rgodf
);
537 HeapFree(GetProcessHeap(), 0, df
);
538 release_DataFormat(&newDevice
->base
.data_format
);
539 HeapFree(GetProcessHeap(),0,newDevice
->axis_map
);
540 HeapFree(GetProcessHeap(),0,newDevice
->name
);
541 HeapFree(GetProcessHeap(),0,newDevice
->props
);
542 HeapFree(GetProcessHeap(),0,newDevice
);
548 static BOOL
IsJoystickGUID(REFGUID guid
)
550 GUID wine_joystick
= DInput_Wine_Joystick_GUID
;
551 GUID dev_guid
= *guid
;
553 wine_joystick
.Data3
= 0;
556 return IsEqualGUID(&wine_joystick
, &dev_guid
);
559 static HRESULT
joydev_create_deviceA(IDirectInputImpl
*dinput
, REFGUID rguid
, REFIID riid
, LPDIRECTINPUTDEVICEA
* pdev
)
561 if ((IsEqualGUID(&GUID_Joystick
,rguid
)) ||
562 (IsJoystickGUID(rguid
))) {
563 if ((riid
== NULL
) ||
564 IsEqualGUID(&IID_IDirectInputDeviceA
,riid
) ||
565 IsEqualGUID(&IID_IDirectInputDevice2A
,riid
) ||
566 IsEqualGUID(&IID_IDirectInputDevice7A
,riid
) ||
567 IsEqualGUID(&IID_IDirectInputDevice8A
,riid
)) {
568 return alloc_device(rguid
, &JoystickAvt
, dinput
, pdev
);
570 WARN("no interface\n");
572 return DIERR_NOINTERFACE
;
576 WARN("invalid device GUID\n");
578 return DIERR_DEVICENOTREG
;
581 static HRESULT
joydev_create_deviceW(IDirectInputImpl
*dinput
, REFGUID rguid
, REFIID riid
, LPDIRECTINPUTDEVICEW
* pdev
)
583 if ((IsEqualGUID(&GUID_Joystick
,rguid
)) ||
584 (IsJoystickGUID(rguid
))) {
585 if ((riid
== NULL
) ||
586 IsEqualGUID(&IID_IDirectInputDeviceW
,riid
) ||
587 IsEqualGUID(&IID_IDirectInputDevice2W
,riid
) ||
588 IsEqualGUID(&IID_IDirectInputDevice7W
,riid
) ||
589 IsEqualGUID(&IID_IDirectInputDevice8W
,riid
)) {
590 return alloc_device(rguid
, &JoystickWvt
, dinput
, (LPDIRECTINPUTDEVICEA
*)pdev
);
592 WARN("no interface\n");
594 return DIERR_NOINTERFACE
;
598 WARN("invalid device GUID\n");
600 return DIERR_DEVICENOTREG
;
603 const struct dinput_device joystick_linux_device
= {
604 "Wine Linux joystick driver",
607 joydev_create_deviceA
,
608 joydev_create_deviceW
611 /******************************************************************************
614 static ULONG WINAPI
JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface
)
616 JoystickImpl
*This
= (JoystickImpl
*)iface
;
619 ref
= InterlockedDecrement(&This
->base
.ref
);
623 /* Free the device name */
624 HeapFree(GetProcessHeap(),0,This
->name
);
626 /* Free the axis map */
627 HeapFree(GetProcessHeap(),0,This
->axis_map
);
629 /* Free the data queue */
630 HeapFree(GetProcessHeap(), 0, This
->base
.data_queue
);
632 /* Free the properties */
633 HeapFree(GetProcessHeap(), 0, This
->props
);
635 /* release the data transform filter */
636 HeapFree(GetProcessHeap(), 0, This
->base
.data_format
.wine_df
->rgodf
);
637 HeapFree(GetProcessHeap(), 0, This
->base
.data_format
.wine_df
);
638 release_DataFormat(&This
->base
.data_format
);
640 This
->base
.crit
.DebugInfo
->Spare
[0] = 0;
641 IDirectInput_Release((LPDIRECTINPUTDEVICE8A
)This
->dinput
);
642 DeleteCriticalSection(&This
->base
.crit
);
644 HeapFree(GetProcessHeap(),0,This
);
648 /******************************************************************************
649 * SetDataFormat : the application can choose the format of the data
650 * the device driver sends back with GetDeviceState.
652 static HRESULT WINAPI
JoystickAImpl_SetDataFormat(
653 LPDIRECTINPUTDEVICE8A iface
,
656 JoystickImpl
*This
= (JoystickImpl
*)iface
;
660 TRACE("(%p,%p)\n",This
,df
);
662 hr
= IDirectInputDevice2AImpl_SetDataFormat(iface
, df
);
663 if (FAILED(hr
)) return hr
;
665 for (i
= 0; i
< This
->base
.data_format
.wine_df
->dwNumObjs
; i
++)
667 This
->props
[i
].lMin
= 0;
668 This
->props
[i
].lMax
= 0xffff;
669 This
->props
[i
].lDeadZone
= 1000;
670 This
->props
[i
].lSaturation
= 0;
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_AXIS
: 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 JoystickAImpl_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
)JoystickAImpl_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 */