1
0
mirror of synced 2024-09-24 19:48:21 +02:00

Fix tex2 files from loading mips in image editor

This commit is contained in:
KillzXGaming 2019-04-06 11:53:39 -04:00
parent ea099ee2dd
commit 2f4b03a454
9 changed files with 8 additions and 1 deletions

Binary file not shown.

View File

@ -392,7 +392,7 @@ namespace Bfres.Structs
if (!IsEdited && Tex1 != null && Tex1.Contains(".Tex1"))
{
string Tex2 = Tex1.Replace(".Tex1", ".Tex2");
Console.WriteLine(Tex2);
Console.WriteLine(Tex2 + " " + System.IO.File.Exists(Tex2));
if (System.IO.File.Exists(Tex2))
{
@ -407,8 +407,12 @@ namespace Bfres.Structs
{
resFile2 = new ResFile(Tex2);
}
Console.WriteLine((resFile2.Textures.ContainsKey(texture.Name)));
if (resFile2.Textures.ContainsKey(texture.Name))
{
MipCount = texture.MipCount;
texture.MipData = resFile2.Textures[texture.Name].MipData;
texture.MipOffsets = resFile2.Textures[texture.Name].MipOffsets;
surf.mipData = resFile2.Textures[texture.Name].MipData;

View File

@ -432,6 +432,9 @@ namespace Switch_Toolbox.Library
public static List<List<byte[]>> Decode(GX2Surface tex, string DebugTextureName = "")
{
if (tex.data.Length <= 0)
throw new Exception("Invalid GX2 surface data. Make sure to not open Tex2 files if this is one. Those will load automatically next to Tex1!");
Console.WriteLine("DECODING TEX " + DebugTextureName);
var surfdEBUG = getSurfaceInfo((GX2SurfaceFormat)tex.format, tex.width, tex.height, tex.depth, (uint)tex.dim, (uint)tex.tileMode, (uint)tex.aa, 0);