mirror of
https://github.com/xavo95/repak.git
synced 2025-02-22 15:53:45 +00:00
Increase compression block size
This commit is contained in:
parent
aaa16b7800
commit
71d0664474
2 changed files with 6 additions and 1 deletions
|
@ -153,7 +153,7 @@ where
|
||||||
Some(compression) => {
|
Some(compression) => {
|
||||||
// https://github.com/EpicGames/UnrealEngine/commit/3aad0ff7976be1073005dca2c1282af548b45d89
|
// https://github.com/EpicGames/UnrealEngine/commit/3aad0ff7976be1073005dca2c1282af548b45d89
|
||||||
// Block size must fit into flags field or it may cause unreadable paks for earlier Unreal Engine versions
|
// Block size must fit into flags field or it may cause unreadable paks for earlier Unreal Engine versions
|
||||||
compression_block_size = 0x10000;
|
compression_block_size = 0x3e << 11; // max possible block size
|
||||||
let mut compressed_size = 0;
|
let mut compressed_size = 0;
|
||||||
let mut blocks = vec![];
|
let mut blocks = vec![];
|
||||||
for chunk in data.as_ref().chunks(compression_block_size as usize) {
|
for chunk in data.as_ref().chunks(compression_block_size as usize) {
|
||||||
|
|
|
@ -282,6 +282,11 @@ impl Entry {
|
||||||
let is_uncompressed_size_32_bit_safe = self.uncompressed <= u32::MAX as u64;
|
let is_uncompressed_size_32_bit_safe = self.uncompressed <= u32::MAX as u64;
|
||||||
let is_offset_32_bit_safe = self.offset <= u32::MAX as u64;
|
let is_offset_32_bit_safe = self.offset <= u32::MAX as u64;
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
compression_blocks_count < 0x10_000,
|
||||||
|
"compression blocks count fits in 16 bits"
|
||||||
|
);
|
||||||
|
|
||||||
let flags = (compression_block_size)
|
let flags = (compression_block_size)
|
||||||
| (compression_blocks_count << 6)
|
| (compression_blocks_count << 6)
|
||||||
| ((self.is_encrypted() as u32) << 22)
|
| ((self.is_encrypted() as u32) << 22)
|
||||||
|
|
Loading…
Reference in a new issue