implemented variation of YOX archives.

This commit is contained in:
morkt 2016-08-30 04:22:34 +04:00
parent f990fbb55e
commit 7aa279eb3a
2 changed files with 19 additions and 7 deletions

View File

@ -23,6 +23,7 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
// //
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.IO; using System.IO;
@ -53,15 +54,25 @@ namespace GameRes.Formats.Yox
return null; return null;
var dir = new List<Entry> (count); var dir = new List<Entry> (count);
for (int i = 0; i < count; ++i) Func<uint, bool> 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") }; dir.Clear();
entry.Offset = file.View.ReadUInt32 (index_offset); if (!ReadIndex (0x10))
entry.Size = file.View.ReadUInt32 (index_offset+4);
if (!entry.CheckPlacement (file.MaxOffset))
return null; return null;
dir.Add (entry);
index_offset += 8;
} }
using (var stream = file.CreateStream()) using (var stream = file.CreateStream())
DetectFileTypes (stream, dir); DetectFileTypes (stream, dir);

View File

@ -1064,6 +1064,7 @@ Boku no Te no Naka no Rakuen<br/>
<tr><td>*.fcb</td><td><tt>fcb1</tt></td><td>No</td></tr> <tr><td>*.fcb</td><td><tt>fcb1</tt></td><td>No</td></tr>
<tr class="odd"><td>*.dat</td><td><tt>YOX</tt></td><td>No</td><td>Shelf</td><td> <tr class="odd"><td>*.dat</td><td><tt>YOX</tt></td><td>No</td><td>Shelf</td><td>
Kagiroi ~Shaku Kei~<br/> Kagiroi ~Shaku Kei~<br/>
L.i.n.k.<br/>
</td></tr> </td></tr>
<tr><td>*.lac</td><td><tt>LAC</tt></td><td>No</td><td rowspan="5">Leaf</td><td rowspan="5"> <tr><td>*.lac</td><td><tt>LAC</tt></td><td>No</td><td rowspan="5">Leaf</td><td rowspan="5">
ToHeart2 AnotherDays<br/> ToHeart2 AnotherDays<br/>