mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
feat: add sopport of Love Once PS3 archive
This commit is contained in:
@@ -170,6 +170,7 @@
|
|||||||
<Compile Include="Macromedia\DirectorFile.cs" />
|
<Compile Include="Macromedia\DirectorFile.cs" />
|
||||||
<Compile Include="Macromedia\Palettes.cs" />
|
<Compile Include="Macromedia\Palettes.cs" />
|
||||||
<Compile Include="MAGES\ArcARC20.cs" />
|
<Compile Include="MAGES\ArcARC20.cs" />
|
||||||
|
<Compile Include="MAGES\ArcLoveOnce.cs" />
|
||||||
<Compile Include="Mugi\ArcBIN.cs" />
|
<Compile Include="Mugi\ArcBIN.cs" />
|
||||||
<Compile Include="NScripter\Script.cs" />
|
<Compile Include="NScripter\Script.cs" />
|
||||||
<Compile Include="Psp\ArcQPK.cs" />
|
<Compile Include="Psp\ArcQPK.cs" />
|
||||||
|
|||||||
55
ArcFormats/MAGES/ArcLoveOnce.cs
Normal file
55
ArcFormats/MAGES/ArcLoveOnce.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.Composition;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace GameRes.Formats.MAGES
|
||||||
|
{
|
||||||
|
[Export(typeof(ArchiveFormat))]
|
||||||
|
public class LoveOnceOpener : ArchiveFormat
|
||||||
|
{
|
||||||
|
public override string Tag { get { return "BIN/LoveOnce"; } }
|
||||||
|
public override string Description { get { return "L@ve Once PS3 resource archive"; } }
|
||||||
|
public override uint Signature { get { return 0; } } // no header
|
||||||
|
public override bool IsHierarchic { get { return false; } }
|
||||||
|
public override bool CanWrite { get { return false; } }
|
||||||
|
|
||||||
|
public override ArcFile TryOpen(ArcView filedata)
|
||||||
|
{
|
||||||
|
ArcView filelist;
|
||||||
|
if (filedata.Name.EndsWith("data.bin"))
|
||||||
|
{
|
||||||
|
string filepath = Path.GetDirectoryName(filedata.Name);
|
||||||
|
filepath = Path.Combine(filepath, "list.bin");
|
||||||
|
filelist = new ArcView(filepath);
|
||||||
|
}
|
||||||
|
else if (filedata.Name.EndsWith("list.bin"))
|
||||||
|
{
|
||||||
|
string filepath = Path.GetDirectoryName(filedata.Name);
|
||||||
|
filepath = Path.Combine(filepath, "data.bin");
|
||||||
|
filelist = new ArcView(filepath);
|
||||||
|
return TryOpen(filelist);
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
|
||||||
|
uint index_offset = 0, count = 0;
|
||||||
|
var dir = new List<Entry>();
|
||||||
|
while (index_offset < filelist.MaxOffset)
|
||||||
|
{
|
||||||
|
uint filesize = filelist.View.ReadUInt32(index_offset);
|
||||||
|
uint fileoffset = filelist.View.ReadUInt32(index_offset + 8);
|
||||||
|
string name = filelist.View.ReadString(index_offset + 0x10, 0x40);
|
||||||
|
var entry = Create<Entry>(name);
|
||||||
|
entry.Size = filesize;
|
||||||
|
entry.Offset = fileoffset;
|
||||||
|
if (!entry.CheckPlacement(filedata.MaxOffset))
|
||||||
|
return null;
|
||||||
|
dir.Add(entry);
|
||||||
|
count++;
|
||||||
|
index_offset += 0x50;
|
||||||
|
}
|
||||||
|
return new ArcFile(filedata, this, dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user