From 96f24046b8578e53a8c7ffc36da527d7c9c9dc15 Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Tue, 14 Jan 2020 19:09:07 -0500 Subject: [PATCH] Fix BNSH decompiling as I was doing it wrong the whole time. --- File_Format_Library/FileFormats/Shader/BNSH.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/File_Format_Library/FileFormats/Shader/BNSH.cs b/File_Format_Library/FileFormats/Shader/BNSH.cs index b5bfe37f..a6c69630 100644 --- a/File_Format_Library/FileFormats/Shader/BNSH.cs +++ b/File_Format_Library/FileFormats/Shader/BNSH.cs @@ -228,7 +228,7 @@ namespace FirstPlugin { reader.Seek(GeometryShaderOffset, SeekOrigin.Begin); GeometryShader = new ShaderData(); - GeometryShader.shaderType = NSWShaderDecompile.NswShaderType.Geometry; + GeometryShader.shaderType = NSWShaderDecompile.NswShaderType.Geometry; GeometryShader.Format = Format; GeometryShader.Read(reader); } @@ -250,7 +250,7 @@ namespace FirstPlugin } } - + reader.Seek(pos, SeekOrigin.Begin); } } @@ -362,7 +362,7 @@ namespace FirstPlugin sfd.FileName = "shader1"; sfd.Filter = "Supported Formats|*.bin;"; - + if (sfd.ShowDialog() == DialogResult.OK) { File.WriteAllBytes(sfd.FileName, data[1]); @@ -384,8 +384,9 @@ namespace FirstPlugin private string DecompileShader() { //Shader A and B usually need to be combined but atm it has some issues - return NSWShaderDecompile.DecompileShader(shaderType, data[1], 0x30); + return NSWShaderDecompile.DecompileShader(shaderType, + Utils.SubArray(data[1], 48, (uint)data[1].Length - 48), 0x30); } } } -} +} \ No newline at end of file