(GsPIC): interpret extra field as alpha channel flag.

This commit is contained in:
morkt
2018-07-06 15:16:19 +04:00
parent 33f3d8128f
commit 46eeab8114

View File

@@ -40,6 +40,7 @@ namespace GameRes.Formats.Gs
public uint PackedSize; public uint PackedSize;
public uint UnpackedSize; public uint UnpackedSize;
public uint HeaderSize; public uint HeaderSize;
public int Extra;
} }
[Export(typeof(ImageFormat))] [Export(typeof(ImageFormat))]
@@ -69,7 +70,7 @@ namespace GameRes.Formats.Gs
info.BPP = file.ReadInt32(); info.BPP = file.ReadInt32();
if (info.HeaderSize >= 0x2C) if (info.HeaderSize >= 0x2C)
{ {
file.ReadInt32(); info.Extra = file.ReadInt32();
info.OffsetX = file.ReadInt32(); info.OffsetX = file.ReadInt32();
info.OffsetY = file.ReadInt32(); info.OffsetY = file.ReadInt32();
} }
@@ -99,7 +100,7 @@ namespace GameRes.Formats.Gs
int stride = (int)meta.Width*((info.BPP+7)/8); int stride = (int)meta.Width*((info.BPP+7)/8);
var pixels = new byte[stride*meta.Height]; var pixels = new byte[stride*meta.Height];
input.Read (pixels, 0, pixels.Length); input.Read (pixels, 0, pixels.Length);
if (32 == meta.BPP) if (32 == meta.BPP && meta.Extra != 0)
{ {
for (int i = 3; i < pixels.Length; i += 4) for (int i = 3; i < pixels.Length; i += 4)
{ {