/// <summary> /// Sucht alle Pointer auf das IRepointable Objekt, ändert sie, sodass sie auf das neue Offset zeigen und schreibt das /// Objekt an die neue Stelle /// </summary> /// <param name="data">Ein Objekt welches IRepointable implementiert</param> /// <param name="newOffset">Die neue Position des Objekts</param> public void Repoint(IRepointable data, UInt32 newOffset) { newOffset |= 0x8000000; UInt32 oldOffset = data.GetCurrentOffset() | 0x8000000; var oldOffsets = new List<int>(); oldOffsets.AddRange(FindByteSequence(BitConverter.GetBytes(oldOffset))); foreach (int offset in oldOffsets) { SetStreamOffset(offset); WriteUInt32(newOffset); } SetStreamOffset(data.GetCurrentOffset()); WriteByteArray(Enumerable.Repeat((byte) 0xFF, data.GetOriginalSize()).ToArray()); SetStreamOffset(newOffset & 0x1FFFFFF); WriteToRom(data); }
public void WriteToRom(IRepointable data) { data.SetCurrentOffset((uint) _romstream.Position); WriteByteArray(data.GetRawData()); }