From ea29b5fac24fdf32df93c96bef3da81ed1876630 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Tue, 23 Jun 2009 17:48:34 +0000 Subject: [PATCH] # Simplified local configuration changes. default.cfg shouldn't be edited by normal users; local.cfg can be used for any local tweaks. Removed old profile files, since they add clutter and aren't useful yet. This was SVN commit r6919. --- .../data/config/{system.cfg => default.cfg} | 36 +++++++++++-------- .../data/profiles/Acumen/settings/user.cfg | 3 -- .../profiles/Fire Giant/settings/user.cfg | 3 -- .../data/profiles/Player/settings/user.cfg | 3 -- binaries/data/profiles/default.cfg | 3 -- source/ps/ConfigDB.cpp | 18 +++++++--- source/ps/ConfigDB.h | 2 ++ source/ps/GameSetup/Config.cpp | 10 ++++-- 8 files changed, 46 insertions(+), 32 deletions(-) rename binaries/data/config/{system.cfg => default.cfg} (90%) delete mode 100644 binaries/data/profiles/Acumen/settings/user.cfg delete mode 100644 binaries/data/profiles/Fire Giant/settings/user.cfg delete mode 100644 binaries/data/profiles/Player/settings/user.cfg delete mode 100755 binaries/data/profiles/default.cfg diff --git a/binaries/data/config/system.cfg b/binaries/data/config/default.cfg similarity index 90% rename from binaries/data/config/system.cfg rename to binaries/data/config/default.cfg index 393847e2f2..12fc1ae515 100644 --- a/binaries/data/config/system.cfg +++ b/binaries/data/config/default.cfg @@ -1,17 +1,25 @@ -; Profile settings +; Global Configuration Settings +; +; ************************************************************** +; * DO NOT EDIT THIS FILE if you want personal customisations: * +; * create a filed called "local.cfg" instead, and copy into * +; * it the lines from this file that you want to change. * +; ************************************************************** -; profile = default +; Profile selection + +profile = default ; System settings: -nos3tc=false -noautomipmap=false -novbo=false -noframebufferobject=false +nos3tc = false +noautomipmap = false +novbo = false +noframebufferobject = false -shadows=true -vsync=false -fancywater=true +shadows = true +vsync = false +fancywater = true ; Specify the render path. This can be one of: ; default Automatically select one of the below, depending on system capabilities @@ -19,7 +27,7 @@ fancywater=true ; vertexshader Use vertex shaders for transform and lighting where possible ; Using 'fixed' instead of 'default' may work around some graphics-related problems, ; but will reduce performance when a modern graphics card is available. -renderpath=vertexshader +renderpath = vertexshader ; Adjusts how OpenGL calculates mipmap level of detail. 0.0f is the default (blurry) value. ; Lower values sharpen/extend, and higher values blur/decrease. Clamped at -3.0 to 3.0. @@ -27,15 +35,15 @@ renderpath=vertexshader lodbias = -0.5 ; Language selection: (currently "english" or "pseudogreek") -language=english +language = english ; Enable/disable windowed mode. -windowed=false +windowed = true ; You can specify these as well, but the default (keeping the current resolution) is ; probably best for most people. -xres = 1152 -yres = 864 +xres = 1024 +yres = 768 ; Font mappings: diff --git a/binaries/data/profiles/Acumen/settings/user.cfg b/binaries/data/profiles/Acumen/settings/user.cfg deleted file mode 100644 index b388d1a42f..0000000000 --- a/binaries/data/profiles/Acumen/settings/user.cfg +++ /dev/null @@ -1,3 +0,0 @@ -; Settings in a profile config are used instead of the equivalent settings in the system.cfg file, -; but note that not some settings are only allowed to be specified in system.cfg, for security reasons. - diff --git a/binaries/data/profiles/Fire Giant/settings/user.cfg b/binaries/data/profiles/Fire Giant/settings/user.cfg deleted file mode 100644 index b388d1a42f..0000000000 --- a/binaries/data/profiles/Fire Giant/settings/user.cfg +++ /dev/null @@ -1,3 +0,0 @@ -; Settings in a profile config are used instead of the equivalent settings in the system.cfg file, -; but note that not some settings are only allowed to be specified in system.cfg, for security reasons. - diff --git a/binaries/data/profiles/Player/settings/user.cfg b/binaries/data/profiles/Player/settings/user.cfg deleted file mode 100644 index b388d1a42f..0000000000 --- a/binaries/data/profiles/Player/settings/user.cfg +++ /dev/null @@ -1,3 +0,0 @@ -; Settings in a profile config are used instead of the equivalent settings in the system.cfg file, -; but note that not some settings are only allowed to be specified in system.cfg, for security reasons. - diff --git a/binaries/data/profiles/default.cfg b/binaries/data/profiles/default.cfg deleted file mode 100755 index 0cd54b7839..0000000000 --- a/binaries/data/profiles/default.cfg +++ /dev/null @@ -1,3 +0,0 @@ -; Settings in a profile config are used instead of the equivalent settings in the system.cfg file, -; but note that not some settings are only allowed to be specified in system.cfg, for security reasons. - diff --git a/source/ps/ConfigDB.cpp b/source/ps/ConfigDB.cpp index ce0a5308e5..27693bcba6 100644 --- a/source/ps/ConfigDB.cpp +++ b/source/ps/ConfigDB.cpp @@ -186,6 +186,7 @@ namespace ConfigDB_JS ConfigNamespace_JS::SetNamespace(cx, nsobj, _enum); \ debug_assert(JS_DefineProperty(cx, newObj, _propname, OBJECT_TO_JSVAL(nsobj), NULL, NULL, flags)); ) + cfg_ns("default", CFG_DEFAULT); cfg_ns("system", CFG_SYSTEM); cfg_ns("user", CFG_USER); cfg_ns("mod", CFG_MOD); @@ -224,7 +225,7 @@ CConfigValueSet *CConfigDB::GetValues(EConfigNamespace ns, const CStr& name ) if( it != m_Map[CFG_COMMAND].end() ) return &( it->second ); - for( int search_ns = ns; search_ns >= CFG_SYSTEM; search_ns-- ) + for( int search_ns = ns; search_ns >= 0; search_ns-- ) { TConfigMap::iterator it = m_Map[search_ns].find(name); if (it != m_Map[search_ns].end()) @@ -272,12 +273,21 @@ bool CConfigDB::Reload(EConfigNamespace ns) // Open file with VFS shared_ptr buffer; size_t buflen; { - LibError ret = g_VFS->LoadFile(m_ConfigFile[ns], buffer, buflen); - if(ret != INFO::OK) + // Handle missing files quietly + if (g_VFS->GetFileInfo(m_ConfigFile[ns], NULL) == ERR::VFS_FILE_NOT_FOUND) { - LOG(CLogger::Error, LOG_CATEGORY, "vfs_load for \"%s\" failed: return was %lld", m_ConfigFile[ns].c_str(), ret); + LOG(CLogger::Warning, LOG_CATEGORY, "Cannot find config file \"%s\" - ignoring", m_ConfigFile[ns].c_str()); return false; } + else + { + LibError ret = g_VFS->LoadFile(m_ConfigFile[ns], buffer, buflen); + if (ret != INFO::OK) + { + LOG(CLogger::Error, LOG_CATEGORY, "vfs_load for \"%s\" failed: return was %lld", m_ConfigFile[ns].c_str(), ret); + return false; + } + } } TConfigMap newMap; diff --git a/source/ps/ConfigDB.h b/source/ps/ConfigDB.h index 7a4d1e6a61..cf30625e4b 100644 --- a/source/ps/ConfigDB.h +++ b/source/ps/ConfigDB.h @@ -32,6 +32,7 @@ g_ConfigDB.GetValue(CFG_SYSTEM, "foo"); mod: Ditto, but linked to CFG_MOD user: Ditto, but linked to CFG_USER + default: Ditto, but linked to CFG_DEFAULT g_ConfigDB Functions: None so far @@ -59,6 +60,7 @@ enum EConfigNamespace { + CFG_DEFAULT, CFG_SYSTEM, CFG_MOD, CFG_USER, diff --git a/source/ps/GameSetup/Config.cpp b/source/ps/GameSetup/Config.cpp index 0c7f0ddb1a..3cced75684 100644 --- a/source/ps/GameSetup/Config.cpp +++ b/source/ps/GameSetup/Config.cpp @@ -196,8 +196,14 @@ void CONFIG_Init(const CmdLineArgs& args) new CConfigDB; - g_ConfigDB.SetConfigFile(CFG_SYSTEM, false, "config/system.cfg"); - g_ConfigDB.Reload(CFG_SYSTEM); // 216ms + // Load the global, default config file + g_ConfigDB.SetConfigFile(CFG_DEFAULT, false, "config/default.cfg"); + g_ConfigDB.Reload(CFG_DEFAULT); // 216ms + // Try loading the local system config file (which doesn't exist by + // default) - this is designed as a way of letting developers edit the + // system config without accidentally committing their changes back to SVN. + g_ConfigDB.SetConfigFile(CFG_SYSTEM, false, "config/local.cfg"); + g_ConfigDB.Reload(CFG_SYSTEM); g_ConfigDB.SetConfigFile(CFG_MOD, true, "config/mod.cfg"); // No point in reloading mod.cfg here - we haven't mounted mods yet