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 * Fixed regression in RIOT INTIM reads; at least one known ROM
(Mr. Roboto Berzerk hack) wasn't working properly. (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. * Updated included PNG and ZLIB libraries to latest stable version.
-Have fun! -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>
<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> <td>The directory to save snapshot files to.</td>
</tr> </tr>
<tr>
<td><pre>-snaploaddir &lt;path&gt;</pre></td>
<td>The directory to load snapshot files from.</td>
</tr>
<tr> <tr>
<td><pre>-sssingle &lt;1|0&gt;</pre></td> <td><pre>-sssingle &lt;1|0&gt;</pre></td>
<td>Generate single snapshot instead of many, overwriting <td>Generate single snapshot instead of many, overwriting
@ -2552,7 +2557,8 @@
<table border="1" cellpadding="4"> <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><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>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>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>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> <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 // Figure out the correct snapshot name
string filename; string filename;
bool showmessage = number == 0; bool showmessage = number == 0;
string sspath = myOSystem->snapshotDir() + string sspath = myOSystem->snapshotSaveDir() +
myOSystem->console().properties().get(Cartridge_Name); myOSystem->console().properties().get(Cartridge_Name);
// Check whether we want multiple snapshots created // Check whether we want multiple snapshots created

View File

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

View File

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

View File

@ -94,7 +94,8 @@ Settings::Settings(OSystem* osystem)
setInternal("ctrlcombo", "true"); setInternal("ctrlcombo", "true");
// Snapshot options // Snapshot options
setInternal("snapdir", ""); setInternal("snapsavedir", "");
setInternal("snaploaddir", "");
setInternal("sssingle", "false"); setInternal("sssingle", "false");
setInternal("ss1x", "false"); setInternal("ss1x", "false");
setInternal("ssinterval", "2"); setInternal("ssinterval", "2");
@ -398,7 +399,8 @@ void Settings::usage()
<< " -autoslot <1|0> Automatically switch to next save slot when state saving\n" << " -autoslot <1|0> Automatically switch to next save slot when state saving\n"
<< " -stats <1|0> Overlay console info during emulation\n" << " -stats <1|0> Overlay console info during emulation\n"
<< " -fastscbios <1|0> Disable Supercharger BIOS progress loading bars\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" << " -sssingle <1|0> Generate single snapshot instead of many\n"
<< " -ss1x <1|0> Generate TIA snapshot in 1x mode (ignore scaling/effects)\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" << " -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(), const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = font.getMaxCharWidth(),
buttonWidth = font.getStringWidth("Properties file:") + 20, buttonWidth = font.getStringWidth("Snapshot load path:") + 20,
buttonHeight = font.getLineHeight() + 4; buttonHeight = font.getLineHeight() + 4;
const int vBorder = 8; const int vBorder = 8;
int xpos, ypos; int xpos, ypos;
@ -51,8 +51,8 @@ FileSnapDialog::FileSnapDialog(
ButtonWidget* b; ButtonWidget* b;
// Set real dimensions // Set real dimensions
_w = 52 * fontWidth + 8; _w = 56 * fontWidth + 8;
_h = 12 * (lineHeight + 4) + 10; _h = 13 * (lineHeight + 4) + 10;
xpos = vBorder; ypos = vBorder; xpos = vBorder; ypos = vBorder;
@ -66,15 +66,25 @@ FileSnapDialog::FileSnapDialog(
_w - xpos - 10, lineHeight, ""); _w - xpos - 10, lineHeight, "");
wid.push_back(myRomPath); wid.push_back(myRomPath);
// Snapshot path // Snapshot path (save files)
xpos = vBorder; ypos += romButton->getHeight() + 3; xpos = vBorder; ypos += romButton->getHeight() + 3;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Snapshot path:", kChooseSnapDirCmd); "Snapshot save path:", kChooseSnapSaveDirCmd);
wid.push_back(b); wid.push_back(b);
xpos += buttonWidth + 10; xpos += buttonWidth + 10;
mySnapPath = new EditTextWidget(this, font, xpos, ypos + 2, mySnapSavePath = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, ""); _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 // Cheat file
xpos = vBorder; ypos += b->getHeight() + 3; xpos = vBorder; ypos += b->getHeight() + 3;
@ -188,7 +198,8 @@ void FileSnapDialog::loadConfig()
{ {
const Settings& settings = instance().settings(); const Settings& settings = instance().settings();
myRomPath->setEditString(settings.getString("romdir")); 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")); myCheatFile->setEditString(settings.getString("cheatfile"));
myPaletteFile->setEditString(settings.getString("palettefile")); myPaletteFile->setEditString(settings.getString("palettefile"));
myPropsFile->setEditString(settings.getString("propsfile")); myPropsFile->setEditString(settings.getString("propsfile"));
@ -203,7 +214,8 @@ void FileSnapDialog::loadConfig()
void FileSnapDialog::saveConfig() void FileSnapDialog::saveConfig()
{ {
instance().settings().setString("romdir", myRomPath->getEditString()); 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("cheatfile", myCheatFile->getEditString());
instance().settings().setString("palettefile", myPaletteFile->getEditString()); instance().settings().setString("palettefile", myPaletteFile->getEditString());
instance().settings().setString("propsfile", myPropsFile->getEditString()); instance().settings().setString("propsfile", myPropsFile->getEditString());
@ -227,7 +239,8 @@ void FileSnapDialog::setDefaults()
node = FilesystemNode("~"); node = FilesystemNode("~");
myRomPath->setEditString(node.getShortPath()); myRomPath->setEditString(node.getShortPath());
mySnapPath->setEditString(instance().defaultSnapDir()); mySnapSavePath->setEditString(instance().defaultSnapSaveDir());
mySnapLoadPath->setEditString(instance().defaultSnapLoadDir());
const string& cheatfile = basedir + "stella.cht"; const string& cheatfile = basedir + "stella.cht";
node = FilesystemNode(cheatfile); node = FilesystemNode(cheatfile);
@ -276,9 +289,14 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
FilesystemNode::kListDirectoriesOnly, kRomDirChosenCmd); FilesystemNode::kListDirectoriesOnly, kRomDirChosenCmd);
break; break;
case kChooseSnapDirCmd: case kChooseSnapSaveDirCmd:
myBrowser->show("Select snapshot directory:", mySnapPath->getEditString(), myBrowser->show("Select snapshot save directory:", mySnapSavePath->getEditString(),
FilesystemNode::kListDirectoriesOnly, kSnapDirChosenCmd); FilesystemNode::kListDirectoriesOnly, kSnapSaveDirChosenCmd);
break;
case kChooseSnapLoadDirCmd:
myBrowser->show("Select snapshot load directory:", mySnapLoadPath->getEditString(),
FilesystemNode::kListDirectoriesOnly, kSnapLoadDirChosenCmd);
break; break;
case kChooseCheatFileCmd: case kChooseCheatFileCmd:
@ -313,10 +331,17 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
break; break;
} }
case kSnapDirChosenCmd: case kSnapSaveDirChosenCmd:
{ {
FilesystemNode dir(myBrowser->getResult()); FilesystemNode dir(myBrowser->getResult());
mySnapPath->setEditString(dir.getShortPath()); mySnapSavePath->setEditString(dir.getShortPath());
break;
}
case kSnapLoadDirChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());
mySnapLoadPath->setEditString(dir.getShortPath());
break; break;
} }

