From 1811115b65e6a7b5618c9846a19b5c39845557c1 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 15 Aug 2023 16:42:13 +0200 Subject: [PATCH] Some flags and configuration file fixes. --- src/config.c | 16 +++--- src/include/86box/cdrom.h | 13 +++-- src/include/86box/machine.h | 110 +++++++++++++++++++----------------- 3 files changed, 73 insertions(+), 66 deletions(-) diff --git a/src/config.c b/src/config.c index d917d4548..d6b12e9f9 100644 --- a/src/config.c +++ b/src/config.c @@ -2923,16 +2923,14 @@ save_floppy_and_cdrom_drives(void) } sprintf(temp, "cdrom_%02i_parameters", c + 1); - if (cdrom[c].bus_type == 0) { + if (cdrom[c].bus_type == 0) ini_section_delete_var(cat, temp); - } 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; - } + else { + /* In case one wants an ATAPI drive on SCSI and vice-versa. */ + if ((cdrom_drive_types[cdrom_get_type(c)].bus_type != BUS_TYPE_BOTH) && + (cdrom_drive_types[cdrom_get_type(c)].bus_type != cdrom[c].bus_type)) + cdrom[c].bus_type = cdrom_drive_types[cdrom_get_type(c)].bus_type; + sprintf(tmp2, "%u, %s", cdrom[c].sound_on, hdd_bus_to_string(cdrom[c].bus_type, 1)); ini_section_set_string(cat, temp, tmp2); diff --git a/src/include/86box/cdrom.h b/src/include/86box/cdrom.h index 69b4e90f3..50f90168a 100644 --- a/src/include/86box/cdrom.h +++ b/src/include/86box/cdrom.h @@ -60,12 +60,13 @@ enum { CDROM_BUS_USB = 8 }; -#define KNOWN_CDROM_DRIVE_TYPES 35 -#define BUS_TYPE_ALL 0 -#define BUS_TYPE_IDE 1 -#define BUS_TYPE_SCSI 2 +#define KNOWN_CDROM_DRIVE_TYPES 35 +#define BUS_TYPE_IDE CDROM_BUS_ATAPI +#define BUS_TYPE_SCSI CDROM_BUS_SCSI +#define BUS_TYPE_BOTH -1 -static const struct { +static const struct +{ const char vendor[9]; const char model[17]; const char revision[5]; @@ -73,7 +74,7 @@ static const struct { const char *internal_name; const int bus_type; } cdrom_drive_types[] = { - { "86BOX", "CD-ROM", "1.00", "(ATAPI/SCSI) 86BOX CD-ROM 1.00", "86BOX_CD-ROM_1.00", BUS_TYPE_ALL }, /*1*/ + { "86BOX", "CD-ROM", "1.00", "(ATAPI/SCSI) 86BOX CD-ROM 1.00", "86BOX_CD-ROM_1.00", BUS_TYPE_BOTH }, /*1*/ { "AZT", "CDA46802I", "1.15", "(ATAPI) AZT CDA46802I 1.15", "AZT_CDA46802I_1.15", BUS_TYPE_IDE }, /*2*/ { "BTC", "CD-ROM BCD36XH", "U1.0", "(ATAPI) BTC CD-ROM BCD36XH U1.0", "BTC_CD-ROM_BCD36XH_U1.0", BUS_TYPE_IDE }, /*3*/ { "GOLDSTAR", "CRD-8160B", "3.14", "(ATAPI) GOLDSTAR CRD-8160B 3.14", "GOLDSTAR_CRD-8160B_3.14", BUS_TYPE_IDE }, /*4*/ diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index b52790255..4b6c24499 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -80,61 +80,69 @@ #define MACHINE_PS2_NOISA (MACHINE_PS2_AGP & ~MACHINE_AT) /* sys is AGP PS/2 without ISA */ #define MACHINE_PS2_NOI97 (MACHINE_PS2_A97 & ~MACHINE_AT) /* sys is AGP/AC97 PS/2 without ISA */ /* Feature flags for miscellaneous internal devices. */ -#define MACHINE_FLAGS_NONE 0x00000000 /* sys has no int devices */ -#define MACHINE_VIDEO 0x00000001 /* sys has int video */ -#define MACHINE_VIDEO_ONLY 0x00000002 /* sys has fixed video */ -#define MACHINE_MOUSE 0x00000004 /* sys has int mouse */ -#define MACHINE_FDC 0x00000008 /* sys has int FDC */ -#define MACHINE_LPT_PRI 0x00000010 /* sys has int pri LPT */ -#define MACHINE_LPT_SEC 0x00000020 /* sys has int sec LPT */ -#define MACHINE_UART_PRI 0x00000040 /* sys has int pri UART */ -#define MACHINE_UART_SEC 0x00000080 /* sys has int sec UART */ -#define MACHINE_UART_TER 0x00000100 /* sys has int ter UART */ -#define MACHINE_UART_QUA 0x00000200 /* sys has int qua UART */ -#define MACHINE_GAMEPORT 0x00000400 /* sys has int game port */ -#define MACHINE_SOUND 0x00000800 /* sys has int sound */ -#define MACHINE_NIC 0x00001000 /* sys has int NIC */ -#define MACHINE_MODEM 0x00002000 /* sys has int modem */ +#define MACHINE_FLAGS_NONE 0x00000000 /* sys has no int devices */ +#define MACHINE_SOFTFLOAT_ONLY 0x00000001 /* sys requires SoftFloat FPU */ +#define MACHINE_VIDEO 0x00000002 /* sys has int video */ +#define MACHINE_VIDEO_ONLY 0x00000004 /* sys has fixed video */ +#define MACHINE_MOUSE 0x00000008 /* sys has int mouse */ +#define MACHINE_FDC 0x00000010 /* sys has int FDC */ +#define MACHINE_LPT_PRI 0x00000020 /* sys has int pri LPT */ +#define MACHINE_LPT_SEC 0x00000040 /* sys has int sec LPT */ +#define MACHINE_LPT_TER 0x00000080 /* sys has int ter LPT */ +#define MACHINE_LPT_QUA 0x00000100 /* sys has int qua LPT */ +#define MACHINE_UART_PRI 0x00000200 /* sys has int pri UART */ +#define MACHINE_UART_SEC 0x00000400 /* sys has int sec UART */ +#define MACHINE_UART_TER 0x00000800 /* sys has int ter UART */ +#define MACHINE_UART_QUA 0x00001000 /* sys has int qua UART */ +#define MACHINE_GAMEPORT 0x00002000 /* sys has int game port */ +#define MACHINE_SOUND 0x00004000 /* sys has int sound */ +#define MACHINE_NIC 0x00008000 /* sys has int NIC */ +#define MACHINE_MODEM 0x00010000 /* sys has int modem */ /* Feature flags for advanced devices. */ -#define MACHINE_APM 0x00004000 /* sys has APM */ -#define MACHINE_ACPI 0x00008000 /* sys has ACPI */ -#define MACHINE_HWM 0x00010000 /* sys has hw monitor */ -/* Combined flags. */ -#define MACHINE_VIDEO_FIXED (MACHINE_VIDEO | MACHINE_VIDEO_ONLY) /* sys has fixed int video */ -#define MACHINE_SUPER_IO (MACHINE_FDC | MACHINE_LPT_PRI | MACHINE_UART_PRI | MACHINE_UART_SEC) -#define MACHINE_SUPER_IO_GAME (MACHINE_SUPER_IO | MACHINE_GAMEPORT) -#define MACHINE_SUPER_IO_DUAL (MACHINE_SUPER_IO | MACHINE_LPT_SEC | MACHINE_UART_TER | MACHINE_UART_QUA) -#define MACHINE_AV (MACHINE_VIDEO | MACHINE_SOUND) /* sys has video and sound */ -#define MACHINE_AG (MACHINE_SOUND | MACHINE_GAMEPORT) /* sys has sound and game port */ +#define MACHINE_APM 0x00020000 /* sys has APM */ +#define MACHINE_ACPI 0x00040000 /* sys has ACPI */ +#define MACHINE_HWM 0x00080000 /* sys has hw monitor */ +#define MACHINE_COREBOOT 0x00100000 /* sys has coreboot BIOS */ /* Feature flags for internal storage controllers. */ -#define MACHINE_HDC 0x03FE0000 /* sys has int HDC */ -#define MACHINE_MFM 0x00020000 /* sys has int MFM/RLL */ -#define MACHINE_XTA 0x00040000 /* sys has int XTA */ -#define MACHINE_ESDI 0x00080000 /* sys has int ESDI */ -#define MACHINE_IDE_PRI 0x00100000 /* sys has int pri IDE/ATAPI */ -#define MACHINE_IDE_SEC 0x00200000 /* sys has int sec IDE/ATAPI */ -#define MACHINE_IDE_TER 0x00400000 /* sys has int ter IDE/ATAPI */ -#define MACHINE_IDE_QUA 0x00800000 /* sys has int qua IDE/ATAPI */ -#define MACHINE_SCSI_PRI 0x01000000 /* sys has int pri SCSI */ -#define MACHINE_SCSI_SEC 0x02000000 /* sys has int sec SCSI */ -#define MACHINE_USB_PRI 0x04000000 /* sys has int pri USB */ -#define MACHINE_USB_SEC 0x08000000 /* sys has int sec USB */ -#define MACHINE_COREBOOT 0x10000000 /* sys has coreboot BIOS */ -#define MACHINE_SOFTFLOAT_ONLY 0x20000000 /* sys requires softfloat FPU */ +#define MACHINE_MFM 0x00200000 /* sys has int MFM/RLL */ +#define MACHINE_XTA 0x00400000 /* sys has int XTA */ +#define MACHINE_ESDI 0x00800000 /* sys has int ESDI */ +#define MACHINE_IDE_PRI 0x01000000 /* sys has int pri IDE/ATAPI */ +#define MACHINE_IDE_SEC 0x02000000 /* sys has int sec IDE/ATAPI */ +#define MACHINE_IDE_TER 0x04000000 /* sys has int ter IDE/ATAPI */ +#define MACHINE_IDE_QUA 0x08000000 /* sys has int qua IDE/ATAPI */ +#define MACHINE_SCSI_PRI 0x10000000 /* sys has int pri SCSI */ +#define MACHINE_SCSI_SEC 0x20000000 /* sys has int sec SCSI */ +#define MACHINE_USB_PRI 0x40000000 /* sys has int pri USB */ +#define MACHINE_USB_SEC 0x80000000 /* sys has int sec USB */ /* Combined flags. */ -#define MACHINE_IDE (MACHINE_IDE_PRI) /* sys has int single IDE/ATAPI - mark as pri IDE/ATAPI */ -#define MACHINE_IDE_DUAL (MACHINE_IDE_PRI | MACHINE_IDE_SEC) /* sys has int dual IDE/ATAPI - mark as both pri and sec IDE/ATAPI */ -#define MACHINE_IDE_DUALTQ (MACHINE_IDE_TER | MACHINE_IDE_QUA) -#define MACHINE_IDE_QUAD (MACHINE_IDE_DUAL | MACHINE_IDE_DUALTQ) /* sys has int quad IDE/ATAPI - mark as dual + both ter and and qua IDE/ATAPI */ -#define MACHINE_SCSI (MACHINE_SCSI_PRI) /* sys has int single SCSI - mark as pri SCSI */ -#define MACHINE_SCSI_DUAL (MACHINE_SCSI_PRI | MACHINE_SCSI_SEC) /* sys has int dual SCSI - mark as both pri and sec SCSI */ -#define MACHINE_USB (MACHINE_USB_PRI) -#define MACHINE_USB_DUAL (MACHINE_USB_PRI | MACHINE_USB_SEC) +#define MACHINE_LPT (MACHINE_LPT-PRI | MACHINE_LPT_SEC | \ + MACHINE_LPT_TER | MACHINE_LPT_QUA) +#define MACHINE_UART (MACHINE_UART_PRI | MACHINE_UART_SEC | \ + MACHINE_UART_TER | MACHINE_UART_QUA) +#define MACHINE_VIDEO_FIXED (MACHINE_VIDEO | MACHINE_VIDEO_ONLY) /* sys has fixed int video */ +#define MACHINE_SUPER_IO (MACHINE_FDC | MACHINE_LPT_PRI | MACHINE_UART_PRI | MACHINE_UART_SEC) +#define MACHINE_SUPER_IO_GAME (MACHINE_SUPER_IO | MACHINE_GAMEPORT) +#define MACHINE_SUPER_IO_DUAL (MACHINE_SUPER_IO | MACHINE_LPT_SEC | \ + MACHINE_UART_TER | MACHINE_UART_QUA) +#define MACHINE_AV (MACHINE_VIDEO | MACHINE_SOUND) /* sys has video and sound */ +#define MACHINE_AG (MACHINE_SOUND | MACHINE_GAMEPORT) /* sys has sound and game port */ +/* Combined flag for internal storage controllerss. */ +#define MACHINE_IDE (MACHINE_IDE_PRI) /* sys has int single IDE/ATAPI - mark as pri IDE/ATAPI */ +#define MACHINE_IDE_DUAL (MACHINE_IDE_PRI | MACHINE_IDE_SEC) /* sys has int dual IDE/ATAPI - mark as both pri and sec IDE/ATAPI */ +#define MACHINE_IDE_DUALTQ (MACHINE_IDE_TER | MACHINE_IDE_QUA) +#define MACHINE_IDE_QUAD (MACHINE_IDE_DUAL | MACHINE_IDE_DUALTQ) /* sys has int quad IDE/ATAPI - mark as dual + both ter and and qua IDE/ATAPI */ +#define MACHINE_SCSI (MACHINE_SCSI_PRI) /* sys has int single SCSI - mark as pri SCSI */ +#define MACHINE_SCSI_DUAL (MACHINE_SCSI_PRI | MACHINE_SCSI_SEC) /* sys has int dual SCSI - mark as both pri and sec SCSI */ +#define MACHINE_USB (MACHINE_USB_PRI) +#define MACHINE_USB_DUAL (MACHINE_USB_PRI | MACHINE_USB_SEC) +#define MACHINE_HDC (MACHINE_MFM | MACHINE_XTA | \ + MACHINE_ESDI | MACHINE_IDE_QUAD | \ + MACHINE_SCSI_DUAL | MACHINE_USB_DUAL) /* Special combined flags. */ -#define MACHINE_PIIX (MACHINE_IDE_DUAL) -#define MACHINE_PIIX3 (MACHINE_PIIX | MACHINE_USB) -/* TODO: ACPI flag. */ -#define MACHINE_PIIX4 (MACHINE_PIIX3 | MACHINE_ACPI) +#define MACHINE_PIIX (MACHINE_IDE_DUAL) +#define MACHINE_PIIX3 (MACHINE_PIIX | MACHINE_USB) +#define MACHINE_PIIX4 (MACHINE_PIIX3 | MACHINE_ACPI) #define IS_ARCH(m, a) ((machines[m].bus_flags & (a)) ? 1 : 0) #define IS_AT(m) (((machines[m].bus_flags & (MACHINE_BUS_ISA16 | MACHINE_BUS_EISA | MACHINE_BUS_VLB | MACHINE_BUS_MCA | MACHINE_BUS_PCI | MACHINE_BUS_PCMCIA | MACHINE_BUS_AGP | MACHINE_BUS_AC97)) && !(machines[m].bus_flags & MACHINE_PC98)) ? 1 : 0)