Пример #1
0
        private static void SaveOWAnimFile(string animationEffectFile, FindLogic.Combo.EffectInfoCombo animationEffect,
                                           FindLogic.Combo.AnimationInfoNew animationInfo, FindLogic.Combo.ComboInfo info,
                                           Effect.OWAnimWriter owAnimWriter, ulong model, Dictionary <ulong, HashSet <FindLogic.Combo.VoiceLineInstanceInfo> > svceLines)
        {
            CreateDirectoryFromFile(animationEffectFile);

            using (Stream fileStream = new FileStream(animationEffectFile, FileMode.Create)) {
                fileStream.SetLength(0);
                owAnimWriter.Write(fileStream, info, animationInfo, animationEffect, model, svceLines);
            }
        }
Пример #2
0
        public static void SaveAnimationEffectReference(ICLIFlags flags, string path, FindLogic.Combo.ComboInfo info,
                                                        ulong animation, ulong model)
        {
            FindLogic.Combo.AnimationInfoNew animationInfo = info.Animations[animation];
            Effect.OWAnimWriter animWriter = new Effect.OWAnimWriter();
            string file = Path.Combine(path, Model.AnimationEffectDir,
                                       animationInfo.GetNameIndex() + animWriter.Format);

            CreateDirectoryFromFile(file);
            using (Stream outputStream = File.OpenWrite(file)) {
                animWriter.WriteReference(outputStream, info, animationInfo, model);
            }
        }
Пример #3
0
        public static void SaveAnimation(ICLIFlags flags, string path, FindLogic.Combo.ComboInfo info, ulong animation,
                                         ulong model)
        {
            bool convertAnims = false;

            if (flags is ExtractFlags extractFlags)
            {
                convertAnims = extractFlags.ConvertAnimations && !extractFlags.Raw;
                if (extractFlags.SkipAnimations)
                {
                    return;
                }
            }

            SEAnimWriter animWriter = new SEAnimWriter();

            FindLogic.Combo.AnimationInfoNew animationInfo = info.Animations[animation];

            using (Stream animStream = OpenFile(animation)) {
                if (animStream == null)
                {
                    return;
                }
                MemoryStream animMemStream = new MemoryStream();
                animStream.CopyTo(animMemStream);

                if (info.SaveRuntimeData.Threads)
                {
                    info.SaveRuntimeData.Tasks.Add(Task.Run(() => {
                        ConvertAnimation(animMemStream, path, convertAnims, animWriter, animationInfo);
                    }));
                }
                else
                {
                    ConvertAnimation(animMemStream, path, convertAnims, animWriter, animationInfo);
                }
            }

            if (!info.SaveConfig.SaveAnimationEffects)
            {
                return;
            }
            FindLogic.Combo.EffectInfoCombo animationEffect;


            // just create a fake effect if it doesn't exist
            if (animationInfo.Effect == 0)
            {
                animationEffect = new FindLogic.Combo.EffectInfoCombo(0)
                {
                    Effect = new EffectParser.EffectInfo()
                };
                animationEffect.Effect.SetupEffect();
            }
            else if (info.Effects.ContainsKey(animationInfo.Effect))
            {
                // wot, why
                animationEffect = info.Effects[animationInfo.Effect];
            }
            else
            {
                animationEffect = info.AnimationEffects[animationInfo.Effect];
            }

            Effect.OWAnimWriter owAnimWriter = new Effect.OWAnimWriter();
            string animationEffectDir        = Path.Combine(path, Model.AnimationEffectDir, animationInfo.GetNameIndex());
            string animationEffectFile       =
                Path.Combine(animationEffectDir, $"{animationInfo.GetNameIndex()}{owAnimWriter.Format}");
            Dictionary <ulong, HashSet <FindLogic.Combo.VoiceLineInstanceInfo> > svceLines = new Dictionary <ulong, HashSet <FindLogic.Combo.VoiceLineInstanceInfo> >();

            if (animationEffect.GUID != 0)
            {
                SaveEffectExtras(flags, animationEffectDir, info, animationEffect.Effect, out svceLines);
            }
            if (info.SaveRuntimeData.Threads)
            {
                info.SaveRuntimeData.Tasks.Add(Task.Run(() => {
                    SaveOWAnimFile(animationEffectFile, animationEffect, animationInfo, info, owAnimWriter, model, svceLines);
                }));
            }
            else
            {
                SaveOWAnimFile(animationEffectFile, animationEffect, animationInfo, info, owAnimWriter, model, svceLines);
            }
        }