Reworking of joystick support :

- Joystick type now selectable
- Added emulation of standard joysticks with up to 8 buttons
- Added emulation of Microsoft Sidewinder pads
- Host->emulated joystick button & axis mapping now configurable (only on Windows atm)
- Gameport registers now take 1us to access - helps Sidewinder drivers
This commit is contained in:
SarahW 2016-06-21 22:00:31 +01:00
commit 7980438e1f
17 changed files with 543 additions and 100 deletions

View file

@ -5,14 +5,61 @@ extern "C" {
void joystick_close();
void joystick_poll();
typedef struct plat_joystick_t
{
char name[64];
int a[8];
int b[32];
int p[4];
struct
{
char name[32];
int id;
} axis[8];
struct
{
char name[32];
int id;
} button[32];
struct
{
char name[32];
int id;
} pov[4];
int nr_axes;
int nr_buttons;
int nr_povs;
} plat_joystick_t;
#define MAX_PLAT_JOYSTICKS 8
extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
extern int joysticks_present;
#define POV_X 0x80000000
#define POV_Y 0x40000000
typedef struct joystick_t
{
int x, y;
int b[4];
int axis[8];
int button[32];
int pov[4];
int plat_joystick_nr;
int axis_mapping[8];
int button_mapping[32];
} joystick_t;
extern joystick_t joystick_state[2];
extern int joysticks_present;
#define MAX_JOYSTICKS 4
extern joystick_t joystick_state[MAX_JOYSTICKS];
#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0)
#ifdef __cplusplus
}
#endif