Added ability to specify separate directories for saving

and loading snapshot files.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2612 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-02-16 19:56:09 +00:00
parent c31f53654c
commit c11c7724ad
17 changed files with 105 additions and 41 deletions

View File

@ -53,6 +53,11 @@
* Fixed regression in RIOT INTIM reads; at least one known ROM
(Mr. Roboto Berzerk hack) wasn't working properly.
* Added support for different directories for saving/loading PNG
files. These are set with the 'snapsavedir' and 'snaploaddir'
commandline arguments (which replace the old 'snapdir'), and are
also available within the UI.
* Updated included PNG and ZLIB libraries to latest stable version.
-Have fun!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -2101,10 +2101,15 @@
</tr>
<tr>
<td><pre>-snapdir &lt;path&gt;</pre></td>
<td><pre>-snapsavedir &lt;path&gt;</pre></td>
<td>The directory to save snapshot files to.</td>
</tr>
<tr>
<td><pre>-snaploaddir &lt;path&gt;</pre></td>
<td>The directory to load snapshot files from.</td>
</tr>
<tr>
<td><pre>-sssingle &lt;1|0&gt;</pre></td>
<td>Generate single snapshot instead of many, overwriting
@ -2552,7 +2557,8 @@
<table border="1" cellpadding="4">
<tr><th>Item</th><th>Brief description</th><th>For more information,<br>see <a href="#CommandLine">CommandLine</a></th></tr>
<tr><td>Rom path</td><td>specifies location of ROM files</td><td>-romdir</td></tr>
<tr><td>Snapshot path</td><td>specifies where to load/save snapshots</td><td>-snapdir</td></tr>
<tr><td>Snapshot save path</td><td>specifies where to save snapshots</td><td>-snapsavedir</td></tr>
<tr><td>Snapshot load path</td><td>specifies where to load snapshots</td><td>-snaploaddir</td></tr>
<tr><td>Cheat file</td><td>specifies location of cheatfile database</td><td>-cheatfile</td></tr>
<tr><td>Palette file</td><td>specifies location of user palette</td><td>-palettefile</td></tr>
<tr><td>Properties file </td><td>specifies location of external stella.pro database</td><td>-propsfile</td></tr>

View File

@ -1948,7 +1948,7 @@ void EventHandler::takeSnapshot(uInt32 number)
// Figure out the correct snapshot name
string filename;
bool showmessage = number == 0;
string sspath = myOSystem->snapshotDir() +
string sspath = myOSystem->snapshotSaveDir() +
myOSystem->console().properties().get(Cartridge_Name);
// Check whether we want multiple snapshots created

View File

@ -348,7 +348,8 @@ void OSystem::setConfigPaths()
string s;
validatePath(myStateDir, "statedir", myBaseDir + "statedir");
validatePath(mySnapshotDir, "snapdir", defaultSnapDir());
validatePath(mySnapshotSaveDir, "snapsavedir", defaultSnapSaveDir());
validatePath(mySnapshotLoadDir, "snaploaddir", defaultSnapLoadDir());
validatePath(myEEPROMDir, "eepromdir", myBaseDir);
validatePath(myCfgDir, "cfgdir", myBaseDir + "cfg");

View File

