Merge branch 'master' of https://github.com/86Box/86Box
This commit is contained in:
22
src/config.c
22
src/config.c
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
@@ -715,7 +715,20 @@ load_input_devices(void)
|
||||
else
|
||||
mouse_type = 0;
|
||||
|
||||
joystick_type = config_get_int(cat, "joystick_type", JOYSTICK_TYPE_NONE);
|
||||
p = config_get_string(cat, "joystick_type", NULL);
|
||||
if (p != NULL) {
|
||||
joystick_type = joystick_get_from_internal_name(p);
|
||||
if (!joystick_type) {
|
||||
/* Try to read an integer for backwards compatibility with old configs */
|
||||
c = config_get_int(cat, "joystick_type", 8);
|
||||
if ((c >= 0) && (c < 8))
|
||||
/* "None" was type 8 instead of 0 previously, shift the number accordingly */
|
||||
joystick_type = c + 1;
|
||||
else
|
||||
joystick_type = 0;
|
||||
}
|
||||
} else
|
||||
joystick_type = 0;
|
||||
|
||||
for (c=0; c<joystick_get_max_joysticks(joystick_type); c++) {
|
||||
sprintf(temp, "joystick_%i_nr", c);
|
||||
@@ -1672,7 +1685,6 @@ config_load(void)
|
||||
gfxcard = video_get_video_from_internal_name("cga");
|
||||
vid_api = plat_vidapi("default");
|
||||
time_sync = TIME_SYNC_ENABLED;
|
||||
joystick_type = JOYSTICK_TYPE_NONE;
|
||||
hdc_current = hdc_get_from_internal_name("none");
|
||||
serial_enabled[0] = 1;
|
||||
serial_enabled[1] = 1;
|
||||
@@ -1977,7 +1989,7 @@ save_input_devices(void)
|
||||
|
||||
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");
|
||||
|
||||
for (c = 0; c < 16; c++) {
|
||||
@@ -1998,7 +2010,7 @@ save_input_devices(void)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
config_set_int(cat, "joystick_type", joystick_type);
|
||||
config_set_string(cat, "joystick_type", joystick_get_internal_name(joystick_type));
|
||||
|
||||
for (c = 0; c < joystick_get_max_joysticks(joystick_type); c++) {
|
||||
sprintf(tmp2, "joystick_%i_nr", c);
|
||||
|
||||
Reference in New Issue
Block a user