示例#1
0
        public static T GetRootItem <T>(PsoFile pso) where T : struct, IPsoSwapEnd
        {
            var i = pso.DataMapSection.RootId - 1;
            var e = pso.DataMapSection.Entries[i];

            return(GetItem <T>(pso, e.Offset));
        }
示例#2
0
        public void Load(byte[] data, RpfFileEntry entry)
        {
            //MemoryStream ms = new MemoryStream(data);

            FileEntry = entry;

            MemoryStream ms = new MemoryStream(data);

            if (PsoFile.IsPSO(ms))
            {
                Pso = new PsoFile();
                Pso.Load(ms);

                //PsoTypes.EnsurePsoTypes(Pso);

                var root = PsoTypes.GetRootEntry(Pso);
                if (root != null)
                {
                }
                return;
            }
            else
            {
            }
        }
示例#3
0
        public static PsoDataMappingEntry GetRootEntry(PsoFile pso)
        {
            var i = pso.DataMapSection.RootId - 1;
            var e = pso.DataMapSection.Entries[i];

            return(e);
        }
示例#4
0
 public void Load(PsoFile pso)
 {
     Data          = PsoTypes.GetRootItem <CScenarioPointManifest>(pso);
     RegionDefs    = PsoTypes.ConvertDataArray <CScenarioPointRegionDef>(pso, _Data.RegionDefs);
     Groups        = PsoTypes.ConvertDataArray <CScenarioPointGroup>(pso, _Data.Groups);
     InteriorNames = PsoTypes.GetHashArray(pso, _Data.InteriorNames);
 }
示例#5
0
        public PsoFile GetPso()
        {
            PsoFile pso = new PsoFile();

            pso.SchemaSection = new PsoSchemaSection();

            var schEntries = new List <PsoElementInfo>();

            foreach (var structInfo in StructureInfos.Values)
            {
                schEntries.Add(structInfo);
            }
            foreach (var enumInfo in EnumInfos.Values)
            {
                schEntries.Add(enumInfo);
            }
            pso.SchemaSection.Entries    = schEntries.ToArray();
            pso.SchemaSection.EntriesIdx = new PsoElementIndexInfo[schEntries.Count];
            for (int i = 0; i < schEntries.Count; i++)
            {
                pso.SchemaSection.EntriesIdx[i]          = new PsoElementIndexInfo();
                pso.SchemaSection.EntriesIdx[i].NameHash = schEntries[i].IndexInfo.NameHash;
            }

            if (STRFStrings.Count > 0)
            {
                pso.STRFSection         = new PsoSTRFSection();
                pso.STRFSection.Strings = STRFStrings.ToArray();
            }
            if (STRSStrings.Count > 0)
            {
                pso.STRSSection         = new PsoSTRSSection();
                pso.STRSSection.Strings = STRSStrings.ToArray();
            }


            pso.DataSection      = new PsoDataSection();
            pso.DataSection.Data = GetData();

            pso.DataMapSection         = new PsoDataMapSection();
            pso.DataMapSection.Entries = new PsoDataMappingEntry[Blocks.Count];
            pso.DataMapSection.RootId  = RootPointer.BlockID;
            var offset = 16;

            for (int i = 0; i < Blocks.Count; i++)
            {
                var b = Blocks[i];
                var e = new PsoDataMappingEntry();
                e.NameHash = b.StructureNameHash;
                e.Length   = b.TotalSize;
                e.Offset   = offset;
                offset    += b.TotalSize;
                pso.DataMapSection.Entries[i] = e;
            }



            return(pso);
        }
示例#6
0
        private void LoadScenarioPointManifest(PsoFile pso)
        {
            FileFormat  = YmtFileFormat.PSO;
            ContentType = YmtFileContentType.ScenarioPointManifest;

            CScenarioPointManifest = new YmtScenarioPointManifest();
            CScenarioPointManifest.Load(pso);
        }
示例#7
0
 public override void Init(PsoFile pso, ref CMapDataGroup v)
 {
     DataGroup    = v;
     Bounds       = PsoTypes.GetHashArray(pso, v.Bounds);
     WeatherTypes = PsoTypes.GetHashArray(pso, v.WeatherTypes);
     Name         = v.Name;
     Flags        = v.Flags;
     HoursOnOff   = v.HoursOnOff;
 }
