2020-12-04 21:45:14 +05:00
|
|
|
/*
|
2017-07-26 00:34:43 +02:00
|
|
|
* 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
|
|
|
|
|
* system designs based on the PCI bus.
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the 86Box distribution.
|
|
|
|
|
*
|
|
|
|
|
* Configuration file handler.
|
|
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2017-07-26 00:34:43 +02:00
|
|
|
*
|
|
|
|
|
* Authors: Sarah Walker,
|
|
|
|
|
* Miran Grca, <mgrca8@gmail.com>
|
|
|
|
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
|
|
|
|
* Overdoze,
|
2018-08-04 01:36:49 +02:00
|
|
|
* David Hrdlička, <hrdlickadavid@outlook.com>
|
2017-10-08 19:14:46 -04:00
|
|
|
*
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
* Copyright 2008-2019 Sarah Walker.
|
|
|
|
|
* Copyright 2016-2019 Miran Grca.
|
|
|
|
|
* Copyright 2017-2019 Fred N. van Kempen.
|
|
|
|
|
* Copyright 2018,2019 David Hrdlička.
|
2017-05-31 01:22:52 -04:00
|
|
|
*
|
2017-09-23 21:12:26 -04:00
|
|
|
* NOTE: Forcing config files to be in Unicode encoding breaks
|
|
|
|
|
* it on Windows XP, and possibly also Vista. Use the
|
|
|
|
|
* -DANSI_CFG for use on these systems.
|
2017-05-31 01:22:52 -04:00
|
|
|
*/
|
2018-05-21 19:04:05 +02:00
|
|
|
#include <inttypes.h>
|
|
|
|
|
#include <stdarg.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
#include <stdio.h>
|
2017-05-08 04:54:17 +02:00
|
|
|
#include <stdint.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <wchar.h>
|
2018-05-21 19:04:05 +02:00
|
|
|
#define HAVE_STDARG_H
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
2020-02-29 19:12:23 +01:00
|
|
|
#include "cpu.h"
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/device.h>
|
|
|
|
|
#include <86box/timer.h>
|
|
|
|
|
#include <86box/nvr.h>
|
|
|
|
|
#include <86box/config.h>
|
|
|
|
|
#include <86box/isamem.h>
|
|
|
|
|
#include <86box/isartc.h>
|
|
|
|
|
#include <86box/lpt.h>
|
|
|
|
|
#include <86box/hdd.h>
|
|
|
|
|
#include <86box/hdc.h>
|
|
|
|
|
#include <86box/hdc_ide.h>
|
|
|
|
|
#include <86box/fdd.h>
|
|
|
|
|
#include <86box/fdc.h>
|
2020-06-16 16:41:35 +02:00
|
|
|
#include <86box/fdc_ext.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/gameport.h>
|
|
|
|
|
#include <86box/machine.h>
|
|
|
|
|
#include <86box/mouse.h>
|
|
|
|
|
#include <86box/network.h>
|
|
|
|
|
#include <86box/scsi.h>
|
|
|
|
|
#include <86box/scsi_device.h>
|
|
|
|
|
#include <86box/cdrom.h>
|
|
|
|
|
#include <86box/zip.h>
|
2020-04-01 19:04:53 +02:00
|
|
|
#include <86box/mo.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/sound.h>
|
|
|
|
|
#include <86box/midi.h>
|
|
|
|
|
#include <86box/snd_mpu401.h>
|
|
|
|
|
#include <86box/video.h>
|
|
|
|
|
#include <86box/plat.h>
|
|
|
|
|
#include <86box/plat_midi.h>
|
|
|
|
|
#include <86box/ui.h>
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-05-11 03:25:23 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
typedef struct _list_ {
|
|
|
|
|
struct _list_ *next;
|
2016-06-26 00:34:39 +02:00
|
|
|
} list_t;
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
typedef struct {
|
2017-10-13 18:26:25 -04:00
|
|
|
list_t list;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
char name[128];
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
list_t entry_head;
|
2016-06-26 00:34:39 +02:00
|
|
|
} section_t;
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
typedef struct {
|
2017-10-13 18:26:25 -04:00
|
|
|
list_t list;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
char name[128];
|
2020-01-14 22:24:56 +01:00
|
|
|
char data[512];
|
2017-10-13 18:26:25 -04:00
|
|
|
wchar_t wdata[512];
|
2016-06-26 00:34:39 +02:00
|
|
|
} entry_t;
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
#define list_add(new, head) { \
|
|
|
|
|
list_t *next = head; \
|
|
|
|
|
\
|
|
|
|
|
while (next->next != NULL) \
|
|
|
|
|
next = next->next; \
|
|
|
|
|
\
|
|
|
|
|
(next)->next = new; \
|
|
|
|
|
(new)->next = NULL; \
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
#define list_delete(old, head) { \
|
|
|
|
|
list_t *next = head; \
|
|
|
|
|
\
|
|
|
|
|
while ((next)->next != old) { \
|
|
|
|
|
next = (next)->next; \
|
|
|
|
|
} \
|
|
|
|
|
\
|
|
|
|
|
(next)->next = (old)->next; \
|
2020-05-06 00:23:53 +02:00
|
|
|
if ((next) == (head)) \
|
|
|
|
|
(head)->next = (old)->next; \
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static list_t config_head;
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2020-07-19 06:07:58 +02:00
|
|
|
/* TODO: Backwards compatibility, get rid of this when enough time has passed. */
|
|
|
|
|
static int backwards_compat = 0;
|
2020-11-26 18:20:24 +01:00
|
|
|
static int backwards_compat2 = 0;
|
2020-07-19 06:07:58 +02:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2018-05-21 19:04:05 +02:00
|
|
|
#ifdef ENABLE_CONFIG_LOG
|
|
|
|
|
int config_do_log = ENABLE_CONFIG_LOG;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-17 05:29:48 +02:00
|
|
|
config_log(const char *fmt, ...)
|
2018-05-21 19:04:05 +02:00
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
if (config_do_log) {
|
2018-10-17 05:29:48 +02:00
|
|
|
va_start(ap, fmt);
|
|
|
|
|
pclog_ex(fmt, ap);
|
2018-05-21 19:04:05 +02:00
|
|
|
va_end(ap);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-10-17 05:29:48 +02:00
|
|
|
#else
|
|
|
|
|
#define config_log(fmt, ...)
|
|
|
|
|
#endif
|
2018-05-21 19:04:05 +02:00
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
static section_t *
|
|
|
|
|
find_section(char *name)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *sec;
|
|
|
|
|
char blank[] = "";
|
|
|
|
|
|
|
|
|
|
sec = (section_t *)config_head.next;
|
|
|
|
|
if (name == NULL)
|
|
|
|
|
name = blank;
|
|
|
|
|
|
|
|
|
|
while (sec != NULL) {
|
2017-10-13 18:26:25 -04:00
|
|
|
if (! strncmp(sec->name, name, sizeof(sec->name)))
|
2017-10-07 00:46:54 -04:00
|
|
|
return(sec);
|
|
|
|
|
|
|
|
|
|
sec = (section_t *)sec->list.next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(NULL);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static entry_t *
|
|
|
|
|
find_entry(section_t *section, char *name)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
entry_t *ent;
|
|
|
|
|
|
|
|
|
|
ent = (entry_t *)section->entry_head.next;
|
|
|
|
|
|
|
|
|
|
while (ent != NULL) {
|
2017-10-13 18:26:25 -04:00
|
|
|
if (! strncmp(ent->name, name, sizeof(ent->name)))
|
2017-10-07 00:46:54 -04:00
|
|
|
return(ent);
|
|
|
|
|
|
|
|
|
|
ent = (entry_t *)ent->list.next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(NULL);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
entries_num(section_t *section)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
entry_t *ent;
|
|
|
|
|
int i = 0;
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
ent = (entry_t *)section->entry_head.next;
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
while (ent != NULL) {
|
|
|
|
|
if (strlen(ent->name) > 0) i++;
|
|
|
|
|
|
|
|
|
|
ent = (entry_t *)ent->list.next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return(i);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
static void
|
|
|
|
|
delete_section_if_empty(char *head)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL) return;
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (entries_num(section) == 0) {
|
|
|
|
|
list_delete(§ion->list, &config_head);
|
|
|
|
|
free(section);
|
|
|
|
|
}
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static section_t *
|
|
|
|
|
create_section(char *name)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *ns = malloc(sizeof(section_t));
|
|
|
|
|
|
|
|
|
|
memset(ns, 0x00, sizeof(section_t));
|
2019-02-06 03:34:39 +01:00
|
|
|
memcpy(ns->name, name, strlen(name) + 1);
|
2017-10-07 00:46:54 -04:00
|
|
|
list_add(&ns->list, &config_head);
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
return(ns);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static entry_t *
|
|
|
|
|
create_entry(section_t *section, char *name)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
entry_t *ne = malloc(sizeof(entry_t));
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
memset(ne, 0x00, sizeof(entry_t));
|
2019-02-06 03:34:39 +01:00
|
|
|
memcpy(ne->name, name, strlen(name) + 1);
|
2017-10-07 00:46:54 -04:00
|
|
|
list_add(&ne->list, §ion->entry_head);
|
|
|
|
|
|
|
|
|
|
return(ne);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
static void
|
|
|
|
|
config_free(void)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *sec, *ns;
|
|
|
|
|
entry_t *ent;
|
|
|
|
|
|
|
|
|
|
sec = (section_t *)config_head.next;
|
|
|
|
|
while (sec != NULL) {
|
|
|
|
|
ns = (section_t *)sec->list.next;
|
|
|
|
|
ent = (entry_t *)sec->entry_head.next;
|
|
|
|
|
|
|
|
|
|
while (ent != NULL) {
|
|
|
|
|
entry_t *nent = (entry_t *)ent->list.next;
|
|
|
|
|
|
|
|
|
|
free(ent);
|
|
|
|
|
ent = nent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(sec);
|
|
|
|
|
sec = ns;
|
|
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
2017-06-16 06:44:11 +02:00
|
|
|
#endif
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Read and parse the configuration file into memory. */
|
|
|
|
|
static int
|
|
|
|
|
config_read(wchar_t *fn)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-13 18:26:25 -04:00
|
|
|
char sname[128], ename[128];
|
2017-10-07 00:46:54 -04:00
|
|
|
wchar_t buff[1024];
|
|
|
|
|
section_t *sec, *ns;
|
|
|
|
|
entry_t *ne;
|
2017-10-13 18:26:25 -04:00
|
|
|
int c, d;
|
2017-10-07 00:46:54 -04:00
|
|
|
FILE *f;
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-29 04:20:20 -05:00
|
|
|
#if defined(ANSI_CFG) || !defined(_WIN32)
|
2017-10-12 14:25:17 -04:00
|
|
|
f = plat_fopen(fn, L"rt");
|
2017-05-31 01:22:52 -04:00
|
|
|
#else
|
2017-10-12 14:25:17 -04:00
|
|
|
f = plat_fopen(fn, L"rt, ccs=UNICODE");
|
2017-05-31 01:22:52 -04:00
|
|
|
#endif
|
2017-10-07 00:46:54 -04:00
|
|
|
if (f == NULL) return(0);
|
|
|
|
|
|
|
|
|
|
sec = malloc(sizeof(section_t));
|
|
|
|
|
memset(sec, 0x00, sizeof(section_t));
|
|
|
|
|
memset(&config_head, 0x00, sizeof(list_t));
|
|
|
|
|
list_add(&sec->list, &config_head);
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
memset(buff, 0x00, sizeof(buff));
|
2017-10-13 18:26:25 -04:00
|
|
|
fgetws(buff, sizeof_w(buff), f);
|
2017-10-07 00:46:54 -04:00
|
|
|
if (feof(f)) break;
|
|
|
|
|
|
2017-10-13 02:44:32 -04:00
|
|
|
/* Make sure there are no stray newlines or hard-returns in there. */
|
2020-04-10 01:08:52 +02:00
|
|
|
if (wcslen(buff) > 0)
|
|
|
|
|
if (buff[wcslen(buff)-1] == L'\n') buff[wcslen(buff)-1] = L'\0';
|
|
|
|
|
if (wcslen(buff) > 0)
|
|
|
|
|
if (buff[wcslen(buff)-1] == L'\r') buff[wcslen(buff)-1] = L'\0';
|
2017-10-13 02:44:32 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Skip any leading whitespace. */
|
2017-10-07 00:46:54 -04:00
|
|
|
c = 0;
|
2017-10-13 18:26:25 -04:00
|
|
|
while ((buff[c] == L' ') || (buff[c] == L'\t'))
|
2017-10-07 00:46:54 -04:00
|
|
|
c++;
|
|
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Skip empty lines. */
|
2017-10-07 00:46:54 -04:00
|
|
|
if (buff[c] == L'\0') continue;
|
|
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Skip lines that (only) have a comment. */
|
|
|
|
|
if ((buff[c] == L'#') || (buff[c] == L';')) continue;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
if (buff[c] == L'[') { /*Section*/
|
|
|
|
|
c++;
|
2017-10-13 18:26:25 -04:00
|
|
|
d = 0;
|
2017-10-07 00:46:54 -04:00
|
|
|
while (buff[c] != L']' && buff[c])
|
2017-10-13 18:26:25 -04:00
|
|
|
wctomb(&(sname[d++]), buff[c++]);
|
|
|
|
|
sname[d] = L'\0';
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Is the section name properly terminated? */
|
2017-10-07 00:46:54 -04:00
|
|
|
if (buff[c] != L']') continue;
|
|
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Create a new section and insert it. */
|
2017-10-07 00:46:54 -04:00
|
|
|
ns = malloc(sizeof(section_t));
|
|
|
|
|
memset(ns, 0x00, sizeof(section_t));
|
2020-02-29 19:12:23 +01:00
|
|
|
memcpy(ns->name, sname, 128);
|
2017-10-07 00:46:54 -04:00
|
|
|
list_add(&ns->list, &config_head);
|
2017-10-13 18:26:25 -04:00
|
|
|
|
|
|
|
|
/* New section is now the current one. */
|
2017-10-07 00:46:54 -04:00
|
|
|
sec = ns;
|
2017-10-13 18:26:25 -04:00
|
|
|
continue;
|
|
|
|
|
}
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Get the variable name. */
|
|
|
|
|
d = 0;
|
|
|
|
|
while ((buff[c] != L'=') && (buff[c] != L' ') && buff[c])
|
|
|
|
|
wctomb(&(ename[d++]), buff[c++]);
|
|
|
|
|
ename[d] = L'\0';
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Skip incomplete lines. */
|
|
|
|
|
if (buff[c] == L'\0') continue;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Look for =, skip whitespace. */
|
|
|
|
|
while ((buff[c] == L'=' || buff[c] == L' ') && buff[c])
|
|
|
|
|
c++;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Skip incomplete lines. */
|
|
|
|
|
if (buff[c] == L'\0') continue;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* This is where the value part starts. */
|
|
|
|
|
d = c;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Allocate a new variable entry.. */
|
|
|
|
|
ne = malloc(sizeof(entry_t));
|
|
|
|
|
memset(ne, 0x00, sizeof(entry_t));
|
2020-02-29 19:12:23 +01:00
|
|
|
memcpy(ne->name, ename, 128);
|
2017-10-13 18:26:25 -04:00
|
|
|
wcsncpy(ne->wdata, &buff[d], sizeof_w(ne->wdata)-1);
|
|
|
|
|
ne->wdata[sizeof_w(ne->wdata)-1] = L'\0';
|
|
|
|
|
wcstombs(ne->data, ne->wdata, sizeof(ne->data));
|
|
|
|
|
ne->data[sizeof(ne->data)-1] = '\0';
|
|
|
|
|
|
|
|
|
|
/* .. and insert it. */
|
|
|
|
|
list_add(&ne->list, &sec->entry_head);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(void)fclose(f);
|
2017-10-21 20:29:11 -04:00
|
|
|
|
|
|
|
|
if (do_dump_config)
|
|
|
|
|
config_dump();
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
return(1);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/*
|
|
|
|
|
* Write the in-memory configuration to disk.
|
|
|
|
|
* This is a public function, because the Settings UI
|
|
|
|
|
* want to directly write the configuration after it
|
|
|
|
|
* has changed it.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
config_write(wchar_t *fn)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-13 18:26:25 -04:00
|
|
|
wchar_t wtemp[512];
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *sec;
|
|
|
|
|
FILE *f;
|
|
|
|
|
int fl = 0;
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-29 04:20:20 -05:00
|
|
|
#if defined(ANSI_CFG) || !defined(_WIN32)
|
2017-10-12 14:25:17 -04:00
|
|
|
f = plat_fopen(fn, L"wt");
|
2017-05-31 01:22:52 -04:00
|
|
|
#else
|
2017-10-12 14:25:17 -04:00
|
|
|
f = plat_fopen(fn, L"wt, ccs=UNICODE");
|
2017-05-31 01:22:52 -04:00
|
|
|
#endif
|
2017-10-07 00:46:54 -04:00
|
|
|
if (f == NULL) return;
|
|
|
|
|
|
|
|
|
|
sec = (section_t *)config_head.next;
|
|
|
|
|
while (sec != NULL) {
|
|
|
|
|
entry_t *ent;
|
|
|
|
|
|
|
|
|
|
if (sec->name[0]) {
|
2017-10-13 18:26:25 -04:00
|
|
|
mbstowcs(wtemp, sec->name, strlen(sec->name)+1);
|
2017-10-07 00:46:54 -04:00
|
|
|
if (fl)
|
2017-10-13 18:26:25 -04:00
|
|
|
fwprintf(f, L"\n[%ls]\n", wtemp);
|
2017-10-07 00:46:54 -04:00
|
|
|
else
|
2017-10-13 18:26:25 -04:00
|
|
|
fwprintf(f, L"[%ls]\n", wtemp);
|
2017-10-07 00:46:54 -04:00
|
|
|
fl++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ent = (entry_t *)sec->entry_head.next;
|
|
|
|
|
while (ent != NULL) {
|
2017-10-13 18:26:25 -04:00
|
|
|
if (ent->name[0] != '\0') {
|
2020-01-15 04:58:28 +01:00
|
|
|
mbstowcs(wtemp, ent->name, 128);
|
2017-10-07 00:46:54 -04:00
|
|
|
if (ent->wdata[0] == L'\0')
|
2017-10-13 18:26:25 -04:00
|
|
|
fwprintf(f, L"%ls = \n", wtemp);
|
2017-09-23 21:12:26 -04:00
|
|
|
else
|
2017-10-13 18:26:25 -04:00
|
|
|
fwprintf(f, L"%ls = %ls\n", wtemp, ent->wdata);
|
2017-09-23 21:12:26 -04:00
|
|
|
fl++;
|
2017-05-27 03:53:32 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
ent = (entry_t *)ent->list.next;
|
|
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sec = (section_t *)sec->list.next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(void)fclose(f);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
#if NOT_USED
|
|
|
|
|
static void
|
|
|
|
|
config_new(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-29 04:20:20 -05:00
|
|
|
#if defined(ANSI_CFG) || !defined(_WIN32)
|
2017-10-07 00:46:54 -04:00
|
|
|
FILE *f = _wfopen(config_file, L"wt");
|
2017-09-23 21:12:26 -04:00
|
|
|
#else
|
2017-10-07 00:46:54 -04:00
|
|
|
FILE *f = _wfopen(config_file, L"wt, ccs=UNICODE");
|
2017-09-23 21:12:26 -04:00
|
|
|
#endif
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
if (file != NULL)
|
|
|
|
|
(void)fclose(f);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
2017-09-23 21:12:26 -04:00
|
|
|
#endif
|
2017-05-18 01:57:16 -04:00
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Load "General" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_general(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "General";
|
|
|
|
|
char temp[512];
|
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
|
|
vid_resize = !!config_get_int(cat, "vid_resize", 0);
|
|
|
|
|
|
|
|
|
|
memset(temp, '\0', sizeof(temp));
|
2017-10-19 04:27:04 -04:00
|
|
|
p = config_get_string(cat, "vid_renderer", "default");
|
|
|
|
|
vid_api = plat_vidapi(p);
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, "vid_api");
|
|
|
|
|
|
|
|
|
|
video_fullscreen_scale = config_get_int(cat, "video_fullscreen_scale", 0);
|
|
|
|
|
|
2020-06-18 21:46:28 -03:00
|
|
|
video_fullscreen_first = config_get_int(cat, "video_fullscreen_first", 1);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
force_43 = !!config_get_int(cat, "force_43", 0);
|
|
|
|
|
scale = config_get_int(cat, "scale", 1);
|
|
|
|
|
if (scale > 3)
|
2020-09-02 10:56:49 +08:00
|
|
|
scale = 3;
|
|
|
|
|
dpi_scale = config_get_int(cat, "dpi_scale", 1);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
enable_overscan = !!config_get_int(cat, "enable_overscan", 0);
|
|
|
|
|
vid_cga_contrast = !!config_get_int(cat, "vid_cga_contrast", 0);
|
|
|
|
|
video_grayscale = config_get_int(cat, "video_grayscale", 0);
|
|
|
|
|
video_graytype = config_get_int(cat, "video_graytype", 0);
|
|
|
|
|
|
2018-02-10 00:01:52 +01:00
|
|
|
rctrl_is_lalt = config_get_int(cat, "rctrl_is_lalt", 0);
|
2018-02-11 20:51:42 +01:00
|
|
|
update_icons = config_get_int(cat, "update_icons", 1);
|
2018-02-10 00:01:52 +01:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
window_remember = config_get_int(cat, "window_remember", 0);
|
|
|
|
|
if (window_remember) {
|
|
|
|
|
p = config_get_string(cat, "window_coordinates", NULL);
|
|
|
|
|
if (p == NULL)
|
|
|
|
|
p = "0, 0, 0, 0";
|
|
|
|
|
sscanf(p, "%i, %i, %i, %i", &window_w, &window_h, &window_x, &window_y);
|
|
|
|
|
} else {
|
|
|
|
|
config_delete_var(cat, "window_remember");
|
|
|
|
|
config_delete_var(cat, "window_coordinates");
|
|
|
|
|
|
|
|
|
|
window_w = window_h = window_x = window_y = 0;
|
|
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2018-02-11 20:51:42 +01:00
|
|
|
sound_gain = config_get_int(cat, "sound_gain", 0);
|
2017-12-10 15:16:24 +01:00
|
|
|
|
2020-07-27 19:55:25 -03:00
|
|
|
confirm_reset = config_get_int(cat, "confirm_reset", 1);
|
|
|
|
|
confirm_exit = config_get_int(cat, "confirm_exit", 1);
|
2020-11-21 19:17:06 +01:00
|
|
|
confirm_save = config_get_int(cat, "confirm_save", 1);
|
2020-07-27 19:55:25 -03:00
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
#ifdef USE_LANGUAGE
|
2017-10-07 00:46:54 -04:00
|
|
|
/*
|
|
|
|
|
* Currently, 86Box is English (US) only, but in the future
|
2018-01-26 22:17:09 +01:00
|
|
|
* (version 3.0 at the earliest) other languages will be
|
2017-10-07 00:46:54 -04:00
|
|
|
* added, therefore it is better to future-proof the code.
|
|
|
|
|
*/
|
2017-10-13 18:26:25 -04:00
|
|
|
plat_langid = config_get_hex16(cat, "language", 0x0409);
|
2017-09-23 21:12:26 -04:00
|
|
|
#endif
|
2019-12-04 21:55:35 +01:00
|
|
|
|
|
|
|
|
#if USE_DISCORD
|
|
|
|
|
enable_discord = !!config_get_int(cat, "enable_discord", 0);
|
|
|
|
|
#endif
|
2017-05-27 03:53:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Load "Machine" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_machine(void)
|
2017-05-27 03:53:32 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Machine";
|
|
|
|
|
char *p;
|
2020-11-18 19:56:22 -03:00
|
|
|
int c, i, speed, legacy_mfg, legacy_cpu;
|
2020-11-18 01:09:17 -03:00
|
|
|
double multi;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
p = config_get_string(cat, "machine", NULL);
|
2020-11-18 01:09:17 -03:00
|
|
|
if (p != NULL) {
|
2020-11-18 21:23:28 -03:00
|
|
|
if (! strcmp(p, "8500ttc")) /* fix typo */
|
2020-11-18 01:09:17 -03:00
|
|
|
machine = machine_get_machine_from_internal_name("8600ttc");
|
2020-11-18 21:23:28 -03:00
|
|
|
else if (! strcmp(p, "president")) /* migrate removed machine */
|
2020-11-18 14:52:09 -03:00
|
|
|
machine = machine_get_machine_from_internal_name("mb500n");
|
2020-11-18 21:23:28 -03:00
|
|
|
else if (! strcmp(p, "j656vxd")) /* migrate removed machine */
|
|
|
|
|
machine = machine_get_machine_from_internal_name("p55va");
|
2020-11-18 01:09:17 -03:00
|
|
|
else
|
|
|
|
|
machine = machine_get_machine_from_internal_name(p);
|
|
|
|
|
} else
|
2017-10-07 00:46:54 -04:00
|
|
|
machine = 0;
|
|
|
|
|
if (machine >= machine_count())
|
|
|
|
|
machine = machine_count() - 1;
|
|
|
|
|
|
|
|
|
|
/* This is for backwards compatibility. */
|
|
|
|
|
p = config_get_string(cat, "model", NULL);
|
|
|
|
|
if (p != NULL) {
|
2020-11-18 21:23:28 -03:00
|
|
|
if (! strcmp(p, "p55r2p4")) /* fix typo */
|
2017-10-07 00:46:54 -04:00
|
|
|
machine = machine_get_machine_from_internal_name("p55t2p4");
|
2020-11-18 01:09:17 -03:00
|
|
|
else
|
2017-09-23 21:12:26 -04:00
|
|
|
machine = machine_get_machine_from_internal_name(p);
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, "model");
|
|
|
|
|
}
|
|
|
|
|
if (machine >= machine_count())
|
|
|
|
|
machine = machine_count() - 1;
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2020-11-18 15:18:20 -03:00
|
|
|
cpu_f = NULL;
|
|
|
|
|
p = config_get_string(cat, "cpu_family", NULL);
|
|
|
|
|
if (p) {
|
2020-11-18 16:08:22 -03:00
|
|
|
cpu_f = cpu_get_family(p);
|
2020-07-25 12:48:20 -03:00
|
|
|
|
2020-11-18 16:08:22 -03:00
|
|
|
if (cpu_f && !cpu_family_is_eligible(cpu_f, machine)) /* only honor eligible families */
|
|
|
|
|
cpu_f = NULL;
|
2020-11-18 15:18:20 -03:00
|
|
|
} else {
|
2020-11-18 17:32:49 -03:00
|
|
|
/* Backwards compatibility with the previous CPU model system. */
|
2020-11-18 15:18:20 -03:00
|
|
|
legacy_mfg = config_get_int(cat, "cpu_manufacturer", 0);
|
|
|
|
|
legacy_cpu = config_get_int(cat, "cpu", 0);
|
2020-11-18 19:56:22 -03:00
|
|
|
|
|
|
|
|
/* Check if either legacy ID is present, and if they are within bounds. */
|
|
|
|
|
if (((legacy_mfg > 0) || (legacy_cpu > 0)) && (legacy_mfg >= 0) && (legacy_mfg < 4) && (legacy_cpu >= 0)) {
|
2020-11-18 15:18:20 -03:00
|
|
|
/* Look for a machine entry on the legacy table. */
|
|
|
|
|
p = machine_get_internal_name();
|
|
|
|
|
c = 0;
|
|
|
|
|
while (cpu_legacy_table[c].machine) {
|
|
|
|
|
if (!strcmp(p, cpu_legacy_table[c].machine))
|
2020-11-18 01:09:17 -03:00
|
|
|
break;
|
2020-11-18 15:18:20 -03:00
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
if (cpu_legacy_table[c].machine) {
|
2020-11-18 19:56:22 -03:00
|
|
|
/* Determine the amount of CPU entries on the table. */
|
2020-11-18 15:18:20 -03:00
|
|
|
i = -1;
|
2020-11-18 19:56:22 -03:00
|
|
|
while (cpu_legacy_table[c].tables[legacy_mfg][++i].family);
|
2020-11-18 15:18:20 -03:00
|
|
|
|
2020-11-18 19:56:22 -03:00
|
|
|
/* If the CPU ID is out of bounds, reset to the last known ID. */
|
|
|
|
|
if (legacy_cpu >= i)
|
|
|
|
|
legacy_cpu = i - 1;
|
|
|
|
|
|
|
|
|
|
const cpu_legacy_table_t *legacy_table_entry = &cpu_legacy_table[c].tables[legacy_mfg][legacy_cpu];
|
|
|
|
|
|
|
|
|
|
/* Check if the referenced family exists. */
|
|
|
|
|
cpu_f = cpu_get_family(legacy_table_entry->family);
|
|
|
|
|
if (cpu_f) {
|
|
|
|
|
/* Save the new values. */
|
|
|
|
|
config_set_string(cat, "cpu_family", (char *) legacy_table_entry->family);
|
|
|
|
|
config_set_int(cat, "cpu_speed", legacy_table_entry->rspeed);
|
|
|
|
|
config_set_double(cat, "cpu_multi", legacy_table_entry->multi);
|
|
|
|
|
}
|
2020-11-18 15:18:20 -03:00
|
|
|
}
|
2020-07-25 12:48:20 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-18 01:09:17 -03:00
|
|
|
if (cpu_f) {
|
|
|
|
|
speed = config_get_int(cat, "cpu_speed", 0);
|
|
|
|
|
multi = config_get_double(cat, "cpu_multi", 0);
|
2020-11-18 14:44:27 -03:00
|
|
|
|
|
|
|
|
/* Find the configured CPU. */
|
2020-11-18 15:18:20 -03:00
|
|
|
cpu = 0;
|
2020-11-18 17:32:49 -03:00
|
|
|
c = 0;
|
|
|
|
|
i = 256;
|
2020-11-18 19:56:22 -03:00
|
|
|
while (cpu_f->cpus[cpu].cpu_type) {
|
2020-11-18 15:18:20 -03:00
|
|
|
if (cpu_is_eligible(cpu_f, cpu, machine)) { /* skip ineligible CPUs */
|
2020-11-18 19:56:22 -03:00
|
|
|
if ((cpu_f->cpus[cpu].rspeed == speed) && (cpu_f->cpus[cpu].multi == multi)) /* exact speed/multiplier match */
|
2020-11-18 14:44:27 -03:00
|
|
|
break;
|
2020-11-18 19:56:22 -03:00
|
|
|
else if ((cpu_f->cpus[cpu].rspeed >= speed) && (i == 256)) /* closest speed match */
|
2020-11-18 17:32:49 -03:00
|
|
|
i = cpu;
|
|
|
|
|
c = cpu; /* store fastest eligible CPU */
|
2020-11-18 14:44:27 -03:00
|
|
|
}
|
2020-11-18 15:18:20 -03:00
|
|
|
cpu++;
|
2020-11-18 01:09:17 -03:00
|
|
|
}
|
2020-11-18 19:56:22 -03:00
|
|
|
if (!cpu_f->cpus[cpu].cpu_type) /* if no exact match was found, use closest matching faster CPU, or fastest eligible CPU */
|
2020-11-18 17:32:49 -03:00
|
|
|
cpu = MIN(i, c);
|
2020-11-18 14:44:27 -03:00
|
|
|
} else { /* default */
|
2020-11-18 16:08:22 -03:00
|
|
|
/* Find first eligible family. */
|
2020-11-18 01:09:17 -03:00
|
|
|
c = 0;
|
|
|
|
|
while (!cpu_family_is_eligible(&cpu_families[c], machine)) {
|
2020-11-18 15:18:20 -03:00
|
|
|
if (cpu_families[c++].package == 0) { /* end of list */
|
2020-11-18 01:09:17 -03:00
|
|
|
fatal("No eligible CPU families for the selected machine\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-18 19:56:22 -03:00
|
|
|
cpu_f = (cpu_family_t *) &cpu_families[c];
|
2020-07-25 12:48:20 -03:00
|
|
|
|
2020-11-18 14:44:27 -03:00
|
|
|
/* Find first eligible CPU in that family. */
|
2020-11-18 15:18:20 -03:00
|
|
|
cpu = 0;
|
|
|
|
|
while (!cpu_is_eligible(cpu_f, cpu, machine)) {
|
|
|
|
|
if (cpu_f->cpus[cpu++].cpu_type == 0) { /* end of list */
|
|
|
|
|
cpu = 0;
|
|
|
|
|
break;
|
2020-11-18 01:09:17 -03:00
|
|
|
}
|
2020-07-25 12:48:20 -03:00
|
|
|
}
|
|
|
|
|
}
|
2020-11-18 15:18:20 -03:00
|
|
|
cpu_s = (CPU *) &cpu_f->cpus[cpu];
|
2020-11-23 14:48:32 -03:00
|
|
|
cpu_override = config_get_int(cat, "cpu_override", 0);
|
2020-07-25 12:48:20 -03:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
cpu_waitstates = config_get_int(cat, "cpu_waitstates", 0);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2020-06-15 21:21:26 +02:00
|
|
|
p = (char *)config_get_string(cat, "fpu_type", "none");
|
2020-11-18 01:09:17 -03:00
|
|
|
fpu_type = fpu_get_type(cpu_f, cpu, p);
|
2020-06-15 21:21:26 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
mem_size = config_get_int(cat, "mem_size", 4096);
|
2018-09-03 14:28:50 +02:00
|
|
|
|
|
|
|
|
#if 0
|
2017-10-07 00:46:54 -04:00
|
|
|
if (mem_size < (((machines[machine].flags & MACHINE_AT) &&
|
|
|
|
|
(machines[machine].ram_granularity < 128)) ? machines[machine].min_ram*1024 : machines[machine].min_ram))
|
|
|
|
|
mem_size = (((machines[machine].flags & MACHINE_AT) && (machines[machine].ram_granularity < 128)) ? machines[machine].min_ram*1024 : machines[machine].min_ram);
|
2020-07-25 12:48:20 -03:00
|
|
|
#endif
|
2018-09-03 14:28:50 +02:00
|
|
|
|
2020-06-12 23:29:12 +02:00
|
|
|
if (mem_size > 2097152)
|
|
|
|
|
mem_size = 2097152;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
cpu_use_dynarec = !!config_get_int(cat, "cpu_use_dynarec", 0);
|
2017-10-03 16:26:55 -04:00
|
|
|
|
2018-08-01 18:07:52 +02:00
|
|
|
p = config_get_string(cat, "time_sync", NULL);
|
|
|
|
|
if (p != NULL) {
|
|
|
|
|
if (!strcmp(p, "disabled"))
|
|
|
|
|
time_sync = TIME_SYNC_DISABLED;
|
|
|
|
|
else
|
|
|
|
|
if (!strcmp(p, "local"))
|
|
|
|
|
time_sync = TIME_SYNC_ENABLED;
|
|
|
|
|
else
|
|
|
|
|
if (!strcmp(p, "utc") || !strcmp(p, "gmt"))
|
|
|
|
|
time_sync = TIME_SYNC_ENABLED | TIME_SYNC_UTC;
|
|
|
|
|
else
|
|
|
|
|
time_sync = TIME_SYNC_ENABLED;
|
|
|
|
|
} else
|
|
|
|
|
time_sync = !!config_get_int(cat, "enable_sync", 1);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
/* Remove this after a while.. */
|
|
|
|
|
config_delete_var(cat, "nvr_path");
|
2018-08-01 18:07:52 +02:00
|
|
|
config_delete_var(cat, "enable_sync");
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Load "Video" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_video(void)
|
2017-05-05 22:36:10 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Video";
|
|
|
|
|
char *p;
|
2020-01-15 03:04:59 +01:00
|
|
|
int free_p = 0;
|
2017-05-05 22:36:10 +02:00
|
|
|
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
if (machines[machine].flags & MACHINE_VIDEO_ONLY) {
|
2017-11-05 01:57:04 -05:00
|
|
|
config_delete_var(cat, "gfxcard");
|
2018-09-19 20:13:32 +02:00
|
|
|
gfxcard = VID_INTERNAL;
|
2017-11-05 01:57:04 -05:00
|
|
|
} else {
|
|
|
|
|
p = config_get_string(cat, "gfxcard", NULL);
|
|
|
|
|
if (p == NULL) {
|
|
|
|
|
if (machines[machine].flags & MACHINE_VIDEO) {
|
|
|
|
|
p = (char *)malloc((strlen("internal")+1)*sizeof(char));
|
|
|
|
|
strcpy(p, "internal");
|
|
|
|
|
} else {
|
|
|
|
|
p = (char *)malloc((strlen("none")+1)*sizeof(char));
|
|
|
|
|
strcpy(p, "none");
|
|
|
|
|
}
|
2020-01-15 03:04:59 +01:00
|
|
|
free_p = 1;
|
2017-11-05 01:57:04 -05:00
|
|
|
}
|
2017-10-07 00:46:54 -04:00
|
|
|
gfxcard = video_get_video_from_internal_name(p);
|
2020-01-15 03:04:59 +01:00
|
|
|
if (free_p)
|
|
|
|
|
free(p);
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2017-05-05 22:36:10 +02:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
voodoo_enabled = !!config_get_int(cat, "voodoo", 0);
|
2017-05-05 22:36:10 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Load "Input Devices" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_input_devices(void)
|
2017-05-27 03:53:32 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Input devices";
|
|
|
|
|
char temp[512];
|
|
|
|
|
int c, d;
|
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
|
|
p = config_get_string(cat, "mouse_type", NULL);
|
|
|
|
|
if (p != NULL)
|
|
|
|
|
mouse_type = mouse_get_from_internal_name(p);
|
|
|
|
|
else
|
|
|
|
|
mouse_type = 0;
|
|
|
|
|
|
2020-12-04 21:45:14 +05:00
|
|
|
p = config_get_string(cat, "joystick_type", NULL);
|
|
|
|
|
if (p != NULL) {
|
|
|
|
|
joystick_type = joystick_get_from_internal_name(p);
|
|
|
|
|
if (joystick_type == JOYSTICK_TYPE_NONE) {
|
|
|
|
|
/* Try to read an integer for backwards compatibility with old configs */
|
|
|
|
|
c = config_get_int(cat, "joystick_type", JOYSTICK_TYPE_NONE);
|
|
|
|
|
if ((c >= 0) && (c <= 8))
|
|
|
|
|
joystick_type = c;
|
|
|
|
|
else
|
|
|
|
|
joystick_type = JOYSTICK_TYPE_NONE;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
joystick_type = JOYSTICK_TYPE_NONE;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
for (c=0; c<joystick_get_max_joysticks(joystick_type); c++) {
|
|
|
|
|
sprintf(temp, "joystick_%i_nr", c);
|
|
|
|
|
joystick_state[c].plat_joystick_nr = config_get_int(cat, temp, 0);
|
|
|
|
|
|
|
|
|
|
if (joystick_state[c].plat_joystick_nr) {
|
|
|
|
|
for (d=0; d<joystick_get_axis_count(joystick_type); d++) {
|
|
|
|
|
sprintf(temp, "joystick_%i_axis_%i", c, d);
|
|
|
|
|
joystick_state[c].axis_mapping[d] = config_get_int(cat, temp, d);
|
|
|
|
|
}
|
|
|
|
|
for (d=0; d<joystick_get_button_count(joystick_type); d++) {
|
|
|
|
|
sprintf(temp, "joystick_%i_button_%i", c, d);
|
|
|
|
|
joystick_state[c].button_mapping[d] = config_get_int(cat, temp, d);
|
|
|
|
|
}
|
|
|
|
|
for (d=0; d<joystick_get_pov_count(joystick_type); d++) {
|
|
|
|
|
sprintf(temp, "joystick_%i_pov_%i", c, d);
|
|
|
|
|
p = config_get_string(cat, temp, "0, 0");
|
|
|
|
|
joystick_state[c].pov_mapping[d][0] = joystick_state[c].pov_mapping[d][1] = 0;
|
|
|
|
|
sscanf(p, "%i, %i", &joystick_state[c].pov_mapping[d][0], &joystick_state[c].pov_mapping[d][1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Load "Sound" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_sound(void)
|
2017-05-27 03:53:32 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Sound";
|
|
|
|
|
char temp[512];
|
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
|
|
p = config_get_string(cat, "sndcard", NULL);
|
2020-11-16 00:01:21 +01:00
|
|
|
/* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */
|
|
|
|
|
if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci")))
|
|
|
|
|
p = "es1371";
|
2017-10-07 00:46:54 -04:00
|
|
|
if (p != NULL)
|
|
|
|
|
sound_card_current = sound_card_get_from_internal_name(p);
|
|
|
|
|
else
|
|
|
|
|
sound_card_current = 0;
|
|
|
|
|
|
|
|
|
|
p = config_get_string(cat, "midi_device", NULL);
|
|
|
|
|
if (p != NULL)
|
|
|
|
|
midi_device_current = midi_device_get_from_internal_name(p);
|
|
|
|
|
else
|
|
|
|
|
midi_device_current = 0;
|
|
|
|
|
|
2020-01-01 20:20:16 +01:00
|
|
|
p = config_get_string(cat, "midi_in_device", NULL);
|
|
|
|
|
if (p != NULL)
|
|
|
|
|
midi_input_device_current = midi_in_device_get_from_internal_name(p);
|
|
|
|
|
else
|
|
|
|
|
midi_input_device_current = 0;
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
mpu401_standalone_enable = !!config_get_int(cat, "mpu401_standalone", 0);
|
|
|
|
|
|
|
|
|
|
SSI2001 = !!config_get_int(cat, "ssi2001", 0);
|
|
|
|
|
GAMEBLASTER = !!config_get_int(cat, "gameblaster", 0);
|
|
|
|
|
GUS = !!config_get_int(cat, "gus", 0);
|
2019-02-06 03:34:39 +01:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
memset(temp, '\0', sizeof(temp));
|
|
|
|
|
p = config_get_string(cat, "sound_type", "float");
|
2020-01-15 05:24:33 +01:00
|
|
|
if (strlen(p) <= 511)
|
|
|
|
|
strcpy(temp, p);
|
|
|
|
|
else
|
|
|
|
|
strncpy(temp, p, 511);
|
2017-10-07 00:46:54 -04:00
|
|
|
if (!strcmp(temp, "float") || !strcmp(temp, "1"))
|
|
|
|
|
sound_is_float = 1;
|
|
|
|
|
else
|
|
|
|
|
sound_is_float = 0;
|
2017-05-27 03:53:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Load "Network" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_network(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Network";
|
|
|
|
|
char *p;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
p = config_get_string(cat, "net_type", NULL);
|
|
|
|
|
if (p != NULL) {
|
|
|
|
|
if (!strcmp(p, "pcap") || !strcmp(p, "1"))
|
2017-09-23 21:12:26 -04:00
|
|
|
network_type = NET_TYPE_PCAP;
|
|
|
|
|
else
|
2017-10-07 00:46:54 -04:00
|
|
|
if (!strcmp(p, "slirp") || !strcmp(p, "2"))
|
|
|
|
|
network_type = NET_TYPE_SLIRP;
|
2017-09-23 21:12:26 -04:00
|
|
|
else
|
2017-10-07 00:46:54 -04:00
|
|
|
network_type = NET_TYPE_NONE;
|
|
|
|
|
} else
|
|
|
|
|
network_type = NET_TYPE_NONE;
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
memset(network_host, '\0', sizeof(network_host));
|
|
|
|
|
p = config_get_string(cat, "net_host_device", NULL);
|
|
|
|
|
if (p == NULL) {
|
|
|
|
|
p = config_get_string(cat, "net_host_device", NULL);
|
|
|
|
|
if (p != NULL)
|
|
|
|
|
config_delete_var(cat, "net_host_device");
|
|
|
|
|
}
|
2017-10-07 00:46:54 -04:00
|
|
|
if (p != NULL) {
|
|
|
|
|
if ((network_dev_to_id(p) == -1) || (network_ndev == 1)) {
|
2018-03-19 01:02:04 +01:00
|
|
|
if ((network_ndev == 1) && strcmp(network_host, "none")) {
|
2020-06-18 21:20:10 -03:00
|
|
|
ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2094, (wchar_t *) IDS_2129);
|
2017-10-07 00:46:54 -04:00
|
|
|
} else if (network_dev_to_id(p) == -1) {
|
2020-06-18 21:20:10 -03:00
|
|
|
ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2095, (wchar_t *) IDS_2129);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
strcpy(network_host, "none");
|
2017-10-07 00:46:54 -04:00
|
|
|
} else {
|
2020-01-14 20:52:02 +01:00
|
|
|
if (strlen(p) <= 522)
|
|
|
|
|
strcpy(network_host, p);
|
|
|
|
|
else
|
|
|
|
|
strncpy(network_host, p, 522);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
} else
|
2018-03-19 01:02:04 +01:00
|
|
|
strcpy(network_host, "none");
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
p = config_get_string(cat, "net_card", NULL);
|
|
|
|
|
if (p != NULL)
|
|
|
|
|
network_card = network_card_get_from_internal_name(p);
|
|
|
|
|
else
|
|
|
|
|
network_card = 0;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Load "Ports" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_ports(void)
|
2017-05-17 21:56:31 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Ports (COM & LPT)";
|
|
|
|
|
char *p;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
char temp[512];
|
|
|
|
|
int c, d;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2020-07-08 04:24:25 +02:00
|
|
|
for (c = 0; c < 4; c++) {
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
sprintf(temp, "serial%d_enabled", c + 1);
|
2020-07-08 04:28:44 +02:00
|
|
|
serial_enabled[c] = !!config_get_int(cat, temp, (c >= 2) ? 0 : 1);
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
2017-10-07 00:46:54 -04:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
for (c = 0; c < 3; c++) {
|
|
|
|
|
sprintf(temp, "lpt%d_enabled", c + 1);
|
|
|
|
|
lpt_ports[c].enabled = !!config_get_int(cat, temp, (c == 0) ? 1 : 0);
|
2018-02-06 19:53:34 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
sprintf(temp, "lpt%d_device", c + 1);
|
|
|
|
|
p = (char *) config_get_string(cat, temp, "none");
|
|
|
|
|
lpt_ports[c].device = lpt_device_get_from_internal_name(p);
|
|
|
|
|
}
|
2018-02-06 19:53:34 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
/* Legacy config compatibility. */
|
|
|
|
|
d = config_get_int(cat, "lpt_enabled", 2);
|
|
|
|
|
if (d < 2) {
|
|
|
|
|
for (c = 0; c < 3; c++)
|
|
|
|
|
lpt_ports[c].enabled = d;
|
|
|
|
|
}
|
|
|
|
|
config_delete_var(cat, "lpt_enabled");
|
2017-05-17 21:56:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2020-11-26 18:20:24 +01:00
|
|
|
/* Load "Storage Controllers" section. */
|
2017-09-23 21:12:26 -04:00
|
|
|
static void
|
2020-11-26 18:20:24 +01:00
|
|
|
load_storage_controllers(void)
|
2017-05-27 03:53:32 +02:00
|
|
|
{
|
2020-11-26 18:20:24 +01:00
|
|
|
char *cat = "Storage controllers";
|
2018-04-25 23:51:13 +02:00
|
|
|
char *p;
|
2020-11-26 18:20:24 +01:00
|
|
|
int free_p = 0;
|
|
|
|
|
|
|
|
|
|
/* TODO: Backwards compatibility, get rid of this when enough time has passed. */
|
|
|
|
|
backwards_compat2 = (find_section(cat) == NULL);
|
2018-09-03 14:28:50 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
p = config_get_string(cat, "scsicard", NULL);
|
|
|
|
|
if (p != NULL)
|
|
|
|
|
scsi_card_current = scsi_card_get_from_internal_name(p);
|
|
|
|
|
else
|
|
|
|
|
scsi_card_current = 0;
|
|
|
|
|
|
2020-06-17 00:32:48 +02:00
|
|
|
p = config_get_string(cat, "fdc", NULL);
|
2020-06-17 14:29:24 +02:00
|
|
|
if (p != NULL)
|
|
|
|
|
fdc_type = fdc_card_get_from_internal_name(p);
|
|
|
|
|
else
|
2020-06-16 16:25:23 +02:00
|
|
|
fdc_type = FDC_INTERNAL;
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
p = config_get_string(cat, "hdc", NULL);
|
|
|
|
|
if (p == NULL) {
|
2017-11-05 01:57:04 -05:00
|
|
|
if (machines[machine].flags & MACHINE_HDC) {
|
2019-02-06 03:34:39 +01:00
|
|
|
p = (char *)malloc((strlen("internal")+1)*sizeof(char));
|
|
|
|
|
strcpy(p, "internal");
|
2017-10-19 23:55:51 +02:00
|
|
|
} else {
|
2019-02-06 03:34:39 +01:00
|
|
|
p = (char *)malloc((strlen("none")+1)*sizeof(char));
|
|
|
|
|
strcpy(p, "none");
|
2017-10-19 23:55:51 +02:00
|
|
|
}
|
2020-01-15 03:04:59 +01:00
|
|
|
free_p = 1;
|
2017-10-19 23:55:51 +02:00
|
|
|
}
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if (!strcmp(p, "mfm_xt"))
|
|
|
|
|
hdc_current = hdc_get_from_internal_name("st506_xt");
|
|
|
|
|
else if (!strcmp(p, "mfm_xt_dtc5150x"))
|
|
|
|
|
hdc_current = hdc_get_from_internal_name("st506_xt_dtc5150x");
|
|
|
|
|
else if (!strcmp(p, "mfm_at"))
|
|
|
|
|
hdc_current = hdc_get_from_internal_name("st506_at");
|
|
|
|
|
else
|
|
|
|
|
hdc_current = hdc_get_from_internal_name(p);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2020-01-15 03:04:59 +01:00
|
|
|
if (free_p) {
|
|
|
|
|
free(p);
|
|
|
|
|
p = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
ide_ter_enabled = !!config_get_int(cat, "ide_ter", 0);
|
|
|
|
|
ide_qua_enabled = !!config_get_int(cat, "ide_qua", 0);
|
2017-05-27 03:53:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Load "Hard Disks" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_hard_disks(void)
|
2017-09-30 16:56:38 -04:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Hard disks";
|
2017-10-13 18:26:25 -04:00
|
|
|
char temp[512], tmp2[512];
|
2017-10-07 00:46:54 -04:00
|
|
|
char s[512];
|
|
|
|
|
int c;
|
|
|
|
|
char *p;
|
|
|
|
|
wchar_t *wp;
|
2018-04-25 23:51:13 +02:00
|
|
|
uint32_t max_spt, max_hpc, max_tracks;
|
|
|
|
|
uint32_t board = 0, dev = 0;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
memset(temp, '\0', sizeof(temp));
|
|
|
|
|
for (c=0; c<HDD_NUM; c++) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(temp, "hdd_%02i_parameters", c+1);
|
|
|
|
|
p = config_get_string(cat, temp, "0, 0, 0, 0, none");
|
2018-04-25 23:51:13 +02:00
|
|
|
sscanf(p, "%u, %u, %u, %i, %s",
|
|
|
|
|
&hdd[c].spt, &hdd[c].hpc, &hdd[c].tracks, (int *)&hdd[c].wp, s);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
hdd[c].bus = hdd_string_to_bus(s, 0);
|
|
|
|
|
switch(hdd[c].bus) {
|
2017-09-30 16:56:38 -04:00
|
|
|
case HDD_BUS_DISABLED:
|
|
|
|
|
default:
|
2017-10-07 00:46:54 -04:00
|
|
|
max_spt = max_hpc = max_tracks = 0;
|
2017-09-30 16:56:38 -04:00
|
|
|
break;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-09-30 16:56:38 -04:00
|
|
|
case HDD_BUS_MFM:
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
max_spt = 26; /* 26 for RLL */
|
2017-10-07 00:46:54 -04:00
|
|
|
max_hpc = 15;
|
2020-06-19 12:10:04 +02:00
|
|
|
max_tracks = 2047;
|
2017-09-30 16:56:38 -04:00
|
|
|
break;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case HDD_BUS_XTA:
|
2017-10-07 00:46:54 -04:00
|
|
|
max_spt = 63;
|
|
|
|
|
max_hpc = 16;
|
|
|
|
|
max_tracks = 1023;
|
2017-09-30 16:56:38 -04:00
|
|
|
break;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2019-11-19 07:48:49 +01:00
|
|
|
case HDD_BUS_ESDI:
|
|
|
|
|
max_spt = 99;
|
|
|
|
|
max_hpc = 16;
|
|
|
|
|
max_tracks = 266305;
|
|
|
|
|
break;
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case HDD_BUS_IDE:
|
2017-10-07 00:46:54 -04:00
|
|
|
max_spt = 63;
|
|
|
|
|
max_hpc = 16;
|
|
|
|
|
max_tracks = 266305;
|
2017-09-30 16:56:38 -04:00
|
|
|
break;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-09-30 16:56:38 -04:00
|
|
|
case HDD_BUS_SCSI:
|
2017-10-07 00:46:54 -04:00
|
|
|
max_spt = 99;
|
|
|
|
|
max_hpc = 255;
|
|
|
|
|
max_tracks = 266305;
|
2017-09-30 16:56:38 -04:00
|
|
|
break;
|
|
|
|
|
}
|
2017-05-05 22:36:10 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (hdd[c].spt > max_spt)
|
|
|
|
|
hdd[c].spt = max_spt;
|
|
|
|
|
if (hdd[c].hpc > max_hpc)
|
|
|
|
|
hdd[c].hpc = max_hpc;
|
|
|
|
|
if (hdd[c].tracks > max_tracks)
|
|
|
|
|
hdd[c].tracks = max_tracks;
|
|
|
|
|
|
|
|
|
|
/* MFM/RLL */
|
|
|
|
|
sprintf(temp, "hdd_%02i_mfm_channel", c+1);
|
|
|
|
|
if (hdd[c].bus == HDD_BUS_MFM)
|
|
|
|
|
hdd[c].mfm_channel = !!config_get_int(cat, temp, c & 1);
|
|
|
|
|
else
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
/* XTA */
|
|
|
|
|
sprintf(temp, "hdd_%02i_xta_channel", c+1);
|
|
|
|
|
if (hdd[c].bus == HDD_BUS_XTA)
|
|
|
|
|
hdd[c].xta_channel = !!config_get_int(cat, temp, c & 1);
|
2017-10-07 00:46:54 -04:00
|
|
|
else
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
/* ESDI */
|
|
|
|
|
sprintf(temp, "hdd_%02i_esdi_channel", c+1);
|
|
|
|
|
if (hdd[c].bus == HDD_BUS_ESDI)
|
|
|
|
|
hdd[c].esdi_channel = !!config_get_int(cat, temp, c & 1);
|
|
|
|
|
else
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
/* IDE */
|
|
|
|
|
sprintf(temp, "hdd_%02i_ide_channel", c+1);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (hdd[c].bus == HDD_BUS_IDE) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "%01u:%01u", c>>1, c&1);
|
|
|
|
|
p = config_get_string(cat, temp, tmp2);
|
2018-04-25 23:51:13 +02:00
|
|
|
sscanf(p, "%01u:%01u", &board, &dev);
|
|
|
|
|
board &= 3;
|
|
|
|
|
dev &= 1;
|
|
|
|
|
hdd[c].ide_channel = (board<<1) + dev;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
if (hdd[c].ide_channel > 7)
|
|
|
|
|
hdd[c].ide_channel = 7;
|
|
|
|
|
} else {
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* SCSI */
|
2018-07-15 01:41:53 +02:00
|
|
|
sprintf(temp, "hdd_%02i_scsi_id", c+1);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (hdd[c].bus == HDD_BUS_SCSI) {
|
2018-07-15 01:41:53 +02:00
|
|
|
hdd[c].scsi_id = config_get_int(cat, temp, c);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
if (hdd[c].scsi_id > 15)
|
|
|
|
|
hdd[c].scsi_id = 15;
|
2018-07-15 01:41:53 +02:00
|
|
|
} else
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
2018-07-15 01:41:53 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
memset(hdd[c].fn, 0x00, sizeof(hdd[c].fn));
|
|
|
|
|
memset(hdd[c].prev_fn, 0x00, sizeof(hdd[c].prev_fn));
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(temp, "hdd_%02i_fn", c+1);
|
2017-10-07 00:46:54 -04:00
|
|
|
wp = config_get_wstring(cat, temp, L"");
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-09-30 16:56:38 -04:00
|
|
|
#if 0
|
2017-10-07 00:46:54 -04:00
|
|
|
/*
|
|
|
|
|
* NOTE:
|
|
|
|
|
* Temporary hack to remove the absolute
|
|
|
|
|
* path currently saved in most config
|
|
|
|
|
* files. We should remove this before
|
|
|
|
|
* finalizing this release! --FvK
|
|
|
|
|
*/
|
2020-11-17 23:31:38 -06:00
|
|
|
/*
|
|
|
|
|
* ANOTHER NOTE:
|
|
|
|
|
* When loading differencing VHDs, the absolute path is required.
|
|
|
|
|
* So we should not convert absolute paths to relative. -sards
|
|
|
|
|
*/
|
2017-12-04 11:59:26 -05:00
|
|
|
if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) {
|
2017-09-23 21:12:26 -04:00
|
|
|
/*
|
2017-10-07 00:46:54 -04:00
|
|
|
* Yep, its absolute and prefixed
|
|
|
|
|
* with the CFG path. Just strip
|
|
|
|
|
* that off for now...
|
2017-09-23 21:12:26 -04:00
|
|
|
*/
|
2017-12-04 11:59:26 -05:00
|
|
|
wcsncpy(hdd[c].fn, &wp[wcslen(usr_path)], sizeof_w(hdd[c].fn));
|
2017-10-07 00:46:54 -04:00
|
|
|
} else
|
2017-09-23 21:12:26 -04:00
|
|
|
#endif
|
2020-04-24 13:33:56 +08:00
|
|
|
if (plat_path_abs(wp)) {
|
|
|
|
|
wcsncpy(hdd[c].fn, wp, sizeof_w(hdd[c].fn));
|
|
|
|
|
} else {
|
|
|
|
|
wcsncpy(hdd[c].fn, usr_path, sizeof_w(hdd[c].fn));
|
|
|
|
|
wcsncat(hdd[c].fn, wp, sizeof_w(hdd[c].fn)-wcslen(usr_path));
|
|
|
|
|
}
|
2017-05-08 04:54:17 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* If disk is empty or invalid, mark it for deletion. */
|
|
|
|
|
if (! hdd_is_valid(c)) {
|
|
|
|
|
sprintf(temp, "hdd_%02i_parameters", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
2017-05-08 04:54:17 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "hdd_%02i_preide_channels", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
2017-05-08 04:54:17 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "hdd_%02i_ide_channels", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
sprintf(temp, "hdd_%02i_scsi_id", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "hdd_%02i_fn", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "hdd_%02i_mfm_channel", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "hdd_%02i_ide_channel", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
2017-05-17 21:56:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2020-07-19 06:07:58 +02:00
|
|
|
/* TODO: Backwards compatibility, get rid of this when enough time has passed. */
|
2018-01-26 22:17:09 +01:00
|
|
|
/* Load "Floppy Drives" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_floppy_drives(void)
|
|
|
|
|
{
|
|
|
|
|
char *cat = "Floppy drives";
|
|
|
|
|
char temp[512], *p;
|
|
|
|
|
wchar_t *wp;
|
|
|
|
|
int c;
|
|
|
|
|
|
2020-07-19 06:07:58 +02:00
|
|
|
if (!backwards_compat)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (c=0; c<FDD_NUM; c++) {
|
|
|
|
|
sprintf(temp, "fdd_%02i_type", c+1);
|
|
|
|
|
p = config_get_string(cat, temp, (c < 2) ? "525_2dd" : "none");
|
2020-11-18 01:09:17 -03:00
|
|
|
fdd_set_type(c, fdd_get_from_internal_name(p));
|
2020-07-19 06:07:58 +02:00
|
|
|
if (fdd_get_type(c) > 13)
|
|
|
|
|
fdd_set_type(c, 13);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "fdd_%02i_fn", c + 1);
|
|
|
|
|
wp = config_get_wstring(cat, temp, L"");
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
/*
|
|
|
|
|
* NOTE:
|
|
|
|
|
* Temporary hack to remove the absolute
|
|
|
|
|
* path currently saved in most config
|
|
|
|
|
* files. We should remove this before
|
|
|
|
|
* finalizing this release! --FvK
|
|
|
|
|
*/
|
|
|
|
|
if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) {
|
|
|
|
|
/*
|
|
|
|
|
* Yep, its absolute and prefixed
|
|
|
|
|
* with the EXE path. Just strip
|
|
|
|
|
* that off for now...
|
|
|
|
|
*/
|
|
|
|
|
wcsncpy(floppyfns[c], &wp[wcslen(usr_path)], sizeof_w(floppyfns[c]));
|
|
|
|
|
} else
|
|
|
|
|
#endif
|
|
|
|
|
wcsncpy(floppyfns[c], wp, sizeof_w(floppyfns[c]));
|
|
|
|
|
|
|
|
|
|
/* if (*wp != L'\0')
|
|
|
|
|
config_log("Floppy%d: %ls\n", c, floppyfns[c]); */
|
|
|
|
|
sprintf(temp, "fdd_%02i_writeprot", c+1);
|
|
|
|
|
ui_writeprot[c] = !!config_get_int(cat, temp, 0);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
sprintf(temp, "fdd_%02i_turbo", c + 1);
|
|
|
|
|
fdd_set_turbo(c, !!config_get_int(cat, temp, 0));
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
sprintf(temp, "fdd_%02i_check_bpb", c+1);
|
|
|
|
|
fdd_set_check_bpb(c, !!config_get_int(cat, temp, 1));
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delete_section_if_empty(cat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Load "Floppy and CD-ROM Drives" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_floppy_and_cdrom_drives(void)
|
|
|
|
|
{
|
|
|
|
|
char *cat = "Floppy and CD-ROM drives";
|
|
|
|
|
char temp[512], tmp2[512], *p;
|
|
|
|
|
char s[512];
|
|
|
|
|
unsigned int board = 0, dev = 0;
|
|
|
|
|
wchar_t *wp;
|
|
|
|
|
int c, d = 0;
|
|
|
|
|
|
|
|
|
|
/* TODO: Backwards compatibility, get rid of this when enough time has passed. */
|
|
|
|
|
backwards_compat = (find_section(cat) == NULL);
|
|
|
|
|
|
|
|
|
|
memset(temp, 0x00, sizeof(temp));
|
2017-10-07 00:46:54 -04:00
|
|
|
for (c=0; c<FDD_NUM; c++) {
|
|
|
|
|
sprintf(temp, "fdd_%02i_type", c+1);
|
|
|
|
|
p = config_get_string(cat, temp, (c < 2) ? "525_2dd" : "none");
|
2020-11-18 01:09:17 -03:00
|
|
|
fdd_set_type(c, fdd_get_from_internal_name(p));
|
2017-10-07 00:46:54 -04:00
|
|
|
if (fdd_get_type(c) > 13)
|
|
|
|
|
fdd_set_type(c, 13);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "fdd_%02i_fn", c + 1);
|
|
|
|
|
wp = config_get_wstring(cat, temp, L"");
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
#if 0
|
2017-10-07 00:46:54 -04:00
|
|
|
/*
|
|
|
|
|
* NOTE:
|
|
|
|
|
* Temporary hack to remove the absolute
|
|
|
|
|
* path currently saved in most config
|
|
|
|
|
* files. We should remove this before
|
|
|
|
|
* finalizing this release! --FvK
|
|
|
|
|
*/
|
2017-12-04 11:59:26 -05:00
|
|
|
if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) {
|
2017-09-23 21:12:26 -04:00
|
|
|
/*
|
2017-10-07 00:46:54 -04:00
|
|
|
* Yep, its absolute and prefixed
|
|
|
|
|
* with the EXE path. Just strip
|
|
|
|
|
* that off for now...
|
2017-09-23 21:12:26 -04:00
|
|
|
*/
|
2017-12-04 11:59:26 -05:00
|
|
|
wcsncpy(floppyfns[c], &wp[wcslen(usr_path)], sizeof_w(floppyfns[c]));
|
2017-10-07 00:46:54 -04:00
|
|
|
} else
|
2017-09-23 21:12:26 -04:00
|
|
|
#endif
|
2017-10-13 18:26:25 -04:00
|
|
|
wcsncpy(floppyfns[c], wp, sizeof_w(floppyfns[c]));
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-12-28 20:42:45 +01:00
|
|
|
/* if (*wp != L'\0')
|
2018-05-21 19:04:05 +02:00
|
|
|
config_log("Floppy%d: %ls\n", c, floppyfns[c]); */
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "fdd_%02i_writeprot", c+1);
|
|
|
|
|
ui_writeprot[c] = !!config_get_int(cat, temp, 0);
|
|
|
|
|
sprintf(temp, "fdd_%02i_turbo", c + 1);
|
|
|
|
|
fdd_set_turbo(c, !!config_get_int(cat, temp, 0));
|
|
|
|
|
sprintf(temp, "fdd_%02i_check_bpb", c+1);
|
|
|
|
|
fdd_set_check_bpb(c, !!config_get_int(cat, temp, 1));
|
|
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
/* Check whether each value is default, if yes, delete it so that only non-default values will later be saved. */
|
2017-10-07 00:46:54 -04:00
|
|
|
if (fdd_get_type(c) == ((c < 2) ? 2 : 0)) {
|
|
|
|
|
sprintf(temp, "fdd_%02i_type", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
if (wcslen(floppyfns[c]) == 0) {
|
|
|
|
|
sprintf(temp, "fdd_%02i_fn", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
if (ui_writeprot[c] == 0) {
|
|
|
|
|
sprintf(temp, "fdd_%02i_writeprot", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
if (fdd_get_turbo(c) == 0) {
|
|
|
|
|
sprintf(temp, "fdd_%02i_turbo", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
if (fdd_get_check_bpb(c) == 1) {
|
|
|
|
|
sprintf(temp, "fdd_%02i_check_bpb", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memset(temp, 0x00, sizeof(temp));
|
|
|
|
|
for (c=0; c<CDROM_NUM; c++) {
|
|
|
|
|
sprintf(temp, "cdrom_%02i_host_drive", c+1);
|
2018-10-17 05:29:48 +02:00
|
|
|
cdrom[c].host_drive = config_get_int(cat, temp, 0);
|
|
|
|
|
cdrom[c].prev_host_drive = cdrom[c].host_drive;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
sprintf(temp, "cdrom_%02i_parameters", c+1);
|
|
|
|
|
p = config_get_string(cat, temp, NULL);
|
|
|
|
|
if (p != NULL)
|
2018-10-17 05:29:48 +02:00
|
|
|
sscanf(p, "%01u, %s", &d, s);
|
2020-11-09 04:24:33 +05:00
|
|
|
else if (c == 0)
|
|
|
|
|
/* If this is the first drive, unmute the audio. */
|
|
|
|
|
sscanf("1, none", "%01u, %s", &d, s);
|
2020-04-01 19:04:53 +02:00
|
|
|
else
|
2018-10-17 05:29:48 +02:00
|
|
|
sscanf("0, none", "%01u, %s", &d, s);
|
|
|
|
|
cdrom[c].sound_on = d;
|
|
|
|
|
cdrom[c].bus_type = hdd_string_to_bus(s, 1);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2018-03-07 20:06:08 +01:00
|
|
|
sprintf(temp, "cdrom_%02i_speed", c+1);
|
2018-10-17 05:29:48 +02:00
|
|
|
cdrom[c].speed = config_get_int(cat, temp, 8);
|
2018-03-07 20:06:08 +01:00
|
|
|
|
2017-12-15 06:39:13 +01:00
|
|
|
/* Default values, needed for proper operation of the Settings dialog. */
|
2018-10-17 05:29:48 +02:00
|
|
|
cdrom[c].ide_channel = cdrom[c].scsi_device_id = c + 2;
|
2017-12-15 06:39:13 +01:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "cdrom_%02i_ide_channel", c+1);
|
2018-10-17 05:29:48 +02:00
|
|
|
if (cdrom[c].bus_type == CDROM_BUS_ATAPI) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "%01u:%01u", (c+2)>>1, (c+2)&1);
|
|
|
|
|
p = config_get_string(cat, temp, tmp2);
|
2018-04-25 23:51:13 +02:00
|
|
|
sscanf(p, "%01u:%01u", &board, &dev);
|
|
|
|
|
board &= 3;
|
|
|
|
|
dev &= 1;
|
2018-10-17 05:29:48 +02:00
|
|
|
cdrom[c].ide_channel = (board<<1)+dev;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2018-10-17 05:29:48 +02:00
|
|
|
if (cdrom[c].ide_channel > 7)
|
|
|
|
|
cdrom[c].ide_channel = 7;
|
2017-10-07 00:46:54 -04:00
|
|
|
} else {
|
2019-09-26 10:02:43 +02:00
|
|
|
sprintf(temp, "cdrom_%02i_scsi_id", c+1);
|
|
|
|
|
if (cdrom[c].bus_type == CDROM_BUS_SCSI) {
|
2018-10-17 05:29:48 +02:00
|
|
|
cdrom[c].scsi_device_id = config_get_int(cat, temp, c+2);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2018-10-17 05:29:48 +02:00
|
|
|
if (cdrom[c].scsi_device_id > 15)
|
|
|
|
|
cdrom[c].scsi_device_id = 15;
|
2018-07-15 01:41:53 +02:00
|
|
|
} else
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "cdrom_%02i_image_path", c+1);
|
|
|
|
|
wp = config_get_wstring(cat, temp, L"");
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
#if 0
|
2017-10-07 00:46:54 -04:00
|
|
|
/*
|
|
|
|
|
* NOTE:
|
|
|
|
|
* Temporary hack to remove the absolute
|
|
|
|
|
* path currently saved in most config
|
|
|
|
|
* files. We should remove this before
|
|
|
|
|
* finalizing this release! --FvK
|
|
|
|
|
*/
|
2017-12-04 11:59:26 -05:00
|
|
|
if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) {
|
2017-09-23 21:12:26 -04:00
|
|
|
/*
|
2017-10-07 00:46:54 -04:00
|
|
|
* Yep, its absolute and prefixed
|
|
|
|
|
* with the EXE path. Just strip
|
|
|
|
|
* that off for now...
|
2017-09-23 21:12:26 -04:00
|
|
|
*/
|
2018-10-17 05:29:48 +02:00
|
|
|
wcsncpy(cdrom[c].image_path, &wp[wcslen(usr_path)], sizeof_w(cdrom[c].image_path));
|
2017-10-07 00:46:54 -04:00
|
|
|
} else
|
2017-09-23 21:12:26 -04:00
|
|
|
#endif
|
2018-10-17 05:29:48 +02:00
|
|
|
wcsncpy(cdrom[c].image_path, wp, sizeof_w(cdrom[c].image_path));
|
2017-05-08 04:54:17 +02:00
|
|
|
|
2018-10-17 05:29:48 +02:00
|
|
|
if (cdrom[c].host_drive && (cdrom[c].host_drive != 200))
|
|
|
|
|
cdrom[c].host_drive = 0;
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2018-10-17 05:29:48 +02:00
|
|
|
if ((cdrom[c].host_drive == 0x200) &&
|
|
|
|
|
(wcslen(cdrom[c].image_path) == 0))
|
|
|
|
|
cdrom[c].host_drive = 0;
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* If the CD-ROM is disabled, delete all its variables. */
|
2018-10-17 05:29:48 +02:00
|
|
|
if (cdrom[c].bus_type == CDROM_BUS_DISABLED) {
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "cdrom_%02i_host_drive", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "cdrom_%02i_parameters", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "cdrom_%02i_ide_channel", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
sprintf(temp, "cdrom_%02i_scsi_id", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "cdrom_%02i_image_path", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
2017-05-17 21:56:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "cdrom_%02i_iso_path", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
2020-07-19 06:07:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Load "Other Removable Devices" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_other_removable_devices(void)
|
|
|
|
|
{
|
|
|
|
|
char *cat = "Other removable devices";
|
|
|
|
|
char temp[512], tmp2[512], *p;
|
|
|
|
|
char s[512];
|
|
|
|
|
unsigned int board = 0, dev = 0;
|
|
|
|
|
wchar_t *wp;
|
|
|
|
|
int c, d = 0;
|
|
|
|
|
|
|
|
|
|
/* TODO: Backwards compatibility, get rid of this when enough time has passed. */
|
|
|
|
|
if (backwards_compat) {
|
|
|
|
|
memset(temp, 0x00, sizeof(temp));
|
|
|
|
|
for (c=0; c<CDROM_NUM; c++) {
|
|
|
|
|
sprintf(temp, "cdrom_%02i_host_drive", c+1);
|
|
|
|
|
cdrom[c].host_drive = config_get_int(cat, temp, 0);
|
|
|
|
|
cdrom[c].prev_host_drive = cdrom[c].host_drive;
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "cdrom_%02i_parameters", c+1);
|
|
|
|
|
p = config_get_string(cat, temp, NULL);
|
|
|
|
|
if (p != NULL)
|
|
|
|
|
sscanf(p, "%01u, %s", &d, s);
|
|
|
|
|
else
|
|
|
|
|
sscanf("0, none", "%01u, %s", &d, s);
|
|
|
|
|
cdrom[c].sound_on = d;
|
|
|
|
|
cdrom[c].bus_type = hdd_string_to_bus(s, 1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "cdrom_%02i_speed", c+1);
|
|
|
|
|
cdrom[c].speed = config_get_int(cat, temp, 8);
|
|
|
|
|
config_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;
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "cdrom_%02i_ide_channel", c+1);
|
|
|
|
|
if (cdrom[c].bus_type == CDROM_BUS_ATAPI) {
|
|
|
|
|
sprintf(tmp2, "%01u:%01u", (c+2)>>1, (c+2)&1);
|
|
|
|
|
p = config_get_string(cat, temp, tmp2);
|
|
|
|
|
sscanf(p, "%01u:%01u", &board, &dev);
|
|
|
|
|
board &= 3;
|
|
|
|
|
dev &= 1;
|
|
|
|
|
cdrom[c].ide_channel = (board<<1)+dev;
|
|
|
|
|
|
|
|
|
|
if (cdrom[c].ide_channel > 7)
|
|
|
|
|
cdrom[c].ide_channel = 7;
|
|
|
|
|
} else {
|
|
|
|
|
sprintf(temp, "cdrom_%02i_scsi_id", c+1);
|
|
|
|
|
if (cdrom[c].bus_type == CDROM_BUS_SCSI) {
|
|
|
|
|
cdrom[c].scsi_device_id = config_get_int(cat, temp, c+2);
|
|
|
|
|
|
|
|
|
|
if (cdrom[c].scsi_device_id > 15)
|
|
|
|
|
cdrom[c].scsi_device_id = 15;
|
|
|
|
|
} else
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "cdrom_%02i_image_path", c+1);
|
|
|
|
|
wp = config_get_wstring(cat, temp, L"");
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
/*
|
|
|
|
|
* NOTE:
|
|
|
|
|
* Temporary hack to remove the absolute
|
|
|
|
|
* path currently saved in most config
|
|
|
|
|
* files. We should remove this before
|
|
|
|
|
* finalizing this release! --FvK
|
|
|
|
|
*/
|
|
|
|
|
if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) {
|
|
|
|
|
/*
|
|
|
|
|
* Yep, its absolute and prefixed
|
|
|
|
|
* with the EXE path. Just strip
|
|
|
|
|
* that off for now...
|
|
|
|
|
*/
|
|
|
|
|
wcsncpy(cdrom[c].image_path, &wp[wcslen(usr_path)], sizeof_w(cdrom[c].image_path));
|
|
|
|
|
} else
|
|
|
|
|
#endif
|
|
|
|
|
wcsncpy(cdrom[c].image_path, wp, sizeof_w(cdrom[c].image_path));
|
|
|
|
|
|
|
|
|
|
if (cdrom[c].host_drive && (cdrom[c].host_drive != 200))
|
|
|
|
|
cdrom[c].host_drive = 0;
|
|
|
|
|
|
|
|
|
|
if ((cdrom[c].host_drive == 0x200) &&
|
|
|
|
|
(wcslen(cdrom[c].image_path) == 0))
|
|
|
|
|
cdrom[c].host_drive = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
backwards_compat = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
memset(temp, 0x00, sizeof(temp));
|
|
|
|
|
for (c=0; c<ZIP_NUM; c++) {
|
|
|
|
|
sprintf(temp, "zip_%02i_parameters", c+1);
|
|
|
|
|
p = config_get_string(cat, temp, NULL);
|
|
|
|
|
if (p != NULL)
|
2018-01-27 02:38:52 +01:00
|
|
|
sscanf(p, "%01u, %s", &zip_drives[c].is_250, s);
|
2018-01-26 22:17:09 +01:00
|
|
|
else
|
2018-01-27 02:38:52 +01:00
|
|
|
sscanf("0, none", "%01u, %s", &zip_drives[c].is_250, s);
|
2018-01-26 22:17:09 +01:00
|
|
|
zip_drives[c].bus_type = hdd_string_to_bus(s, 1);
|
|
|
|
|
|
|
|
|
|
/* Default values, needed for proper operation of the Settings dialog. */
|
|
|
|
|
zip_drives[c].ide_channel = zip_drives[c].scsi_device_id = c + 2;
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "zip_%02i_ide_channel", c+1);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (zip_drives[c].bus_type == ZIP_BUS_ATAPI) {
|
2018-01-26 22:17:09 +01:00
|
|
|
sprintf(tmp2, "%01u:%01u", (c+2)>>1, (c+2)&1);
|
|
|
|
|
p = config_get_string(cat, temp, tmp2);
|
2018-04-25 23:51:13 +02:00
|
|
|
sscanf(p, "%01u:%01u", &board, &dev);
|
|
|
|
|
board &= 3;
|
|
|
|
|
dev &= 1;
|
|
|
|
|
zip_drives[c].ide_channel = (board<<1)+dev;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
if (zip_drives[c].ide_channel > 7)
|
|
|
|
|
zip_drives[c].ide_channel = 7;
|
|
|
|
|
} else {
|
2018-07-15 01:41:53 +02:00
|
|
|
sprintf(temp, "zip_%02i_scsi_id", c+1);
|
2020-04-01 19:04:53 +02:00
|
|
|
if (zip_drives[c].bus_type == ZIP_BUS_SCSI) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_drives[c].scsi_device_id = config_get_int(cat, temp, c+2);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
if (zip_drives[c].scsi_device_id > 15)
|
|
|
|
|
zip_drives[c].scsi_device_id = 15;
|
2018-07-15 01:41:53 +02:00
|
|
|
} else
|
2018-01-26 22:17:09 +01:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "zip_%02i_image_path", c+1);
|
|
|
|
|
wp = config_get_wstring(cat, temp, L"");
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
/*
|
|
|
|
|
* NOTE:
|
|
|
|
|
* Temporary hack to remove the absolute
|
|
|
|
|
* path currently saved in most config
|
|
|
|
|
* files. We should remove this before
|
|
|
|
|
* finalizing this release! --FvK
|
|
|
|
|
*/
|
|
|
|
|
if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) {
|
|
|
|
|
/*
|
|
|
|
|
* Yep, its absolute and prefixed
|
|
|
|
|
* with the EXE path. Just strip
|
|
|
|
|
* that off for now...
|
|
|
|
|
*/
|
|
|
|
|
wcsncpy(zip_drives[c].image_path, &wp[wcslen(usr_path)], sizeof_w(zip_drives[c].image_path));
|
|
|
|
|
} else
|
|
|
|
|
#endif
|
|
|
|
|
wcsncpy(zip_drives[c].image_path, wp, sizeof_w(zip_drives[c].image_path));
|
|
|
|
|
|
|
|
|
|
/* If the CD-ROM is disabled, delete all its variables. */
|
|
|
|
|
if (zip_drives[c].bus_type == ZIP_BUS_DISABLED) {
|
|
|
|
|
sprintf(temp, "zip_%02i_host_drive", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "zip_%02i_parameters", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "zip_%02i_ide_channel", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
sprintf(temp, "zip_%02i_scsi_id", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
sprintf(temp, "zip_%02i_image_path", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "zip_%02i_iso_path", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
2020-04-01 19:04:53 +02:00
|
|
|
|
|
|
|
|
memset(temp, 0x00, sizeof(temp));
|
|
|
|
|
for (c=0; c<MO_NUM; c++) {
|
|
|
|
|
sprintf(temp, "mo_%02i_parameters", c+1);
|
|
|
|
|
p = config_get_string(cat, temp, NULL);
|
|
|
|
|
if (p != NULL)
|
2020-08-02 19:02:56 +02:00
|
|
|
sscanf(p, "%u, %s", &mo_drives[c].type, s);
|
2020-04-01 19:04:53 +02:00
|
|
|
else
|
2020-08-02 19:02:56 +02:00
|
|
|
sscanf("00, none", "%u, %s", &mo_drives[c].type, s);
|
2020-04-01 19:04:53 +02:00
|
|
|
mo_drives[c].bus_type = hdd_string_to_bus(s, 1);
|
|
|
|
|
|
|
|
|
|
/* Default values, needed for proper operation of the Settings dialog. */
|
|
|
|
|
mo_drives[c].ide_channel = mo_drives[c].scsi_device_id = c + 2;
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "mo_%02i_ide_channel", c+1);
|
|
|
|
|
if (mo_drives[c].bus_type == MO_BUS_ATAPI) {
|
|
|
|
|
sprintf(tmp2, "%01u:%01u", (c+2)>>1, (c+2)&1);
|
|
|
|
|
p = config_get_string(cat, temp, tmp2);
|
|
|
|
|
sscanf(p, "%01u:%01u", &board, &dev);
|
|
|
|
|
board &= 3;
|
|
|
|
|
dev &= 1;
|
|
|
|
|
mo_drives[c].ide_channel = (board<<1)+dev;
|
|
|
|
|
|
|
|
|
|
if (mo_drives[c].ide_channel > 7)
|
|
|
|
|
mo_drives[c].ide_channel = 7;
|
|
|
|
|
} else {
|
|
|
|
|
sprintf(temp, "mo_%02i_scsi_id", c+1);
|
|
|
|
|
if (mo_drives[c].bus_type == MO_BUS_SCSI) {
|
|
|
|
|
mo_drives[c].scsi_device_id = config_get_int(cat, temp, c+2);
|
|
|
|
|
|
|
|
|
|
if (mo_drives[c].scsi_device_id > 15)
|
|
|
|
|
mo_drives[c].scsi_device_id = 15;
|
|
|
|
|
} else
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "mo_%02i_image_path", c+1);
|
|
|
|
|
wp = config_get_wstring(cat, temp, L"");
|
|
|
|
|
|
|
|
|
|
wcsncpy(mo_drives[c].image_path, wp, sizeof_w(mo_drives[c].image_path));
|
|
|
|
|
|
|
|
|
|
/* If the CD-ROM is disabled, delete all its variables. */
|
|
|
|
|
if (mo_drives[c].bus_type == MO_BUS_DISABLED) {
|
|
|
|
|
sprintf(temp, "mo_%02i_host_drive", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "mo_%02i_parameters", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "mo_%02i_ide_channel", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "mo_%02i_scsi_id", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "mo_%02i_image_path", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "mo_%02i_iso_path", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2020-11-26 18:20:24 +01:00
|
|
|
/* Load "Other Peripherals" section. */
|
|
|
|
|
static void
|
|
|
|
|
load_other_peripherals(void)
|
|
|
|
|
{
|
|
|
|
|
char *cat = "Other peripherals";
|
|
|
|
|
char *p;
|
|
|
|
|
char temp[512];
|
|
|
|
|
int c, free_p = 0;
|
|
|
|
|
|
|
|
|
|
if (backwards_compat2) {
|
|
|
|
|
p = config_get_string(cat, "scsicard", NULL);
|
|
|
|
|
if (p != NULL)
|
|
|
|
|
scsi_card_current = scsi_card_get_from_internal_name(p);
|
|
|
|
|
else
|
|
|
|
|
scsi_card_current = 0;
|
|
|
|
|
config_delete_var(cat, "scsicard");
|
|
|
|
|
|
|
|
|
|
p = config_get_string(cat, "fdc", NULL);
|
|
|
|
|
if (p != NULL)
|
|
|
|
|
fdc_type = fdc_card_get_from_internal_name(p);
|
|
|
|
|
else
|
|
|
|
|
fdc_type = FDC_INTERNAL;
|
|
|
|
|
config_delete_var(cat, "fdc");
|
|
|
|
|
|
|
|
|
|
p = config_get_string(cat, "hdc", NULL);
|
|
|
|
|
if (p == NULL) {
|
|
|
|
|
if (machines[machine].flags & MACHINE_HDC) {
|
|
|
|
|
p = (char *)malloc((strlen("internal")+1)*sizeof(char));
|
|
|
|
|
strcpy(p, "internal");
|
|
|
|
|
} else {
|
|
|
|
|
p = (char *)malloc((strlen("none")+1)*sizeof(char));
|
|
|
|
|
strcpy(p, "none");
|
|
|
|
|
}
|
|
|
|
|
free_p = 1;
|
|
|
|
|
}
|
|
|
|
|
if (!strcmp(p, "mfm_xt"))
|
|
|
|
|
hdc_current = hdc_get_from_internal_name("st506_xt");
|
|
|
|
|
else if (!strcmp(p, "mfm_xt_dtc5150x"))
|
|
|
|
|
hdc_current = hdc_get_from_internal_name("st506_xt_dtc5150x");
|
|
|
|
|
else if (!strcmp(p, "mfm_at"))
|
|
|
|
|
hdc_current = hdc_get_from_internal_name("st506_at");
|
|
|
|
|
else
|
|
|
|
|
hdc_current = hdc_get_from_internal_name(p);
|
|
|
|
|
config_delete_var(cat, "hdc");
|
|
|
|
|
|
|
|
|
|
if (free_p) {
|
|
|
|
|
free(p);
|
|
|
|
|
p = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ide_ter_enabled = !!config_get_int(cat, "ide_ter", 0);
|
|
|
|
|
config_delete_var(cat, "ide_ter");
|
|
|
|
|
ide_qua_enabled = !!config_get_int(cat, "ide_qua", 0);
|
|
|
|
|
config_delete_var(cat, "ide_qua");
|
|
|
|
|
}
|
|
|
|
|
backwards_compat2 = 0;
|
|
|
|
|
|
|
|
|
|
bugger_enabled = !!config_get_int(cat, "bugger_enabled", 0);
|
|
|
|
|
postcard_enabled = !!config_get_int(cat, "postcard_enabled", 0);
|
|
|
|
|
|
|
|
|
|
for (c = 0; c < ISAMEM_MAX; c++) {
|
|
|
|
|
sprintf(temp, "isamem%d_type", c);
|
|
|
|
|
|
|
|
|
|
p = config_get_string(cat, temp, "none");
|
|
|
|
|
isamem_type[c] = isamem_get_from_internal_name(p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p = config_get_string(cat, "isartc_type", "none");
|
|
|
|
|
isartc_type = isartc_get_from_internal_name(p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Load the specified or a default configuration file. */
|
|
|
|
|
void
|
2017-12-04 11:59:26 -05:00
|
|
|
config_load(void)
|
2017-10-07 00:46:54 -04:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
int i;
|
|
|
|
|
|
2018-05-21 19:04:05 +02:00
|
|
|
config_log("Loading config file '%ls'..\n", cfg_path);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
memset(hdd, 0, sizeof(hard_disk_t));
|
2018-10-17 05:29:48 +02:00
|
|
|
memset(cdrom, 0, sizeof(cdrom_t) * CDROM_NUM);
|
2018-04-25 23:51:13 +02:00
|
|
|
#ifdef USE_IOCTL
|
|
|
|
|
memset(cdrom_ioctl, 0, sizeof(cdrom_ioctl_t) * CDROM_NUM);
|
|
|
|
|
#endif
|
|
|
|
|
memset(zip_drives, 0, sizeof(zip_drive_t));
|
|
|
|
|
|
2017-12-04 11:59:26 -05:00
|
|
|
if (! config_read(cfg_path)) {
|
2020-11-18 19:56:22 -03:00
|
|
|
cpu_f = (cpu_family_t *) &cpu_families[0];
|
2017-10-07 00:46:54 -04:00
|
|
|
cpu = 0;
|
2017-10-10 03:07:29 -04:00
|
|
|
#ifdef USE_LANGUAGE
|
2017-10-13 18:26:25 -04:00
|
|
|
plat_langid = 0x0409;
|
2017-10-07 00:46:54 -04:00
|
|
|
#endif
|
|
|
|
|
scale = 1;
|
2018-04-25 23:51:13 +02:00
|
|
|
machine = machine_get_machine_from_internal_name("ibmpc");
|
2020-11-18 01:09:17 -03:00
|
|
|
fpu_type = fpu_get_type(cpu_f, cpu, "none");
|
2018-09-19 20:46:42 +02:00
|
|
|
gfxcard = video_get_video_from_internal_name("cga");
|
2018-04-25 23:51:13 +02:00
|
|
|
vid_api = plat_vidapi("default");
|
2018-08-01 18:07:52 +02:00
|
|
|
time_sync = TIME_SYNC_ENABLED;
|
2020-01-16 19:23:54 -05:00
|
|
|
joystick_type = JOYSTICK_TYPE_NONE;
|
2019-02-06 03:34:39 +01:00
|
|
|
hdc_current = hdc_get_from_internal_name("none");
|
2018-04-25 23:51:13 +02:00
|
|
|
serial_enabled[0] = 1;
|
|
|
|
|
serial_enabled[1] = 1;
|
2020-07-08 04:24:25 +02:00
|
|
|
serial_enabled[2] = 0;
|
|
|
|
|
serial_enabled[3] = 0;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
lpt_ports[0].enabled = 1;
|
|
|
|
|
lpt_ports[1].enabled = 0;
|
|
|
|
|
lpt_ports[2].enabled = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
for (i = 0; i < FDD_NUM; i++) {
|
|
|
|
|
if (i < 2)
|
|
|
|
|
fdd_set_type(i, 2);
|
|
|
|
|
else
|
|
|
|
|
fdd_set_type(i, 0);
|
|
|
|
|
|
|
|
|
|
fdd_set_turbo(i, 0);
|
|
|
|
|
fdd_set_check_bpb(i, 1);
|
|
|
|
|
}
|
2020-11-09 04:24:33 +05:00
|
|
|
|
|
|
|
|
/* Unmute the CD audio on the first CD-ROM drive. */
|
|
|
|
|
cdrom[0].sound_on = 1;
|
2017-10-07 00:46:54 -04:00
|
|
|
mem_size = 640;
|
2018-09-03 14:45:55 +02:00
|
|
|
isartc_type = 0;
|
|
|
|
|
for (i = 0; i < ISAMEM_MAX; i++)
|
|
|
|
|
isamem_type[i] = 0;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2018-05-21 19:04:05 +02:00
|
|
|
config_log("Config file not present or invalid!\n");
|
2017-10-07 00:46:54 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
load_general(); /* General */
|
|
|
|
|
load_machine(); /* Machine */
|
|
|
|
|
load_video(); /* Video */
|
|
|
|
|
load_input_devices(); /* Input devices */
|
|
|
|
|
load_sound(); /* Sound */
|
|
|
|
|
load_network(); /* Network */
|
|
|
|
|
load_ports(); /* Ports (COM & LPT) */
|
2020-11-26 18:20:24 +01:00
|
|
|
load_storage_controllers(); /* Storage controllers */
|
2018-01-26 22:17:09 +01:00
|
|
|
load_hard_disks(); /* Hard disks */
|
2020-07-19 06:07:58 +02:00
|
|
|
load_floppy_and_cdrom_drives(); /* Floppy and CD-ROM drives */
|
|
|
|
|
/* TODO: Backwards compatibility, get rid of this when enough time has passed. */
|
2018-01-26 22:17:09 +01:00
|
|
|
load_floppy_drives(); /* Floppy drives */
|
|
|
|
|
load_other_removable_devices(); /* Other removable devices */
|
2020-11-26 18:20:24 +01:00
|
|
|
load_other_peripherals(); /* Other peripherals */
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-10-29 04:20:20 -05:00
|
|
|
/* Mark the configuration as changed. */
|
|
|
|
|
config_changed = 1;
|
|
|
|
|
|
2018-05-21 19:04:05 +02:00
|
|
|
config_log("Config loaded.\n\n");
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Save "General" section. */
|
|
|
|
|
static void
|
|
|
|
|
save_general(void)
|
|
|
|
|
{
|
|
|
|
|
char *cat = "General";
|
|
|
|
|
char temp[512];
|
|
|
|
|
|
2017-10-25 02:17:27 +02:00
|
|
|
char *va_name;
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
config_set_int(cat, "vid_resize", vid_resize);
|
|
|
|
|
if (vid_resize == 0)
|
|
|
|
|
config_delete_var(cat, "vid_resize");
|
|
|
|
|
|
2017-10-24 22:10:21 -04:00
|
|
|
va_name = plat_vidapi_name(vid_api);
|
2017-10-25 02:17:27 +02:00
|
|
|
if (!strcmp(va_name, "default")) {
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, "vid_renderer");
|
2017-10-25 02:17:27 +02:00
|
|
|
} else {
|
|
|
|
|
config_set_string(cat, "vid_renderer", va_name);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (video_fullscreen_scale == 0)
|
|
|
|
|
config_delete_var(cat, "video_fullscreen_scale");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "video_fullscreen_scale", video_fullscreen_scale);
|
|
|
|
|
|
2020-07-27 19:28:32 -03:00
|
|
|
if (video_fullscreen_first == 1)
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, "video_fullscreen_first");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "video_fullscreen_first", video_fullscreen_first);
|
|
|
|
|
|
|
|
|
|
if (force_43 == 0)
|
|
|
|
|
config_delete_var(cat, "force_43");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "force_43", force_43);
|
|
|
|
|
|
|
|
|
|
if (scale == 1)
|
|
|
|
|
config_delete_var(cat, "scale");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "scale", scale);
|
|
|
|
|
|
2020-09-02 10:56:49 +08:00
|
|
|
if (dpi_scale == 1)
|
|
|
|
|
config_delete_var(cat, "dpi_scale");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "dpi_scale", dpi_scale);
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (enable_overscan == 0)
|
|
|
|
|
config_delete_var(cat, "enable_overscan");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "enable_overscan", enable_overscan);
|
|
|
|
|
|
|
|
|
|
if (vid_cga_contrast == 0)
|
|
|
|
|
config_delete_var(cat, "vid_cga_contrast");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "vid_cga_contrast", vid_cga_contrast);
|
|
|
|
|
|
|
|
|
|
if (video_grayscale == 0)
|
|
|
|
|
config_delete_var(cat, "video_grayscale");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "video_grayscale", video_grayscale);
|
|
|
|
|
|
|
|
|
|
if (video_graytype == 0)
|
|
|
|
|
config_delete_var(cat, "video_graytype");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "video_graytype", video_graytype);
|
|
|
|
|
|
2018-02-10 00:01:52 +01:00
|
|
|
if (rctrl_is_lalt == 0)
|
|
|
|
|
config_delete_var(cat, "rctrl_is_lalt");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "rctrl_is_lalt", rctrl_is_lalt);
|
|
|
|
|
|
2018-02-11 20:51:42 +01:00
|
|
|
if (update_icons == 1)
|
|
|
|
|
config_delete_var(cat, "update_icons");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "update_icons", update_icons);
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (window_remember) {
|
|
|
|
|
config_set_int(cat, "window_remember", window_remember);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "%i, %i, %i, %i", window_w, window_h, window_x, window_y);
|
|
|
|
|
config_set_string(cat, "window_coordinates", temp);
|
|
|
|
|
} else {
|
|
|
|
|
config_delete_var(cat, "window_remember");
|
|
|
|
|
config_delete_var(cat, "window_coordinates");
|
|
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2018-02-11 20:51:42 +01:00
|
|
|
if (sound_gain != 0)
|
|
|
|
|
config_set_int(cat, "sound_gain", sound_gain);
|
2017-12-10 15:16:24 +01:00
|
|
|
else
|
2018-02-11 20:51:42 +01:00
|
|
|
config_delete_var(cat, "sound_gain");
|
2017-12-10 15:16:24 +01:00
|
|
|
|
2020-07-27 19:55:25 -03:00
|
|
|
if (confirm_reset != 1)
|
2020-11-18 01:09:17 -03:00
|
|
|
config_set_int(cat, "confirm_reset", confirm_reset);
|
2020-07-27 19:55:25 -03:00
|
|
|
else
|
2020-11-18 01:09:17 -03:00
|
|
|
config_delete_var(cat, "confirm_reset");
|
2020-07-27 19:55:25 -03:00
|
|
|
|
|
|
|
|
if (confirm_exit != 1)
|
2020-11-18 01:09:17 -03:00
|
|
|
config_set_int(cat, "confirm_exit", confirm_exit);
|
2020-07-27 19:55:25 -03:00
|
|
|
else
|
2020-11-18 01:09:17 -03:00
|
|
|
config_delete_var(cat, "confirm_exit");
|
2020-07-27 19:55:25 -03:00
|
|
|
|
2020-11-21 19:17:06 +01:00
|
|
|
if (confirm_save != 1)
|
|
|
|
|
config_set_int(cat, "confirm_save", confirm_save);
|
|
|
|
|
else
|
|
|
|
|
config_delete_var(cat, "confirm_save");
|
|
|
|
|
|
2017-10-10 03:07:29 -04:00
|
|
|
#ifdef USE_LANGUAGE
|
2017-10-13 18:26:25 -04:00
|
|
|
if (plat_langid == 0x0409)
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, "language");
|
|
|
|
|
else
|
2017-10-13 18:26:25 -04:00
|
|
|
config_set_hex16(cat, "language", plat_langid);
|
2017-09-23 21:12:26 -04:00
|
|
|
#endif
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2019-12-04 21:55:35 +01:00
|
|
|
#if USE_DISCORD
|
|
|
|
|
if (enable_discord)
|
|
|
|
|
config_set_int(cat, "enable_discord", enable_discord);
|
|
|
|
|
else
|
|
|
|
|
config_delete_var(cat, "enable_discord");
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
delete_section_if_empty(cat);
|
2017-05-27 03:53:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Save "Machine" section. */
|
|
|
|
|
static void
|
|
|
|
|
save_machine(void)
|
2017-05-29 01:18:32 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Machine";
|
2020-11-18 16:08:22 -03:00
|
|
|
char *p;
|
2020-11-18 19:56:22 -03:00
|
|
|
int c, i = 0, legacy_mfg, legacy_cpu = -1, closest_legacy_cpu = -1;
|
2017-05-29 01:18:32 +02:00
|
|
|
|
2020-11-18 16:08:22 -03:00
|
|
|
p = machine_get_internal_name();
|
|
|
|
|
config_set_string(cat, "machine", p);
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2020-11-18 01:09:17 -03:00
|
|
|
config_set_string(cat, "cpu_family", (char *) cpu_f->internal_name);
|
|
|
|
|
config_set_int(cat, "cpu_speed", cpu_f->cpus[cpu].rspeed);
|
|
|
|
|
config_set_double(cat, "cpu_multi", cpu_f->cpus[cpu].multi);
|
2020-11-23 14:48:32 -03:00
|
|
|
if (cpu_override)
|
|
|
|
|
config_set_int(cat, "cpu_override", cpu_override);
|
|
|
|
|
else
|
|
|
|
|
config_delete_var(cat, "cpu_override");
|
2017-05-29 01:18:32 +02:00
|
|
|
|
2020-11-18 19:56:22 -03:00
|
|
|
/* Forwards compatibility with the previous CPU model system. */
|
2020-11-18 01:09:17 -03:00
|
|
|
config_delete_var(cat, "cpu_manufacturer");
|
|
|
|
|
config_delete_var(cat, "cpu");
|
2017-05-29 01:18:32 +02:00
|
|
|
|
2020-11-18 16:08:22 -03:00
|
|
|
/* Look for a machine entry on the legacy table. */
|
|
|
|
|
c = 0;
|
|
|
|
|
while (cpu_legacy_table[c].machine) {
|
|
|
|
|
if (!strcmp(p, cpu_legacy_table[c].machine))
|
|
|
|
|
break;
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
if (cpu_legacy_table[c].machine) {
|
|
|
|
|
/* Look for a corresponding CPU entry. */
|
|
|
|
|
cpu_legacy_table_t *legacy_table_entry;
|
2020-11-18 19:56:22 -03:00
|
|
|
for (legacy_mfg = 0; legacy_mfg < 4; legacy_mfg++) {
|
|
|
|
|
if (!cpu_legacy_table[c].tables[legacy_mfg])
|
2020-11-18 16:08:22 -03:00
|
|
|
continue;
|
|
|
|
|
|
2020-11-18 19:56:22 -03:00
|
|
|
i = 0;
|
2020-11-18 16:08:22 -03:00
|
|
|
do {
|
2020-11-18 19:56:22 -03:00
|
|
|
legacy_table_entry = (cpu_legacy_table_t *) &cpu_legacy_table[c].tables[legacy_mfg][i];
|
|
|
|
|
|
|
|
|
|
/* Match the family name, speed and multiplier. */
|
|
|
|
|
if (!strcmp(cpu_f->internal_name, legacy_table_entry->family)) {
|
|
|
|
|
if ((legacy_table_entry->rspeed == cpu_f->cpus[cpu].rspeed) &&
|
|
|
|
|
(legacy_table_entry->multi == cpu_f->cpus[cpu].multi)) { /* exact speed/multiplier match */
|
|
|
|
|
legacy_cpu = i;
|
|
|
|
|
break;
|
|
|
|
|
} else if ((legacy_table_entry->rspeed >= cpu_f->cpus[cpu].rspeed) &&
|
|
|
|
|
(closest_legacy_cpu == -1)) { /* closest speed match */
|
|
|
|
|
closest_legacy_cpu = i;
|
|
|
|
|
}
|
2020-11-18 16:08:22 -03:00
|
|
|
}
|
2020-11-18 19:56:22 -03:00
|
|
|
} while (cpu_legacy_table[c].tables[legacy_mfg][++i].family);
|
|
|
|
|
|
|
|
|
|
/* Use the closest speed match if no exact match was found. */
|
|
|
|
|
if ((legacy_cpu == -1) && (closest_legacy_cpu > -1)) {
|
|
|
|
|
legacy_cpu = closest_legacy_cpu;
|
|
|
|
|
break;
|
|
|
|
|
} else if (legacy_cpu > -1) /* exact match found */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set legacy values if a match was found. */
|
|
|
|
|
if (legacy_cpu > -1) {
|
|
|
|
|
if (legacy_mfg)
|
|
|
|
|
config_set_int(cat, "cpu_manufacturer", legacy_mfg);
|
|
|
|
|
if (legacy_cpu)
|
|
|
|
|
config_set_int(cat, "cpu", legacy_cpu);
|
2020-11-18 16:08:22 -03:00
|
|
|
}
|
|
|
|
|
}
|
2017-05-29 01:18:32 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (cpu_waitstates == 0)
|
|
|
|
|
config_delete_var(cat, "cpu_waitstates");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "cpu_waitstates", cpu_waitstates);
|
2017-05-29 01:18:32 +02:00
|
|
|
|
2020-06-15 21:21:26 +02:00
|
|
|
if (fpu_type == 0)
|
|
|
|
|
config_delete_var(cat, "fpu_type");
|
|
|
|
|
else
|
2020-11-18 01:09:17 -03:00
|
|
|
config_set_string(cat, "fpu_type", (char *) fpu_get_internal_name(cpu_f, cpu, fpu_type));
|
2020-06-15 21:21:26 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (mem_size == 4096)
|
|
|
|
|
config_delete_var(cat, "mem_size");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "mem_size", mem_size);
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
config_set_int(cat, "cpu_use_dynarec", cpu_use_dynarec);
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2018-08-01 18:07:52 +02:00
|
|
|
if (time_sync & TIME_SYNC_ENABLED)
|
|
|
|
|
if (time_sync & TIME_SYNC_UTC)
|
|
|
|
|
config_set_string(cat, "time_sync", "utc");
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, "time_sync", "local");
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, "time_sync", "disabled");
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
delete_section_if_empty(cat);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Save "Video" section. */
|
|
|
|
|
static void
|
|
|
|
|
save_video(void)
|
2017-05-17 21:56:31 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Video";
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
config_set_string(cat, "gfxcard",
|
2018-09-19 20:46:42 +02:00
|
|
|
video_get_internal_name(gfxcard));
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (voodoo_enabled == 0)
|
|
|
|
|
config_delete_var(cat, "voodoo");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "voodoo", voodoo_enabled);
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
delete_section_if_empty(cat);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Save "Input Devices" section. */
|
|
|
|
|
static void
|
|
|
|
|
save_input_devices(void)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Input devices";
|
2017-10-13 18:26:25 -04:00
|
|
|
char temp[512], tmp2[512];
|
2017-10-07 00:46:54 -04:00
|
|
|
int c, d;
|
|
|
|
|
|
|
|
|
|
config_set_string(cat, "mouse_type", mouse_get_internal_name(mouse_type));
|
|
|
|
|
|
2020-01-16 19:23:54 -05:00
|
|
|
if (joystick_type == JOYSTICK_TYPE_NONE) {
|
2018-10-06 20:42:13 +02:00
|
|
|
config_delete_var(cat, "joystick_type");
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2018-10-06 20:42:13 +02:00
|
|
|
for (c = 0; c < 16; c++) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "joystick_%i_nr", c);
|
|
|
|
|
config_delete_var(cat, tmp2);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
for (d=0; d<16; d++) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "joystick_%i_axis_%i", c, d);
|
|
|
|
|
config_delete_var(cat, tmp2);
|
2017-05-29 01:18:32 +02:00
|
|
|
}
|
2017-10-07 00:46:54 -04:00
|
|
|
for (d=0; d<16; d++) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "joystick_%i_button_%i", c, d);
|
|
|
|
|
config_delete_var(cat, tmp2);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
for (d=0; d<16; d++) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "joystick_%i_pov_%i", c, d);
|
|
|
|
|
config_delete_var(cat, tmp2);
|
2017-05-29 01:18:32 +02:00
|
|
|
}
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-10-07 00:46:54 -04:00
|
|
|
} else {
|
2020-12-04 21:45:14 +05:00
|
|
|
config_set_string(cat, "joystick_type", joystick_get_internal_name(joystick_type));
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2018-10-06 20:42:13 +02:00
|
|
|
for (c = 0; c < joystick_get_max_joysticks(joystick_type); c++) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "joystick_%i_nr", c);
|
|
|
|
|
config_set_int(cat, tmp2, joystick_state[c].plat_joystick_nr);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
if (joystick_state[c].plat_joystick_nr) {
|
|
|
|
|
for (d=0; d<joystick_get_axis_count(joystick_type); d++) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "joystick_%i_axis_%i", c, d);
|
|
|
|
|
config_set_int(cat, tmp2, joystick_state[c].axis_mapping[d]);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
for (d=0; d<joystick_get_button_count(joystick_type); d++) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "joystick_%i_button_%i", c, d);
|
|
|
|
|
config_set_int(cat, tmp2, joystick_state[c].button_mapping[d]);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
for (d=0; d<joystick_get_pov_count(joystick_type); d++) {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "joystick_%i_pov_%i", c, d);
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "%i, %i", joystick_state[c].pov_mapping[d][0], joystick_state[c].pov_mapping[d][1]);
|
2017-10-13 18:26:25 -04:00
|
|
|
config_set_string(cat, tmp2, temp);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
}
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
delete_section_if_empty(cat);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
|
|
|
|
|
/* Save "Sound" section. */
|
|
|
|
|
static void
|
|
|
|
|
save_sound(void)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Sound";
|
|
|
|
|
|
|
|
|
|
if (sound_card_current == 0)
|
|
|
|
|
config_delete_var(cat, "sndcard");
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, "sndcard", sound_card_get_internal_name(sound_card_current));
|
|
|
|
|
|
|
|
|
|
if (!strcmp(midi_device_get_internal_name(midi_device_current), "none"))
|
|
|
|
|
config_delete_var(cat, "midi_device");
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, "midi_device", midi_device_get_internal_name(midi_device_current));
|
|
|
|
|
|
2020-01-01 20:20:16 +01:00
|
|
|
if (!strcmp(midi_in_device_get_internal_name(midi_input_device_current), "none"))
|
|
|
|
|
config_delete_var(cat, "midi_in_device");
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, "midi_in_device", midi_in_device_get_internal_name(midi_input_device_current));
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (mpu401_standalone_enable == 0)
|
|
|
|
|
config_delete_var(cat, "mpu401_standalone");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "mpu401_standalone", mpu401_standalone_enable);
|
|
|
|
|
|
|
|
|
|
if (SSI2001 == 0)
|
|
|
|
|
config_delete_var(cat, "ssi2001");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "ssi2001", SSI2001);
|
|
|
|
|
|
|
|
|
|
if (GAMEBLASTER == 0)
|
|
|
|
|
config_delete_var(cat, "gameblaster");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "gameblaster", GAMEBLASTER);
|
|
|
|
|
|
|
|
|
|
if (GUS == 0)
|
|
|
|
|
config_delete_var(cat, "gus");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "gus", GUS);
|
|
|
|
|
|
|
|
|
|
if (sound_is_float == 1)
|
|
|
|
|
config_delete_var(cat, "sound_type");
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, "sound_type", (sound_is_float == 1) ? "float" : "int16");
|
|
|
|
|
|
|
|
|
|
delete_section_if_empty(cat);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Save "Network" section. */
|
|
|
|
|
static void
|
|
|
|
|
save_network(void)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Network";
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (network_type == NET_TYPE_NONE)
|
|
|
|
|
config_delete_var(cat, "net_type");
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, "net_type",
|
|
|
|
|
(network_type == NET_TYPE_SLIRP) ? "slirp" : "pcap");
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
if (network_host[0] != '\0') {
|
|
|
|
|
if (! strcmp(network_host, "none"))
|
|
|
|
|
config_delete_var(cat, "net_host_device");
|
2017-10-13 18:26:25 -04:00
|
|
|
else
|
2018-03-19 01:02:04 +01:00
|
|
|
config_set_string(cat, "net_host_device", network_host);
|
2017-10-07 00:46:54 -04:00
|
|
|
} else {
|
2018-03-19 01:02:04 +01:00
|
|
|
/* config_set_string(cat, "net_host_device", "none"); */
|
|
|
|
|
config_delete_var(cat, "net_host_device");
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (network_card == 0)
|
|
|
|
|
config_delete_var(cat, "net_card");
|
2017-10-13 18:26:25 -04:00
|
|
|
else
|
2017-10-07 00:46:54 -04:00
|
|
|
config_set_string(cat, "net_card",
|
|
|
|
|
network_card_get_internal_name(network_card));
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
delete_section_if_empty(cat);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-05-29 01:18:32 +02:00
|
|
|
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Save "Ports" section. */
|
|
|
|
|
static void
|
|
|
|
|
save_ports(void)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Ports (COM & LPT)";
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
char temp[512];
|
|
|
|
|
int c, d;
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2020-07-08 04:24:25 +02:00
|
|
|
for (c = 0; c < 4; c++) {
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
sprintf(temp, "serial%d_enabled", c + 1);
|
2020-07-08 04:28:44 +02:00
|
|
|
if (((c < 2) && serial_enabled[c]) || ((c >= 2) && !serial_enabled[c]))
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, temp, serial_enabled[c]);
|
|
|
|
|
}
|
2018-02-06 19:53:34 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
for (c = 0; c < 3; c++) {
|
|
|
|
|
sprintf(temp, "lpt%d_enabled", c + 1);
|
|
|
|
|
d = (c == 0) ? 1 : 0;
|
|
|
|
|
if (lpt_ports[c].enabled == d)
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, temp, lpt_ports[c].enabled);
|
2018-02-06 19:53:34 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
sprintf(temp, "lpt%d_device", c + 1);
|
|
|
|
|
if (lpt_ports[c].device == 0)
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, temp,
|
|
|
|
|
(char *) lpt_device_get_internal_name(lpt_ports[c].device));
|
|
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
delete_section_if_empty(cat);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
|
|
|
|
|
2020-11-26 18:20:24 +01:00
|
|
|
/* Save "Storage Controllers" section. */
|
2017-09-23 21:12:26 -04:00
|
|
|
static void
|
2020-11-26 18:20:24 +01:00
|
|
|
save_storage_controllers(void)
|
2017-09-23 21:12:26 -04:00
|
|
|
{
|
2020-11-26 18:20:24 +01:00
|
|
|
char *cat = "Storage controllers";
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
if (scsi_card_current == 0)
|
|
|
|
|
config_delete_var(cat, "scsicard");
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, "scsicard",
|
|
|
|
|
scsi_card_get_internal_name(scsi_card_current));
|
|
|
|
|
|
2020-06-17 14:29:24 +02:00
|
|
|
if (fdc_type == FDC_INTERNAL)
|
|
|
|
|
config_delete_var(cat, "fdc");
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, "fdc",
|
|
|
|
|
fdc_card_get_internal_name(fdc_type));
|
2020-06-16 16:25:23 +02:00
|
|
|
|
2019-02-06 03:34:39 +01:00
|
|
|
config_set_string(cat, "hdc",
|
|
|
|
|
hdc_get_internal_name(hdc_current));
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (ide_ter_enabled == 0)
|
|
|
|
|
config_delete_var(cat, "ide_ter");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "ide_ter", ide_ter_enabled);
|
|
|
|
|
|
|
|
|
|
if (ide_qua_enabled == 0)
|
|
|
|
|
config_delete_var(cat, "ide_qua");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "ide_qua", ide_qua_enabled);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2020-11-26 18:20:24 +01:00
|
|
|
delete_section_if_empty(cat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Save "Other Peripherals" section. */
|
|
|
|
|
static void
|
|
|
|
|
save_other_peripherals(void)
|
|
|
|
|
{
|
|
|
|
|
char *cat = "Other peripherals";
|
|
|
|
|
char temp[512];
|
|
|
|
|
int c;
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
if (bugger_enabled == 0)
|
|
|
|
|
config_delete_var(cat, "bugger_enabled");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "bugger_enabled", bugger_enabled);
|
|
|
|
|
|
2020-03-23 17:03:28 -03:00
|
|
|
if (postcard_enabled == 0)
|
|
|
|
|
config_delete_var(cat, "postcard_enabled");
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, "postcard_enabled", postcard_enabled);
|
|
|
|
|
|
2018-09-03 14:28:50 +02:00
|
|
|
for (c = 0; c < ISAMEM_MAX; c++) {
|
|
|
|
|
sprintf(temp, "isamem%d_type", c);
|
|
|
|
|
if (isamem_type[c] == 0)
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, temp,
|
2018-09-06 14:38:43 +02:00
|
|
|
(char *) isamem_get_internal_name(isamem_type[c]));
|
2018-09-03 14:28:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isartc_type == 0)
|
|
|
|
|
config_delete_var(cat, "isartc_type");
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, "isartc_type",
|
|
|
|
|
isartc_get_internal_name(isartc_type));
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
delete_section_if_empty(cat);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
/* Save "Hard Disks" section. */
|
|
|
|
|
static void
|
|
|
|
|
save_hard_disks(void)
|
2017-05-17 21:56:31 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
char *cat = "Hard disks";
|
2020-01-15 04:58:28 +01:00
|
|
|
char temp[32], tmp2[512];
|
2017-10-07 00:46:54 -04:00
|
|
|
char *p;
|
|
|
|
|
int c;
|
|
|
|
|
|
|
|
|
|
memset(temp, 0x00, sizeof(temp));
|
|
|
|
|
for (c=0; c<HDD_NUM; c++) {
|
|
|
|
|
sprintf(temp, "hdd_%02i_parameters", c+1);
|
|
|
|
|
if (hdd_is_valid(c)) {
|
|
|
|
|
p = hdd_bus_to_string(hdd[c].bus, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
sprintf(tmp2, "%u, %u, %u, %i, %s",
|
2017-10-07 00:46:54 -04:00
|
|
|
hdd[c].spt, hdd[c].hpc, hdd[c].tracks, hdd[c].wp, p);
|
2017-10-13 18:26:25 -04:00
|
|
|
config_set_string(cat, temp, tmp2);
|
2017-10-07 00:46:54 -04:00
|
|
|
} else {
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "hdd_%02i_mfm_channel", c+1);
|
2017-10-08 21:49:59 +02:00
|
|
|
if (hdd_is_valid(c) && (hdd[c].bus == HDD_BUS_MFM))
|
2017-10-07 00:46:54 -04:00
|
|
|
config_set_int(cat, temp, hdd[c].mfm_channel);
|
|
|
|
|
else
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
sprintf(temp, "hdd_%02i_xta_channel", c+1);
|
|
|
|
|
if (hdd_is_valid(c) && (hdd[c].bus == HDD_BUS_XTA))
|
|
|
|
|
config_set_int(cat, temp, hdd[c].xta_channel);
|
2017-10-07 00:46:54 -04:00
|
|
|
else
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "hdd_%02i_esdi_channel", c+1);
|
2017-10-08 21:49:59 +02:00
|
|
|
if (hdd_is_valid(c) && (hdd[c].bus == HDD_BUS_ESDI))
|
2017-10-07 00:46:54 -04:00
|
|
|
config_set_int(cat, temp, hdd[c].esdi_channel);
|
2018-07-15 01:41:53 +02:00
|
|
|
else
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "hdd_%02i_ide_channel", c+1);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (! hdd_is_valid(c) || (hdd[c].bus != HDD_BUS_IDE)) {
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(tmp2, "%01u:%01u", hdd[c].ide_channel >> 1, hdd[c].ide_channel & 1);
|
|
|
|
|
config_set_string(cat, temp, tmp2);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
sprintf(temp, "hdd_%02i_scsi_id", c+1);
|
|
|
|
|
if (hdd_is_valid(c) && (hdd[c].bus == HDD_BUS_SCSI))
|
|
|
|
|
config_set_int(cat, temp, hdd[c].scsi_id);
|
|
|
|
|
else
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "hdd_%02i_fn", c+1);
|
2017-10-08 21:49:59 +02:00
|
|
|
if (hdd_is_valid(c) && (wcslen(hdd[c].fn) != 0))
|
2020-04-24 14:42:01 +02:00
|
|
|
if (!wcsnicmp(hdd[c].fn, usr_path, wcslen(usr_path)))
|
2020-04-24 13:33:56 +08:00
|
|
|
config_set_wstring(cat, temp, &hdd[c].fn[wcslen(usr_path)]);
|
|
|
|
|
else
|
|
|
|
|
config_set_wstring(cat, temp, hdd[c].fn);
|
2018-07-15 01:41:53 +02:00
|
|
|
else
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delete_section_if_empty(cat);
|
2017-05-08 04:54:17 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
/* Save "Floppy Drives" section. */
|
2017-09-23 21:12:26 -04:00
|
|
|
static void
|
2020-07-19 06:07:58 +02:00
|
|
|
save_floppy_and_cdrom_drives(void)
|
2017-05-08 04:54:17 +02:00
|
|
|
{
|
2020-07-19 06:07:58 +02:00
|
|
|
char *cat = "Floppy and CD-ROM drives";
|
|
|
|
|
char temp[512], tmp2[512];
|
2017-10-07 00:46:54 -04:00
|
|
|
int c;
|
|
|
|
|
|
|
|
|
|
for (c=0; c<FDD_NUM; c++) {
|
|
|
|
|
sprintf(temp, "fdd_%02i_type", c+1);
|
|
|
|
|
if (fdd_get_type(c) == ((c < 2) ? 2 : 0))
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
else
|
|
|
|
|
config_set_string(cat, temp,
|
|
|
|
|
fdd_get_internal_name(fdd_get_type(c)));
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "fdd_%02i_fn", c+1);
|
|
|
|
|
if (wcslen(floppyfns[c]) == 0) {
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
|
|
|
|
|
ui_writeprot[c] = 0;
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "fdd_%02i_writeprot", c+1);
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
|
|
|
|
config_set_wstring(cat, temp, floppyfns[c]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "fdd_%02i_writeprot", c+1);
|
|
|
|
|
if (ui_writeprot[c] == 0)
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, temp, ui_writeprot[c]);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "fdd_%02i_turbo", c+1);
|
|
|
|
|
if (fdd_get_turbo(c) == 0)
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, temp, fdd_get_turbo(c));
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "fdd_%02i_check_bpb", c+1);
|
|
|
|
|
if (fdd_get_check_bpb(c) == 1)
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
else
|
|
|
|
|
config_set_int(cat, temp, fdd_get_check_bpb(c));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (c=0; c<CDROM_NUM; c++) {
|
|
|
|
|
sprintf(temp, "cdrom_%02i_host_drive", c+1);
|
2018-10-17 05:29:48 +02:00
|
|
|
if ((cdrom[c].bus_type == 0) || (cdrom[c].host_drive != 200)) {
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
2018-10-17 05:29:48 +02:00
|
|
|
config_set_int(cat, temp, cdrom[c].host_drive);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
|
2018-03-07 20:06:08 +01:00
|
|
|
sprintf(temp, "cdrom_%02i_speed", c+1);
|
2018-10-17 05:29:48 +02:00
|
|
|
if ((cdrom[c].bus_type == 0) || (cdrom[c].speed == 8)) {
|
2018-03-07 20:06:08 +01:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
2018-10-17 05:29:48 +02:00
|
|
|
config_set_int(cat, temp, cdrom[c].speed);
|
2018-03-07 20:06:08 +01:00
|
|
|
}
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "cdrom_%02i_parameters", c+1);
|
2018-10-17 05:29:48 +02:00
|
|
|
if (cdrom[c].bus_type == 0) {
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
2018-10-17 05:29:48 +02:00
|
|
|
sprintf(tmp2, "%u, %s", cdrom[c].sound_on,
|
|
|
|
|
hdd_bus_to_string(cdrom[c].bus_type, 1));
|
2017-10-13 18:26:25 -04:00
|
|
|
config_set_string(cat, temp, tmp2);
|
2017-07-17 23:04:50 +09:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
sprintf(temp, "cdrom_%02i_ide_channel", c+1);
|
2018-10-17 05:29:48 +02:00
|
|
|
if (cdrom[c].bus_type != CDROM_BUS_ATAPI)
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
2018-04-25 23:51:13 +02:00
|
|
|
else {
|
2018-10-17 05:29:48 +02:00
|
|
|
sprintf(tmp2, "%01u:%01u", cdrom[c].ide_channel>>1,
|
|
|
|
|
cdrom[c].ide_channel & 1);
|
2017-10-13 18:26:25 -04:00
|
|
|
config_set_string(cat, temp, tmp2);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
2019-09-26 10:02:43 +02:00
|
|
|
|
|
|
|
|
sprintf(temp, "cdrom_%02i_scsi_id", c + 1);
|
2019-10-21 13:36:10 +02:00
|
|
|
if (cdrom[c].bus_type != CDROM_BUS_SCSI) {
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
2018-10-17 05:29:48 +02:00
|
|
|
config_set_int(cat, temp, cdrom[c].scsi_device_id);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "cdrom_%02i_image_path", c + 1);
|
2018-10-17 05:29:48 +02:00
|
|
|
if ((cdrom[c].bus_type == 0) ||
|
|
|
|
|
(wcslen(cdrom[c].image_path) == 0)) {
|
2017-10-07 00:46:54 -04:00
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
2018-10-17 05:29:48 +02:00
|
|
|
config_set_wstring(cat, temp, cdrom[c].image_path);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-19 06:07:58 +02:00
|
|
|
delete_section_if_empty(cat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Save "Other Removable Devices" section. */
|
|
|
|
|
static void
|
|
|
|
|
save_other_removable_devices(void)
|
|
|
|
|
{
|
|
|
|
|
char *cat = "Other removable devices";
|
|
|
|
|
char temp[512], tmp2[512];
|
|
|
|
|
int c;
|
|
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
for (c=0; c<ZIP_NUM; c++) {
|
|
|
|
|
sprintf(temp, "zip_%02i_parameters", c+1);
|
|
|
|
|
if (zip_drives[c].bus_type == 0) {
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
|
|
|
|
sprintf(tmp2, "%u, %s", zip_drives[c].is_250,
|
|
|
|
|
hdd_bus_to_string(zip_drives[c].bus_type, 1));
|
|
|
|
|
config_set_string(cat, temp, tmp2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "zip_%02i_ide_channel", c+1);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (zip_drives[c].bus_type != ZIP_BUS_ATAPI)
|
2018-01-26 22:17:09 +01:00
|
|
|
config_delete_var(cat, temp);
|
2018-04-25 23:51:13 +02:00
|
|
|
else {
|
2018-01-26 22:17:09 +01:00
|
|
|
sprintf(tmp2, "%01u:%01u", zip_drives[c].ide_channel>>1,
|
|
|
|
|
zip_drives[c].ide_channel & 1);
|
|
|
|
|
config_set_string(cat, temp, tmp2);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
sprintf(temp, "zip_%02i_scsi_id", c + 1);
|
2018-01-26 22:17:09 +01:00
|
|
|
if (zip_drives[c].bus_type != ZIP_BUS_SCSI) {
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
2018-07-15 01:41:53 +02:00
|
|
|
config_set_int(cat, temp, zip_drives[c].scsi_device_id);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "zip_%02i_image_path", c + 1);
|
|
|
|
|
if ((zip_drives[c].bus_type == 0) ||
|
|
|
|
|
(wcslen(zip_drives[c].image_path) == 0)) {
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
|
|
|
|
config_set_wstring(cat, temp, zip_drives[c].image_path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-01 19:04:53 +02:00
|
|
|
for (c=0; c<MO_NUM; c++) {
|
|
|
|
|
sprintf(temp, "mo_%02i_parameters", c+1);
|
|
|
|
|
if (mo_drives[c].bus_type == 0) {
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
|
|
|
|
sprintf(tmp2, "%u, %s", mo_drives[c].type,
|
|
|
|
|
hdd_bus_to_string(mo_drives[c].bus_type, 1));
|
|
|
|
|
config_set_string(cat, temp, tmp2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "mo_%02i_ide_channel", c+1);
|
|
|
|
|
if (mo_drives[c].bus_type != MO_BUS_ATAPI)
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
else {
|
|
|
|
|
sprintf(tmp2, "%01u:%01u", mo_drives[c].ide_channel>>1,
|
|
|
|
|
mo_drives[c].ide_channel & 1);
|
|
|
|
|
config_set_string(cat, temp, tmp2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "mo_%02i_scsi_id", c + 1);
|
|
|
|
|
if (mo_drives[c].bus_type != MO_BUS_SCSI) {
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
|
|
|
|
config_set_int(cat, temp, mo_drives[c].scsi_device_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "mo_%02i_image_path", c + 1);
|
|
|
|
|
if ((mo_drives[c].bus_type == 0) ||
|
|
|
|
|
(wcslen(mo_drives[c].image_path) == 0)) {
|
|
|
|
|
config_delete_var(cat, temp);
|
|
|
|
|
} else {
|
|
|
|
|
config_set_wstring(cat, temp, mo_drives[c].image_path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
delete_section_if_empty(cat);
|
2017-05-17 21:56:31 +02:00
|
|
|
}
|
2017-05-08 04:54:17 +02:00
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
void
|
|
|
|
|
config_save(void)
|
|
|
|
|
{
|
2018-01-26 22:17:09 +01:00
|
|
|
save_general(); /* General */
|
|
|
|
|
save_machine(); /* Machine */
|
|
|
|
|
save_video(); /* Video */
|
|
|
|
|
save_input_devices(); /* Input devices */
|
|
|
|
|
save_sound(); /* Sound */
|
|
|
|
|
save_network(); /* Network */
|
|
|
|
|
save_ports(); /* Ports (COM & LPT) */
|
2020-11-26 18:20:24 +01:00
|
|
|
save_storage_controllers(); /* Storage controllers */
|
2018-01-26 22:17:09 +01:00
|
|
|
save_hard_disks(); /* Hard disks */
|
2020-07-19 06:07:58 +02:00
|
|
|
save_floppy_and_cdrom_drives(); /* Floppy and CD-ROM drives */
|
2018-01-26 22:17:09 +01:00
|
|
|
save_other_removable_devices(); /* Other removable devices */
|
2020-11-26 18:20:24 +01:00
|
|
|
save_other_peripherals(); /* Other peripherals */
|
2017-10-07 00:46:54 -04:00
|
|
|
|
2017-12-04 11:59:26 -05:00
|
|
|
config_write(cfg_path);
|
2017-05-17 21:56:31 +02:00
|
|
|
}
|
2017-05-08 04:54:17 +02:00
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
void
|
|
|
|
|
config_dump(void)
|
2017-05-17 21:56:31 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *sec;
|
|
|
|
|
|
|
|
|
|
sec = (section_t *)config_head.next;
|
|
|
|
|
while (sec != NULL) {
|
|
|
|
|
entry_t *ent;
|
|
|
|
|
|
2019-03-20 02:42:55 +08:00
|
|
|
if (sec->name[0])
|
2018-05-21 19:04:05 +02:00
|
|
|
config_log("[%s]\n", sec->name);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
ent = (entry_t *)sec->entry_head.next;
|
|
|
|
|
while (ent != NULL) {
|
2018-05-21 19:04:05 +02:00
|
|
|
config_log("%s = %ls\n", ent->name, ent->wdata);
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
ent = (entry_t *)ent->list.next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sec = (section_t *)sec->list.next;
|
|
|
|
|
}
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-05-17 21:56:31 +02:00
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
void
|
|
|
|
|
config_delete_var(char *head, char *name)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
|
|
|
|
entry_t *entry;
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL) return;
|
|
|
|
|
|
|
|
|
|
entry = find_entry(section, name);
|
|
|
|
|
if (entry != NULL) {
|
2017-09-23 21:12:26 -04:00
|
|
|
list_delete(&entry->list, §ion->entry_head);
|
|
|
|
|
free(entry);
|
2017-10-07 00:46:54 -04:00
|
|
|
}
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
config_get_int(char *head, char *name, int def)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
|
|
|
|
entry_t *entry;
|
|
|
|
|
int value;
|
|
|
|
|
|
|
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
entry = find_entry(section, name);
|
|
|
|
|
if (entry == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
sscanf(entry->data, "%i", &value);
|
|
|
|
|
|
|
|
|
|
return(value);
|
2017-05-17 21:56:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2020-11-18 01:09:17 -03:00
|
|
|
double
|
|
|
|
|
config_get_double(char *head, char *name, double def)
|
|
|
|
|
{
|
|
|
|
|
section_t *section;
|
|
|
|
|
entry_t *entry;
|
|
|
|
|
double value;
|
|
|
|
|
|
|
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
entry = find_entry(section, name);
|
|
|
|
|
if (entry == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
sscanf(entry->data, "%lg", &value);
|
|
|
|
|
|
|
|
|
|
return(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
int
|
|
|
|
|
config_get_hex16(char *head, char *name, int def)
|
2017-05-17 21:56:31 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
|
|
|
|
entry_t *entry;
|
2018-04-25 23:51:13 +02:00
|
|
|
unsigned int value;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
entry = find_entry(section, name);
|
|
|
|
|
if (entry == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
sscanf(entry->data, "%04X", &value);
|
|
|
|
|
|
|
|
|
|
return(value);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-06-19 06:46:08 +02:00
|
|
|
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
int
|
|
|
|
|
config_get_hex20(char *head, char *name, int def)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
|
|
|
|
entry_t *entry;
|
2018-04-25 23:51:13 +02:00
|
|
|
unsigned int value;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
entry = find_entry(section, name);
|
|
|
|
|
if (entry == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
sscanf(entry->data, "%05X", &value);
|
|
|
|
|
|
|
|
|
|
return(value);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
int
|
|
|
|
|
config_get_mac(char *head, char *name, int def)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
|
|
|
|
entry_t *entry;
|
2018-04-25 23:51:13 +02:00
|
|
|
unsigned int val0 = 0, val1 = 0, val2 = 0;
|
2017-10-07 00:46:54 -04:00
|
|
|
|
|
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
entry = find_entry(section, name);
|
|
|
|
|
if (entry == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
sscanf(entry->data, "%02x:%02x:%02x", &val0, &val1, &val2);
|
|
|
|
|
|
|
|
|
|
return((val0 << 16) + (val1 << 8) + val2);
|
2017-05-17 21:56:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
char *
|
|
|
|
|
config_get_string(char *head, char *name, char *def)
|
2017-05-17 21:56:31 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
|
|
|
|
entry_t *entry;
|
|
|
|
|
|
|
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
entry = find_entry(section, name);
|
|
|
|
|
if (entry == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
return(entry->data);
|
2017-05-17 21:56:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
wchar_t *
|
|
|
|
|
config_get_wstring(char *head, char *name, wchar_t *def)
|
2017-09-02 23:39:26 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
|
|
|
|
entry_t *entry;
|
|
|
|
|
|
|
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
entry = find_entry(section, name);
|
|
|
|
|
if (entry == NULL)
|
|
|
|
|
return(def);
|
|
|
|
|
|
|
|
|
|
return(entry->wdata);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-09-02 23:39:26 +02:00
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
void
|
|
|
|
|
config_set_int(char *head, char *name, int val)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
2017-10-13 18:26:25 -04:00
|
|
|
entry_t *ent;
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
section = create_section(head);
|
2017-09-23 21:12:26 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
ent = find_entry(section, name);
|
|
|
|
|
if (ent == NULL)
|
|
|
|
|
ent = create_entry(section, name);
|
2017-09-02 23:39:26 +02:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(ent->data, "%i", val);
|
2020-01-15 05:24:33 +01:00
|
|
|
mbstowcs(ent->wdata, ent->data, 512);
|
2017-09-02 23:39:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-11-18 01:09:17 -03:00
|
|
|
void
|
|
|
|
|
config_set_double(char *head, char *name, double val)
|
|
|
|
|
{
|
|
|
|
|
section_t *section;
|
|
|
|
|
entry_t *ent;
|
|
|
|
|
|
|
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
section = create_section(head);
|
|
|
|
|
|
|
|
|
|
ent = find_entry(section, name);
|
|
|
|
|
if (ent == NULL)
|
|
|
|
|
ent = create_entry(section, name);
|
|
|
|
|
|
|
|
|
|
sprintf(ent->data, "%lg", val);
|
|
|
|
|
mbstowcs(ent->wdata, ent->data, 512);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
void
|
|
|
|
|
config_set_hex16(char *head, char *name, int val)
|
2017-05-17 21:56:31 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
2017-10-13 18:26:25 -04:00
|
|
|
entry_t *ent;
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
section = create_section(head);
|
2017-05-08 04:54:17 +02:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
ent = find_entry(section, name);
|
|
|
|
|
if (ent == NULL)
|
|
|
|
|
ent = create_entry(section, name);
|
2017-05-08 04:54:17 +02:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(ent->data, "%04X", val);
|
2020-01-15 02:15:42 +01:00
|
|
|
mbstowcs(ent->wdata, ent->data, sizeof_w(ent->wdata));
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
|
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
void
|
|
|
|
|
config_set_hex20(char *head, char *name, int val)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
2017-10-13 18:26:25 -04:00
|
|
|
entry_t *ent;
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
section = create_section(head);
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
ent = find_entry(section, name);
|
|
|
|
|
if (ent == NULL)
|
|
|
|
|
ent = create_entry(section, name);
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(ent->data, "%05X", val);
|
|
|
|
|
mbstowcs(ent->wdata, ent->data, sizeof_w(ent->wdata));
|
2017-05-17 21:56:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
void
|
|
|
|
|
config_set_mac(char *head, char *name, int val)
|
2017-05-17 21:56:31 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
2017-10-13 18:26:25 -04:00
|
|
|
entry_t *ent;
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
section = create_section(head);
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
ent = find_entry(section, name);
|
|
|
|
|
if (ent == NULL)
|
|
|
|
|
ent = create_entry(section, name);
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
sprintf(ent->data, "%02x:%02x:%02x",
|
2017-09-23 21:12:26 -04:00
|
|
|
(val>>16)&0xff, (val>>8)&0xff, val&0xff);
|
2020-01-15 04:58:28 +01:00
|
|
|
mbstowcs(ent->wdata, ent->data, 512);
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
void
|
|
|
|
|
config_set_string(char *head, char *name, char *val)
|
|
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
2017-10-13 18:26:25 -04:00
|
|
|
entry_t *ent;
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
section = create_section(head);
|
2017-05-17 21:56:31 +02:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
ent = find_entry(section, name);
|
|
|
|
|
if (ent == NULL)
|
|
|
|
|
ent = create_entry(section, name);
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
if ((strlen(val) + 1) <= sizeof(ent->data))
|
|
|
|
|
memcpy(ent->data, val, strlen(val) + 1);
|
|
|
|
|
else
|
|
|
|
|
memcpy(ent->data, val, sizeof(ent->data));
|
2020-01-15 02:12:29 +01:00
|
|
|
mbstowcs(ent->wdata, ent->data, sizeof_w(ent->wdata));
|
2017-05-17 21:56:31 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-18 01:57:16 -04:00
|
|
|
|
2017-09-23 21:12:26 -04:00
|
|
|
void
|
|
|
|
|
config_set_wstring(char *head, char *name, wchar_t *val)
|
2017-05-17 21:56:31 +02:00
|
|
|
{
|
2017-10-07 00:46:54 -04:00
|
|
|
section_t *section;
|
2017-10-13 18:26:25 -04:00
|
|
|
entry_t *ent;
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
section = find_section(head);
|
|
|
|
|
if (section == NULL)
|
|
|
|
|
section = create_section(head);
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
ent = find_entry(section, name);
|
|
|
|
|
if (ent == NULL)
|
|
|
|
|
ent = create_entry(section, name);
|
2017-05-27 03:53:32 +02:00
|
|
|
|
2017-10-13 18:26:25 -04:00
|
|
|
memcpy(ent->wdata, val, sizeof_w(ent->wdata));
|
|
|
|
|
wcstombs(ent->data, ent->wdata, sizeof(ent->data));
|
2017-09-23 21:12:26 -04:00
|
|
|
}
|