From f94ebed3405969e232905fed2b900943b7da9872 Mon Sep 17 00:00:00 2001 From: stephena Date: Wed, 14 Apr 2010 20:27:59 +0000 Subject: [PATCH] Some improvements to continuous snapshot mode: 1) the interval between snapshots can be configured within the 'File Settings' dialog 2) the commandline option is now named 'ssinterval' instead of 'ssdelay' 3) the action is tied to the 'Alt/Cmd-s' key instead of a function key There's just one more small issue to take care of in the Windows port, and the next release should be ready. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2011 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- Changes.txt | 7 +++---- docs/index.html | 8 ++++---- src/emucore/EventHandler.cxx | 8 ++++---- src/emucore/Settings.cxx | 10 +++++----- src/gui/FileSnapDialog.cxx | 25 ++++++++++++++++++++++++- src/gui/FileSnapDialog.hxx | 13 ++++++++++--- 6 files changed, 50 insertions(+), 21 deletions(-) diff --git a/Changes.txt b/Changes.txt index 1eec80e7f..0b8337fda 100644 --- a/Changes.txt +++ b/Changes.txt @@ -134,10 +134,9 @@ Critical messages are still shown, though. * Added ability to take multiple snapshots in a given interval every - x seconds. This is currently tied to the 'Shift-F12' key and is not - remappable (for now). The interval can be set with the 'ssdelay' - commandline argument, and defaults to 2. Currently, this can't be - changed from within the UI. + x seconds. This is currently tied to the 'Alt-s' key and is not + remappable (for now). The interval can be set with the 'ssinterval' + commandline argument and within the UI, and defaults to 2. * Many changes to the FrameBuffer and UI code for 'smaller' systems. Stella will now scale correctly to small screens, down to 320x240 diff --git a/docs/index.html b/docs/index.html index 0741705d3..7811b9f00 100644 --- a/docs/index.html +++ b/docs/index.html @@ -919,8 +919,8 @@ -
-ssdelay <delay>
- Set the delay in seconds between taking snapshots in continuous snapshot mode (currently, 1 - 10). +
-ssinterval <number>
+ Set the interval in seconds between taking snapshots in continuous snapshot mode (currently, 1 - 10). @@ -2225,8 +2225,8 @@ Save continuous PNG snapshots - Shift-F12 - Shift-F12 + Alt + s + Cmd + s diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 04a2bfac0..0a13f798a 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -451,14 +451,14 @@ void EventHandler::poll(uInt64 time) myOSystem->frameBuffer().toggleFrameStats(); break; - case SDLK_F12: // TODO - make this remappable + case SDLK_s: // TODO - make this remappable if(myContSnapshotInterval == 0) { ostringstream buf; - uInt32 delay = myOSystem->settings().getInt("ssdelay"); - buf << "Enabling shotshots in " << delay << " second intervals"; + uInt32 interval = myOSystem->settings().getInt("ssinterval"); + buf << "Enabling shotshots in " << interval << " second intervals"; myOSystem->frameBuffer().showMessage(buf.str()); - setContinuousSnapshots(delay); + setContinuousSnapshots(interval); } else { diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 8f66d63c6..7d09bbfb4 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -92,7 +92,7 @@ Settings::Settings(OSystem* osystem) setInternal("ssdir", ""); setInternal("sssingle", "false"); setInternal("ss1x", "false"); - setInternal("ssdelay", "2"); + setInternal("ssinterval", "2"); // Config files and paths setInternal("romdir", "~"); @@ -270,9 +270,9 @@ void Settings::validate() if(i < 1) setInternal("pspeed", "1"); else if(i > 15) setInternal("pspeed", "15"); - i = getInt("ssdelay"); - if(i < 1) setInternal("ssdelay", "2"); - else if(i > 10) setInternal("ssdelay", "10"); + i = getInt("ssinterval"); + if(i < 1) setInternal("ssinterval", "2"); + else if(i > 10) setInternal("ssinterval", "10"); s = getString("palette"); if(s != "standard" && s != "z26" && s != "user") @@ -378,7 +378,7 @@ void Settings::usage() << " -ssdir The directory to save snapshot files to\n" << " -sssingle <1|0> Generate single snapshot instead of many\n" << " -ss1x <1|0> Generate TIA snapshot in 1x mode (ignore scaling/effects)\n" - << " -ssdelay Number of seconds between snapshots in continuous snapshot mode\n" + << " -ssinterval Display detailed information for the given ROM\n" << " -listrominfo Display contents of stella.pro, one line per ROM entry\n" diff --git a/src/gui/FileSnapDialog.cxx b/src/gui/FileSnapDialog.cxx index 8c188a36d..0938262c2 100644 --- a/src/gui/FileSnapDialog.cxx +++ b/src/gui/FileSnapDialog.cxx @@ -51,7 +51,7 @@ FileSnapDialog::FileSnapDialog( // Set real dimensions _w = 52 * fontWidth + 8; - _h = 11 * (lineHeight + 4) + 10; + _h = 12 * (lineHeight + 4) + 10; xpos = vBorder; ypos = vBorder; @@ -137,6 +137,20 @@ FileSnapDialog::FileSnapDialog( "Snapshot in 1x mode"); wid.push_back(mySnap1x); + // Snapshot interval (continuous mode) + xpos = 30; ypos += b->getHeight(); + mySnapSlider = + new SliderWidget(this, font, xpos, ypos, 6*fontWidth, lineHeight, + "Snapshot interval: ", font.getStringWidth("Snapshot interval: "), + kSnapIntervalChanged); + mySnapSlider->setMinValue(1); mySnapSlider->setMaxValue(10); + wid.push_back(mySnapSlider); + mySnapLabel = + new StaticTextWidget(this, font, xpos + mySnapSlider->getWidth() + 4, + ypos + 1, 3*fontWidth, font.getFontHeight(), "", + kTextAlignLeft); + mySnapLabel->setFlags(WIDGET_CLEARBG); + // Add Defaults, OK and Cancel buttons b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, font.getStringWidth("Defaults") + 20, buttonHeight, @@ -176,6 +190,8 @@ void FileSnapDialog::loadConfig() myEEPROMPath->setEditString(settings.getString("eepromdir")); mySnapSingle->setState(!settings.getBool("sssingle")); mySnap1x->setState(settings.getBool("ss1x")); + mySnapSlider->setValue(instance().settings().getInt("ssinterval")); + mySnapLabel->setLabel(instance().settings().getString("ssinterval")); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -190,6 +206,7 @@ void FileSnapDialog::saveConfig() instance().settings().setString("eepromdir", myEEPROMPath->getEditString()); instance().settings().setBool("sssingle", !mySnapSingle->getState()); instance().settings().setBool("ss1x", mySnap1x->getState()); + instance().settings().setInt("ssinterval", mySnapSlider->getValue()); // Flush changes to disk and inform the OSystem instance().settings().saveConfig(); @@ -233,6 +250,8 @@ void FileSnapDialog::setDefaults() mySnapSingle->setState(true); mySnap1x->setState(false); + mySnapSlider->setValue(2); + mySnapLabel->setLabel("2"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -340,6 +359,10 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd, sendCommand(kReloadRomDirCmd, 0, 0); break; + case kSnapIntervalChanged: + mySnapLabel->setValue(mySnapSlider->getValue()); + break; + default: Dialog::handleCommand(sender, cmd, data, 0); break; diff --git a/src/gui/FileSnapDialog.hxx b/src/gui/FileSnapDialog.hxx index e2da6371e..ce594f691 100644 --- a/src/gui/FileSnapDialog.hxx +++ b/src/gui/FileSnapDialog.hxx @@ -30,6 +30,8 @@ class BrowserDialog; class CheckboxWidget; class PopUpWidget; class EditTextWidget; +class SliderWidget; +class StaticTextWidget; #include "Dialog.hxx" #include "Command.hxx" @@ -63,7 +65,8 @@ class FileSnapDialog : public Dialog, public CommandSender kCheatFileChosenCmd = 'LOcc', // cheatfile changed kPaletteFileChosenCmd = 'LOpc', // palette file changed kPropsFileChosenCmd = 'LOrc', // properties file changed - kEEPROMDirChosenCmd = 'LOec' // eeprom dir changed + kEEPROMDirChosenCmd = 'LOec', // eeprom dir changed + kSnapIntervalChanged = 'LOsi' // continuous snapshot interval }; BrowserDialog* myBrowser; @@ -76,8 +79,12 @@ class FileSnapDialog : public Dialog, public CommandSender EditTextWidget* myPaletteFile; EditTextWidget* myPropsFile; EditTextWidget* mySnapPath; - CheckboxWidget* mySnapSingle; - CheckboxWidget* mySnap1x; + + // Other snapshot settings + CheckboxWidget* mySnapSingle; + CheckboxWidget* mySnap1x; + SliderWidget* mySnapSlider; + StaticTextWidget* mySnapLabel; // Indicates if this dialog is used for global (vs. in-game) settings bool myIsGlobal;