示例#8
0
 public static T[] GetItemArrayRaw <T>(PsoFile pso, Array_Structure arr) where T : struct
 {
     if ((arr.Count1 > 0) && (arr.Pointer > 0))
     {
         var entry = pso.DataMapSection.Entries[(int)arr.PointerDataIndex];
         return(ConvertDataArrayRaw <T>(pso.DataSection.Data, entry.Offset, arr.Count1));
     }
     return(null);
 }
示例#9
0
 public static float[] GetFloatArray(PsoFile pso, Array_float arr)
 {
     float[] floats = GetFloatArrayRaw(pso, arr);
     if (floats == null)
     {
         return(null);
     }
     for (int i = 0; i < floats.Length; i++)
     {
         floats[i] = MetaTypes.SwapBytes(floats[i]);
     }
     return(floats);
 }
示例#10
0
 public static uint[] GetUintArray(PsoFile pso, Array_uint arr)
 {
     uint[] uints = GetUintArrayRaw(pso, arr);
     if (uints == null)
     {
         return(null);
     }
     for (int i = 0; i < uints.Length; i++)
     {
         uints[i] = MetaTypes.SwapBytes(uints[i]);
     }
     return(uints);
 }
示例#11
0
 public static ushort[] GetUShortArray(PsoFile pso, Array_Structure arr)
 {
     ushort[] ushorts = GetUShortArrayRaw(pso, arr);
     if (ushorts == null)
     {
         return(null);
     }
     for (int i = 0; i < ushorts.Length; i++)
     {
         ushorts[i] = MetaTypes.SwapBytes(ushorts[i]);
     }
     return(ushorts);
 }
示例#12
0
 public static MetaHash[] GetHashArray(PsoFile pso, Array_uint arr)
 {
     uint[] uints = GetUintArrayRaw(pso, arr);
     if (uints == null)
     {
         return(null);
     }
     MetaHash[] hashes = new MetaHash[uints.Length];
     for (int n = 0; n < uints.Length; n++)
     {
         hashes[n].Hash = MetaTypes.SwapBytes(uints[n]);
     }
     return(hashes);
 }
示例#13
0
        public void Load(byte[] data, RpfFileEntry entry)
        {
            RpfFileEntry = entry;
            Name         = entry.Name;
            FilePath     = Name;



            //can be PSO .ymt or XML .meta
            MemoryStream ms = new MemoryStream(data);

            if (PsoFile.IsPSO(ms))
            {
                Pso = new PsoFile();
                Pso.Load(data);
                Xml = PsoXml.GetXml(Pso); //yep let's just convert that to XML :P
            }
            else
            {
                Xml = TextUtil.GetUTF8Text(data);
            }

            XmlDocument xdoc = new XmlDocument();

            if (!string.IsNullOrEmpty(Xml))
            {
                try
                {
                    xdoc.LoadXml(Xml);
                }
                catch (Exception ex)
                {
                    var msg = ex.Message;
                }
            }
            else
            {
            }


            if (xdoc.DocumentElement != null)
            {
                InitDataList = new CPedModelInfo__InitDataList(xdoc.DocumentElement);
            }



            Loaded = true;
        }
示例#14
0
        public static byte[] GetByteArray(PsoFile pso, PsoStructureEntryInfo entry, int offset)
        {
            var aCount   = (entry.ReferenceKey >> 16) & 0x0000FFFF;
            var aBlockId = (int)entry.ReferenceKey & 0x0000FFFF;
            var block    = pso.GetBlock(aBlockId);

            if (block == null)
            {
                return(null);
            }

            //block.Offset

            return(null);
        }
示例#15
0
        public static ushort[] GetUShortArrayRaw(PsoFile pso, Array_Structure arr)
        {
            byte[] data    = pso.DataSection.Data;
            var    entryid = arr.Pointer & 0xFFF;

            if ((entryid == 0) || (entryid > pso.DataMapSection.EntriesCount))
            {
                return(null);
            }
            var entryoffset = (arr.Pointer & 0xFFFFFF) >> 12;
            var arrentry    = pso.DataMapSection.Entries[(int)entryid - 1];
            int totoffset   = arrentry.Offset + (int)entryoffset;

            ushort[] readdata = ConvertDataArrayRaw <ushort>(data, totoffset, arr.Count1);
            return(readdata);
        }
