use TgaStream.Create where appropriate.

This commit is contained in:
morkt 2015-11-30 03:50:03 +04:00
parent abe08cd457
commit 3a6f30f316
3 changed files with 4 additions and 28 deletions

View File

@ -175,13 +175,7 @@ namespace GameRes.Formats.Ags
using (var reader = new CgFormat.Reader (input, info, key_frame))
{
reader.Unpack();
var header = new byte[0x12];
header[2] = 2;
LittleEndian.Pack ((ushort)info.Width, header, 0xc);
LittleEndian.Pack ((ushort)info.Height, header, 0xe);
header[0x10] = 24;
header[0x11] = 0x20;
return new PrefixStream (header, new MemoryStream (reader.Data));
return TgaStream.Create (info, reader.Data);
}
}

View File

@ -65,7 +65,7 @@ namespace GameRes.Formats.CatSystem
offset += section_size;
++i;
}
if (dir.Count < 2)
if (dir.Count < 1)
return null;
return new ArcFile (file, this, dir);
}
@ -89,16 +89,7 @@ namespace GameRes.Formats.CatSystem
using (var reader = new Hg3Reader (input, info))
{
var pixels = reader.Unpack();
var header = new byte[0x12];
header[2] = 2;
LittleEndian.Pack ((short)info.OffsetX, header, 8);
LittleEndian.Pack ((short)info.OffsetY, header, 0xa);
LittleEndian.Pack ((ushort)info.Width, header, 0xc);
LittleEndian.Pack ((ushort)info.Height, header, 0xe);
header[0x10] = (byte)info.BPP;
if (!reader.Flipped)
header[0x11] = 0x20;
return new PrefixStream (header, new MemoryStream (pixels));
return TgaStream.Create (info, pixels, reader.Flipped);
}
}
}

View File

@ -96,16 +96,7 @@ namespace GameRes.Formats.ShiinaRio
using (var input = arc.File.CreateStream (0, (uint)arc.File.MaxOffset))
using (var reader = new S25Format.Reader (input, info))
{
var pixels = reader.Unpack();
var header = new byte[0x12];
header[2] = 2;
LittleEndian.Pack ((short)info.OffsetX, header, 8);
LittleEndian.Pack ((short)info.OffsetY, header, 0xa);
LittleEndian.Pack ((ushort)info.Width, header, 0xc);
LittleEndian.Pack ((ushort)info.Height, header, 0xe);
header[0x10] = 32;
header[0x11] = 0x20;
return new PrefixStream (header, new MemoryStream (pixels));
return TgaStream.Create (info, reader.Unpack());
}
}
}