feat: add support of Shin Hayarigami 2 PS3 archive

This commit is contained in:
ManicSteiner 2023-12-07 22:18:05 +08:00
parent 6efe8ad30b
commit 4a3f4562b0
3 changed files with 43 additions and 1 deletions

View File

@ -173,6 +173,7 @@
<Compile Include="MAGES\ArcLoveOnce.cs" />
<Compile Include="Mugi\ArcBIN.cs" />
<Compile Include="NipponIchi\ArcCASN.cs" />
<Compile Include="NipponIchi\ArcPSFS.cs" />
<Compile Include="NipponIchi\ImageNMT.cs" />
<Compile Include="NScripter\Script.cs" />
<Compile Include="Psp\ArcQPK.cs" />

View File

@ -22,7 +22,6 @@ namespace GameRes.Formats.NipponIchi
var dir = new List<Entry>(count);
for (int i = 0; i < count; ++i)
{
uint fstart = Binary.BigEndian(file.View.ReadUInt32(index_offset));
uint flength = Binary.BigEndian(file.View.ReadUInt32(index_offset + 4));
index_offset += 8;

View File

@ -0,0 +1,42 @@
using GameRes.Utility;
using System.Collections.Generic;
using System.ComponentModel.Composition;
namespace GameRes.Formats.NipponIchi
{
[Export(typeof(ArchiveFormat))]
public class PSFSOpener : ArchiveFormat
{
public override string Tag { get { return "DAT/PS_FS ShinHayarigami2"; } }
public override string Description { get { return "Nippon Ichi Shin Hayarigami2 PS3 resource archive"; } }
public override uint Signature { get { return 0x465F5350; } } // 'PS_F' of 'PS_FS_V1'
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
public override ArcFile TryOpen(ArcView file)
{
int count = Binary.BigEndian(file.View.ReadInt32(8));
if (!IsSaneCount(count))
return null;
long index_offset = 0x10;
var dir = new List<Entry>(count);
for (int i = 0; i < count; ++i)
{
string name = file.View.ReadString(index_offset, 0x30);
var entry = Create<Entry>(name);
entry.Offset = Binary.BigEndian(file.View.ReadUInt32(index_offset + 0x3C));
entry.Size = Binary.BigEndian(file.View.ReadUInt32(index_offset + 0x34));
index_offset += 0x40;
if (!entry.CheckPlacement(file.MaxOffset))
return null;
if (0 == file.View.ReadByte(entry.Offset))
{
entry.Offset += 0x10;
entry.Size -= 0x10;
}
dir.Add(entry);
}
return new ArcFile(file, this, dir);
}
}
}