diff --git a/stella/src/common/mainSDL.cxx b/stella/src/common/mainSDL.cxx index 0fe5d2a7b..f8d77c66b 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.63 2006-03-17 19:44:16 stephena Exp $ +// $Id: mainSDL.cxx,v 1.64 2006-03-19 00:46:02 stephena Exp $ //============================================================================ #include @@ -168,7 +168,7 @@ int main(int argc, char* argv[]) EventHandler handler(theOSystem); // Create a properties set for us to use and set it up - PropertiesSet propertiesSet; + PropertiesSet propertiesSet(theOSystem); SetupProperties(propertiesSet); theOSystem->attach(&propertiesSet); diff --git a/stella/src/emucore/Props.hxx b/stella/src/emucore/Props.hxx index 0ffc5d98c..3a955f783 100644 --- a/stella/src/emucore/Props.hxx +++ b/stella/src/emucore/Props.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: Props.hxx,v 1.7 2006-03-05 01:18:42 stephena Exp $ +// $Id: Props.hxx,v 1.8 2006-03-19 00:46:04 stephena Exp $ //============================================================================ #ifndef PROPERTIES_HXX @@ -55,10 +55,12 @@ enum PropertyType { if the property key is not found in the original property list. @author Bradford W. Mott - @version $Id: Props.hxx,v 1.7 2006-03-05 01:18:42 stephena Exp $ + @version $Id: Props.hxx,v 1.8 2006-03-19 00:46:04 stephena Exp $ */ class Properties { + friend class PropertiesSet; + public: /** Creates an empty properties object with the specified defaults. The diff --git a/stella/src/emucore/PropsSet.cxx b/stella/src/emucore/PropsSet.cxx index cf4295a4f..13d8cb1e9 100644 --- a/stella/src/emucore/PropsSet.cxx +++ b/stella/src/emucore/PropsSet.cxx @@ -13,19 +13,19 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: PropsSet.cxx,v 1.20 2006-03-05 01:18:42 stephena Exp $ +// $Id: PropsSet.cxx,v 1.21 2006-03-19 00:46:04 stephena Exp $ //============================================================================ -#include - +#include "OSystem.hxx" #include "GuiUtils.hxx" #include "DefProps.hxx" #include "Props.hxx" #include "PropsSet.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -PropertiesSet::PropertiesSet() - : myRoot(NULL), +PropertiesSet::PropertiesSet(OSystem* osystem) + : myOSystem(osystem), + myRoot(NULL), mySize(0) { } @@ -80,7 +80,7 @@ void PropertiesSet::getMD5(const string& md5, Properties &properties) if(cmp == 0) { for(int p = 0; p < LastPropType; ++p) - if(DefProps[i][p] != "") + if(DefProps[i][p][0] != 0) properties.set((PropertyType)p, DefProps[i][p]); found = true; @@ -92,6 +92,15 @@ void PropertiesSet::getMD5(const string& md5, Properties &properties) i = 2*i + 2; // right child } } + + // Reset TIA positioning to defaults if option is enabled + if(myOSystem->settings().getBool("tiadefaults")) + { + properties.set(Display_XStart, Properties::ourDefaultProperties[Display_XStart]); + properties.set(Display_Width, Properties::ourDefaultProperties[Display_Width]); + properties.set(Display_YStart, Properties::ourDefaultProperties[Display_YStart]); + properties.set(Display_Height, Properties::ourDefaultProperties[Display_Height]); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -178,7 +187,7 @@ void PropertiesSet::save(ostream& out) void PropertiesSet::print() { cout << size() << endl; - printNode(myRoot); + printNode(myRoot); // FIXME - print out internal properties as well } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/PropsSet.hxx b/stella/src/emucore/PropsSet.hxx index 589a7cff9..89f2fc5af 100644 --- a/stella/src/emucore/PropsSet.hxx +++ b/stella/src/emucore/PropsSet.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: PropsSet.hxx,v 1.13 2006-03-06 21:38:09 stephena Exp $ +// $Id: PropsSet.hxx,v 1.14 2006-03-19 00:46:04 stephena Exp $ //============================================================================ #ifndef PROPERTIES_SET_HXX @@ -23,6 +23,7 @@ #include "bspf.hxx" +class OSystem; class Properties; /** @@ -42,7 +43,7 @@ class PropertiesSet Create an empty properties set object using the md5 as the key to the BST. */ - PropertiesSet(); + PropertiesSet(OSystem* osystem); /** Destructor @@ -150,6 +151,9 @@ class PropertiesSet void printNode(TreeNode *node); private: + // The parent system for this object + OSystem* myOSystem; + // The root of the BST TreeNode* myRoot; diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 378f13df8..2570907e9 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.81 2006-03-17 19:44:18 stephena Exp $ +// $Id: Settings.cxx,v 1.82 2006-03-19 00:46:04 stephena Exp $ //============================================================================ #include @@ -79,6 +79,8 @@ Settings::Settings(OSystem* osystem) setInternal("rombrowse", "false"); setInternal("lastrom", ""); setInternal("modtime", ""); // romdir last modification time + + setInternal("tiadefaults", "false"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -188,7 +190,7 @@ bool Settings::loadCommandLine(int argc, char** argv) // Settings read from the commandline must not be saved to // the rc-file, unless they were previously set if(int idx = getInternalPos(key) != -1) - setInternal(key, value, idx, true); + setInternal(key, value, idx); // don't set initialValue here else setExternal(key, value); } @@ -312,6 +314,7 @@ void Settings::usage() << " -p2speed Speed of emulated mouse movement for paddle 2 (0-100)\n" << " -p3speed Speed of emulated mouse movement for paddle 3 (0-100)\n" << " -p4speed Speed of emulated mouse movement for paddle 4 (0-100)\n" + << " -tiadefaults <1|0> Use TIA positioning defaults instead of enhanced values\n" #ifdef UNIX << " -accurate <1|0> Accurate game timing (uses more CPU)\n" #endif @@ -359,7 +362,6 @@ void Settings::usage() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Settings::saveConfig() { - // Do a quick scan of the internal settings to see if any have // changed. If not, we don't need to save them at all. bool settingsChanged = false; @@ -485,22 +487,20 @@ bool Settings::getBool(const string& key) const int idx = -1; if((idx = getInternalPos(key)) != -1) { - if(myInternalSettings[idx].value == "1" || - myInternalSettings[idx].value == "true") + const string& value = myInternalSettings[idx].value; + if(value == "1" || value == "true") return true; - else if(myInternalSettings[idx].value == "0" || - myInternalSettings[idx].value == "false") + else if(value == "0" || value == "false") return false; else return false; } else if((idx = getExternalPos(key)) != -1) { - if(myInternalSettings[idx].value == "1" || - myInternalSettings[idx].value == "true") + const string& value = myExternalSettings[idx].value; + if(value == "1" || value == "true") return true; - else if(myInternalSettings[idx].value == "0" || - myInternalSettings[idx].value == "false") + else if(value == "0" || value == "false") return false; else return false; @@ -572,7 +572,8 @@ int Settings::setInternal(const string& key, const string& value, if(useAsInitial) myInternalSettings[idx].initialValue = value; /*cerr << "modify internal: key = " << key - << ", value = " << value + << ", value = " << value + << ", ivalue = " << myInternalSettings[idx].initialValue << " @ index = " << idx << endl;*/ } @@ -587,7 +588,8 @@ int Settings::setInternal(const string& key, const string& value, idx = myInternalSettings.size() - 1; /*cerr << "insert internal: key = " << key - << ", value = " << value + << ", value = " << value + << ", ivalue = " << setting.initialValue << " @ index = " << idx << endl;*/ }