diff options
Diffstat (limited to 'src/core/loader/nso.cpp')
| -rw-r--r-- | src/core/loader/nso.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 714d85a59..8aeabe409 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #include <cinttypes> | 5 | #include <cinttypes> |
| 6 | #include <vector> | 6 | #include <vector> |
| 7 | #include <lz4.h> | 7 | |
| 8 | #include "common/data_compression.h" | ||
| 8 | #include "common/common_funcs.h" | 9 | #include "common/common_funcs.h" |
| 9 | #include "common/file_util.h" | 10 | #include "common/file_util.h" |
| 10 | #include "common/hex_util.h" | 11 | #include "common/hex_util.h" |
| @@ -35,15 +36,11 @@ static_assert(sizeof(MODHeader) == 0x1c, "MODHeader has incorrect size."); | |||
| 35 | 36 | ||
| 36 | std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, | 37 | std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, |
| 37 | const NSOSegmentHeader& header) { | 38 | const NSOSegmentHeader& header) { |
| 38 | std::vector<u8> uncompressed_data(header.size); | 39 | const std::vector<u8> uncompressed_data = |
| 39 | const int bytes_uncompressed = | 40 | Compression::DecompressDataLZ4(compressed_data, header.size); |
| 40 | LZ4_decompress_safe(reinterpret_cast<const char*>(compressed_data.data()), | 41 | |
| 41 | reinterpret_cast<char*>(uncompressed_data.data()), | 42 | ASSERT_MSG(uncompressed_data.size() == static_cast<int>(header.size), |
| 42 | static_cast<int>(compressed_data.size()), header.size); | 43 | "{} != {}", header.size, uncompressed_data.size()); |
| 43 | |||
| 44 | ASSERT_MSG(bytes_uncompressed == static_cast<int>(header.size) && | ||
| 45 | bytes_uncompressed == static_cast<int>(uncompressed_data.size()), | ||
| 46 | "{} != {} != {}", bytes_uncompressed, header.size, uncompressed_data.size()); | ||
| 47 | 44 | ||
| 48 | return uncompressed_data; | 45 | return uncompressed_data; |
| 49 | } | 46 | } |