public int GetPropertyEnd() { int pos = 0x00; try { int test = BitConverter.ToInt32(Owner.Exports[MyIndex].Data, 8); if (test == 0) { pos = 0x04; } else { pos = 0x08; } if ((Flags & 0x02000000) != 0) { pos = 0x1A; } while (true) { int idxname = BitConverter.ToInt32(Owner.Exports[MyIndex].Data, pos); if (Owner.GetName(idxname) == "None" || Owner.GetName(idxname) == "") { break; } int idxtype = BitConverter.ToInt32(Owner.Exports[MyIndex].Data, pos + 8); int size = BitConverter.ToInt32(Owner.Exports[MyIndex].Data, pos + 16); if (size == 0) { size = 1; //boolean fix } if (Owner.GetName(idxtype) == "StructProperty") { size += 8; } if (Owner.GetName(idxtype) == "ByteProperty") { size += 8; } pos += 24 + size; if (pos > Owner.Exports[MyIndex].Data.Length) { pos -= 24 + size; break; } } } catch (Exception e) { MessageBox.Show(e.ToString()); } return(pos + 8); }
public Sequence(PCCPackage Pcc, int index) { pcc = Pcc; MyIndex = index; byte[] buff = pcc.GetObjectData(index + 1); Props = PropertyReader.getPropList(pcc, buff); Objects = new List <int>(); foreach (PropertyReader.Property p in Props) { string s = pcc.GetName(p.Name); switch (s) { case "SequenceObjects": int count = BitConverter.ToInt32(p.raw, 24); for (int i = 0; i < count; i++) { Objects.Add(BitConverter.ToInt32(p.raw, 28 + i * 4)); } break; } } for (int i = 0; i < pcc.Exports.Count; i++) { if (pcc.Exports[i].idxLink == MyIndex + 1) { Objects.Add(i + 1); } } Objects.Sort(); }
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.getObjectName(idxSTM).ToLower().Contains("volumetric") && !pcc.getObjectName(idxSTM).ToLower().Contains("spheremesh")) { STM = new StaticMesh(pcc, idxSTM - 1, t); } }
public StaticMeshActor(PCCPackage Pcc, int index) { pcc = Pcc; MyIndex = index; byte[] buff = pcc.GetObjectData(index); Props = PropertyReader.getPropList(pcc, buff); foreach (PropertyReader.Property p in Props) { string s = pcc.GetName(p.Name); switch (s) { case "StaticMeshComponent": idxSTM = p.Value.IntValue; break; case "DrawScale": DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4); break; case "DrawScale3D": DrawScale3D = 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": Rotator = 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 "location": location = 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(DrawScale3D); MyMatrix *= Matrix.Scaling(new Vector3(DrawScale, DrawScale, DrawScale)); Vector3 rot = DXHelper.RotatorToDX(Rotator); MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z); MyMatrix *= Matrix.Translation(location); if (idxSTM != 0) { STMC = new StaticMeshComponent(pcc, idxSTM - 1, MyMatrix); } }
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.getObjectName(idxSTM).ToLower().Contains("volumetric") && !pcc.getObjectName(idxSTM).ToLower().Contains("spheremesh")) STM = new StaticMesh(pcc, idxSTM - 1, t); }
public StaticMeshActor(PCCPackage Pcc, int index) { pcc = Pcc; MyIndex = index; byte[]buff = pcc.GetObjectData(index); Props = PropertyReader.getPropList(pcc, buff); foreach (PropertyReader.Property p in Props) { string s = pcc.GetName(p.Name); switch (s) { case "StaticMeshComponent": idxSTM = p.Value.IntValue; break; case "DrawScale": DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4); break; case "DrawScale3D": DrawScale3D = 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": Rotator = 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 "location": location = 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(DrawScale3D); MyMatrix *= Matrix.Scaling(new Vector3(DrawScale, DrawScale, DrawScale)); Vector3 rot = DXHelper.RotatorToDX(Rotator); MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z); MyMatrix *= Matrix.Translation(location); if (idxSTM != 0) STMC = new StaticMeshComponent(pcc, idxSTM - 1, MyMatrix); }
public Sequence(PCCPackage Pcc, int index) { pcc = Pcc; MyIndex = index; byte[] buff = pcc.GetObjectData(index + 1); Props = PropertyReader.getPropList(pcc, buff); Objects = new List<int>(); foreach (PropertyReader.Property p in Props) { string s = pcc.GetName(p.Name); switch (s) { case "SequenceObjects": int count = BitConverter.ToInt32(p.raw, 24); for (int i = 0; i < count; i++) Objects.Add(BitConverter.ToInt32(p.raw, 28 + i * 4)); break; } } for (int i = 0; i < pcc.Exports.Count; i++) if (pcc.Exports[i].idxLink == MyIndex + 1) Objects.Add(i + 1); Objects.Sort(); }
//for debugging purposes. not exposed to user private void InterpTrackScan_Click(object sender, EventArgs e) { KFreonLib.Debugging.DebugOutput.StartDebugger("Main ME3Explorer Form"); string basepath = ME3Directory.cookedPath; string[] files = Directory.GetFiles(basepath, "*.pcc"); List <string> conds = new List <string>(); List <string> conds1 = new List <string>(); //string property = Microsoft.VisualBasic.Interaction.InputBox("Please enter property name", "ME3 Explorer"); string name; 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, true, false, true); for (int i = 0; i < p.Exports.Count; i++) { if (p.GetObjectClass(i).StartsWith("InterpTrackVisibility")) //GetObject(p.Exports[i].idxLink).StartsWith("InterpGroup")) { List <ME3LibWV.PropertyReader.Property> props = ME3LibWV.PropertyReader.getPropList(p, p.Exports[i].Data); foreach (ME3LibWV.PropertyReader.Property prop in props) { //KFreonLib.Debugging.DebugOutput.PrintLn(p.GetName(prop.Name)); if (p.GetName(prop.Name) == "VisibilityTrack") { int pos = 28; int count = BitConverter.ToInt32(prop.raw, 24); for (int j = 0; j < count; j++) { List <ME3LibWV.PropertyReader.Property> p2 = ME3LibWV.PropertyReader.ReadProp(p, prop.raw, pos); for (int k = 0; k < p2.Count; k++) { name = p.GetName(p2[k].Name); if (name == "Action") { if (!conds.Contains(p.GetName(BitConverter.ToInt32(p2[k].raw, 32)))) { conds.Add(p.GetName(BitConverter.ToInt32(p2[k].raw, 32))); KFreonLib.Debugging.DebugOutput.PrintLn("Action " + p.GetName(BitConverter.ToInt32(p2[k].raw, 24)) + ", " + p.GetName(BitConverter.ToInt32(p2[k].raw, 32)) + " at: #" + i + " " + p.GetObjectPath(i + 1) + p.GetObjectClass(i + 1) + " in: " + file.Substring(file.LastIndexOf(@"\") + 1), false); } } else if (name == "ActiveCondition") { if (!conds1.Contains(p.GetName(BitConverter.ToInt32(p2[k].raw, 32)))) { conds1.Add(p.GetName(BitConverter.ToInt32(p2[k].raw, 32))); KFreonLib.Debugging.DebugOutput.PrintLn("ActiveCondition " + p.GetName(BitConverter.ToInt32(p2[k].raw, 24)) + ", " + p.GetName(BitConverter.ToInt32(p2[k].raw, 32)) + " at: #" + i + " " + p.GetObjectPath(i + 1) + p.GetObjectClass(i + 1) + " in: " + file.Substring(file.LastIndexOf(@"\") + 1), false); } } pos += p2[k].raw.Length; } } } //if (p.GetName(prop.Name) == property) //{ // if(!conds.Contains(p.GetName(BitConverter.ToInt32(prop.raw, 32)))) // { // conds.Add(p.GetName(BitConverter.ToInt32(prop.raw, 32))); // KFreonLib.Debugging.DebugOutput.PrintLn(p.GetName(BitConverter.ToInt32(prop.raw, 24)) + ", " + p.GetName(BitConverter.ToInt32(prop.raw, 32)) + " at: #" + i + " " + p.GetObjectPath(i + 1) + p.GetObjectClass(i + 1) + " in: " + file.Substring(file.LastIndexOf(@"\") + 1), false); // } //} } //KFreonLib.Debugging.DebugOutput.PrintLn(i + " : " + p.GetObjectClass(i + 1) + " at: " + p.GetObjectPath(i + 1) + " in: " + file.Substring(file.LastIndexOf(@"\") + 1), false); } } Application.DoEvents(); } KFreonLib.Debugging.DebugOutput.PrintLn(); KFreonLib.Debugging.DebugOutput.PrintLn("*****************"); KFreonLib.Debugging.DebugOutput.PrintLn("Done"); }
public TreeNode MakeSubObj(TreeNode t, int index) { byte[] buff = pcc.GetObjectData(index); List <PropertyReader.Property> Pr = PropertyReader.getPropList(pcc, buff); int count, pos, count2, pos2; TreeNode t2, t3, t4; List <PropertyReader.Property> Pr2, Pr3; foreach (PropertyReader.Property p in Pr) { string s = pcc.GetName(p.Name); switch (s) { #region InputLinks case "InputLinks": t2 = new TreeNode("Input Links"); count = BitConverter.ToInt32(p.raw, 24); pos = 28; for (int i = 0; i < count; i++) { t3 = new TreeNode(i.ToString()); Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos); foreach (PropertyReader.Property pp in Pr2) { string s2 = pcc.GetName(pp.Name); switch (s2) { case "LinkDesc": t3.Nodes.Add("Link Description : " + pp.Value.StringValue); break; case "LinkAction": t3.Nodes.Add("Link Action : " + pcc.GetName(pp.Value.IntValue)); break; case "LinkedOp": t3.Nodes.Add("Linked Operation : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.GetObject(pp.Value.IntValue)); break; } } t2.Nodes.Add(t3); pos = Pr2[Pr2.Count - 1].offend; } t.Nodes.Add(t2); break; #endregion #region Output Links case "OutputLinks": t2 = new TreeNode("Output Links"); count = BitConverter.ToInt32(p.raw, 24); pos = 28; for (int i = 0; i < count; i++) { t3 = new TreeNode(i.ToString()); Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos); foreach (PropertyReader.Property pp in Pr2) { string s2 = pcc.GetName(pp.Name); switch (s2) { case "LinkDesc": t3.Nodes.Add("Link Description : " + pp.Value.StringValue); break; case "LinkAction": t3.Nodes.Add("Link Action : " + pcc.GetName(pp.Value.IntValue)); break; case "LinkedOp": t3.Nodes.Add("Linked Operation : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.GetObject(pp.Value.IntValue)); break; case "Links": t4 = new TreeNode("Links"); count2 = BitConverter.ToInt32(pp.raw, 24); pos2 = 28; for (int i2 = 0; i2 < count2; i2++) { Pr3 = PropertyReader.ReadProp(pcc, pp.raw, pos2); string res = "#" + i2.ToString() + " : "; foreach (PropertyReader.Property ppp in Pr3) { string s3 = pcc.GetName(ppp.Name); switch (s3) { case "LinkedOp": res += "Linked Operation (" + ppp.Value.IntValue + " " + pcc.GetObjectPath(ppp.Value.IntValue) + pcc.GetObject(ppp.Value.IntValue) + ") "; break; case "InputLinkIdx": res += "Input Link Index(" + ppp.Value.IntValue + ")"; break; } } t4.Nodes.Add(res); pos2 = Pr3[Pr3.Count - 1].offend; } t3.Nodes.Add(t4); break; } } t2.Nodes.Add(t3); pos = Pr2[Pr2.Count - 1].offend; } t.Nodes.Add(t2); break; #endregion #region Variable Links case "VariableLinks": t2 = new TreeNode("Variable Links"); count = BitConverter.ToInt32(p.raw, 24); pos = 28; for (int i = 0; i < count; i++) { t3 = new TreeNode(i.ToString()); Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos); foreach (PropertyReader.Property pp in Pr2) { string s2 = pcc.GetName(pp.Name); switch (s2) { case "LinkDesc": t3.Nodes.Add("Link Description : " + pp.Value.StringValue); break; case "LinkVar": t3.Nodes.Add("Link Variable : " + pcc.GetName(pp.Value.IntValue)); break; case "PropertyName": t3.Nodes.Add("Property Name : " + pcc.GetName(pp.Value.IntValue)); break; case "ExpectedType": t3.Nodes.Add("Expected Type : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.GetObject(pp.Value.IntValue)); break; case "LinkedVariables": t4 = new TreeNode("Linked Variables"); count2 = BitConverter.ToInt32(pp.raw, 24); for (int i2 = 0; i2 < count2; i2++) { int idx = BitConverter.ToInt32(pp.raw, 28 + i2 * 4); t4.Nodes.Add("#" + i2.ToString() + " : #" + idx + " " + pcc.GetObjectPath(idx) + pcc.GetObject(idx)); } t3.Nodes.Add(t4); break; } } t2.Nodes.Add(t3); pos = Pr2[Pr2.Count - 1].offend; } t.Nodes.Add(t2); break; #endregion } } return(t); }
public void FreshTree(int n) { splitContainer1.BringToFront(); treeView1.Nodes.Clear(); PCCPackage.ExportEntry e = pcc.Exports[n]; List <PropertyReader.Property> props = PropertyReader.ReadProp(pcc, e.Data, PropertyReader.detectStart(pcc, e.Data, (uint)e.ObjectFlags)); TreeNode t = new TreeNode(n + " : " + pcc.GetObject(n + 1)); int idx; foreach (PropertyReader.Property p in props) { switch (pcc.GetName(p.Name)) { case "InterpGroups": int count = BitConverter.ToInt32(p.raw, 24); TreeNode groups = new TreeNode("Interp Groups (" + count + ")"); for (int i = 0; i < count; i++) { idx = BitConverter.ToInt32(p.raw, 28 + i * 4); if (idx > 0) { groups.Nodes.Add(MakeInterpGroupNode(idx - 1)); } else { groups.Nodes.Add(idx + ""); } } if (groups.Nodes.Count != 0) { t.Nodes.Add(groups); } break; case "InterpLength": byte[] buff = BitConverter.GetBytes(p.Value.IntValue); float f = BitConverter.ToSingle(buff, 0); t.Nodes.Add("Interp Length : " + f); break; case "ParentSequence": idx = p.Value.IntValue; if (idx > 0) { t.Nodes.Add("Parent Sequence : " + idx + " (" + pcc.GetObject(idx) + ")"); } break; } } treeView1.Nodes.Add(t); treeView1.Nodes[0].Expand(); }