1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

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.
This commit is contained in:
Megamouse 2021-09-08 00:09:53 +02:00
parent c37c6fb6de
commit 129ade2f73
2 changed files with 15 additions and 15 deletions

View File

@ -64,12 +64,6 @@ void fmt_class_string<patch_type>::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()

View File

@ -117,7 +117,6 @@ void Emulator::Init(bool add_only)
}
g_fxo->reset();
g_fxo->need<named_thread<progress_dialog_server>>();
// 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<patch_engine>()->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<named_thread<progress_dialog_server>>();
// 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<patch_engine>();
// Load patches from different locations
g_fxo->get<patch_engine>().append_global_patches();
g_fxo->get<patch_engine>().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<u64>(g_cfg.core.tx_limit2_ns * _1ns);
}
// Load patches from different locations
g_fxo->get<patch_engine>().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<named_thread<progress_dialog_server>>();
// Set title to actual disc title if necessary
const std::string disc_sfo_dir = vfs::get("/dev_bdvd/PS3_GAME/PARAM.SFO");