mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 07:34:00 +08:00
support_kaguya_PL_arc
This commit is contained in:
parent
6b65a173fb
commit
01a2b34c5d
@ -215,6 +215,8 @@
|
|||||||
<Compile Include="Interheart\ArcFPK2.cs" />
|
<Compile Include="Interheart\ArcFPK2.cs" />
|
||||||
<Compile Include="Interheart\ImageCandy.cs" />
|
<Compile Include="Interheart\ImageCandy.cs" />
|
||||||
<Compile Include="Ivory\ArcSG.cs" />
|
<Compile Include="Ivory\ArcSG.cs" />
|
||||||
|
<Compile Include="Kaguya\ArcPL00.cs" />
|
||||||
|
<Compile Include="Kaguya\ArcPL10.cs" />
|
||||||
<Compile Include="Key\ArcPAK.cs" />
|
<Compile Include="Key\ArcPAK.cs" />
|
||||||
<Compile Include="Key\AudioOGGPAK.cs" />
|
<Compile Include="Key\AudioOGGPAK.cs" />
|
||||||
<Compile Include="Key\ImageCZ.cs" />
|
<Compile Include="Key\ImageCZ.cs" />
|
||||||
|
@ -649,6 +649,7 @@ namespace GameRes.Formats.Kaguya
|
|||||||
{
|
{
|
||||||
table.Add (new Tuple<string, Decryptor> ("AN00", (a, e) => DecryptAn00 (a, e)));
|
table.Add (new Tuple<string, Decryptor> ("AN00", (a, e) => DecryptAn00 (a, e)));
|
||||||
table.Add (new Tuple<string, Decryptor> ("AN21", (a, e) => DecryptAn21 (a, e)));
|
table.Add (new Tuple<string, Decryptor> ("AN21", (a, e) => DecryptAn21 (a, e)));
|
||||||
|
table.Add (new Tuple<string, Decryptor> ("PL00", (a, e) => DecryptPL00 (a, e)));
|
||||||
table.Add (new Tuple<string, Decryptor> ("PL10", (a, e) => DecryptPL10 (a, e)));
|
table.Add (new Tuple<string, Decryptor> ("PL10", (a, e) => DecryptPL10 (a, e)));
|
||||||
}
|
}
|
||||||
m_type_table = table.ToArray();
|
m_type_table = table.ToArray();
|
||||||
@ -719,6 +720,25 @@ namespace GameRes.Formats.Kaguya
|
|||||||
return new BinMemoryStream (data, entry.Name);
|
return new BinMemoryStream (data, entry.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Stream DecryptPL00(LinkArchive arc, LinkEntry entry)
|
||||||
|
{
|
||||||
|
var data = arc.File.View.ReadBytes(entry.Offset, entry.Size);
|
||||||
|
int count = data.ToUInt16(4);
|
||||||
|
int offset = 22;
|
||||||
|
for(int i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
offset += 8;
|
||||||
|
int w = data.ToInt32(offset);
|
||||||
|
int h = data.ToInt32(offset + 4);
|
||||||
|
int channels = data.ToInt32(offset + 8);
|
||||||
|
int size = channels * w * h;
|
||||||
|
offset += 12;
|
||||||
|
DecryptData(data, offset, size);
|
||||||
|
offset += size;
|
||||||
|
}
|
||||||
|
return new BinMemoryStream(data, entry.Name);
|
||||||
|
}
|
||||||
|
|
||||||
Stream DecryptPL10(LinkArchive arc, LinkEntry entry)
|
Stream DecryptPL10(LinkArchive arc, LinkEntry entry)
|
||||||
{
|
{
|
||||||
var data = arc.File.View.ReadBytes(entry.Offset, entry.Size);
|
var data = arc.File.View.ReadBytes(entry.Offset, entry.Size);
|
||||||
|
126
ArcFormats/Kaguya/ArcPL00.cs
Normal file
126
ArcFormats/Kaguya/ArcPL00.cs
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
//! \file ArcAN21.cs
|
||||||
|
//! \date Sun Apr 30 21:04:25 2017
|
||||||
|
//! \brief KaGuYa script engine animation resource.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017 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.Collections.Generic;
|
||||||
|
using System.ComponentModel.Composition;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace GameRes.Formats.Kaguya
|
||||||
|
{
|
||||||
|
class PL00Entry : PackedEntry
|
||||||
|
{
|
||||||
|
public int FrameIndex;
|
||||||
|
public ImageMetaData ImageInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export(typeof(ArchiveFormat))]
|
||||||
|
public class PL00Opener : ArchiveFormat
|
||||||
|
{
|
||||||
|
public override string Tag { get { return "PL00/KAGUYA"; } }
|
||||||
|
public override string Description { get { return "KaGuYa script engine animation resource"; } }
|
||||||
|
public override uint Signature { get { return 0x30304C50; } } // 'PL00'
|
||||||
|
public override bool IsHierarchic { get { return false; } }
|
||||||
|
public override bool CanWrite { get { return false; } }
|
||||||
|
|
||||||
|
public PL00Opener()
|
||||||
|
{
|
||||||
|
Extensions = new string[] { "plt" };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ArcFile TryOpen(ArcView file)
|
||||||
|
{
|
||||||
|
uint current_offset = 4;
|
||||||
|
int frame_count = file.View.ReadUInt16(current_offset);
|
||||||
|
if (!IsSaneCount(frame_count))
|
||||||
|
return null;
|
||||||
|
current_offset += 2;
|
||||||
|
string base_name = Path.GetFileNameWithoutExtension(file.Name);
|
||||||
|
var dir = new List<Entry>(frame_count);
|
||||||
|
var info = new ImageMetaData
|
||||||
|
{
|
||||||
|
OffsetX = file.View.ReadInt32(current_offset),
|
||||||
|
OffsetY = file.View.ReadInt32(current_offset + 4),
|
||||||
|
Width = file.View.ReadUInt32(current_offset + 8),
|
||||||
|
Height = file.View.ReadUInt32(current_offset + 12),
|
||||||
|
};
|
||||||
|
int channels = file.View.ReadInt32(38);
|
||||||
|
info.BPP = channels * 8;
|
||||||
|
current_offset += 16;
|
||||||
|
for (int i = 0; i < frame_count; ++i)
|
||||||
|
{
|
||||||
|
int offsetx = file.View.ReadInt32(current_offset);
|
||||||
|
int offsety = file.View.ReadInt32(current_offset + 4);
|
||||||
|
uint width = file.View.ReadUInt32(current_offset + 8);
|
||||||
|
uint height = file.View.ReadUInt32(current_offset + 12);
|
||||||
|
channels = file.View.ReadInt32(current_offset + 16);
|
||||||
|
uint size = (uint)(width * height * channels);
|
||||||
|
current_offset += 20;
|
||||||
|
var entry = new PL00Entry
|
||||||
|
{
|
||||||
|
FrameIndex = i,
|
||||||
|
Name = string.Format("{0}#{1:D2}", base_name, i),
|
||||||
|
Type = "image",
|
||||||
|
Offset = current_offset,
|
||||||
|
Size = size,
|
||||||
|
IsPacked = false,
|
||||||
|
ImageInfo = new ImageMetaData
|
||||||
|
{
|
||||||
|
OffsetX = offsetx,
|
||||||
|
OffsetY = offsety,
|
||||||
|
Width = width,
|
||||||
|
Height = height,
|
||||||
|
BPP = channels * 8,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dir.Add(entry);
|
||||||
|
current_offset += size;
|
||||||
|
}
|
||||||
|
return new PL00Archive(file, this, dir, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IImageDecoder OpenImage(ArcFile arc, Entry entry)
|
||||||
|
{
|
||||||
|
var anent = (PL00Entry)entry;
|
||||||
|
var input = arc.File.CreateStream(entry.Offset, entry.Size);
|
||||||
|
var pixels = input.ReadBytes((int)anent.Size);
|
||||||
|
return new BitmapDecoder(pixels, anent.ImageInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PL00Archive : ArcFile
|
||||||
|
{
|
||||||
|
public readonly ImageMetaData ImageInfo;
|
||||||
|
|
||||||
|
public PL00Archive(ArcView arc, ArchiveFormat impl, ICollection<Entry> dir, ImageMetaData base_info)
|
||||||
|
: base(arc, impl, dir)
|
||||||
|
{
|
||||||
|
ImageInfo = base_info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user