internal void Read(IBitReader reader)
 {
     reader.PushFrameLength(24);
     this._Unknown1 = reader.ReadUInt32();
     this._Unknown2 = reader.ReadBoolean();
     this._Unknown3 = reader.ReadBoolean();
     reader.PopFrameLength();
 }
예제 #2
0
        internal void Read(IBitReader reader, uint version)
        {
            reader.PushFrameLength(24);
            var dataBytesLength = reader.ReadUInt32();

            this._DataBytes = reader.ReadBytes((int)dataBytesLength);
            this._Unknown1  = version >= 6 && reader.ReadBoolean();
            this._Unknown2  = version >= 6 && reader.ReadBoolean();
            reader.PopFrameLength();
        }
 public void Read(IBitReader reader, int version)
 {
     this._Health    = reader.ReadFloat32();
     this._Unknown2  = reader.ReadBoolean();
     this._Unknown3  = reader.ReadBoolean();
     this._Shields   = reader.ReadFloat32();
     this._Unknown5  = reader.ReadUInt32();
     this._Unknown6  = reader.ReadUInt32();
     this._Unknown7  = reader.ReadUInt32();
     this._Unknown8  = reader.ReadFloat32();
     this._Unknown9  = reader.ReadUInt32();
     this._Unknown10 = reader.ReadUInt32();
     this._Unknown11 = reader.ReadUInt32();
     this._Unknown12 = reader.ReadFloat32();
 }
예제 #4
0
        public void Read(IBitReader reader, int version)
        {
            this._Unknown1 = reader.ReadUInt32();
            this._Unknown2 = version >= 10 && reader.ReadBoolean();

            for (int i = 0; i < this._PowerIds.Length; i++)
            {
                this._PowerIds[i] = reader.ReadUInt32();
            }

            for (int i = 0; i < this._RangedWeaponIds.Length; i++)
            {
                this._RangedWeaponIds[i] = reader.ReadUInt32();
            }

            this._MeleeWeaponId = reader.ReadUInt32();

            for (int i = 0; i < this._GearIds.Length; i++)
            {
                this._GearIds[i] = reader.ReadUInt32();
            }

            for (int i = 0; i < this._SpaceToolIds.Length; i++)
            {
                this._SpaceToolIds[i] = reader.ReadUInt32();
            }

            for (int i = 0; i < this._ConsumableIds.Length; i++)
            {
                this._ConsumableIds[i] = reader.ReadUInt32();
            }

            this._CasualOutfitId = reader.ReadUInt32();
        }
 public void Read(IBitReader reader)
 {
     reader.PushFrameLength(24);
     this._CurrentValue = reader.ReadFloat32();
     this._MaximumValue = reader.ReadFloat32();
     this._Unknown      = reader.ReadBoolean();
     reader.PopFrameLength();
 }
예제 #6
0
        internal override void Read1(IBitReader reader)
        {
            base.Read1(reader);
            var hasWaypoint = reader.ReadBoolean();

            if (hasWaypoint == true)
            {
                this._CurrentWaypoint = reader.ReadVector3();
            }
        }
 internal void Read(IBitReader reader)
 {
     reader.PushFrameLength(24);
     this._Unknown1 = reader.ReadUInt32();
     this._Unknown2 = reader.ReadBoolean();
     this._Unknown3 = reader.ReadUInt32();
     // TODO(gibbed): figure out what this actually
     this._Unknown4 = reader.ReadBytes(Math.Max(1, (int)((this._Unknown3 + 31) >> 5)) * 4);
     reader.PopFrameLength();
 }
 public override void Read(IBitReader reader, ushort version)
 {
     if (version >= 1)
     {
         reader.PushFrameLength(24);
         this._Unknown5 = reader.ReadUInt32();
         this._Unknown6 = reader.ReadUInt32();
         this._Unknown7 = reader.ReadBoolean();
         this._Unknown8 = reader.ReadUInt32();
         reader.PopFrameLength();
     }
     base.Read(reader, version);
 }
 internal override void Read2(IBitReader reader)
 {
     base.Read2(reader);
     if (this.ReadVersion >= 3)
     {
         this._Unknown1 = reader.ReadBoolean();
         if (this._Unknown1 == true)
         {
             this._Unknown2.Read(reader);
             this._Unknown3.Read(reader);
         }
     }
 }
