mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 15:44:00 +08:00
implemented AOS resource archives.
This commit is contained in:
parent
321ac1cf69
commit
43406ffd66
109
ArcFormats/ArcAOS.cs
Normal file
109
ArcFormats/ArcAOS.cs
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
//! \file ArcAOS.cs
|
||||||
|
//! \date Tue Aug 04 06:00:39 2015
|
||||||
|
//! \brief LiLiM resource archive implementation.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2015 by morkt
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.Composition;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using GameRes.Utility;
|
||||||
|
|
||||||
|
namespace GameRes.Formats.Lilim
|
||||||
|
{
|
||||||
|
[Export(typeof(ArchiveFormat))]
|
||||||
|
public class AosOpener : ArchiveFormat
|
||||||
|
{
|
||||||
|
public override string Tag { get { return "AOS"; } }
|
||||||
|
public override string Description { get { return "LiLiM/Le.Chocolat engine resource archive"; } }
|
||||||
|
public override uint Signature { get { return 0; } }
|
||||||
|
public override bool IsHierarchic { get { return false; } }
|
||||||
|
public override bool CanCreate { get { return false; } }
|
||||||
|
|
||||||
|
static readonly byte[] IndexLink = Enumerable.Repeat<byte> (0xff, 0x10).ToArray();
|
||||||
|
static readonly byte[] IndexEnd = Enumerable.Repeat<byte> (0, 0x10).ToArray();
|
||||||
|
|
||||||
|
public override ArcFile TryOpen (ArcView file)
|
||||||
|
{
|
||||||
|
if (0 == file.View.ReadByte (0))
|
||||||
|
return null;
|
||||||
|
uint first_offset = file.View.ReadUInt32 (0x10);
|
||||||
|
if (first_offset >= file.MaxOffset || 0 != (first_offset & 0x1F))
|
||||||
|
return null;
|
||||||
|
var name_buf = new byte[0x10];
|
||||||
|
if (0x10 != file.View.Read (first_offset, name_buf, 0, 0x10))
|
||||||
|
return null;
|
||||||
|
if (!name_buf.SequenceEqual (IndexLink) && !name_buf.SequenceEqual (IndexEnd))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
uint current_offset = 0;
|
||||||
|
var dir = new List<Entry> (0x3E);
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (0x10 != file.View.Read (current_offset, name_buf, 0, 0x10))
|
||||||
|
break;
|
||||||
|
if (name_buf.SequenceEqual (IndexLink))
|
||||||
|
{
|
||||||
|
uint next_offset = file.View.ReadUInt32 (current_offset+0x10);
|
||||||
|
current_offset += 0x20 + next_offset;
|
||||||
|
if (current_offset >= file.MaxOffset)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int name_length = Array.IndexOf<byte> (name_buf, 0);
|
||||||
|
if (0 == name_length)
|
||||||
|
break;
|
||||||
|
if (-1 == name_length)
|
||||||
|
name_length = name_buf.Length;
|
||||||
|
var name = Encodings.cp932.GetString (name_buf, 0, name_length);
|
||||||
|
var entry = FormatCatalog.Instance.CreateEntry (name);
|
||||||
|
entry.Offset = file.View.ReadUInt32 (current_offset+0x10);
|
||||||
|
entry.Size = file.View.ReadUInt32 (current_offset+0x14);
|
||||||
|
current_offset += 0x20;
|
||||||
|
entry.Offset += current_offset;
|
||||||
|
if (!entry.CheckPlacement (file.MaxOffset))
|
||||||
|
return null;
|
||||||
|
dir.Add (entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArcFile (file, this, dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||||
|
{
|
||||||
|
if (!entry.Name.EndsWith (".scr", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
return arc.File.CreateStream (entry.Offset, entry.Size);
|
||||||
|
|
||||||
|
uint unpacked_size = arc.File.View.ReadUInt32 (entry.Offset);
|
||||||
|
var packed = new byte[entry.Size-4];
|
||||||
|
arc.File.View.Read (entry.Offset+4, packed, 0, (uint)packed.Length);
|
||||||
|
var unpacked = new byte[unpacked_size];
|
||||||
|
|
||||||
|
var decoder = new HuffmanDecoder (packed, unpacked);
|
||||||
|
decoder.Unpack();
|
||||||
|
return new MemoryStream (unpacked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -69,6 +69,7 @@
|
|||||||
<Compile Include="ArcAil.cs" />
|
<Compile Include="ArcAil.cs" />
|
||||||
<Compile Include="ArcALD.cs" />
|
<Compile Include="ArcALD.cs" />
|
||||||
<Compile Include="ArcAMI.cs" />
|
<Compile Include="ArcAMI.cs" />
|
||||||
|
<Compile Include="ArcAOS.cs" />
|
||||||
<Compile Include="ArcAST.cs" />
|
<Compile Include="ArcAST.cs" />
|
||||||
<Compile Include="ArcAVC.cs" />
|
<Compile Include="ArcAVC.cs" />
|
||||||
<Compile Include="ArcAZSys.cs" />
|
<Compile Include="ArcAZSys.cs" />
|
||||||
@ -126,8 +127,10 @@
|
|||||||
<Compile Include="ArcSAF.cs" />
|
<Compile Include="ArcSAF.cs" />
|
||||||
<Compile Include="ArcVPK.cs" />
|
<Compile Include="ArcVPK.cs" />
|
||||||
<Compile Include="AudioVAW.cs" />
|
<Compile Include="AudioVAW.cs" />
|
||||||
|
<Compile Include="EriReader.cs" />
|
||||||
<Compile Include="ImageDWQ.cs" />
|
<Compile Include="ImageDWQ.cs" />
|
||||||
<Compile Include="ImageHIZ.cs" />
|
<Compile Include="ImageHIZ.cs" />
|
||||||
|
<Compile Include="MioDecoder.cs" />
|
||||||
<Compile Include="ZLibStream.cs" />
|
<Compile Include="ZLibStream.cs" />
|
||||||
<None Include="ArcSeraph.cs" />
|
<None Include="ArcSeraph.cs" />
|
||||||
<Compile Include="ArcSPack.cs" />
|
<Compile Include="ArcSPack.cs" />
|
||||||
|
@ -204,6 +204,7 @@ Rikorisu ~Lycoris Radiata~<br/>
|
|||||||
<tr><td>*.pmp<br/>*.pmw</td><td>-</td><td>Yes</td><td>ScenePlayer</td><td>Nyuujoku Hitozuma Jogakuen</td></tr>
|
<tr><td>*.pmp<br/>*.pmw</td><td>-</td><td>Yes</td><td>ScenePlayer</td><td>Nyuujoku Hitozuma Jogakuen</td></tr>
|
||||||
<tr class="odd"><td>*.dat</td><td><tt>GAMEDAT PACK</tt><br/><tt>GAMEDAT PAC2</tt></td><td>No</td><td rowspan="2"> bootUP!<br/>Pajamas Soft</td><td rowspan="2">
|
<tr class="odd"><td>*.dat</td><td><tt>GAMEDAT PACK</tt><br/><tt>GAMEDAT PAC2</tt></td><td>No</td><td rowspan="2"> bootUP!<br/>Pajamas Soft</td><td rowspan="2">
|
||||||
Aneimo 2 ~Second Stage~<br/>
|
Aneimo 2 ~Second Stage~<br/>
|
||||||
|
Momichupa Teacher!<br/>
|
||||||
Natsu no Owari no Nirvana<br/>
|
Natsu no Owari no Nirvana<br/>
|
||||||
Prism Heart<br/>
|
Prism Heart<br/>
|
||||||
</tr>
|
</tr>
|
||||||
@ -297,6 +298,9 @@ Yami no Koe Zero<br/>
|
|||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td>*.dwq</td><td><tt>BMP</tt><br/><tt>JPEG</tt><br/><tt>PNG</tt><br/><tt>JPEG+MASK</tt><br/><tt>PACKBMP+MASK</tt><br/></td><td>No</td></tr>
|
<tr><td>*.dwq</td><td><tt>BMP</tt><br/><tt>JPEG</tt><br/><tt>PNG</tt><br/><tt>JPEG+MASK</tt><br/><tt>PACKBMP+MASK</tt><br/></td><td>No</td></tr>
|
||||||
<tr><td>*.vaw<br/>*.wgq</td><td><tt>IF PACKTYPE==</tt><br/><tt>OGG</tt></td><td>No</td></tr>
|
<tr><td>*.vaw<br/>*.wgq</td><td><tt>IF PACKTYPE==</tt><br/><tt>OGG</tt></td><td>No</td></tr>
|
||||||
|
<tr class="odd"><td>*.aos</td><td>-</td><td>No</td><td>LiLiM</td><td>
|
||||||
|
Answer Dead<br/>
|
||||||
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<p><a name="note-1" class="footnote">1</a> Non-encrypted only</p>
|
<p><a name="note-1" class="footnote">1</a> Non-encrypted only</p>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user