--- uae/src/cfgfile.c 2018/04/24 17:18:31 1.1.1.18 +++ uae/src/cfgfile.c 2018/04/24 17:22:00 1.1.1.20 @@ -26,6 +26,8 @@ #define cfgfile_write fprintf +static int config_newfilesystem; + /* @@@ need to get rid of this... just cut part of the manual and print that * as a help text. */ struct cfg_lines @@ -117,7 +119,7 @@ static const char *soundmode[] = { "none static const char *centermode1[] = { "none", "simple", "smart", 0 }; static const char *centermode2[] = { "false", "true", "smart", 0 }; static const char *stereomode[] = { "mono", "stereo", "mixed", 0 }; -static const char *interpolmode[] = { "none", "rh", "crux", "sinc", "anti", 0 }; +static const char *interpolmode[] = { "none", "sinc", "anti", 0 }; static const char *soundfiltermode1[] = { "off", "emulated", "on", 0 }; static const char *soundfiltermode2[] = { "standard", "enhanced", 0 }; static const char *collmode[] = { "none", "sprites", "playfields", "full", 0 }; @@ -399,6 +401,36 @@ static int getintval (char **p, int *res return 1; } +static int getintval2 (char **p, int *result, int delim) +{ + char *value = *p; + int base = 10; + char *endptr; + char *p2 = strchr (*p, delim); + + if (p2 == 0) { + p2 = strchr (*p, 0); + if (p2 == 0) { + *p = 0; + return 0; + } + } + if (*p2 != 0) + *p2++ = '\0'; + + if (value[0] == '0' && value[1] == 'x') + value += 2, base = 16; + *result = strtol (value, &endptr, base); + *p = p2; + + if (*endptr != '\0' || *value == '\0') { + *p = 0; + return 0; + } + + return 1; +} + static void set_chipset_mask (struct uae_prefs *p, int val) { p->chipset_mask = (val == 0 ? 0 @@ -550,6 +582,12 @@ static int cfgfile_parse_host (struct ua /* Tricky ones... */ if (cfgfile_strval (option, value, "sound_channels", &p->sound_stereo, stereomode, 1)) { + if (p->sound_stereo == SND_MONO) { + write_log ("Mono sound no longer supported, switching to stereo.\n"); + p->sound_stereo = SND_STEREO; + p->sound_mixed_stereo_delay = 0; + p->sound_stereo_separation = 15; + } if (p->sound_stereo == SND_NONE) { /* "mixed stereo" compatibility hack */ p->sound_stereo = SND_STEREO; p->sound_mixed_stereo_delay = 5; @@ -580,6 +618,15 @@ static int cfgfile_parse_host (struct ua char *aname, *root; char *tmpp = strchr (value, ','); char *str; + + /* New versions of the emulator write out both types of config string, + with the new variant going first. When reading in the config file, + we see the new variant and sest config_newfilesystem, and here we + proceed to ignore the old variant since it contains duplicated + information. */ + if (config_newfilesystem) + return 1; + if (tmpp == 0) goto invalid_fs; @@ -620,6 +667,84 @@ static int cfgfile_parse_host (struct ua if (tmpp) gui_message (tmpp); return 1; + } + + if (strcmp (option, "filesystem2") == 0 + || strcmp (option, "hardfile2") == 0) + { + int secs, heads, reserved, bs, ro, bp, hdcv; + char *dname = NULL, *aname = "", *root = NULL, *fs = NULL, *hdc; + char *tmpp = strchr (value, ','); + char *str = NULL; + + config_newfilesystem = 1; + if (tmpp == 0) + goto invalid_fs; + + *tmpp++ = '\0'; + if (strcasecmp (value, "ro") == 0) + ro = 1; + else if (strcasecmp (value, "rw") == 0) + ro = 0; + else + goto invalid_fs; + secs = 0; heads = 0; reserved = 0; bs = 0; bp = 0; + fs = 0; hdc = 0; hdcv = 0; + + value = tmpp; + if (strcmp (option, "filesystem2") == 0) { + tmpp = strchr (value, ':'); + if (tmpp == 0) + goto empty_fs; + *tmpp++ = 0; + dname = value; + aname = tmpp; + tmpp = strchr (tmpp, ':'); + if (tmpp == 0) + goto empty_fs; + *tmpp++ = 0; + root = tmpp; + tmpp = strchr (tmpp, ','); + if (tmpp == 0) + goto empty_fs; + *tmpp++ = 0; + if (! getintval (&tmpp, &bp, 0)) + goto empty_fs; + } else { + tmpp = strchr (value, ':'); + if (tmpp == 0) + goto invalid_fs; + *tmpp++ = '\0'; + dname = value; + root = tmpp; + tmpp = strchr (tmpp, ','); + if (tmpp == 0) + goto invalid_fs; + *tmpp++ = 0; + aname = 0; + if (! getintval (&tmpp, &secs, ',') + || ! getintval (&tmpp, &heads, ',') + || ! getintval (&tmpp, &reserved, ',') + || ! getintval (&tmpp, &bs, ',')) + goto invalid_fs; + if (getintval2 (&tmpp, &bp, ',')) { + fs = tmpp; + tmpp = strchr (tmpp, ','); + if (tmpp != 0) { + *tmpp++ = 0; + hdc = tmpp; + } + } + } + empty_fs: + if (root) + str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile, root); + tmpp = add_filesys_unit (p->mountinfo, NULL, aname, str, ro, secs, + heads, reserved, bs, bp); + free (str); + if (tmpp) + gui_message (tmpp); + return 1; invalid_fs: write_log ("Invalid filesystem/hardfile specification.\n"); @@ -942,13 +1067,10 @@ static void parse_sound_spec (struct uae p->produce_sound = atoi (x0); if (x1) { p->sound_mixed_stereo_delay = 0; + p->sound_stereo = SND_STEREO; if (*x1 == 'S') { - p->sound_stereo = SND_STEREO; p->sound_stereo_separation = 7; - } else if (*x1 == 's') - p->sound_stereo = SND_STEREO; - else - p->sound_stereo = SND_MONO; + } } /* x2 used to be bits, now fixed at 16 bit. */ if (x3)