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:
morkt
2023-10-11 18:38:23 +04:00
parent e4e85fe879
commit 1b585ea30e
11 changed files with 872 additions and 40 deletions

View File

@@ -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;