file_sys: Handle patch applying failures
This changes ApplyCodePatch to return a ResultStatus, which makes it possible to determine whether patch applying has failed. Previously, only a boolean was returned, and false was returned when no patch was found OR when a patch was found but applying it failed. This also changes AppLoader_NCCH to return an error if patching fails because the executable is likely to be left in an inconsistent state and we should not proceed booting in that case.
This commit is contained in:
parent
1377be9902
commit
3140086c60
3 changed files with 13 additions and 9 deletions
|
@ -100,8 +100,10 @@ ResultStatus AppLoader_NCCH::LoadExec(std::shared_ptr<Kernel::Process>& process)
|
|||
overlay_ncch->exheader_header.codeset_info.data.num_max_pages * Memory::PAGE_SIZE +
|
||||
bss_page_size;
|
||||
|
||||
// Apply any IPS patch now that the entire codeset (including .bss) has been allocated
|
||||
overlay_ncch->ApplyCodePatch(code);
|
||||
// Apply patches now that the entire codeset (including .bss) has been allocated
|
||||
const ResultStatus patch_result = overlay_ncch->ApplyCodePatch(code);
|
||||
if (patch_result != ResultStatus::Success && patch_result != ResultStatus::ErrorNotUsed)
|
||||
return patch_result;
|
||||
|
||||
codeset->entrypoint = codeset->CodeSegment().addr;
|
||||
codeset->memory = std::move(code);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue