示例#1
0
        private static ExtractedSoundExtraInfo ReadSoundExtraInfo(IReader reader, byte version)
        {
            if (version > 0)
            {
                throw new InvalidOperationException("Unrecognized \"snex\" block version");
            }

            int originalIndex = reader.ReadInt32();

            var extra = new SoundExtraInfo();

            var permSections = new System.Collections.Generic.List <SoundExtraInfoPermutationSection>();

            int permsectioncount = reader.ReadInt32();

            for (int i = 0; i < permsectioncount; i++)
            {
                var permsection = new SoundExtraInfoPermutationSection();

                var dialogInfos = new System.Collections.Generic.List <SoundExtraInfoDialogueInfo>();
                var unk1s       = new System.Collections.Generic.List <SoundExtraInfoUnknown1>();

                int    datalength = reader.ReadInt32();
                byte[] data       = reader.ReadBlock(datalength);
                permsection.EncodedData = data;

                int dialogueinfocount = reader.ReadInt32();
                for (int d = 0; d < dialogueinfocount; d++)
                {
                    var dialogueinfo = new SoundExtraInfoDialogueInfo();

                    dialogueinfo.MouthOffset   = reader.ReadInt32();
                    dialogueinfo.MouthLength   = reader.ReadInt32();
                    dialogueinfo.LipsyncOffset = reader.ReadInt32();
                    dialogueinfo.LipsyncLength = reader.ReadInt32();

                    dialogInfos.Add(dialogueinfo);
                }

                int unk1count = reader.ReadInt32();
                for (int a = 0; a < unk1count; a++)
                {
                    var unk1  = new SoundExtraInfoUnknown1();
                    var unk2s = new System.Collections.Generic.List <SoundExtraInfoUnknown2>();

                    unk1.Unknown   = reader.ReadInt32();
                    unk1.Unknown1  = reader.ReadInt32();
                    unk1.Unknown2  = reader.ReadInt32();
                    unk1.Unknown3  = reader.ReadInt32();
                    unk1.Unknown4  = reader.ReadInt32();
                    unk1.Unknown5  = reader.ReadInt32();
                    unk1.Unknown6  = reader.ReadInt32();
                    unk1.Unknown7  = reader.ReadInt32();
                    unk1.Unknown8  = reader.ReadInt32();
                    unk1.Unknown9  = reader.ReadInt32();
                    unk1.Unknown10 = reader.ReadInt32();
                    unk1.Unknown11 = reader.ReadInt32();

                    int unk2count = reader.ReadInt32();
                    for (int b = 0; b < unk2count; b++)
                    {
                        var unk2  = new SoundExtraInfoUnknown2();
                        var unk5s = new System.Collections.Generic.List <SoundExtraInfoUnknown3>();
                        var unk6s = new System.Collections.Generic.List <SoundExtraInfoUnknown4>();

                        unk2.Unknown  = reader.ReadFloat();
                        unk2.Unknown1 = reader.ReadFloat();
                        unk2.Unknown2 = reader.ReadFloat();
                        unk2.Unknown3 = reader.ReadFloat();

                        int unk3count = reader.ReadInt32();
                        for (int c = 0; c < unk3count; c++)
                        {
                            var unk3 = new SoundExtraInfoUnknown3();

                            unk3.Unknown  = reader.ReadInt32();
                            unk3.Unknown1 = reader.ReadInt32();

                            if (version >= 1)
                            {
                                unk3.Unknown2 = reader.ReadInt32();
                                unk3.Unknown3 = reader.ReadInt32();
                            }

                            unk5s.Add(unk3);
                        }

                        int unk4count = reader.ReadInt32();
                        for (int c = 0; c < unk4count; c++)
                        {
                            var unk4 = new SoundExtraInfoUnknown4();

                            unk4.Unknown  = reader.ReadInt32();
                            unk4.Unknown1 = reader.ReadInt32();
                            unk6s.Add(unk4);
                        }

                        unk2.Unknown5s = unk5s.ToArray();
                        unk2.Unknown6s = unk6s.ToArray();

                        unk2s.Add(unk2);
                        unk1.Unknown12s = unk2s.ToArray();
                    }

                    unk1s.Add(unk1);

                    permsection.DialogueInfos = dialogInfos.ToArray();
                    permsection.Unknown1s     = unk1s.ToArray();
                }

                permSections.Add(permsection);
            }

            extra.PermutationSections = permSections.ToArray();

            int datumscount = reader.ReadInt32();
            var datums      = new System.Collections.Generic.List <DatumIndex>();

            for (int i = 0; i < datumscount; i++)
            {
                datums.Add(new DatumIndex(reader.ReadUInt32()));
            }

            extra.Datums = datums.ToArray();

            return(new ExtractedSoundExtraInfo(originalIndex, extra));
        }
示例#2
0
 public ExtractedSoundExtraInfo(int index, SoundExtraInfo src)
 {
     OriginalIndex = index;
     Source        = src;
 }