diff --git a/stella/src/build/makefile b/stella/src/build/makefile index 68f25d6cf..41c2b44ef 100644 --- a/stella/src/build/makefile +++ b/stella/src/build/makefile @@ -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: makefile,v 1.60 2005-02-21 20:41:04 stephena Exp $ +## $Id: makefile,v 1.61 2005-02-22 02:59:52 stephena Exp $ ##============================================================================ ##============================================================================ @@ -32,7 +32,7 @@ OPTIMIZATIONS = ### to include support for saving snapshots in png format ### (requires PNG library) -# SNAPSHOT_SUPPORT = 1 + SNAPSHOT_SUPPORT = 1 ### to include support for game developers ### enables some extra commandline options that allow the user @@ -41,7 +41,7 @@ OPTIMIZATIONS = ### to build on SMP (or distcc-based) machines ### change to number of CPU's you have - NUMBER_CPU = 3 + NUMBER_CPU = 1 ##============================================================================ ## All done, type make to get a list of frontends diff --git a/stella/src/common/SoundSDL.cxx b/stella/src/common/SoundSDL.cxx index 1d66d35e0..2f76e13f4 100644 --- a/stella/src/common/SoundSDL.cxx +++ b/stella/src/common/SoundSDL.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: SoundSDL.cxx,v 1.9 2005-02-21 02:23:48 stephena Exp $ +// $Id: SoundSDL.cxx,v 1.10 2005-02-22 02:59:53 stephena Exp $ //============================================================================ #include @@ -32,12 +32,14 @@ #include "SoundSDL.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SoundSDL::SoundSDL(uInt32 fragsize) - : myIsInitializedFlag(false), +SoundSDL::SoundSDL(OSystem* osystem) + : Sound(osystem), myFragmentSizeLogBase2(0), - myIsMuted(false), - myVolume(100) + myIsMuted(false) { + uInt32 fragsize = myOSystem->settings().getInt("fragsize"); + myVolume = myOSystem->settings().getInt("volume"); + if(SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { cerr << "WARNING: Couldn't initialize SDL audio system! " << endl; diff --git a/stella/src/common/SoundSDL.hxx b/stella/src/common/SoundSDL.hxx index 909c388c1..e8c4510dd 100644 --- a/stella/src/common/SoundSDL.hxx +++ b/stella/src/common/SoundSDL.hxx @@ -13,12 +13,14 @@ // 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.7 2005-02-13 19:17:02 stephena Exp $ +// $Id: SoundSDL.hxx,v 1.8 2005-02-22 02:59:53 stephena Exp $ //============================================================================ #ifndef SOUNDSDL_HXX #define SOUNDSDL_HXX +class OSystem; + #include #include "Sound.hxx" @@ -29,7 +31,7 @@ This class implements the sound API for SDL. @author Stephen Anthony and Bradford W. Mott - @version $Id: SoundSDL.hxx,v 1.7 2005-02-13 19:17:02 stephena Exp $ + @version $Id: SoundSDL.hxx,v 1.8 2005-02-22 02:59:53 stephena Exp $ */ class SoundSDL : public Sound { @@ -38,7 +40,7 @@ class SoundSDL : public Sound Create a new sound object. The init method must be invoked before using the object. */ - SoundSDL(uInt32 fragsize); + SoundSDL(OSystem* osystem); /** Destructor @@ -196,9 +198,6 @@ class SoundSDL : public Sound // Audio specification structure SDL_AudioSpec myHardwareSpec; - // Indicates if the sound device was successfully initialized - bool myIsInitializedFlag; - // Log base 2 of the selected fragment size double myFragmentSizeLogBase2; diff --git a/stella/src/common/mainSDL.cxx b/stella/src/common/mainSDL.cxx index 63dca71e2..66b5c877f 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.22 2005-02-21 20:41:20 stephena Exp $ +// $Id: mainSDL.cxx,v 1.23 2005-02-22 02:59:53 stephena Exp $ //============================================================================ #include @@ -923,20 +923,17 @@ int main(int argc, char* argv[]) // Create a sound object for playing audio if(theSettings->getBool("sound")) { - uInt32 fragsize = theSettings->getInt("fragsize"); - Int32 volume = theSettings->getInt("volume"); - theSound = new SoundSDL(fragsize); - theSound->setVolume(volume); + theSound = new SoundSDL(theOSystem); ostringstream message; - message << "Sound enabled:" << endl - << " Volume : " << volume << endl - << " Frag size: " << fragsize << endl; + message << "Sound enabled:" << endl; +//FIXME << " Volume : " << volume << endl +// << " Frag size: " << fragsize << endl; ShowInfo(message.str()); } else // even if sound has been disabled, we still need a sound object { - theSound = new Sound(); + theSound = new Sound(theOSystem); ShowInfo("Sound disabled"); } @@ -958,9 +955,8 @@ int main(int argc, char* argv[]) in.close(); // Create the 2600 game console - Console* theConsole = new Console(image, size, theOSystem); - -cerr << "got here\n"; + Console* theConsole = (Console*) NULL; + theConsole = new Console(image, size, theOSystem); // 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 fcb10111d..bc8eaf420 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.40 2005-02-21 20:41:24 stephena Exp $ +// $Id: Console.cxx,v 1.41 2005-02-22 02:59:53 stephena Exp $ //============================================================================ #include @@ -173,12 +173,12 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem) ostringstream title; title << "Stella: \"" << myProperties.get("Cartridge.Name") << "\""; myOSystem->frameBuffer().initialize(title.str(), - myMediaSource->width() << 1, - myMediaSource->height()); + myMediaSource->width() << 1, + myMediaSource->height()); // Initialize the sound interface. uInt32 soundFrameRate = (myProperties.get("Display.Format") == "PAL") ? 50 : 60; - myOSystem->sound().initialize(myOSystem, mySystem, soundFrameRate); + myOSystem->sound().initialize(soundFrameRate); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 1d9f3e679..db033fcc6 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.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: EventHandler.cxx,v 1.32 2005-02-21 20:42:07 stephena Exp $ +// $Id: EventHandler.cxx,v 1.33 2005-02-22 02:59:53 stephena Exp $ //============================================================================ #include @@ -42,7 +42,6 @@ EventHandler::EventHandler(OSystem* osystem) myMenuStatus(false), myRemapEnabledFlag(true) { -cerr << "EventHandler::EventHandler()\n"; // Add this eventhandler object to the OSystem myOSystem->attach(this); diff --git a/stella/src/emucore/FrameBuffer.cxx b/stella/src/emucore/FrameBuffer.cxx index 25c081b90..5de44799e 100644 --- a/stella/src/emucore/FrameBuffer.cxx +++ b/stella/src/emucore/FrameBuffer.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: FrameBuffer.cxx,v 1.14 2005-02-21 20:42:38 stephena Exp $ +// $Id: FrameBuffer.cxx,v 1.15 2005-02-22 02:59:54 stephena Exp $ //============================================================================ #include @@ -81,6 +81,7 @@ FrameBuffer::FrameBuffer(OSystem* osystem) myMenuRedraws(2), myInfoMenuWidth(0) { + // Add the framebuffer to the system myOSystem->attach(this); } diff --git a/stella/src/emucore/Sound.cxx b/stella/src/emucore/Sound.cxx index ddcea23b3..acda94d02 100644 --- a/stella/src/emucore/Sound.cxx +++ b/stella/src/emucore/Sound.cxx @@ -13,18 +13,23 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Sound.cxx,v 1.15 2005-02-21 02:23:57 stephena Exp $ +// $Id: Sound.cxx,v 1.16 2005-02-22 02:59:54 stephena Exp $ //============================================================================ #include "Serializer.hxx" #include "Deserializer.hxx" +#include "OSystem.hxx" #include "Sound.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Sound::Sound(uInt32 fragsize) - : myLastRegisterSetCycle(0) +Sound::Sound(OSystem* osystem) + : myOSystem(osystem), + myIsInitializedFlag(false), + myLastRegisterSetCycle(0) { + // Add the sound object to the system + myOSystem->attach(this); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -44,10 +49,8 @@ void Sound::mute(bool state) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Sound::initialize(OSystem* osystem, System* system, double displayframerate) +void Sound::initialize(double displayframerate) { - myOSystem = osystem; - mySystem = system; myLastRegisterSetCycle = 0; myDisplayFrameRate = displayframerate; } diff --git a/stella/src/emucore/Sound.hxx b/stella/src/emucore/Sound.hxx index 73ef1ac22..70b4bbd54 100644 --- a/stella/src/emucore/Sound.hxx +++ b/stella/src/emucore/Sound.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: Sound.hxx,v 1.14 2005-02-21 02:23:57 stephena Exp $ +// $Id: Sound.hxx,v 1.15 2005-02-22 02:59:54 stephena Exp $ //============================================================================ #ifndef SOUND_HXX @@ -22,7 +22,6 @@ class OSystem; class Serializer; class Deserializer; -class System; #include "bspf.hxx" @@ -32,7 +31,7 @@ class System; to compile Stella with no sound support whatsoever. @author Stephen Anthony and Bradford W. Mott - @version $Id: Sound.hxx,v 1.14 2005-02-21 02:23:57 stephena Exp $ + @version $Id: Sound.hxx,v 1.15 2005-02-22 02:59:54 stephena Exp $ */ class Sound { @@ -41,7 +40,7 @@ class Sound Create a new sound object. The init method must be invoked before using the object. */ - Sound(uInt32 fragsize = 512); + Sound(OSystem* osystem); /** Destructor @@ -61,11 +60,9 @@ class Sound Initializes the sound device. This must be called before any calls are made to derived methods. - @param osystem The OSystem - @param system The M6502 system @param framerate The base framerate depending on NTSC or PAL ROM */ - virtual void initialize(OSystem* osystem, System* system, double displayframerate); + virtual void initialize(double displayframerate); /** Return true iff the sound device was successfully initialized. @@ -133,8 +130,8 @@ public: // The OSystem for this sound object OSystem* myOSystem; - // The M6502 system for this sound object - System* mySystem; + // Indicates if the sound device was successfully initialized + bool myIsInitializedFlag; // Indicates the cycle when a sound register was last set Int32 myLastRegisterSetCycle; diff --git a/stella/src/emucore/TIA.cxx b/stella/src/emucore/TIA.cxx index be3301711..501ae2795 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.37 2005-02-21 20:43:22 stephena Exp $ +// $Id: TIA.cxx,v 1.38 2005-02-22 02:59:54 stephena Exp $ //============================================================================ #include @@ -265,8 +265,6 @@ void TIA::install(System& system) uInt16 shift = mySystem->pageShift(); mySystem->resetCycles(); -cerr << "TIA::install()\n"; - // All accesses are to this device System::PageAccess access; diff --git a/stella/src/emucore/m6502/src/System.cxx b/stella/src/emucore/m6502/src/System.cxx index 1f3e5348f..fa6b1e202 100644 --- a/stella/src/emucore/m6502/src/System.cxx +++ b/stella/src/emucore/m6502/src/System.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: System.cxx,v 1.5 2005-02-21 20:43:28 stephena Exp $ +// $Id: System.cxx,v 1.6 2005-02-22 02:59:54 stephena Exp $ //============================================================================ #include @@ -101,7 +101,6 @@ void System::reset() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void System::attach(Device* device) { -cerr << "System::attach()\n"; assert(myNumberOfDevices < 100); // Add device to my collection of devices