mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
75
Legacy/Gsx/ImageK4.cs
Normal file
75
Legacy/Gsx/ImageK4.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
//! \file ImageK4.cs
|
||||
//! \date 2019 Feb 07
|
||||
//! \brief Toyo GSX image format.
|
||||
//
|
||||
// Copyright (C) 2019 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;
|
||||
|
||||
// [030825][Mirai] Hoshi no Oujo
|
||||
|
||||
namespace GameRes.Formats.Gsx
|
||||
{
|
||||
internal class K4MetaData : ImageMetaData
|
||||
{
|
||||
public bool HasAlpha;
|
||||
public int FrameCount;
|
||||
}
|
||||
|
||||
[Export(typeof(ImageFormat))]
|
||||
public class K4Format : ImageFormat
|
||||
{
|
||||
public override string Tag { get { return "K4"; } }
|
||||
public override string Description { get { return "Toyo GSX image format"; } }
|
||||
public override uint Signature { get { return 0x0201344B; } } // 'K4'
|
||||
|
||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||
{
|
||||
var header = file.ReadHeader (0x10);
|
||||
if (!header.AsciiEqual ("K4"))
|
||||
return null;
|
||||
if (header[2] != 1 || header[3] != 2)
|
||||
return null;
|
||||
return new K4MetaData {
|
||||
Width = header.ToUInt16 (4),
|
||||
Height = header.ToUInt16 (6),
|
||||
BPP = header[0xF],
|
||||
HasAlpha = header[0xB] != 0,
|
||||
FrameCount = header.ToUInt16 (0xC),
|
||||
};
|
||||
}
|
||||
|
||||
public override ImageData Read (IBinaryStream file, ImageMetaData info)
|
||||
{
|
||||
var meta = (K4MetaData)info;
|
||||
|
||||
return ImageData.Create (info, format, palette, pixels);
|
||||
}
|
||||
|
||||
public override void Write (Stream file, ImageData image)
|
||||
{
|
||||
throw new System.NotImplementedException ("K4Format.Write not implemented");
|
||||
}
|
||||
}
|
||||
}
|
||||
62
Legacy/HyperWorks/ImageI24.cs
Normal file
62
Legacy/HyperWorks/ImageI24.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
//! \file ImageI24.cs
|
||||
//! \date 2019 Jun 22
|
||||
//! \brief HyperWorks image format.
|
||||
//
|
||||
// Copyright (C) 2019 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;
|
||||
|
||||
namespace GameRes.Formats.HyperWorks
|
||||
{
|
||||
[Export(typeof(ImageFormat))]
|
||||
public class I24Format : ImageFormat
|
||||
{
|
||||
public override string Tag { get { return "I24"; } }
|
||||
public override string Description { get { return "HyperWorks image format"; } }
|
||||
public override uint Signature { get { return 0x41343249; } } // 'I24A'
|
||||
|
||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||
{
|
||||
var header = file.ReadHeader (0x18);
|
||||
int bpp = header.ToInt16 (0x10);
|
||||
if (bpp != 24)
|
||||
return null;
|
||||
return new ImageMetaData {
|
||||
Width = header.ToUInt16 (0xC),
|
||||
Height = header.ToUInt16 (0xE),
|
||||
BPP = bpp,
|
||||
};
|
||||
}
|
||||
|
||||
public override ImageData Read (IBinaryStream file, ImageMetaData info)
|
||||
{
|
||||
return ImageData.Create (info, format, palette, pixels);
|
||||
}
|
||||
|
||||
public override void Write (Stream file, ImageData image)
|
||||
{
|
||||
throw new System.NotImplementedException ("I24Format.Write not implemented");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,10 +39,17 @@ namespace GameRes.Formats.KApp
|
||||
public override string Description { get { return "KApp compressed image format"; } }
|
||||
public override uint Signature { get { return 0x6F6F746B; } } // 'ktool210'
|
||||
|
||||
public CgdFormat ()
|
||||
{
|
||||
Signatures = new uint[] { 0x6F6F746B, 0x65697073 };
|
||||
}
|
||||
|
||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||
{
|
||||
var header = file.ReadHeader (0x18);
|
||||
if (!header.AsciiEqual ("ktool210") || header.ToInt32 (8) != 1)
|
||||
if (header.ToInt32 (8) != 1)
|
||||
return null;
|
||||
if (!header.AsciiEqual ("ktool210") && !header.AsciiEqual ("spiel100"))
|
||||
return null;
|
||||
uint offset = header.ToUInt32 (0x10) & 0x7FFFFFFF;
|
||||
return CgdMetaData.FromStream (file, offset);
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
<Compile Include="FazeX\ImageFGP.cs" />
|
||||
<Compile Include="HillField\ImageIMA.cs" />
|
||||
<Compile Include="HillField\ImageIMG.cs" />
|
||||
<Compile Include="hmp\ImageALP.cs" />
|
||||
<Compile Include="KApp\ArcASD.cs" />
|
||||
<Compile Include="KApp\ImageCGD.cs" />
|
||||
<Compile Include="Kasane\ArcAR2.cs" />
|
||||
@@ -226,6 +227,7 @@
|
||||
<Compile Include="Nekotaro\ArcNSC.cs" />
|
||||
<Compile Include="Nekotaro\ImageGCmp.cs" />
|
||||
<Compile Include="PlanTech\ArcPAC.cs" />
|
||||
<Compile Include="Zenos\ImagePNX.cs" />
|
||||
<Compile Include="Zone\ArcPKD.cs" />
|
||||
<Compile Include="Zone\ImageBM_.cs" />
|
||||
<None Include="app.config" />
|
||||
|
||||
@@ -27,6 +27,7 @@ using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace GameRes.Formats.Pochette
|
||||
@@ -93,15 +94,21 @@ namespace GameRes.Formats.Pochette
|
||||
|
||||
BitmapSource BlendBaseLine (BitmapSource overlay, GdtMetaData meta)
|
||||
{
|
||||
string base_name = VFS.ChangeFileName (meta.FileName, meta.BaseLine+".gdt");
|
||||
string base_name = VFS.ChangeFileName (meta.FileName, meta.BaseLine);
|
||||
if (!VFS.FileExists (base_name))
|
||||
return overlay;
|
||||
{
|
||||
base_name += ".gdt";
|
||||
if (!VFS.FileExists (base_name))
|
||||
return overlay;
|
||||
}
|
||||
using (var base_file = VFS.OpenBinaryStream (base_name))
|
||||
{
|
||||
var base_info = ReadMetaData (base_file) as GdtMetaData;
|
||||
if (null == base_info)
|
||||
return overlay;
|
||||
var base_image = ReadBitmapSource (base_file, base_info);
|
||||
if (base_image.Format.BitsPerPixel < 24)
|
||||
base_image = new FormatConvertedBitmap (base_image, PixelFormats.Bgr32, null, 0);
|
||||
var canvas = new WriteableBitmap (base_image);
|
||||
int canvas_bpp = canvas.Format.BitsPerPixel;
|
||||
if (canvas_bpp != overlay.Format.BitsPerPixel)
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion ("1.0.10.196")]
|
||||
[assembly: AssemblyFileVersion ("1.0.10.196")]
|
||||
[assembly: AssemblyVersion ("1.0.10.198")]
|
||||
[assembly: AssemblyFileVersion ("1.0.10.198")]
|
||||
|
||||
64
Legacy/Zenos/ImagePNX.cs
Normal file
64
Legacy/Zenos/ImagePNX.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
//! \file ImagePNX.cs
|
||||
//! \date 2022 Apr 14
|
||||
//! \brief Obfuscated PNG image.
|
||||
//
|
||||
// Copyright (C) 2022 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;
|
||||
|
||||
namespace GameRes.Formats.Zenos
|
||||
{
|
||||
[Export(typeof(ImageFormat))]
|
||||
public class PnxFormat : PngFormat
|
||||
{
|
||||
public override string Tag { get { return "PNX/ZENOS"; } }
|
||||
public override string Description { get { return "Obfuscated PNG image"; } }
|
||||
public override uint Signature { get { return 0x584E5089; } }
|
||||
public override bool CanWrite { get { return false; } }
|
||||
|
||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||
{
|
||||
using (var input = DeobfuscateStream (file))
|
||||
return base.ReadMetaData (input);
|
||||
}
|
||||
|
||||
public override ImageData Read (IBinaryStream file, ImageMetaData info)
|
||||
{
|
||||
using (var input = DeobfuscateStream (file))
|
||||
return base.Read (input, info);
|
||||
}
|
||||
|
||||
IBinaryStream DeobfuscateStream (IBinaryStream file)
|
||||
{
|
||||
var body = new StreamRegion (file.AsStream, 8, file.Length-8, true);
|
||||
var png = new PrefixStream (HeaderBytes, body);
|
||||
return new BinaryStream (png, file.Name);
|
||||
}
|
||||
|
||||
public override void Write (Stream file, ImageData image)
|
||||
{
|
||||
throw new System.NotImplementedException ("PnxFormat.Write not implemented");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup></configuration>
|
||||
</configuration>
|
||||
60
Legacy/hmp/ImageALP.cs
Normal file
60
Legacy/hmp/ImageALP.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
//! \file ImageALP.cs
|
||||
//! \date 2022 Apr 22
|
||||
//! \brief BeF bitmap mask
|
||||
//
|
||||
// Copyright (C) 2022 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;
|
||||
|
||||
namespace GameRes.Formats.Hmp
|
||||
{
|
||||
[Export(typeof(ImageFormat))]
|
||||
[ExportMetadata("Priority", -1)]
|
||||
public class AlpFormat : ImageFormat
|
||||
{
|
||||
public override string Tag { get { return "ALP/BeF"; } }
|
||||
public override string Description { get { return "BeF bitmap mask format"; } }
|
||||
public override uint Signature { get { return 0; } }
|
||||
|
||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||
{
|
||||
if (!file.Name.HasExtension (".alp") || file.Length != 0x25800)
|
||||
return null;
|
||||
return new ImageMetaData { Width = 320, Height = 480, BPP = 8 };
|
||||
}
|
||||
|
||||
public override ImageData Read (IBinaryStream file, ImageMetaData info)
|
||||
{
|
||||
var pixels = file.ReadBytes (0x25800);
|
||||
for (int i = 0; i < pixels.Length; ++i)
|
||||
pixels[i] = (byte)(pixels[i] * 0xFF / 0x40);
|
||||
return ImageData.Create (info, PixelFormats.Gray8, null, pixels);
|
||||
}
|
||||
|
||||
public override void Write (Stream file, ImageData image)
|
||||
{
|
||||
throw new System.NotImplementedException ("AlpFormat.Write not implemented");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user