Add TestKit Support.

This commit is contained in:
Bluzume 2020-08-12 12:08:58 +12:00 committed by GitHub
parent fa8c5ff1b3
commit 98a68583f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 8 deletions

View File

@ -97,6 +97,23 @@ namespace CHOVY
catch (Exception) { }
}
public bool IsDexAidSet()
{
string isDex = ReadSetting("DexAid");
if (isDex == "0")
{
return false;
}
else if(isDex == "1")
{
return true;
}
else
{
return false;
}
}
public CHOVY()
{
InitializeComponent();
@ -174,9 +191,14 @@ namespace CHOVY
rif.Read(RifAid, 0x00, 0x08);
rif.Close();
string ContentID = Encoding.UTF8.GetString(ContentId);
string Aid = BitConverter.ToString(RifAid).Replace("-", "").ToLower();
string BackupWorkDir = Path.Combine(CmaDir, "PGAME", Aid, TitleID);
string AidStr = BitConverter.ToString(RifAid).Replace("-", "").ToLower();
if(IsDexAidSet())
{
AidStr = "0000000000000000";
}
string BackupWorkDir = Path.Combine(CmaDir, "PGAME", AidStr, TitleID);
TotalProgress.Maximum = 100;
Status.Text = "Overthrowing The PSPEMU Monarchy 0%";
@ -232,8 +254,17 @@ namespace CHOVY
*/
// Pacakge GAME
byte[] CmaKey;
if (IsDexAidSet())
{
CmaKey = CmaKeys.GenerateKey(new byte[0x8] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
}
else
{
CmaKey = CmaKeys.GenerateKey(RifAid);
}
byte[] CmaKey = CmaKeys.GenerateKey(RifAid);
string[] entrys = Directory.GetFileSystemEntries(GameWorkDir, "*", SearchOption.AllDirectories);
long noEntrys = entrys.LongLength;
@ -486,5 +517,19 @@ namespace CHOVY
WriteSetting("MuteAudio", "0");
}
}
private void DexAidEnabler_Click(object sender, EventArgs e)
{
if (!IsDexAidSet())
{
WriteSetting("DexAid", "1");
MessageBox.Show("Enabled DEX Aid\n(0x0000000000000000) will be used for CMA Backups.", "Dex Aid", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
WriteSetting("DexAid", "0");
MessageBox.Show("Enabled Retail Aid,\nAid From RIF Will be used for CMA Backups.", "Dex Aid", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}

View File

@ -48,10 +48,12 @@
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.CompressPBP = new System.Windows.Forms.CheckBox();
this.label6 = new System.Windows.Forms.Label();
this.DexAidEnabler = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PsmChan)).BeginInit();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DexAidEnabler)).BeginInit();
this.SuspendLayout();
//
// label1
@ -265,12 +267,23 @@
this.label6.TabIndex = 18;
this.label6.Text = "100% percent free!\r\n";
//
// DexAidEnabler
//
this.DexAidEnabler.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.DexAidEnabler.Location = new System.Drawing.Point(829, 1);
this.DexAidEnabler.Name = "DexAidEnabler";
this.DexAidEnabler.Size = new System.Drawing.Size(15, 15);
this.DexAidEnabler.TabIndex = 19;
this.DexAidEnabler.TabStop = false;
this.DexAidEnabler.Click += new System.EventHandler(this.DexAidEnabler_Click);
//
// CHOVY
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(843, 302);
this.Controls.Add(this.DexAidEnabler);
this.Controls.Add(this.label6);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
@ -292,6 +305,7 @@
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.DexAidEnabler)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -318,6 +332,7 @@
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox CompressPBP;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.PictureBox DexAidEnabler;
}
}

View File

@ -59,10 +59,11 @@ namespace PSVIMGTOOLS
MemoryStream ms = new MemoryStream();
/*
*- DEBUG Disable Encryption
// - DEBUG Disable Encryption
ms.Write(plainText, 0x00, size);
ms.Seek(0x00,SeekOrigin.Begin);
return ms.ToArray();*/
return ms.ToArray();
*/
Aes alg = Aes.Create();
alg.Mode = CipherMode.CBC;
@ -86,11 +87,12 @@ namespace PSVIMGTOOLS
}
MemoryStream ms = new MemoryStream();
/*
*- DEBUG Disable Encryption
/*
// - DEBUG Disable Encryption
ms.Write(plainText, 0x00, size);
ms.Seek(0x00,SeekOrigin.Begin);
return ms.ToArray();*/
return ms.ToArray();
*/
Aes alg = Aes.Create();
alg.Mode = CipherMode.ECB;