예제 #10
0
        public void Read(IBitReader reader, int version)
        {
            var unknown1Count = reader.ReadUInt16();

            this._Unknown.Clear();
            for (int i = 0; i < unknown1Count; i++)
            {
                reader.PushFrameLength(24);
                var unknown1Key   = reader.ReadUInt32();
                var unknown1Value = reader.ReadBoolean();
                this._Unknown.Add(new KeyValuePair <uint, bool>(unknown1Key, unknown1Value));
                reader.PopFrameLength();
            }
        }
 internal override void Read3(IBitReader reader, ushort arg1)
 {
     base.Read3(reader, arg1);
     reader.PushFrameLength(24);
     if (arg1 >= 2)
     {
         this._NextItemId = reader.ReadUInt32();
     }
     this._HasActiveSquad = arg1 < 3 || reader.ReadBoolean();
     if (this._HasActiveSquad == true)
     {
         this._ActiveSquad.Read(reader);
     }
     reader.PopFrameLength();
 }
        public const ulong Signature = 0x0A45564153004246; // 'FB\0SAVE\n'

        public virtual void Read(IBitReader reader)
        {
            var magic = reader.ReadUInt64();

            if (magic != Signature)
            {
                throw new SaveFormatException("invalid save data signature");
            }

            var hasExtraValue = reader.ReadBoolean();

            if (hasExtraValue == true)
            {
                reader.SkipUInt32(27);
            }
        }
 internal void Read(IBitReader reader, uint version)
 {
     reader.PushFrameLength(20);
     this._Unknown1 = reader.ReadUInt32();
     this._Unknown2 = reader.ReadTransform();
     if (version >= 5)
     {
         this._Unknown3 = reader.ReadBoolean();
         if (this._Unknown3 == true)
         {
             this._Unknown4 = reader.ReadGuid();
             this._Unknown5 = reader.ReadGuid();
             this._Unknown6 = reader.ReadGuid();
         }
     }
     reader.PopFrameLength();
 }
예제 #14
0
        public override void Read(IBitReader reader, ushort version)
        {
            this._Unknown4 = reader.ReadBoolean();

            var modCount = Math.Min(5, (int)reader.ReadUInt16());

            for (int i = 0; i < modCount; i++)
            {
                reader.PushFrameLength(24);
                if (version >= 9)
                {
                    var modId = reader.ReadUInt32();
                    if (modId != 0)
                    {
                        reader.PushFrameLength(24);
                        var modItem = Components.InventoryComponent.ReadItemData(reader, version);
                        reader.PopFrameLength();
                        this._Mods.Add(new KeyValuePair <uint, ItemData>(modId, modItem));
                    }
                }
                else
                {
                    throw new NotSupportedException();
                }
                reader.PopFrameLength();
            }

            var augmentationCount = reader.ReadUInt16();

            for (int i = 0; i < augmentationCount; i++)
            {
                reader.PushFrameLength(24);
                var augmentationItemHash = reader.ReadUInt32();
                this._AugmentationItemHashes.Add(augmentationItemHash);
                reader.PopFrameLength();
            }

            this._CustomName = reader.ReadString();

            base.Read(reader, version);
        }
