mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 21:55:34 +08:00
(NpkWriter): don't compress small segments.
This commit is contained in:
parent
53129e43ba
commit
cba110ae1c
@ -385,9 +385,10 @@ namespace GameRes.Formats.NitroPlus
|
|||||||
for (int i = 0; i < segment_count; ++i)
|
for (int i = 0; i < segment_count; ++i)
|
||||||
{
|
{
|
||||||
int chunk_size = (int)Math.Min (m_remaining, segment_size);
|
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 file_pos = m_input.Position;
|
||||||
var segment = WriteSegment (chunk_size, m_entry.IsPacked);
|
var segment = WriteSegment (chunk_size, should_compress);
|
||||||
if (m_entry.IsPacked && !segment.IsCompressed)
|
if (should_compress && !segment.IsCompressed)
|
||||||
{
|
{
|
||||||
// compressed segment is larger than uncompressed, rewrite
|
// compressed segment is larger than uncompressed, rewrite
|
||||||
m_input.Position = file_pos;
|
m_input.Position = file_pos;
|
||||||
|
Loading…
Reference in New Issue
Block a user