diff --git a/.vs/AppInfoParser/v16/.suo b/.vs/AppInfoParser/v16/.suo
index 9f6ecbe..f4f1e0e 100644
Binary files a/.vs/AppInfoParser/v16/.suo and b/.vs/AppInfoParser/v16/.suo differ
diff --git a/AppInfoCli/CXMLBuilder.cs b/AppInfoCli/CXMLBuilder.cs
new file mode 100644
index 0000000..6c82350
--- /dev/null
+++ b/AppInfoCli/CXMLBuilder.cs
@@ -0,0 +1,101 @@
+using General;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace CXMLDecompiler
+{
+ class CXMLBuilder
+ {
+ String MainDir = "";
+ String XMLFilename = "";
+ String CXMLFilename = "";
+ String MagicNumber = "";
+
+ FileStream InfoFile;
+
+ MemoryStream TreeTable;
+ MemoryStream StringIDTable;
+ MemoryStream IntIDTable;
+ MemoryStream StringTable;
+ MemoryStream CharTable;
+ MemoryStream HashIDTable;
+ MemoryStream IntArrayTable;
+ MemoryStream FloatArrayTable;
+ MemoryStream FileTable;
+
+ Boolean IsInitalized = false;
+
+ BinaryWriter bInfoFile;
+ BinaryWriter bTreeTable;
+ BinaryWriter bIntIDTable;
+ BinaryWriter bFloatArrayTable;
+ BinaryWriter bIntArrayTable;
+ BinaryWriter bHashIDTable;
+ BinaryWriter bStringIDTable;
+
+ XmlReader XMLFile;
+
+ public void Init(string XMLFile, string CxmlFile, string Magic)
+ {
+ MagicNumber = Magic;
+ InfoFile = File.Open(CxmlFile, FileMode.CreateNew, FileAccess.ReadWrite);
+
+ TreeTable = new MemoryStream();
+ StringIDTable = new MemoryStream();
+ IntIDTable = new MemoryStream();
+ StringTable = new MemoryStream();
+ CharTable = new MemoryStream();
+ HashIDTable = new MemoryStream();
+ IntArrayTable = new MemoryStream();
+ FloatArrayTable = new MemoryStream();
+ FileTable = new MemoryStream();
+
+ bInfoFile = new BinaryWriter(InfoFile);
+ bTreeTable = new BinaryWriter(TreeTable);
+ bIntIDTable = new BinaryWriter(IntIDTable);
+ bFloatArrayTable = new BinaryWriter(FloatArrayTable);
+ bIntArrayTable = new BinaryWriter(IntArrayTable);
+ bHashIDTable = new BinaryWriter(HashIDTable);
+ bStringIDTable = new BinaryWriter(StringIDTable);
+
+ CXMLFilename = CxmlFile;
+ XMLFilename = XMLFile;
+ MainDir = Path.GetDirectoryName(XMLFilename);
+
+ IsInitalized = true;
+
+ return;
+ }
+ public string DetectMagic(string XmlFileName)
+ {
+ string SearchFor = " ";
+ string xmlData = File.ReadAllText(XmlFileName);
+ int ind1 = xmlData.IndexOf(SearchFor);
+ xmlData = xmlData.Substring(ind1+ SearchFor.Length);
+ int ind2 = xmlData.IndexOf(SearchFor2);
+ xmlData = xmlData.Substring(0, ind2);
+ return xmlData;
+ }
+ public void BuildCXML(string XmlFile, string CxmlFile)
+ {
+ string Magic = DetectMagic(XmlFile);
+ Console.WriteLine("Magic Number: " + Magic);
+ if (!IsInitalized)
+ Init(XmlFile, XmlFile, "RCOF");
+
+ XmlReaderSettings XMLSettings = new XmlReaderSettings();
+ string XMLPath = Path.Combine(MainDir, XMLFilename);
+ XMLFile = XmlReader.Create(XMLPath, XMLSettings);
+
+ Tools.WriteStringToStream(InfoFile, Magic);
+ bInfoFile.Write((UInt32)0x0110);
+
+ }
+ }
+}
diff --git a/AppInfoCli/CXMLCli.csproj b/AppInfoCli/CXMLCli.csproj
index ee95b5b..5ec3ec2 100644
--- a/AppInfoCli/CXMLCli.csproj
+++ b/AppInfoCli/CXMLCli.csproj
@@ -90,7 +90,9 @@
-
+
+
+
diff --git a/AppInfoCli/CXML.cs b/AppInfoCli/CXMLReader.cs
similarity index 99%
rename from AppInfoCli/CXML.cs
rename to AppInfoCli/CXMLReader.cs
index 18b461e..21a6d14 100644
--- a/AppInfoCli/CXML.cs
+++ b/AppInfoCli/CXMLReader.cs
@@ -337,6 +337,10 @@ namespace CXML
InfoFile.Read(FileTable, 0x00, DataLength);
return FileTable;
}
+ public int ReadVersion()
+ {
+ return Tools.ReadIntAt(InfoFile, 0x4);
+ }
public void DecompileCXML(String CXMLFile, bool force = false)
{
@@ -355,7 +359,8 @@ namespace CXML
string XMLPath = Path.Combine(MainDir, XMLFilename);
XMLFile = XmlWriter.Create(XMLPath, XMLSettings);
XMLFile.WriteStartDocument();
- XMLFile.WriteComment("Decompiled with CXML Decompiler v6 By SilicaAndPina (Magic: \"" + MagicNumber + "\")");
+ XMLFile.WriteComment("Decompiled with CXML Decompiler v6 By SilicaAndPina (Magic: \"" + MagicNumber + "\", Version: \""+ ReadVersion()+"\")");
+
ReadElements();
XMLFile.WriteEndDocument();
diff --git a/AppInfoCli/GimConv.cs b/AppInfoCli/GimConv.cs
new file mode 100644
index 0000000..6de1b9e
--- /dev/null
+++ b/AppInfoCli/GimConv.cs
@@ -0,0 +1,62 @@
+using Ionic.Zip;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CXMLDecompiler
+{
+ class GimConv
+ {
+
+ static WebClient wc = new WebClient();
+ static bool DownloadCompleted = true;
+ public static void DownloadGimConv()
+ {
+ wc.DownloadProgressChanged += Wc_DownloadProgressChanged;
+ wc.DownloadDataCompleted += Wc_DownloadDataCompleted;
+ wc.DownloadDataAsync(new Uri("http://e1.dl.playstation.net/e1/downloads/ps3/themes/370/PS3_Custom_Theme_v200.zip")); // Thanks Sony :3
+ while (wc.IsBusy || !DownloadCompleted) { };
+ }
+
+ private static void Wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
+ {
+ Console.Write("\r\n");
+ MemoryStream zipStream = new MemoryStream(e.Result);
+ ZipFile zip = ZipFile.Read(zipStream);
+ foreach(ZipEntry zEntry in zip.Entries)
+ {
+ string filename = Path.GetFileName(zEntry.FileName);
+ if (filename == "msvcp71.dll" || filename == "msvcr71.dll" || zEntry.FileName.Contains("GimConv"))
+ {
+ string outputFilename = zEntry.FileName;
+ if (outputFilename.Contains("GimConv"))
+ outputFilename = outputFilename.Substring(outputFilename.IndexOf("GimConv"));
+ else
+ outputFilename = Path.Combine("GimConv", filename);
+ outputFilename = outputFilename.Replace("/", "\\");
+ Console.WriteLine("Extracting: " + outputFilename);
+ if (zEntry.IsDirectory)
+ {
+ Directory.CreateDirectory(outputFilename);
+ continue;
+ }
+
+ FileStream fs = File.Open(outputFilename, FileMode.CreateNew, FileAccess.ReadWrite);
+ zEntry.Extract(fs);
+ fs.Close();
+ }
+ }
+ DownloadCompleted = true;
+ }
+
+ private static void Wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
+ {
+ DownloadCompleted = false;
+ Console.Write("\rDownloading GimConv Directly from Sony " + e.BytesReceived + "/" + e.TotalBytesToReceive + " - " + e.ProgressPercentage.ToString() + "%");
+ }
+ }
+}
diff --git a/AppInfoCli/Program.cs b/AppInfoCli/Program.cs
index d3a5749..578b671 100644
--- a/AppInfoCli/Program.cs
+++ b/AppInfoCli/Program.cs
@@ -1,4 +1,5 @@
-using General;
+using CXMLDecompiler;
+using General;
using System;
using System.IO;
using System.Reflection;
@@ -7,9 +8,12 @@ namespace CXMLCli
{
class Program
{
- static void Main(string[] args)
+ static int Main(string[] args)
{
- //args = "src20.vag -iv".Split(' ');
+
+ // Do you have gimconv?
+ if (!File.Exists(Path.Combine("GimConv", "GimConv.exe")))
+ GimConv.DownloadGimConv(); // Politely ask sony to give it to us.
bool Check = true;
@@ -37,7 +41,7 @@ namespace CXMLCli
Console.WriteLine("\t-d --decompile Decompile CXML.");
Console.WriteLine("Example: " + Path.GetFileName(Assembly.GetEntryAssembly().Location) + " app.info -f -s -t -f -d");
Console.WriteLine("Default functonality is to Decompile,\nThis is canceled if any other arguments passed.");
- return;
+ return 0;
}
String ArgsFull = String.Join(" ", args);
@@ -50,7 +54,7 @@ namespace CXMLCli
string FileName = Path.GetFileNameWithoutExtension(path) + "-" + VAG.VAGAudio.GetFilename(path) + ".wav";
Console.WriteLine("Writing "+FileName);
File.WriteAllBytes(FileName, WaveData);
- return;
+ return 0;
}
CXML.CXMLParser cxmlParser = new CXML.CXMLParser();
cxmlParser.Init(path, Check);
@@ -139,7 +143,7 @@ namespace CXMLCli
cxmlParser.WaitExit = true;
}
- if (ArgsFull.Contains("-d") || ArgsFull.Contains("--decompile"))
+ if (ArgsFull.Contains("-d") || ArgsFull.Contains("--decompile") && !ArgsFull.Contains("-dt"))
{
Console.WriteLine("Decompiling.");
cxmlParser.DecompileCXML(path, Check);
@@ -147,6 +151,7 @@ namespace CXMLCli
if(cxmlParser.WaitExit)
Console.ReadKey();
}
+
return 0;
}
}