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

@@ -2508,7 +2508,7 @@ machine_amstrad_init(const machine_t *model, int type)
mouse_set_poll(ms_poll, ams);
}
if (joystick_type != 7)
if (joystick_type != JOYSTICK_TYPE_NONE)
device_add(&gameport_device);
}

View File

@@ -72,7 +72,7 @@ machine_at_common_init_ex(const machine_t *model, int type)
else if (type == 0)
device_add(&at_nvr_device);
if (joystick_type != 7)
if (joystick_type != JOYSTICK_TYPE_NONE)
device_add(&gameport_device);
}

View File

@@ -615,7 +615,7 @@ europc_boot(const device_t *info)
mouse_bus_set_irq(sys->mouse, 2);
/* Configure the port for (Bus Mouse Compatible) Mouse. */
b |= 0x01;
} else if (joystick_type != 7)
} else if (joystick_type != JOYSTICK_TYPE_NONE)
b |= 0x02; /* enable port as joysticks */
sys->nvr.regs[MRTC_CONF_C] = b;

View File

@@ -892,7 +892,7 @@ machine_olim24_init(const machine_t *model)
keyboard_set_table(scancode_xt);
if (joystick_type != 7)
if (joystick_type != JOYSTICK_TYPE_NONE)
device_add(&gameport_device);
/* FIXME: make sure this is correct?? */

View File

@@ -525,7 +525,7 @@ ps1_common_init(const machine_t *model)
device_add(&keyboard_ps2_ps1_device);
/* Audio uses ports 200h and 202-207h, so only initialize gameport on 201h. */
if (joystick_type != 7)
if (joystick_type != JOYSTICK_TYPE_NONE)
device_add(&gameport_201_device);
}

View File

@@ -1527,7 +1527,7 @@ machine_tandy1k_init(const machine_t *model, int type)
device_add(&eep_1000sl2_device);
}
if (joystick_type != 7)
if (joystick_type != JOYSTICK_TYPE_NONE)
device_add(&gameport_device);
eep_data_out = 0x0000;

View File

@@ -26,7 +26,7 @@ machine_xt_common_init(const machine_t *model)
device_add(&fdc_xt_device);
nmi_init();
if (joystick_type != 7)
if (joystick_type != JOYSTICK_TYPE_NONE)
device_add(&gameport_device);
}

View File

@@ -55,7 +55,7 @@ machine_xt_compaq_init(const machine_t *model)
device_add(&keyboard_xt_compaq_device);
device_add(&fdc_xt_device);
nmi_init();
if (joystick_type != 7)
if (joystick_type != JOYSTICK_TYPE_NONE)
device_add(&gameport_device);
lpt1_remove();

View File

@@ -171,7 +171,7 @@ machine_xt_lxt3_init(const machine_t *model)
device_add(&keyboard_xt_lxt3_device);
device_add(&fdc_xt_device);
nmi_init();
if (joystick_type != 7)
if (joystick_type != JOYSTICK_TYPE_NONE)
device_add(&gameport_device);
laserxt_init(1);

View File

@@ -175,7 +175,7 @@ machine_xt_xi8088_init(const machine_t *model)
nmi_init();
device_add(&ibmat_nvr_device);
pic2_init();
if (joystick_type != 7)
if (joystick_type != JOYSTICK_TYPE_NONE)
device_add(&gameport_device);
return ret;