Merge branch 'master' into qt-wacom-serial
This commit is contained in:
130
src/config.c
130
src/config.c
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker,
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Overdoze,
|
||||
@@ -19,7 +19,7 @@
|
||||
* Copyright 2008-2019 Sarah Walker.
|
||||
* Copyright 2016-2019 Miran Grca.
|
||||
* Copyright 2017-2019 Fred N. van Kempen.
|
||||
* Copyright 2018,2019 David Hrdlička.
|
||||
* Copyright 2018-2019 David Hrdlička.
|
||||
*
|
||||
* NOTE: Forcing config files to be in Unicode encoding breaks
|
||||
* it on Windows XP, and possibly also Vista. Use the
|
||||
@@ -61,6 +61,7 @@
|
||||
#include <86box/scsi.h>
|
||||
#include <86box/scsi_device.h>
|
||||
#include <86box/cdrom.h>
|
||||
#include <86box/cdrom_interface.h>
|
||||
#include <86box/zip.h>
|
||||
#include <86box/mo.h>
|
||||
#include <86box/sound.h>
|
||||
@@ -529,7 +530,7 @@ load_video(void)
|
||||
|
||||
if (machine_has_flags(machine, MACHINE_VIDEO_ONLY)) {
|
||||
ini_section_delete_var(cat, "gfxcard");
|
||||
gfxcard = VID_INTERNAL;
|
||||
gfxcard[0] = VID_INTERNAL;
|
||||
} else {
|
||||
p = ini_section_get_string(cat, "gfxcard", NULL);
|
||||
if (p == NULL) {
|
||||
@@ -543,9 +544,9 @@ load_video(void)
|
||||
free_p = 1;
|
||||
}
|
||||
if (!strcmp(p, "virge375_vbe20_pci")) /* migrate renamed cards */
|
||||
gfxcard = video_get_video_from_internal_name("virge385_pci");
|
||||
gfxcard[0] = video_get_video_from_internal_name("virge385_pci");
|
||||
else
|
||||
gfxcard = video_get_video_from_internal_name(p);
|
||||
gfxcard[0] = video_get_video_from_internal_name(p);
|
||||
if (free_p)
|
||||
free(p);
|
||||
}
|
||||
@@ -559,7 +560,7 @@ load_video(void)
|
||||
p = ini_section_get_string(cat, "gfxcard_2", NULL);
|
||||
if (!p)
|
||||
p = "none";
|
||||
gfxcard_2 = video_get_video_from_internal_name(p);
|
||||
gfxcard[1] = video_get_video_from_internal_name(p);
|
||||
}
|
||||
|
||||
/* Load "Input Devices" section. */
|
||||
@@ -667,9 +668,36 @@ load_sound(void)
|
||||
if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci")))
|
||||
p = "es1371";
|
||||
if (p != NULL)
|
||||
sound_card_current = sound_card_get_from_internal_name(p);
|
||||
sound_card_current[0] = sound_card_get_from_internal_name(p);
|
||||
else
|
||||
sound_card_current = 0;
|
||||
sound_card_current[0] = 0;
|
||||
|
||||
p = ini_section_get_string(cat, "sndcard2", NULL);
|
||||
/* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */
|
||||
if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci")))
|
||||
p = "es1371";
|
||||
if (p != NULL)
|
||||
sound_card_current[1] = sound_card_get_from_internal_name(p);
|
||||
else
|
||||
sound_card_current[1] = 0;
|
||||
|
||||
p = ini_section_get_string(cat, "sndcard3", NULL);
|
||||
/* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */
|
||||
if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci")))
|
||||
p = "es1371";
|
||||
if (p != NULL)
|
||||
sound_card_current[2] = sound_card_get_from_internal_name(p);
|
||||
else
|
||||
sound_card_current[2] = 0;
|
||||
|
||||
p = ini_section_get_string(cat, "sndcard4", NULL);
|
||||
/* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */
|
||||
if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci")))
|
||||
p = "es1371";
|
||||
if (p != NULL)
|
||||
sound_card_current[3] = sound_card_get_from_internal_name(p);
|
||||
else
|
||||
sound_card_current[3] = 0;
|
||||
|
||||
p = ini_section_get_string(cat, "midi_device", NULL);
|
||||
if (p != NULL)
|
||||
@@ -685,10 +713,6 @@ load_sound(void)
|
||||
|
||||
mpu401_standalone_enable = !!ini_section_get_int(cat, "mpu401_standalone", 0);
|
||||
|
||||
SSI2001 = !!ini_section_get_int(cat, "ssi2001", 0);
|
||||
GAMEBLASTER = !!ini_section_get_int(cat, "gameblaster", 0);
|
||||
GUS = !!ini_section_get_int(cat, "gus", 0);
|
||||
|
||||
memset(temp, '\0', sizeof(temp));
|
||||
p = ini_section_get_string(cat, "sound_type", "float");
|
||||
if (strlen(p) > 511)
|
||||
@@ -906,6 +930,15 @@ load_storage_controllers(void)
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
p = ini_section_get_string(cat, "cdrom_interface", NULL);
|
||||
if (p != NULL)
|
||||
cdrom_interface_current = cdrom_interface_get_from_internal_name(p);
|
||||
|
||||
if (free_p) {
|
||||
free(p);
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
ide_ter_enabled = !!ini_section_get_int(cat, "ide_ter", 0);
|
||||
ide_qua_enabled = !!ini_section_get_int(cat, "ide_qua", 0);
|
||||
|
||||
@@ -1323,8 +1356,13 @@ load_floppy_and_cdrom_drives(void)
|
||||
|
||||
sprintf(temp, "cdrom_%02i_speed", c + 1);
|
||||
cdrom[c].speed = ini_section_get_int(cat, temp, 8);
|
||||
sprintf(temp, "cdrom_%02i_early", c + 1);
|
||||
cdrom[c].early = ini_section_get_int(cat, temp, 0);
|
||||
|
||||
sprintf(temp, "cdrom_%02i_type", c + 1);
|
||||
p = ini_section_get_string(cat, temp, (c == 1) ? "86BOX_CD-ROM_1.00" : "none");
|
||||
cdrom_set_type(c, cdrom_get_from_internal_name(p));
|
||||
if (cdrom_get_type(c) > KNOWN_CDROM_DRIVE_TYPES)
|
||||
cdrom_set_type(c, KNOWN_CDROM_DRIVE_TYPES);
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
/* Default values, needed for proper operation of the Settings dialog. */
|
||||
cdrom[c].ide_channel = cdrom[c].scsi_device_id = c + 2;
|
||||
@@ -1815,7 +1853,7 @@ config_load(void)
|
||||
dpi_scale = 1;
|
||||
|
||||
fpu_type = fpu_get_type(cpu_f, cpu, "none");
|
||||
gfxcard = video_get_video_from_internal_name("cga");
|
||||
gfxcard[0] = video_get_video_from_internal_name("cga");
|
||||
vid_api = plat_vidapi("default");
|
||||
vid_resize = 0;
|
||||
video_fullscreen_first = 1;
|
||||
@@ -2199,7 +2237,7 @@ save_video(void)
|
||||
ini_section_t cat = ini_find_or_create_section(config, "Video");
|
||||
|
||||
ini_section_set_string(cat, "gfxcard",
|
||||
video_get_internal_name(gfxcard));
|
||||
video_get_internal_name(gfxcard[0]));
|
||||
|
||||
if (voodoo_enabled == 0)
|
||||
ini_section_delete_var(cat, "voodoo");
|
||||
@@ -2216,10 +2254,10 @@ save_video(void)
|
||||
else
|
||||
ini_section_set_int(cat, "xga", xga_enabled);
|
||||
|
||||
if (gfxcard_2 == 0)
|
||||
if (gfxcard[1] == 0)
|
||||
ini_section_delete_var(cat, "gfxcard_2");
|
||||
else
|
||||
ini_section_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard_2));
|
||||
ini_section_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard[1]));
|
||||
|
||||
if (show_second_monitors == 1)
|
||||
ini_section_delete_var(cat, "show_second_monitors");
|
||||
@@ -2304,10 +2342,25 @@ save_sound(void)
|
||||
{
|
||||
ini_section_t cat = ini_find_or_create_section(config, "Sound");
|
||||
|
||||
if (sound_card_current == 0)
|
||||
if (sound_card_current[0] == 0)
|
||||
ini_section_delete_var(cat, "sndcard");
|
||||
else
|
||||
ini_section_set_string(cat, "sndcard", sound_card_get_internal_name(sound_card_current));
|
||||
ini_section_set_string(cat, "sndcard", sound_card_get_internal_name(sound_card_current[0]));
|
||||
|
||||
if (sound_card_current[1] == 0)
|
||||
ini_section_delete_var(cat, "sndcard2");
|
||||
else
|
||||
ini_section_set_string(cat, "sndcard2", sound_card_get_internal_name(sound_card_current[1]));
|
||||
|
||||
if (sound_card_current[2] == 0)
|
||||
ini_section_delete_var(cat, "sndcard3");
|
||||
else
|
||||
ini_section_set_string(cat, "sndcard3", sound_card_get_internal_name(sound_card_current[2]));
|
||||
|
||||
if (sound_card_current[3] == 0)
|
||||
ini_section_delete_var(cat, "sndcard4");
|
||||
else
|
||||
ini_section_set_string(cat, "sndcard4", sound_card_get_internal_name(sound_card_current[3]));
|
||||
|
||||
if (!strcmp(midi_out_device_get_internal_name(midi_output_device_current), "none"))
|
||||
ini_section_delete_var(cat, "midi_device");
|
||||
@@ -2324,21 +2377,6 @@ save_sound(void)
|
||||
else
|
||||
ini_section_set_int(cat, "mpu401_standalone", mpu401_standalone_enable);
|
||||
|
||||
if (SSI2001 == 0)
|
||||
ini_section_delete_var(cat, "ssi2001");
|
||||
else
|
||||
ini_section_set_int(cat, "ssi2001", SSI2001);
|
||||
|
||||
if (GAMEBLASTER == 0)
|
||||
ini_section_delete_var(cat, "gameblaster");
|
||||
else
|
||||
ini_section_set_int(cat, "gameblaster", GAMEBLASTER);
|
||||
|
||||
if (GUS == 0)
|
||||
ini_section_delete_var(cat, "gus");
|
||||
else
|
||||
ini_section_set_int(cat, "gus", GUS);
|
||||
|
||||
if (sound_is_float == 1)
|
||||
ini_section_delete_var(cat, "sound_type");
|
||||
else
|
||||
@@ -2478,6 +2516,12 @@ save_storage_controllers(void)
|
||||
ini_section_set_string(cat, "hdc",
|
||||
hdc_get_internal_name(hdc_current));
|
||||
|
||||
if (cdrom_interface_current == 0)
|
||||
ini_section_delete_var(cat, "cdrom_interface");
|
||||
else
|
||||
ini_section_set_string(cat, "cdrom_interface",
|
||||
cdrom_interface_get_internal_name(cdrom_interface_current));
|
||||
|
||||
if (ide_ter_enabled == 0)
|
||||
ini_section_delete_var(cat, "ide_ter");
|
||||
else
|
||||
@@ -2725,17 +2769,25 @@ save_floppy_and_cdrom_drives(void)
|
||||
ini_section_set_int(cat, temp, cdrom[c].speed);
|
||||
}
|
||||
|
||||
sprintf(temp, "cdrom_%02i_early", c + 1);
|
||||
if ((cdrom[c].bus_type == 0) || (cdrom[c].early == 0)) {
|
||||
sprintf(temp, "cdrom_%02i_type", c + 1);
|
||||
if ((cdrom[c].bus_type == 0) || (cdrom[c].bus_type == CDROM_BUS_MITSUMI)) {
|
||||
ini_section_delete_var(cat, temp);
|
||||
} else {
|
||||
ini_section_set_int(cat, temp, cdrom[c].early);
|
||||
ini_section_set_string(cat, temp,
|
||||
cdrom_get_internal_name(cdrom_get_type(c)));
|
||||
}
|
||||
|
||||
sprintf(temp, "cdrom_%02i_parameters", c + 1);
|
||||
if (cdrom[c].bus_type == 0) {
|
||||
ini_section_delete_var(cat, temp);
|
||||
} else {
|
||||
} else { /*In case one wants an ATAPI drive on SCSI and vice-versa.*/
|
||||
if (cdrom[c].bus_type == CDROM_BUS_ATAPI) {
|
||||
if (cdrom_drive_types[cdrom_get_type(c)].bus_type == BUS_TYPE_SCSI)
|
||||
cdrom[c].bus_type = CDROM_BUS_SCSI;
|
||||
} else if (cdrom[c].bus_type == CDROM_BUS_SCSI) {
|
||||
if (cdrom_drive_types[cdrom_get_type(c)].bus_type == BUS_TYPE_IDE)
|
||||
cdrom[c].bus_type = CDROM_BUS_ATAPI;
|
||||
}
|
||||
sprintf(tmp2, "%u, %s", cdrom[c].sound_on,
|
||||
hdd_bus_to_string(cdrom[c].bus_type, 1));
|
||||
ini_section_set_string(cat, temp, tmp2);
|
||||
|
||||
Reference in New Issue
Block a user