Final merge of Google Summer of Code 2008 work...
Force Feedback for SDL by Edgar Simo, mentored by Ryan C. Gordon --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403159
This commit is contained in:
parent
0aca811202
commit
4fd9c25fe6
29 changed files with 6642 additions and 165 deletions
|
@ -31,13 +31,11 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include <limits.h> /* For the definition of PATH_MAX */
|
||||
#include <linux/joystick.h>
|
||||
#if SDL_INPUT_LINUXEV
|
||||
#include <linux/input.h>
|
||||
#endif
|
||||
|
||||
#include "SDL_joystick.h"
|
||||
#include "../SDL_sysjoystick.h"
|
||||
#include "../SDL_joystick_c.h"
|
||||
#include "SDL_sysjoystick_c.h"
|
||||
|
||||
/* Special joystick configurations */
|
||||
static struct
|
||||
|
@ -278,35 +276,6 @@ static struct
|
|||
} SDL_joylist[MAX_JOYSTICKS];
|
||||
|
||||
|
||||
/* The private structure used to keep track of a joystick */
|
||||
struct joystick_hwdata
|
||||
{
|
||||
int fd;
|
||||
/* The current linux joystick driver maps hats to two axes */
|
||||
struct hwdata_hat
|
||||
{
|
||||
int axis[2];
|
||||
} *hats;
|
||||
/* The current linux joystick driver maps balls to two axes */
|
||||
struct hwdata_ball
|
||||
{
|
||||
int axis[2];
|
||||
} *balls;
|
||||
|
||||
/* Support for the Linux 2.4 unified input interface */
|
||||
#if SDL_INPUT_LINUXEV
|
||||
SDL_bool is_hid;
|
||||
Uint8 key_map[KEY_MAX - BTN_MISC];
|
||||
Uint8 abs_map[ABS_MAX];
|
||||
struct axis_correct
|
||||
{
|
||||
int used;
|
||||
int coef[3];
|
||||
} abs_correct[ABS_MAX];
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#ifndef NO_LOGICAL_JOYSTICKS
|
||||
|
||||
static int
|
||||
|
@ -805,6 +774,7 @@ int
|
|||
SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
|
||||
{
|
||||
int fd;
|
||||
char *fname;
|
||||
SDL_logical_joydecl(int realindex);
|
||||
SDL_logical_joydecl(SDL_Joystick * realjoy = NULL);
|
||||
|
||||
|
@ -818,13 +788,16 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
|
|||
return (-1);
|
||||
|
||||
fd = realjoy->hwdata->fd;
|
||||
fname = realjoy->hwdata->fname;
|
||||
|
||||
} else {
|
||||
fd = open(SDL_joylist[joystick->index].fname, O_RDONLY, 0);
|
||||
fname = SDL_joylist[joystick->index].fname;
|
||||
}
|
||||
SDL_joylist[joystick->index].joy = joystick;
|
||||
#else
|
||||
fd = open(SDL_joylist[joystick->index].fname, O_RDONLY, 0);
|
||||
fname = SDL_joylist[joystick->index].fname;
|
||||
#endif
|
||||
|
||||
if (fd < 0) {
|
||||
|
@ -840,6 +813,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
|
|||
}
|
||||
SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
|
||||
joystick->hwdata->fd = fd;
|
||||
joystick->hwdata->fname = fname;
|
||||
|
||||
/* Set the joystick to non-blocking read mode */
|
||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue