Fix wii u textures crashing from null mip data
This commit is contained in:
parent
78446003b7
commit
3a43ea049c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -151,10 +151,15 @@ namespace Switch_Toolbox.Library.IO
|
||||
byte* end = input + decompressedLength;
|
||||
byte* data = input + pos;
|
||||
|
||||
if (pos > decompressedLength)
|
||||
Console.WriteLine($"decompressedLength " + decompressedLength);
|
||||
Console.WriteLine($"pos " + pos);
|
||||
|
||||
if (pos < decompressedLength)
|
||||
{
|
||||
uint flag;
|
||||
|
||||
Console.WriteLine($"Pass 1 ");
|
||||
|
||||
while (true)
|
||||
{
|
||||
flag = 0xFF000000 * data[0];
|
||||
@ -169,6 +174,8 @@ namespace Switch_Toolbox.Library.IO
|
||||
CheckFinished(data, end);
|
||||
}
|
||||
|
||||
Console.WriteLine($"Pass 2 ");
|
||||
|
||||
flag |= 0x800000;
|
||||
|
||||
data++;
|
||||
@ -179,6 +186,7 @@ namespace Switch_Toolbox.Library.IO
|
||||
IterateFlag(flag, data, output);
|
||||
}
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
flag <<= 1;
|
||||
|
@ -628,7 +628,10 @@ namespace Switch_Toolbox.Library
|
||||
tex.numArray = 1;
|
||||
|
||||
byte[] data = new byte[tex.data.Length];
|
||||
byte[] mipdata = new byte[tex.mipData.Length];
|
||||
byte[] mipdata = new byte[0];
|
||||
|
||||
if (tex.mipData != null)
|
||||
mipdata = new byte[tex.mipData.Length];
|
||||
|
||||
uint mipCount = tex.numMips;
|
||||
if (tex.mipData == null || tex.mipData.Length <= 0)
|
||||
|
Loading…
Reference in New Issue
Block a user