implemented WSM1 archives.

This commit is contained in:
morkt 2017-01-31 16:17:48 +04:00
parent dd45a61cc7
commit 2a1e13c294
2 changed files with 88 additions and 5 deletions

View File

@ -25,19 +25,25 @@
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using GameRes.Utility;
namespace GameRes.Formats.Will
{
[Export(typeof(ArchiveFormat))]
public class WsmOpener : ArchiveFormat
public class Wsm2Opener : ArchiveFormat
{
public override string Tag { get { return "WSM"; } }
public override string Description { get { return "Tanaka Tatsuhiro's engine music archive"; } }
public override string Tag { get { return "WSM2"; } }
public override string Description { get { return "Tanaka Tatsuhiro's engine music archive v2"; } }
public override uint Signature { get { return 0x324D5357; } } // 'WSM2'
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
public Wsm2Opener ()
{
Extensions = new string[] { "wsm" };
}
public override ArcFile TryOpen (ArcView file)
{
uint index_size = file.View.ReadUInt32 (4);
@ -55,6 +61,8 @@ namespace GameRes.Formats.Will
var entry = new Entry { Type = "audio" };
entry.Offset = index.ToUInt32 (table_offset) - 0x14;
entry.Size = index.ToUInt32 (table_offset+8) + 0x14;
if (!entry.CheckPlacement (file.MaxOffset))
return null;
table_offset += 0x20;
dir.Add (entry);
}
@ -77,4 +85,72 @@ namespace GameRes.Formats.Will
return new ArcFile (file, this, dir);
}
}
[Export(typeof(ArchiveFormat))]
public class Wsm1Opener : ArchiveFormat
{
public override string Tag { get { return "WSM1"; } }
public override string Description { get { return "Tanaka Tatsuhiro's engine music archive v1"; } }
public override uint Signature { get { return 0x314D5357; } } // 'WSM1'
public override bool IsHierarchic { get { return false; } }
public override bool CanWrite { get { return false; } }
public Wsm1Opener ()
{
Extensions = new string[] { "wsm" };
}
public override ArcFile TryOpen (ArcView file)
{
uint index_size = file.View.ReadUInt32 (4);
int count = file.View.ReadInt32 (8);
if (!IsSaneCount (count) || index_size >= file.MaxOffset)
return null;
var index = file.View.ReadBytes (0, index_size);
var dir = new List<Entry> (count);
int index_offset = 0x10;
for (int i = 0; i < count; ++i)
{
int entry_pos = index.ToInt32 (index_offset);
index_offset += 4;
int name_length = index[entry_pos];
var name = Binary.GetCString (index, entry_pos+1, name_length-1);
if (0 == name.Length)
return null;
entry_pos += name_length;
var entry = new WsmEntry {
Name = string.Format ("{0}.wav", name),
Type = "audio",
Offset = index.ToUInt32 (entry_pos+8),
Size = index.ToUInt32 (entry_pos+12),
};
if (!entry.CheckPlacement (file.MaxOffset))
return null;
entry.Format.FormatTag = 1;
entry.Format.Channels = index[entry_pos+2];
entry.Format.BitsPerSample = index[entry_pos+3];
entry.Format.SamplesPerSecond = index.ToUInt32 (entry_pos+4);
entry.Format.BlockAlign = (ushort)(entry.Format.Channels * entry.Format.BitsPerSample/8);
entry.Format.AverageBytesPerSecond = entry.Format.SamplesPerSecond * entry.Format.BlockAlign;
dir.Add (entry);
}
return new ArcFile (file, this, dir);
}
public override Stream OpenEntry (ArcFile arc, Entry entry)
{
var went = (WsmEntry)entry;
using (var riff = new MemoryStream (0x2C))
{
WaveAudio.WriteRiffHeader (riff, went.Format, entry.Size);
var input = arc.File.CreateStream (entry.Offset, entry.Size);
return new PrefixStream (riff.ToArray(), input);
}
}
}
internal class WsmEntry : Entry
{
public WaveFormat Format;
}
}

View File

