mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 00:36:46 +00:00
Added a list of setting overrides
This commit is contained in:
parent
e610247392
commit
2923174f9a
5 changed files with 151 additions and 3 deletions
|
@ -371,6 +371,9 @@ endif (APPLE)
|
||||||
configure_resource_file(${OpenMW_SOURCE_DIR}/files/settings-default.cfg
|
configure_resource_file(${OpenMW_SOURCE_DIR}/files/settings-default.cfg
|
||||||
"${OpenMW_BINARY_DIR}" "settings-default.cfg")
|
"${OpenMW_BINARY_DIR}" "settings-default.cfg")
|
||||||
|
|
||||||
|
configure_resource_file(${OpenMW_SOURCE_DIR}/files/settings-overrides-vr.cfg
|
||||||
|
"${OpenMW_BINARY_DIR}" "settings-overrides-vr.cfg")
|
||||||
|
|
||||||
configure_resource_file(${OpenMW_SOURCE_DIR}/files/openmw.appdata.xml
|
configure_resource_file(${OpenMW_SOURCE_DIR}/files/openmw.appdata.xml
|
||||||
"${OpenMW_BINARY_DIR}" "openmw.appdata.xml")
|
"${OpenMW_BINARY_DIR}" "openmw.appdata.xml")
|
||||||
|
|
||||||
|
|
|
@ -509,6 +509,18 @@ std::string OMW::Engine::loadSettings (Settings::Manager & settings)
|
||||||
if (boost::filesystem::exists(settingspath))
|
if (boost::filesystem::exists(settingspath))
|
||||||
settings.loadUser(settingspath);
|
settings.loadUser(settingspath);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_OPENXR
|
||||||
|
const std::string localoverrides = (mCfgMgr.getLocalPath() / "settings-overrides-vr.cfg").string();
|
||||||
|
const std::string globaloverrides = (mCfgMgr.getGlobalPath() / "settings-overrides-vr.cfg").string();
|
||||||
|
if (boost::filesystem::exists(localoverrides))
|
||||||
|
settings.loadOverrides(localoverrides);
|
||||||
|
else if (boost::filesystem::exists(globaloverrides))
|
||||||
|
settings.loadOverrides(globaloverrides);
|
||||||
|
else
|
||||||
|
throw std::runtime_error("No settings overrides file found! Make sure the file \"settings-overrides-vr.cfg\" was properly installed.");
|
||||||
|
#endif
|
||||||
|
|
||||||
return settingspath;
|
return settingspath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace Settings
|
||||||
|
|
||||||
CategorySettingValueMap Manager::mDefaultSettings = CategorySettingValueMap();
|
CategorySettingValueMap Manager::mDefaultSettings = CategorySettingValueMap();
|
||||||
CategorySettingValueMap Manager::mUserSettings = CategorySettingValueMap();
|
CategorySettingValueMap Manager::mUserSettings = CategorySettingValueMap();
|
||||||
|
CategorySettingValueMap Manager::mSettingsOverrides = CategorySettingValueMap();
|
||||||
CategorySettingVector Manager::mChangedSettings = CategorySettingVector();
|
CategorySettingVector Manager::mChangedSettings = CategorySettingVector();
|
||||||
|
|
||||||
void Manager::clear()
|
void Manager::clear()
|
||||||
|
@ -17,6 +18,7 @@ void Manager::clear()
|
||||||
mDefaultSettings.clear();
|
mDefaultSettings.clear();
|
||||||
mUserSettings.clear();
|
mUserSettings.clear();
|
||||||
mChangedSettings.clear();
|
mChangedSettings.clear();
|
||||||
|
mSettingsOverrides.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::loadDefault(const std::string &file)
|
void Manager::loadDefault(const std::string &file)
|
||||||
|
@ -25,12 +27,18 @@ void Manager::loadDefault(const std::string &file)
|
||||||
parser.loadSettingsFile(file, mDefaultSettings);
|
parser.loadSettingsFile(file, mDefaultSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::loadUser(const std::string &file)
|
void Manager::loadUser(const std::string& file)
|
||||||
{
|
{
|
||||||
SettingsFileParser parser;
|
SettingsFileParser parser;
|
||||||
parser.loadSettingsFile(file, mUserSettings);
|
parser.loadSettingsFile(file, mUserSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Manager::loadOverrides(const std::string& file)
|
||||||
|
{
|
||||||
|
SettingsFileParser parser;
|
||||||
|
parser.loadSettingsFile(file, mSettingsOverrides);
|
||||||
|
}
|
||||||
|
|
||||||
void Manager::saveUser(const std::string &file)
|
void Manager::saveUser(const std::string &file)
|
||||||
{
|
{
|
||||||
SettingsFileParser parser;
|
SettingsFileParser parser;
|
||||||
|
@ -40,7 +48,11 @@ void Manager::saveUser(const std::string &file)
|
||||||
std::string Manager::getString(const std::string &setting, const std::string &category)
|
std::string Manager::getString(const std::string &setting, const std::string &category)
|
||||||
{
|
{
|
||||||
CategorySettingValueMap::key_type key = std::make_pair(category, setting);
|
CategorySettingValueMap::key_type key = std::make_pair(category, setting);
|
||||||
CategorySettingValueMap::iterator it = mUserSettings.find(key);
|
CategorySettingValueMap::iterator it = mSettingsOverrides.find(key);
|
||||||
|
if (it != mSettingsOverrides.end())
|
||||||
|
return it->second;
|
||||||
|
|
||||||
|
it = mUserSettings.find(key);
|
||||||
if (it != mUserSettings.end())
|
if (it != mUserSettings.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
|
@ -101,8 +113,11 @@ osg::Vec3f Manager::getVector3 (const std::string& setting, const std::string& c
|
||||||
void Manager::setString(const std::string &setting, const std::string &category, const std::string &value)
|
void Manager::setString(const std::string &setting, const std::string &category, const std::string &value)
|
||||||
{
|
{
|
||||||
CategorySettingValueMap::key_type key = std::make_pair(category, setting);
|
CategorySettingValueMap::key_type key = std::make_pair(category, setting);
|
||||||
|
CategorySettingValueMap::iterator found = mSettingsOverrides.find(key);
|
||||||
|
if (found != mSettingsOverrides.end())
|
||||||
|
return;
|
||||||
|
|
||||||
CategorySettingValueMap::iterator found = mUserSettings.find(key);
|
found = mUserSettings.find(key);
|
||||||
if (found != mUserSettings.end())
|
if (found != mUserSettings.end())
|
||||||
{
|
{
|
||||||
if (found->second == value)
|
if (found->second == value)
|
||||||
|
@ -163,4 +178,53 @@ void Manager::resetPendingChanges()
|
||||||
mChangedSettings.clear();
|
mChangedSettings.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Manager::overrideString(const std::string& setting, const std::string& category, const std::string& value)
|
||||||
|
{
|
||||||
|
CategorySettingValueMap::key_type key = std::make_pair(category, setting);
|
||||||
|
|
||||||
|
CategorySettingValueMap::iterator found = mUserSettings.find(key);
|
||||||
|
if (found != mUserSettings.end())
|
||||||
|
{
|
||||||
|
if (found->second == value)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mSettingsOverrides[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Manager::overrideInt(const std::string& setting, const std::string& category, const int value)
|
||||||
|
{
|
||||||
|
std::ostringstream stream;
|
||||||
|
stream << value;
|
||||||
|
overrideString(setting, category, stream.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Manager::overrideFloat(const std::string& setting, const std::string& category, const float value)
|
||||||
|
{
|
||||||
|
std::ostringstream stream;
|
||||||
|
stream << value;
|
||||||
|
overrideString(setting, category, stream.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Manager::overrideBool(const std::string& setting, const std::string& category, const bool value)
|
||||||
|
{
|
||||||
|
overrideString(setting, category, value ? "true" : "false");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Manager::overrideVector2(const std::string& setting, const std::string& category, const osg::Vec2f value)
|
||||||
|
{
|
||||||
|
std::ostringstream stream;
|
||||||
|
stream << value.x() << " " << value.y();
|
||||||
|
overrideString(setting, category, stream.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Manager::overrideVector3(const std::string& setting, const std::string& category, const osg::Vec3f value)
|
||||||
|
{
|
||||||
|
std::ostringstream stream;
|
||||||
|
stream << value.x() << ' ' << value.y() << ' ' << value.z();
|
||||||
|
overrideString(setting, category, stream.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace Settings
|
||||||
public:
|
public:
|
||||||
static CategorySettingValueMap mDefaultSettings;
|
static CategorySettingValueMap mDefaultSettings;
|
||||||
static CategorySettingValueMap mUserSettings;
|
static CategorySettingValueMap mUserSettings;
|
||||||
|
static CategorySettingValueMap mSettingsOverrides;
|
||||||
|
|
||||||
static CategorySettingVector mChangedSettings;
|
static CategorySettingVector mChangedSettings;
|
||||||
///< tracks all the settings that were changed since the last apply() call
|
///< tracks all the settings that were changed since the last apply() call
|
||||||
|
@ -32,6 +33,9 @@ namespace Settings
|
||||||
void loadUser (const std::string& file);
|
void loadUser (const std::string& file);
|
||||||
///< load file as user settings
|
///< load file as user settings
|
||||||
|
|
||||||
|
void loadOverrides (const std::string& file);
|
||||||
|
///< load file as settings overrides
|
||||||
|
|
||||||
void saveUser (const std::string& file);
|
void saveUser (const std::string& file);
|
||||||
///< save user settings to file
|
///< save user settings to file
|
||||||
|
|
||||||
|
@ -55,6 +59,13 @@ namespace Settings
|
||||||
static void setBool (const std::string& setting, const std::string& category, const bool value);
|
static void setBool (const std::string& setting, const std::string& category, const bool value);
|
||||||
static void setVector2 (const std::string& setting, const std::string& category, const osg::Vec2f value);
|
static void setVector2 (const std::string& setting, const std::string& category, const osg::Vec2f value);
|
||||||
static void setVector3 (const std::string& setting, const std::string& category, const osg::Vec3f value);
|
static void setVector3 (const std::string& setting, const std::string& category, const osg::Vec3f value);
|
||||||
|
|
||||||
|
static void overrideInt(const std::string& setting, const std::string& category, const int value);
|
||||||
|
static void overrideFloat(const std::string& setting, const std::string& category, const float value);
|
||||||
|
static void overrideString(const std::string& setting, const std::string& category, const std::string& value);
|
||||||
|
static void overrideBool(const std::string& setting, const std::string& category, const bool value);
|
||||||
|
static void overrideVector2(const std::string& setting, const std::string& category, const osg::Vec2f value);
|
||||||
|
static void overrideVector3(const std::string& setting, const std::string& category, const osg::Vec3f value);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
58
files/settings-overrides-vr.cfg
Normal file
58
files/settings-overrides-vr.cfg
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
# WARNING: This is a special config file that should not be edited by the user.
|
||||||
|
# Any settings listed in this file will be absolute and not modifiable by user settings.
|
||||||
|
# This is to prevent the use of settings that are incompatible with VR.
|
||||||
|
# Ignoring this and removing/editing lines in this file will either have no effect or break your game.
|
||||||
|
|
||||||
|
[Camera]
|
||||||
|
# Automatically enable preview mode when player doesn't move.
|
||||||
|
preview if stand still = false
|
||||||
|
|
||||||
|
# Enables head bobbing in first person mode
|
||||||
|
head bobbing = false
|
||||||
|
|
||||||
|
[GUI]
|
||||||
|
# Scales GUI window and widget size. (<1.0 is smaller, >1.0 is larger).
|
||||||
|
scaling factor = 1.0
|
||||||
|
|
||||||
|
# Size of in-game fonts
|
||||||
|
font size = 16
|
||||||
|
|
||||||
|
# Stretch menus, load screens, etc. to the window aspect ratio.
|
||||||
|
stretch menu background = false
|
||||||
|
|
||||||
|
# Red flash visually showing player damage.
|
||||||
|
hit fader = false
|
||||||
|
|
||||||
|
# Werewolf overlay border around screen or window.
|
||||||
|
werewolf overlay = false
|
||||||
|
|
||||||
|
# Controls whether Arrow keys, Movement keys, Tab/Shift-Tab and Spacebar/Enter/Activate may be used to navigate GUI buttons.
|
||||||
|
keyboard navigation = true
|
||||||
|
|
||||||
|
[HUD]
|
||||||
|
|
||||||
|
# Displays the crosshair or reticle when not in GUI mode.
|
||||||
|
crosshair = false
|
||||||
|
|
||||||
|
[Game]
|
||||||
|
# Always use the best mode of attack: e.g. chop, slash or thrust.
|
||||||
|
best attack = false
|
||||||
|
|
||||||
|
[Video]
|
||||||
|
# OpenMW takes complete control of the screen.
|
||||||
|
fullscreen = false
|
||||||
|
|
||||||
|
# Enable vertical syncing to reduce tearing defects.
|
||||||
|
vsync = false
|
||||||
|
|
||||||
|
# Maximum frames per second. 0.0 is unlimited, or >0.0 to limit.
|
||||||
|
framerate limit = 0
|
||||||
|
|
||||||
|
# Type of screenshot to take (regular, cylindrical, spherical or planet), optionally followed by
|
||||||
|
# screenshot width, height and cubemap resolution in pixels. (e.g. spherical 1600 1000 1200)
|
||||||
|
screenshot type = regular
|
||||||
|
|
||||||
|
[Stereo]
|
||||||
|
|
||||||
|
# Enable/disable stereo view.
|
||||||
|
stereo enabled = true
|
Loading…
Reference in a new issue