From f8286bc2a0772b9a7b825f7d14f8fae8a7a19892 Mon Sep 17 00:00:00 2001 From: morkt Date: Wed, 20 Mar 2019 13:35:07 +0400 Subject: [PATCH] (origin): support old images format. --- ArcFormats/Origin/ArcDAT.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ArcFormats/Origin/ArcDAT.cs b/ArcFormats/Origin/ArcDAT.cs index 12873890..461132e0 100644 --- a/ArcFormats/Origin/ArcDAT.cs +++ b/ArcFormats/Origin/ArcDAT.cs @@ -221,13 +221,20 @@ namespace GameRes.Formats.Origin int w = m_input.ReadInt32(); int h = m_input.ReadInt32(); int method = m_input.ReadByte(); - if (w == m_width && h == m_height && (1 == method || 2 == method)) + if (w == m_width && h == m_height) { alpha = new byte[plane_length]; if (1 == method) UnpackRle (alpha); - else + else if (2 == method) UnpackAlphaV2 (alpha); + else + { + m_input.Seek (-1, SeekOrigin.Current); + UnpackRle (alpha); + for (int i = 0; i < alpha.Length; ++i) + alpha[i] = (byte)(alpha[i] * 0xFF / 0x64); + } pixel_size = 4; } }