示例#16
0
        public void Load(byte[] data, RpfFileEntry entry)
        {
            FileEntry = entry;

            RpfResourceFileEntry resentry = entry as RpfResourceFileEntry;

            if (resentry == null)
            {
                MemoryStream ms = new MemoryStream(data);
                if (RbfFile.IsRBF(ms))
                {
                    Rbf = new RbfFile();
                    Rbf.Load(ms);

                    //x64j.rpf\\levels\\gta5\\_citye\\indust_01\\id1_props.rpf\\_manifest.ymf
                    //x64j.rpf\\levels\\gta5\\_citye\\indust_02\\id2_props.rpf\\_manifest.ymf
                    //x64q.rpf\\levels\\gta5\\_hills\\country_01\\cs1_railwyc.rpf\\_manifest.ymf
                    //all just HDTxd bindings

                    return;
                }
                if (PsoFile.IsPSO(ms))
                {
                    Pso = new PsoFile();
                    Pso.Load(ms);

                    //PsoTypes.EnsurePsoTypes(Pso);

                    ProcessPSO();

                    return;
                }
                else
                {
                }
                return;
            }
            else
            {
            }  //doesn't get here



            ResourceDataReader rd = new ResourceDataReader(resentry, data);

            Meta = rd.ReadBlock <Meta>();
        }
示例#17
0
 public static T[] GetItemArray <T>(PsoFile pso, Array_Structure arr) where T : struct, IPsoSwapEnd
 {
     if ((arr.Count1 > 0) && (arr.Pointer > 0))
     {
         var entry = pso.DataMapSection.Entries[(int)arr.PointerDataIndex];
         var res   = ConvertDataArrayRaw <T>(pso.DataSection.Data, entry.Offset, arr.Count1);
         if (res != null)
         {
             for (int i = 0; i < res.Length; i++)
             {
                 res[i].SwapEnd();
             }
         }
         return(res);
     }
     return(null);
 }
示例#18
0
        public void Load(byte[] data, RpfFileEntry entry)
        {
            RpfFileEntry = entry;
            Name         = entry.Name;
            FilePath     = Name;


            //always PSO .ymt
            MemoryStream ms = new MemoryStream(data);

            if (PsoFile.IsPSO(ms))
            {
                Pso = new PsoFile();
                Pso.Load(data);
                Xml = PsoXml.GetXml(Pso); //yep let's just convert that to XML :P
            }


            XmlDocument xdoc = new XmlDocument();

            if (!string.IsNullOrEmpty(Xml))
            {
                try
                {
                    xdoc.LoadXml(Xml);
                }
                catch (Exception ex)
                {
                    var msg = ex.Message;
                }
            }
            else
            {
            }


            if (xdoc.DocumentElement != null)
            {
                VehicleModColours = new CVehicleModColours(xdoc.DocumentElement);
            }



            Loaded = true;
        }
示例#19
0
        public static void EnsurePsoTypes(PsoFile pso)
        {
            if ((pso.SchemaSection == null) || (pso.SchemaSection.Entries == null) || (pso.SchemaSection.EntriesIdx == null))
            {
                return;
            }


            for (int i = 0; i < pso.SchemaSection.Entries.Length; i++)
            {
                var entry      = pso.SchemaSection.Entries[i];
                var enuminfo   = entry as PsoEnumInfo;
                var structinfo = entry as PsoStructureInfo;

                if (enuminfo != null)
                {
                    if (!EnumDict.ContainsKey(enuminfo.IndexInfo.NameHash))
                    {
                        EnumDict.Add(enuminfo.IndexInfo.NameHash, enuminfo);
                    }
                    else
                    {
                        PsoEnumInfo oldei = EnumDict[enuminfo.IndexInfo.NameHash];
                        if (!ComparePsoEnumInfos(oldei, enuminfo))
                        {
                        }
                    }
                }
                else if (structinfo != null)
                {
                    if (!StructDict.ContainsKey(structinfo.IndexInfo.NameHash))
                    {
                        StructDict.Add(structinfo.IndexInfo.NameHash, structinfo);
                    }
                    else
                    {
                        PsoStructureInfo oldsi = StructDict[structinfo.IndexInfo.NameHash];
                        if (!ComparePsoStructureInfos(oldsi, structinfo))
                        {
                        }
                    }
                }
            }
        }
