private void Init(Stream input)
        {
            if (input.Length < 0x100)
            {
                throw new Exception(
                          "Invalid Savedata!\nData is too short for it to be valid, please select a valid save file");
            }
            long val = input.ReadInt32(true);

            if (val != (long)PackageHeader.Mc02)
            {
                input.Position -= 4;
                val             = input.ReadInt64(true);
                if (val != (long)PackageHeader.Fb)
                {
                    throw new Exception("Invalid Package Header!");
                }
            }
            PackageHeader = (PackageHeader)val;
            bool isbigendian = PackageHeader == PackageHeader.Mc02;

            if (PackageHeader == PackageHeader.Mc02)
            {
                InitMcPackage(input);
            }
            else
            {
                InitFbPackage(input);
            }
            uint hash = input.ReadUInt32(isbigendian);

            Header = input.ReadBytes(HeaderLength - 4);
            var crc = new DA3CRC();

            if (crc.Compute(Header) != hash)
            {
                throw new Exception(
                          "Header data did not pass intergrity check!\nPlease choose a valid unmodified save to proceed");
            }
            hash = input.ReadUInt32(isbigendian);
            var  data  = input.ReadBytes(DataLength - 4);
            uint xhash = crc.Compute(data);

            if (hash != xhash)
            {
                throw new Exception(
                          "Save data did not pass the intergrity check!\nPlease choose a valid unmodified save to proceed");
            }

            var xio = new DAIIO(data, isbigendian);

            DataStructure = new SaveDataStructure().Read(xio);
            xio.Close();
        }
Beispiel #2
0
 public StoreInventory(SaveDataStructure xstruct)
 {
     SStructure = xstruct;
 }
Beispiel #3
0
 public LootManager(SaveDataStructure strx)
 {
     SStStructure = strx;
 }
 public PartyPlayerManager(SaveDataStructure xstruc)
 {
     SStructure = xstruc;
 }
 public TerrainPart(SaveDataStructure xstruct)
 {
     SStructure = xstruct;
 }
Beispiel #6
0
 public WorldStateManager(SaveDataStructure xstruct)
 {
     SStructure = xstruct;
 }
Beispiel #7
0
 public BWMapManager(SaveDataStructure xstruc)
 {
     SStructure = xstruc;
 }
Beispiel #8
0
 public MissionArray(SaveDataStructure xstruc, bool isfirst)
 {
     SStructure = xstruc;
     _isfirst   = isfirst;
 }
 public OwnerInfo(SaveDataStructure xstruct)
 {
     SStructure = xstruct;
 }
Beispiel #10
0
 public SaveEntity(SaveDataStructure xstr)
 {
     xstruct = xstr;
 }
Beispiel #11
0
 public MissionManager(SaveDataStructure xstruc)
 {
     SStructure = xstruc;
 }
 public WarTableEntry(SaveDataStructure xstruc, bool isfirst)
 {
     SStructure = xstruc;
     _isfirst   = isfirst;
 }
Beispiel #13
0
 public ImpactEntityDestructionComplex(SaveDataStructure xstruct)
 {
     SStructure = xstruct;
 }
Beispiel #14
0
 public AgentEntity(SaveDataStructure xstruct)
 {
     SStructure = xstruct;
 }
Beispiel #15
0
 public EntityMeta(SaveDataStructure xstr)
 {
     xstruct = xstr;
 }
 public PartDestructionComplex(SaveDataStructure xstruct)
 {
     SStructure = xstruct;
 }
 public TerrainManager(SaveDataStructure xstruct)
 {
     SStructure = xstruct;
 }