static ThumbnailHeader LoadHeader(BinaryReader reader)
{
var header = new ThumbnailHeader();
header.Type = ScummHelper.SwapBytes(reader.ReadUInt32());
// We also accept the bad 'BMHT' header here, for the sake of compatibility
// with some older savegames which were written incorrectly due to a bug in
// ScummVM which wrote the thumb header type incorrectly on LE systems.
if (header.Type != ScummHelper.MakeTag('T', 'H', 'M', 'B') && header.Type != ScummHelper.MakeTag('B', 'M', 'H', 'T'))
{
//if (outputWarnings)
// warning("couldn't find thumbnail header type");
return null;
}
header.Size = ScummHelper.SwapBytes(reader.ReadUInt32());
header.Version = reader.ReadByte();
if (header.Version > TumbnailVersion)
{
//if (outputWarnings)
// warning("trying to load a newer thumbnail version: %d instead of %d", header.version, THMB_VERSION);
return null;
}
header.Width = ScummHelper.SwapBytes(reader.ReadUInt16());
header.Height = ScummHelper.SwapBytes(reader.ReadUInt16());
header.Bpp = reader.ReadByte();
return header;
}