I built a plugin to make persistent changes to scability settings, following Ramma tutorials on the wiki. Now I’m writing some variables on the GameIni like: Mouse Sensitivity and Volume.
What I’d like is to read them all and return to the bp. I found this: https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Misc/FConfigCacheIni/ForEachEntry/index.html but I don’t know how to use it.
USManager::GetGameSettings(){
FString Section = "GameSettings";
GConfig->ForEachEntry(
SOMETHING_HERE_I_DONT_KNOW_WHAT
*Section,
GGameIni
);
}
And how do I retrieve the values?
Thank you for reading.
Edit¹
Here is the function (from Engine\Source\Runtime\Core\Private\Misc):
bool FConfigCacheIni::ForEachEntry(const FKeyValueSink& Visitor, const TCHAR* Section, const FString& Filename)
{
FConfigFile* File = Find(Filename, 0);
if(!File)
{
return false;
}
FConfigSection* Sec = File->Find(Section);
if(!Sec)
{
return false;
}
for(FConfigSectionMap::TIterator It(*Sec); It; ++It)
{
Visitor.Execute(*It.Key().GetPlainNameString(), *It.Value());
}
return true;
}
Breaking down to this part: **Visitor.Execute(It.Key().GetPlainNameString(), It.Value());
Edit²
Found this: DECLARE_DELEGATE_TwoParams(FKeyValueSink, const TCHAR, const TCHAR);**
And this: https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Delegates/index.html.
Yet, I don’t know what to do.
Edit³
I made a class:
class FGetFromIni
{
public:
static void OnEntry(const TCHAR *Key, const TCHAR* Value)
{
}
static TArray<FString> KeyAndValues;
};
And I’m calling:
TArray<FString> OMSPlugin::GetFromIni(FString Section)
{
GConfig->ForEachEntry(FKeyValueSink::CreateStatic(&FGetFromIni::OnEntry), *Section, GGameIni);
return FGetFromIni::KeyAndValues;
Now I’m getting the error: error LNK2001: unresolved external symbol "public: static class TArray FGetFromIni::KeyAndValues"