@ -314,9 +314,11 @@ class OSystem
const string& stateDir() const { return myStateDir; }
/**
Return the full/complete directory name for storing PNG snapshots.
Return the full/complete directory name for saving and loading
PNG snapshots.
*/
const string& snapshotDir() const { return mySnapshotDir; }
const string& snapshotSaveDir() const { return mySnapshotSaveDir; }
const string& snapshotLoadDir() const { return mySnapshotLoadDir; }
/**
Return the full/complete directory name for storing EEPROM files.
@ -505,13 +507,14 @@ class OSystem
virtual void stateChanged(EventHandler::State state);
/**
Returns the default path for the snapshot directory.
Returns the default save and load paths for the snapshot directory.
Since this varies greatly among different systems and is the one
directory that most end-users care about (vs. config file stuff
that usually isn't user-modifiable), we create a special method
for it.
*/
virtual string defaultSnapDir() { return "~"; }
virtual string defaultSnapSaveDir() { return "~"; }
virtual string defaultSnapLoadDir() { return "~"; }
/**
Set the position of the application window, generally using
@ -610,7 +613,8 @@ class OSystem
enum { kNumUIPalettes = 2 };
string myBaseDir;
string myStateDir;
string mySnapshotDir;
string mySnapshotSaveDir;
string mySnapshotLoadDir;
string myEEPROMDir;
string myCfgDir;

View File

@ -94,7 +94,8 @@ Settings::Settings(OSystem* osystem)
setInternal("ctrlcombo", "true");
// Snapshot options
setInternal("snapdir", "");
setInternal("snapsavedir", "");
setInternal("snaploaddir", "");
setInternal("sssingle", "false");
setInternal("ss1x", "false");
setInternal("ssinterval", "2");
@ -398,7 +399,8 @@ void Settings::usage()
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
<< " -stats <1|0> Overlay console info during emulation\n"
<< " -fastscbios <1|0> Disable Supercharger BIOS progress loading bars\n"
<< " -snapdir <path> The directory to save snapshot files to\n"
<< " -snapsavedir <path> The directory to save snapshot files to\n"
<< " -snaploaddir <path> The directory to load snapshot files from\n"
<< " -sssingle <1|0> Generate single snapshot instead of many\n"
<< " -ss1x <1|0> Generate TIA snapshot in 1x mode (ignore scaling/effects)\n"
<< " -ssinterval <number Number of seconds between snapshots in continuous snapshot mode\n"

View File

@ -43,7 +43,7 @@ FileSnapDialog::FileSnapDialog(
{
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),
buttonWidth = font.getStringWidth("Properties file:") + 20,
buttonWidth = font.getStringWidth("Snapshot load path:") + 20,
buttonHeight = font.getLineHeight() + 4;
const int vBorder = 8;
int xpos, ypos;
@ -51,8 +51,8 @@ FileSnapDialog::FileSnapDialog(
ButtonWidget* b;
// Set real dimensions
_w = 52 * fontWidth + 8;
_h = 12 * (lineHeight + 4) + 10;
_w = 56 * fontWidth + 8;
_h = 13 * (lineHeight + 4) + 10;
xpos = vBorder; ypos = vBorder;
@ -66,15 +66,25 @@ FileSnapDialog::FileSnapDialog(
_w - xpos - 10, lineHeight, "");
wid.push_back(myRomPath);
// Snapshot path
// Snapshot path (save files)
xpos = vBorder; ypos += romButton->getHeight() + 3;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Snapshot path:", kChooseSnapDirCmd);
"Snapshot save path:", kChooseSnapSaveDirCmd);
wid.push_back(b);
xpos += buttonWidth + 10;
mySnapPath = new EditTextWidget(this, font, xpos, ypos + 2,
mySnapSavePath = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, "");
wid.push_back(mySnapPath);
wid.push_back(mySnapSavePath);
// Snapshot path (load files)
xpos = vBorder; ypos += romButton->getHeight() + 3;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Snapshot load path:", kChooseSnapLoadDirCmd);
wid.push_back(b);
xpos += buttonWidth + 10;
mySnapLoadPath = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, "");
wid.push_back(mySnapLoadPath);
// Cheat file
xpos = vBorder; ypos += b->getHeight() + 3;
@ -188,7 +198,8 @@ void FileSnapDialog::loadConfig()
{
const Settings& settings = instance().settings();
myRomPath->setEditString(settings.getString("romdir"));
mySnapPath->setEditString(settings.getString("snapdir"));
mySnapSavePath->setEditString(settings.getString("snapsavedir"));
mySnapLoadPath->setEditString(settings.getString("snaploaddir"));
myCheatFile->setEditString(settings.getString("cheatfile"));
myPaletteFile->setEditString(settings.getString("palettefile"));
myPropsFile->setEditString(settings.getString("propsfile"));
@ -203,7 +214,8 @@ void FileSnapDialog::loadConfig()
void FileSnapDialog::saveConfig()
{
instance().settings().setString("romdir", myRomPath->getEditString());
instance().settings().setString("snapdir", mySnapPath->getEditString());
instance().settings().setString("snapsavedir", mySnapSavePath->getEditString());
instance().settings().setString("snaploaddir", mySnapLoadPath->getEditString());
instance().settings().setString("cheatfile", myCheatFile->getEditString());
instance().settings().setString("palettefile", myPaletteFile->getEditString());
instance().settings().setString("propsfile", myPropsFile->getEditString());
@ -227,7 +239,8 @@ void FileSnapDialog::setDefaults()
node = FilesystemNode("~");
myRomPath->setEditString(node.getShortPath());
mySnapPath->setEditString(instance().defaultSnapDir());
mySnapSavePath->setEditString(instance().defaultSnapSaveDir());
mySnapLoadPath->setEditString(instance().defaultSnapLoadDir());
const string& cheatfile = basedir + "stella.cht";
node = FilesystemNode(cheatfile);
@ -276,9 +289,14 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
FilesystemNode::kListDirectoriesOnly, kRomDirChosenCmd);
break;
case kChooseSnapDirCmd:
myBrowser->show("Select snapshot directory:", mySnapPath->getEditString(),
FilesystemNode::kListDirectoriesOnly, kSnapDirChosenCmd);
case kChooseSnapSaveDirCmd:
myBrowser->show("Select snapshot save directory:", mySnapSavePath->getEditString(),
FilesystemNode::kListDirectoriesOnly, kSnapSaveDirChosenCmd);
break;
case kChooseSnapLoadDirCmd:
myBrowser->show("Select snapshot load directory:", mySnapLoadPath->getEditString(),
FilesystemNode::kListDirectoriesOnly, kSnapLoadDirChosenCmd);
break;
case kChooseCheatFileCmd:
@ -313,10 +331,17 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
break;
}
case kSnapDirChosenCmd:
case kSnapSaveDirChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());
mySnapPath->setEditString(dir.getShortPath());
mySnapSavePath->setEditString(dir.getShortPath());
break;
}
case kSnapLoadDirChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());
mySnapLoadPath->setEditString(dir.getShortPath());
break;
}

View File

@ -58,7 +58,8 @@ class FileSnapDialog : public Dialog, public CommandSender
kChooseCheatFileCmd = 'LOcf', // cheatfile (stella.cht)
kChoosePaletteFileCmd = 'LOpf', // palette file (stella.pal)
kChoosePropsFileCmd = 'LOpr', // properties file (stella.pro)
kChooseSnapDirCmd = 'LOsn', // snapshot dir
kChooseSnapSaveDirCmd = 'LOss', // snapshot dir (save files)
kChooseSnapLoadDirCmd = 'LOsl', // snapshot dir (load files)
kChooseEEPROMDirCmd = 'LOee', // eeprom dir
kStateDirChosenCmd = 'LOsc', // state dir changed
kCheatFileChosenCmd = 'LOcc', // cheatfile changed
@ -76,7 +77,8 @@ class FileSnapDialog : public Dialog, public CommandSender
EditTextWidget* myCheatFile;
EditTextWidget* myPaletteFile;
EditTextWidget* myPropsFile;
EditTextWidget* mySnapPath;
EditTextWidget* mySnapSavePath;
EditTextWidget* mySnapLoadPath;
// Other snapshot settings
CheckboxWidget* mySnapSingle;

View File

@ -603,7 +603,11 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
updateListing();
break;
case kSnapDirChosenCmd:
case kSnapSaveDirChosenCmd:
// Stub just in case we need it
break;
case kSnapLoadDirChosenCmd:
// Stub just in case we need it
break;

View File

@ -49,10 +49,11 @@ class StringListWidget;
// These must be accessible from dialogs created by this class
enum {
kRomDirChosenCmd = 'romc', // rom chosen
kSnapDirChosenCmd = 'snpc', // snap chosen
kReloadRomDirCmd = 'rdrl', // reload the current listing
kReloadFiltersCmd = 'rlfl' // reload filtering options and current listing
kRomDirChosenCmd = 'romc', // rom chosen
kSnapSaveDirChosenCmd = 'snsc', // snap chosen (save files)
kSnapLoadDirChosenCmd = 'snlc', // snap chosen (load files)
kReloadRomDirCmd = 'rdrl', // reload the current listing
kReloadFiltersCmd = 'rlfl' // reload filtering options and current listing
};
class LauncherDialog : public Dialog

View File

@ -108,7 +108,7 @@ void RomInfoWidget::parseProperties()
myRomInfo.clear();
// Get a valid filename representing a snapshot file for this rom
const string& filename = instance().snapshotDir() +
const string& filename = instance().snapshotLoadDir() +
myProperties.get(Cartridge_Name) + ".png";
// Read the PNG file

View File

@ -174,7 +174,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
// Add message concerning usage
const GUI::Font& infofont = instance().infoFont();
ypos = myTab->getHeight() - 5 - fontHeight - infofont.getFontHeight()- 10;
ypos = myTab->getHeight() - 5 - fontHeight - infofont.getFontHeight() - 10;
new StaticTextWidget(myTab, infofont, 10, ypos,
font.getStringWidth("(*) Requires application restart"), fontHeight,
"(*) Requires application restart", kTextAlignLeft);

View File

@ -46,8 +46,14 @@ OSystemMACOSX::~OSystemMACOSX()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string OSystemMACOSX::defaultSnapDir()
string OSystemMACOSX::defaultSnapSaveDir()
{
FilesystemNode desktop("~/Desktop");
return desktop.isDirectory() ? desktop.getShortPath() : "~";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string OSystemMACOSX::defaultSnapLoadDir()
{
return defaultSnapSaveDir();
}

View File

@ -42,9 +42,10 @@ class OSystemMACOSX : public OSystem
virtual ~OSystemMACOSX();
/**
Returns the default path for the snapshot directory.
Returns the default paths for the snapshot directory.
*/
string defaultSnapDir();
string defaultSnapSaveDir();
string defaultSnapLoadDir();
};
#endif

View File

@ -91,13 +91,19 @@ OSystemWin32::~OSystemWin32()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string OSystemWin32::defaultSnapDir()
string OSystemWin32::defaultSnapSaveDir()
{
HomeFinder homefinder;
FilesystemNode desktop(homefinder.getDesktopPath());
return desktop.isDirectory() ? desktop.getShortPath() : "~";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string OSystemWin32::defaultSnapLoadDir()
{
return defaultSnapSaveDir();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemWin32::setAppWindowPos(int x, int y, int w, int h)
{

View File

@ -44,9 +44,10 @@ class OSystemWin32 : public OSystem
public:
/**
Returns the default path for the snapshot directory.
Returns the default paths for the snapshot directory.
*/
string defaultSnapDir();
string defaultSnapSaveDir();
string defaultSnapLoadDir();
/**
Move window to given position. The width and height are also