cfg: per-game settings must be deleted when changed back to standard

When a per-game setting is the same as the standard one, it is ignored
and not saved to emu.cfg. However the previously saved per-game setting
wasn't deleted, making it impossible to revert.

Issue #653
This commit is contained in:
Flyinghead 2022-07-25 11:25:42 +02:00
parent 5ae7ac3eca
commit 642fad9a6e
3 changed files with 10 additions and 0 deletions

View File

@ -119,6 +119,11 @@ void cfgDeleteSection(const std::string& section)
cfgdb.delete_section(section);
}
void cfgDeleteEntry(const std::string& section, const std::string& key)
{
cfgdb.delete_entry(section, key);
}
void cfgSetAutoSave(bool autoSave)
{
::autoSave = autoSave;

View File

@ -19,3 +19,4 @@ bool ParseCommandLine(int argc, char *argv[]);
void cfgSetAutoSave(bool autoSave);
bool cfgHasSection(const std::string& section);
void cfgDeleteSection(const std::string& section);
void cfgDeleteEntry(const std::string& section, const std::string& key);

View File

@ -142,7 +142,11 @@ public:
else if (PerGameOption && settings.hasPerGameConfig())
{
if (value == doLoad(section, name))
{
// delete existing per-game option if any
cfgDeleteEntry(settings.gameId, section + "." + name);
return;
}
}
if (PerGameOption && settings.hasPerGameConfig())
doSave(settings.gameId, section + "." + name);