|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
4: * Config file handling
5: * This still needs some thought before it's complete...
6: *
7: * Copyright 1998 Brian King, Bernd Schmidt
8: */
9:
10: #include "sysconfig.h"
11: #include "sysdeps.h"
12:
13: #include <ctype.h>
14:
15: #include "config.h"
16: #include "options.h"
1.1.1.10 root 17: #include "threaddep/thread.h"
1.1 root 18: #include "uae.h"
19: #include "autoconf.h"
1.1.1.8 root 20: #include "events.h"
1.1.1.3 root 21: #include "custom.h"
1.1.1.16! root 22: #include "inputdevice.h"
! 23:
! 24: #define cfgfile_write fprintf
1.1 root 25:
26: /* @@@ need to get rid of this... just cut part of the manual and print that
27: * as a help text. */
28: struct cfg_lines
29: {
30: const char *config_label, *config_help;
31: };
32:
33: static struct cfg_lines opttable[] =
34: {
35: {"help", "Prints this help" },
36: {"config_description", "" },
37: {"use_gui", "Enable the GUI? If no, then goes straight to emulator" },
38: {"use_debugger", "Enable the debugger?" },
39: {"cpu_speed", "can be max, real, or a number between 1 and 20" },
40: {"cpu_type", "Can be 68000, 68010, 68020, 68020/68881" },
41: {"cpu_compatible", "yes enables compatibility-mode" },
42: {"cpu_24bit_addressing", "must be set to 'no' in order for Z3mem or P96mem to work" },
43: {"autoconfig", "yes = add filesystems and extra ram" },
44: {"accuracy", "emulation accuracy, default is 2" },
45: {"log_illegal_mem", "print illegal memory access by Amiga software?" },
46: {"fastmem_size", "Size in megabytes of fast-memory" },
47: {"chipmem_size", "Size in megabytes of chip-memory" },
48: {"bogomem_size", "Size in megabytes of bogo-memory at 0xC00000" },
49: {"a3000mem_size", "Size in megabytes of A3000 memory" },
50: {"gfxcard_size", "Size in megabytes of Picasso96 graphics-card memory" },
51: {"z3mem_size", "Size in megabytes of Zorro-III expansion memory" },
52: {"gfx_test_speed", "Test graphics speed?" },
53: {"framerate", "Print every nth frame" },
54: {"gfx_width", "Screen width" },
55: {"gfx_height", "Screen height" },
56: {"gfx_lores", "Treat display as lo-res?" },
57: {"gfx_linemode", "Can be none, double, or scanlines" },
58: {"gfx_fullscreen_amiga", "Amiga screens are fullscreen?" },
59: {"gfx_fullscreen_picasso", "Picasso screens are fullscreen?" },
60: {"gfx_correct_aspect", "Correct aspect ratio?" },
61: {"gfx_center_horizontal", "Center display horizontally?" },
62: {"gfx_center_vertical", "Center display vertically?" },
63: {"gfx_colour_mode", "" },
64: {"32bit_blits", "Enable 32 bit blitter emulation" },
65: {"immediate_blits", "Perform blits immediately" },
1.1.1.15 root 66: {"show_leds", "LED display" },
1.1 root 67: {"gfxlib_replacement", "Use graphics.library replacement?" },
68: {"sound_output", "" },
69: {"sound_frequency", "" },
70: {"sound_bits", "" },
71: {"sound_channels", "" },
72: {"sound_min_buff", "" },
73: {"sound_max_buff", "" },
74: {"parallel_on_demand", "" },
75: {"serial_on_demand", "" },
76: {"joyport0", "" },
77: {"joyport1", "" },
78: {"kickstart_rom_file", "Kickstart ROM image, (C) Copyright Amiga, Inc." },
1.1.1.12 root 79: {"kickstart_ext_rom_file", "Extended Kickstart ROM image, (C) Copyright Amiga, Inc." },
1.1 root 80: {"kickstart_key_file", "Key-file for encrypted ROM images (from Cloanto's Amiga Forever)" },
81: {"floppy0", "Diskfile for drive 0" },
82: {"floppy1", "Diskfile for drive 1" },
83: {"floppy2", "Diskfile for drive 2" },
84: {"floppy3", "Diskfile for drive 3" },
85: {"hardfile", "access,sectors, surfaces, reserved, blocksize, path format" },
86: {"filesystem", "access,'Amiga volume-name':'host directory path' - where 'access' can be 'read-only' or 'read-write'" }
87: };
88:
1.1.1.10 root 89: static const char *guimode1[] = { "no", "yes", "nowait", 0 };
90: static const char *guimode2[] = { "false", "true", "nowait", 0 };
91: static const char *guimode3[] = { "0", "1", "nowait", 0 };
92: static const char *csmode[] = { "ocs", "ecs_agnus", "ecs_denise", "ecs", "aga", 0 };
1.1 root 93: static const char *linemode1[] = { "none", "double", "scanlines", 0 };
94: static const char *linemode2[] = { "n", "d", "s", 0 };
95: static const char *speedmode[] = { "max", "real", 0 };
1.1.1.7 root 96: static const char *cpumode[] = {
97: "68000", "68000", "68010", "68010", "68ec020", "68020", "68ec020/68881", "68020/68881",
1.1.1.9 root 98: "68040", "68040", 0
1.1.1.7 root 99: };
1.1 root 100: static const char *colormode1[] = { "8bit", "15bit", "16bit", "8bit_dither", "4bit_dither", "32bit", 0 };
101: static const char *colormode2[] = { "8", "15", "16", "8d", "4d", "32", 0 };
102: static const char *soundmode[] = { "none", "interrupts", "normal", "exact", 0 };
1.1.1.2 root 103: static const char *centermode1[] = { "none", "simple", "smart", 0 };
104: static const char *centermode2[] = { "false", "true", "smart", 0 };
1.1.1.8 root 105: static const char *stereomode1[] = { "mono", "stereo", "mixed", 0 };
106: static const char *stereomode2[] = { "m", "s", "x", 0 };
107: static const char *stereomode3[] = { "1", "2", "3", 0 };
1.1.1.4 root 108: static const char *interpolmode[] = { "none", "rh", "crux", 0 };
1.1.1.9 root 109: static const char *collmode[] = { "none", "sprites", "playfields", "full", 0 };
1.1 root 110:
111: #define UNEXPANDED "$(FILE_PATH)"
112:
113: static int match_string (const char *table[], const char *str)
114: {
115: int i;
116: for (i = 0; table[i] != 0; i++)
117: if (strcasecmp (table[i], str) == 0)
118: return i;
119: return -1;
120: }
121:
122: char *cfgfile_subst_path (const char *path, const char *subst, const char *file)
123: {
124: /* @@@ use strcasecmp for some targets. */
125: if (strlen (path) > 0 && strncmp (file, path, strlen (path)) == 0) {
126: int l;
127: char *p = xmalloc (strlen (file) + strlen (subst) + 2);
128: strcpy (p, subst);
129: l = strlen (p);
130: while (l > 0 && p[l - 1] == '/')
131: p[--l] = '\0';
132: l = strlen (path);
133: while (file[l] == '/')
134: l++;
135: strcat (p, "/"); strcat (p, file + l);
136: return p;
137: }
138: return my_strdup (file);
139: }
140:
141: void save_options (FILE *f, struct uae_prefs *p)
142: {
143: struct strlist *sl;
144: char *str;
145: int i;
146:
1.1.1.16! root 147: cfgfile_write (f, "config_description=%s\n", p->description);
1.1 root 148:
149: for (sl = p->unknown_lines; sl; sl = sl->next)
1.1.1.16! root 150: cfgfile_write (f, "%s\n", sl->str);
1.1 root 151:
1.1.1.16! root 152: cfgfile_write (f, "%s.rom_path=%s\n", TARGET_NAME, p->path_rom);
! 153: cfgfile_write (f, "%s.floppy_path=%s\n", TARGET_NAME, p->path_floppy);
! 154: cfgfile_write (f, "%s.hardfile_path=%s\n", TARGET_NAME, p->path_hardfile);
1.1 root 155:
1.1.1.2 root 156: target_save_options (f, p);
157:
1.1.1.16! root 158: cfgfile_write (f, "use_gui=%s\n", guimode1[p->start_gui]);
! 159: cfgfile_write (f, "use_debugger=%s\n", p->start_debugger ? "true" : "false");
1.1 root 160: str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->romfile);
1.1.1.16! root 161: cfgfile_write (f, "kickstart_rom_file=%s\n", str);
1.1 root 162: free (str);
1.1.1.12 root 163: str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->romextfile);
1.1.1.16! root 164: cfgfile_write (f, "kickstart_ext_rom_file=%s\n", str);
1.1.1.12 root 165: free (str);
1.1 root 166: str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->keyfile);
1.1.1.16! root 167: cfgfile_write (f, "kickstart_key_file=%s\n", str);
1.1 root 168: free (str);
1.1.1.16! root 169: cfgfile_write (f, "kickshifter=%s\n", p->kickshifter ? "true" : "false");
1.1 root 170:
171: for (i = 0; i < 4; i++) {
172: str = cfgfile_subst_path (p->path_floppy, UNEXPANDED, p->df[i]);
1.1.1.16! root 173: cfgfile_write (f, "floppy%d=%s\n", i, str);
1.1 root 174: free (str);
175: }
1.1.1.16! root 176: cfgfile_write (f, "nr_floppies=%d\n", p->nr_floppies);
! 177: cfgfile_write (f, "parallel_on_demand=%s\n", p->parallel_demand ? "true" : "false");
! 178: cfgfile_write (f, "serial_on_demand=%s\n", p->serial_demand ? "true" : "false");
! 179:
! 180: cfgfile_write (f, "sound_output=%s\n", soundmode[p->produce_sound]);
! 181: cfgfile_write (f, "sound_channels=%s\n", stereomode1[p->sound_stereo + p->mixed_stereo]);
! 182: cfgfile_write (f, "sound_bits=%d\n", p->sound_bits);
! 183: cfgfile_write (f, "sound_min_buff=%d\n", p->sound_minbsiz);
! 184: cfgfile_write (f, "sound_max_buff=%d\n", p->sound_maxbsiz);
! 185: cfgfile_write (f, "sound_frequency=%d\n", p->sound_freq);
! 186: cfgfile_write (f, "sound_interpol=%s\n", interpolmode[p->sound_interpol]);
! 187:
! 188: cfgfile_write (f, "sound_pri_time=%d\n", p->sound_pri_time);
! 189: cfgfile_write (f, "sound_pri_cutoff=%d\n", p->sound_pri_cutoff);
! 190:
! 191: for (i = 0; i < 2; i++) {
! 192: int v = i == 0 ? p->jport0 : p->jport1;
! 193: char tmp1[100], tmp2[50];
! 194: if (v < JSEM_JOYS) {
! 195: sprintf (tmp2, "kbd%d", v + 1);
! 196: } else if (v < JSEM_MICE) {
! 197: sprintf (tmp2, "joy%d", v - JSEM_JOYS);
! 198: } else {
! 199: strcpy (tmp2, "mouse");
! 200: if (v - JSEM_MICE > 0)
! 201: sprintf (tmp2, "mouse%d", v - JSEM_MICE);
! 202: }
! 203: sprintf (tmp1, "joyport%d=%s\n", i, tmp2);
! 204: cfgfile_write (f, tmp1);
! 205: }
! 206:
! 207: cfgfile_write (f, "bsdsocket_emu=%s\n", p->socket_emu ? "true" : "false");
! 208:
! 209: cfgfile_write (f, "gfx_framerate=%d\n", p->gfx_framerate);
! 210: cfgfile_write (f, "gfx_width=%d\n", p->gfx_width);
! 211: cfgfile_write (f, "gfx_height=%d\n", p->gfx_height);
! 212: cfgfile_write (f, "gfx_lores=%s\n", p->gfx_lores ? "true" : "false");
! 213: cfgfile_write (f, "gfx_linemode=%s\n", linemode1[p->gfx_linedbl]);
! 214: cfgfile_write (f, "gfx_correct_aspect=%s\n", p->gfx_correct_aspect ? "true" : "false");
! 215: cfgfile_write (f, "gfx_fullscreen_amiga=%s\n", p->gfx_afullscreen ? "true" : "false");
! 216: cfgfile_write (f, "gfx_fullscreen_picasso=%s\n", p->gfx_pfullscreen ? "true" : "false");
! 217: cfgfile_write (f, "gfx_center_horizontal=%s\n", centermode1[p->gfx_xcenter]);
! 218: cfgfile_write (f, "gfx_center_vertical=%s\n", centermode1[p->gfx_ycenter]);
! 219: cfgfile_write (f, "gfx_colour_mode=%s\n", colormode1[p->color_mode]);
! 220:
! 221: cfgfile_write (f, "immediate_blits=%s\n", p->immediate_blits ? "true" : "false");
! 222: cfgfile_write (f, "ntsc=%s\n", p->ntscmode ? "true" : "false");
! 223: cfgfile_write (f, "show_leds=%s\n", p->leds_on_screen ? "true" : "false");
1.1.1.3 root 224: if (p->chipset_mask & CSMASK_AGA)
1.1.1.16! root 225: cfgfile_write (f, "chipset=aga\n");
1.1.1.3 root 226: else if ((p->chipset_mask & CSMASK_ECS_AGNUS) && (p->chipset_mask & CSMASK_ECS_AGNUS))
1.1.1.16! root 227: cfgfile_write (f, "chipset=ecs\n");
1.1.1.3 root 228: else if (p->chipset_mask & CSMASK_ECS_AGNUS)
1.1.1.16! root 229: cfgfile_write (f, "chipset=ecs_agnus\n");
1.1.1.3 root 230: else if (p->chipset_mask & CSMASK_ECS_DENISE)
1.1.1.16! root 231: cfgfile_write (f, "chipset=ecs_denise\n");
1.1.1.3 root 232: else
1.1.1.16! root 233: cfgfile_write (f, "chipset=ocs\n");
! 234: cfgfile_write (f, "collision_level=%s\n", collmode[p->collision_level]);
1.1 root 235:
1.1.1.16! root 236: cfgfile_write (f, "fastmem_size=%d\n", p->fastmem_size / 0x100000);
! 237: cfgfile_write (f, "a3000mem_size=%d\n", p->a3000mem_size / 0x100000);
! 238: cfgfile_write (f, "z3mem_size=%d\n", p->z3fastmem_size / 0x100000);
! 239: cfgfile_write (f, "bogomem_size=%d\n", p->bogomem_size / 0x40000);
! 240: cfgfile_write (f, "gfxcard_size=%d\n", p->gfxmem_size / 0x100000);
! 241: cfgfile_write (f, "chipmem_size=%d\n", p->chipmem_size / 0x80000);
1.1 root 242:
1.1.1.3 root 243: if (p->m68k_speed > 0)
1.1.1.16! root 244: cfgfile_write (f, "finegrain_cpu_speed=%d\n", p->m68k_speed);
1.1 root 245: else
1.1.1.16! root 246: cfgfile_write (f, "cpu_speed=%s\n", p->m68k_speed == -1 ? "max" : "real");
1.1 root 247:
1.1.1.16! root 248: cfgfile_write (f, "cpu_type=%s\n", cpumode[p->cpu_level * 2 + !p->address_space_24]);
! 249: cfgfile_write (f, "cpu_compatible=%s\n", p->cpu_compatible ? "true" : "false");
1.1 root 250:
1.1.1.16! root 251: cfgfile_write (f, "accuracy=%d\n", p->emul_accuracy);
! 252: cfgfile_write (f, "log_illegal_mem=%s\n", p->illegal_mem ? "true" : "false");
1.1 root 253:
1.1.1.16! root 254: cfgfile_write (f, "kbd_lang=%s\n", (p->keyboard_lang == KBD_LANG_DE ? "de"
1.1.1.9 root 255: : p->keyboard_lang == KBD_LANG_DK ? "dk"
1.1 root 256: : p->keyboard_lang == KBD_LANG_ES ? "es"
257: : p->keyboard_lang == KBD_LANG_US ? "us"
258: : p->keyboard_lang == KBD_LANG_SE ? "se"
259: : p->keyboard_lang == KBD_LANG_FR ? "fr"
260: : p->keyboard_lang == KBD_LANG_IT ? "it"
261: : "FOO"));
262:
263: write_filesys_config (p->mountinfo, UNEXPANDED, p->path_hardfile, f);
264:
265: /* Don't write gfxlib/gfx_test_speed options. */
266: }
267:
268: int cfgfile_yesno (char *option, char *value, char *name, int *location)
269: {
270: if (strcmp (option, name) != 0)
271: return 0;
272: if (strcasecmp (value, "yes") == 0 || strcasecmp (value, "y") == 0
273: || strcasecmp (value, "true") == 0 || strcasecmp (value, "t") == 0)
274: *location = 1;
275: else if (strcasecmp (value, "no") == 0 || strcasecmp (value, "n") == 0
276: || strcasecmp (value, "false") == 0 || strcasecmp (value, "f") == 0)
277: *location = 0;
278: else
279: write_log ("Option `%s' requires a value of either `yes' or `no'.\n", option);
280: return 1;
281: }
282:
283: int cfgfile_intval (char *option, char *value, char *name, int *location, int scale)
284: {
285: int base = 10;
286: char *endptr;
287: if (strcmp (option, name) != 0)
288: return 0;
289: /* I guess octal isn't popular enough to worry about here... */
290: if (value[0] == '0' && value[1] == 'x')
291: value += 2, base = 16;
292: *location = strtol (value, &endptr, base) * scale;
293:
294: if (*endptr != '\0' || *value == '\0')
295: write_log ("Option `%s' requires a numeric argument.\n", option);
296: return 1;
297: }
298:
299: int cfgfile_strval (char *option, char *value, char *name, int *location, const char *table[], int more)
300: {
301: int val;
302: if (strcmp (option, name) != 0)
303: return 0;
304: val = match_string (table, value);
305: if (val == -1) {
1.1.1.6 root 306: if (more)
307: return 0;
308:
309: write_log ("Unknown value for option `%s'.\n", option);
1.1 root 310: return 1;
311: }
312: *location = val;
313: return 1;
314: }
315:
316: int cfgfile_string (char *option, char *value, char *name, char *location, int maxsz)
317: {
318: if (strcmp (option, name) != 0)
319: return 0;
320: strncpy (location, value, maxsz - 1);
321: location[maxsz - 1] = '\0';
322: return 1;
323: }
324:
325: static int getintval (char **p, int *result, int delim)
326: {
327: char *value = *p;
328: int base = 10;
329: char *endptr;
330: char *p2 = strchr (*p, delim);
331:
332: if (p2 == 0)
333: return 0;
334:
335: *p2++ = '\0';
336:
337: if (value[0] == '0' && value[1] == 'x')
338: value += 2, base = 16;
339: *result = strtol (value, &endptr, base);
340: *p = p2;
341:
342: if (*endptr != '\0' || *value == '\0')
343: return 0;
344:
345: return 1;
346: }
347:
1.1.1.8 root 348: static void set_chipset_mask (struct uae_prefs *p, int val)
1.1.1.5 root 349: {
350: p->chipset_mask = (val == 0 ? 0
351: : val == 1 ? CSMASK_ECS_AGNUS
352: : val == 2 ? CSMASK_ECS_DENISE
353: : val == 3 ? CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS
354: : CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS);
355: }
356:
1.1.1.2 root 357: int cfgfile_parse_option (struct uae_prefs *p, char *option, char *value)
1.1 root 358: {
1.1.1.3 root 359: int tmpval;
1.1.1.9 root 360: int dummy;
1.1 root 361: char *section = 0;
362: char *tmpp;
1.1.1.3 root 363:
1.1 root 364: for (tmpp = option; *tmpp != '\0'; tmpp++)
365: if (isupper (*tmpp))
366: *tmpp = tolower (*tmpp);
367: tmpp = strchr (option, '.');
368: if (tmpp) {
369: section = option;
370: option = tmpp + 1;
371: *tmpp = '\0';
372: if (strcmp (section, TARGET_NAME) == 0) {
373: /* We special case the various path options here. */
374: if (cfgfile_string (option, value, "rom_path", p->path_rom, 256)
375: || cfgfile_string (option, value, "floppy_path", p->path_floppy, 256)
376: || cfgfile_string (option, value, "hardfile_path", p->path_hardfile, 256))
377: return 1;
378: return target_parse_option (p, option, value);
379: }
380: return 0;
381: }
382: if (cfgfile_yesno (option, value, "use_debugger", &p->start_debugger)
1.1.1.3 root 383: || cfgfile_yesno (option, value, "bsdsocket_emu", &p->socket_emu)
1.1 root 384: || cfgfile_yesno (option, value, "immediate_blits", &p->immediate_blits)
1.1.1.11 root 385: || cfgfile_yesno (option, value, "kickshifter", &p->kickshifter)
1.1 root 386: || cfgfile_yesno (option, value, "gfx_lores", &p->gfx_lores)
387: || cfgfile_yesno (option, value, "gfx_correct_aspect", &p->gfx_correct_aspect)
388: || cfgfile_yesno (option, value, "gfx_fullscreen_amiga", &p->gfx_afullscreen)
389: || cfgfile_yesno (option, value, "gfx_fullscreen_picasso", &p->gfx_pfullscreen)
1.1.1.3 root 390: || cfgfile_yesno (option, value, "ntsc", &p->ntscmode)
1.1 root 391: || cfgfile_yesno (option, value, "cpu_compatible", &p->cpu_compatible)
392: || cfgfile_yesno (option, value, "cpu_24bit_addressing", &p->address_space_24)
1.1.1.9 root 393: /* For backward compatibility. */
394: || cfgfile_yesno (option, value, "autoconfig", &dummy)
1.1 root 395: || cfgfile_yesno (option, value, "parallel_on_demand", &p->parallel_demand)
396: || cfgfile_yesno (option, value, "serial_on_demand", &p->serial_demand)
397: || cfgfile_yesno (option, value, "log_illegal_mem", &p->illegal_mem))
398: return 1;
399: if (cfgfile_intval (option, value, "accuracy", &p->emul_accuracy, 1)
400: || cfgfile_intval (option, value, "sound_min_buff", &p->sound_minbsiz, 1)
401: || cfgfile_intval (option, value, "sound_max_buff", &p->sound_maxbsiz, 1)
402: || cfgfile_intval (option, value, "sound_frequency", &p->sound_freq, 1)
403: || cfgfile_intval (option, value, "sound_bits", &p->sound_bits, 1)
404: || cfgfile_intval (option, value, "sound_pri_cutoff", &p->sound_pri_cutoff, 1)
405: || cfgfile_intval (option, value, "sound_pri_time", &p->sound_pri_time, 1)
1.1.1.3 root 406: || cfgfile_intval (option, value, "gfx_framerate", &p->gfx_framerate, 1)
1.1 root 407: || cfgfile_intval (option, value, "gfx_width", &p->gfx_width, 1)
408: || cfgfile_intval (option, value, "gfx_height", &p->gfx_height, 1)
409: || cfgfile_intval (option, value, "fastmem_size", &p->fastmem_size, 0x100000)
410: || cfgfile_intval (option, value, "a3000mem_size", &p->a3000mem_size, 0x100000)
411: || cfgfile_intval (option, value, "z3mem_size", &p->z3fastmem_size, 0x100000)
412: || cfgfile_intval (option, value, "bogomem_size", &p->bogomem_size, 0x40000)
413: || cfgfile_intval (option, value, "gfxcard_size", &p->gfxmem_size, 0x100000)
1.1.1.6 root 414: || cfgfile_intval (option, value, "chipmem_size", &p->chipmem_size, 0x80000)
415: || cfgfile_intval (option, value, "nr_floppies", &p->nr_floppies, 1))
1.1 root 416: return 1;
417: if (cfgfile_strval (option, value, "sound_output", &p->produce_sound, soundmode, 0)
1.1.1.4 root 418: || cfgfile_strval (option, value, "sound_interpol", &p->sound_interpol, interpolmode, 0)
1.1.1.10 root 419: || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode1, 1)
420: || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode2, 1)
421: || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode3, 0)
1.1.1.8 root 422: || cfgfile_strval (option, value, "collision_level", &p->collision_level, collmode, 0)
1.1 root 423: || cfgfile_strval (option, value, "gfx_linemode", &p->gfx_linedbl, linemode1, 1)
424: || cfgfile_strval (option, value, "gfx_linemode", &p->gfx_linedbl, linemode2, 0)
1.1.1.2 root 425: || cfgfile_strval (option, value, "gfx_center_horizontal", &p->gfx_xcenter, centermode1, 1)
426: || cfgfile_strval (option, value, "gfx_center_vertical", &p->gfx_ycenter, centermode1, 1)
427: || cfgfile_strval (option, value, "gfx_center_horizontal", &p->gfx_xcenter, centermode2, 0)
428: || cfgfile_strval (option, value, "gfx_center_vertical", &p->gfx_ycenter, centermode2, 0)
1.1 root 429: || cfgfile_strval (option, value, "gfx_colour_mode", &p->color_mode, colormode1, 1)
430: || cfgfile_strval (option, value, "gfx_colour_mode", &p->color_mode, colormode2, 0)
431: || cfgfile_strval (option, value, "gfx_color_mode", &p->color_mode, colormode1, 1)
432: || cfgfile_strval (option, value, "gfx_color_mode", &p->color_mode, colormode2, 0))
433: return 1;
1.1.1.16! root 434:
! 435: if (strcmp (option, "joyport0") == 0 || strcmp (option, "joyport1") == 0) {
! 436: int port = strcmp (option, "joyport0") == 0 ? 0 : 1;
! 437: int start = -1;
! 438: char *pp = 0;
! 439: if (strncmp (value, "kbd", 3) == 0) {
! 440: start = JSEM_KBDLAYOUT;
! 441: pp = value + 3;
! 442: } else if (strncmp (value, "joy", 3) == 0) {
! 443: start = JSEM_JOYS;
! 444: pp = value + 3;
! 445: } else if (strncmp (value, "mouse", 5) == 0) {
! 446: start = JSEM_MICE;
! 447: pp = value + 5;
! 448: }
! 449: if (pp) {
! 450: int v = atol (pp);
! 451: if (start >= 0) {
! 452: if (start == JSEM_KBDLAYOUT)
! 453: v--;
! 454: if (v >= 0) {
! 455: start += v;
! 456: if (port)
! 457: p->jport1 = start;
! 458: else
! 459: p->jport0 = start;
! 460: }
! 461: }
! 462: }
! 463: return 1;
! 464: }
! 465:
1.1 root 466: if (cfgfile_string (option, value, "floppy0", p->df[0], 256)
467: || cfgfile_string (option, value, "floppy1", p->df[1], 256)
468: || cfgfile_string (option, value, "floppy2", p->df[2], 256)
469: || cfgfile_string (option, value, "floppy3", p->df[3], 256)
470: || cfgfile_string (option, value, "kickstart_rom_file", p->romfile, 256)
1.1.1.12 root 471: || cfgfile_string (option, value, "kickstart_ext_rom_file", p->romextfile, 256)
1.1 root 472: || cfgfile_string (option, value, "kickstart_key_file", p->keyfile, 256)
1.1.1.2 root 473: || cfgfile_string (option, value, "config_description", p->description, 256))
1.1 root 474: return 1;
475:
476: /* Tricky ones... */
1.1.1.3 root 477: if (cfgfile_strval (option, value, "chipset", &tmpval, csmode, 0)) {
1.1.1.5 root 478: set_chipset_mask (p, tmpval);
1.1.1.3 root 479: return 1;
480: }
1.1.1.7 root 481:
1.1.1.14 root 482: if (cfgfile_strval (option, value, "sound_channels", &p->sound_stereo, stereomode1, 1)
483: || cfgfile_strval (option, value, "sound_channels", &p->sound_stereo, stereomode2, 1)
484: || cfgfile_strval (option, value, "sound_channels", &p->sound_stereo, stereomode3, 0))
1.1.1.8 root 485: {
486: p->mixed_stereo = 0;
1.1.1.14 root 487: if (p->sound_stereo == 2) {
488: p->sound_stereo = 1;
1.1.1.8 root 489: p->mixed_stereo = 1;
490: }
1.1.1.13 root 491: return 1;
1.1.1.8 root 492: }
493:
1.1 root 494: if (cfgfile_strval (option, value, "cpu_type", &p->cpu_level, cpumode, 0)) {
1.1.1.7 root 495: p->address_space_24 = p->cpu_level < 8 && !(p->cpu_level & 1);
1.1 root 496: p->cpu_level >>= 1;
497: return 1;
498: }
1.1.1.11 root 499: if (cfgfile_strval (option, value, "cpu_speed", &p->m68k_speed, speedmode, 1)
500: /* Broken earlier versions used to write this out as a string. */
501: || cfgfile_strval (option, value, "finegraincpu_speed", &p->m68k_speed, speedmode, 1))
502: {
1.1 root 503: p->m68k_speed--;
504: return 1;
505: }
1.1.1.8 root 506: if (cfgfile_intval (option, value, "cpu_speed", &p->m68k_speed, 1)) {
1.1.1.16! root 507: p->m68k_speed *= CYCLE_UNIT;
1.1.1.8 root 508: return 1;
509: }
1.1.1.9 root 510: if (cfgfile_intval (option, value, "finegrain_cpu_speed", &p->m68k_speed, 1)) {
511: if (OFFICIAL_CYCLE_UNIT > CYCLE_UNIT) {
512: int factor = OFFICIAL_CYCLE_UNIT / CYCLE_UNIT;
513: p->m68k_speed = (p->m68k_speed + factor - 1) / factor;
514: }
1.1 root 515: return 1;
1.1.1.9 root 516: }
1.1 root 517:
518: if (strcmp (option, "kbd_lang") == 0) {
519: KbdLang l;
520: if ((l = KBD_LANG_DE, strcasecmp (value, "de") == 0)
1.1.1.9 root 521: || (l = KBD_LANG_DK, strcasecmp (value, "dk") == 0)
1.1 root 522: || (l = KBD_LANG_SE, strcasecmp (value, "se") == 0)
523: || (l = KBD_LANG_US, strcasecmp (value, "us") == 0)
524: || (l = KBD_LANG_FR, strcasecmp (value, "fr") == 0)
525: || (l = KBD_LANG_IT, strcasecmp (value, "it") == 0)
526: || (l = KBD_LANG_ES, strcasecmp (value, "es") == 0))
527: p->keyboard_lang = l;
528: else
529: write_log ("Unknown keyboard language\n");
530: return 1;
531: }
532:
533: if (strcmp (option, "filesystem") == 0
534: || strcmp (option, "hardfile") == 0)
535: {
1.1.1.2 root 536: int secs, heads, reserved, bs, ro;
537: char *aname, *root;
1.1 root 538: char *tmpp = strchr (value, ',');
1.1.1.2 root 539: char *str;
1.1 root 540: if (tmpp == 0)
541: goto invalid_fs;
542:
543: *tmpp++ = '\0';
544: if (strcmp (value, "0") == 0 || strcasecmp (value, "ro") == 0
545: || strcasecmp (value, "readonly") == 0
546: || strcasecmp (value, "read-only") == 0)
1.1.1.2 root 547: ro = 1;
1.1 root 548: else if (strcmp (value, "1") == 0 || strcasecmp (value, "rw") == 0
549: || strcasecmp (value, "readwrite") == 0
550: || strcasecmp (value, "read-write") == 0)
1.1.1.2 root 551: ro = 0;
1.1 root 552: else
553: goto invalid_fs;
1.1.1.2 root 554: secs = 0; heads = 0; reserved = 0; bs = 0;
1.1 root 555:
556: value = tmpp;
557: if (strcmp (option, "filesystem") == 0) {
558: tmpp = strchr (value, ':');
559: if (tmpp == 0)
560: goto invalid_fs;
561: *tmpp++ = '\0';
1.1.1.2 root 562: aname = value;
563: root = tmpp;
1.1 root 564: } else {
1.1.1.2 root 565: if (! getintval (&value, &secs, ',')
566: || ! getintval (&value, &heads, ',')
567: || ! getintval (&value, &reserved, ',')
568: || ! getintval (&value, &bs, ','))
1.1 root 569: goto invalid_fs;
1.1.1.2 root 570: root = value;
571: aname = 0;
1.1 root 572: }
1.1.1.2 root 573: str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile, root);
574: tmpp = add_filesys_unit (p->mountinfo, aname, str, ro, secs,
575: heads, reserved, bs);
576: free (str);
577: if (tmpp)
578: write_log ("Error: %s\n", tmpp);
1.1 root 579: return 1;
580:
581: invalid_fs:
582: write_log ("Invalid filesystem/hardfile specification.\n");
583: return 1;
584: }
585:
586: return 0;
587: }
588:
1.1.1.2 root 589: void cfgfile_parse_line (struct uae_prefs *p, char *line)
1.1 root 590: {
591: int i;
592: char *orig_line = my_strdup (line);
593: char *line1, *line2;
594:
595: line1 = line;
596: line2 = strchr (line, '=');
597: if (! line2) {
598: write_log ("CFGFILE: line was incomplete with only %s\n", line1);
599: return;
600: }
601:
602: *line2++ = '\0';
603:
604: /* Get rid of whitespace. */
1.1.1.2 root 605: i = strlen (line2);
606: while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
607: || line2[i - 1] == '\r' || line2[i - 1] == '\n'))
608: line2[--i] = '\0';
1.1 root 609: line2 += strspn (line2, "\t \r\n");
1.1.1.2 root 610: i = strlen (line);
611: while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' '
612: || line[i - 1] == '\r' || line[i - 1] == '\n'))
613: line[--i] = '\0';
1.1 root 614: line += strspn (line, "\t \r\n");
615:
1.1.1.2 root 616: if (! cfgfile_parse_option (p, line, line2)) {
1.1 root 617: struct strlist *u = xmalloc (sizeof (struct strlist));
618: u->str = orig_line;
619: u->next = p->unknown_lines;
620: p->unknown_lines = u;
621: } else
622: free (orig_line);
623: }
624:
625: static void subst (char *p, char *f, int n)
626: {
627: char *str = cfgfile_subst_path (UNEXPANDED, p, f);
628: strncpy (f, str, n - 1);
629: f[n - 1] = '\0';
630: free (str);
631: }
632:
633: int cfgfile_load (struct uae_prefs *p, const char *filename)
634: {
635: int i;
636:
637: FILE *fh;
638: char line[256];
639:
1.1.1.4 root 640: fh = fopen (filename, "r");
1.1 root 641: if (! fh)
642: return 0;
643:
644: while (fgets (line, 256, fh) != 0) {
1.1.1.13 root 645: int len = strlen (line);
646: /* Delete trailing whitespace. */
647: while (len > 0 && strcspn (line + len - 1, "\t \r\n") == 0) {
648: line[--len] = '\0';
649: }
1.1 root 650: if (strlen (line) > 0)
1.1.1.2 root 651: cfgfile_parse_line (p, line);
1.1 root 652: }
653: fclose (fh);
654:
655: for (i = 0; i < 4; i++)
656: subst (p->path_floppy, p->df[i], sizeof p->df[i]);
657: subst (p->path_rom, p->romfile, sizeof p->romfile);
1.1.1.12 root 658: subst (p->path_rom, p->romextfile, sizeof p->romextfile);
1.1 root 659: subst (p->path_rom, p->keyfile, sizeof p->keyfile);
660:
661: return 1;
662: }
663:
664: int cfgfile_save (struct uae_prefs *p, const char *filename)
665: {
666: FILE *fh = fopen (filename, "w");
667: if (! fh)
668: return 0;
669:
670: save_options (fh, p);
671: fclose (fh);
672: return 1;
673: }
674:
675: int cfgfile_get_description (const char *filename, char *description)
676: {
677: int result = 0;
678: struct uae_prefs p;
679: default_prefs (&p);
680: strcpy (p.description, "");
1.1.1.12 root 681: if (cfgfile_load (&p, filename)) {
1.1 root 682: result = 1;
683: strcpy (description, p.description);
684: }
685: discard_prefs (&p);
686: return result;
687: }
688:
689: void cfgfile_show_usage (void)
690: {
691: int i;
692: fprintf (stderr, "UAE Configuration Help:\n" \
693: "=======================\n");
694: for (i = 0; i < sizeof opttable / sizeof *opttable; i++)
695: fprintf (stderr, "%s: %s\n", opttable[i].config_label, opttable[i].config_help);
696: }
1.1.1.4 root 697:
698: /* This implements the old commandline option parsing. I've re-added this
699: because the new way of doing things is painful for me (it requires me
700: to type a couple hundred characters when invoking UAE). The following
701: is far less annoying to use. */
1.1.1.16! root 702: static void parse_gfx_specs (struct uae_prefs *p, char *spec)
1.1.1.4 root 703: {
704: char *x0 = my_strdup (spec);
705: char *x1, *x2;
706:
707: x1 = strchr (x0, ':');
708: if (x1 == 0)
709: goto argh;
710: x2 = strchr (x1+1, ':');
711: if (x2 == 0)
712: goto argh;
713: *x1++ = 0; *x2++ = 0;
714:
1.1.1.16! root 715: p->gfx_width = atoi (x0);
! 716: p->gfx_height = atoi (x1);
! 717: p->gfx_lores = strchr (x2, 'l') != 0;
! 718: p->gfx_xcenter = strchr (x2, 'x') != 0 ? 1 : strchr (x2, 'X') != 0 ? 2 : 0;
! 719: p->gfx_ycenter = strchr (x2, 'y') != 0 ? 1 : strchr (x2, 'Y') != 0 ? 2 : 0;
! 720: p->gfx_linedbl = strchr (x2, 'd') != 0;
! 721: p->gfx_linedbl += 2 * (strchr (x2, 'D') != 0);
! 722: p->gfx_afullscreen = strchr (x2, 'a') != 0;
! 723: p->gfx_pfullscreen = strchr (x2, 'p') != 0;
! 724: p->gfx_correct_aspect = strchr (x2, 'c') != 0;
1.1.1.4 root 725:
1.1.1.16! root 726: if (p->gfx_linedbl == 3) {
1.1.1.4 root 727: fprintf (stderr, "You can't use both 'd' and 'D' modifiers in the display mode specification.\n");
728: }
1.1.1.16! root 729:
1.1.1.4 root 730: free (x0);
731: return;
732:
733: argh:
734: fprintf (stderr, "Bad display mode specification.\n");
735: fprintf (stderr, "The format to use is: \"width:height:modifiers\"\n");
736: fprintf (stderr, "Type \"uae -h\" for detailed help.\n");
737: free (x0);
738: }
739:
1.1.1.16! root 740: static void parse_sound_spec (struct uae_prefs *p, char *spec)
1.1.1.4 root 741: {
742: char *x0 = my_strdup (spec);
743: char *x1, *x2 = NULL, *x3 = NULL, *x4 = NULL, *x5 = NULL;
744:
745: x1 = strchr (x0, ':');
746: if (x1 != NULL) {
747: *x1++ = '\0';
748: x2 = strchr (x1 + 1, ':');
749: if (x2 != NULL) {
750: *x2++ = '\0';
751: x3 = strchr (x2 + 1, ':');
752: if (x3 != NULL) {
753: *x3++ = '\0';
754: x4 = strchr (x3 + 1, ':');
755: if (x4 != NULL) {
756: *x4++ = '\0';
757: x5 = strchr (x4 + 1, ':');
758: }
759: }
760: }
761: }
1.1.1.16! root 762: p->produce_sound = atoi (x0);
1.1.1.4 root 763: if (x1) {
1.1.1.16! root 764: p->mixed_stereo = 0;
1.1.1.8 root 765: if (*x1 == 'S')
1.1.1.16! root 766: p->sound_stereo = p->mixed_stereo = 1;
1.1.1.8 root 767: else if (*x1 == 's')
1.1.1.16! root 768: p->sound_stereo = 1;
1.1.1.4 root 769: else
1.1.1.16! root 770: p->sound_stereo = 0;
1.1.1.4 root 771: }
772: if (x2)
1.1.1.16! root 773: p->sound_bits = atoi (x2);
1.1.1.4 root 774: if (x3)
1.1.1.16! root 775: p->sound_freq = atoi (x3);
1.1.1.4 root 776: if (x4)
1.1.1.16! root 777: p->sound_maxbsiz = p->sound_minbsiz = atoi (x4);
1.1.1.4 root 778: if (x5)
1.1.1.16! root 779: p->sound_minbsiz = atoi (x5);
1.1.1.4 root 780: free (x0);
781: return;
782: }
783:
784:
1.1.1.16! root 785: static void parse_joy_spec (struct uae_prefs *p, char *spec)
1.1.1.4 root 786: {
787: int v0 = 2, v1 = 0;
788: if (strlen(spec) != 2)
789: goto bad;
790:
791: switch (spec[0]) {
1.1.1.16! root 792: case '0': v0 = JSEM_JOYS; break;
! 793: case '1': v0 = JSEM_JOYS + 1; break;
! 794: case 'M': case 'm': v0 = JSEM_MICE; break;
! 795: case 'A': case 'a': v0 = JSEM_KBDLAYOUT; break;
! 796: case 'B': case 'b': v0 = JSEM_KBDLAYOUT + 1; break;
! 797: case 'C': case 'c': v0 = JSEM_KBDLAYOUT + 2; break;
1.1.1.4 root 798: default: goto bad;
799: }
800:
801: switch (spec[1]) {
1.1.1.16! root 802: case '0': v1 = JSEM_JOYS; break;
! 803: case '1': v1 = JSEM_JOYS + 1; break;
! 804: case 'M': case 'm': v1 = JSEM_MICE; break;
! 805: case 'A': case 'a': v1 = JSEM_KBDLAYOUT; break;
! 806: case 'B': case 'b': v1 = JSEM_KBDLAYOUT + 1; break;
! 807: case 'C': case 'c': v1 = JSEM_KBDLAYOUT + 2; break;
1.1.1.4 root 808: default: goto bad;
809: }
810: if (v0 == v1)
811: goto bad;
812: /* Let's scare Pascal programmers */
813: if (0)
814: bad:
1.1.1.16! root 815: write_log ("Bad joystick mode specification. Use -J xy, where x and y\n"
1.1.1.4 root 816: "can be 0 for joystick 0, 1 for joystick 1, M for mouse, and\n"
817: "a, b or c for different keyboard settings.\n");
818:
1.1.1.16! root 819: p->jport0 = v0;
! 820: p->jport1 = v1;
1.1.1.4 root 821: }
822:
823: static void parse_filesys_spec (int readonly, char *spec)
824: {
825: char buf[256];
826: char *s2;
827:
828: strncpy (buf, spec, 255); buf[255] = 0;
829: s2 = strchr (buf, ':');
830: if (s2) {
831: *s2++ = '\0';
832: #ifdef __DOS__
833: {
834: char *tmp;
1.1.1.16! root 835:
1.1.1.4 root 836: while ((tmp = strchr (s2, '\\')))
837: *tmp = '/';
838: }
839: #endif
840: s2 = add_filesys_unit (currprefs.mountinfo, buf, s2, readonly, 0, 0, 0, 0);
841: if (s2)
842: fprintf (stderr, "%s\n", s2);
843: } else {
844: fprintf (stderr, "Usage: [-m | -M] VOLNAME:mount_point\n");
845: }
846: }
1.1.1.16! root 847:
1.1.1.4 root 848: static void parse_hardfile_spec (char *spec)
849: {
850: char *x0 = my_strdup (spec);
851: char *x1, *x2, *x3, *x4;
852:
853: x1 = strchr (x0, ':');
854: if (x1 == NULL)
855: goto argh;
856: *x1++ = '\0';
857: x2 = strchr (x1 + 1, ':');
858: if (x2 == NULL)
859: goto argh;
860: *x2++ = '\0';
861: x3 = strchr (x2 + 1, ':');
862: if (x3 == NULL)
863: goto argh;
864: *x3++ = '\0';
865: x4 = strchr (x3 + 1, ':');
866: if (x4 == NULL)
867: goto argh;
868: *x4++ = '\0';
869: x4 = add_filesys_unit (currprefs.mountinfo, 0, x4, 0, atoi (x0), atoi (x1), atoi (x2), atoi (x3));
870: if (x4)
871: fprintf (stderr, "%s\n", x4);
872:
873: free (x0);
874: return;
875:
876: argh:
877: free (x0);
878: fprintf (stderr, "Bad hardfile parameter specified - type \"uae -h\" for help.\n");
879: return;
880: }
881:
882: static void parse_cpu_specs (char *spec)
883: {
1.1.1.7 root 884: if (*spec < '0' || *spec > '4') {
885: fprintf (stderr, "CPU parameter string must begin with '0', '1', '2', '3' or '4'.\n");
1.1.1.4 root 886: return;
887: }
1.1.1.16! root 888:
1.1.1.4 root 889: currprefs.cpu_level = *spec++ - '0';
890: currprefs.address_space_24 = currprefs.cpu_level < 2;
891: currprefs.cpu_compatible = 0;
892: while (*spec != '\0') {
893: switch (*spec) {
894: case 'a':
895: if (currprefs.cpu_level < 2)
896: fprintf (stderr, "In 68000/68010 emulation, the address space is always 24 bit.\n");
1.1.1.7 root 897: else if (currprefs.cpu_level >= 4)
898: fprintf (stderr, "In 68040 emulation, the address space is always 32 bit.\n");
1.1.1.4 root 899: else
900: currprefs.address_space_24 = 1;
901: break;
902: case 'c':
903: if (currprefs.cpu_level != 0)
904: fprintf (stderr, "The more compatible CPU emulation is only available for 68000\n"
905: "emulation, not for 68010 upwards.\n");
906: else
907: currprefs.cpu_compatible = 1;
908: break;
909: default:
910: fprintf (stderr, "Bad CPU parameter specified - type \"uae -h\" for help.\n");
911: break;
912: }
913: spec++;
914: }
915: }
916:
917: /* Returns the number of args used up (0 or 1). */
918: int parse_cmdline_option (char c, char *arg)
919: {
1.1.1.5 root 920: const char arg_required[] = "0123rKpImWSAJwNCZUFcblOdHRv";
1.1.1.4 root 921:
922: if (strchr (arg_required, c) && ! arg) {
923: fprintf (stderr, "Missing argument for option `-%c'!\n", c);
924: return 0;
925: }
926:
927: switch (c) {
1.1.1.5 root 928: case 'h': usage (); exit (0);
1.1.1.4 root 929:
1.1.1.5 root 930: case '0': strncpy (currprefs.df[0], arg, 255); currprefs.df[0][255] = 0; break;
931: case '1': strncpy (currprefs.df[1], arg, 255); currprefs.df[1][255] = 0; break;
932: case '2': strncpy (currprefs.df[2], arg, 255); currprefs.df[2][255] = 0; break;
933: case '3': strncpy (currprefs.df[3], arg, 255); currprefs.df[3][255] = 0; break;
934: case 'r': strncpy (currprefs.romfile, arg, 255); currprefs.romfile[255] = 0; break;
935: case 'K': strncpy (currprefs.keyfile, arg, 255); currprefs.keyfile[255] = 0; break;
936: case 'p': strncpy (currprefs.prtname, arg, 255); currprefs.prtname[255] = 0; break;
1.1.1.4 root 937: /* case 'I': strncpy (currprefs.sername, arg, 255); currprefs.sername[255] = 0; currprefs.use_serial = 1; break; */
1.1.1.5 root 938: case 'm': case 'M': parse_filesys_spec (c == 'M', arg); break;
939: case 'W': parse_hardfile_spec (arg); break;
1.1.1.16! root 940: case 'S': parse_sound_spec (&currprefs, arg); break;
1.1.1.5 root 941: case 'R': currprefs.gfx_framerate = atoi (arg); break;
942: case 'A': currprefs.emul_accuracy = atoi (arg); break;
943: case 'x': currprefs.no_xhair = 1; break;
944: case 'i': currprefs.illegal_mem = 1; break;
1.1.1.16! root 945: case 'J': parse_joy_spec (&currprefs, arg); break;
1.1.1.5 root 946:
947: case 't': currprefs.test_drawing_speed = 1; break;
948: case 'L': currprefs.x11_use_low_bandwidth = 1; break;
949: case 'T': currprefs.x11_use_mitshm = 1; break;
950: case 'w': currprefs.m68k_speed = atoi (arg); break;
1.1.1.4 root 951:
952: /* case 'g': currprefs.use_gfxlib = 1; break; */
1.1.1.5 root 953: case 'G': currprefs.start_gui = 0; break;
954: case 'D': currprefs.start_debugger = 1; break;
1.1.1.4 root 955:
1.1.1.5 root 956: case 'n':
1.1.1.4 root 957: if (strchr (arg, '3') != 0)
958: currprefs.blits_32bit_enabled = 1;
959: if (strchr (arg, 'i') != 0)
960: currprefs.immediate_blits = 1;
961: break;
962:
1.1.1.5 root 963: case 'v':
964: set_chipset_mask (&currprefs, atoi (arg));
965: break;
966:
967: case 'C':
1.1.1.4 root 968: parse_cpu_specs (arg);
969: break;
970:
1.1.1.5 root 971: case 'Z':
1.1.1.4 root 972: currprefs.z3fastmem_size = atoi (arg) * 0x100000;
973: break;
974:
1.1.1.5 root 975: case 'U':
1.1.1.4 root 976: currprefs.gfxmem_size = atoi (arg) * 0x100000;
977: break;
978:
1.1.1.5 root 979: case 'F':
1.1.1.4 root 980: currprefs.fastmem_size = atoi (arg) * 0x100000;
981: break;
982:
1.1.1.5 root 983: case 'b':
1.1.1.4 root 984: currprefs.bogomem_size = atoi (arg) * 0x40000;
985: break;
986:
1.1.1.5 root 987: case 'c':
1.1.1.4 root 988: currprefs.chipmem_size = atoi (arg) * 0x80000;
989: break;
990:
1.1.1.5 root 991: case 'l':
1.1.1.4 root 992: if (0 == strcasecmp(arg, "de"))
993: currprefs.keyboard_lang = KBD_LANG_DE;
1.1.1.9 root 994: else if (0 == strcasecmp(arg, "dk"))
995: currprefs.keyboard_lang = KBD_LANG_DK;
1.1.1.4 root 996: else if (0 == strcasecmp(arg, "us"))
997: currprefs.keyboard_lang = KBD_LANG_US;
998: else if (0 == strcasecmp(arg, "se"))
999: currprefs.keyboard_lang = KBD_LANG_SE;
1000: else if (0 == strcasecmp(arg, "fr"))
1001: currprefs.keyboard_lang = KBD_LANG_FR;
1002: else if (0 == strcasecmp(arg, "it"))
1003: currprefs.keyboard_lang = KBD_LANG_IT;
1004: else if (0 == strcasecmp(arg, "es"))
1005: currprefs.keyboard_lang = KBD_LANG_ES;
1006: break;
1007:
1.1.1.16! root 1008: case 'O': parse_gfx_specs (&currprefs, arg); break;
1.1.1.5 root 1009: case 'd':
1.1.1.4 root 1010: if (strchr (arg, 'S') != NULL || strchr (arg, 's')) {
1011: write_log (" Serial on demand.\n");
1012: currprefs.serial_demand = 1;
1013: }
1014: if (strchr (arg, 'P') != NULL || strchr (arg, 'p')) {
1015: write_log (" Parallel on demand.\n");
1016: currprefs.parallel_demand = 1;
1017: }
1018:
1019: break;
1020:
1.1.1.5 root 1021: case 'H':
1.1.1.4 root 1022: currprefs.color_mode = atoi (arg);
1023: if (currprefs.color_mode < 0) {
1024: fprintf (stderr, "Bad color mode selected. Using default.\n");
1025: currprefs.color_mode = 0;
1026: }
1027: break;
1.1.1.5 root 1028: default:
1.1.1.4 root 1029: fprintf (stderr, "Unknown option `-%c'!\n", c);
1030: break;
1031: }
1032: return !! strchr (arg_required, c);
1033: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.