(HG2): recognize older version.

This commit is contained in:
morkt 2018-10-08 08:45:12 +04:00
parent f492b60af3
commit 1bdbaf714a

View File

@ -48,11 +48,13 @@ namespace GameRes.Formats.CatSystem
{ {
stream.Position = 8; stream.Position = 8;
var info = new Hg2MetaData(); var info = new Hg2MetaData();
int type = stream.ReadInt32(); int version = stream.ReadInt32();
if (0x25 == type) if (0x25 == version)
info.HeaderSize = 0x58; info.HeaderSize = 0x58;
else if (0x20 == type) else if (0x20 == version)
info.HeaderSize = 0x50; info.HeaderSize = 0x50;
else if (0x10 == version)
info.HeaderSize = 0x30;
else else
return null; return null;
info.Width = stream.ReadUInt32(); info.Width = stream.ReadUInt32();
@ -63,11 +65,14 @@ namespace GameRes.Formats.CatSystem
info.DataUnpacked = stream.ReadInt32(); info.DataUnpacked = stream.ReadInt32();
info.CtlPacked = stream.ReadInt32(); info.CtlPacked = stream.ReadInt32();
info.CtlUnpacked = stream.ReadInt32(); info.CtlUnpacked = stream.ReadInt32();
if (info.HeaderSize > 0x30)
{
stream.Seek (8, SeekOrigin.Current); stream.Seek (8, SeekOrigin.Current);
info.CanvasWidth = stream.ReadUInt32(); info.CanvasWidth = stream.ReadUInt32();
info.CanvasHeight = stream.ReadUInt32(); info.CanvasHeight = stream.ReadUInt32();
info.OffsetX = stream.ReadInt32(); info.OffsetX = stream.ReadInt32();
info.OffsetY = stream.ReadInt32(); info.OffsetY = stream.ReadInt32();
}
return info; return info;
} }