mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
implemented YGP images.
This commit is contained in:
@@ -82,6 +82,7 @@
|
|||||||
<Compile Include="Hexenhaus\ArcARCC.cs" />
|
<Compile Include="Hexenhaus\ArcARCC.cs" />
|
||||||
<Compile Include="Hexenhaus\ArcODIO.cs" />
|
<Compile Include="Hexenhaus\ArcODIO.cs" />
|
||||||
<Compile Include="Hexenhaus\ArcWAG.cs" />
|
<Compile Include="Hexenhaus\ArcWAG.cs" />
|
||||||
|
<Compile Include="Ikura\ImageYGP.cs" />
|
||||||
<Compile Include="ImageLZ.cs" />
|
<Compile Include="ImageLZ.cs" />
|
||||||
<Compile Include="KiriKiri\ChainReactionCrypt.cs" />
|
<Compile Include="KiriKiri\ChainReactionCrypt.cs" />
|
||||||
<Compile Include="MnoViolet\ImageDIF.cs" />
|
<Compile Include="MnoViolet\ImageDIF.cs" />
|
||||||
|
|||||||
142
ArcFormats/Ikura/ImageYGP.cs
Normal file
142
ArcFormats/Ikura/ImageYGP.cs
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
//! \file ImageYGP.cs
|
||||||
|
//! \date Sun Mar 20 13:24:00 2016
|
||||||
|
//! \brief YGP image format.
|
||||||
|
//
|
||||||
|
// 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.ComponentModel.Composition;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using GameRes.Utility;
|
||||||
|
|
||||||
|
namespace GameRes.Formats.Ikura
|
||||||
|
{
|
||||||
|
internal class YgpMetaData : ImageMetaData
|
||||||
|
{
|
||||||
|
public byte Type;
|
||||||
|
public byte Flags;
|
||||||
|
public int DataOffset;
|
||||||
|
public int DataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export(typeof(ImageFormat))]
|
||||||
|
public class YgpFormat : ImageFormat
|
||||||
|
{
|
||||||
|
public override string Tag { get { return "YGP"; } }
|
||||||
|
public override string Description { get { return "Ikura GDL image format"; } }
|
||||||
|
public override uint Signature { get { return 0x504759; } } // 'YGP'
|
||||||
|
|
||||||
|
public override ImageMetaData ReadMetaData (Stream stream)
|
||||||
|
{
|
||||||
|
stream.Position = 4;
|
||||||
|
using (var reader = new ArcView.Reader (stream))
|
||||||
|
{
|
||||||
|
int mask_pos = reader.ReadUInt16(); // 04
|
||||||
|
byte type = reader.ReadByte(); // 06
|
||||||
|
if (type != 1 && type != 2)
|
||||||
|
return null;
|
||||||
|
var info = new YgpMetaData { Type = type, BPP = 32 };
|
||||||
|
info.Flags = reader.ReadByte(); // 07
|
||||||
|
int header_size = reader.ReadInt32(); // 08
|
||||||
|
stream.Position = header_size;
|
||||||
|
info.DataSize = reader.ReadInt32(); // XX+00
|
||||||
|
info.Width = reader.ReadUInt16(); // XX+04
|
||||||
|
info.Height = reader.ReadUInt16(); // XX+06
|
||||||
|
info.DataOffset = header_size+8;
|
||||||
|
if (0 != (info.Flags & 4))
|
||||||
|
{
|
||||||
|
stream.Position = 0x14;
|
||||||
|
info.OffsetX = reader.ReadInt16();
|
||||||
|
info.OffsetY = reader.ReadInt16();
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ImageData Read (Stream stream, ImageMetaData info)
|
||||||
|
{
|
||||||
|
var meta = (YgpMetaData)info;
|
||||||
|
stream.Position = meta.DataOffset;
|
||||||
|
int stride = (int)meta.Width * 4;
|
||||||
|
var pixels = new byte[stride * (int)meta.Height];
|
||||||
|
if (0 != (meta.Flags & 1))
|
||||||
|
{
|
||||||
|
using (var reader = new ArcView.Reader (stream))
|
||||||
|
Unpack (reader, meta.DataSize, pixels);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stream.Read (pixels, 0, pixels.Length);
|
||||||
|
return ImageData.Create (info, PixelFormats.Bgra32, null, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Unpack (BinaryReader input, int input_size, byte[] output)
|
||||||
|
{
|
||||||
|
int dst = 0;
|
||||||
|
while (input_size > 0)
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
int ctl = input.ReadByte();
|
||||||
|
--input_size;
|
||||||
|
if (0 == (ctl & 0xC0))
|
||||||
|
{
|
||||||
|
count = ((ctl & 0x3F) + 1) * 4;
|
||||||
|
input.Read (output, dst, count);
|
||||||
|
input_size -= count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
|
if (0x40 == (ctl & 0xC0))
|
||||||
|
{
|
||||||
|
count = (ctl & 0x3F) + 1;
|
||||||
|
offset = 1;
|
||||||
|
}
|
||||||
|
else if (0x80 == (ctl & 0xE0))
|
||||||
|
{
|
||||||
|
count = (ctl & 0x1F) + 1;
|
||||||
|
offset = input.ReadByte();
|
||||||
|
--input_size;
|
||||||
|
}
|
||||||
|
else if (0xA0 == (ctl & 0xE0))
|
||||||
|
{
|
||||||
|
count = (ctl & 0x1F) + 1;
|
||||||
|
offset = input.ReadUInt16();
|
||||||
|
input_size -= 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
count *= 4;
|
||||||
|
offset *= 4;
|
||||||
|
Binary.CopyOverlapped (output, dst-offset, dst, count);
|
||||||
|
}
|
||||||
|
dst += count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Write (Stream file, ImageData image)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException ("YgpFormat.Write not implemented");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@ Melty Moment<br/>
|
|||||||
Traveling Stars<br/>
|
Traveling Stars<br/>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td>-</td><td><tt>CompressedBG___</tt></td><td>No</td></tr>
|
<tr><td>-</td><td><tt>CompressedBG___</tt></td><td>No</td></tr>
|
||||||
<tr class="odd"><td>*</td><td>-<br/><tt>SM2MPX10</tt></td><td>No</td><td rowspan="4">DRS</td><td rowspan="4">
|
<tr class="odd"><td>*</td><td>-<br/><tt>SM2MPX10</tt></td><td>No</td><td rowspan="5">DRS</td><td rowspan="5">
|
||||||
Anata no Osanazuma<br/>
|
Anata no Osanazuma<br/>
|
||||||
Ecchi na Bunny-san wa Kirai?<br/>
|
Ecchi na Bunny-san wa Kirai?<br/>
|
||||||
Kana ~Imouto~<br/>
|
Kana ~Imouto~<br/>
|
||||||
@@ -54,12 +54,14 @@ Salmon Pink<br/>
|
|||||||
Shisho-san to Issho<br/>
|
Shisho-san to Issho<br/>
|
||||||
Sensei 2<br/>
|
Sensei 2<br/>
|
||||||
Shoujo Settai<br/>
|
Shoujo Settai<br/>
|
||||||
|
Sumeragi no Miko-tachi<br/>
|
||||||
Suzuri-sensei to 26-ko no Ecchi na Oppai<br/>
|
Suzuri-sensei to 26-ko no Ecchi na Oppai<br/>
|
||||||
Tsukushite Agechau series<br/>
|
Tsukushite Agechau series<br/>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr class="odd"><td>*.ggd</td><td><tt>\xB9\xAA\xB3\xB3</tt><br/><tt>\xAB\xAD\xAA\xBA</tt><br/><tt>\xB7\xB6\xB8\xB7</tt><br/><tt>\xCD\xCA\xC9\xB8</tt></td><td>Yes</td></tr>
|
<tr class="odd"><td>*.ggd</td><td><tt>\xB9\xAA\xB3\xB3</tt><br/><tt>\xAB\xAD\xAA\xBA</tt><br/><tt>\xB7\xB6\xB8\xB7</tt><br/><tt>\xCD\xCA\xC9\xB8</tt></td><td>Yes</td></tr>
|
||||||
<tr class="odd"><td>*.gg1<br/>*.gg2<br/>*.gg3<br/>*.gg0</td><td><tt>GGA00000</tt></td><td>No</td></tr>
|
<tr class="odd"><td>*.gg1<br/>*.gg2<br/>*.gg3<br/>*.gg0</td><td><tt>GGA00000</tt></td><td>No</td></tr>
|
||||||
<tr class="odd"><td>*.ggp</td><td><tt>GGPFAIKE</tt></td><td>No</td></tr>
|
<tr class="odd"><td>*.ggp</td><td><tt>GGPFAIKE</tt></td><td>No</td></tr>
|
||||||
|
<tr class="odd"><td>*.ygp</td><td><tt>YGP</tt></td><td>No</td></tr>
|
||||||
<tr><td>*.bin</td><td><tt>ACPXPK01</tt></td><td>No</td><td>Escu:de<br/>Unison Shift</td><td>
|
<tr><td>*.bin</td><td><tt>ACPXPK01</tt></td><td>No</td><td>Escu:de<br/>Unison Shift</td><td>
|
||||||
Eiyuu x Maou<br/>
|
Eiyuu x Maou<br/>
|
||||||
Wasurenagusa ~Forget-me-Not~<br/>
|
Wasurenagusa ~Forget-me-Not~<br/>
|
||||||
|
|||||||
Reference in New Issue
Block a user