Move the "No joystick" option to the top and get rid of the JOYSTICK_TYPE_NONE macro
This commit is contained in:
16
src/config.c
16
src/config.c
@@ -718,16 +718,17 @@ load_input_devices(void)
|
|||||||
p = config_get_string(cat, "joystick_type", NULL);
|
p = config_get_string(cat, "joystick_type", NULL);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
joystick_type = joystick_get_from_internal_name(p);
|
joystick_type = joystick_get_from_internal_name(p);
|
||||||
if (joystick_type == JOYSTICK_TYPE_NONE) {
|
if (!joystick_type) {
|
||||||
/* Try to read an integer for backwards compatibility with old configs */
|
/* Try to read an integer for backwards compatibility with old configs */
|
||||||
c = config_get_int(cat, "joystick_type", JOYSTICK_TYPE_NONE);
|
c = config_get_int(cat, "joystick_type", 8);
|
||||||
if ((c >= 0) && (c <= 8))
|
if ((c >= 0) && (c < 8))
|
||||||
joystick_type = c;
|
/* "None" was type 8 instead of 0 previously, shift the number accordingly */
|
||||||
|
joystick_type = c + 1;
|
||||||
else
|
else
|
||||||
joystick_type = JOYSTICK_TYPE_NONE;
|
joystick_type = 0;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
joystick_type = JOYSTICK_TYPE_NONE;
|
joystick_type = 0;
|
||||||
|
|
||||||
for (c=0; c<joystick_get_max_joysticks(joystick_type); c++) {
|
for (c=0; c<joystick_get_max_joysticks(joystick_type); c++) {
|
||||||
sprintf(temp, "joystick_%i_nr", c);
|
sprintf(temp, "joystick_%i_nr", c);
|
||||||
@@ -1684,7 +1685,6 @@ config_load(void)
|
|||||||
gfxcard = video_get_video_from_internal_name("cga");
|
gfxcard = video_get_video_from_internal_name("cga");
|
||||||
vid_api = plat_vidapi("default");
|
vid_api = plat_vidapi("default");
|
||||||
time_sync = TIME_SYNC_ENABLED;
|
time_sync = TIME_SYNC_ENABLED;
|
||||||
joystick_type = JOYSTICK_TYPE_NONE;
|
|
||||||
hdc_current = hdc_get_from_internal_name("none");
|
hdc_current = hdc_get_from_internal_name("none");
|
||||||
serial_enabled[0] = 1;
|
serial_enabled[0] = 1;
|
||||||
serial_enabled[1] = 1;
|
serial_enabled[1] = 1;
|
||||||
@@ -1987,7 +1987,7 @@ save_input_devices(void)
|
|||||||
|
|
||||||
config_set_string(cat, "mouse_type", mouse_get_internal_name(mouse_type));
|
config_set_string(cat, "mouse_type", mouse_get_internal_name(mouse_type));
|
||||||
|
|
||||||
if (joystick_type == JOYSTICK_TYPE_NONE) {
|
if (!joystick_type) {
|
||||||
config_delete_var(cat, "joystick_type");
|
config_delete_var(cat, "joystick_type");
|
||||||
|
|
||||||
for (c = 0; c < 16; c++) {
|
for (c = 0; c < 16; c++) {
|
||||||
|
@@ -68,11 +68,11 @@ typedef struct _gameport_ {
|
|||||||
} gameport_t;
|
} gameport_t;
|
||||||
|
|
||||||
|
|
||||||
int joystick_type;
|
int joystick_type = 0;
|
||||||
|
|
||||||
|
|
||||||
static const joystick_if_t joystick_none = {
|
static const joystick_if_t joystick_none = {
|
||||||
"No joystick",
|
"None",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -89,6 +89,7 @@ static const struct {
|
|||||||
const char *internal_name;
|
const char *internal_name;
|
||||||
const joystick_if_t *joystick;
|
const joystick_if_t *joystick;
|
||||||
} joysticks[] = {
|
} joysticks[] = {
|
||||||
|
{ "none", &joystick_none },
|
||||||
{ "standard_2button", &joystick_standard },
|
{ "standard_2button", &joystick_standard },
|
||||||
{ "standard_4button", &joystick_standard_4button },
|
{ "standard_4button", &joystick_standard_4button },
|
||||||
{ "standard_6button", &joystick_standard_6button },
|
{ "standard_6button", &joystick_standard_6button },
|
||||||
@@ -97,7 +98,6 @@ static const struct {
|
|||||||
{ "ch_flighstick_pro", &joystick_ch_flightstick_pro },
|
{ "ch_flighstick_pro", &joystick_ch_flightstick_pro },
|
||||||
{ "sidewinder_pad", &joystick_sw_pad },
|
{ "sidewinder_pad", &joystick_sw_pad },
|
||||||
{ "thrustmaster_fcs", &joystick_tm_fcs },
|
{ "thrustmaster_fcs", &joystick_tm_fcs },
|
||||||
{ "none", &joystick_none },
|
|
||||||
{ "", NULL }
|
{ "", NULL }
|
||||||
};
|
};
|
||||||
static gameport_t *gameport_global = NULL;
|
static gameport_t *gameport_global = NULL;
|
||||||
@@ -131,7 +131,7 @@ joystick_get_from_internal_name(char *s)
|
|||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return JOYSTICK_TYPE_NONE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ gameport_init(const device_t *info)
|
|||||||
{
|
{
|
||||||
gameport_t *p = NULL;
|
gameport_t *p = NULL;
|
||||||
|
|
||||||
if (joystick_type == JOYSTICK_TYPE_NONE) {
|
if (!joystick_type) {
|
||||||
p = NULL;
|
p = NULL;
|
||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ gameport_201_init(const device_t *info)
|
|||||||
{
|
{
|
||||||
gameport_t *p;
|
gameport_t *p;
|
||||||
|
|
||||||
if (joystick_type == JOYSTICK_TYPE_NONE) {
|
if (!joystick_type) {
|
||||||
p = NULL;
|
p = NULL;
|
||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
#define SLIDER 0x20000000
|
#define SLIDER 0x20000000
|
||||||
|
|
||||||
#define AXIS_NOT_PRESENT -99999
|
#define AXIS_NOT_PRESENT -99999
|
||||||
#define JOYSTICK_TYPE_NONE 8
|
|
||||||
|
|
||||||
#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0)
|
#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0)
|
||||||
|
|
||||||
|
@@ -2507,7 +2507,7 @@ machine_amstrad_init(const machine_t *model, int type)
|
|||||||
mouse_set_poll(ms_poll, ams);
|
mouse_set_poll(ms_poll, ams);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,7 +74,7 @@ machine_at_common_init_ex(const machine_t *model, int type)
|
|||||||
else if (type == 0)
|
else if (type == 0)
|
||||||
device_add(&at_nvr_device);
|
device_add(&at_nvr_device);
|
||||||
|
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -615,7 +615,7 @@ europc_boot(const device_t *info)
|
|||||||
mouse_bus_set_irq(sys->mouse, 2);
|
mouse_bus_set_irq(sys->mouse, 2);
|
||||||
/* Configure the port for (Bus Mouse Compatible) Mouse. */
|
/* Configure the port for (Bus Mouse Compatible) Mouse. */
|
||||||
b |= 0x01;
|
b |= 0x01;
|
||||||
} else if (joystick_type != JOYSTICK_TYPE_NONE)
|
} else if (joystick_type)
|
||||||
b |= 0x02; /* enable port as joysticks */
|
b |= 0x02; /* enable port as joysticks */
|
||||||
sys->nvr.regs[MRTC_CONF_C] = b;
|
sys->nvr.regs[MRTC_CONF_C] = b;
|
||||||
|
|
||||||
|
@@ -517,7 +517,7 @@ ps1_common_init(const machine_t *model)
|
|||||||
device_add(&keyboard_ps2_ps1_device);
|
device_add(&keyboard_ps2_ps1_device);
|
||||||
|
|
||||||
/* Audio uses ports 200h and 202-207h, so only initialize gameport on 201h. */
|
/* Audio uses ports 200h and 202-207h, so only initialize gameport on 201h. */
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_201_device);
|
device_add(&gameport_201_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1535,7 +1535,7 @@ machine_tandy1k_init(const machine_t *model, int type)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
|
|
||||||
eep_data_out = 0x0000;
|
eep_data_out = 0x0000;
|
||||||
|
@@ -29,7 +29,7 @@ machine_xt_common_init(const machine_t *model)
|
|||||||
device_add(&fdc_xt_device);
|
device_add(&fdc_xt_device);
|
||||||
|
|
||||||
nmi_init();
|
nmi_init();
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ machine_xt_compaq_deskpro_init(const machine_t *model)
|
|||||||
if (fdc_type == FDC_INTERNAL)
|
if (fdc_type == FDC_INTERNAL)
|
||||||
device_add(&fdc_xt_device);
|
device_add(&fdc_xt_device);
|
||||||
nmi_init();
|
nmi_init();
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
|
|
||||||
lpt1_remove();
|
lpt1_remove();
|
||||||
@@ -85,7 +85,7 @@ machine_xt_compaq_portable_init(const machine_t *model)
|
|||||||
if (fdc_type == FDC_INTERNAL)
|
if (fdc_type == FDC_INTERNAL)
|
||||||
device_add(&fdc_xt_device);
|
device_add(&fdc_xt_device);
|
||||||
nmi_init();
|
nmi_init();
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
|
|
||||||
lpt1_remove();
|
lpt1_remove();
|
||||||
|
@@ -171,7 +171,7 @@ machine_xt_lxt3_init(const machine_t *model)
|
|||||||
device_add(&keyboard_xt_lxt3_device);
|
device_add(&keyboard_xt_lxt3_device);
|
||||||
device_add(&fdc_xt_device);
|
device_add(&fdc_xt_device);
|
||||||
nmi_init();
|
nmi_init();
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
|
|
||||||
laserxt_init(1);
|
laserxt_init(1);
|
||||||
|
@@ -717,7 +717,7 @@ machine_xt_olim24_init(const machine_t *model)
|
|||||||
/* FIXME: make sure this is correct?? */
|
/* FIXME: make sure this is correct?? */
|
||||||
device_add(&at_nvr_device);
|
device_add(&at_nvr_device);
|
||||||
|
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
|
|
||||||
nmi_init();
|
nmi_init();
|
||||||
@@ -760,7 +760,7 @@ machine_xt_olim240_init(const machine_t *model)
|
|||||||
if (fdc_type == FDC_INTERNAL)
|
if (fdc_type == FDC_INTERNAL)
|
||||||
device_add(&fdc_xt_device);
|
device_add(&fdc_xt_device);
|
||||||
|
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
|
|
||||||
nmi_init();
|
nmi_init();
|
||||||
@@ -833,7 +833,7 @@ machine_xt_olim15_init(const machine_t *model)
|
|||||||
if (fdc_type == FDC_INTERNAL)
|
if (fdc_type == FDC_INTERNAL)
|
||||||
device_add(&fdc_xt_device);
|
device_add(&fdc_xt_device);
|
||||||
|
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
|
|
||||||
nmi_init();
|
nmi_init();
|
||||||
|
@@ -177,7 +177,7 @@ machine_xt_xi8088_init(const machine_t *model)
|
|||||||
nmi_init();
|
nmi_init();
|
||||||
device_add(&ibmat_nvr_device);
|
device_add(&ibmat_nvr_device);
|
||||||
pic2_init();
|
pic2_init();
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
device_add(&gameport_device);
|
device_add(&gameport_device);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
2
src/pc.c
2
src/pc.c
@@ -809,7 +809,7 @@ pc_reset_hard_init(void)
|
|||||||
/* Reset and reconfigure the Network Card layer. */
|
/* Reset and reconfigure the Network Card layer. */
|
||||||
network_reset();
|
network_reset();
|
||||||
|
|
||||||
if (joystick_type != JOYSTICK_TYPE_NONE)
|
if (joystick_type)
|
||||||
gameport_update_joystick_type();
|
gameport_update_joystick_type();
|
||||||
|
|
||||||
ui_sb_update_panes();
|
ui_sb_update_panes();
|
||||||
|
@@ -263,7 +263,7 @@ void joystick_process(void)
|
|||||||
{
|
{
|
||||||
int c, d;
|
int c, d;
|
||||||
|
|
||||||
if (joystick_type == JOYSTICK_TYPE_NONE) return;
|
if (!joystick_type) return;
|
||||||
|
|
||||||
for (c = 0; c < joysticks_present; c++)
|
for (c = 0; c < joysticks_present; c++)
|
||||||
{
|
{
|
||||||
|
@@ -217,7 +217,7 @@ void joystick_process(void)
|
|||||||
{
|
{
|
||||||
int c, d;
|
int c, d;
|
||||||
|
|
||||||
if (joystick_type == JOYSTICK_TYPE_NONE) return;
|
if (!joystick_type) return;
|
||||||
|
|
||||||
joystick_poll();
|
joystick_poll();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user