1 /* DirectInput Joystick device
3 * Copyright 1998,2000 Marcus Meissner
4 * Copyright 1998,1999 Lionel Ulmer
5 * Copyright 2000-2001 TransGaming Technologies Inc.
6 * Copyright 2005 Daniel Remenak
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/port.h"
34 #ifdef HAVE_SYS_TIME_H
35 # include <sys/time.h>
38 #ifdef HAVE_SYS_IOCTL_H
39 # include <sys/ioctl.h>
42 #ifdef HAVE_SYS_ERRNO_H
43 # include <sys/errno.h>
45 #ifdef HAVE_LINUX_INPUT_H
46 # include <linux/input.h>
48 # if defined(EVIOCGBIT) && defined(EV_ABS) && defined(BTN_PINKIE)
49 # define HAVE_CORRECT_LINUXINPUT_H
52 #ifdef HAVE_SYS_POLL_H
53 # include <sys/poll.h>
56 #include "wine/debug.h"
57 #include "wine/unicode.h"
58 #include "wine/list.h"
65 #include "dinput_private.h"
66 #include "device_private.h"
67 #include "joystick_private.h"
69 WINE_DEFAULT_DEBUG_CHANNEL(dinput);
71 #ifdef HAVE_CORRECT_LINUXINPUT_H
73 #define EVDEVPREFIX "/dev/input/event"
75 /* Wine joystick driver object instances */
76 #define WINE_JOYSTICK_MAX_AXES 8
77 #define WINE_JOYSTICK_MAX_POVS 4
78 #define WINE_JOYSTICK_MAX_BUTTONS 128
80 struct wine_input_absinfo {
88 /* implemented in effect_linuxinput.c */
89 HRESULT linuxinput_create_effect(int* fd, REFGUID rguid, struct list *parent_list_entry, LPDIRECTINPUTEFFECT* peff);
90 HRESULT linuxinput_get_info_A(int fd, REFGUID rguid, LPDIEFFECTINFOA info);
91 HRESULT linuxinput_get_info_W(int fd, REFGUID rguid, LPDIEFFECTINFOW info);
93 typedef struct JoystickImpl JoystickImpl;
94 static const IDirectInputDevice8AVtbl JoystickAvt;
95 static const IDirectInputDevice8WVtbl JoystickWvt;
105 /* data returned by EVIOCGBIT for caps, EV_ABS, EV_KEY, and EV_FF */
106 BYTE evbits[(EV_MAX+7)/8];
107 BYTE absbits[(ABS_MAX+7)/8];
108 BYTE keybits[(KEY_MAX+7)/8];
109 BYTE ffbits[(FF_MAX+7)/8];
111 /* data returned by the EVIOCGABS() ioctl */
112 struct wine_input_absinfo axes[ABS_MAX];
117 struct JoystickGenericImpl generic;
118 struct JoyDev *joydev;
120 /* joystick private */
123 int dev_axes_to_di[ABS_MAX];
126 /* LUT for KEY_ to offset in rgbButtons */
127 BYTE buttons[KEY_MAX];
129 /* Force feedback variables */
130 struct list ff_effects;
136 static void fake_current_js_state(JoystickImpl *ji);
137 static void find_joydevs(void);
138 static void joy_polldev(JoystickGenericImpl *This);
140 /* This GUID is slightly different from the linux joystick one. Take note. */
141 static const GUID DInput_Wine_Joystick_Base_GUID = { /* 9e573eda-7734-11d2-8d4a-23903fb6bdf7 */
145 {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
148 #define test_bit(arr,bit) (((BYTE*)(arr))[(bit)>>3]&(1<<((bit)&7)))
150 #define MAX_JOYDEV 64
152 static int have_joydevs = -1;
153 static struct JoyDev *joydevs = NULL;
155 static void find_joydevs(void)
159 if (InterlockedCompareExchange(&have_joydevs, 0, -1) != -1)
160 /* Someone beat us to it */
163 for (i = 0; i < MAX_JOYDEV; i++)
166 struct JoyDev joydev = {0};
170 struct JoyDev *new_joydevs;
172 snprintf(buf, sizeof(buf), EVDEVPREFIX"%d", i);
174 if ((fd = open(buf, O_RDWR)) == -1)
176 fd = open(buf, O_RDONLY);
182 WARN("Failed to open \"%s\": %d %s\n", buf, errno, strerror(errno));
186 if (ioctl(fd, EVIOCGBIT(0, sizeof(joydev.evbits)), joydev.evbits) == -1)
188 WARN("ioct(EVIOCGBIT, 0) failed: %d %s\n", errno, strerror(errno));
192 if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(joydev.absbits)), joydev.absbits) == -1)
194 WARN("ioct(EVIOCGBIT, EV_ABS) failed: %d %s\n", errno, strerror(errno));
198 if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(joydev.keybits)), joydev.keybits) == -1)
200 WARN("ioct(EVIOCGBIT, EV_KEY) failed: %d %s\n", errno, strerror(errno));
205 /* A true joystick has at least axis X and Y, and at least 1
206 * button. copied from linux/drivers/input/joydev.c */
207 if (!test_bit(joydev.absbits, ABS_X) || !test_bit(joydev.absbits, ABS_Y) ||
208 !(test_bit(joydev.keybits, BTN_TRIGGER) ||
209 test_bit(joydev.keybits, BTN_A) ||
210 test_bit(joydev.keybits, BTN_1)))
216 if (!(joydev.device = HeapAlloc(GetProcessHeap(), 0, strlen(buf) + 1)))
221 strcpy(joydev.device, buf);
223 buf[MAX_PATH - 1] = 0;
224 if (ioctl(fd, EVIOCGNAME(MAX_PATH - 1), buf) != -1 &&
225 (joydev.name = HeapAlloc(GetProcessHeap(), 0, strlen(buf) + 1)))
226 strcpy(joydev.name, buf);
228 joydev.name = joydev.device;
230 joydev.guid = DInput_Wine_Joystick_Base_GUID;
231 joydev.guid.Data3 += have_joydevs;
233 TRACE("Found a joystick on %s: %s (%s)\n",
234 joydev.device, joydev.name,
235 debugstr_guid(&joydev.guid)
238 #ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
240 test_bit(joydev.evbits, EV_FF) &&
241 ioctl(fd, EVIOCGBIT(EV_FF, sizeof(joydev.ffbits)), joydev.ffbits) != -1 &&
242 ioctl(fd, EVIOCGEFFECTS, &joydev.num_effects) != -1 &&
243 joydev.num_effects > 0)
245 TRACE(" ... with force feedback\n");
250 for (j = 0; j < ABS_MAX;j ++)
252 if (!test_bit(joydev.absbits, j)) continue;
253 if (ioctl(fd, EVIOCGABS(j), &(joydev.axes[j])) != -1)
255 TRACE(" ... with axis %d: cur=%d, min=%d, max=%d, fuzz=%d, flat=%d\n",
257 joydev.axes[j].value,
258 joydev.axes[j].minimum,
259 joydev.axes[j].maximum,
267 new_joydevs = HeapAlloc(GetProcessHeap(), 0, sizeof(struct JoyDev));
269 new_joydevs = HeapReAlloc(GetProcessHeap(), 0, joydevs, (1 + have_joydevs) * sizeof(struct JoyDev));
276 joydevs = new_joydevs;
277 memcpy(joydevs + have_joydevs, &joydev, sizeof(joydev));
284 static void fill_joystick_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
286 DWORD dwSize = lpddi->dwSize;
288 TRACE("%d %p\n", dwSize, lpddi);
289 memset(lpddi, 0, dwSize);
291 lpddi->dwSize = dwSize;
292 lpddi->guidInstance = joydevs[id].guid;
293 lpddi->guidProduct = DInput_Wine_Joystick_Base_GUID;
294 lpddi->guidFFDriver = GUID_NULL;
296 if (version >= 0x0800)
297 lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
299 lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);
301 strcpy(lpddi->tszInstanceName, joydevs[id].name);
302 strcpy(lpddi->tszProductName, joydevs[id].name);
305 static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
307 DWORD dwSize = lpddi->dwSize;
309 TRACE("%d %p\n", dwSize, lpddi);
310 memset(lpddi, 0, dwSize);
312 lpddi->dwSize = dwSize;
313 lpddi->guidInstance = joydevs[id].guid;
314 lpddi->guidProduct = DInput_Wine_Joystick_Base_GUID;
315 lpddi->guidFFDriver = GUID_NULL;
317 if (version >= 0x0800)
318 lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
320 lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);
322 MultiByteToWideChar(CP_ACP, 0, joydevs[id].name, -1, lpddi->tszInstanceName, MAX_PATH);
323 MultiByteToWideChar(CP_ACP, 0, joydevs[id].name, -1, lpddi->tszProductName, MAX_PATH);
326 static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
330 if (id >= have_joydevs) {
334 if (!((dwDevType == 0) ||
335 ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) ||
336 (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))))
339 #ifndef HAVE_STRUCT_FF_EFFECT_DIRECTION
340 if (dwFlags & DIEDFL_FORCEFEEDBACK)
344 if (!(dwFlags & DIEDFL_FORCEFEEDBACK) || joydevs[id].has_ff) {
345 fill_joystick_dideviceinstanceA(lpddi, version, id);
351 static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
355 if (id >= have_joydevs) {
359 if (!((dwDevType == 0) ||
360 ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) ||
361 (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))))
364 #ifndef HAVE_STRUCT_FF_EFFECT_DIRECTION
365 if (dwFlags & DIEDFL_FORCEFEEDBACK)
369 if (!(dwFlags & DIEDFL_FORCEFEEDBACK) || joydevs[id].has_ff) {
370 fill_joystick_dideviceinstanceW(lpddi, version, id);
376 static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *dinput, unsigned short index)
378 JoystickImpl* newDevice;
379 LPDIDATAFORMAT df = NULL;
381 int default_axis_map[WINE_JOYSTICK_MAX_AXES + WINE_JOYSTICK_MAX_POVS*2];
383 newDevice = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(JoystickImpl));
384 if (!newDevice) return NULL;
386 newDevice->generic.base.lpVtbl = jvt;
387 newDevice->generic.base.ref = 1;
388 newDevice->generic.base.guid = *rguid;
389 newDevice->generic.base.dinput = dinput;
390 newDevice->generic.joy_polldev = joy_polldev;
391 newDevice->joyfd = -1;
392 newDevice->joydev = &joydevs[index];
393 newDevice->generic.name = newDevice->joydev->name;
394 list_init(&newDevice->ff_effects);
395 #ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
396 newDevice->ff_state = FF_STATUS_STOPPED;
398 /* There is no way in linux to query force feedback autocenter status.
399 Instead, track it with ff_autocenter, and assume it's initialy
401 newDevice->ff_autocenter = 1;
402 newDevice->ff_gain = 0xFFFF;
403 InitializeCriticalSection(&newDevice->generic.base.crit);
404 newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->base.crit");
406 /* Count number of available axes - supported Axis & POVs */
407 for (i = 0; i < WINE_JOYSTICK_MAX_AXES; i++)
409 if (test_bit(newDevice->joydev->absbits, i))
411 newDevice->generic.device_axis_count++;
412 newDevice->dev_axes_to_di[i] = idx;
413 newDevice->generic.props[idx].lDevMin = newDevice->joydev->axes[i].minimum;
414 newDevice->generic.props[idx].lDevMax = newDevice->joydev->axes[i].maximum;
415 default_axis_map[idx] = i;
419 newDevice->dev_axes_to_di[i] = -1;
422 for (i = 0; i < WINE_JOYSTICK_MAX_POVS; i++)
424 if (test_bit(newDevice->joydev->absbits, ABS_HAT0X + i * 2) &&
425 test_bit(newDevice->joydev->absbits, ABS_HAT0Y + i * 2))
427 newDevice->generic.device_axis_count += 2;
428 newDevice->generic.props[idx ].lDevMin = newDevice->joydev->axes[ABS_HAT0X + i * 2].minimum;
429 newDevice->generic.props[idx ].lDevMax = newDevice->joydev->axes[ABS_HAT0X + i * 2].maximum;
430 newDevice->dev_axes_to_di[ABS_HAT0X + i * 2] = idx;
431 newDevice->generic.props[idx+1].lDevMin = newDevice->joydev->axes[ABS_HAT0Y + i * 2].minimum;
432 newDevice->generic.props[idx+1].lDevMax = newDevice->joydev->axes[ABS_HAT0Y + i * 2].maximum;
433 newDevice->dev_axes_to_di[ABS_HAT0Y + i * 2] = idx + 1;
435 default_axis_map[idx] = default_axis_map[idx + 1] = WINE_JOYSTICK_MAX_AXES + i;
439 newDevice->dev_axes_to_di[ABS_HAT0X + i * 2] = newDevice->dev_axes_to_di[ABS_HAT0Y + i * 2] = -1;
442 /* do any user specified configuration */
443 if (setup_dinput_options(&newDevice->generic, default_axis_map) != DI_OK) goto failed;
445 /* Create copy of default data format */
446 if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2.dwSize))) goto failed;
447 memcpy(df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize);
448 if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto failed;
451 /* Construct internal data format */
453 /* Supported Axis & POVs */
454 for (i = 0, idx = 0; i < newDevice->generic.device_axis_count; i++)
456 int wine_obj = newDevice->generic.axis_map[i];
458 if (wine_obj < 0) continue;
460 memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[wine_obj], df->dwObjSize);
462 df->rgodf[idx].dwType = DIDFT_MAKEINSTANCE(wine_obj) | DIDFT_ABSAXIS;
465 df->rgodf[idx].dwType = DIDFT_MAKEINSTANCE(wine_obj - 8) | DIDFT_POV;
466 i++; /* POV takes 2 axes */
469 newDevice->generic.props[idx].lMin = 0;
470 newDevice->generic.props[idx].lMax = 0xffff;
471 newDevice->generic.props[idx].lSaturation = 0;
472 newDevice->generic.props[idx].lDeadZone = newDevice->generic.deadzone;
474 /* Linux supports force-feedback on X & Y axes only */
475 if (newDevice->joydev->has_ff && (i == 0 || i == 1))
476 df->rgodf[idx].dwFlags |= DIDOI_FFACTUATOR;
481 /* Buttons can be anywhere, so check all */
482 for (i = 0; i < KEY_MAX && newDevice->generic.devcaps.dwButtons < WINE_JOYSTICK_MAX_BUTTONS; i++)
484 if (!test_bit(newDevice->joydev->keybits, i)) continue;
486 memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[newDevice->generic.devcaps.dwButtons + 12], df->dwObjSize);
487 newDevice->buttons[i] = 0x80 | newDevice->generic.devcaps.dwButtons;
488 df->rgodf[idx ].pguid = &GUID_Button;
489 df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(newDevice->generic.devcaps.dwButtons++) | DIDFT_PSHBUTTON;
492 newDevice->generic.base.data_format.wine_df = df;
494 fake_current_js_state(newDevice);
497 newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps);
498 newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED;
499 if (newDevice->generic.base.dinput->dwVersion >= 0x0800)
500 newDevice->generic.devcaps.dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
502 newDevice->generic.devcaps.dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);
504 if (newDevice->joydev->has_ff)
505 newDevice->generic.devcaps.dwFlags |= DIDC_FORCEFEEDBACK;
507 IDirectInput_AddRef((LPDIRECTINPUTDEVICE8A)newDevice->generic.base.dinput);
511 if (df) HeapFree(GetProcessHeap(), 0, df->rgodf);
512 HeapFree(GetProcessHeap(), 0, df);
513 HeapFree(GetProcessHeap(), 0, newDevice->generic.axis_map);
514 HeapFree(GetProcessHeap(), 0, newDevice);
518 /******************************************************************************
519 * get_joystick_index : Get the joystick index from a given GUID
521 static unsigned short get_joystick_index(REFGUID guid)
523 GUID wine_joystick = DInput_Wine_Joystick_Base_GUID;
524 GUID dev_guid = *guid;
526 wine_joystick.Data3 = 0;
529 /* for the standard joystick GUID use index 0 */
530 if(IsEqualGUID(&GUID_Joystick,guid)) return 0;
532 /* for the wine joystick GUIDs use the index stored in Data3 */
533 if(IsEqualGUID(&wine_joystick, &dev_guid)) return guid->Data3 - DInput_Wine_Joystick_Base_GUID.Data3;
538 static HRESULT joydev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
540 unsigned short index;
544 if ((index = get_joystick_index(rguid)) < MAX_JOYDEV &&
545 have_joydevs && index < have_joydevs)
547 if ((riid == NULL) ||
548 IsEqualGUID(&IID_IDirectInputDeviceA, riid) ||
549 IsEqualGUID(&IID_IDirectInputDevice2A, riid) ||
550 IsEqualGUID(&IID_IDirectInputDevice7A, riid) ||
551 IsEqualGUID(&IID_IDirectInputDevice8A, riid))
553 *pdev = (IDirectInputDeviceA*) alloc_device(rguid, &JoystickAvt, dinput, index);
554 TRACE("Created a Joystick device (%p)\n", *pdev);
558 ERR("out of memory\n");
559 return DIERR_OUTOFMEMORY;
564 WARN("no interface\n");
565 return DIERR_NOINTERFACE;
568 return DIERR_DEVICENOTREG;
572 static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
574 unsigned short index;
578 if ((index = get_joystick_index(rguid)) < MAX_JOYDEV &&
579 have_joydevs && index < have_joydevs)
581 if ((riid == NULL) ||
582 IsEqualGUID(&IID_IDirectInputDeviceW, riid) ||
583 IsEqualGUID(&IID_IDirectInputDevice2W, riid) ||
584 IsEqualGUID(&IID_IDirectInputDevice7W, riid) ||
585 IsEqualGUID(&IID_IDirectInputDevice8W, riid))
587 *pdev = (IDirectInputDeviceW*) alloc_device(rguid, &JoystickWvt, dinput, index);
588 TRACE("Created a Joystick device (%p)\n", *pdev);
592 ERR("out of memory\n");
593 return DIERR_OUTOFMEMORY;
597 WARN("no interface\n");
598 return DIERR_NOINTERFACE;
601 WARN("invalid device GUID\n");
602 return DIERR_DEVICENOTREG;
605 const struct dinput_device joystick_linuxinput_device = {
606 "Wine Linux-input joystick driver",
609 joydev_create_deviceA,
610 joydev_create_deviceW
613 /******************************************************************************
614 * Acquire : gets exclusive control of the joystick
616 static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
618 JoystickImpl *This = (JoystickImpl *)iface;
621 TRACE("(this=%p)\n",This);
623 if ((res = IDirectInputDevice2AImpl_Acquire(iface)) != DI_OK)
625 WARN("Failed to acquire: %x\n", res);
629 if ((This->joyfd = open(This->joydev->device, O_RDWR)) == -1)
631 if ((This->joyfd = open(This->joydev->device, O_RDONLY)) == -1)
633 /* Couldn't open the device at all */
634 ERR("Failed to open device %s: %d %s\n", This->joydev->device, errno, strerror(errno));
635 IDirectInputDevice2AImpl_Unacquire(iface);
636 return DIERR_NOTFOUND;
640 /* Couldn't open in r/w but opened in read-only. */
641 WARN("Could not open %s in read-write mode. Force feedback will be disabled.\n", This->joydev->device);
646 struct input_event event;
649 event.code = FF_GAIN;
650 event.value = This->ff_gain;
651 if (write(This->joyfd, &event, sizeof(event)) == -1)
652 ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno));
653 if (!This->ff_autocenter)
655 /* Disable autocenter. */
656 event.code = FF_AUTOCENTER;
658 if (write(This->joyfd, &event, sizeof(event)) == -1)
659 ERR("Failed disabling autocenter: %d %s\n", errno, strerror(errno));
666 /******************************************************************************
667 * Unacquire : frees the joystick
669 static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
671 JoystickImpl *This = (JoystickImpl *)iface;
674 TRACE("(this=%p)\n",This);
675 res = IDirectInputDevice2AImpl_Unacquire(iface);
676 if (res==DI_OK && This->joyfd!=-1) {
677 effect_list_item *itr;
678 struct input_event event;
680 /* For each known effect:
683 * But, unlike DISFFC_RESET, do not release the effect.
685 LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry) {
686 IDirectInputEffect_Stop(itr->ref);
687 IDirectInputEffect_Unload(itr->ref);
690 /* Enable autocenter. */
692 event.code = FF_AUTOCENTER;
693 /* TODO: Read autocenter strengh before disabling it, and use it here
694 * instead of 0xFFFF (maximum strengh).
696 event.value = 0xFFFF;
697 if (write(This->joyfd, &event, sizeof(event)) == -1)
698 ERR("Failed to set autocenter to %04x: %d %s\n", event.value, errno, strerror(errno));
707 * set the current state of the js device as it would be with the middle
710 #define CENTER_AXIS(a) \
711 (ji->dev_axes_to_di[a] == -1 ? 0 : joystick_map_axis( &ji->generic.props[ji->dev_axes_to_di[a]], \
712 ji->joydev->axes[a].value ))
713 static void fake_current_js_state(JoystickImpl *ji)
717 /* center the axes */
718 ji->generic.js.lX = CENTER_AXIS(ABS_X);
719 ji->generic.js.lY = CENTER_AXIS(ABS_Y);
720 ji->generic.js.lZ = CENTER_AXIS(ABS_Z);
721 ji->generic.js.lRx = CENTER_AXIS(ABS_RX);
722 ji->generic.js.lRy = CENTER_AXIS(ABS_RY);
723 ji->generic.js.lRz = CENTER_AXIS(ABS_RZ);
724 ji->generic.js.rglSlider[0] = CENTER_AXIS(ABS_THROTTLE);
725 ji->generic.js.rglSlider[1] = CENTER_AXIS(ABS_RUDDER);
727 /* POV center is -1 */
728 for (i = 0; i < 4; i++)
729 ji->generic.js.rgdwPOV[i] = -1;
733 /* convert wine format offset to user format object index */
734 static void joy_polldev(JoystickGenericImpl *iface)
737 struct input_event ie;
738 JoystickImpl *This = (JoystickImpl*) iface;
748 plfd.fd = This->joyfd;
749 plfd.events = POLLIN;
751 if (poll(&plfd,1,0) != 1)
754 /* we have one event, so we can read */
755 if (sizeof(ie)!=read(This->joyfd,&ie,sizeof(ie)))
758 TRACE("input_event: type %d, code %d, value %d\n",ie.type,ie.code,ie.value);
760 case EV_KEY: /* button */
762 int btn = This->buttons[ie.code];
764 TRACE("(%p) %d -> %d\n", This, ie.code, btn);
768 inst_id = DIDFT_MAKEINSTANCE(btn) | DIDFT_PSHBUTTON;
769 This->generic.js.rgbButtons[btn] = value = ie.value ? 0x80 : 0x00;
775 int axis = This->dev_axes_to_di[ie.code];
777 /* User axis remapping */
779 axis = This->generic.axis_map[axis];
782 inst_id = axis < 8 ? DIDFT_MAKEINSTANCE(axis) | DIDFT_ABSAXIS :
783 DIDFT_MAKEINSTANCE(axis - 8) | DIDFT_POV;
784 value = joystick_map_axis(&This->generic.props[id_to_object(This->generic.base.data_format.wine_df, inst_id)], ie.value);
787 case 0: This->generic.js.lX = value; break;
788 case 1: This->generic.js.lY = value; break;
789 case 2: This->generic.js.lZ = value; break;
790 case 3: This->generic.js.lRx = value; break;
791 case 4: This->generic.js.lRy = value; break;
792 case 5: This->generic.js.lRz = value; break;
793 case 6: This->generic.js.rglSlider[0] = value; break;
794 case 7: This->generic.js.rglSlider[1] = value; break;
795 case 8: case 9: case 10: case 11:
800 This->povs[idx].y = ie.value;
802 This->povs[idx].x = ie.value;
804 This->generic.js.rgdwPOV[idx] = value = joystick_map_pov(&This->povs[idx]);
808 FIXME("unhandled joystick axis event (code %d, value %d)\n",ie.code,ie.value);
812 #ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
814 This->ff_state = ie.value;
819 /* there is nothing to do */
823 FIXME("joystick cannot handle type %d event (code %d)\n",ie.type,ie.code);
827 queue_event((LPDIRECTINPUTDEVICE8A)This,
828 id_to_offset(&This->generic.base.data_format, inst_id),
829 value, ie.time.tv_usec, This->generic.base.dinput->evsequence++);
833 /******************************************************************************
834 * SetProperty : change input device properties
836 static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface,
840 JoystickImpl *This = (JoystickImpl *)iface;
843 WARN("invalid argument\n");
844 return DIERR_INVALIDPARAM;
847 TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
848 TRACE("ph.dwSize = %d, ph.dwHeaderSize =%d, ph.dwObj = %d, ph.dwHow= %d\n",
849 ph->dwSize, ph->dwHeaderSize, ph->dwObj, ph->dwHow);
851 if (!HIWORD(rguid)) {
852 switch (LOWORD(rguid)) {
853 case (DWORD_PTR)DIPROP_CALIBRATIONMODE: {
854 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
855 FIXME("DIPROP_CALIBRATIONMODE(%d)\n", pd->dwData);
858 case (DWORD_PTR)DIPROP_AUTOCENTER: {
859 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
861 TRACE("autocenter(%d)\n", pd->dwData);
862 This->ff_autocenter = pd->dwData == DIPROPAUTOCENTER_ON;
866 case (DWORD_PTR)DIPROP_FFGAIN: {
867 LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
869 TRACE("DIPROP_FFGAIN(%d)\n", pd->dwData);
870 This->ff_gain = MulDiv(pd->dwData, 0xFFFF, 10000);
871 if (This->generic.base.acquired) {
872 /* Update immediately. */
873 struct input_event event;
876 event.code = FF_GAIN;
877 event.value = This->ff_gain;
878 if (write(This->joyfd, &event, sizeof(event)) == -1)
879 ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno));
884 return JoystickAGenericImpl_SetProperty(iface, rguid, ph);
890 /******************************************************************************
891 * GetProperty : get input device properties
893 static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
895 LPDIPROPHEADER pdiph)
897 JoystickImpl *This = (JoystickImpl *)iface;
899 TRACE("(this=%p,%s,%p)\n", iface, debugstr_guid(rguid), pdiph);
900 _dump_DIPROPHEADER(pdiph);
902 if (HIWORD(rguid)) return DI_OK;
904 switch (LOWORD(rguid)) {
905 case (DWORD_PTR) DIPROP_AUTOCENTER:
907 LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
909 pd->dwData = This->ff_autocenter ? DIPROPAUTOCENTER_ON : DIPROPAUTOCENTER_OFF;
910 TRACE("autocenter(%d)\n", pd->dwData);
913 case (DWORD_PTR) DIPROP_FFGAIN:
915 LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
917 pd->dwData = MulDiv(This->ff_gain, 10000, 0xFFFF);
918 TRACE("DIPROP_FFGAIN(%d)\n", pd->dwData);
923 return JoystickAGenericImpl_GetProperty(iface, rguid, pdiph);
929 /******************************************************************************
930 * CreateEffect - Create a new FF effect with the specified params
932 static HRESULT WINAPI JoystickAImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface,
935 LPDIRECTINPUTEFFECT *ppdef,
938 #ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
939 effect_list_item* new_effect = NULL;
940 HRESULT retval = DI_OK;
943 JoystickImpl* This = (JoystickImpl*)iface;
944 TRACE("(this=%p,%p,%p,%p,%p)\n", This, rguid, lpeff, ppdef, pUnkOuter);
946 #ifndef HAVE_STRUCT_FF_EFFECT_DIRECTION
947 TRACE("not available (compiled w/o ff support)\n");
952 if (!(new_effect = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_effect))))
953 return DIERR_OUTOFMEMORY;
955 retval = linuxinput_create_effect(&This->joyfd, rguid, &new_effect->entry, &new_effect->ref);
958 HeapFree(GetProcessHeap(), 0, new_effect);
964 retval = IDirectInputEffect_SetParameters(new_effect->ref, lpeff, 0);
966 if (retval != DI_OK && retval != DI_DOWNLOADSKIPPED)
968 HeapFree(GetProcessHeap(), 0, new_effect);
973 list_add_tail(&This->ff_effects, &new_effect->entry);
974 *ppdef = new_effect->ref;
976 if (pUnkOuter != NULL)
977 FIXME("Interface aggregation not implemented.\n");
981 #endif /* HAVE_STRUCT_FF_EFFECT_DIRECTION */
984 /*******************************************************************************
985 * EnumEffects - Enumerate available FF effects
987 static HRESULT WINAPI JoystickAImpl_EnumEffects(LPDIRECTINPUTDEVICE8A iface,
988 LPDIENUMEFFECTSCALLBACKA lpCallback,
992 #ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
993 DIEFFECTINFOA dei; /* feif */
994 DWORD type = DIEFT_GETTYPE(dwEffType);
995 JoystickImpl* This = (JoystickImpl*)iface;
997 TRACE("(this=%p,%p,%d) type=%d\n", This, pvRef, dwEffType, type);
999 dei.dwSize = sizeof(DIEFFECTINFOA);
1001 if ((type == DIEFT_ALL || type == DIEFT_CONSTANTFORCE)
1002 && test_bit(This->joydev->ffbits, FF_CONSTANT)) {
1003 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_ConstantForce);
1004 (*lpCallback)(&dei, pvRef);
1007 if ((type == DIEFT_ALL || type == DIEFT_PERIODIC)
1008 && test_bit(This->joydev->ffbits, FF_PERIODIC)) {
1009 if (test_bit(This->joydev->ffbits, FF_SQUARE)) {
1010 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Square);
1011 (*lpCallback)(&dei, pvRef);
1013 if (test_bit(This->joydev->ffbits, FF_SINE)) {
1014 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Sine);
1015 (*lpCallback)(&dei, pvRef);
1017 if (test_bit(This->joydev->ffbits, FF_TRIANGLE)) {
1018 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Triangle);
1019 (*lpCallback)(&dei, pvRef);
1021 if (test_bit(This->joydev->ffbits, FF_SAW_UP)) {
1022 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_SawtoothUp);
1023 (*lpCallback)(&dei, pvRef);
1025 if (test_bit(This->joydev->ffbits, FF_SAW_DOWN)) {
1026 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_SawtoothDown);
1027 (*lpCallback)(&dei, pvRef);
1031 if ((type == DIEFT_ALL || type == DIEFT_RAMPFORCE)
1032 && test_bit(This->joydev->ffbits, FF_RAMP)) {
1033 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_RampForce);
1034 (*lpCallback)(&dei, pvRef);
1037 if (type == DIEFT_ALL || type == DIEFT_CONDITION) {
1038 if (test_bit(This->joydev->ffbits, FF_SPRING)) {
1039 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Spring);
1040 (*lpCallback)(&dei, pvRef);
1042 if (test_bit(This->joydev->ffbits, FF_DAMPER)) {
1043 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Damper);
1044 (*lpCallback)(&dei, pvRef);
1046 if (test_bit(This->joydev->ffbits, FF_INERTIA)) {
1047 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Inertia);
1048 (*lpCallback)(&dei, pvRef);
1050 if (test_bit(This->joydev->ffbits, FF_FRICTION)) {
1051 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Friction);
1052 (*lpCallback)(&dei, pvRef);
1061 static HRESULT WINAPI JoystickWImpl_EnumEffects(LPDIRECTINPUTDEVICE8W iface,
1062 LPDIENUMEFFECTSCALLBACKW lpCallback,
1066 #ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
1067 /* seems silly to duplicate all this code but all the structures and functions
1068 * are actually different (A/W) */
1069 DIEFFECTINFOW dei; /* feif */
1070 DWORD type = DIEFT_GETTYPE(dwEffType);
1071 JoystickImpl* This = (JoystickImpl*)iface;
1072 int xfd = This->joyfd;
1074 TRACE("(this=%p,%p,%d) type=%d fd=%d\n", This, pvRef, dwEffType, type, xfd);
1076 dei.dwSize = sizeof(DIEFFECTINFOW);
1078 if ((type == DIEFT_ALL || type == DIEFT_CONSTANTFORCE)
1079 && test_bit(This->joydev->ffbits, FF_CONSTANT)) {
1080 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_ConstantForce);
1081 (*lpCallback)(&dei, pvRef);
1084 if ((type == DIEFT_ALL || type == DIEFT_PERIODIC)
1085 && test_bit(This->joydev->ffbits, FF_PERIODIC)) {
1086 if (test_bit(This->joydev->ffbits, FF_SQUARE)) {
1087 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Square);
1088 (*lpCallback)(&dei, pvRef);
1090 if (test_bit(This->joydev->ffbits, FF_SINE)) {
1091 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Sine);
1092 (*lpCallback)(&dei, pvRef);
1094 if (test_bit(This->joydev->ffbits, FF_TRIANGLE)) {
1095 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Triangle);
1096 (*lpCallback)(&dei, pvRef);
1098 if (test_bit(This->joydev->ffbits, FF_SAW_UP)) {
1099 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_SawtoothUp);
1100 (*lpCallback)(&dei, pvRef);
1102 if (test_bit(This->joydev->ffbits, FF_SAW_DOWN)) {
1103 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_SawtoothDown);
1104 (*lpCallback)(&dei, pvRef);
1108 if ((type == DIEFT_ALL || type == DIEFT_RAMPFORCE)
1109 && test_bit(This->joydev->ffbits, FF_RAMP)) {
1110 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_RampForce);
1111 (*lpCallback)(&dei, pvRef);
1114 if (type == DIEFT_ALL || type == DIEFT_CONDITION) {
1115 if (test_bit(This->joydev->ffbits, FF_SPRING)) {
1116 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Spring);
1117 (*lpCallback)(&dei, pvRef);
1119 if (test_bit(This->joydev->ffbits, FF_DAMPER)) {
1120 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Damper);
1121 (*lpCallback)(&dei, pvRef);
1123 if (test_bit(This->joydev->ffbits, FF_INERTIA)) {
1124 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Inertia);
1125 (*lpCallback)(&dei, pvRef);
1127 if (test_bit(This->joydev->ffbits, FF_FRICTION)) {
1128 IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Friction);
1129 (*lpCallback)(&dei, pvRef);
1133 /* return to unacquired state if that's where it was */
1135 IDirectInputDevice8_Unacquire(iface);
1141 /*******************************************************************************
1142 * GetEffectInfo - Get information about a particular effect
1144 static HRESULT WINAPI JoystickAImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8A iface,
1145 LPDIEFFECTINFOA pdei,
1148 JoystickImpl* This = (JoystickImpl*)iface;
1150 TRACE("(this=%p,%p,%s)\n", This, pdei, _dump_dinput_GUID(guid));
1152 #ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
1153 return linuxinput_get_info_A(This->joyfd, guid, pdei);
1159 static HRESULT WINAPI JoystickWImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8W iface,
1160 LPDIEFFECTINFOW pdei,
1163 JoystickImpl* This = (JoystickImpl*)iface;
1165 TRACE("(this=%p,%p,%s)\n", This, pdei, _dump_dinput_GUID(guid));
1167 #ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
1168 return linuxinput_get_info_W(This->joyfd, guid, pdei);
1174 /*******************************************************************************
1175 * GetForceFeedbackState - Get information about the device's FF state
1177 static HRESULT WINAPI JoystickAImpl_GetForceFeedbackState(
1178 LPDIRECTINPUTDEVICE8A iface,
1181 JoystickImpl* This = (JoystickImpl*)iface;
1183 TRACE("(this=%p,%p)\n", This, pdwOut);
1187 #ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
1188 /* DIGFFS_STOPPED is the only mandatory flag to report */
1189 if (This->ff_state == FF_STATUS_STOPPED)
1190 (*pdwOut) |= DIGFFS_STOPPED;
1196 /*******************************************************************************
1197 * SendForceFeedbackCommand - Send a command to the device's FF system
1199 static HRESULT WINAPI JoystickAImpl_SendForceFeedbackCommand(
1200 LPDIRECTINPUTDEVICE8A iface,
1203 JoystickImpl* This = (JoystickImpl*)iface;
1204 TRACE("(this=%p,%d)\n", This, dwFlags);
1206 #ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
1209 case DISFFC_STOPALL:
1211 /* Stop all effects */
1212 effect_list_item *itr;
1214 LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry)
1215 IDirectInputEffect_Stop(itr->ref);
1221 effect_list_item *itr, *ptr;
1223 /* Stop, unload, release and free all effects */
1224 /* This returns the device to its "bare" state */
1225 LIST_FOR_EACH_ENTRY_SAFE(itr, ptr, &This->ff_effects, effect_list_item, entry)
1226 IDirectInputEffect_Release(itr->ref);
1230 case DISFFC_CONTINUE:
1231 FIXME("No support for Pause or Continue in linux\n");
1234 case DISFFC_SETACTUATORSOFF:
1235 case DISFFC_SETACTUATORSON:
1236 FIXME("No direct actuator control in linux\n");
1240 FIXME("Unknown Force Feedback Command!\n");
1241 return DIERR_INVALIDPARAM;
1245 return DIERR_UNSUPPORTED;
1249 /*******************************************************************************
1250 * EnumCreatedEffectObjects - Enumerate all the effects that have been
1251 * created for this device.
1253 static HRESULT WINAPI JoystickAImpl_EnumCreatedEffectObjects(
1254 LPDIRECTINPUTDEVICE8A iface,
1255 LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
1259 /* this function is safe to call on non-ff-enabled builds */
1260 JoystickImpl* This = (JoystickImpl*)iface;
1261 effect_list_item *itr, *ptr;
1263 TRACE("(this=%p,%p,%p,%d)\n", This, lpCallback, pvRef, dwFlags);
1266 return DIERR_INVALIDPARAM;
1269 FIXME("Flags specified, but no flags exist yet (DX9)!\n");
1271 LIST_FOR_EACH_ENTRY_SAFE(itr, ptr, &This->ff_effects, effect_list_item, entry)
1272 (*lpCallback)(itr->ref, pvRef);
1277 /******************************************************************************
1278 * GetDeviceInfo : get information about a device's identity
1280 static HRESULT WINAPI JoystickAImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8A iface,
1281 LPDIDEVICEINSTANCEA pdidi)
1283 JoystickImpl *This = (JoystickImpl *)iface;
1285 TRACE("(%p) %p\n", This, pdidi);
1287 if (pdidi == NULL) return E_POINTER;
1288 if ((pdidi->dwSize != sizeof(DIDEVICEINSTANCE_DX3A)) &&
1289 (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)))
1290 return DIERR_INVALIDPARAM;
1292 fill_joystick_dideviceinstanceA(pdidi, This->generic.base.dinput->dwVersion,
1293 get_joystick_index(&This->generic.base.guid));
1297 static HRESULT WINAPI JoystickWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface,
1298 LPDIDEVICEINSTANCEW pdidi)
1300 JoystickImpl *This = (JoystickImpl *)iface;
1302 TRACE("(%p) %p\n", This, pdidi);
1304 if (pdidi == NULL) return E_POINTER;
1305 if ((pdidi->dwSize != sizeof(DIDEVICEINSTANCE_DX3W)) &&
1306 (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)))
1307 return DIERR_INVALIDPARAM;
1309 fill_joystick_dideviceinstanceW(pdidi, This->generic.base.dinput->dwVersion,
1310 get_joystick_index(&This->generic.base.guid));
1314 static const IDirectInputDevice8AVtbl JoystickAvt =
1316 IDirectInputDevice2AImpl_QueryInterface,
1317 IDirectInputDevice2AImpl_AddRef,
1318 IDirectInputDevice2AImpl_Release,
1319 JoystickAGenericImpl_GetCapabilities,
1320 IDirectInputDevice2AImpl_EnumObjects,
1321 JoystickAImpl_GetProperty,
1322 JoystickAImpl_SetProperty,
1323 JoystickAImpl_Acquire,
1324 JoystickAImpl_Unacquire,
1325 JoystickAGenericImpl_GetDeviceState,
1326 IDirectInputDevice2AImpl_GetDeviceData,
1327 IDirectInputDevice2AImpl_SetDataFormat,
1328 IDirectInputDevice2AImpl_SetEventNotification,
1329 IDirectInputDevice2AImpl_SetCooperativeLevel,
1330 JoystickAGenericImpl_GetObjectInfo,
1331 JoystickAImpl_GetDeviceInfo,
1332 IDirectInputDevice2AImpl_RunControlPanel,
1333 IDirectInputDevice2AImpl_Initialize,
1334 JoystickAImpl_CreateEffect,
1335 JoystickAImpl_EnumEffects,
1336 JoystickAImpl_GetEffectInfo,
1337 JoystickAImpl_GetForceFeedbackState,
1338 JoystickAImpl_SendForceFeedbackCommand,
1339 JoystickAImpl_EnumCreatedEffectObjects,
1340 IDirectInputDevice2AImpl_Escape,
1341 JoystickAGenericImpl_Poll,
1342 IDirectInputDevice2AImpl_SendDeviceData,
1343 IDirectInputDevice7AImpl_EnumEffectsInFile,
1344 IDirectInputDevice7AImpl_WriteEffectToFile,
1345 IDirectInputDevice8AImpl_BuildActionMap,
1346 IDirectInputDevice8AImpl_SetActionMap,
1347 IDirectInputDevice8AImpl_GetImageInfo
1350 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
1351 # define XCAST(fun) (typeof(JoystickWvt.fun))
1353 # define XCAST(fun) (void*)
1356 static const IDirectInputDevice8WVtbl JoystickWvt =
1358 IDirectInputDevice2WImpl_QueryInterface,
1359 XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
1360 XCAST(Release)IDirectInputDevice2AImpl_Release,
1361 XCAST(GetCapabilities)JoystickAGenericImpl_GetCapabilities,
1362 IDirectInputDevice2WImpl_EnumObjects,
1363 XCAST(GetProperty)JoystickAImpl_GetProperty,
1364 XCAST(SetProperty)JoystickAImpl_SetProperty,
1365 XCAST(Acquire)JoystickAImpl_Acquire,
1366 XCAST(Unacquire)JoystickAImpl_Unacquire,
1367 XCAST(GetDeviceState)JoystickAGenericImpl_GetDeviceState,
1368 XCAST(GetDeviceData)IDirectInputDevice2AImpl_GetDeviceData,
1369 XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
1370 XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
1371 XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
1372 JoystickWGenericImpl_GetObjectInfo,
1373 JoystickWImpl_GetDeviceInfo,
1374 XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
1375 XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
1376 XCAST(CreateEffect)JoystickAImpl_CreateEffect,
1377 JoystickWImpl_EnumEffects,
1378 JoystickWImpl_GetEffectInfo,
1379 XCAST(GetForceFeedbackState)JoystickAImpl_GetForceFeedbackState,
1380 XCAST(SendForceFeedbackCommand)JoystickAImpl_SendForceFeedbackCommand,
1381 XCAST(EnumCreatedEffectObjects)JoystickAImpl_EnumCreatedEffectObjects,
1382 XCAST(Escape)IDirectInputDevice2AImpl_Escape,
1383 XCAST(Poll)JoystickAGenericImpl_Poll,
1384 XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
1385 IDirectInputDevice7WImpl_EnumEffectsInFile,
1386 IDirectInputDevice7WImpl_WriteEffectToFile,
1387 IDirectInputDevice8WImpl_BuildActionMap,
1388 IDirectInputDevice8WImpl_SetActionMap,
1389 IDirectInputDevice8WImpl_GetImageInfo
1393 #else /* HAVE_CORRECT_LINUXINPUT_H */
1395 const struct dinput_device joystick_linuxinput_device = {
1396 "Wine Linux-input joystick driver",
1403 #endif /* HAVE_CORRECT_LINUXINPUT_H */