private void ImportLOBJ_Click(object sender, EventArgs e) { OpenFileDialog o = new OpenFileDialog(); o.Filter = "Binary Light Object (*blobj)|*.blobj"; if (o.ShowDialog() == DialogResult.OK) { BigEndianReader Reader = new BigEndianReader(new MemoryStream(File.ReadAllBytes(o.FileName))); LOBJ.Magic = Encoding.ASCII.GetString(Reader.ReadBytes(0x04)); if (LOBJ.Magic != "LOBJ") { throw new WrongMagicException(LOBJ.Magic, "LOBJ", Reader.BaseStream.Position - 4); } LOBJ.SectionSize = Reader.ReadUInt32(); if (LOBJ.SectionSize != 0x50) { MessageBox.Show("Please give this file to Wexos!"); } LOBJ.Unknown1 = Reader.ReadUInt64(); LOBJ.Unknown2 = Reader.ReadUInt16(); LOBJ.LightType = Reader.ReadByte(); LOBJ.Unknown3 = Reader.ReadByte(); LOBJ.LightID = Reader.ReadUInt16(); LOBJ.Unknown4 = Reader.ReadUInt16(); LOBJ.OriginVector = Reader.ReadSingles(3); LOBJ.DestinationVector = Reader.ReadSingles(3); LOBJ.Scale = Reader.ReadSingle(); LOBJ.RGBA = Reader.ReadBytes(4); LOBJ.Unknown5 = Reader.ReadUInt32(); LOBJ.Unknown6 = Reader.ReadSingle(); LOBJ.Unknown7 = Reader.ReadSingle(); LOBJ.Unknown8 = Reader.ReadSingle(); LOBJ.Padding = Reader.ReadUInt64(); Reader.Close(); dgwLOBJ.Rows.Add(HexUtil.Hex8(Convert.ToByte(dgwLOBJ.Rows.Count)), HexUtil.Hex8(LOBJ.LightType), HexUtil.Hex8(LOBJ.Unknown3), LOBJ.OriginVector[0], LOBJ.OriginVector[1], LOBJ.OriginVector[2], LOBJ.DestinationVector[0], LOBJ.DestinationVector[1], LOBJ.DestinationVector[2], LOBJ.Scale, LOBJ.Unknown6, LOBJ.Unknown7, LOBJ.Unknown8, HexUtil.Hex16(LOBJ.LightID), HexUtil.Hex16(LOBJ.Unknown4), HexUtil.Hex32(LOBJ.Unknown5), HexUtil.Hex8(LOBJ.RGBA[0]), HexUtil.Hex8(LOBJ.RGBA[1]), HexUtil.Hex8(LOBJ.RGBA[2]), HexUtil.Hex8(LOBJ.RGBA[3]), HexUtil.Hex64(LOBJ.Unknown1), HexUtil.Hex16(LOBJ.Unknown2), HexUtil.Hex64(LOBJ.Padding)); } }
public void ReadBLIGHT(string FilePath) { FileName = FilePath; BigEndianReader Reader = new BigEndianReader(new MemoryStream(File.ReadAllBytes(FilePath))); BLIGHT.Magic = Encoding.ASCII.GetString(Reader.ReadBytes(0x04)); if (BLIGHT.Magic != "LGHT") { throw new WrongMagicException(BLIGHT.Magic, "LGHT", Reader.BaseStream.Position - 4); } BLIGHT.FileSize = Reader.ReadUInt32(); BLIGHT.Unknown1 = Reader.ReadUInt32(); BLIGHT.Unknown2 = Reader.ReadUInt32(); BLIGHT.NrLOBJ = Reader.ReadUInt16(); BLIGHT.NrAmbientLight = Reader.ReadUInt16(); BLIGHT.Unknown3 = Reader.ReadUInt32(); BLIGHT.Padding = Reader.ReadUInt64(); BLIGHT.Padding2 = Reader.ReadUInt64(); for (int i = 0; i < BLIGHT.NrLOBJ; i++) { LOBJ.Magic = Encoding.ASCII.GetString(Reader.ReadBytes(0x04)); if (LOBJ.Magic != "LOBJ") { throw new WrongMagicException(LOBJ.Magic, "LOBJ", Reader.BaseStream.Position - 4); } LOBJ.SectionSize = Reader.ReadUInt32(); if (LOBJ.SectionSize != 0x50) { MessageBox.Show("Please give this file to Wexos!"); } LOBJ.Unknown1 = Reader.ReadUInt64(); LOBJ.Unknown2 = Reader.ReadUInt16(); LOBJ.LightType = Reader.ReadByte(); LOBJ.Unknown3 = Reader.ReadByte(); LOBJ.LightID = Reader.ReadUInt16(); LOBJ.Unknown4 = Reader.ReadUInt16(); LOBJ.OriginVector = Reader.ReadSingles(3); LOBJ.DestinationVector = Reader.ReadSingles(3); LOBJ.Scale = Reader.ReadSingle(); LOBJ.RGBA = Reader.ReadBytes(4); LOBJ.Unknown5 = Reader.ReadUInt32(); LOBJ.Unknown6 = Reader.ReadSingle(); LOBJ.Unknown7 = Reader.ReadSingle(); LOBJ.Unknown8 = Reader.ReadSingle(); LOBJ.Padding = Reader.ReadUInt64(); dgwLOBJ.Rows.Add(HexUtil.Hex8(Convert.ToByte(i)), HexUtil.Hex8(LOBJ.LightType), HexUtil.Hex8(LOBJ.Unknown3), LOBJ.OriginVector[0], LOBJ.OriginVector[1], LOBJ.OriginVector[2], LOBJ.DestinationVector[0], LOBJ.DestinationVector[1], LOBJ.DestinationVector[2], LOBJ.Scale, LOBJ.Unknown6, LOBJ.Unknown7, LOBJ.Unknown8, HexUtil.Hex16(LOBJ.LightID), HexUtil.Hex16(LOBJ.Unknown4), HexUtil.Hex32(LOBJ.Unknown5), HexUtil.Hex8(LOBJ.RGBA[0]), HexUtil.Hex8(LOBJ.RGBA[1]), HexUtil.Hex8(LOBJ.RGBA[2]), HexUtil.Hex8(LOBJ.RGBA[3]), HexUtil.Hex64(LOBJ.Unknown1), HexUtil.Hex16(LOBJ.Unknown2), HexUtil.Hex64(LOBJ.Padding)); } for (int i = 0; i < BLIGHT.NrAmbientLight; i++) { Ambient.RGBALight = Reader.ReadBytes(4); Ambient.Padding = Reader.ReadUInt32(); dgwAmbient.Rows.Add(HexUtil.Hex8(Convert.ToByte(i)), HexUtil.Hex8(Ambient.RGBALight[0]), HexUtil.Hex8(Ambient.RGBALight[1]), HexUtil.Hex8(Ambient.RGBALight[2]), HexUtil.Hex8(Ambient.RGBALight[3]), HexUtil.Hex32(Ambient.Padding)); } LOBJColor.BackColor = Color.FromArgb(byte.Parse(dgwLOBJ.Rows[0].Cells[16].Value.ToString(), NumberStyles.HexNumber), byte.Parse(dgwLOBJ.Rows[0].Cells[17].Value.ToString(), NumberStyles.HexNumber), byte.Parse(dgwLOBJ.Rows[0].Cells[18].Value.ToString(), NumberStyles.HexNumber)); AmbientColor.BackColor = Color.FromArgb(byte.Parse(dgwAmbient.Rows[0].Cells[1].Value.ToString(), NumberStyles.HexNumber), byte.Parse(dgwAmbient.Rows[0].Cells[2].Value.ToString(), NumberStyles.HexNumber), byte.Parse(dgwAmbient.Rows[0].Cells[3].Value.ToString(), NumberStyles.HexNumber)); this.Show(); Reader.Close(); }
public Section3(BigEndianReader Reader) { NameOffset = Reader.ReadUInt16(); Alpha = Reader.ReadUInt16(); Animation = Reader.ReadUInt16(); Padding = Reader.ReadUInt16(); Delay = Reader.ReadSingle(); TranslationWS = Reader.ReadSingles(3); ScaleWS = Reader.ReadSingles(2); Translation = Reader.ReadSingles(3); Scale = Reader.ReadSingles(2); Section4ID = Reader.ReadUInt16(); NrSection4 = Reader.ReadUInt16(); Section5ID = Reader.ReadUInt16(); NrSection5 = Reader.ReadUInt16(); }
public void ReadBDOF(string FilePath) { FileName = FilePath; BigEndianReader Reader = new BigEndianReader(new MemoryStream(File.ReadAllBytes(FilePath))); BDOF.Magic = Reader.ReadASCII(4); if (BDOF.Magic != "PDOF") { throw new WrongMagicException(BDOF.Magic, "PDOF", Reader.BaseStream.Position - 4); } BDOF.FileSize = Reader.ReadUInt32(); if (BDOF.FileSize != 0x50) { MessageBox.Show("Please give this file to Wexos!"); } BDOF.Unknown1 = Reader.ReadUInt64(); BDOF.Activator = Reader.ReadUInt16(); BDOF.Unknown2 = Reader.ReadUInt16(); BDOF.Unknown3 = Reader.ReadUInt32(); BDOF.FloatValues = Reader.ReadSingles(10); BDOF.Padding = Reader.ReadUInt64s(0x02); bdofComponent1.AddData(BDOF); this.Show(); Reader.Close(); }