(FB): fixed header reading.

This commit is contained in:
morkt 2018-03-21 10:01:56 +04:00
parent 69f87acac4
commit d1766fde01

View File

@ -44,8 +44,8 @@ namespace GameRes.Formats.Akatombo
if (!header.AsciiEqual ("FB")) if (!header.AsciiEqual ("FB"))
return null; return null;
return new ImageMetaData { return new ImageMetaData {
Width = header.ToUInt32 (4), Width = header.ToUInt16 (4),
Height = header.ToUInt32 (6), Height = header.ToUInt16 (6),
BPP = header.ToUInt16 (2), BPP = header.ToUInt16 (2),
}; };
} }
@ -99,7 +99,8 @@ namespace GameRes.Formats.Akatombo
pos = dst + 4 * (pos - m_width); pos = dst + 4 * (pos - m_width);
else else
pos = dst + 4 * (-m_width & -pos) - 4; pos = dst + 4 * (-m_width & -pos) - 4;
Buffer.BlockCopy (m_output, pos, m_output, dst, 4); if (pos >= 0)
Buffer.BlockCopy (m_output, pos, m_output, dst, 4);
} }
m_output[dst ] += ReadDiff(); m_output[dst ] += ReadDiff();
m_output[dst+1] += ReadDiff(); m_output[dst+1] += ReadDiff();