Beispiel #1
0
        public SaveDataStructure Read(DAIIO io)
        {
            byte[] xdm = io.ReadBytes(0x41, false);
            if (!xdm.MemCompare(DataMagic, 0))
            {
                throw new Exception("Invalid Save Data Header!");
            }
            SavedTime = io.ReadInt64().ToUnixTime();
            ushort count = io.ReadUInt16();

            SID               = io.ReadString(count);
            GameVersion       = io.ReadUInt16();
            SaveVersion       = io.ReadUInt16();
            ProjectVersion    = io.ReadUInt16();
            BitstreamFeatures = io.ReadUInt16();
            ChangeList        = io.ReadUInt32();
            count             = io.ReadUInt16();
            Level             = io.ReadString(count);
            Difficulty        = io.ReadUInt32();
            BundleCount       = io.ReadUInt16();
            BundleList        = new string[BundleCount];
            for (int i = 0; i < BundleCount; i++)
            {
                count         = io.ReadUInt16();
                BundleList[i] = io.ReadString(count);
            }
            InclusionCount = io.ReadUInt16();
            Inclusions     = new Inclusion[InclusionCount];
            for (int i = 0; i < InclusionCount; i++)
            {
                Inclusions[i] = new Inclusion().Read(io);
            }
            SubLevelInfoCount = io.ReadBit2(0xc);
            if (SubLevelInfoCount <= 0x40 && SubLevelInfoCount > 0)
            {
                SubLevelEntries = new SubLevelInfo[SubLevelInfoCount];
                for (int i = 0; i < SubLevelInfoCount; i++)
                {
                    SubLevelEntries[i] = new SubLevelInfo().Read(io);
                }
            }
            LevelChecksum = new byte[0x10];
            for (int i = 0; i < 0x10; i++)
            {
                LevelChecksum[i] = (byte)io.ReadBit(0x8);
            }
            DLC                   = io.ReadBit2(0x14);
            EntityVersion         = (short)io.ReadBit2(0x10);
            ProjectVersionContext = (short)io.ReadBit2(0x10);
            HasDebugInfo          = io.ReadBoolean();
            AgentTocBookmark      = io.ReadBit2(0x1A);
            ClientDataBookmark    = io.ReadBit2(0x1A);
            EntityContentLength   = io.ReadBit2(0x20);
            ///////////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////UNFINISHED SECTION!!!!!/////////////////////////////////
            var xpos = io.Position;                                                         ////////

            EntityContent = new EntityData(this).Read(io);                                  ////////
            tmpdata       = io.ReadData((int)(EntityContentLength - (io.Position - xpos))); ////////
            //////////////////////////////////////////////////////////////////////////////////
            SaveEntityComplexLength = io.ReadBit2(6);


            SaveEntityComplex  = io.ReadData((int)SaveEntityComplexLength);
            SaveEntityBookmark = io.ReadBit2(0x1A);
            SaveEntity         = new SaveEntity(this).Read(io);


            EntityMetaData = new EntityMeta(this).Read(io);
            AgentToc       = new AgentToc().Read(io);
            //var xdio = new DAIIO(io.xbaseStream, io.Position, ClientDataLength) {IsBigEndian = true};
            ClientData = new ClientAgent().Read(io);
            //io.Position += ClientDataLength;
            LastPartSeedLength = (int)(io.Length - io.Position);
            if (LastPartSeedLength > 0)
            {
                LastPartSeed = io.ReadBit2((uint)LastPartSeedLength);
            }
            return(this);
        }