PPU LLVM: Allow to abort OVL analysis in the middle

This commit is contained in:
Eladash 2023-07-14 17:57:43 +03:00 committed by Elad Ashkenazi
parent 3b8f8d7fc8
commit 1371bf89e0
3 changed files with 21 additions and 1 deletions

View file

@ -2682,8 +2682,16 @@ std::pair<std::shared_ptr<lv2_overlay>, CellError> ppu_load_overlay(const ppu_ex
ovlm->entry = static_cast<u32>(elf.header.e_entry);
const auto cpu = cpu_thread::get_current();
// Analyse executable (TODO)
ovlm->analyse(0, ovlm->entry, end, applied);
if (!ovlm->analyse(0, ovlm->entry, end, applied, !cpu ? std::function<bool()>() : [cpu, is_being_used_in_emulation = (vm::base(ovlm->segs[0].addr) == ovlm->segs[0].ptr)]()
{
return is_being_used_in_emulation && cpu->state & cpu_flag::exit;
}))
{
return {nullptr, CellError{CELL_CANCEL + 0u}};
}
// Validate analyser results (not required)
ovlm->validate(0);

View file

@ -3479,6 +3479,12 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
if (error)
{
if (error == CELL_CANCEL + 0u)
{
// Emulation stopped
break;
}
// Abort
ovl_err = elf_error::header_type;
break;

View file

@ -49,6 +49,12 @@ static error_code overlay_load_module(vm::ptr<u32> ovlmid, const std::string& vp
if (error)
{
if (error == CELL_CANCEL + 0u)
{
// Emulation stopped
return {};
}
return error;
}