ncch_container: Apply IPS patch after allocating .bss

This allows an IPS patch to edit .bss. This is useful for game patches
that need to add code, as putting things in .bss allows adding new code
*without* editing .code and thus without having to relocate everything.
This commit is contained in:
Léo Lam 2019-06-30 18:27:00 +02:00
parent 2f7a10eeaa
commit 43d1ee6fb7
3 changed files with 26 additions and 14 deletions

View file

@ -100,6 +100,9 @@ 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->ApplyIPSPatch(code);
codeset->entrypoint = codeset->CodeSegment().addr;
codeset->memory = std::move(code);