private void writeBinaryHibernation(ArkArchive archive)
        {
            archive.Position = hibernationOffset;
            if (SaveVersion > 7)
            {
                archive.WriteInt(hibernationV8Unknown1);
                archive.WriteInt(hibernationV8Unknown2);
                archive.WriteInt(hibernationV8Unknown3);
                archive.WriteInt(hibernationV8Unknown4);
            }

            if (!HibernationEntries.Any())
            {
                return;
            }

            archive.WriteInt(hibernationUnknown1);
            archive.WriteInt(hibernationUnknown2);

            archive.WriteInt(hibernationClasses.Count);
            hibernationClasses.ForEach(archive.WriteString);

            archive.WriteInt(hibernationIndices.Count);
            hibernationIndices.ForEach(archive.WriteInt);

            archive.WriteInt(HibernationEntries.Count);
            foreach (HibernationEntry hibernationEntry in HibernationEntries)
            {
                hibernationEntry.WriteBinary(archive);
            }
        }
Exemple #2
0
        public void WriteBinary(ArkArchive archive, WritingOptions options)
        {
            archive.WriteInt(TribeVersion);
            archive.WriteInt(Objects.Count);

            foreach (GameObject gameObject in Objects)
            {
                propertiesBlockOffset = gameObject.WriteBinary(archive, propertiesBlockOffset);
            }

            foreach (GameObject gameObject in Objects)
            {
                gameObject.WriteProperties(archive, 0);
            }
        }
 private void writeBinaryDataFilesObjectMap(ArkArchive archive)
 {
     archive.WriteInt(DataFilesObjectMap.Count);
     foreach (int key in DataFilesObjectMap.Keys)
     {
         foreach (string[] namesList in DataFilesObjectMap[key])
         {
             archive.WriteInt(key);
             archive.WriteInt(namesList.Length);
             foreach (string name in namesList)
             {
                 archive.WriteString(name);
             }
         }
     }
 }
Exemple #4
0
        private MemoryStream toBuffer()
        {
            int size = sizeof(int);

            NameSizeCalculator nameSizer = ArkArchive.GetNameSizer(false);

            size += Objects.Sum(o => o.Size(nameSizer));

            int propertiesBlockOffset = size;

            size += Objects.Sum(o => o.PropertiesSize(nameSizer));

            MemoryStream buffer  = new MemoryStream(new byte[size], true);
            ArkArchive   archive = new ArkArchive(buffer);

            archive.WriteInt(Objects.Count);

            foreach (GameObject gameObject in Objects)
            {
                propertiesBlockOffset = gameObject.WriteBinary(archive, propertiesBlockOffset);
            }

            foreach (GameObject gameObject in Objects)
            {
                gameObject.WriteProperties(archive, 0);
            }

            return(buffer);
        }
        private void writeNameTable(ArkArchive archive)
        {
            archive.Position = nameTableOffset;
            List <string> nameTable = archive.NameTable;

            archive.WriteInt(nameTable.Count);
            nameTable.ForEach(archive.WriteString);
        }
Exemple #6
0
        public void WriteBinary(ArkArchive archive, WritingOptions options)
        {
            archive.WriteString(className);

            Properties?.ForEach(p => p.WriteBinary(archive));

            archive.WriteName(ArkName.NameNone);
            archive.WriteInt(0);
        }
        public void WriteBinary(ArkArchive archive)
        {
            archive.WriteFloat(X);
            archive.WriteFloat(Y);
            archive.WriteFloat(Z);
            archive.WriteByte(UnkByte);
            archive.WriteFloat(UnkFloat);

            archive.WriteInt(nameTableSize);
            ArkArchive nameArchive = archive.Slice(nameTableSize);

            nameArchive.WriteInt(3);

            nameArchive.WriteInt(nameTable.Count);
            nameTable.ForEach(nameArchive.WriteString);

            nameArchive.WriteInt(ZoneVolumes.Count);
            ZoneVolumes.ForEach(nameArchive.WriteName);

            archive.WriteInt(objectsSize);
            ArkArchive objectArchive = archive.Slice(objectsSize);

            objectArchive.WriteInt(Objects.Count);

            int currentOffset = propertiesStart;

            foreach (GameObject gameObject in Objects)
            {
                currentOffset = gameObject.WriteBinary(objectArchive, currentOffset);
            }

            objectArchive.SetNameTable(nameTable, 0, true);
            foreach (GameObject gameObject in Objects)
            {
                gameObject.WriteProperties(objectArchive, 0);
            }

            archive.WriteInt(UnkInt1);
            archive.WriteInt(ClassIndex);
        }
        private void writeBinaryObjects(ArkArchive archive)
        {
            archive.WriteInt(Objects.Count);

            // Position of properties data is absolute
            // or Position of properties data is relative to propertiesBlockOffset
            int currentOffset = SaveVersion == 5 ? propertiesBlockOffset : 0;

            foreach (GameObject gameObject in Objects)
            {
                currentOffset = gameObject.WriteBinary(archive, currentOffset);
            }
        }
        private void writeBinaryHeader(ArkArchive archive)
        {
            archive.WriteShort(SaveVersion);

            if (SaveVersion > 6)
            {
                archive.WriteInt(hibernationOffset);
                archive.WriteInt(0);
            }

            if (SaveVersion > 5)
            {
                archive.WriteInt(nameTableOffset);
                archive.WriteInt(propertiesBlockOffset);
            }

            archive.WriteFloat(GameTime);

            if (SaveVersion > 8)
            {
                archive.WriteInt(SaveCount);
            }
        }
 private void writeBinaryEmbeddedData(ArkArchive archive)
 {
     archive.WriteInt(EmbeddedData.Count);
     EmbeddedData.ForEach(ed => ed.WriteBinary(archive));
 }
 private void writeBinaryDataFiles(ArkArchive archive)
 {
     archive.WriteInt(DataFiles.Count);
     DataFiles.ForEach(archive.WriteString);
 }