(PBM): workaround for cropped images.

This commit is contained in:
morkt
2018-10-30 23:52:43 +04:00
parent f589269a2e
commit 30a8e741e7

View File

@@ -41,7 +41,7 @@ namespace GameRes.Formats.Nekopunch
if (!file.Name.HasExtension (".pbm")) if (!file.Name.HasExtension (".pbm"))
return null; return null;
var header = file.ReadHeader (8); var header = file.ReadHeader (8);
if (!header.AsciiEqual (5, "BM")) if ((header[4] & 7) != 7 || !header.AsciiEqual (5, "BM"))
return null; return null;
using (var bmp = OpenBitmapStream (file, header.ToUInt32 (0))) using (var bmp = OpenBitmapStream (file, header.ToUInt32 (0)))
return Bmp.ReadMetaData (bmp); return Bmp.ReadMetaData (bmp);
@@ -57,7 +57,7 @@ namespace GameRes.Formats.Nekopunch
{ {
file.Position = 4; file.Position = 4;
Stream input = new LzssStream (file.AsStream, LzssMode.Decompress, true); Stream input = new LzssStream (file.AsStream, LzssMode.Decompress, true);
input = new LimitStream (input, unpacked_size); input = new LimitStream (input, unpacked_size, StreamOption.Fill);
return new BinaryStream (input, file.Name); return new BinaryStream (input, file.Name);
} }