mirror of
https://github.com/yuzu-emu/yuzu-mainline
synced 2024-11-23 21:53:41 +00:00
core: Do not link LZ4 to core. Use common/data_compression for nso segment decompression instead.
This commit is contained in:
parent
74cee1b65d
commit
6a1a2d4aa5
2 changed files with 7 additions and 10 deletions
|
@ -458,7 +458,7 @@ add_library(core STATIC
|
||||||
create_target_directory_groups(core)
|
create_target_directory_groups(core)
|
||||||
|
|
||||||
target_link_libraries(core PUBLIC common PRIVATE audio_core video_core)
|
target_link_libraries(core PUBLIC common PRIVATE audio_core video_core)
|
||||||
target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt lz4_static mbedtls opus unicorn open_source_archives)
|
target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt mbedtls opus unicorn open_source_archives)
|
||||||
if (ENABLE_WEB_SERVICE)
|
if (ENABLE_WEB_SERVICE)
|
||||||
target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE)
|
target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE)
|
||||||
target_link_libraries(core PRIVATE web_service)
|
target_link_libraries(core PRIVATE web_service)
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <lz4.h>
|
|
||||||
|
#include "common/data_compression.h"
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "common/hex_util.h"
|
#include "common/hex_util.h"
|
||||||
|
@ -35,15 +36,11 @@ static_assert(sizeof(MODHeader) == 0x1c, "MODHeader has incorrect size.");
|
||||||
|
|
||||||
std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
|
std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
|
||||||
const NSOSegmentHeader& header) {
|
const NSOSegmentHeader& header) {
|
||||||
std::vector<u8> uncompressed_data(header.size);
|
const std::vector<u8> uncompressed_data =
|
||||||
const int bytes_uncompressed =
|
Compression::DecompressDataLZ4(compressed_data, header.size);
|
||||||
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) &&
|
ASSERT_MSG(uncompressed_data.size() == static_cast<int>(header.size),
|
||||||
bytes_uncompressed == static_cast<int>(uncompressed_data.size()),
|
"{} != {}", header.size, uncompressed_data.size());
|
||||||
"{} != {} != {}", bytes_uncompressed, header.size, uncompressed_data.size());
|
|
||||||
|
|
||||||
return uncompressed_data;
|
return uncompressed_data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue