From 69faf14a793a77d4258f09d7c00c614a72a7473b Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 8 Sep 2021 02:13:10 +0200 Subject: [PATCH] System: remove deprecated custom config location --- rpcs3/Emu/System.cpp | 30 +++++++++--------------------- rpcs3/Emu/system_utils.cpp | 11 ++--------- rpcs3/Emu/system_utils.hpp | 2 +- rpcs3/rpcs3qt/emu_settings.cpp | 11 +++-------- rpcs3/rpcs3qt/game_list_frame.cpp | 24 +++++++----------------- 5 files changed, 22 insertions(+), 56 deletions(-) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 45dc6c00c5..cf09992c2b 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -601,36 +601,24 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool if (!add_only && !force_global_config && m_config_override_path.empty()) { - const std::string config_path_new = rpcs3::utils::get_custom_config_path(m_title_id); - const std::string config_path_old = rpcs3::utils::get_custom_config_path(m_title_id, true); + const std::string config_path = rpcs3::utils::get_custom_config_path(m_title_id); // Load custom config-1 - if (fs::file cfg_file{ config_path_old }) + if (fs::file cfg_file{ config_path }) { - sys_log.notice("Applying custom config: %s", config_path_old); + sys_log.notice("Applying custom config: %s", config_path); - if (!g_cfg.from_string(cfg_file.to_string())) + if (g_cfg.from_string(cfg_file.to_string())) { - sys_log.fatal("Failed to apply custom config: %s", config_path_old); + g_cfg.name = config_path; + } + else + { + sys_log.fatal("Failed to apply custom config: %s", config_path); } } // Load custom config-2 - if (fs::file cfg_file{ config_path_new }) - { - sys_log.notice("Applying custom config: %s", config_path_new); - - if (g_cfg.from_string(cfg_file.to_string())) - { - g_cfg.name = config_path_new; - } - else - { - sys_log.fatal("Failed to apply custom config: %s", config_path_new); - } - } - - // Load custom config-3 if (fs::file cfg_file{ m_path + ".yml" }) { sys_log.notice("Applying custom config: %s.yml", m_path); diff --git a/rpcs3/Emu/system_utils.cpp b/rpcs3/Emu/system_utils.cpp index b82998459d..5ab959ce97 100644 --- a/rpcs3/Emu/system_utils.cpp +++ b/rpcs3/Emu/system_utils.cpp @@ -214,16 +214,9 @@ namespace rpcs3::utils #endif } - std::string get_custom_config_path(const std::string& title_id, bool get_deprecated_path) + std::string get_custom_config_path(const std::string& title_id) { - std::string path; - - if (get_deprecated_path) - path = fs::get_config_dir() + "data/" + title_id + "/config.yml"; - else - path = get_custom_config_dir() + "config_" + title_id + ".yml"; - - return path; + return get_custom_config_dir() + "config_" + title_id + ".yml"; } std::string get_input_config_root() diff --git a/rpcs3/Emu/system_utils.hpp b/rpcs3/Emu/system_utils.hpp index 2342cab946..1d0bf255b0 100644 --- a/rpcs3/Emu/system_utils.hpp +++ b/rpcs3/Emu/system_utils.hpp @@ -26,7 +26,7 @@ namespace rpcs3::utils std::string get_sfo_dir_from_game_path(const std::string& game_path, const std::string& title_id = ""); std::string get_custom_config_dir(); - std::string get_custom_config_path(const std::string& title_id, bool get_deprecated_path = false); + std::string get_custom_config_path(const std::string& title_id); std::string get_input_config_root(); std::string get_input_config_dir(const std::string& title_id = ""); diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index 254364cc5c..438cb423fb 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -140,17 +140,12 @@ void emu_settings::LoadSettings(const std::string& title_id) // Otherwise we'll always trigger the "obsolete settings dialog" when editing custom configs. ValidateSettings(true); - const std::string config_path_new = rpcs3::utils::get_custom_config_path(m_title_id); - const std::string config_path_old = rpcs3::utils::get_custom_config_path(m_title_id, true); + const std::string config_path = rpcs3::utils::get_custom_config_path(m_title_id); std::string custom_config_path; - if (fs::is_file(config_path_new)) + if (fs::is_file(config_path)) { - custom_config_path = config_path_new; - } - else if (fs::is_file(config_path_old)) - { - custom_config_path = config_path_old; + custom_config_path = config_path; } if (!custom_config_path.empty()) diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 79e0b64ae7..d222d3f2a5 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -665,7 +665,7 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after) m_mutex_cat.unlock(); const auto compat = m_game_compat->GetCompatibility(game.serial); - const bool hasCustomConfig = fs::is_file(rpcs3::utils::get_custom_config_path(game.serial)) || fs::is_file(rpcs3::utils::get_custom_config_path(game.serial, true)); + const bool hasCustomConfig = fs::is_file(rpcs3::utils::get_custom_config_path(game.serial)); const bool hasCustomPadConfig = fs::is_file(rpcs3::utils::get_custom_input_config_path(game.serial)); const bool has_hover_gif = fs::is_file(game_icon_path + game.serial + "/hover.gif"); @@ -1017,15 +1017,10 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) QAction* open_config_dir = menu.addAction(tr("&Open Custom Config Folder")); connect(open_config_dir, &QAction::triggered, [current_game]() { - const std::string new_config_path = rpcs3::utils::get_custom_config_path(current_game.serial); + const std::string config_path = rpcs3::utils::get_custom_config_path(current_game.serial); - if (fs::is_file(new_config_path)) - gui::utils::open_dir(new_config_path); - - const std::string old_config_path = rpcs3::utils::get_custom_config_path(current_game.serial, true); - - if (fs::is_file(old_config_path)) - gui::utils::open_dir(old_config_path); + if (fs::is_file(config_path)) + gui::utils::open_dir(config_path); }); } if (fs::is_dir(data_base_dir)) @@ -1398,10 +1393,9 @@ bool game_list_frame::CreatePPUCache(const game_info& game) bool game_list_frame::RemoveCustomConfiguration(const std::string& title_id, const game_info& game, bool is_interactive) { - const std::string config_path_new = rpcs3::utils::get_custom_config_path(title_id); - const std::string config_path_old = rpcs3::utils::get_custom_config_path(title_id, true); + const std::string path = rpcs3::utils::get_custom_config_path(title_id); - if (!fs::is_file(config_path_new) && !fs::is_file(config_path_old)) + if (!fs::is_file(path)) return true; if (is_interactive && QMessageBox::question(this, tr("Confirm Removal"), tr("Remove custom game configuration?")) != QMessageBox::Yes) @@ -1409,12 +1403,8 @@ bool game_list_frame::RemoveCustomConfiguration(const std::string& title_id, con bool result = true; - for (const std::string& path : { config_path_new, config_path_old }) + if (fs::is_file(path)) { - if (!fs::is_file(path)) - { - continue; - } if (fs::remove_file(path)) { if (game)