--- previous/src/options.c 2018/04/24 19:25:10 1.1 +++ previous/src/options.c 2018/04/24 19:31:17 1.1.1.5 @@ -29,16 +29,10 @@ const char Options_fileid[] = "Hatari op #include "screen.h" #include "video.h" #include "log.h" -#include "avi_record.h" +#include "paths.h" #include "hatari-glue.h" - -bool bLoadAutoSave; /* Load autosave memory snapshot at startup */ -bool bLoadMemorySave; /* Load memory snapshot provided via option at startup */ -bool bBiosIntercept; /* whether UAE should intercept Bios & XBios calls */ -bool AviRecordOnStartup; /* Start avi recording at startup */ - static bool bNoSDLParachute; /* List of supported options. */ @@ -48,68 +42,35 @@ enum { OPT_VERSION, OPT_CONFIRMQUIT, OPT_CONFIGFILE, - OPT_FASTFORWARD, - OPT_MONO, /* display options */ + OPT_KEYMAPFILE, OPT_MONITOR, OPT_FULLSCREEN, OPT_WINDOW, OPT_GRAB, - OPT_ZOOM, - OPT_MAXWIDTH, - OPT_MAXHEIGHT, - OPT_ASPECT, - OPT_BORDERS, - OPT_FRAMESKIPS, OPT_STATUSBAR, OPT_DRIVE_LED, - OPT_SPEC512, - OPT_FORCEBPP, - OPT_VDI, /* VDI options */ - OPT_VDI_PLANES, - OPT_VDI_WIDTH, - OPT_VDI_HEIGHT, - OPT_AVIRECORD, /* record options */ - OPT_AVIRECORD_VCODEC, - OPT_AVIRECORD_FPS, - OPT_AVIRECORD_CROP, - OPT_AVIRECORD_FILE, - OPT_JOYSTICK, /* device options */ - OPT_JOYSTICK0, - OPT_JOYSTICK1, - OPT_JOYSTICK2, - OPT_JOYSTICK3, - OPT_JOYSTICK4, - OPT_JOYSTICK5, OPT_PRINTER, - OPT_MIDI_IN, - OPT_MIDI_OUT, - OPT_RS232_IN, - OPT_RS232_OUT, - OPT_DISKA, /* disk options */ - OPT_DISKB, - OPT_SLOWFLOPPY, - OPT_WRITEPROT_FLOPPY, OPT_WRITEPROT_HD, - OPT_HARDDRIVE, - OPT_ACSIHDIMAGE, - OPT_IDEMASTERHDIMAGE, - OPT_IDESLAVEHDIMAGE, OPT_MEMSIZE, /* memory options */ - OPT_TOS, - OPT_CARTRIDGE, OPT_MEMSTATE, OPT_CPULEVEL, /* CPU options */ OPT_CPUCLOCK, OPT_COMPATIBLE, + + OPT_CPU_CYCLE_EXACT, /* WinUAE CPU/FPU/bus options */ + OPT_CPU_ADDR24, + OPT_FPU_TYPE, + OPT_FPU_COMPATIBLE, + OPT_MMU, + OPT_MACHINE, /* system options */ - OPT_BLITTER, - OPT_TIMERD, + OPT_REALTIME, OPT_DSP, + OPT_MICROPHONE, OPT_SOUND, OPT_SOUNDBUFFERSIZE, - OPT_KEYMAPFILE, + OPT_RTC, OPT_DEBUG, /* debug options */ - OPT_BIOSINTERCEPT, OPT_TRACE, OPT_TRACEFILE, OPT_PARSE, @@ -119,7 +80,6 @@ enum { OPT_LOGFILE, OPT_LOGLEVEL, OPT_ALERTLEVEL, - OPT_RUNVBLS, OPT_ERROR, OPT_CONTINUE }; @@ -144,12 +104,10 @@ static const opt_t HatariOptions[] = { "", "Whether Hatari confirms quit" }, { OPT_CONFIGFILE, "-c", "--configfile", "", "Use instead of the default hatari config file" }, - { OPT_FASTFORWARD, NULL, "--fast-forward", - "", "Help skipping stuff on fast machine" }, - - { OPT_HEADER, NULL, NULL, NULL, "Display" }, - { OPT_MONO, "-m", "--mono", - NULL, "Start in monochrome mode instead of color" }, + { OPT_KEYMAPFILE, "-k", "--keymap", + "", "Read (additional) keyboard mappings from " }, + + { OPT_HEADER, NULL, NULL, NULL, "Common display" }, { OPT_MONITOR, NULL, "--monitor", "", "Select monitor type (x = mono/rgb/vga/tv)" }, { OPT_FULLSCREEN,"-f", "--fullscreen", @@ -158,107 +116,22 @@ static const opt_t HatariOptions[] = { NULL, "Start emulator in window mode" }, { OPT_GRAB, NULL, "--grab", NULL, "Grab mouse (also) in window mode" }, - { OPT_ZOOM, "-z", "--zoom", - "", "Double small resolutions (1=no, 2=yes)" }, - { OPT_MAXWIDTH, NULL, "--max-width", - "", "Maximum window width for zooming (Falcon/TT only)" }, - { OPT_MAXHEIGHT, NULL, "--max-height", - "", "Maximum window height for zooming (Falcon/TT only)" }, - { OPT_ASPECT, NULL, "--aspect", - "", "Monitor aspect ratio correction (Falcon/TT only)" }, - { OPT_BORDERS, NULL, "--borders", - "", "Show ST/STE screen borders (for overscan demos etc)" }, - { OPT_FRAMESKIPS, NULL, "--frameskips", - "", "Skip frames after each shown frame (0=off, >4=auto/max)" }, { OPT_STATUSBAR, NULL, "--statusbar", "", "Show statusbar (floppy leds etc)" }, { OPT_DRIVE_LED, NULL, "--drive-led", "", "Show overlay drive led when statusbar isn't shown" }, - { OPT_SPEC512, NULL, "--spec512", - "", "Spec512 palette threshold (0 <= x <= 512, 0=disable)" }, - { OPT_FORCEBPP, NULL, "--bpp", - "", "Force internal bitdepth (x = 8/15/16/32, 0=disable)" }, - - { OPT_HEADER, NULL, NULL, NULL, "VDI" }, - { OPT_VDI, NULL, "--vdi", - "", "Whether to use VDI screen mode" }, - { OPT_VDI_PLANES,NULL, "--vdi-planes", - "", "VDI mode bit-depth (x = 1/2/4)" }, - { OPT_VDI_WIDTH, NULL, "--vdi-width", - "", "VDI mode width (320 < w <= 1280)" }, - { OPT_VDI_HEIGHT, NULL, "--vdi-height", - "", "VDI mode height (200 < h <= 960)" }, - - { OPT_HEADER, NULL, NULL, NULL, "Video recording" }, - { OPT_AVIRECORD, NULL, "--avirecord", - NULL, "Start AVI recording" }, - { OPT_AVIRECORD_VCODEC, NULL, "--avi-vcodec", - "", "Select avi video codec (x = bmp/png)" }, - { OPT_AVIRECORD_FPS, NULL, "--avi-fps", - "", "Force avi frame rate (x = 50/60/71/...)" }, - { OPT_AVIRECORD_CROP, NULL, "--avi-crop", - "", "Remove status bar from the recorded file" }, - { OPT_AVIRECORD_FILE, NULL, "--avi-file", - "", "Use to record avi" }, { OPT_HEADER, NULL, NULL, NULL, "Devices" }, - { OPT_JOYSTICK, "-j", "--joystick", - "", "Emulate joystick with cursor keys in given port (0-5)" }, - /* these have to be exactly the same as I'm relying compiler giving - * them the same same string pointer when strings are identical - * (Opt_ShowHelpSection() skips successive options with same help - * pointer). - */ - { OPT_JOYSTICK0, NULL, "--joy", - "", "Set joystick type (none/keys/real) for given port" }, - { OPT_JOYSTICK1, NULL, "--joy", - "", "Set joystick type (none/keys/real) for given port" }, - { OPT_JOYSTICK2, NULL, "--joy", - "", "Set joystick type (none/keys/real) for given port" }, - { OPT_JOYSTICK3, NULL, "--joy", - "", "Set joystick type (none/keys/real) for given port" }, - { OPT_JOYSTICK4, NULL, "--joy", - "", "Set joystick type (none/keys/real) for given port" }, - { OPT_JOYSTICK5, NULL, "--joy", - "", "Set joystick type (none/keys/real) for given port" }, { OPT_PRINTER, NULL, "--printer", "", "Enable printer support and write data to " }, - { OPT_MIDI_IN, NULL, "--midi-in", - "", "Enable MIDI and use as the input device" }, - { OPT_MIDI_OUT, NULL, "--midi-out", - "", "Enable MIDI and use as the output device" }, - { OPT_RS232_IN, NULL, "--rs232-in", - "", "Enable serial port and use as the input device" }, - { OPT_RS232_OUT, NULL, "--rs232-out", - "", "Enable serial port and use as the output device" }, { OPT_HEADER, NULL, NULL, NULL, "Disk" }, - { OPT_DISKA, NULL, "--disk-a", - "", "Set disk image for floppy drive A" }, - { OPT_DISKB, NULL, "--disk-b", - "", "Set disk image for floppy drive B" }, - { OPT_SLOWFLOPPY, NULL, "--slowfdc", - "", "Slow down floppy disk access emulation" }, - { OPT_WRITEPROT_FLOPPY, NULL, "--protect-floppy", - "", "Write protect floppy image contents (on/off/auto)" }, { OPT_WRITEPROT_HD, NULL, "--protect-hd", "", "Write protect harddrive contents (on/off/auto)" }, - { OPT_HARDDRIVE, "-d", "--harddrive", - "", "Emulate harddrive partition(s) with contents" }, - { OPT_ACSIHDIMAGE, NULL, "--acsi", - "", "Emulate an ACSI harddrive with an image " }, - { OPT_IDEMASTERHDIMAGE, NULL, "--ide-master", - "", "Emulate an IDE master harddrive with an image " }, - { OPT_IDESLAVEHDIMAGE, NULL, "--ide-slave", - "", "Emulate an IDE slave harddrive with an image " }, { OPT_HEADER, NULL, NULL, NULL, "Memory" }, { OPT_MEMSIZE, "-s", "--memsize", "", "ST RAM size (x = size in MiB from 0 to 14, 0 = 512KiB)" }, - { OPT_TOS, "-t", "--tos", - "", "Use TOS image " }, - { OPT_CARTRIDGE, NULL, "--cartridge", - "", "Use ROM cartridge image " }, { OPT_MEMSTATE, NULL, "--memstate", "", "Load memory snap-shot " }, @@ -269,28 +142,36 @@ static const opt_t HatariOptions[] = { "", "Set the CPU clock (x = 8/16/32)" }, { OPT_COMPATIBLE, NULL, "--compatible", "", "Use a more compatible (but slower) 68000 CPU mode" }, - + + { OPT_HEADER, NULL, NULL, NULL, "WinUAE CPU/FPU/bus" }, + { OPT_CPU_CYCLE_EXACT, NULL, "--cpu-exact", + "", "Use cycle exact CPU emulation" }, + { OPT_CPU_ADDR24, NULL, "--addr24", + "", "Use 24-bit instead of 32-bit addressing mode" }, + { OPT_FPU_TYPE, NULL, "--fpu-type", + "", "FPU type (x=none/68881/68882/internal)" }, + { OPT_FPU_COMPATIBLE, NULL, "--fpu-compatible", + "", "Use more compatible, but slower FPU emulation" }, + { OPT_MMU, NULL, "--mmu", + "", "Use MMU emulation" }, + { OPT_HEADER, NULL, NULL, NULL, "Misc system" }, - { OPT_MACHINE, NULL, "--machine", - "", "Select machine type (x = st/ste/tt/falcon)" }, - { OPT_BLITTER, NULL, "--blitter", - "", "Use blitter emulation (ST only)" }, - { OPT_TIMERD, NULL, "--timer-d", - "", "Patch Timer-D (about doubles Hatari speed)" }, + { OPT_REALTIME, NULL, "--realtime", + "", "Use host realtime sources" }, { OPT_DSP, NULL, "--dsp", - "", "DSP emulation (x = none/dummy/emu, Falcon only)" }, + "", "DSP emulation (x = none/dummy/emu)" }, + { OPT_MICROPHONE, NULL, "--mic", + "", "Enable/disable microphone" }, { OPT_SOUND, NULL, "--sound", "", "Sound frequency (x=off/6000-50066, off=fastest)" }, { OPT_SOUNDBUFFERSIZE, NULL, "--sound-buffer-size", - "", "Sound buffer size for SDL in ms (x=0/10-100, 0=use default buffer size)" }, - { OPT_KEYMAPFILE, "-k", "--keymap", - "", "Read (additional) keyboard mappings from " }, - + "", "Sound buffer size for SDL in ms (x=0/10-100, 0=default)" }, + { OPT_RTC, NULL, "--rtc", + "", "Enable real-time clock" }, + { OPT_HEADER, NULL, NULL, NULL, "Debug" }, { OPT_DEBUG, "-D", "--debug", NULL, "Toggle whether CPU exceptions invoke debugger" }, - { OPT_BIOSINTERCEPT, NULL, "--bios-intercept", - NULL, "Enable Bios/XBios interception (experimental)" }, { OPT_TRACE, NULL, "--trace", "", "Activate emulation tracing, see '--trace help'" }, { OPT_TRACEFILE, NULL, "--trace-file", @@ -311,8 +192,6 @@ static const opt_t HatariOptions[] = { "", "Log output level (x=debug/todo/info/warn/error/fatal)" }, { OPT_ALERTLEVEL, NULL, "--alert-level", "", "Show dialog for log messages above given level" }, - { OPT_RUNVBLS, NULL, "--run-vbls", - "", "Exit after x VBLs" }, { OPT_ERROR, NULL, NULL, NULL, NULL } }; @@ -324,8 +203,8 @@ static const opt_t HatariOptions[] = { static void Opt_ShowVersion(void) { printf("\n" PROG_NAME - " - the Atari ST, STE, TT and Falcon emulator.\n\n"); - printf("Hatari is free software licensed under the GNU General" + " - the NeXT emulator.\n\n"); + printf(PROG_NAME " is free software licensed under the GNU General" " Public License.\n\n"); } @@ -431,7 +310,7 @@ static void Opt_ShowHelp(void) const opt_t *opt = HatariOptions; Opt_ShowVersion(); - printf("Usage:\n hatari [options] [disk image name]\n"); + printf("Usage:\n previous [options] [directory|disk image|Atari program]\n"); while(opt->id != OPT_ERROR) { @@ -600,7 +479,7 @@ static int Opt_CheckBracketValue(const o * Checks also that if option is supposed to have argument, * whether there's one. */ -static int Opt_WhichOption(int argc, const char *argv[], int idx) +static int Opt_WhichOption(int argc, const char * const argv[], int idx) { const opt_t *opt; const char *str = argv[idx]; @@ -699,26 +578,84 @@ Uint32 Opt_GetNoParachuteFlag(void) /** + * Handle last (non-option) argument. It can be a path or filename. + * Filename can be a disk image or Atari program. + * Return false if it's none of these. + */ +static bool Opt_HandleArgument(const char *path) +{ + char *dir = NULL; + Uint8 test[2]; + FILE *fp; + + /* Atari program? */ + if (File_Exists(path) && (fp = fopen(path, "rb"))) { + + /* file starts with GEMDOS magic? */ + if (fread(test, 1, 2, fp) == 2 && + test[0] == 0x60 && test[1] == 0x1A) { + + const char *prgname = strrchr(path, PATHSEP); + if (prgname) { + dir = strdup(path); + dir[prgname-path] = '\0'; + prgname++; + } else { + dir = strdup(Paths_GetWorkingDir()); + prgname = path; + } + /* after above, dir should point to valid dir, + * then make sure that given program from that + * dir will be started. + */ +// TOS_AutoStart(prgname); + } + fclose(fp); + } + if (dir) { + path = dir; + } + + /* GEMDOS HDD directory (as argument, or for the Atari program)? */ + if (File_DirExists(path)) { +// if (Opt_StrCpy(OPT_HARDDRIVE, false, ConfigureParams.HardDisk.szHardDiskDirectories[0], +// path, sizeof(ConfigureParams.HardDisk.szHardDiskDirectories[0]), +// &ConfigureParams.HardDisk.bUseHardDiskDirectories) +// && ConfigureParams.HardDisk.bUseHardDiskDirectories) + { +// ConfigureParams.SCSI.bBootFromHardDisk = true; + } + if (dir) { + free(dir); + } + return true; + } else { + if (dir) { + /* if dir is set, it should be valid... */ + Log_Printf(LOG_ERROR, "Given atari program path '%s' doesn't exist (anymore?)!\n", dir); + free(dir); + exit(1); + } + } + + return Opt_ShowError(OPT_ERROR, path, "Not a disk image, Atari program or directory"); +} + +/** * parse all Hatari command line options and set Hatari state accordingly. * Returns true if everything was OK, false otherwise. */ -bool Opt_ParseParameters(int argc, const char *argv[]) +bool Opt_ParseParameters(int argc, const char * const argv[]) { - int ncpu, skips, zoom, planes, cpuclock, threshold, memsize, port, freq, temp; + int ncpu, cpuclock, memsize, freq, temp; const char *errstr; int i, ok = true; - int val; - - /* Defaults for loading initial memory snap-shots */ - bLoadMemorySave = false; - bLoadAutoSave = ConfigureParams.Memory.bAutoSave; for(i = 1; i < argc; i++) { - if (argv[i][0] != '-') - { - continue; - } + /* last argument can be a non-option */ + if (argv[i][0] != '-' && i+1 == argc) + return Opt_HandleArgument(argv[i]); /* WhichOption() checks also that there is an argument, * so we don't need to check that below @@ -738,10 +675,6 @@ bool Opt_ParseParameters(int argc, const case OPT_CONFIRMQUIT: ok = Opt_Bool(argv[++i], OPT_CONFIRMQUIT, &ConfigureParams.Log.bConfirmQuit); break; - - case OPT_FASTFORWARD: - ok = Opt_Bool(argv[++i], OPT_FASTFORWARD, &ConfigureParams.System.bFastForward); - break; case OPT_CONFIGFILE: i += 1; @@ -751,39 +684,33 @@ bool Opt_ParseParameters(int argc, const if (ok) { Configuration_Load(NULL); - bLoadAutoSave = ConfigureParams.Memory.bAutoSave; } break; - /* display options */ - case OPT_MONO: - ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_MONO; - bLoadAutoSave = false; - break; + /* common display options */ case OPT_MONITOR: i += 1; if (strcasecmp(argv[i], "mono") == 0) { - ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_MONO; +// ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_MONO; } else if (strcasecmp(argv[i], "rgb") == 0) { - ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_RGB; +// ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_RGB; } else if (strcasecmp(argv[i], "vga") == 0) { - ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_VGA; +// ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_VGA; } else if (strcasecmp(argv[i], "tv") == 0) { - ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_TV; +// ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_TV; } else { return Opt_ShowError(OPT_MONITOR, argv[i], "Unknown monitor type"); } - bLoadAutoSave = false; break; case OPT_FULLSCREEN: @@ -797,55 +724,7 @@ bool Opt_ParseParameters(int argc, const case OPT_GRAB: bGrabMouse = true; break; - - case OPT_ZOOM: - zoom = atoi(argv[++i]); - if (zoom < 1) - { - return Opt_ShowError(OPT_ZOOM, argv[i], "Invalid zoom value"); - } - if (zoom > 1) - { - ConfigureParams.Screen.nMaxWidth = 1024; - ConfigureParams.Screen.nMaxHeight = 768; - } - else - { - ConfigureParams.Screen.nMaxWidth = 1024; - ConfigureParams.Screen.nMaxHeight = 768; - } - break; - - case OPT_MAXWIDTH: - ConfigureParams.Screen.nMaxWidth = atoi(argv[++i]); - break; - - case OPT_MAXHEIGHT: - ConfigureParams.Screen.nMaxHeight = atoi(argv[++i]); - break; - - case OPT_ASPECT: - ok = Opt_Bool(argv[++i], OPT_ASPECT, &ConfigureParams.Screen.bAspectCorrect); - break; - - case OPT_FRAMESKIPS: - skips = atoi(argv[++i]); - if (skips < 0) - { - return Opt_ShowError(OPT_FRAMESKIPS, argv[i], - "Invalid frame skip value"); - } - else if (skips > 8) - { - Log_Printf(LOG_WARN, "Extravagant frame skip value %d!\n", skips); - } - ConfigureParams.Screen.nFrameSkips = skips; - break; - - case OPT_BORDERS: - ok = Opt_Bool(argv[++i], OPT_BORDERS, &ConfigureParams.Screen.bAllowOverscan); - break; - + case OPT_STATUSBAR: ok = Opt_Bool(argv[++i], OPT_STATUSBAR, &ConfigureParams.Screen.bShowStatusbar); break; @@ -853,77 +732,28 @@ bool Opt_ParseParameters(int argc, const case OPT_DRIVE_LED: ok = Opt_Bool(argv[++i], OPT_DRIVE_LED, &ConfigureParams.Screen.bShowDriveLed); break; - - case OPT_SPEC512: - threshold = atoi(argv[++i]); - if (threshold < 0 || threshold > 512) - { - return Opt_ShowError(OPT_SPEC512, argv[i], - "Invalid palette writes per line threshold for Spec512"); - } - ConfigureParams.Screen.nSpec512Threshold = threshold; + + case OPT_PRINTER: + i += 1; + /* "none" can be used to disable printer */ + ok = Opt_StrCpy(OPT_PRINTER, false, ConfigureParams.Printer.szPrintToFileName, + argv[i], sizeof(ConfigureParams.Printer.szPrintToFileName), + &ConfigureParams.Printer.bPrinterConnected); break; - case OPT_FORCEBPP: - planes = atoi(argv[++i]); - switch(planes) - { - case 32: - case 16: - case 15: - case 8: - break; /* supported */ - case 24: - planes = 32; /* We do not support 24 bpp (yet) */ - break; - default: - return Opt_ShowError(OPT_FORCEBPP, argv[i], "Invalid bit depth"); - } - ConfigureParams.Screen.nForceBpp = planes; - break; + /* disk options */ - /* avi recording options */ - case OPT_AVIRECORD: - AviRecordOnStartup = true; - break; - - case OPT_AVIRECORD_VCODEC: + case OPT_WRITEPROT_HD: i += 1; - if (strcasecmp(argv[i], "bmp") == 0) - { -// AviRecordDefaultVcodec = AVI_RECORD_VIDEO_CODEC_BMP; - } - else if (strcasecmp(argv[i], "png") == 0) - { -// AviRecordDefaultVcodec = AVI_RECORD_VIDEO_CODEC_PNG; - } + if (strcasecmp(argv[i], "off") == 0) + ConfigureParams.SCSI.nWriteProtection = WRITEPROT_OFF; + else if (strcasecmp(argv[i], "on") == 0) + ConfigureParams.SCSI.nWriteProtection = WRITEPROT_ON; + else if (strcasecmp(argv[i], "auto") == 0) + ConfigureParams.SCSI.nWriteProtection = WRITEPROT_AUTO; else - { - return Opt_ShowError(OPT_AVIRECORD_VCODEC, argv[i], "Unknown video codec"); - } + return Opt_ShowError(OPT_WRITEPROT_HD, argv[i], "Unknown option value"); break; - - case OPT_AVIRECORD_FPS: - val = atoi(argv[++i]); - if (val < 0 || val > 100) - { - return Opt_ShowError(OPT_AVIRECORD_FPS, argv[i], - "Invalid frame rate for avi recording"); - } -// AviRecordDefaultFps = val; - break; - - case OPT_AVIRECORD_CROP: -// ok = Opt_Bool(argv[++i], OPT_AVIRECORD_CROP, &AviRecordDefaultCrop); - break; - - case OPT_AVIRECORD_FILE: - i += 1; - /* false -> file is created if it doesn't exist */ -// ok = Opt_StrCpy(OPT_AVIRECORD_FILE, false, AviRecordFile, -// argv[i], sizeof(AviRecordFile), NULL); - break; - /* Memory options */ case OPT_MEMSIZE: @@ -932,44 +762,9 @@ bool Opt_ParseParameters(int argc, const { return Opt_ShowError(OPT_MEMSIZE, argv[i], "Invalid memory size"); } - ConfigureParams.Memory.nMemorySize = memsize; - bLoadAutoSave = false; +// ConfigureParams.Memory.nMemorySize = memsize; break; - - case OPT_TOS: - i += 1; - ok = Opt_StrCpy(OPT_TOS, true, ConfigureParams.Rom.szTosImageFileName, - argv[i], sizeof(ConfigureParams.Rom.szTosImageFileName), - NULL); - if (ok) - { - bLoadAutoSave = false; - } - break; - - case OPT_CARTRIDGE: - i += 1; - ok = Opt_StrCpy(OPT_CARTRIDGE, true, ConfigureParams.Rom.szCartridgeImageFileName, - argv[i], sizeof(ConfigureParams.Rom.szCartridgeImageFileName), - NULL); - if (ok) - { - bLoadAutoSave = false; - } - break; - - case OPT_MEMSTATE: - i += 1; - ok = Opt_StrCpy(OPT_MEMSTATE, true, ConfigureParams.Memory.szMemoryCaptureFileName, - argv[i], sizeof(ConfigureParams.Memory.szMemoryCaptureFileName), - NULL); - if (ok) - { - bLoadMemorySave = true; - bLoadAutoSave = false; - } - break; - + /* CPU options */ case OPT_CPULEVEL: /* UAE core uses cpu_level variable */ @@ -979,7 +774,6 @@ bool Opt_ParseParameters(int argc, const return Opt_ShowError(OPT_CPULEVEL, argv[i], "Invalid CPU level"); } ConfigureParams.System.nCpuLevel = ncpu; - bLoadAutoSave = false; break; case OPT_CPUCLOCK: @@ -989,15 +783,10 @@ bool Opt_ParseParameters(int argc, const return Opt_ShowError(OPT_CPUCLOCK, argv[i], "Invalid CPU clock"); } ConfigureParams.System.nCpuFreq = cpuclock; - bLoadAutoSave = false; break; case OPT_COMPATIBLE: ok = Opt_Bool(argv[++i], OPT_COMPATIBLE, &ConfigureParams.System.bCompatibleCpu); - if (ok) - { - bLoadAutoSave = false; - } break; /* system options */ @@ -1005,25 +794,24 @@ bool Opt_ParseParameters(int argc, const i += 1; if (strcasecmp(argv[i], "st") == 0) { - ConfigureParams.System.nMachineType = MACHINE_ST; ConfigureParams.System.nCpuLevel = 0; ConfigureParams.System.nCpuFreq = 8; } else if (strcasecmp(argv[i], "ste") == 0) { - ConfigureParams.System.nMachineType = MACHINE_STE; ConfigureParams.System.nCpuLevel = 0; ConfigureParams.System.nCpuFreq = 8; } else if (strcasecmp(argv[i], "tt") == 0) { - ConfigureParams.System.nMachineType = MACHINE_TT; ConfigureParams.System.nCpuLevel = 3; ConfigureParams.System.nCpuFreq = 32; } else if (strcasecmp(argv[i], "falcon") == 0) { - ConfigureParams.System.nMachineType = MACHINE_FALCON; +#if ENABLE_DSP_EMU + ConfigureParams.System.nDSPType = DSP_TYPE_EMU; +#endif ConfigureParams.System.nCpuLevel = 3; ConfigureParams.System.nCpuFreq = 16; } @@ -1031,14 +819,88 @@ bool Opt_ParseParameters(int argc, const { return Opt_ShowError(OPT_MACHINE, argv[i], "Unknown machine type"); } - bLoadAutoSave = false; break; - - case OPT_TIMERD: - ok = Opt_Bool(argv[++i], OPT_TIMERD, &ConfigureParams.System.bPatchTimerD); + case OPT_REALTIME: + ok = Opt_Bool(argv[++i], OPT_REALTIME, &ConfigureParams.System.bRealtime); + break; + + case OPT_RTC: + ok = Opt_Bool(argv[++i], OPT_RTC, &ConfigureParams.System.bRealTimeClock); break; + case OPT_DSP: + i += 1; + if (strcasecmp(argv[i], "none") == 0) + { + ConfigureParams.System.nDSPType = DSP_TYPE_NONE; + } + else if (strcasecmp(argv[i], "dummy") == 0) + { + ConfigureParams.System.nDSPType = DSP_TYPE_DUMMY; + } + else if (strcasecmp(argv[i], "emu") == 0) + { +#if ENABLE_DSP_EMU + ConfigureParams.System.nDSPType = DSP_TYPE_EMU; +#else + return Opt_ShowError(OPT_DSP, argv[i], "DSP type 'emu' support not compiled in"); +#endif + } + else + { + return Opt_ShowError(OPT_DSP, argv[i], "Unknown DSP type"); + } + break; + + case OPT_FPU_TYPE: + i += 1; + if (strcasecmp(argv[i], "none") == 0) + { + ConfigureParams.System.n_FPUType = FPU_NONE; + } + else if (strcasecmp(argv[i], "68881") == 0) + { + ConfigureParams.System.n_FPUType = FPU_68881; + } + else if (strcasecmp(argv[i], "68882") == 0) + { + ConfigureParams.System.n_FPUType = FPU_68882; + } + else if (strcasecmp(argv[i], "internal") == 0) + { + ConfigureParams.System.n_FPUType = FPU_CPU; + } + else + { + return Opt_ShowError(OPT_FPU_TYPE, argv[i], "Unknown FPU type"); + } + break; + + case OPT_FPU_COMPATIBLE: + ok = Opt_Bool(argv[++i], OPT_FPU_COMPATIBLE, &ConfigureParams.System.bCompatibleFPU); + break; + + case OPT_MMU: + ok = Opt_Bool(argv[++i], OPT_MMU, &ConfigureParams.System.bMMU); + break; + + case OPT_SOUND: + i += 1; + if (strcasecmp(argv[i], "off") == 0) + { + ConfigureParams.Sound.bEnableSound = false; + } + else + { + freq = atoi(argv[i]); + if (freq != 44100) + { + return Opt_ShowError(OPT_SOUND, argv[i], "Unsupported sound frequency, only 44100 supported"); + } + ConfigureParams.Sound.bEnableSound = true; + } + break; case OPT_SOUNDBUFFERSIZE: i += 1; @@ -1049,8 +911,12 @@ bool Opt_ParseParameters(int argc, const { return Opt_ShowError(OPT_SOUNDBUFFERSIZE, argv[i], "Unsupported sound buffer size"); } - ConfigureParams.Sound.SdlAudioBufferSize = temp; +// ConfigureParams.Sound.SdlAudioBufferSize = temp; break; + + case OPT_MICROPHONE: + ok = Opt_Bool(argv[++i], OPT_MICROPHONE, &ConfigureParams.Sound.bEnableMicrophone); + break; case OPT_KEYMAPFILE: i += 1; @@ -1146,10 +1012,6 @@ bool Opt_ParseParameters(int argc, const return Opt_ShowError(OPT_ALERTLEVEL, argv[i], "Unknown alert level!"); } break; - - case OPT_RUNVBLS: - nRunVBLs = atol(argv[++i]); - break; case OPT_ERROR: /* unknown option or missing option parameter */