Fix Create PPU Cache

This commit is contained in:
Eladash 2023-06-15 21:59:19 +03:00 committed by Ivan
parent 37bc73865d
commit 073b723c09
4 changed files with 24 additions and 16 deletions

View File

@ -107,8 +107,8 @@ struct ppu_module
struct main_ppu_module : public ppu_module
{
u32 elf_entry;
u32 seg0_code_end;
u32 elf_entry{};
u32 seg0_code_end{};
std::basic_string<u32> applied_pathes;
};

View File

@ -1051,8 +1051,6 @@ void init_ppu_functions(utils::serial* ar, bool full = false)
if (full)
{
ensure(ar);
// Initialize HLE modules
ppu_initialize_modules(&g_fxo->get<ppu_linkage_info>(), ar);
}

View File

@ -1329,8 +1329,6 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch,
argv[0] = "/dev_bdvd/PS3_GAME/USRDIR/EBOOT.BIN";
m_dir = "/dev_bdvd/PS3_GAME";
Run(false);
std::string path;
std::vector<std::string> dir_queue;
dir_queue.emplace_back(m_path + '/');
@ -1394,26 +1392,36 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch,
// Workaround for analyser glitches
ensure(vm::falloc(0x10000, 0xf0000, vm::main));
}
if (IsStopped())
{
GetCallbacks().on_stop(); // Call on_stop to refresh gui
return game_boot_result::no_errors;
}
}
if (auto& _main = g_fxo->get<main_ppu_module>(); _main.path.empty())
{
init_fxo_for_exec(nullptr, false);
init_fxo_for_exec(nullptr, true);
}
if (auto main_ppu = idm::get<named_thread<ppu_thread>>(ppu_thread::id_base))
{
// Created by ppu_load_exec, unwanted
main_ppu->state += cpu_flag::exit;
}
g_fxo->init<named_thread>("SPRX Loader"sv, [this, dir_queue]() mutable
{
if (auto& _main = g_fxo->get<main_ppu_module>(); !_main.path.empty())
{
if (!_main.analyse(0, _main.elf_entry, _main.seg0_code_end, _main.applied_pathes, [](){ return Emu.IsStopped(); }))
{
return;
}
ppu_initialize(_main);
}
if (Emu.IsStopped())
{
return;
}
ppu_precompile(dir_queue, nullptr);
// Exit "process"
@ -1424,6 +1432,8 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch,
});
});
Run(false);
return game_boot_result::no_errors;
}

View File

@ -12,15 +12,15 @@ namespace rpcs3::cache
{
std::string get_ppu_cache()
{
auto& _main = g_fxo->get<main_ppu_module>();
const auto _main = g_fxo->try_get<main_ppu_module>();
if (!g_fxo->is_init<main_ppu_module>() || _main.cache.empty())
if (!_main || _main->cache.empty())
{
ppu_log.error("PPU Cache location not initialized.");
return {};
}
return _main.cache;
return _main->cache;
}
void limit_cache_size()