diff --git a/ArcFormats/ArcFormats.csproj b/ArcFormats/ArcFormats.csproj index c1232e76..f8f12629 100644 --- a/ArcFormats/ArcFormats.csproj +++ b/ArcFormats/ArcFormats.csproj @@ -173,6 +173,7 @@ + diff --git a/ArcFormats/NipponIchi/ArcCASN.cs b/ArcFormats/NipponIchi/ArcCASN.cs index d76a7db3..7f826f1c 100644 --- a/ArcFormats/NipponIchi/ArcCASN.cs +++ b/ArcFormats/NipponIchi/ArcCASN.cs @@ -22,7 +22,6 @@ namespace GameRes.Formats.NipponIchi var dir = new List(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; diff --git a/ArcFormats/NipponIchi/ArcPSFS.cs b/ArcFormats/NipponIchi/ArcPSFS.cs new file mode 100644 index 00000000..72f43997 --- /dev/null +++ b/ArcFormats/NipponIchi/ArcPSFS.cs @@ -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(count); + for (int i = 0; i < count; ++i) + { + string name = file.View.ReadString(index_offset, 0x30); + var entry = Create(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); + } + } +}