summaryrefslogtreecommitdiffstats
path: root/src/core/loader
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-04-04 03:50:29 +0200
committerGitHub <noreply@github.com>2019-04-04 03:50:29 +0200
commitd6374b25224e0542fa93612914fdd0bf02432a5b (patch)
tree99ce7c0918ccd7b9b35d0e5d8172244866472e83 /src/core/loader
parentMerge pull request #2299 from lioncash/maxwell (diff)
parentgl_shader_disk_cache: Use LZ4HC with compression level 9 instead of compression level 12 for less compression time (diff)
downloadyuzu-d6374b25224e0542fa93612914fdd0bf02432a5b.tar
yuzu-d6374b25224e0542fa93612914fdd0bf02432a5b.tar.gz
yuzu-d6374b25224e0542fa93612914fdd0bf02432a5b.tar.bz2
yuzu-d6374b25224e0542fa93612914fdd0bf02432a5b.tar.lz
yuzu-d6374b25224e0542fa93612914fdd0bf02432a5b.tar.xz
yuzu-d6374b25224e0542fa93612914fdd0bf02432a5b.tar.zst
yuzu-d6374b25224e0542fa93612914fdd0bf02432a5b.zip
Diffstat (limited to 'src/core/loader')
-rw-r--r--src/core/loader/nso.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index babc7e646..ffe2eea8a 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -4,11 +4,12 @@
#include <cinttypes>
#include <vector>
-#include <lz4.h>
+
#include "common/common_funcs.h"
#include "common/file_util.h"
#include "common/hex_util.h"
#include "common/logging/log.h"
+#include "common/lz4_compression.h"
#include "common/swap.h"
#include "core/core.h"
#include "core/file_sys/patch_manager.h"
@@ -35,15 +36,11 @@ static_assert(sizeof(MODHeader) == 0x1c, "MODHeader has incorrect size.");
std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
const NSOSegmentHeader& header) {
- std::vector<u8> uncompressed_data(header.size);
- const int bytes_uncompressed =
- LZ4_decompress_safe(reinterpret_cast<const char*>(compressed_data.data()),
- reinterpret_cast<char*>(uncompressed_data.data()),
- static_cast<int>(compressed_data.size()), header.size);
-
- ASSERT_MSG(bytes_uncompressed == static_cast<int>(header.size) &&
- bytes_uncompressed == static_cast<int>(uncompressed_data.size()),
- "{} != {} != {}", bytes_uncompressed, header.size, uncompressed_data.size());
+ const std::vector<u8> uncompressed_data =
+ Common::Compression::DecompressDataLZ4(compressed_data, header.size);
+
+ ASSERT_MSG(uncompressed_data.size() == static_cast<int>(header.size), "{} != {}", header.size,
+ uncompressed_data.size());
return uncompressed_data;
}