Batch export with archive directories and extract bntx textures from bffnt

This commit is contained in:
KillzXGaming 2019-07-02 17:56:56 -04:00
parent 7df5effdc2
commit b3dacf8dbd
7 changed files with 25 additions and 2 deletions

Binary file not shown.

View file

@ -42,6 +42,8 @@ namespace FirstPlugin
}
FFNT bffnt;
public BNTX BinaryTextureFile;
public void Load(System.IO.Stream stream)
{
Text = FileName;
@ -58,6 +60,7 @@ namespace FirstPlugin
var bntx = STFileLoader.OpenFileFormat("Sheet_0", Utils.CombineByteArray(tglp.SheetDataList.ToArray()));
if (bntx != null)
{
BinaryTextureFile = (BNTX)bntx;
textureFolder.Nodes.Add((BNTX)bntx);
}
else

View file

@ -124,7 +124,16 @@ namespace FirstPlugin
if (FileFormat == null)
continue;
SearchBinary(FileFormat, folderDialog.SelectedPath, Extension);
if (FileFormat is SARC)
{
string ArchiveFilePath = Path.Combine(folderDialog.SelectedPath, Path.GetFileNameWithoutExtension(file));
if (!Directory.Exists(ArchiveFilePath))
Directory.CreateDirectory(ArchiveFilePath);
SearchBinary(FileFormat, ArchiveFilePath, Extension);
}
else
SearchBinary(FileFormat, folderDialog.SelectedPath, Extension);
}
}
}
@ -171,6 +180,17 @@ namespace FirstPlugin
bntx.Unload();
}
}
if (FileFormat is BFFNT)
{
var bntx = ((BFFNT)FileFormat).BinaryTextureFile;
if (bntx != null)
{
foreach (var texture in bntx.Textures.Values)
texture.Export(Path.Combine(Folder, $"{FileFormat.FileName}_{texture.Text}{Extension}"));
bntx.Unload();
}
}
FileFormat.Unload();
GC.Collect();

View file

@ -335,7 +335,7 @@ namespace FirstPlugin
Formats.Add(typeof(NCA));
Formats.Add(typeof(RARC));
Formats.Add(typeof(ME01));
// Formats.Add(typeof(LM2_DICT));
Formats.Add(typeof(LM2_DICT));
//Formats.Add(typeof(GFA));
//Unfinished wip formats not ready for use