diff --git a/stella/src/common/SoundSDL.hxx b/stella/src/common/SoundSDL.hxx index 58731f0b1..e1f8bf5bc 100644 --- a/stella/src/common/SoundSDL.hxx +++ b/stella/src/common/SoundSDL.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: SoundSDL.hxx,v 1.2 2004-06-13 05:03:26 bwmott Exp $ +// $Id: SoundSDL.hxx,v 1.3 2004-06-13 16:51:15 stephena Exp $ //============================================================================ #ifndef SOUNDSDL_HXX @@ -29,7 +29,7 @@ This class implements the sound API for SDL. @author Stephen Anthony and Bradford W. Mott - @version $Id: SoundSDL.hxx,v 1.2 2004-06-13 05:03:26 bwmott Exp $ + @version $Id: SoundSDL.hxx,v 1.3 2004-06-13 16:51:15 stephena Exp $ */ class SoundSDL : public Sound { @@ -205,4 +205,4 @@ class SoundSDL : public Sound static void callback(void* udata, uInt8* stream, int len); }; -#endif \ No newline at end of file +#endif diff --git a/stella/src/common/mainSDL.cxx b/stella/src/common/mainSDL.cxx index 65d83fc47..45b5a90ad 100644 --- a/stella/src/common/mainSDL.cxx +++ b/stella/src/common/mainSDL.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: mainSDL.cxx,v 1.3 2004-06-13 05:09:37 bwmott Exp $ +// $Id: mainSDL.cxx,v 1.4 2004-06-13 16:51:15 stephena Exp $ //============================================================================ #include @@ -759,10 +759,13 @@ bool setupProperties(PropertiesSet& set) void cleanup() { #ifdef JOYSTICK_SUPPORT - for(uInt32 i = 0; i < StellaEvent::LastJSTICK; i++) + if(SDL_WasInit(SDL_INIT_JOYSTICK) & SDL_INIT_JOYSTICK) { - if(SDL_JoystickOpened(i)) - SDL_JoystickClose(theJoysticks[i].stick); + for(uInt32 i = 0; i < StellaEvent::LastJSTICK; i++) + { + if(SDL_JoystickOpened(i)) + SDL_JoystickClose(theJoysticks[i].stick); + } } #endif @@ -778,7 +781,9 @@ void cleanup() if(theDisplay) delete theDisplay; - SDL_Quit(); + Uint32 subsystem_mask = SDL_INIT_VIDEO|SDL_INIT_AUDIO; + if(SDL_WasInit(subsystem_mask) == subsystem_mask) + SDL_Quit(); } @@ -825,6 +830,8 @@ int main(int argc, char* argv[]) if(!in) { cerr << "ERROR: Couldn't open " << file << "..." << endl; + string message = "Stella version 1.4_cvs\n\nUsage: stella [options ...] romfile"; + theSettings->usage(message); cleanup(); return 0; } @@ -899,7 +906,7 @@ int main(int argc, char* argv[]) // Create the 2600 game console theConsole = new Console(image, size, filename, *theSettings, propertiesSet, - *theDisplay, *theSound, theSettings->getInt("framerate")); + *theDisplay, *theSound); // Free the image since we don't need it any longer delete[] image; diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index 4fcaec4a4..ce733b5de 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Console.cxx,v 1.29 2004-06-13 04:59:40 bwmott Exp $ +// $Id: Console.cxx,v 1.30 2004-06-13 16:51:15 stephena Exp $ //============================================================================ #include @@ -52,12 +52,11 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Console::Console(const uInt8* image, uInt32 size, const char* filename, Settings& settings, PropertiesSet& propertiesSet, - FrameBuffer& framebuffer, Sound& sound, uInt32 frameRate) + FrameBuffer& framebuffer, Sound& sound) : mySettings(settings), myPropSet(propertiesSet), myFrameBuffer(framebuffer), - mySound(sound), - myFrameRate(frameRate) + mySound(sound) { myControllers[0] = 0; myControllers[1] = 0; @@ -66,6 +65,8 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename, mySystem = 0; myEvent = 0; + myFrameRate = mySettings.getInt("framerate"); + // Create an event handler which will collect and dispatch events myEventHandler = new EventHandler(this); myEvent = myEventHandler->event(); diff --git a/stella/src/emucore/Console.hxx b/stella/src/emucore/Console.hxx index b69b5b612..9cd9d8c33 100644 --- a/stella/src/emucore/Console.hxx +++ b/stella/src/emucore/Console.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Console.hxx,v 1.18 2004-06-13 04:59:40 bwmott Exp $ +// $Id: Console.hxx,v 1.19 2004-06-13 16:51:15 stephena Exp $ //============================================================================ #ifndef CONSOLE_HXX @@ -41,7 +41,7 @@ class FrameBuffer; This class represents the entire game console. @author Bradford W. Mott - @version $Id: Console.hxx,v 1.18 2004-06-13 04:59:40 bwmott Exp $ + @version $Id: Console.hxx,v 1.19 2004-06-13 16:51:15 stephena Exp $ */ class Console { @@ -57,11 +57,10 @@ class Console @param profiles The game profiles object to use @param framebuffer The framebuffer object to use @param sound The sound object to use - @param framerate The framerate being used */ Console(const uInt8* image, uInt32 size, const char* filename, Settings& settings, PropertiesSet& propertiesSet, - FrameBuffer& framebuffer, Sound& sound, uInt32 frameRate); + FrameBuffer& framebuffer, Sound& sound); /** Create a new console object by copying another one diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 70f6e93a9..63c6dc440 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Settings.cxx,v 1.20 2004-05-28 22:07:57 stephena Exp $ +// $Id: Settings.cxx,v 1.21 2004-06-13 16:51:15 stephena Exp $ //============================================================================ #include @@ -44,12 +44,11 @@ Settings::Settings() #endif set("sound", "true"); set("fragsize", "512"); - set("bufsize", "1536"); set("fullscreen", "false"); set("grabmouse", "false"); set("hidecursor", "false"); set("volume", "-1"); - set("accurate", "true"); + set("accurate", "false"); set("framerate", "60"); set("keymap", ""); set("joymap", ""); diff --git a/stella/src/emucore/TIA.cxx b/stella/src/emucore/TIA.cxx index 2fe32ae9d..9234d1e7f 100644 --- a/stella/src/emucore/TIA.cxx +++ b/stella/src/emucore/TIA.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: TIA.cxx,v 1.33 2004-06-13 04:53:04 bwmott Exp $ +// $Id: TIA.cxx,v 1.34 2004-06-13 16:51:15 stephena Exp $ //============================================================================ #include @@ -38,11 +38,11 @@ TIA::TIA(const Console& console, Sound& sound) : myConsole(console), mySound(sound), myColorLossEnabled(false), + myMaximumNumberOfScanlines(262), myCOLUBK(myColor[0]), myCOLUPF(myColor[1]), myCOLUP0(myColor[2]), - myCOLUP1(myColor[3]), - myMaximumNumberOfScanlines(262) + myCOLUP1(myColor[3]) { // Allocate buffers for two frame buffers myCurrentFrameBuffer = new uInt8[160 * 300]; diff --git a/stella/src/unix/SettingsUNIX.cxx b/stella/src/unix/SettingsUNIX.cxx index 535c27db8..346560a50 100644 --- a/stella/src/unix/SettingsUNIX.cxx +++ b/stella/src/unix/SettingsUNIX.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: SettingsUNIX.cxx,v 1.2 2004-05-28 22:07:57 stephena Exp $ +// $Id: SettingsUNIX.cxx,v 1.3 2004-06-13 16:51:15 stephena Exp $ //============================================================================ #include @@ -83,8 +83,7 @@ void SettingsUNIX::usage(string& message) << endl #endif << " -sound <0|1> Enable sound generation\n" - << " -fragsize The size of sound fragments (should be a power of two)\n" - << " -bufsize The size of the sound buffer\n" + << " -fragsize The size of sound fragments (must be a power of two)\n" << " -framerate Display the given number of frames per second\n" << " -zoom Makes window be 'size' times normal\n" << " -fullscreen <0|1> Play the game in fullscreen mode\n" diff --git a/stella/src/win32/SettingsWin32.cxx b/stella/src/win32/SettingsWin32.cxx index 8d6360fe0..aafde1103 100644 --- a/stella/src/win32/SettingsWin32.cxx +++ b/stella/src/win32/SettingsWin32.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: SettingsWin32.cxx,v 1.3 2004-05-28 23:16:26 stephena Exp $ +// $Id: SettingsWin32.cxx,v 1.4 2004-06-13 16:51:15 stephena Exp $ //============================================================================ //#include @@ -60,6 +60,7 @@ SettingsWin32::SettingsWin32() // Now create Win32 specific settings set("romdir", "roms"); set("accurate", "false"); // Don't change this, or the sound will skip + set("fragsize", "2048"); // Anything less than this usually causes sound skipping #ifdef SNAPSHOT_SUPPORT set("ssdir", ".\\"); #endif @@ -90,7 +91,7 @@ void SettingsWin32::usage(string& message) << endl #endif << " -sound <0|1> Enable sound generation\n" - << " -fragsize The size of sound fragments (should be a power of two)\n" + << " -fragsize The size of sound fragments (must be a power of two)\n" << " -bufsize The size of the sound buffer\n" << " -framerate Display the given number of frames per second\n" << " -zoom Makes window be 'size' times normal\n"