public static void DumpMeshViewerFile(String file) { PCCObject pcc = new PCCObject(file); int index = 0; string savepath = Directory.GetParent(file) + "\\" + Path.GetFileNameWithoutExtension(file) + "_meshmap.txt"; using (StreamWriter stringoutput = new StreamWriter(savepath)) { foreach (PCCObject.ExportEntry exp in pcc.Exports) { index++; if (exp.ClassName == "PathNode") { Console.WriteLine(exp.ClassName); Interpreter i = new Interpreter(); i.Pcc = pcc; i.Index = index - 1; //0-based array i.InitInterpreter(); TreeNode top = i.topNode; if (top.Children.Count > 0 && top.Children[0].Tag != Interpreter.nodeType.None) { //stringoutput.WriteLine(String.Format("|{0,40}|{1,15}|{2,10}|{3,30}|", "Name", "Type", "Size", "Value")); top.PrintMeshViewer("", stringoutput, false); } } } } }
/// <summary> /// Dumps data from a pcc file to a text file /// </summary> /// <param name="file">PCC file path to dump from</param> /// <param name="args">6 element boolean array, specifying what should be dumped. In order: imports, exports, data, scripts, coalesced, names. At least 1 of these options must be true.</param> /// <param name="outputfolder"></param> public static void dumpPCCFile(string file, Boolean[] args, string outputfolder = null) { if (GamePath == null) { Console.Error.WriteLine("Game path not defined. Can't dump file file with undefined game path."); return; } //try { Boolean imports = args[0]; Boolean exports = args[1]; Boolean data = args[2]; Boolean scripts = args[3]; Boolean coalesced = args[4]; Boolean names = args[5]; Boolean separateExports = args[6]; Boolean properties = args[7]; PCCObject pcc = new PCCObject(file); string outfolder = outputfolder; if (outfolder == null) { outfolder = Directory.GetParent(file).ToString(); } if (!outfolder.EndsWith(@"\")) { outfolder += @"\"; } if (properties) { UnrealObjectInfo.loadfromJSON(); } string savepath = outfolder + Path.GetFileNameWithoutExtension(file) + ".txt"; Directory.CreateDirectory(Path.GetDirectoryName(savepath)); using (StreamWriter stringoutput = new StreamWriter(savepath)) { if (imports) { writeVerboseLine("Getting Imports"); stringoutput.WriteLine("--Imports"); for (int x = 0; x < pcc.Imports.Count; x++) { PCCObject.ImportEntry imp = pcc.Imports[x]; if (imp.PackageFullName != "Class" && imp.PackageFullName != "Package") { stringoutput.WriteLine("#" + ((x + 1) * -1) + ": " + imp.PackageFullName + "." + imp.ObjectName + "(From: " + imp.PackageFile + ") " + "(Offset: 0x " + (pcc.ImportOffset + (x * PCCObject.ImportEntry.byteSize)).ToString("X4") + ")"); } else { stringoutput.WriteLine("#" + ((x + 1) * -1) + ": " + imp.ObjectName + "(From: " + imp.PackageFile + ") " + "(Offset: 0x " + (pcc.ImportOffset + (x * PCCObject.ImportEntry.byteSize)).ToString("X4") + ")"); } } stringoutput.WriteLine("--End of Imports"); } if (exports || scripts || data || coalesced) { string datasets = ""; if (exports) { datasets += "Exports "; } if (scripts) { datasets += "Scripts "; } if (coalesced) { datasets += "Coalesced "; } if (data) { datasets += "Data "; } stringoutput.WriteLine("--Start of " + datasets); int numDone = 1; int numTotal = pcc.Exports.Count; int lastProgress = 0; writeVerboseLine("Enumerating exports"); Boolean needsFlush = false; int index = 0; foreach (PCCObject.ExportEntry exp in pcc.Exports) { index++; writeVerboseLine("Parse export #" + index); //Boolean isCoalesced = coalesced && exp.likelyCoalescedVal; Boolean isCoalesced = exp.likelyCoalescedVal; Boolean isScript = scripts && (exp.ClassName == "Function"); Boolean isEnum = exp.ClassName == "Enum"; int progress = ((int)(((double)numDone / numTotal) * 100)); while (progress >= (lastProgress + 10)) { Console.Write("..." + (lastProgress + 10) + "%"); needsFlush = true; lastProgress += 10; } if (exports || data || isScript || isCoalesced) { if (separateExports) { stringoutput.WriteLine("======================================================================="); } stringoutput.Write("#" + index + " "); if (isCoalesced) { stringoutput.Write("[C] "); } if (exports || isCoalesced || isScript) { stringoutput.WriteLine(exp.PackageFullName + "." + exp.ObjectName + "(" + exp.ClassName + ") (Superclass: " + exp.ClassParentWrapped + ") (Data Offset: 0x " + exp.DataOffset.ToString("X4") + ")"); } if (isEnum) { SFXEnum sfxenum = new SFXEnum(pcc, exp.Data); stringoutput.WriteLine(sfxenum.ToString()); } if (isScript) { stringoutput.WriteLine("==============Function=============="); Function func = new Function(exp.Data, pcc); stringoutput.WriteLine(func.ToRawText()); } if (properties) { Interpreter i = new Interpreter(); i.Pcc = pcc; i.Index = index - 1; //0-based array i.InitInterpreter(); TreeNode top = i.topNode; if (top.Children.Count > 0 && top.Children[0].Tag != Interpreter.nodeType.None) { stringoutput.WriteLine("=================================================Properties================================================="); //stringoutput.WriteLine(String.Format("|{0,40}|{1,15}|{2,10}|{3,30}|", "Name", "Type", "Size", "Value")); top.PrintPretty("", stringoutput, false); stringoutput.WriteLine(); } } if (data) { stringoutput.WriteLine("==============Data=============="); stringoutput.WriteLine(BitConverter.ToString(exp.Data)); } } numDone++; } stringoutput.WriteLine("--End of " + datasets); if (needsFlush) { Console.WriteLine(); } } if (names) { writeVerboseLine("Gathering names"); stringoutput.WriteLine("--Names"); int count = 0; foreach (string s in pcc.Names) stringoutput.WriteLine((count++) + " : " + s); stringoutput.WriteLine("--End of Names"); } } } //catch (Exception e) //{ // Console.WriteLine("Exception parsing " + file + "\n" + e.Message); //} }