mirror of https://github.com/stella-emu/stella.git
Made the error message clearer when a snapshot file couldn't be created.
Made the default snapshot folder be $BASEDIR/snapshots, and got rid of the previous default './'. I suspect this relative pathname was causing a problem. The user is still free to choose another snapshot dir, but the one in $BASEDIR is always created anyway. Removed the logic that entering Stella directly from a ROM wouldn't allow one to enter the ROM launcher afterwords. You can now always exit from a ROM back to the launcher, no matter how Stella was launched. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1452 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
cd9d21051f
commit
c90e67d398
|
@ -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 <zlib.h>
|
||||
|
@ -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 };
|
||||
|
|
|
@ -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 <sstream>
|
||||
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 <cassert>
|
||||
|
@ -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 == "")
|
||||
|
|
|
@ -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<Resolution> 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;
|
||||
|
|
|
@ -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 <cassert>
|
||||
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue