From d2a22fa2fbb0687e8965bf19cbf6caf4fc1824e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20=C5=9Apiewak?= Date: Wed, 14 Aug 2024 18:30:45 +0200 Subject: [PATCH] Update ArcDX8.cs We already read the entry to the array. Don't attempt to read twice. Or in other words, just copy from the prepared array. --- ArcFormats/DxLib/ArcDX8.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ArcFormats/DxLib/ArcDX8.cs b/ArcFormats/DxLib/ArcDX8.cs index 9e3e8b60..45b46528 100644 --- a/ArcFormats/DxLib/ArcDX8.cs +++ b/ArcFormats/DxLib/ArcDX8.cs @@ -178,7 +178,7 @@ namespace GameRes.Formats.DxLib entries = reader.Read(); } return new DxArchive8(file, this,entries ,key, 8,dx.HuffmanKB); - //return null; + //retu rn null; } public override Stream OpenEntry(ArcFile arc, Entry entry) @@ -188,7 +188,7 @@ namespace GameRes.Formats.DxLib if (null == dx_arc) return input; var dx_ent = (DXA8PackedEntry)entry; - long dec_offset = dx_ent.UnpackedSize; //is this still right? + long dec_offset = dx_ent.UnpackedSize; var key = dx_arc.Encryption.GetEntryKey(dx_ent.Name); input = new EncryptedStream(input, dec_offset, key); if (!dx_ent.HuffmanCompressed && !dx_ent.IsPacked) @@ -212,7 +212,7 @@ namespace GameRes.Formats.DxLib Array.Copy(partTmpBuffer,0, outBuffer, 0,dx_arc.huffmanMaxKB*1024); Array.Copy(partTmpBuffer,dx_arc.huffmanMaxKB*1024,outBuffer,outBuffer.Length-dx_arc.huffmanMaxKB*1024,dx_arc.huffmanMaxKB*1024); //uncompressed part goes into middle. - input.Read(outBuffer, dx_arc.huffmanMaxKB * 1024, outBuffer.Length-dx_arc.huffmanMaxKB*1024*2); + Array.Copy(tmpBuffer, dx_ent.HuffmanSize, outBuffer, dx_arc.huffmanMaxKB * 1024, outBufSize - dx_arc.huffmanMaxKB * 1024 * 2); tmpBuffer = outBuffer; } else {