From cba110ae1c75fb8e3b051980520c89aa11bc3ee9 Mon Sep 17 00:00:00 2001 From: morkt Date: Sun, 25 Dec 2016 15:58:09 +0400 Subject: [PATCH] (NpkWriter): don't compress small segments. --- ArcFormats/NitroPlus/ArcNPK.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ArcFormats/NitroPlus/ArcNPK.cs b/ArcFormats/NitroPlus/ArcNPK.cs index 625100a5..2d7aaa0e 100644 --- a/ArcFormats/NitroPlus/ArcNPK.cs +++ b/ArcFormats/NitroPlus/ArcNPK.cs @@ -385,9 +385,10 @@ namespace GameRes.Formats.NitroPlus for (int i = 0; i < segment_count; ++i) { int chunk_size = (int)Math.Min (m_remaining, segment_size); + bool should_compress = m_entry.IsPacked && chunk_size > 2; var file_pos = m_input.Position; - var segment = WriteSegment (chunk_size, m_entry.IsPacked); - if (m_entry.IsPacked && !segment.IsCompressed) + var segment = WriteSegment (chunk_size, should_compress); + if (should_compress && !segment.IsCompressed) { // compressed segment is larger than uncompressed, rewrite m_input.Position = file_pos;