示例#20
0
        public static T[] ConvertDataArray <T>(PsoFile pso, Array_StructurePointer array) where T : struct, IPsoSwapEnd
        {
            uint count = array.Count1;

            if (count == 0)
            {
                return(null);
            }
            PsoPOINTER[] ptrs = GetPointerArray(pso, array);
            if (ptrs == null)
            {
                return(null);
            }
            if (ptrs.Length < count)
            {
                return(null);
            }

            T[] items    = new T[count];
            int itemsize = Marshal.SizeOf(typeof(T));

            for (int i = 0; i < count; i++)
            {
                var sptr   = ptrs[i];
                int blocki = sptr.BlockID - 1;
                int offset = (int)sptr.ItemOffset;// * 16;//block data size...
                if (blocki >= pso.DataMapSection.EntriesCount)
                {
                    continue;
                }
                var block = pso.DataMapSection.Entries[blocki];

                if ((offset < 0) || (offset >= block.Length))
                {
                    continue;
                }

                int boffset = block.Offset + offset;

                items[i] = ConvertData <T>(pso.DataSection.Data, boffset);
            }

            return(items);
        }
示例#21
0
        public static string GetString(PsoFile pso, CharPointer ptr)
        {
            if (ptr.Count1 == 0)
            {
                return(null);
            }

            var blocki = (int)ptr.PointerDataId;     // (ptr.Pointer & 0xFFF) - 1;
            var offset = (int)ptr.PointerDataOffset; // (ptr.Pointer >> 12) & 0xFFFFF;

            var block = pso.GetBlock(blocki);

            if (block == null)
            {
                return(null);
            }

            var length   = ptr.Count1;
            var lastbyte = offset + length;

            if (lastbyte >= block.Length)
            {
                return(null);
            }

            var data = pso.DataSection?.Data;

            if (data == null)
            {
                return(null);
            }

            var doffset = block.Offset + offset;

            string s = Encoding.ASCII.GetString(data, doffset, length);

            //if (meta.Strings == null) return null;
            //if (offset < 0) return null;
            //if (offset >= meta.Strings.Length) return null;
            //string s = meta.Strings[offset];

            return(s);
        }
示例#22
0
        public static string GetString(PsoFile pso, DataBlockPointer ptr)
        {
            var blocki = (int)ptr.PointerDataId;     // (ptr.Pointer & 0xFFF) - 1;
            var offset = (int)ptr.PointerDataOffset; // (ptr.Pointer >> 12) & 0xFFFFF;

            var block = pso.GetBlock(blocki);

            if (block == null)
            {
                return(null);
            }

            //var length = ptr.Count1;
            //var lastbyte = offset + length;
            //if (lastbyte >= block.Length)
            //{ return null; }

            var data = pso.DataSection?.Data;

            if (data == null)
            {
                return(null);
            }

            //var doffset = block.Offset + offset;

            //string s = Encoding.ASCII.GetString(data, doffset, length);

            StringBuilder sb = new StringBuilder();
            var           o  = block.Offset + offset;
            char          c  = (char)data[o];

            while (c != 0)
            {
                sb.Append(c);
                o++;
                c = (char)data[o];
            }
            var s = sb.ToString();

            return(s);
        }
示例#23
0
 public static T[] GetObjectArray <T, U>(PsoFile pso, Array_Structure arr) where U : struct, IPsoSwapEnd where T : PsoClass <U>, new()
 {
     U[] items = GetItemArray <U>(pso, arr);
     if (items == null)
     {
         return(null);
     }
     if (items.Length == 0)
     {
         return(null);
     }
     T[] result = new T[items.Length];
     for (int i = 0; i < items.Length; i++)
     {
         T newitem = new T();
         newitem.Init(pso, ref items[i]);
         result[i] = newitem;
     }
     return(result);
 }
示例#24
0
        private void NonMetaLoad(byte[] data)
        {
            //non meta not supported yet! but see what's in there...
            MemoryStream ms = new MemoryStream(data);

            if (RbfFile.IsRBF(ms))
            {
                var Rbf = new RbfFile();
                Rbf.Load(ms);
            }
            else if (PsoFile.IsPSO(ms))
            {
                var Pso = new PsoFile();
                Pso.Load(ms);
                //PsoTypes.EnsurePsoTypes(Pso);
            }
            else
            {
            }
        }
