From 76ac8ffbd6d89ba53856dea56778f5ee34b9104a Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sun, 5 Sep 2021 02:15:08 +0200 Subject: [PATCH] input: fix custom pad config removal --- Utilities/Config.cpp | 8 ++++++++ Utilities/Config.h | 2 ++ rpcs3/rpcs3qt/game_list_frame.cpp | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/Utilities/Config.cpp b/Utilities/Config.cpp index b500a251f5..8be321335a 100644 --- a/Utilities/Config.cpp +++ b/Utilities/Config.cpp @@ -429,6 +429,14 @@ void cfg::map_entry::set_map(std::map&& 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({}); diff --git a/Utilities/Config.h b/Utilities/Config.h index 51fd0c2d43..c92793b4a0 100644 --- a/Utilities/Config.h +++ b/Utilities/Config.h @@ -494,6 +494,8 @@ namespace cfg void set_value(const std::string& key, const std::string& value); void set_map(std::map&& map); + void erase(const std::string& key); + void from_default() override; }; diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index ba96a970b0..6aea973d66 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -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)