diff options
author | bunnei <bunneidev@gmail.com> | 2019-03-23 18:46:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-23 18:46:09 +0100 |
commit | 6af322a347340953cb90098645ba6d1b26864c3b (patch) | |
tree | ea15e581f4653eadc9eae05dd21e16920f04471d /src/core/loader/nso.h | |
parent | Merge pull request #2279 from lioncash/cheat-global (diff) | |
parent | loader/nso: Place translation unit specific functions into an anonymous namespace (diff) | |
download | yuzu-6af322a347340953cb90098645ba6d1b26864c3b.tar yuzu-6af322a347340953cb90098645ba6d1b26864c3b.tar.gz yuzu-6af322a347340953cb90098645ba6d1b26864c3b.tar.bz2 yuzu-6af322a347340953cb90098645ba6d1b26864c3b.tar.lz yuzu-6af322a347340953cb90098645ba6d1b26864c3b.tar.xz yuzu-6af322a347340953cb90098645ba6d1b26864c3b.tar.zst yuzu-6af322a347340953cb90098645ba6d1b26864c3b.zip |
Diffstat (limited to 'src/core/loader/nso.h')
-rw-r--r-- | src/core/loader/nso.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h index 167c8a694..4674c3724 100644 --- a/src/core/loader/nso.h +++ b/src/core/loader/nso.h @@ -4,7 +4,9 @@ #pragma once +#include <array> #include <optional> +#include <type_traits> #include "common/common_types.h" #include "common/swap.h" #include "core/file_sys/patch_manager.h" @@ -16,6 +18,43 @@ class Process; namespace Loader { +struct NSOSegmentHeader { + u32_le offset; + u32_le location; + u32_le size; + union { + u32_le alignment; + u32_le bss_size; + }; +}; +static_assert(sizeof(NSOSegmentHeader) == 0x10, "NsoSegmentHeader has incorrect size."); + +struct NSOHeader { + using SHA256Hash = std::array<u8, 0x20>; + + struct RODataRelativeExtent { + u32_le data_offset; + u32_le size; + }; + + u32_le magic; + u32_le version; + u32 reserved; + u32_le flags; + std::array<NSOSegmentHeader, 3> segments; // Text, RoData, Data (in that order) + std::array<u8, 0x20> build_id; + std::array<u32_le, 3> segments_compressed_size; + std::array<u8, 0x1C> padding; + RODataRelativeExtent api_info_extent; + RODataRelativeExtent dynstr_extent; + RODataRelativeExtent dynsyn_extent; + std::array<SHA256Hash, 3> segment_hashes; + + bool IsSegmentCompressed(size_t segment_num) const; +}; +static_assert(sizeof(NSOHeader) == 0x100, "NSOHeader has incorrect size."); +static_assert(std::is_trivially_copyable_v<NSOHeader>, "NSOHeader must be trivially copyable."); + constexpr u64 NSO_ARGUMENT_DATA_ALLOCATION_SIZE = 0x9000; struct NSOArgumentHeader { |