Add VXA Support

This commit is contained in:
SilicaAndPina 2019-12-15 17:50:00 +13:00
parent a94449f8a2
commit 2ac917cebd
20 changed files with 37814 additions and 29 deletions

View File

@ -10,6 +10,7 @@ namespace RMDEC
{
public class MVProject
{
public MVProject() { }
//Private internal variables
@ -122,18 +123,7 @@ namespace RMDEC
}
private static byte[] xor(byte[] input, byte[] key)
{
long inpLen = input.LongLength;
byte[] output = new byte[inpLen];
for(long i = 0; i < input.LongLength; i++)
{
output[i] = (byte)(input[i] ^ key[i % key.LongLength]);
}
return output;
}
private void genEncryptionKey()
{
@ -214,7 +204,7 @@ namespace RMDEC
byte[] plaintextHeader = new byte[0x10];
inStream.Read(plaintextHeader, 0x00, 0x10);
byte[] encryptedHeader = xor(plaintextHeader, EncryptionKey);
byte[] encryptedHeader = RMProject.Xor(plaintextHeader, EncryptionKey);
outStream.Write(encryptedHeader, 0x00, encryptedHeader.Length);
inStream.CopyTo(outStream);
}
@ -235,7 +225,7 @@ namespace RMDEC
byte[] encryptedHeader = new byte[0x10];
inStream.Read(encryptedHeader, 0x00, 0x10);
byte[] plaintextHeader = xor(encryptedHeader, EncryptionKey);
byte[] plaintextHeader = RMProject.Xor(encryptedHeader, EncryptionKey);
outStream.Seek(0x00, SeekOrigin.Begin);
outStream.SetLength(0);

View File

@ -1,6 +1,6 @@
namespace RMDEC
{
partial class MVProjectToolset
partial class mvProjectToolset
{
/// <summary>
/// Required designer variable.

View File

@ -10,10 +10,10 @@ using static System.Windows.Forms.ListBox;
namespace RMDEC
{
public partial class MVProjectToolset : Form
public partial class mvProjectToolset : Form
{
public MVProject mvProject;
public MVProjectToolset(MVProject proj)
public mvProjectToolset(MVProject proj)
{
mvProject = proj;
InitializeComponent();

View File

@ -32,6 +32,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DotNetZip, Version=1.13.4.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.13.4\lib\net40\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\WindowsAPICodePack-Core.1.1.2\lib\Microsoft.WindowsAPICodePack.dll</HintPath>
</Reference>
@ -55,6 +58,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="MVProject.cs" />
<Compile Include="VXAProjectToolset.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="VXAProjectToolset.Designer.cs">
<DependentUpon>VXAProjectToolset.cs</DependentUpon>
</Compile>
<Compile Include="MVProjectToolset.cs">
<SubType>Form</SubType>
</Compile>
@ -69,6 +78,11 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RMProject.cs" />
<Compile Include="VXAProject.cs" />
<EmbeddedResource Include="VXAProjectToolset.resx">
<DependentUpon>VXAProjectToolset.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MVProjectToolset.resx">
<DependentUpon>MVProjectToolset.cs</DependentUpon>
</EmbeddedResource>

26
RMDEC/RMProject.cs Normal file
View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RMDEC
{
class RMProject
{
public static Byte[] Xor(byte[] input, byte[] key)
{
long inpLen = input.LongLength;
byte[] output = new byte[inpLen];
for (long i = 0; i < input.LongLength; i++)
{
output[i] = (byte)(input[i] ^ key[i % key.LongLength]);
}
return output;
}
}
}

264
RMDEC/VXAProject.cs Normal file
View File

@ -0,0 +1,264 @@
using Ionic.Zlib;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RMDEC
{
public class VXAProject
{
public VXAProject() { }
//Private Variables
private static int[] supportedVersions = { 0x3 };
private int currentVersion = 0;
private byte[] encryptionKey = new byte[0x4];
private string gameTitle;
private string filePath;
private Stream rgss3aStream;
private struct ArchiveFile
{
public UInt32 Offset;
public UInt32 Size;
public Byte[] Key;
public String Name;
}
private List<ArchiveFile> archiveFileList = new List<ArchiveFile>();
//Public Variables
public List<String> FileList = new List<string>();
public String GameTitle
{
get
{
return gameTitle;
}
}
public String FilePath
{
get
{
return filePath;
}
}
public byte[] EncryptionKey
{
get
{
return encryptionKey;
}
}
//Private Functions
private uint readUInt32()
{
byte[] intBytes = new byte[0x4];
rgss3aStream.Read(intBytes, 0x00, 0x4);
return BitConverter.ToUInt32(intBytes, 0x00);
}
private byte[] decryptData(uint size)
{
byte[] data = new byte[size];
rgss3aStream.Read(data, 0x00, data.Length);
return RMProject.Xor(data, encryptionKey);
}
private uint decryptUint32()
{
byte[] intBytes = decryptData(0x4);
return BitConverter.ToUInt32(intBytes, 0x00);
}
private string decryptString(uint length)
{
byte[] strBytes = decryptData(length);
return Encoding.UTF8.GetString(strBytes);
}
private static string read_ini_value(string iniFile, string column,string key,string defaultValue="")
{
string[] lines = File.ReadAllLines(iniFile);
string value = defaultValue;
bool inColumn = false;
foreach(string line in lines)
{
if (line == ("[" + column + "]"))
{
inColumn = true;
continue;
}
if(!inColumn)
{
continue;
}
string[] iniKeyValue = line.Split('=');
if (iniKeyValue[0] == key)
{
value = iniKeyValue[1];
break;
}
if(line.StartsWith("["))
{
break;
}
}
return value;
}
private byte[] decryptFileData(byte[] input, byte[] keydata)
{
byte[] output = new byte[input.Length];
uint keyInt = BitConverter.ToUInt32(keydata, 0x00);
for (int i = 0; i < input.Length; i++)
{
if (i != 0 && i % 4 == 0)
{
// Derive new key
keyInt *= 7;
keyInt += 3;
keydata = BitConverter.GetBytes(keyInt);
}
output[i] = (byte)(input[i] ^ keydata[i % keydata.Length]);
}
return output;
}
//Public Functions
public static VXAProject ParseRgss3a(string file)
{
VXAProject vxp = new VXAProject();
FileStream rgss3a = File.OpenRead(file);
byte[] magic = new byte[0x06];
rgss3a.Read(magic, 0x00, 0x06);
string magicStr = Encoding.UTF8.GetString(magic);
if (magicStr != "RGSSAD")
{
throw new InvalidDataException("Not a valid rgss3a!");
}
string workDir = Path.GetDirectoryName(file);
string gameExeName = Path.GetFileNameWithoutExtension(file);
string iniFilePath = Path.Combine(workDir, gameExeName + ".ini");
vxp.rgss3aStream = rgss3a;
try
{
vxp.gameTitle = read_ini_value(iniFilePath, "Game", "Title", gameExeName);
}
catch (Exception)
{
vxp.gameTitle = gameExeName;
}
vxp.filePath = workDir;
rgss3a.Seek(0x1, SeekOrigin.Current);
int version = rgss3a.ReadByte();
if(!supportedVersions.Contains(version))
{
throw new InvalidDataException("Unsupported version!");
}
vxp.currentVersion = version;
vxp.encryptionKey = BitConverter.GetBytes((((vxp.readUInt32()) * 9) + 3));
return vxp;
}
public void DecryptFile(int fileIndex, Stream outStream)
{
ArchiveFile fileData = archiveFileList[fileIndex];
byte[] keyData = fileData.Key;
rgss3aStream.Seek(fileData.Offset, SeekOrigin.Begin);
uint size = fileData.Size;
for(int i = 0; i < size; i += 0x40000000)
{
if (size >= 0x40000000) //1GB
{
byte[] gameData = new byte[0x40000000];
rgss3aStream.Read(gameData, 0x00, 0x40000000);
gameData = decryptFileData(gameData, keyData);
//gameData = ZlibStream.UncompressBuffer(gameData);
outStream.Write(gameData, 0x00, (int)size);
}
else
{
byte[] gameData = new byte[size];
rgss3aStream.Read(gameData, 0x00, (int)size);
gameData = decryptFileData(gameData, keyData);
//gameData = ZlibStream.UncompressBuffer(gameData);
outStream.Write(gameData, 0x00, (int)size);
}
}
}
public void PopulateFileList()
{
archiveFileList.Clear();
FileList.Clear();
while (true)
{
uint offset = decryptUint32();
if (offset == 0x00)
{
break;
}
ArchiveFile file;
file.Offset = offset;
file.Size = decryptUint32();
file.Key = decryptData(0x4);
uint nameLen = decryptUint32();
file.Name = decryptString(nameLen);
archiveFileList.Add(file);
FileList.Add(file.Name);
}
}
public void Close()
{
rgss3aStream.Close();
rgss3aStream.Dispose();
FileList.Clear();
archiveFileList.Clear();
}
}
}

229
RMDEC/VXAProjectToolset.Designer.cs generated Normal file
View File

@ -0,0 +1,229 @@
namespace RMDEC
{
partial class vxaProjectToolset
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.encryptedFileList = new System.Windows.Forms.ListBox();
this.decryptSelected = new System.Windows.Forms.Button();
this.decryptedFileList = new System.Windows.Forms.ListBox();
this.encryptSelected = new System.Windows.Forms.Button();
this.processingBar = new System.Windows.Forms.ProgressBar();
this.processingText = new System.Windows.Forms.Label();
this.makeMV = new System.Windows.Forms.Button();
this.unmakeMV = new System.Windows.Forms.Button();
this.layout1 = new System.Windows.Forms.TableLayoutPanel();
this.layout2 = new System.Windows.Forms.TableLayoutPanel();
this.layout1.SuspendLayout();
this.layout2.SuspendLayout();
this.SuspendLayout();
//
// encryptedFileList
//
this.encryptedFileList.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.encryptedFileList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.encryptedFileList.Dock = System.Windows.Forms.DockStyle.Fill;
this.encryptedFileList.FormattingEnabled = true;
this.encryptedFileList.HorizontalScrollbar = true;
this.encryptedFileList.Location = new System.Drawing.Point(3, 3);
this.encryptedFileList.Name = "encryptedFileList";
this.layout1.SetRowSpan(this.encryptedFileList, 4);
this.encryptedFileList.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.encryptedFileList.Size = new System.Drawing.Size(334, 357);
this.encryptedFileList.TabIndex = 3;
//
// decryptSelected
//
this.decryptSelected.Anchor = System.Windows.Forms.AnchorStyles.None;
this.decryptSelected.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.decryptSelected.Enabled = false;
this.decryptSelected.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.decryptSelected.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.decryptSelected.Location = new System.Drawing.Point(387, 98);
this.decryptSelected.Name = "decryptSelected";
this.decryptSelected.Size = new System.Drawing.Size(48, 48);
this.decryptSelected.TabIndex = 4;
this.decryptSelected.Text = "-->";
this.decryptSelected.UseVisualStyleBackColor = false;
this.decryptSelected.Click += new System.EventHandler(this.decryptSelected_Click);
//
// decryptedFileList
//
this.decryptedFileList.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.decryptedFileList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.decryptedFileList.Dock = System.Windows.Forms.DockStyle.Fill;
this.decryptedFileList.FormattingEnabled = true;
this.decryptedFileList.HorizontalScrollbar = true;
this.decryptedFileList.Location = new System.Drawing.Point(486, 3);
this.decryptedFileList.Name = "decryptedFileList";
this.layout1.SetRowSpan(this.decryptedFileList, 4);
this.decryptedFileList.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.decryptedFileList.Size = new System.Drawing.Size(337, 357);
this.decryptedFileList.TabIndex = 5;
//
// encryptSelected
//
this.encryptSelected.Anchor = System.Windows.Forms.AnchorStyles.None;
this.encryptSelected.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.encryptSelected.Enabled = false;
this.encryptSelected.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.encryptSelected.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.encryptSelected.Location = new System.Drawing.Point(387, 208);
this.encryptSelected.Name = "encryptSelected";
this.encryptSelected.Size = new System.Drawing.Size(48, 48);
this.encryptSelected.TabIndex = 6;
this.encryptSelected.Text = "<--";
this.encryptSelected.UseVisualStyleBackColor = false;
this.encryptSelected.Click += new System.EventHandler(this.encryptSelected_Click);
//
// processingBar
//
this.processingBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.processingBar.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.processingBar.Location = new System.Drawing.Point(154, 415);
this.processingBar.Name = "processingBar";
this.processingBar.Size = new System.Drawing.Size(684, 22);
this.processingBar.TabIndex = 7;
//
// processingText
//
this.processingText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.processingText.BackColor = System.Drawing.Color.Red;
this.processingText.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.processingText.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.processingText.Location = new System.Drawing.Point(12, 415);
this.processingText.Name = "processingText";
this.processingText.Size = new System.Drawing.Size(136, 22);
this.processingText.TabIndex = 8;
this.processingText.Text = "Waiting";
this.processingText.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// makeMV
//
this.makeMV.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.makeMV.Dock = System.Windows.Forms.DockStyle.Fill;
this.makeMV.Enabled = false;
this.makeMV.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.makeMV.Location = new System.Drawing.Point(417, 3);
this.makeMV.Name = "makeMV";
this.makeMV.Size = new System.Drawing.Size(409, 24);
this.makeMV.TabIndex = 9;
this.makeMV.Text = "Un-Deploy MV Project";
this.makeMV.UseVisualStyleBackColor = false;
this.makeMV.Click += new System.EventHandler(this.makeMV_Click);
//
// unmakeMV
//
this.unmakeMV.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.unmakeMV.Dock = System.Windows.Forms.DockStyle.Fill;
this.unmakeMV.Enabled = false;
this.unmakeMV.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.unmakeMV.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
this.unmakeMV.Location = new System.Drawing.Point(3, 3);
this.unmakeMV.Name = "unmakeMV";
this.unmakeMV.Size = new System.Drawing.Size(408, 24);
this.unmakeMV.TabIndex = 10;
this.unmakeMV.Text = "Deploy MV Project";
this.unmakeMV.UseVisualStyleBackColor = false;
this.unmakeMV.Click += new System.EventHandler(this.unmakeMV_Click);
//
// layout1
//
this.layout1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.layout1.ColumnCount = 5;
this.layout1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 44.17065F));
this.layout1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.829354F));
this.layout1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 55F));
this.layout1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.829354F));
this.layout1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 44.17064F));
this.layout1.Controls.Add(this.encryptSelected, 2, 2);
this.layout1.Controls.Add(this.encryptedFileList, 0, 0);
this.layout1.Controls.Add(this.decryptedFileList, 4, 0);
this.layout1.Controls.Add(this.decryptSelected, 2, 1);
this.layout1.Location = new System.Drawing.Point(15, 12);
this.layout1.Name = "layout1";
this.layout1.RowCount = 4;
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 22.89562F));
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 39.05724F));
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 38.04714F));
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 74F));
this.layout1.Size = new System.Drawing.Size(826, 363);
this.layout1.TabIndex = 7;
//
// layout2
//
this.layout2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.layout2.ColumnCount = 2;
this.layout2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.layout2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.layout2.Controls.Add(this.unmakeMV, 0, 0);
this.layout2.Controls.Add(this.makeMV, 1, 0);
this.layout2.Location = new System.Drawing.Point(12, 380);
this.layout2.Name = "layout2";
this.layout2.RowCount = 1;
this.layout2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.layout2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.layout2.Size = new System.Drawing.Size(829, 30);
this.layout2.TabIndex = 11;
//
// VXAProjectToolset
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.ClientSize = new System.Drawing.Size(853, 442);
this.Controls.Add(this.processingText);
this.Controls.Add(this.processingBar);
this.Controls.Add(this.layout1);
this.Controls.Add(this.layout2);
this.MinimumSize = new System.Drawing.Size(869, 481);
this.Name = "VXAProjectToolset";
this.Text = "RMDec - RPG Maker VX ACE";
this.Load += new System.EventHandler(this.VXAProjectToolset_Load);
this.layout1.ResumeLayout(false);
this.layout2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListBox encryptedFileList;
private System.Windows.Forms.Button decryptSelected;
private System.Windows.Forms.ListBox decryptedFileList;
private System.Windows.Forms.Button encryptSelected;
private System.Windows.Forms.ProgressBar processingBar;
private System.Windows.Forms.Label processingText;
private System.Windows.Forms.Button makeMV;
private System.Windows.Forms.Button unmakeMV;
private System.Windows.Forms.TableLayoutPanel layout1;
private System.Windows.Forms.TableLayoutPanel layout2;
}
}

