From 557d015662f6b5f9cb1bf5b0fad61c6cecdff542 Mon Sep 17 00:00:00 2001 From: Eladash Date: Tue, 23 Aug 2022 13:05:55 +0300 Subject: [PATCH] System.cpp: Fix Create PPU Cache regression --- rpcs3/Emu/System.cpp | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 53280d7c3b..040602bb3e 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -170,6 +170,7 @@ void Emulator::BlockingCallFromMainThread(std::function&& func) const while (!wake_up && !IsStopped()) { + ensure(thread_ctrl::get_current()); thread_ctrl::wait_on(wake_up, false); } } @@ -1161,9 +1162,8 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool { m_state = system_state::ready; GetCallbacks().on_ready(); + g_fxo->init(); vm::init(); - g_fxo->init(false); - Run(false); m_force_boot = false; // Force LLVM recompiler @@ -1189,12 +1189,13 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool argv[0] = "/dev_bdvd/PS3_GAME/USRDIR/EBOOT.BIN"; m_dir = "/dev_bdvd/PS3_GAME"; - g_fxo->init("SPRX Loader"sv, [this] - { - std::string path; - std::vector dir_queue; - dir_queue.emplace_back(m_path + '/'); + Run(false); + std::string path; + std::vector dir_queue; + dir_queue.emplace_back(m_path + '/'); + + { if (m_title_id.empty()) { // Check if we are trying to scan vsh/module @@ -1239,17 +1240,9 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool const ppu_exec_object obj = src; - if (obj == elf_error::ok) + if (obj == elf_error::ok && ppu_load_exec(obj)) { - auto& _main = g_fxo->get(); - - ppu_load_exec(obj); - - _main.path = path; - - ConfigurePPUCache(); - - ppu_initialize(_main); + g_fxo->get().path = path; } else { @@ -1266,19 +1259,25 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool { m_path = m_path_old; // Reset m_path to fix boot from gui GetCallbacks().on_stop(); // Call on_stop to refresh gui - return; + return game_boot_result::no_errors; + } + } + + g_fxo->init("SPRX Loader"sv, [this, dir_queue]() mutable + { + if (auto& _main = g_fxo->get(); !_main.path.empty()) + { + ppu_initialize(_main); } ppu_precompile(dir_queue, nullptr); // Exit "process" - CallFromMainThread([] + CallFromMainThread([this] { Emu.Kill(false); + m_path = m_path_old; // Reset m_path to fix boot from gui }); - - m_path = m_path_old; // Reset m_path to fix boot from gui - GetCallbacks().on_stop(); // Call on_stop to refresh gui }); return game_boot_result::no_errors;