mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 05:35:34 +08:00
perf: Various fixes
This commit is contained in:
parent
53d8fdd844
commit
eb60e27378
@ -103,6 +103,9 @@ namespace GameRes.Formats.Ivory
|
||||
bool IsValidInput (Stream input, uint width, uint height, int pixel_size)
|
||||
{
|
||||
int total = (int)width * (int)height;
|
||||
// Other formats will be incorrectly recognized as this format, try to correct it.
|
||||
if (total * pixel_size < input.Length / 10)
|
||||
return false;
|
||||
int dst = 0;
|
||||
while (dst < total)
|
||||
{
|
||||
|
@ -38,6 +38,8 @@ namespace GameRes.Formats.Kid
|
||||
entry.Size = size;
|
||||
dir.Add(entry);
|
||||
}
|
||||
if (dir.Count == 0)
|
||||
return null;
|
||||
return new ArcFile(file, this, dir);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace GameRes.Formats.Kid
|
||||
uint header = file.ReadUInt32();
|
||||
if (header == 9)
|
||||
{
|
||||
throw new NotSupportedException(string.Format("BIP Chara format not supported."));
|
||||
return null;//throw new NotSupportedException(string.Format("BIP Chara format not supported."));
|
||||
}
|
||||
else if (header != 5)
|
||||
{
|
||||
@ -33,18 +33,18 @@ namespace GameRes.Formats.Kid
|
||||
return null;
|
||||
}
|
||||
uint sign = file.ReadUInt16();
|
||||
uint dy = 0;
|
||||
uint dy;
|
||||
bool sliced = true;
|
||||
if (sign == 0x17)
|
||||
{
|
||||
dy = 16;
|
||||
}
|
||||
else if (sign == 0x16)
|
||||
else if (sign == 0x13)
|
||||
{
|
||||
dy = 16;
|
||||
sliced = false;
|
||||
}
|
||||
else if (sign == 0x13)
|
||||
else if (sign == 0x16)
|
||||
{
|
||||
dy = 32;
|
||||
}
|
||||
@ -57,7 +57,7 @@ namespace GameRes.Formats.Kid
|
||||
file.Seek(0x88, SeekOrigin.Begin);
|
||||
uint width = file.ReadUInt16();
|
||||
uint height = file.ReadUInt16();
|
||||
if (width >= 1280 || height >= 1280) // suppose not so large
|
||||
if (width >= 1280 || height >= 1280 || width == 0 || height == 0) // suppose not so large
|
||||
return null;
|
||||
|
||||
file.Seek(0x90, SeekOrigin.Begin);
|
||||
|
Loading…
Reference in New Issue
Block a user