From 8529b0b81878dc4eda15c498af403bbab7149bfb Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Mon, 14 Oct 2019 18:38:55 -0400 Subject: [PATCH] Some archive parent fixes for texture manager --- File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs | 2 +- .../FileFormats/Layout/TextureManager.cs | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs b/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs index 620aeec3..ad8e0950 100644 --- a/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs +++ b/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs @@ -504,7 +504,7 @@ namespace LayoutBXLYT.Cafe else TextureManager.Platform = TextureManager.PlatformType.WiiU; - TextureManager.ArchiveParent = FileInfo.IFileInfo.ArchiveParent; + TextureManager.LayoutFile = this; bool setRoot = false; bool setGroupRoot = false; diff --git a/File_Format_Library/FileFormats/Layout/TextureManager.cs b/File_Format_Library/FileFormats/Layout/TextureManager.cs index febacfb5..d9254996 100644 --- a/File_Format_Library/FileFormats/Layout/TextureManager.cs +++ b/File_Format_Library/FileFormats/Layout/TextureManager.cs @@ -11,12 +11,17 @@ namespace LayoutBXLYT { public class TextureManager : IDisposable { + public BxlytHeader LayoutFile; + public Dictionary BinaryContainers = new Dictionary(); //The archive to put textures in if necessary public Dictionary ArchiveFile = new Dictionary(); - public IArchiveFile ArchiveParent; + public IArchiveFile ArchiveParent + { + get { return LayoutFile.FileInfo.IFileInfo.ArchiveParent; } + } public PlatformType Platform = PlatformType.WiiU; @@ -55,6 +60,8 @@ namespace LayoutBXLYT break; case PlatformType.WiiU: { + if (ArchiveParent == null) return null; + foreach (var file in ArchiveParent.Files) { if (file.FileName == name) @@ -92,6 +99,8 @@ namespace LayoutBXLYT case PlatformType.WiiU: { var archive = ArchiveParent; + if (archive == null) return null; + var bflim = BFLIM.CreateNewFromImage(); if (bflim == null) return textures;