public TreeNode ToTree() { TreeNode t = new TreeNode("#E" + MyIndex.ToString("d6") + " : " + pcc.GetObject(MyIndex + 1) + "(" + pcc.GetObjectClass(MyIndex + 1) + ")"); t.Name = (MyIndex + 1).ToString(); for (int i = 0; i < Objects.Count; i++) { if (Objects[i] == 0) { continue; } TreeNode t2 = new TreeNode(); if (Objects[i] > 0) { t2.Text = "#E" + (Objects[i] - 1).ToString("d6") + " : " + pcc.GetObject(Objects[i]) + "(" + pcc.GetObjectClass(Objects[i]) + ")"; } else { t2.Text = "#I" + (-Objects[i] - 1).ToString("d6") + " : " + pcc.GetObject(Objects[i]) + "(" + pcc.GetObjectClass(Objects[i]) + ")"; } t2.Name = Objects[i].ToString(); if (Objects[i] > 0 && pcc.GetObjectClass(Objects[i]) != "Sequence") { t2 = MakeSubObj(t2, Objects[i] - 1); } t.Nodes.Add(t2); } return(t); }
public void LoadFile(string path) { currfilepath = path; this.Text = "Camera Tool - " + Path.GetFileName(path); pcc = new PCCPackage(path, true, false, true); Indexes = new List <int>(); for (int i = 0; i < pcc.Exports.Count; i++) { PCCPackage.ExportEntry e = pcc.Exports[i]; string c = pcc.GetObject(e.idxClass); if (c == "InterpData") { List <PropertyReader.Property> props = PropertyReader.ReadProp(pcc, e.Data, PropertyReader.detectStart(pcc, e.Data, (uint)e.ObjectFlags)); bool has = false; foreach (PropertyReader.Property p in props) { if (pcc.GetName(p.Name) == "InterpGroups") { has = true; break; } } if (has) { Indexes.Add(i); } } } FreshList(); }
public StaticMeshComponent(PCCPackage Pcc, int index, Matrix transform) { pcc = Pcc; MyIndex = index; byte[] buff = pcc.GetObjectData(index); Props = PropertyReader.getPropList(pcc, buff); ParentMatrix = transform; foreach (PropertyReader.Property p in Props) { string s = pcc.GetName(p.Name); switch (s) { case "StaticMesh": idxSTM = p.Value.IntValue; break; case "Scale": Scale = BitConverter.ToSingle(p.raw, p.raw.Length - 4); break; case "Scale3D": Scale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12), BitConverter.ToSingle(p.raw, p.raw.Length - 8), BitConverter.ToSingle(p.raw, p.raw.Length - 4)); break; case "Rotation": Rotation = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12), BitConverter.ToInt32(p.raw, p.raw.Length - 8), BitConverter.ToInt32(p.raw, p.raw.Length - 4)); break; case "Translation": Translation = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12), BitConverter.ToSingle(p.raw, p.raw.Length - 8), BitConverter.ToSingle(p.raw, p.raw.Length - 4)); break; default: break; } } MyMatrix = Matrix.Identity; MyMatrix *= Matrix.Scaling(Scale3D); MyMatrix *= Matrix.Scaling(new Vector3(Scale, Scale, Scale)); Vector3 rot = DXHelper.RotatorToDX(Rotation); MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z); MyMatrix *= Matrix.Translation(Translation); Matrix t = MyMatrix * ParentMatrix; if (idxSTM > 0 && !pcc.GetObject(idxSTM).ToLower().Contains("volumetric") && !pcc.GetObject(idxSTM).ToLower().Contains("spheremesh")) STM = new StaticMesh(pcc, idxSTM - 1, t); }
public void FreshList() { splitContainer1.BringToFront(); listBox1.Items.Clear(); foreach (int idx in Indexes) { listBox1.Items.Add(idx + " : " + pcc.GetObjectPath(idx + 1) + pcc.GetObject(idx + 1) + "(" + pcc.Exports[idx].Index + ")"); } }
public Level(PCCPackage Pcc, int index) { pcc = Pcc; MyIndex = index; byte[] buff = pcc.GetObjectData(index); Props = PropertyReader.getPropList(pcc, buff); int off = Props[Props.Count() - 1].offend + 4; int count = BitConverter.ToInt32(buff, off); Objects = new List <int>(); for (int i = 0; i < count; i++) { int idx = BitConverter.ToInt32(buff, off + 4 + i * 4); Objects.Add(idx); } for (int i = 0; i < pcc.Exports.Count; i++) { if (pcc.Exports[i].idxLink - 1 == index) { bool found = false; foreach (int j in Objects) { if (j == i + 1) { found = true; } } if (!found) { Objects.Add(i + 1); } } } RenderObjects = new List <_DXRenderableObject>(); foreach (int i in Objects) { if (i > 0) { string c = pcc.GetObject(pcc.Exports[i - 1].idxClass); switch (c) { case "ModelComponent": RenderObjects.Add(new ModelComponent(pcc, i - 1)); break; case "StaticMeshActor": case "InterpActor": RenderObjects.Add(new StaticMeshActor(pcc, i - 1)); break; case "StaticMeshCollectionActor": RenderObjects.Add(new StaticMeshCollectionActor(pcc, i - 1)); break; default: break; } } } }
public StaticMeshComponent(PCCPackage Pcc, int index, Matrix transform) { pcc = Pcc; MyIndex = index; byte[] buff = pcc.GetObjectData(index); Props = PropertyReader.getPropList(pcc, buff); ParentMatrix = transform; foreach (PropertyReader.Property p in Props) { string s = pcc.GetName(p.Name); switch (s) { case "StaticMesh": idxSTM = p.Value.IntValue; break; case "Scale": Scale = BitConverter.ToSingle(p.raw, p.raw.Length - 4); break; case "Scale3D": Scale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12), BitConverter.ToSingle(p.raw, p.raw.Length - 8), BitConverter.ToSingle(p.raw, p.raw.Length - 4)); break; case "Rotation": Rotation = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12), BitConverter.ToInt32(p.raw, p.raw.Length - 8), BitConverter.ToInt32(p.raw, p.raw.Length - 4)); break; case "Translation": Translation = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12), BitConverter.ToSingle(p.raw, p.raw.Length - 8), BitConverter.ToSingle(p.raw, p.raw.Length - 4)); break; default: break; } } MyMatrix = Matrix.Identity; MyMatrix *= Matrix.Scaling(Scale3D); MyMatrix *= Matrix.Scaling(new Vector3(Scale, Scale, Scale)); Vector3 rot = DXHelper.RotatorToDX(Rotation); MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z); MyMatrix *= Matrix.Translation(Translation); Matrix t = MyMatrix * ParentMatrix; if (idxSTM > 0 && !pcc.GetObject(idxSTM).ToLower().Contains("volumetric") && !pcc.GetObject(idxSTM).ToLower().Contains("spheremesh")) { STM = new StaticMesh(pcc, idxSTM - 1, t); } }
private void listBox2_SelectedIndexChanged(object sender, EventArgs e) { int n = listBox2.SelectedIndex; if (n == -1) { return; } PCCPackage p = new PCCPackage(OverView[n].filepath, false, false, true); listBox3.Items.Clear(); foreach (int i in OverView[n].Indexes) { listBox3.Items.Add(i + " : " + p.GetObjectPath(i + 1) + p.GetObject(i + 1) + "(" + p.Exports[i].Index + ")"); } }
public Level(PCCPackage Pcc, int index) { pcc = Pcc; MyIndex = index; byte[] buff = pcc.GetObjectData(index); Props = PropertyReader.getPropList(pcc, buff); int off = Props[Props.Count() - 1].offend + 4; int count = BitConverter.ToInt32(buff, off); Objects = new List<int>(); for (int i = 0; i < count; i++) { int idx = BitConverter.ToInt32(buff, off + 4 + i * 4); Objects.Add(idx); } for (int i = 0; i < pcc.Exports.Count; i++) if (pcc.Exports[i].idxLink - 1 == index) { bool found = false; foreach (int j in Objects) if (j == i + 1) found = true; if (!found) Objects.Add(i + 1); } RenderObjects = new List<_DXRenderableObject>(); foreach (int i in Objects) if (i > 0) { string c = pcc.GetObject(pcc.Exports[i - 1].idxClass); switch (c) { case "ModelComponent": RenderObjects.Add(new ModelComponent(pcc, i - 1)); break; case "StaticMeshActor": case "InterpActor": RenderObjects.Add(new StaticMeshActor(pcc, i - 1)); break; case "StaticMeshCollectionActor": RenderObjects.Add(new StaticMeshCollectionActor(pcc, i - 1)); break; default: break; } } }
public TreeNode ToTree() { TreeNode t = new TreeNode("E#" + MyIndex.ToString("d6") + " : Level"); t.Name = (MyIndex + 1).ToString(); foreach (int i in Objects) { if (i > 0) { string c = pcc.GetObject(pcc.Exports[i - 1].idxClass); bool found = false; foreach (_DXRenderableObject m in RenderObjects) { if (m.MyIndex == i - 1) { t.Nodes.Add(m.ToTree()); found = true; break; } } if (!found) { TreeNode t2 = new TreeNode("E#" + (i - 1).ToString("d6") + " : " + pcc.GetObject(i)); t2.Name = i.ToString(); t.Nodes.Add(t2); } } else if (i < 0) { TreeNode t2 = new TreeNode("I#" + (-i - 1).ToString("d6") + " : " + pcc.GetObject(i)); t2.Name = i.ToString(); t.Nodes.Add(t2); } else { TreeNode t2 = new TreeNode("#000000 : \"this\""); t2.Name = i.ToString(); t.Nodes.Add(t2); } } t.Expand(); return(t); }
private void generateFromBasefolderToolStripMenuItem_Click(object sender, EventArgs e) { string basepath = KFreonLib.MEDirectories.ME3Directory.cookedPath; if (String.IsNullOrEmpty(basepath)) { MessageBox.Show("This functionality requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3"); return; } KFreonLib.Debugging.DebugOutput.StartDebugger("Main ME3Explorer Form"); string[] files = Directory.GetFiles(basepath, "*.pcc"); OverView = new List <OverViewStruct>(); for (int f = 0; f < files.Length; f++) { string file = files[f]; KFreonLib.Debugging.DebugOutput.PrintLn((f + 1) + " / " + files.Length + " : " + file + " :", true); PCCPackage p = new PCCPackage(file, false, false, true); OverViewStruct o = new OverViewStruct(); o.filepath = file; o.Indexes = new List <int>(); int count = 0; for (int i = 0; i < p.Exports.Count; i++) { if (p.GetObject(p.Exports[i].idxClass) == "InterpData") { o.Indexes.Add(i); string s = ""; if (count++ == 0) { s = "\n"; } KFreonLib.Debugging.DebugOutput.PrintLn(s + "found " + i + " : " + p.GetObjectPath(i + 1) + p.GetObject(i + 1), false); } } if (o.Indexes.Count != 0) { OverView.Add(o); } Application.DoEvents(); } FreshOverView(); }
public void Init(PCCPackage p, int index = 0) { pcc = p; comboBox1.Items.Clear(); comboBox2.Items.Clear(); for (int i = 0; i < pcc.Header.ExportCount; i++) { comboBox1.Items.Add(i.ToString("d6") + " : " + pcc.GetObjectPath(i + 1) + pcc.GetObject(i + 1)); } for (int i = 0; i < pcc.Header.ImportCount; i++) { comboBox2.Items.Add(i.ToString("d6") + " : " + pcc.GetObjectPath(-i - 1) + pcc.GetObject(-i - 1)); } comboBox1.SelectedIndex = comboBox2.SelectedIndex = 0; if (index == 0) { r1.Checked = true; } if (index > 0) { comboBox1.SelectedIndex = index - 1; r2.Checked = true; } if (index < 0) { comboBox2.SelectedIndex = -index - 1; r3.Checked = true; } }