From 13f53affbb048905ae945c7230c30aa791081110 Mon Sep 17 00:00:00 2001 From: morkt Date: Sun, 1 Oct 2017 17:59:31 +0400 Subject: [PATCH] (Csystem): workaround for some incremental images. --- ArcFormats/Cyberworks/ImageTINK.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ArcFormats/Cyberworks/ImageTINK.cs b/ArcFormats/Cyberworks/ImageTINK.cs index 774e5901..b806d8b1 100644 --- a/ArcFormats/Cyberworks/ImageTINK.cs +++ b/ArcFormats/Cyberworks/ImageTINK.cs @@ -173,7 +173,7 @@ namespace GameRes.Formats.Cyberworks if (unpacked_size <= 0) { if (0 == unpacked_size && 0 == header[6] - && (1 == (flags & 1) && 'd' == m_type && Baseline != null)) + && (1 == (flags & 1) && Baseline != null)) { UnpackV6NoAlpha (bits_size); return; @@ -409,20 +409,24 @@ namespace GameRes.Formats.Cyberworks void UnpackV6NoAlpha (int bits_size) { - Info.BPP = 32; var rgb_map = m_input.ReadBytes (bits_size); int plane_size = Math.Min (Baseline.Length, bits_size*8); m_output = Baseline; + if (m_info.Width * m_info.Height * 3 == m_output.Length) + Info.BPP = 24; + else + Info.BPP = 32; int bit = 1; int bit_src = 0; int dst = 0; + int pixel_size = Info.BPP / 8; for (int i = 0; i < plane_size; ++i) { if ((bit & rgb_map[bit_src]) != 0) { m_input.Read (m_output, dst, 3); } - dst += 4; + dst += pixel_size; bit <<= 1; if (0x100 == bit) {