1
0
mirror of synced 2024-11-12 02:00:50 +01:00

BFFNT : Fix bntx sheet generating and default mip maps to 1.

This commit is contained in:
KillzXGaming 2021-03-21 14:51:59 -04:00
parent 7b973d2b66
commit dcba003aba
2 changed files with 18 additions and 6 deletions

View File

@ -85,11 +85,23 @@ namespace FirstPlugin
{
long pos = writer.Position;
SheetSize = (uint)SheetDataList[0].Length;
SheetCount = (byte)SheetDataList.Count;
if (BinaryTextureFile != null)
{
var mem = new System.IO.MemoryStream();
BinaryTextureFile.Save(mem);
SheetDataList[0] = mem.ToArray();
var binaryFile = mem.ToArray();
SheetDataList.Clear();
SheetSize = (uint)(binaryFile.Length / SheetCount);
uint offset = 0;
for (int i = 0; i < SheetCount; i++) {
SheetDataList.Add(Utils.SubArray(binaryFile, offset, SheetSize));
offset += SheetSize;
}
}
writer.WriteSignature("TGLP");
@ -100,14 +112,14 @@ namespace FirstPlugin
{
writer.Write((byte)BaseLinePos);
writer.Write(MaxCharWidth);
writer.Write(SheetDataList[0].Length);
writer.Write((ushort)SheetDataList.Count);
writer.Write(SheetSize);
writer.Write((ushort)SheetCount);
}
else
{
writer.Write((byte)SheetDataList.Count);
writer.Write((byte)SheetCount);
writer.Write(MaxCharWidth);
writer.Write(SheetDataList[0].Length);
writer.Write(SheetSize);
writer.Write(BaseLinePos);
}

View File

@ -205,7 +205,7 @@ namespace FirstPlugin.Forms
if (ofd.ShowDialog() == DialogResult.OK)
{
if (IsBntx)
((TextureData)image).Replace(ofd.FileName, 0, (uint)ImageIndex, image.Format, ((TextureData)image).Texture.SurfaceDim);
((TextureData)image).Replace(ofd.FileName, 1, (uint)ImageIndex, image.Format, ((TextureData)image).Texture.SurfaceDim);
else
image.Replace(ofd.FileName);
}