Exemple #1
0
 public static void AddTpf(SoulsFormats.TPF tpf)
 {
     foreach (var tex in tpf.Textures)
     {
         AddFetch(tpf, tex.Name);
     }
 }
Exemple #2
0
        public static void AddTextureBnd(BND chrbnd, IProgress <double> prog)
        {
            var tpfFiles = chrbnd.Where(x => x.Name.EndsWith(".tpf")).ToList();
            int i        = 0;

            foreach (var t in tpfFiles)
            {
                SoulsFormats.TPF tpf = null;
                lock (_lock_IO)
                {
                    tpf = SoulsFormats.TPF.Read(t.GetBytes());
                }
                AddTpf(tpf);
                prog?.Report(1.0 * (++i) / tpfFiles.Count);
            }
        }
Exemple #3
0
        public static void AddFetch(SoulsFormats.TPF tpf, string texName)
        {
            string shortName = Path.GetFileNameWithoutExtension(texName);

            if (!Fetches.ContainsKey(shortName))
            {
                lock (_lock_pool)
                {
                    if (tpf.Platform == SoulsFormats.TPF.TPFPlatform.PS4)
                    {
                        tpf.ConvertPS4ToPC();
                    }
                    var newFetch = new TextureFetchRequest(tpf, texName);
                    Fetches.Add(shortName, newFetch);
                }
            }
        }
        public static List <Model> LoadModelChr(int id)
        {
            var bndName    = GetInterrootPath($@"chr\c{id:D4}.chrbnd");
            var texBndName = GetInterrootPath($@"chr\c{id:D4}.texbnd");
            // Used in Bloodborne
            var texExtendedTpf = GetInterrootPath($@"chr\c{id:D4}_2.tpf.dcx");

            BND bnd = LoadDecompressedBND(bndName);

            if (bnd != null)
            {
                var models = LoadModelsFromBnd(bnd);
                if (Type == InterrootType.InterrootDS3)
                {
                    // DS3 has separate texbnds for textures
                    BND texbnd = LoadDecompressedBND(texBndName);
                    if (texbnd != null)
                    {
                        TexturePool.AddTextureBnd(texbnd, null);
                    }
                }
                else
                {
                    if (File.Exists(texExtendedTpf))
                    {
                        SoulsFormats.TPF tpf = null;
                        lock (_lock_IO)
                        {
                            tpf = SoulsFormats.TPF.Read(texExtendedTpf);
                        }
                        TexturePool.AddTpf(tpf);
                    }
                    TexturePool.AddTextureBnd(bnd, null);
                }
                return(models);
            }

            return(new List <Model>());
        }
Exemple #5
0
 public static void AddTpfFromPath(string path)
 {
     SoulsFormats.TPF tpf = InterrootLoader.DirectLoadTpf(path);
     AddTpf(tpf);
 }