(WBP): added 'ARCFORM2' archives.

This commit is contained in:
morkt 2016-09-07 20:29:43 +04:00
parent 7c5b26933a
commit 1139034b2f

View File

@ -41,12 +41,11 @@ namespace GameRes.Formats.WildBug
public override ArcFile TryOpen (ArcView file) public override ArcFile TryOpen (ArcView file)
{ {
int version; if (!file.View.AsciiEqual (0, "ARCFORM") ||
if (file.View.AsciiEqual (0, "ARCFORM3 WBUG ")) !file.View.AsciiEqual (8, " WBUG "))
version = 3; return null;
else if (file.View.AsciiEqual (0, "ARCFORM4 WBUG ")) int version = file.View.ReadByte (7) - '0';
version = 4; if (version < 2 || version > 4)
else
return null; return null;
int count = file.View.ReadInt32 (0x10); int count = file.View.ReadInt32 (0x10);
if (!IsSaneCount (count)) if (!IsSaneCount (count))
@ -59,10 +58,10 @@ namespace GameRes.Formats.WildBug
if (index_size > file.View.Reserve (index_offset, index_size)) if (index_size > file.View.Reserve (index_offset, index_size))
return null; return null;
if (3 == version) if (4 == version)
return OpenV3 (file, count, index_offset);
else
return OpenV4 (file, count, index_offset, index_size); return OpenV4 (file, count, index_offset, index_size);
else
return OpenV3 (file, count, index_offset);
} }
ArcFile OpenV3 (ArcView file, int count, uint index_offset) ArcFile OpenV3 (ArcView file, int count, uint index_offset)