summaryrefslogtreecommitdiffstats
path: root/src/core/loader/nso.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-03-22 17:55:03 +0100
committerLioncash <mathew1800@gmail.com>2019-03-22 19:26:58 +0100
commit90e27ea00355dfe6f189ad116bb5d1bb3e278517 (patch)
tree7e6af9299e2b92c538391f472c4a3eac44df03b9 /src/core/loader/nso.cpp
parentfile_sys/patch_manager: Remove two magic values (diff)
downloadyuzu-90e27ea00355dfe6f189ad116bb5d1bb3e278517.tar
yuzu-90e27ea00355dfe6f189ad116bb5d1bb3e278517.tar.gz
yuzu-90e27ea00355dfe6f189ad116bb5d1bb3e278517.tar.bz2
yuzu-90e27ea00355dfe6f189ad116bb5d1bb3e278517.tar.lz
yuzu-90e27ea00355dfe6f189ad116bb5d1bb3e278517.tar.xz
yuzu-90e27ea00355dfe6f189ad116bb5d1bb3e278517.tar.zst
yuzu-90e27ea00355dfe6f189ad116bb5d1bb3e278517.zip
Diffstat (limited to 'src/core/loader/nso.cpp')
-rw-r--r--src/core/loader/nso.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index 0eb9fd7f7..a52104792 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -34,20 +34,32 @@ struct NsoSegmentHeader {
static_assert(sizeof(NsoSegmentHeader) == 0x10, "NsoSegmentHeader has incorrect size.");
struct NsoHeader {
+ using SHA256Hash = std::array<u8, 0x20>;
+
+ struct RODataRelativeExtent {
+ u32 data_offset;
+ u32 size;
+ };
+
u32_le magic;
u32_le version;
- INSERT_PADDING_WORDS(1);
- u8 flags;
+ 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 {
ASSERT_MSG(segment_num < 3, "Invalid segment {}", segment_num);
return ((flags >> segment_num) & 1);
}
};
-static_assert(sizeof(NsoHeader) == 0x6c, "NsoHeader has incorrect size.");
+static_assert(sizeof(NsoHeader) == 0x100, "NsoHeader has incorrect size.");
static_assert(std::is_trivially_copyable_v<NsoHeader>, "NsoHeader isn't trivially copyable.");
struct ModHeader {