mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(MCG): some images have size field set to zero.
This commit is contained in:
@@ -82,6 +82,7 @@ namespace GameRes.Formats.FC01
|
|||||||
int bpp = header.ToInt32 (0x24);
|
int bpp = header.ToInt32 (0x24);
|
||||||
if (24 != bpp && 8 != bpp)
|
if (24 != bpp && 8 != bpp)
|
||||||
throw new NotSupportedException ("Not supported MCG image bitdepth");
|
throw new NotSupportedException ("Not supported MCG image bitdepth");
|
||||||
|
int packed_size = header.ToInt32 (0x38);
|
||||||
return new McgMetaData
|
return new McgMetaData
|
||||||
{
|
{
|
||||||
Width = header.ToUInt32 (0x1c),
|
Width = header.ToUInt32 (0x1c),
|
||||||
@@ -90,7 +91,7 @@ namespace GameRes.Formats.FC01
|
|||||||
OffsetY = header.ToInt32 (0x18),
|
OffsetY = header.ToInt32 (0x18),
|
||||||
BPP = bpp,
|
BPP = bpp,
|
||||||
DataOffset = header_size,
|
DataOffset = header_size,
|
||||||
PackedSize = header.ToInt32 (0x38) - header_size,
|
PackedSize = packed_size,
|
||||||
Version = version,
|
Version = version,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -187,6 +188,9 @@ namespace GameRes.Formats.FC01
|
|||||||
{
|
{
|
||||||
m_file.Position = m_info.DataOffset;
|
m_file.Position = m_info.DataOffset;
|
||||||
int input_size = m_info.PackedSize;
|
int input_size = m_info.PackedSize;
|
||||||
|
if (0 == input_size)
|
||||||
|
input_size = (int)m_file.Length;
|
||||||
|
input_size -= m_info.DataOffset;
|
||||||
if (8 == m_info.BPP)
|
if (8 == m_info.BPP)
|
||||||
{
|
{
|
||||||
Palette = ImageFormat.ReadPalette (m_file.AsStream);
|
Palette = ImageFormat.ReadPalette (m_file.AsStream);
|
||||||
|
|||||||
Reference in New Issue
Block a user