diff options
Diffstat (limited to 'src/core/loader/nso.cpp')
| -rw-r--r-- | src/core/loader/nso.cpp | 18 |
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 { | |||
| 34 | static_assert(sizeof(NsoSegmentHeader) == 0x10, "NsoSegmentHeader has incorrect size."); | 34 | static_assert(sizeof(NsoSegmentHeader) == 0x10, "NsoSegmentHeader has incorrect size."); |
| 35 | 35 | ||
| 36 | struct NsoHeader { | 36 | struct NsoHeader { |
| 37 | using SHA256Hash = std::array<u8, 0x20>; | ||
| 38 | |||
| 39 | struct RODataRelativeExtent { | ||
| 40 | u32 data_offset; | ||
| 41 | u32 size; | ||
| 42 | }; | ||
| 43 | |||
| 37 | u32_le magic; | 44 | u32_le magic; |
| 38 | u32_le version; | 45 | u32_le version; |
| 39 | INSERT_PADDING_WORDS(1); | 46 | u32 reserved; |
| 40 | u8 flags; | 47 | u32_le flags; |
| 41 | std::array<NsoSegmentHeader, 3> segments; // Text, RoData, Data (in that order) | 48 | std::array<NsoSegmentHeader, 3> segments; // Text, RoData, Data (in that order) |
| 42 | std::array<u8, 0x20> build_id; | 49 | std::array<u8, 0x20> build_id; |
| 43 | std::array<u32_le, 3> segments_compressed_size; | 50 | std::array<u32_le, 3> segments_compressed_size; |
| 51 | std::array<u8, 0x1C> padding; | ||
| 52 | RODataRelativeExtent api_info_extent; | ||
| 53 | RODataRelativeExtent dynstr_extent; | ||
| 54 | RODataRelativeExtent dynsyn_extent; | ||
| 55 | std::array<SHA256Hash, 3> segment_hashes; | ||
| 44 | 56 | ||
| 45 | bool IsSegmentCompressed(size_t segment_num) const { | 57 | bool IsSegmentCompressed(size_t segment_num) const { |
| 46 | ASSERT_MSG(segment_num < 3, "Invalid segment {}", segment_num); | 58 | ASSERT_MSG(segment_num < 3, "Invalid segment {}", segment_num); |
| 47 | return ((flags >> segment_num) & 1); | 59 | return ((flags >> segment_num) & 1); |
| 48 | } | 60 | } |
| 49 | }; | 61 | }; |
| 50 | static_assert(sizeof(NsoHeader) == 0x6c, "NsoHeader has incorrect size."); | 62 | static_assert(sizeof(NsoHeader) == 0x100, "NsoHeader has incorrect size."); |
| 51 | static_assert(std::is_trivially_copyable_v<NsoHeader>, "NsoHeader isn't trivially copyable."); | 63 | static_assert(std::is_trivially_copyable_v<NsoHeader>, "NsoHeader isn't trivially copyable."); |
| 52 | 64 | ||
| 53 | struct ModHeader { | 65 | struct ModHeader { |