diff options
author | bunnei <bunneidev@gmail.com> | 2018-11-19 04:23:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-19 04:23:38 +0100 |
commit | e34d47e6e36f5c99211d0382eded6dbb78ed805e (patch) | |
tree | 262bc94da150ef3b2995d72671ac075c2053ef4f /src/core/loader | |
parent | Merge pull request #1718 from ogniK5377/lets-go-softlock (diff) | |
parent | ldr_ro: Add error check for memory allocation failure (diff) | |
download | yuzu-e34d47e6e36f5c99211d0382eded6dbb78ed805e.tar yuzu-e34d47e6e36f5c99211d0382eded6dbb78ed805e.tar.gz yuzu-e34d47e6e36f5c99211d0382eded6dbb78ed805e.tar.bz2 yuzu-e34d47e6e36f5c99211d0382eded6dbb78ed805e.tar.lz yuzu-e34d47e6e36f5c99211d0382eded6dbb78ed805e.tar.xz yuzu-e34d47e6e36f5c99211d0382eded6dbb78ed805e.tar.zst yuzu-e34d47e6e36f5c99211d0382eded6dbb78ed805e.zip |
Diffstat (limited to 'src/core/loader')
-rw-r--r-- | src/core/loader/nro.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index c8e491fec..fbbd6b0de 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp @@ -170,17 +170,20 @@ static constexpr u32 PageAlignSize(u32 size) { arg_data.size()); } - // Read MOD header - ModHeader mod_header{}; // Default .bss to NRO header bss size if MOD0 section doesn't exist u32 bss_size{PageAlignSize(nro_header.bss_size)}; + + // Read MOD header + ModHeader mod_header{}; std::memcpy(&mod_header, program_image.data() + nro_header.module_header_offset, sizeof(ModHeader)); + const bool has_mod_header{mod_header.magic == Common::MakeMagic('M', 'O', 'D', '0')}; if (has_mod_header) { // Resize program image to include .bss section and page align each section bss_size = PageAlignSize(mod_header.bss_end_offset - mod_header.bss_start_offset); } + codeset.DataSegment().size += bss_size; program_image.resize(static_cast<u32>(program_image.size()) + bss_size); |