--- uae/src/cfgfile.c 2018/04/24 16:56:46 1.1.1.7 +++ uae/src/cfgfile.c 2018/04/24 17:12:36 1.1.1.15 @@ -14,9 +14,10 @@ #include "config.h" #include "options.h" -#include "threaddep/penguin.h" +#include "threaddep/thread.h" #include "uae.h" #include "autoconf.h" +#include "events.h" #include "custom.h" /* @@@ need to get rid of this... just cut part of the manual and print that @@ -59,6 +60,7 @@ static struct cfg_lines opttable[] = {"gfx_colour_mode", "" }, {"32bit_blits", "Enable 32 bit blitter emulation" }, {"immediate_blits", "Perform blits immediately" }, + {"show_leds", "LED display" }, {"gfxlib_replacement", "Use graphics.library replacement?" }, {"sound_output", "" }, {"sound_frequency", "" }, @@ -71,6 +73,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" }, @@ -80,13 +83,16 @@ static struct cfg_lines opttable[] = {"filesystem", "access,'Amiga volume-name':'host directory path' - where 'access' can be 'read-only' or 'read-write'" } }; -static const char *csmode[] = { "ocs", "ecs_agnus", "ecs_denise", "ecs", "aga" }; +static const char *guimode1[] = { "no", "yes", "nowait", 0 }; +static const char *guimode2[] = { "false", "true", "nowait", 0 }; +static const char *guimode3[] = { "0", "1", "nowait", 0 }; +static const char *csmode[] = { "ocs", "ecs_agnus", "ecs_denise", "ecs", "aga", 0 }; static const char *linemode1[] = { "none", "double", "scanlines", 0 }; static const char *linemode2[] = { "n", "d", "s", 0 }; static const char *speedmode[] = { "max", "real", 0 }; static const char *cpumode[] = { "68000", "68000", "68010", "68010", "68ec020", "68020", "68ec020/68881", "68020/68881", - "68040", 0 + "68040", "68040", 0 }; static const char *portmode[] = { "joy0", "joy1", "mouse", "kbd1", "kbd2", "kbd3", 0 }; static const char *colormode1[] = { "8bit", "15bit", "16bit", "8bit_dither", "4bit_dither", "32bit", 0 }; @@ -94,10 +100,11 @@ static const char *colormode2[] = { "8", static const char *soundmode[] = { "none", "interrupts", "normal", "exact", 0 }; static const char *centermode1[] = { "none", "simple", "smart", 0 }; static const char *centermode2[] = { "false", "true", "smart", 0 }; -static const char *stereomode1[] = { "mono", "stereo", 0 }; -static const char *stereomode2[] = { "m", "s", 0 }; -static const char *stereomode3[] = { "1", "2", 0 }; +static const char *stereomode1[] = { "mono", "stereo", "mixed", 0 }; +static const char *stereomode2[] = { "m", "s", "x", 0 }; +static const char *stereomode3[] = { "1", "2", "3", 0 }; static const char *interpolmode[] = { "none", "rh", "crux", 0 }; +static const char *collmode[] = { "none", "sprites", "playfields", "full", 0 }; #define UNEXPANDED "$(FILE_PATH)" @@ -146,14 +153,18 @@ void save_options (FILE *f, struct uae_p target_save_options (f, p); - fprintf (f, "use_gui=%s\n", p->start_gui ? "true" : "false"); + fprintf (f, "use_gui=%s\n", guimode1[p->start_gui]); fprintf (f, "use_debugger=%s\n", p->start_debugger ? "true" : "false"); 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); + fprintf (f, "kickshifter=%s\n", p->kickshifter ? "true" : "false"); for (i = 0; i < 4; i++) { str = cfgfile_subst_path (p->path_floppy, UNEXPANDED, p->df[i]); @@ -165,7 +176,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]); + 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); @@ -192,9 +203,9 @@ void save_options (FILE *f, struct uae_p fprintf (f, "gfx_center_vertical=%s\n", centermode1[p->gfx_ycenter]); fprintf (f, "gfx_colour_mode=%s\n", colormode1[p->color_mode]); - fprintf (f, "32bit_blits=%s\n", p->blits_32bit_enabled ? "true" : "false"); fprintf (f, "immediate_blits=%s\n", p->immediate_blits ? "true" : "false"); fprintf (f, "ntsc=%s\n", p->ntscmode ? "true" : "false"); + fprintf (f, "show_leds=%s\n", p->leds_on_screen ? "true" : "false"); if (p->chipset_mask & CSMASK_AGA) fprintf (f, "chipset=aga\n"); else if ((p->chipset_mask & CSMASK_ECS_AGNUS) && (p->chipset_mask & CSMASK_ECS_AGNUS)) @@ -205,6 +216,7 @@ void save_options (FILE *f, struct uae_p fprintf (f, "chipset=ecs_denise\n"); else fprintf (f, "chipset=ocs\n"); + fprintf (f, "collision_level=%s\n", collmode[p->collision_level]); fprintf (f, "fastmem_size=%d\n", p->fastmem_size / 0x100000); fprintf (f, "a3000mem_size=%d\n", p->a3000mem_size / 0x100000); @@ -214,18 +226,18 @@ void save_options (FILE *f, struct uae_p fprintf (f, "chipmem_size=%d\n", p->chipmem_size / 0x80000); if (p->m68k_speed > 0) - fprintf (f, "cpu_speed=%d\n", p->m68k_speed); + fprintf (f, "finegrain_cpu_speed=%d\n", p->m68k_speed); else fprintf (f, "cpu_speed=%s\n", p->m68k_speed == -1 ? "max" : "real"); fprintf (f, "cpu_type=%s\n", cpumode[p->cpu_level * 2 + !p->address_space_24]); fprintf (f, "cpu_compatible=%s\n", p->cpu_compatible ? "true" : "false"); - fprintf (f, "autoconfig=%s\n", p->automount_uaedev ? "true" : "false"); fprintf (f, "accuracy=%d\n", p->emul_accuracy); fprintf (f, "log_illegal_mem=%s\n", p->illegal_mem ? "true" : "false"); fprintf (f, "kbd_lang=%s\n", (p->keyboard_lang == KBD_LANG_DE ? "de" + : p->keyboard_lang == KBD_LANG_DK ? "dk" : p->keyboard_lang == KBD_LANG_ES ? "es" : p->keyboard_lang == KBD_LANG_US ? "us" : p->keyboard_lang == KBD_LANG_SE ? "se" @@ -318,7 +330,7 @@ static int getintval (char **p, int *res return 1; } -static int set_chipset_mask (struct uae_prefs *p, int val) +static void set_chipset_mask (struct uae_prefs *p, int val) { p->chipset_mask = (val == 0 ? 0 : val == 1 ? CSMASK_ECS_AGNUS @@ -330,6 +342,7 @@ static int set_chipset_mask (struct uae_ int cfgfile_parse_option (struct uae_prefs *p, char *option, char *value) { int tmpval; + int dummy; char *section = 0; char *tmpp; @@ -352,10 +365,9 @@ int cfgfile_parse_option (struct uae_pre return 0; } if (cfgfile_yesno (option, value, "use_debugger", &p->start_debugger) - || cfgfile_yesno (option, value, "use_gui", &p->start_gui) || cfgfile_yesno (option, value, "bsdsocket_emu", &p->socket_emu) || cfgfile_yesno (option, value, "immediate_blits", &p->immediate_blits) - || cfgfile_yesno (option, value, "32bit_blits", &p->blits_32bit_enabled) + || cfgfile_yesno (option, value, "kickshifter", &p->kickshifter) || cfgfile_yesno (option, value, "gfx_lores", &p->gfx_lores) || cfgfile_yesno (option, value, "gfx_correct_aspect", &p->gfx_correct_aspect) || cfgfile_yesno (option, value, "gfx_fullscreen_amiga", &p->gfx_afullscreen) @@ -363,7 +375,8 @@ int cfgfile_parse_option (struct uae_pre || cfgfile_yesno (option, value, "ntsc", &p->ntscmode) || cfgfile_yesno (option, value, "cpu_compatible", &p->cpu_compatible) || cfgfile_yesno (option, value, "cpu_24bit_addressing", &p->address_space_24) - || cfgfile_yesno (option, value, "autoconfig", &p->automount_uaedev) + /* For backward compatibility. */ + || cfgfile_yesno (option, value, "autoconfig", &dummy) || cfgfile_yesno (option, value, "parallel_on_demand", &p->parallel_demand) || cfgfile_yesno (option, value, "serial_on_demand", &p->serial_demand) || cfgfile_yesno (option, value, "log_illegal_mem", &p->illegal_mem)) @@ -387,12 +400,13 @@ int cfgfile_parse_option (struct uae_pre || cfgfile_intval (option, value, "nr_floppies", &p->nr_floppies, 1)) return 1; if (cfgfile_strval (option, value, "sound_output", &p->produce_sound, soundmode, 0) - || 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) || cfgfile_strval (option, value, "sound_interpol", &p->sound_interpol, interpolmode, 0) || cfgfile_strval (option, value, "joyport0", &p->jport0, portmode, 0) || cfgfile_strval (option, value, "joyport1", &p->jport1, portmode, 0) + || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode1, 1) + || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode2, 1) + || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode3, 0) + || cfgfile_strval (option, value, "collision_level", &p->collision_level, collmode, 0) || cfgfile_strval (option, value, "gfx_linemode", &p->gfx_linedbl, linemode1, 1) || cfgfile_strval (option, value, "gfx_linemode", &p->gfx_linedbl, linemode2, 0) || cfgfile_strval (option, value, "gfx_center_horizontal", &p->gfx_xcenter, centermode1, 1) @@ -409,6 +423,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; @@ -419,21 +434,46 @@ int cfgfile_parse_option (struct uae_pre return 1; } + 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->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)) { p->address_space_24 = p->cpu_level < 8 && !(p->cpu_level & 1); p->cpu_level >>= 1; return 1; } - if (cfgfile_strval (option, value, "cpu_speed", &p->m68k_speed, speedmode, 1)) { + if (cfgfile_strval (option, value, "cpu_speed", &p->m68k_speed, speedmode, 1) + /* Broken earlier versions used to write this out as a string. */ + || cfgfile_strval (option, value, "finegraincpu_speed", &p->m68k_speed, speedmode, 1)) + { p->m68k_speed--; return 1; } - if (cfgfile_intval (option, value, "cpu_speed", &p->m68k_speed, 1)) + if (cfgfile_intval (option, value, "cpu_speed", &p->m68k_speed, 1)) { + p->m68k_speed *= CYCLE_UNIT; return 1; + } + if (cfgfile_intval (option, value, "finegrain_cpu_speed", &p->m68k_speed, 1)) { + if (OFFICIAL_CYCLE_UNIT > CYCLE_UNIT) { + int factor = OFFICIAL_CYCLE_UNIT / CYCLE_UNIT; + p->m68k_speed = (p->m68k_speed + factor - 1) / factor; + } + return 1; + } if (strcmp (option, "kbd_lang") == 0) { KbdLang l; if ((l = KBD_LANG_DE, strcasecmp (value, "de") == 0) + || (l = KBD_LANG_DK, strcasecmp (value, "dk") == 0) || (l = KBD_LANG_SE, strcasecmp (value, "se") == 0) || (l = KBD_LANG_US, strcasecmp (value, "us") == 0) || (l = KBD_LANG_FR, strcasecmp (value, "fr") == 0) @@ -547,7 +587,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; @@ -558,7 +597,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); } @@ -567,6 +610,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; @@ -589,7 +633,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); } @@ -672,10 +716,13 @@ static void parse_sound_spec (char *spec } currprefs.produce_sound = atoi (x0); if (x1) { - if (*x1 == 's') - currprefs.stereo = 1; + currprefs.mixed_stereo = 0; + if (*x1 == 'S') + currprefs.sound_stereo = currprefs.mixed_stereo = 1; + else if (*x1 == 's') + currprefs.sound_stereo = 1; else - currprefs.stereo = 0; + currprefs.sound_stereo = 0; } if (x2) currprefs.sound_bits = atoi (x2); @@ -851,7 +898,6 @@ int parse_cmdline_option (char c, char * case 'x': currprefs.no_xhair = 1; break; case 'i': currprefs.illegal_mem = 1; break; case 'J': parse_joy_spec (arg); break; - case 'a': currprefs.automount_uaedev = 0; break; case 't': currprefs.test_drawing_speed = 1; break; case 'L': currprefs.x11_use_low_bandwidth = 1; break; @@ -900,6 +946,8 @@ int parse_cmdline_option (char c, char * case 'l': if (0 == strcasecmp(arg, "de")) currprefs.keyboard_lang = KBD_LANG_DE; + else if (0 == strcasecmp(arg, "dk")) + currprefs.keyboard_lang = KBD_LANG_DK; else if (0 == strcasecmp(arg, "us")) currprefs.keyboard_lang = KBD_LANG_US; else if (0 == strcasecmp(arg, "se"))