implemented "CHERRY PACK 3.0" archives.

This commit is contained in:
morkt
2015-11-22 06:27:09 +04:00
parent 3110f78e6d
commit 5e55256d8e
2 changed files with 13 additions and 5 deletions

View File

@@ -138,13 +138,17 @@ namespace GameRes.Formats.Cherry
public override ArcFile TryOpen (ArcView file)
{
if (!file.View.AsciiEqual (0, "CHERRY PACK 2.0\0"))
if (!file.View.AsciiEqual (0, "CHERRY PACK 2.0\0") &&
!file.View.AsciiEqual (0, "CHERRY PACK 3.0\0"))
return null;
int version = file.View.ReadByte (0xC) - '0';
bool is_compressed = file.View.ReadInt32 (0x10) != 0;
int count = file.View.ReadInt32 (0x14);
long base_offset = file.View.ReadUInt32 (0x18);
bool is_encrypted = false;
while (!IsSaneCount (count) || base_offset >= file.MaxOffset || (!is_compressed && base_offset != (0x1C + count*0x18)))
int min_offset = 0x1C + count * 0x18;
while (!IsSaneCount (count) || base_offset >= file.MaxOffset
|| (2 == version && !is_compressed && base_offset != min_offset))
{
if (is_encrypted)
return null;