diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index ace7a96ec..fdf31b3a4 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.101 2006-12-15 16:42:58 stephena Exp $ +// $Id: Settings.cxx,v 1.102 2006-12-15 17:52:03 stephena Exp $ //============================================================================ #include @@ -25,14 +25,6 @@ #include "bspf.hxx" #include "Settings.hxx" -// Specifies the minimum version of the settings file that's valid -// for this version of Stella. If the settings file is too old, -// the internal defaults are used. -// For each new release, this should only be bumped if there have been -// major changes in some settings; changes which could stop Stella from -// actually working. -#define MIN_SETTINGS_VERSION "2.3_alpha" - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Settings::Settings(OSystem* osystem) : myOSystem(osystem) diff --git a/stella/src/emucore/Settings.hxx b/stella/src/emucore/Settings.hxx index d05416217..10df3d141 100644 --- a/stella/src/emucore/Settings.hxx +++ b/stella/src/emucore/Settings.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: Settings.hxx,v 1.28 2006-12-08 16:49:28 stephena Exp $ +// $Id: Settings.hxx,v 1.29 2006-12-15 17:52:03 stephena Exp $ //============================================================================ #ifndef SETTINGS_HXX @@ -24,12 +24,19 @@ class OSystem; #include "Array.hxx" #include "bspf.hxx" +// Specifies the minimum version of the settings file that's valid +// for this version of Stella. If the settings file is too old, +// the internal defaults are used. +// For each new release, this should only be bumped if there have been +// major changes in some settings; changes which could stop Stella from +// actually working. +#define MIN_SETTINGS_VERSION "2.3_alpha" /** This class provides an interface for accessing frontend specific settings. @author Stephen Anthony - @version $Id: Settings.hxx,v 1.28 2006-12-08 16:49:28 stephena Exp $ + @version $Id: Settings.hxx,v 1.29 2006-12-15 17:52:03 stephena Exp $ */ class Settings { diff --git a/stella/src/macosx/SettingsMACOSX.cxx b/stella/src/macosx/SettingsMACOSX.cxx index 99ee622f5..512f1aae5 100644 --- a/stella/src/macosx/SettingsMACOSX.cxx +++ b/stella/src/macosx/SettingsMACOSX.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: SettingsMACOSX.cxx,v 1.13 2006-12-08 16:49:37 stephena Exp $ +// $Id: SettingsMACOSX.cxx,v 1.14 2006-12-15 17:52:03 stephena Exp $ //============================================================================ #include @@ -27,6 +27,7 @@ #include "bspf.hxx" #include "Console.hxx" #include "EventHandler.hxx" +#include "Version.hxx" #include "Settings.hxx" #include "SettingsMACOSX.hxx" @@ -56,7 +57,12 @@ void SettingsMACOSX::loadConfig() string key, value; char cvalue[2048]; - // Write out each of the key and value pairs + // Check if the settings plist file is valid + prefsGetString("plist_version", cvalue); + if(cvalue[0] == 0 || string(cvalue) < string(MIN_SETTINGS_VERSION)) + return; + + // Read key/value pairs from the plist file const SettingsArray& settings = getInternalSettings(); for(unsigned int i = 0; i < settings.size(); ++i) { @@ -69,6 +75,9 @@ void SettingsMACOSX::loadConfig() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void SettingsMACOSX::saveConfig() { + // Write out plist version + prefsSetString("plist_version", STELLA_VERSION); + // Write out each of the key and value pairs const SettingsArray& settings = getInternalSettings(); for(unsigned int i = 0; i < settings.size(); ++i)