mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 04:23:09 +00:00
Add a fix for detecting decompressed mc binary files
This commit is contained in:
parent
414a4c1ea2
commit
5f77578a63
2 changed files with 14 additions and 1 deletions
|
@ -802,7 +802,7 @@ namespace FirstPlugin
|
||||||
BFRESRender.ModelTransform = MarioCostumeEditor.SetTransform(FileName);
|
BFRESRender.ModelTransform = MarioCostumeEditor.SetTransform(FileName);
|
||||||
BFRESRender.ResFileNode = this;
|
BFRESRender.ResFileNode = this;
|
||||||
|
|
||||||
if (this.FileName.Contains("bfres.mc"))
|
if (MeshCodec.IsMeshCodec(stream))
|
||||||
MeshCodec.Prepare();
|
MeshCodec.Prepare();
|
||||||
|
|
||||||
if (IsWiiU)
|
if (IsWiiU)
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using AampLibraryCSharp.IO;
|
||||||
using Syroot.NintenTools.NSW.Bfres;
|
using Syroot.NintenTools.NSW.Bfres;
|
||||||
using Toolbox.Library;
|
using Toolbox.Library;
|
||||||
using ZstdSharp.Unsafe;
|
using ZstdSharp.Unsafe;
|
||||||
|
@ -16,6 +17,18 @@ namespace FirstPlugin
|
||||||
{
|
{
|
||||||
static ResFile ExternalStringBinary;
|
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()
|
public static void Prepare()
|
||||||
{
|
{
|
||||||
//Check if a valid directory exists
|
//Check if a valid directory exists
|
||||||
|
|
Loading…
Reference in a new issue