1
0
mirror of synced 2024-11-28 01:10:51 +01:00

Fix wii u textures crashing from null mip data

This commit is contained in:
KillzXGaming 2019-07-01 17:27:55 -04:00
parent 78446003b7
commit 3a43ea049c
7 changed files with 13 additions and 2 deletions

Binary file not shown.

View File

@ -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;

View File

@ -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)