implemented cromwell archives.

This commit is contained in:
morkt 2017-02-05 21:08:52 +04:00
parent 45129fdc1d
commit 08d0494a04
3 changed files with 133 additions and 0 deletions

View File

@ -103,6 +103,7 @@
<Compile Include="Cmvs\AudioMV2.cs" />
<Compile Include="Cmvs\ImageMSK.cs" />
<Compile Include="Cmvs\ImagePB2.cs" />
<Compile Include="Cromwell\ArcPAK.cs" />
<Compile Include="Ellefin\ArcEPK.cs" />
<Compile Include="Entis\ArcPAC.cs" />
<Compile Include="ExeFile.cs" />

View File

@ -0,0 +1,124 @@
//! \file ArcPAK.cs
//! \date Sun Feb 05 13:07:40 2017
//! \brief cromwell graphic resource archive.
//
// Copyright (C) 2017 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.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using GameRes.Compression;
namespace GameRes.Formats.Cromwell
{
[Export(typeof(ArchiveFormat))]
public class GraphicPakOpener : ArchiveFormat
{
public override string Tag { get { return "PAK/cromwell"; } }
public override string Description { get { return "cromwell graphic resource archive"; } }
public override uint Signature { get { return 0x70617247; } } // 'Graphic PackData'
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
public override ArcFile TryOpen (ArcView file)
{
if (!file.View.AsciiEqual (4, "hic PackData"))
return null;
int count = file.View.ReadInt32 (0x10);
if (!IsSaneCount (count))
return null;
uint index_offset = 0x14;
var dir = new List<Entry> (count);
for (int i = 0; i < count; ++i)
{
var name = file.View.ReadString (index_offset, 0xC);
if (string.IsNullOrWhiteSpace (name))
return null;
index_offset += 0xC;
var entry = FormatCatalog.Instance.Create<PackedEntry> (name);
entry.Offset = file.View.ReadUInt32 (index_offset);
if (entry.Offset >= file.MaxOffset)
return null;
entry.UnpackedSize = file.View.ReadUInt32 (index_offset+4);
entry.IsPacked = true;
dir.Add (entry);
index_offset += 8;
}
for (int i = 0; i < count; ++i)
{
long next_offset = i+1 < count ? dir[i+1].Offset : file.MaxOffset;
dir[i].Size = (uint)(next_offset - dir[i].Offset);
}
return new ArcFile (file, this, dir);
}
public override Stream OpenEntry (ArcFile arc, Entry entry)
{
var input = arc.File.CreateStream (entry.Offset, entry.Size);
return new ZLibStream (input, CompressionMode.Decompress);
}
}
[Export(typeof(ArchiveFormat))]
public class OpkOpener : ArchiveFormat
{
public override string Tag { get { return "OPK"; } }
public override string Description { get { return "cromwell audio resource archive"; } }
public override uint Signature { get { return 0x63696F56; } } // 'VoiceOggPackFile'
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
public override ArcFile TryOpen (ArcView file)
{
if (!file.View.AsciiEqual (4, "eOggPackFile"))
return null;
int count = file.View.ReadInt32 (0x10);
if (!IsSaneCount (count))
return null;
var base_name = Path.GetFileNameWithoutExtension (file.Name);
using (var input = file.CreateStream())
{
input.Position = 0x14;
var dir = new List<Entry> (count);
uint next_offset = input.ReadUInt32();
for (int i = 0; i < count; ++i)
{
var entry = new Entry { Type = "audio" };
entry.Offset = next_offset;
next_offset = input.ReadUInt32();
entry.Size = (uint)(next_offset - entry.Offset);
if (!entry.CheckPlacement (file.MaxOffset))
return null;
dir.Add (entry);
}
input.Position = next_offset;
foreach (var entry in dir)
{
entry.Name = input.ReadCString (8) + ".ogg";
}
return new ArcFile (file, this, dir);
}
}
}
}

View File

@ -152,6 +152,7 @@ Tiny Dungeon ~Brave or Slave~<br/>
Ayase Ke no Onna ~Inka no Ketsumyaku~<br/>
Chokotto☆Vampire!<br/>
Clover Point<br/>
Kindan ~Kimi wa Boku Dake no Maiden~<br/>
Setsuei<br/>
Tsuki to Mahou to Taiyo to<br/>
</td></tr>
@ -439,6 +440,8 @@ Touka Gettan<br/>
<tr><td>*.war</td><td><tt>WARC 1.7</tt><br/><tt>WARC 1.5</tt><br/><tt>WARC 1.4</tt><br/><tt>WARC 1.3</tt><br/><tt>WARC 1.2</tt></td><td>No</td><td rowspan="5">Shiina Rio</td><td rowspan="5">
Ao no Juuai <span class="footnote">ShiinaRio v2.34</span><br/>
Aneiro <span class="footnote">ShiinaRio v2.49</span><br/>
Bitch Nee-chan ga Seijun na Hazu ga Nai! <span class="footnote">ShiinaRio v2.50</span><br/>
Bitch Shimai ga Seijun na Hazu ga Nai!! <span class="footnote">ShiinaRio v2.50</span><br/>
Can Fes! ~Itazura Majo to Naisho no Gakuensai~ <span class="footnote">ShiinaRio v2.47</span><br/>
Chikan Circle <span class="footnote">ShiinaRio v2.46</span><br/>
Chikan Circle 2 <span class="footnote">ShiinaRio v2.47</span><br/>
@ -453,6 +456,7 @@ Draculius <span class="footnote">ShiinaRio v2.38</span><br/>
Enkaku Sousa <span class="footnote">2.36 or 2.37</span><br/>
Gakushoku no Oba-san The Motion <span class="footnote">ShiinaRio v2.48</span><br/>
Gensou no Idea ~Oratorio Phantasm Historia~<span class="footnote">ShiinaRio v2.49</span><br/>
Gibo to Oba ~Soshite Yuujin no Haha~ <span class="footnote">ShiinaRio v2.36</span><br/>
Gohoushi Nurse ~Mayonaka no Kyousei Call~ <span class="footnote">ShiinaRio v2.50</span><br/>
Hana no Kioku 1-2-3 <span class="footnote">ShiinaRio v2.10</span><br/>
Hana no Kioku 4-5-6 <span class="footnote">ShiinaRio v2.19</span><br/>
@ -1413,6 +1417,10 @@ Ryoujoku Joshi Gakuen<br/>
<tr class="odd"><td>*.wrc</td><td><tt>WVX0</tt></td><td>No</td></tr>
<tr class="odd"><td>*.wsm</td><td><tt>WSM1</tt><br/><tt>WSM2</tt><br/><tt>WSM3</tt></td><td>No</td></tr>
<tr class="odd"><td>*</td><td><tt>BC</tt></td><td>No</td></tr>
<tr><td>*.pak</td><td><tt>Graphic PackData</tt></td><td>No</td><td rowspan="2">cromwell</td><td rowspan="2">
Ikenie Reijou<br/>
</td></tr>
<tr><td>*.opk</td><td><tt>VoiceOggPackFile</tt></td><td>No</td></tr>
</table>
<p><a name="note-1" class="footnote">1</a> Non-encrypted only</p>
</body>