private void importFromFileToolStripMenuItem_Click(object sender, EventArgs e) { string path = ""; OpenFileDialog FileDialog1 = new OpenFileDialog(); FileDialog1.Filter = "PropertyDef(*.xml)|*.xml"; if (FileDialog1.ShowDialog() == DialogResult.OK) { path = FileDialog1.FileName; UPropertyReader t = new UPropertyReader(); t.ImportDefinitionsXML(path); for (int i = 0; i < t.Definitions.Count; i++) { int n = -1; for (int j = 0; j < UPR.Definitions.Count; j++) { if (UPR.Definitions[j].name == t.Definitions[i].name) { n = j; break; } } if (n == -1) { System.Windows.Forms.DialogResult m = MessageBox.Show("Do you want to import class : \"" + t.Definitions[i].name + "\"?", "ME3 Explorer", MessageBoxButtons.YesNo); if (m == System.Windows.Forms.DialogResult.Yes) { UPR.Definitions.Add(t.Definitions[i]); } } else { UPropertyReader.ClassDefinition d = t.Definitions[i]; for (int j = 0; j < d.props.Count; j++) { int m = -1; for (int k = 0; k < UPR.Definitions[n].props.Count; k++) { if (d.props[j].name == UPR.Definitions[n].props[k].name) { m = j; break; } } if (m == -1) { System.Windows.Forms.DialogResult m2 = MessageBox.Show("Do you want to import the property: \"" + t.Definitions[i].props[j].name + "\" into class : \"" + t.Definitions[i].name + "\"?", "ME3 Explorer", MessageBoxButtons.YesNo); if (m2 == System.Windows.Forms.DialogResult.Yes) { UPR.Definitions[n].props.Add(t.Definitions[i].props[j]); } } } } } RefreshView(); } }
private void PropertyManager_Load(object sender, EventArgs e) { UPR = new UPropertyReader(); string loc = Path.GetDirectoryName(Application.ExecutablePath); if (File.Exists(loc + "\\exec\\DefaultProp.xml")) { UPR.ImportDefinitionsXML(loc + "\\exec\\DefaultProp.xml"); } RefreshView(); }
private void button13_Click(object sender, EventArgs e) { int source = refO.Level.UStat[refStat].LP.source; int entry = refO.Level.UStat[refStat].LP.sourceentry; int parent = refO.Level.UStat[refStat].index2; int parentidx = refO.Level.UStat[refStat].index3; UPropertyReader UPR = refO.Level.UPR; PCCFile pcc = refO.Level.pcc; UMath math = new UMath(); if (source == 0)//Static Actor { UStaticMeshActor u = new UStaticMeshActor(pcc.EntryToBuff(entry), pcc.names); u.UPR = UPR; u.Deserialize(); int ent = UPR.FindProperty("location", u.props); if (ent != -1) { ent++; int off1 = (int)pcc.Export[entry].DataOffset; int off2 = u.props[ent].offset + u.props[ent].raw.Length - 12; Vector3 v = UPR.PropToVector3(u.props[ent].raw); v += loc; byte[] buff = BitConverter.GetBytes(v.X); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i] = buff[i]; } buff = BitConverter.GetBytes(v.Y); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i + 4] = buff[i]; } buff = BitConverter.GetBytes(v.Z); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i + 8] = buff[i]; } } ent = UPR.FindProperty("Rotator", u.props); if (ent != -1) { int off1 = (int)pcc.Export[entry].DataOffset; int off2 = u.props[ent].offset + u.props[ent].raw.Length - 12; UMath.Rotator r = math.PropToRotator(u.props[ent].raw); UMath.Rotator r2 = math.IntVectorToRotator(rot); r = r + r2; byte[] buff = BitConverter.GetBytes(r.Pitch); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i] = buff[i]; } buff = BitConverter.GetBytes(r.Roll); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i + 4] = buff[i]; } buff = BitConverter.GetBytes(r.Yaw); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i + 8] = buff[i]; } } } if (source == 1)//Collection { UStaticMeshComponent uc = refO.Level.UStatComp[parentidx]; UStaticMeshCollectionActor u = refO.Level.UStatColl[uc.index3]; int ent = UPR.FindProperty("Scale3D", uc.props); if (ent != -1) { Matrix m = current; Vector3 v = new Vector3(m.M41, m.M42, m.M43); Vector3 v2 = UPR.PropToVector3(uc.props[ent + 1].raw); v2.X = 1 / v2.X; v2.Y = 1 / v2.Y; v2.Z = 1 / v2.Z; m.M41 = 0; m.M42 = 0; m.M43 = 0; m *= Matrix.Scaling(v2); m.M41 = v.X; m.M42 = v.Y; m.M43 = v.Z; current = m; } int ent2 = uc.index2; if (ent2 != -1) { int off = u.props[u.props.Count - 1].offset + u.props[u.props.Count - 1].raw.Length + (int)pcc.Export[entry].DataOffset + ent2 * 16 * 4; byte[] buff = BitConverter.GetBytes(current.M11); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M12); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M13); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M14); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M21); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M22); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M23); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M24); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M31); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M32); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M33); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M34); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M41); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M42); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M43); WriteMemory(off, buff); off += 4; buff = BitConverter.GetBytes(current.M44); WriteMemory(off, buff); off += 4; } } if (source == 2)//Interp Actor { UInterpActor u = new UInterpActor(pcc.EntryToBuff(entry), pcc.names); u.UPR = UPR; u.Deserialize(); int ent = UPR.FindProperty("location", u.props); if (ent != -1) { ent++; int off1 = (int)pcc.Export[entry].DataOffset; int off2 = u.props[ent].offset + u.props[ent].raw.Length - 12; Vector3 v = UPR.PropToVector3(u.props[ent].raw); v += loc; byte[] buff = BitConverter.GetBytes(v.X); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i] = buff[i]; } buff = BitConverter.GetBytes(v.Y); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i + 4] = buff[i]; } buff = BitConverter.GetBytes(v.Z); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i + 8] = buff[i]; } } ent = UPR.FindProperty("Rotator", u.props); if (ent != -1) { int off1 = (int)pcc.Export[entry].DataOffset; int off2 = u.props[ent].offset + u.props[ent].raw.Length - 12; UMath.Rotator r = math.PropToRotator(u.props[ent].raw); UMath.Rotator r2 = math.IntVectorToRotator(rot); r = r + r2; byte[] buff = BitConverter.GetBytes(r.Pitch); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i] = buff[i]; } buff = BitConverter.GetBytes(r.Roll); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i + 4] = buff[i]; } buff = BitConverter.GetBytes(r.Yaw); for (int i = 0; i < 4; i++) { pcc.memory[off1 + off2 + i + 8] = buff[i]; } } } }