mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-11 20:39:29 +08:00
(Kaguya): streamlined animated resources implementation.
This commit is contained in:
parent
ca2da660d3
commit
0250fbe0d3
@ -23,7 +23,6 @@
|
|||||||
// IN THE SOFTWARE.
|
// IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -42,60 +41,110 @@ namespace GameRes.Formats.Kaguya
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Export(typeof(ArchiveFormat))]
|
internal class AnmEntry : Entry
|
||||||
public class AnmOpener : ArchiveFormat
|
{
|
||||||
|
public long ImageDataOffset;
|
||||||
|
public uint ImageDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal interface IAnmReader
|
||||||
|
{
|
||||||
|
List<Entry> GetFramesList (IBinaryStream input);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class AnmOpenerBase : ArchiveFormat, IAnmReader
|
||||||
{
|
{
|
||||||
public override string Tag { get { return "ANM/KAGUYA"; } }
|
|
||||||
public override string Description { get { return "KaGuYa script engine animation resource"; } }
|
public override string Description { get { return "KaGuYa script engine animation resource"; } }
|
||||||
public override uint Signature { get { return 0x30304E41; } } // 'AN00'
|
|
||||||
public override bool IsHierarchic { get { return false; } }
|
public override bool IsHierarchic { get { return false; } }
|
||||||
public override bool CanWrite { get { return false; } }
|
public override bool CanWrite { get { return false; } }
|
||||||
|
|
||||||
public AnmOpener ()
|
public AnmOpenerBase ()
|
||||||
{
|
{
|
||||||
Extensions = new string[] { "anm" };
|
Extensions = new string[] { "anm" };
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ArcFile TryOpen (ArcView file)
|
public override ArcFile TryOpen (ArcView file)
|
||||||
{
|
{
|
||||||
int frame_count = file.View.ReadInt16 (0x14);
|
using (var input = file.CreateStream())
|
||||||
uint current_offset = 0x18 + (uint)frame_count * 4;
|
{
|
||||||
int count = file.View.ReadInt16 (current_offset);
|
var dir = GetFramesList (input);
|
||||||
if (!IsSaneCount (count))
|
if (null == dir)
|
||||||
return null;
|
return null;
|
||||||
var base_info = new ImageMetaData
|
var base_info = GetBaseInfo (input);
|
||||||
{
|
|
||||||
OffsetX = file.View.ReadInt32 (4),
|
|
||||||
OffsetY = file.View.ReadInt32 (8),
|
|
||||||
Width = file.View.ReadUInt32 (0x0C),
|
|
||||||
Height = file.View.ReadUInt32 (0x10),
|
|
||||||
BPP = 32,
|
|
||||||
};
|
|
||||||
current_offset += 2;
|
|
||||||
string base_name = Path.GetFileNameWithoutExtension (file.Name);
|
string base_name = Path.GetFileNameWithoutExtension (file.Name);
|
||||||
var dir = new List<Entry> (count);
|
int i = 0;
|
||||||
for (int i = 0; i < count; ++i)
|
foreach (var entry in dir)
|
||||||
{
|
{
|
||||||
uint width = file.View.ReadUInt32 (current_offset+8);
|
entry.Name = string.Format ("{0}#{1:D2}", base_name, i++);
|
||||||
uint height = file.View.ReadUInt32 (current_offset+12);
|
entry.Type = "image";
|
||||||
var entry = new Entry
|
|
||||||
{
|
|
||||||
Name = string.Format ("{0}#{1:D2}", base_name, i),
|
|
||||||
Type = "image",
|
|
||||||
Offset = current_offset,
|
|
||||||
Size = 0x10 + 4*width*height,
|
|
||||||
};
|
|
||||||
dir.Add (entry);
|
|
||||||
current_offset += entry.Size;
|
|
||||||
}
|
}
|
||||||
return new AnmArchive (file, this, dir, base_info);
|
return new AnmArchive (file, this, dir, base_info);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override IImageDecoder OpenImage (ArcFile arc, Entry entry)
|
public override IImageDecoder OpenImage (ArcFile arc, Entry entry)
|
||||||
{
|
{
|
||||||
var base_info = ((AnmArchive)arc).ImageInfo;
|
var base_info = ((AnmArchive)arc).ImageInfo;
|
||||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||||
return new An00Decoder (input, base_info);
|
return CreateDecoder (input, base_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal virtual ImageMetaData GetBaseInfo (IBinaryStream input)
|
||||||
|
{
|
||||||
|
input.Position = 4;
|
||||||
|
return new ImageMetaData
|
||||||
|
{
|
||||||
|
OffsetX = input.ReadInt32(),
|
||||||
|
OffsetY = input.ReadInt32(),
|
||||||
|
Width = input.ReadUInt32(),
|
||||||
|
Height = input.ReadUInt32(),
|
||||||
|
BPP = 32,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract List<Entry> GetFramesList (IBinaryStream input);
|
||||||
|
|
||||||
|
public abstract IImageDecoder CreateDecoder (IBinaryStream input, ImageMetaData info);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Export(typeof(ArchiveFormat))]
|
||||||
|
public class AnmOpener : AnmOpenerBase
|
||||||
|
{
|
||||||
|
public override string Tag { get { return "ANM/KAGUYA"; } }
|
||||||
|
public override uint Signature { get { return 0x30304E41; } } // 'AN00'
|
||||||
|
|
||||||
|
public override List<Entry> GetFramesList (IBinaryStream file)
|
||||||
|
{
|
||||||
|
file.Position = 0x14;
|
||||||
|
int frame_count = file.ReadInt16();
|
||||||
|
file.Position = 0x18 + frame_count * 4;
|
||||||
|
int count = file.ReadInt16();
|
||||||
|
if (!IsSaneCount (count))
|
||||||
|
return null;
|
||||||
|
var current_offset = file.Position;
|
||||||
|
var dir = new List<Entry> (count);
|
||||||
|
for (int i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
file.Position = current_offset + 8;
|
||||||
|
uint width = file.ReadUInt32();
|
||||||
|
uint height = file.ReadUInt32();
|
||||||
|
uint image_size = 4*width*height;
|
||||||
|
var entry = new AnmEntry
|
||||||
|
{
|
||||||
|
Offset = current_offset,
|
||||||
|
Size = 0x10 + image_size,
|
||||||
|
ImageDataOffset = current_offset + 0x10,
|
||||||
|
ImageDataSize = image_size,
|
||||||
|
};
|
||||||
|
dir.Add (entry);
|
||||||
|
current_offset += entry.Size;
|
||||||
|
}
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IImageDecoder CreateDecoder (IBinaryStream input, ImageMetaData info)
|
||||||
|
{
|
||||||
|
return new An00Decoder (input, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,60 +172,44 @@ namespace GameRes.Formats.Kaguya
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Export(typeof(ArchiveFormat))]
|
[Export(typeof(ArchiveFormat))]
|
||||||
public class An10Opener : ArchiveFormat
|
public class An10Opener : AnmOpenerBase, IAnmReader
|
||||||
{
|
{
|
||||||
public override string Tag { get { return "AN10/KAGUYA"; } }
|
public override string Tag { get { return "AN10/KAGUYA"; } }
|
||||||
public override string Description { get { return "KaGuYa script engine animation resource"; } }
|
|
||||||
public override uint Signature { get { return 0x30314E41; } } // 'AN10'
|
public override uint Signature { get { return 0x30314E41; } } // 'AN10'
|
||||||
public override bool IsHierarchic { get { return false; } }
|
|
||||||
public override bool CanWrite { get { return false; } }
|
|
||||||
|
|
||||||
public An10Opener ()
|
public override List<Entry> GetFramesList (IBinaryStream file)
|
||||||
{
|
{
|
||||||
Extensions = new string[] { "anm" };
|
file.Position = 0x14;
|
||||||
}
|
int frame_count = file.ReadInt16();
|
||||||
|
file.Position = 0x18 + frame_count * 4;
|
||||||
public override ArcFile TryOpen (ArcView file)
|
int count = file.ReadInt16();
|
||||||
{
|
|
||||||
int frame_count = file.View.ReadInt16 (0x14);
|
|
||||||
uint current_offset = 0x18 + (uint)frame_count * 4;
|
|
||||||
int count = file.View.ReadInt16 (current_offset);
|
|
||||||
if (!IsSaneCount (count))
|
if (!IsSaneCount (count))
|
||||||
return null;
|
return null;
|
||||||
var base_info = new ImageMetaData
|
var current_offset = file.Position;
|
||||||
{
|
|
||||||
OffsetX = file.View.ReadInt32 (4),
|
|
||||||
OffsetY = file.View.ReadInt32 (8),
|
|
||||||
Width = file.View.ReadUInt32 (0x0C),
|
|
||||||
Height = file.View.ReadUInt32 (0x10),
|
|
||||||
BPP = 32,
|
|
||||||
};
|
|
||||||
current_offset += 2;
|
|
||||||
string base_name = Path.GetFileNameWithoutExtension (file.Name);
|
|
||||||
var dir = new List<Entry> (count);
|
var dir = new List<Entry> (count);
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
uint width = file.View.ReadUInt32 (current_offset+8);
|
file.Position = current_offset + 8;
|
||||||
uint height = file.View.ReadUInt32 (current_offset+12);
|
uint width = file.ReadUInt32();
|
||||||
uint channels = file.View.ReadUInt32 (current_offset+16);
|
uint height = file.ReadUInt32();
|
||||||
var entry = new Entry
|
uint channels = file.ReadUInt32();
|
||||||
|
uint image_size = channels*width*height;
|
||||||
|
var entry = new AnmEntry
|
||||||
{
|
{
|
||||||
Name = string.Format ("{0}#{1:D2}", base_name, i),
|
|
||||||
Type = "image",
|
|
||||||
Offset = current_offset,
|
Offset = current_offset,
|
||||||
Size = 0x14 + channels*width*height,
|
Size = 0x14 + image_size,
|
||||||
|
ImageDataOffset = current_offset + 0x14,
|
||||||
|
ImageDataSize = image_size,
|
||||||
};
|
};
|
||||||
dir.Add (entry);
|
dir.Add (entry);
|
||||||
current_offset += entry.Size;
|
current_offset += entry.Size;
|
||||||
}
|
}
|
||||||
return new AnmArchive (file, this, dir, base_info);
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IImageDecoder OpenImage (ArcFile arc, Entry entry)
|
public override IImageDecoder CreateDecoder (IBinaryStream input, ImageMetaData info)
|
||||||
{
|
{
|
||||||
var base_info = ((AnmArchive)arc).ImageInfo;
|
return new An10Decoder (input, info);
|
||||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
|
||||||
return new An10Decoder (input, base_info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,83 +230,88 @@ namespace GameRes.Formats.Kaguya
|
|||||||
protected override ImageData GetImageData ()
|
protected override ImageData GetImageData ()
|
||||||
{
|
{
|
||||||
m_input.Position = 0x14;
|
m_input.Position = 0x14;
|
||||||
int stride = Info.BPP / 8 * (int)Info.Width;
|
int stride = Info.BPP / 8 * Info.iWidth;
|
||||||
var pixels = m_input.ReadBytes (stride*(int)Info.Height);
|
var pixels = m_input.ReadBytes (stride*Info.iHeight);
|
||||||
PixelFormat format = 24 == Info.BPP ? PixelFormats.Bgr24 : PixelFormats.Bgra32;
|
PixelFormat format = 24 == Info.BPP ? PixelFormats.Bgr24 : PixelFormats.Bgra32;
|
||||||
return ImageData.CreateFlipped (Info, format, null, pixels, stride);
|
return ImageData.CreateFlipped (Info, format, null, pixels, stride);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Export(typeof(ArchiveFormat))]
|
[Export(typeof(ArchiveFormat))]
|
||||||
public class An20Opener : ArchiveFormat
|
public class An20Opener : AnmOpenerBase
|
||||||
{
|
{
|
||||||
public override string Tag { get { return "AN20/KAGUYA"; } }
|
public override string Tag { get { return "AN20/KAGUYA"; } }
|
||||||
public override string Description { get { return "KaGuYa script engine animation resource"; } }
|
|
||||||
public override uint Signature { get { return 0x30324E41; } } // 'AN20'
|
public override uint Signature { get { return 0x30324E41; } } // 'AN20'
|
||||||
public override bool IsHierarchic { get { return false; } }
|
|
||||||
public override bool CanWrite { get { return false; } }
|
|
||||||
|
|
||||||
public An20Opener ()
|
public override List<Entry> GetFramesList (IBinaryStream file)
|
||||||
{
|
{
|
||||||
Extensions = new string[] { "anm" };
|
if (!SkipFrameTable (file))
|
||||||
}
|
return null;
|
||||||
|
int count = file.ReadInt16();
|
||||||
public override ArcFile TryOpen (ArcView file)
|
|
||||||
{
|
|
||||||
int table_count = file.View.ReadInt16 (4);
|
|
||||||
uint current_offset = 8;
|
|
||||||
for (int i = 0; i < table_count; ++i)
|
|
||||||
{
|
|
||||||
switch (file.View.ReadByte (current_offset++))
|
|
||||||
{
|
|
||||||
case 0: break;
|
|
||||||
case 1: current_offset += 8; break;
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
case 5: current_offset += 4; break;
|
|
||||||
default: return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
current_offset += 2 + file.View.ReadUInt16 (current_offset) * 8u;
|
|
||||||
int count = file.View.ReadInt16 (current_offset);
|
|
||||||
if (!IsSaneCount (count))
|
if (!IsSaneCount (count))
|
||||||
return null;
|
return null;
|
||||||
current_offset += 2;
|
long current_offset = file.Position + 0x10;
|
||||||
var base_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),
|
|
||||||
BPP = 32,
|
|
||||||
};
|
|
||||||
current_offset += 0x10;
|
|
||||||
string base_name = Path.GetFileNameWithoutExtension (file.Name);
|
|
||||||
var dir = new List<Entry> (count);
|
var dir = new List<Entry> (count);
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
uint width = file.View.ReadUInt32 (current_offset+8);
|
file.Position = current_offset + 8;
|
||||||
uint height = file.View.ReadUInt32 (current_offset+0x0C);
|
uint width = file.ReadUInt32();
|
||||||
uint depth = file.View.ReadUInt32 (current_offset+0x10);
|
uint height = file.ReadUInt32();
|
||||||
var entry = new Entry
|
uint depth = file.ReadUInt32();
|
||||||
|
uint image_size = depth*width*height;
|
||||||
|
var entry = new AnmEntry
|
||||||
{
|
{
|
||||||
Name = string.Format ("{0}#{1:D2}", base_name, i),
|
|
||||||
Type = "image",
|
|
||||||
Offset = current_offset,
|
Offset = current_offset,
|
||||||
Size = 0x14 + depth*width*height,
|
Size = 0x14 + image_size,
|
||||||
|
ImageDataOffset = current_offset + 0x14,
|
||||||
|
ImageDataSize = image_size,
|
||||||
};
|
};
|
||||||
dir.Add (entry);
|
dir.Add (entry);
|
||||||
current_offset += entry.Size;
|
current_offset += entry.Size;
|
||||||
}
|
}
|
||||||
return new AnmArchive (file, this, dir, base_info);
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IImageDecoder OpenImage (ArcFile arc, Entry entry)
|
internal override ImageMetaData GetBaseInfo (IBinaryStream input)
|
||||||
{
|
{
|
||||||
var base_info = ((AnmArchive)arc).ImageInfo;
|
SkipFrameTable (input);
|
||||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
input.ReadInt16();
|
||||||
return new An20Decoder (input, base_info);
|
return new ImageMetaData
|
||||||
|
{
|
||||||
|
OffsetX = input.ReadInt32(),
|
||||||
|
OffsetY = input.ReadInt32(),
|
||||||
|
Width = input.ReadUInt32(),
|
||||||
|
Height = input.ReadUInt32(),
|
||||||
|
BPP = 32,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SkipFrameTable (IBinaryStream file)
|
||||||
|
{
|
||||||
|
file.Position = 4;
|
||||||
|
int table_count = file.ReadInt16();
|
||||||
|
file.Position = 8;
|
||||||
|
for (int i = 0; i < table_count; ++i)
|
||||||
|
{
|
||||||
|
switch (file.ReadByte())
|
||||||
|
{
|
||||||
|
case 0: break;
|
||||||
|
case 1: file.Seek (8, SeekOrigin.Current); break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
case 5: file.Seek (4, SeekOrigin.Current); break;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int count = file.ReadUInt16();
|
||||||
|
file.Seek (count * 8, SeekOrigin.Current);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IImageDecoder CreateDecoder (IBinaryStream input, ImageMetaData info)
|
||||||
|
{
|
||||||
|
return new An20Decoder (input, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,6 +711,11 @@ namespace GameRes.Formats.Kaguya
|
|||||||
|
|
||||||
delegate Stream Decryptor (LinkArchive arc, LinkEntry entry);
|
delegate Stream Decryptor (LinkArchive arc, LinkEntry entry);
|
||||||
|
|
||||||
|
static readonly ResourceInstance<AnmOpener> An00 = new ResourceInstance<AnmOpener> ("ANM/KAGUYA");
|
||||||
|
static readonly ResourceInstance<An10Opener> An10 = new ResourceInstance<An10Opener> ("AN10/KAGUYA");
|
||||||
|
static readonly ResourceInstance<An20Opener> An20 = new ResourceInstance<An20Opener> ("AN20/KAGUYA");
|
||||||
|
static readonly ResourceInstance<Pl00Opener> Pl00 = new ResourceInstance<Pl00Opener> ("PLT/KAGUYA");
|
||||||
|
|
||||||
public LinkEncryption (byte[] key, bool anm_encrypted = true)
|
public LinkEncryption (byte[] key, bool anm_encrypted = true)
|
||||||
{
|
{
|
||||||
if (null == key || 0 == key.Length)
|
if (null == key || 0 == key.Length)
|
||||||
@ -725,8 +730,12 @@ namespace GameRes.Formats.Kaguya
|
|||||||
};
|
};
|
||||||
if (anm_encrypted)
|
if (anm_encrypted)
|
||||||
{
|
{
|
||||||
table.Add (new Tuple<string, Decryptor> ("AN00", (a, e) => DecryptAn00 (a, e)));
|
table.Add (new Tuple<string, Decryptor> ("AN00", (a, e) => DecryptAnm (a, e, An00.Value)));
|
||||||
|
table.Add (new Tuple<string, Decryptor> ("AN10", (a, e) => DecryptAnm (a, e, An10.Value)));
|
||||||
|
table.Add (new Tuple<string, Decryptor> ("AN20", (a, e) => DecryptAnm (a, e, An20.Value)));
|
||||||
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) => DecryptAnm (a, e, Pl00.Value)));
|
||||||
|
table.Add (new Tuple<string, Decryptor> ("PL10", (a, e) => DecryptPl10 (a, e)));
|
||||||
}
|
}
|
||||||
m_type_table = table.ToArray();
|
m_type_table = table.ToArray();
|
||||||
}
|
}
|
||||||
@ -750,22 +759,20 @@ namespace GameRes.Formats.Kaguya
|
|||||||
return new PrefixStream (header, body);
|
return new PrefixStream (header, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream DecryptAn00 (LinkArchive arc, LinkEntry entry)
|
Stream DecryptAnm (LinkArchive arc, LinkEntry entry, IAnmReader reader)
|
||||||
{
|
{
|
||||||
var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
|
var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
|
||||||
int frame_offset = 0x18 + data.ToUInt16 (0x14) * 4;
|
var input = new BinMemoryStream (data, entry.Name);
|
||||||
int count = data.ToUInt16 (frame_offset);
|
var dir = reader.GetFramesList (input);
|
||||||
frame_offset += 10;
|
if (dir != null)
|
||||||
for (int i = 0; i < count; ++i)
|
|
||||||
{
|
{
|
||||||
int w = data.ToInt32 (frame_offset);
|
foreach (AnmEntry frame in dir)
|
||||||
int h = data.ToInt32 (frame_offset+4);
|
{
|
||||||
int size = 4 * w * h;
|
DecryptData (data, (int)frame.ImageDataOffset, (int)frame.ImageDataSize);
|
||||||
frame_offset += 8;
|
|
||||||
DecryptData (data, frame_offset, size);
|
|
||||||
frame_offset += size + 8;
|
|
||||||
}
|
}
|
||||||
return new BinMemoryStream (data, entry.Name);
|
}
|
||||||
|
input.Position = 0;
|
||||||
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream DecryptAn21 (LinkArchive arc, LinkEntry entry)
|
Stream DecryptAn21 (LinkArchive arc, LinkEntry entry)
|
||||||
@ -796,6 +803,18 @@ namespace GameRes.Formats.Kaguya
|
|||||||
return new BinMemoryStream (data, entry.Name);
|
return new BinMemoryStream (data, entry.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Stream DecryptPl10 (LinkArchive arc, LinkEntry entry)
|
||||||
|
{
|
||||||
|
var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
|
||||||
|
int offset = 30;
|
||||||
|
int w = data.ToInt32 (offset);
|
||||||
|
int h = data.ToInt32 (offset+4);
|
||||||
|
int channels = data.ToInt32 (offset+8);
|
||||||
|
offset += 12;
|
||||||
|
DecryptData (data, offset, channels * w * h);
|
||||||
|
return new BinMemoryStream (data, entry.Name);
|
||||||
|
}
|
||||||
|
|
||||||
void DecryptData (byte[] data, int index, int length)
|
void DecryptData (byte[] data, int index, int length)
|
||||||
{
|
{
|
||||||
while (length > 0)
|
while (length > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user