(GP): support certain 24bpp images.

This commit is contained in:
morkt 2020-03-30 17:27:51 +04:00
parent 15da067676
commit 303bac1e7e
2 changed files with 4 additions and 4 deletions

View File

@ -62,7 +62,7 @@ namespace GameRes.Formats.Eushully
int bpp = stream.ReadByte(); int bpp = stream.ReadByte();
if (alpha_channel < 0 || alpha_channel > 1 || method < 0 || method > 2 if (alpha_channel < 0 || alpha_channel > 1 || method < 0 || method > 2
|| align1 < 0 || align1 > 4 || align2 < 0 || align2 > 4 || align1 < 0 || align1 > 4 || align2 < 0 || align2 > 4
|| bpp <= 0 || !(bpp <= 16 || 24 == bpp || 32 == bpp)) || bpp < 0 || !(bpp <= 16 || 24 == bpp || 32 == bpp))
return null; return null;
int palette_size = stream.ReadInt32(); int palette_size = stream.ReadInt32();
@ -70,13 +70,13 @@ namespace GameRes.Formats.Eushully
uint height = stream.ReadUInt16(); uint height = stream.ReadUInt16();
if (palette_size <= 0 || 0 == width || 0 == height || palette_size >= stream.Length) if (palette_size <= 0 || 0 == width || 0 == height || palette_size >= stream.Length)
return null; return null;
if (bpp <= 8 && palette_size > 0x100) if (bpp > 0 && bpp <= 8 && palette_size > 0x100)
return null; return null;
return new GpMetaData return new GpMetaData
{ {
Width = width, Width = width,
Height = height, Height = height,
BPP = bpp, BPP = bpp == 0 ? 24 : bpp,
HasAlpha = alpha_channel != 0, HasAlpha = alpha_channel != 0,
Method = method, Method = method,
ElementSize = align1, ElementSize = align1,

View File

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014-2019 morkt Copyright (c) 2014-2020 morkt
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal