mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
updated formats.
(PICT): fixed 16bpp images. (GDT): added image format. (DXR): tweaks to recognizing DXR inside exe files. (NSA): recognize mp3 files named as nsa. (TLZ): added ContainedFormats. (WrapSingleFileAchive): class that represents single file as an archive. (DesertCgOPener): Software House Parsley archive. (Triangle.RleReader): utilize UnpackV2, replaced BinaryReader with IBinaryStream.
This commit is contained in:
@@ -294,8 +294,10 @@ namespace GameRes.Formats.Apple
|
||||
byte[] RepackPixels (Pixmap pixmap)
|
||||
{
|
||||
int bpp = m_info.BPP;
|
||||
if (bpp <= 16)
|
||||
if (bpp < 16)
|
||||
return m_buffer;
|
||||
else if (16 == bpp)
|
||||
return Repack16bpp();
|
||||
int bytes_per_pixel = bpp / 8;
|
||||
int stride = m_info.iWidth * bytes_per_pixel;
|
||||
var pixels = new byte[stride * m_info.iHeight];
|
||||
@@ -326,6 +328,17 @@ namespace GameRes.Formats.Apple
|
||||
return pixels;
|
||||
}
|
||||
|
||||
byte[] Repack16bpp () // swap 16bit pixels to little-endian order
|
||||
{
|
||||
for (int p = 1; p < m_buffer.Length; p += 2)
|
||||
{
|
||||
byte b = m_buffer[p-1];
|
||||
m_buffer[p-1] = m_buffer[p];
|
||||
m_buffer[p] = b;
|
||||
}
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
void SetFormat (Pixmap pixmap)
|
||||
{
|
||||
int bpp = null == pixmap ? 8 : pixmap.BPP;
|
||||
|
||||
Reference in New Issue
Block a user