My Engine.ini is readable to players and they can use it to set various parameters of the game. However, the same file can be used to inject “illegal” values into some unreal variables, breaking the rendering of the game and enabling various forms of online cheating.
The engine has to go through the following two steps:
- Load Engine.ini file and store that data into GConfig map.
- If Engine.ini contained console variables (like r.ReflectionQuality, etc.), load them from GConfig
I would like to know how can I control this process. I’d like for a way to discard or modify any of the entries in Engine.ini file, either before they are loaded into GConfig, or before they are loaded as console variable.
I’ve been looking around the engine and there is a public
bool FConfigCacheIni::ForEachEntry(const FKeyValueSink& Visitor, const TCHAR* Section, const FString& Filename) function, but I have no idea where to call it so it would be early enough.
There is also a call to
ApplyCVarSettingsFromIni(...) from within
ULaunchEngineLoop:PreInitPreStartupScreen(const TCHAR* CmdLine), but I can’t find any place where my game code would have control before that point, even the Engine subsystems are loaded after that point.
So, how do I make sure players don’t mess with unreal variables via ini hacking, while leaving ini modifiable to allow for legal changes? How do I verify the data? Where do I inject my code?