--- uae/src/cfgfile.c 2018/04/24 17:03:56 1.1.1.11 +++ uae/src/cfgfile.c 2018/04/24 17:10:53 1.1.1.14 @@ -72,6 +72,7 @@ static struct cfg_lines opttable[] = {"joyport0", "" }, {"joyport1", "" }, {"kickstart_rom_file", "Kickstart ROM image, (C) Copyright Amiga, Inc." }, + {"kickstart_ext_rom_file", "Extended Kickstart ROM image, (C) Copyright Amiga, Inc." }, {"kickstart_key_file", "Key-file for encrypted ROM images (from Cloanto's Amiga Forever)" }, {"floppy0", "Diskfile for drive 0" }, {"floppy1", "Diskfile for drive 1" }, @@ -156,6 +157,9 @@ void save_options (FILE *f, struct uae_p str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->romfile); fprintf (f, "kickstart_rom_file=%s\n", str); free (str); + str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->romextfile); + fprintf (f, "kickstart_ext_rom_file=%s\n", str); + free (str); str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->keyfile); fprintf (f, "kickstart_key_file=%s\n", str); free (str); @@ -171,7 +175,7 @@ void save_options (FILE *f, struct uae_p fprintf (f, "serial_on_demand=%s\n", p->serial_demand ? "true" : "false"); fprintf (f, "sound_output=%s\n", soundmode[p->produce_sound]); - fprintf (f, "sound_channels=%s\n", stereomode1[p->stereo + p->mixed_stereo]); + fprintf (f, "sound_channels=%s\n", stereomode1[p->sound_stereo + p->mixed_stereo]); fprintf (f, "sound_bits=%d\n", p->sound_bits); fprintf (f, "sound_min_buff=%d\n", p->sound_minbsiz); fprintf (f, "sound_max_buff=%d\n", p->sound_maxbsiz); @@ -417,6 +421,7 @@ int cfgfile_parse_option (struct uae_pre || cfgfile_string (option, value, "floppy2", p->df[2], 256) || cfgfile_string (option, value, "floppy3", p->df[3], 256) || cfgfile_string (option, value, "kickstart_rom_file", p->romfile, 256) + || cfgfile_string (option, value, "kickstart_ext_rom_file", p->romextfile, 256) || cfgfile_string (option, value, "kickstart_key_file", p->keyfile, 256) || cfgfile_string (option, value, "config_description", p->description, 256)) return 1; @@ -427,15 +432,16 @@ int cfgfile_parse_option (struct uae_pre return 1; } - if (cfgfile_strval (option, value, "sound_channels", &p->stereo, stereomode1, 1) - || cfgfile_strval (option, value, "sound_channels", &p->stereo, stereomode2, 1) - || cfgfile_strval (option, value, "sound_channels", &p->stereo, stereomode3, 0)) + if (cfgfile_strval (option, value, "sound_channels", &p->sound_stereo, stereomode1, 1) + || cfgfile_strval (option, value, "sound_channels", &p->sound_stereo, stereomode2, 1) + || cfgfile_strval (option, value, "sound_channels", &p->sound_stereo, stereomode3, 0)) { p->mixed_stereo = 0; - if (p->stereo == 2) { - p->stereo = 1; + if (p->sound_stereo == 2) { + p->sound_stereo = 1; p->mixed_stereo = 1; } + return 1; } if (cfgfile_strval (option, value, "cpu_type", &p->cpu_level, cpumode, 0)) { @@ -579,7 +585,6 @@ static void subst (char *p, char *f, int int cfgfile_load (struct uae_prefs *p, const char *filename) { - char *str; int i; FILE *fh; @@ -590,7 +595,11 @@ int cfgfile_load (struct uae_prefs *p, c return 0; while (fgets (line, 256, fh) != 0) { - line[strcspn (line, "\t \r\n")] = '\0'; + int len = strlen (line); + /* Delete trailing whitespace. */ + while (len > 0 && strcspn (line + len - 1, "\t \r\n") == 0) { + line[--len] = '\0'; + } if (strlen (line) > 0) cfgfile_parse_line (p, line); } @@ -599,6 +608,7 @@ int cfgfile_load (struct uae_prefs *p, c for (i = 0; i < 4; i++) subst (p->path_floppy, p->df[i], sizeof p->df[i]); subst (p->path_rom, p->romfile, sizeof p->romfile); + subst (p->path_rom, p->romextfile, sizeof p->romextfile); subst (p->path_rom, p->keyfile, sizeof p->keyfile); return 1; @@ -621,7 +631,7 @@ int cfgfile_get_description (const char struct uae_prefs p; default_prefs (&p); strcpy (p.description, ""); - if (cfgfile_load (&p, filename) && strlen (p.description) != 0) { + if (cfgfile_load (&p, filename)) { result = 1; strcpy (description, p.description); } @@ -706,11 +716,11 @@ static void parse_sound_spec (char *spec if (x1) { currprefs.mixed_stereo = 0; if (*x1 == 'S') - currprefs.stereo = currprefs.mixed_stereo = 1; + currprefs.sound_stereo = currprefs.mixed_stereo = 1; else if (*x1 == 's') - currprefs.stereo = 1; + currprefs.sound_stereo = 1; else - currprefs.stereo = 0; + currprefs.sound_stereo = 0; } if (x2) currprefs.sound_bits = atoi (x2);