/// <summary> /// Writes the link data to a SaveWriter at its current position. /// </summary> /// <param name="writer">The SaveWriter to write the new link data to.</param> public void Update(SaveIO.SaveWriter writer) { writer.WriteUInt32(Size); writer.WriteUInt32(ID); writer.WriteUInt32(NextLinkOffset); writer.WriteUInt32(PreviousLinkOffset); }
public void Update(SaveIO.SaveWriter writer) { writer.Seek(_offset, SeekOrigin.Begin); writer.WriteUInt16((ushort)(_id >> 16)); writer.WriteUInt16((ushort)_flags.Data); writer.WriteUInt16((ushort)((ushort)_tagGroup << 8)); writer.WriteUInt16(_type); writer.WriteUInt32(_poolOffset); writer.WriteUInt32(_memAddress); }
/// <summary> /// Updates any changes made to this chunk. /// </summary> /// <param name="writer">The SaveWriter to write to.</param> public void Update(SaveIO.SaveWriter writer) { long baseAddress = _entryListStart - 0x54; writer.Seek(baseAddress + 0x34, SeekOrigin.Begin); writer.WriteUInt32(_firstDeleted); writer.WriteUInt32(_nextFree); writer.WriteUInt32(_activeEntries); // Null out deleted datum indices by setting their high word to 0 foreach (uint index in _deletedEntries) { writer.Seek(baseAddress + 0x54 + index * _entrySize, SeekOrigin.Begin); writer.WriteUInt16(0); } }
protected override void DoUpdate(SaveIO.SaveWriter writer, long start) { base.DoUpdate(writer, start); // Actor writer.Seek(start + 0x1BC, SeekOrigin.Begin); if (_actor != null) { writer.WriteUInt32(_actor.DatumIndex); } else { writer.WriteUInt32(0xFFFFFFFF); } // Unit flags writer.Seek(start + 0x1C4, SeekOrigin.Begin); writer.WriteInt32(_unitFlags.Data); // Team writer.Seek(start + 0x1C8, SeekOrigin.Begin); writer.WriteByte(_team); // Write weapon index info writer.Seek(start + 0x340, SeekOrigin.Begin); writer.WriteUInt16((ushort)(_weapons.Count + 2)); writer.WriteSByte(_currentWeaponIndex); writer.Skip(1); writer.WriteUInt16((ushort)(_weapons.Count + 2)); writer.WriteSByte(_backupWeaponIndex); writer.Skip(1); // Write the weapon list foreach (WeaponObject weapon in _weapons) { writer.WriteUInt32(weapon.ID); } // Write empty spots for (int i = _weapons.Count; i < 4; i++) { writer.WriteUInt32(0xFFFFFFFF); } }
protected override void DoUpdate(SaveIO.SaveWriter writer, long start) { base.DoUpdate(writer, start); // Player data writer.Seek(start + 0xF0, SeekOrigin.Begin); if (_player != null) { writer.WriteUInt32(_player.ID); } else { writer.WriteUInt32(0xFFFFFFFF); } writer.Seek(start + 0x1B4, SeekOrigin.Begin); if (Carrier != null && Carrier.TagGroup == TagGroup.Bipd) { writer.WriteUInt32(Carrier.ID); writer.WriteUInt32(Carrier.ID); } else { writer.WriteUInt32(0xFFFFFFFF); writer.WriteUInt32(0xFFFFFFFF); } // This ID writer.WriteUInt32(ID); }
internal void Update(SaveIO.SaveWriter writer) { writer.Seek(_dataPosition + 0x28, SeekOrigin.Begin); writer.WriteUInt32(_biped.ID); writer.Seek(_dataPosition + 0x34, SeekOrigin.Begin); writer.WriteUInt32(_biped.ID); writer.Seek(_dataPosition + 0x5C, SeekOrigin.Begin); if (PrimaryWeapon != null) { writer.WriteUInt32(PrimaryWeapon.ID); } else { writer.WriteUInt32(0xFFFFFFFF); } if (SecondaryWeapon != null) { writer.WriteUInt32(SecondaryWeapon.ID); } else { writer.WriteUInt32(0xFFFFFFFF); } }
protected override void DoUpdate(SaveIO.SaveWriter writer, long start) { base.DoUpdate(writer, start); writer.Seek(start + 0x388, SeekOrigin.Begin); if (_driver != null) { writer.WriteUInt32(_driver.ID); } else { writer.WriteUInt32(0xFFFFFFFF); } if (_controller != null) { writer.WriteUInt32(_controller.ID); } else { writer.WriteUInt32(0xFFFFFFFF); } }
private void WriteMainHeader(SaveIO.SaveWriter writer) { // Write the new header to a MemoryStream for resigning purposes MemoryStream tempStream = new MemoryStream(HeaderSize - CRC32Size); SaveIO.SaveWriter tempWriter = new SaveIO.SaveWriter(tempStream); tempWriter.WriteUInt32(_unknown); tempWriter.WriteInt32(_cfgSize); tempWriter.WriteInt32(_dataBlock1Size); tempWriter.WriteInt32(_dataBlock2Size); tempWriter.WriteInt32(_saveDataSize); // Grab its CRC32 CRC32 crc32 = new CRC32(); byte[] checksum = crc32.ComputeHash(tempStream.GetBuffer()); // Now write it to the destination stream writer.WriteBlock(checksum); writer.WriteBlock(tempStream.GetBuffer()); tempWriter.Close(); }
/// <summary> /// Writes the DatumIndex out to a SaveWriter. /// </summary> /// <param name="writer">The SaveWriter to write to.</param> public void WriteTo(SaveIO.SaveWriter writer) { writer.WriteUInt32(Value); }
/// <summary> /// Override this to write out any changed properties. /// </summary> /// <param name="writer">The SaveWriter to write to</param> /// <param name="start">The start of the object's data</param> protected virtual void DoUpdate(SaveIO.SaveWriter writer, long start) { // If the object's position has changed, awaken it if (_x != _originalX || _y != _originalY || _z != _originalZ || !_velocity.Equals(_originalVelocity)) { IsAwake = true; } writer.Seek(start + 0x4, SeekOrigin.Begin); writer.WriteInt32(_flags.Data); writer.WriteUInt16(_zone); writer.Seek(2, SeekOrigin.Current); if (_nextCarried != null) { writer.WriteUInt32(_nextCarried.ID); } else { writer.WriteUInt32(0xFFFFFFFF); } if (_firstCarried != null) { writer.WriteUInt32(_firstCarried.ID); } else { writer.WriteUInt32(0xFFFFFFFF); } if (_carrier != null) { writer.WriteUInt32(_carrier.ID); } else { writer.WriteUInt32(0xFFFFFFFF); } writer.WriteSByte(_parentNodeIndex); writer.Seek(start + 0x20, SeekOrigin.Begin); writer.WriteFloat(_x); writer.WriteFloat(_y); writer.WriteFloat(_z); /*writer.WriteFloat(_boundsX1); * writer.WriteFloat(_boundsY1); * writer.WriteFloat(_boundsZ1);*/ writer.Seek(4, SeekOrigin.Current); writer.WriteFloat(_x); writer.WriteFloat(_y); writer.WriteFloat(_z); /*writer.WriteFloat(_boundsX2); * writer.WriteFloat(_boundsY2); * writer.WriteFloat(_boundsZ2);*/ writer.Seek(8, SeekOrigin.Current); writer.WriteFloat(_x); writer.WriteFloat(_y); writer.WriteFloat(_z); writer.WriteFloat(_right.X); writer.WriteFloat(-_right.Y); // hax writer.WriteFloat(_right.Z); writer.WriteFloat(_up.X); writer.WriteFloat(-_up.Y); // hax writer.WriteFloat(_up.Z); writer.Seek(start + 0x68, SeekOrigin.Begin); writer.WriteFloat(_velocity.X); writer.WriteFloat(_velocity.Y); writer.WriteFloat(_velocity.Z); writer.Seek(start + 0x80, SeekOrigin.Begin); // Scale is stored twice?? writer.WriteFloat(_scale); writer.WriteFloat(_scale); writer.Seek(start + 0xDC, SeekOrigin.Begin); writer.WriteInt32(_physicsFlags.Data); writer.Seek(start + 0x13C, SeekOrigin.Begin); writer.WriteInt32(_invincibilityFlags.Data); // Write strength info writer.Seek(start + 0x110, SeekOrigin.Begin); _healthInfo.WriteTo(writer); if (_nodeDataOffset != 0xFFFF) { writer.Seek(start + _nodeDataOffset, SeekOrigin.Begin); foreach (ModelNode node in _nodes) { node.Update(writer, this); } } }