示例#25
0
        public static PsoPOINTER[] GetPointerArray(PsoFile pso, Array_StructurePointer array)
        {
            uint count = array.Count1;

            if (count == 0)
            {
                return(null);
            }

            int  ptrsize   = Marshal.SizeOf(typeof(MetaPOINTER));
            int  itemsleft = (int)count; //large arrays get split into chunks...
            uint ptr       = array.Pointer;
            int  ptrindex  = (int)(ptr & 0xFFF) - 1;
            int  ptroffset = (int)((ptr >> 12) & 0xFFFFF);
            var  ptrblock  = (ptrindex < pso.DataMapSection.EntriesCount) ? pso.DataMapSection.Entries[ptrindex] : null;

            if ((ptrblock == null) || (ptrblock.NameHash != MetaName.PsoPOINTER))
            {
                return(null);
            }

            var offset  = ptrblock.Offset;
            int boffset = offset + ptroffset;

            var ptrs = ConvertDataArrayRaw <PsoPOINTER>(pso.DataSection.Data, boffset, (int)count);

            if (ptrs != null)
            {
                for (int i = 0; i < ptrs.Length; i++)
                {
                    ptrs[i].SwapEnd();
                }
            }

            return(ptrs);
        }
示例#26
0
        public void Load(byte[] data, RpfFileEntry entry)
        {
            Name         = entry.Name;
            RpfFileEntry = entry;
            RpfResourceFileEntry resentry = entry as RpfResourceFileEntry;

            if (resentry == null)
            {
                MemoryStream ms = new MemoryStream(data);
                if (RbfFile.IsRBF(ms))
                {
                    Rbf = new RbfFile();
                    Rbf.Load(ms);
                }
                else if (PsoFile.IsPSO(ms))
                {
                    Pso = new PsoFile();
                    Pso.Load(ms);
                    //PsoTypes.EnsurePsoTypes(Pso);
                }
                else
                {
                }
                return;
            }



            ResourceDataReader rd = new ResourceDataReader(resentry, data);

            Meta = rd.ReadBlock <Meta>();


            _CMapTypes = MetaTypes.GetTypedData <CMapTypes>(Meta, MetaName.CMapTypes);


            List <Archetype> allarchs = new List <Archetype>();

            var ptrs = MetaTypes.GetPointerArray(Meta, _CMapTypes.archetypes);

            if (ptrs != null)
            {
                for (int i = 0; i < ptrs.Length; i++)
                {
                    var ptr    = ptrs[i];
                    var offset = ptr.Offset;
                    var block  = Meta.GetBlock(ptr.BlockID);
                    if (block == null)
                    {
                        continue;
                    }
                    if ((offset < 0) || (block.Data == null) || (offset >= block.Data.Length))
                    {
                        continue;
                    }

                    Archetype a = null;
                    switch (block.StructureNameHash)
                    {
                    case MetaName.CBaseArchetypeDef:
                        var basearch = PsoTypes.ConvertDataRaw <CBaseArchetypeDef>(block.Data, offset);
                        a = new Archetype();
                        a.Init(this, ref basearch);
                        a.Extensions = MetaTypes.GetExtensions(Meta, basearch.extensions);
                        break;

                    case MetaName.CTimeArchetypeDef:
                        var timearch = PsoTypes.ConvertDataRaw <CTimeArchetypeDef>(block.Data, offset);
                        var ta       = new TimeArchetype();
                        ta.Init(this, ref timearch);
                        ta.Extensions = MetaTypes.GetExtensions(Meta, timearch._BaseArchetypeDef.extensions);
                        a             = ta;
                        break;

                    case MetaName.CMloArchetypeDef:
                        var mloarch = PsoTypes.ConvertDataRaw <CMloArchetypeDef>(block.Data, offset);
                        var ma      = new MloArchetype();
                        ma.Init(this, ref mloarch);
                        ma.Extensions = MetaTypes.GetExtensions(Meta, mloarch._BaseArchetypeDef.extensions);

                        ma.LoadChildren(Meta);

                        a = ma;
                        break;

                    default:
                        continue;
                    }

                    if (a != null)
                    {
                        allarchs.Add(a);
                    }
                }
            }
            AllArchetypes = allarchs.ToArray();


            Extensions = MetaTypes.GetExtensions(Meta, _CMapTypes.extensions);

            if (Extensions != null)
            {
            }


            //AudioEmitters = MetaTypes.GetTypedDataArray<CExtensionDefAudioEmitter>(Meta, MetaName.CExtensionDefAudioEmitter);
            //if (AudioEmitters != null)
            //{ }

            //CEntityDefs = MetaTypes.GetTypedDataArray<CEntityDef>(Meta, MetaName.CEntityDef);


            CompositeEntityTypes = MetaTypes.ConvertDataArray <CCompositeEntityType>(Meta, MetaName.CCompositeEntityType, _CMapTypes.compositeEntityTypes);
            if (CompositeEntityTypes != null)
            {
            }

            NameHash = _CMapTypes.name;
            if (NameHash == 0)
            {
                int ind = entry.NameLower.LastIndexOf('.');
                if (ind > 0)
                {
                    NameHash = JenkHash.GenHash(entry.NameLower.Substring(0, ind));
                }
                else
                {
                    NameHash = JenkHash.GenHash(entry.NameLower);
                }
            }

            Strings = MetaTypes.GetStrings(Meta);
            if (Strings != null)
            {
                foreach (string str in Strings)
                {
                    JenkIndex.Ensure(str); //just shove them in there
                }
            }


            //foreach (var block in Meta.DataBlocks)
            //{
            //    switch(block.StructureNameHash)
            //    {
            //        case MetaName.CMapTypes:
            //        case MetaName.CTimeArchetypeDef:
            //        case MetaName.CBaseArchetypeDef:
            //        case MetaName.CMloArchetypeDef:
            //        case MetaName.CMloTimeCycleModifier:
            //        case MetaName.CMloRoomDef:
            //        case MetaName.CMloPortalDef:
            //        case MetaName.CMloEntitySet:
            //        case MetaName.CEntityDef:
            //        case MetaName.CExtensionDefParticleEffect:
            //        case MetaName.CExtensionDefAudioCollisionSettings:
            //        case MetaName.CExtensionDefSpawnPoint:
            //        case MetaName.CExtensionDefSpawnPointOverride:
            //        case MetaName.CExtensionDefExplosionEffect:
            //        case MetaName.CExtensionDefAudioEmitter:
            //        case MetaName.CExtensionDefLadder:
            //        case MetaName.CExtensionDefBuoyancy:
            //        case MetaName.CExtensionDefExpression:
            //        case MetaName.CExtensionDefLightShaft:
            //        case MetaName.CExtensionDefLightEffect:
            //        case MetaName.CExtensionDefDoor:
            //        case MetaName.CExtensionDefWindDisturbance:
            //        case MetaName.CExtensionDefProcObject:
            //        case MetaName.CLightAttrDef:
            //        case (MetaName)MetaTypeName.STRING:
            //        case (MetaName)MetaTypeName.POINTER:
            //        case (MetaName)MetaTypeName.UINT:
            //        case (MetaName)MetaTypeName.VECTOR4:
            //            break;
            //        default:
            //            break;
            //    }
            //}



            //MetaTypes.ParseMetaData(Meta);
        }
