mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 07:34:00 +08:00
feat: support Rune Princess archive
This commit is contained in:
parent
df2ebbc7c5
commit
797816f856
@ -169,6 +169,7 @@
|
||||
<Compile Include="Macromedia\AudioSND.cs" />
|
||||
<Compile Include="Macromedia\DirectorFile.cs" />
|
||||
<Compile Include="Macromedia\Palettes.cs" />
|
||||
<Compile Include="MAGES\ArcARC20.cs" />
|
||||
<Compile Include="Mugi\ArcBIN.cs" />
|
||||
<Compile Include="NScripter\Script.cs" />
|
||||
<Compile Include="Psp\ArcQPK.cs" />
|
||||
|
52
ArcFormats/MAGES/ArcARC20.cs
Normal file
52
ArcFormats/MAGES/ArcARC20.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Text;
|
||||
|
||||
namespace GameRes.Formats.MAGES
|
||||
{
|
||||
[Export(typeof(ArchiveFormat))]
|
||||
public class ARC20Opener : ArchiveFormat
|
||||
{
|
||||
public override string Tag { get { return "ARC/Princess Soft ARC20"; } }
|
||||
public override string Description { get { return "Princess Soft PS2 resource archive"; } }
|
||||
public override uint Signature { get { return 0x20435241; } } // 'ARC\x20'
|
||||
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(4);
|
||||
if (!IsSaneCount(count))
|
||||
return null;
|
||||
uint filename_end = file.View.ReadUInt32(8);
|
||||
var dir = new List<Entry>(count);
|
||||
uint index_offset;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
index_offset = file.View.ReadUInt32(16 * i + 16);
|
||||
byte c;
|
||||
List<byte> namebyte = new List<byte>();
|
||||
while (true)
|
||||
{
|
||||
c = file.View.ReadByte((long)index_offset);
|
||||
if (c == 0 | index_offset > filename_end) break;
|
||||
namebyte.Add(c);
|
||||
index_offset++;
|
||||
}
|
||||
var sjis = System.Text.Encoding.GetEncoding("Shift-JIS");
|
||||
var name = sjis.GetString(namebyte.ToArray());
|
||||
var entry = Create<PackedEntry>(name);
|
||||
|
||||
entry.Offset = file.View.ReadUInt32(16 * i + 16 + 4) * 2048;
|
||||
|
||||
entry.Size = file.View.ReadUInt32(16 * i + 16 + 8);
|
||||
entry.UnpackedSize = file.View.ReadUInt32(16 * i + 16 + 8);
|
||||
if (!entry.CheckPlacement(file.MaxOffset))
|
||||
return null;
|
||||
dir.Add(entry);
|
||||
}
|
||||
return new ArcFile(file, this, dir);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user