Esempio n. 1
0
        public void ReadFromFile(BinaryReader reader)
        {
            fileName       = new string(reader.ReadChars(reader.ReadByte()));
            numActorhashes = reader.ReadInt32();
            actorHashes    = new ulong[numActorhashes];

            for (int i = 0; i != actorHashes.Length; i++)
            {
                actorHashes[i] = reader.ReadUInt64();
            }

            unk01 = reader.ReadInt32();
            unk02 = reader.ReadByte();

            count1    = reader.ReadInt16();
            unksData2 = new ushort[count1];

            for (int i = 0; i != count1; i++)
            {
                unksData2[i] = reader.ReadUInt16();
            }

            parent       = reader.ReadInt32();
            unk03        = reader.ReadInt32();
            soundPrimary = new string(reader.ReadChars(reader.ReadByte()));
            parentIdx    = reader.ReadInt16();
            sUnk04       = reader.ReadInt16();
            count2       = reader.ReadInt16();

            data = new unkStruct1[count2];
            for (int i = 0; i != count2; i++)
            {
                unkStruct1 subData = new unkStruct1();
                subData.unk0      = reader.ReadByte();
                subData.unk1      = reader.ReadByte();
                subData.numFloats = reader.ReadByte();

                subData.floats = new Vector4[subData.numFloats];

                for (int x = 0; x != subData.numFloats; x++)
                {
                    subData.floats[x] = Vector4Extenders.ReadFromFile(reader);
                }

                subData.numShorts = reader.ReadInt16();

                subData.shorts = new short[subData.numShorts];

                for (int x = 0; x != subData.numShorts; x++)
                {
                    subData.shorts[x] = reader.ReadInt16();
                }

                subData.unk2       = reader.ReadInt32();
                subData.unk3       = reader.ReadSingle();
                subData.sectorName = new string(reader.ReadChars(reader.ReadByte()));
                subData.unk4       = reader.ReadInt16();
                subData.unk5       = reader.ReadInt32();
                data[i]            = subData;
            }

            sUnk06 = reader.ReadByte();
            sUnk07 = reader.ReadInt32();
            data1  = new unkStruct2[sUnk07];
            for (int i = 0; i != sUnk07; i++)
            {
                byte       sZero   = reader.ReadByte();
                unkStruct2 subData = new unkStruct2();
                subData.portalName = new string(reader.ReadChars(reader.ReadByte()));
                subData.floats     = new float[5];
                for (int x = 0; x != 5; x++)
                {
                    subData.floats[x] = reader.ReadSingle();
                }
                subData.sectorToLoad = new string(reader.ReadChars(reader.ReadByte()));
                subData.unk01        = reader.ReadByte();
                subData.sectorType   = new string(reader.ReadChars(reader.ReadByte()));
                subData.unk02        = reader.ReadByte();
                subData.unk03        = reader.ReadSingle();
                subData.doorName     = new string(reader.ReadChars(reader.ReadByte()));
                subData.unk04        = reader.ReadByte();
                subData.unk05        = reader.ReadByte();

                if (subData.unk05 == 1)
                {
                    subData.unk06 = reader.ReadByte();
                }

                data1[i] = subData;
            }
            DumpToSound();
        }
Esempio n. 2
0
        public void WriteToFile(BinaryWriter writer)
        {
            writer.Write((byte)fileName.Length);
            writer.Write(fileName.ToCharArray());
            writer.Write(numActorhashes);

            for (int i = 0; i != numActorhashes; i++)
            {
                writer.Write(actorHashes[i]);
            }

            writer.Write(unk01);
            writer.Write(unk02);
            writer.Write(count1);

            for (int i = 0; i != count1; i++)
            {
                writer.Write(unksData2[i]);
            }

            writer.Write(parent);
            writer.Write(unk03);
            writer.Write((byte)soundPrimary.Length);
            writer.Write(soundPrimary.ToCharArray());
            writer.Write(parentIdx);
            writer.Write(sUnk04);
            writer.Write(count2);

            for (int i = 0; i != count2; i++)
            {
                unkStruct1 subData = data[i];
                writer.Write(subData.unk0);
                writer.Write(subData.unk1);
                writer.Write(subData.numFloats);

                for (int x = 0; x != subData.numFloats; x++)
                {
                    Vector4Extenders.WriteToFile(subData.floats[x], writer);
                }

                writer.Write(subData.numShorts);

                for (int x = 0; x != subData.numShorts; x++)
                {
                    writer.Write(subData.shorts[x]);
                }

                writer.Write(subData.unk2);
                writer.Write(subData.unk3);
                writer.Write((byte)subData.sectorName.Length);
                writer.Write(subData.sectorName.ToCharArray());
                writer.Write(subData.unk4);
                writer.Write(subData.unk5);
            }

            writer.Write(sUnk06);
            writer.Write(sUnk07);

            for (int i = 0; i != sUnk07; i++)
            {
                writer.Write((byte)0);
                unkStruct2 subData = data1[i];
                writer.Write((byte)subData.portalName.Length);
                writer.Write(subData.portalName.ToCharArray());
                for (int x = 0; x != 5; x++)
                {
                    writer.Write(subData.floats[x]);
                }

                writer.Write((byte)subData.sectorToLoad.Length);
                writer.Write(subData.sectorToLoad.ToCharArray());
                writer.Write(subData.unk01);
                writer.Write((byte)subData.sectorType.Length);
                writer.Write(subData.sectorType.ToCharArray());
                writer.Write(subData.unk02);
                writer.Write(subData.unk03);
                writer.Write((byte)subData.doorName.Length);
                writer.Write(subData.doorName.ToCharArray());
                writer.Write(subData.unk04);
                writer.Write(subData.unk05);

                if (subData.unk05 == 1)
                {
                    writer.Write(subData.unk06);
                }
            }
        }