Add VXAce Support.

This commit is contained in:
SilicaAndPina 2019-12-15 19:47:58 +13:00
parent 2ac917cebd
commit 34cc013c5e
15 changed files with 133 additions and 37027 deletions

BIN
.vs/RMDEC/v15/.suo Normal file

Binary file not shown.

View File

@ -540,7 +540,7 @@ namespace RMDEC
makeMV.Enabled = true; makeMV.Enabled = true;
unmakeMV.Enabled = true; unmakeMV.Enabled = true;
Process.Start(mvProject.FilePath); Process.Start(mvProject.FilePath+"\\");
} }
private void makeMV_Click(object sender, EventArgs e) private void makeMV_Click(object sender, EventArgs e)
{ {

View File

@ -32,9 +32,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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"> <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> <HintPath>..\packages\WindowsAPICodePack-Core.1.1.2\lib\Microsoft.WindowsAPICodePack.dll</HintPath>
</Reference> </Reference>

View File

@ -1,10 +1,9 @@
using Ionic.Zlib; 
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace RMDEC namespace RMDEC
{ {
@ -13,11 +12,10 @@ namespace RMDEC
public VXAProject() { } public VXAProject() { }
//Private Variables //Private Variables
private static int[] supportedVersions = { 0x3 };
private int currentVersion = 0;
private byte[] encryptionKey = new byte[0x4]; private byte[] encryptionKey = new byte[0x4];
private string gameTitle; private string gameTitle;
private string exeName;
private string filePath; private string filePath;
private Stream rgss3aStream; private Stream rgss3aStream;
@ -43,6 +41,15 @@ namespace RMDEC
} }
} }
public String ExeName
{
get
{
return exeName;
}
}
public String FilePath public String FilePath
{ {
get get
@ -126,18 +133,21 @@ namespace RMDEC
private byte[] decryptFileData(byte[] input, byte[] keydata) private byte[] decryptFileData(byte[] input, byte[] keydata)
{ {
byte[] output = new byte[input.Length]; long size = input.LongLength;
byte[] output = new byte[size];
uint keyInt = BitConverter.ToUInt32(keydata, 0x00); uint keyInt = BitConverter.ToUInt32(keydata, 0x00);
for (int i = 0; i < input.Length; i++) for (int i = 0; i < size; i++)
{ {
if (i != 0 && i % 4 == 0) if (i != 0 && i % 4 == 0)
{ {
// Derive new key // Derive new key
keyInt *= 7; keyInt = ((keyInt * 7) + 3);
keyInt += 3;
keydata = BitConverter.GetBytes(keyInt); byte[] derivedKeyBytes = BitConverter.GetBytes(keyInt);
Array.Copy(derivedKeyBytes, keydata, 0x4); // have to do this in order to make the arguments update..
} }
output[i] = (byte)(input[i] ^ keydata[i % keydata.Length]); output[i] = (byte)(input[i] ^ keydata[i % keydata.Length]);
@ -162,31 +172,23 @@ namespace RMDEC
throw new InvalidDataException("Not a valid rgss3a!"); throw new InvalidDataException("Not a valid rgss3a!");
} }
string workDir = Path.GetDirectoryName(file); string workDir = Path.GetDirectoryName(file);
string gameExeName = Path.GetFileNameWithoutExtension(file); vxp.exeName = Path.GetFileNameWithoutExtension(file);
string iniFilePath = Path.Combine(workDir, gameExeName + ".ini"); string iniFilePath = Path.Combine(workDir, vxp.exeName + ".ini");
vxp.rgss3aStream = rgss3a; vxp.rgss3aStream = rgss3a;
try try
{ {
vxp.gameTitle = read_ini_value(iniFilePath, "Game", "Title", gameExeName); vxp.gameTitle = read_ini_value(iniFilePath, "Game", "Title", vxp.exeName);
} }
catch (Exception) catch (Exception)
{ {
vxp.gameTitle = gameExeName; vxp.gameTitle = vxp.exeName;
} }
vxp.filePath = workDir; vxp.filePath = workDir;
rgss3a.Seek(0x1, SeekOrigin.Current); rgss3a.Seek(0x2, 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)); vxp.encryptionKey = BitConverter.GetBytes((((vxp.readUInt32()) * 9) + 3));
@ -196,31 +198,29 @@ namespace RMDEC
public void DecryptFile(int fileIndex, Stream outStream) public void DecryptFile(int fileIndex, Stream outStream)
{ {
outStream.SetLength(0);
ArchiveFile fileData = archiveFileList[fileIndex]; ArchiveFile fileData = archiveFileList[fileIndex];
byte[] keyData = fileData.Key; byte[] keyData = fileData.Key;
rgss3aStream.Seek(fileData.Offset, SeekOrigin.Begin); rgss3aStream.Seek(fileData.Offset, SeekOrigin.Begin);
uint size = fileData.Size; uint size = fileData.Size;
for(int i = 0; i < size; i += 0x40000000) for(int i = 0; i < size; i += 0x20000000)
{ {
if (size >= 0x40000000) //1GB if (size > 0x20000000) //512MB
{ {
byte[] gameData = new byte[0x40000000]; byte[] gameData = new byte[0x20000000];
rgss3aStream.Read(gameData, 0x00, 0x40000000); rgss3aStream.Read(gameData, 0x00, 0x20000000);
gameData = decryptFileData(gameData, keyData); gameData = decryptFileData(gameData, keyData);
//gameData = ZlibStream.UncompressBuffer(gameData); outStream.Write(gameData, 0x00, gameData.Length);
outStream.Write(gameData, 0x00, (int)size);
} }
else else
{ {
byte[] gameData = new byte[size]; byte[] gameData = new byte[size];
rgss3aStream.Read(gameData, 0x00, (int)size); rgss3aStream.Read(gameData, 0x00, gameData.Length);
gameData = decryptFileData(gameData, keyData); gameData = decryptFileData(gameData, keyData);
//gameData = ZlibStream.UncompressBuffer(gameData); outStream.Write(gameData, 0x00, gameData.Length);
outStream.Write(gameData, 0x00, (int)size);
} }
} }

View File

@ -31,15 +31,11 @@
this.encryptedFileList = new System.Windows.Forms.ListBox(); this.encryptedFileList = new System.Windows.Forms.ListBox();
this.decryptSelected = new System.Windows.Forms.Button(); this.decryptSelected = new System.Windows.Forms.Button();
this.decryptedFileList = new System.Windows.Forms.ListBox(); this.decryptedFileList = new System.Windows.Forms.ListBox();
this.encryptSelected = new System.Windows.Forms.Button();
this.processingBar = new System.Windows.Forms.ProgressBar(); this.processingBar = new System.Windows.Forms.ProgressBar();
this.processingText = new System.Windows.Forms.Label(); this.processingText = new System.Windows.Forms.Label();
this.makeMV = new System.Windows.Forms.Button(); this.makeVXA = new System.Windows.Forms.Button();
this.unmakeMV = new System.Windows.Forms.Button();
this.layout1 = new System.Windows.Forms.TableLayoutPanel(); this.layout1 = new System.Windows.Forms.TableLayoutPanel();
this.layout2 = new System.Windows.Forms.TableLayoutPanel();
this.layout1.SuspendLayout(); this.layout1.SuspendLayout();
this.layout2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// encryptedFileList // encryptedFileList
@ -51,9 +47,8 @@
this.encryptedFileList.HorizontalScrollbar = true; this.encryptedFileList.HorizontalScrollbar = true;
this.encryptedFileList.Location = new System.Drawing.Point(3, 3); this.encryptedFileList.Location = new System.Drawing.Point(3, 3);
this.encryptedFileList.Name = "encryptedFileList"; this.encryptedFileList.Name = "encryptedFileList";
this.layout1.SetRowSpan(this.encryptedFileList, 4);
this.encryptedFileList.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; this.encryptedFileList.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.encryptedFileList.Size = new System.Drawing.Size(334, 357); this.encryptedFileList.Size = new System.Drawing.Size(820, 141);
this.encryptedFileList.TabIndex = 3; this.encryptedFileList.TabIndex = 3;
// //
// decryptSelected // decryptSelected
@ -63,11 +58,11 @@
this.decryptSelected.Enabled = false; this.decryptSelected.Enabled = false;
this.decryptSelected.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.decryptSelected.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.decryptSelected.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; this.decryptSelected.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.decryptSelected.Location = new System.Drawing.Point(387, 98); this.decryptSelected.Location = new System.Drawing.Point(389, 156);
this.decryptSelected.Name = "decryptSelected"; this.decryptSelected.Name = "decryptSelected";
this.decryptSelected.Size = new System.Drawing.Size(48, 48); this.decryptSelected.Size = new System.Drawing.Size(48, 48);
this.decryptSelected.TabIndex = 4; this.decryptSelected.TabIndex = 4;
this.decryptSelected.Text = "-->"; this.decryptSelected.Text = "|\r\nV";
this.decryptSelected.UseVisualStyleBackColor = false; this.decryptSelected.UseVisualStyleBackColor = false;
this.decryptSelected.Click += new System.EventHandler(this.decryptSelected_Click); this.decryptSelected.Click += new System.EventHandler(this.decryptSelected_Click);
// //
@ -78,31 +73,15 @@
this.decryptedFileList.Dock = System.Windows.Forms.DockStyle.Fill; this.decryptedFileList.Dock = System.Windows.Forms.DockStyle.Fill;
this.decryptedFileList.FormattingEnabled = true; this.decryptedFileList.FormattingEnabled = true;
this.decryptedFileList.HorizontalScrollbar = true; this.decryptedFileList.HorizontalScrollbar = true;
this.decryptedFileList.Location = new System.Drawing.Point(486, 3); this.decryptedFileList.Location = new System.Drawing.Point(3, 217);
this.decryptedFileList.Name = "decryptedFileList"; this.decryptedFileList.Name = "decryptedFileList";
this.layout1.SetRowSpan(this.decryptedFileList, 4);
this.decryptedFileList.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; this.decryptedFileList.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.decryptedFileList.Size = new System.Drawing.Size(337, 357); this.decryptedFileList.Size = new System.Drawing.Size(820, 143);
this.decryptedFileList.TabIndex = 5; 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 // processingBar
// //
this.processingBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) this.processingBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.processingBar.BackColor = System.Drawing.SystemColors.InactiveCaption; this.processingBar.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.processingBar.Location = new System.Drawing.Point(154, 415); this.processingBar.Location = new System.Drawing.Point(154, 415);
@ -123,93 +102,56 @@
this.processingText.Text = "Waiting"; this.processingText.Text = "Waiting";
this.processingText.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.processingText.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// makeMV // makeVXA
// //
this.makeMV.BackColor = System.Drawing.SystemColors.InactiveCaption; this.makeVXA.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
this.makeMV.Dock = System.Windows.Forms.DockStyle.Fill; | System.Windows.Forms.AnchorStyles.Right)));
this.makeMV.Enabled = false; this.makeVXA.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.makeMV.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.makeVXA.Enabled = false;
this.makeMV.Location = new System.Drawing.Point(417, 3); this.makeVXA.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.makeMV.Name = "makeMV"; this.makeVXA.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
this.makeMV.Size = new System.Drawing.Size(409, 24); this.makeVXA.Location = new System.Drawing.Point(18, 385);
this.makeMV.TabIndex = 9; this.makeVXA.Name = "makeVXA";
this.makeMV.Text = "Un-Deploy MV Project"; this.makeVXA.Size = new System.Drawing.Size(820, 24);
this.makeMV.UseVisualStyleBackColor = false; this.makeVXA.TabIndex = 10;
this.makeMV.Click += new System.EventHandler(this.makeMV_Click); this.makeVXA.Text = "Decrypt and Uncompress to VX Ace Project";
// this.makeVXA.UseVisualStyleBackColor = false;
// unmakeMV this.makeVXA.Click += new System.EventHandler(this.makeVXA_Click);
//
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 // layout1
// //
this.layout1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 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.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.layout1.ColumnCount = 5; this.layout1.ColumnCount = 1;
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, 100F));
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.encryptedFileList, 0, 0);
this.layout1.Controls.Add(this.decryptedFileList, 4, 0); this.layout1.Controls.Add(this.decryptedFileList, 0, 2);
this.layout1.Controls.Add(this.decryptSelected, 2, 1); this.layout1.Controls.Add(this.decryptSelected, 2, 1);
this.layout1.Location = new System.Drawing.Point(15, 12); this.layout1.Location = new System.Drawing.Point(15, 12);
this.layout1.Name = "layout1"; this.layout1.Name = "layout1";
this.layout1.RowCount = 4; this.layout1.RowCount = 3;
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, 40.76087F));
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, 18.47826F));
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.Percent, 40.76087F));
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.Size = new System.Drawing.Size(826, 363);
this.layout1.TabIndex = 7; this.layout1.TabIndex = 7;
// //
// layout2 // vxaProjectToolset
//
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.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ActiveCaption; this.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.ClientSize = new System.Drawing.Size(853, 442); this.ClientSize = new System.Drawing.Size(853, 442);
this.Controls.Add(this.makeVXA);
this.Controls.Add(this.processingText); this.Controls.Add(this.processingText);
this.Controls.Add(this.processingBar); this.Controls.Add(this.processingBar);
this.Controls.Add(this.layout1); this.Controls.Add(this.layout1);
this.Controls.Add(this.layout2);
this.MinimumSize = new System.Drawing.Size(869, 481); this.MinimumSize = new System.Drawing.Size(869, 481);
this.Name = "VXAProjectToolset"; this.Name = "vxaProjectToolset";
this.Text = "RMDec - RPG Maker VX ACE"; this.Text = "RMDec - RPG Maker VX ACE";
this.Load += new System.EventHandler(this.VXAProjectToolset_Load); this.Load += new System.EventHandler(this.VXAProjectToolset_Load);
this.layout1.ResumeLayout(false); this.layout1.ResumeLayout(false);
this.layout2.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -218,12 +160,9 @@
private System.Windows.Forms.ListBox encryptedFileList; private System.Windows.Forms.ListBox encryptedFileList;
private System.Windows.Forms.Button decryptSelected; private System.Windows.Forms.Button decryptSelected;
private System.Windows.Forms.ListBox decryptedFileList; private System.Windows.Forms.ListBox decryptedFileList;
private System.Windows.Forms.Button encryptSelected;
private System.Windows.Forms.ProgressBar processingBar; private System.Windows.Forms.ProgressBar processingBar;
private System.Windows.Forms.Label processingText; private System.Windows.Forms.Label processingText;
private System.Windows.Forms.Button makeMV; private System.Windows.Forms.Button makeVXA;
private System.Windows.Forms.Button unmakeMV;
private System.Windows.Forms.TableLayoutPanel layout1; private System.Windows.Forms.TableLayoutPanel layout1;
private System.Windows.Forms.TableLayoutPanel layout2;
} }
} }

