public void WriteBFG(string FilePath) { FileName = FilePath; BigEndianWriter Writer = new BigEndianWriter(File.Open(FilePath, FileMode.Create)); BFG b = bfgComponent1.ReturnData(); Writer.WriteUInt32(b.Unknown1); Writer.WriteSingle(b.Unknown2); foreach (Entry e in b.Entries) { Writer.WriteSingle(e.Distance); Writer.WriteUInt32(e.RGBA); Writer.WriteUInt16(e.Unknown1); Writer.WriteUInt16(e.Unknown2); Writer.WriteSingle(e.Float1B); Writer.WriteUInt32(e.Unknown3); Writer.WriteUInt32(e.Unknown4); Writer.WriteUInt32(e.Padding); } Writer.WriteSingle(b.Float4A); Writer.WriteUInt32(b.Bytes4A); Writer.WriteUInt16(b.Unknown4A); Writer.WriteUInt16(b.Unknown4B); Writer.WriteSingle(b.Float4B); Writer.WriteUInt32(b.Unknown4C); Writer.Close(); }
private void ExportAmbient_Click(object sender, EventArgs e) { int Row = 0; if (dgwAmbient.SelectedRows.Count == 1) { Row = dgwAmbient.SelectedRows[0].Index; } else if (dgwAmbient.SelectedRows.Count == 0 && dgwAmbient.SelectedCells.Count == 1) { Row = dgwAmbient.SelectedCells[0].RowIndex; } else { MessageBox.Show("Unable to export Ambient Light!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } SaveFileDialog s = new SaveFileDialog(); s.Filter = "Binary Ambient Light (*bambl)|*.bambl"; if (s.ShowDialog() == DialogResult.OK) { BigEndianWriter Writer = new BigEndianWriter(File.Open(s.FileName, FileMode.Create)); Writer.WriteChars("BAML".ToCharArray(), 0, 4); Writer.WriteByte(byte.Parse(dgwAmbient.Rows[Row].Cells[1].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwAmbient.Rows[Row].Cells[2].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwAmbient.Rows[Row].Cells[3].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwAmbient.Rows[Row].Cells[4].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteUInt32(UInt32.Parse(dgwAmbient.Rows[Row].Cells[5].Value.ToString(), NumberStyles.HexNumber)); Writer.Close(); } }
public void WriteBLMAP(string FilePath) { FileName = FilePath; BigEndianWriter Writer = new BigEndianWriter(File.Open(FilePath, FileMode.Create)); BLMAP BLMAP = lmapComponent1.ReturnData(); Writer.WriteChars("LMAP".ToCharArray(), 0, 4); Writer.WriteUInt32(0); Writer.WriteUInt32(BLMAP.Unknown1); Writer.WriteUInt32(BLMAP.Unknown2); Writer.WriteUInt16(Convert.ToUInt16(treeView1.Nodes[0].Nodes[1].Nodes.Count)); Writer.WriteUInt16(BLMAP.Unknown3); Writer.WriteUInt32(BLMAP.Unknown4); Writer.WriteUInt32(BLMAP.Unknown5); Writer.WriteUInt32(BLMAP.Unknown6); int FileSize = 0x20; for (int i = 0; i < listLTEX.Count; i++) { BLMAPLTEX LTEX = ltexComponent1.ReturnData(); LTEX.Entries = ReturnLTEX(); listLTEX[SelectedNode] = LTEX; FileSize += 0x3C + listLTEX[i].Entries.Count * 8; Writer.WriteChars("LTEX".ToCharArray(), 0, 4); Writer.WriteInt32(0x3C + listLTEX[i].Entries.Count * 8); Writer.WriteUInt32(listLTEX[i].Padding); Writer.WriteUInt32(listLTEX[i].Unknown); Writer.WriteUInt16(Convert.ToUInt16(listLTEX[i].Entries.Count)); Writer.WriteUInt16(listLTEX[i].Unknown1); Writer.WriteChars(listLTEX[i].Texture.ToCharArray(), 0, 4); Writer.WriteUInt32(listLTEX[i].Unknown2); Writer.WriteUInt32(listLTEX[i].Unknown3); Writer.WriteUInt32(listLTEX[i].Unknown4); Writer.WriteUInt32(listLTEX[i].Unknown5); Writer.WriteUInt32(listLTEX[i].Unknown6); Writer.WriteUInt32(listLTEX[i].Unknown7); Writer.WriteUInt32(listLTEX[i].Unknown8); Writer.WriteUInt32(listLTEX[i].Unknown9); Writer.WriteInt32(listLTEX[i].Entries.Count * 8); for (int j = 0; j < listLTEX[i].Entries.Count; j++) { Writer.WriteSingle(listLTEX[i].Entries[j].Unknown1); Writer.WriteUInt32(listLTEX[i].Entries[j].Unknown2); } } Writer.BaseStream.Position = 4; Writer.WriteInt32(FileSize); Writer.Close(); treeView1.Nodes[0].Text = Path.GetFileName(FilePath); }
public void WriteBLIGHT(string FilePath) { FileName = FilePath; BigEndianWriter Writer = new BigEndianWriter(File.Open(FilePath, FileMode.Create)); Writer.WriteChars("LGHT".ToCharArray(), 0, 4); Writer.WriteUInt32(Convert.ToUInt32(0x28 + dgwLOBJ.Rows.Count * 0x50 + dgwAmbient.Rows.Count * 8)); Writer.WriteUInt32(BLIGHT.Unknown1); Writer.WriteUInt32(BLIGHT.Unknown2); Writer.WriteUInt16(Convert.ToUInt16(dgwLOBJ.Rows.Count)); Writer.WriteUInt16(Convert.ToUInt16(dgwAmbient.Rows.Count)); Writer.WriteUInt32(BLIGHT.Unknown3); Writer.WriteUInt64(BLIGHT.Padding); Writer.WriteUInt64(BLIGHT.Padding2); for (int i = 0; i < dgwLOBJ.Rows.Count; i++) { Writer.WriteChars("LOBJ".ToCharArray(), 0, 4); Writer.WriteUInt32(0x50); Writer.WriteUInt64(UInt64.Parse(dgwLOBJ.Rows[i].Cells[20].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteUInt16(UInt16.Parse(dgwLOBJ.Rows[i].Cells[21].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[i].Cells[1].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[i].Cells[2].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteUInt16(UInt16.Parse(dgwLOBJ.Rows[i].Cells[13].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteUInt16(UInt16.Parse(dgwLOBJ.Rows[i].Cells[14].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[i].Cells[3].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[i].Cells[4].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[i].Cells[5].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[i].Cells[6].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[i].Cells[7].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[i].Cells[8].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[i].Cells[9].Value.ToString())); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[i].Cells[16].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[i].Cells[17].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[i].Cells[18].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[i].Cells[19].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteUInt32(UInt32.Parse(dgwLOBJ.Rows[i].Cells[15].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[i].Cells[10].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[i].Cells[11].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[i].Cells[12].Value.ToString())); Writer.WriteUInt64(UInt64.Parse(dgwLOBJ.Rows[i].Cells[22].Value.ToString(), NumberStyles.HexNumber)); } for (int i = 0; i < dgwAmbient.Rows.Count; i++) { Writer.WriteByte(byte.Parse(dgwAmbient.Rows[i].Cells[1].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwAmbient.Rows[i].Cells[2].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwAmbient.Rows[i].Cells[3].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwAmbient.Rows[i].Cells[4].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteUInt32(UInt32.Parse(dgwAmbient.Rows[i].Cells[5].Value.ToString(), NumberStyles.HexNumber)); } Writer.Close(); }
private void ExportLOBJ_Click(object sender, EventArgs e) { int Row = 0; if (dgwLOBJ.SelectedRows.Count == 1) { Row = dgwLOBJ.SelectedRows[0].Index; } else if (dgwLOBJ.SelectedRows.Count == 0 && dgwLOBJ.SelectedCells.Count == 1) { Row = dgwLOBJ.SelectedCells[0].RowIndex; } else { MessageBox.Show("Unable to export Light Object!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } SaveFileDialog s = new SaveFileDialog(); s.Filter = "Binary Light Object (*blobj)|*.blobj"; if (s.ShowDialog() == DialogResult.OK) { BigEndianWriter Writer = new BigEndianWriter(File.Open(s.FileName, FileMode.Create)); Writer.WriteChars("LOBJ".ToCharArray(), 0, 4); Writer.WriteUInt32(0x50); Writer.WriteUInt64(UInt64.Parse(dgwLOBJ.Rows[Row].Cells[20].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteUInt16(UInt16.Parse(dgwLOBJ.Rows[Row].Cells[21].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[Row].Cells[1].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[Row].Cells[2].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteUInt16(UInt16.Parse(dgwLOBJ.Rows[Row].Cells[13].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteUInt16(UInt16.Parse(dgwLOBJ.Rows[Row].Cells[14].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[Row].Cells[3].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[Row].Cells[4].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[Row].Cells[5].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[Row].Cells[6].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[Row].Cells[7].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[Row].Cells[8].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[Row].Cells[9].Value.ToString())); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[Row].Cells[16].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[Row].Cells[17].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[Row].Cells[18].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteByte(byte.Parse(dgwLOBJ.Rows[Row].Cells[19].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteUInt32(UInt32.Parse(dgwLOBJ.Rows[Row].Cells[15].Value.ToString(), NumberStyles.HexNumber)); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[Row].Cells[10].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[Row].Cells[11].Value.ToString())); Writer.WriteSingle(Convert.ToSingle(dgwLOBJ.Rows[Row].Cells[12].Value.ToString())); Writer.WriteUInt64(UInt64.Parse(dgwLOBJ.Rows[Row].Cells[22].Value.ToString(), NumberStyles.HexNumber)); Writer.Close(); } }
public void WriteBDOF(string FilePath) { FileName = FilePath; BigEndianWriter Writer = new BigEndianWriter(File.Open(FilePath, FileMode.Create)); BDOF b = bdofComponent1.ReturnData(); Writer.WriteChars("PDOF".ToCharArray(), 0, 4); Writer.WriteUInt32(0x50); Writer.WriteUInt64(b.Unknown1); Writer.WriteUInt16(b.Activator); Writer.WriteUInt16(b.Unknown2); Writer.WriteUInt32(b.Unknown3); Writer.WriteSingles(b.FloatValues); Writer.WriteUInt64s(b.Padding); Writer.Close(); }
private void ExportLTEX_Click(object sender, EventArgs e) { SaveFileDialog s = new SaveFileDialog(); s.Filter = "Binary Light Texture (*bltex)|*.bltex"; if (s.ShowDialog() == DialogResult.OK) { BLMAPLTEX LTEX = ltexComponent1.ReturnData(); LTEX.Entries = ReturnLTEX(); listLTEX[SelectedNode] = LTEX; BigEndianWriter Writer = new BigEndianWriter(File.Open(s.FileName, FileMode.Create)); Writer.WriteChars("LTEX".ToCharArray(), 0, 4); Writer.WriteInt32(0x3C + LTEX.Entries.Count * 8); Writer.WriteUInt32(LTEX.Padding); Writer.WriteUInt32(LTEX.Unknown); Writer.WriteUInt16(Convert.ToUInt16(LTEX.Entries.Count)); Writer.WriteUInt16(LTEX.Unknown1); Writer.WriteChars(LTEX.Texture.ToCharArray(), 0, 4); Writer.WriteUInt32(LTEX.Unknown2); Writer.WriteUInt32(LTEX.Unknown3); Writer.WriteUInt32(LTEX.Unknown4); Writer.WriteUInt32(LTEX.Unknown5); Writer.WriteUInt32(LTEX.Unknown6); Writer.WriteUInt32(LTEX.Unknown7); Writer.WriteUInt32(LTEX.Unknown8); Writer.WriteUInt32(LTEX.Unknown9); Writer.WriteInt32(LTEX.Entries.Count * 8); for (int j = 0; j < LTEX.Entries.Count; j++) { Writer.WriteSingle(LTEX.Entries[j].Unknown1); Writer.WriteUInt32(LTEX.Entries[j].Unknown2); } Writer.Close(); } }
public void WriteBBLM(string FilePath) { FileName = FilePath; BigEndianWriter Writer = new BigEndianWriter(File.Open(FilePath, FileMode.Create)); BBLM b = bblmComponent1.ReturnData(); Writer.WriteChars("PBLM".ToCharArray(), 0, 4); Writer.WriteUInt32(0xA4); Writer.WriteUInt64(b.Unknown1); Writer.WriteSingle(b.ScaleFactor); Writer.WriteUInt32(b.RGB); Writer.WriteUInt32(b.blurrRGB); Writer.WriteUInt16(b.Unknown2); Writer.WriteUInt16(b.Unknown3); for (int i = 0; i < b.Entries.Count; i++) { Writer.WriteSingle(b.Entries[i].Unknown1); Writer.WriteSingle(b.Entries[i].Unknown2); Writer.WriteUInt32(b.Entries[i].Unknown3); Writer.WriteUInt32(b.Entries[i].Unknown4); Writer.WriteUInt32(b.Entries[i].Unknown5); Writer.WriteUInt32(b.Entries[i].Unknown6); Writer.WriteUInt32(b.Entries[i].Unknown7); Writer.WriteUInt32(b.Entries[i].Unknown8); } Writer.WriteUInt32(b.Unknown4); Writer.WriteUInt32(b.Unknown5); Writer.WriteUInt32(b.Unknown6); Writer.WriteUInt32(b.Unknown7); Writer.WriteUInt32(b.Unknown8); Writer.WriteSingle(b.Unknown9); Writer.WriteSingle(b.float1); Writer.WriteSingle(b.float2); Writer.WriteSingle(b.float3); Writer.Close(); }