From 28596c7161e07681c48082e1afbc34209eff8043 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 3 Mar 2017 14:15:13 +1100 Subject: fix crash on excessive command-line options, clean up some tabulation, remove long-dead option --- src/emu/emuopts.cpp | 81 ++++++++++++++++++++++++-------------------------- src/emu/emuopts.h | 15 +++------- src/lib/util/options.h | 2 +- 3 files changed, 44 insertions(+), 54 deletions(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 7551a682622..284284dd665 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -18,16 +18,16 @@ const options_entry emu_options::s_option_entries[] = { // unadorned options - only a single one supported at the moment - { OPTION_SYSTEMNAME, nullptr, OPTION_STRING, nullptr }, - { OPTION_SOFTWARENAME, nullptr, OPTION_STRING, nullptr }, + { OPTION_SYSTEMNAME, nullptr, OPTION_STRING, nullptr }, + { OPTION_SOFTWARENAME, nullptr, OPTION_STRING, nullptr }, // config options - { nullptr, nullptr, OPTION_HEADER, "CORE CONFIGURATION OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE CONFIGURATION OPTIONS" }, { OPTION_READCONFIG ";rc", "1", OPTION_BOOLEAN, "enable loading of configuration files" }, { OPTION_WRITECONFIG ";wc", "0", OPTION_BOOLEAN, "writes configuration to (driver).ini on exit" }, // search path options - { nullptr, nullptr, OPTION_HEADER, "CORE SEARCH PATH OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE SEARCH PATH OPTIONS" }, { OPTION_HOMEPATH, ".", OPTION_STRING, "path to home directory (read/write) location" }, { OPTION_MEDIAPATH ";rp;biospath;bp", "roms", OPTION_STRING, "path to ROMsets and hard disk images" }, { OPTION_HASHPATH ";hash_directory;hash", "hash", OPTION_STRING, "path to hash files" }, @@ -43,7 +43,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_SWPATH, "software", OPTION_STRING, "path to loose software" }, // output directory options - { nullptr, nullptr, OPTION_HEADER, "CORE OUTPUT DIRECTORY OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE OUTPUT DIRECTORY OPTIONS" }, { OPTION_CFG_DIRECTORY, "cfg", OPTION_STRING, "directory to save configurations" }, { OPTION_NVRAM_DIRECTORY, "nvram", OPTION_STRING, "directory to save nvram contents" }, { OPTION_INPUT_DIRECTORY, "inp", OPTION_STRING, "directory to save input device logs" }, @@ -53,20 +53,17 @@ const options_entry emu_options::s_option_entries[] = { OPTION_COMMENT_DIRECTORY, "comments", OPTION_STRING, "directory to save debugger comments" }, // state/playback options - { nullptr, nullptr, OPTION_HEADER, "CORE STATE/PLAYBACK OPTIONS" }, - { OPTION_STATE, nullptr, OPTION_STRING, "saved state to load" }, + { nullptr, nullptr, OPTION_HEADER, "CORE STATE/PLAYBACK OPTIONS" }, + { OPTION_STATE, nullptr, OPTION_STRING, "saved state to load" }, { OPTION_AUTOSAVE, "0", OPTION_BOOLEAN, "enable automatic restore at startup, and automatic save at exit time" }, - { OPTION_PLAYBACK ";pb", nullptr, OPTION_STRING, "playback an input file" }, - { OPTION_RECORD ";rec", nullptr, OPTION_STRING, "record an input file" }, - { OPTION_RECORD_TIMECODE, "0", OPTION_BOOLEAN, "record an input timecode file (requires -record option)" }, - { OPTION_EXIT_AFTER_PLAYBACK, "0", OPTION_BOOLEAN, "close the program at the end of playback" }, - - { OPTION_MNGWRITE, nullptr, OPTION_STRING, "optional filename to write a MNG movie of the current session" }, - { OPTION_AVIWRITE, nullptr, OPTION_STRING, "optional filename to write an AVI movie of the current session" }, -#ifdef MAME_DEBUG - { OPTION_DUMMYWRITE, "0", OPTION_BOOLEAN, "indicates if a snapshot should be created if each frame" }, -#endif - { OPTION_WAVWRITE, nullptr, OPTION_STRING, "optional filename to write a WAV file of the current session" }, + { OPTION_PLAYBACK ";pb", nullptr, OPTION_STRING, "playback an input file" }, + { OPTION_RECORD ";rec", nullptr, OPTION_STRING, "record an input file" }, + { OPTION_RECORD_TIMECODE, "0", OPTION_BOOLEAN, "record an input timecode file (requires -record option)" }, + { OPTION_EXIT_AFTER_PLAYBACK, "0", OPTION_BOOLEAN, "close the program at the end of playback" }, + + { OPTION_MNGWRITE, nullptr, OPTION_STRING, "optional filename to write a MNG movie of the current session" }, + { OPTION_AVIWRITE, nullptr, OPTION_STRING, "optional filename to write an AVI movie of the current session" }, + { OPTION_WAVWRITE, nullptr, OPTION_STRING, "optional filename to write a WAV file of the current session" }, { OPTION_SNAPNAME, "%g/%i", OPTION_STRING, "override of the default snapshot/movie naming; %g == gamename, %i == index" }, { OPTION_SNAPSIZE, "auto", OPTION_STRING, "specify snapshot/movie resolution (x) or 'auto' to use minimal size " }, { OPTION_SNAPVIEW, "internal", OPTION_STRING, "specify snapshot/movie view or 'internal' to use internal pixel-aspect views" }, @@ -75,7 +72,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_BURNIN, "0", OPTION_BOOLEAN, "create burn-in snapshots for each screen" }, // performance options - { nullptr, nullptr, OPTION_HEADER, "CORE PERFORMANCE OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE PERFORMANCE OPTIONS" }, { OPTION_AUTOFRAMESKIP ";afs", "0", OPTION_BOOLEAN, "enable automatic frameskip selection" }, { OPTION_FRAMESKIP ";fs(0-10)", "0", OPTION_INTEGER, "set frameskip to fixed value, 0-10 (autoframeskip must be disabled)" }, { OPTION_SECONDS_TO_RUN ";str", "0", OPTION_INTEGER, "number of emulated seconds to run before automatically exiting" }, @@ -85,7 +82,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_REFRESHSPEED ";rs", "0", OPTION_BOOLEAN, "automatically adjusts the speed of gameplay to keep the refresh rate lower than the screen" }, // render options - { nullptr, nullptr, OPTION_HEADER, "CORE RENDER OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE RENDER OPTIONS" }, { OPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" }, { OPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" }, { OPTION_UNEVENSTRETCHX ";uesx", "0", OPTION_BOOLEAN, "allow non-integer stretch factors only on horizontal axis"}, @@ -96,7 +93,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_INTSCALEY ";sy", "0", OPTION_INTEGER, "set vertical integer scale."}, // rotation options - { nullptr, nullptr, OPTION_HEADER, "CORE ROTATION OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE ROTATION OPTIONS" }, { OPTION_ROTATE, "1", OPTION_BOOLEAN, "rotate the game screen according to the game's orientation needs it" }, { OPTION_ROR, "0", OPTION_BOOLEAN, "rotate screen clockwise 90 degrees" }, { OPTION_ROL, "0", OPTION_BOOLEAN, "rotate screen counterclockwise 90 degrees" }, @@ -106,7 +103,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_FLIPY, "0", OPTION_BOOLEAN, "flip screen upside-down" }, // artwork options - { nullptr, nullptr, OPTION_HEADER, "CORE ARTWORK OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE ARTWORK OPTIONS" }, { OPTION_ARTWORK_CROP ";artcrop", "0", OPTION_BOOLEAN, "crop artwork to game screen size" }, { OPTION_USE_BACKDROPS ";backdrop", "1", OPTION_BOOLEAN, "enable backdrops if artwork is enabled and available" }, { OPTION_USE_OVERLAYS ";overlay", "1", OPTION_BOOLEAN, "enable overlays if artwork is enabled and available" }, @@ -115,7 +112,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_USE_MARQUEES ";marquee", "1", OPTION_BOOLEAN, "enable marquees if artwork is enabled and available" }, // screen options - { nullptr, nullptr, OPTION_HEADER, "CORE SCREEN OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE SCREEN OPTIONS" }, { OPTION_BRIGHTNESS "(0.1-2.0)", "1.0", OPTION_FLOAT, "default game screen brightness correction" }, { OPTION_CONTRAST "(0.1-2.0)", "1.0", OPTION_FLOAT, "default game screen contrast correction" }, { OPTION_GAMMA "(0.1-3.0)", "1.0", OPTION_FLOAT, "default game screen gamma correction" }, @@ -123,22 +120,22 @@ const options_entry emu_options::s_option_entries[] = { OPTION_EFFECT, "none", OPTION_STRING, "name of a PNG file to use for visual effects, or 'none'" }, // vector options - { nullptr, nullptr, OPTION_HEADER, "CORE VECTOR OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE VECTOR OPTIONS" }, { OPTION_BEAM_WIDTH_MIN, "1.0", OPTION_FLOAT, "set vector beam width minimum" }, { OPTION_BEAM_WIDTH_MAX, "1.0", OPTION_FLOAT, "set vector beam width maximum" }, { OPTION_BEAM_INTENSITY_WEIGHT, "0", OPTION_FLOAT, "set vector beam intensity weight " }, { OPTION_FLICKER, "0", OPTION_FLOAT, "set vector flicker effect" }, // sound options - { nullptr, nullptr, OPTION_HEADER, "CORE SOUND OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE SOUND OPTIONS" }, { OPTION_SAMPLERATE ";sr(1000-1000000)", "48000", OPTION_INTEGER, "set sound output sample rate" }, { OPTION_SAMPLES, "1", OPTION_BOOLEAN, "enable the use of external samples if available" }, { OPTION_VOLUME ";vol", "0", OPTION_INTEGER, "sound volume in decibels (-32 min, 0 max)" }, // input options - { nullptr, nullptr, OPTION_HEADER, "CORE INPUT OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CORE INPUT OPTIONS" }, { OPTION_COIN_LOCKOUT ";coinlock", "1", OPTION_BOOLEAN, "enable coin lockouts to actually lock out coins" }, - { OPTION_CTRLR, nullptr, OPTION_STRING, "preconfigure for specified controller" }, + { OPTION_CTRLR, nullptr, OPTION_STRING, "preconfigure for specified controller" }, { OPTION_MOUSE, "0", OPTION_BOOLEAN, "enable mouse input" }, { OPTION_JOYSTICK ";joy", "1", OPTION_BOOLEAN, "enable joystick input" }, { OPTION_LIGHTGUN ";gun", "0", OPTION_BOOLEAN, "enable lightgun input" }, @@ -155,7 +152,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_COIN_IMPULSE, "0", OPTION_INTEGER, "set coin impulse time (n<0 disable impulse, n==0 obey driver, 0