diff --git a/ArcFormats/ArcFormats.csproj b/ArcFormats/ArcFormats.csproj
index d43d3753..1e40e8b4 100644
--- a/ArcFormats/ArcFormats.csproj
+++ b/ArcFormats/ArcFormats.csproj
@@ -81,6 +81,8 @@
+
+
@@ -481,7 +483,9 @@
-
+
+
+ perl "$(SolutionDir)inc-revision.pl" "$(ProjectPath)" $(ConfigurationName)
diff --git a/ArcFormats/Nags/ArcNFS.cs b/ArcFormats/Nags/ArcNFS.cs
new file mode 100644
index 00000000..417bc303
--- /dev/null
+++ b/ArcFormats/Nags/ArcNFS.cs
@@ -0,0 +1,89 @@
+//! \file ArcNFS.cs
+//! \date Sun Nov 08 15:56:33 2015
+//! \brief NA Game System resource archive.
+//
+// Copyright (C) 2015 by morkt
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.IO;
+using System.Security.Cryptography;
+using GameRes.Utility;
+
+namespace GameRes.Formats.Nags
+{
+ [Export(typeof(ArchiveFormat))]
+ public class NfsOpener : ArchiveFormat
+ {
+ public override string Tag { get { return "NFS"; } }
+ public override string Description { get { return "NAGS engine resource archive"; } }
+ public override uint Signature { get { return 0; } }
+ public override bool IsHierarchic { get { return false; } }
+ public override bool CanCreate { get { return false; } }
+
+ public override ArcFile TryOpen (ArcView file)
+ {
+ int count = file.View.ReadInt32 (0);
+ if (!IsSaneCount (count))
+ return null;
+
+ uint index_size = (uint)count * 0x20;
+ if (index_size > file.View.Reserve (4, (uint)index_size))
+ return null;
+ int first_offset = file.View.ReadInt32 (0x1C);
+ byte key = (byte)count;
+ first_offset ^= key | key << 8 | key << 16 | key << 24;
+ if (first_offset != 0)
+ return null;
+
+ var index = new byte[index_size];
+ file.View.Read (4, index, 0, index_size);
+ for (int i = 0; i < index.Length; ++i)
+ index[i] ^= key;
+
+ long base_offset = 4 + index_size;
+ int index_offset = 0;
+ var dir = new List (count);
+ for (int i = 0; i < count; ++i)
+ {
+ var name = Binary.GetCString (index, index_offset, 0x18);
+ var entry = FormatCatalog.Instance.Create (name);
+ entry.Offset = base_offset + LittleEndian.ToUInt32 (index, index_offset+0x18);
+ entry.Size = LittleEndian.ToUInt32 (index, index_offset+0x1C);
+ if (!entry.CheckPlacement (file.MaxOffset))
+ return null;
+ dir.Add (entry);
+ index_offset += 0x20;
+ }
+ return new ArcFile (file, this, dir);
+ }
+
+ public override Stream OpenEntry (ArcFile arc, Entry entry)
+ {
+ var input = arc.File.CreateStream (entry.Offset, entry.Size);
+ if (!entry.Name.EndsWith (".scb", StringComparison.InvariantCultureIgnoreCase))
+ return input;
+ return new CryptoStream (input, new NotTransform(), CryptoStreamMode.Read);
+ }
+ }
+}
diff --git a/ArcFormats/Nags/ImageNGP.cs b/ArcFormats/Nags/ImageNGP.cs
new file mode 100644
index 00000000..2206a4da
--- /dev/null
+++ b/ArcFormats/Nags/ImageNGP.cs
@@ -0,0 +1,98 @@
+//! \file ImageNGP.cs
+//! \date Sun Nov 08 16:11:56 2015
+//! \brief NA Game System image format.
+//
+// Copyright (C) 2015 by morkt
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//
+
+using GameRes.Compression;
+using System.ComponentModel.Composition;
+using System.IO;
+using System.Windows.Media;
+
+namespace GameRes.Formats.Nags
+{
+ internal class NgpMetaData : ImageMetaData
+ {
+ public int PackedSize;
+ public int UnpackedSize;
+ }
+
+ [Export(typeof(ImageFormat))]
+ public class NgpFormat : ImageFormat
+ {
+ public override string Tag { get { return "NGP"; } }
+ public override string Description { get { return "NAGS engine image format"; } }
+ public override uint Signature { get { return 0x2050474E; } } // 'NGP '
+
+ public override ImageMetaData ReadMetaData (Stream stream)
+ {
+ stream.Position = 0x12;
+ using (var reader = new ArcView.Reader (stream))
+ {
+ int packed_size = reader.ReadInt32();
+ uint width = reader.ReadUInt32();
+ uint height = reader.ReadUInt32();
+ int bpp = reader.ReadUInt16() * 8;
+ reader.BaseStream.Position = 0x100;
+ int unpacked_size = reader.ReadInt32();
+ if (packed_size <= 0 || unpacked_size <= 0)
+ return null;
+ return new NgpMetaData
+ {
+ Width = width,
+ Height = height,
+ BPP = bpp,
+ PackedSize = packed_size,
+ UnpackedSize = unpacked_size,
+ };
+ }
+ }
+
+ public override ImageData Read (Stream stream, ImageMetaData info)
+ {
+ var meta = (NgpMetaData)info;
+ using (var input = new StreamRegion (stream, 0x104, meta.PackedSize, true))
+ using (var z = new ZLibStream (input, CompressionMode.Decompress))
+ {
+ var pixels = new byte[meta.UnpackedSize];
+ if (pixels.Length != z.Read (pixels, 0, pixels.Length))
+ throw new EndOfStreamException();
+ PixelFormat format;
+ if (32 == meta.BPP)
+ format = PixelFormats.Bgra32;
+ else if (24 == meta.BPP)
+ format = PixelFormats.Bgr24;
+ else if (8 == meta.BPP)
+ format = PixelFormats.Gray8;
+ else
+ throw new System.NotSupportedException ("Not supported NGP image color depth");
+
+ return ImageData.Create (info, format, null, pixels);
+ }
+ }
+
+ public override void Write (Stream file, ImageData image)
+ {
+ throw new System.NotImplementedException ("NgpFormat.Write not implemented");
+ }
+ }
+}
diff --git a/supported.html b/supported.html
index 47ac0da2..0f02e609 100644
--- a/supported.html
+++ b/supported.html
@@ -37,6 +37,7 @@ Natsu no Hitoshizuku
Private Nurse
Sensei 2
Shoujo Settai
+Tsukushite Agechau 5