mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 06:20:24 +00:00
Quick xtx saving fix
This commit is contained in:
parent
137c086699
commit
3c2526bedc
1 changed files with 13 additions and 6 deletions
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Threading.Tasks;
|
using System.Linq;
|
||||||
using Toolbox;
|
using Toolbox;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Toolbox.Library;
|
using Toolbox.Library;
|
||||||
|
@ -339,12 +339,14 @@ namespace FirstPlugin
|
||||||
{
|
{
|
||||||
if (block.BlockType == TextureBlockType)
|
if (block.BlockType == TextureBlockType)
|
||||||
{
|
{
|
||||||
|
block.Data = TextureInfos[curTexImage].ImageData;
|
||||||
block.WriteHeader(writer);
|
block.WriteHeader(writer);
|
||||||
block.WriteBlock(writer, 512);
|
block.WriteBlock(writer, 512);
|
||||||
|
curTexImage++;
|
||||||
}
|
}
|
||||||
else if (block.BlockType == TextureInfoType)
|
else if (block.BlockType == TextureInfoType)
|
||||||
{
|
{
|
||||||
block.Data = TextureInfos[curTexImage++].Write();
|
block.Data = TextureInfos[curTexImage].Write();
|
||||||
block.WriteHeader(writer);
|
block.WriteHeader(writer);
|
||||||
block.WriteBlock(writer);
|
block.WriteBlock(writer);
|
||||||
}
|
}
|
||||||
|
@ -485,8 +487,6 @@ namespace FirstPlugin
|
||||||
public override string ExportFilter => FileFilters.XTX;
|
public override string ExportFilter => FileFilters.XTX;
|
||||||
public override string ReplaceFilter => FileFilters.XTX;
|
public override string ReplaceFilter => FileFilters.XTX;
|
||||||
|
|
||||||
private byte[] unknownData;
|
|
||||||
|
|
||||||
public TextureInfo()
|
public TextureInfo()
|
||||||
{
|
{
|
||||||
CanExport = true;
|
CanExport = true;
|
||||||
|
@ -528,7 +528,10 @@ namespace FirstPlugin
|
||||||
writer.Write(MipCount);
|
writer.Write(MipCount);
|
||||||
writer.Write(SliceSize);
|
writer.Write(SliceSize);
|
||||||
writer.Write(MipOffsets);
|
writer.Write(MipOffsets);
|
||||||
writer.Write(unknownData);
|
writer.Write(TextureLayout1);
|
||||||
|
writer.Write(TextureLayout2);
|
||||||
|
writer.Write(Boolean);
|
||||||
|
|
||||||
writer.Close();
|
writer.Close();
|
||||||
writer.Dispose();
|
writer.Dispose();
|
||||||
|
|
||||||
|
@ -563,7 +566,11 @@ namespace FirstPlugin
|
||||||
Format = tex.Format;
|
Format = tex.Format;
|
||||||
XTXFormat = ConvertFromGenericFormat(tex.Format);
|
XTXFormat = ConvertFromGenericFormat(tex.Format);
|
||||||
|
|
||||||
MipOffsets = TegraX1Swizzle.GenerateMipSizes(tex.Format, tex.Width, tex.Height, tex.Depth, tex.ArrayCount, tex.MipCount, (uint)ImageData.Length)[0];
|
uint[] mips = TegraX1Swizzle.GenerateMipSizes(tex.Format, tex.Width, tex.Height, tex.Depth, tex.ArrayCount, tex.MipCount, (uint)ImageData.Length)[0];
|
||||||
|
MipOffsets = new uint[17];
|
||||||
|
|
||||||
|
for (int i = 0; i < mips.Length; i++)
|
||||||
|
MipOffsets[i] = mips[i];
|
||||||
|
|
||||||
surfacesNew.Clear();
|
surfacesNew.Clear();
|
||||||
surfaces.Clear();
|
surfaces.Clear();
|
||||||
|
|
Loading…
Reference in a new issue