From f01f4909b472ceaa427525aded10e8ee29cbf740 Mon Sep 17 00:00:00 2001 From: morkt Date: Thu, 19 Jan 2017 23:46:23 +0400 Subject: [PATCH] (CHR): use overlay alpha channel. --- ArcFormats/GameSystem/ArcCHR.cs | 5 +++-- ArcFormats/GameSystem/ImageCHR.cs | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ArcFormats/GameSystem/ArcCHR.cs b/ArcFormats/GameSystem/ArcCHR.cs index ee7ed26e..4d1c026e 100644 --- a/ArcFormats/GameSystem/ArcCHR.cs +++ b/ArcFormats/GameSystem/ArcCHR.cs @@ -133,8 +133,9 @@ namespace GameRes.Formats.GameSystem int stride = (int)Info.Width * 4; var pixels = new byte[stride * (int)Info.Height]; m_input.Read (pixels, 0, pixels.Length); - return ImageData.CreateFlipped (Info, PixelFormats.Bgr32, null, pixels, stride); - + for (int i = 3; i < pixels.Length; i += 4) + pixels[i] = (byte)(pixels[i] * 0xFF / 0x80); + return ImageData.CreateFlipped (Info, PixelFormats.Bgra32, null, pixels, stride); } } } diff --git a/ArcFormats/GameSystem/ImageCHR.cs b/ArcFormats/GameSystem/ImageCHR.cs index ffe5b621..cf3f196f 100644 --- a/ArcFormats/GameSystem/ImageCHR.cs +++ b/ArcFormats/GameSystem/ImageCHR.cs @@ -181,9 +181,7 @@ namespace GameRes.Formats.GameSystem { m_input.Read (m_output, dst, 3); int a = m_input.ReadByte(); - if (a != 0x80) - throw new InvalidFormatException ("Error reading overlay frame"); - m_output[dst+3] = 0xFF; + m_output[dst+3] = (byte)(a * 0xFF / 0x80); dst += 4; } output += m_stride;