forked from 0ad/0ad
Refactor HWDetect and rendering options setup.
Remove duplication when setting graphic options by reading the configDB directly. Properly protect the ModIO config keys. Approved By: linkmauve Refs #5538 Differential Revision: https://code.wildfiregames.com/D1931 This was SVN commit r23747.
This commit is contained in:
parent
d1d4a1d6b9
commit
e9361705ae
@ -81,18 +81,11 @@ fog = true
|
||||
silhouettes = true
|
||||
showsky = true
|
||||
|
||||
nos3tc = false
|
||||
noautomipmap = true
|
||||
novbo = false
|
||||
noframebufferobject = false
|
||||
|
||||
; Disable hardware cursors
|
||||
nohwcursor = false
|
||||
|
||||
; Linux only: Set the driconf force_s3tc_enable option at startup,
|
||||
; for compressed texture support
|
||||
force_s3tc_enable = true
|
||||
|
||||
; Specify the render path. This can be one of:
|
||||
; default Automatically select one of the below, depending on system capabilities
|
||||
; fixed Only use OpenGL fixed function pipeline
|
||||
|
@ -358,30 +358,38 @@ global.RunHardwareDetection = function(settings)
|
||||
if (output.disable_audio !== undefined)
|
||||
Engine.SetDisableAudio(output.disable_audio);
|
||||
|
||||
if (output.disable_s3tc !== undefined)
|
||||
Engine.SetDisableS3TC(output.disable_s3tc);
|
||||
|
||||
if (output.disable_shadows !== undefined)
|
||||
Engine.SetDisableShadows(output.disable_shadows);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "shadows", !output.disable_shadows);
|
||||
|
||||
if (output.disable_shadowpcf !== undefined)
|
||||
Engine.SetDisableShadowPCF(output.disable_shadowpcf);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "shadowpcf", !output.disable_shadowpcf);
|
||||
|
||||
if (output.disable_allwater !== undefined)
|
||||
Engine.SetDisableAllWater(output.disable_allwater);
|
||||
{
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "watereffects", !output.disable_allwater);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "waterfancyeffects", !output.disable_allwater);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "waterrealdepth", !output.disable_allwater);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "watershadows", !output.disable_allwater);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "waterrefraction", !output.disable_allwater);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "waterreflection", !output.disable_allwater);
|
||||
}
|
||||
|
||||
if (output.disable_fancywater !== undefined)
|
||||
Engine.SetDisableFancyWater(output.disable_fancywater);
|
||||
{
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "waterfancyeffects", !output.disable_fancywater);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "waterrealdepth", !output.disable_fancywater);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "watershadows", !output.disable_fancywater);
|
||||
}
|
||||
|
||||
if (output.enable_glsl !== undefined)
|
||||
Engine.SetEnableGLSL(output.enable_glsl);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "preferglsl", output.enable_glsl);
|
||||
|
||||
if (output.enable_postproc !== undefined)
|
||||
Engine.SetEnablePostProc(output.enable_postproc);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "postproc", output.enable_postproc);
|
||||
|
||||
if (output.enable_smoothlos !== undefined)
|
||||
Engine.SetEnableSmoothLOS(output.enable_smoothlos);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "smoothlos", output.enable_smoothlos);
|
||||
|
||||
if (output.override_renderpath !== undefined)
|
||||
Engine.SetRenderPath(output.override_renderpath);
|
||||
Engine.ConfigDB_CreateValue("hwdetect", "renderpath", output.override_renderpath);
|
||||
};
|
||||
|
@ -33,14 +33,19 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
// Namespace priorities: User supersedes mod supersedes system.
|
||||
// Command-line arguments override everything.
|
||||
|
||||
/**
|
||||
* Namespace priorities:
|
||||
* - Command line args override everything
|
||||
* - User supersedes HWDetect (let the user try crashing his system).
|
||||
* - HWDetect supersedes mods & default -> mods can mod hwdetect itself.
|
||||
* - SYSTEM is used for local.cfg and is basically for setting custom defaults.
|
||||
*/
|
||||
enum EConfigNamespace
|
||||
{
|
||||
CFG_DEFAULT,
|
||||
CFG_SYSTEM,
|
||||
CFG_MOD,
|
||||
CFG_SYSTEM,
|
||||
CFG_HWDETECT,
|
||||
CFG_USER,
|
||||
CFG_COMMAND,
|
||||
CFG_LAST
|
||||
|
@ -31,33 +31,8 @@ const wchar_t g_DefaultCursor[] = L"default-arrow";
|
||||
|
||||
CStrW g_CursorName = g_DefaultCursor;
|
||||
|
||||
bool g_NoGLS3TC = false;
|
||||
bool g_NoGLAutoMipmap = false;
|
||||
bool g_NoGLVBO = false;
|
||||
|
||||
bool g_PauseOnFocusLoss = false;
|
||||
|
||||
bool g_Shadows = false;
|
||||
bool g_ShadowPCF = false;
|
||||
|
||||
bool g_WaterEffects = true;
|
||||
bool g_WaterFancyEffects = false;
|
||||
bool g_WaterRealDepth = false;
|
||||
bool g_WaterRefraction = false;
|
||||
bool g_WaterReflection = false;
|
||||
bool g_WaterShadows = false;
|
||||
|
||||
bool g_Particles = false;
|
||||
bool g_Fog = true;
|
||||
bool g_Silhouettes = false;
|
||||
bool g_ShowSky = false;
|
||||
|
||||
bool g_PreferGLSL = false;
|
||||
bool g_PostProc = false;
|
||||
bool g_SmoothLOS = false;
|
||||
|
||||
CStr g_RenderPath = "default";
|
||||
|
||||
int g_xres, g_yres;
|
||||
float g_GuiScale = 1.0f;
|
||||
bool g_VSync = false;
|
||||
@ -85,28 +60,8 @@ static void LoadGlobals()
|
||||
{
|
||||
CFG_GET_VAL("vsync", g_VSync);
|
||||
|
||||
CFG_GET_VAL("nos3tc", g_NoGLS3TC);
|
||||
CFG_GET_VAL("noautomipmap", g_NoGLAutoMipmap);
|
||||
CFG_GET_VAL("novbo", g_NoGLVBO);
|
||||
CFG_GET_VAL("pauseonfocusloss", g_PauseOnFocusLoss);
|
||||
CFG_GET_VAL("shadows", g_Shadows);
|
||||
CFG_GET_VAL("shadowpcf", g_ShadowPCF);
|
||||
|
||||
CFG_GET_VAL("watereffects", g_WaterEffects);
|
||||
CFG_GET_VAL("waterfancyeffects", g_WaterFancyEffects);
|
||||
CFG_GET_VAL("waterrealdepth", g_WaterRealDepth);
|
||||
CFG_GET_VAL("waterrefraction", g_WaterRefraction);
|
||||
CFG_GET_VAL("waterreflection", g_WaterReflection);
|
||||
CFG_GET_VAL("watershadows", g_WaterShadows);
|
||||
|
||||
CFG_GET_VAL("renderpath", g_RenderPath);
|
||||
CFG_GET_VAL("particles", g_Particles);
|
||||
CFG_GET_VAL("fog", g_Fog);
|
||||
CFG_GET_VAL("silhouettes", g_Silhouettes);
|
||||
CFG_GET_VAL("showsky", g_ShowSky);
|
||||
CFG_GET_VAL("preferglsl", g_PreferGLSL);
|
||||
CFG_GET_VAL("postproc", g_PostProc);
|
||||
CFG_GET_VAL("smoothlos", g_SmoothLOS);
|
||||
CFG_GET_VAL("gui.scale", g_GuiScale);
|
||||
}
|
||||
|
||||
|
@ -20,68 +20,9 @@
|
||||
|
||||
#include "ps/CStr.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// prevent various OpenGL features from being used. this allows working
|
||||
// around issues like buggy drivers.
|
||||
|
||||
// when loading S3TC-compressed texture files, do not pass them directly to
|
||||
// OpenGL; instead, decompress them via software to regular textures.
|
||||
// (necessary on JW's S3 laptop graphics card -- oh, the irony)
|
||||
extern bool g_NoGLS3TC;
|
||||
|
||||
// do not ask OpenGL to create mipmaps; instead, generate them in software
|
||||
// and upload them all manually. (potentially helpful for PT's system, where
|
||||
// Mesa falsely reports full S3TC support but isn't able to generate mipmaps
|
||||
// for them)
|
||||
extern bool g_NoGLAutoMipmap;
|
||||
|
||||
// don't use VBOs. (RC: that was necessary on laptop Radeon cards)
|
||||
extern bool g_NoGLVBO;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// flag to pause the game on window focus loss
|
||||
extern bool g_PauseOnFocusLoss;
|
||||
|
||||
// flag to switch on shadows
|
||||
extern bool g_Shadows;
|
||||
|
||||
// If disabled, force the use of the fixed function for rendering water.
|
||||
extern bool g_WaterEffects;
|
||||
// Add foam and waves near the shores, trails following ships, and other HQ things.
|
||||
extern bool g_WaterFancyEffects;
|
||||
// Use real depth for water rendering.
|
||||
extern bool g_WaterRealDepth;
|
||||
// Use a real refraction map and not transparency.
|
||||
extern bool g_WaterRefraction;
|
||||
// Use a real reflection map and not a skybox texture.
|
||||
extern bool g_WaterReflection;
|
||||
// Enable on-water shadows.
|
||||
extern bool g_WaterShadows;
|
||||
|
||||
// flag to switch on shadow PCF
|
||||
extern bool g_ShadowPCF;
|
||||
// flag to switch on particles rendering
|
||||
extern bool g_Particles;
|
||||
// flag to switch on fog
|
||||
extern bool g_Fog;
|
||||
// flag to switch on unit silhouettes
|
||||
extern bool g_Silhouettes;
|
||||
// flag to switch on sky rendering
|
||||
extern bool g_ShowSky;
|
||||
|
||||
// Prefer GLSL shaders over ARB shaders
|
||||
extern bool g_PreferGLSL;
|
||||
// Use screen-space postprocessing filters (HDR, bloom, DOF, etc)
|
||||
extern bool g_PostProc;
|
||||
// Use smooth LOS interpolation
|
||||
extern bool g_SmoothLOS;
|
||||
|
||||
// name of configured render path (depending on OpenGL extensions, this may not be
|
||||
// the render path that is actually in use right now)
|
||||
extern CStr g_RenderPath;
|
||||
|
||||
extern int g_xres, g_yres;
|
||||
extern float g_GuiScale;
|
||||
extern bool g_VSync;
|
||||
|
@ -592,53 +592,11 @@ static void InitRenderer()
|
||||
{
|
||||
TIMER(L"InitRenderer");
|
||||
|
||||
if(g_NoGLS3TC)
|
||||
ogl_tex_override(OGL_TEX_S3TC, OGL_TEX_DISABLE);
|
||||
if(g_NoGLAutoMipmap)
|
||||
ogl_tex_override(OGL_TEX_AUTO_MIPMAP_GEN, OGL_TEX_DISABLE);
|
||||
|
||||
// create renderer
|
||||
new CRenderer;
|
||||
|
||||
g_RenderingOptions.ReadConfig();
|
||||
|
||||
// set renderer options from command line options - NOVBO must be set before opening the renderer
|
||||
// and init them in the ConfigDB when needed
|
||||
g_RenderingOptions.SetNoVBO(g_NoGLVBO);
|
||||
g_RenderingOptions.SetShadows(g_Shadows);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "shadows", g_Shadows);
|
||||
|
||||
g_RenderingOptions.SetWaterEffects(g_WaterEffects);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "watereffects", g_WaterEffects);
|
||||
g_RenderingOptions.SetWaterFancyEffects(g_WaterFancyEffects);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterfancyeffects", g_WaterFancyEffects);
|
||||
g_RenderingOptions.SetWaterRealDepth(g_WaterRealDepth);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterrealdepth", g_WaterRealDepth);
|
||||
g_RenderingOptions.SetWaterReflection(g_WaterReflection);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterreflection", g_WaterReflection);
|
||||
g_RenderingOptions.SetWaterRefraction(g_WaterRefraction);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterrefraction", g_WaterRefraction);
|
||||
g_RenderingOptions.SetWaterShadows(g_WaterShadows);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "watershadows", g_WaterShadows);
|
||||
|
||||
g_RenderingOptions.SetRenderPath(RenderPathEnum::FromString(g_RenderPath));
|
||||
g_RenderingOptions.SetShadowPCF(g_ShadowPCF);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "shadowpcf", g_ShadowPCF);
|
||||
g_RenderingOptions.SetParticles(g_Particles);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "particles", g_Particles);
|
||||
g_RenderingOptions.SetFog(g_Fog);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "fog", g_Fog);
|
||||
g_RenderingOptions.SetSilhouettes(g_Silhouettes);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "silhouettes", g_Silhouettes);
|
||||
g_RenderingOptions.SetShowSky(g_ShowSky);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "showsky", g_ShowSky);
|
||||
g_RenderingOptions.SetPreferGLSL(g_PreferGLSL);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "preferglsl", g_PreferGLSL);
|
||||
g_RenderingOptions.SetPostProc(g_PostProc);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "postproc", g_PostProc);
|
||||
g_RenderingOptions.SetSmoothLOS(g_SmoothLOS);
|
||||
g_ConfigDB.SetValueBool(CFG_SYSTEM, "smoothlos", g_SmoothLOS);
|
||||
|
||||
// create terrain related stuff
|
||||
new CTerrainTextureManager;
|
||||
|
||||
@ -1078,7 +1036,7 @@ void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& i
|
||||
L"The GL_ARB_texture_env_crossbar extension doesn't appear to be available on your computer."
|
||||
L" Shadows are not available and overall graphics quality might suffer."
|
||||
L" You are advised to try installing newer drivers and/or upgrade your graphics card.");
|
||||
g_Shadows = false;
|
||||
g_ConfigDB.SetValueBool(CFG_HWDETECT, "shadows", false);
|
||||
}
|
||||
|
||||
ogl_WarnIfError();
|
||||
|
@ -145,73 +145,6 @@ void SetDisableAudio(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabl
|
||||
g_DisableAudio = disabled;
|
||||
}
|
||||
|
||||
void SetDisableS3TC(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled)
|
||||
{
|
||||
if (!IsOverridden("nos3tc"))
|
||||
ogl_tex_override(OGL_TEX_S3TC, disabled ? OGL_TEX_DISABLE : OGL_TEX_ENABLE);
|
||||
}
|
||||
|
||||
void SetDisableShadows(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled)
|
||||
{
|
||||
if (!IsOverridden("shadows"))
|
||||
g_Shadows = !disabled;
|
||||
}
|
||||
|
||||
void SetDisableShadowPCF(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled)
|
||||
{
|
||||
if (!IsOverridden("shadowpcf"))
|
||||
g_ShadowPCF = !disabled;
|
||||
}
|
||||
|
||||
void SetDisableAllWater(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled)
|
||||
{
|
||||
if (!IsOverridden("watereffects"))
|
||||
g_WaterEffects = !disabled;
|
||||
if (!IsOverridden("waterfancyeffects"))
|
||||
g_WaterFancyEffects = !disabled;
|
||||
if (!IsOverridden("waterrealdepth"))
|
||||
g_WaterRealDepth = !disabled;
|
||||
if (!IsOverridden("waterrefraction"))
|
||||
g_WaterRefraction = !disabled;
|
||||
if (!IsOverridden("waterreflection"))
|
||||
g_WaterReflection = !disabled;
|
||||
if (!IsOverridden("watershadows"))
|
||||
g_WaterShadows = !disabled;
|
||||
}
|
||||
|
||||
void SetDisableFancyWater(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled)
|
||||
{
|
||||
if (!IsOverridden("waterfancyeffects"))
|
||||
g_WaterFancyEffects = !disabled;
|
||||
if (!IsOverridden("waterrealdepth"))
|
||||
g_WaterRealDepth = !disabled;
|
||||
if (!IsOverridden("watershadows"))
|
||||
g_WaterShadows = !disabled;
|
||||
}
|
||||
|
||||
void SetEnableGLSL(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled)
|
||||
{
|
||||
if (!IsOverridden("preferglsl"))
|
||||
g_PreferGLSL = enabled;
|
||||
}
|
||||
|
||||
void SetEnablePostProc(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled)
|
||||
{
|
||||
if (!IsOverridden("postproc"))
|
||||
g_PostProc = enabled;
|
||||
}
|
||||
|
||||
void SetEnableSmoothLOS(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled)
|
||||
{
|
||||
if (!IsOverridden("smoothlos"))
|
||||
g_SmoothLOS = enabled;
|
||||
}
|
||||
|
||||
void SetRenderPath(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& renderpath)
|
||||
{
|
||||
g_RenderPath = renderpath;
|
||||
}
|
||||
|
||||
void RunHardwareDetection()
|
||||
{
|
||||
TIMER(L"RunHardwareDetection");
|
||||
@ -223,15 +156,6 @@ void RunHardwareDetection()
|
||||
JSI_Debug::RegisterScriptFunctions(scriptInterface); // Engine.DisplayErrorDialog
|
||||
|
||||
scriptInterface.RegisterFunction<void, bool, &SetDisableAudio>("SetDisableAudio");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetDisableS3TC>("SetDisableS3TC");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetDisableShadows>("SetDisableShadows");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetDisableShadowPCF>("SetDisableShadowPCF");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetDisableAllWater>("SetDisableAllWater");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetDisableFancyWater>("SetDisableFancyWater");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetEnableGLSL>("SetEnableGLSL");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetEnablePostProc>("SetEnablePostProc");
|
||||
scriptInterface.RegisterFunction<void, bool, &SetEnableSmoothLOS>("SetEnableSmoothLOS");
|
||||
scriptInterface.RegisterFunction<void, std::string, &SetRenderPath>("SetRenderPath");
|
||||
|
||||
// Load the detection script:
|
||||
|
||||
|
@ -75,7 +75,7 @@ struct DownloadCallbackData
|
||||
ModIo::ModIo()
|
||||
: m_GamesRequest("/games"), m_CallbackData(nullptr)
|
||||
{
|
||||
// Get config values from the sytem namespace, or below (default).
|
||||
// Get config values from the default namespace.
|
||||
// This can be overridden on the command line.
|
||||
//
|
||||
// We do this so a malicious mod cannot change the base url and
|
||||
@ -85,16 +85,16 @@ ModIo::ModIo()
|
||||
// provide some shortcut/script that sets these using command line
|
||||
// parameters.
|
||||
std::string pk_str;
|
||||
g_ConfigDB.GetValue(CFG_SYSTEM, "modio.public_key", pk_str);
|
||||
g_ConfigDB.GetValue(CFG_SYSTEM, "modio.v1.baseurl", m_BaseUrl);
|
||||
g_ConfigDB.GetValue(CFG_DEFAULT, "modio.public_key", pk_str);
|
||||
g_ConfigDB.GetValue(CFG_DEFAULT, "modio.v1.baseurl", m_BaseUrl);
|
||||
{
|
||||
std::string api_key;
|
||||
g_ConfigDB.GetValue(CFG_SYSTEM, "modio.v1.api_key", api_key);
|
||||
g_ConfigDB.GetValue(CFG_DEFAULT, "modio.v1.api_key", api_key);
|
||||
m_ApiKey = "api_key=" + api_key;
|
||||
}
|
||||
{
|
||||
std::string nameid;
|
||||
g_ConfigDB.GetValue(CFG_SYSTEM, "modio.v1.name_id", nameid);
|
||||
g_ConfigDB.GetValue(CFG_DEFAULT, "modio.v1.name_id", nameid);
|
||||
m_IdQuery = "name_id="+nameid;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ CVideoMode g_VideoMode;
|
||||
CVideoMode::CVideoMode() :
|
||||
m_IsFullscreen(false), m_IsInitialised(false), m_Window(NULL),
|
||||
m_PreferredW(0), m_PreferredH(0), m_PreferredBPP(0), m_PreferredFreq(0),
|
||||
m_ConfigW(0), m_ConfigH(0), m_ConfigBPP(0), m_ConfigFullscreen(false), m_ConfigForceS3TCEnable(true),
|
||||
m_ConfigW(0), m_ConfigH(0), m_ConfigBPP(0), m_ConfigFullscreen(false),
|
||||
m_WindowedW(DEFAULT_WINDOW_W), m_WindowedH(DEFAULT_WINDOW_H), m_WindowedX(0), m_WindowedY(0)
|
||||
{
|
||||
// (m_ConfigFullscreen defaults to false, so users don't get stuck if
|
||||
@ -68,7 +68,6 @@ void CVideoMode::ReadConfig()
|
||||
CFG_GET_VAL("yres", m_ConfigH);
|
||||
CFG_GET_VAL("bpp", m_ConfigBPP);
|
||||
CFG_GET_VAL("display", m_ConfigDisplay);
|
||||
CFG_GET_VAL("force_s3tc_enable", m_ConfigForceS3TCEnable);
|
||||
}
|
||||
|
||||
bool CVideoMode::SetVideoMode(int w, int h, int bpp, bool fullscreen)
|
||||
@ -169,8 +168,6 @@ bool CVideoMode::InitSDL()
|
||||
|
||||
ReadConfig();
|
||||
|
||||
EnableS3TC();
|
||||
|
||||
// preferred video mode = current desktop settings
|
||||
// (command line params may override these)
|
||||
gfx::GetVideoMode(&m_PreferredW, &m_PreferredH, &m_PreferredBPP, &m_PreferredFreq);
|
||||
@ -261,8 +258,6 @@ bool CVideoMode::InitNonSDL()
|
||||
|
||||
ReadConfig();
|
||||
|
||||
EnableS3TC();
|
||||
|
||||
m_IsInitialised = true;
|
||||
|
||||
return true;
|
||||
@ -281,28 +276,6 @@ void CVideoMode::Shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
void CVideoMode::EnableS3TC()
|
||||
{
|
||||
// On Linux we have to try hard to get S3TC compressed texture support.
|
||||
// If the extension is already provided by default, that's fine.
|
||||
// Otherwise we should enable the 'force_s3tc_enable' environment variable
|
||||
// and (re)initialise the video system, so that Mesa provides the extension
|
||||
// (if the driver at least supports decompression).
|
||||
// (This overrides the force_s3tc_enable specified via driconf files.)
|
||||
// Otherwise we should complain to the user, and stop using compressed textures.
|
||||
//
|
||||
// Setting the environment variable causes Mesa to print an ugly message to stderr
|
||||
// ("ATTENTION: default value of option force_s3tc_enable overridden by environment."),
|
||||
// so it'd be nicer to skip that if S3TC will be supported by default,
|
||||
// but reinitialising video is a pain (and it might do weird things when fullscreen)
|
||||
// so we just unconditionally set it (unless our config file explicitly disables it).
|
||||
|
||||
#if !(OS_WIN || OS_MACOSX) // (assume Mesa is used for all non-Windows non-Mac platforms)
|
||||
if (m_ConfigForceS3TCEnable)
|
||||
setenv("force_s3tc_enable", "true", 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CVideoMode::ResizeWindow(int w, int h)
|
||||
{
|
||||
ENSURE(m_IsInitialised);
|
||||
|
@ -33,7 +33,6 @@ public:
|
||||
/**
|
||||
* Initialise parts of the video mode, for use in Atlas (which uses
|
||||
* wxWidgets instead of SDL for GL).
|
||||
* Currently this just tries to enable S3TC.
|
||||
*/
|
||||
bool InitNonSDL();
|
||||
|
||||
@ -91,7 +90,6 @@ private:
|
||||
void ReadConfig();
|
||||
int GetBestBPP();
|
||||
bool SetVideoMode(int w, int h, int bpp, bool fullscreen);
|
||||
void EnableS3TC();
|
||||
|
||||
/**
|
||||
* Remember whether Init has been called. (This isn't used for anything
|
||||
@ -114,7 +112,6 @@ private:
|
||||
int m_ConfigBPP;
|
||||
int m_ConfigDisplay;
|
||||
bool m_ConfigFullscreen;
|
||||
bool m_ConfigForceS3TCEnable;
|
||||
|
||||
// If we're fullscreen, size/position of window when we were last windowed (or the default window
|
||||
// size/position if we started fullscreen), to support switching back to the old window size/position
|
||||
|
@ -26,9 +26,13 @@
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
// These entries will not be readable nor writable for JS, so that malicious mods can't leak personal or sensitive data
|
||||
// These entries will not be readable nor writable for JS, so that e.g. malicious mods can't leak personal or sensitive data
|
||||
static const std::unordered_set<std::string> g_ProtectedConfigNames = {
|
||||
"userreport.id" // authentication token for GDPR personal data requests
|
||||
"modio.public_key", // See ModIO.cpp
|
||||
"modio.v1.baseurl",
|
||||
"modio.v1.api_key",
|
||||
"modio.v1.name_id",
|
||||
"userreport.id" // Acts as authentication token for GDPR personal data requests.
|
||||
};
|
||||
|
||||
bool JSI_ConfigDB::IsProtectedConfigName(const std::string& name)
|
||||
@ -45,12 +49,14 @@ bool JSI_ConfigDB::GetConfigNamespace(const std::wstring& cfgNsString, EConfigNa
|
||||
{
|
||||
if (cfgNsString == L"default")
|
||||
cfgNs = CFG_DEFAULT;
|
||||
else if (cfgNsString == L"mod")
|
||||
cfgNs = CFG_MOD;
|
||||
else if (cfgNsString == L"system")
|
||||
cfgNs = CFG_SYSTEM;
|
||||
else if (cfgNsString == L"user")
|
||||
cfgNs = CFG_USER;
|
||||
else if (cfgNsString == L"mod")
|
||||
cfgNs = CFG_MOD;
|
||||
else if (cfgNsString == L"hwdetect")
|
||||
cfgNs = CFG_HWDETECT;
|
||||
else
|
||||
{
|
||||
LOGERROR("Invalid namespace name passed to the ConfigDB!");
|
||||
|
@ -83,12 +83,33 @@ SRenderingOptions::SRenderingOptions()
|
||||
|
||||
void SRenderingOptions::ReadConfig()
|
||||
{
|
||||
// TODO: be more consistent in use of the config system
|
||||
CFG_GET_VAL("shadows", m_Shadows);
|
||||
CFG_GET_VAL("shadowpcf", m_ShadowPCF);
|
||||
|
||||
CFG_GET_VAL("preferglsl", m_PreferGLSL);
|
||||
CFG_GET_VAL("postproc", m_PostProc);
|
||||
CFG_GET_VAL("smoothlos", m_SmoothLOS);
|
||||
|
||||
CStr renderPath;
|
||||
CFG_GET_VAL("renderpath", renderPath);
|
||||
SetRenderPath(RenderPathEnum::FromString(renderPath));
|
||||
|
||||
CFG_GET_VAL("watereffects", m_WaterEffects);
|
||||
CFG_GET_VAL("waterfancyeffects", m_WaterFancyEffects);
|
||||
CFG_GET_VAL("waterrealdepth", m_WaterRealDepth);
|
||||
CFG_GET_VAL("waterrefraction", m_WaterRefraction);
|
||||
CFG_GET_VAL("waterreflection", m_WaterReflection);
|
||||
CFG_GET_VAL("watershadows", m_WaterShadows);
|
||||
|
||||
CFG_GET_VAL("particles", m_Particles);
|
||||
CFG_GET_VAL("fog", m_Fog);
|
||||
CFG_GET_VAL("silhouettes", m_Silhouettes);
|
||||
CFG_GET_VAL("showsky", m_ShowSky);
|
||||
|
||||
CFG_GET_VAL("novbo", m_NoVBO);
|
||||
|
||||
CFG_GET_VAL("forcealphatest", m_ForceAlphaTest);
|
||||
CFG_GET_VAL("gpuskinning", m_GPUSkinning);
|
||||
CFG_GET_VAL("smoothlos", m_SmoothLOS);
|
||||
CFG_GET_VAL("postproc", m_PostProc);
|
||||
|
||||
CFG_GET_VAL("renderactors", m_RenderActors);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user