/// <summary> /// The add. /// </summary> /// <param name="tagIndex">Index of the tag.</param> /// <param name="metasplit">The metasplit.</param> /// <remarks></remarks> public void Add(int tagIndex, MetaSplitter metasplit) { // TagIndex - Global Variable this.TagIndex = tagIndex; ArrayList metas = new ArrayList(0); for (int x = 0; x < map.IndexHeader.metaCount; x++) { // sender.setProgressBar(x / map.IndexHeader.metaCount); Meta m = new Meta(map); m.ReadMetaFromMap(x, true); // Read meta layout of TAG from .ENT file IFPIO ifpx = IFPHashMap.GetIfp(m.type, map.HaloVersion); m.headersize = ifpx.headerSize; if (m.type == "sbsp") { } else { // anything but "sbsp" m.scanner.ScanWithIFP(ref ifpx); // metaScanner.ScanManually(ref m, ref map); } metas.Add(m); } // sender.setProgressBar(0); Meta targetTag = (Meta)metas[tagIndex]; Meta tempm = MetaBuilder.BuildMeta(metasplit, map); // (Meta) metas[TagIndex]; metas[tagIndex] = tempm; // ((Meta)metas[TagIndex]).RelinkReferences(map); SizeOfShift = tempm.size - targetTag.size; // Map IS already open? I guess it's a safety check. map.OpenMap(MapTypes.Internal); FixReflexives(metas); map.CloseMap(); }
/// <summary> /// The tree view tags_ after select. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> /// <remarks></remarks> private void treeViewTags_AfterSelect(object sender, TreeViewEventArgs e) { treeView1.Nodes.Clear(); try { IFPIO ifpx = IFPHashMap.GetIfp(e.Node.Text, map.HaloVersion); // path stores parent offsets string path = string.Empty; treeView1.Nodes.AddRange(CreateTree(ifpx.items, path)); } catch (Exception ex) { Global.ShowErrorMsg(string.Empty, ex); } }
/// <summary> /// The over write. /// </summary> /// <param name="map">The map.</param> /// <param name="tagIndex">Index of the tag.</param> /// <param name="newMeta">The new meta.</param> /// <remarks></remarks> public static void OverWrite(Map map, int tagIndex, ref Meta newMeta) { TagIndex = tagIndex; if (map.MetaInfo.TagType[tagIndex] == "sbsp") { MessageBox.Show("Can't OverWrite The Bsp"); return; } newMeta.RelinkReferences(); ArrayList metas = new ArrayList(0); map.OpenMap(MapTypes.Internal); for (int x = 0; x < map.IndexHeader.metaCount; x++) { if (tagIndex == x) { newMeta.type = map.MetaInfo.TagType[x]; newMeta.name = map.FileNames.Name[x]; SizeOfShift = newMeta.size - map.MetaInfo.Size[x]; metas.Add(newMeta); continue; } Meta m = new Meta(map); m.ReadMetaFromMap(x, true); try { IFPIO ifpx = IFPHashMap.GetIfp(m.type, map.HaloVersion); m.headersize = ifpx.headerSize; m.scanner.ScanWithIFP(ref ifpx); // metaScanner.ScanManually(ref m, ref map); metas.Add(m); } catch (System.Exception ex) { Globals.Global.ShowErrorMsg(string.Empty, ex); } } FixReflexives(metas, map); map.CloseMap(); }
/// <summary> /// Initializes a new instance of the <see cref="MetaItemComparer"/> class. /// </summary> /// <param name="currentForm">The current form.</param> /// <remarks></remarks> public MetaItemComparer(MapForm currentForm) { Map map = currentForm.map; int counter = 0; for (counter = 0; counter < map.MapHeader.fileCount; counter++) { currentForm.SetProgressBar(counter * 100 / map.MapHeader.fileCount); ifpMeta = new Meta(map); manualMeta = new Meta(map); manualMeta.ReadMetaFromMap(counter, false); ifpMeta.ReadMetaFromMap(counter, false); // parse ifp and scan meta with it try { IFPIO io = IFPHashMap.GetIfp(ifpMeta.type, map.HaloVersion); ifpMeta.headersize = io.headerSize; manualMeta.headersize = io.headerSize; try { ifpMeta.scanner.ScanWithIFP(ref io); } catch (Exception ex) { Global.ShowErrorMsg("Broken IFP - " + ifpMeta.type, ex); } manualMeta.scanner.ScanManually(); check(map); } catch (Exception ex) { Globals.Global.ShowErrorMsg(string.Empty, ex); } } currentForm.SetProgressBar(0); }
/// <summary> /// The add. /// </summary> /// <param name="meta">The meta.</param> /// <remarks></remarks> public void Add(Meta meta) { TagIndex = meta.TagIndex; ArrayList metas = new ArrayList(0); for (int x = 0; x < meta.Map.IndexHeader.metaCount; x++) { if (TagIndex == x) { metas.Add(meta); continue; } Meta m = new Meta(meta.Map); m.ReadMetaFromMap(x, true); IFPIO ifpx = IFPHashMap.GetIfp(m.type, meta.Map.HaloVersion); m.headersize = ifpx.headerSize; if (m.type == "sbsp") { } else { m.scanner.ScanWithIFP(ref ifpx); } // metaScanner.ScanManually(ref m, ref meta.Map); metas.Add(m); } int diff = meta.size - meta.Map.MetaInfo.Size[TagIndex]; SizeOfShift = diff; meta.Map.OpenMap(MapTypes.Internal); FixReflexives(metas); meta.Map.CloseMap(); }
/// <summary> /// The save recursive function. /// </summary> /// <param name="meta">The meta.</param> /// <param name="metas">The metas.</param> /// <param name="parsed">The parsed.</param> /// <param name="pb">The pb.</param> /// <param name="percent">The percent.</param> /// <param name="percentsize">The percentsize.</param> /// <remarks></remarks> private void SaveRecursiveFunction( Meta meta, ref ArrayList metas, bool parsed, ToolStripProgressBar pb, float percent, float percentsize) { int wtf = metas.Count; if (meta.items.Count == 0) { return; } float test = meta.items.Count; float currentpercentsize = percentsize / test; Item i = null; try { for (int x = 0; x < meta.items.Count; x++) { i = meta.items[x]; if (i.type != ItemType.Ident) { continue; } float currentpercentage = percent + (currentpercentsize * x); pb.Value = (int)currentpercentage; Application.DoEvents(); Ident id = (Ident)i; if (id.ident == -1) { continue; } if (id.ident == 0) { int tagIndex = Map.Functions.ForMeta.FindByNameAndTagType("sbsp", i.intagname); id.ident = Map.MetaInfo.Ident[tagIndex]; } bool exists = false; for (int e = 0; e < metas.Count; e++) { Meta tempmeta = (Meta)metas[e]; // if (id.pointstotagtype ==tempmeta.type&&id.pointstotagname ==tempmeta.name ) if (id.ident == tempmeta.ident) { exists = true; break; } } if (exists) { continue; } // Drag & drop w/ recursive locks up. num == -1 int num = Map.Functions.ForMeta.FindMetaByID(id.ident); if (num < 0) { MessageBox.Show("ERROR! Not Found!"); } Meta m = new Meta(Map); if (parsed) { m.parsed = true; } m.ReadMetaFromMap(num, false); if (m.type == "ltmp" | m.type == "matg") { continue; } if (m.type == "phmo" | m.type == "coll" | m.type == "jmad") { m.parsed = false; } if (m.type != "jmad") { IFPIO ifp = IFPHashMap.GetIfp(m.type, Map.HaloVersion); m.headersize = ifp.headerSize; m.scanner.ScanWithIFP(ref ifp); } else { m.scanner.ScanManually(); } m.SortItemsByOffset(); metas.Add(m); Application.DoEvents(); SaveRecursiveFunction(m, ref metas, parsed, pb, currentpercentage, currentpercentsize); } } catch (Exception e) { string addOn = "\nin [" + meta.type + "] " + meta.name; if (i.type == ItemType.Ident) { addOn = "\n" + i.description + ", Ident: " + ((Ident)i).ident + addOn; } throw new Exception(e.Message + addOn, e.InnerException); } }
/// <summary> /// The scan meta items. /// </summary> /// <param name="manual">The manual.</param> /// <param name="parsed">The parsed.</param> /// <remarks></remarks> public void ScanMetaItems(bool manual, bool parsed) { if (parsed) { this.parsed = true; } this.items.Clear(); switch (Map.HaloVersion) { case HaloVersionEnum.Halo1: case HaloVersionEnum.HaloCE: this.magic = Map.PrimaryMagic; if (Map.MetaInfo.TagType[this.TagIndex] == "bitm" && Map.MetaInfo.external[this.TagIndex] && Map.HaloVersion != HaloVersionEnum.Halo1) { Map.CloseMap(); Map.OpenMap(MapTypes.Bitmaps); } else { Map.CloseMap(); Map.OpenMap(MapTypes.Internal); } this.ReadMetaFromMap(this.TagIndex, false); if (manual && this.type != "sbsp") { this.scannedwithent = true; IFPHashMap.RemoveIfp(this.type, Map); IFPIO io = IFPHashMap.GetIfp(this.type, Map.HaloVersion); this.headersize = io.headerSize; scanner.ScanWithIFP(ref io); } else { scanner.ScanManually(); } break; case HaloVersionEnum.Halo2: case HaloVersionEnum.Halo2Vista: #region Halo 2 Map.OpenMap(MapTypes.Internal); this.ReadMetaFromMap(this.TagIndex, false); if (manual) { // {&&meta.type!="sbsp") IFPHashMap.RemoveIfp(this.type, Map); IFPIO io = IFPHashMap.GetIfp(this.type, Map.HaloVersion); this.headersize = io.headerSize; string[] sa = scanner.ScanWithIFP(ref io); if (sa.Length > 0) { string s = string.Empty; for (int i = 0; i < sa.Length; i++) { s += "\n" + sa[i]; } MessageBox.Show("Errors were detected with the following idents:\n" + s); } } else { scanner.ScanManually(); } break; #endregion } }
/// <summary> /// The inject model. /// </summary> /// <param name="FilePath">The file path.</param> /// <param name="meta">The meta.</param> /// <returns></returns> /// <remarks></remarks> public override Meta InjectModel(string FilePath, Meta meta) { LoadFromOBJ(FilePath); char[] crsr = new[] { 'c', 'r', 's', 'r' }; char[] fklb = new[] { 'f', 'k', 'l', 'b' }; for (int x = 0; x < this.RawDataMetaChunks.Length; x++) { MemoryStream raw = new MemoryStream(); BinaryWriter newraw = new BinaryWriter(raw); BinaryReader oldraw = new BinaryReader(meta.raw.rawChunks[x].MS); int newrawsize = 0; int rawchunkid = 0; #region Write Header oldraw.BaseStream.Position = 0; newraw.BaseStream.Position = 0; newraw.Write(oldraw.ReadBytes(this.RawDataMetaChunks[x].HeaderSize)); newrawsize += this.RawDataMetaChunks[x].HeaderSize; #endregion #region Write Submesh Info newraw.BaseStream.Position = newrawsize; newraw.Write(crsr); newrawsize += 4; for (int y = 0; y < this.RawDataMetaChunks[x].SubMeshInfo.Length; y++) { oldraw.BaseStream.Position = this.RawDataMetaChunks[x].HeaderSize + this.RawDataMetaChunks[x].RawDataChunkInfo[0].Offset; newraw.BaseStream.Position = newrawsize + (y * 72); newraw.Write(oldraw.ReadBytes(72)); newraw.BaseStream.Position = newrawsize + (y * 72) + 4; newraw.Write((short)this.RawDataMetaChunks[x].SubMeshInfo[y].ShaderNumber); newraw.Write((short)this.RawDataMetaChunks[x].SubMeshInfo[y].IndiceStart); newraw.Write((short)this.RawDataMetaChunks[x].SubMeshInfo[y].IndiceCount); } this.RawDataMetaChunks[x].RawDataChunkInfo[0].ChunkCount = this.RawDataMetaChunks[x].SubMeshInfo.Length; this.RawDataMetaChunks[x].RawDataChunkInfo[0].Size = this.RawDataMetaChunks[x].SubMeshInfo.Length * 72; newrawsize += this.RawDataMetaChunks[x].SubMeshInfo.Length * 72; // write count newraw.BaseStream.Position = 8; newraw.Write(this.RawDataMetaChunks[x].SubMeshInfo.Length); #endregion #region Write Unknown rawchunkid = 1; while (newrawsize > 0) { if (this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].ChunkSize == 2) { break; } oldraw.BaseStream.Position = this.RawDataMetaChunks[x].HeaderSize + this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Offset; newraw.BaseStream.Position = newrawsize; newraw.Write(crsr); newrawsize += 4; newraw.Write(oldraw.ReadBytes(this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Size)); this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Offset = newrawsize - this.RawDataMetaChunks[x].HeaderSize; newrawsize += this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Size; rawchunkid++; } #endregion #region Write Indices int indicechunkid = rawchunkid; newraw.BaseStream.Position = newrawsize; newraw.Write(crsr); newrawsize += 4; for (int y = 0; y < this.RawDataMetaChunks[x].Indices.Length; y++) { newraw.Write(this.RawDataMetaChunks[x].Indices[y]); } this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Offset = newrawsize - this.RawDataMetaChunks[x].HeaderSize; this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].ChunkCount = this.RawDataMetaChunks[x].Indices.Length; this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Size = this.RawDataMetaChunks[x].Indices.Length * 2; newrawsize += this.RawDataMetaChunks[x].Indices.Length * 2; rawchunkid++; // indice count newraw.BaseStream.Position = 40; newraw.Write((short)this.RawDataMetaChunks[x].Indices.Length); #endregion #region Write Unknown oldraw.BaseStream.Position = this.RawDataMetaChunks[x].HeaderSize + this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Offset; newraw.BaseStream.Position = newrawsize; newraw.Write(crsr); newrawsize += 4; newraw.Write(oldraw.ReadBytes(this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Size)); this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Offset = newrawsize - this.RawDataMetaChunks[x].HeaderSize; newrawsize += this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Size; rawchunkid++; #endregion #region Write Vertices int verticechunkid = indicechunkid + 2; newraw.BaseStream.Position = newrawsize; newraw.Write(crsr); newrawsize += 4; newraw.Write( new byte[ this.RawDataMetaChunks[x].RawDataChunkInfo[verticechunkid].ChunkSize * this.RawDataMetaChunks[x].VerticeCount]); for (int y = 0; y < this.RawDataMetaChunks[x].VerticeCount; y++) { newraw.BaseStream.Position = newrawsize + (y * this.RawDataMetaChunks[x].RawDataChunkInfo[verticechunkid].ChunkSize); short vx = (short) this.RawDataMetaChunks[x].CompressVertice( this.RawDataMetaChunks[x].Vertices[y].X, this.BoundingBox.MinX, this.BoundingBox.MaxX); short vy = (short) this.RawDataMetaChunks[x].CompressVertice( this.RawDataMetaChunks[x].Vertices[y].Y, this.BoundingBox.MinY, this.BoundingBox.MaxY); short vz = (short) this.RawDataMetaChunks[x].CompressVertice( this.RawDataMetaChunks[x].Vertices[y].Z, this.BoundingBox.MinZ, this.BoundingBox.MaxZ); newraw.Write(vx); newraw.Write(vy); newraw.Write(vz); } this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Offset = newrawsize - this.RawDataMetaChunks[x].HeaderSize; newrawsize += this.RawDataMetaChunks[x].RawDataChunkInfo[verticechunkid].ChunkSize * this.RawDataMetaChunks[x].VerticeCount; this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Size = this.RawDataMetaChunks[x].RawDataChunkInfo[verticechunkid].ChunkSize * this.RawDataMetaChunks[x].VerticeCount; this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].ChunkSize = 0; // this.RawDataMetaChunks[x].RawDataChunkInfo[verticechunkid].ChunkSize * this.RawDataMetaChunks[x].VerticeCount; ; newraw.BaseStream.Position = 100; newraw.Write(this.RawDataMetaChunks[x].VerticeCount); rawchunkid++; #endregion #region Write UVs int uvchunkid = verticechunkid + 1; newraw.BaseStream.Position = newrawsize; newraw.Write(crsr); newrawsize += 4; for (int y = 0; y < this.RawDataMetaChunks[x].VerticeCount; y++) { short u = (short) this.RawDataMetaChunks[x].CompressVertice( this.RawDataMetaChunks[x].UVs[y].X, this.BoundingBox.MinU, this.BoundingBox.MaxU); short v = (short) this.RawDataMetaChunks[x].CompressVertice( this.RawDataMetaChunks[x].UVs[y].Y, this.BoundingBox.MinV, this.BoundingBox.MaxV); newraw.Write(u); newraw.Write(v); } this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Offset = newrawsize - this.RawDataMetaChunks[x].HeaderSize; this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].ChunkSize = 1; this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Size = 4 * this.RawDataMetaChunks[x].VerticeCount; newrawsize += 4 * this.RawDataMetaChunks[x].VerticeCount; rawchunkid++; #endregion #region Write Normals newraw.BaseStream.Position = newrawsize; newraw.Write(crsr); newrawsize += 4; for (int y = 0; y < this.RawDataMetaChunks[x].VerticeCount; y++) { int u = (int) this.RawDataMetaChunks[x].CompressVertice( this.RawDataMetaChunks[x].UVs[y].X, this.BoundingBox.MinU, this.BoundingBox.MaxU); int v = (int) this.RawDataMetaChunks[x].CompressVertice( this.RawDataMetaChunks[x].UVs[y].Y, this.BoundingBox.MinV, this.BoundingBox.MaxV); newraw.Write(u); newraw.Write(v); newraw.Write(v); } this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Offset = newrawsize - this.RawDataMetaChunks[x].HeaderSize; this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].ChunkSize = 2; this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Size = 4 * this.RawDataMetaChunks[x].VerticeCount; newrawsize += 12 * this.RawDataMetaChunks[x].VerticeCount; rawchunkid++; #endregion #region Write Other Stuff Not Yet Implemented while (rawchunkid < this.RawDataMetaChunks[x].RawDataChunkInfo.Length) { oldraw.BaseStream.Position = this.RawDataMetaChunks[x].HeaderSize + this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Offset; newraw.BaseStream.Position = newrawsize; newraw.Write(crsr); newrawsize += 4; newraw.Write(oldraw.ReadBytes(this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Size)); this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Offset = newrawsize - this.RawDataMetaChunks[x].HeaderSize; newrawsize += this.RawDataMetaChunks[x].RawDataChunkInfo[rawchunkid].Size; rawchunkid++; } #endregion // footer newraw.Write(fklb); newrawsize += 4; // raw size int rawsize = newrawsize - this.RawDataMetaChunks[x].HeaderSize - 4; newraw.BaseStream.Position = 4; newraw.Write(rawsize); meta.raw.rawChunks[x].MS = raw; meta.raw.rawChunks[x].size = newrawsize; } MetaSplitter ms = new MetaSplitter(); IFPIO io = IFPHashMap.GetIfp(meta.type, map.HaloVersion); ms.SplitWithIFP(ref io, ref meta, map); #region Write Bounding Box int c = 0; while (c != -1) { if (ms.Header.Chunks[0].ChunkResources[c].offset == 20) { break; } c++; } MetaSplitter.SplitReflexive reflex = ms.Header.Chunks[0].ChunkResources[c] as MetaSplitter.SplitReflexive; BinaryWriter BW = new BinaryWriter(reflex.Chunks[0].MS); BW.BaseStream.Position = 0; BW.Write(this.BoundingBox.MinX); BW.Write(this.BoundingBox.MaxX); BW.Write(this.BoundingBox.MinY); BW.Write(this.BoundingBox.MaxY); BW.Write(this.BoundingBox.MinZ); BW.Write(this.BoundingBox.MaxZ); BW.Write(this.BoundingBox.MinU); BW.Write(this.BoundingBox.MaxU); BW.Write(this.BoundingBox.MinV); BW.Write(this.BoundingBox.MaxV); ms.Header.Chunks[0].ChunkResources[c] = reflex; #endregion #region metachunks while (c != -1) { if (ms.Header.Chunks[0].ChunkResources[c].offset == 36) { break; } c++; } MetaSplitter.SplitReflexive reflexe = ms.Header.Chunks[0].ChunkResources[c] as MetaSplitter.SplitReflexive; for (int l = 0; l < reflexe.Chunks.Count; l++) { BW = new BinaryWriter(reflexe.Chunks[l].MS); BW.BaseStream.Position = 4; short facecount = (short)this.RawDataMetaChunks[l].FaceCount; BW.Write((short)this.RawDataMetaChunks[l].VerticeCount); BW.Write(facecount); BW.BaseStream.Position = 68; BW.Write(meta.raw.rawChunks[l].size - this.RawDataMetaChunks[l].HeaderSize - 4); for (int h = 0; h < reflexe.Chunks[l].ChunkResources.Count; h++) { if (reflexe.Chunks[l].ChunkResources[h].offset == 72) { MetaSplitter.SplitReflexive reflexx = reflexe.Chunks[l].ChunkResources[h] as MetaSplitter.SplitReflexive; for (int k = 0; k < reflexx.Chunks.Count; k++) { BinaryWriter BWX = new BinaryWriter(reflexx.Chunks[k].MS); BWX.BaseStream.Position = 6; BWX.Write((short)this.RawDataMetaChunks[l].RawDataChunkInfo[k].ChunkSize); BWX.Write(this.RawDataMetaChunks[l].RawDataChunkInfo[k].Size); BWX.Write(this.RawDataMetaChunks[l].RawDataChunkInfo[k].Offset); } reflexe.Chunks[l].ChunkResources[h] = reflexx; break; } } } while (c != -1) { if (ms.Header.Chunks[0].ChunkResources[c].offset == 96) { break; } c++; } reflexe = ms.Header.Chunks[0].ChunkResources[c] as MetaSplitter.SplitReflexive; if (this.Shaders.Shader.Length > this.Shaders.count) { int diff = this.Shaders.Shader.Length - reflexe.Chunks.Count; for (int x = 0; x < diff; x++) { reflexe.Chunks.Add(reflexe.Chunks[0]); } } else { } #endregion Meta f****r = MetaBuilder.BuildMeta(ms, map); f****r.raw = meta.raw; return(f****r); }
/// <summary> /// The map rebuilder. /// </summary> /// <param name="layout">The layout.</param> /// <remarks></remarks> public void MapRebuilder(ref MapLayout layout) { int totalshift = 0; // find new strings /// /// ArrayList strings = new ArrayList(); foreach (string s in map.Strings.Name) { strings.Add(s); } for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; for (int y = 0; y < m.items.Count; y++) { Meta.Item ii = m.items[y]; if (ii.type == Meta.ItemType.String) { Meta.String iii = (Meta.String)ii; if (strings.IndexOf(iii.name) == -1) { strings.Add(iii.name); } } } } ///read ugh to meta /// /// map.OpenMap(MapTypes.Internal); Meta ughmeta = new Meta(map); ughmeta.ReadMetaFromMap(map.IndexHeader.metaCount - 1, false); IFPIO ifp = IFPHashMap.GetIfp("ugh!", map.HaloVersion); ughmeta.headersize = ifp.headerSize; ughmeta.scanner.ScanWithIFP(ref ifp); MetaList.Add(ughmeta); string temps = string.Empty; ///get model info int tempint = layout.FindByType(RawDataContainerType.Model); LayOutChunk loc = (LayOutChunk)layout.chunks[tempint]; ////////////////////////////////////// ///model raw data /// int modeshift = 0; loc.startoffset += totalshift; for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; if (m.rawType == RawDataContainerType.Model) { BinaryWriter BW = new BinaryWriter(m.MS); for (int y = 0; y < m.raw.rawChunks.Count; y++) { RawDataChunk r = m.raw.rawChunks[y]; if (r.rawLocation != MapTypes.Internal) { int tempintxx = r.offset; if (r.rawLocation == MapTypes.MPShared) { tempintxx |= int.Parse("80000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.SPShared) { tempintxx |= int.Parse("C0000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.MainMenu) { tempintxx |= int.Parse("40000000", NumberStyles.HexNumber); } // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempintxx); BW.Write(r.size); continue; } int tempintx = loc.startoffset + modeshift; // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempintx); BW.Write(r.size); // writes raw to map file map.BW.BaseStream.Position = tempintx; map.BW.BaseStream.Write(r.MS.ToArray(), 0, r.size); // write padding int tempinty = map.Functions.Padding(r.size, 512); byte[] tempbytes = new byte[tempinty]; map.BW.Write(tempbytes); modeshift += r.size + tempinty; } MetaList[x] = m; } } loc.size = modeshift; loc.endoffset = loc.startoffset + loc.size; layout.chunks[tempint] = loc; int curroffset = loc.endoffset; ///////////////////////////////////// /// bsp raw /// int bspcount = 0; int[] bspmagic = new int[20]; int[] bspmagicreflexive = new int[20]; int[] bsprawoffset = new int[20]; int[] bsprawsize = new int[20]; int totalbsprawsize = 0; bool found = false; for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; if (m.type == "sbsp") { BinaryWriter BW = new BinaryWriter(m.MS); int[] tempoff = new int[m.raw.rawChunks.Count]; int thisbsprawsize = 0; for (int y = 0; y < m.raw.rawChunks.Count; y++) { found = false; RawDataChunk r = m.raw.rawChunks[y]; for (int yy = 0; yy < y; yy++) { RawDataChunk rr = m.raw.rawChunks[yy]; if (rr.offset == r.offset && rr.rawLocation == r.rawLocation) { tempoff[y] = tempoff[yy]; // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempoff[y]); BW.Write(r.size); found = true; break; } } if (found) { continue; } tempoff[y] = curroffset + thisbsprawsize; // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempoff[y]); BW.Write(r.size); // writes raw to map file map.BW.BaseStream.Position = curroffset + thisbsprawsize; map.BW.BaseStream.Write(r.MS.ToArray(), 0, r.size); // write padding int tempinty = map.Functions.Padding(r.size, 512); byte[] tempbytes = new byte[tempinty]; map.BW.Write(tempbytes); thisbsprawsize += r.size + tempinty; totalbsprawsize += r.size + tempinty; } bsprawsize[bspcount] = thisbsprawsize; bspmagic[bspcount] = m.magic; bspmagicreflexive[bspcount] = m.magic + m.offset; curroffset += bsprawsize[bspcount]; // bspmagic=m.magic; // newmagicreflexive=bspmagic+m.offset; bspcount += 1; MetaList[x] = m; } } ////////////////////////////////////// ///weather raw data /// int weathershift = 0; for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; if (m.rawType == RawDataContainerType.Weather) { BinaryWriter BW = new BinaryWriter(m.MS); for (int y = 0; y < m.raw.rawChunks.Count; y++) { RawDataChunk r = m.raw.rawChunks[y]; if (r.rawLocation != MapTypes.Internal) { int tempintxx = r.offset; if (r.rawLocation == MapTypes.MPShared) { tempintxx |= int.Parse("80000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.SPShared) { tempintxx |= int.Parse("C0000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.MainMenu) { tempintxx |= int.Parse("40000000", NumberStyles.HexNumber); } // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempintxx); BW.Write(r.size); continue; } int tempintx = curroffset + weathershift; // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempintx); BW.Write(r.size); // writes raw to map file map.BW.BaseStream.Position = tempintx; map.BW.BaseStream.Write(r.MS.ToArray(), 0, r.size); // write padding int tempinty = map.Functions.Padding(r.size, 512); byte[] tempbytes = new byte[tempinty]; map.BW.Write(tempbytes); weathershift += r.size + tempinty; } MetaList[x] = m; } } curroffset += weathershift; ////////////////////////////////////// ///decr raw data /// int decrshift = 0; for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; if (m.rawType == RawDataContainerType.DECR) { BinaryWriter BW = new BinaryWriter(m.MS); for (int y = 0; y < m.raw.rawChunks.Count; y++) { RawDataChunk r = m.raw.rawChunks[y]; if (r.rawLocation != MapTypes.Internal) { int tempintxx = r.offset; if (r.rawLocation == MapTypes.MPShared) { tempintxx |= int.Parse("80000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.SPShared) { tempintxx |= int.Parse("C0000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.MainMenu) { tempintxx |= int.Parse("40000000", NumberStyles.HexNumber); } // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempintxx); BW.Write(r.size); continue; } int tempintx = curroffset + decrshift; // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempintx); BW.Write(r.size); // writes raw to map file map.BW.BaseStream.Position = tempintx; map.BW.BaseStream.Write(r.MS.ToArray(), 0, r.size); // write padding int tempinty = map.Functions.Padding(r.size, 512); byte[] tempbytes = new byte[tempinty]; map.BW.Write(tempbytes); decrshift += r.size + tempinty; } MetaList[x] = m; } } curroffset += decrshift; ////////////////////////////////////// ///prtm raw data /// int prtmshift = 0; for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; if (m.rawType == RawDataContainerType.PRTM) { BinaryWriter BW = new BinaryWriter(m.MS); for (int y = 0; y < m.raw.rawChunks.Count; y++) { RawDataChunk r = m.raw.rawChunks[y]; if (r.rawLocation != MapTypes.Internal) { int tempintxx = r.offset; if (r.rawLocation == MapTypes.MPShared) { tempintxx |= int.Parse("80000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.SPShared) { tempintxx |= int.Parse("C0000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.MainMenu) { tempintxx |= int.Parse("40000000", NumberStyles.HexNumber); } // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempintxx); BW.Write(r.size); continue; } int tempintx = curroffset + prtmshift; // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempintx); BW.Write(r.size); // writes raw to map file map.BW.BaseStream.Position = tempintx; map.BW.BaseStream.Write(r.MS.ToArray(), 0, r.size); // write padding int tempinty = map.Functions.Padding(r.size, 512); byte[] tempbytes = new byte[tempinty]; map.BW.Write(tempbytes); prtmshift += r.size + tempinty; } MetaList[x] = m; } } curroffset += prtmshift; ////////////////////////////////////// ///jmad raw data /// int jmadshift = 0; for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; if (m.rawType == RawDataContainerType.Animation) { BinaryWriter BW = new BinaryWriter(m.MS); for (int y = 0; y < m.raw.rawChunks.Count; y++) { RawDataChunk r = m.raw.rawChunks[y]; if (r.rawLocation != MapTypes.Internal) { int tempintxx = r.offset; if (r.rawLocation == MapTypes.MPShared) { tempintxx |= int.Parse("80000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.SPShared) { tempintxx |= int.Parse("C0000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.MainMenu) { tempintxx |= int.Parse("40000000", NumberStyles.HexNumber); } // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset - 4; BW.Write(r.size); BW.Write(tempintxx); continue; } int tempintx = curroffset + jmadshift; // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset - 4; BW.Write(r.size); BW.Write(tempintx); // writes raw to map file map.BW.BaseStream.Position = tempintx; map.BW.BaseStream.Write(r.MS.ToArray(), 0, r.size); // write padding int tempinty = map.Functions.Padding(r.size, 512); byte[] tempbytes = new byte[tempinty]; map.BW.Write(tempbytes); jmadshift += r.size + tempinty; } MetaList[x] = m; } } curroffset += jmadshift; ////////////////////////////////////// ///bsp meta data /// int[] bspmetaoffset = new int[20]; int[] bspmetasize = new int[20]; int tempcount = 0; for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; if (m.type == "sbsp") { Meta mm = (Meta)MetaList[3]; if (mm.type == "scnr") { BinaryWriter BWX = new BinaryWriter(mm.MS); int tempoffx = map.BSP.sbsp[tempcount].pointerOffset; BWX.BaseStream.Position = tempoffx; BWX.Write(curroffset); BWX.Write(m.size); BWX.Write(bspmagicreflexive[tempcount]); MetaList[3] = mm; } map.BW.BaseStream.Position = curroffset; map.BW.BaseStream.Write(m.MS.ToArray(), 0, m.size); bspmetasize[tempcount] = m.size; bspmetaoffset[tempcount] = curroffset; curroffset += m.size; tempcount++; } } ////stringnames1 /// byte[] tempb = new byte[strings.Count * 128]; map.BW.BaseStream.Position = curroffset; map.BW.BaseStream.Write(tempb, 0, strings.Count * 128); for (int x = 0; x < strings.Count; x++) { map.BW.BaseStream.Position = curroffset + (x * 128); char[] tempc = ((String)strings[x]).ToCharArray(); map.BW.Write(tempc); } map.BW.BaseStream.Position = 352; map.BW.Write(curroffset); int newcount = strings.Count; map.BW.Write(newcount); curroffset += strings.Count * 128; int padding = map.Functions.Padding(curroffset, 512); tempb = new byte[padding]; map.BW.BaseStream.Position = curroffset; map.BW.BaseStream.Write(tempb, 0, padding); curroffset += padding; ////stringsindex /// int tempnewsrsize = strings.Count * 4; map.BW.BaseStream.Position = curroffset; int temporary = 0; for (int x = 0; x < strings.Count; x++) { map.BW.BaseStream.Position = curroffset + (x * 4); map.BW.Write(temporary); temporary += ((String)strings[x]).Length + 1; } map.BW.BaseStream.Position = 364; map.BW.Write(curroffset); curroffset += tempnewsrsize; padding = map.Functions.Padding(curroffset, 512); tempb = new byte[padding]; map.BW.BaseStream.Position = curroffset; map.BW.BaseStream.Write(tempb, 0, padding); curroffset += padding; ////strings2 /// temporary = 0; byte zero = 0; for (int x = 0; x < strings.Count; x++) { map.BW.BaseStream.Position = curroffset + temporary; char[] h = ((String)strings[x]).ToCharArray(); map.BW.Write(h); map.BW.Write(zero); temporary += ((String)strings[x]).Length + 1; } map.BW.BaseStream.Position = 360; map.BW.Write(temporary); map.BW.BaseStream.Position = 368; map.BW.Write(curroffset); curroffset += temporary; padding = map.Functions.Padding(curroffset, 512); tempb = new byte[padding]; map.BW.BaseStream.Position = curroffset; map.BW.BaseStream.Write(tempb, 0, padding); curroffset += padding; ////file names /// temporary = 0; for (int x = 0; x < MetaList.Count; x++) { map.BW.BaseStream.Position = curroffset + temporary; char[] h = ((Meta)MetaList[x]).name.ToCharArray(); map.BW.Write(h); map.BW.Write(zero); temporary += ((Meta)MetaList[x]).name.Length + 1; } map.BW.BaseStream.Position = 704; newcount = MetaList.Count; map.BW.Write(newcount); map.BW.Write(curroffset); map.BW.Write(temporary); curroffset += temporary; padding = map.Functions.Padding(curroffset, 512); tempb = new byte[padding]; map.BW.BaseStream.Position = curroffset; map.BW.BaseStream.Write(tempb, 0, padding); curroffset += padding; ////files index /// temporary = 0; for (int x = 0; x < MetaList.Count; x++) { map.BW.BaseStream.Position = curroffset + (x * 4); map.BW.Write(temporary); temporary += ((Meta)MetaList[x]).name.Length + 1; } map.BW.BaseStream.Position = 716; map.BW.Write(curroffset); curroffset += MetaList.Count * 4; padding = map.Functions.Padding(curroffset, 512); tempb = new byte[padding]; map.BW.BaseStream.Position = curroffset; map.BW.BaseStream.Write(tempb, 0, padding); curroffset += padding; tempint = layout.FindByType(RawDataContainerType.UnicodeNamesIndex); for (int x = 0; x < 9; x++) { map.Unicode.ut[x].indexOffset = curroffset; if (x != 8) { loc = (LayOutChunk)layout.chunks[tempint + (x * 2)]; loc.startoffset = curroffset; loc.endoffset = loc.startoffset + loc.size; map.BW.BaseStream.Position = loc.startoffset; map.BW.BaseStream.Write(loc.MS.ToArray(), 0, loc.size); layout.chunks[tempint + (x * 2)] = loc; curroffset += loc.size; } map.Unicode.ut[x].tableOffset = curroffset; if (x != 8) { LayOutChunk loc2 = (LayOutChunk)layout.chunks[tempint + (x * 2) + 1]; loc2.startoffset = curroffset; loc2.endoffset = loc2.startoffset + loc.size; map.BW.BaseStream.Position = loc2.startoffset; map.BW.BaseStream.Write(loc2.MS.ToArray(), 0, loc2.size); layout.chunks[tempint + (x * 2) + 1] = loc2; curroffset += loc2.size; } } Meta tempmatg = (Meta)MetaList[0]; BinaryWriter BWXX = new BinaryWriter(tempmatg.MS); for (int x = 0; x < 9; x++) { BWXX.BaseStream.Position = map.Unicode.ut[x].indexPointerOffset; BWXX.Write(map.Unicode.ut[x].indexOffset); BWXX.Write(map.Unicode.ut[x].tableOffset); } MetaList[0] = tempmatg; tempint = layout.FindByType(RawDataContainerType.Crazy); loc = (LayOutChunk)layout.chunks[tempint]; loc.startoffset = curroffset; // loc.endoffset+=totalshift; map.BW.BaseStream.Position = loc.startoffset; map.BW.BaseStream.Write(loc.MS.ToArray(), 0, loc.size); map.BW.BaseStream.Position = 344; map.BW.Write(loc.startoffset); layout.chunks[tempint] = loc; curroffset += loc.size; ////////////////////////////////////// ///bitmap raw data /// int bitmshift = 0; for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; if (m.rawType == RawDataContainerType.Bitmap) { BinaryWriter BW = new BinaryWriter(m.MS); for (int y = 0; y < m.raw.rawChunks.Count; y++) { RawDataChunk r = m.raw.rawChunks[y]; if (r.rawLocation != MapTypes.Internal) { int tempintxx = r.offset; if (r.rawLocation == MapTypes.MPShared) { tempintxx |= int.Parse("80000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.SPShared) { tempintxx |= int.Parse("C0000000", NumberStyles.HexNumber); } else if (r.rawLocation == MapTypes.MainMenu) { tempintxx |= int.Parse("40000000", NumberStyles.HexNumber); } // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempintxx); BW.BaseStream.Position = r.pointerMetaOffset + 24; BW.Write(r.size); continue; } int tempintx = curroffset + bitmshift; // writes new pointer to loaded meta BW.BaseStream.Position = r.pointerMetaOffset; BW.Write(tempintx); BW.BaseStream.Position = r.pointerMetaOffset + 24; BW.Write(r.size); // writes raw to map file map.BW.BaseStream.Position = tempintx; map.BW.BaseStream.Write(r.MS.ToArray(), 0, r.size); // write padding int tempinty = map.Functions.Padding(r.size, 512); byte[] tempbytes = new byte[tempinty]; map.BW.Write(tempbytes); bitmshift += r.size + tempinty; } MetaList[x] = m; } } curroffset += bitmshift; tempint = layout.FindByType(RawDataContainerType.MetaIndex); loc = (LayOutChunk)layout.chunks[tempint]; loc.startoffset = curroffset; map.BW.BaseStream.Position = loc.startoffset; map.BW.BaseStream.Write(loc.MS.ToArray(), 0, loc.size); map.BW.BaseStream.Position = 16; map.BW.Write(loc.startoffset); newcount = MetaList.Count; map.BW.BaseStream.Position = loc.startoffset + 24; map.BW.Write(newcount); int tagsoff = map.IndexHeader.tagsOffset - map.MapHeader.indexOffset; map.PrimaryMagic = map.IndexHeader.constant - (curroffset + 32); map.SecondaryMagic = map.PrimaryMagic + bspmetasize[0]; // map.SecondaryMagic=map.BR.ReadInt32()-(loc.startoffset+map.MapHeader.metaStart); int where = curroffset + map.MapHeader.metaStart; tempcount = 0; int howfar = 0; int[] newoffset = new int[MetaList.Count]; int[] newident = new int[MetaList.Count]; for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; int f**k = curroffset + tagsoff + (x * 16); char[] metatype = m.type.ToCharArray(); Array.Reverse(metatype); int ident = map.MetaInfo.Ident[0] + (x * 65537); int offset = where + howfar; if (x == MetaList.Count - 1) { int wherex = curroffset + map.MapHeader.metaStart + 756; map.BW.BaseStream.Position = wherex; map.BW.Write(ident); } if (m.type == "phmo" | m.type == "coll" | m.type == "spas") { int tempoffset = offset; do { string tempss = tempoffset.ToString("X"); char[] tempc = tempss.ToCharArray(); int xxx = tempc.Length; if (m.padding == tempc[xxx - 1]) { int diff = tempoffset - offset; tempb = new byte[diff]; map.BW.BaseStream.Position = offset; map.BW.Write(tempb); int tempsize = ((Meta)MetaList[x - 1]).size; tempsize += diff; int temploc = f**k - 4; map.BW.BaseStream.Position = temploc; map.BW.Write(tempsize); offset = tempoffset; howfar += diff; break; } tempoffset++; }while (temps != null); } newoffset[x] = offset; newident[x] = ident; int offsetwithmagic = offset + map.SecondaryMagic; int size = m.size; map.BW.BaseStream.Position = f**k; map.BW.Write(metatype); map.BW.Write(ident); if (m.type != "sbsp" && m.type != "ltmp") { map.BW.Write(offsetwithmagic); map.BW.Write(size); howfar += m.size; map.BW.BaseStream.Position = offset; map.BW.BaseStream.Write(m.MS.ToArray(), 0, m.size); } else { int zeroi = 0; map.BW.Write(zeroi); map.BW.Write(zeroi); if (m.type == "sbsp") { offset = bspmetaoffset[tempcount]; newoffset[x] = offset; tempcount++; } else { continue; } } } for (int x = 0; x < MetaList.Count; x++) { Meta m = (Meta)MetaList[x]; for (int xx = 0; xx < m.items.Count; xx++) { Meta.Item i = m.items[xx]; for (int e = 0; e < MetaList.Count; e++) { Meta tempm = (Meta)MetaList[e]; if (tempm.name == i.intagname && tempm.type == i.intagtype) { i.intag = e; break; } } if (i.intag != x) { continue; } switch (i.type) { case Meta.ItemType.Ident: Meta.Ident id = (Meta.Ident)i; id.ident = -1; for (int e = 0; e < MetaList.Count; e++) { Meta tempm = (Meta)MetaList[e]; if (tempm.name == id.pointstotagname && tempm.type == id.pointstotagtype) { id.ident = newident[e]; break; } } map.BW.BaseStream.Position = newoffset[x] + id.offset; map.BW.Write(id.ident); break; case Meta.ItemType.Reflexive: if (m.type != "sbsp") { Meta.Reflexive reflex = (Meta.Reflexive)i; for (int e = 0; e < MetaList.Count; e++) { Meta tempm = (Meta)MetaList[e]; if (reflex.pointstotagname == tempm.name && reflex.pointstotagtype == tempm.type) { reflex.pointstoTagIndex = e; break; } } int newreflex = reflex.translation + newoffset[reflex.pointstoTagIndex] + map.SecondaryMagic; map.BW.BaseStream.Position = newoffset[x] + reflex.offset; map.BW.Write(reflex.chunkcount); map.BW.Write(newreflex); } break; case Meta.ItemType.String: Meta.String s = (Meta.String)i; short stringnum = 0; byte stringlength = 0; for (int e = 0; e < strings.Count; e++) { if (s.name == (string)strings[e]) { stringnum = (short)e; stringlength = (byte)((string)strings[e]).Length; break; } } map.BW.BaseStream.Position = newoffset[x] + s.offset; map.BW.Write(stringnum); map.BW.Write(zero); map.BW.Write(stringlength); break; } } } // totalshift+=howfar; int tempfilesize = curroffset + map.MapHeader.metaStart + howfar; // map.MapHeader.fileSize+totalshift+howfar-map.MetaInfo.Size [map.IndexHeader.metaCount-1]; padding = map.Functions.Padding(tempfilesize, 512); tempb = new byte[padding]; map.BW.BaseStream.Position = tempfilesize; map.BW.Write(tempb); tempfilesize += padding; int olddifference = map.MapHeader.fileSize - (map.MapHeader.indexOffset); int difference = tempfilesize - (map.MapHeader.indexOffset + totalshift); int metasize = tempfilesize - (curroffset + map.MapHeader.metaStart); int combined = bspmetasize[0] + (tempfilesize - curroffset); map.BW.BaseStream.Position = 8; map.BW.Write(tempfilesize); map.BW.BaseStream.Position = 24; map.BW.Write(metasize); map.BW.Write(combined); map.BW.BaseStream.SetLength(tempfilesize); map.CloseMap(); }
/// <summary> /// The recursively check metas. /// </summary> /// <param name="tn">The tn.</param> /// <remarks></remarks> private void RecursivelyCheckMetas(TreeNode tn) { foreach (TreeNode n in tn.Nodes) { if (n.Checked == false) { continue; } if (n.Text.IndexOf('.') == -1) { RecursivelyCheckMetas(n); continue; } StatusLabel1.Text = "Processing: " + n.Text + "..."; Application.DoEvents(); int id = 0; for (int xx = 0; xx < map.IndexHeader.metaCount; xx++) { string[] tempn = map.FileNames.Name[xx].Split('\\'); string tempi = tempn[tempn.Length - 1] + "." + map.MetaInfo.TagType[xx]; int i = map.FileNames.Name[xx].LastIndexOf('\\'); string tempp = string.Empty; if (i != -1) { tempp = map.FileNames.Name[xx].Substring(0, i) + "\\"; } if (n.Text == tempi && n.Tag.ToString() == map.FileNames.Name[xx] + "." + map.MetaInfo.TagType[xx]) { id = xx; break; } } if (map.MetaInfo.TagType[id] == "ltmp") { Meta templtmp = new Meta(map); templtmp.TagIndex = id; templtmp.type = map.MetaInfo.TagType[id]; templtmp.name = map.FileNames.Name[id]; templtmp.offset = 0; templtmp.size = 0; templtmp.ident = map.MetaInfo.Ident[id]; templtmp.MS = new MemoryStream(0); templtmp.rawType = RawDataContainerType.Empty; templtmp.items = new List <Meta.Item>(); MetaList.Add(templtmp); continue; } if (map.MetaInfo.TagType[id] == "ugh!") { continue; } if (map.MetaInfo.TagType[id] == "snd!") { // dontscanraw = true; } Meta m = new Meta(map); m.ReadMetaFromMap(id, false); if (m.type != "sbsp" && m.type != "jmad") { IFPIO ifp = IFPHashMap.GetIfp(m.type, map.HaloVersion); // m.parsed = true; m.headersize = ifp.headerSize; m.scanner.ScanWithIFP(ref ifp); } else { m.scanner.ScanManually(); } switch (m.type.Trim()) { case "matg": matg = m; break; case "sncl": sncl = m; break; case "spk!": spk = m; break; case "scnr": scnr = m; break; case "sky": this.Skies.Add(m); skycount++; break; default: MetaList.Add(m); count++; break; } RecursivelyCheckMetas(n); } }