520
RMDEC/VXAProjectToolset.cs Normal file
View File

@ -0,0 +1,520 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using static System.Windows.Forms.ListBox;
namespace RMDEC
{
public partial class vxaProjectToolset : Form
{
public VXAProject vxProject;
public vxaProjectToolset(VXAProject proj)
{
vxProject = proj;
InitializeComponent();
}
private List<string> decFileList = new List<string>();
private bool encryptedIndexingComplete = false;
private bool unencryptedIndexingComplete = false;
private void onIndexThreadComplete()
{
if(encryptedIndexingComplete && unencryptedIndexingComplete)
{
processingText.Text = "Waiting";
processingText.BackColor = Color.Red;
decryptSelected.Enabled = true;
encryptSelected.Enabled = true;
makeMV.Enabled = true;
unmakeMV.Enabled = true;
processingBar.Style = ProgressBarStyle.Continuous;
this.Cursor = Cursors.Arrow;
}
}
private void indexFiles()
{
processingText.Text = "Indexing";
processingText.BackColor = Color.Yellow;
processingBar.Style = ProgressBarStyle.Marquee;
this.Cursor = Cursors.WaitCursor;
//Index Encrypted Files
Thread indexEncryptedFilesThread = new Thread(() =>
{
vxProject.PopulateFileList();
foreach (string file in vxProject.FileList)
{
string fileExtension = Path.GetExtension(file);
Invoke((Action)delegate
{
encryptedFileList.Items.Add("[" + fileExtension.ToUpper().TrimStart('.') + "] " + file);
});
}
Invoke((Action)delegate
{
encryptedIndexingComplete = true;
unencryptedIndexingComplete = true;
onIndexThreadComplete();
});
});
indexEncryptedFilesThread.Start();
/*Index Unencrypted Files
Thread indexUnencryptedFilesThread = new Thread(() =>
{
List<string> pngList = new List<string>();
List<string> oggList = new List<string>();
List<string> m4aList = new List<string>();
foreach (string file in Directory.EnumerateFiles(vxProject.FilePath, "*", SearchOption.AllDirectories))
{
string relativeName = file.Remove(0, vxProject.FilePath.Length + 1);
string fileExtension = Path.GetExtension(file).ToLower();
if(blacklistedFiles.Contains(relativeName))
{
continue;
}
switch (fileExtension)
{
case ".png":
pngList.Add(file);
break;
case ".ogg":
oggList.Add(file);
break;
case ".m4a":
m4aList.Add(file);
break;
}
}
//add PNG
foreach (string png in pngList)
{
string relativeName = png.Remove(0, vxProject.FilePath.Length+1);
Invoke((Action)delegate
{
decryptedFileList.Items.Add("[PNG] " + relativeName);
});
decFileList.Add(png);
}
//add OGG
foreach (string ogg in oggList)
{
string relativeName = ogg.Remove(0, vxProject.FilePath.Length+1);
Invoke((Action)delegate
{
decryptedFileList.Items.Add("[OGG] " + relativeName);
});
decFileList.Add(ogg);
}
//add M4A
foreach (string m4a in m4aList)
{
string relativeName = m4a.Remove(0, vxProject.FilePath.Length+1);
Invoke((Action)delegate
{
decryptedFileList.Items.Add("[M4A] " + relativeName);
});
decFileList.Add(m4a);
}
Invoke((Action)delegate
{
unencryptedImageCount = pngList.Count;
unencryptedMusicCount = oggList.Count + m4aList.Count;
unencryptedIndexingComplete = true;
onIndexThreadComplete();
});
});
indexUnencryptedFilesThread.Start();
*/
}
private void VXAProjectToolset_Load(object sender, EventArgs e)
{
updateTitle();
indexFiles();
}
private void updateTitle()
{
this.Text = "RMDec - [RMVXA] " + vxProject.GameTitle + " - " + vxProject.FilePath;
}
private void encryptSelected_Click(object sender, EventArgs e)
{
/* SelectedIndexCollection itemList = decryptedFileList.SelectedIndices;
int itemCount = itemList.Count;
if (itemCount < 1)
{
return;
}
int item = 0;
processingBar.Style = ProgressBarStyle.Continuous;
processingBar.Maximum = itemCount;
processingText.BackColor = Color.Yellow;
encryptSelected.Enabled = false;
decryptSelected.Enabled = false;
Thread decryptFilesThread = new Thread(() =>
{
int i = 1;
int total = itemCount;
do
{
Invoke((Action)delegate
{
itemCount = itemList.Count;
item = itemList[0];
processingText.Text = "Encrypting " + i.ToString() + "/" + total.ToString();
});
string decryptedFile = decFileList[item];
string newExtension = encodeFileExtension(decryptedFile);
string encryptedFile = Path.ChangeExtension(decryptedFile, newExtension);
FileStream Decrypted = File.OpenRead(decryptedFile);
FileStream Encrypted = File.OpenWrite(encryptedFile);
vxProject.EncryptFile(Decrypted, Encrypted);
Encrypted.Close();
Decrypted.Close();
File.Delete(decryptedFile);
Invoke((Action)delegate
{
string entry = decryptedFileList.Items[item].ToString();
string encryptedEntry = Path.ChangeExtension(entry, newExtension);
encryptedFileList.Items.Add(encryptedEntry);
encFileList.Add(encryptedFile);
decryptedFileList.Items.RemoveAt(item);
decFileList.RemoveAt(item);
processingBar.Value = i;
});
i++;
} while (itemCount > 1);
Invoke((Action)delegate
{
encryptSelected.Enabled = true;
decryptSelected.Enabled = true;
processingText.BackColor = Color.Green;
processingText.Text = "Encrypted " + total.ToString() + " files!";
});
});
decryptFilesThread.Start();
*/
}
private void decryptSelected_Click(object sender, EventArgs e)
{
SelectedIndexCollection itemList = encryptedFileList.SelectedIndices;
int itemCount = itemList.Count;
if (itemCount < 1)
{
return;
}
int item = 0;
processingBar.Style = ProgressBarStyle.Continuous;
processingBar.Maximum = itemCount;
processingText.BackColor = Color.Yellow;
encryptSelected.Enabled = false;
decryptSelected.Enabled = false;
makeMV.Enabled = false;
unmakeMV.Enabled = false;
Thread decryptFilesThread = new Thread(() =>
{
int i = 1;
int total = itemCount;
do
{
Invoke((Action)delegate
{
itemCount = itemList.Count;
item = itemList[0];
processingText.Text = "Decrypting " + i.ToString() + "/" + total.ToString();
});
string fileName = (Path.Combine(vxProject.FilePath, vxProject.FileList[item]));
Directory.CreateDirectory(Path.GetDirectoryName(fileName));
FileStream Decrypted = File.OpenWrite(fileName);
vxProject.DecryptFile(item, Decrypted);
Decrypted.Close();
Invoke((Action)delegate
{
string entry = encryptedFileList.Items[item].ToString();
string decryptedEntry = entry;
decryptedFileList.Items.Add(decryptedEntry);
encryptedFileList.Items.RemoveAt(item);
vxProject.FileList.RemoveAt(item);
processingBar.Value = i;
});
i++;
} while (itemCount > 1);
Invoke((Action)delegate
{
encryptSelected.Enabled = true;
decryptSelected.Enabled = true;
makeMV.Enabled = true;
unmakeMV.Enabled = true;
processingText.BackColor = Color.Green;
processingText.Text = "Decrypted " + total.ToString() + " files!";
});
});
decryptFilesThread.Start();
}
private void onMakeMvComplete()
{
string rpgProject = Path.Combine(vxProject.FilePath, "Game.rvproj2");
File.WriteAllText(rpgProject, "RPGVXAce 1.00");
processingText.BackColor = Color.Green;
processingText.Text = "Game Un-Deployed!";
encryptSelected.Enabled = true;
decryptSelected.Enabled = true;
makeMV.Enabled = true;
unmakeMV.Enabled = true;
Process.Start(vxProject.FilePath);
}
private void makeMV_Click(object sender, EventArgs e)
{
int itemCount = vxProject.FileList.Count;
//Decrypt Everything
if (itemCount > 0)
{
processingBar.Style = ProgressBarStyle.Continuous;
processingBar.Maximum = itemCount;
processingText.BackColor = Color.Yellow;
encryptSelected.Enabled = false;
decryptSelected.Enabled = false;
makeMV.Enabled = false;
unmakeMV.Enabled = false;
Thread decryptFilesThread = new Thread(() =>
{
for (int i = 0; i < itemCount; i++)
{
Invoke((Action)delegate
{
processingText.Text = "Decrypting " + i.ToString() + "/" + itemCount.ToString();
});
string fileName = (Path.Combine(vxProject.FilePath, vxProject.FileList[0]));
Directory.CreateDirectory(Path.GetDirectoryName(fileName));
FileStream Decrypted = File.OpenWrite(fileName);
vxProject.DecryptFile(0, Decrypted);
Decrypted.Close();
Invoke((Action)delegate
{
string entry = encryptedFileList.Items[0].ToString();
string decryptedEntry = entry;
decryptedFileList.Items.Add(decryptedEntry);
decFileList.Add(fileName);
encryptedFileList.Items.RemoveAt(0);
vxProject.FileList.RemoveAt(0);
processingBar.Value = i;
});
}
Invoke((Action)delegate
{
onMakeMvComplete();
});
});
decryptFilesThread.Start();
}
else
{
onMakeMvComplete();
}
}
private void onUnMakeMvComplete()
{
string rpgProject = Path.Combine(vxProject.FilePath, "Game.rpgproject");
if(File.Exists(rpgProject))
{
File.Delete(rpgProject);
}
processingText.BackColor = Color.Green;
processingText.Text = "Game Deployed!";
encryptSelected.Enabled = true;
decryptSelected.Enabled = true;
makeMV.Enabled = true;
unmakeMV.Enabled = true;
}
private void unmakeMV_Click(object sender, EventArgs e)
{
/* int itemCount = decFileList.Count;
//Encrypt Everything
if (itemCount > 0)
{
processingBar.Style = ProgressBarStyle.Continuous;
processingBar.Maximum = itemCount;
processingText.BackColor = Color.Yellow;
encryptSelected.Enabled = false;
decryptSelected.Enabled = false;
makeMV.Enabled = false;
unmakeMV.Enabled = false;
Thread encryptFilesThread = new Thread(() =>
{
for (int i = 0; i < itemCount; i++)
{
Invoke((Action)delegate
{
processingText.Text = "Encrypting " + i.ToString() + "/" + itemCount.ToString();
});
string decryptedFile = decFileList[0];
string newExtension = encodeFileExtension(decryptedFile);
string encryptedFile = Path.ChangeExtension(decryptedFile, newExtension);
FileStream Encrypted = File.OpenWrite(encryptedFile);
FileStream Decrypted = File.OpenRead(decryptedFile);
vxProject.EncryptFile(Decrypted,Encrypted);
Encrypted.Close();
Decrypted.Close();
File.Delete(decryptedFile);
Invoke((Action)delegate
{
string entry = decryptedFileList.Items[0].ToString();
string encryptedEntry = Path.ChangeExtension(entry, newExtension);
encryptedFileList.Items.Add(encryptedEntry);
encFileList.Add(encryptedFile);
decryptedFileList.Items.RemoveAt(0);
decFileList.RemoveAt(0);
processingBar.Value = i;
});
}
Invoke((Action)delegate
{
onUnMakeMvComplete();
});
});
encryptFilesThread.Start();
}
else
{
onUnMakeMvComplete();
}
*/
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNetZip" version="1.13.4" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net452" />
<package id="WindowsAPICodePack-Core" version="1.1.2" targetFramework="net452" />
<package id="WindowsAPICodePack-Shell" version="1.1.1" targetFramework="net452" />

View File

@ -114,6 +114,7 @@
this.MinimumSize = new System.Drawing.Size(677, 505);
this.Name = "projectSelector";
this.Text = "RMDec - Project Selection";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.projectSelector_FormClosing);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -2,6 +2,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Windows.Forms;
@ -11,7 +12,7 @@ namespace RMDEC
public partial class projectSelector : Form
{
private List<MVProject> mvProjectList = new List<MVProject>();
private List<Object> globalProjectList = new List<Object>();
public projectSelector()
{
InitializeComponent();
@ -19,22 +20,38 @@ namespace RMDEC
private void onIndexingComplete()
{
selectButton.Enabled = true;
this.Cursor = Cursors.Arrow;
}
private void tryAddProject(string projectFile)
{
string relativeName = projectFile.Remove(0,projectDir.Text.Length + 1);
string extension = Path.GetExtension(projectFile).ToLower();
//Try MV
try
if (extension == ".json")
{
MVProject proj = MVProject.ParseSystemJson(projectFile);
mvProjectList.Add(proj);
projectList.Items.Add("[RMMV] - "+ proj.GameTitle + " - " + relativeName);
try
{
MVProject proj = MVProject.ParseSystemJson(projectFile);
globalProjectList.Add(proj);
projectList.Items.Add("[RMMV] - " + proj.GameTitle + " - " + relativeName);
selectButton.Enabled = true;
}
catch (Exception) { }
}
catch(Exception) { }
else if (extension == ".rgss3a")
{
try
{
VXAProject proj = VXAProject.ParseRgss3a(projectFile);
globalProjectList.Add(proj);
projectList.Items.Add("[RMVXA] - " + proj.GameTitle + " - " + relativeName);
selectButton.Enabled = true;
}
catch (Exception) { }
}
}
private void updateProjectList(string projectDir)
{
@ -52,7 +69,7 @@ namespace RMDEC
{
foreach (string fileEntry in fileList)
{
if (Path.GetFileName(fileEntry) == "System.json")
if (Path.GetFileName(fileEntry) == "System.json" || Path.GetExtension(fileEntry).ToLower() == ".rgss3a")
{
Invoke((Action)delegate
{
@ -63,7 +80,6 @@ namespace RMDEC
}
catch (Exception) { };
Invoke((Action)delegate
{
onIndexingComplete();
@ -77,7 +93,7 @@ namespace RMDEC
private void clearProjectList()
{
mvProjectList.Clear();
globalProjectList.Clear();
projectList.Items.Clear();
selectButton.Enabled = false;
}
@ -105,9 +121,53 @@ namespace RMDEC
int index = projectList.SelectedIndex;
if(index >= 0)
{
MVProjectToolset mvProjectToolset = new MVProjectToolset(mvProjectList[index]);
mvProjectToolset.ShowDialog();
object proj = globalProjectList[index];
if(proj is MVProject)
{
mvProjectToolset mvToolset = new mvProjectToolset((MVProject)globalProjectList[index]);
this.Hide();
mvToolset.Show();
mvToolset.FormClosing += MvToolset_FormClosing;
}
if(proj is VXAProject)
{
vxaProjectToolset vxToolset = new vxaProjectToolset((VXAProject)globalProjectList[index]);
this.Hide();
vxToolset.Show();
vxToolset.FormClosing += VxToolset_FormClosing;
}
}
}
private void onChildFormClosed()
{
foreach (object proj in globalProjectList)
{
if (proj is VXAProject)
{
VXAProject vxproj = (VXAProject)proj;
vxproj.Close();
}
}
clearProjectList();
updateProjectList(projectDir.Text);
this.Show();
}
private void MvToolset_FormClosing(object sender, FormClosingEventArgs e)
{
onChildFormClosed();
}
private void VxToolset_FormClosing(object sender, FormClosingEventArgs e)
{
onChildFormClosed();
}
private void projectSelector_FormClosing(object sender, FormClosingEventArgs e)
{
Process.GetCurrentProcess().Kill();
}
}
}

BIN
packages/DotNetZip.1.13.4/.signature.p7s vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff