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 = (uint)this.Name; this.MetaStructure.textureDictionary = (uint)this.TextureDictionary; this.MetaStructure.clipDictionary = (uint)this.ClipDictionary; this.MetaStructure.drawableDictionary = (uint)this.DrawableDictionary; this.MetaStructure.physicsDictionary = (uint)this.PhysicsDictionary; this.MetaStructure.assetType = this.AssetType; this.MetaStructure.assetName = (uint)this.AssetName; // Extensions var extPtrs = new List <MetaPOINTER>(); /* * if (this.ExtensionDefLightEffects != null) * this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefLightEffect, this.ExtensionDefLightEffects.Select(e => { e.Build(mb); return e.MetaStructure; })); * * if (this.ExtensionDefSpawnPointOverrides != null) * this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefSpawnPointOverride, this.ExtensionDefSpawnPointOverrides.Select(e => { e.Build(mb); return e.MetaStructure; })); * * if (this.ExtensionDefDoors != null) * this.AddMetaPointers(mb, extPtrs, MetaName.CExtensionDefDoor, this.ExtensionDefDoors.Select(e => { e.Build(mb); return e.MetaStructure; })); * * if (this.rage__PhVerletClothCustomBounds != null) * this.AddMetaPointers(mb, extPtrs, MetaName.rage__phVerletClothCustomBounds, this.rage__PhVerletClothCustomBounds.Select(e => { e.Build(mb); return e.MetaStructure; })); */ this.MetaStructure.extensions = mb.AddPointerArray(extPtrs.ToArray()); MCBaseArchetypeDef.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(); }