private void readBinaryNameTable(ArkArchive archive)
        {
            int version = archive.ReadInt();

            if (version != 3)
            {
                archive.DebugMessage($"Found unknown Version {version}", -4);
                throw new NotSupportedException();
            }

            int count = archive.ReadInt();

            nameTable = new List <string>(count);

            for (int index = 0; index < count; index++)
            {
                nameTable.Add(archive.ReadString());
            }

            int zoneCount = archive.ReadInt();

            for (int index = 0; index < zoneCount; index++)
            {
                ZoneVolumes.Add(archive.ReadName());
            }
        }
Exemplo n.º 2
0
        private ArkArchive(ArkArchive toClone, int size)
        {
            if (toClone.mbb.Position + size > toClone.mbb.Length)
            {
                toClone.DebugMessage($"Requesting {size} bytes with only {toClone.mbb.Length - toClone.mbb.Position} bytes available");
                throw new ArgumentOutOfRangeException(nameof(size));
            }

            totalOffset = toClone.totalOffset + toClone.mbb.Position;
            mbb         = new MemoryStream(toClone.mbbReader.ReadBytes(size));
            mbbReader   = new BinaryReader(mbb);
            state       = toClone.state;
            isSlice     = true;
        }
Exemplo n.º 3
0
        private void readBinaryHibernation(ArkArchive archive, ReadingOptions options)
        {
            if (!options.Hibernation)
            {
                hibernationV8Unknown1 = 0;
                hibernationV8Unknown2 = 0;
                hibernationV8Unknown3 = 0;
                hibernationV8Unknown4 = 0;
                hibernationUnknown1   = 0;
                hibernationUnknown2   = 0;
                hibernationClasses.Clear();
                hibernationIndices.Clear();
                HibernationEntries.Clear();
                archive.HasUnknownData = true;
                return;
            }

            archive.Position = hibernationOffset;

            if (SaveVersion > 7)
            {
                hibernationV8Unknown1 = archive.ReadInt();
                hibernationV8Unknown2 = archive.ReadInt();
                hibernationV8Unknown3 = archive.ReadInt();
                hibernationV8Unknown4 = archive.ReadInt();
            }

            // No hibernate section if we reached the nameTable
            if (archive.Position == nameTableOffset)
            {
                return;
            }

            hibernationUnknown1 = archive.ReadInt();
            hibernationUnknown2 = archive.ReadInt();

            int hibernatedClassesCount = archive.ReadInt();

            hibernationClasses.Clear();
            hibernationClasses.Capacity = hibernatedClassesCount;
            for (int index = 0; index < hibernatedClassesCount; index++)
            {
                hibernationClasses.Add(archive.ReadString());
            }

            int hibernatedIndicesCount = archive.ReadInt();

            if (hibernatedIndicesCount != hibernatedClassesCount)
            {
                archive.DebugMessage("hibernatedClassesCount does not match hibernatedIndicesCount");
                throw new NotSupportedException();
            }

            hibernationIndices.Clear();
            hibernationIndices.Capacity = hibernatedIndicesCount;
            for (int index = 0; index < hibernatedIndicesCount; index++)
            {
                hibernationIndices.Add(archive.ReadInt());
            }

            int hibernatedObjectsCount = archive.ReadInt();

            HibernationEntries.Clear();
            HibernationEntries.Capacity = hibernatedObjectsCount;
            for (int index = 0; index < hibernatedObjectsCount; index++)
            {
                HibernationEntries.Add(new HibernationEntry(archive, options));
            }
        }