mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(Legacy): added formats, mostly PC-98.
This commit is contained in:
@@ -44,20 +44,56 @@ namespace GameRes.Formats.AyPio
|
||||
int count = file.View.ReadInt16 (0x16);
|
||||
if (!IsSaneCount (count))
|
||||
return null;
|
||||
uint index_pos = 0x18;
|
||||
using (var index = file.CreateStream())
|
||||
{
|
||||
index.Position = 0x18;
|
||||
var dir = ReadIndex (index, count);
|
||||
return new ArcFile (file, this, dir);
|
||||
}
|
||||
}
|
||||
|
||||
internal List<Entry> ReadIndex (IBinaryStream index, int count)
|
||||
{
|
||||
var max_offset = index.Length;
|
||||
var dir = new List<Entry> (count);
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
var name = file.View.ReadString (index_pos, 0xD);
|
||||
var name = index.ReadCString (0xD);
|
||||
var entry = Create<Entry> (name);
|
||||
entry.Offset = file.View.ReadUInt32 (index_pos+0x0D);
|
||||
entry.Size = file.View.ReadUInt32 (index_pos+0x11);
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
entry.Offset = index.ReadUInt32();
|
||||
entry.Size = index.ReadUInt32();
|
||||
if (!entry.CheckPlacement (max_offset))
|
||||
return null;
|
||||
dir.Add (entry);
|
||||
index_pos += 0x15;
|
||||
}
|
||||
return new ArcFile (file, this, dir);
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
|
||||
[Export(typeof(ArchiveFormat))]
|
||||
public class Dlb0Opener : DlbOpener
|
||||
{
|
||||
public override string Tag => "DLB/V0";
|
||||
public override string Description => "UK2 engine resource archive";
|
||||
public override uint Signature => 0;
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.Name.HasExtension (".DLB"))
|
||||
return null;
|
||||
int count = file.View.ReadInt16 (0);
|
||||
if (!IsSaneCount (count))
|
||||
return null;
|
||||
uint first_offset = file.View.ReadUInt32 (0xF);
|
||||
if (first_offset != count * 0x15 + 2)
|
||||
return null;
|
||||
using (var index = file.CreateStream())
|
||||
{
|
||||
index.Position = 2;
|
||||
var dir = ReadIndex (index, count);
|
||||
return new ArcFile (file, this, dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user