From b3f5195a9ad93cb08bc86cb3f15f7521331b859a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20=C5=9Apiewak?= Date: Mon, 15 Jul 2024 14:20:17 +0200 Subject: [PATCH] Ensure that DXA is not "decrypted" when not needed. --- ArcFormats/DxLib/ArcDX8.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ArcFormats/DxLib/ArcDX8.cs b/ArcFormats/DxLib/ArcDX8.cs index 1a009819..36e8eacc 100644 --- a/ArcFormats/DxLib/ArcDX8.cs +++ b/ArcFormats/DxLib/ArcDX8.cs @@ -90,14 +90,18 @@ namespace GameRes.Formats.DxLib //TODO: Ask for key here. var key = DefaultKey; - if ((dx.Flags & DXA8Flags.DXA_FLAG_NO_HEAD_PRESS) != 0) + if ((dx.Flags & DXA8Flags.DXA_FLAG_NO_KEY) == 0) { - var index = file.View.ReadBytes(dx.IndexOffset, dx.IndexSize); - Decrypt(index, 0, index.Length, 0, key); - } else - { - //input is compressed. First by huffman then by LZ. if it's also encrypted then we're stuck. - throw new NotImplementedException(); + if ((dx.Flags & DXA8Flags.DXA_FLAG_NO_HEAD_PRESS) != 0) + { + var index = file.View.ReadBytes(dx.IndexOffset, dx.IndexSize); + Decrypt(index, 0, index.Length, 0, key); + } + else + { + //input is compressed. First by huffman then by LZ. if it's also encrypted then we're stuck. + throw new NotImplementedException(); + } } // decrypt-2 // decompress