mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-25 12:24:12 +08:00
(DatOpener.TryOpen): do not lookup zero signatures.
This commit is contained in:
parent
126e037ac9
commit
d72ed765b3
@ -43,13 +43,13 @@ namespace GameRes.Formats.Ail
|
|||||||
|
|
||||||
public DatOpener ()
|
public DatOpener ()
|
||||||
{
|
{
|
||||||
Extensions = new string[] { "dat" };
|
Extensions = new string[] { "dat", "snl" };
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ArcFile TryOpen (ArcView file)
|
public override ArcFile TryOpen (ArcView file)
|
||||||
{
|
{
|
||||||
int count = file.View.ReadInt32 (0);
|
int count = file.View.ReadInt32 (0);
|
||||||
if (count <= 0 || count > 0xfffff)
|
if (!IsSaneCount (count))
|
||||||
return null;
|
return null;
|
||||||
long offset = 4+count*4;
|
long offset = 4+count*4;
|
||||||
if (offset >= file.MaxOffset)
|
if (offset >= file.MaxOffset)
|
||||||
@ -92,21 +92,22 @@ namespace GameRes.Formats.Ail
|
|||||||
}
|
}
|
||||||
entry.Offset += extra;
|
entry.Offset += extra;
|
||||||
entry.Size -= extra;
|
entry.Size -= extra;
|
||||||
|
uint signature;
|
||||||
if (entry.IsPacked)
|
if (entry.IsPacked)
|
||||||
{
|
{
|
||||||
file.View.Read (entry.Offset, preview, 0, (uint)preview.Length);
|
file.View.Read (entry.Offset, preview, 0, (uint)preview.Length);
|
||||||
using (var input = new MemoryStream (preview))
|
using (var input = new MemoryStream (preview))
|
||||||
{
|
{
|
||||||
LzssUnpack (input, sign_buf);
|
LzssUnpack (input, sign_buf);
|
||||||
uint signature = LittleEndian.ToUInt32 (sign_buf, 0);
|
signature = LittleEndian.ToUInt32 (sign_buf, 0);
|
||||||
SetEntryType (entry, signature);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint signature = file.View.ReadUInt32 (entry.Offset);
|
signature = file.View.ReadUInt32 (entry.Offset);
|
||||||
SetEntryType (entry, signature);
|
|
||||||
}
|
}
|
||||||
|
if (0 != signature)
|
||||||
|
SetEntryType (entry, signature);
|
||||||
}
|
}
|
||||||
return new ArcFile (file, this, dir);
|
return new ArcFile (file, this, dir);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user