mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 05:35:34 +08:00
(gpd, msk): recognize earlier format versions.
This commit is contained in:
parent
da057b4326
commit
cc89377dc7
@ -30,6 +30,11 @@ using GameRes.Compression;
|
||||
|
||||
namespace GameRes.Formats.Ankh
|
||||
{
|
||||
internal class GpdMetaData : ImageMetaData
|
||||
{
|
||||
public int HeaderSize;
|
||||
}
|
||||
|
||||
[Export(typeof(ImageFormat))]
|
||||
public class GpdFormat : ImageFormat
|
||||
{
|
||||
@ -40,19 +45,19 @@ namespace GameRes.Formats.Ankh
|
||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||
{
|
||||
var header = file.ReadHeader (0x10);
|
||||
if (header.ToInt32 (12) != 0)
|
||||
return null;
|
||||
return new ImageMetaData {
|
||||
return new GpdMetaData {
|
||||
Width = header.ToUInt32 (4),
|
||||
Height = header.ToUInt32 (8),
|
||||
BPP = 24,
|
||||
HeaderSize = header.ToInt32 (12) != 0 ? 12 : 16,
|
||||
};
|
||||
}
|
||||
|
||||
public override ImageData Read (IBinaryStream file, ImageMetaData info)
|
||||
{
|
||||
var meta = (GpdMetaData)info;
|
||||
int stride = (int)info.Width * 3;
|
||||
file.Position = 0x10;
|
||||
file.Position = meta.HeaderSize;
|
||||
using (var lzss = new LzssStream (file.AsStream, LzssMode.Decompress, true))
|
||||
{
|
||||
var pixels = new byte[stride * (int)info.Height];
|
||||
|
@ -40,18 +40,18 @@ namespace GameRes.Formats.Ankh
|
||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||
{
|
||||
var header = file.ReadHeader (0x10);
|
||||
if (header.ToInt32 (12) != 0)
|
||||
return null;
|
||||
return new ImageMetaData {
|
||||
return new GpdMetaData {
|
||||
Width = header.ToUInt32 (4),
|
||||
Height = header.ToUInt32 (8),
|
||||
BPP = 8,
|
||||
HeaderSize = header.ToInt32 (12) != 0 ? 12 : 16,
|
||||
};
|
||||
}
|
||||
|
||||
public override ImageData Read (IBinaryStream file, ImageMetaData info)
|
||||
{
|
||||
file.Position = 0x10;
|
||||
var meta = (GpdMetaData)info;
|
||||
file.Position = meta.HeaderSize;
|
||||
using (var lzss = new LzssStream (file.AsStream, LzssMode.Decompress, true))
|
||||
{
|
||||
var pixels = new byte[info.Width * info.Height];
|
||||
|
Loading…
Reference in New Issue
Block a user