System.cpp: Fix Create PPU Cache regression

This commit is contained in:
Eladash 2022-08-23 13:05:55 +03:00 committed by Ivan
parent 5985f0eefa
commit 557d015662

View file

@ -170,6 +170,7 @@ void Emulator::BlockingCallFromMainThread(std::function<void()>&& func) const
while (!wake_up && !IsStopped()) while (!wake_up && !IsStopped())
{ {
ensure(thread_ctrl::get_current());
thread_ctrl::wait_on(wake_up, false); 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; m_state = system_state::ready;
GetCallbacks().on_ready(); GetCallbacks().on_ready();
g_fxo->init<ppu_module>();
vm::init(); vm::init();
g_fxo->init(false);
Run(false);
m_force_boot = false; m_force_boot = false;
// Force LLVM recompiler // 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"; argv[0] = "/dev_bdvd/PS3_GAME/USRDIR/EBOOT.BIN";
m_dir = "/dev_bdvd/PS3_GAME"; m_dir = "/dev_bdvd/PS3_GAME";
g_fxo->init<named_thread>("SPRX Loader"sv, [this] Run(false);
{
std::string path; std::string path;
std::vector<std::string> dir_queue; std::vector<std::string> dir_queue;
dir_queue.emplace_back(m_path + '/'); dir_queue.emplace_back(m_path + '/');
{
if (m_title_id.empty()) if (m_title_id.empty())
{ {
// Check if we are trying to scan vsh/module // 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; 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_module>(); g_fxo->get<ppu_module>().path = path;
ppu_load_exec(obj);
_main.path = path;
ConfigurePPUCache();
ppu_initialize(_main);
} }
else 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 m_path = m_path_old; // Reset m_path to fix boot from gui
GetCallbacks().on_stop(); // Call on_stop to refresh gui GetCallbacks().on_stop(); // Call on_stop to refresh gui
return; return game_boot_result::no_errors;
}
}
g_fxo->init<named_thread>("SPRX Loader"sv, [this, dir_queue]() mutable
{
if (auto& _main = g_fxo->get<ppu_module>(); !_main.path.empty())
{
ppu_initialize(_main);
} }
ppu_precompile(dir_queue, nullptr); ppu_precompile(dir_queue, nullptr);
// Exit "process" // Exit "process"
CallFromMainThread([] CallFromMainThread([this]
{ {
Emu.Kill(false); 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; return game_boot_result::no_errors;