Merge pull request #12986 from t895/input-config-clear-fix

config: Always delete control settings in ClearControlPlayerValues
This commit is contained in:
liamwhite 2024-02-11 12:24:18 -05:00 committed by GitHub
commit 98db796fde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -867,15 +867,9 @@ void Config::Reload() {
} }
void Config::ClearControlPlayerValues() const { void Config::ClearControlPlayerValues() const {
// If key is an empty string, all keys in the current group() are removed. // Removes the entire [Controls] section
const char* section = Settings::TranslateCategory(Settings::Category::Controls); const char* section = Settings::TranslateCategory(Settings::Category::Controls);
CSimpleIniA::TNamesDepend keys; config->Delete(section, nullptr, true);
config->GetAllKeys(section, keys);
for (const auto& key : keys) {
if (std::string(config->GetValue(section, key.pItem)).empty()) {
config->Delete(section, key.pItem);
}
}
} }
const std::string& Config::GetConfigFilePath() const { const std::string& Config::GetConfigFilePath() const {