mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-02 18:05:36 +08:00
(GrFormat): handle zero image size field.
This commit is contained in:
parent
664f7ca415
commit
7e4425cb13
@ -57,6 +57,8 @@ namespace GameRes.Formats.Eagls
|
|||||||
int height = LittleEndian.ToInt32 (bmp, 0x16);
|
int height = LittleEndian.ToInt32 (bmp, 0x16);
|
||||||
int bpp = LittleEndian.ToInt16 (bmp, 0x1c);
|
int bpp = LittleEndian.ToInt16 (bmp, 0x1c);
|
||||||
int image_size = LittleEndian.ToInt32 (bmp, 0x22);
|
int image_size = LittleEndian.ToInt32 (bmp, 0x22);
|
||||||
|
if (0 == image_size)
|
||||||
|
image_size = width * height * (bpp / 8);
|
||||||
return new GrMetaData
|
return new GrMetaData
|
||||||
{
|
{
|
||||||
Width = (uint)width,
|
Width = (uint)width,
|
||||||
@ -69,10 +71,7 @@ namespace GameRes.Formats.Eagls
|
|||||||
|
|
||||||
public override ImageData Read (Stream stream, ImageMetaData info)
|
public override ImageData Read (Stream stream, ImageMetaData info)
|
||||||
{
|
{
|
||||||
var meta = info as GrMetaData;
|
var meta = (GrMetaData)info;
|
||||||
if (null == meta)
|
|
||||||
throw new ArgumentException ("GrFormat.Read should be supplied with GrMetaData", "info");
|
|
||||||
|
|
||||||
using (var reader = new LzssReader (stream, (int)stream.Length, meta.UnpackedSize+2))
|
using (var reader = new LzssReader (stream, (int)stream.Length, meta.UnpackedSize+2))
|
||||||
{
|
{
|
||||||
reader.Unpack();
|
reader.Unpack();
|
||||||
|
Loading…
Reference in New Issue
Block a user