fixed some IBinaryStream migration aftermath.

This commit is contained in:
morkt 2017-01-02 21:06:05 +04:00
parent 8ff76d59d6
commit 77dc85f5be
4 changed files with 4 additions and 1 deletions

View File

@ -47,6 +47,7 @@ namespace GameRes.Formats.Cri
uint unpacked_size = stream.Signature;
if (unpacked_size <= 0x20 || unpacked_size > 0x5000000) // ~83MB
return null;
stream.Position = 4;
using (var lzss = new LzssStream (stream.AsStream, LzssMode.Decompress, true))
using (var input = new SeekableStream (lzss))
using (var xtx = new BinaryStream (input, stream.Name))

View File

@ -69,6 +69,7 @@ namespace GameRes.Formats.Ikura
case 0x48474948: bpp = 16; break;
default: return null;
}
stream.Position = 4;
uint width = stream.ReadUInt16();
uint height = stream.ReadUInt16();
return new ImageMetaData {

View File

@ -51,7 +51,7 @@ namespace GameRes.Formats.Unknown
public override ImageMetaData ReadMetaData (IBinaryStream stream)
{
int signature = (int)~stream.Signature;
int signature = ~stream.ReadInt32();
int mode = (signature & 0x70) >> 4; // v6
if (0 != (mode & 4))
return null;

View File

@ -44,6 +44,7 @@ namespace GameRes.Formats.Ivory
uint height = wh >> 16;
if (0 == width || width > 800 || 0 == height || height > 600)
return null;
stream.Position = 4;
if (!IsValidInput (stream.AsStream, width, height))
return null;
return new ImageMetaData { Width = width, Height = height, BPP = 24 };