@ -202,6 +202,7 @@ Xross Scramble<br/>
<tr class="odd"><td>*.pac</td><td><tt>PAC1</tt></td><td>No</td><td rowspan="2">RAGE</td><td rowspan="2">
Brightia Plus<br/>
Hana Hiraku<br/>
Hitou Meguri ~Yokujou Juurin Onsen Ki~<br/>
Iinari<br/>
Kyrie ~Blood Royal 3~<br/>
Shiosai no Himei<br/>
@ -339,6 +340,7 @@ Gitai Saimin<br/>
Fukou na Kami<br/>
Saiminjutsu<br/>
Soukan Yuugi 2<br/>
Ura Saiminjutsu 2<br/>
</td></tr>
<tr class="odd"><td>*.bmd</td><td><tt>_BMD</tt></td><td>Yes</td></tr>
<tr class="odd last"><td>*.asd</td><td>-</td><td>No</td></tr>
@ -449,6 +451,7 @@ Doushite Daite Kurenai no!?<span class="footnote">ShiinaRio v2.49</span><br/>
Douryou no Oku-san ~Netori Tsuma, Netorare Tsuma~ <span class="footnote">ShiinaRio v2.46</span><br/>
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/>
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/>
@ -492,6 +495,7 @@ Tekoire Princess!<span class="footnote">ShiinaRio v2.37</span><br/>
Toriko no Chigiri<span class="footnote">ShiinaRio v2.49</span><br/>
Wana ~Hakudaku Mamire no Houkago~<span class="footnote">ShiinaRio v2.36</span><br/>
Wana II ~Gang Rape~<span class="footnote">ShiinaRio v2.44</span><br/>
Yokorenbo ~Immoral Mother~ <span class="footnote">ShiinaRio v2.44</span><br/>
Yoyogi Hitozuma Senmon Gakuin<span class="footnote">ShiinaRio v2.37</span><br/>
Zansho Omimai Moushiagemasu<span class="footnote">ShiinaRio v2.41</span><br/>
</td></tr>
@ -956,6 +960,7 @@ Otto no Mae de Okasarete...<br/>
<tr class="odd"><td>*.arc</td><td>-</td><td>No</td><td rowspan="2">AI6WIN</td><td rowspan="2">
Gakuen Saimin Reido<br/>
Jokei Kazoku 3<br/>
Mama no Oppai ~Ore no Doutei Milk ga Shiboritorareta Ken~<br/>
Shinsou Noise<br/>
</td></tr>
<tr class="odd last"><td>*.akb</td><td><tt>AKB</tt></td><td>No</td></tr>
@ -1383,8 +1388,9 @@ Mite Kudasaimasu?<br/>
<tr class ="odd"><td>*.dpm<br/>*.bin</td><td><tt>DPMX</tt></td><td>No</td><td>Hot Soup Processor</td><td>
femme fatale<br/>
</td></tr>
<tr><td>*.cdt<br/>*.pdt<br/>*.vdt</td><td><tt>RK1</tt></td><td>No</td><td rowspan="2">NEJII</td><td rowspan="2">
<tr><td>*.cdt<br/>*.pdt<br/>*.vdt<br/>*.ovd</td><td><tt>RK1</tt></td><td>No</td><td rowspan="2">NEJII</td><td rowspan="2">
Kidou Houshinki<br/>
Sutadoru!<br/>
</td></tr>
<tr><td class="last">*.pcd</td><td>-</td><td>No</td></tr>
<tr class="odd"><td>*.tac</td><td><tt>TArc1.10</tt><br/><tt>TArc1.00</tt></td><td>No</td><td>TanukiSoft</td><td>
@ -1396,12 +1402,13 @@ Dedenden!<br/>
</td></tr>
<tr class="odd"><td>*.arc</td><td><tt>ARC0</tt></td><td>No</td><td rowspan="7">Will</td><td rowspan="7">
Bishimai Kutsujoku no Heya<br/>
~Miboujin~ Niku Dorei<br/>
</td></tr>
<tr class="odd"><td>*.bmx</td><td>-</td><td>No</td></tr>
<tr class="odd"><td>*.mbf</td><td><tt>MBF0</tt></td><td>No</td></tr>
<tr class="odd"><td>*.vpk</td><td><tt>VPK1</tt></td><td>No</td></tr>
<tr class="odd"><td>*.wrc</td><td><tt>WVX0</tt></td><td>No</td></tr>
<tr class="odd"><td>*.wsm</td><td><tt>WSM2</tt></td><td>No</td></tr>
<tr class="odd"><td>*.wsm</td><td><tt>WSM1</tt><br/><tt>WSM2</tt></td><td>No</td></tr>
<tr class="odd"><td>*</td><td><tt>BC</tt></td><td>No</td></tr>
</table>
<p><a name="note-1" class="footnote">1</a> Non-encrypted only</p>