View File

@ -19,32 +19,21 @@ namespace RMDEC
vxProject = proj; vxProject = proj;
InitializeComponent(); InitializeComponent();
} }
private List<string> decFileList = new List<string>();
private bool encryptedIndexingComplete = false;
private bool unencryptedIndexingComplete = false;
private void onIndexThreadComplete() private void onIndexThreadComplete()
{ {
if(encryptedIndexingComplete && unencryptedIndexingComplete) processingText.Text = "Waiting";
{ processingText.BackColor = Color.Red;
processingText.Text = "Waiting";
processingText.BackColor = Color.Red;
decryptSelected.Enabled = true; decryptSelected.Enabled = true;
encryptSelected.Enabled = true;
makeMV.Enabled = true; makeVXA.Enabled = true;
unmakeMV.Enabled = true; makeVXA.Enabled = true;
processingBar.Style = ProgressBarStyle.Continuous; processingBar.Style = ProgressBarStyle.Continuous;
this.Cursor = Cursors.Arrow; this.Cursor = Cursors.Arrow;
}
} }
private void indexFiles() private void indexFiles()
{ {
@ -54,112 +43,39 @@ namespace RMDEC
this.Cursor = Cursors.WaitCursor; this.Cursor = Cursors.WaitCursor;
//Index Encrypted Files //Index Encrypted Files
Thread indexEncryptedFilesThread = new Thread(() => Thread indexFiles = new Thread(() =>
{ {
vxProject.PopulateFileList(); vxProject.PopulateFileList();
foreach (string file in vxProject.FileList) foreach (string file in vxProject.FileList)
{ {
string fileExtension = Path.GetExtension(file); string fileExtension = Path.GetExtension(file);
string realPath = Path.Combine(vxProject.FilePath, file);
Invoke((Action)delegate Invoke((Action)delegate
{ {
encryptedFileList.Items.Add("[" + fileExtension.ToUpper().TrimStart('.') + "] " + file); encryptedFileList.Items.Add("[" + fileExtension.ToUpper().TrimStart('.') + "] " + file);
}); });
if (File.Exists(realPath))
{
Invoke((Action)delegate
{
decryptedFileList.Items.Add("[" + fileExtension.ToUpper().TrimStart('.') + "] " + file);
});
}
} }
Invoke((Action)delegate Invoke((Action)delegate
{ {
encryptedIndexingComplete = true;
unencryptedIndexingComplete = true;
onIndexThreadComplete(); onIndexThreadComplete();
}); });
}); });
indexEncryptedFilesThread.Start(); indexFiles.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) private void VXAProjectToolset_Load(object sender, EventArgs e)
{ {
@ -172,87 +88,7 @@ namespace RMDEC
this.Text = "RMDec - [RMVXA] " + vxProject.GameTitle + " - " + vxProject.FilePath; 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) private void decryptSelected_Click(object sender, EventArgs e)
@ -271,27 +107,20 @@ namespace RMDEC
processingBar.Maximum = itemCount; processingBar.Maximum = itemCount;
processingText.BackColor = Color.Yellow; processingText.BackColor = Color.Yellow;
encryptSelected.Enabled = false;
decryptSelected.Enabled = false; decryptSelected.Enabled = false;
makeMV.Enabled = false; makeVXA.Enabled = false;
unmakeMV.Enabled = false;
Thread decryptFilesThread = new Thread(() => Thread decryptFilesThread = new Thread(() =>
{ {
int i = 1; for(int i = 0; i < itemCount; i++)
int total = itemCount; {
do
{
Invoke((Action)delegate Invoke((Action)delegate
{ {
item = itemList[i];
itemCount = itemList.Count; processingText.Text = "Decrypting " + i.ToString() + "/" + itemCount.ToString();
item = itemList[0];
processingText.Text = "Decrypting " + i.ToString() + "/" + total.ToString();
}); });
@ -308,50 +137,50 @@ namespace RMDEC
Invoke((Action)delegate Invoke((Action)delegate
{ {
string entry = encryptedFileList.Items[item].ToString(); string encEntry = encryptedFileList.Items[i].ToString();
string decryptedEntry = entry; if (!decryptedFileList.Items.Contains(encEntry))
decryptedFileList.Items.Add(decryptedEntry); {
decryptedFileList.Items.Add(encEntry);
}
encryptedFileList.Items.RemoveAt(item);
vxProject.FileList.RemoveAt(item);
processingBar.Value = i; processingBar.Value = i;
}); });
i++; }
} while (itemCount > 1);
Invoke((Action)delegate Invoke((Action)delegate
{ {
encryptSelected.Enabled = true;
decryptSelected.Enabled = true; decryptSelected.Enabled = true;
makeMV.Enabled = true; makeVXA.Enabled = true;
unmakeMV.Enabled = true;
processingText.BackColor = Color.Green; processingText.BackColor = Color.Green;
processingText.Text = "Decrypted " + total.ToString() + " files!"; processingText.Text = "Decrypted " + itemCount.ToString() + " files!";
}); });
}); });
decryptFilesThread.Start(); decryptFilesThread.Start();
} }
private void onMakeMvComplete() private void onMakeVxaComplete()
{ {
string rpgProject = Path.Combine(vxProject.FilePath, "Game.rvproj2"); string rpgProject = Path.Combine(vxProject.FilePath, vxProject.ExeName+".rvproj2");
string rpgEncryptedArchive = Path.Combine(vxProject.FilePath, vxProject.ExeName + ".rgss3a");
File.WriteAllText(rpgProject, "RPGVXAce 1.00"); File.WriteAllText(rpgProject, "RPGVXAce 1.00");
if(File.Exists(rpgEncryptedArchive))
{
vxProject.Close();
File.Move(rpgEncryptedArchive, rpgEncryptedArchive+".delete-me");
}
processingText.BackColor = Color.Green; processingText.BackColor = Color.Green;
processingText.Text = "Game Un-Deployed!"; processingText.Text = "Game Decrypted!";
encryptSelected.Enabled = true;
decryptSelected.Enabled = true; decryptSelected.Enabled = true;
makeMV.Enabled = true; makeVXA.Enabled = true;
unmakeMV.Enabled = true;
Process.Start(vxProject.FilePath); Process.Start(vxProject.FilePath+"\\");
} }
private void makeMV_Click(object sender, EventArgs e) private void makeVXA_Click(object sender, EventArgs e)
{ {
int itemCount = vxProject.FileList.Count; int itemCount = vxProject.FileList.Count;
@ -362,12 +191,11 @@ namespace RMDEC
processingBar.Maximum = itemCount; processingBar.Maximum = itemCount;
processingText.BackColor = Color.Yellow; processingText.BackColor = Color.Yellow;
encryptSelected.Enabled = false;
decryptSelected.Enabled = false; decryptSelected.Enabled = false;
makeMV.Enabled = false; makeVXA.Enabled = false;
unmakeMV.Enabled = false; makeVXA.Enabled = false;
Thread decryptFilesThread = new Thread(() => Thread decryptFilesThread = new Thread(() =>
{ {
@ -380,26 +208,22 @@ namespace RMDEC
}); });
string fileName = (Path.Combine(vxProject.FilePath, vxProject.FileList[0])); string fileName = (Path.Combine(vxProject.FilePath, vxProject.FileList[i]));
Directory.CreateDirectory(Path.GetDirectoryName(fileName)); Directory.CreateDirectory(Path.GetDirectoryName(fileName));
FileStream Decrypted = File.OpenWrite(fileName); FileStream Decrypted = File.OpenWrite(fileName);
vxProject.DecryptFile(i, Decrypted);
vxProject.DecryptFile(0, Decrypted);
Decrypted.Close(); Decrypted.Close();
Invoke((Action)delegate Invoke((Action)delegate
{ {
string entry = encryptedFileList.Items[0].ToString(); string encEntry = encryptedFileList.Items[0].ToString();
string decryptedEntry = entry; if (!decryptedFileList.Items.Contains(encEntry))
decryptedFileList.Items.Add(decryptedEntry); {
decFileList.Add(fileName); decryptedFileList.Items.Add(encEntry);
}
encryptedFileList.Items.RemoveAt(0); encryptedFileList.Items.Remove(encEntry);
vxProject.FileList.RemoveAt(0);
processingBar.Value = i; processingBar.Value = i;
}); });
} }
@ -408,7 +232,7 @@ namespace RMDEC
Invoke((Action)delegate Invoke((Action)delegate
{ {
onMakeMvComplete(); onMakeVxaComplete();
}); });
@ -418,103 +242,10 @@ namespace RMDEC
} }
else else
{ {
onMakeMvComplete(); onMakeVxaComplete();
} }
} }
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

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

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

File diff suppressed because it is too large Load Diff