From df15daebf0df1994a0644710d2abc0512348395a Mon Sep 17 00:00:00 2001 From: morkt Date: Sat, 11 Mar 2017 11:37:22 +0400 Subject: [PATCH] (ags): green background by default. --- ArcFormats/AnimeGameSystem/ArcANI.cs | 3 +-- ArcFormats/AnimeGameSystem/ImageAinos.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ArcFormats/AnimeGameSystem/ArcANI.cs b/ArcFormats/AnimeGameSystem/ArcANI.cs index e2a4b297..ffbf97ef 100644 --- a/ArcFormats/AnimeGameSystem/ArcANI.cs +++ b/ArcFormats/AnimeGameSystem/ArcANI.cs @@ -147,10 +147,9 @@ namespace GameRes.Formats.Ags } } var input = arc.File.CreateStream (entry.Offset, entry.Size); - CgMetaData info = null; try { - info = Cg.ReadMetaData (input) as CgMetaData; + var info = Cg.ReadMetaData (input) as CgMetaData; if (null == info) throw new InvalidFormatException(); return new CgFormat.Reader (input, info, key_frame); diff --git a/ArcFormats/AnimeGameSystem/ImageAinos.cs b/ArcFormats/AnimeGameSystem/ImageAinos.cs index 896a2221..6851cfea 100644 --- a/ArcFormats/AnimeGameSystem/ImageAinos.cs +++ b/ArcFormats/AnimeGameSystem/ImageAinos.cs @@ -129,7 +129,7 @@ namespace GameRes.Formats.Ags m_top = info.OffsetY; m_right = info.Right == 0 ? m_width : info.Right; m_bottom = info.Bottom == 0 ? m_height : info.Bottom; - m_output = base_image ?? new byte[3*m_width*m_height]; + m_output = base_image ?? CreateBackground(); m_input = file; Info = info; ShiftTable = InitShiftTable(); @@ -159,6 +159,14 @@ namespace GameRes.Formats.Ags return table; } + private byte[] CreateBackground () + { + var bg = new byte[3*m_width*m_height]; + for (int i = 1; i < bg.Length; i += 3) + bg[i] = 0xFF; + return bg; + } + public void Unpack () { if (0 != (m_type & 0x10))