From 9f7ea702a696a6b461d81b73c430bd8bc5d4f522 Mon Sep 17 00:00:00 2001 From: jeblanchard Date: Wed, 4 Jun 2008 04:11:33 +0000 Subject: [PATCH] Restore usage string and several old command-line options --- src/drivers/sdl/config.cpp | 22 ++++++------- src/drivers/sdl/sdl-sound.cpp | 7 ++-- src/drivers/sdl/sdl.cpp | 41 +++++++++++++++++++++--- src/drivers/sdl/usage.h | 60 ----------------------------------- 4 files changed, 48 insertions(+), 82 deletions(-) delete mode 100644 src/drivers/sdl/usage.h diff --git a/src/drivers/sdl/config.cpp b/src/drivers/sdl/config.cpp index 33ba98a5..b6bcc005 100644 --- a/src/drivers/sdl/config.cpp +++ b/src/drivers/sdl/config.cpp @@ -26,8 +26,6 @@ #include #endif -//#include "usage.h" - /** * Read a custom pallete from a file and load it into the core. */ @@ -120,13 +118,13 @@ InitConfig() // sound options config->addOption('s', "sound", "SDL.Sound", 1); config->addOption("volume", "SDL.SoundVolume", 100); - config->addOption("SDL.SoundRate", 48000); - config->addOption("SDL.SoundQuality", 0); + config->addOption("soundrate", "SDL.SoundRate", 48000); + config->addOption("soundq", "SDL.SoundQuality", 0); config->addOption("soundrecord", "SDL.SoundRecordFile", ""); #ifdef WIN32 - config->addOption("SDL.SoundBufSize", 52); + config->addOption("soundbufsize", "SDL.SoundBufSize", 52); #else - config->addOption("SDL.SoundBufSize", 24); + config->addOption("soundbufsize", "SDL.SoundBufSize", 24); #endif // old EOptions @@ -134,10 +132,10 @@ InitConfig() config->addOption("lowpass", "SDL.LowPass", 0); config->addOption("pal", "SDL.PAL", 0); config->addOption("frameskip", "SDL.Frameskip", 0); - config->addOption("SDL.SnapName", 0); - config->addOption("SDL.ClipSides", 0); - config->addOption("SDL.NoThrottle", 0); - config->addOption("SDL.DisableSpriteLimit", 0); + config->addOption("snapname", "SDL.SnapName", 0); + config->addOption("clipsides", "SDL.ClipSides", 0); + config->addOption("nothrottle", "SDL.NoThrottle", 0); + config->addOption("no8lim", "SDL.DisableSpriteLimit", 0); // color control config->addOption('p', "palette", "SDL.Palette", ""); @@ -146,8 +144,8 @@ InitConfig() config->addOption("color", "SDL.Color", 0); // scanline settings - config->addOption("SDL.ScanLineStart", 0); - config->addOption("SDL.ScanLineEnd", 239); + config->addOption("slstart", "SDL.ScanLineStart", 0); + config->addOption("slend", "SDL.ScanLineEnd", 239); // video controls config->addOption('x', "xres", "SDL.XResolution", 512); diff --git a/src/drivers/sdl/sdl-sound.cpp b/src/drivers/sdl/sdl-sound.cpp index 31026fb7..e0d7f23b 100644 --- a/src/drivers/sdl/sdl-sound.cpp +++ b/src/drivers/sdl/sdl-sound.cpp @@ -102,11 +102,8 @@ InitSound(FCEUGI *gi) s_BufferSize = soundbufsize * soundrate / 1000; - // XXX soules - what is this?? - /* SDL uses at least double-buffering, so multiply by 2. */ - s_BufferSize -= spec.samples * 2; - - if(s_BufferSize < spec.samples) s_BufferSize = spec.samples; + // For safety, set a bare minimum: + if (s_BufferSize < spec.samples * 2) s_BufferSize = spec.samples * 2; s_Buffer = (int *)malloc(sizeof(int) * s_BufferSize); s_BufferRead = s_BufferWrite = s_BufferIn = 0; diff --git a/src/drivers/sdl/sdl.cpp b/src/drivers/sdl/sdl.cpp index 9571126d..2d75df56 100644 --- a/src/drivers/sdl/sdl.cpp +++ b/src/drivers/sdl/sdl.cpp @@ -52,6 +52,8 @@ int gametype = 0; char *DriverUsage= "--pal x Use PAL timing.\n\ --gamegenie x, -g x Enable emulated Game Genie if x is nonzero.\n\ +--no8lim x Disables the 8 sprites per scanline limitation, if x is nonzero.\n\ +--nothrottle x Disable artificial speed throttling, if x is nonzero.\n\ --frameskip x Set # of frames to skip per emulated frame.\n\ --(x/y)res x, -(x/y) x Set horizontal/vertical resolution to x for full screen mode.\n\ --(x/y)scale x Multiply width/height by x (Real numbers >0 with OpenGL, otherwise integers >0).\n\ @@ -60,17 +62,26 @@ char *DriverUsage= --opengl x Enable OpenGL support if x is nonzero.\n\ --doublebuf x Enable SDL double-buffering if x is nonzero.\n\ --fullscreen x, -f x Select full screen mode if x is nonzero.\n\ ---color x ?\n\ ---hue x ?\n\ ---tint x ?\n\ ---palette p, -p p ?\n\ +--clipsides x Clip left- and rightmost 8 columns of pixels if x is nonzero.\n\ +--slstart x Set the first drawn emulated scanline. Valid values for x are\n\ + 0 through 239.\n\ +--slend x Set the last drawn emulated scanline. Valid values for x are\n\ + 0 through 239.\n\ +--color x Emulate an NTSC TV's colors, if x is nonzero.\n\ +--hue x Parameter for NTSC color emulation.\n\ +--tint x Parameter for NTSC color emulation.\n\ +--palette s, -p s Load a custom global palette from file s.\n\ --sound x, -s x Enable sound if x is nonzero.\n\ +--soundrate x Set sound playback rate to x Hz.\n\ +--soundq x Sets sound quality: 0 for low, 1 for high.\n\ +--soundbufsize x Set sound buffer size to x ms.\n\ --volume x Set volume to x%.\n\ --lowpass x Enable low-pass filter if x is nonzero.\n\ --soundrecord s Record sound to file s.\n\ +--snapname x Prepend the game's name to (numeric) snapshot filenames, if x is nonzero.\n\ --inputcfg, -i Configure input device(s) on startup.\n\ --net s, -n s Connect to server 's' for TCP/IP network play.\n\ ---port x, -p x Use TCP/IP port x for network play.\ +--port x, -p x Use TCP/IP port x for network play.\n\ --user s, -u s Set the nickname to use in network play.\n\ --pass s, -w s Password to use for connecting to the server.\n\ --netkey s, -k s Use key 's' to create a unique session for the game loaded.\n\ @@ -80,6 +91,24 @@ char *DriverUsage= // global configuration object Config *g_config; +static void ShowUsage(char *prog) +{ + printf("\nUsage is as follows:\n%s filename\n\n",prog); + puts("Options:"); + puts(DriverUsage); +// These options are basically not going to work... +#if 0 +puts("\ +--inputx str Select device mapped to virtual input port x(1-2).\n\ + str may be: none, gamepad, zapper, powerpada, powerpadb,\n\ + arkanoid\n\ +--fcexp str Select Famicom expansion port device.\n\ + str may be: none, shadow, arkanoid, 4player, fkb\n\ +--nofs x Disables Four-Score emulation if x is 1.\n\ +"); +#endif +} + /** * Prints an error string to STDOUT. */ @@ -429,12 +458,14 @@ main(int argc, // initialize the infrastructure error = FCEUI_Initialize(); if(error != 1) { + ShowUsage(argv[0]); SDL_Quit(); return -1; } int romIndex = g_config->parse(argc, argv); if(romIndex <= 0) { + ShowUsage(argv[0]); FCEUD_Message("\nError parsing command line arguments\n"); SDL_Quit(); return -1; diff --git a/src/drivers/sdl/usage.h b/src/drivers/sdl/usage.h deleted file mode 100644 index b53f31a5..00000000 --- a/src/drivers/sdl/usage.h +++ /dev/null @@ -1,60 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -static void ShowUsage(char *prog) -{ -printf("\nUsage is as follows:\n%s filename\n\n",prog); -puts("Options:"); -puts(DriverUsage); -puts("-cpalette x Load a custom global palette from file x.\n\ --ntsccol x Emulate an NTSC's TV's colors.\n\ - 0 = Disabled.\n\ - 1 = Enabled.\n\ --pal x Emulate a PAL NES if x is 1.\n\ --sound x Sound.\n\ - 0 = Disabled.\n\ - Otherwise, x = playback rate.\n\ --soundvol x Sound volume. x is an integral percentage value.\n\ --soundq x Sets sound quality.\n\ - 0 = Low quality.\n\ - 1 = High quality.\n\ --inputx str Select device mapped to virtual input port x(1-2).\n\ - str may be: none, gamepad, zapper, powerpada, powerpadb,\n\ - arkanoid\n\ --fcexp str Select Famicom expansion port device.\n\ - str may be: none, shadow, arkanoid, 4player, fkb\n\ --inputcfg s Configure virtual input device \"s\".\n\ --nofs x Disables Four-Score emulation if x is 1.\n\ --gg x Enable Game Genie emulation if x is 1.\n\ --no8lim x Disables the 8 sprites per scanline limitation.\n\ - 0 = Limitation enabled.\n\ - 1 = Limitation disabled.\n\ --snapname x Selects what type of file name snapshots will have.\n\ - 0 = Numeric(0.png)\n\ - 1 = File base and numeric(mario-0.png)\n\ --nothrottle x Disable artificial speed throttling if x is non-zero.\n\ --clipsides x Clip leftmost and rightmost 8 columns of pixels of video output.\n\ - 0 = No clipping.\n\ - 1 = Clipping.\n\ --slstart x Set the first drawn emulated scanline. Valid values for x are\n\ - 0 through 239.\n\ --slend x Set the last drawn emulated scanline. Valid values for x are\n\ - 0 through 239."); -}