diff --git a/stella/src/common/Snapshot.cxx b/stella/src/common/Snapshot.cxx index f1e85b92b..38f3962f8 100644 --- a/stella/src/common/Snapshot.cxx +++ b/stella/src/common/Snapshot.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: Snapshot.cxx,v 1.18 2008-02-06 13:45:19 stephena Exp $ +// $Id: Snapshot.cxx,v 1.19 2008-03-30 15:01:38 stephena Exp $ //============================================================================ #include @@ -46,8 +46,8 @@ void Snapshot::savePNG(FrameBuffer& framebuffer, const Properties& props, int height = framebuffer.imageHeight(); out.open(filename.c_str(), ios_base::binary); - if(!out) - throw "Couldn't open snapshot file"; + if(!out.is_open()) + throw "Error: Couldn't create snapshot file"; // PNG file header uInt8 header[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 804286469..9e6279cf0 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -14,7 +14,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.220 2008-03-28 23:29:13 stephena Exp $ +// $Id: EventHandler.cxx,v 1.221 2008-03-30 15:01:38 stephena Exp $ //============================================================================ #include @@ -64,7 +64,6 @@ EventHandler::EventHandler(OSystem* osystem) myOverlay(NULL), myState(S_NONE), myGrabMouseFlag(false), - myUseLauncherFlag(false), myAllowAllDirectionsFlag(false), myFryingFlag(false) { @@ -155,13 +154,8 @@ void EventHandler::initialize() void EventHandler::reset(State state) { setEventState(state); - myEvent->clear(); - myOSystem->state().reset(); - - if(myState == S_LAUNCHER) - myUseLauncherFlag = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -982,10 +976,7 @@ void EventHandler::handleEvent(Event::Type event, int state) return; case Event::LauncherMode: - // ExitGame will only work when we've launched stella using the ROM - // launcher. Otherwise, the only way to exit the main loop is to Quit. - if((myState == S_EMULATE || myState == S_CMDMENU) && - myUseLauncherFlag && state) + if((myState == S_EMULATE || myState == S_CMDMENU) && state) { myOSystem->settings().saveConfig(); myOSystem->deleteConsole(); diff --git a/stella/src/emucore/EventHandler.hxx b/stella/src/emucore/EventHandler.hxx index cc46b18d8..e4de3cdfd 100644 --- a/stella/src/emucore/EventHandler.hxx +++ b/stella/src/emucore/EventHandler.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: EventHandler.hxx,v 1.109 2008-03-22 17:35:02 stephena Exp $ +// $Id: EventHandler.hxx,v 1.110 2008-03-30 15:01:38 stephena Exp $ //============================================================================ #ifndef EVENTHANDLER_HXX @@ -61,7 +61,7 @@ enum EventMode { mapping can take place. @author Stephen Anthony - @version $Id: EventHandler.hxx,v 1.109 2008-03-22 17:35:02 stephena Exp $ + @version $Id: EventHandler.hxx,v 1.110 2008-03-30 15:01:38 stephena Exp $ */ class EventHandler { @@ -164,12 +164,6 @@ class EventHandler */ inline State state() { return myState; } - /** - Returns the current launcher state (decide whether to enter launcher - on game exit). - */ - inline bool useLauncher() { return myUseLauncherFlag; } - /** Resets the state machine of the EventHandler to the defaults @@ -497,9 +491,6 @@ class EventHandler // Indicates whether the mouse cursor is grabbed bool myGrabMouseFlag; - // Indicates whether to use launcher mode when exiting a game - bool myUseLauncherFlag; - // Indicates whether the joystick emulates 'impossible' directions bool myAllowAllDirectionsFlag; diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index 694e34e53..2a216b28e 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.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: OSystem.cxx,v 1.119 2008-03-23 16:22:40 stephena Exp $ +// $Id: OSystem.cxx,v 1.120 2008-03-30 15:01:38 stephena Exp $ //============================================================================ #include @@ -217,7 +217,12 @@ void OSystem::setConfigPaths() FilesystemNode::makeDir(myStateDir); mySettings->setString("statedir", myStateDir); - myGameListCacheFile = myBaseDir + BSPF_PATH_SEPARATOR + "stella.cache"; + mySnapshotDir = mySettings->getString("ssdir"); + if(mySnapshotDir == "") + mySnapshotDir = myBaseDir + BSPF_PATH_SEPARATOR + "snapshots"; + if(!FilesystemNode::dirExists(mySnapshotDir)) + FilesystemNode::makeDir(mySnapshotDir); + mySettings->setString("ssdir", mySnapshotDir); myCheatFile = mySettings->getString("cheatfile"); if(myCheatFile == "") diff --git a/stella/src/emucore/OSystem.hxx b/stella/src/emucore/OSystem.hxx index 888260129..d7c550395 100644 --- a/stella/src/emucore/OSystem.hxx +++ b/stella/src/emucore/OSystem.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: OSystem.hxx,v 1.62 2008-03-14 19:34:56 stephena Exp $ +// $Id: OSystem.hxx,v 1.63 2008-03-30 15:01:38 stephena Exp $ //============================================================================ #ifndef OSYSTEM_HXX @@ -55,7 +55,7 @@ typedef Common::Array ResolutionList; other objects belong. @author Stephen Anthony - @version $Id: OSystem.hxx,v 1.62 2008-03-14 19:34:56 stephena Exp $ + @version $Id: OSystem.hxx,v 1.63 2008-03-30 15:01:38 stephena Exp $ */ class OSystem { @@ -244,12 +244,9 @@ class OSystem const string& stateDir() const { return myStateDir; } /** - This method should be called to get the full path of the gamelist - cache file (used by the Launcher to show a listing of available games). - - @return String representing the full path of the gamelist cache file. + Return the directory for storing PNG snapshots. */ - const string& cacheFile() const { return myGameListCacheFile; } + const string& snapshotDir() const { return mySnapshotDir; } /** This method should be called to get the full path of the cheat file. @@ -435,11 +432,6 @@ class OSystem */ void setBaseDir(const string& basedir); - /** - Set the location of the gamelist cache file - */ - void setCacheFile(const string& cachefile) { myGameListCacheFile = cachefile; } - /** Set the locations of config file */ @@ -501,13 +493,13 @@ class OSystem enum { kNumUIPalettes = 2 }; string myBaseDir; string myStateDir; + string mySnapshotDir; string myCheatFile; string myConfigFile; string myPaletteFile; string myPropertiesFile; - string myGameListCacheFile; string myRomFile; string myFeatures; diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index a265ab8fa..c1a8dd3eb 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.139 2008-03-26 23:59:21 stephena Exp $ +// $Id: Settings.cxx,v 1.140 2008-03-30 15:01:38 stephena Exp $ //============================================================================ #include @@ -74,7 +74,7 @@ Settings::Settings(OSystem* osystem) setInternal("sa2", "right"); // Snapshot options - setInternal("ssdir", string(".") + BSPF_PATH_SEPARATOR); + setInternal("ssdir", ""); setInternal("sssingle", "false"); // Config files and paths diff --git a/stella/src/gui/CommandDialog.cxx b/stella/src/gui/CommandDialog.cxx index eef935e0a..f2c3e2ab4 100644 --- a/stella/src/gui/CommandDialog.cxx +++ b/stella/src/gui/CommandDialog.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: CommandDialog.cxx,v 1.17 2008-02-06 13:45:23 stephena Exp $ +// $Id: CommandDialog.cxx,v 1.18 2008-03-30 15:01:38 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -204,10 +204,7 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd, break; case kExitCmd: - if(instance()->eventHandler().useLauncher()) - instance()->eventHandler().handleEvent(Event::LauncherMode, 1); - else - instance()->quit(); + instance()->eventHandler().handleEvent(Event::LauncherMode, 1); execute = false; break; diff --git a/stella/src/gui/FileSnapDialog.cxx b/stella/src/gui/FileSnapDialog.cxx index 85934a5f0..6d91b2477 100644 --- a/stella/src/gui/FileSnapDialog.cxx +++ b/stella/src/gui/FileSnapDialog.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: FileSnapDialog.cxx,v 1.17 2008-03-23 17:43:22 stephena Exp $ +// $Id: FileSnapDialog.cxx,v 1.18 2008-03-30 15:01:38 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -183,7 +183,7 @@ void FileSnapDialog::setDefaults() const string& cheatfile = basedir + BSPF_PATH_SEPARATOR + "stella.cht"; const string& palettefile = basedir + BSPF_PATH_SEPARATOR + "stella.pal"; const string& propsfile = basedir + BSPF_PATH_SEPARATOR + "stella.pro"; - const string& ssdir = basedir + BSPF_PATH_SEPARATOR; + const string& ssdir = basedir + BSPF_PATH_SEPARATOR + "snapshots"; myRomPath->setEditString(romdir); myStatePath->setEditString(statedir);