mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 21:55:34 +08:00
implemented EENC images and UM3 audio.
This commit is contained in:
parent
db22d43f4a
commit
880245fea4
@ -72,6 +72,8 @@
|
||||
</Compile>
|
||||
<Compile Include="Ankh\ArcGRP.cs" />
|
||||
<Compile Include="ArcCG.cs" />
|
||||
<Compile Include="Bruns\AudioUM3.cs" />
|
||||
<Compile Include="Bruns\ImageEENC.cs" />
|
||||
<Compile Include="LiveMaker\ArcVF.cs" />
|
||||
<Compile Include="ArcZIP.cs" />
|
||||
<Compile Include="AudioVOC.cs" />
|
||||
|
86
ArcFormats/Bruns/AudioUM3.cs
Normal file
86
ArcFormats/Bruns/AudioUM3.cs
Normal file
@ -0,0 +1,86 @@
|
||||
//! \file AudioUM3.cs
|
||||
//! \date Sat Jun 18 11:11:29 2016
|
||||
//! \brief UltraMarine3 encrypted OGG vorbis audio.
|
||||
//
|
||||
// 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.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace GameRes.Formats
|
||||
{
|
||||
[Export(typeof(AudioFormat))]
|
||||
public class Um3Audio : AudioFormat
|
||||
{
|
||||
public override string Tag { get { return "UM3"; } }
|
||||
public override string Description { get { return "UltraMarine3 audio format (Ogg/Vorbis)"; } }
|
||||
public override uint Signature { get { return 0xAC9898B0; } } // ~'OggS'
|
||||
|
||||
public override SoundInput TryOpen (Stream file)
|
||||
{
|
||||
return new OggInput (new Um3Stream (file));
|
||||
}
|
||||
}
|
||||
|
||||
internal class Um3Stream : ProxyStream
|
||||
{
|
||||
public Um3Stream (Stream main, bool leave_open = false)
|
||||
: base (main, leave_open)
|
||||
{
|
||||
}
|
||||
|
||||
public override int Read (byte[] buffer, int offset, int count)
|
||||
{
|
||||
var pos = Position;
|
||||
int read = BaseStream.Read (buffer, offset, count);
|
||||
if (pos < 0x800 && read > 0)
|
||||
{
|
||||
int enc_count = Math.Min (0x800 - (int)pos, read);
|
||||
for (int i = 0; i < enc_count; ++i)
|
||||
{
|
||||
buffer[offset+i] ^= 0xFF;
|
||||
}
|
||||
}
|
||||
return read;
|
||||
}
|
||||
|
||||
public override int ReadByte ()
|
||||
{
|
||||
var pos = Position;
|
||||
int b = BaseStream.ReadByte();
|
||||
if (-1 != b && pos < 0x800)
|
||||
b ^= 0xFF;
|
||||
return b;
|
||||
}
|
||||
|
||||
public override void Write (byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException ("Um3Stream.Write not supported");
|
||||
}
|
||||
|
||||
public override void WriteByte (byte value)
|
||||
{
|
||||
throw new NotSupportedException ("Um3Stream.Write not supported");
|
||||
}
|
||||
}
|
||||
}
|
165
ArcFormats/Bruns/ImageEENC.cs
Normal file
165
ArcFormats/Bruns/ImageEENC.cs
Normal file
@ -0,0 +1,165 @@
|
||||
//! \file ImageEENC.cs
|
||||
//! \date Sat Jun 18 06:26:23 2016
|
||||
//! \brief SepterApp encrypted images.
|
||||
//
|
||||
// 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.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using GameRes.Compression;
|
||||
using GameRes.Utility;
|
||||
|
||||
namespace GameRes.Formats.Bruns
|
||||
{
|
||||
internal class EencMetaData : ImageMetaData
|
||||
{
|
||||
public uint Key;
|
||||
public ImageMetaData Info;
|
||||
public ImageFormat Format;
|
||||
public bool Compressed;
|
||||
}
|
||||
|
||||
[Export(typeof(ImageFormat))]
|
||||
public class EencFormat : ImageFormat
|
||||
{
|
||||
public override string Tag { get { return "EENC"; } }
|
||||
public override string Description { get { return "Bruns system encrypted image"; } }
|
||||
public override uint Signature { get { return 0x434E4545; } } // 'EENC'
|
||||
|
||||
static readonly uint EencKey = 0xDEADBEEF;
|
||||
|
||||
public EencFormat ()
|
||||
{
|
||||
Extensions = new string[] { "brs", "png", "bmp" };
|
||||
Signatures = new uint[] { 0x434E4545, 0x5A4E4545 }; // 'EENC', 'EENZ'
|
||||
}
|
||||
|
||||
public override ImageMetaData ReadMetaData (Stream stream)
|
||||
{
|
||||
var header = new byte[8];
|
||||
if (8 != stream.Read (header, 0, 8))
|
||||
return null;
|
||||
bool compressed = 'Z' == header[3];
|
||||
uint key = LittleEndian.ToUInt32 (header, 4) ^ EencKey;
|
||||
Stream input = new StreamRegion (stream, 8, true);
|
||||
try
|
||||
{
|
||||
input = new EencStream (input, key);
|
||||
if (compressed)
|
||||
{
|
||||
input = new ZLibStream (input, CompressionMode.Decompress);
|
||||
input = new SeekableStream (input);
|
||||
}
|
||||
var format = FindFormat (input);
|
||||
if (null == format)
|
||||
return null;
|
||||
return new EencMetaData
|
||||
{
|
||||
Width = format.Item2.Width,
|
||||
Height = format.Item2.Height,
|
||||
BPP = format.Item2.BPP,
|
||||
Key = key,
|
||||
Info = format.Item2,
|
||||
Format = format.Item1,
|
||||
Compressed = compressed,
|
||||
};
|
||||
}
|
||||
finally
|
||||
{
|
||||
input.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public override ImageData Read (Stream stream, ImageMetaData info)
|
||||
{
|
||||
var meta = (EencMetaData)info;
|
||||
meta.Info.FileName = info.FileName;
|
||||
Stream input = new StreamRegion (stream, 8, true);
|
||||
try
|
||||
{
|
||||
input = new EencStream (input, meta.Key);
|
||||
if (meta.Compressed)
|
||||
input = new ZLibStream (input, CompressionMode.Decompress);
|
||||
return meta.Format.Read (input, meta.Info);
|
||||
}
|
||||
finally
|
||||
{
|
||||
input.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write (Stream file, ImageData image)
|
||||
{
|
||||
throw new System.NotImplementedException ("EencFormat.Write not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
internal class EencStream : ProxyStream
|
||||
{
|
||||
uint m_key;
|
||||
|
||||
public EencStream (Stream main, uint key, bool leave_open = false)
|
||||
: base (main, leave_open)
|
||||
{
|
||||
m_key = key;
|
||||
}
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
|
||||
public override int Read (byte[] buffer, int offset, int count)
|
||||
{
|
||||
int pos = (int)Position & 3;
|
||||
int read = BaseStream.Read (buffer, offset, count);
|
||||
for (int i = 0; i < read; ++i)
|
||||
{
|
||||
buffer[offset+i] ^= (byte)(m_key >> (pos << 3));
|
||||
pos = (pos + 1) & 3;
|
||||
}
|
||||
return read;
|
||||
}
|
||||
|
||||
public override int ReadByte ()
|
||||
{
|
||||
int pos = (int)Position & 3;
|
||||
int b = BaseStream.ReadByte();
|
||||
if (-1 != b)
|
||||
b ^= (byte)(m_key >> (pos << 3));
|
||||
return b;
|
||||
}
|
||||
|
||||
public override void SetLength (long length)
|
||||
{
|
||||
throw new NotSupportedException ("EencStream.SetLength method is not supported");
|
||||
}
|
||||
|
||||
public override void Write (byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException ("EencStream.Write method is not supported");
|
||||
}
|
||||
|
||||
public override void WriteByte (byte value)
|
||||
{
|
||||
throw new NotSupportedException ("EencStream.WriteByte method is not supported");
|
||||
}
|
||||
}
|
||||
}
|
@ -98,10 +98,12 @@ Okaa-san ga Ippai!<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.pak</td><td><tt>HyPack</tt></td><td>Yes</td><td>Kogado</td><td>Symphonic Rain</td></tr>
|
||||
<tr><td>*+*.lst</td><td>-</td><td>No</td><td rowspan="2">Nexton LikeC</td><td rowspan="2">
|
||||
Chikan Ou ~Inkoku no Souzousha~<br/>
|
||||
Injoku Shinryuu Club<br/>
|
||||
Moon.<br/>
|
||||
Ryoujoku Famiresu Choukyou Menu<br/>
|
||||
Ryoujoku Idol Mesu Dorei<br/>
|
||||
Sentoreido Gakuen<br/>
|
||||
Yakuchu!<br/>
|
||||
</td></tr>
|
||||
<tr><td>*.tgf</td><td>-</td><td>No</td></tr>
|
||||
@ -216,6 +218,7 @@ Coμ<br/>
|
||||
Crime Rhyme series<br/>
|
||||
Damegane<br/>
|
||||
Distance<br/>
|
||||
ExE<br/>
|
||||
Fate/stay night<br/>
|
||||
Fate/hollow ataraxia<br/>
|
||||
G-senjou no Maou<br/>
|
||||
@ -249,6 +252,9 @@ Zecchou Spiral!!<br/>
|
||||
<tr><td>*.tlg</td><td><tt>TLG0.0</tt><br/><tt>TLG5.0</tt><br/><tt>TLG6.0</tt></td><td>No</td></tr>
|
||||
<tr class="odd"><td>*.ypf</td><td><tt>YPF</tt></td><td>Yes</td><td rowspan="2">YU-RIS</td><td rowspan="2">
|
||||
Eroge! ~H mo Game mo Kaihatsu Zanmai~<br/>
|
||||
Mamono Musume-tachi to no Rakuen ~Slime & Scylla~<br/>
|
||||
Sei Monmusu Festival!!<br/>
|
||||
Shin Chikan Ou<br/>
|
||||
Unionism Quartet<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.ycg</td><td><tt>YCG</tt></td><td>No</td></tr>
|
||||
@ -391,6 +397,7 @@ Shuffle! Essence+<br/>
|
||||
<tr><td>*.arc</td><td><tt>ARC\x1a</tt><br><tt>ARC</tt></td><td>No</td><td rowspan="2">AZ System</td><td rowspan="2">
|
||||
Clover Heart's<br/>
|
||||
Geki Tama! ~Seiryou Gakuen Engeki Bu~<br/>
|
||||
Maria ~Tenshi no Kiss to Akuma no Hanayome~<br/>
|
||||
Triptych<br/>
|
||||
Tsurugi Otome Noah<br/>
|
||||
</td></tr>
|
||||
@ -540,6 +547,7 @@ Samurai Jupiter<br/>
|
||||
Sora no Iro, Mizu no Iro<br/>
|
||||
Thunder Claps!<br/>
|
||||
Tokumei Kyoushi Hitomi<br/>
|
||||
Toshiue Lesson ~Mama to Oba-san to Sensei to~<br/>
|
||||
</td></tr>
|
||||
<tr><td>*.iks</td><td><tt>NPSR</tt></td><td>No</td><td>X[iks]</td><td>Shikkan ~Hazukashimerareta Karada, Oreta Kokoro~</td></tr>
|
||||
<tr class="odd"><td>*.wbp</td><td><tt>ARCFORM3 WBUG</tt></td><td>No</td><td rowspan="4">Wild Bug</td><td rowspan="4">
|
||||
@ -753,6 +761,7 @@ AstralAir no Shiroki Towa<br/>
|
||||
<tr class="odd"><td>*.bin</td><td><tt>ESC-ARC1</tt><br/><tt>ESC-ARC2</tt></td><td>No</td><td>Escu:de</td><td>
|
||||
Otome Renshin Prister<br/>
|
||||
Suisei Tenshi Primaveil Zwei<br/>
|
||||
Verdia Gensoukyoku<br/>
|
||||
Wondering Repair!<br/>
|
||||
</td></tr>
|
||||
<tr><td>*.pac</td><td>-</td><td>No</td><td>Tmr-Hiro ADV System</td><td>
|
||||
@ -834,6 +843,7 @@ Angenehm Platz -Kleiner Garten Sie Erstellen-<br/>
|
||||
Ase Nure Shoujo Misaki "Anata no Nioi de Icchau!"<br/>
|
||||
D-spray Biyaku de Motemote Kachou Dairi Hosa<br/>
|
||||
Hitomi no Rakuin ~Inbaku no Mesu Dorei~<br/>
|
||||
Jokujima<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.grp</td><td>-</td><td>No</td><td>Ankh</td><td>
|
||||
Mozu<br/>
|
||||
@ -883,6 +893,11 @@ Grope ~Yami no Naka no Kotori-tachi~<br/>
|
||||
Ryoujoku Seifuku Jogakuen ~Chimitsu ni Nureta Seifuku~<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.gal</td><td><tt>Gale105</tt><br/><tt>Gale106</tt></td><td>No</td></tr>
|
||||
<tr><td>*.png<br/>*.bmp</td><td><tt>EENC</tt><br/><tt>EENZ</tt></td><td>No</td><td rowspan="2">Bruns</td><td rowspan="2">
|
||||
Majiyome<br/>
|
||||
Uchi no Tsuma Dakimasenka?<br/>
|
||||
</td></tr>
|
||||
<tr><td>*.um3</td><td><tt>\xB0\x98\x98\xAC</tt></td><td>No</td></tr>
|
||||
</table>
|
||||
<p><a name="note-1" class="footnote">1</a> Non-encrypted only</p>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user