diff --git a/ArcFormats/Yox/ArcYOX.cs b/ArcFormats/Yox/ArcYOX.cs index 97d50ca2..3b91e20e 100644 --- a/ArcFormats/Yox/ArcYOX.cs +++ b/ArcFormats/Yox/ArcYOX.cs @@ -23,6 +23,7 @@ // IN THE SOFTWARE. // +using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.IO; @@ -53,15 +54,25 @@ namespace GameRes.Formats.Yox return null; var dir = new List (count); - for (int i = 0; i < count; ++i) + Func ReadIndex = entry_size => { + uint current_offset = index_offset; + for (int i = 0; i < count; ++i) + { + var entry = new PackedEntry { Name = i.ToString ("D5") }; + entry.Offset = file.View.ReadUInt32 (current_offset); + entry.Size = file.View.ReadUInt32 (current_offset+4); + if (0 == entry.Size || !entry.CheckPlacement (file.MaxOffset)) + return false; + dir.Add (entry); + current_offset += entry_size; + } + return true; + }; + if (!ReadIndex (8)) { - 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)) + dir.Clear(); + if (!ReadIndex (0x10)) return null; - dir.Add (entry); - index_offset += 8; } using (var stream = file.CreateStream()) DetectFileTypes (stream, dir); diff --git a/supported.html b/supported.html index f5411c1d..08e44163 100644 --- a/supported.html +++ b/supported.html @@ -1064,6 +1064,7 @@ Boku no Te no Naka no Rakuen
*.fcbfcb1No *.datYOXNoShelf Kagiroi ~Shaku Kei~
+L.i.n.k.
*.lacLACNoLeaf ToHeart2 AnotherDays