diff --git a/stella/src/build/makefile b/stella/src/build/makefile index c95e5fc4b..7adbfca3c 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.15 2002-04-22 00:53:19 bwmott Exp $ +## $Id: makefile,v 1.16 2002-05-13 19:29:44 stephena Exp $ ##============================================================================ ##============================================================================ @@ -229,6 +229,7 @@ CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \ Console.o Control.o Driving.o \ Event.o Joystick.o Keyboard.o M6532.o MD5.o MediaSrc.o Paddles.o \ Props.o PropsSet.o Random.o Sound.o Switches.o Settings.o TIA.o \ + Serializer.o Deserializer.o \ $(M6502_OBJS) stella.exe: $(CORE_OBJS) $(OBJS) @@ -372,6 +373,12 @@ Switches.o: $(CORE)/Switches.cxx Sound.o: $(CORE)/Sound.cxx $(CXX) -c $(CXXFLAGS) $(OPTIONS) $(CORE)/Sound.cxx +Serializer.o: $(CORE)/Serializer.cxx + $(CXX) -c $(CXXFLAGS) $(OPTIONS) $(CORE)/Serializer.cxx + +Deserializer.o: $(CORE)/Deserializer.cxx + $(CXX) -c $(CXXFLAGS) $(OPTIONS) $(CORE)/Deserializer.cxx + Settings.o: $(UI)/common/Settings.cxx $(UI)/common/Settings.hxx $(CXX) -c $(CXXFLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/common/Settings.cxx @@ -431,4 +438,3 @@ NullDev.o: $(CORE)/m6502/src/NullDev.cxx System.o: $(CORE)/m6502/src/System.cxx $(CXX) -c $(CXXFLAGS) $(OPTIONS) $(CORE)/m6502/src/System.cxx - diff --git a/stella/src/ui/sdl/mainSDL.cxx b/stella/src/ui/sdl/mainSDL.cxx index 86acc08d1..ffa77bd35 100644 --- a/stella/src/ui/sdl/mainSDL.cxx +++ b/stella/src/ui/sdl/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 2002-04-18 17:18:48 stephena Exp $ +// $Id: mainSDL.cxx,v 1.23 2002-05-13 19:29:44 stephena Exp $ //============================================================================ #include @@ -201,7 +201,6 @@ static bool isCentered = false; static uInt32 currentState = 0; - /** This routine should be called once the console is created to setup the SDL window for us to use. Return false if any operation fails, @@ -622,23 +621,25 @@ void grabMouse(bool grab) */ void saveState() { -#if 0 - // Do a state save using the MediaSource - // ... + char buf[40]; + + // First get the name for the current state file + string md5 = theConsole->properties().get("Cartridge.MD5"); + snprintf(buf, 39, "%s.st%d", md5.c_str(), currentState); + string fileName = buf; + + // Do a state save using the System + int result = theConsole->system().saveState(fileName, md5); // Print appropriate message - char buf[40]; - if(true) // if the state saved correctly + if(result == 1) snprintf(buf, 39, "State %d saved", currentState); else - snprintf(buf, 39, "Error saving state %d", currentState); + snprintf(buf, 39, "Error saving state %d %d", currentState, result); string message = buf; theConsole->mediaSource().showMessage(message, MESSAGE_INTERVAL * settings->theDesiredFrameRate); -#else - cerr << "State saving not yet implemented\n"; -#endif } @@ -652,14 +653,12 @@ void changeState() else ++currentState; -#if 0 // Print appropriate message char buf[40]; snprintf(buf, 39, "Changed to state slot %d", currentState); string message = buf; theConsole->mediaSource().showMessage(message, MESSAGE_INTERVAL * settings->theDesiredFrameRate); -#endif } @@ -668,23 +667,25 @@ void changeState() */ void loadState() { -#if 0 - // Do a state load using the MediaSource - // ... + char buf[40]; + + // First get the name for the current state file + string md5 = theConsole->properties().get("Cartridge.MD5"); + snprintf(buf, 39, "%s.st%d", md5.c_str(), currentState); + string fileName = buf; + + // Do a state load using the System + int result = theConsole->system().loadState(fileName, md5); // Print appropriate message - char buf[40]; - if(true) // if the state loaded correctly + if(result == 1) snprintf(buf, 39, "State %d loaded", currentState); else - snprintf(buf, 39, "Error loading state %d", currentState); + snprintf(buf, 39, "Error loading state %d %d", currentState, result); string message = buf; theConsole->mediaSource().showMessage(message, MESSAGE_INTERVAL * settings->theDesiredFrameRate); -#else - cerr << "State loading not yet implemented\n"; -#endif }