(GRP): added 'zfd' compression.

This commit is contained in:
morkt 2023-10-27 04:06:23 +04:00
parent 1aac79f7b5
commit 05ab3e2600

View File

@ -118,6 +118,12 @@ namespace GameRes.Formats.Ankh
entry.UnpackedSize = header.ToUInt32 (0); entry.UnpackedSize = header.ToUInt32 (0);
entry.IsPacked = true; entry.IsPacked = true;
} }
else if (header.AsciiEqual (0, "zfd "))
{
entry.ChangeType (ImageFormat.Tga);
entry.UnpackedSize = header.ToUInt32 (4);
entry.IsPacked = true;
}
else if (header.AsciiEqual (4, "OggS")) else if (header.AsciiEqual (4, "OggS"))
{ {
entry.ChangeType (OggAudio.Instance); entry.ChangeType (OggAudio.Instance);
@ -177,6 +183,8 @@ namespace GameRes.Formats.Ankh
return OpenTpw (arc, pent); return OpenTpw (arc, pent);
if (arc.File.View.AsciiEqual (entry.Offset+4, "HDJ\0")) if (arc.File.View.AsciiEqual (entry.Offset+4, "HDJ\0"))
return OpenImage (arc, pent); return OpenImage (arc, pent);
if (arc.File.View.AsciiEqual (entry.Offset, "zfd "))
return OpenZfd (arc, pent);
if (entry.Size > 12) if (entry.Size > 12)
{ {
byte type = arc.File.View.ReadByte (entry.Offset+4); byte type = arc.File.View.ReadByte (entry.Offset+4);
@ -243,6 +251,12 @@ namespace GameRes.Formats.Ankh
} }
} }
Stream OpenZfd (ArcFile arc, PackedEntry entry)
{
var input = arc.File.CreateStream (entry.Offset+8, entry.Size-8);
return new ZLibStream (input, CompressionMode.Decompress);
}
internal static void UnpackTpw (IBinaryStream input, byte[] output) internal static void UnpackTpw (IBinaryStream input, byte[] output)
{ {
input.Position = 8; input.Position = 8;