Fix bffnt with bntx that changes the sheet size

This commit is contained in:
KillzXGaming 2019-08-07 21:53:59 -04:00
parent 46d729e2d8
commit b5f50c824c
5 changed files with 17 additions and 16 deletions

View file

@ -829,6 +829,13 @@ namespace FirstPlugin
{
long pos = writer.Position;
if (BinaryTextureFile != null)
{
var mem = new System.IO.MemoryStream();
BinaryTextureFile.Save(mem);
SheetDataList[0] = mem.ToArray();
}
writer.WriteSignature("TGLP");
writer.Write(uint.MaxValue);
writer.Write(CellWidth);
@ -850,13 +857,6 @@ namespace FirstPlugin
else
writer.Align(8192);
if (BinaryTextureFile != null)
{
var mem = new System.IO.MemoryStream();
BinaryTextureFile.Save(mem);
SheetDataList[0] = mem.ToArray();
}
long DataPosition = writer.Position;
using (writer.TemporarySeek(_ofsSheetBlocks, SeekOrigin.Begin))
{

View file

@ -1407,15 +1407,16 @@ namespace FirstPlugin
break;
}
//After image data is replaced, use original and swap the specific array index
for (int i = 0; i < ImageDataCached.Count; i++)
{
if (i == ArrayIndex)
ImageDataCached[i] = Texture.TextureData[0];
}
if (ImageDataCached.Count > 0)
Texture.TextureData = ImageDataCached;
{
//After image data is replaced, use original and swap the specific array index
ImageDataCached[(int)ArrayIndex] = Texture.TextureData[0];
Texture.TextureData.Clear();
for (int i = 0; i < ImageDataCached.Count; i++)
Texture.TextureData.Add(ImageDataCached[i]);
}
}
public void ApplyImportSettings(TextureImporterSettings setting,STCompressionMode CompressionMode)
{

View file

@ -140,7 +140,7 @@ namespace Toolbox.Library
public IFileFormat FileFormat = null; //Format attached for saving
[Browsable(false)]
protected byte[] _fileData = null;
private byte[] _fileData = null;
//Full File Name
private string _fileName = string.Empty;