From 129ade2f7344b4beeeec3003e74e948b795bad8a Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 8 Sep 2021 00:09:53 +0200 Subject: [PATCH] System: only init fxo objects if a game is started The progress_dialog and patch system aren't needed unless a game is started. Before, they were both initialized everytime we added a single game to the game list or even when simply started RPCS3. This both means that a thread was needlessly idling all the time and even worse: The patch.yml was read countless times when we didn't need it. --- Utilities/bin_patch.cpp | 6 ------ rpcs3/Emu/System.cpp | 24 +++++++++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Utilities/bin_patch.cpp b/Utilities/bin_patch.cpp index 37d98fa05d..eb2358d8ef 100644 --- a/Utilities/bin_patch.cpp +++ b/Utilities/bin_patch.cpp @@ -64,12 +64,6 @@ void fmt_class_string::format(std::string& out, u64 arg) patch_engine::patch_engine() { - const std::string patches_path = get_patches_path(); - - if (!fs::create_path(patches_path)) - { - patch_log.fatal("Failed to create path: %s (%s)", patches_path, fs::g_tls_error); - } } std::string patch_engine::get_patch_config_path() diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 19308137e1..5916a71b4f 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -117,7 +117,6 @@ void Emulator::Init(bool add_only) } g_fxo->reset(); - g_fxo->need>(); // Reset defaults, cache them g_cfg.from_default(); @@ -235,6 +234,7 @@ void Emulator::Init(bool add_only) make_path_verbose(fs::get_cache_dir() + "shaderlog/"); make_path_verbose(fs::get_cache_dir() + "spu_progs/"); make_path_verbose(fs::get_config_dir() + "captures/"); + make_path_verbose(patch_engine::get_patches_path()); if (add_only) { @@ -312,9 +312,6 @@ void Emulator::Init(bool add_only) // Limit cache size if (g_cfg.vfs.limit_cache_size) rpcs3::cache::limit_cache_size(); - - // Initialize patch engine - g_fxo->init()->append_global_patches(); } void Emulator::SetUsr(const std::string& user) @@ -419,6 +416,9 @@ bool Emulator::BootRsxCapture(const std::string& path) vm::init(); g_fxo->init(false); + // Initialize progress dialog + g_fxo->init>(); + // PS3 'executable' m_state = system_state::ready; GetCallbacks().on_ready(); @@ -649,22 +649,28 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool // Set RTM usage g_use_rtm = utils::has_rtm() && ((utils::has_mpx() && g_cfg.core.enable_TSX == tsx_usage::enabled) || g_cfg.core.enable_TSX == tsx_usage::forced); - // Log some extra info in case of boot if (!add_only) { + // Log some extra info in case of boot #if defined(_WIN32) || defined(HAVE_VULKAN) if (g_cfg.video.renderer == video_renderer::vulkan) { sys_log.notice("Vulkan SDK Revision: %d", VK_HEADER_VERSION); } #endif - sys_log.notice("Used configuration:\n%s\n", g_cfg.to_string()); if (g_use_rtm && !utils::has_mpx()) { sys_log.warning("TSX forced by User"); } + + // Initialize patch engine + g_fxo->need(); + + // Load patches from different locations + g_fxo->get().append_global_patches(); + g_fxo->get().append_title_patches(m_title_id); } if (g_use_rtm) @@ -675,9 +681,6 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool g_rtm_tx_limit2 = static_cast(g_cfg.core.tx_limit2_ns * _1ns); } - // Load patches from different locations - g_fxo->get().append_title_patches(m_title_id); - // Mount all devices const std::string emu_dir = rpcs3::utils::get_emu_dir(); std::string bdvd_dir; @@ -1038,6 +1041,9 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool return game_boot_result::no_errors; } + // Initialize progress dialog + g_fxo->init>(); + // Set title to actual disc title if necessary const std::string disc_sfo_dir = vfs::get("/dev_bdvd/PS3_GAME/PARAM.SFO");