diff --git a/stella/src/common/mainSDL.cxx b/stella/src/common/mainSDL.cxx index addb16937..0eb4ba636 100644 --- a/stella/src/common/mainSDL.cxx +++ b/stella/src/common/mainSDL.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: mainSDL.cxx,v 1.10 2004-07-05 00:53:48 stephena Exp $ +// $Id: mainSDL.cxx,v 1.11 2004-07-07 22:46:01 stephena Exp $ //============================================================================ #include @@ -430,7 +430,6 @@ void handleEvents() theDisplay->showCursor(!theHideCursorIndicator); } } -#ifdef DEVELOPER_SUPPORT else if(key == SDLK_f) // Ctrl-f toggles NTSC/PAL mode { theConsole->toggleFormat(); @@ -441,6 +440,7 @@ void handleEvents() theConsole->togglePalette(); theDisplay->setupPalette(); } +#ifdef DEVELOPER_SUPPORT else if(key == SDLK_END) // Ctrl-End increases Width { theConsole->changeWidth(1); @@ -461,6 +461,7 @@ void handleEvents() theConsole->changeHeight(0); theDisplay->resize(0); } +#endif else if(key == SDLK_s) // Ctrl-s saves properties to a file { if(theConsole->settings().getBool("mergeprops")) // Attempt to merge with propertiesSet @@ -475,7 +476,6 @@ void handleEvents() theConsole->saveProperties(newPropertiesFile); } } -#endif } else // check all the other keys { @@ -715,20 +715,11 @@ void setupProperties(PropertiesSet& set) string theUserProFile = theSettings->userPropertiesFilename(); string theSystemProFile = theSettings->systemPropertiesFilename(); - // When 'listroms' is specified, we need to have the full list in memory - if(theSettings->getBool("listrominfo")) + // When 'listrominfo' or 'mergeprops' is specified, we need to have the + // full list in memory + if(theSettings->getBool("listrominfo") || theSettings->getBool("mergeprops")) useMemList = true; -#ifdef DEVELOPER_SUPPORT - // If the user wishes to merge any property modifications to the - // PropertiesSet file, then the PropertiesSet file MUST be loaded - // into memory. - - // If 'useMemList' is true, do not override it - if(!useMemList) - useMemList = theSettings->getBool("mergeprops"); -#endif - if(theAlternateProFile != "") set.load(theAlternateProFile, &Console::defaultProperties(), useMemList); else if(theUserProFile != "") diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index 1c94caef0..90d555cc2 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.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: Console.cxx,v 1.32 2004-06-25 03:50:47 bwmott Exp $ +// $Id: Console.cxx,v 1.33 2004-07-07 22:46:01 stephena Exp $ //============================================================================ #include @@ -77,11 +77,6 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename, // Search for the properties based on MD5 myPropSet.getMD5(md5, myProperties); -#ifdef DEVELOPER_SUPPORT - // Merge any user-defined properties - myProperties.merge(mySettings.userDefinedProperties); -#endif - // Make sure the MD5 value of the cartridge is set in the properties if(myProperties.get("Cartridge.MD5") == "") { @@ -276,7 +271,6 @@ const Properties& Console::defaultProperties() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Properties Console::ourDefaultProperties; -#ifdef DEVELOPER_SUPPORT // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::toggleFormat() { @@ -321,6 +315,35 @@ void Console::togglePalette() } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Console::saveProperties(string filename, bool merge) +{ + // Merge the current properties into the PropertiesSet file + if(merge) + { + if(myPropSet.merge(myProperties, filename)) + myFrameBuffer.showMessage("Properties merged"); + else + myFrameBuffer.showMessage("Properties not merged"); + } + else // Save to the specified file directly + { + ofstream out(filename.c_str(), ios::out); + + if(out && out.is_open()) + { + myProperties.save(out); + out.close(); + myFrameBuffer.showMessage("Properties saved"); + } + else + { + myFrameBuffer.showMessage("Properties not saved"); + } + } +} + +#ifdef DEVELOPER_SUPPORT // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::changeXStart(const uInt32 direction) { @@ -472,32 +495,4 @@ void Console::changeHeight(const uInt32 direction) message += strval.str(); myFrameBuffer.showMessage(message); } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Console::saveProperties(string filename, bool merge) -{ - // Merge the current properties into the PropertiesSet file - if(merge) - { - if(myPropSet.merge(myProperties, filename)) - myFrameBuffer.showMessage("Properties merged"); - else - myFrameBuffer.showMessage("Properties not merged"); - } - else // Save to the specified file directly - { - ofstream out(filename.c_str(), ios::out); - - if(out && out.is_open()) - { - myProperties.save(out); - out.close(); - myFrameBuffer.showMessage("Properties saved"); - } - else - { - myFrameBuffer.showMessage("Properties not saved"); - } - } -} #endif diff --git a/stella/src/emucore/Console.hxx b/stella/src/emucore/Console.hxx index d22ba7693..72e4fa7ed 100644 --- a/stella/src/emucore/Console.hxx +++ b/stella/src/emucore/Console.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: Console.hxx,v 1.20 2004-06-20 23:30:48 stephena Exp $ +// $Id: Console.hxx,v 1.21 2004-07-07 22:46:01 stephena Exp $ //============================================================================ #ifndef CONSOLE_HXX @@ -40,7 +40,7 @@ class FrameBuffer; This class represents the entire game console. @author Bradford W. Mott - @version $Id: Console.hxx,v 1.20 2004-06-20 23:30:48 stephena Exp $ + @version $Id: Console.hxx,v 1.21 2004-07-07 22:46:01 stephena Exp $ */ class Console { @@ -170,8 +170,6 @@ class Console */ static const Properties& defaultProperties(); -#ifdef DEVELOPER_SUPPORT - public: /** Toggle between NTSC and PAL mode. The frontends will need to reload their palette. @@ -184,6 +182,17 @@ class Console */ void togglePalette(); + /** + Save a copy of the current properties after any changes. + + @param filename Filename to save the properties into. + @param merge Whether or not to merge the changes into the + main properties file. + */ + void saveProperties(string filename, bool merge = false); + +#ifdef DEVELOPER_SUPPORT + public: /** Change the "Display.XStart" variable. Currently, a system reset is issued after the change. GUI's may need to resize their viewports. @@ -215,15 +224,6 @@ class Console @param direction A 1 indicates increase, 0 indicates decrease. */ void changeHeight(const uInt32 direction); - - /** - Save a copy of the current properties after any changes. - - @param filename Filename to save the properties into. - @param merge Whether or not to merge the changes into the - main properties file. - */ - void saveProperties(string filename, bool merge = false); #endif private: diff --git a/stella/src/emucore/Props.cxx b/stella/src/emucore/Props.cxx index 710b9820e..0b60b2190 100644 --- a/stella/src/emucore/Props.cxx +++ b/stella/src/emucore/Props.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: Props.cxx,v 1.5 2004-07-05 00:53:48 stephena Exp $ +// $Id: Props.cxx,v 1.6 2004-07-07 22:46:01 stephena Exp $ //============================================================================ #include "Props.hxx" @@ -282,11 +282,10 @@ void Properties::merge(const Properties& properties) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Properties::print() { - cout << "|" - << get("Cartridge.MD5") << "|" + cout << get("Cartridge.MD5") << "|" << get("Cartridge.Name") << "|" << get("Cartridge.Rarity") << "|" << get("Cartridge.Manufactuer") << "|" - << get("Cartridge.Note") << "|" + << get("Cartridge.Note") << endl; } diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index dda90de93..e0d39c5e8 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.23 2004-07-05 00:53:48 stephena Exp $ +// $Id: Settings.cxx,v 1.24 2004-07-07 22:46:01 stephena Exp $ //============================================================================ #include @@ -23,11 +23,6 @@ #include "bspf.hxx" #include "Settings.hxx" -#ifdef DEVELOPER_SUPPORT - #include "Props.hxx" -#endif - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Settings::Settings() { @@ -58,19 +53,11 @@ Settings::Settings() set("mergeprops", "false"); set("paddle", "0"); set("palette", "standard"); - #ifdef SNAPSHOT_SUPPORT set("ssdir", "."); set("ssname", "romname"); set("sssingle", "false"); #endif -#ifdef DEVELOPER_SUPPORT - userDefinedProperties.set("Display.Format", "-1"); - userDefinedProperties.set("Display.XStart", "-1"); - userDefinedProperties.set("Display.Width", "-1"); - userDefinedProperties.set("Display.YStart", "-1"); - userDefinedProperties.set("Display.Height", "-1"); -#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -155,8 +142,8 @@ bool Settings::loadCommandLine(Int32 argc, char** argv) } else if(key == "listrominfo") { - set(key, "true", false); - return true; + set(key, "true", false); // this confusing line means set 'listrominfo' + return true; // to true, but don't save to the settings file } if(++i >= argc) @@ -192,37 +179,28 @@ void Settings::usage() << " nearest Normal scaling (GL_NEAREST)\n" << " linear Blurred scaling (GL_LINEAR)\n" << " -gl_aspect Scale the width by the given amount\n" - << " -gl_fsmax <0|1> Use the largest available screenmode in fullscreen OpenGL\n" + << " -gl_fsmax <1|0> Use the largest available screenmode in fullscreen OpenGL\n" << endl #endif - << " -sound <0|1> Enable sound generation\n" + << " -sound <1|0> Enable sound generation\n" << " -fragsize The size of sound fragments (must be a power of two)\n" << " -framerate Display the given number of frames per second\n" << " -zoom Makes window be 'size' times normal\n" - << " -fullscreen <0|1> Play the game in fullscreen mode\n" - << " -grabmouse <0|1> Keeps the mouse in the game window\n" - << " -hidecursor <0|1> Hides the mouse cursor in the game window\n" + << " -fullscreen <1|0> Play the game in fullscreen mode\n" + << " -grabmouse <1|0> Keeps the mouse in the game window\n" + << " -hidecursor <1|0> Hides the mouse cursor in the game window\n" << " -volume Set the volume (0 - 100)\n" << " -paddle <0|1|2|3> Indicates which paddle the mouse should emulate\n" << " -altpro Use the given properties file instead of stella.pro\n" - << " -showinfo <0|1> Shows some game info\n" - << " -accurate <0|1> Accurate game timing (uses more CPU)\n" + << " -showinfo <1|0> Shows some game info\n" + << " -accurate <1|0> Accurate game timing (uses more CPU)\n" #ifdef SNAPSHOT_SUPPORT << " -ssdir The directory to save snapshot files to\n" << " -ssname How to name the snapshot (romname or md5sum)\n" - << " -sssingle <0|1> Generate single snapshot instead of many\n" + << " -sssingle <1|0> Generate single snapshot instead of many\n" #endif - << endl - #ifdef DEVELOPER_SUPPORT - << " DEVELOPER options (see Stella manual for details)\n" - << " -Dformat Sets \"Display.Format\"\n" - << " -Dxstart Sets \"Display.XStart\"\n" - << " -Dwidth Sets \"Display.Width\"\n" - << " -Dystart Sets \"Display.YStart\"\n" - << " -Dheight Sets \"Display.Height\"\n" - << " -mergeprops <0|1> Merge changed properties into properties file,\n" + << " -mergeprops <1|0> Merge changed properties into properties file,\n" << " or save into a separate file\n" - #endif << endl; #endif } diff --git a/stella/src/emucore/Settings.hxx b/stella/src/emucore/Settings.hxx index 332bb9915..0f1601312 100644 --- a/stella/src/emucore/Settings.hxx +++ b/stella/src/emucore/Settings.hxx @@ -13,16 +13,12 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Settings.hxx,v 1.14 2004-07-05 00:53:48 stephena Exp $ +// $Id: Settings.hxx,v 1.15 2004-07-07 22:46:01 stephena Exp $ //============================================================================ #ifndef SETTINGS_HXX #define SETTINGS_HXX -#ifdef DEVELOPER_SUPPORT - #include "Props.hxx" -#endif - #include "bspf.hxx" @@ -30,7 +26,7 @@ This class provides an interface for accessing frontend specific settings. @author Stephen Anthony - @version $Id: Settings.hxx,v 1.14 2004-07-05 00:53:48 stephena Exp $ + @version $Id: Settings.hxx,v 1.15 2004-07-07 22:46:01 stephena Exp $ */ class Settings { @@ -204,12 +200,6 @@ class Settings */ string baseDir() { return myBaseDir; } - public: -#ifdef DEVELOPER_SUPPORT - // User-modified properties - Properties userDefinedProperties; -#endif - protected: void set(const string& key, const string& value, bool save = true);