input: fix custom pad config removal

This commit is contained in:
Megamouse 2021-09-05 02:15:08 +02:00
parent fe0c164de2
commit 76ac8ffbd6
3 changed files with 15 additions and 0 deletions

View file

@ -429,6 +429,14 @@ void cfg::map_entry::set_map(std::map<std::string, std::string>&& map)
m_map = std::move(map);
}
void cfg::map_entry::erase(const std::string& key)
{
if (m_map.contains(key))
{
m_map.erase(key);
}
}
void cfg::map_entry::from_default()
{
set_map({});

View file

@ -494,6 +494,8 @@ namespace cfg
void set_value(const std::string& key, const std::string& value);
void set_map(std::map<std::string, std::string>&& map);
void erase(const std::string& key);
void from_default() override;
};

View file

@ -1466,6 +1466,11 @@ bool game_list_frame::RemoveCustomPadConfiguration(const std::string& title_id,
: tr("Remove custom pad configuration?")) != QMessageBox::Yes)
return true;
g_cfg_profile.load();
g_cfg_profile.active_profiles.erase(title_id);
g_cfg_profile.save();
game_list_log.notice("Removed active pad profile entry for key '%s'", title_id);
if (QDir(qstr(config_dir)).removeRecursively())
{
if (game)