示例#27
0
 public override void Init(PsoFile pso, ref CInteriorBoundsFiles v)
 {
     Interior = v;
     Bounds   = PsoTypes.GetHashArray(pso, v.Bounds);
 }
示例#28
0
        }                                           //ytyp hashes?

        public override void Init(PsoFile pso, ref CItypDependencies v)
        {
            Dep          = v;
            itypDepArray = PsoTypes.GetHashArray(pso, v.itypDepArray);
        }
示例#29
0
 public abstract void Init(PsoFile pso, ref T v);
示例#30
0
        public void Load(byte[] data, RpfFileEntry entry)
        {
            RpfFileEntry = entry;
            Name         = entry.Name;
            FilePath     = Name;


            RpfResourceFileEntry resentry = entry as RpfResourceFileEntry;

            if (resentry != null)
            {
                ResourceDataReader rd = new ResourceDataReader(resentry, data);

                Meta = rd.ReadBlock <Meta>();

                var rootblock = Meta.GetRootBlock();
                if (rootblock != null)
                {
                    if (rootblock.StructureNameHash == MetaName.CScenarioPointRegion)
                    {
                        LoadScenarioPointRegion(Meta, rootblock);
                    }
                }

                Loaded = true;
                return;
            }


            MemoryStream ms = new MemoryStream(data);

            if (RbfFile.IsRBF(ms))
            {
                Rbf = new RbfFile();
                var rbfstruct = Rbf.Load(ms);

                if (rbfstruct.Name == "CMapParentTxds")
                {
                    LoadMapParentTxds(rbfstruct);
                }



                Loaded = true;
                return;
            }
            if (PsoFile.IsPSO(ms))
            {
                Pso = new PsoFile();
                Pso.Load(ms);

                //PsoTypes.EnsurePsoTypes(Pso);

                var root = PsoTypes.GetRootEntry(Pso);
                if (root != null)
                {
                    if (root.NameHash == MetaName.CScenarioPointManifest)
                    {
                        LoadScenarioPointManifest(Pso);
                    }
                }


                Loaded = true;
                return;
            }
            else
            {
            }
        }