Assorted Joystick fixes

Implemented use of DirectInput sliders.  They were previously lumped in with axis and then not read or used at all.

Lots of use of joystick_type == 7 or joystick_type != 7 to detect if the joystick_type was none.  Changed this to a define.

The text to enumerate the types of joysticks was contained in a numbered LPARAM sheet.  Switched to using the name listed in the joystick struct.

Joysticks with more than 32 buttons would overflow the plat_joystick_state button array.  Added overflow checks.

Added a 4 axis 4 button joystick type that Win98 can pick up as a generic 4 axis 4 button controller.
This commit is contained in:
horkthane
2020-01-16 19:23:54 -05:00
parent 9b80d4b151
commit 3a8b89af63
20 changed files with 151 additions and 51 deletions

View File

@@ -45,8 +45,10 @@
#define POV_X 0x80000000
#define POV_Y 0x40000000
#define SLIDER 0x20000000
#define AXIS_NOT_PRESENT -99999
#define JOYSTICK_TYPE_NONE 8
#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0)
@@ -57,6 +59,7 @@ typedef struct {
int a[8];
int b[32];
int p[4];
int s[2];
struct {
char name[260];
@@ -73,9 +76,16 @@ typedef struct {
int id;
} pov[4];
struct
{
char name[260];
int id;
} slider[2];
int nr_axes;
int nr_buttons;
int nr_povs;
int nr_sliders;
} plat_joystick_t;
typedef struct {