Config: Only load modified game settings, don't save
There is no reason to build a configuration file of duplicate settings. The user can acquire the defaults from the config section and only inject the changes into the game section.
This commit is contained in:
parent
2311253aa5
commit
9e57068192
|
@ -136,7 +136,7 @@ string cfgLoadStr(const wchar * Section, const wchar * Key, const wchar* Defaul
|
|||
{
|
||||
if(!cfgdb.has_entry(string(Section), string(Key)))
|
||||
{
|
||||
cfgSaveStr(Section, Key, Default);
|
||||
cfgSaveStr(Section, Key, Default);
|
||||
}
|
||||
return cfgdb.get(string(Section), string(Key), string(Default));
|
||||
}
|
||||
|
@ -155,11 +155,20 @@ s32 cfgLoadInt(const wchar * Section, const wchar * Key,s32 Default)
|
|||
{
|
||||
if(!cfgdb.has_entry(string(Section), string(Key)))
|
||||
{
|
||||
cfgSaveInt(Section, Key, Default);
|
||||
cfgSaveInt(Section, Key, Default);
|
||||
}
|
||||
return cfgdb.get_int(string(Section), string(Key), Default);
|
||||
}
|
||||
|
||||
s32 cfgGameInt(const wchar * Section, const wchar * Key,s32 Default)
|
||||
{
|
||||
if(cfgdb.has_entry(string(Section), string(Key)))
|
||||
{
|
||||
return cfgdb.get_int(string(Section), string(Key), Default);
|
||||
}
|
||||
return Default;
|
||||
}
|
||||
|
||||
void cfgSaveBool(const wchar * Section, const wchar * Key, bool BoolValue)
|
||||
{
|
||||
cfgdb.set_bool(string(Section), string(Key), BoolValue);
|
||||
|
@ -173,7 +182,7 @@ bool cfgLoadBool(const wchar * Section, const wchar * Key,bool Default)
|
|||
{
|
||||
if(!cfgdb.has_entry(string(Section), string(Key)))
|
||||
{
|
||||
cfgSaveBool(Section, Key, Default);
|
||||
cfgSaveBool(Section, Key, Default);
|
||||
}
|
||||
return cfgdb.get_bool(string(Section), string(Key), Default);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
bool cfgOpen();
|
||||
s32 cfgLoadInt(const wchar * lpSection, const wchar * lpKey,s32 Default);
|
||||
s32 cfgGameInt(const wchar * lpSection, const wchar * lpKey,s32 Default);
|
||||
void cfgSaveInt(const wchar * lpSection, const wchar * lpKey, s32 Int);
|
||||
void cfgLoadStr(const wchar * lpSection, const wchar * lpKey, wchar * lpReturn,const wchar* lpDefault);
|
||||
string cfgLoadStr(const wchar * Section, const wchar * Key, const wchar* Default);
|
||||
|
|
|
@ -313,19 +313,19 @@ void LoadCustom()
|
|||
char *reios_id = reios_disk_id();
|
||||
|
||||
cfgSaveStr(reios_id, "software.name", reios_software_name);
|
||||
settings.dynarec.idleskip = cfgLoadInt(reios_id,"Dynarec.idleskip", settings.dynarec.idleskip ? 1 : 0) != 0;
|
||||
settings.dynarec.unstable_opt = cfgLoadInt(reios_id,"Dynarec.unstable-opt", settings.dynarec.unstable_opt);
|
||||
settings.dynarec.safemode = cfgLoadInt(reios_id,"Dynarec.safemode", settings.dynarec.safemode);
|
||||
settings.rend.ModifierVolumes = cfgLoadInt(reios_id,"rend.ModifierVolumes", settings.rend.ModifierVolumes);
|
||||
settings.rend.Clipping = cfgLoadInt(reios_id,"rend.Clipping", settings.rend.Clipping);
|
||||
settings.dynarec.idleskip = cfgGameInt(reios_id,"Dynarec.idleskip", settings.dynarec.idleskip ? 1 : 0) != 0;
|
||||
settings.dynarec.unstable_opt = cfgGameInt(reios_id,"Dynarec.unstable-opt", settings.dynarec.unstable_opt);
|
||||
settings.dynarec.safemode = cfgGameInt(reios_id,"Dynarec.safemode", settings.dynarec.safemode);
|
||||
settings.rend.ModifierVolumes = cfgGameInt(reios_id,"rend.ModifierVolumes", settings.rend.ModifierVolumes);
|
||||
settings.rend.Clipping = cfgGameInt(reios_id,"rend.Clipping", settings.rend.Clipping);
|
||||
|
||||
settings.pvr.subdivide_transp = cfgLoadInt(reios_id,"pvr.Subdivide", settings.pvr.subdivide_transp);
|
||||
settings.pvr.subdivide_transp = cfgGameInt(reios_id,"pvr.Subdivide", settings.pvr.subdivide_transp);
|
||||
|
||||
settings.pvr.ta_skip = cfgLoadInt(reios_id,"ta.skip", settings.pvr.ta_skip);
|
||||
settings.pvr.rend = cfgLoadInt(reios_id,"pvr.rend", settings.pvr.rend);
|
||||
settings.pvr.ta_skip = cfgGameInt(reios_id,"ta.skip", settings.pvr.ta_skip);
|
||||
settings.pvr.rend = cfgGameInt(reios_id,"pvr.rend", settings.pvr.rend);
|
||||
|
||||
settings.pvr.MaxThreads = cfgLoadInt(reios_id, "pvr.MaxThreads", settings.pvr.MaxThreads);
|
||||
settings.pvr.SynchronousRender = cfgLoadInt(reios_id, "pvr.SynchronousRendering", settings.pvr.SynchronousRender);
|
||||
settings.pvr.MaxThreads = cfgGameInt(reios_id, "pvr.MaxThreads", settings.pvr.MaxThreads);
|
||||
settings.pvr.SynchronousRender = cfgGameInt(reios_id, "pvr.SynchronousRendering", settings.pvr.SynchronousRender);
|
||||
}
|
||||
|
||||
void SaveSettings()
|
||||
|
|
Loading…
Reference in New Issue