2000-12-12 01:38:58 +01:00
|
|
|
/* DirectInput Joystick device
|
|
|
|
*
|
|
|
|
* Copyright 1998,2000 Marcus Meissner
|
|
|
|
* Copyright 1998,1999 Lionel Ulmer
|
2002-06-14 02:39:44 +02:00
|
|
|
* Copyright 2000-2001 TransGaming Technologies Inc.
|
2005-07-29 16:18:58 +02:00
|
|
|
* Copyright 2005 Daniel Remenak
|
2000-12-12 01:38:58 +01:00
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2000-12-12 01:38:58 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2002-07-22 23:53:32 +02:00
|
|
|
#include "wine/port.h"
|
2000-12-12 01:38:58 +01:00
|
|
|
|
|
|
|
#include <assert.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2000-12-12 01:38:58 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
2002-08-17 02:43:16 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
# include <sys/time.h>
|
|
|
|
#endif
|
2008-02-27 20:02:45 +01:00
|
|
|
#include <fcntl.h>
|
2002-05-22 03:55:18 +02:00
|
|
|
#ifdef HAVE_SYS_IOCTL_H
|
|
|
|
# include <sys/ioctl.h>
|
|
|
|
#endif
|
2000-12-12 01:38:58 +01:00
|
|
|
#include <errno.h>
|
|
|
|
#ifdef HAVE_SYS_ERRNO_H
|
|
|
|
# include <sys/errno.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LINUX_INPUT_H
|
|
|
|
# include <linux/input.h>
|
2007-01-22 12:11:04 +01:00
|
|
|
# undef SW_MAX
|
2005-08-08 13:17:25 +02:00
|
|
|
# if defined(EVIOCGBIT) && defined(EV_ABS) && defined(BTN_PINKIE)
|
|
|
|
# define HAVE_CORRECT_LINUXINPUT_H
|
|
|
|
# endif
|
2000-12-12 01:38:58 +01:00
|
|
|
#endif
|
2006-11-06 07:28:29 +01:00
|
|
|
#ifdef HAVE_SYS_POLL_H
|
|
|
|
# include <sys/poll.h>
|
|
|
|
#endif
|
2000-12-12 01:38:58 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2003-06-16 22:22:13 +02:00
|
|
|
#include "wine/unicode.h"
|
2008-07-06 06:24:51 +02:00
|
|
|
#include "wine/list.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
2000-12-12 01:38:58 +01:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
2007-09-25 03:34:38 +02:00
|
|
|
#include "winreg.h"
|
2000-12-12 01:38:58 +01:00
|
|
|
#include "dinput.h"
|
|
|
|
|
|
|
|
#include "dinput_private.h"
|
|
|
|
#include "device_private.h"
|
2009-03-09 16:07:07 +01:00
|
|
|
#include "joystick_private.h"
|
2000-12-12 01:38:58 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
|
2000-12-12 01:38:58 +01:00
|
|
|
|
2005-03-15 20:36:15 +01:00
|
|
|
#ifdef HAVE_CORRECT_LINUXINPUT_H
|
|
|
|
|
|
|
|
#define EVDEVPREFIX "/dev/input/event"
|
|
|
|
|
2000-12-12 01:38:58 +01:00
|
|
|
/* Wine joystick driver object instances */
|
2007-01-16 10:45:34 +01:00
|
|
|
#define WINE_JOYSTICK_MAX_AXES 8
|
|
|
|
#define WINE_JOYSTICK_MAX_POVS 4
|
|
|
|
#define WINE_JOYSTICK_MAX_BUTTONS 128
|
2000-12-12 01:38:58 +01:00
|
|
|
|
2007-08-21 15:06:17 +02:00
|
|
|
struct wine_input_absinfo {
|
|
|
|
LONG value;
|
|
|
|
LONG minimum;
|
|
|
|
LONG maximum;
|
|
|
|
LONG fuzz;
|
|
|
|
LONG flat;
|
|
|
|
};
|
|
|
|
|
2005-09-03 17:02:38 +02:00
|
|
|
/* implemented in effect_linuxinput.c */
|
2008-07-06 06:24:57 +02:00
|
|
|
HRESULT linuxinput_create_effect(int* fd, REFGUID rguid, struct list *parent_list_entry, LPDIRECTINPUTEFFECT* peff);
|
2005-09-03 17:02:38 +02:00
|
|
|
HRESULT linuxinput_get_info_A(int fd, REFGUID rguid, LPDIEFFECTINFOA info);
|
|
|
|
HRESULT linuxinput_get_info_W(int fd, REFGUID rguid, LPDIEFFECTINFOW info);
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
typedef struct JoystickImpl JoystickImpl;
|
2005-05-30 12:01:08 +02:00
|
|
|
static const IDirectInputDevice8AVtbl JoystickAvt;
|
|
|
|
static const IDirectInputDevice8WVtbl JoystickWvt;
|
2006-07-06 13:12:07 +02:00
|
|
|
|
|
|
|
struct JoyDev {
|
|
|
|
char *device;
|
|
|
|
char *name;
|
|
|
|
GUID guid;
|
|
|
|
|
|
|
|
int has_ff;
|
|
|
|
int num_effects;
|
|
|
|
|
|
|
|
/* data returned by EVIOCGBIT for caps, EV_ABS, EV_KEY, and EV_FF */
|
|
|
|
BYTE evbits[(EV_MAX+7)/8];
|
|
|
|
BYTE absbits[(ABS_MAX+7)/8];
|
|
|
|
BYTE keybits[(KEY_MAX+7)/8];
|
|
|
|
BYTE ffbits[(FF_MAX+7)/8];
|
2006-07-06 13:16:22 +02:00
|
|
|
|
|
|
|
/* data returned by the EVIOCGABS() ioctl */
|
2007-08-21 15:06:17 +02:00
|
|
|
struct wine_input_absinfo axes[ABS_MAX];
|
2007-01-15 12:07:35 +01:00
|
|
|
};
|
2006-07-06 13:16:22 +02:00
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
struct JoystickImpl
|
2000-12-12 01:38:58 +01:00
|
|
|
{
|
2009-04-20 04:33:29 +02:00
|
|
|
struct JoystickGenericImpl generic;
|
2006-07-06 13:12:07 +02:00
|
|
|
struct JoyDev *joydev;
|
2000-12-12 01:38:58 +01:00
|
|
|
|
|
|
|
/* joystick private */
|
|
|
|
int joyfd;
|
|
|
|
|
2007-01-16 10:45:34 +01:00
|
|
|
int axes[ABS_MAX];
|
2007-08-05 20:22:49 +02:00
|
|
|
POINTL povs[4];
|
2007-01-16 10:45:34 +01:00
|
|
|
|
2007-01-15 12:08:00 +01:00
|
|
|
/* LUT for KEY_ to offset in rgbButtons */
|
|
|
|
BYTE buttons[KEY_MAX];
|
|
|
|
|
2005-07-29 16:18:58 +02:00
|
|
|
/* Force feedback variables */
|
2008-07-06 06:24:51 +02:00
|
|
|
struct list ff_effects;
|
2005-09-03 17:02:38 +02:00
|
|
|
int ff_state;
|
2009-01-22 00:00:10 +01:00
|
|
|
int ff_autocenter;
|
2009-01-29 21:26:30 +01:00
|
|
|
int ff_gain;
|
2000-12-12 01:38:58 +01:00
|
|
|
};
|
|
|
|
|
2006-07-06 13:12:07 +02:00
|
|
|
static void fake_current_js_state(JoystickImpl *ji);
|
|
|
|
static void find_joydevs(void);
|
2009-04-20 04:33:29 +02:00
|
|
|
static void joy_polldev(JoystickGenericImpl *This);
|
2006-07-06 13:12:07 +02:00
|
|
|
|
2000-12-12 01:38:58 +01:00
|
|
|
/* This GUID is slightly different from the linux joystick one. Take note. */
|
2006-07-06 13:12:07 +02:00
|
|
|
static const GUID DInput_Wine_Joystick_Base_GUID = { /* 9e573eda-7734-11d2-8d4a-23903fb6bdf7 */
|
2000-12-12 01:38:58 +01:00
|
|
|
0x9e573eda,
|
|
|
|
0x7734,
|
|
|
|
0x11d2,
|
|
|
|
{0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
|
|
|
|
};
|
|
|
|
|
2006-03-10 09:58:14 +01:00
|
|
|
#define test_bit(arr,bit) (((BYTE*)(arr))[(bit)>>3]&(1<<((bit)&7)))
|
2000-12-12 01:38:58 +01:00
|
|
|
|
2006-07-06 13:12:07 +02:00
|
|
|
#define MAX_JOYDEV 64
|
|
|
|
|
|
|
|
static int have_joydevs = -1;
|
|
|
|
static struct JoyDev *joydevs = NULL;
|
|
|
|
|
|
|
|
static void find_joydevs(void)
|
2000-12-12 01:38:58 +01:00
|
|
|
{
|
2008-12-27 19:23:08 +01:00
|
|
|
int i;
|
2005-07-29 16:41:55 +02:00
|
|
|
|
2008-12-27 19:23:08 +01:00
|
|
|
if (InterlockedCompareExchange(&have_joydevs, 0, -1) != -1)
|
|
|
|
/* Someone beat us to it */
|
|
|
|
return;
|
2005-07-29 16:41:55 +02:00
|
|
|
|
2008-12-27 19:23:11 +01:00
|
|
|
for (i = 0; i < MAX_JOYDEV; i++)
|
|
|
|
{
|
|
|
|
char buf[MAX_PATH];
|
|
|
|
struct JoyDev joydev = {0};
|
|
|
|
int fd;
|
|
|
|
int no_ff_check = 0;
|
|
|
|
int j;
|
2008-12-28 21:40:47 +01:00
|
|
|
struct JoyDev *new_joydevs;
|
2008-12-27 19:23:11 +01:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), EVDEVPREFIX"%d", i);
|
2006-07-06 13:12:07 +02:00
|
|
|
|
2008-12-27 19:23:13 +01:00
|
|
|
if ((fd = open(buf, O_RDWR)) == -1)
|
|
|
|
{
|
|
|
|
fd = open(buf, O_RDONLY);
|
|
|
|
no_ff_check = 1;
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
|
2008-12-27 19:23:13 +01:00
|
|
|
if (fd == -1)
|
|
|
|
{
|
|
|
|
WARN("Failed to open \"%s\": %d %s\n", buf, errno, strerror(errno));
|
|
|
|
continue;
|
|
|
|
}
|
2007-07-29 21:21:17 +02:00
|
|
|
|
2008-12-27 19:23:15 +01:00
|
|
|
if (ioctl(fd, EVIOCGBIT(0, sizeof(joydev.evbits)), joydev.evbits) == -1)
|
|
|
|
{
|
|
|
|
WARN("ioct(EVIOCGBIT, 0) failed: %d %s\n", errno, strerror(errno));
|
|
|
|
close(fd);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(joydev.absbits)), joydev.absbits) == -1)
|
|
|
|
{
|
|
|
|
WARN("ioct(EVIOCGBIT, EV_ABS) failed: %d %s\n", errno, strerror(errno));
|
|
|
|
close(fd);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(joydev.keybits)), joydev.keybits) == -1)
|
|
|
|
{
|
|
|
|
WARN("ioct(EVIOCGBIT, EV_KEY) failed: %d %s\n", errno, strerror(errno));
|
|
|
|
close(fd);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2008-12-28 21:41:08 +01:00
|
|
|
/* A true joystick has at least axis X and Y, and at least 1
|
|
|
|
* button. copied from linux/drivers/input/joydev.c */
|
|
|
|
if (!test_bit(joydev.absbits, ABS_X) || !test_bit(joydev.absbits, ABS_Y) ||
|
|
|
|
!(test_bit(joydev.keybits, BTN_TRIGGER) ||
|
|
|
|
test_bit(joydev.keybits, BTN_A) ||
|
|
|
|
test_bit(joydev.keybits, BTN_1)))
|
|
|
|
{
|
|
|
|
close(fd);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(joydev.device = HeapAlloc(GetProcessHeap(), 0, strlen(buf) + 1)))
|
|
|
|
{
|
|
|
|
close(fd);
|
|
|
|
continue;
|
2008-09-14 19:05:55 +02:00
|
|
|
}
|
|
|
|
strcpy(joydev.device, buf);
|
2006-07-06 13:12:07 +02:00
|
|
|
|
2008-09-14 19:05:55 +02:00
|
|
|
buf[MAX_PATH - 1] = 0;
|
|
|
|
if (ioctl(fd, EVIOCGNAME(MAX_PATH - 1), buf) != -1 &&
|
|
|
|
(joydev.name = HeapAlloc(GetProcessHeap(), 0, strlen(buf) + 1)))
|
2008-12-28 21:41:08 +01:00
|
|
|
strcpy(joydev.name, buf);
|
2008-09-14 19:05:55 +02:00
|
|
|
else
|
2008-12-28 21:41:08 +01:00
|
|
|
joydev.name = joydev.device;
|
2006-07-06 13:12:07 +02:00
|
|
|
|
|
|
|
joydev.guid = DInput_Wine_Joystick_Base_GUID;
|
|
|
|
joydev.guid.Data3 += have_joydevs;
|
|
|
|
|
|
|
|
TRACE("Found a joystick on %s: %s (%s)\n",
|
|
|
|
joydev.device, joydev.name,
|
|
|
|
debugstr_guid(&joydev.guid)
|
|
|
|
);
|
|
|
|
|
|
|
|
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
2007-02-02 08:46:17 +01:00
|
|
|
if (!no_ff_check &&
|
|
|
|
test_bit(joydev.evbits, EV_FF) &&
|
|
|
|
ioctl(fd, EVIOCGBIT(EV_FF, sizeof(joydev.ffbits)), joydev.ffbits) != -1 &&
|
|
|
|
ioctl(fd, EVIOCGEFFECTS, &joydev.num_effects) != -1 &&
|
|
|
|
joydev.num_effects > 0)
|
|
|
|
{
|
2006-07-06 13:12:07 +02:00
|
|
|
TRACE(" ... with force feedback\n");
|
|
|
|
joydev.has_ff = 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-12-28 21:41:08 +01:00
|
|
|
for (j = 0; j < ABS_MAX;j ++)
|
|
|
|
{
|
|
|
|
if (!test_bit(joydev.absbits, j)) continue;
|
|
|
|
if (ioctl(fd, EVIOCGABS(j), &(joydev.axes[j])) != -1)
|
|
|
|
{
|
2007-01-15 12:07:04 +01:00
|
|
|
TRACE(" ... with axis %d: cur=%d, min=%d, max=%d, fuzz=%d, flat=%d\n",
|
2006-07-06 13:16:22 +02:00
|
|
|
j,
|
2007-08-20 06:26:27 +02:00
|
|
|
joydev.axes[j].value,
|
|
|
|
joydev.axes[j].minimum,
|
|
|
|
joydev.axes[j].maximum,
|
|
|
|
joydev.axes[j].fuzz,
|
|
|
|
joydev.axes[j].flat
|
2006-07-06 13:16:22 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-28 21:40:47 +01:00
|
|
|
if (!have_joydevs)
|
|
|
|
new_joydevs = HeapAlloc(GetProcessHeap(), 0, sizeof(struct JoyDev));
|
|
|
|
else
|
|
|
|
new_joydevs = HeapReAlloc(GetProcessHeap(), 0, joydevs, (1 + have_joydevs) * sizeof(struct JoyDev));
|
|
|
|
|
|
|
|
if (!new_joydevs)
|
|
|
|
{
|
|
|
|
close(fd);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
joydevs = new_joydevs;
|
|
|
|
memcpy(joydevs + have_joydevs, &joydev, sizeof(joydev));
|
2006-07-06 13:12:07 +02:00
|
|
|
have_joydevs++;
|
|
|
|
|
2008-12-27 19:23:13 +01:00
|
|
|
close(fd);
|
2006-07-06 13:12:07 +02:00
|
|
|
}
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2007-09-25 03:34:44 +02:00
|
|
|
static void fill_joystick_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
|
|
|
|
{
|
|
|
|
DWORD dwSize = lpddi->dwSize;
|
|
|
|
|
|
|
|
TRACE("%d %p\n", dwSize, lpddi);
|
|
|
|
memset(lpddi, 0, dwSize);
|
|
|
|
|
|
|
|
lpddi->dwSize = dwSize;
|
|
|
|
lpddi->guidInstance = joydevs[id].guid;
|
|
|
|
lpddi->guidProduct = DInput_Wine_Joystick_Base_GUID;
|
|
|
|
lpddi->guidFFDriver = GUID_NULL;
|
|
|
|
|
|
|
|
if (version >= 0x0800)
|
|
|
|
lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
|
|
|
|
else
|
|
|
|
lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);
|
|
|
|
|
|
|
|
strcpy(lpddi->tszInstanceName, joydevs[id].name);
|
2009-04-20 04:33:31 +02:00
|
|
|
strcpy(lpddi->tszProductName, joydevs[id].name);
|
2007-09-25 03:34:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
|
|
|
|
{
|
|
|
|
DWORD dwSize = lpddi->dwSize;
|
|
|
|
|
|
|
|
TRACE("%d %p\n", dwSize, lpddi);
|
|
|
|
memset(lpddi, 0, dwSize);
|
|
|
|
|
|
|
|
lpddi->dwSize = dwSize;
|
|
|
|
lpddi->guidInstance = joydevs[id].guid;
|
|
|
|
lpddi->guidProduct = DInput_Wine_Joystick_Base_GUID;
|
|
|
|
lpddi->guidFFDriver = GUID_NULL;
|
|
|
|
|
|
|
|
if (version >= 0x0800)
|
|
|
|
lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
|
|
|
|
else
|
|
|
|
lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);
|
|
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, joydevs[id].name, -1, lpddi->tszInstanceName, MAX_PATH);
|
2009-04-20 04:33:31 +02:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, joydevs[id].name, -1, lpddi->tszProductName, MAX_PATH);
|
2007-09-25 03:34:44 +02:00
|
|
|
}
|
|
|
|
|
2005-05-16 10:44:14 +02:00
|
|
|
static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
|
2003-06-16 22:22:13 +02:00
|
|
|
{
|
2006-07-06 13:12:07 +02:00
|
|
|
find_joydevs();
|
2004-09-13 21:16:47 +02:00
|
|
|
|
2006-07-06 13:12:07 +02:00
|
|
|
if (id >= have_joydevs) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-04-12 19:33:04 +02:00
|
|
|
|
2004-12-07 15:19:29 +01:00
|
|
|
if (!((dwDevType == 0) ||
|
2008-04-12 19:33:18 +02:00
|
|
|
((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) ||
|
2005-05-16 10:44:14 +02:00
|
|
|
(((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))))
|
2004-12-07 15:19:29 +01:00
|
|
|
return FALSE;
|
2003-06-16 22:22:13 +02:00
|
|
|
|
2005-07-29 16:41:55 +02:00
|
|
|
#ifndef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
2003-06-16 22:22:13 +02:00
|
|
|
if (dwFlags & DIEDFL_FORCEFEEDBACK)
|
|
|
|
return FALSE;
|
2005-07-29 16:41:55 +02:00
|
|
|
#endif
|
2003-06-16 22:22:13 +02:00
|
|
|
|
2006-07-06 13:12:07 +02:00
|
|
|
if (!(dwFlags & DIEDFL_FORCEFEEDBACK) || joydevs[id].has_ff) {
|
2007-09-25 03:34:44 +02:00
|
|
|
fill_joystick_dideviceinstanceA(lpddi, version, id);
|
2006-07-06 13:12:07 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
|
|
|
|
2005-05-16 10:44:14 +02:00
|
|
|
static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
|
2003-06-16 22:22:13 +02:00
|
|
|
{
|
2006-07-06 13:12:07 +02:00
|
|
|
find_joydevs();
|
2003-06-16 22:22:13 +02:00
|
|
|
|
2006-07-06 13:12:07 +02:00
|
|
|
if (id >= have_joydevs) {
|
2006-07-20 07:21:35 +02:00
|
|
|
return FALSE;
|
2006-07-06 13:12:07 +02:00
|
|
|
}
|
2004-09-13 21:16:47 +02:00
|
|
|
|
2004-12-07 15:19:29 +01:00
|
|
|
if (!((dwDevType == 0) ||
|
2008-04-12 19:33:18 +02:00
|
|
|
((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) ||
|
2005-05-16 10:44:14 +02:00
|
|
|
(((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))))
|
2004-12-07 15:19:29 +01:00
|
|
|
return FALSE;
|
2003-06-16 22:22:13 +02:00
|
|
|
|
2005-07-29 16:41:55 +02:00
|
|
|
#ifndef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
2003-06-16 22:22:13 +02:00
|
|
|
if (dwFlags & DIEDFL_FORCEFEEDBACK)
|
|
|
|
return FALSE;
|
2005-07-29 16:41:55 +02:00
|
|
|
#endif
|
2003-06-16 22:22:13 +02:00
|
|
|
|
2006-07-06 13:12:07 +02:00
|
|
|
if (!(dwFlags & DIEDFL_FORCEFEEDBACK) || joydevs[id].has_ff) {
|
2007-09-25 03:34:44 +02:00
|
|
|
fill_joystick_dideviceinstanceW(lpddi, version, id);
|
2006-07-06 13:12:07 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
2007-07-29 21:21:17 +02:00
|
|
|
static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *dinput, unsigned short index)
|
2000-12-12 01:38:58 +01:00
|
|
|
{
|
2007-01-09 21:44:32 +01:00
|
|
|
JoystickImpl* newDevice;
|
|
|
|
LPDIDATAFORMAT df = NULL;
|
|
|
|
int i, idx = 0;
|
2007-09-25 03:34:38 +02:00
|
|
|
char buffer[MAX_PATH+16];
|
|
|
|
HKEY hkey, appkey;
|
2008-04-12 19:33:28 +02:00
|
|
|
LONG def_deadzone = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2007-01-09 21:44:32 +01:00
|
|
|
newDevice = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(JoystickImpl));
|
|
|
|
if (!newDevice) return NULL;
|
2006-07-06 13:14:18 +02:00
|
|
|
|
2009-04-20 04:33:29 +02:00
|
|
|
newDevice->generic.base.lpVtbl = jvt;
|
|
|
|
newDevice->generic.base.ref = 1;
|
|
|
|
newDevice->generic.base.guid = *rguid;
|
|
|
|
newDevice->generic.base.dinput = dinput;
|
|
|
|
newDevice->generic.joy_polldev = joy_polldev;
|
2007-09-25 03:34:38 +02:00
|
|
|
newDevice->joyfd = -1;
|
|
|
|
newDevice->joydev = &joydevs[index];
|
2009-04-20 04:33:29 +02:00
|
|
|
newDevice->generic.name = newDevice->joydev->name;
|
2008-07-06 06:24:51 +02:00
|
|
|
list_init(&newDevice->ff_effects);
|
2005-09-06 11:19:51 +02:00
|
|
|
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
2007-09-25 03:34:38 +02:00
|
|
|
newDevice->ff_state = FF_STATUS_STOPPED;
|
2005-09-06 11:19:51 +02:00
|
|
|
#endif
|
2009-01-22 00:00:10 +01:00
|
|
|
/* There is no way in linux to query force feedback autocenter status.
|
|
|
|
Instead, track it with ff_autocenter, and assume it's initialy
|
|
|
|
enabled. */
|
|
|
|
newDevice->ff_autocenter = 1;
|
2009-01-29 21:26:30 +01:00
|
|
|
newDevice->ff_gain = 0xFFFF;
|
2009-04-20 04:33:29 +02:00
|
|
|
InitializeCriticalSection(&newDevice->generic.base.crit);
|
|
|
|
newDevice->generic.base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->base.crit");
|
2007-09-25 03:34:38 +02:00
|
|
|
|
|
|
|
/* get options */
|
|
|
|
get_app_key(&hkey, &appkey);
|
|
|
|
|
|
|
|
if (!get_config_key(hkey, appkey, "DefaultDeadZone", buffer, MAX_PATH))
|
|
|
|
{
|
|
|
|
def_deadzone = atoi(buffer);
|
|
|
|
TRACE("setting default deadzone to: %d\n", def_deadzone);
|
|
|
|
}
|
|
|
|
if (appkey) RegCloseKey(appkey);
|
|
|
|
if (hkey) RegCloseKey(hkey);
|
2006-07-06 13:14:18 +02:00
|
|
|
|
2007-01-09 21:44:32 +01:00
|
|
|
/* Create copy of default data format */
|
|
|
|
if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2.dwSize))) goto failed;
|
|
|
|
memcpy(df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize);
|
|
|
|
if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto failed;
|
|
|
|
|
|
|
|
/* Supported Axis & POVs should map 1-to-1 */
|
2007-01-16 10:45:34 +01:00
|
|
|
for (i = 0; i < WINE_JOYSTICK_MAX_AXES; i++)
|
2007-01-09 21:44:32 +01:00
|
|
|
{
|
2007-01-16 10:45:34 +01:00
|
|
|
if (!test_bit(newDevice->joydev->absbits, i)) {
|
|
|
|
newDevice->axes[i] = -1;
|
|
|
|
continue;
|
|
|
|
}
|
2007-01-09 21:44:32 +01:00
|
|
|
|
2007-01-16 10:45:34 +01:00
|
|
|
memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[i], df->dwObjSize);
|
|
|
|
newDevice->axes[i] = idx;
|
2009-04-20 04:33:29 +02:00
|
|
|
newDevice->generic.props[idx].lDevMin = newDevice->joydev->axes[i].minimum;
|
|
|
|
newDevice->generic.props[idx].lDevMax = newDevice->joydev->axes[i].maximum;
|
|
|
|
newDevice->generic.props[idx].lMin = 0;
|
|
|
|
newDevice->generic.props[idx].lMax = 0xffff;
|
|
|
|
newDevice->generic.props[idx].lSaturation = 0;
|
|
|
|
newDevice->generic.props[idx].lDeadZone = def_deadzone;
|
2007-08-05 20:20:26 +02:00
|
|
|
|
2008-07-06 06:25:37 +02:00
|
|
|
/* Linux supports force-feedback on X & Y axes only */
|
|
|
|
if (newDevice->joydev->has_ff && (i == 0 || i == 1))
|
|
|
|
df->rgodf[idx].dwFlags |= DIDOI_FFACTUATOR;
|
|
|
|
|
2009-04-20 04:33:29 +02:00
|
|
|
df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(newDevice->generic.devcaps.dwAxes++) | DIDFT_ABSAXIS;
|
2007-01-09 21:44:32 +01:00
|
|
|
}
|
2007-01-16 10:45:34 +01:00
|
|
|
|
|
|
|
for (i = 0; i < WINE_JOYSTICK_MAX_POVS; i++)
|
2007-01-09 21:44:32 +01:00
|
|
|
{
|
|
|
|
if (!test_bit(newDevice->joydev->absbits, ABS_HAT0X + i * 2) ||
|
2007-01-16 10:45:34 +01:00
|
|
|
!test_bit(newDevice->joydev->absbits, ABS_HAT0Y + i * 2)) {
|
|
|
|
newDevice->axes[ABS_HAT0X + i * 2] = newDevice->axes[ABS_HAT0Y + i * 2] = -1;
|
2007-01-09 21:44:32 +01:00
|
|
|
continue;
|
2007-01-16 10:45:34 +01:00
|
|
|
}
|
2007-01-09 21:44:32 +01:00
|
|
|
|
2007-01-16 10:45:34 +01:00
|
|
|
memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[i + WINE_JOYSTICK_MAX_AXES], df->dwObjSize);
|
|
|
|
newDevice->axes[ABS_HAT0X + i * 2] = newDevice->axes[ABS_HAT0Y + i * 2] = i;
|
2009-04-20 04:33:29 +02:00
|
|
|
df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(newDevice->generic.devcaps.dwPOVs++) | DIDFT_POV;
|
2007-01-09 21:44:32 +01:00
|
|
|
}
|
2007-01-16 10:45:34 +01:00
|
|
|
|
2007-01-09 21:44:32 +01:00
|
|
|
/* Buttons can be anywhere, so check all */
|
2009-04-20 04:33:29 +02:00
|
|
|
for (i = 0; i < KEY_MAX && newDevice->generic.devcaps.dwButtons < WINE_JOYSTICK_MAX_BUTTONS; i++)
|
2007-01-09 21:44:32 +01:00
|
|
|
{
|
|
|
|
if (!test_bit(newDevice->joydev->keybits, i)) continue;
|
|
|
|
|
2009-04-20 04:33:29 +02:00
|
|
|
memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[newDevice->generic.devcaps.dwButtons + 12], df->dwObjSize);
|
|
|
|
newDevice->buttons[i] = 0x80 | newDevice->generic.devcaps.dwButtons;
|
2008-04-12 19:33:04 +02:00
|
|
|
df->rgodf[idx ].pguid = &GUID_Button;
|
2009-04-20 04:33:29 +02:00
|
|
|
df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(newDevice->generic.devcaps.dwButtons++) | DIDFT_PSHBUTTON;
|
2007-01-09 21:44:32 +01:00
|
|
|
}
|
|
|
|
df->dwNumObjs = idx;
|
2009-04-20 04:33:29 +02:00
|
|
|
newDevice->generic.base.data_format.wine_df = df;
|
2006-07-06 13:14:18 +02:00
|
|
|
|
2007-01-16 10:45:34 +01:00
|
|
|
fake_current_js_state(newDevice);
|
|
|
|
|
2009-04-20 04:33:29 +02:00
|
|
|
/* Fill the caps */
|
|
|
|
newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps);
|
|
|
|
newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED;
|
|
|
|
if (newDevice->generic.base.dinput->dwVersion >= 0x0800)
|
|
|
|
newDevice->generic.devcaps.dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
|
|
|
|
else
|
|
|
|
newDevice->generic.devcaps.dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);
|
|
|
|
|
|
|
|
if (newDevice->joydev->has_ff)
|
|
|
|
newDevice->generic.devcaps.dwFlags |= DIDC_FORCEFEEDBACK;
|
|
|
|
|
|
|
|
IDirectInput_AddRef((LPDIRECTINPUTDEVICE8A)newDevice->generic.base.dinput);
|
2006-12-12 16:57:54 +01:00
|
|
|
return newDevice;
|
2006-07-06 13:14:18 +02:00
|
|
|
|
2007-01-09 21:44:32 +01:00
|
|
|
failed:
|
|
|
|
if (df) HeapFree(GetProcessHeap(), 0, df->rgodf);
|
|
|
|
HeapFree(GetProcessHeap(), 0, df);
|
|
|
|
HeapFree(GetProcessHeap(), 0, newDevice);
|
|
|
|
return NULL;
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
|
|
|
|
2007-07-29 21:21:17 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* get_joystick_index : Get the joystick index from a given GUID
|
|
|
|
*/
|
|
|
|
static unsigned short get_joystick_index(REFGUID guid)
|
|
|
|
{
|
|
|
|
GUID wine_joystick = DInput_Wine_Joystick_Base_GUID;
|
|
|
|
GUID dev_guid = *guid;
|
|
|
|
|
|
|
|
wine_joystick.Data3 = 0;
|
|
|
|
dev_guid.Data3 = 0;
|
|
|
|
|
|
|
|
/* for the standard joystick GUID use index 0 */
|
|
|
|
if(IsEqualGUID(&GUID_Joystick,guid)) return 0;
|
|
|
|
|
|
|
|
/* for the wine joystick GUIDs use the index stored in Data3 */
|
|
|
|
if(IsEqualGUID(&wine_joystick, &dev_guid)) return guid->Data3 - DInput_Wine_Joystick_Base_GUID.Data3;
|
|
|
|
|
|
|
|
return MAX_JOYDEV;
|
|
|
|
}
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
static HRESULT joydev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
|
2000-12-12 01:38:58 +01:00
|
|
|
{
|
2007-07-29 21:21:17 +02:00
|
|
|
unsigned short index;
|
2006-07-06 13:12:07 +02:00
|
|
|
|
2007-07-29 21:21:17 +02:00
|
|
|
find_joydevs();
|
2006-07-06 13:12:07 +02:00
|
|
|
|
2007-08-20 06:26:19 +02:00
|
|
|
if ((index = get_joystick_index(rguid)) < MAX_JOYDEV &&
|
|
|
|
have_joydevs && index < have_joydevs)
|
|
|
|
{
|
|
|
|
if ((riid == NULL) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDeviceA, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice2A, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice7A, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice8A, riid))
|
|
|
|
{
|
|
|
|
*pdev = (IDirectInputDeviceA*) alloc_device(rguid, &JoystickAvt, dinput, index);
|
|
|
|
TRACE("Created a Joystick device (%p)\n", *pdev);
|
|
|
|
|
|
|
|
if (*pdev == NULL)
|
|
|
|
{
|
|
|
|
ERR("out of memory\n");
|
|
|
|
return DIERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
return DI_OK;
|
2006-07-06 13:14:18 +02:00
|
|
|
}
|
2007-08-20 06:26:19 +02:00
|
|
|
|
|
|
|
WARN("no interface\n");
|
2006-07-06 13:12:07 +02:00
|
|
|
return DIERR_NOINTERFACE;
|
|
|
|
}
|
2003-06-16 22:22:13 +02:00
|
|
|
|
2007-07-29 21:21:17 +02:00
|
|
|
return DIERR_DEVICENOTREG;
|
2003-06-16 22:22:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
|
|
|
|
{
|
2007-07-29 21:21:17 +02:00
|
|
|
unsigned short index;
|
2006-07-06 13:12:07 +02:00
|
|
|
|
2007-07-29 21:21:17 +02:00
|
|
|
find_joydevs();
|
2006-07-06 13:12:07 +02:00
|
|
|
|
2007-08-20 06:26:19 +02:00
|
|
|
if ((index = get_joystick_index(rguid)) < MAX_JOYDEV &&
|
|
|
|
have_joydevs && index < have_joydevs)
|
|
|
|
{
|
|
|
|
if ((riid == NULL) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDeviceW, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice2W, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice7W, riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice8W, riid))
|
|
|
|
{
|
|
|
|
*pdev = (IDirectInputDeviceW*) alloc_device(rguid, &JoystickWvt, dinput, index);
|
|
|
|
TRACE("Created a Joystick device (%p)\n", *pdev);
|
|
|
|
|
|
|
|
if (*pdev == NULL)
|
|
|
|
{
|
|
|
|
ERR("out of memory\n");
|
|
|
|
return DIERR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
return DI_OK;
|
2006-07-06 13:14:18 +02:00
|
|
|
}
|
2007-08-20 06:26:19 +02:00
|
|
|
WARN("no interface\n");
|
2006-07-06 13:12:07 +02:00
|
|
|
return DIERR_NOINTERFACE;
|
|
|
|
}
|
2000-12-12 01:38:58 +01:00
|
|
|
|
2007-08-20 06:26:19 +02:00
|
|
|
WARN("invalid device GUID\n");
|
2007-07-29 21:21:17 +02:00
|
|
|
return DIERR_DEVICENOTREG;
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
|
|
|
|
2005-03-15 20:36:15 +01:00
|
|
|
const struct dinput_device joystick_linuxinput_device = {
|
2004-06-04 20:06:37 +02:00
|
|
|
"Wine Linux-input joystick driver",
|
2003-06-16 22:22:13 +02:00
|
|
|
joydev_enum_deviceA,
|
|
|
|
joydev_enum_deviceW,
|
|
|
|
joydev_create_deviceA,
|
|
|
|
joydev_create_deviceW
|
2000-12-12 01:38:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Acquire : gets exclusive control of the joystick
|
|
|
|
*/
|
2002-06-14 02:39:44 +02:00
|
|
|
static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
2000-12-12 01:38:58 +01:00
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
JoystickImpl *This = (JoystickImpl *)iface;
|
2006-12-11 10:04:49 +01:00
|
|
|
HRESULT res;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-12-12 01:38:58 +01:00
|
|
|
TRACE("(this=%p)\n",This);
|
2006-12-11 10:04:49 +01:00
|
|
|
|
2008-12-27 19:23:15 +01:00
|
|
|
if ((res = IDirectInputDevice2AImpl_Acquire(iface)) != DI_OK)
|
|
|
|
{
|
|
|
|
WARN("Failed to acquire: %x\n", res);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((This->joyfd = open(This->joydev->device, O_RDWR)) == -1)
|
|
|
|
{
|
|
|
|
if ((This->joyfd = open(This->joydev->device, O_RDONLY)) == -1)
|
|
|
|
{
|
|
|
|
/* Couldn't open the device at all */
|
|
|
|
ERR("Failed to open device %s: %d %s\n", This->joydev->device, errno, strerror(errno));
|
|
|
|
IDirectInputDevice2AImpl_Unacquire(iface);
|
|
|
|
return DIERR_NOTFOUND;
|
2006-12-11 10:04:49 +01:00
|
|
|
}
|
2009-01-17 22:14:10 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Couldn't open in r/w but opened in read-only. */
|
|
|
|
WARN("Could not open %s in read-write mode. Force feedback will be disabled.\n", This->joydev->device);
|
|
|
|
}
|
2008-12-27 19:23:15 +01:00
|
|
|
}
|
2009-01-22 00:00:10 +01:00
|
|
|
else
|
|
|
|
{
|
2009-01-29 21:26:30 +01:00
|
|
|
struct input_event event;
|
|
|
|
|
|
|
|
event.type = EV_FF;
|
|
|
|
event.code = FF_GAIN;
|
|
|
|
event.value = This->ff_gain;
|
|
|
|
if (write(This->joyfd, &event, sizeof(event)) == -1)
|
|
|
|
ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno));
|
2009-01-22 00:00:10 +01:00
|
|
|
if (!This->ff_autocenter)
|
|
|
|
{
|
|
|
|
/* Disable autocenter. */
|
|
|
|
event.code = FF_AUTOCENTER;
|
|
|
|
event.value = 0;
|
|
|
|
if (write(This->joyfd, &event, sizeof(event)) == -1)
|
|
|
|
ERR("Failed disabling autocenter: %d %s\n", errno, strerror(errno));
|
|
|
|
}
|
|
|
|
}
|
2005-07-29 16:18:58 +02:00
|
|
|
|
2008-12-27 19:23:15 +01:00
|
|
|
return DI_OK;
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Unacquire : frees the joystick
|
|
|
|
*/
|
2002-06-14 02:39:44 +02:00
|
|
|
static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
|
2000-12-12 01:38:58 +01:00
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
JoystickImpl *This = (JoystickImpl *)iface;
|
2006-12-11 10:04:49 +01:00
|
|
|
HRESULT res;
|
2000-12-12 01:38:58 +01:00
|
|
|
|
|
|
|
TRACE("(this=%p)\n",This);
|
2006-12-11 10:04:49 +01:00
|
|
|
res = IDirectInputDevice2AImpl_Unacquire(iface);
|
|
|
|
if (res==DI_OK && This->joyfd!=-1) {
|
2009-01-21 23:01:42 +01:00
|
|
|
effect_list_item *itr;
|
2009-01-22 00:00:10 +01:00
|
|
|
struct input_event event;
|
2009-01-21 23:01:42 +01:00
|
|
|
|
|
|
|
/* For each known effect:
|
|
|
|
* - stop it
|
|
|
|
* - unload it
|
|
|
|
* But, unlike DISFFC_RESET, do not release the effect.
|
|
|
|
*/
|
|
|
|
LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry) {
|
|
|
|
IDirectInputEffect_Stop(itr->ref);
|
|
|
|
IDirectInputEffect_Unload(itr->ref);
|
|
|
|
}
|
|
|
|
|
2009-01-22 00:00:10 +01:00
|
|
|
/* Enable autocenter. */
|
|
|
|
event.type = EV_FF;
|
|
|
|
event.code = FF_AUTOCENTER;
|
|
|
|
/* TODO: Read autocenter strengh before disabling it, and use it here
|
|
|
|
* instead of 0xFFFF (maximum strengh).
|
|
|
|
*/
|
|
|
|
event.value = 0xFFFF;
|
|
|
|
if (write(This->joyfd, &event, sizeof(event)) == -1)
|
|
|
|
ERR("Failed to set autocenter to %04x: %d %s\n", event.value, errno, strerror(errno));
|
|
|
|
|
2006-12-11 10:04:49 +01:00
|
|
|
close(This->joyfd);
|
|
|
|
This->joyfd = -1;
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
2006-12-11 10:04:49 +01:00
|
|
|
return res;
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
|
|
|
|
2004-04-19 04:59:22 +02:00
|
|
|
/*
|
|
|
|
* set the current state of the js device as it would be with the middle
|
|
|
|
* values on the axes
|
|
|
|
*/
|
2007-08-05 20:24:04 +02:00
|
|
|
#define CENTER_AXIS(a) \
|
2009-04-20 04:33:29 +02:00
|
|
|
(ji->axes[a] == -1 ? 0 : joystick_map_axis( &ji->generic.props[ji->axes[a]], \
|
2007-08-20 06:26:27 +02:00
|
|
|
ji->joydev->axes[a].value ))
|
2004-04-19 04:59:22 +02:00
|
|
|
static void fake_current_js_state(JoystickImpl *ji)
|
|
|
|
{
|
2007-08-05 20:24:04 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
/* center the axes */
|
2009-04-20 04:33:29 +02:00
|
|
|
ji->generic.js.lX = CENTER_AXIS(ABS_X);
|
|
|
|
ji->generic.js.lY = CENTER_AXIS(ABS_Y);
|
|
|
|
ji->generic.js.lZ = CENTER_AXIS(ABS_Z);
|
|
|
|
ji->generic.js.lRx = CENTER_AXIS(ABS_RX);
|
|
|
|
ji->generic.js.lRy = CENTER_AXIS(ABS_RY);
|
|
|
|
ji->generic.js.lRz = CENTER_AXIS(ABS_RZ);
|
|
|
|
ji->generic.js.rglSlider[0] = CENTER_AXIS(ABS_THROTTLE);
|
|
|
|
ji->generic.js.rglSlider[1] = CENTER_AXIS(ABS_RUDDER);
|
2007-08-05 20:24:04 +02:00
|
|
|
|
|
|
|
/* POV center is -1 */
|
|
|
|
for (i = 0; i < 4; i++)
|
2009-04-20 04:33:29 +02:00
|
|
|
ji->generic.js.rgdwPOV[i] = -1;
|
2006-03-10 09:58:14 +01:00
|
|
|
}
|
2007-08-05 20:24:04 +02:00
|
|
|
#undef CENTER_AXIS
|
2006-03-10 09:58:14 +01:00
|
|
|
|
2006-07-06 13:15:36 +02:00
|
|
|
/* convert wine format offset to user format object index */
|
2009-04-20 04:33:29 +02:00
|
|
|
static void joy_polldev(JoystickGenericImpl *iface)
|
2007-01-09 21:44:49 +01:00
|
|
|
{
|
2006-11-06 07:28:29 +01:00
|
|
|
struct pollfd plfd;
|
2007-01-09 21:44:49 +01:00
|
|
|
struct input_event ie;
|
2009-04-20 04:33:29 +02:00
|
|
|
JoystickImpl *This = (JoystickImpl*) iface;
|
2000-12-12 01:38:58 +01:00
|
|
|
|
|
|
|
if (This->joyfd==-1)
|
|
|
|
return;
|
|
|
|
|
2007-01-09 21:44:49 +01:00
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
LONG value = 0;
|
|
|
|
int inst_id = -1;
|
|
|
|
|
2006-11-06 07:28:29 +01:00
|
|
|
plfd.fd = This->joyfd;
|
|
|
|
plfd.events = POLLIN;
|
2000-12-12 01:38:58 +01:00
|
|
|
|
2006-11-06 07:28:29 +01:00
|
|
|
if (poll(&plfd,1,0) != 1)
|
2000-12-12 01:38:58 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* we have one event, so we can read */
|
|
|
|
if (sizeof(ie)!=read(This->joyfd,&ie,sizeof(ie)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
TRACE("input_event: type %d, code %d, value %d\n",ie.type,ie.code,ie.value);
|
|
|
|
switch (ie.type) {
|
|
|
|
case EV_KEY: /* button */
|
2007-01-09 21:44:49 +01:00
|
|
|
{
|
2007-01-15 12:08:00 +01:00
|
|
|
int btn = This->buttons[ie.code];
|
2007-01-09 21:44:49 +01:00
|
|
|
|
2006-07-06 13:15:36 +02:00
|
|
|
TRACE("(%p) %d -> %d\n", This, ie.code, btn);
|
2007-01-09 21:44:49 +01:00
|
|
|
if (btn & 0x80)
|
|
|
|
{
|
|
|
|
btn &= 0x7F;
|
|
|
|
inst_id = DIDFT_MAKEINSTANCE(btn) | DIDFT_PSHBUTTON;
|
2009-04-20 04:33:29 +02:00
|
|
|
This->generic.js.rgbButtons[btn] = value = ie.value ? 0x80 : 0x00;
|
2006-07-06 13:15:36 +02:00
|
|
|
}
|
|
|
|
break;
|
2007-01-09 21:44:49 +01:00
|
|
|
}
|
2000-12-12 01:38:58 +01:00
|
|
|
case EV_ABS:
|
2007-01-16 10:45:34 +01:00
|
|
|
{
|
|
|
|
int axis = This->axes[ie.code];
|
|
|
|
if (axis==-1) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
inst_id = DIDFT_MAKEINSTANCE(axis) | (ie.code < ABS_HAT0X ? DIDFT_ABSAXIS : DIDFT_POV);
|
2009-04-20 04:33:29 +02:00
|
|
|
value = joystick_map_axis(&This->generic.props[id_to_object(This->generic.base.data_format.wine_df, inst_id)], ie.value);
|
2007-01-09 21:44:49 +01:00
|
|
|
|
2000-12-12 01:38:58 +01:00
|
|
|
switch (ie.code) {
|
2009-04-20 04:33:29 +02:00
|
|
|
case ABS_X: This->generic.js.lX = value; break;
|
|
|
|
case ABS_Y: This->generic.js.lY = value; break;
|
|
|
|
case ABS_Z: This->generic.js.lZ = value; break;
|
|
|
|
case ABS_RX: This->generic.js.lRx = value; break;
|
|
|
|
case ABS_RY: This->generic.js.lRy = value; break;
|
|
|
|
case ABS_RZ: This->generic.js.lRz = value; break;
|
|
|
|
case ABS_THROTTLE: This->generic.js.rglSlider[0] = value; break;
|
|
|
|
case ABS_RUDDER: This->generic.js.rglSlider[1] = value; break;
|
2007-08-05 20:22:49 +02:00
|
|
|
case ABS_HAT0X: case ABS_HAT0Y: case ABS_HAT1X: case ABS_HAT1Y:
|
|
|
|
case ABS_HAT2X: case ABS_HAT2Y: case ABS_HAT3X: case ABS_HAT3Y:
|
|
|
|
{
|
|
|
|
int idx = (ie.code - ABS_HAT0X) / 2;
|
|
|
|
|
|
|
|
if (ie.code % 2)
|
|
|
|
This->povs[idx].y = ie.value;
|
|
|
|
else
|
|
|
|
This->povs[idx].x = ie.value;
|
|
|
|
|
2009-04-20 04:33:29 +02:00
|
|
|
This->generic.js.rgdwPOV[idx] = value = joystick_map_pov(&This->povs[idx]);
|
2006-03-10 09:58:14 +01:00
|
|
|
break;
|
2007-08-05 20:22:49 +02:00
|
|
|
}
|
2000-12-12 01:38:58 +01:00
|
|
|
default:
|
2007-01-15 12:07:04 +01:00
|
|
|
FIXME("unhandled joystick axis event (code %d, value %d)\n",ie.code,ie.value);
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
|
|
|
break;
|
2007-01-16 10:45:34 +01:00
|
|
|
}
|
2005-09-06 11:19:51 +02:00
|
|
|
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
2005-09-03 17:02:38 +02:00
|
|
|
case EV_FF_STATUS:
|
|
|
|
This->ff_state = ie.value;
|
|
|
|
break;
|
2005-09-06 11:19:51 +02:00
|
|
|
#endif
|
2006-02-09 17:44:38 +01:00
|
|
|
#ifdef EV_SYN
|
2006-02-09 12:07:55 +01:00
|
|
|
case EV_SYN:
|
|
|
|
/* there is nothing to do */
|
|
|
|
break;
|
2006-02-09 17:44:38 +01:00
|
|
|
#endif
|
2000-12-12 01:38:58 +01:00
|
|
|
default:
|
|
|
|
FIXME("joystick cannot handle type %d event (code %d)\n",ie.type,ie.code);
|
|
|
|
break;
|
|
|
|
}
|
2007-01-09 21:44:49 +01:00
|
|
|
if (inst_id >= 0)
|
|
|
|
queue_event((LPDIRECTINPUTDEVICE8A)This,
|
2009-04-20 04:33:29 +02:00
|
|
|
id_to_offset(&This->generic.base.data_format, inst_id),
|
|
|
|
value, ie.time.tv_usec, This->generic.base.dinput->evsequence++);
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* SetProperty : change input device properties
|
|
|
|
*/
|
2002-06-14 02:39:44 +02:00
|
|
|
static HRESULT WINAPI JoystickAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface,
|
2000-12-12 01:38:58 +01:00
|
|
|
REFGUID rguid,
|
|
|
|
LPCDIPROPHEADER ph)
|
|
|
|
{
|
2004-09-09 22:17:07 +02:00
|
|
|
JoystickImpl *This = (JoystickImpl *)iface;
|
2000-12-12 01:38:58 +01:00
|
|
|
|
2005-11-12 20:10:38 +01:00
|
|
|
if (!ph) {
|
|
|
|
WARN("invalid argument\n");
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE("ph.dwSize = %d, ph.dwHeaderSize =%d, ph.dwObj = %d, ph.dwHow= %d\n",
|
|
|
|
ph->dwSize, ph->dwHeaderSize, ph->dwObj, ph->dwHow);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-12-12 01:38:58 +01:00
|
|
|
if (!HIWORD(rguid)) {
|
2005-09-12 12:30:05 +02:00
|
|
|
switch (LOWORD(rguid)) {
|
2009-01-05 12:39:44 +01:00
|
|
|
case (DWORD_PTR)DIPROP_CALIBRATIONMODE: {
|
2006-12-11 10:04:02 +01:00
|
|
|
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
|
|
|
|
FIXME("DIPROP_CALIBRATIONMODE(%d)\n", pd->dwData);
|
|
|
|
break;
|
|
|
|
}
|
2009-01-05 12:39:44 +01:00
|
|
|
case (DWORD_PTR)DIPROP_AUTOCENTER: {
|
2007-11-04 17:11:49 +01:00
|
|
|
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
|
|
|
|
|
2009-01-22 00:00:10 +01:00
|
|
|
TRACE("autocenter(%d)\n", pd->dwData);
|
|
|
|
This->ff_autocenter = pd->dwData == DIPROPAUTOCENTER_ON;
|
|
|
|
|
2007-11-04 17:11:49 +01:00
|
|
|
break;
|
|
|
|
}
|
2009-01-29 21:26:30 +01:00
|
|
|
case (DWORD_PTR)DIPROP_FFGAIN: {
|
|
|
|
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
|
|
|
|
|
|
|
|
TRACE("DIPROP_FFGAIN(%d)\n", pd->dwData);
|
|
|
|
This->ff_gain = MulDiv(pd->dwData, 0xFFFF, 10000);
|
2009-04-20 04:33:29 +02:00
|
|
|
if (This->generic.base.acquired) {
|
2009-01-29 21:26:30 +01:00
|
|
|
/* Update immediately. */
|
|
|
|
struct input_event event;
|
|
|
|
|
|
|
|
event.type = EV_FF;
|
|
|
|
event.code = FF_GAIN;
|
|
|
|
event.value = This->ff_gain;
|
|
|
|
if (write(This->joyfd, &event, sizeof(event)) == -1)
|
|
|
|
ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2000-12-12 01:38:58 +01:00
|
|
|
default:
|
2009-04-20 04:33:29 +02:00
|
|
|
return JoystickAGenericImpl_SetProperty(iface, rguid, ph);
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
|
|
|
}
|
2006-12-04 18:54:49 +01:00
|
|
|
return DI_OK;
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetProperty : get input device properties
|
|
|
|
*/
|
2002-06-14 02:39:44 +02:00
|
|
|
static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
|
2000-12-12 01:38:58 +01:00
|
|
|
REFGUID rguid,
|
|
|
|
LPDIPROPHEADER pdiph)
|
|
|
|
{
|
2007-02-02 08:47:01 +01:00
|
|
|
JoystickImpl *This = (JoystickImpl *)iface;
|
2000-12-12 01:38:58 +01:00
|
|
|
|
2007-02-02 08:47:01 +01:00
|
|
|
TRACE("(this=%p,%s,%p)\n", iface, debugstr_guid(rguid), pdiph);
|
2000-12-12 01:38:58 +01:00
|
|
|
_dump_DIPROPHEADER(pdiph);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2007-02-02 08:47:01 +01:00
|
|
|
if (HIWORD(rguid)) return DI_OK;
|
|
|
|
|
2005-09-12 12:30:05 +02:00
|
|
|
switch (LOWORD(rguid)) {
|
2009-01-22 00:00:10 +01:00
|
|
|
case (DWORD_PTR) DIPROP_AUTOCENTER:
|
|
|
|
{
|
|
|
|
LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
|
|
|
|
|
|
|
|
pd->dwData = This->ff_autocenter ? DIPROPAUTOCENTER_ON : DIPROPAUTOCENTER_OFF;
|
|
|
|
TRACE("autocenter(%d)\n", pd->dwData);
|
|
|
|
break;
|
|
|
|
}
|
2009-01-29 21:26:30 +01:00
|
|
|
case (DWORD_PTR) DIPROP_FFGAIN:
|
|
|
|
{
|
|
|
|
LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph;
|
|
|
|
|
|
|
|
pd->dwData = MulDiv(This->ff_gain, 10000, 0xFFFF);
|
|
|
|
TRACE("DIPROP_FFGAIN(%d)\n", pd->dwData);
|
|
|
|
break;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-12-12 01:38:58 +01:00
|
|
|
default:
|
2009-04-20 04:33:29 +02:00
|
|
|
return JoystickAGenericImpl_GetProperty(iface, rguid, pdiph);
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2007-02-02 08:47:01 +01:00
|
|
|
return DI_OK;
|
2000-12-12 01:38:58 +01:00
|
|
|
}
|
|
|
|
|
2005-09-03 17:02:38 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* CreateEffect - Create a new FF effect with the specified params
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI JoystickAImpl_CreateEffect(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
REFGUID rguid,
|
|
|
|
LPCDIEFFECT lpeff,
|
|
|
|
LPDIRECTINPUTEFFECT *ppdef,
|
|
|
|
LPUNKNOWN pUnkOuter)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
2008-07-06 06:24:51 +02:00
|
|
|
effect_list_item* new_effect = NULL;
|
2005-09-03 17:02:38 +02:00
|
|
|
HRESULT retval = DI_OK;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
JoystickImpl* This = (JoystickImpl*)iface;
|
|
|
|
TRACE("(this=%p,%p,%p,%p,%p)\n", This, rguid, lpeff, ppdef, pUnkOuter);
|
|
|
|
|
|
|
|
#ifndef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
|
|
|
TRACE("not available (compiled w/o ff support)\n");
|
|
|
|
*ppdef = NULL;
|
2006-11-10 07:40:41 +01:00
|
|
|
return DI_OK;
|
2005-09-03 17:02:38 +02:00
|
|
|
#else
|
|
|
|
|
2008-07-06 06:24:51 +02:00
|
|
|
if (!(new_effect = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_effect))))
|
|
|
|
return DIERR_OUTOFMEMORY;
|
2005-09-03 17:02:38 +02:00
|
|
|
|
2008-07-06 06:24:57 +02:00
|
|
|
retval = linuxinput_create_effect(&This->joyfd, rguid, &new_effect->entry, &new_effect->ref);
|
2005-09-03 17:02:38 +02:00
|
|
|
if (retval != DI_OK)
|
2008-07-06 06:24:51 +02:00
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, new_effect);
|
|
|
|
return retval;
|
|
|
|
}
|
2006-11-10 07:40:41 +01:00
|
|
|
|
2005-09-03 17:02:38 +02:00
|
|
|
if (lpeff != NULL)
|
2008-07-06 06:24:51 +02:00
|
|
|
{
|
|
|
|
retval = IDirectInputEffect_SetParameters(new_effect->ref, lpeff, 0);
|
2005-09-03 17:02:38 +02:00
|
|
|
|
2008-07-06 06:24:51 +02:00
|
|
|
if (retval != DI_OK && retval != DI_DOWNLOADSKIPPED)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, new_effect);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
list_add_tail(&This->ff_effects, &new_effect->entry);
|
|
|
|
*ppdef = new_effect->ref;
|
2005-09-03 17:02:38 +02:00
|
|
|
|
|
|
|
if (pUnkOuter != NULL)
|
|
|
|
FIXME("Interface aggregation not implemented.\n");
|
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
|
|
|
|
#endif /* HAVE_STRUCT_FF_EFFECT_DIRECTION */
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* EnumEffects - Enumerate available FF effects
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI JoystickAImpl_EnumEffects(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIENUMEFFECTSCALLBACKA lpCallback,
|
|
|
|
LPVOID pvRef,
|
|
|
|
DWORD dwEffType)
|
|
|
|
{
|
2005-09-07 13:25:32 +02:00
|
|
|
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
2005-09-03 17:02:38 +02:00
|
|
|
DIEFFECTINFOA dei; /* feif */
|
|
|
|
DWORD type = DIEFT_GETTYPE(dwEffType);
|
|
|
|
JoystickImpl* This = (JoystickImpl*)iface;
|
|
|
|
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE("(this=%p,%p,%d) type=%d\n", This, pvRef, dwEffType, type);
|
2005-09-03 17:02:38 +02:00
|
|
|
|
|
|
|
dei.dwSize = sizeof(DIEFFECTINFOA);
|
|
|
|
|
|
|
|
if ((type == DIEFT_ALL || type == DIEFT_CONSTANTFORCE)
|
2006-07-06 13:12:07 +02:00
|
|
|
&& test_bit(This->joydev->ffbits, FF_CONSTANT)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_ConstantForce);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((type == DIEFT_ALL || type == DIEFT_PERIODIC)
|
2006-07-06 13:12:07 +02:00
|
|
|
&& test_bit(This->joydev->ffbits, FF_PERIODIC)) {
|
|
|
|
if (test_bit(This->joydev->ffbits, FF_SQUARE)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Square);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_SINE)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Sine);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_TRIANGLE)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Triangle);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_SAW_UP)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_SawtoothUp);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_SAW_DOWN)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_SawtoothDown);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((type == DIEFT_ALL || type == DIEFT_RAMPFORCE)
|
2006-07-06 13:12:07 +02:00
|
|
|
&& test_bit(This->joydev->ffbits, FF_RAMP)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_RampForce);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == DIEFT_ALL || type == DIEFT_CONDITION) {
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_SPRING)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Spring);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_DAMPER)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Damper);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_INERTIA)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Inertia);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_FRICTION)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Friction);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI JoystickWImpl_EnumEffects(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMEFFECTSCALLBACKW lpCallback,
|
|
|
|
LPVOID pvRef,
|
|
|
|
DWORD dwEffType)
|
|
|
|
{
|
2005-09-07 13:25:32 +02:00
|
|
|
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
2005-09-03 17:02:38 +02:00
|
|
|
/* seems silly to duplicate all this code but all the structures and functions
|
|
|
|
* are actually different (A/W) */
|
|
|
|
DIEFFECTINFOW dei; /* feif */
|
|
|
|
DWORD type = DIEFT_GETTYPE(dwEffType);
|
|
|
|
JoystickImpl* This = (JoystickImpl*)iface;
|
|
|
|
int xfd = This->joyfd;
|
|
|
|
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE("(this=%p,%p,%d) type=%d fd=%d\n", This, pvRef, dwEffType, type, xfd);
|
2005-09-03 17:02:38 +02:00
|
|
|
|
|
|
|
dei.dwSize = sizeof(DIEFFECTINFOW);
|
|
|
|
|
|
|
|
if ((type == DIEFT_ALL || type == DIEFT_CONSTANTFORCE)
|
2006-07-06 13:12:07 +02:00
|
|
|
&& test_bit(This->joydev->ffbits, FF_CONSTANT)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_ConstantForce);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((type == DIEFT_ALL || type == DIEFT_PERIODIC)
|
2006-07-06 13:12:07 +02:00
|
|
|
&& test_bit(This->joydev->ffbits, FF_PERIODIC)) {
|
|
|
|
if (test_bit(This->joydev->ffbits, FF_SQUARE)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Square);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_SINE)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Sine);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_TRIANGLE)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Triangle);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_SAW_UP)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_SawtoothUp);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_SAW_DOWN)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_SawtoothDown);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((type == DIEFT_ALL || type == DIEFT_RAMPFORCE)
|
2006-07-06 13:12:07 +02:00
|
|
|
&& test_bit(This->joydev->ffbits, FF_RAMP)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_RampForce);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == DIEFT_ALL || type == DIEFT_CONDITION) {
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_SPRING)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Spring);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_DAMPER)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Damper);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_INERTIA)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Inertia);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
2006-07-06 13:12:07 +02:00
|
|
|
if (test_bit(This->joydev->ffbits, FF_FRICTION)) {
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_GetEffectInfo(iface, &dei, &GUID_Friction);
|
2005-09-03 17:02:38 +02:00
|
|
|
(*lpCallback)(&dei, pvRef);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-07 00:37:42 +01:00
|
|
|
/* return to unacquired state if that's where it was */
|
2005-09-03 17:02:38 +02:00
|
|
|
if (xfd == -1)
|
2005-09-07 13:50:34 +02:00
|
|
|
IDirectInputDevice8_Unacquire(iface);
|
2005-09-03 17:02:38 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* GetEffectInfo - Get information about a particular effect
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI JoystickAImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIEFFECTINFOA pdei,
|
|
|
|
REFGUID guid)
|
|
|
|
{
|
|
|
|
JoystickImpl* This = (JoystickImpl*)iface;
|
|
|
|
|
|
|
|
TRACE("(this=%p,%p,%s)\n", This, pdei, _dump_dinput_GUID(guid));
|
|
|
|
|
|
|
|
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
|
|
|
return linuxinput_get_info_A(This->joyfd, guid, pdei);
|
|
|
|
#else
|
|
|
|
return DI_OK;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI JoystickWImpl_GetEffectInfo(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIEFFECTINFOW pdei,
|
|
|
|
REFGUID guid)
|
|
|
|
{
|
|
|
|
JoystickImpl* This = (JoystickImpl*)iface;
|
|
|
|
|
|
|
|
TRACE("(this=%p,%p,%s)\n", This, pdei, _dump_dinput_GUID(guid));
|
|
|
|
|
|
|
|
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
|
|
|
return linuxinput_get_info_W(This->joyfd, guid, pdei);
|
|
|
|
#else
|
|
|
|
return DI_OK;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* GetForceFeedbackState - Get information about the device's FF state
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI JoystickAImpl_GetForceFeedbackState(
|
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDWORD pdwOut)
|
|
|
|
{
|
|
|
|
JoystickImpl* This = (JoystickImpl*)iface;
|
|
|
|
|
|
|
|
TRACE("(this=%p,%p)\n", This, pdwOut);
|
|
|
|
|
|
|
|
(*pdwOut) = 0;
|
|
|
|
|
|
|
|
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
|
|
|
/* DIGFFS_STOPPED is the only mandatory flag to report */
|
|
|
|
if (This->ff_state == FF_STATUS_STOPPED)
|
|
|
|
(*pdwOut) |= DIGFFS_STOPPED;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* SendForceFeedbackCommand - Send a command to the device's FF system
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI JoystickAImpl_SendForceFeedbackCommand(
|
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
|
|
|
JoystickImpl* This = (JoystickImpl*)iface;
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE("(this=%p,%d)\n", This, dwFlags);
|
2005-09-03 17:02:38 +02:00
|
|
|
|
|
|
|
#ifdef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
2008-07-06 06:24:51 +02:00
|
|
|
switch (dwFlags)
|
|
|
|
{
|
|
|
|
case DISFFC_STOPALL:
|
|
|
|
{
|
2005-09-03 17:02:38 +02:00
|
|
|
/* Stop all effects */
|
2008-07-06 06:24:51 +02:00
|
|
|
effect_list_item *itr;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry)
|
|
|
|
IDirectInputEffect_Stop(itr->ref);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case DISFFC_RESET:
|
|
|
|
{
|
|
|
|
effect_list_item *itr, *ptr;
|
|
|
|
|
2005-09-03 17:02:38 +02:00
|
|
|
/* Stop, unload, release and free all effects */
|
|
|
|
/* This returns the device to its "bare" state */
|
2008-07-06 06:24:51 +02:00
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(itr, ptr, &This->ff_effects, effect_list_item, entry)
|
|
|
|
IDirectInputEffect_Release(itr->ref);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DISFFC_PAUSE:
|
|
|
|
case DISFFC_CONTINUE:
|
2005-09-03 17:02:38 +02:00
|
|
|
FIXME("No support for Pause or Continue in linux\n");
|
2008-07-06 06:24:51 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DISFFC_SETACTUATORSOFF:
|
|
|
|
case DISFFC_SETACTUATORSON:
|
|
|
|
FIXME("No direct actuator control in linux\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2005-09-03 17:02:38 +02:00
|
|
|
FIXME("Unknown Force Feedback Command!\n");
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
}
|
|
|
|
return DI_OK;
|
|
|
|
#else
|
|
|
|
return DIERR_UNSUPPORTED;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* EnumCreatedEffectObjects - Enumerate all the effects that have been
|
|
|
|
* created for this device.
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI JoystickAImpl_EnumCreatedEffectObjects(
|
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
|
|
|
|
LPVOID pvRef,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
|
|
|
/* this function is safe to call on non-ff-enabled builds */
|
|
|
|
JoystickImpl* This = (JoystickImpl*)iface;
|
2008-07-06 06:24:51 +02:00
|
|
|
effect_list_item *itr, *ptr;
|
|
|
|
|
2006-10-08 01:55:40 +02:00
|
|
|
TRACE("(this=%p,%p,%p,%d)\n", This, lpCallback, pvRef, dwFlags);
|
2005-09-03 17:02:38 +02:00
|
|
|
|
|
|
|
if (!lpCallback)
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
|
|
|
if (dwFlags != 0)
|
2006-10-18 21:21:57 +02:00
|
|
|
FIXME("Flags specified, but no flags exist yet (DX9)!\n");
|
2005-09-03 17:02:38 +02:00
|
|
|
|
2008-07-06 06:24:51 +02:00
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(itr, ptr, &This->ff_effects, effect_list_item, entry)
|
|
|
|
(*lpCallback)(itr->ref, pvRef);
|
2005-09-03 17:02:38 +02:00
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2007-09-25 03:34:44 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GetDeviceInfo : get information about a device's identity
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI JoystickAImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIDEVICEINSTANCEA pdidi)
|
|
|
|
{
|
|
|
|
JoystickImpl *This = (JoystickImpl *)iface;
|
|
|
|
|
|
|
|
TRACE("(%p) %p\n", This, pdidi);
|
|
|
|
|
|
|
|
if (pdidi == NULL) return E_POINTER;
|
|
|
|
if ((pdidi->dwSize != sizeof(DIDEVICEINSTANCE_DX3A)) &&
|
|
|
|
(pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)))
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
2009-04-20 04:33:29 +02:00
|
|
|
fill_joystick_dideviceinstanceA(pdidi, This->generic.base.dinput->dwVersion,
|
|
|
|
get_joystick_index(&This->generic.base.guid));
|
2007-09-25 03:34:44 +02:00
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI JoystickWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIDEVICEINSTANCEW pdidi)
|
|
|
|
{
|
|
|
|
JoystickImpl *This = (JoystickImpl *)iface;
|
|
|
|
|
|
|
|
TRACE("(%p) %p\n", This, pdidi);
|
|
|
|
|
|
|
|
if (pdidi == NULL) return E_POINTER;
|
|
|
|
if ((pdidi->dwSize != sizeof(DIDEVICEINSTANCE_DX3W)) &&
|
|
|
|
(pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)))
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
2009-04-20 04:33:29 +02:00
|
|
|
fill_joystick_dideviceinstanceW(pdidi, This->generic.base.dinput->dwVersion,
|
|
|
|
get_joystick_index(&This->generic.base.guid));
|
2007-09-25 03:34:44 +02:00
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2005-05-30 12:01:08 +02:00
|
|
|
static const IDirectInputDevice8AVtbl JoystickAvt =
|
2000-12-12 01:38:58 +01:00
|
|
|
{
|
|
|
|
IDirectInputDevice2AImpl_QueryInterface,
|
|
|
|
IDirectInputDevice2AImpl_AddRef,
|
2007-06-27 14:58:27 +02:00
|
|
|
IDirectInputDevice2AImpl_Release,
|
2009-04-20 04:33:29 +02:00
|
|
|
JoystickAGenericImpl_GetCapabilities,
|
2007-01-09 21:44:42 +01:00
|
|
|
IDirectInputDevice2AImpl_EnumObjects,
|
2000-12-12 01:38:58 +01:00
|
|
|
JoystickAImpl_GetProperty,
|
|
|
|
JoystickAImpl_SetProperty,
|
|
|
|
JoystickAImpl_Acquire,
|
|
|
|
JoystickAImpl_Unacquire,
|
2009-04-20 04:33:29 +02:00
|
|
|
JoystickAGenericImpl_GetDeviceState,
|
2006-12-04 18:54:49 +01:00
|
|
|
IDirectInputDevice2AImpl_GetDeviceData,
|
2006-12-12 16:58:13 +01:00
|
|
|
IDirectInputDevice2AImpl_SetDataFormat,
|
2006-10-15 19:29:48 +02:00
|
|
|
IDirectInputDevice2AImpl_SetEventNotification,
|
2000-12-12 01:38:58 +01:00
|
|
|
IDirectInputDevice2AImpl_SetCooperativeLevel,
|
2009-03-09 16:07:27 +01:00
|
|
|
JoystickAGenericImpl_GetObjectInfo,
|
2007-09-25 03:34:44 +02:00
|
|
|
JoystickAImpl_GetDeviceInfo,
|
2000-12-12 01:38:58 +01:00
|
|
|
IDirectInputDevice2AImpl_RunControlPanel,
|
|
|
|
IDirectInputDevice2AImpl_Initialize,
|
2005-09-03 17:02:38 +02:00
|
|
|
JoystickAImpl_CreateEffect,
|
|
|
|
JoystickAImpl_EnumEffects,
|
|
|
|
JoystickAImpl_GetEffectInfo,
|
|
|
|
JoystickAImpl_GetForceFeedbackState,
|
|
|
|
JoystickAImpl_SendForceFeedbackCommand,
|
|
|
|
JoystickAImpl_EnumCreatedEffectObjects,
|
2000-12-12 01:38:58 +01:00
|
|
|
IDirectInputDevice2AImpl_Escape,
|
2009-04-20 04:33:29 +02:00
|
|
|
JoystickAGenericImpl_Poll,
|
2000-12-12 01:38:58 +01:00
|
|
|
IDirectInputDevice2AImpl_SendDeviceData,
|
|
|
|
IDirectInputDevice7AImpl_EnumEffectsInFile,
|
2002-06-14 02:39:44 +02:00
|
|
|
IDirectInputDevice7AImpl_WriteEffectToFile,
|
|
|
|
IDirectInputDevice8AImpl_BuildActionMap,
|
|
|
|
IDirectInputDevice8AImpl_SetActionMap,
|
|
|
|
IDirectInputDevice8AImpl_GetImageInfo
|
2000-12-12 01:38:58 +01:00
|
|
|
};
|
|
|
|
|
2003-06-16 22:22:13 +02:00
|
|
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
|
|
|
# define XCAST(fun) (typeof(JoystickWvt.fun))
|
|
|
|
#else
|
|
|
|
# define XCAST(fun) (void*)
|
|
|
|
#endif
|
|
|
|
|
2005-05-30 12:01:08 +02:00
|
|
|
static const IDirectInputDevice8WVtbl JoystickWvt =
|
2003-06-16 22:22:13 +02:00
|
|
|
{
|
|
|
|
IDirectInputDevice2WImpl_QueryInterface,
|
|
|
|
XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
|
2007-06-27 14:58:27 +02:00
|
|
|
XCAST(Release)IDirectInputDevice2AImpl_Release,
|
2009-04-20 04:33:29 +02:00
|
|
|
XCAST(GetCapabilities)JoystickAGenericImpl_GetCapabilities,
|
2007-01-09 21:44:42 +01:00
|
|
|
IDirectInputDevice2WImpl_EnumObjects,
|
2003-06-16 22:22:13 +02:00
|
|
|
XCAST(GetProperty)JoystickAImpl_GetProperty,
|
|
|
|
XCAST(SetProperty)JoystickAImpl_SetProperty,
|
|
|
|
XCAST(Acquire)JoystickAImpl_Acquire,
|
|
|
|
XCAST(Unacquire)JoystickAImpl_Unacquire,
|
2009-04-20 04:33:29 +02:00
|
|
|
XCAST(GetDeviceState)JoystickAGenericImpl_GetDeviceState,
|
2006-12-04 18:54:49 +01:00
|
|
|
XCAST(GetDeviceData)IDirectInputDevice2AImpl_GetDeviceData,
|
2006-12-12 16:58:13 +01:00
|
|
|
XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
|
2006-10-15 19:29:48 +02:00
|
|
|
XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
|
2003-06-16 22:22:13 +02:00
|
|
|
XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
|
2009-03-09 16:07:27 +01:00
|
|
|
JoystickWGenericImpl_GetObjectInfo,
|
2007-09-25 03:34:44 +02:00
|
|
|
JoystickWImpl_GetDeviceInfo,
|
2003-06-16 22:22:13 +02:00
|
|
|
XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
|
|
|
|
XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
|
2005-09-03 17:02:38 +02:00
|
|
|
XCAST(CreateEffect)JoystickAImpl_CreateEffect,
|
|
|
|
JoystickWImpl_EnumEffects,
|
|
|
|
JoystickWImpl_GetEffectInfo,
|
|
|
|
XCAST(GetForceFeedbackState)JoystickAImpl_GetForceFeedbackState,
|
|
|
|
XCAST(SendForceFeedbackCommand)JoystickAImpl_SendForceFeedbackCommand,
|
|
|
|
XCAST(EnumCreatedEffectObjects)JoystickAImpl_EnumCreatedEffectObjects,
|
2003-06-16 22:22:13 +02:00
|
|
|
XCAST(Escape)IDirectInputDevice2AImpl_Escape,
|
2009-04-20 04:33:29 +02:00
|
|
|
XCAST(Poll)JoystickAGenericImpl_Poll,
|
2003-06-16 22:22:13 +02:00
|
|
|
XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
|
|
|
|
IDirectInputDevice7WImpl_EnumEffectsInFile,
|
|
|
|
IDirectInputDevice7WImpl_WriteEffectToFile,
|
|
|
|
IDirectInputDevice8WImpl_BuildActionMap,
|
|
|
|
IDirectInputDevice8WImpl_SetActionMap,
|
|
|
|
IDirectInputDevice8WImpl_GetImageInfo
|
|
|
|
};
|
|
|
|
#undef XCAST
|
|
|
|
|
2005-03-15 20:36:15 +01:00
|
|
|
#else /* HAVE_CORRECT_LINUXINPUT_H */
|
2001-01-19 22:09:07 +01:00
|
|
|
|
2005-03-18 11:25:15 +01:00
|
|
|
const struct dinput_device joystick_linuxinput_device = {
|
2005-03-15 20:36:15 +01:00
|
|
|
"Wine Linux-input joystick driver",
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* HAVE_CORRECT_LINUXINPUT_H */
|