예제 #15
0
 public void Read(IBitReader reader, uint baseVersion)
 {
     this._Unknown1 = reader.ReadVector3();
     this._Unknown2 = reader.ReadVector3();
     this._Unknown3 = reader.ReadVector3();
     this._Unknown4 = reader.ReadVector3();
     this._Unknown5 = reader.ReadBoolean();
     if (this._Unknown5 == true)
     {
         this._Unknown6 = reader.ReadUInt32();
         this._Unknown7 = reader.ReadUInt32();
     }
     if (baseVersion > 9)
     {
         var vehicleCount = reader.ReadUInt32();
         this._Vehicles.Clear();
         for (uint i = 0; i < vehicleCount; i++)
         {
             var vehicle = new Data.PartyMemberVehicleData();
             vehicle.Read(reader);
             this._Vehicles.Add(vehicle);
         }
     }
 }
        public override void Read(IBitReader reader)
        {
            base.Read(reader);

            this._Timestamp    = ImportTimestamp(reader.ReadUInt64());
            this._SaveFileName = reader.ReadString();
            var gameVersion = reader.ReadUInt16();
            var saveVersion = reader.ReadUInt16();
            var unknown1    = reader.ReadUInt16(); // 10
            var unknown2    = reader.ReadUInt16(); // 0

            this._UserBuildInfo = reader.ReadUInt32();

            if (gameVersion != 3)
            {
                throw new SaveFormatException("unsupported save data game version");
            }

            if (saveVersion < 20 || saveVersion > 22)
            {
                throw new SaveFormatException("unsupported save data save version");
            }

            if (unknown1 != 10 || unknown2 != 0)
            {
                throw new SaveFormatException("unsupported save data header data");
            }

            this._LevelName = reader.ReadString();
            this._Unknown1  = reader.ReadUInt32();
            reader.ReadStringList(this._PreloadedBundleNames);
            reader.ReadStringDictionary(this._LayerInclusion);

            var bundleHeapCount = reader.ReadUInt16(12);

            this._BundleHeaps.Clear();
            for (int i = 0; i < bundleHeapCount; i++)
            {
                reader.PushFrameLength(24);
                var bundleHeap = new Data.BundleHeapInfo();
                bundleHeap.Unknown1 = reader.ReadString();
                bundleHeap.Unknown2 = reader.ReadUInt32();
                bundleHeap.Unknown3 = reader.ReadUInt32();
                bundleHeap.Type     = (Data.BundleHeapType)reader.ReadUInt8();
                bundleHeap.Unknown4 = reader.ReadUInt32();
                bundleHeap.Unknown5 = reader.ReadBoolean();
                bundleHeap.Unknown6 = reader.ReadUInt8();
                bundleHeap.Unknown7 = reader.ReadUInt8();
                bundleHeap.Unknown8 = reader.ReadUInt32();
                if (saveVersion < 17)
                {
                    reader.SkipBoolean();
                }
                this._BundleHeaps.Add(bundleHeap);
                reader.PopFrameLength();
            }

            var unknown3Count = reader.ReadUInt16(12);

            this._Unknown2.Clear();
            for (int i = 0; i < unknown3Count; i++)
            {
                reader.PushFrameLength(24);
                var instance = new Data.SaveDataUnknown0();
                instance.Unknown1 = reader.ReadUInt16();
                instance.Unknown2 = reader.ReadUInt16();
                instance.Unknown3 = reader.ReadUInt8();
                this._Unknown2.Add(instance);
                reader.PopFrameLength();
            }

            // not actually a Guid, but we will borrow it for sake of simplicity
            this._LevelHash = reader.ReadGuid();

            var unknown5 = reader.ReadUInt32(20);

            if (unknown5 != 0)
            {
                throw new NotImplementedException();
            }
            reader.SkipBits((int)unknown5); // TODO(gibbed): position move

            this._Unknown3 = reader.ReadUInt16();
            this._Unknown4 = this._Unknown3 >= 5 ? reader.ReadUInt16() : (ushort)0;
            this._Unknown5 = reader.ReadBoolean();

            reader.PushFramePosition(26);

            var componentDataPosition = reader.ReadUInt32(26);

            var entityBulkDataLength   = reader.ReadUInt32();
            var entityBulkDataPosition = reader.Position;

            reader.SkipBits((int)entityBulkDataLength);

            var unknown9 = reader.Position;

            reader.PushFrameLength(saveVersion >= 18 ? 24 : 6);
            reader.PushFrameLength(24);
            this._Unknown6 = reader.ReadString();
            this._Unknown7 = reader.ReadString();
            this._SaveName = reader.ReadString();
            reader.PopFrameLength();

            this._Unknown8  = reader.ReadUInt32();
            this._Unknown9  = reader.ReadGuid();
            this._Unknown10 = reader.ReadUInt32();
            reader.PopFrameLength();

            var unknown16 = reader.ReadUInt32(26);

            if (unknown9 != unknown16)
            {
                throw new FormatException();
            }

            var agentBulkDataLength   = reader.ReadUInt32();
            var agentBulkDataPosition = reader.Position;

            reader.SkipBits((int)agentBulkDataLength);

            var agentDataCount        = reader.ReadUInt8(4);
            var agentDataOffsetLookup = new Dictionary <byte, uint[]>();

            for (int i = 0; i < agentDataCount; i++)
            {
                var index            = reader.ReadUInt8();
                var agentDataOffsets = new uint[5];
                for (int j = 0; j < 5; j++)
                {
                    var agentDataOffset = agentDataOffsets[j] = reader.ReadUInt32(26);
                    if (agentDataOffset != 0)
                    {
                        if (agentDataOffset < agentBulkDataPosition ||
                            agentDataOffset > agentBulkDataPosition + agentBulkDataLength)
                        {
                            throw new FormatException();
                        }
                    }
                }
                agentDataOffsetLookup.Add(index, agentDataOffsets);
            }

            reader.PushFrameLength(24);

            var entityDataCount   = reader.ReadUInt16();
            var entityDataOffsets = new Dictionary <uint, Tuple <uint?, uint?> >();

            for (int i = 0; i < entityDataCount; i++)
            {
                var  entityId          = reader.ReadUInt32();
                uint?entityData0Offset = null;
                uint?entityData1Offset = null;

                var entityHasData0 = reader.ReadBoolean();
                if (entityHasData0 == true)
                {
                    var entityDataOffset = reader.ReadUInt32(26);
                    if (entityDataOffset < entityBulkDataPosition ||
                        entityDataOffset > entityBulkDataPosition + entityBulkDataLength)
                    {
                        throw new FormatException();
                    }
                    entityData0Offset = entityDataOffset;
                }

                var entityHasData1 = reader.ReadBoolean();
                if (entityHasData1 == true)
                {
                    var entityDataOffset = reader.ReadUInt32(26);
                    if (entityDataOffset < entityBulkDataPosition ||
                        entityDataOffset > entityBulkDataPosition + entityBulkDataLength)
                    {
                        throw new FormatException();
                    }
                    entityData1Offset = entityDataOffset;
                }

                entityDataOffsets.Add(entityId, new Tuple <uint?, uint?>(entityData0Offset, entityData1Offset));
            }

            var unknown17Count = reader.ReadUInt16();

            this._Unknown11.Clear();
            for (int i = 0; i < unknown17Count; i++)
            {
                this._Unknown11.Add(reader.ReadUInt32());
            }

            var unknown18Count = reader.ReadUInt16();

            for (int i = 0; i < unknown18Count; i++)
            {
                reader.PushFrameLength(24);
                var unknown19      = reader.ReadUInt32();
                var unknown20Count = reader.ReadUInt16();
                var unknown20      = new uint[unknown20Count];
                for (int j = 0; j < unknown20Count; j++)
                {
                    unknown20[j] = reader.ReadUInt32();
                }
                reader.PopFrameLength();
                throw new NotImplementedException();
            }

            var unknown12Count = reader.ReadUInt16();

            this._Unknown12.Clear();
            for (int i = 0; i < unknown12Count; i++)
            {
                this._Unknown12.Add(reader.ReadUInt32());
            }

            reader.PopFrameLength();

            reader.PopFramePosition();

            reader.PushFrameLength(24);
            var agentCount = reader.ReadUInt8(4);

            this._Agents.Clear();
            for (int i = 0; i < agentCount; i++)
            {
                var nameHash = reader.ReadUInt32();
                var index    = reader.ReadUInt8();
                var agent    = AgentFactory.Create(nameHash);
                agent.Read0(reader, index);
                this._Agents.Add(index, agent);
            }
            reader.PopFrameLength();

            if (reader.FrameCount != 0)
            {
                throw new SaveFormatException();
            }

            if (reader.Position != componentDataPosition)
            {
                throw new SaveFormatException();
            }

            reader.PushFrameLength(32);
            this._ComponentContainerAgents.Clear();
            this._Unknown13 = reader.ReadUInt16();
            if (this._Unknown13 == 1)
            {
                var componentCount = reader.ReadUInt16();
                for (int i = 0; i < componentCount; i++)
                {
                    reader.PushFrameLength(24);
                    var componentNameHash = reader.ReadUInt32();
                    var componentVersion  = reader.ReadUInt16();
                    var component         = ComponentContainerAgentFactory.Create(componentNameHash);
                    component.Read(reader, componentVersion);
                    reader.PopFrameLength();
                    this._ComponentContainerAgents.Add(component);
                }
            }
            reader.PopFrameLength();

            ReadAgentData(reader, this._Agents, agentDataOffsetLookup, 0, (r, t) => t.Read1(r, this._Unknown4));
            ReadAgentData(reader, this._Agents, agentDataOffsetLookup, 1, (r, t) => t.Read2(r));
            ReadAgentData(reader, this._Agents, agentDataOffsetLookup, 2, (r, t) => t.Read3(r, this._Unknown4));
            ReadAgentData(reader, this._Agents, agentDataOffsetLookup, 3, (r, t) => t.Read4(r));
            ReadAgentData(reader, this._Agents, agentDataOffsetLookup, 4, (r, t) => t.Read5(r));

            /*
             * var entities = new List<Entities.Entity>();
             * foreach (var kv in entityDataOffsets)
             * {
             *  var entityDataFirstOffset = kv.Value.Item1;
             *  var entityDataSecondOffset = kv.Value.Item2;
             *
             *  var entity = Entities.EntityFactory.Create(kv.Key);
             *
             *  if (entityDataFirstOffset.HasValue == true)
             *  {
             *      reader.Position = (int)entityDataFirstOffset.Value;
             *      reader.PushFrameLength(24);
             *      entity.Read0(reader);
             *      reader.PopFrameLength();
             *  }
             *
             *  if (entityDataSecondOffset.HasValue == true)
             *  {
             *      reader.Position = (int)entityDataSecondOffset.Value;
             *      reader.PushFrameLength(24);
             *      entity.Read1(reader);
             *      reader.PopFrameLength();
             *  }
             *
             *  entities.Add(entity);
             * }
             */

            this._Entities.Clear();
            foreach (var kv in entityDataOffsets)
            {
                var entityData0Offset = kv.Value.Item1;
                var entityData1Offset = kv.Value.Item2;
                var rawEntity         = new Entities.RawEntity();
                rawEntity.Id = kv.Key;
                if (entityData0Offset.HasValue == true)
                {
                    reader.Position       = (int)entityData0Offset.Value;
                    rawEntity.Data0Length = (int)reader.ReadUInt32(24);
                    rawEntity.Data0Bytes  = reader.ReadBits(rawEntity.Data0Length);
                }
                if (entityData1Offset.HasValue == true)
                {
                    reader.Position       = (int)entityData1Offset.Value;
                    rawEntity.Data1Length = (int)reader.ReadUInt32(24);
                    rawEntity.Data1Bytes  = reader.ReadBits(rawEntity.Data1Length);
                }
                this._Entities.Add(rawEntity);
            }

            if (reader.FrameCount != 0)
            {
                throw new SaveFormatException();
            }

            if (reader.HasUnreadBits() == true)
            {
                throw new SaveFormatException();
            }
        }
