示例#1
0
        public void LoadFromPath(string file)
        {
            ReloadType = TaeFileContainerReloadType.None;

            containerBND3 = null;
            containerBND4 = null;

            taeInBND.Clear();
            hkxInBND.Clear();

            if (BND3.Is(file))
            {
                ContainerType = TaeFileContainerType.BND3;
                containerBND3 = BND3.Read(file);
                foreach (var f in containerBND3.Files)
                {
                    if (TAE.Is(f.Bytes))
                    {
                        taeInBND.Add(f.Name, TAE.Read(f.Bytes));
                    }
                    else if (f.Name.ToUpper().EndsWith(".HKX"))
                    {
                        hkxInBND.Add(f.Name, f.Bytes);
                    }
                }
            }
            else if (BND4.Is(file))
            {
                ContainerType = TaeFileContainerType.BND4;
                containerBND4 = BND4.Read(file);
                foreach (var f in containerBND4.Files)
                {
                    if (TAE.Is(f.Bytes))
                    {
                        taeInBND.Add(f.Name, TAE.Read(f.Bytes));
                    }
                    else if (f.Name.ToUpper().EndsWith(".HKX"))
                    {
                        hkxInBND.Add(f.Name, f.Bytes);
                    }
                }
            }
            else if (TAE.Is(file))
            {
                ContainerType = TaeFileContainerType.TAE;
                taeInBND.Add(file, TAE.Read(file));
            }

            filePath = file;

            //SFTODO
            ReloadType = TaeFileContainerReloadType.None;
        }
示例#2
0
        static void Main(string[] args)
        {
            const string basePath = @"D:\Program Files (x86)\Steam\steamapps\common\DARK SOULS III\Game";

            const string actionSetupPath = "Res/TaeToWeaponKind.yml";

            TAEAnalyzerData analyzerData = new YamlDotNet.Serialization.Deserializer().Deserialize <TAEAnalyzerData>(new System.IO.StreamReader(actionSetupPath));

            var reader = new BND4Reader(System.IO.Path.Combine(basePath, "chr/c0000.anibnd.dcx"));


            const int jumpTableEventType = 0;

            const int attackEventType = 1;

            int[] comboBehSubIds = new[] { 4, 116 };

            var taeTemplate = TAE.Template.ReadXMLFile(@"Res/TAE.Template.DS3.xml");

            var jumpTableEventTemplate = taeTemplate[21][jumpTableEventType];
            var attackEventTemplate    = taeTemplate[21][attackEventType];

            var analyzedWeapons = analyzerData.weapons.Select(weaponKvp => (kvp: weaponKvp, taeFileHeader: reader.Files
                                                                            // get all TAE headers
                                                                            .Where(header => header.Name.EndsWith("tae"))
                                                                            .Single(header => System.IO.Path.GetFileName(header.Name) == $"a{weaponKvp.Key}.tae")))
                                  .Select(weaponData => (weaponData: weaponData, fileContents: reader.ReadFile(weaponData.taeFileHeader)))
                                  .Where(weaponData => TAE.Is(weaponData.fileContents))
                                  .Select((weaponData) => (kvp: weaponData.weaponData.kvp, weaponTae: TAE.Read(weaponData.fileContents)))
                                  .SelectMany(myTuple => analyzerData.animKind.Select(animKindKvp => (weaponKindKvp: myTuple.kvp, animKindKvp: animKindKvp, weaponTae: myTuple.weaponTae)))
                                  .SelectMany(myTuple =>
            {
                var attackTimings = myTuple.weaponTae.Animations.Select(anim => {
                    bool didFind = myTuple.animKindKvp.Value.TryGetDetails(myTuple.animKindKvp.Key, anim, out string details);

                    return(found: didFind, myTuple: myTuple, anim, details);
                })
                                    .Where(d => d.found)
                                    .Select(anim => (anim, events: anim.anim.Events.Where(taeEvent => taeEvent.Type == attackEventType || taeEvent.Type == jumpTableEventType)))
                                    .Where(events => events.events.Any())
                                    .Select(anim => anim.events.Aggregate(new AttackInfo(), (attackInfo, taeEvent) =>
                {
                    attackInfo.anim    = anim.anim.anim;
                    attackInfo.details = anim.anim.details;
                    if (taeEvent.Type == attackEventType)
                    {
                        taeEvent.ApplyTemplate(false, attackEventTemplate);
                        if (taeEvent.Parameters["Unk04"].Equals(0))
                        {
                            attackInfo.Attacks.Add((attackStart: taeEvent.StartTime, attackEnd: taeEvent.EndTime));
                        }
                    }
示例#3
0
        public void LoadFromPath(string file)
        {
            filePath = file;

            containerANIBND = null;

            taeInBND.Clear();
            hkxInBND.Clear();



            if (BND3.Is(file))
            {
                ContainerType   = TaeFileContainerType.ANIBND;
                containerANIBND = BND3.Read(file);
            }
            else if (BND4.Is(file))
            {
                ContainerType   = TaeFileContainerType.ANIBND;
                containerANIBND = BND4.Read(file);
            }
            else if (TAE.Is(file))
            {
                CheckGameVersionForTaeInterop(file);

                ContainerType = TaeFileContainerType.TAE;
                taeInBND.Add(file, TAE.Read(file));
            }

            void DoBnd(IBinder bnd)
            {
            }

            if (ContainerType == TaeFileContainerType.ANIBND)
            {
                LoadingTaskMan.DoLoadingTaskSynchronous("TaeFileContainer_ANIBND", "Loading all TAE files in ANIBND...", innerProgress =>
                {
                    double i = 0;
                    foreach (var f in containerANIBND.Files)
                    {
                        innerProgress.Report(++i / containerANIBND.Files.Count);

                        CheckGameVersionForTaeInterop(f.Name);
                        if (BND3.Is(f.Bytes))
                        {
                            ContainerType          = TaeFileContainerType.OBJBND;
                            containerOBJBND        = containerANIBND;
                            containerANIBND        = BND3.Read(f.Bytes);
                            anibndPathInsideObjbnd = f.Name;
                            break;
                        }
                        else if (BND4.Is(f.Bytes))
                        {
                            ContainerType          = TaeFileContainerType.OBJBND;
                            containerOBJBND        = containerANIBND;
                            containerANIBND        = BND4.Read(f.Bytes);
                            anibndPathInsideObjbnd = f.Name;
                            break;
                        }
                        else if (TAE.Is(f.Bytes))
                        {
                            taeInBND.Add(f.Name, TAE.Read(f.Bytes));
                        }
                        else if (f.Name.ToUpper().EndsWith(".HKX"))
                        {
                            hkxInBND.Add(f.Name, f.Bytes);
                        }
                    }
                    innerProgress.Report(1);

                    if (ContainerType == TaeFileContainerType.OBJBND)
                    {
                        i = 0;
                        foreach (var f in containerANIBND.Files)
                        {
                            innerProgress.Report(++i / containerANIBND.Files.Count);

                            CheckGameVersionForTaeInterop(f.Name);
                            if (TAE.Is(f.Bytes))
                            {
                                taeInBND.Add(f.Name, TAE.Read(f.Bytes));
                            }
                            else if (f.Name.ToUpper().EndsWith(".HKX"))
                            {
                                hkxInBND.Add(f.Name, f.Bytes);
                            }
                        }
                        innerProgress.Report(1);
                    }
                });
            }
        }