feat: DAT/FARC MAGES Rozen Maiden PS3 archive

This commit is contained in:
ManicSteiner 2023-12-14 22:58:43 +08:00
parent b1cc4eddf3
commit 5292d3c9c8
2 changed files with 49 additions and 0 deletions

View File

@ -172,6 +172,7 @@
<Compile Include="Macromedia\DirectorFile.cs" />
<Compile Include="Macromedia\Palettes.cs" />
<Compile Include="MAGES\ArcARC20.cs" />
<Compile Include="MAGES\ArcFARC.cs" />
<Compile Include="MAGES\ArcLoveOnce.cs" />
<Compile Include="MAGES\ImageBIN.cs" />
<Compile Include="Mugi\ArcBIN.cs" />

View File

@ -0,0 +1,48 @@
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Text;
namespace GameRes.Formats.MAGES
{
[Export(typeof(ArchiveFormat))]
public class FARCOpener : ArchiveFormat
{
public override string Tag { get { return "DAT/FARC Rozen Maiden PS3 archive"; } }
public override string Description { get { return "MAGES Rozen Maiden Wechseln Sie Welt ab PS3 BLJM61120 archive"; } }
public override uint Signature { get { return 0x43524146; } } // 'FARC'
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
public override ArcFile TryOpen(ArcView file)
{
int count = file.View.ReadInt32(20);
if (!IsSaneCount(count))
return null;
uint datanamestart = (uint)count * 20 + 36;
var dir = new List<Entry>(count);
for (int i = 0; i < count; ++i)
{
long namepl = file.View.ReadUInt32(20 * i + 36 + 16);
long index_offset = datanamestart + namepl;
byte c;
List<byte> namebyte = new List<byte>();
while (true)
{
c = file.View.ReadByte(index_offset);
if (c == 0) break;
namebyte.Add(c);
index_offset++;
}
var sjis = Encoding.GetEncoding("Shift-JIS");
var name = sjis.GetString(namebyte.ToArray());
var entry = Create<Entry>(name);
entry.Offset = file.View.ReadUInt32(20 * i + 36);
entry.Size = file.View.ReadUInt32(20 * i + 36 + 4);
if (entry.Size == 0)
continue;
dir.Add(entry);
}
return new ArcFile(file, this, dir);
}
}
}