Add a fix for detecting decompressed mc binary files

This commit is contained in:
KillzXGaming 2023-05-28 15:29:35 -04:00
parent 414a4c1ea2
commit 5f77578a63
2 changed files with 14 additions and 1 deletions

View file

@ -802,7 +802,7 @@ namespace FirstPlugin
BFRESRender.ModelTransform = MarioCostumeEditor.SetTransform(FileName);
BFRESRender.ResFileNode = this;
if (this.FileName.Contains("bfres.mc"))
if (MeshCodec.IsMeshCodec(stream))
MeshCodec.Prepare();
if (IsWiiU)

View file

@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AampLibraryCSharp.IO;
using Syroot.NintenTools.NSW.Bfres;
using Toolbox.Library;
using ZstdSharp.Unsafe;
@ -16,6 +17,18 @@ namespace FirstPlugin
{
static ResFile ExternalStringBinary;
public static bool IsMeshCodec(Stream stream)
{
using (var reader = new FileReader(stream, true))
{
reader.Seek(238, SeekOrigin.Begin);
byte flag = reader.ReadByte();
reader.Position = 0;
//Check if flag is external buffer .mc binary
return flag == 11;
}
}
public static void Prepare()
{
//Check if a valid directory exists