diff --git a/ArcFormats/ArcFormats.csproj b/ArcFormats/ArcFormats.csproj
index 6a74580f..0f1a1d43 100644
--- a/ArcFormats/ArcFormats.csproj
+++ b/ArcFormats/ArcFormats.csproj
@@ -398,6 +398,7 @@
+
diff --git a/ArcFormats/Yox/ArcYOX.cs b/ArcFormats/Yox/ArcYOX.cs
new file mode 100644
index 00000000..97d50ca2
--- /dev/null
+++ b/ArcFormats/Yox/ArcYOX.cs
@@ -0,0 +1,120 @@
+//! \file ArcYOX.cs
+//! \date Wed Aug 17 10:54:39 2016
+//! \brief Yox ADV+++ resource archives.
+//
+// Copyright (C) 2016 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.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.IO;
+using System.Linq;
+using GameRes.Compression;
+
+namespace GameRes.Formats.Yox
+{
+ [Export(typeof(ArchiveFormat))]
+ public class DatOpener : ArchiveFormat
+ {
+ public override string Tag { get { return "DAT/YOX"; } }
+ public override string Description { get { return "YOX ADV+++ engine resource archive"; } }
+ public override uint Signature { get { return 0x584F59; } } // 'YOX'
+ public override bool IsHierarchic { get { return false; } }
+ public override bool CanCreate { get { return false; } }
+
+ public DatOpener ()
+ {
+ Extensions = new string[] { "dat" };
+ }
+
+ public override ArcFile TryOpen (ArcView file)
+ {
+ uint index_offset = file.View.ReadUInt32 (8);
+ int count = file.View.ReadInt32 (0xC);
+ if (!IsSaneCount (count) || index_offset >= file.MaxOffset)
+ return null;
+
+ var dir = new List (count);
+ for (int i = 0; i < count; ++i)
+ {
+ var entry = new PackedEntry { Name = i.ToString ("D5") };
+ entry.Offset = file.View.ReadUInt32 (index_offset);
+ entry.Size = file.View.ReadUInt32 (index_offset+4);
+ if (!entry.CheckPlacement (file.MaxOffset))
+ return null;
+ dir.Add (entry);
+ index_offset += 8;
+ }
+ using (var stream = file.CreateStream())
+ DetectFileTypes (stream, dir);
+ return new ArcFile (file, this, dir);
+ }
+
+ public override Stream OpenEntry (ArcFile arc, Entry entry)
+ {
+ var input = base.OpenEntry (arc, entry);
+ var pent = entry as PackedEntry;
+ if (null == pent || !pent.IsPacked)
+ return input;
+ return new ZLibStream (input, CompressionMode.Decompress);
+ }
+
+ void DetectFileTypes (Stream file, IList dir)
+ {
+ foreach (PackedEntry entry in dir)
+ {
+ file.Position = entry.Offset;
+ uint signature = ReadUInt32 (file);
+ IResource res = null;
+ if (0x584F59 == signature) // 'YOX'
+ {
+ if (0 != (2 & ReadUInt32 (file)))
+ {
+ entry.IsPacked = true;
+ entry.UnpackedSize = ReadUInt32 (file);
+ entry.Offset += 0x10;
+ entry.Size -= 0x10;
+ file.Position = entry.Offset;
+ using (var input = new ZLibStream (file, CompressionMode.Decompress, true))
+ signature = ReadUInt32 (input);
+ res = AutoEntry.DetectFileType (signature);
+ }
+ }
+ else
+ res = AutoEntry.DetectFileType (signature);
+ if (res != null)
+ {
+ entry.Name = Path.ChangeExtension (entry.Name, res.Extensions.FirstOrDefault());
+ entry.Type = res.Type;
+ }
+ }
+ }
+
+ static uint ReadUInt32 (Stream input)
+ {
+ uint v = (uint)input.ReadByte();
+ v |= (uint)input.ReadByte() << 8;
+ v |= (uint)input.ReadByte() << 16;
+ v |= (uint)input.ReadByte() << 24;
+ return v;
+ }
+ }
+}
diff --git a/supported.html b/supported.html
index cefb2ee1..91b39d69 100644
--- a/supported.html
+++ b/supported.html
@@ -1049,6 +1049,9 @@ Binkan Ecchi! ~Futari no Oyatsu wa Tokunou Milk~
Boku no Te no Naka no Rakuen
| *.fcb | fcb1 | No |
+| *.dat | YOX | No | Shelf |
+Kagiroi ~Shaku Kei~
+ |
Non-encrypted only