public void Load(ref FileStream FI) { MapHeader = new H1_MapHeader(); //IndexHeader = new H1_Index_Header(); MapHeader.Load(ref FI); switch (MapHeader.Map_Version) { case 0x05: IndexHeader = new IndexHeaderBase.XIndexHeader(); break; case 0x07: case 0x261: IndexHeader = new IndexHeaderBase.IndexHeader(); break; } FI.Seek(MapHeader.Offset_To_Index, System.IO.SeekOrigin.Begin); IndexHeader.Load(ref FI); uint StartOfTags = (uint)FI.Position;//MapHeader.Offset_To_Index + 36 + 4; Map_Magic = IndexHeader.IndexMagic - StartOfTags; //FI.Seek(StartOfTags,System.IO.SeekOrigin.Begin); IndexItems = new h1_Tag_Index_Item[IndexHeader.TagCount]; IndexItemStringList = new string[IndexHeader.TagCount]; uint BSPCount = 0; for (int ind = 0; ind < IndexHeader.TagCount; ind += 1) { IndexItems[ind] = new h1_Tag_Index_Item(); IndexItems[ind].Load(ref FI); if (IndexItems[ind].Type1 == 0x73627370) //Test for BSP tags { uint MapFileSavePos = (uint)FI.Position; //Seek to Scnr FI.Seek(IndexItems[0].MetaOffset, System.IO.SeekOrigin.Begin); //Read SCNR header byte[] SCNRHeader = new byte[1456]; FI.Read(SCNRHeader, 0, SCNRHeader.Length); //uint BSPSectionChunkCount = BitConverter.ToUInt32(SCNRHeader,1444); uint BSPSectionOffset = BitConverter.ToUInt32(SCNRHeader, 1444 + 4) - Map_Magic; byte[] BSPInfo = new byte[32]; FI.Seek(BSPSectionOffset + (32 * BSPCount), System.IO.SeekOrigin.Begin); FI.Read(BSPInfo, 0, BSPInfo.Length); IndexItems[ind].MetaOffset = BitConverter.ToUInt32(BSPInfo, 0); IndexItems[ind].MetaMagic = BitConverter.ToUInt32(BSPInfo, 8) - IndexItems[ind].MetaOffset; FI.Seek(IndexItems[ind].MetaOffset, SeekOrigin.Begin); byte[] tmpBSPNormalHeader = new byte[0x18]; FI.Read(tmpBSPNormalHeader, 0, 0x18); IndexItems[ind].MetaOffset = BitConverter.ToUInt32(tmpBSPNormalHeader, 0) - IndexItems[ind].MetaMagic; IndexItems[ind].OffsetToString = IndexItems[ind].OffsetToString - Map_Magic;//BitConverter.ToUInt32(BSPInfo,20) - Map_Magic;//IndexItems[ind].OffsetToString - Map_Magic; BSPCount += 1; FI.Seek(MapFileSavePos, System.IO.SeekOrigin.Begin); } else { IndexItems[ind].MetaOffset = IndexItems[ind].MetaOffset - Map_Magic; IndexItems[ind].OffsetToString = IndexItems[ind].OffsetToString - Map_Magic; IndexItems[ind].MetaMagic = Map_Magic; } } FilenameTable = new Hashtable((int)IndexHeader.TagCount); for (int strs = 0; strs < IndexHeader.TagCount; strs += 1) { TSFReader STSF = new TSFReader(); STSF.TSF(ref mr, IndexItems[strs].Type1); IndexItemStringList[strs] = CompUtil.StringLoader(ref FI, IndexItems[strs].OffsetToString) + STSF.Name; STSF = null; FilenameTable.Add(IndexItemStringList[strs], strs); } }