implemented ACV1 archives.

This commit is contained in:
morkt 2016-12-30 20:52:59 +04:00
parent 6b06d4f25f
commit 9c7ea4c659
3 changed files with 100 additions and 1 deletions

View File

@ -221,6 +221,7 @@
<Compile Include="NitroPlus\WidgetNPK.xaml.cs">
<DependentUpon>WidgetNPK.xaml</DependentUpon>
</Compile>
<Compile Include="NonColor\ArcACV.cs" />
<Compile Include="NonColor\ArcDAT.cs" />
<Compile Include="Crc64.cs" />
<Compile Include="NonColor\WidgetNCARC.xaml.cs">

View File

@ -0,0 +1,93 @@
//! \file ArcACV.cs
//! \date Wed Dec 28 09:49:14 2016
//! \brief Mirai resource archive.
//
// Copyright (C) 2016 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 GameRes.Compression;
using GameRes.Utility;
namespace GameRes.Formats.NonColor
{
[Export(typeof(ArchiveFormat))]
public class AcvOpener : DatOpener
{
public override string Tag { get { return "ACV"; } }
public override string Description { get { return "Mirai resource archive"; } }
public override uint Signature { get { return 0x31564341; } } // 'ACV1'
public override bool IsHierarchic { get { return true; } }
public override bool CanWrite { get { return false; } }
public AcvOpener ()
{
Extensions = new string[] { "dat" };
}
public override ArcFile TryOpen (ArcView file)
{
uint key = 0x8B6A4E5F;
int count = file.View.ReadInt32 (4) ^ (int)key;
if (!IsSaneCount (count))
return null;
var scheme = QueryScheme (file.Name);
if (null == scheme)
return null;
bool is_script = VFS.IsPathEqualsToFileName (file.Name, "script.dat");
var dir = new List<Entry> (count);
using (var input = file.CreateStream (8, (uint)count * 0x15))
{
foreach (var entry in ReadIndex (input, count, scheme, key))
{
if (!entry.CheckPlacement (file.MaxOffset))
return null;
if (is_script)
entry.Hash ^= scheme.Hash;
dir.Add (entry);
}
}
return new ArcFile (file, this, dir);
}
public override Stream OpenEntry (ArcFile arc, Entry entry)
{
var dent = entry as ArcDatEntry;
if (null == dent || 0 == dent.Size)
return arc.File.CreateStream (entry.Offset, entry.Size);
var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
if (dent.IsPacked)
{
DecryptData (data, (uint)dent.Hash);
return new ZLibStream (new MemoryStream (data), CompressionMode.Decompress);
}
if (dent.RawName != null && 0 != dent.Flags)
DecryptWithName (data, dent.RawName);
return new BinMemoryStream (data, entry.Name);
}
}
}

View File

@ -906,6 +906,7 @@ Otto no Mae de Okasarete...<br/>
<tr class="last"><td>*.gec</td><td>-</td><td>No</td></tr>
<tr class="odd"><td>*.arc</td><td>-</td><td>No</td><td rowspan="2">AI6WIN</td><td rowspan="2">
Gakuen Saimin Reido<br/>
Shinsou Noise<br/>
</td></tr>
<tr class="odd last"><td>*.akb</td><td><tt>AKB</tt></td><td>No</td></tr>
<tr><td>*.cpz</td><td><tt>CPZ2</tt><br/><tt>CPZ5</tt><br/><tt>CPZ6</tt></td><td>No</td><td rowspan="5">CMVS<br/>CVNS</td><td rowspan="5">
@ -1061,8 +1062,9 @@ Shin Genre Esudere!!<br/>
Valkyrie Complex<br/>
</td></tr>
<tr class="last"><td>*.cps</td><td>-</td><td>No</td></tr>
<tr class="odd"><td>arc*.dat<br/>script.dat</td><td>-</td><td>No</td><td>non color</td><td>
<tr class="odd"><td>arc*.dat<br/>script.dat</td><td>-<br/><tt>ACV1</tt></td><td>No</td><td>non color<br/>mirai</td><td>
Doubly na Kanojo<br/>
Hana Hime * Absolute!<br/>
Nora to Oujo to Noraneko Heart<br/>
Tsujidou-san no Jun'ai Road<br/>
Tsujidou-san no Virgin Road<br/>
@ -1289,6 +1291,9 @@ Maou no Ingu<br/>
Doreijou<br/>
</td></tr>
<tr class="odd last"><td>*.kgf</td><td><tt>KGF</tt></td><td>No</td></tr>
<tr><td>*.pfs</td><td><tt>pf8</tt></td><td>No</td><td>Artemis Engine</td><td>
Boku no Elf Onee-san<br/>
</td></tr>
</table>
<p><a name="note-1" class="footnote">1</a> Non-encrypted only</p>
</body>