diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/ResourceFile.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/ResourceFile.cs index c7e7ecad..bbdf6a68 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/ResourceFile.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/ResourceFile.cs @@ -282,7 +282,7 @@ namespace Bfres.Structs ftexContainer.Nodes.Add(texture); ftexContainer.Textures.Add(texture.Text, texture); } - // PluginRuntime.ftexContainers.Add(ftexContainer); + PluginRuntime.ftexContainers.Add(ftexContainer); } private void AddSkeletonAnims(ResU.ResFile resFile) { diff --git a/Switch_FileFormatsMain/FileFormats/Texture/BNTX.cs b/Switch_FileFormatsMain/FileFormats/Texture/BNTX.cs index 88773af5..c86f3454 100644 --- a/Switch_FileFormatsMain/FileFormats/Texture/BNTX.cs +++ b/Switch_FileFormatsMain/FileFormats/Texture/BNTX.cs @@ -434,54 +434,56 @@ namespace FirstPlugin else { settings.Add(LoadSettings(name)); - } - } - if (settings.Count == 0) - { - importer.Dispose(); - return; - } - importer.LoadSettings(settings, this); - if (importer.ShowDialog() == DialogResult.OK) - { - Cursor.Current = Cursors.WaitCursor; - foreach (var setting in settings) - { - if (setting.GenerateMipmaps) + if (settings.Count == 0) { - setting.DataBlockOutput.Clear(); - setting.DataBlockOutput.Add(setting.GenerateMips()); + importer.Dispose(); + return; } - if (setting.DataBlockOutput != null) + importer.LoadSettings(settings, this); + if (importer.ShowDialog() == DialogResult.OK) { - Texture tex = setting.FromBitMap(setting.DataBlockOutput[0], setting); - if (setting.textureData != null) + Cursor.Current = Cursors.WaitCursor; + foreach (var setting in settings) { - setting.textureData.LoadTexture(tex, 1); - } - else - { - setting.textureData = new TextureData(tex, setting.bntx); - } + if (setting.GenerateMipmaps) + { + setting.DataBlockOutput.Clear(); + setting.DataBlockOutput.Add(setting.GenerateMips()); + } - int i = 0; - if (Textures.ContainsKey(setting.textureData.Text)) - { - setting.textureData.Text = setting.textureData.Text + i++; - } + if (setting.DataBlockOutput != null) + { + Texture tex = setting.FromBitMap(setting.DataBlockOutput[0], setting); + if (setting.textureData != null) + { + setting.textureData.LoadTexture(tex, 1); + } + else + { + setting.textureData = new TextureData(tex, setting.bntx); + } - Nodes.Add(setting.textureData); - Textures.Add(setting.textureData.Text, setting.textureData); - setting.textureData.LoadOpenGLTexture(); - } - else - { - MessageBox.Show("Something went wrong???"); + int i = 0; + if (Textures.ContainsKey(setting.textureData.Text)) + { + setting.textureData.Text = setting.textureData.Text + i++; + } + + Nodes.Add(setting.textureData); + Textures.Add(setting.textureData.Text, setting.textureData); + setting.textureData.LoadOpenGLTexture(); + } + else + { + MessageBox.Show("Something went wrong???"); + } + } } } } + settings.Clear(); GC.Collect(); Cursor.Current = Cursors.Default; @@ -1177,7 +1179,6 @@ namespace FirstPlugin if (setting.DataBlockOutput != null) { Texture = setting.FromBitMap(setting.DataBlockOutput[0], setting); - LoadTexture(Texture, 1); LoadOpenGLTexture(); } else diff --git a/Switch_FileFormatsMain/FileFormats/Texture/FTEX.cs b/Switch_FileFormatsMain/FileFormats/Texture/FTEX.cs index 3cbf0f4d..c8c2a7f9 100644 --- a/Switch_FileFormatsMain/FileFormats/Texture/FTEX.cs +++ b/Switch_FileFormatsMain/FileFormats/Texture/FTEX.cs @@ -25,6 +25,9 @@ namespace FirstPlugin Name = "FTEXCONT"; ContextMenu = new ContextMenu(); + MenuItem importTex = new MenuItem("Import"); + ContextMenu.MenuItems.Add(importTex); + importTex.Click += Import; MenuItem exportAll = new MenuItem("Export All Textures"); ContextMenu.MenuItems.Add(exportAll); exportAll.Click += ExportAll; @@ -50,7 +53,117 @@ namespace FirstPlugin Textures.Remove(textureData.Text); Viewport.Instance.UpdateViewport(); } + private void Import(object sender, EventArgs args) + { + ImportTexture(); + } + public void ImportTexture() + { + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Filter = "Supported Formats|*.dds; *.png;*.tga;*.jpg;*.tiff|" + + "Microsoft DDS |*.dds|" + + "Portable Network Graphics |*.png|" + + "Joint Photographic Experts Group |*.jpg|" + + "Bitmap Image |*.bmp|" + + "Tagged Image File Format |*.tiff|" + + "All files(*.*)|*.*"; + ofd.Multiselect = true; + if (ofd.ShowDialog() == DialogResult.OK) + { + GTXTextureImporter importer = new GTXTextureImporter(); + List settings = new List(); + foreach (string name in ofd.FileNames) + { + string ext = System.IO.Path.GetExtension(name); + ext = ext.ToLower(); + + if (ext == ".dds") + { + settings.Add(LoadSettings(name)); + if (settings.Count == 0) + { + importer.Dispose(); + return; + } + importer.LoadSettings(settings); + foreach (var setting in settings) + { + if (setting.DataBlockOutput != null) + { + GTX.GX2Surface tex = setting.CreateGx2Texture(setting.DataBlockOutput[0]); + FTEX ftex = new FTEX(); + ftex.texture = ftex.FromGx2Surface(tex, setting); + ftex.Read(ftex.texture); + + Nodes.Add(ftex); + Textures.Add(ftex.Text, ftex); + ftex.LoadOpenGLTexture(); + } + } + } + else + { + settings.Add(LoadSettings(name)); + if (settings.Count == 0) + { + importer.Dispose(); + return; + } + importer.LoadSettings(settings); + if (importer.ShowDialog() == DialogResult.OK) + { + Cursor.Current = Cursors.WaitCursor; + foreach (var setting in settings) + { + if (setting.GenerateMipmaps) + { + setting.DataBlockOutput.Clear(); + setting.DataBlockOutput.Add(setting.GenerateMips()); + } + if (setting.DataBlockOutput != null) + { + GTX.GX2Surface tex = setting.CreateGx2Texture(setting.DataBlockOutput[0]); + FTEX ftex = new FTEX(); + ftex.texture = ftex.FromGx2Surface(tex, setting); + ftex.Read(ftex.texture); + + Nodes.Add(ftex); + Textures.Add(ftex.Text, ftex); + ftex.LoadOpenGLTexture(); + } + else + { + MessageBox.Show("Something went wrong???"); + } + } + } + } + + settings.Clear(); + GC.Collect(); + Cursor.Current = Cursors.Default; + } + } + } + public GTXImporterSettings LoadSettings(string name) + { + var importer = new GTXImporterSettings(); + string ext = System.IO.Path.GetExtension(name); + ext = ext.ToLower(); + + switch (ext) + { + case ".dds": + importer.LoadDDS(name); + break; + default: + importer.LoadBitMap(name); + break; + } + + return importer; + } private void ExportAll(object sender, EventArgs args) { List Formats = new List(); @@ -94,10 +207,7 @@ namespace FirstPlugin { public int format; public RenderableTex renderedTex = new RenderableTex(); - GX2CompSel ChannelRed; - GX2CompSel ChannelBlue; - GX2CompSel ChannelGreen; - GX2CompSel ChannelAlpha; + public Texture texture; public FTEX() { @@ -105,6 +215,9 @@ namespace FirstPlugin MenuItem export = new MenuItem("Export"); ContextMenu.MenuItems.Add(export); export.Click += Export; + MenuItem replace = new MenuItem("Replace"); + ContextMenu.MenuItems.Add(replace); + replace.Click += Replace; MenuItem remove = new MenuItem("Remove"); ContextMenu.MenuItems.Add(remove); remove.Click += Remove; @@ -115,7 +228,91 @@ namespace FirstPlugin private void Replace(object sender, EventArgs args) { + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Filter = "Supported Formats|*.dds; *.png;*.tga;*.jpg;*.tiff|" + + "Microsoft DDS |*.dds|" + + "Portable Network Graphics |*.png|" + + "Joint Photographic Experts Group |*.jpg|" + + "Bitmap Image |*.bmp|" + + "Tagged Image File Format |*.tiff|" + + "All files(*.*)|*.*"; + ofd.Multiselect = false; + if (ofd.ShowDialog() == DialogResult.OK) + { + Replace(ofd.FileName); + } + } + public void Replace(string FileName) + { + string ext = System.IO.Path.GetExtension(FileName); + ext = ext.ToLower(); + + GTXImporterSettings setting = new GTXImporterSettings(); + GTXTextureImporter importer = new GTXTextureImporter(); + + switch (ext) + { + case ".dds": + setting.LoadDDS(FileName, null); + break; + default: + setting.LoadBitMap(FileName); + importer.LoadSetting(setting); + break; + } + + if (importer.ShowDialog() == DialogResult.OK) + { + Cursor.Current = Cursors.WaitCursor; + + if (setting.GenerateMipmaps) + { + setting.DataBlockOutput.Clear(); + setting.DataBlockOutput.Add(setting.GenerateMips()); + } + + if (setting.DataBlockOutput != null) + { + var surface = setting.CreateGx2Texture(setting.DataBlockOutput[0]); + texture = FromGx2Surface(surface, setting); + LoadOpenGLTexture(); + } + else + { + MessageBox.Show("Something went wrong???"); + } + UpdateEditor(); + } + } + //We reuse GX2 data as it's the same thing + public Texture FromGx2Surface(GTX.GX2Surface surf, GTXImporterSettings settings) + { + Texture tex = new Texture(); + tex.Name = settings.TexName; + tex.AAMode = (GX2AAMode)surf.aa; + tex.Alignment = (uint)surf.alignment; + tex.ArrayLength = 1; + tex.Data = surf.data; + tex.MipData = surf.mipData; + tex.Format = (GX2SurfaceFormat)surf.format; + tex.Dim = (GX2SurfaceDim)surf.dim; + tex.Use = (GX2SurfaceUse)surf.use; + tex.TileMode = (GX2TileMode)surf.tileMode; + tex.Swizzle = (uint)surf.swizzle; + tex.Pitch = (uint)surf.pitch; + tex.Depth = (uint)surf.depth; + tex.MipCount = (uint)surf.numMips; + tex.MipOffsets = surf.mipOffset; + tex.Height = (uint)surf.height; + tex.Width = (uint)surf.width; + tex.Regs = new uint[0]; + var channels = SetChannelsByFormat((GX2SurfaceFormat)surf.format); + tex.CompSelR = channels[0]; + tex.CompSelG = channels[1]; + tex.CompSelB = channels[2]; + tex.CompSelA = channels[3]; + return tex; } private void Rename(object sender, EventArgs args) { @@ -160,11 +357,7 @@ namespace FirstPlugin SelectedImageKey = "Texture"; Text = tex.Name; - ChannelRed = tex.CompSelR; - ChannelGreen = tex.CompSelG; - ChannelBlue = tex.CompSelB; - ChannelAlpha = tex.CompSelA; - + renderedTex = new RenderableTex(); renderedTex.width = (int)tex.Width; renderedTex.height = (int)tex.Height; format = (int)tex.Format; @@ -172,30 +365,70 @@ namespace FirstPlugin int pitch = (int)tex.Pitch; uint bpp = GTX.surfaceGetBitsPerPixel((uint)format) >> 3; + Console.WriteLine(tex.Width); + Console.WriteLine(tex.Height); + Console.WriteLine(tex.Format); + Console.WriteLine(tex.Swizzle); + Console.WriteLine(tex.Pitch); + Console.WriteLine(tex.Alignment); + Console.WriteLine(tex.Depth); + Console.WriteLine(tex.Dim); + Console.WriteLine(tex.MipCount); + Console.WriteLine(tex.MipOffsets); + Console.WriteLine(tex.AAMode); + Console.WriteLine(tex.Use); + GTX.GX2Surface surf = new GTX.GX2Surface(); surf.bpp = bpp; - surf.height = (int)tex.Height; - surf.width = (int)tex.Width; - surf.aa = (int)tex.AAMode; - surf.alignment = (int)tex.Alignment; - surf.depth = (int)tex.Depth; - surf.dim = (int)tex.Dim; - surf.format = (int)tex.Format; - surf.use = (int)tex.Use; - surf.pitch = (int)tex.Pitch; + surf.height = tex.Height; + surf.width = tex.Width; + surf.aa = (uint)tex.AAMode; + surf.alignment = tex.Alignment; + surf.depth = tex.Depth; + surf.dim = (uint)tex.Dim; + surf.format = (uint)tex.Format; + surf.use = (uint)tex.Use; + surf.pitch = tex.Pitch; surf.data = tex.Data; - surf.numMips = (int)tex.MipCount; + surf.numMips = tex.MipCount; surf.mipOffset = tex.MipOffsets; surf.mipData = tex.MipData; - surf.tileMode = (int)tex.TileMode; - surf.swizzle = (int)tex.Swizzle; + surf.tileMode = (uint)tex.TileMode; + surf.swizzle = tex.Swizzle; List mips = GTX.Decode(surf); renderedTex.mipmaps.Add(mips); - // LoadOpenGLTexture(); - // else - // Console.WriteLine("Failed to load image!"); + renderedTex.data = renderedTex.mipmaps[0][0]; + } + public static GX2CompSel[] SetChannelsByFormat(GX2SurfaceFormat Format) + { + GX2CompSel[] channels = new GX2CompSel[4]; + + switch (Format) + { + case GX2SurfaceFormat.T_BC5_UNorm: + case GX2SurfaceFormat.T_BC5_SNorm: + channels[0] = GX2CompSel.ChannelR; + channels[1] = GX2CompSel.ChannelG; + channels[2] = GX2CompSel.Always0; + channels[3] = GX2CompSel.Always1; + break; + case GX2SurfaceFormat.T_BC4_SNorm: + case GX2SurfaceFormat.T_BC4_UNorm: + channels[0] = GX2CompSel.ChannelR; + channels[1] = GX2CompSel.ChannelR; + channels[2] = GX2CompSel.ChannelR; + channels[3] = GX2CompSel.ChannelR; + break; + default: + channels[0] = GX2CompSel.ChannelR; + channels[1] = GX2CompSel.ChannelG; + channels[2] = GX2CompSel.ChannelB; + channels[3] = GX2CompSel.Always1; + break; + } + return channels; } public void Export(string FileName, bool ExportSurfaceLevel = false, @@ -252,6 +485,7 @@ namespace FirstPlugin if (OpenTKSharedResources.SetupStatus == OpenTKSharedResources.SharedResourceStatus.Unitialized) return; + switch (format) { case ((int)GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC1_UNORM): @@ -283,8 +517,7 @@ namespace FirstPlugin break; case ((int)GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC5_SNORM): //OpenTK doesn't load BC5 SNORM textures right so I'll use the same decompress method bntx has - byte[] fixBC5 = DDSCompressor.DecompressBC5(renderedTex.data, renderedTex.width, renderedTex.height, true, true); - renderedTex.data = fixBC5; + renderedTex.data = DDSCompressor.DecompressBC5(renderedTex.mipmaps[0][0], (int)renderedTex.width, (int)renderedTex.height, true, true); renderedTex.pixelInternalFormat = PixelInternalFormat.Rgba; renderedTex.pixelFormat = OpenTK.Graphics.OpenGL.PixelFormat.Rgba; break; @@ -356,12 +589,24 @@ namespace FirstPlugin public override void OnClick(TreeView treeView) { - FTEXEditor FTEXEditor = new FTEXEditor(); - FTEXEditor.Text = Text; - FTEXEditor.Dock = DockStyle.Fill; - FTEXEditor.LoadPicture(DisplayTexture()); - FTEXEditor.LoadProperty(this); - LibraryGUI.Instance.LoadDockContent(FTEXEditor, PluginRuntime.FSHPDockState); + UpdateEditor(); + } + + public void UpdateEditor() + { + if (Viewport.Instance.gL_ControlModern1.Visible == false) + PluginRuntime.FSHPDockState = WeifenLuo.WinFormsUI.Docking.DockState.Document; + + FTEXEditor docked = (FTEXEditor)LibraryGUI.Instance.GetContentDocked(new FTEXEditor()); + if (docked == null) + { + docked = new FTEXEditor(); + LibraryGUI.Instance.LoadDockContent(docked, PluginRuntime.FSHPDockState); + } + docked.Text = Text; + docked.Dock = DockStyle.Fill; + docked.LoadPicture(DisplayTexture()); + docked.LoadProperty(this); } public class RenderableTex @@ -373,21 +618,8 @@ namespace FirstPlugin public PixelType pixelType = PixelType.UnsignedByte; public int mipMapCount; public List> mipmaps = new List>(); + public byte[] data; - public byte[] data - { - get - { - return mipmaps[0][0]; - } - set - { - mipmaps.Clear(); - List mips = new List(); - mips.Add(value); - mipmaps.Add(mips); - } - } public class Surface { @@ -435,18 +667,23 @@ namespace FirstPlugin { throw new Exception($"Bad size from format {Format}"); } - - - + } + public static byte[] CompressBlock(byte[] data, int width, int height, GTX.GX2SurfaceFormat format) + { + if (IsCompressedFormat((GX2SurfaceFormat)format)) + return DDSCompressor.CompressBlock(data, width, height, GetCompressedDXGI_FORMAT((GX2SurfaceFormat)format)); + else + return DDSCompressor.EncodePixelBlock(data, width, height, GetUncompressedDXGI_FORMAT((GX2SurfaceFormat)format)); } private static DDS.DXGI_FORMAT GetUncompressedDXGI_FORMAT(GX2SurfaceFormat Format) { switch (Format) { + case GX2SurfaceFormat.TC_R5_G5_B5_A1_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM; case GX2SurfaceFormat.TC_A1_B5_G5_R5_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM; case GX2SurfaceFormat.TC_R4_G4_B4_A4_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM; case GX2SurfaceFormat.TCS_R5_G6_B5_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM; - case GX2SurfaceFormat.TCS_R8_G8_B8_A8_SRGB: return DDS.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; + case GX2SurfaceFormat.TCS_R8_G8_B8_A8_SRGB: return DDS.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM; case GX2SurfaceFormat.TCS_R8_G8_B8_A8_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM; case GX2SurfaceFormat.TCS_R10_G10_B10_A2_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM; case GX2SurfaceFormat.TC_R11_G11_B10_Float: return DDS.DXGI_FORMAT.DXGI_FORMAT_R11G11B10_FLOAT; @@ -484,11 +721,11 @@ namespace FirstPlugin switch (Format) { case GX2SurfaceFormat.T_BC1_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM; - case GX2SurfaceFormat.T_BC1_SRGB: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB; + case GX2SurfaceFormat.T_BC1_SRGB: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM; case GX2SurfaceFormat.T_BC2_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM; - case GX2SurfaceFormat.T_BC2_SRGB: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB; + case GX2SurfaceFormat.T_BC2_SRGB: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM; case GX2SurfaceFormat.T_BC3_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM; - case GX2SurfaceFormat.T_BC3_SRGB: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB; + case GX2SurfaceFormat.T_BC3_SRGB: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM; case GX2SurfaceFormat.T_BC4_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC4_UNORM; case GX2SurfaceFormat.T_BC4_SNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC4_SNORM; case GX2SurfaceFormat.T_BC5_UNorm: return DDS.DXGI_FORMAT.DXGI_FORMAT_BC5_UNORM; @@ -503,7 +740,8 @@ namespace FirstPlugin } public Bitmap UpdateBitmap(Bitmap image) { - return ColorComponentSelector(image, ChannelRed, ChannelGreen, ChannelBlue, ChannelAlpha); + return ColorComponentSelector(image, texture.CompSelR, + texture.CompSelG, texture.CompSelB, texture.CompSelA); } public static Bitmap ColorComponentSelector(Bitmap image, GX2CompSel R, GX2CompSel G, GX2CompSel B, GX2CompSel A) { diff --git a/Switch_FileFormatsMain/FileFormats/Texture/GTX.cs b/Switch_FileFormatsMain/FileFormats/Texture/GTX.cs index 3150330b..9576e65b 100644 --- a/Switch_FileFormatsMain/FileFormats/Texture/GTX.cs +++ b/Switch_FileFormatsMain/FileFormats/Texture/GTX.cs @@ -72,24 +72,24 @@ namespace FirstPlugin //Todo. Add swizzling back public struct GX2Surface { - public int dim; - public int width; - public int height; - public int depth; - public int numMips; - public int format; - public int aa; - public int use; + public uint dim; + public uint width; + public uint height; + public uint depth; + public uint numMips; + public uint format; + public uint aa; + public uint use; public int resourceFlags; - public int imageSize; - public int imagePtr; + public uint imageSize; + public uint imagePtr; public int pMem; - public int mipSize; - public int mipPtr; - public int tileMode; - public int swizzle; - public int alignment; - public int pitch; + public uint mipSize; + public uint mipPtr; + public uint tileMode; + public uint swizzle; + public uint alignment; + public uint pitch; public uint bpp; public byte[] data; @@ -483,49 +483,52 @@ namespace FirstPlugin Console.WriteLine($"tileType {surf.tileType}"); Console.WriteLine($"tileIndex {surf.tileIndex}"); } - static bool DebugSurface = true; + static bool DebugSurface = false; public static List Decode(GX2Surface tex) { - var surfInfo = getSurfaceInfo((GX2SurfaceFormat)tex.format, tex.width, tex.height, tex.depth, (uint)tex.dim, (uint)tex.tileMode, (uint)tex.aa, 0); + uint blkWidth, blkHeight; + if (IsFormatBCN((GX2SurfaceFormat)tex.format)) + { + blkWidth = 4; + blkHeight = 4; + } + else + { + blkWidth = 1; + blkHeight = 1; + } - Console.WriteLine(tex.tileMode); + byte[] data = tex.data; + + var surfInfo = getSurfaceInfo((GX2SurfaceFormat)tex.format, tex.width, tex.height, tex.depth, (uint)tex.dim, (uint)tex.tileMode, (uint)tex.aa, 0); + Debug(surfInfo); + uint bpp = TegraX1Swizzle.DIV_ROUND_UP(surfInfo.bpp, 8); if (surfInfo.depth != 1) - throw new Exception("Unsupported Depth!"); + throw new Exception($"Unsupported Depth {surfInfo.depth}!"); List result = new List(); for (int mipLevel = 0; mipLevel < tex.numMips; mipLevel++) { - int size; - if (IsFormatBCN((GX2SurfaceFormat)tex.format)) - size = ((Math.Max(1, tex.width >> mipLevel) + 3) >> 2) * ((Math.Max(1, tex.height >> mipLevel) + 3) >> 2) * (int)tex.bpp; - else - size = Math.Max(1, tex.width >> mipLevel) * Math.Max(1, tex.height >> mipLevel) * (int)tex.bpp; + uint width_ = (uint)Math.Max(1, tex.width >> mipLevel); + uint height_ = (uint)Math.Max(1, tex.height >> mipLevel); - byte[] data; - if (mipLevel == 0) + uint size = TegraX1Swizzle.DIV_ROUND_UP(width_, blkWidth) * TegraX1Swizzle.DIV_ROUND_UP(height_, blkHeight) * bpp; + + uint mipOffset; + if (mipLevel != 0) { - data = new byte[surfInfo.surfSize]; - } - else - { - uint mipOffset; + mipOffset = (tex.mipOffset[mipLevel - 1]); if (mipLevel == 1) - mipOffset = (uint)(tex.mipOffset[mipLevel - 1] - surfInfo.surfSize); - else - mipOffset = (uint)tex.mipOffset[mipLevel - 1]; - - // Console.WriteLine("mipOffset " + tex.mipOffset[mipLevel - 1]); - // Console.WriteLine("surfSize " + surfInfo.surfSize); + mipOffset -= (uint)surfInfo.surfSize; surfInfo = getSurfaceInfo((GX2SurfaceFormat)tex.format, tex.width, tex.height, tex.depth, (uint)tex.dim, (uint)tex.tileMode, (uint)tex.aa, mipLevel); - data = new byte[surfInfo.surfSize + mipOffset]; Array.Copy(tex.mipData, mipOffset, data, 0, surfInfo.surfSize); } - byte[] deswizzled = deswizzle(Math.Max(1, (uint)tex.width >> mipLevel), Math.Max(1, (uint)tex.height >> mipLevel), (uint)surfInfo.height, (uint)tex.format, - (uint)surfInfo.tileMode, (uint)tex.swizzle, (uint)surfInfo.pitch, (uint)surfInfo.bpp, data); + byte[] deswizzled = deswizzle(width_, height_, surfInfo.height, (uint)tex.format, + surfInfo.tileMode, (uint)tex.swizzle, surfInfo.pitch, surfInfo.bpp, data); //Create a copy and use that to remove uneeded data byte[] result_ = new byte[size]; Array.Copy(deswizzled, 0, result_, 0, size); @@ -591,17 +594,17 @@ namespace FirstPlugin private static byte[] swizzleSurf(uint width, uint height, uint height_, uint format, uint tileMode, uint swizzle_, uint pitch, uint bitsPerPixel, byte[] data, int swizzle) { - Console.WriteLine("swizzle"); + Console.WriteLine("swizzling level...."); Console.WriteLine("---------------------------"); - Console.WriteLine(width); - Console.WriteLine(height); - Console.WriteLine(height_); - Console.WriteLine(format); - Console.WriteLine(tileMode); - Console.WriteLine(swizzle_); - Console.WriteLine(pitch); - Console.WriteLine(bitsPerPixel); - Console.WriteLine(swizzle); + Console.WriteLine("width " + width); + Console.WriteLine("height " + height); + Console.WriteLine("height_ " + height_); + Console.WriteLine("format " + format); + Console.WriteLine("tileMode " + tileMode); + Console.WriteLine("swizzle_ " + swizzle_); + Console.WriteLine("pitch " + pitch); + Console.WriteLine("bitsPerPixel " + bitsPerPixel); + Console.WriteLine("swizzle " + swizzle); Console.WriteLine("---------------------------"); uint bytesPerPixel = bitsPerPixel / 8; @@ -2265,7 +2268,7 @@ namespace FirstPlugin return ~(align - 1) & (x + align - 1); } - public static surfaceOut getSurfaceInfo(GX2SurfaceFormat surfaceFormat, int surfaceWidth, int surfaceHeight, int surfaceDepth, uint surfaceDim, uint surfaceTileMode, uint surfaceAA, int level) + public static surfaceOut getSurfaceInfo(GX2SurfaceFormat surfaceFormat, uint surfaceWidth, uint surfaceHeight, uint surfaceDepth, uint surfaceDim, uint surfaceTileMode, uint surfaceAA, int level) { GX2Surface surface = new GX2Surface(); @@ -2312,34 +2315,34 @@ namespace FirstPlugin } else if (dim == 1) { - pSurfOut.height = (uint)Math.Max(1, surfaceHeight >> level); + pSurfOut.height = Math.Max(1, surfaceHeight >> level); pSurfOut.depth = 1; } else if (dim == 2) { - pSurfOut.height = (uint)Math.Max(1, surfaceHeight >> level); - pSurfOut.depth = (uint)Math.Max(1, surfaceDepth >> level); + pSurfOut.height = Math.Max(1, surfaceHeight >> level); + pSurfOut.depth = Math.Max(1, surfaceDepth >> level); } else if (dim == 3) { - pSurfOut.height = (uint)Math.Max(1, surfaceHeight >> level); - pSurfOut.depth = (uint)Math.Max(6, surfaceDepth); + pSurfOut.height = Math.Max(1, surfaceHeight >> level); + pSurfOut.depth = Math.Max(6, surfaceDepth); } else if (dim == 4) { pSurfOut.height = 1; - pSurfOut.depth = (uint)surfaceDepth; + pSurfOut.depth = surfaceDepth; } else if (dim == 5) { - pSurfOut.height = (uint)Math.Max(1, surfaceHeight >> level); - pSurfOut.depth = (uint)surfaceDepth; + pSurfOut.height = Math.Max(1, surfaceHeight >> level); + pSurfOut.depth = surfaceDepth; } - pSurfOut.height = (uint)(~(blockSize - 1) & (pSurfOut.height + blockSize - 1)) / blockSize; - pSurfOut.pixelPitch = (uint)(~(blockSize - 1) & ((surfaceWidth >> level) + blockSize - 1)); + pSurfOut.height = (~(blockSize - 1) & (pSurfOut.height + blockSize - 1)) / blockSize; + pSurfOut.pixelPitch = (~(blockSize - 1) & ((surfaceWidth >> level) + blockSize - 1)); pSurfOut.pixelPitch = Math.Max(blockSize, pSurfOut.pixelPitch); - pSurfOut.pixelHeight = (uint)(~(blockSize - 1) & ((surfaceHeight >> level) + blockSize - 1)); + pSurfOut.pixelHeight = (~(blockSize - 1) & ((surfaceHeight >> level) + blockSize - 1)); pSurfOut.pixelHeight = Math.Max(blockSize, pSurfOut.pixelHeight); pSurfOut.pitch = Math.Max(1, pSurfOut.pitch); pSurfOut.height = Math.Max(1, pSurfOut.height); diff --git a/Switch_FileFormatsMain/GUI/TextureUI/BinaryTextureImporterList.Designer.cs b/Switch_FileFormatsMain/GUI/TextureUI/BinaryTextureImporterList.Designer.cs index b285d4be..51d785f3 100644 --- a/Switch_FileFormatsMain/GUI/TextureUI/BinaryTextureImporterList.Designer.cs +++ b/Switch_FileFormatsMain/GUI/TextureUI/BinaryTextureImporterList.Designer.cs @@ -36,7 +36,7 @@ this.Format = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.SwizzleNum = new System.Windows.Forms.NumericUpDown(); this.label5 = new System.Windows.Forms.Label(); - this.GPUAccessFlgComb = new System.Windows.Forms.ComboBox(); + this.tileModeCB = new System.Windows.Forms.ComboBox(); this.label4 = new System.Windows.Forms.Label(); this.ImgDimComb = new System.Windows.Forms.ComboBox(); this.label3 = new System.Windows.Forms.Label(); @@ -57,7 +57,7 @@ this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button2.ForeColor = System.Drawing.Color.White; - this.button2.Location = new System.Drawing.Point(941, 517); + this.button2.Location = new System.Drawing.Point(1009, 517); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(79, 33); this.button2.TabIndex = 5; @@ -69,7 +69,7 @@ this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Location = new System.Drawing.Point(843, 517); + this.button1.Location = new System.Drawing.Point(911, 517); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(79, 33); this.button1.TabIndex = 4; @@ -121,23 +121,23 @@ this.label5.TabIndex = 27; this.label5.Text = "Swizzle"; // - // GPUAccessFlgComb + // tileModeCB // - this.GPUAccessFlgComb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.GPUAccessFlgComb.FormattingEnabled = true; - this.GPUAccessFlgComb.Location = new System.Drawing.Point(855, 79); - this.GPUAccessFlgComb.Name = "GPUAccessFlgComb"; - this.GPUAccessFlgComb.Size = new System.Drawing.Size(172, 21); - this.GPUAccessFlgComb.TabIndex = 26; + this.tileModeCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.tileModeCB.FormattingEnabled = true; + this.tileModeCB.Location = new System.Drawing.Point(855, 79); + this.tileModeCB.Name = "tileModeCB"; + this.tileModeCB.Size = new System.Drawing.Size(233, 21); + this.tileModeCB.TabIndex = 26; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(759, 82); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(96, 13); + this.label4.Size = new System.Drawing.Size(54, 13); this.label4.TabIndex = 25; - this.label4.Text = "GPU Access Flags"; + this.label4.Text = "Tile Mode"; // // ImgDimComb // @@ -145,7 +145,7 @@ this.ImgDimComb.FormattingEnabled = true; this.ImgDimComb.Location = new System.Drawing.Point(853, 46); this.ImgDimComb.Name = "ImgDimComb"; - this.ImgDimComb.Size = new System.Drawing.Size(172, 21); + this.ImgDimComb.Size = new System.Drawing.Size(233, 21); this.ImgDimComb.TabIndex = 24; // // label3 @@ -222,7 +222,7 @@ this.formatComboBox.FormattingEnabled = true; this.formatComboBox.Location = new System.Drawing.Point(853, 16); this.formatComboBox.Name = "formatComboBox"; - this.formatComboBox.Size = new System.Drawing.Size(172, 21); + this.formatComboBox.Size = new System.Drawing.Size(233, 21); this.formatComboBox.TabIndex = 16; this.formatComboBox.SelectedIndexChanged += new System.EventHandler(this.formatComboBox_SelectedIndexChanged); // @@ -231,10 +231,10 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.ClientSize = new System.Drawing.Size(1036, 562); + this.ClientSize = new System.Drawing.Size(1100, 562); this.Controls.Add(this.SwizzleNum); this.Controls.Add(this.label5); - this.Controls.Add(this.GPUAccessFlgComb); + this.Controls.Add(this.tileModeCB); this.Controls.Add(this.label4); this.Controls.Add(this.ImgDimComb); this.Controls.Add(this.label3); @@ -265,7 +265,7 @@ private Switch_Toolbox.Library.Forms.ListViewCustom listViewCustom1; private System.Windows.Forms.NumericUpDown SwizzleNum; private System.Windows.Forms.Label label5; - private System.Windows.Forms.ComboBox GPUAccessFlgComb; + private System.Windows.Forms.ComboBox tileModeCB; private System.Windows.Forms.Label label4; private System.Windows.Forms.ComboBox ImgDimComb; private System.Windows.Forms.Label label3; diff --git a/Switch_FileFormatsMain/GUI/TextureUI/BinaryTextureImporterList.cs b/Switch_FileFormatsMain/GUI/TextureUI/BinaryTextureImporterList.cs index 7514802d..8b234743 100644 --- a/Switch_FileFormatsMain/GUI/TextureUI/BinaryTextureImporterList.cs +++ b/Switch_FileFormatsMain/GUI/TextureUI/BinaryTextureImporterList.cs @@ -62,9 +62,9 @@ namespace FirstPlugin { ImgDimComb.Items.Add(dim); } - GPUAccessFlgComb.Items.Add("Texture"); + tileModeCB.Items.Add("Texture"); ImgDimComb.SelectedIndex = 1; - GPUAccessFlgComb.SelectedIndex = 0; + tileModeCB.SelectedIndex = 0; formatComboBox.SelectedItem = SurfaceFormat.BC1_SRGB; } TextureImporterSettings SelectedTexSettings; diff --git a/Switch_FileFormatsMain/GUI/TextureUI/GTXImporterSettings.cs b/Switch_FileFormatsMain/GUI/TextureUI/GTXImporterSettings.cs new file mode 100644 index 00000000..9dbf947d --- /dev/null +++ b/Switch_FileFormatsMain/GUI/TextureUI/GTXImporterSettings.cs @@ -0,0 +1,375 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.IO; +using System.Drawing; +using System.Threading.Tasks; +using Switch_Toolbox.Library; +using Switch_Toolbox.Library.IO; +using Syroot.NintenTools.Bfres.GX2; + +namespace FirstPlugin +{ + public class GTXImporterSettings + { + public string TexName; + public uint TexWidth; + public uint TexHeight; + public uint MipCount; + public uint bpp; + public uint Depth = 1; + public uint arrayLength = 1; + public List DataBlockOutput = new List(); + public List DecompressedData = new List(); + public GTX.GX2SurfaceFormat Format; + public bool GenerateMipmaps; + public bool IsSRGB; + public uint tileMode = 4; + public uint swizzle = 4; + public GX2CompSel[] compSel = new GX2CompSel[4]; + public GX2SurfaceDim SurfaceDim = GX2SurfaceDim.Dim2D; + public GX2AAMode AAMode = GX2AAMode.Mode1X; + + private GTX.GX2SurfaceFormat LoadDDSFormat(uint fourCC, DDS dds = null, bool IsSRGB = false) + { + bool IsDX10 = false; + + switch (fourCC) + { + case DDS.FOURCC_DXT1: + if (IsSRGB) + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC1_SRGB; + else + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC1_UNORM; + case DDS.FOURCC_DXT3: + if (IsSRGB) + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC2_SRGB; + else + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC2_UNORM; + case DDS.FOURCC_DXT5: + if (IsSRGB) + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC3_SRGB; + else + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC3_UNORM; + case DDS.FOURCC_BC4U: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC4_UNORM; + case DDS.FOURCC_ATI1: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC4_UNORM; + case DDS.FOURCC_ATI2: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC5_UNORM; + case DDS.FOURCC_BC5U: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC4_UNORM; + case DDS.FOURCC_DX10: + IsDX10 = true; + break; + default: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM; + } + if (IsDX10) + { + switch (dds.DX10header.DXGI_Format) + { + case DDS.DXGI_FORMAT.DXGI_FORMAT_BC4_UNORM: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC4_UNORM; + case DDS.DXGI_FORMAT.DXGI_FORMAT_BC4_SNORM: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC4_SNORM; + case DDS.DXGI_FORMAT.DXGI_FORMAT_BC4_TYPELESS: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC4_UNORM; + case DDS.DXGI_FORMAT.DXGI_FORMAT_BC5_UNORM: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC5_UNORM; + case DDS.DXGI_FORMAT.DXGI_FORMAT_BC5_SNORM: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC5_SNORM; + case DDS.DXGI_FORMAT.DXGI_FORMAT_BC5_TYPELESS: + return GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC5_UNORM; + default: + throw new Exception($"Format {dds.DX10header.DXGI_Format} not supported!"); + } + } + throw new Exception($"This shouldn't happen :("); + } + public void LoadDDS(string FileName, byte[] FileData = null) + { + TexName = Path.GetFileNameWithoutExtension(FileName); + + DDS dds = new DDS(); + + if (FileData != null) + dds.Load(new FileReader(new MemoryStream(FileData))); + else + dds.Load(new FileReader(FileName)); + MipCount = dds.header.mipmapCount; + TexWidth = dds.header.width; + TexHeight = dds.header.height; + arrayLength = 1; + if (dds.header.caps2 == (uint)DDS.DDSCAPS2.CUBEMAP_ALLFACES) + { + arrayLength = 6; + } + DataBlockOutput.Add(dds.bdata); + + Format = LoadDDSFormat(dds.header.ddspf.fourCC, dds, IsSRGB); + + GTX.GX2Surface tex = CreateGx2Texture(DataBlockOutput[0]); + } + public void LoadBitMap(string FileName) + { + DecompressedData.Clear(); + + TexName = Path.GetFileNameWithoutExtension(FileName); + Format = GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC1_SRGB; + GenerateMipmaps = true; + + Bitmap Image = new Bitmap(FileName); + Image = TextureData.SwapBlueRedChannels(Image); + + TexWidth = (uint)Image.Width; + TexHeight = (uint)Image.Height; + MipCount = (uint)GetTotalMipCount(); + + DecompressedData.Add(BitmapExtension.ImageToByte(Image)); + + Image.Dispose(); + if (DecompressedData.Count == 0) + { + throw new Exception("Failed to load " + Format); + } + } + public int GetTotalMipCount() + { + int MipmapNum = 0; + uint num = Math.Max(TexHeight, TexWidth); + + int width = (int)TexWidth; + int height = (int)TexHeight; + + while (true) + { + num >>= 1; + + width = width / 2; + height = height / 2; + if (width <= 0 || height <= 0) + break; + + if (num > 0) + ++MipmapNum; + else + break; + } + + return MipmapNum; + } + public byte[] GenerateMips(int SurfaceLevel = 0) + { + Bitmap Image = BitmapExtension.GetBitmap(DecompressedData[SurfaceLevel], (int)TexWidth, (int)TexHeight); + + List mipmaps = new List(); + mipmaps.Add(FTEX.CompressBlock(DecompressedData[SurfaceLevel], (int)TexWidth, (int)TexHeight, Format)); + + //while (Image.Width / 2 > 0 && Image.Height / 2 > 0) + // for (int mipLevel = 0; mipLevel < MipCount; mipLevel++) + for (int mipLevel = 0; mipLevel < MipCount; mipLevel++) + { + Image = BitmapExtension.Resize(Image, Image.Width / 2, Image.Height / 2); + mipmaps.Add(FTEX.CompressBlock(BitmapExtension.ImageToByte(Image), Image.Width, Image.Height, Format)); + } + Image.Dispose(); + + return Utils.CombineByteArray(mipmaps.ToArray()); + } + public void Compress() + { + DataBlockOutput.Clear(); + foreach (var surface in DecompressedData) + { + DataBlockOutput.Add(FTEX.CompressBlock(surface, (int)TexWidth, (int)TexHeight, Format)); + } + } + + public GTX.GX2Surface CreateGx2Texture(byte[] imageData) + { + var surfOut = GTX.getSurfaceInfo(Format, TexWidth, TexHeight, 1, 1, tileMode, 0, 0); + uint imageSize = (uint)surfOut.surfSize; + uint alignment = surfOut.baseAlign; + uint pitch = surfOut.pitch; + uint mipSize = 0; + uint dataSize = (uint)imageData.Length; + + if (imageData.Length <= 0) + throw new Exception($"Image is empty!!"); + + if (surfOut.depth != 1) + throw new Exception($"Unsupported Depth {surfOut.depth}!"); + + uint s = 0; + switch (tileMode) + { + case 1: + case 2: + case 3: + case 16: + s = 0; + break; + default: + s = 0xd0000 | swizzle << 8; + break; + } + uint blkWidth, blkHeight; + if (GTX.IsFormatBCN(Format)) + { + blkWidth = 4; + blkHeight = 4; + } + else + { + blkWidth = 1; + blkHeight = 1; + } + List mipOffsets = new List(); + List Swizzled = new List(); + + byte[] data; + for (int mipLevel = 0; mipLevel < MipCount; mipLevel++) + { + var result = TextureHelper.GetCurrentMipSize(TexWidth, TexHeight, blkWidth, blkHeight, bpp, mipLevel); + uint offset = result.Item1; + uint size = result.Item2; + + byte[] data_ = Utils.SubArray(imageData, offset, size); + + uint width_ = Math.Max(1, TexWidth >> mipLevel); + uint height_ = Math.Max(1, TexHeight >> mipLevel); + + + if (mipLevel != 0) + { + surfOut = GTX.getSurfaceInfo(Format, TexWidth, TexHeight, 1, 1, tileMode, 0, mipLevel); + + if (mipLevel == 1) + { + if (mipLevel == 1) + mipOffsets.Add(imageSize); + else + mipOffsets.Add(mipSize); + } + } + + data_ = Utils.CombineByteArray(data_, new byte[surfOut.surfSize - size]); + byte[] dataAlignBytes = new byte[RoundUp(mipSize, surfOut.baseAlign) - mipSize]; + + if (mipLevel != 0) + mipSize += (uint)(surfOut.surfSize + dataAlignBytes.Length); + + Swizzled.Add(Utils.CombineByteArray(dataAlignBytes, GTX.swizzle(width_, height_, surfOut.height, (uint)Format, surfOut.tileMode, s, + surfOut.pitch, surfOut.bpp, data_))); + } + File.WriteAllBytes("NewSwizzle.bin",Swizzled[0]); + + compSel[0] = GX2CompSel.ChannelR; + compSel[1] = GX2CompSel.ChannelG; + compSel[2] = GX2CompSel.ChannelB; + compSel[3] = GX2CompSel.ChannelA; + + GTX.GX2Surface surf = new GTX.GX2Surface(); + surf.depth = Depth; + surf.width = TexWidth; + surf.height = TexHeight; + surf.depth = 1; + surf.dim = (uint)SurfaceDim; + surf.bpp = GTX.surfaceGetBitsPerPixel((uint)Format >> 3); + surf.tileMode = tileMode; + surf.swizzle = s; + surf.resourceFlags = 0; + surf.pitch = surfOut.pitch; + surf.format = (uint)Format; + surf.numMips = MipCount; + surf.aa = (uint)AAMode; + surf.mipOffset = mipOffsets.ToArray(); + surf.numMips = (uint)Swizzled.Count; + surf.alignment = alignment; + surf.mipSize = mipSize; + surf.imageSize = imageSize; + surf.data = Swizzled[0]; + + List mips = new List(); + for (int mipLevel = 1; mipLevel < Swizzled.Count; mipLevel++) + { + mips.Add(Swizzled[mipLevel]); + } + surf.mipData = Utils.CombineByteArray(mips.ToArray()); + mips.Clear(); + + Console.WriteLine(""); + Console.WriteLine("// ----- GX2Surface Info ----- "); + Console.WriteLine(" dim = 1"); + Console.WriteLine(" width = " + surf.width); + Console.WriteLine(" height = " + surf.height); + Console.WriteLine(" depth = 1"); + Console.WriteLine(" numMips = " + surf.numMips); + Console.WriteLine(" format = " + surf.format); + Console.WriteLine(" aa = 0"); + Console.WriteLine(" use = 1"); + Console.WriteLine(" imageSize = " + surf.imageSize); + Console.WriteLine(" mipSize = " + surf.mipSize); + Console.WriteLine(" tileMode = " + surf.tileMode); + Console.WriteLine(" swizzle = " + surf.swizzle); + Console.WriteLine(" alignment = " + surf.alignment); + Console.WriteLine(" pitch = " + surf.pitch); + Console.WriteLine(""); + Console.WriteLine(" GX2 Component Selector:"); + Console.WriteLine(" Red Channel: " + compSel[0]); + Console.WriteLine(" Green Channel: " + compSel[1]); + Console.WriteLine(" Blue Channel: " + compSel[2]); + Console.WriteLine(" Alpha Channel: " + compSel[3]); + Console.WriteLine(""); + Console.WriteLine(" bits per pixel = " + (surf.bpp << 3)); + Console.WriteLine(" bytes per pixel = " + surf.bpp); + Console.WriteLine(" realSize = " + imageData.Length); + + + return surf; + } + private static Tuple GetCurrentMipSize(uint width, uint height, uint bpp, int CurLevel, bool IsCompressed) + { + uint offset = 0; + uint size = 0; + + for (int mipLevel = 0; mipLevel < CurLevel; mipLevel++) + { + int level = mipLevel + 1; + if (IsCompressed) + offset += ((Math.Max(1, width >> level) + 3) >> 2) * ((Math.Max(1, height >> level) + 3) >> 2) * bpp; + else + offset += Math.Max(1, width >> level) * Math.Max(1, height >> level) * bpp; + } + if (IsCompressed) + size = ((Math.Max(1, width >> CurLevel) + 3) >> 2) * ((Math.Max(1, height >> CurLevel) + 3) >> 2) * bpp; + else + size = Math.Max(1, width >> CurLevel) * Math.Max(1, height >> CurLevel) * bpp; + + return Tuple.Create(offset, size); + + } + private uint getAlignBlockSize(uint dataOffset, uint alignment) + { + uint alignSize = RoundUp(dataOffset, alignment) - dataOffset - 32; + + uint z = 1; + while (alignSize <= 0) + { + alignSize = RoundUp(dataOffset + (alignment * z), alignment) - dataOffset - 32; + z += 1; + } + return alignSize; + } + + private int RoundUp(int X, int Y) + { + return ((X - 1) | (Y - 1)) + 1; + } + private uint RoundUp(uint X, uint Y) + { + return ((X - 1) | (Y - 1)) + 1; + } + } +} diff --git a/Switch_FileFormatsMain/GUI/TextureUI/GTXTextureImporter.Designer.cs b/Switch_FileFormatsMain/GUI/TextureUI/GTXTextureImporter.Designer.cs new file mode 100644 index 00000000..6b978c01 --- /dev/null +++ b/Switch_FileFormatsMain/GUI/TextureUI/GTXTextureImporter.Designer.cs @@ -0,0 +1,281 @@ +namespace FirstPlugin +{ + partial class GTXTextureImporter + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GTXTextureImporter)); + this.SwizzleNum = new System.Windows.Forms.NumericUpDown(); + this.label5 = new System.Windows.Forms.Label(); + this.tileModeCB = new System.Windows.Forms.ComboBox(); + this.label4 = new System.Windows.Forms.Label(); + this.ImgDimComb = new System.Windows.Forms.ComboBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.MipmapNum = new System.Windows.Forms.NumericUpDown(); + this.WidthLabel = new System.Windows.Forms.Label(); + this.HeightLabel = new System.Windows.Forms.Label(); + this.formatComboBox = new System.Windows.Forms.ComboBox(); + this.listViewCustom1 = new Switch_Toolbox.Library.Forms.ListViewCustom(); + this.Name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.Format = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.pictureBox1 = new Switch_Toolbox.Library.Forms.PictureBoxCustom(); + ((System.ComponentModel.ISupportInitialize)(this.SwizzleNum)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.MipmapNum)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // SwizzleNum + // + this.SwizzleNum.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.SwizzleNum.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.SwizzleNum.ForeColor = System.Drawing.Color.White; + this.SwizzleNum.Location = new System.Drawing.Point(877, 142); + this.SwizzleNum.Name = "SwizzleNum"; + this.SwizzleNum.Size = new System.Drawing.Size(130, 16); + this.SwizzleNum.TabIndex = 44; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(769, 142); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(42, 13); + this.label5.TabIndex = 43; + this.label5.Text = "Swizzle"; + // + // tileModeCB + // + this.tileModeCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.tileModeCB.FormattingEnabled = true; + this.tileModeCB.Location = new System.Drawing.Point(877, 69); + this.tileModeCB.Name = "tileModeCB"; + this.tileModeCB.Size = new System.Drawing.Size(172, 21); + this.tileModeCB.TabIndex = 42; + this.tileModeCB.SelectedIndexChanged += new System.EventHandler(this.tileModeCB_SelectedIndexChanged); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(769, 72); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(54, 13); + this.label4.TabIndex = 41; + this.label4.Text = "Tile Mode"; + // + // ImgDimComb + // + this.ImgDimComb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.ImgDimComb.FormattingEnabled = true; + this.ImgDimComb.Location = new System.Drawing.Point(875, 36); + this.ImgDimComb.Name = "ImgDimComb"; + this.ImgDimComb.Size = new System.Drawing.Size(172, 21); + this.ImgDimComb.TabIndex = 40; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(769, 39); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(88, 13); + this.label3.TabIndex = 39; + this.label3.Text = "Image Dimension"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(766, 9); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(39, 13); + this.label2.TabIndex = 38; + this.label2.Text = "Format"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(769, 107); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(90, 13); + this.label1.TabIndex = 37; + this.label1.Text = "Number MipMaps"; + // + // MipmapNum + // + this.MipmapNum.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.MipmapNum.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.MipmapNum.ForeColor = System.Drawing.Color.White; + this.MipmapNum.Location = new System.Drawing.Point(877, 105); + this.MipmapNum.Name = "MipmapNum"; + this.MipmapNum.Size = new System.Drawing.Size(130, 16); + this.MipmapNum.TabIndex = 36; + // + // WidthLabel + // + this.WidthLabel.AutoSize = true; + this.WidthLabel.Location = new System.Drawing.Point(769, 210); + this.WidthLabel.Name = "WidthLabel"; + this.WidthLabel.Size = new System.Drawing.Size(35, 13); + this.WidthLabel.TabIndex = 35; + this.WidthLabel.Text = "Width"; + // + // HeightLabel + // + this.HeightLabel.AutoSize = true; + this.HeightLabel.Location = new System.Drawing.Point(769, 175); + this.HeightLabel.Name = "HeightLabel"; + this.HeightLabel.Size = new System.Drawing.Size(38, 13); + this.HeightLabel.TabIndex = 34; + this.HeightLabel.Text = "Height"; + // + // formatComboBox + // + this.formatComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.formatComboBox.FormattingEnabled = true; + this.formatComboBox.Location = new System.Drawing.Point(875, 6); + this.formatComboBox.Name = "formatComboBox"; + this.formatComboBox.Size = new System.Drawing.Size(172, 21); + this.formatComboBox.TabIndex = 32; + this.formatComboBox.SelectedIndexChanged += new System.EventHandler(this.formatComboBox_SelectedIndexChanged); + // + // listViewCustom1 + // + this.listViewCustom1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.listViewCustom1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.Name, + this.Format}); + this.listViewCustom1.Dock = System.Windows.Forms.DockStyle.Left; + this.listViewCustom1.ForeColor = System.Drawing.Color.White; + this.listViewCustom1.Location = new System.Drawing.Point(0, 0); + this.listViewCustom1.Name = "listViewCustom1"; + this.listViewCustom1.Size = new System.Drawing.Size(237, 515); + this.listViewCustom1.TabIndex = 31; + this.listViewCustom1.UseCompatibleStateImageBehavior = false; + this.listViewCustom1.View = System.Windows.Forms.View.Details; + this.listViewCustom1.SelectedIndexChanged += new System.EventHandler(this.listViewCustom1_SelectedIndexChanged); + // + // Name + // + this.Name.Text = "Name"; + this.Name.Width = 104; + // + // Format + // + this.Format.Text = "Format"; + // + // button2 + // + this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button2.ForeColor = System.Drawing.Color.White; + this.button2.Location = new System.Drawing.Point(993, 470); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(79, 33); + this.button2.TabIndex = 30; + this.button2.Text = "Cancel"; + this.button2.UseVisualStyleBackColor = true; + // + // button1 + // + this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; + this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button1.ForeColor = System.Drawing.Color.White; + this.button1.Location = new System.Drawing.Point(895, 470); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(79, 33); + this.button1.TabIndex = 29; + this.button1.Text = "Ok"; + this.button1.UseVisualStyleBackColor = true; + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.Transparent; + this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage"))); + this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Left; + this.pictureBox1.Location = new System.Drawing.Point(237, 0); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(513, 515); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 33; + this.pictureBox1.TabStop = false; + // + // GTXTextureImporter + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); + this.ClientSize = new System.Drawing.Size(1084, 515); + this.Controls.Add(this.SwizzleNum); + this.Controls.Add(this.label5); + this.Controls.Add(this.tileModeCB); + this.Controls.Add(this.label4); + this.Controls.Add(this.ImgDimComb); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.MipmapNum); + this.Controls.Add(this.WidthLabel); + this.Controls.Add(this.HeightLabel); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.formatComboBox); + this.Controls.Add(this.listViewCustom1); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.ForeColor = System.Drawing.Color.White; + this.Text = "GTXTextureImporter"; + ((System.ComponentModel.ISupportInitialize)(this.SwizzleNum)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.MipmapNum)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.NumericUpDown SwizzleNum; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.ComboBox tileModeCB; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.ComboBox ImgDimComb; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.NumericUpDown MipmapNum; + private System.Windows.Forms.Label WidthLabel; + private System.Windows.Forms.Label HeightLabel; + private Switch_Toolbox.Library.Forms.PictureBoxCustom pictureBox1; + private System.Windows.Forms.ComboBox formatComboBox; + private Switch_Toolbox.Library.Forms.ListViewCustom listViewCustom1; + private System.Windows.Forms.ColumnHeader Name; + private System.Windows.Forms.ColumnHeader Format; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file diff --git a/Switch_FileFormatsMain/GUI/TextureUI/GTXTextureImporter.cs b/Switch_FileFormatsMain/GUI/TextureUI/GTXTextureImporter.cs new file mode 100644 index 00000000..2365652c --- /dev/null +++ b/Switch_FileFormatsMain/GUI/TextureUI/GTXTextureImporter.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Threading; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace FirstPlugin +{ + public partial class GTXTextureImporter : Form + { + public GTXTextureImporter() + { + InitializeComponent(); + + + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TCS_R10_G10_B10_A2_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TCS_R5_G6_B5_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TC_R5_G5_B5_A1_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TC_R4_G4_B4_A4_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TC_R8_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_TC_R8_G8_UNORM); + + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC1_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC1_SRGB); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC2_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC2_SRGB); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC3_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC3_SRGB); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC4_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC4_SNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC5_UNORM); + formatComboBox.Items.Add(GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC5_SNORM); + + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_DEFAULT); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_LINEAR_ALIGNED); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_1D_TILED_THIN1); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_1D_TILED_THICK); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_2D_TILED_THIN1); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_2D_TILED_THIN2); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_2D_TILED_THIN4); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_2D_TILED_THICK); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_2B_TILED_THIN1); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_2B_TILED_THIN2); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_2B_TILED_THIN4); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_2B_TILED_THICK); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_3D_TILED_THIN1); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_3D_TILED_THICK); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_3B_TILED_THIN1); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_3B_TILED_THICK); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_LINEAR_SPECIAL); + tileModeCB.Items.Add(GTX.GX2TileMode.GX2_TILE_MODE_DEFAULT_FIX2197); + + tileModeCB.SelectedItem = GTX.GX2TileMode.GX2_TILE_MODE_2D_TILED_THIN1; + formatComboBox.SelectedItem = GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_T_BC1_SRGB; + } + GTXImporterSettings SelectedTexSettings; + + List settings = new List(); + public void LoadSettings(List s) + { + settings = s; + + foreach (var setting in settings) + { + listViewCustom1.Items.Add(setting.TexName).SubItems.Add(setting.Format.ToString()); + } + listViewCustom1.Items[0].Selected = true; + listViewCustom1.Select(); + } + public void LoadSetting(GTXImporterSettings setting) + { + settings = new List(); + settings.Add(setting); + + listViewCustom1.Items.Add(setting.TexName).SubItems.Add(setting.Format.ToString()); + listViewCustom1.Items[0].Selected = true; + listViewCustom1.Select(); + } + + private Thread Thread; + public void SetupSettings() + { + if (SelectedTexSettings.Format == GTX.GX2SurfaceFormat.GX2_SURFACE_FORMAT_INVALID) + return; + + + if (Thread != null && Thread.IsAlive) + Thread.Abort(); + + if (formatComboBox.SelectedItem is GTX.GX2SurfaceFormat) + { + SelectedTexSettings.Format = (GTX.GX2SurfaceFormat)formatComboBox.SelectedItem; + listViewCustom1.SelectedItems[0].SubItems[1].Text = SelectedTexSettings.Format.ToString(); + } + Bitmap bitmap = Switch_Toolbox.Library.Imaging.GetLoadingImage(); + + Thread = new Thread((ThreadStart)(() => + { + pictureBox1.Image = bitmap; + SelectedTexSettings.Compress(); + + bitmap = FTEX.DecodeBlock(SelectedTexSettings.DataBlockOutput[0], SelectedTexSettings. + TexWidth, SelectedTexSettings.TexHeight, (Syroot.NintenTools.Bfres.GX2.GX2SurfaceFormat)SelectedTexSettings.Format); + + pictureBox1.Image = bitmap; + + })); + Thread.Start(); + } + + private void tileModeCB_SelectedIndexChanged(object sender, EventArgs e) + { + if (tileModeCB.SelectedIndex > -1 && SelectedTexSettings != null) + SelectedTexSettings.tileMode = (uint)tileModeCB.SelectedItem; + } + + private void formatComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + if (formatComboBox.SelectedIndex > -1 && SelectedTexSettings != null) + { + SetupSettings(); + } + } + + private void listViewCustom1_SelectedIndexChanged(object sender, EventArgs e) + { + if (listViewCustom1.SelectedItems.Count > 0) + { + SelectedTexSettings = settings[listViewCustom1.SelectedIndices[0]]; + formatComboBox.SelectedItem = SelectedTexSettings.Format; + + SetupSettings(); + + MipmapNum.Maximum = SelectedTexSettings.GetTotalMipCount(); + MipmapNum.Value = SelectedTexSettings.MipCount; + } + } + } +} diff --git a/Switch_FileFormatsMain/GUI/TextureUI/GTXTextureImporter.resx b/Switch_FileFormatsMain/GUI/TextureUI/GTXTextureImporter.resx new file mode 100644 index 00000000..0bef8ca4 --- /dev/null +++ b/Switch_FileFormatsMain/GUI/TextureUI/GTXTextureImporter.resx @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAAlgAAAJYCAMAAACJuGjuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 + JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAADAFBMVEXMzMzNzc3Ozs7Pz8/Q0NDR0dHS + 0tLT09PU1NTV1dXW1tbX19fY2NjZ2dna2trb29vc3Nzd3d3e3t7f39/g4ODh4eHi4uLj4+Pk5OTl5eXm + 5ubn5+fo6Ojp6enq6urr6+vs7Ozt7e3u7u7v7+/w8PDx8fHy8vLz8/P09PT19fX29vb39/f4+Pj5+fn6 + +vr7+/v8/Pz9/f3+/v7///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAA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9izTcB2156Xeh5NoJuFZpqf4TNZemHHeITCz8FjXfXwEbnxe6qlEYLZhueMz + WZtFWIratmJtTTba8+60592oWEbFMiqWUbHcP6NY+iS0UbGc7likYjkVi1Qsp2IZFcuoWOYjiqWfsUjF + MrpjGRXLqVikYjkVi1Qs96sUS3+PZVQspzsWqVhOxSIVy6lYRsUy9WLlQRHhuMHhVxAYHH4FgcFhg8MO + xw0Ov4LA4bjBYYPDDscNDr+CwOE44ajDcYPDDsdfQWBw+BUEBocNDjscNzjscPwVBAaHDQ6/goBw1OTv + PhP65gOeCX1AQPGZ0HfvPxM6PEv5hzwT+owEas+Ebnz8M6GfZwhMfNjyu8+EPn/8M6Fv6s+ERkL/xjOh + cesy2vNO2vPu4g8z8ZunPkzhVCyjYjkVi1Qsp2KRiuVULKNiGRXLqFhGxXIqFqlYTsUiFcupWEbFMiqW + UbGMiuVULFKxnIpFKpZTsYyKZVQso2KZH1Is/D4jM+80LrRKBLQZIoHmCIFJmoigv0FAZZjRKRDQqYuE + kvArnu7TMGOwQkBrBGaOgI59BJSFX8p1KhBQJ17HuoWEyvhbosYIaBiu4xxnNGq/GayHAJq139oVZ/QQ + mGk4zW7tt3aFGa0JAhPXKv5Grfv8ckaj93+veSuXxEAIUwAAAABJRU5ErkJggg== + + + \ No newline at end of file diff --git a/Switch_FileFormatsMain/GUI/TextureUI/TextureImporterSettings.cs b/Switch_FileFormatsMain/GUI/TextureUI/TextureImporterSettings.cs index ca31cadf..1e16332a 100644 --- a/Switch_FileFormatsMain/GUI/TextureUI/TextureImporterSettings.cs +++ b/Switch_FileFormatsMain/GUI/TextureUI/TextureImporterSettings.cs @@ -145,7 +145,7 @@ namespace FirstPlugin DataBlockOutput.Add(dds.bdata); - Format = LoadDDSFormat(dds.header.ddspf.fourCC, dds, IsSRGB); + Format = LoadDDSFormat(dds.header.ddspf.fourCC.ToString(), dds, IsSRGB); Texture tex = FromBitMap(DataBlockOutput[0], this); @@ -237,31 +237,6 @@ namespace FirstPlugin { return TegraX1Swizzle.DIV_ROUND_UP(value1, value2); } - public static byte[] SubArray(byte[] data, uint offset, uint length) - { - return data.Skip((int)offset).Take((int)length).ToArray(); - } - private static Tuple GetCurrentMipSize(uint width, uint height, uint blkHeight, uint blkWidth, uint bpp, int CurLevel) - { - uint offset = 0; - uint width_ = 0; - uint height_ = 0; - - for (int mipLevel = 0; mipLevel < CurLevel; mipLevel++) - { - width_ = DIV_ROUND_UP(Math.Max(1, width >> mipLevel), blkWidth); - height_ = DIV_ROUND_UP(Math.Max(1, height >> mipLevel), blkHeight); - - offset += width_ * height_ * bpp; - } - - width_ = DIV_ROUND_UP(Math.Max(1, width >> CurLevel), blkWidth); - height_ = DIV_ROUND_UP(Math.Max(1, height >> CurLevel), blkHeight); - - uint size = width_ * height_ * bpp; - return Tuple.Create(offset, size); - - } public Texture FromBitMap(byte[] data, TextureImporterSettings settings) { Texture tex = new Texture(); @@ -357,11 +332,11 @@ namespace FirstPlugin List mipmaps = new List(); for (int mipLevel = 0; mipLevel < tex.MipCount; mipLevel++) { - var result = GetCurrentMipSize(tex.Width, tex.Height, blkWidth, blkHeight, bpp, mipLevel); + var result = TextureHelper.GetCurrentMipSize(tex.Width, tex.Height, blkWidth, blkHeight, bpp, mipLevel); uint offset = result.Item1; uint size = result.Item2; - byte[] data_ = SubArray(data, offset, size); + byte[] data_ = Utils.SubArray(data, offset, size); uint width_ = Math.Max(1, tex.Width >> mipLevel); uint height_ = Math.Max(1, tex.Height >> mipLevel); diff --git a/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj b/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj index da264030..178d8739 100644 --- a/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj +++ b/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj @@ -21,7 +21,7 @@ true full false - ..\Switch_Toolbox\Lib\Plugins\ + ..\Switch_Toolbox\bin\Debug\Lib\Plugins\ DEBUG;TRACE prompt 4 @@ -267,6 +267,13 @@ BfresShapeEditor.cs + + + Form + + + GTXTextureImporter.cs + UserControl @@ -424,6 +431,9 @@ BfresShapeEditor.cs + + GTXTextureImporter.cs + XTXEditor.cs @@ -490,7 +500,6 @@ {96820047-2a39-4e5a-bfa4-e84fff5c66cf} Switch_Toolbox_Library - False diff --git a/Switch_Toolbox.sln b/Switch_Toolbox.sln index 9f0653d4..8408f4a8 100644 --- a/Switch_Toolbox.sln +++ b/Switch_Toolbox.sln @@ -18,8 +18,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater. EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "Switch_Toolbox\Lib\DirectXTex\DirectXTex.vcxproj", "{755AB64B-16B4-4C90-AA3B-BFF448E5A21E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GTXDEBUG", "GTXDEBUG\GTXDEBUG.csproj", "{C610B02F-97AE-48A8-B967-1F4E97DB2903}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -68,21 +66,14 @@ Global {D82A2C08-2A65-43AF-BDA6-A36CC27AA003}.Release|Any CPU.Build.0 = Release|Any CPU {D82A2C08-2A65-43AF-BDA6-A36CC27AA003}.Release|x64.ActiveCfg = Release|Any CPU {D82A2C08-2A65-43AF-BDA6-A36CC27AA003}.Release|x64.Build.0 = Release|Any CPU - {755AB64B-16B4-4C90-AA3B-BFF448E5A21E}.Debug|Any CPU.ActiveCfg = Debug|x64 + {755AB64B-16B4-4C90-AA3B-BFF448E5A21E}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {755AB64B-16B4-4C90-AA3B-BFF448E5A21E}.Debug|Any CPU.Build.0 = Debug|Win32 {755AB64B-16B4-4C90-AA3B-BFF448E5A21E}.Debug|x64.ActiveCfg = Debug|x64 {755AB64B-16B4-4C90-AA3B-BFF448E5A21E}.Debug|x64.Build.0 = Debug|x64 {755AB64B-16B4-4C90-AA3B-BFF448E5A21E}.Release|Any CPU.ActiveCfg = Release|Win32 {755AB64B-16B4-4C90-AA3B-BFF448E5A21E}.Release|Any CPU.Build.0 = Release|Win32 {755AB64B-16B4-4C90-AA3B-BFF448E5A21E}.Release|x64.ActiveCfg = Release|x64 {755AB64B-16B4-4C90-AA3B-BFF448E5A21E}.Release|x64.Build.0 = Release|x64 - {C610B02F-97AE-48A8-B967-1F4E97DB2903}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C610B02F-97AE-48A8-B967-1F4E97DB2903}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C610B02F-97AE-48A8-B967-1F4E97DB2903}.Debug|x64.ActiveCfg = Debug|Any CPU - {C610B02F-97AE-48A8-B967-1F4E97DB2903}.Debug|x64.Build.0 = Debug|Any CPU - {C610B02F-97AE-48A8-B967-1F4E97DB2903}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C610B02F-97AE-48A8-B967-1F4E97DB2903}.Release|Any CPU.Build.0 = Release|Any CPU - {C610B02F-97AE-48A8-B967-1F4E97DB2903}.Release|x64.ActiveCfg = Release|Any CPU - {C610B02F-97AE-48A8-B967-1F4E97DB2903}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Switch_Toolbox/Lib/DirectXTex/.vs/DirectXTex/v15/Browse.VC.db b/Switch_Toolbox/Lib/DirectXTex/.vs/DirectXTex/v15/Browse.VC.db index 9c7660f0..62ca20f2 100644 Binary files a/Switch_Toolbox/Lib/DirectXTex/.vs/DirectXTex/v15/Browse.VC.db and b/Switch_Toolbox/Lib/DirectXTex/.vs/DirectXTex/v15/Browse.VC.db differ diff --git a/Switch_Toolbox/Lib/DirectXTex/DirectXTex.vcxproj b/Switch_Toolbox/Lib/DirectXTex/DirectXTex.vcxproj index c16b3886..f2c78a8c 100644 --- a/Switch_Toolbox/Lib/DirectXTex/DirectXTex.vcxproj +++ b/Switch_Toolbox/Lib/DirectXTex/DirectXTex.vcxproj @@ -30,7 +30,6 @@ {755AB64B-16B4-4C90-AA3B-BFF448E5A21E} Win32Proj DirectXTex - 8.1 v4.6 diff --git a/Switch_Toolbox/Lib/Plugins/AssimpNet.dll b/Switch_Toolbox/Lib/Plugins/AssimpNet.dll new file mode 100644 index 00000000..bc6a8c7a Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/AssimpNet.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/AxInterop.WMPLib.dll b/Switch_Toolbox/Lib/Plugins/AxInterop.WMPLib.dll index d07bca3f..087586eb 100644 Binary files a/Switch_Toolbox/Lib/Plugins/AxInterop.WMPLib.dll and b/Switch_Toolbox/Lib/Plugins/AxInterop.WMPLib.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/DirectXTex.dll b/Switch_Toolbox/Lib/Plugins/DirectXTex.dll new file mode 100644 index 00000000..06f75cf5 Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/DirectXTex.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/FirstPlugin.Plg.dll b/Switch_Toolbox/Lib/Plugins/FirstPlugin.Plg.dll index 4f0c5287..81837bd7 100644 Binary files a/Switch_Toolbox/Lib/Plugins/FirstPlugin.Plg.dll and b/Switch_Toolbox/Lib/Plugins/FirstPlugin.Plg.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/FirstPlugin.Plg.pdb b/Switch_Toolbox/Lib/Plugins/FirstPlugin.Plg.pdb index 695f7602..74749330 100644 Binary files a/Switch_Toolbox/Lib/Plugins/FirstPlugin.Plg.pdb and b/Switch_Toolbox/Lib/Plugins/FirstPlugin.Plg.pdb differ diff --git a/Switch_Toolbox/Lib/Plugins/Interop.WMPLib.dll b/Switch_Toolbox/Lib/Plugins/Interop.WMPLib.dll index b0af9dcb..be82fd83 100644 Binary files a/Switch_Toolbox/Lib/Plugins/Interop.WMPLib.dll and b/Switch_Toolbox/Lib/Plugins/Interop.WMPLib.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/K4os.Compression.LZ4.Streams.dll b/Switch_Toolbox/Lib/Plugins/K4os.Compression.LZ4.Streams.dll new file mode 100644 index 00000000..438de79f Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/K4os.Compression.LZ4.Streams.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/K4os.Compression.LZ4.dll b/Switch_Toolbox/Lib/Plugins/K4os.Compression.LZ4.dll new file mode 100644 index 00000000..a3198315 Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/K4os.Compression.LZ4.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/K4os.Hash.xxHash.dll b/Switch_Toolbox/Lib/Plugins/K4os.Hash.xxHash.dll new file mode 100644 index 00000000..5a37340e Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/K4os.Hash.xxHash.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/LZ4.dll b/Switch_Toolbox/Lib/Plugins/LZ4.dll new file mode 100644 index 00000000..89240f4e Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/LZ4.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/Octokit.dll b/Switch_Toolbox/Lib/Plugins/Octokit.dll new file mode 100644 index 00000000..66990897 Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/Octokit.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/Switch_Toolbox.Library.dll b/Switch_Toolbox/Lib/Plugins/Switch_Toolbox.Library.dll new file mode 100644 index 00000000..84585e1f Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/Switch_Toolbox.Library.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/Switch_Toolbox.Library.dll.config b/Switch_Toolbox/Lib/Plugins/Switch_Toolbox.Library.dll.config new file mode 100644 index 00000000..dd099c02 --- /dev/null +++ b/Switch_Toolbox/Lib/Plugins/Switch_Toolbox.Library.dll.config @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Switch_Toolbox/Lib/Plugins/Switch_Toolbox.Library.pdb b/Switch_Toolbox/Lib/Plugins/Switch_Toolbox.Library.pdb new file mode 100644 index 00000000..f527f16e Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/Switch_Toolbox.Library.pdb differ diff --git a/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.Bfres.dll b/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.Bfres.dll index ffe9200c..1e49e56d 100644 Binary files a/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.Bfres.dll and b/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.Bfres.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.Bfres.pdb b/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.Bfres.pdb new file mode 100644 index 00000000..cc5fe952 Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.Bfres.pdb differ diff --git a/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.Bfres.xml b/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.Bfres.xml new file mode 100644 index 00000000..210152de --- /dev/null +++ b/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.Bfres.xml @@ -0,0 +1,5730 @@ + + + + Syroot.NintenTools.Bfres + + + + + Represents an animation curve used by several sections to control different parameters over time. + + + + + Gets or sets the data type in which are loaded and saved. For simplicity, the class + always stores frames as converted instances. + + + + + Gets or sets the data type in which are loaded and saved. For simplicity, the class + always stores frames as converted instances. + + + + + Gets or sets the curve type, determining the number of elements stored with each key. + + + + + Gets or sets the memory offset relative to the start of the corresponding animation data structure to + animate the field stored at that address. Note that enums exist in the specific animation which map offsets + to names. + + + + + Gets or sets the first frame at which a key is placed. + + + + + Gets or sets the last frame at which a key is placed. + + + + + Gets or sets the scale to multiply values of the curve by. + + + + + Gets or sets the offset to add to the values of the curve (after multiplicating them). + + + + + Gets or sets the difference between the lowest and highest key value. + + + + + Gets the frame numbers at which keys of the same index in the array are placed. + + + + + Gets an array of elements forming the elements of keys placed at the frames of the same index in the + array. + + + + + Represents the possible data types in which are stored. For simple library use, + they are always converted them to and from instances. + + + + + The frames are stored as instances. + + + + + The frames are stored as instances. + + + + + The frames are stored as instances. + + + + + Represents the possible data types in which are stored. For simple library use, + they are always converted them to and from instances. + + + + + The keys are stored as instances. + + + + + The keys are stored as instances. + + + + + The keys are stored as instances. + + + + + Represents the type of key values stored by this curve. This also determines the number of required elements to + define a key in the array. Use the + method to retrieve the number of elements required for the of that curve. + + + + + The curve uses cubic interpolation. 4 elements of the array form a key. + + + + + The curve uses linear interpolation. 2 elements of the array form a key. + + + + + 1 element of the array forms a key. + + + + + 1 element of the array forms a key. + + + + + 1 element of the array forms a key. + + + + + 1 element of the array forms a key. + + + + + 1 element of the array forms a key. + + + + + Gets or sets the memory offset relative to the start of the corresponding animation data structure to + animate the field stored at that address. Note that enums exist in the specific animation which map offsets + to names. + + + + + Represents a buffer of data uploaded to the GX2 GPU which can hold arbitrary data. + + + + + The size of a full vertex in bytes. + + + + + The raw bytes stored for each buffering. + + + + + Represents a 16-bit fixed-point decimal consisting of 1 sign bit, 10 integer bits and 5 fractional bits (denoted + as Q10.5). Note that the implementation is not reporting over- and underflowing errors. + + + Examples: + SIIIIIII_IIIFFFFF + 0b00000000_00010000 = 0.5 + 0b00000000_00100000 = 1 + 0b00000001_00000000 = 8 + 0b01000000_00000000 = 512 + 0b10000000_00000000 = -1024 + + + + + Represents the largest possible value of . + + + + + Represents the smallest possible value of . + + + + + Initializes a new instance of the struct from the given + representation. + + The raw representation of the internally stored bits. + + + + Gets the internally stored value to represent the instance. + + Signed to get arithmetic rather than logical shifts. + + + + Returns the given . + + The . + The result. + + + + Adds the first to the second one. + + The first . + The second . + The addition result. + + + + Negates the given . + + The to negate. + The negated result. + + + + Subtracts the first from the second one. + + The first . + The second . + The subtraction result. + + + + Multiplicates the given by the scalar. + + The . + The scalar. + The multiplication result. + + + + Multiplicates the first by the second one. + + The first . + The second . + The multiplication result. + + + + Divides the given through the scalar. + + The . + The scalar. + The division result. + + + + Divides the first through the second one. + + The first . + The second . + The division result. + + + + Gets a value indicating whether the first specified is the same as the second + specified . + + The first to compare. + The second to compare. + true, if both are the same. + + + + Gets a value indicating whether the first specified is not the same as the second + specified . + + The first to compare. + The second to compare. + true, if both are not the same. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Gets a value indicating whether this is the same as the second specified + . + + The object to compare, if it is a . + true, if both are the same. + + + + Gets a hash code as an indication for object equality. + + The hash code. + + + + Gets a string describing this . + + A string describing this . + + + + Indicates whether the current is equal to another . + + A to compare with this . + true if the current is equal to the other parameter; otherwise, false. + + + + + Represents a 4-byte value which can hold differently typed data. + + + + + The data as an . + + + + + The data as a . + + + + + The data as an . + + + + + Converts the given value to a instance. + + The value to represent in the new instance. + + + + + Converts the given value to a instance. + + The value to represent in the new instance. + + + + + Converts the given value to a instance. + + The value to represent in the new instance. + + + + + Converts the given value to an instance. + + The value to represent in the new instance. + + + + + Converts the given value to a instance. + + The value to represent in the new instance. + + + + + Converts the given value to an instance. + + The value to represent in the new instance. + + + + + Returns the for this instance. + + The enumerated constant that is the of the class or value type that + implements this interface. + + + + This operation is not supported. + + + + + This operation is not supported. + + + + + This operation is not supported. + + + + + This operation is not supported. + + + + + This operation is not supported. + + + + + Converts the value of this instance to an equivalent double-precision floating-point number using the + specified culture-specific formatting information. + + An interface implementation that supplies + culture-specific formatting information. + A double-precision floating-point number equivalent to the value of this instance. + + + + This operation is not supported. + + + + + Converts the value of this instance to an equivalent 32-bit signed integer using the specified + culture-specific formatting information. + + An interface implementation that supplies + culture-specific formatting information. + An 32-bit signed integer equivalent to the value of this instance. + + + + Converts the value of this instance to an equivalent 64-bit signed integer using the specified + culture-specific formatting information. + + An interface implementation that supplies + culture-specific formatting information. + An 64-bit signed integer equivalent to the value of this instance. + + + + This operation is not supported. + + + + + Converts the value of this instance to an equivalent single-precision floating-point number using the + specified culture-specific formatting information. + + An interface implementation that supplies + culture-specific formatting information. + A single-precision floating-point number equivalent to the value of this instance. + + + + This operation is not supported. + + + + + Converts the value of this instance to an of the specified that has + an equivalent value, using the specified culture-specific formatting information. + + The to which the value of this instance is converted. + + An interface implementation that supplies + culture-specific formatting information. + An instance of type conversionType whose value is equivalent to the value of + this instance. + + + + This operation is not supported. + + + + + This operation is not supported. + + + + + This operation is not supported. + + + + + Represents a 16-bit half-precision floating point value according to the IEEE 754 standard. + + + Examples: + SEEEEEFF_FFFFFFFF + 0b00000000_00000000 = 0 + 1b00000000_00000000 = -0 + 0b00111100_00000000 = 1 + 0b11000000_00000000 = -2 + 0b11111011_11111111 = 65504 (MaxValue) + 0b01111100_00000000 = PositiveInfinity + 0b11111100_00000000 = NegativeInfinity + + + + + Represents the smallest positive value greater than zero. + + + + + Represents the largest possible value of . + + + + + Represents the smallest possible value of . + + + + + Represents not a number (NaN). + + + + + Represents negative infinity. + + + + + Represents positive infinity. + + + + + Initializes a new instance of the struct from the given + representation. + + The raw representation of the internally stored bits. + + + + Gets the internally stored value to represent the instance. + + Signed to get arithmetic rather than logical shifts. + + + + Returns the given . + + The . + The result. + + + + Adds the first to the second one. + + The first . + The second . + The addition result. + + + + Negates the given . + + The to negate. + The negated result. + + + + Subtracts the first from the second one. + + The first . + The second . + The subtraction result. + + + + Multiplicates the first by the second one. + + The first . + The second . + The multiplication result. + + + + Divides the first through the second one. + + The first . + The second . + The division result. + + + + Gets a value indicating whether the first specified is the same as the second + specified . + + The first to compare. + The second to compare. + true, if both are the same. + + + + Gets a value indicating whether the first specified is not the same as the second + specified . + + The first to compare. + The second to compare. + true, if both are not the same. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Converts the given value to a instance. + + The value to represent in the new + instance. + + + + Gets a value indicating whether this is the same as the second specified + . + + The object to compare, if it is a . + true, if both are the same. + + + + Gets a hash code as an indication for object equality. + + The hash code. + + + + Gets a string describing this . + + A string describing this . + + + + Indicates whether the current is equal to another . + + A to compare with this . + true if the current is equal to the other parameter; otherwise, false. + + + + + Returns a value indicating whether the specified number evaluates to not a number (). + + A half-precision floating-point number. + true if value evaluates to not a number (); otherwise false. + + + + Returns a value indicating whether the specified number evaluates to negative or positive infinity. + + A half-precision floating-point number. + true if half evaluates to or ; + otherwise false. + + + + Returns a value indicating whether the specified number evaluates to negative infinity. + + A half-precision floating-point number. + true if half evaluates to ; otherwise false. + + + + Returns a value indicating whether the specified number evaluates to positive infinity. + + A half-precision floating-point number. + true if half evaluates to ; otherwise false. + + + + Represents the non-generic base of a dictionary which can quickly look up instances via + key or index. + + + + + Initializes a new instance of the class. + + + + + Gets the number of instances stored. + + + + + Gets all keys under which instances are stored. + + + + + Gets all stored instances. + + + + + Returns only the publically visible nodes, excluding the root node. + + + + + Gets or sets the instance stored at the specified . + + The 0-based index of the instance to get or set. + The at the specified . + The index is smaller than 0 or bigger or equal to + . + + + + Gets or sets the instance stored under the specified . + + The textual key of the instance to get or set. + The with the specified . + An instance with the same + already exists. + An instance with the given + does not exist. + + + + Gets or sets the key under which the specified is stored. + + The instance of the key to get or set. + The key of the specified . + An instance with the same key already exists. + + A key for the given does not exist. + + + + + Removes all elements from the dictionary. + + + + + Determines whether an instance is saved under the given in the dictionary. + + The textual key to locate in the dictionary. The value can be null. + true if was found in the dictionary; otherwise false. + + + + Searches for the specified and returns the zero-based index of the first occurrence + within the entire dictionary. + + The textual key to locate in the dictionary. The value can be null. + The zero-based index of the first occurence of within the entire dictionary + if found; otherwise -1. + + + + Changes the key of the instance currently saved under the given to the + . + + The current textual key to rename. + The new textual key to use. + An instance with the same + already exists. + + The given does not exist. + + + + + Removes the first occurrence of the instance with the specific from the dictionary. + + The textual key of the instance which will be removed. + true if the instance under was successfully removed; otherwise + false. This method also returns false if was not found in the + dictionary. + + + + Removes the instance at the specified of the dictionary. + + The zero-based index of the instance to remove. + is less than 0 or equal to or greater + than . + + + + Returns true if an instance was stored under the given + and has been assigned to , or false if no instance is stored under the + given and null was assigned to . + + The textual key of the instance to get or set. + The variable receiving the found or null. + true if an instance was found and assigned; otherwise false. + + + + Adds the given under the specified . + + The textual key under which the instance will be stored. + The to add. + An instance with the same + already exists. + + + + Determines whether the given is in the dictionary. + + The instance to locate in the dictionary. The value can be + null. + true if was found in the dictionary; otherwise false. + + + + + Searches for the specified and returns the zero-based index of the first occurrence + within the entire dictionary. + + The instance to locate in the dictionary. The value can be + null. + The zero-based index of the first occurence of within the entire + dictionary if found; otherwise -1. + + + + Removes the first occurrence of a specific from the dictionary. + + The instance to remove from the dictionary. The value can be + null. + true if was successfully removed; otherwise false. This + method also returns false if was not found in the dictionary. + + + + Copies the elements of the dictionary as instances to a new + array and returns it. + + An array containing copies of the elements. + + + + Returns true if a key was found for the given and has been assigned to + , or false if no key was found for the value and null was assigned to + . + + The to look up a key for. + The variable receiving the found key or null. + true if a key was found and assigned; otherwise false. + + + + Returns a generic which can be used to iterate over the items in the dictionary. + + An enumerator to iterate over the items in the dictionary. + + + + Returns an which can be used to iterate over the items in the dictionary. + + An enumerator to iterate over the items in the dictionary. + + + + Returns the instance of the node with the given using the + Patricia trie logic. + + Nodes are looked up linearly by iterating over the node list internally, this method has been + implemented for test and validation purposes only. + The name of the node to look up. + The instance referenced by the found node. + + + + Loads an instance from the given . + + The to load the instance with. + The loaded instance. + + + + Represents a node forming the Patricia trie of the dictionary. + + + + + Represents a dictionary which can quickly look up instances of type + via key or index. + + The specialized type of the instances. + + + + Initializes a new instance of the class. + + + + + Gets all stored instances. + + + + + Gets or sets the value stored at the specified . + + The 0-based index of the instance to get or set. + The instance at the specified . + The index is smaller than 0 or bigger or equal to + . + + + + Gets or sets the value stored under the specified . + + The textual key of the instance to get or set. + The instance with the specified . + An instance with the same already exists. + + An instance with the given does not exist. + + + + + Adds the given under the specified . + + The textual key under which the instance will be stored. + The to add. + An instance with the same + already exists. + + + + Determines whether the given is in the dictionary. + + The instance to locate in the dictionary. The value can be + null. + true if was found in the dictionary; otherwise false. + + + + + Returns a generic which can be used to iterate over the items in the dictionary. + + An enumerator to iterate over the items in the dictionary. + + + + Searches for the specified and returns the zero-based index of the first occurrence + within the entire dictionary. + + The instance to locate in the dictionary. The value can be + null. + The zero-based index of the first occurence of within the entire + dictionary if found; otherwise -1. + + + + Removes the first occurrence of a specific from the dictionary. + + The instance to remove from the dictionary. The value can be + null. + true if was successfully removed; otherwise false. This + method also returns false if was not found in the dictionary. + + + + Copies the elements of the dictionary as instances to a new + array and returns it. + + An array containing copies of the elements. + + + + Returns true if a key was found for the given and has been assigned to + , or false if no key was found for the value and null was assigned to + . + + The to look up a key for. + The variable receiving the found key or null. + true if a key was found and assigned; otherwise false. + + + + Returns true if an instance was stored under the given and has been assigned + to , or false if no instance is stored under the given + and null was assigned to . + + The textual key of the instance to get or set. + The variable receiving the found instance or null. + true if an instance was found and assigned; otherwise false. + + + + Loads an instance from the given . + + The to load the instance with. + The loaded instance. + + + + Represents a which is stored in a . + + + + + The textual represented by this instance. + + + + + The with which this string was read or will be written. + + + + + Converts the given value to a instance. + + The value to represent in the new instance. + + + + + Converts the given value to an instance. + + The value to represent in the new instance. + + + + + Returns the value of the property. + + The value of the property. + + + + Represents a 2D transformation. + + + + + The size of this structure. + + + + + The scaling amount of the transformation. + + + + + The rotation angle of the transformation. + + + + + The translation amount of the transformation. + + + + + Represents a 3D transformation. + + + + + The size of this structure. + + + + + The scaling amount of the transformation. + + + + + The rotation amount of the transformation. + + + + + The translation amount of the transformation. + + + + + Represents a 2D texture transformation. + + + + + The size of this structure. + + + + + The with which the transformation is applied. + + + + + The scaling amount of the transformation. + + + + + The rotation angle of the transformation. + + + + + The translation amount of the transformation. + + + + + Represents a 2D texture transformation which is multiplied by a 3x4 matrix referenced at runtime by the + . + + + + + The size of this structure. + + + + + The with which the transformation is applied. + + + + + The scaling amount of the transformation. + + + + + The rotation angle of the transformation. + + + + + The translation amount of the transformation. + + + + + A pointer to a 3x4 matrix to multiply the transformation with. Set at runtime. + + + + + Represents the texture transformation mode used in and . + + + + + Represents a reference to a instance by name. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. Typically the same as the . + + + + + The referenced instance. + + + + + Represents custom user variables which can be attached to many sections and subfiles of a . + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + The data type of the stored values. + + + + + Returns the stored value as an array of instances when the is + . + + The typed value. + + + + Returns the stored value as an array of instances when the is + . + + The typed value. + + + + Returns the stored value as an array of instances when the is + or . + + The typed value. + + + + Returns the stored value as an array of instances when the is + . + + The typed value. + + + + Sets the stored as an array and the to + + + The value to store. + + + + Sets the stored as a array and the to + + + The value to store. + + + + Sets the stored as a array and the to + or depending on + . + + true to store data as UTF-16 encoded strings, or false to store it + as ASCII encoded strings. + The value to store. + + + + Sets the stored as a array and the to + + + The value to store. + + + + Represents the possible data types of values stored in instances. + + + + + The values is an array. + + + + + The values is a array. + + + + + The values is a array encoded in ASCII. + + + + + The values is a array encoded in UTF-16. + + + + + The values is a array. + + + + + Represents extension methods for the class. + + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads a instance from the current stream and returns it. + + The extended . + The number of instances to read. + The instance. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The in which values are stored. + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The in which values are stored. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The in which values are stored. + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The in which values are stored. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The in which values are stored. + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The in which values are stored. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Reads a instance from the current stream and returns it. + + The extended . + The instance. + + + + Reads instances from the current stream and returns them. + + The extended . + The number of instances to read. + The instances. + + + + Returns the conversion delegate for converting data available in the given + into a instance. Useful to prevent repetitive lookup for multiple values. + + The extended . + The of the data. + A conversion delegate for the data. + + + + Reads a instance converted from the given and + returns it. + + The extended . + The of the data. + The instance. + + + + Reads a instances converted from the given and + returns them. + + The extended . + The number of instances to read. + The of the data. + The instances. + + + + Represents extension methods for the class. + + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + The in which values are stored. + + + + Writes instances into the current stream. + + The extended . + The instances. + The in which values are stored. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + The in which values are stored. + + + + Writes instances into the current stream. + + The extended . + The instances. + The in which values are stored. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + The in which values are stored. + + + + Writes instances into the current stream. + + The extended . + The instances. + The in which values are stored. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Writes a instance into the current stream. + + The extended . + The instance. + + + + Writes instances into the current stream. + + The extended . + The instances. + + + + Returns the conversion delegate for converting data available in the given + from a instance. Useful to prevent repetitive lookup for multiple values. + + The extended . + The of the data. + A conversion delegate for the data. + + + + Writes a instance into the current stream with the given + . + + The extended . + The instance. + The of the data. + + + + Writes instances into the current stream with the given + . + + The extended . + The instances. + The of the data. + + + + Represents extension methods for instances. + + + + + Returns an instance represented by the given number of , starting + at the . + + The extended instance. + The first bit of the encoded value. + The number of least significant bits which are used to store the + value. + The decoded . + + + + Returns the current with the bit at the set (being 1). + + The extended instance. + The 0-based index of the bit to enable. + The current with the bit enabled. + + + + Returns the current with the given set into the given number + of starting at . + + The extended instance. + The value to encode. + The first bit used for the encoded value. + The number of bits which are used to store the value. + The current with the value encoded into it. + + + + Returns the current with the bit at the cleared (being 0). + + The extended instance. + The 0-based index of the bit to disable. + The current with the bit disabled. + + + + Returns a value indicating whether the bit at the in the current + is enabled or disabled. + + The extended instance. + The 0-based index of the bit to check. + true when the bit is set; otherwise false. + + + + Returns the current with all bits rotated in the given , + where positive directions rotate left and negative directions rotate right. + + The extended instance. + The direction in which to rotate, where positive directions rotate left. + The current with the bits rotated. + + + + Returns the current with the bit at the enabled or disabled, + according to . + + The extended instance. + The 0-based index of the bit to enable or disable. + true to enable the bit; otherwise false. + The current with the bit enabled or disabled. + + + + Returns the current with the bit at the enabled when it is + disabled or disabled when it is enabled. + + The extended instance. + The 0-based index of the bit to toggle. + The current with the bit toggled. + + + + Represents extension methods for instances. + + + + + Returns an instance represented by the given number of , starting + at the . + + The extended instance. + The first bit of the encoded value. + The number of least significant bits which are used to store the + value. + The decoded . + + + + Returns the current with the bit at the set (being 1). + + The extended instance. + The 0-based index of the bit to enable. + The current with the bit enabled. + + + + Returns the current with the given set into the given number + of starting at . + + The extended instance. + The value to encode. + The first bit used for the encoded value. + The number of bits which are used to store the value. + The current with the value encoded into it. + + + + Returns the current with the bit at the cleared (being 0). + + The extended instance. + The 0-based index of the bit to disable. + The current with the bit disabled. + + + + Returns a value indicating whether the bit at the in the current + is enabled or disabled. + + The extended instance. + The 0-based index of the bit to check. + true when the bit is set; otherwise false. + + + + Returns the current with all bits rotated in the given , + where positive directions rotate left and negative directions rotate right. + + The extended instance. + The direction in which to rotate, where positive directions rotate left. + The current with the bits rotated. + + + + Returns the current with the bit at the enabled or disabled, + according to . + + The extended instance. + The 0-based index of the bit to enable or disable. + true to enable the bit; otherwise false. + The current with the bit enabled or disabled. + + + + Returns the current with the bit at the enabled when it is + disabled or disabled when it is enabled. + + The extended instance. + The 0-based index of the bit to toggle. + The current with the bit toggled. + + + + Represents the common interface for data instances. + + + + + Loads raw data from the data stream into instances. + + The to load data with. + + + + Saves header data of the instance and queues referenced data in the given . + + The to save headers and queue data with. + + + + Loads the hierachy and data of a . + + + + + Initializes a new instance of the class loading data into the given + from the specified which is optionally left open. + + The instance to load data into. + The to read data from. + true to leave the stream open after reading, otherwise false. + + + + Initializes a new instance of the class from the file with the given + . + + The instance to load data into. + The name of the file to load the data from. + + + + Gets the loaded instance. + + + + + Gets the loaded instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the loaded instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the loaded instance. + + + + + Starts deserializing the data from the root. + + + + + Reads and returns an instance of type from the following + offset or returns null if the read offset is 0. + + The type of the to read. + The instance or null. + + + + Reads and returns an instance of arbitrary type from the following offset with the + given or returns null if the read offset is 0. + + The type of the data to read. + The callback to read the instance data with. + The optional offset to use instead of reading a following one. + The data instance or null. + Offset required for ExtFile header (offset specified before size). + + + + Reads and returns an instance with elements of type from + the following offset or returns an empty instance if the read offset is 0. + + The type of the elements. + The instance. + + + + Reads and returns an instance with elements of type + from the following offset or returns null if the read offset is 0. + + The type of the elements. + The number of elements to expect for the list. + The optional offset to use instead of reading a following one. + The instance or null. + Offset required for FMDL FVTX lists (offset specified before count). + + + + Reads and returns a instance from the following offset or null if the read + offset is 0. + + The optional encoding of the text. + The read text. + + + + Reads and returns instances from the following offsets. + + The number of instances to read. + The optional encoding of the texts. + The read texts. + + + + Reads a BFRES signature consisting of 4 ASCII characters encoded as an and checks for + validity. + + A valid signature. + + + + Reads a BFRES offset which is relative to itself, and returns the absolute address. + + The absolute address of the offset. + + + + Reads BFRES offsets which are relative to themselves, and returns the absolute addresses. + + The number of offsets to read. + The absolute addresses of the offsets. + + + + Saves the hierachy and data of a . + + + + + Gets or sets a data block alignment typically seen with . + + + + + Initializes a new instance of the class saving data from the given + into the specified which is optionally left open. + + The instance to save data from. + The to save data into. + true to leave the stream open after writing, otherwise false. + + + + Initializes a new instance of the class for the file with the given + . + + The instance to save. + The name of the file to save the data into. + + + + Initializes a new instance of the class for the file with the given + . + + The instance to save. + The name of the file to save the data into. + + + + Initializes a new instance of the class for the file with the given + . + + The instance to save. + The name of the file to save the data into. + + + + Initializes a new instance of the class for the file with the given + . + + The instance to save. + The name of the file to save the data into. + + + + Initializes a new instance of the class for the file with the given + . + + The instance to save. + The name of the file to save the data into. + + + + Initializes a new instance of the class for the file with the given + . + + The instance to save. + The name of the file to save the data into. + + + + Initializes a new instance of the class for the file with the given + . + + The instance to save. + The name of the file to save the data into. + + + + Initializes a new instance of the class for the file with the given + . + + The instance to save. + The name of the file to save the data into. + + + + Initializes a new instance of the class for the file with the given + . + + The instance to save. + The name of the file to save the data into. + + + + Initializes a new instance of the class for the file with the given + . + + The instance to save. + The name of the file to save the data into. + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the saved instance. + + + + + Gets the current index when writing lists or dicts. + + + + + Starts serializing the data from the root. + + + + + Starts serializing the data from the root. + + + + + Reserves space for an offset to the written later. + + The to save. + The index of the element, used for instances referenced by a . + + + + + Reserves space for the file size field which is automatically filled later. + + + + + Reserves space for the string pool size and offset fields which are automatically + filled later. + + + + + Reserves space for an offset to the written later. + + The type of the elements. + The to save. + + + + Reserves space for an offset to the written later. + + The type of the element values. + The to save. + + + + Reserves space for an offset to the written later with the + . + + The data to save. + The to invoke to write the data. + + + + Reserves space for an offset to the written later in the string pool with the + specified . + + The name to save. + The in which the name will be stored. + + + + Reserves space for offsets to the written later in the string pool with the + specified + + The names to save. + The in which the names will be stored. + + + + Reserves space for an offset to the written later in the data block pool. + + The data to save. + The alignment to seek to before invoking the callback. + The to invoke to write the data. + + + + Writes a BFRES signature consisting of 4 ASCII characters encoded as an . + + A valid signature. + + + + Represents a sorting empty strings to the end of lists. + + + + + Represents a file attachment to a which can be of arbitrary data. + + + + + Gets or sets the raw data stored by the external file. + + + + + Opens and returns a on the raw byte array, which optionally + can be written to. + + true to allow write access to the raw data. + The opened instance. + + + + Represents GX2 settings controlling additional alpha blending options. + + + + + Gets or sets a value indicating whether alpha testing is enabled at all. + + + + + Gets or sets the comparison functions to use for alpha testing. + + + + + Represents GX2 settings controlling color and alpha blending. + + + + + Gets or sets the color source blend operation. + + + + + Gets or sets the color combine operation. + + + + + Gets or sets the color destination blend operation. + + + + + Gets or sets the alpha source blend operation. + + + + + Gets or sets the alpha combine operation. + + + + + Gets or sets the alpha destination blend operation. + + + + + Gets or sets a value indicating whether alpha blending is separated from color blending. + + + + + Represents GX2 settings controlling additional color blending options. + + + + + Gets or sets a value indicating whether multi writes are enabled. + + + + + Gets or sets a value indicating whether the color buffer is enabled. + + + + + Gets or sets the bitmask used for blending. + + + + + Gets or sets the ROP3 logic operation. + + + + + Represents GX2 settings controlling how depth and stencil buffer checks are performed and handled. + + + + + Gets or sets a value indicating whether depth testing is enabled. + + + + + Gets or sets a value indicating whether writing to the depth buffer is enabled. + + + + + Gets or sets the depth buffer comparison function, controlling whether a new fragment is allowed to + overwrite the old value in the depth buffer. + + + + + Gets or sets a value indicating whether stencil testing is enabled. + + + + + Gets or sets a value indicating whether back-facing polygons are allowed to write to the stencil buffer or + not. + + + + + Gets or sets the front-facing polygon stencil comparison function. + + + + + Gets or sets the stencil function configuring what to do with the existing stencil value when the stencil + test fails for front-facing polygons. + + + + + Gets or sets the stencil function taking effect when the stencil test passes with the depth buffer for + front-facing polygons. + + + + + Gets or sets the function taking effect when the stencil test fails with the depth buffer for front-facing + polygons. + + + + + Gets or sets the back-facing polygon stencil comparison function. + + + + + Gets or sets the stencil function configuring what to do with the existing stencil value when the stencil + test fails for back-facing polygons. + + + + + Gets or sets the stencil function taking effect when the stencil test passes with the depth buffer for + back-facing polygons. + + + + + Gets or sets the function taking effect when the stencil test fails with the depth buffer for back-facing + polygons. + + + + + Represents the AA modes (number of samples) for a surface. + + + + + Represents the format of a vertex attribute entry. Possible type conversions: + UNorm: attrib unsigned integer is converted to/from [0.0, 1.0] in shader. + UInt: attrib unsigned integer is copied to/from shader as unsigned int. + SNorm: attrib signed integer is converted to/from [-1.0, 1.0] in shader. + SInt: attrib signed integer is copied to/from shader as signed int. + Single: attrib single is copied to/from shader as Single. + UIntToSingle: attrib unsigned integer is converted Single in shader. + SIntToSingle: attrib signed integer is converted Single in shader. + + + + + Represents how the terms of the blend function are combined. + + + + + Represents the factors used in the blend function. + + + + + Represents compare functions used for depth and stencil tests. + + + + + Represents the source channels to map to a color channel in textures. + + + + + Represents the vertex order of front-facing polygons. + + + + + Represents the type in which vertex indices are stored. + + + + + Represents the logic op function to perform. + + + + + Black + + + + + White + + + + + Source (Default) + + + + + ~Source + + + + + Destination + + + + + ~Destination + + + + + Source & Destination + + + + + ~(Source & Destination) + + + + + Source | Destination + + + + + ~(Source | Destination) + + + + + Source ^ Destination + + + + + ~(Source ^ Destination) + + + + + Source & ~Destination + + + + + ~Source & Destination + + + + + Source | ~Destination + + + + + ~Source | Destination + + + + + Represents the base primitive used to draw each side of the polygon when dual-sided polygon mode is enabled. + + + + + Represents the type of primitives to draw. + + + + + Requires at least 1 element and 1 more to draw another primitive. + + + + + Requires at least 2 elements and 2 more to draw another primitive. + + + + + Requires at least 2 elements and 1 more to draw another primitive. + + + + + Requires at least 3 elements and 3 more to draw another primitive. + + + + + Requires at least 3 elements and 1 more to draw another primitive. + + + + + Requires at least 3 elements and 1 more to draw another primitive. + + + + + Requires at least 4 elements and 4 more to draw another primitive. + + + + + Requires at least 4 elements and 1 more to draw another primitive. + + + + + Requires at least 6 elements and 6 more to draw another primitive. + + + + + Requires at least 6 elements and 2 more to draw another primitive. + + + + + Requires at least 3 elements and 3 more to draw another primitive. + + + + + Requires at least 2 elements and 1 more to draw another primitive. + + + + + Requires at least 4 elements and 4 more to draw another primitive. + + + + + Requires at least 4 elements and 2 more to draw another primitive. + + + + + Requires at least 2 elements and 2 more to draw another primitive. + + + + + Requires at least 2 elements and 1 more to draw another primitive. + + + + + Requires at least 3 elements and 3 more to draw another primitive. + + + + + Requires at least 3 elements and 1 more to draw another primitive. + + + + + Requires at least 4 elements and 4 more to draw another primitive. + + + + + Requires at least 4 elements and 2 more to draw another primitive. + + + + + Represents the stencil function to be performed if stencil tests pass. + + + + + Represents shapes of a given surface or texture. + + + + + Represents desired texture, color-buffer, depth-buffer, or scan-buffer formats. + + + + + Represents Indicates how a given surface may be used. A final TV render target is one that will be copied to a + TV scan buffer. It needs to be designated to handle certain display corner cases (when a HD surface must be + scaled down to display in NTSC/PAL). + + + + + Represents maximum desired anisotropic filter ratios. Higher ratios give better image quality, but slower + performance. + + + + + Represents type of border color to use. + + + + + Represents how to treat texture coordinates outside of the normalized coordinate texture range. + + + + + Represents desired texture filter options between mip levels. + + + + + Represents desired texture filter options within a plane. + + + + + Represents desired texture filter options between Z planes. + + + + + Represents the desired tiling modes for a surface. + + + + + Represents GX2 polygon drawing settings controlling if and how triangles are rendered. + + + + + Gets or sets a value indicating whether front-facing polygons are culled. + + + + + Gets or sets a value indicating whether back-facing polygons are culled. + + + + + Gets or sets the order in which vertices have to form the triangle to be handled as a front- rather than + back-face. + + + + + Gets or sets a value indicating whether polygons are drawn at all. + + + + + Gets or sets how front facing polygons are drawn. + + + + + Gets or sets how back facing polygons are drawn. + + + + + Gets or sets whether front-facing polygons are drawn offset (useful for decals to combat Z fighting). + + + + + Gets or sets whether back-facing polygons are drawn offset (useful for decals to combat Z fighting). + + + + + Gets or sets whether lines are drawn offset (useful for decals to combat Z fighting). + + + + + Represents a GX2 texture sampler controlling how a texture is samples and drawn onto a surface. + + + + + Initializes a new instance of the instance. + + + + + Gets or sets the texture repetition mode on the X axis. + + + + + Gets or sets the texture repetition mode on the Y axis. + + + + + Gets or sets the texture repetition mode on the Z axis. + + + + + Gets or sets the texture filtering on the X and Y axes when the texture is drawn larger than the actual + texture's resolution. + + + + + Gets or sets the texture filtering on the X and Y axes when the texture is drawn smaller than the actual + texture's resolution. + + + + + Gets or sets the texture filtering on the Z axis. + + + + + Gets or sets the texture filtering for mipmaps. + + + + + Gets or sets the maximum anisotropic filtering level to use. + + + + + Gets or sets what color to draw at places not reached by a texture if the clamp mode does not repeat it. + + + + + Gets or sets the depth comparison function. + + + + + Gets or sets the minimum LoD level. + + + + + Gets or sets the maximum LoD level. + + + + + Gets or sets the LoD bias. + + + + + Gets or sets a value indicating whether depth comparison is enabled (never set for a real console). + + + + + Represents a helper class for working with instances. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with data read from the given + . The data is available in the , which defaults + to system byte order. + + The to initially read data from. + The in which vertex data is available. null to use + system byte order. + + + + Gets or sets the in which vertex data will be stored when calling + . This should be the same as the remainder of the in + which it will be stored. + + + + + Gets or sets the number of bones influencing the vertices stored in the buffer. 0 influences equal + rigidbodies (no skinning), 1 equal rigid skinning and 2 or more smooth skinning. + + + + + Gets or sets the list of instances which store the data. + + + + + Gets or sets the instance at the given . + + The index of the instance. + The instance at the given index. + + + + Gets or sets the first instance with the given + . + + The name of the instance. + The instance with the given name. + + + + Returns a instance out of the stored helper data. + + A new . + + + + Represents an attribute and the data it stores in a instance. + + + + + The name of the attribute, typically used to determine the use of the data. + + + + + The into which data will be converted upon creating a + . + + + + + The data stored for this attribute. Has to be of the same length as every other + . Depending on , not every component of the + elements is used. + + + + + Represents an FMAT subsection of a subfile, storing information on with which textures and + how technically a surface is drawn. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets flags specifying how a is rendered. + + + + + Gets or sets the list of instances referencing the instances + required to draw the material. + + + + + Gets or sets a dictionary of instances which configure how to draw + instances referenced by the list. + + + + + Gets or sets the raw data block which stores values. + + + + + Gets or sets customly attached instances. + + + + + Gets or sets a set of bits determining whether instances are volatile. + + + + + Initializes a new instance of the class from the given which + is optionally left open. + + The to load the data from. + true to leave the stream open after reading, otherwise false. + + + + Initializes a new instance of the class from the file with the given + . + + The name of the file to load the data from. + + + + Saves the contents in the given and optionally leaves it open + + The to save the contents into. + true to leave the stream open after writing, otherwise false. + + + + Saves the contents in the file with the given . + + The name of the file to save the contents into. + + + + Represents general flags specifying how a is rendered. + + + + + The material is not rendered at all. + + + + + The material is rendered. + + + + + Represents a render info in a FMAT section storing uniform parameters required to render the + . + + + + + Gets the determining the data type of the stored value. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets the stored value as an array. Only valid if is + . + + The stored value as an array. + + + + Gets the stored value as a array. Only valid if is + . + + The stored value as a array. + + + + Gets the stored value as a array. Only valid if is + . + + The stored value as a array. + + + + Sets the stored value as an array and sets to + . + + The array to set as the value. + + + + Sets the stored value as a array and sets to + . + + The array to set as the value. + + + + Sets the stored value as a array and sets to + . + + The array to set as the value. + + + + Represents the data type of elements of the value array. + + + + + The elements are instances. + + + + + The elements are instances. + + + + + The elements are instances. + + + + + Represents GX2 GPU configuration to determine how polygons are rendered. + + + + + Gets or sets GX2 polygon drawing settings controlling if and how triangles are rendered. + + + + + Gets or sets GX2 settings controlling how depth and stencil buffer checks are performed and handled. + + + + + Gets or sets GX2 settings controlling additional alpha blending options. + + + + + Gets or sets the reference value used for alpha testing. + + + + + Gets or sets GX2 settings controlling additional color blending options. + + + + + Gets or sets the blend target index. + + + + + Gets or sets GX2 settings controlling color and alpha blending. + + + + + Gets or sets the blend color to perform blending with. + + + + + Represents a sampler in a section, storing configuration on how to + draw and interpolate textures. + + + + + Gets or sets the internal representation of the sampler configuration. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Represents a parameter value in a section, passing data to shader variables. + + + + + Gets or sets the type of the value. + + + + + Gets the offset in the byte array in bytes. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets the size of the value in bytes. + + + + + Represents the data types in which instances can store their value. + + + + + The value is a single . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a single . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a single . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a single . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + An invalid type for values, only used for internal computations. + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + An invalid type for values, only used for internal computations. + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + An invalid type for values, only used for internal computations. + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + The value is a . + + + + + Represents an FMDL subfile in a , storing model vertex data, skeletons and used materials. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the path of the file which originally supplied the data of this instance. + + + + + Gets the instance to deform the model with animations. + + + + + Gets or sets the instances storing the vertex data used by the + . + + + + + Gets or sets the instances forming the surface of the model. + + + + + Gets or sets the instance applied on the to color their surface. + + + + + Gets or sets customly attached instances. + + + + + Gets the total number of vertices to process when drawing this model. + + This excludes vertices which are not processed by any shader. However, the exact value does not + seem to matter, so the total count of all vertices is taken to keep things trivial for now. + + + + Represents a spatial bounding box. + + + + + The center point of the bounding box. + + + + + The extent from the center point to the furthest point. + + + + + Represents a node in a bounding tree to determine when to show which sub mesh of a + . + + + + + Represents the surface net of a section, storing information on which + index to use for referencing vertices of the shape, mostly used for different levels of + detail (LoD) models. + + + + + Gets or sets the which determines how indices are used to form polygons. + + + + + Gets the determining the data type of the indices in the + . + + + + + Gets the number of indices stored in the . + + + + + Gets or sets the list of instances which split up a mesh into parts which can be + hidden if they are not visible to optimize rendering performance. + + + + + Gets or sets the storing the index data. + + + + + Gets or sets the offset to the first vertex element of a to reference by indices. + + + + + Returns the indices stored in the as instances. + + The indices stored in the . + + + + Stores the given in the in the provided + , or the current if none was specified. + + The indices to store in the . + The to use or null to use the current format. + + + + + Represents an FSHP section in a subfile. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets flags determining which data is available for this instance. + + + + + Gets or sets the index of the material to apply to the shapes surface in the owning + list. + + + + + Gets or sets the index of the to which this instance is directly attached to. The bone + must be part of the skeleton referenced by the owning instance. + + + + + Gets or sets the index of the in the owning + list. + + + + + Gets or sets the bounding radius/radii spanning the shape. BOTW uses multiple per LOD mesh. + + + + + Gets or sets the number of bones influencing the vertices stored in this buffer. 0 influences equal + rigidbodies (no skinning), 1 equal rigid skinning and 2 or more smooth skinning. + + + + + Gets or sets a value with unknown purpose. + + + + + Gets or sets the list of which are used to represent different level of details of the + shape. + + + + + Gets or sets the instances forming the bounding tree with which parts of a mesh + are culled when not visible. + + + + + Gets or sets the instance storing the data which forms the shape's surface. Saved + depending on . + + + + + Represents flags determining which data is available for instances. + + + + + The instance references a . + + + + + The boundings in all submeshes are consistent. + + + + + Represents a subarray of a section, storing a slice of indices to draw from the index buffer + referenced in the mesh, mostly used for hiding parts of a model when not visible. + + + + + Gets the offset into the index buffer in bytes. + + + + + Gets the number of indices to reference. + + + + + Represents a single bone in a section, storing its initial transform and transformation + effects. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the index of the parent this instance is a child of. + + + + + Gets or sets the index of a matrix used for smooth skinning. + + + + + Gets or sets the index of a matrix used for rigid skinning. + + + + + Gets or sets flags controlling bone behavior. + + + + + Gets or sets the rotation method used to store bone rotations in . + + + + + Gets or sets the billboard transformation applied to the bone. + + + + + Gets or sets the spatial scale of the bone. + + + + + Gets or sets the spatial rotation of the bone. If is used, the + fourth component is always 1.0f. + + + + + Gets or sets the spatial position of the bone. + + + + + Gets or sets customly attached instances. + + + + + Gets or sets the inverse matrix (Only used in bfres verson v3.3.X.X and below) + + + + + Represents flags controlling bone behavior. + + + + + Set when the bone is visible. + + + + + Represents the rotation method used to store bone rotations. + + + + + A quaternion represents the rotation. + + + + + A represents the Euler rotation in XYZ order. + + + + + Represents the possible transformations for bones to handle them as billboards. + + + + + No transformation is applied. + + + + + Transforms of the child are applied. + + + + + Transforms the Z axis parallel to the camera. + + + + + Transforms the Z axis parallel to the direction of the camera. + + + + + Transforms the Y axis parallel to the camera up vector, and the Z parallel to the camera up-vector. + + + + + Transforms the Y axis parallel to the camera up vector, and the Z axis parallel to the direction of the + camera. + + + + + Transforms the Z axis parallel to the camera by rotating only the Y axis. + + + + + Transforms the Z axis parallel to the direction of the camera by rotating only the Y axis. + + + + + Represents an FSKL section in a subfile, storing armature data. + + + + + Gets or sets the rotation method used to store bone rotations. + + + + + Gets or sets the list of instances forming the skeleton. + + + + + Represents the rotation method used to store bone rotations. + + + + + A quaternion represents the rotation. + + + + + A represents the Euler rotation in XYZ order. + + + + + Represents an attribute of a describing the data format, type and layout of a + specific data subset in the buffer. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the index of the buffer storing the data in the list. + + + + + Gets or sets the offset in bytes to the attribute in each vertex. + + + + + Gets or sets the determining the type in which attribute data is available. + + + + + Represents a data buffer holding vertices for a subfile. + + + + + Gets or sets the number of bones influencing the vertices stored in this buffer. 0 influences equal + rigidbodies (no skinning), 1 equal rigid skinning and 2 or more smooth skinning. + + + + + Gets the number of vertices stored by the . It is calculated from the size of the first + in bytes divided by the . + + + + + Gets or sets the dictionary of instances describing how to interprete data in the + . + + + + + Gets or sets the list of instances storing raw unformatted vertex data. + + + + + Represents an exception raised when handling data. + + + + + Initializes a new instance of the class with a specified error + . + + The error message that explains the reason for the exception. + + + + Initializes a new instance of the class with a specified error message created + from the given and . + + The format of the error message. + The parameters to format the error message with. + + + + Represents a NintendoWare for Cafe (NW4F) graphics data archive file. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class from the given which + is optionally left open. + + The to load the data from. + true to leave the stream open after reading, otherwise false. + + + + Initializes a new instance of the class from the file with the given + . + + The name of the file to load the data from. + + + + Gets or sets the revision of the BFRES structure formats. + + + + + Gets the byte order in which data is stored. Must be the endianness of the target platform. + + + + + Gets or sets the alignment to use for raw data blocks in the file. + + + + + Gets or sets a name describing the contents. + + + + + Gets or sets the stored (FMDL) instances. + + + + + Gets or sets the stored (FTEX) instances. + + + + + Gets or sets the stored (FSKA) instances. + + + + + Gets or sets the stored (FSHU) instances. + + + + + Gets or sets the stored (FSHU) instances for color animations. + + + + + Gets or sets the stored (FSHU) instances for texture SRT animations. + + + + + Gets or sets the stored (FTXP) instances. + + + + + Gets or sets the stored (FVIS) instances for bone visibility animations. + + + + + Gets or sets the stored (FVIS) instances for material visibility animations. + + + + + Gets or sets the stored (FSHA) instances. + + + + + Gets or sets the stored (FSCN) instances. + + + + + Gets or sets attached instances. The key of the dictionary typically represents + the name of the file they were originally created from. + + + + + Saves the contents in the given and optionally leaves it open + + The to save the contents into. + true to leave the stream open after writing, otherwise false. + + + + Saves the contents in the file with the given . + + The name of the file to save the contents into. + + + + Represents an FCAM section in a subfile, storing animations controlling camera settings. + + + + + Gets or sets flags controlling how animation data is stored or how the animation should be played. + + + + + Gets or sets the total number of frames this animation plays. + + + + + Gets or sets the number of bytes required to bake all . + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets instances animating properties of objects stored in this section. + + + + + Gets the instance storing initial camera parameters. + + + + + Gets or sets customly attached instances. + + + + + Represents flags specifying how animation data is stored or should be played. + + + + + The stored curve data has been baked. + + + + + The animation repeats from the start after the last frame has been played. + + + + + The rotation mode stores ZXY angles rather than look-at points in combination with a twist. + + + + + The projection mode is perspective rather than ortographic. + + + + + Represents the animatable data of scene cameras. + + + + + The near clipping plane distance. + + + + + The far clipping plane distance. + + + + + The aspect ratio of the projected image. + + + + + The field of view of the projected image. + + + + + The spatial position of the camera. + + + + + The spatial rotation of the camera. + + + + + The spatial twist of the camera. + + + + + Gets the for instances. + + + + + Animates . + + + + + Animates . + + + + + Animates . + + + + + Animates . + + + + + Animates the X component of . + + + + + Animates the Y component of . + + + + + Animates the Z component of . + + + + + Animates the X component of . + + + + + Animates the Y component of . + + + + + Animates the Z component of . + + + + + Animates . + + + + + Represents an FCAM section in a subfile, storing animations controlling fog settings. + + + + + Gets or sets flags controlling how animation data is stored or how the animation should be played. + + + + + Gets or sets the total number of frames this animation plays. + + + + + Gets or sets the index of the distance attenuation function to use. + + + + + Gets or sets the number of bytes required to bake all . + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the name of the distance attenuation function to use. + + + + + Gets or sets instances animating properties of objects stored in this section. + + + + + Gets or sets the instance storing initial fog parameters. + + + + + Gets or sets customly attached instances. + + + + + Represents flags specifying how animation data is stored or should be played. + + + + + The stored curve data has been baked. + + + + + The animation repeats from the start after the last frame has been played. + + + + + Represents the animatable data of scene fog. + + + + + The distance attenuation of the fog depth. + + + + + The color of the fog. + + + + + Gets the for instances. + + + + + Animates the X component of . + + + + + Animates the Y component of . + + + + + Animates the X (red) component of . + + + + + Animates the Y (green) component of . + + + + + Animates the Z (blue) component of . + + + + + Represents an FLIT section in a subfile, storing animations controlling light settings. + + + + + Gets or sets flags controlling how the animation should be played. + + + + + Gets or sets flags controlling how animation data is stored or how the animation should be played. + + + + + Gets or sets the total number of frames this animation plays. + + + + + Gets or sets the index of the light type. + + + + + Gets or sets the index of the distance attenuation function to use. + + + + + Gets or sets the index of the angle attenuation function to use. + + + + + Gets or sets the number of bytes required to bake all . + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the name of the light type. + + + + + Gets or sets the name of the distance attenuation function to use. + + + + + Gets or sets the name of the angle attenuation function to use. + + + + + Gets or sets instances animating properties of objects stored in this section. + + + + + Gets the instance storing initial light parameters. + + + + + Gets or sets customly attached instances. + + + + + Represents flags specifying how animation data is stored. + + + + + The stored curve data has been baked. + + + + + The animation repeats from the start after the last frame has been played. + + + + + Represents flags specifying which fields are animated. + + + + + Enabled state is animated. + + + + + Position is animated. + + + + + Rotation is animated. + + + + + Distance attenuation is animated. + + + + + Angle attenuation is animated in degrees. + + + + + Color 0 is animated. + + + + + Color 1 is animated. + + + + + Represents the animatable data of scene lighting. + + + + + Enables or disables the light in total. + + + + + The spatial origin of the light source for point or spot lights. + + + + + The spatial rotation of the light source. + + + + + The distance attenuation of the light. + + + + + The angle attenuation of the light in degrees. + + + + + The first light source color. + + + + + The second light source color. + + + + + Gets the for instances. + + + + + Animates . + + + + + Animates the X component of . + + + + + Animates the Y component of . + + + + + Animates the Z component of . + + + + + Animates the X component of . + + + + + Animates the Y component of . + + + + + Animates the Z component of . + + + + + Animates the X component of . + + + + + Animates the Y component of . + + + + + Animates the X component of . + + + + + Animates the Y component of . + + + + + Animates the X (red) component of . + + + + + Animates the Y (green) component of . + + + + + Animates the Z (blue) component of . + + + + + Animates the X (red) component of . + + + + + Animates the Y (green) component of . + + + + + Animates the Z (blue) component of . + + + + + Represents an FSCN subfile in a , storing scene animations controlling camera, light and + fog settings. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the path of the file which originally supplied the data of this instance. + + + + + Gets or sets the instances. + + + + + Gets or sets the instances. + + + + + Gets or sets the instances. + + + + + Gets or sets customly attached instances. + + + + + Represents a parameter animation info in a instance. + + + + + Gets or sets the index of the first instance in the parent + . + + + + + Gets or sets the index of the first instance in the parent + . + + + + + Gets or sets the number of instances used in the parent + . + + + + + Gets or sets the index of the in the . + + + + + Gets the name of the animated . + + + + + Represents an FSHU subfile in a , storing shader parameter animations of a + instance. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the path of the file which originally supplied the data of this instance. + + + + + Gets or sets flags controlling how animation data is stored or how the animation should be played. + + + + + Gets or sets the total number of frames this animation plays. + + + + + Gets or sets the number of bytes required to bake all instances of all + . + + + + + Gets or sets the instance affected by this animation. + + + + + Gets the indices of the instances in the dictionary to + bind for each animation. specifies no binding. + + + + + Gets or sets the instances creating the animation. + + + + + Gets or sets customly attached instances. + + + + + Represents flags specifying how animation data is stored or should be played. + + + + + The stored curve data has been baked. + + + + + The animation repeats from the start after the last frame has been played. + + + + + Represents a material parameter animation in a subfile. + + + + + Gets or sets the name of the animated . + + + + + Gets or sets the list of instances. + + + + + Gets or sets instances animating properties of objects stored in this section. + + + + + Gets or sets the index of the first relative to all curves of the parent + instances. + + + + + Gets or sets the index of the first relative to all param anim infos of the + parent instances. + + + + + Represents a key shape animation info in a instance. + + + + + Gets or sets the index of the curve in the . + + + + + Gets or sets the index of the in the . + + + + + Gets or sets the name of the in the . + + + + + Represents an FSHA subfile in a , storing shape animations of a + instance. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the path of the file which originally supplied the data of this instance. + + + + + Gets or sets flags controlling how animation data is stored or how the animation should be played. + + + + + Gets or sets the total number of frames this animation plays. + + + + + Gets or sets the number of bytes required to bake all instances of all + . + + + + + Gets or sets the instance affected by this animation. + + + + + Gets or sets the indices of the instances in the dictionary + to bind for each animation. specifies no binding. + + + + + Gets or sets the instances creating the animation. + + + + + Gets or sets customly attached instances. + + + + + Represents flags specifying how animation data is stored or should be played. + + + + + The stored curve data has been baked. + + + + + The animation repeats from the start after the last frame has been played. + + + + + Represents a vertex shape animation in a subfile. + + + + + Gets or sets the name of the animated . + + + + + Gets or sets the list of instances. + + + + + Gets or sets instances animating properties of objects stored in this section. + + + + + Gets or sets the list of base values, excluding the base shape (which is always being initialized with 0f). + + + + + Gets or sets the index of the first relative to all curves of the parent + instances. + + + + + Gets or sets the index of the first relative to all key shape anim infos of + the parent instances. + + + + + Represents the animation of a single in a subfile. + + + + + Gets or sets a set of flags indicating whether initial transformation values exist in + . + + + + + Gets or sets a set of flags indicating whether curves animating the corresponding transformation exist. + + + + + Gets or sets a set of flags controlling how to transform bones. + + + + + Gets or sets the name of the animated . + + + + + Gets or sets a field with unknown purpose. + + + + + Gets or sets a field with unknown purpose. + + + + + Gets or sets the element offset in the to an initial translation. + + + + + Gets or sets instances animating properties of objects stored in this section. + + + + + Gets or sets initial transformation values. Only stores specific transformations according to + . + + + + + Gets the index of the first relative to all curves of the parent + instances. + + + + + Represents if initial values exist for the corresponding transformation in the base animation data. + + + + + Initial scaling values exist. + + + + + Initial rotation values exist. + + + + + Initial translation values exist. + + + + + Represents if curves exist which animate the corresponding transformation component. + + + + + Curve animating the X component of a bone's scale. + + + + + Curve animating the Y component of a bone's scale. + + + + + Curve animating the Z component of a bone's scale. + + + + + Curve animating the X component of a bone's rotation. + + + + + Curve animating the Y component of a bone's rotation. + + + + + Curve animating the Z component of a bone's rotation. + + + + + Curve animating the W component of a bone's rotation. + + + + + Curve animating the X component of a bone's translation. + + + + + Curve animating the Y component of a bone's translation. + + + + + Curve animating the Z component of a bone's translation. + + + + + Represents how a bone transformation has to be applied. + + + + + Represents the animatable data of a instance. + + + + + The scaling of the bone. + + + + + The translation of the bone. + + + + + An unused field. + + + + + The rotation of the bone. + + + + + Gets the for instances. + + + + + Animates (never seen in files). + + + + + Animates the X component of . + + + + + Animates the Y component of . + + + + + Animates the Z component of . + + + + + Animates the X component of . + + + + + Animates the Y component of . + + + + + Animates the Z component of . + + + + + Animates the X component of . + + + + + Animates the Y component of . + + + + + Animates the Z component of . + + + + + Animates the W component of . + + + + + Represents an FSKA subfile in a , storing armature animations of + instances in a . + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the path of the file which originally supplied the data of this instance. + + + + + Gets or sets the mode used to control looping and baked settings. + + + + + Gets or sets the mode used to store scaling values. + + + + + Gets or sets the mode used to store rotation values. + + + + + Gets or sets the total number of frames this animation plays. + + + + + Gets or sets the number of bytes required to bake all instances of all + . + + + + + Gets or sets the instances creating the animation. + + + + + Gets or sets the instance affected by this animation. + + + + + Gets or sets the indices of the instances in the dictionary + to bind for each animation. specifies no binding. + + + + + Gets or sets customly attached instances. + + + + + Represents flags specifying how animation data is stored or should be played. + + + + + The stored curve data has been baked. + + + + + The animation repeats from the start after the last frame has been played. + + + + + Represents the data format in which scaling values are stored. + + + + + No scaling. + + + + + Default scaling. + + + + + Autodesk Maya scaling. + + + + + Autodesk Softimage scaling. + + + + + Represents the data format in which rotation values are stored. + + + + + Quaternion, 4 components. + + + + + Euler XYZ, 3 components. + + + + + Represents a pattern animation info in a instance. + + + + + Gets or sets the index of the curve in the . + + + + + Gets or sets the index of the texture in the . + + + + + Gets or sets the name of the in the . + + + + + Represents an FTXP subfile in a , storing texture material pattern animations. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the path of the file which originally supplied the data of this instance. + + + + + Gets or sets flags controlling how animation data is stored or how the animation should be played. + + + + + Gets or sets the total number of frames this animation plays. + + + + + Gets or sets the number of bytes required to bake all instances of all + . + + + + + Gets or sets the instance affected by this animation. + + + + + Gets or sets the indices of the instances in the + dictionary to bind for each animation. specifies no binding. + + + + + Gets or sets the instances creating the animation. + + + + + Gets or sets the instances pointing to instances + participating in the animation. + + + + + Note used for older bfres files + Gets or sets the instances pointing to instances + participating in the animation. + + + + + Gets or sets customly attached instances. + + + + + Represents flags specifying how animation data is stored or should be played. + + + + + The stored curve data has been baked. + + + + + The animation repeats from the start after the last frame has been played. + + + + + Represents a texture pattern material animation in a subfile. + + + + + Gets the name of the animated . + + + + + Gets or sets the list of instances. + + + + + Gets or sets instances animating properties of objects stored in this section. + + + + + Gets or sets the initial indices. + + + + + Gets or sets the index of the first relative to all curves of the parent + instances. + + + + + Gets or sets the index of the first relative to all param anim infos of the + parent instances. + + + + + Represents an FMDL subfile in a , storing multi-dimensional texture data. + + + + + Gets or sets the shape of the texture. + + + + + Gets or sets the width of the texture. + + + + + Gets or sets the height of the texture. + + + + + Gets or sets the depth of the texture. + + + + + Gets or sets the number of mipmaps stored in the . + + + + + Gets or sets the desired texture data buffer format. + + + + + Gets or sets the number of samples for the texture. + + + + + Gets or sets the texture data usage hint. + + + + + Gets or sets the tiling mode. + + + + + Gets or sets the swizzling value. + + + + + Gets or sets the swizzling alignment. + + + + + Gets or sets the pixel swizzling stride. + + + + + Gets or sets the offsets in the array to the data of the mipmap level corresponding + to the array index. + + + + + Gets or sets the source channel to map to the R (red) channel. + + + + + Gets or sets the source channel to map to the G (green) channel. + + + + + Gets or sets the source channel to map to the B (blue) channel. + + + + + Gets or sets the source channel to map to the A (alpha) channel. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the path of the file which originally supplied the data of this instance. + + + + + Gets or sets the raw texture data bytes. + + + + + Gets or sets the raw mipmap level data bytes for all levels. + + + + + Gets or sets customly attached instances. + + + + + Represents an FVIS subfile in a , storing visibility animations of or + instances. + + + + + Gets or sets the name with which the instance can be referenced uniquely in + instances. + + + + + Gets or sets the path of the file which originally supplied the data of this instance. + + + + + Gets or sets flags controlling how animation data is stored or how the animation should be played. + + + + + Gets or sets the kind of data the animation controls. + + + + + Gets or sets the total number of frames this animation plays. + + + + + Gets or sets the number of bytes required to bake all . + + + + + Gets or sets the instance affected by this animation. + + + + + Gets or sets the indices of entries in the or + dictionaries to bind to for each animation. specifies no binding. + + + + + Gets or sets the names of entries in the or + dictionaries to bind to for each animation. + + + + + Gets or sets instances animating properties of objects stored in this section. + + + + + Gets or sets boolean values storing the initial visibility for each or + . + + + + + Gets or sets customly attached instances. + + + + + Represents flags specifying how animation data is stored or should be played. + + + + + The stored curve data has been baked. + + + + + The animation repeats from the start after the last frame has been played. + + + + + Represents the kind of data the visibility animation controls. + + + + + Bone visiblity is controlled. + + + + + Material visibility is controlled. + + + + diff --git a/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.NSW.Bfres.dll b/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.NSW.Bfres.dll index 65ea73a7..3b110e65 100644 Binary files a/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.NSW.Bfres.dll and b/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.NSW.Bfres.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.NSW.Bntx.dll b/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.NSW.Bntx.dll index 24011b12..546c2aa6 100644 Binary files a/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.NSW.Bntx.dll and b/Switch_Toolbox/Lib/Plugins/Syroot.NintenTools.NSW.Bntx.dll differ diff --git a/Switch_Toolbox/Lib/Plugins/WeifenLuo.WinFormsUI.Docking.ThemeVS2015.dll b/Switch_Toolbox/Lib/Plugins/WeifenLuo.WinFormsUI.Docking.ThemeVS2015.dll new file mode 100644 index 00000000..9f9703c5 Binary files /dev/null and b/Switch_Toolbox/Lib/Plugins/WeifenLuo.WinFormsUI.Docking.ThemeVS2015.dll differ diff --git a/Switch_Toolbox/Switch_Toolbox.csproj b/Switch_Toolbox/Switch_Toolbox.csproj index d65fd17a..7d5fd328 100644 --- a/Switch_Toolbox/Switch_Toolbox.csproj +++ b/Switch_Toolbox/Switch_Toolbox.csproj @@ -26,6 +26,7 @@ DEBUG;TRACE prompt 4 + true AnyCPU @@ -266,7 +267,6 @@ {96820047-2a39-4e5a-bfa4-e84fff5c66cf} Switch_Toolbox_Library - False {d82a2c08-2a65-43af-bda6-a36cc27aa003} diff --git a/Switch_Toolbox/Switch_Toolbox.csproj.user b/Switch_Toolbox/Switch_Toolbox.csproj.user new file mode 100644 index 00000000..8ce6b66f --- /dev/null +++ b/Switch_Toolbox/Switch_Toolbox.csproj.user @@ -0,0 +1,9 @@ + + + + true + + + true + + \ No newline at end of file diff --git a/Switch_Toolbox_Library/FileFormats/DDS.cs b/Switch_Toolbox_Library/FileFormats/DDS.cs index 57236072..1fbe308c 100644 --- a/Switch_Toolbox_Library/FileFormats/DDS.cs +++ b/Switch_Toolbox_Library/FileFormats/DDS.cs @@ -18,6 +18,19 @@ namespace Switch_Toolbox.Library //Data from https://github.com/jam1garner/Smash-Forge/blob/master/Smash%20Forge/Filetypes/Textures/DDS.cs public class DDS { + public const uint FOURCC_DXT1 = 0x31545844; + public const uint FOURCC_DXT2 = 0x32545844; + public const uint FOURCC_DXT3 = 0x33545844; + public const uint FOURCC_DXT4 = 0x34545844; + public const uint FOURCC_DXT5 = 0x35545844; + public const uint FOURCC_ATI1 = 0x31495441; + public const uint FOURCC_BC4U = 0x55344342; + public const uint FOURCC_BC5U = 0x55354342; + public const uint FOURCC_DX10 = 0x30315844; + + public const uint FOURCC_ATI2 = 0x32495441; + public const uint FOURCC_RXGB = 0x42475852; + public enum CubemapFace { PosX, @@ -79,17 +92,21 @@ namespace Switch_Toolbox.Library { case 0x00000000: //RGBA return 0x4; - case 0x31545844: //DXT1 + case FOURCC_DXT1: return 0x8; - case 0x33545844: //DXT3 + case FOURCC_DXT2: return 0x10; - case 0x35545844: //DXT5 + case FOURCC_DXT3: return 0x10; - case 0x31495441: //ATI1 - case 0x55344342: //BC4U + case FOURCC_DXT4: + return 0x10; + case FOURCC_DXT5: + return 0x10; + case FOURCC_ATI1: + case FOURCC_BC4U: return 0x8; - case 0x32495441: //ATI2 - case 0x55354342: //BC5U + case FOURCC_ATI2: + case FOURCC_BC5U: return 0x10; default: return 0; @@ -101,19 +118,21 @@ namespace Switch_Toolbox.Library { case DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM: case DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB: - header.ddspf.fourCC = "DXT1"; + header.ddspf.fourCC = FOURCC_DXT1; break; case DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM: case DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB: - header.ddspf.fourCC = "DXT3"; + header.ddspf.fourCC = FOURCC_DXT3; break; case DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM: case DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB: - header.ddspf.fourCC = "DXT5"; + header.ddspf.fourCC = FOURCC_DXT5; break; } } public bool IsDX10; + public uint imageSize; + public Header header; public DX10Header DX10header; public class Header @@ -131,7 +150,7 @@ namespace Switch_Toolbox.Library { public uint size = 0x20; public uint flags = 0x00000000; - public string fourCC; + public uint fourCC; public uint RGBBitCount = 0; public uint RBitMask = 0x00000000; public uint GBitMask = 0x00000000; @@ -320,7 +339,7 @@ namespace Switch_Toolbox.Library header.ddspf.size = reader.ReadUInt32(); header.ddspf.flags = reader.ReadUInt32(); - header.ddspf.fourCC = reader.ReadString(4); + header.ddspf.fourCC = reader.ReadUInt32(); header.ddspf.RGBBitCount = reader.ReadUInt32(); header.ddspf.RBitMask = reader.ReadUInt32(); header.ddspf.GBitMask = reader.ReadUInt32(); @@ -334,7 +353,7 @@ namespace Switch_Toolbox.Library header.reserved2 = reader.ReadUInt32(); int DX10HeaderSize = 0; - if (header.ddspf.fourCC == "DX10") + if (header.ddspf.fourCC == FOURCC_DX10) { IsDX10 = true; @@ -342,8 +361,15 @@ namespace Switch_Toolbox.Library ReadDX10Header(reader); } + if (IsCompressed()) + { + imageSize = ((header.width + 3) >> 2) * ((header.height + 3) >> 2) * getFormatSize(header.ddspf.fourCC); + } + else + imageSize = header.width * header.height * getFormatSize(header.ddspf.fourCC); + reader.TemporarySeek((int)(4 + header.size + DX10HeaderSize), SeekOrigin.Begin); - bdata = reader.ReadBytes((int)(reader.BaseStream.Length - reader.Position)); + bdata = reader.ReadBytes((int)imageSize); reader.Dispose(); reader.Close(); @@ -398,17 +424,17 @@ namespace Switch_Toolbox.Library case DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB: case DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM: header.ddspf.flags = (uint)DDPF.FOURCC; - header.ddspf.fourCC = "DXT1"; + header.ddspf.fourCC = FOURCC_DXT1; break; case DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB: case DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM: header.ddspf.flags = (uint)DDPF.FOURCC; - header.ddspf.fourCC = "DXT3"; + header.ddspf.fourCC = FOURCC_DXT3; break; case DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB: case DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM: header.ddspf.flags = (uint)DDPF.FOURCC; - header.ddspf.fourCC = "DXT5"; + header.ddspf.fourCC = FOURCC_DXT5; break; case DXGI_FORMAT.DXGI_FORMAT_BC4_UNORM: case DXGI_FORMAT.DXGI_FORMAT_BC4_SNORM: @@ -419,7 +445,7 @@ namespace Switch_Toolbox.Library case DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM: case DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM_SRGB: header.ddspf.flags = (uint)DDPF.FOURCC; - header.ddspf.fourCC = "DX10"; + header.ddspf.fourCC = FOURCC_DX10; if (DX10header == null) DX10header = new DX10Header(); @@ -428,9 +454,58 @@ namespace Switch_Toolbox.Library break; } } + public bool IsCompressed() + { + if (header == null) + return false; + + if (DX10header != null) + { + switch (DX10header.DXGI_Format) + { + case DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM: + case DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB: + case DXGI_FORMAT.DXGI_FORMAT_BC1_TYPELESS: + case DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB: + case DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM: + case DXGI_FORMAT.DXGI_FORMAT_BC2_TYPELESS: + case DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB: + case DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM: + case DXGI_FORMAT.DXGI_FORMAT_BC3_TYPELESS: + case DXGI_FORMAT.DXGI_FORMAT_BC4_UNORM: + case DXGI_FORMAT.DXGI_FORMAT_BC4_TYPELESS: + case DXGI_FORMAT.DXGI_FORMAT_BC4_SNORM: + case DXGI_FORMAT.DXGI_FORMAT_BC5_UNORM: + case DXGI_FORMAT.DXGI_FORMAT_BC5_TYPELESS: + case DXGI_FORMAT.DXGI_FORMAT_BC5_SNORM: + return true; + default: + return false; + } + } + else + { + switch (header.ddspf.fourCC) + { + case FOURCC_DXT1: + case FOURCC_DXT2: + case FOURCC_DXT3: + case FOURCC_DXT4: + case FOURCC_DXT5: + case FOURCC_ATI1: + case FOURCC_BC4U: + case FOURCC_ATI2: + case FOURCC_BC5U: + return true; + default: + return false; + } + } + } public void Save(DDS dds, string FileName, List> data = null) { FileWriter writer = new FileWriter(new FileStream(FileName, FileMode.Create, FileAccess.Write, FileShare.Write)); + var header = dds.header; writer.Write(Encoding.ASCII.GetBytes("DDS ")); writer.Write(header.size); writer.Write(header.flags); @@ -447,7 +522,7 @@ namespace Switch_Toolbox.Library writer.Write(header.ddspf.size); writer.Write(header.ddspf.flags); - writer.WriteSignature(header.ddspf.fourCC); + writer.Write(header.ddspf.fourCC); writer.Write(header.ddspf.RGBBitCount); writer.Write(header.ddspf.RBitMask); writer.Write(header.ddspf.GBitMask); @@ -466,10 +541,7 @@ namespace Switch_Toolbox.Library if (data != null) { - foreach (byte[] mip in data[0]) - { - writer.Write(mip); - } + writer.Write(data[0][0]); } else { diff --git a/Switch_Toolbox_Library/Helpers/TextureHelper.cs b/Switch_Toolbox_Library/Helpers/TextureHelper.cs new file mode 100644 index 00000000..f2cda4ce --- /dev/null +++ b/Switch_Toolbox_Library/Helpers/TextureHelper.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Switch_Toolbox.Library +{ + public class TextureHelper + { + public static Tuple GetCurrentMipSize(uint width, uint height, uint blkHeight, uint blkWidth, uint bpp, int CurLevel) + { + uint offset = 0; + uint width_ = 0; + uint height_ = 0; + + for (int mipLevel = 0; mipLevel < CurLevel; mipLevel++) + { + width_ = DIV_ROUND_UP(Math.Max(1, width >> mipLevel), blkWidth); + height_ = DIV_ROUND_UP(Math.Max(1, height >> mipLevel), blkHeight); + + offset += width_ * height_ * bpp; + } + + width_ = DIV_ROUND_UP(Math.Max(1, width >> CurLevel), blkWidth); + height_ = DIV_ROUND_UP(Math.Max(1, height >> CurLevel), blkHeight); + + uint size = width_ * height_ * bpp; + return Tuple.Create(offset, size); + + } + private static uint DIV_ROUND_UP(uint n, uint d) + { + return (n + d - 1) / d; + } + } +} diff --git a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj index 064e7cb5..8cad482f 100644 --- a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj +++ b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj @@ -25,6 +25,7 @@ DEBUG;TRACE prompt 4 + true pdbonly @@ -140,6 +141,7 @@ Viewport.cs + diff --git a/Switch_Toolbox_Library/Util/Util.cs b/Switch_Toolbox_Library/Util/Util.cs index 2ac25ebb..33efb7e9 100644 --- a/Switch_Toolbox_Library/Util/Util.cs +++ b/Switch_Toolbox_Library/Util/Util.cs @@ -44,6 +44,11 @@ namespace Switch_Toolbox.Library } return rv; } + public static byte[] SubArray(byte[] data, uint offset, uint length) + { + return data.Skip((int)offset).Take((int)length).ToArray(); + } + static int i = 0; public static string RenameDuplicateString(List strings, string oldString) {