mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
bunch of stuff.
This commit is contained in:
@@ -27,11 +27,13 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using GameRes.Compression;
|
||||
using GameRes.Formats.Maika;
|
||||
using GameRes.Utility;
|
||||
|
||||
namespace GameRes.Formats.BellDa
|
||||
{
|
||||
[Export(typeof(ArchiveFormat))]
|
||||
public sealed class BldOpener : ArchiveFormat
|
||||
public sealed class BldOpener : Mk2Opener
|
||||
{
|
||||
public override string Tag { get { return "DAT/BLD"; } }
|
||||
public override string Description { get { return "BELL-DA resource archive"; } }
|
||||
@@ -39,6 +41,13 @@ namespace GameRes.Formats.BellDa
|
||||
public override bool IsHierarchic { get { return false; } }
|
||||
public override bool CanWrite { get { return false; } }
|
||||
|
||||
public BldOpener ()
|
||||
{
|
||||
Signatures = new[] { this.Signature };
|
||||
Settings = null;
|
||||
Scheme = null;
|
||||
}
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
var version_str = file.View.ReadString (4, 4).TrimEnd ('\x1A');
|
||||
@@ -66,26 +75,5 @@ namespace GameRes.Formats.BellDa
|
||||
}
|
||||
return new ArcFile (file, this, dir);
|
||||
}
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
// XXX compression method identical to Maika.Mk2Opener
|
||||
var pent = (PackedEntry)entry;
|
||||
if (null == pent || !pent.IsPacked)
|
||||
{
|
||||
var id_str = arc.File.View.ReadString (entry.Offset, 2);
|
||||
if (id_str != "B1" && id_str != "C1" && id_str != "D1" && id_str != "E1")
|
||||
return base.OpenEntry (arc, entry);
|
||||
uint packed_size = arc.File.View.ReadUInt32 (entry.Offset+2);
|
||||
if (packed_size != entry.Size - 10)
|
||||
return base.OpenEntry (arc, entry);
|
||||
pent.Size = packed_size;
|
||||
pent.UnpackedSize = arc.File.View.ReadUInt32 (entry.Offset+6);
|
||||
pent.Offset += 10;
|
||||
pent.IsPacked = true;
|
||||
}
|
||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
return new LzssStream (input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user