public void Load(TO8CHTX TO8CHTX, EntryStruct EntryStruct) { this.Title = TO8CHTX.StreamTexts.SetPosition(EntryStruct.OffsetTitle).ReadStringz(-1, Encoding.UTF8); this.TextOriginal = TO8CHTX.StreamTexts.SetPosition(EntryStruct.OffsetTextOriginal).ReadStringz(-1, Encoding.UTF8); this.TextTranslated = TO8CHTX.StreamTexts.SetPosition(EntryStruct.OffsetTextTranslated).ReadStringz(-1, Encoding.UTF8); this.Talker = (Talker)(uint)EntryStruct.Talker; }
/// <summary> /// Méthode permettant de fixer la valeur de l'entrée d'une colone /// </summary> /// <param name="col"></param> /// <param name="qubit"></param> public void SetEntry(int col, Qubit qubit) { EntryStruct entryStruct = entries[col]; entryStruct.qubit = qubit; OnSetEntry?.Invoke(entryStruct); }
private void treeView1_DoubleClick(object sender, EventArgs e) { TreeNode t = treeView1.SelectedNode; if (t == null || t.Parent == null || t.Parent.Text != "Codex Map") { return; } EntryStruct entry = CodexMap[t.Index]; string s = ""; for (int i = 0; i < 7; i++) { s += entry.Values[i] + " , "; } s += entry.Values[7]; string result = Microsoft.VisualBasic.Interaction.InputBox("Please enter new values", "ME3Explorer", s, 0, 0); string[] sres = result.Split(','); if (sres.Length != 8) { return; } for (int i = 0; i < 8; i++) { entry.Values[i] = Convert.ToInt32(sres[i].Trim()); } CodexMap[t.Index] = entry; RefreshTree(); }
public void LoadFromDB(string path) { try { Entries = new List <EntryStruct>(); FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); int count = FH.GetInt(fs); for (int i = 0; i < count; i++) { EntryStruct e = new EntryStruct(); e.text = FH.ReadString(fs); e.speaker = FH.ReadString(fs); e.convname = FH.ReadString(fs); e.pathpcc = FH.ReadString(fs); e.pathdlc = FH.ReadString(fs); e.pathafc = FH.ReadString(fs); e.ID = FH.GetInt(fs); e.indexpcc = FH.GetInt(fs); byte b = (byte)fs.ReadByte(); e.inDLC = b == 1; Entries.Add(e); } fs.Close(); RefreshDisplay(); } catch (Exception e) { MessageBox.Show("Error : \n" + e.Message); } }
public void GetEntries() { CodexMap = new List <EntryStruct>(); byte[] buff = pcc.Exports[0].Data; List <PropertyReader.Property> props = PropertyReader.getPropList(pcc, buff); int pos = props[props.Count - 1].offend; BitConverter.IsLittleEndian = true; while (pos < buff.Length) { int count = BitConverter.ToInt32(buff, pos); pos += 4; for (int i = 0; i < count; i++) { EntryStruct entry = new EntryStruct(); entry.offset = pos; entry.Values = new int[8]; for (int j = 0; j < 8; j++) { entry.Values[j] = BitConverter.ToInt32(buff, pos + j * 4); } CodexMap.Add(entry); pos += 32; } } }
public void LoadFromDB(string path) { try { Entries = new List<EntryStruct>(); FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); int count = FH.GetInt(fs); for (int i = 0; i < count; i++) { EntryStruct e = new EntryStruct(); e.text = FH.ReadString(fs); e.speaker = FH.ReadString(fs); e.convname = FH.ReadString(fs); e.pathpcc = FH.ReadString(fs); e.pathdlc = FH.ReadString(fs); e.pathafc = FH.ReadString(fs); e.ID = FH.GetInt(fs); e.indexpcc = FH.GetInt(fs); byte b = (byte)fs.ReadByte(); e.inDLC = b == 1; Entries.Add(e); } fs.Close(); RefreshDisplay(); } catch (Exception e) { MessageBox.Show("Error : \n" + e.Message); } }
internal Entry(FPS4 FPS4, EntryStruct EntryStruct, String Name) { this.FPS4 = FPS4; this.EntryStruct = EntryStruct; this.Name = Name; this._Stream = SliceStream.CreateWithLength((EntryStruct.Offset == 0) ? FPS4.DavStream : FPS4.DatStream, EntryStruct.Offset, EntryStruct.LengthReal); }
private void loadToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.Filter = "*.db|*.db"; if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) { timer1.Enabled = false; Entries = new List <EntryStruct>(); FileStream fs = new FileStream(d.FileName, FileMode.Open, FileAccess.Read); int count = ReadInt(fs); for (int i = 0; i < count; i++) { EntryStruct en = new EntryStruct(); en.Filename = ReadString(fs); en.DLCName = ReadString(fs); en.ObjectPath = ReadString(fs); en.Index = ReadInt(fs); byte b = (byte)fs.ReadByte(); en.isDLC = b == 1; b = (byte)fs.ReadByte(); en.isSkeletal = b == 1; Entries.Add(en); } fs.Close(); TreeRefresh(); timer1.Enabled = true; } }
public static Entry FromEntryStruct(int Index, EntryStruct EntryStruct, Stream TextStream) { return(new Entry() { Index = Index, Text1 = TextStream.ReadStringzAt(EntryStruct.TextPointer1), Text2 = TextStream.ReadStringzAt(EntryStruct.TextPointer2), Text3 = TextStream.ReadStringzAt(EntryStruct.TextPointer3), EntryStruct = EntryStruct, }); }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { int n = listBox1.SelectedIndex; if (n == -1) { return; } EntryStruct t = Entries[n]; string s = "Entry #" + n + "\n\n" + "ID\t\t\t: " + t.ID + " = 0x" + t.ID.ToString("X8") + "\n" + "Text\t\t\t: " + t.text.Trim() + "\n" + "Speaker\t\t: " + t.speaker + "\n" + "Dialog Name\t\t: " + t.convname + "\n" + "Dialog Index\t: " + t.indexpcc + "\n" + "Is in DLC\t\t: " + t.inDLC + "\n" + "PCC path\t\t: " + t.pathpcc + "\n" + "DLC path\t\t: " + t.pathdlc + "\n";// + //"AFC path\t:\n"; *todo* rtb1.Text = s; }
/// <summary> /// Essaie d'insérer une colone vide à l'index spécifié, renvoie True si réussie, False sinon. /// Associe à la colone insérée une entrée de valeur zéro. /// Echoue dans le cas ou la colone en question passerait au milieu d'une porte à plusieurs entrées. /// Appelle l'evennement OnInsertCol sur la colone ainsi insérée. /// </summary> /// <param name="index"></param> /// <returns>bool</returns> public bool InsertCol(int index) { if (!CanInsertCol(index)) { return(false); } // insert the entry EntryStruct insertedEntry = CreateEntryStruct(index, Qubit.Zero); entries.Insert(index, insertedEntry); // insert the column List <GateStruct> insertedCol = new List <GateStruct>(NbRow); for (int i = 0; i < NbRow; i++) { GateStruct gateStruct = CreateGateStruct(i, index, Gate.IDENTITY); insertedCol.Add(gateStruct); rows[i].Insert(index, gateStruct); } for (int j = NbCol - 1; j >= index + 1; j--) { entries[j].col++; for (int i = 0; i < NbRow; i++) { if (rows[i][j].col == j - 1) { rows[i][j].col++; } } } OnInsertCol?.Invoke(insertedEntry, insertedCol); return(true); }
public void GetEntries() { CodexMap = new List<EntryStruct>(); byte[] buff = pcc.Exports[0].Data; List<PropertyReader.Property> props = PropertyReader.getPropList(pcc, buff); int pos = props[props.Count - 1].offend; BitConverter.IsLittleEndian = true; while (pos < buff.Length) { int count = BitConverter.ToInt32(buff, pos); pos += 4; for (int i = 0; i < count; i++) { EntryStruct entry = new EntryStruct(); entry.offset = pos; entry.Values = new int[8]; for (int j = 0; j < 8; j++) entry.Values[j] = BitConverter.ToInt32(buff, pos + j * 4); CodexMap.Add(entry); pos += 32; } } }
/// <summary> /// Essaie de supprime la colone d'index spécifié, renvoie True si réussie, False sinon. /// Echoue dans le cas ou une porte à plusieurs entrées occupe la colone en question. /// Appelle l'évennement OnRemoveCol sur la colone ainsi supprimée. /// </summary> /// <param name="index"></param> /// <returns>bool</returns> public bool RemoveCol(int index) { if (!CanRemoveCol(index)) { return(false); } EntryStruct removedEntry = entries[index]; entries.RemoveAt(index); List <GateStruct> removedCol = new List <GateStruct>(); for (int i = 0; i < NbRow; i++) { GateStruct gateStruct = rows[i][index]; removedCol.Add(gateStruct); rows[i].RemoveAt(index); } for (int j = index; j < NbCol; j++) { entries[j].col--; for (int i = 0; i < NbRow; i++) { if (rows[i][j].col == j + 1) { rows[i][j].col--; } } } OnRemoveCol?.Invoke(removedEntry, removedCol); return(true); }
/** * #################################################################################################### * ############################################## ENTRY ############################################### * #################################################################################################### */ /// <summary> /// Crée un EntryStruct et appelle l'évennement OnCreateEntry. /// </summary> /// <param name="col"></param> /// <param name="qubit"></param> /// <returns>EntryStruct</returns> private EntryStruct CreateEntryStruct(int col, Qubit qubit) { EntryStruct entryStruct = new EntryStruct(col, qubit); return(entryStruct); }
public Entry(TO8SCEL TO8SCEL, EntryStruct EntryStruct, int Index) { this.TO8SCEL = TO8SCEL; this.EntryStruct = EntryStruct; this.Index = Index; }
public void ScanDLCfolder1() { DebugOutput.PrintLn("\n\nDLC Scan for unpacked files...\n", true); string dir = ME3Directory.DLCPath; string[] files = Directory.GetFiles(dir, "*.pcc", SearchOption.AllDirectories); if (files.Length == 0) return; pbar1.Maximum = files.Length - 1; int count = 0; foreach (string file in files) if (!file.ToLower().Contains("patch")) { DebugOutput.PrintLn("Scan file #" + count + " : " + file, count % 10 == 0); try { PCCObject pcc = new PCCObject(file); for (int i = 0; i < pcc.Exports.Count; i++) if (pcc.Exports[i].ClassName == "BioConversation") { DebugOutput.PrintLn("Found dialog \"" + pcc.Exports[i].ObjectName + "\"", false); BioConversation Dialog = new BioConversation(pcc, i); foreach (BioConversation.EntryListStuct e in Dialog.EntryList) { string text = talkFile.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = false; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = ""; t.pathpcc = file; t.convname = pcc.Exports[i].ObjectName; if (e.SpeakerIndex >= 0 && e.SpeakerIndex < Dialog.SpeakerList.Count) t.speaker = pcc.getNameEntry(Dialog.SpeakerList[e.SpeakerIndex]); else t.speaker = "unknown"; if (t.speaker == null || t.speaker == "") t.speaker = "unknown"; Entries.Add(t); DebugOutput.PrintLn("Requ.: (" + t.speaker + ") " + t.text, false); } } foreach (BioConversation.ReplyListStruct e in Dialog.ReplyList) { string text = talkFile.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = false; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = ""; t.pathpcc = file; t.convname = pcc.Exports[i].ObjectName; Entries.Add(t); DebugOutput.PrintLn("Reply: " + t.text, false); } } } if (count % 10 == 0) { Application.DoEvents(); pbar1.Value = count; } count++; } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } }
private void scanToolStripMenuItem_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(ME3Directory.cookedPath)) { MessageBox.Show("This functionality requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3"); return; } DebugOutput.StartDebugger("Meshplorer2"); int count = 0; timer1.Enabled = false; Entries = new List <EntryStruct>(); bool ScanDLC = false; if (MessageBox.Show("Scan DLCs too?", "Meshplorer 2", MessageBoxButtons.YesNo) == DialogResult.Yes) { ScanDLC = true; } if (ScanDLC) { #region DLC Stuff string dirDLC = ME3Directory.DLCPath; if (!Directory.Exists(dirDLC)) { DebugOutput.PrintLn("No DLC Folder found!"); } else { string[] subdirs = Directory.GetDirectories(dirDLC); string loc = Path.GetDirectoryName(Application.ExecutablePath) + "\\exec\\"; Directory.CreateDirectory(loc + "temp"); foreach (string DLCpath in subdirs) { if (!DLCpath.StartsWith("__") && !DLCpath.StartsWith("DLC_UPD")) { string path = DLCpath + "\\CookedPCConsole\\Default.sfar"; DLCBase dlcbase; try { dlcbase = new DLCBase(path); count = 0; pbar1.Maximum = dlcbase.fileList.Count; foreach (sfarFile file in dlcbase.fileList) { try { string filename = Path.GetFileName(file.fileName); if (Path.GetExtension(filename).ToLower().EndsWith(".pcc")) { using (Stream input = File.OpenRead(path), output = File.Create(loc + "temp\\" + filename)) { AmaroK86.MassEffect3.DLCUnpack.DecompressEntry(file, input, output, dlcbase.CompressionScheme); } FileInfo f = new FileInfo(loc + "temp\\" + filename); DebugOutput.PrintLn("checking DLC: " + Path.GetFileName(DLCpath) + " File: " + filename + " Size: " + f.Length + " bytes", count % 3 == 0); PCCObject pcc = new PCCObject(loc + "temp\\" + filename); for (int i = 0; i < pcc.Exports.Count; i++) { if (pcc.Exports[i].ClassName == "SkeletalMesh" || pcc.Exports[i].ClassName == "StaticMesh") { EntryStruct ent = new EntryStruct(); ent.DLCName = Path.GetFileName(DLCpath); ent.Filename = filename; ent.Index = i; ent.isDLC = true; ent.ObjectPath = pcc.Exports[i].GetFullPath; ent.isSkeletal = (pcc.Exports[i].ClassName == "SkeletalMesh"); Entries.Add(ent); } } File.Delete(loc + "temp\\" + filename); } if (count % 3 == 0) { pbar1.Value = count; Application.DoEvents(); } count++; } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } } Directory.Delete(loc + "temp", true); } #endregion } #region Basegame Stuff string dir = ME3Directory.cookedPath; string[] files = Directory.GetFiles(dir, "*.pcc"); pbar1.Maximum = files.Length - 1; foreach (string file in files) { DebugOutput.PrintLn("Scan file #" + count + " : " + file, count % 10 == 0); try { PCCObject pcc = new PCCObject(file); for (int i = 0; i < pcc.Exports.Count; i++) { if (pcc.Exports[i].ClassName == "SkeletalMesh" || pcc.Exports[i].ClassName == "StaticMesh") { EntryStruct ent = new EntryStruct(); ent.DLCName = ""; ent.Filename = Path.GetFileName(file); ent.Index = i; ent.isDLC = false; ent.ObjectPath = pcc.Exports[i].GetFullPath; ent.isSkeletal = (pcc.Exports[i].ClassName == "SkeletalMesh"); Entries.Add(ent); } } if (count % 10 == 0) { Application.DoEvents(); pbar1.Value = count; } count++; } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } #endregion #region Sorting bool run = true; DebugOutput.PrintLn("=====Info=====\n\nSorting names...\n\n=====Info====="); count = 0; while (run) { run = false; for (int i = 0; i < Entries.Count - 1; i++) { if (Entries[i].Filename.CompareTo(Entries[i + 1].Filename) > 0) { EntryStruct tmp = Entries[i]; Entries[i] = Entries[i + 1]; Entries[i + 1] = tmp; run = true; if (count++ % 100 == 0) { Application.DoEvents(); } } } } #endregion TreeRefresh(); timer1.Enabled = true; }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { TreeNode t = treeView1.SelectedNode; if (DisplayStyle == 0) { if (t.Parent == null || t.Name == "") { return; } Renderer.STM = null; Renderer.SKM = null; Renderer.CamDistance = 10; Renderer.CamOffset = new Microsoft.DirectX.Vector3(0, 0, 0); try { int i = 0; if (Int32.TryParse(t.Name, out i)) { EntryStruct en = Entries[i]; if (!en.isDLC) { PCCObject pcc = new PCCObject(ME3Directory.cookedPath + en.Filename); if (en.isSkeletal) { Renderer.SKM = new SkeletalMesh(pcc, en.Index); Renderer.CamDistance = Renderer.SKM.Bounding.r * 2.0f; Renderer.CamOffset = Renderer.SKM.Bounding.origin; treeView2.Nodes.Clear(); if (previewWithTreeToolStripMenuItem.Checked) { treeView2.Visible = false; Application.DoEvents(); treeView2.Nodes.Add(Renderer.SKM.ToTree()); treeView2.Visible = true; } } else { } } else { string loc = Path.GetDirectoryName(Application.ExecutablePath) + "\\exec\\"; string dirDLC = ME3Directory.DLCPath; dirDLC += en.DLCName; dirDLC += "\\CookedPCConsole\\Default.sfar"; DLCBase dlc = new DLCBase(dirDLC); foreach (sfarFile file in dlc.fileList) { try { string filename = Path.GetFileName(file.fileName); if (Path.GetExtension(filename).ToLower().EndsWith(".pcc") && filename == en.Filename) { using (Stream input = File.OpenRead(dirDLC), output = File.Create(loc + filename)) { AmaroK86.MassEffect3.DLCUnpack.DecompressEntry(file, input, output, dlc.CompressionScheme); } if (File.Exists(loc + filename)) { try { PCCObject pcc = new PCCObject(loc + filename); if (en.isSkeletal) { Renderer.SKM = new SkeletalMesh(pcc, en.Index); Renderer.CamDistance = Renderer.SKM.Bounding.r * 2.0f; Renderer.CamOffset = Renderer.SKM.Bounding.origin; treeView2.Nodes.Clear(); if (previewWithTreeToolStripMenuItem.Checked) { treeView2.Visible = false; Application.DoEvents(); treeView2.Nodes.Add(Renderer.SKM.ToTree()); treeView2.Visible = true; } } else { } } catch (Exception) { } File.Delete(loc + filename); } } } catch (Exception) { } } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
public void ScanDLCfolder2() { DebugOutput.PrintLn("\n\nDLC Scan for packed files...\n", true); string dir = ME3Directory.DLCPath; string[] files = Directory.GetFiles(dir, "*.sfar", SearchOption.AllDirectories); if (files.Length == 0) return; pbar1.Maximum = files.Length - 1; int count = 0; foreach (string file in files) if (!file.ToLower().Contains("patch")) { DebugOutput.PrintLn("Scan file #" + count + " : " + file, count % 10 == 0); try { DLCPackage dlc = new DLCPackage(file); DebugOutput.PrintLn("found " + dlc.Files.Length + " files : " + file); for (int j = 0; j < dlc.Files.Length; j++) { if (dlc.Files[j].FileName.ToLower().EndsWith(".pcc")) { string filename = dlc.Files[j].FileName; DebugOutput.PrintLn(" " + j.ToString("d4") + " / " + dlc.Files.Length.ToString("d4") + " : opening " + Path.GetFileName(filename),true); MemoryStream mem = dlc.DecompressEntry(j); File.WriteAllBytes("temp.pcc", mem.ToArray()); PCCObject pcc = new PCCObject("temp.pcc"); for (int i = 0; i < pcc.Exports.Count; i++) if (pcc.Exports[i].ClassName == "BioConversation") { DebugOutput.PrintLn("Found dialog \"" + pcc.Exports[i].ObjectName + "\"", false); BioConversation Dialog = new BioConversation(pcc, i); foreach (BioConversation.EntryListStuct e in Dialog.EntryList) { string text = talkFile.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = true; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = file; t.pathpcc = filename; t.convname = pcc.Exports[i].ObjectName; if (e.SpeakerIndex >= 0 && e.SpeakerIndex < Dialog.SpeakerList.Count) t.speaker = pcc.getNameEntry(Dialog.SpeakerList[e.SpeakerIndex]); else t.speaker = "unknown"; if (t.speaker == null || t.speaker == "") t.speaker = "unknown"; Entries.Add(t); DebugOutput.PrintLn("Requ.: (" + t.speaker + ") " + t.text, false); } } foreach (BioConversation.ReplyListStruct e in Dialog.ReplyList) { string text = talkFile.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = true; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = file; t.pathpcc = filename; t.convname = pcc.Exports[i].ObjectName; Entries.Add(t); DebugOutput.PrintLn("Reply: " + t.text, false); } } } } } if (count % 10 == 0) { Application.DoEvents(); pbar1.Value = count; } count++; } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } if (File.Exists("temp.pcc")) File.Delete("temp.pcc"); }
public void ScanDLCfolder1() { DebugOutput.PrintLn("\n\nDLC Scan for unpacked files...\n", true); string dir = ME3Directory.DLCPath; string[] files = Directory.GetFiles(dir, "*.pcc", SearchOption.AllDirectories); if (files.Length == 0) { return; } pbar1.Maximum = files.Length - 1; int count = 0; foreach (string file in files) { if (!file.ToLower().Contains("patch")) { DebugOutput.PrintLn("Scan file #" + count + " : " + file, count % 10 == 0); try { PCCObject pcc = new PCCObject(file); for (int i = 0; i < pcc.Exports.Count; i++) { if (pcc.Exports[i].ClassName == "BioConversation") { DebugOutput.PrintLn("Found dialog \"" + pcc.Exports[i].ObjectName + "\"", false); BioConversation Dialog = new BioConversation(pcc, i); foreach (BioConversation.EntryListStuct e in Dialog.EntryList) { string text = talkFile.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = false; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = ""; t.pathpcc = file; t.convname = pcc.Exports[i].ObjectName; if (e.SpeakerIndex >= 0 && e.SpeakerIndex < Dialog.SpeakerList.Count) { t.speaker = pcc.getNameEntry(Dialog.SpeakerList[e.SpeakerIndex]); } else { t.speaker = "unknown"; } if (t.speaker == null || t.speaker == "") { t.speaker = "unknown"; } Entries.Add(t); DebugOutput.PrintLn("Requ.: (" + t.speaker + ") " + t.text, false); } } foreach (BioConversation.ReplyListStruct e in Dialog.ReplyList) { string text = talkFile.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = false; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = ""; t.pathpcc = file; t.convname = pcc.Exports[i].ObjectName; Entries.Add(t); DebugOutput.PrintLn("Reply: " + t.text, false); } } } } if (count % 10 == 0) { Application.DoEvents(); pbar1.Value = count; } count++; } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } } }
public void ScanDLCfolder2() { DebugOutput.PrintLn("\n\nDLC Scan for packed files...\n", true); string dir = ME3Directory.DLCPath; string[] files = Directory.GetFiles(dir, "*.sfar", SearchOption.AllDirectories); if (files.Length == 0) { return; } pbar1.Maximum = files.Length - 1; int count = 0; foreach (string file in files) { if (!file.ToLower().Contains("patch")) { DebugOutput.PrintLn("Scan file #" + count + " : " + file, count % 10 == 0); try { DLCPackage dlc = new DLCPackage(file); DebugOutput.PrintLn("found " + dlc.Files.Length + " files : " + file); for (int j = 0; j < dlc.Files.Length; j++) { if (dlc.Files[j].FileName.ToLower().EndsWith(".pcc")) { string filename = dlc.Files[j].FileName; DebugOutput.PrintLn(" " + j.ToString("d4") + " / " + dlc.Files.Length.ToString("d4") + " : opening " + Path.GetFileName(filename), true); MemoryStream mem = dlc.DecompressEntry(j); File.WriteAllBytes("temp.pcc", mem.ToArray()); using (ME3Package pcc = MEPackageHandler.OpenME3Package("temp.pcc")) { IReadOnlyList <IExportEntry> Exports = pcc.Exports; for (int i = 0; i < Exports.Count; i++) { if (Exports[i].ClassName == "BioConversation") { DebugOutput.PrintLn("Found dialog \"" + Exports[i].ObjectName + "\"", false); ME3BioConversation Dialog = new ME3BioConversation(Exports[i] as ME3ExportEntry); foreach (ME3BioConversation.EntryListStuct e in Dialog.EntryList) { string text = ME3TalkFiles.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = true; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = file; t.pathpcc = filename; t.convname = Exports[i].ObjectName; if (e.SpeakerIndex >= 0 && e.SpeakerIndex < Dialog.SpeakerList.Count) { t.speaker = Dialog.SpeakerList[e.SpeakerIndex].InstancedString; } else { t.speaker = "unknown"; } if (t.speaker == null || t.speaker == "") { t.speaker = "unknown"; } Entries.Add(t); DebugOutput.PrintLn("Requ.: (" + t.speaker + ") " + t.text, false); } } foreach (ME3BioConversation.ReplyListStruct e in Dialog.ReplyList) { string text = ME3TalkFiles.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = true; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = file; t.pathpcc = filename; t.convname = Exports[i].ObjectName; Entries.Add(t); DebugOutput.PrintLn("Reply: " + t.text, false); } } } } } } } if (count % 10 == 0) { Application.DoEvents(); pbar1.Value = count; } count++; } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } } if (File.Exists("temp.pcc")) { File.Delete("temp.pcc"); } }
/// <summary> /// Essaie de déplacer la colone source à l'index cible, renvoie True si réussie, False sinon. /// Echoue dans le cas ou une porte à plusieurs entrées occupe la colone source ou que la colone en question passerait au milieu d'une porte à plusieurs entrées à l'index cible. /// Appelle l'évennement OnMoveCol sur chaque colone dont l'index est mis à jour. /// </summary> /// <param name="source"></param> /// <param name="target"></param> /// <returns></returns> public bool MoveCol(int source, int target) { if (!CanMoveCol(source, target)) { return(false); } // move the entry EntryStruct movedEntry = entries[source]; entries.RemoveAt(source); movedEntry.col = target; entries.Insert(target, movedEntry); // move the column List <GateStruct> movedCol = new List <GateStruct>(NbRow); for (int i = 0; i < NbRow; i++) { List <GateStruct> currentRow = rows[i]; GateStruct gateStruct = currentRow[source]; currentRow.RemoveAt(source); gateStruct.col = target; currentRow.Insert(target, gateStruct); movedCol.Add(gateStruct); } OnMoveCol?.Invoke(movedEntry, movedCol); // update col property of moved gates if (source < target) { for (int j = source; j < target; j++) { EntryStruct updatedEntry = entries[j]; updatedEntry.col--; List <GateStruct> updatedCol = new List <GateStruct>(NbRow); for (int i = 0; i < NbRow; i++) { if (rows[i][j].col == j + 1) { rows[i][j].col--; updatedCol.Add(rows[i][j]); } } OnMoveCol?.Invoke(updatedEntry, updatedCol); } } else { for (int j = source; j > target; j--) { EntryStruct updatedEntry = entries[j]; updatedEntry.col++; List <GateStruct> updatedCol = new List <GateStruct>(NbRow); for (int i = 0; i < NbRow; i++) { if (rows[i][j].col == j - 1) { rows[i][j].col++; updatedCol.Add(rows[i][j]); } } OnMoveCol?.Invoke(updatedEntry, updatedCol); } } return(true); }
public void ScanBasefolder() { string dir = ME3Directory.cookedPath; string[] files = Directory.GetFiles(dir, "*.pcc"); pbar1.Maximum = files.Length - 1; int count = 0; foreach (string file in files) { DebugOutput.PrintLn("Scan file #" + count + " : " + file, count % 10 == 0); try { using (ME3Package pcc = MEPackageHandler.OpenME3Package(file)) { IReadOnlyList <IExportEntry> Exports = pcc.Exports; for (int i = 0; i < Exports.Count; i++) { if (Exports[i].ClassName == "BioConversation") { DebugOutput.PrintLn("Found dialog \"" + Exports[i].ObjectName + "\"", false); ME3BioConversation Dialog = new ME3BioConversation(Exports[i] as ME3ExportEntry); foreach (ME3BioConversation.EntryListStuct e in Dialog.EntryList) { string text = ME3TalkFiles.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = false; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = ""; t.pathpcc = file; t.convname = Exports[i].ObjectName; if (e.SpeakerIndex >= 0 && e.SpeakerIndex < Dialog.SpeakerList.Count) { t.speaker = Dialog.SpeakerList[e.SpeakerIndex].InstancedString; } else { t.speaker = "unknown"; } if (t.speaker == null || t.speaker == "") { t.speaker = "unknown"; } Entries.Add(t); DebugOutput.PrintLn("Requ.: (" + t.speaker + ") " + t.text, false); } } foreach (ME3BioConversation.ReplyListStruct e in Dialog.ReplyList) { string text = ME3TalkFiles.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = false; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = ""; t.pathpcc = file; t.convname = Exports[i].ObjectName; Entries.Add(t); DebugOutput.PrintLn("Reply: " + t.text, false); } } } } if (count % 10 == 0) { Application.DoEvents(); pbar1.Value = count; } count++; } } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { TreeNode t = treeView1.SelectedNode; if (DisplayStyle == 0) { if (t.Parent == null || t.Name == "") { return; } preview?.Dispose(); preview = null; try { if (int.TryParse(t.Name, out int i)) { EntryStruct en = Entries[i]; if (!en.isDLC) { using (ME3Package pcc = MEPackageHandler.OpenME3Package(ME3Directory.cookedPath + en.Filename)) { if (en.isSkeletal) { SkeletalMesh skmesh = new SkeletalMesh(pcc, en.Index); // TODO: pass device preview = new ModelPreview(view.Device, skmesh, view.TextureCache); CenterView(); treeView2.Nodes.Clear(); if (previewWithTreeToolStripMenuItem.Checked) { treeView2.Visible = false; Application.DoEvents(); treeView2.Nodes.Add(skmesh.ToTree()); treeView2.Visible = true; } } else { } } } else { string loc = Path.GetDirectoryName(Application.ExecutablePath) + "\\exec\\"; string dirDLC = ME3Directory.DLCPath; dirDLC += en.DLCName; dirDLC += "\\CookedPCConsole\\Default.sfar"; DLCUnpack dlc = new DLCUnpack(dirDLC); foreach (DLCUnpack.DLCEntry file in dlc.filesList) { try { string filename = Path.GetFileName(file.filenamePath); if (Path.GetExtension(filename).ToLower().EndsWith(".pcc") && filename == en.Filename) { using (Stream input = File.OpenRead(dirDLC), output = File.Create(loc + filename)) { dlc.ExtractEntry(file, input, output); } if (File.Exists(loc + filename)) { try { if (en.isSkeletal) { using (ME3Package pcc = MEPackageHandler.OpenME3Package(loc + filename)) { SkeletalMesh skmesh = new SkeletalMesh(pcc, en.Index); CenterView(); treeView2.Nodes.Clear(); if (previewWithTreeToolStripMenuItem.Checked) { treeView2.Visible = false; Application.DoEvents(); treeView2.Nodes.Add(skmesh.ToTree()); treeView2.Visible = true; } } } } catch (Exception) { } File.Delete(loc + filename); } } } catch (Exception) { } } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void scanToolStripMenuItem_Click(object sender, EventArgs e) { DebugOutput.StartDebugger("Meshplorer2"); int count = 0; timer1.Enabled = false; Entries = new List<EntryStruct>(); bool ScanDLC = false; if (MessageBox.Show("Scan DLCs too?", "Meshplorer 2", MessageBoxButtons.YesNo) == DialogResult.Yes) ScanDLC = true; if (ScanDLC) { #region DLC Stuff string dirDLC = ME3Directory.DLCPath; if (!Directory.Exists(dirDLC)) DebugOutput.PrintLn("No DLC Folder found!"); else { string[] subdirs = Directory.GetDirectories(dirDLC); string loc = Path.GetDirectoryName(Application.ExecutablePath) + "\\exec\\"; Directory.CreateDirectory(loc + "temp"); foreach (string DLCpath in subdirs) if (!DLCpath.StartsWith("__") && !DLCpath.StartsWith("DLC_UPD")) { string path = DLCpath + "\\CookedPCConsole\\Default.sfar"; DLCBase dlcbase; try { dlcbase = new DLCBase(path); count = 0; pbar1.Maximum = dlcbase.fileList.Count; foreach (sfarFile file in dlcbase.fileList) try { string filename = Path.GetFileName(file.fileName); if (Path.GetExtension(filename).ToLower().EndsWith(".pcc")) { using (Stream input = File.OpenRead(path), output = File.Create(loc + "temp\\" + filename)) { AmaroK86.MassEffect3.DLCUnpack.DecompressEntry(file, input, output, dlcbase.CompressionScheme); } FileInfo f = new FileInfo(loc + "temp\\" + filename); DebugOutput.PrintLn("checking DLC: " + Path.GetFileName(DLCpath) + " File: " + filename + " Size: " + f.Length + " bytes", count % 3 == 0); PCCObject pcc = new PCCObject(loc + "temp\\" + filename); for (int i = 0; i < pcc.Exports.Count; i++) if (pcc.Exports[i].ClassName == "SkeletalMesh" || pcc.Exports[i].ClassName == "StaticMesh") { EntryStruct ent = new EntryStruct(); ent.DLCName = Path.GetFileName(DLCpath); ent.Filename = filename; ent.Index = i; ent.isDLC = true; ent.ObjectPath = pcc.Exports[i].GetFullPath; ent.isSkeletal = (pcc.Exports[i].ClassName == "SkeletalMesh"); Entries.Add(ent); } File.Delete(loc + "temp\\" + filename); } if (count % 3 == 0) { pbar1.Value = count; Application.DoEvents(); } count++; } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } Directory.Delete(loc + "temp", true); } #endregion } #region Basegame Stuff string dir = ME3Directory.cookedPath; string[] files = Directory.GetFiles(dir,"*.pcc"); pbar1.Maximum = files.Length - 1; foreach (string file in files) { DebugOutput.PrintLn("Scan file #" + count + " : " + file, count % 10 == 0); try { PCCObject pcc = new PCCObject(file); for (int i = 0; i < pcc.Exports.Count; i++) if (pcc.Exports[i].ClassName == "SkeletalMesh" || pcc.Exports[i].ClassName == "StaticMesh") { EntryStruct ent = new EntryStruct(); ent.DLCName = ""; ent.Filename = Path.GetFileName(file); ent.Index = i; ent.isDLC = false; ent.ObjectPath = pcc.Exports[i].GetFullPath; ent.isSkeletal = (pcc.Exports[i].ClassName == "SkeletalMesh"); Entries.Add(ent); } if (count % 10 == 0) { Application.DoEvents(); pbar1.Value = count; } count++; } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } #endregion #region Sorting bool run = true; DebugOutput.PrintLn("=====Info=====\n\nSorting names...\n\n=====Info====="); count = 0; while (run) { run = false; for(int i=0;i<Entries.Count -1;i++) if (Entries[i].Filename.CompareTo(Entries[i + 1].Filename) > 0) { EntryStruct tmp = Entries[i]; Entries[i] = Entries[i + 1]; Entries[i + 1] = tmp; run = true; if (count++ % 100 == 0) Application.DoEvents(); } } #endregion TreeRefresh(); timer1.Enabled = true; }
private void loadToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.Filter = "*.db|*.db"; if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) { timer1.Enabled = false; Entries = new List<EntryStruct>(); FileStream fs = new FileStream(d.FileName, FileMode.Open, FileAccess.Read); int count = ReadInt(fs); for (int i = 0; i < count; i++) { EntryStruct en = new EntryStruct(); en.Filename = ReadString(fs); en.DLCName = ReadString(fs); en.ObjectPath = ReadString(fs); en.Index = ReadInt(fs); byte b = (byte)fs.ReadByte(); en.isDLC = b == 1; b = (byte)fs.ReadByte(); en.isSkeletal = b == 1; Entries.Add(en); } fs.Close(); TreeRefresh(); timer1.Enabled = true; } }
public void ScanBasefolder() { string dir = ME3Directory.cookedPath; string[] files = Directory.GetFiles(dir, "*.pcc"); pbar1.Maximum = files.Length - 1; int count = 0; foreach (string file in files) { DebugOutput.PrintLn("Scan file #" + count + " : " + file, count % 10 == 0); try { using (ME3Package pcc = MEPackageHandler.OpenME3Package(file)) { IReadOnlyList<IExportEntry> Exports = pcc.Exports; for (int i = 0; i < Exports.Count; i++) if (Exports[i].ClassName == "BioConversation") { DebugOutput.PrintLn("Found dialog \"" + Exports[i].ObjectName + "\"", false); ME3BioConversation Dialog = new ME3BioConversation(Exports[i] as ME3ExportEntry); foreach (ME3BioConversation.EntryListStuct e in Dialog.EntryList) { string text = ME3TalkFiles.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = false; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = ""; t.pathpcc = file; t.convname = Exports[i].ObjectName; if (e.SpeakerIndex >= 0 && e.SpeakerIndex < Dialog.SpeakerList.Count) t.speaker = pcc.getNameEntry(Dialog.SpeakerList[e.SpeakerIndex]); else t.speaker = "unknown"; if (t.speaker == null || t.speaker == "") t.speaker = "unknown"; Entries.Add(t); DebugOutput.PrintLn("Requ.: (" + t.speaker + ") " + t.text, false); } } foreach (ME3BioConversation.ReplyListStruct e in Dialog.ReplyList) { string text = ME3TalkFiles.findDataById(e.refText); if (text.Length != 7 && text != "No Data") { EntryStruct t = new EntryStruct(); t.inDLC = false; t.text = text; t.ID = e.refText; t.indexpcc = i; t.pathafc = "";//Todo t.pathdlc = ""; t.pathpcc = file; t.convname = Exports[i].ObjectName; Entries.Add(t); DebugOutput.PrintLn("Reply: " + t.text, false); } } } if (count % 10 == 0) { Application.DoEvents(); pbar1.Value = count; } count++; } } catch (Exception ex) { DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR====="); } } }