1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

PPU LLVM: workaround patch handling

Try to address #9704
This commit is contained in:
Nekotekina 2021-02-02 10:33:13 +03:00
parent 78bad361ab
commit 08aaae7999

View File

@ -823,6 +823,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
sha1_starts(&sha);
u32 end = 0;
u32 toc = 0;
for (const auto& prog : elf.progs)
{
@ -1071,7 +1072,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
prx->specials = ppu_load_exports(link, lib_info->exports_start, lib_info->exports_end);
prx->imports = ppu_load_imports(prx->relocs, link, lib_info->imports_start, lib_info->imports_end);
std::stable_sort(prx->relocs.begin(), prx->relocs.end());
prx->analyse(lib_info->toc, 0, end);
toc = lib_info->toc;
}
else
{
@ -1106,12 +1107,20 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
applied += g_fxo->get<patch_engine>()->apply(Emu.GetTitleID() + '-' + hash, vm::g_base_addr);
}
if (applied)
{
// TODO (invalidate constraints if patches were applied)
end = 0;
}
// Embedded SPU elf patching
for (const auto& seg : prx->segs)
{
ppu_check_patch_spu_images(seg);
}
prx->analyse(toc, 0, end);
ppu_loader.success("PRX library hash: %s (<- %u)", hash, applied);
try_spawn_ppu_if_exclusive_program(*prx);
@ -1561,6 +1570,12 @@ bool ppu_load_exec(const ppu_exec_object& elf)
_main->name.clear();
_main->path = vfs::get(Emu.argv[0]);
if (applied)
{
// TODO (invalidate constraints if patches were applied)
end = 0;
}
// Analyse executable (TODO)
_main->analyse(0, static_cast<u32>(elf.header.e_entry), end);
@ -1965,6 +1980,12 @@ std::pair<std::shared_ptr<lv2_overlay>, CellError> ppu_load_overlay(const ppu_ex
ovlm->entry = static_cast<u32>(elf.header.e_entry);
if (applied)
{
// TODO (invalidate constraints if patches were applied)
end = 0;
}
// Analyse executable (TODO)
ovlm->analyse(0, ovlm->entry, end);