From 259426661d29e6dc3cfd656100dfa9be39128161 Mon Sep 17 00:00:00 2001 From: morkt Date: Tue, 26 Dec 2017 19:59:28 +0400 Subject: [PATCH] (DetBmpFormat): additional image signatures. --- ArcFormats/uGOS/ImageBMP.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ArcFormats/uGOS/ImageBMP.cs b/ArcFormats/uGOS/ImageBMP.cs index ebbaa455..23dde532 100644 --- a/ArcFormats/uGOS/ImageBMP.cs +++ b/ArcFormats/uGOS/ImageBMP.cs @@ -31,6 +31,11 @@ using System.Windows.Media; namespace GameRes.Formats.uGOS { + internal class DetBmpMetaData : ImageMetaData + { + public int Method; + } + [Export(typeof(ImageFormat))] public class DetBmpFormat : ImageFormat { @@ -41,17 +46,26 @@ namespace GameRes.Formats.uGOS public DetBmpFormat () { Extensions = new string[] { "bmp" }; - Signatures = new uint[] { 0x206546, 0x186546 }; + Signatures = new uint[] { 0x206546, 0x186546, 0x01186446, 0 }; } public override ImageMetaData ReadMetaData (IBinaryStream stream) { var header = stream.ReadHeader (0x10); - return new ImageMetaData + if (header[0] != 'F') + return null; + var type = header[1] & 0x5F; + if (type != 'D' && type != 'E') + return null; + int bpp = header[2]; + if (bpp != 0x18 && bpp != 0x20) + return null; + return new DetBmpMetaData { Width = header.ToUInt16 (4), Height = header.ToUInt16 (6), - BPP = header[2], + BPP = bpp, + Method = type, }; }