View File

@ -58,7 +58,8 @@ class FileSnapDialog : public Dialog, public CommandSender
kChooseCheatFileCmd = 'LOcf', // cheatfile (stella.cht) kChooseCheatFileCmd = 'LOcf', // cheatfile (stella.cht)
kChoosePaletteFileCmd = 'LOpf', // palette file (stella.pal) kChoosePaletteFileCmd = 'LOpf', // palette file (stella.pal)
kChoosePropsFileCmd = 'LOpr', // properties file (stella.pro) 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 kChooseEEPROMDirCmd = 'LOee', // eeprom dir
kStateDirChosenCmd = 'LOsc', // state dir changed kStateDirChosenCmd = 'LOsc', // state dir changed
kCheatFileChosenCmd = 'LOcc', // cheatfile changed kCheatFileChosenCmd = 'LOcc', // cheatfile changed
@ -76,7 +77,8 @@ class FileSnapDialog : public Dialog, public CommandSender
EditTextWidget* myCheatFile; EditTextWidget* myCheatFile;
EditTextWidget* myPaletteFile; EditTextWidget* myPaletteFile;
EditTextWidget* myPropsFile; EditTextWidget* myPropsFile;
EditTextWidget* mySnapPath; EditTextWidget* mySnapSavePath;
EditTextWidget* mySnapLoadPath;
// Other snapshot settings // Other snapshot settings
CheckboxWidget* mySnapSingle; CheckboxWidget* mySnapSingle;

View File

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

View File

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

View File

@ -108,7 +108,7 @@ void RomInfoWidget::parseProperties()
myRomInfo.clear(); myRomInfo.clear();
// Get a valid filename representing a snapshot file for this rom // 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"; myProperties.get(Cartridge_Name) + ".png";
// Read the PNG file // Read the PNG file

View File

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

View File

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

View File

@ -42,9 +42,10 @@ class OSystemMACOSX : public OSystem
virtual ~OSystemMACOSX(); 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 #endif

View File

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

View File

@ -44,9 +44,10 @@ class OSystemWin32 : public OSystem
public: 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 Move window to given position. The width and height are also