This commit is contained in:
Sławomir Śpiewak 2024-08-01 11:53:08 +02:00
parent 45e7af60ea
commit beaab0ecee
2 changed files with 5 additions and 4 deletions

View File

@ -271,7 +271,7 @@ namespace GameRes.Formats.DxLib
dx = ReadArcHeaderV6 (file, version, key);
if (null == dx || dx.DirTable >= dx.IndexSize || dx.FileTable >= dx.IndexSize)
return null;
using (var encrypted = file.CreateStream (dx.IndexOffset, dx.IndexSize))
using (var encrypted = file.CreateStream (dx.IndexOffset, (uint)dx.IndexSize))
using (var index = new EncryptedStream (encrypted, version >= 6 ? 0 : dx.IndexOffset, key))
using (var reader = IndexReader.Create (dx, version, index))
{
@ -305,8 +305,8 @@ namespace GameRes.Formats.DxLib
IndexSize = LittleEndian.ToUInt32 (header, 0),
BaseOffset = LittleEndian.ToInt64 (header, 4),
IndexOffset = LittleEndian.ToInt64 (header, 0x0C),
FileTable = (uint)LittleEndian.ToInt64 (header, 0x14),
DirTable = (uint)LittleEndian.ToInt64 (header, 0x1C),
FileTable = LittleEndian.ToInt64 (header, 0x14),
DirTable = LittleEndian.ToInt64 (header, 0x1C),
CodePage = LittleEndian.ToInt32 (header, 0x24),
};
}

View File

@ -153,7 +153,8 @@ namespace GameRes.Formats.DxLib
var readyStr = new MemoryStream(headerBuffer);
ArcView arcView = new ArcView(readyStr, "hdr",(uint)headerBuffer.LongLength);
List<Entry> entries;
using (var indexStr = arcView.CreateStream(0, dx.IndexSize))
//TODO: Try to memmap files with over 4GB.
using (var indexStr = arcView.CreateStream(0, (uint)dx.IndexSize))
using (var reader = IndexReader.Create(dx, 8, indexStr))
{
entries = reader.Read();