--- uae/src/cfgfile.c 2018/04/24 16:48:46 1.1.1.4 +++ uae/src/cfgfile.c 2018/04/24 16:58:28 1.1.1.8 @@ -17,6 +17,7 @@ #include "threaddep/penguin.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 @@ -84,18 +85,21 @@ static const char *csmode[] = { "ocs", " 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", 0 }; +static const char *cpumode[] = { + "68000", "68000", "68010", "68010", "68ec020", "68020", "68ec020/68881", "68020/68881", + "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 }; static const char *colormode2[] = { "8", "15", "16", "8d", "4d", "32", 0 }; 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[] = { "sprites", "full", 0 }; #define UNEXPANDED "$(FILE_PATH)" @@ -158,6 +162,7 @@ void save_options (FILE *f, struct uae_p fprintf (f, "floppy%d=%s\n", i, str); free (str); } + fprintf (f, "nr_floppies=%d\n", p->nr_floppies); fprintf (f, "parallel_on_demand=%s\n", p->parallel_demand ? "true" : "false"); fprintf (f, "serial_on_demand=%s\n", p->serial_demand ? "true" : "false"); @@ -202,6 +207,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); @@ -211,9 +217,9 @@ 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, "finegrain_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"); @@ -273,8 +279,10 @@ int cfgfile_strval (char *option, char * return 0; val = match_string (table, value); if (val == -1) { - if (! more) - write_log ("Unknown value for option `%s'.\n", option); + if (more) + return 0; + + write_log ("Unknown value for option `%s'.\n", option); return 1; } *location = val; @@ -313,6 +321,15 @@ static int getintval (char **p, int *res return 1; } +static void set_chipset_mask (struct uae_prefs *p, int val) +{ + p->chipset_mask = (val == 0 ? 0 + : val == 1 ? CSMASK_ECS_AGNUS + : val == 2 ? CSMASK_ECS_DENISE + : val == 3 ? CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS + : CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS); +} + int cfgfile_parse_option (struct uae_prefs *p, char *option, char *value) { int tmpval; @@ -369,15 +386,14 @@ int cfgfile_parse_option (struct uae_pre || cfgfile_intval (option, value, "z3mem_size", &p->z3fastmem_size, 0x100000) || cfgfile_intval (option, value, "bogomem_size", &p->bogomem_size, 0x40000) || cfgfile_intval (option, value, "gfxcard_size", &p->gfxmem_size, 0x100000) - || cfgfile_intval (option, value, "chipmem_size", &p->chipmem_size, 0x80000)) + || cfgfile_intval (option, value, "chipmem_size", &p->chipmem_size, 0x80000) + || 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, "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) @@ -400,16 +416,23 @@ int cfgfile_parse_option (struct uae_pre /* Tricky ones... */ if (cfgfile_strval (option, value, "chipset", &tmpval, csmode, 0)) { - p->chipset_mask = (tmpval == 0 ? 0 - : tmpval == 1 ? CSMASK_ECS_AGNUS - : tmpval == 2 ? CSMASK_ECS_DENISE - : tmpval == 3 ? CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS - : CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS); + set_chipset_mask (p, tmpval); 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)) + { + p->mixed_stereo = 0; + if (p->stereo == 2) { + p->stereo = 1; + p->mixed_stereo = 1; + } + } + if (cfgfile_strval (option, value, "cpu_type", &p->cpu_level, cpumode, 0)) { - p->address_space_24 = !(p->cpu_level & 1); + p->address_space_24 = p->cpu_level < 8 && !(p->cpu_level & 1); p->cpu_level >>= 1; return 1; } @@ -417,7 +440,11 @@ int cfgfile_parse_option (struct uae_pre 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)) return 1; if (strcmp (option, "kbd_lang") == 0) { @@ -661,7 +688,10 @@ static void parse_sound_spec (char *spec } currprefs.produce_sound = atoi (x0); if (x1) { - if (*x1 == 's') + currprefs.mixed_stereo = 0; + if (*x1 == 'S') + currprefs.stereo = currprefs.mixed_stereo = 1; + else if (*x1 == 's') currprefs.stereo = 1; else currprefs.stereo = 0; @@ -778,8 +808,8 @@ static void parse_hardfile_spec (char *s static void parse_cpu_specs (char *spec) { - if (*spec < '0' || *spec > '3') { - fprintf (stderr, "CPU parameter string must begin with '0', '1', '2' or '3'.\n"); + if (*spec < '0' || *spec > '4') { + fprintf (stderr, "CPU parameter string must begin with '0', '1', '2', '3' or '4'.\n"); return; } @@ -791,6 +821,8 @@ static void parse_cpu_specs (char *spec) case 'a': if (currprefs.cpu_level < 2) fprintf (stderr, "In 68000/68010 emulation, the address space is always 24 bit.\n"); + else if (currprefs.cpu_level >= 4) + fprintf (stderr, "In 68040 emulation, the address space is always 32 bit.\n"); else currprefs.address_space_24 = 1; break; @@ -812,7 +844,7 @@ static void parse_cpu_specs (char *spec) /* Returns the number of args used up (0 or 1). */ int parse_cmdline_option (char c, char *arg) { - const char arg_required[] = "0123rKpImWSAJwNCZUFcblOdHR"; + const char arg_required[] = "0123rKpImWSAJwNCZUFcblOdHRv"; if (strchr (arg_required, c) && ! arg) { fprintf (stderr, "Missing argument for option `-%c'!\n", c); @@ -820,67 +852,71 @@ int parse_cmdline_option (char c, char * } switch (c) { - case 'h': usage (); exit (0); + case 'h': usage (); exit (0); - case '0': strncpy (currprefs.df[0], arg, 255); currprefs.df[0][255] = 0; break; - case '1': strncpy (currprefs.df[1], arg, 255); currprefs.df[1][255] = 0; break; - case '2': strncpy (currprefs.df[2], arg, 255); currprefs.df[2][255] = 0; break; - case '3': strncpy (currprefs.df[3], arg, 255); currprefs.df[3][255] = 0; break; - case 'r': strncpy (currprefs.romfile, arg, 255); currprefs.romfile[255] = 0; break; - case 'K': strncpy (currprefs.keyfile, arg, 255); currprefs.keyfile[255] = 0; break; - case 'p': strncpy (currprefs.prtname, arg, 255); currprefs.prtname[255] = 0; break; + case '0': strncpy (currprefs.df[0], arg, 255); currprefs.df[0][255] = 0; break; + case '1': strncpy (currprefs.df[1], arg, 255); currprefs.df[1][255] = 0; break; + case '2': strncpy (currprefs.df[2], arg, 255); currprefs.df[2][255] = 0; break; + case '3': strncpy (currprefs.df[3], arg, 255); currprefs.df[3][255] = 0; break; + case 'r': strncpy (currprefs.romfile, arg, 255); currprefs.romfile[255] = 0; break; + case 'K': strncpy (currprefs.keyfile, arg, 255); currprefs.keyfile[255] = 0; break; + case 'p': strncpy (currprefs.prtname, arg, 255); currprefs.prtname[255] = 0; break; /* case 'I': strncpy (currprefs.sername, arg, 255); currprefs.sername[255] = 0; currprefs.use_serial = 1; break; */ - case 'm': case 'M': parse_filesys_spec (c == 'M', arg); break; - case 'W': parse_hardfile_spec (arg); break; - case 'S': parse_sound_spec (arg); break; - case 'R': currprefs.gfx_framerate = atoi (arg); break; - case 'A': currprefs.emul_accuracy = atoi (arg); break; - 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; - case 'T': currprefs.x11_use_mitshm = 1; break; - case 'w': currprefs.m68k_speed = atoi (arg); break; + case 'm': case 'M': parse_filesys_spec (c == 'M', arg); break; + case 'W': parse_hardfile_spec (arg); break; + case 'S': parse_sound_spec (arg); break; + case 'R': currprefs.gfx_framerate = atoi (arg); break; + case 'A': currprefs.emul_accuracy = atoi (arg); break; + 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; + case 'T': currprefs.x11_use_mitshm = 1; break; + case 'w': currprefs.m68k_speed = atoi (arg); break; /* case 'g': currprefs.use_gfxlib = 1; break; */ - case 'G': currprefs.start_gui = 0; break; - case 'D': currprefs.start_debugger = 1; break; + case 'G': currprefs.start_gui = 0; break; + case 'D': currprefs.start_debugger = 1; break; - case 'n': + case 'n': if (strchr (arg, '3') != 0) currprefs.blits_32bit_enabled = 1; if (strchr (arg, 'i') != 0) currprefs.immediate_blits = 1; break; - case 'C': + case 'v': + set_chipset_mask (&currprefs, atoi (arg)); + break; + + case 'C': parse_cpu_specs (arg); break; - case 'Z': + case 'Z': currprefs.z3fastmem_size = atoi (arg) * 0x100000; break; - case 'U': + case 'U': currprefs.gfxmem_size = atoi (arg) * 0x100000; break; - case 'F': + case 'F': currprefs.fastmem_size = atoi (arg) * 0x100000; break; - case 'b': + case 'b': currprefs.bogomem_size = atoi (arg) * 0x40000; break; - case 'c': + case 'c': currprefs.chipmem_size = atoi (arg) * 0x80000; break; - case 'l': + case 'l': if (0 == strcasecmp(arg, "de")) currprefs.keyboard_lang = KBD_LANG_DE; else if (0 == strcasecmp(arg, "us")) @@ -895,8 +931,8 @@ int parse_cmdline_option (char c, char * currprefs.keyboard_lang = KBD_LANG_ES; break; - case 'O': parse_gfx_specs (arg); break; - case 'd': + case 'O': parse_gfx_specs (arg); break; + case 'd': if (strchr (arg, 'S') != NULL || strchr (arg, 's')) { write_log (" Serial on demand.\n"); currprefs.serial_demand = 1; @@ -908,14 +944,14 @@ int parse_cmdline_option (char c, char * break; - case 'H': + case 'H': currprefs.color_mode = atoi (arg); if (currprefs.color_mode < 0) { fprintf (stderr, "Bad color mode selected. Using default.\n"); currprefs.color_mode = 0; } break; - default: + default: fprintf (stderr, "Unknown option `-%c'!\n", c); break; }