diff options
| author | 2019-04-03 21:50:29 -0400 | |
|---|---|---|
| committer | 2019-04-03 21:50:29 -0400 | |
| commit | d6374b25224e0542fa93612914fdd0bf02432a5b (patch) | |
| tree | 99ce7c0918ccd7b9b35d0e5d8172244866472e83 /src/core | |
| parent | Merge pull request #2299 from lioncash/maxwell (diff) | |
| parent | gl_shader_disk_cache: Use LZ4HC with compression level 9 instead of compressi... (diff) | |
| download | yuzu-d6374b25224e0542fa93612914fdd0bf02432a5b.tar.gz yuzu-d6374b25224e0542fa93612914fdd0bf02432a5b.tar.xz yuzu-d6374b25224e0542fa93612914fdd0bf02432a5b.zip | |
Merge pull request #2093 from FreddyFunk/disk-cache-better-compression
Better LZ4 compression utilization for the disk based shader cache and the yuzu build system
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/loader/nso.cpp | 17 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 9e23afe85..c59107102 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -458,7 +458,7 @@ add_library(core STATIC | |||
| 458 | create_target_directory_groups(core) | 458 | create_target_directory_groups(core) |
| 459 | 459 | ||
| 460 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) | 460 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) |
| 461 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt lz4_static mbedtls opus unicorn open_source_archives) | 461 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt mbedtls opus unicorn open_source_archives) |
| 462 | if (ENABLE_WEB_SERVICE) | 462 | if (ENABLE_WEB_SERVICE) |
| 463 | target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE) | 463 | target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE) |
| 464 | target_link_libraries(core PRIVATE web_service) | 464 | target_link_libraries(core PRIVATE web_service) |
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 @@ | |||
| 4 | 4 | ||
| 5 | #include <cinttypes> | 5 | #include <cinttypes> |
| 6 | #include <vector> | 6 | #include <vector> |
| 7 | #include <lz4.h> | 7 | |
| 8 | #include "common/common_funcs.h" | 8 | #include "common/common_funcs.h" |
| 9 | #include "common/file_util.h" | 9 | #include "common/file_util.h" |
| 10 | #include "common/hex_util.h" | 10 | #include "common/hex_util.h" |
| 11 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 12 | #include "common/lz4_compression.h" | ||
| 12 | #include "common/swap.h" | 13 | #include "common/swap.h" |
| 13 | #include "core/core.h" | 14 | #include "core/core.h" |
| 14 | #include "core/file_sys/patch_manager.h" | 15 | #include "core/file_sys/patch_manager.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 | Common::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), "{} != {}", header.size, |
| 42 | static_cast<int>(compressed_data.size()), header.size); | 43 | 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 | } |