mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 21:55:34 +08:00
implemented Kaguya "AO" images.
This commit is contained in:
parent
0924d385e8
commit
2f7706f228
@ -72,6 +72,7 @@
|
|||||||
<DependentUpon>WidgetMCG.xaml</DependentUpon>
|
<DependentUpon>WidgetMCG.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ImagePSD.cs" />
|
<Compile Include="ImagePSD.cs" />
|
||||||
|
<Compile Include="Kaguya\ImageAO.cs" />
|
||||||
<Compile Include="Propeller\ArcMGR.cs" />
|
<Compile Include="Propeller\ArcMGR.cs" />
|
||||||
<Compile Include="Propeller\ArcMPK.cs" />
|
<Compile Include="Propeller\ArcMPK.cs" />
|
||||||
<Compile Include="Propeller\ImageMGR.cs" />
|
<Compile Include="Propeller\ImageMGR.cs" />
|
||||||
|
88
ArcFormats/Kaguya/ImageAO.cs
Normal file
88
ArcFormats/Kaguya/ImageAO.cs
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
//! \file ImageAO.cs
|
||||||
|
//! \date Tue Nov 24 15:42:43 2015
|
||||||
|
//! \brief KaGuYa script engine image format.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2015 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.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
namespace GameRes.Formats.Kaguya
|
||||||
|
{
|
||||||
|
[Export(typeof(ImageFormat))]
|
||||||
|
public class AoFormat : ApFormat
|
||||||
|
{
|
||||||
|
public override string Tag { get { return "AO/KAGUYA"; } }
|
||||||
|
public override string Description { get { return "KaGuYa script engine image format"; } }
|
||||||
|
public override uint Signature { get { return 0; } }
|
||||||
|
|
||||||
|
public AoFormat ()
|
||||||
|
{
|
||||||
|
Extensions = new string[] { "sp_" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ImageMetaData ReadMetaData (Stream stream)
|
||||||
|
{
|
||||||
|
int A = stream.ReadByte();
|
||||||
|
int O = stream.ReadByte();
|
||||||
|
if ('A' != A || 'O' != O)
|
||||||
|
return null;
|
||||||
|
using (var file = new ArcView.Reader (stream))
|
||||||
|
{
|
||||||
|
var info = new ImageMetaData();
|
||||||
|
info.Width = file.ReadUInt32();
|
||||||
|
info.Height = file.ReadUInt32();
|
||||||
|
info.BPP = file.ReadInt16();
|
||||||
|
info.OffsetX = file.ReadInt32();
|
||||||
|
info.OffsetY = file.ReadInt32();
|
||||||
|
if (info.Width > 0x8000 || info.Height > 0x8000 || !(32 == info.BPP || 24 == info.BPP))
|
||||||
|
return null;
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ImageData Read (Stream stream, ImageMetaData info)
|
||||||
|
{
|
||||||
|
stream.Position = 0x14;
|
||||||
|
return ReadBitmapData (stream, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Write (Stream file, ImageData image)
|
||||||
|
{
|
||||||
|
using (var output = new BinaryWriter (file, Encoding.ASCII, true))
|
||||||
|
{
|
||||||
|
output.Write ((byte)'A');
|
||||||
|
output.Write ((byte)'O');
|
||||||
|
output.Write (image.Width);
|
||||||
|
output.Write (image.Height);
|
||||||
|
output.Write ((short)24);
|
||||||
|
output.Write (image.OffsetX);
|
||||||
|
output.Write (image.OffsetY);
|
||||||
|
WriteBitmapData (file, image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -29,7 +29,6 @@ using System.Text;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using GameRes.Utility;
|
|
||||||
|
|
||||||
namespace GameRes.Formats.Kaguya
|
namespace GameRes.Formats.Kaguya
|
||||||
{
|
{
|
||||||
@ -66,6 +65,11 @@ namespace GameRes.Formats.Kaguya
|
|||||||
public override ImageData Read (Stream stream, ImageMetaData info)
|
public override ImageData Read (Stream stream, ImageMetaData info)
|
||||||
{
|
{
|
||||||
stream.Position = 12;
|
stream.Position = 12;
|
||||||
|
return ReadBitmapData (stream, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ImageData ReadBitmapData (Stream stream, ImageMetaData info)
|
||||||
|
{
|
||||||
int stride = (int)info.Width*4;
|
int stride = (int)info.Width*4;
|
||||||
var pixels = new byte[stride*info.Height];
|
var pixels = new byte[stride*info.Height];
|
||||||
for (int row = (int)info.Height-1; row >= 0; --row)
|
for (int row = (int)info.Height-1; row >= 0; --row)
|
||||||
@ -86,21 +90,25 @@ namespace GameRes.Formats.Kaguya
|
|||||||
output.Write (image.Width);
|
output.Write (image.Width);
|
||||||
output.Write (image.Height);
|
output.Write (image.Height);
|
||||||
output.Write ((short)24);
|
output.Write ((short)24);
|
||||||
|
WriteBitmapData (file, image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var bitmap = image.Bitmap;
|
protected void WriteBitmapData (Stream file, ImageData image)
|
||||||
if (bitmap.Format != PixelFormats.Bgra32)
|
{
|
||||||
{
|
var bitmap = image.Bitmap;
|
||||||
bitmap = new FormatConvertedBitmap (bitmap, PixelFormats.Bgra32, null, 0);
|
if (bitmap.Format != PixelFormats.Bgra32)
|
||||||
}
|
{
|
||||||
int stride = (int)image.Width * 4;
|
bitmap = new FormatConvertedBitmap (bitmap, PixelFormats.Bgra32, null, 0);
|
||||||
byte[] row_data = new byte[stride];
|
}
|
||||||
Int32Rect rect = new Int32Rect (0, (int)image.Height, (int)image.Width, 1);
|
int stride = (int)image.Width * 4;
|
||||||
for (uint row = 0; row < image.Height; ++row)
|
byte[] row_data = new byte[stride];
|
||||||
{
|
Int32Rect rect = new Int32Rect (0, (int)image.Height, (int)image.Width, 1);
|
||||||
--rect.Y;
|
for (uint row = 0; row < image.Height; ++row)
|
||||||
bitmap.CopyPixels (rect, row_data, stride, 0);
|
{
|
||||||
output.Write (row_data);
|
--rect.Y;
|
||||||
}
|
bitmap.CopyPixels (rect, row_data, stride, 0);
|
||||||
|
file.Write (row_data, 0, row_data.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,12 +308,13 @@ Yatohime Zankikou<br/>
|
|||||||
<tr class="odd"><td>*.eri<br/>*.mio</td><td><tt>Entis\x1a</tt></td><td>No</td></tr>
|
<tr class="odd"><td>*.eri<br/>*.mio</td><td><tt>Entis\x1a</tt></td><td>No</td></tr>
|
||||||
<tr><td>*.saf</td><td>-</td><td>No</td><td>Lune</td><td>Rinkan Gakuen</td></tr>
|
<tr><td>*.saf</td><td>-</td><td>No</td><td>Lune</td><td>Rinkan Gakuen</td></tr>
|
||||||
<tr class="odd"><td>*.arc+*.ari</td><td><tt>WFL1</tt></td><td>No</td><td rowspan="2">KaGuYa</td><td rowspan="2">
|
<tr class="odd"><td>*.arc+*.ari</td><td><tt>WFL1</tt></td><td>No</td><td rowspan="2">KaGuYa</td><td rowspan="2">
|
||||||
|
Dungeon Crusaderz 2 ~Eigou no Rakudo~<br/>
|
||||||
Onna Kyoushi<br/>
|
Onna Kyoushi<br/>
|
||||||
Medorei ~Okasareta Houkago~<br/>
|
Medorei ~Okasareta Houkago~<br/>
|
||||||
Serina<br/>
|
Serina<br/>
|
||||||
Ura Nyuugaku ~Ineki ni Nureta Kyoukasho~<br/>
|
Ura Nyuugaku ~Ineki ni Nureta Kyoukasho~<br/>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr class="odd"><td>*.bg_<br/>*.cg_</td><td><tt>AP</tt></td><td>Yes</td></tr>
|
<tr class="odd"><td>*.bg_<br/>*.cg_<br/>*.sp_</td><td><tt>AP</tt><br/><tt>AO</tt></td><td>Yes</td></tr>
|
||||||
<tr><td>*.dpk</td><td><tt>DPK</tt></td><td>No</td><td rowspan="2">DAC</td><td rowspan="2">Yumemiru Tsuki no Lunalutia</td></tr>
|
<tr><td>*.dpk</td><td><tt>DPK</tt></td><td>No</td><td rowspan="2">DAC</td><td rowspan="2">Yumemiru Tsuki no Lunalutia</td></tr>
|
||||||
<tr><td>*.dgc</td><td><tt>DGC</tt></td><td>No</td></tr>
|
<tr><td>*.dgc</td><td><tt>DGC</tt></td><td>No</td></tr>
|
||||||
<tr class="odd"><td>*.pck</td><td>-</td><td>No</td><td rowspan="5">Crowd</td><td rowspan="5">
|
<tr class="odd"><td>*.pck</td><td>-</td><td>No</td><td rowspan="5">Crowd</td><td rowspan="5">
|
||||||
|
Loading…
Reference in New Issue
Block a user