public override void Build(MetaBuilder mb, bool isRoot = false) { this.MetaStructure.lodDist = this.LodDist; this.MetaStructure.flags = this.Flags; this.MetaStructure.specialAttribute = this.SpecialAttribute; this.MetaStructure.bbMin = this.BbMin; this.MetaStructure.bbMax = this.BbMax; this.MetaStructure.bsCentre = this.BsCentre; this.MetaStructure.bsRadius = this.BsRadius; this.MetaStructure.hdTextureDist = this.HdTextureDist; this.MetaStructure.name = this.Name; this.MetaStructure.textureDictionary = this.TextureDictionary; this.MetaStructure.clipDictionary = this.ClipDictionary; this.MetaStructure.drawableDictionary = this.DrawableDictionary; this.MetaStructure.physicsDictionary = this.PhysicsDictionary; this.MetaStructure.assetType = this.AssetType; this.MetaStructure.assetName = this.AssetName; this.MetaStructure.extensions = new Array_StructurePointer(); this.MetaStructure.timeFlags = this.TimeFlags; MCTimeArchetypeDef.AddEnumAndStructureInfo(mb); if (isRoot) { mb.AddItem(this.MetaName, this.MetaStructure); this.Meta = mb.GetMeta(); } }
public override void Parse(MetaFile meta, CMapTypes CMapTypes) { this.Meta = meta; this.MetaStructure = CMapTypes; // this.Extensions = CMapTypes.extensions; // CBaseArchetypeDef + CMloArchetypeDef + CTimeArchetypeDef var archPtrs = MetaUtils.GetPointerArray(this.Meta, this.MetaStructure.archetypes); if (archPtrs != null) { for (int i = 0; i < archPtrs.Length; i++) { var ptr = archPtrs[i]; var block = Meta.GetBlock(ptr.BlockID); if (block == null) { continue; } if ((ptr.Offset < 0) || (block.Data == null) || (ptr.Offset >= block.Data.Length)) { continue; } byte[] data = Array.ConvertAll(block.Data.ToArray(), e => (byte)e); switch ((MetaName)block.StructureNameHash) { case MetaName.CBaseArchetypeDef: { var struc = PsoUtils.ConvertDataRaw <RageLib.Resources.GTA5.PC.Meta.CBaseArchetypeDef>(data, ptr.Offset); var arch = new MCBaseArchetypeDef(); arch.Parse(meta, struc); this.Archetypes.Add(arch); break; } case MetaName.CMloArchetypeDef: { var struc = PsoUtils.ConvertDataRaw <RageLib.Resources.GTA5.PC.Meta.CMloArchetypeDef>(data, ptr.Offset); var arch = new MCMloArchetypeDef(); arch.Parse(meta, struc); this.MloArchetypes.Add(arch); break; } case MetaName.CTimeArchetypeDef: { var struc = PsoUtils.ConvertDataRaw <RageLib.Resources.GTA5.PC.Meta.CTimeArchetypeDef>(data, ptr.Offset); var arch = new MCTimeArchetypeDef(); arch.Parse(meta, struc); this.TimeArchetypes.Add(arch); break; } default: continue; } } } this.Name = (MetaName)CMapTypes.name; // this.Dependencies = CMapTypes.dependencies; var compositeEntityTypes = MetaUtils.ConvertDataArray <CCompositeEntityType>(meta, CMapTypes.compositeEntityTypes); this.CompositeEntityTypes = compositeEntityTypes?.Select(e => { var msw = new MCCompositeEntityType(); msw.Parse(meta, e); return(msw); }).ToList(); }