public TagAnalyzer(TagCache cache, HaloTag tag) { _cache = cache; _tag = tag; _tagMap = BuildTagMap(tag); _dataFixupsByWriteOffset = _tag.DataFixups.ToDictionary(f => f.WriteOffset); _resourceFixupsByWriteOffset = _tag.ResourceFixups.ToDictionary(f => f.WriteOffset); }
/// <summary> /// Builds a memory map for a tag. /// </summary> /// <param name="tag">The tag to build a memory map for.</param> /// <returns>The built map.</returns> private static MemoryMap BuildTagMap(HaloTag tag) { // Create a memory map with a boundary at each fixup target // and at the main structure var result = new MemoryMap(0, tag.Size); result.AddBoundary(tag.MainStructOffset); result.AddBoundaries(tag.DataFixups.Select(f => f.TargetOffset)); return result; }