예제 #17
0
 public virtual void Read(IBitReader reader, ushort version)
 {
     this._Quantity = reader.ReadInt32();
     this._IsNew    = reader.ReadBoolean();
     this._Rarity   = reader.ReadInt32();
 }
예제 #18
0
        public virtual void Read(IBitReader reader, ushort version)
        {
            this._ComponentContainers.Clear();

            if (version == 2)
            {
                var componentContainerVersion = reader.ReadUInt16();

                reader.PushFrameLength(24);

                var componentContainerCount = reader.ReadUInt16();
                for (int i = 0; i < componentContainerCount; i++)
                {
                    reader.PushFrameLength(24);

                    var componentContainerId = reader.ReadUInt32();
                    ComponentContainer componentContainer = null;

                    var hasComponents = reader.ReadBoolean();
                    if (hasComponents == true)
                    {
                        componentContainer = new ComponentContainer();

                        if (componentContainerVersion >= 2)
                        {
                            componentContainer.Unknown1 = reader.ReadBoolean();
                        }

                        if (componentContainerVersion >= 3)
                        {
                            componentContainer.Unknown2 = reader.ReadString();
                        }

                        var componentCount = reader.ReadUInt16();
                        for (int j = 0; j < componentCount; j++)
                        {
                            reader.PushFrameLength(24);

                            var componentNameHash = reader.ReadUInt32();

                            var component = ComponentFactory.Create(componentNameHash);
                            if (component == null)
                            {
                                throw new InvalidOperationException();
                            }

                            component.Read(reader, componentContainerVersion);
                            componentContainer.Components.Add(component);

                            reader.PopFrameLength();
                        }
                    }

                    this._ComponentContainers.Add(componentContainerId, componentContainer);

                    reader.PopFrameLength();
                }

                reader.PopFrameLength();
            }
        }
 internal void Read(IBitReader reader, uint version)
 {
     this._Level = reader.ReadInt32();
     this._IsNew = version >= 5 && reader.ReadBoolean();
 }