Open Xenira opened 2 years ago
Didn't I do this already? (For small files.) Or am I thinking of one of my other game archive programs/scripts?
There is a switch for small files here: https://github.com/panzi/rust-u4pak/blob/7b25c3e1904a7a57ea79733ab77ee6d5f39dc19c/src/pack.rs#L587 Did not see a threshold
Ok, I've added an option for the threshold of files under which they shan't be compressed. See --compression-min-size
Also it now checks if the file didn't shrink after compression and writes the uncompressed file instead in that case. This feature needs testing.
Also it now checks if the file didn't shrink after compression and writes the uncompressed file instead in that case. This feature needs testing.
This is actually what I wanted to do in this issue :)
Yeah, I felt like implementing that. :smile: Do you have any tests with files where you know they grow in size when trying to compress them?
The current files should have a jpg, that is not compressed (need to add a png, to test compression with larger files when I think about it).
UnrealPak does not compress files that can't get much smaller by compressing them. This should also be supported by u4pak, as the compression block overhead inflates the file unnecessarily and extracting compressed resources takes more computation. Also might reduce the size difference noted in #25.
TODO: