Merge branch 'master' of https://github.com/86Box/86Box
This commit is contained in:
175
src/config.c
175
src/config.c
@@ -25,6 +25,7 @@
|
||||
* it on Windows XP, and possibly also Vista. Use the
|
||||
* -DANSI_CFG for use on these systems.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
@@ -89,7 +90,8 @@ typedef struct {
|
||||
wchar_t wdata[512];
|
||||
} entry_t;
|
||||
|
||||
#define list_add(new, head) { \
|
||||
#define list_add(new, head) \
|
||||
{ \
|
||||
list_t *next = head; \
|
||||
\
|
||||
while (next->next != NULL) \
|
||||
@@ -99,7 +101,8 @@ typedef struct {
|
||||
(new)->next = NULL; \
|
||||
}
|
||||
|
||||
#define list_delete(old, head) { \
|
||||
#define list_delete(old, head) \
|
||||
{ \
|
||||
list_t *next = head; \
|
||||
\
|
||||
while ((next)->next != old) { \
|
||||
@@ -111,18 +114,15 @@ typedef struct {
|
||||
(head)->next = (old)->next; \
|
||||
}
|
||||
|
||||
|
||||
static list_t config_head;
|
||||
|
||||
/* TODO: Backwards compatibility, get rid of this when enough time has passed. */
|
||||
static int backwards_compat = 0;
|
||||
static int backwards_compat2 = 0;
|
||||
|
||||
|
||||
#ifdef ENABLE_CONFIG_LOG
|
||||
int config_do_log = ENABLE_CONFIG_LOG;
|
||||
|
||||
|
||||
static void
|
||||
config_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -138,7 +138,6 @@ config_log(const char *fmt, ...)
|
||||
# define config_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
static section_t *
|
||||
find_section(char *name)
|
||||
{
|
||||
@@ -159,14 +158,12 @@ find_section(char *name)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
config_find_section(char *name)
|
||||
{
|
||||
return (void *) find_section(name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_rename_section(void *priv, char *name)
|
||||
{
|
||||
@@ -176,7 +173,6 @@ config_rename_section(void *priv, char *name)
|
||||
memcpy(sec->name, name, MIN(128, strlen(name) + 1));
|
||||
}
|
||||
|
||||
|
||||
static entry_t *
|
||||
find_entry(section_t *section, char *name)
|
||||
{
|
||||
@@ -194,7 +190,6 @@ find_entry(section_t *section, char *name)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
entries_num(section_t *section)
|
||||
{
|
||||
@@ -204,7 +199,8 @@ entries_num(section_t *section)
|
||||
ent = (entry_t *) section->entry_head.next;
|
||||
|
||||
while (ent != NULL) {
|
||||
if (strlen(ent->name) > 0) i++;
|
||||
if (strlen(ent->name) > 0)
|
||||
i++;
|
||||
|
||||
ent = (entry_t *) ent->list.next;
|
||||
}
|
||||
@@ -212,14 +208,14 @@ entries_num(section_t *section)
|
||||
return (i);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
delete_section_if_empty(char *head)
|
||||
{
|
||||
section_t *section;
|
||||
|
||||
section = find_section(head);
|
||||
if (section == NULL) return;
|
||||
if (section == NULL)
|
||||
return;
|
||||
|
||||
if (entries_num(section) == 0) {
|
||||
list_delete(§ion->list, &config_head);
|
||||
@@ -227,7 +223,6 @@ delete_section_if_empty(char *head)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static section_t *
|
||||
create_section(char *name)
|
||||
{
|
||||
@@ -240,7 +235,6 @@ create_section(char *name)
|
||||
return (ns);
|
||||
}
|
||||
|
||||
|
||||
static entry_t *
|
||||
create_entry(section_t *section, char *name)
|
||||
{
|
||||
@@ -253,7 +247,6 @@ create_entry(section_t *section, char *name)
|
||||
return (ne);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static void
|
||||
config_free(void)
|
||||
@@ -290,10 +283,10 @@ config_detect_bom(char *fn)
|
||||
#else
|
||||
f = plat_fopen(fn, "rt, ccs=UTF-8");
|
||||
#endif
|
||||
if (f == NULL) return(0);
|
||||
if (f == NULL)
|
||||
return (0);
|
||||
fread(bom, 1, 3, f);
|
||||
if (bom[0] == 0xEF && bom[1] == 0xBB && bom[2] == 0xBF)
|
||||
{
|
||||
if (bom[0] == 0xEF && bom[1] == 0xBB && bom[2] == 0xBF) {
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
@@ -307,17 +300,21 @@ static wchar_t*
|
||||
config_fgetws(wchar_t *str, int count, FILE *stream)
|
||||
{
|
||||
int i = 0;
|
||||
if (feof(stream)) return NULL;
|
||||
if (feof(stream))
|
||||
return NULL;
|
||||
for (i = 0; i < count; i++) {
|
||||
wint_t curChar = fgetwc(stream);
|
||||
if (curChar == WEOF) {
|
||||
if (i + 1 < count) str[i + 1] = 0;
|
||||
if (i + 1 < count)
|
||||
str[i + 1] = 0;
|
||||
return feof(stream) ? str : NULL;
|
||||
}
|
||||
str[i] = curChar;
|
||||
if (curChar == '\n') break;
|
||||
if (curChar == '\n')
|
||||
break;
|
||||
}
|
||||
if (i + 1 < count) str[i + 1] = 0;
|
||||
if (i + 1 < count)
|
||||
str[i + 1] = 0;
|
||||
return str;
|
||||
}
|
||||
#endif
|
||||
@@ -339,7 +336,8 @@ config_read(char *fn)
|
||||
#else
|
||||
f = plat_fopen(fn, "rt, ccs=UTF-8");
|
||||
#endif
|
||||
if (f == NULL) return(0);
|
||||
if (f == NULL)
|
||||
return (0);
|
||||
|
||||
sec = malloc(sizeof(section_t));
|
||||
memset(sec, 0x00, sizeof(section_t));
|
||||
@@ -355,13 +353,16 @@ config_read(char *fn)
|
||||
#else
|
||||
fgetws(buff, sizeof_w(buff), f);
|
||||
#endif
|
||||
if (feof(f)) break;
|
||||
if (feof(f))
|
||||
break;
|
||||
|
||||
/* Make sure there are no stray newlines or hard-returns in there. */
|
||||
if (wcslen(buff) > 0)
|
||||
if (buff[wcslen(buff)-1] == L'\n') buff[wcslen(buff)-1] = L'\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';
|
||||
if (buff[wcslen(buff) - 1] == L'\r')
|
||||
buff[wcslen(buff) - 1] = L'\0';
|
||||
|
||||
/* Skip any leading whitespace. */
|
||||
c = 0;
|
||||
@@ -369,10 +370,12 @@ config_read(char *fn)
|
||||
c++;
|
||||
|
||||
/* Skip empty lines. */
|
||||
if (buff[c] == L'\0') continue;
|
||||
if (buff[c] == L'\0')
|
||||
continue;
|
||||
|
||||
/* Skip lines that (only) have a comment. */
|
||||
if ((buff[c] == L'#') || (buff[c] == L';')) continue;
|
||||
if ((buff[c] == L'#') || (buff[c] == L';'))
|
||||
continue;
|
||||
|
||||
if (buff[c] == L'[') { /*Section*/
|
||||
c++;
|
||||
@@ -382,7 +385,8 @@ config_read(char *fn)
|
||||
sname[d] = L'\0';
|
||||
|
||||
/* Is the section name properly terminated? */
|
||||
if (buff[c] != L']') continue;
|
||||
if (buff[c] != L']')
|
||||
continue;
|
||||
|
||||
/* Create a new section and insert it. */
|
||||
ns = malloc(sizeof(section_t));
|
||||
@@ -402,14 +406,16 @@ config_read(char *fn)
|
||||
ename[d] = L'\0';
|
||||
|
||||
/* Skip incomplete lines. */
|
||||
if (buff[c] == L'\0') continue;
|
||||
if (buff[c] == L'\0')
|
||||
continue;
|
||||
|
||||
/* Look for =, skip whitespace. */
|
||||
while ((buff[c] == L'=' || buff[c] == L' ') && buff[c])
|
||||
c++;
|
||||
|
||||
/* Skip incomplete lines. */
|
||||
if (buff[c] == L'\0') continue;
|
||||
if (buff[c] == L'\0')
|
||||
continue;
|
||||
|
||||
/* This is where the value part starts. */
|
||||
d = c;
|
||||
@@ -439,7 +445,6 @@ config_read(char *fn)
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Write the in-memory configuration to disk.
|
||||
* This is a public function, because the Settings UI
|
||||
@@ -459,7 +464,8 @@ config_write(char *fn)
|
||||
#else
|
||||
f = plat_fopen(fn, "wt, ccs=UTF-8");
|
||||
#endif
|
||||
if (f == NULL) return;
|
||||
if (f == NULL)
|
||||
return;
|
||||
|
||||
sec = (section_t *) config_head.next;
|
||||
while (sec != NULL) {
|
||||
@@ -494,7 +500,6 @@ config_write(char *fn)
|
||||
(void) fclose(f);
|
||||
}
|
||||
|
||||
|
||||
#if NOT_USED
|
||||
static void
|
||||
config_new(void)
|
||||
@@ -510,7 +515,6 @@ config_new(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Load "General" section. */
|
||||
static void
|
||||
load_general(void)
|
||||
@@ -610,7 +614,6 @@ load_general(void)
|
||||
strncpy(video_shader, config_get_string(cat, "video_gl_shader", ""), sizeof(video_shader));
|
||||
}
|
||||
|
||||
|
||||
/* Load "Machine" section. */
|
||||
static void
|
||||
load_machine(void)
|
||||
@@ -790,7 +793,8 @@ load_machine(void)
|
||||
if (cpu_legacy_table[c].machine) {
|
||||
/* Determine the amount of CPU entries on the table. */
|
||||
i = -1;
|
||||
while (cpu_legacy_table[c].tables[legacy_mfg][++i].family);
|
||||
while (cpu_legacy_table[c].tables[legacy_mfg][++i].family)
|
||||
;
|
||||
|
||||
/* If the CPU ID is out of bounds, reset to the last known ID. */
|
||||
if (legacy_cpu >= i)
|
||||
@@ -873,11 +877,9 @@ load_machine(void)
|
||||
if (p != NULL) {
|
||||
if (!strcmp(p, "disabled"))
|
||||
time_sync = TIME_SYNC_DISABLED;
|
||||
else
|
||||
if (!strcmp(p, "local"))
|
||||
else if (!strcmp(p, "local"))
|
||||
time_sync = TIME_SYNC_ENABLED;
|
||||
else
|
||||
if (!strcmp(p, "utc") || !strcmp(p, "gmt"))
|
||||
else if (!strcmp(p, "utc") || !strcmp(p, "gmt"))
|
||||
time_sync = TIME_SYNC_ENABLED | TIME_SYNC_UTC;
|
||||
else
|
||||
time_sync = TIME_SYNC_ENABLED;
|
||||
@@ -889,7 +891,6 @@ load_machine(void)
|
||||
config_delete_var(cat, "enable_sync");
|
||||
}
|
||||
|
||||
|
||||
/* Load "Video" section. */
|
||||
static void
|
||||
load_video(void)
|
||||
@@ -926,11 +927,11 @@ load_video(void)
|
||||
xga_enabled = !!config_get_int(cat, "xga", 0);
|
||||
show_second_monitors = !!config_get_int(cat, "show_second_monitors", 1);
|
||||
p = config_get_string(cat, "gfxcard_2", NULL);
|
||||
if (!p) p = "none";
|
||||
if (!p)
|
||||
p = "none";
|
||||
gfxcard_2 = video_get_video_from_internal_name(p);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
load_monitor(int monitor_index)
|
||||
{
|
||||
@@ -944,8 +945,10 @@ load_monitor(int monitor_index)
|
||||
config_delete_var("General", "window_coordinates");
|
||||
}
|
||||
snprintf(monitor_config_name, sizeof(monitor_config_name), "Monitor #%i", monitor_index + 1);
|
||||
if (!ptr) ptr = config_get_string(monitor_config_name, "window_coordinates", "0, 0, 0, 0");
|
||||
if (window_remember || (vid_resize & 2)) sscanf(ptr, "%i, %i, %i, %i",
|
||||
if (!ptr)
|
||||
ptr = config_get_string(monitor_config_name, "window_coordinates", "0, 0, 0, 0");
|
||||
if (window_remember || (vid_resize & 2))
|
||||
sscanf(ptr, "%i, %i, %i, %i",
|
||||
&monitor_settings[monitor_index].mon_window_x, &monitor_settings[monitor_index].mon_window_y,
|
||||
&monitor_settings[monitor_index].mon_window_w, &monitor_settings[monitor_index].mon_window_h);
|
||||
}
|
||||
@@ -960,15 +963,15 @@ save_monitor(int monitor_index)
|
||||
if (!(monitor_settings[monitor_index].mon_window_x == 0
|
||||
&& monitor_settings[monitor_index].mon_window_y == 0
|
||||
&& monitor_settings[monitor_index].mon_window_w == 0
|
||||
&& monitor_settings[monitor_index].mon_window_h == 0) && (window_remember || (vid_resize & 2))) {
|
||||
&& monitor_settings[monitor_index].mon_window_h == 0)
|
||||
&& (window_remember || (vid_resize & 2))) {
|
||||
snprintf(saved_coordinates, sizeof(saved_coordinates), "%i, %i, %i, %i", monitor_settings[monitor_index].mon_window_x, monitor_settings[monitor_index].mon_window_y,
|
||||
monitor_settings[monitor_index].mon_window_w, monitor_settings[monitor_index].mon_window_h);
|
||||
|
||||
config_set_string(monitor_config_name, "window_coordinates", saved_coordinates);
|
||||
} else
|
||||
config_delete_var(monitor_config_name, "window_coordinates");
|
||||
}
|
||||
else config_delete_var(monitor_config_name, "window_coordinates");
|
||||
}
|
||||
|
||||
|
||||
/* Load "Input Devices" section. */
|
||||
static void
|
||||
@@ -1060,7 +1063,6 @@ load_input_devices(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Load "Sound" section. */
|
||||
static void
|
||||
load_sound(void)
|
||||
@@ -1108,7 +1110,6 @@ load_sound(void)
|
||||
sound_is_float = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Load "Network" section. */
|
||||
static void
|
||||
load_network(void)
|
||||
@@ -1120,8 +1121,7 @@ load_network(void)
|
||||
if (p != NULL) {
|
||||
if (!strcmp(p, "pcap") || !strcmp(p, "1"))
|
||||
network_type = NET_TYPE_PCAP;
|
||||
else
|
||||
if (!strcmp(p, "slirp") || !strcmp(p, "2"))
|
||||
else if (!strcmp(p, "slirp") || !strcmp(p, "2"))
|
||||
network_type = NET_TYPE_SLIRP;
|
||||
else
|
||||
network_type = NET_TYPE_NONE;
|
||||
@@ -1157,7 +1157,6 @@ load_network(void)
|
||||
network_card = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Load "Ports" section. */
|
||||
static void
|
||||
load_ports(void)
|
||||
@@ -1196,7 +1195,6 @@ load_ports(void)
|
||||
config_delete_var(cat, "lpt_enabled");
|
||||
}
|
||||
|
||||
|
||||
/* Load "Storage Controllers" section. */
|
||||
static void
|
||||
load_storage_controllers(void)
|
||||
@@ -1311,7 +1309,6 @@ load_storage_controllers(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Load "Hard Disks" section. */
|
||||
static void
|
||||
load_hard_disks(void)
|
||||
@@ -1511,7 +1508,6 @@ load_hard_disks(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* TODO: Backwards compatibility, get rid of this when enough time has passed. */
|
||||
/* Load "Floppy Drives" section. */
|
||||
static void
|
||||
@@ -1574,7 +1570,6 @@ load_floppy_drives(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Load "Floppy and CD-ROM Drives" section. */
|
||||
static void
|
||||
load_floppy_and_cdrom_drives(void)
|
||||
@@ -1745,8 +1740,7 @@ load_floppy_and_cdrom_drives(void)
|
||||
if (cdrom[c].host_drive && (cdrom[c].host_drive != 200))
|
||||
cdrom[c].host_drive = 0;
|
||||
|
||||
if ((cdrom[c].host_drive == 0x200) &&
|
||||
(strlen(cdrom[c].image_path) == 0))
|
||||
if ((cdrom[c].host_drive == 0x200) && (strlen(cdrom[c].image_path) == 0))
|
||||
cdrom[c].host_drive = 0;
|
||||
|
||||
/* If the CD-ROM is disabled, delete all its variables. */
|
||||
@@ -1772,7 +1766,6 @@ load_floppy_and_cdrom_drives(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Load "Other Removable Devices" section. */
|
||||
static void
|
||||
load_other_removable_devices(void)
|
||||
@@ -1859,8 +1852,7 @@ load_other_removable_devices(void)
|
||||
if (cdrom[c].host_drive && (cdrom[c].host_drive != 200))
|
||||
cdrom[c].host_drive = 0;
|
||||
|
||||
if ((cdrom[c].host_drive == 0x200) &&
|
||||
(strlen(cdrom[c].image_path) == 0))
|
||||
if ((cdrom[c].host_drive == 0x200) && (strlen(cdrom[c].image_path) == 0))
|
||||
cdrom[c].host_drive = 0;
|
||||
}
|
||||
}
|
||||
@@ -2050,7 +2042,6 @@ load_other_removable_devices(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Load "Other Peripherals" section. */
|
||||
static void
|
||||
load_other_peripherals(void)
|
||||
@@ -2126,7 +2117,6 @@ load_other_peripherals(void)
|
||||
isartc_type = isartc_get_from_internal_name(p);
|
||||
}
|
||||
|
||||
|
||||
/* Load the specified or a default configuration file. */
|
||||
void
|
||||
config_load(void)
|
||||
@@ -2228,7 +2218,6 @@ config_load(void)
|
||||
video_copy = (video_grayscale || invert_display) ? video_transform_copy : memcpy;
|
||||
}
|
||||
|
||||
|
||||
/* Save "General" section. */
|
||||
static void
|
||||
save_general(void)
|
||||
@@ -2395,7 +2384,6 @@ save_general(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Save "Machine" section. */
|
||||
static void
|
||||
save_machine(void)
|
||||
@@ -2439,12 +2427,10 @@ save_machine(void)
|
||||
|
||||
/* 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 */
|
||||
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 */
|
||||
} else if ((legacy_table_entry->rspeed >= cpu_f->cpus[cpu].rspeed) && (closest_legacy_cpu == -1)) { /* closest speed match */
|
||||
closest_legacy_cpu = i;
|
||||
}
|
||||
}
|
||||
@@ -2496,7 +2482,6 @@ save_machine(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Save "Video" section. */
|
||||
static void
|
||||
save_video(void)
|
||||
@@ -2534,7 +2519,6 @@ save_video(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Save "Input Devices" section. */
|
||||
static void
|
||||
save_input_devices(void)
|
||||
@@ -2593,7 +2577,6 @@ save_input_devices(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Save "Sound" section. */
|
||||
static void
|
||||
save_sound(void)
|
||||
@@ -2643,7 +2626,6 @@ save_sound(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Save "Network" section. */
|
||||
static void
|
||||
save_network(void)
|
||||
@@ -2675,7 +2657,6 @@ save_network(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Save "Ports" section. */
|
||||
static void
|
||||
save_ports(void)
|
||||
@@ -2726,7 +2707,6 @@ save_ports(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Save "Storage Controllers" section. */
|
||||
static void
|
||||
save_storage_controllers(void)
|
||||
@@ -2817,7 +2797,6 @@ save_storage_controllers(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Save "Other Peripherals" section. */
|
||||
static void
|
||||
save_other_peripherals(void)
|
||||
@@ -2854,7 +2833,6 @@ save_other_peripherals(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Save "Hard Disks" section. */
|
||||
static void
|
||||
save_hard_disks(void)
|
||||
@@ -2921,8 +2899,7 @@ save_hard_disks(void)
|
||||
config_set_string(cat, temp, &hdd[c].fn[strlen(usr_path)]);
|
||||
else
|
||||
config_set_string(cat, temp, hdd[c].fn);
|
||||
}
|
||||
else
|
||||
} else
|
||||
config_delete_var(cat, temp);
|
||||
|
||||
sprintf(temp, "hdd_%02i_speed", c + 1);
|
||||
@@ -2930,13 +2907,11 @@ save_hard_disks(void)
|
||||
config_delete_var(cat, temp);
|
||||
else
|
||||
config_set_string(cat, temp, hdd_preset_get_internal_name(hdd[c].speed_preset));
|
||||
|
||||
}
|
||||
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Save "Floppy Drives" section. */
|
||||
static void
|
||||
save_floppy_and_cdrom_drives(void)
|
||||
@@ -3030,8 +3005,7 @@ save_floppy_and_cdrom_drives(void)
|
||||
}
|
||||
|
||||
sprintf(temp, "cdrom_%02i_image_path", c + 1);
|
||||
if ((cdrom[c].bus_type == 0) ||
|
||||
(strlen(cdrom[c].image_path) == 0)) {
|
||||
if ((cdrom[c].bus_type == 0) || (strlen(cdrom[c].image_path) == 0)) {
|
||||
config_delete_var(cat, temp);
|
||||
} else {
|
||||
config_set_string(cat, temp, cdrom[c].image_path);
|
||||
@@ -3041,7 +3015,6 @@ save_floppy_and_cdrom_drives(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
/* Save "Other Removable Devices" section. */
|
||||
static void
|
||||
save_other_removable_devices(void)
|
||||
@@ -3082,8 +3055,7 @@ save_other_removable_devices(void)
|
||||
}
|
||||
|
||||
sprintf(temp, "zip_%02i_image_path", c + 1);
|
||||
if ((zip_drives[c].bus_type == 0) ||
|
||||
(strlen(zip_drives[c].image_path) == 0)) {
|
||||
if ((zip_drives[c].bus_type == 0) || (strlen(zip_drives[c].image_path) == 0)) {
|
||||
config_delete_var(cat, temp);
|
||||
} else {
|
||||
config_set_string(cat, temp, zip_drives[c].image_path);
|
||||
@@ -3122,8 +3094,7 @@ save_other_removable_devices(void)
|
||||
}
|
||||
|
||||
sprintf(temp, "mo_%02i_image_path", c + 1);
|
||||
if ((mo_drives[c].bus_type == 0) ||
|
||||
(strlen(mo_drives[c].image_path) == 0)) {
|
||||
if ((mo_drives[c].bus_type == 0) || (strlen(mo_drives[c].image_path) == 0)) {
|
||||
config_delete_var(cat, temp);
|
||||
} else {
|
||||
config_set_string(cat, temp, mo_drives[c].image_path);
|
||||
@@ -3133,7 +3104,6 @@ save_other_removable_devices(void)
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_save(void)
|
||||
{
|
||||
@@ -3157,7 +3127,6 @@ config_save(void)
|
||||
config_write(cfg_path);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_dump(void)
|
||||
{
|
||||
@@ -3181,7 +3150,6 @@ config_dump(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_delete_var(char *head, char *name)
|
||||
{
|
||||
@@ -3189,7 +3157,8 @@ config_delete_var(char *head, char *name)
|
||||
entry_t *entry;
|
||||
|
||||
section = find_section(head);
|
||||
if (section == NULL) return;
|
||||
if (section == NULL)
|
||||
return;
|
||||
|
||||
entry = find_entry(section, name);
|
||||
if (entry != NULL) {
|
||||
@@ -3198,7 +3167,6 @@ config_delete_var(char *head, char *name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
config_get_int(char *head, char *name, int def)
|
||||
{
|
||||
@@ -3219,7 +3187,6 @@ config_get_int(char *head, char *name, int def)
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
||||
double
|
||||
config_get_double(char *head, char *name, double def)
|
||||
{
|
||||
@@ -3240,7 +3207,6 @@ config_get_double(char *head, char *name, double def)
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
config_get_hex16(char *head, char *name, int def)
|
||||
{
|
||||
@@ -3261,7 +3227,6 @@ config_get_hex16(char *head, char *name, int def)
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
config_get_hex20(char *head, char *name, int def)
|
||||
{
|
||||
@@ -3282,7 +3247,6 @@ config_get_hex20(char *head, char *name, int def)
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
config_get_mac(char *head, char *name, int def)
|
||||
{
|
||||
@@ -3303,7 +3267,6 @@ config_get_mac(char *head, char *name, int def)
|
||||
return ((val0 << 16) + (val1 << 8) + val2);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
config_get_string(char *head, char *name, char *def)
|
||||
{
|
||||
@@ -3321,7 +3284,6 @@ config_get_string(char *head, char *name, char *def)
|
||||
return (entry->data);
|
||||
}
|
||||
|
||||
|
||||
wchar_t *
|
||||
config_get_wstring(char *head, char *name, wchar_t *def)
|
||||
{
|
||||
@@ -3339,7 +3301,6 @@ config_get_wstring(char *head, char *name, wchar_t *def)
|
||||
return (entry->wdata);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_set_int(char *head, char *name, int val)
|
||||
{
|
||||
@@ -3358,7 +3319,6 @@ config_set_int(char *head, char *name, int val)
|
||||
mbstowcs(ent->wdata, ent->data, 512);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_set_double(char *head, char *name, double val)
|
||||
{
|
||||
@@ -3377,7 +3337,6 @@ config_set_double(char *head, char *name, double val)
|
||||
mbstowcs(ent->wdata, ent->data, 512);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_set_hex16(char *head, char *name, int val)
|
||||
{
|
||||
@@ -3396,7 +3355,6 @@ config_set_hex16(char *head, char *name, int val)
|
||||
mbstowcs(ent->wdata, ent->data, sizeof_w(ent->wdata));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_set_hex20(char *head, char *name, int val)
|
||||
{
|
||||
@@ -3415,7 +3373,6 @@ config_set_hex20(char *head, char *name, int val)
|
||||
mbstowcs(ent->wdata, ent->data, sizeof_w(ent->wdata));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_set_mac(char *head, char *name, int val)
|
||||
{
|
||||
@@ -3435,7 +3392,6 @@ config_set_mac(char *head, char *name, int val)
|
||||
mbstowcs(ent->wdata, ent->data, 512);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_set_string(char *head, char *name, char *val)
|
||||
{
|
||||
@@ -3461,7 +3417,6 @@ config_set_string(char *head, char *name, char *val)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
config_set_wstring(char *head, char *name, wchar_t *val)
|
||||
{
|
||||
|
@@ -344,15 +344,6 @@ extern int machine_ppc512_init(const machine_t *);
|
||||
extern int machine_pc2086_init(const machine_t *);
|
||||
extern int machine_pc3086_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *pc1512_get_device(void);
|
||||
extern const device_t *pc1640_get_device(void);
|
||||
extern const device_t *pc200_get_device(void);
|
||||
extern const device_t *ppc512_get_device(void);
|
||||
extern const device_t *pc2086_get_device(void);
|
||||
extern const device_t *pc3086_get_device(void);
|
||||
#endif
|
||||
|
||||
/* m_at.c */
|
||||
extern void machine_at_common_init_ex(const machine_t *, int type);
|
||||
extern void machine_at_common_init(const machine_t *);
|
||||
@@ -425,14 +416,6 @@ extern int machine_at_awardsx_init(const machine_t *);
|
||||
|
||||
extern int machine_at_pc916sx_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *at_ama932j_get_device(void);
|
||||
extern const device_t *at_flytech386_get_device(void);
|
||||
extern const device_t *at_cmdsl386sx25_get_device(void);
|
||||
extern const device_t *at_spc4620p_get_device(void);
|
||||
extern const device_t *at_spc6033p_get_device(void);
|
||||
#endif
|
||||
|
||||
/* m_at_386dx_486.c */
|
||||
extern int machine_at_acc386_init(const machine_t *);
|
||||
extern int machine_at_asus386_init(const machine_t *);
|
||||
@@ -516,15 +499,6 @@ extern int machine_at_actionpc2600_init(const machine_t *);
|
||||
extern int machine_at_m919_init(const machine_t *);
|
||||
extern int machine_at_spc7700plw_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *at_acera1g_get_device(void);
|
||||
extern const device_t *at_vect486vl_get_device(void);
|
||||
extern const device_t *at_d824_get_device(void);
|
||||
extern const device_t *at_pcs46c_get_device(void);
|
||||
extern const device_t *at_valuepoint433_get_device(void);
|
||||
extern const device_t *at_sbc490_get_device(void);
|
||||
#endif
|
||||
|
||||
/* m_at_commodore.c */
|
||||
extern int machine_at_cmdpc_init(const machine_t *);
|
||||
|
||||
@@ -535,9 +509,6 @@ extern int machine_at_portableiii386_init(const machine_t *);
|
||||
#if defined(DEV_BRANCH) && defined(USE_DESKPRO386)
|
||||
extern int machine_at_deskpro386_init(const machine_t *);
|
||||
#endif
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *at_cpqiii_get_device(void);
|
||||
#endif
|
||||
|
||||
/* m_at_socket4.c */
|
||||
extern void machine_at_premiere_common_init(const machine_t *, int);
|
||||
@@ -562,10 +533,6 @@ extern int machine_at_p5vl_init(const machine_t *);
|
||||
extern int machine_at_excaliburpci2_init(const machine_t *);
|
||||
extern int machine_at_p5sp4_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *at_pb520r_get_device(void);
|
||||
#endif
|
||||
|
||||
/* m_at_socket5.c */
|
||||
extern int machine_at_plato_init(const machine_t *);
|
||||
extern int machine_at_ambradp90_init(const machine_t *);
|
||||
@@ -609,14 +576,6 @@ extern int machine_at_gw2kte_init(const machine_t *);
|
||||
extern int machine_at_ap5s_init(const machine_t *);
|
||||
extern int machine_at_vectra54_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *at_endeavor_get_device(void);
|
||||
#define at_vectra54_get_device at_endeavor_get_device
|
||||
extern const device_t *at_thor_get_device(void);
|
||||
#define at_mrthor_get_device at_thor_get_device
|
||||
extern const device_t *at_pb640_get_device(void);
|
||||
#endif
|
||||
|
||||
/* m_at_socket7.c */
|
||||
extern int machine_at_acerv35n_init(const machine_t *);
|
||||
extern int machine_at_p55t2p4_init(const machine_t *);
|
||||
@@ -658,11 +617,6 @@ extern int machine_at_ms5146_init(const machine_t *);
|
||||
extern int machine_at_m560_init(const machine_t *);
|
||||
extern int machine_at_ms5164_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *at_presario2240_get_device(void);
|
||||
#define at_presario4500_get_device at_presario2240_get_device
|
||||
#endif
|
||||
|
||||
/* m_at_sockets7.c */
|
||||
extern int machine_at_p5a_init(const machine_t *);
|
||||
extern int machine_at_m579_init(const machine_t *);
|
||||
@@ -718,14 +672,6 @@ extern int machine_at_vei8_init(const machine_t *);
|
||||
extern int machine_at_borapro_init(const machine_t *);
|
||||
extern int machine_at_ms6168_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *at_s1846_get_device(void);
|
||||
#define at_s1857_get_device at_s1846_get_device
|
||||
#define at_gt694va_get_device at_s1846_get_device
|
||||
extern const device_t *at_ms6168_get_device(void);
|
||||
#define at_borapro_get_device at_ms6168_get_device
|
||||
#endif
|
||||
|
||||
/* m_at_slot2.c */
|
||||
extern int machine_at_6gxu_init(const machine_t *);
|
||||
extern int machine_at_s2dge_init(const machine_t *);
|
||||
@@ -743,9 +689,6 @@ extern int machine_at_s370sba_init(const machine_t *);
|
||||
extern int machine_at_apas3_init(const machine_t *);
|
||||
extern int machine_at_gt694va_init(const machine_t *);
|
||||
extern int machine_at_cuv4xls_init(const machine_t *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *at_cuv4xls_get_device(void);
|
||||
#endif
|
||||
extern int machine_at_6via90ap_init(const machine_t *);
|
||||
extern int machine_at_s1857_init(const machine_t *);
|
||||
extern int machine_at_p6bap_init(const machine_t *);
|
||||
@@ -764,22 +707,12 @@ extern const device_t europc_device;
|
||||
|
||||
/* m_xt_olivetti.c */
|
||||
extern int machine_xt_m24_init(const machine_t *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *m24_get_device(void);
|
||||
#endif
|
||||
extern int machine_xt_m240_init(const machine_t *);
|
||||
extern int machine_xt_m19_init(const machine_t *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *m19_get_device(void);
|
||||
#endif
|
||||
|
||||
/* m_pcjr.c */
|
||||
extern int machine_pcjr_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *pcjr_get_device(void);
|
||||
#endif
|
||||
|
||||
/* m_ps1.c */
|
||||
extern int machine_ps1_m2011_init(const machine_t *);
|
||||
extern int machine_ps1_m2121_init(const machine_t *);
|
||||
@@ -811,12 +744,6 @@ extern int machine_tandy1000sl2_init(const machine_t *);
|
||||
/* m_v86p.c */
|
||||
extern int machine_v86p_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *tandy1k_get_device(void);
|
||||
extern const device_t *tandy1k_hx_get_device(void);
|
||||
extern const device_t *tandy1k_sl_get_device(void);
|
||||
#endif
|
||||
|
||||
/* m_xt.c */
|
||||
extern int machine_pc_init(const machine_t *);
|
||||
extern int machine_pc82_init(const machine_t *);
|
||||
@@ -866,24 +793,13 @@ extern int machine_xt_p3120_init(const machine_t *);
|
||||
extern int machine_xt_t1000_init(const machine_t *);
|
||||
extern int machine_xt_t1200_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *t1000_get_device(void);
|
||||
extern const device_t *t1200_get_device(void);
|
||||
#endif
|
||||
|
||||
/* m_xt_zenith.c */
|
||||
extern int machine_xt_z184_init(const machine_t *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *z184_get_device(void);
|
||||
#endif
|
||||
extern int machine_xt_z151_init(const machine_t *);
|
||||
extern int machine_xt_z159_init(const machine_t *);
|
||||
|
||||
/* m_xt_xi8088.c */
|
||||
extern int machine_xt_xi8088_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *xi8088_get_device(void);
|
||||
#endif
|
||||
|
||||
#endif /*EMU_MACHINE_H*/
|
||||
|
@@ -61,7 +61,6 @@ static uint16_t smi_irq_mask = 0x0000,
|
||||
static void (*update_pending)(void);
|
||||
|
||||
|
||||
|
||||
#ifdef ENABLE_PIC_LOG
|
||||
int pic_do_log = ENABLE_PIC_LOG;
|
||||
|
||||
|
@@ -48,14 +48,12 @@ static RtMidiIn * midiin = nullptr;
|
||||
static int midi_out_id = 0, midi_in_id = 0;
|
||||
static const int midi_lengths[8] = { 3, 3, 3, 3, 2, 2, 3, 1 };
|
||||
|
||||
|
||||
int
|
||||
rtmidi_write(uint8_t val)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_play_msg(uint8_t *msg)
|
||||
{
|
||||
@@ -63,7 +61,6 @@ rtmidi_play_msg(uint8_t *msg)
|
||||
midiout->sendMessage(msg, midi_lengths[(msg[0] >> 4) & 7]);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_play_sysex(uint8_t *sysex, unsigned int len)
|
||||
{
|
||||
@@ -71,7 +68,6 @@ rtmidi_play_sysex(uint8_t *sysex, unsigned int len)
|
||||
midiout->sendMessage(sysex, len);
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
rtmidi_output_init(const device_t *info)
|
||||
{
|
||||
@@ -83,7 +79,8 @@ rtmidi_output_init(const device_t *info)
|
||||
dev->write = rtmidi_write;
|
||||
|
||||
try {
|
||||
if (!midiout) midiout = new RtMidiOut;
|
||||
if (!midiout)
|
||||
midiout = new RtMidiOut;
|
||||
} catch (RtMidiError &error) {
|
||||
pclog("Failed to initialize MIDI output: %s\n", error.getMessage().c_str());
|
||||
return nullptr;
|
||||
@@ -111,7 +108,6 @@ rtmidi_output_init(const device_t *info)
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_output_close(void *p)
|
||||
{
|
||||
@@ -126,7 +122,6 @@ rtmidi_output_close(void *p)
|
||||
midi_out_close();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rtmidi_out_get_num_devs(void)
|
||||
{
|
||||
@@ -141,14 +136,12 @@ rtmidi_out_get_num_devs(void)
|
||||
return midiout ? midiout->getPortCount() : 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_out_get_dev_name(int num, char *s)
|
||||
{
|
||||
strcpy(s, midiout->getPortName(num).c_str());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_input_callback(double timeStamp, std::vector<unsigned char> *message, void *userData)
|
||||
{
|
||||
@@ -158,7 +151,6 @@ rtmidi_input_callback(double timeStamp, std::vector<unsigned char> *message, voi
|
||||
midi_in_msg(message->data(), message->size());
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
rtmidi_input_init(const device_t *info)
|
||||
{
|
||||
@@ -204,7 +196,6 @@ rtmidi_input_init(const device_t *info)
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_input_close(void *p)
|
||||
{
|
||||
@@ -217,7 +208,6 @@ rtmidi_input_close(void* p)
|
||||
midi_out_close();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rtmidi_in_get_num_devs(void)
|
||||
{
|
||||
@@ -232,7 +222,6 @@ rtmidi_in_get_num_devs(void)
|
||||
return midiin ? midiin->getPortCount() : 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rtmidi_in_get_dev_name(int num, char *s)
|
||||
{
|
||||
@@ -240,6 +229,7 @@ rtmidi_in_get_dev_name(int num, char *s)
|
||||
}
|
||||
|
||||
static const device_config_t system_midi_config[] = {
|
||||
// clang-format off
|
||||
{
|
||||
.name = "midi",
|
||||
.description = "MIDI out device",
|
||||
@@ -248,9 +238,11 @@ static const device_config_t system_midi_config[] = {
|
||||
.default_int = 0
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static const device_config_t midi_input_config[] = {
|
||||
// clang-format off
|
||||
{
|
||||
.name = "midi_input",
|
||||
.description = "MIDI in device",
|
||||
@@ -280,6 +272,7 @@ static const device_config_t midi_input_config[] = {
|
||||
.default_int = 1
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
const device_t rtmidi_output_device = {
|
||||
@@ -309,5 +302,4 @@ const device_t rtmidi_input_device = {
|
||||
.force_redraw = NULL,
|
||||
.config = midi_input_config
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -31,6 +31,9 @@ ifeq ($(DEV_BUILD), y)
|
||||
ifndef DEBUG
|
||||
DEBUG := y
|
||||
endif
|
||||
ifndef GDBSTUB
|
||||
GDBSTUB := n
|
||||
endif
|
||||
ifndef DEV_BRANCH
|
||||
DEV_BRANCH := y
|
||||
endif
|
||||
@@ -92,6 +95,9 @@ else
|
||||
ifndef DEBUG
|
||||
DEBUG := n
|
||||
endif
|
||||
ifndef GDBSTUB
|
||||
GDBSTUB := n
|
||||
endif
|
||||
ifndef DEV_BRANCH
|
||||
DEV_BRANCH := n
|
||||
endif
|
||||
@@ -506,6 +512,10 @@ OPTS += -DUSE_OLIVETTI
|
||||
DEVBROBJ += olivetti_eva.o
|
||||
endif
|
||||
|
||||
ifeq ($(GDBSTUB), y)
|
||||
OPTS += -DUSE_GDBSTUB
|
||||
DEVBROBJ += gdbstub.o
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
Reference in New Issue
Block a user