Fix PS1 Parse Issue

Fixed a bug where sometimes PS1 games wouldnt be listed ..
This commit is contained in:
Bluzume 2019-11-08 02:33:16 +13:00 committed by GitHub
parent 60a2f5a7c1
commit c8a04679fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 91 additions and 11 deletions

View File

@ -42,8 +42,10 @@
this.progressBar = new System.Windows.Forms.ProgressBar();
this.progressStatus = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.dexToggle = new System.Windows.Forms.PictureBox();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dexToggle)).BeginInit();
this.SuspendLayout();
//
// driveLetterSrc
@ -224,7 +226,7 @@
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(202, 297);
this.progressBar.Location = new System.Drawing.Point(202, 302);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(441, 23);
this.progressBar.TabIndex = 7;
@ -243,18 +245,28 @@
//
this.pictureBox1.BackgroundImage = global::CHOVY_TRANSFER.Properties.Resources.chovytrans;
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBox1.Location = new System.Drawing.Point(9, 3);
this.pictureBox1.Location = new System.Drawing.Point(9, 8);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(144, 317);
this.pictureBox1.TabIndex = 9;
this.pictureBox1.TabStop = false;
//
// dexToggle
//
this.dexToggle.Location = new System.Drawing.Point(781, 0);
this.dexToggle.Name = "dexToggle";
this.dexToggle.Size = new System.Drawing.Size(16, 16);
this.dexToggle.TabIndex = 10;
this.dexToggle.TabStop = false;
this.dexToggle.Click += new System.EventHandler(this.dexToggle_Click);
//
// CHOVYTRANSFER
//
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(796, 332);
this.Controls.Add(this.dexToggle);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.progressStatus);
this.Controls.Add(this.progressBar);
@ -270,6 +282,7 @@
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dexToggle)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -289,6 +302,7 @@
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.Label progressStatus;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox dexToggle;
}
}

View File

@ -8,6 +8,7 @@ using System.Text;
using KeyDerivation;
using PSVIMGTOOLS;
using System.Drawing;
using System.Threading;
namespace CHOVY_TRANSFER
{
@ -16,6 +17,18 @@ namespace CHOVY_TRANSFER
[DllImport("CHOVY.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern int chovy_gen(string ebootpbp, UInt64 AID, string outscefile);
public bool IsDexAidSet()
{
string isDex = ReadSetting("dexAid");
if (isDex == "false" || isDex == "")
{
return false;
}
else
{
return true;
}
}
public string GetCmaDir()
{
string Dir = "";
@ -227,7 +240,8 @@ namespace CHOVY_TRANSFER
byte[] Header = new byte[0x8];
pbps.Read(Header, 0x00, 0x8);
pbps.Close();
if(Encoding.UTF8.GetString(Header) == "PSISOIMG")
string header = Encoding.UTF8.GetString(Header);
if (header == "PSISOIMG" /*Single Disc PSX*/ || header == "PSTITLEI" /*Multi Disc PSX*/)
{
return true;
}
@ -375,7 +389,17 @@ namespace CHOVY_TRANSFER
File.Delete(sigFile);
}
int ChovyGenRes = chovy_gen(ebootFile, uAid, sigFile);
int ChovyGenRes = 100;
Thread ChovyGen = new Thread(() =>
{
ChovyGenRes = chovy_gen(ebootFile, uAid, sigFile);
});
ChovyGen.Start();
while (ChovyGen.IsAlive)
{
Application.DoEvents();
}
if (!File.Exists(sigFile) || ChovyGenRes != 0)
{
@ -395,7 +419,16 @@ namespace CHOVY_TRANSFER
// Pacakge GAME
byte[] CmaKey = CmaKeys.GenerateKey(bAid);
byte[] CmaKey;
if(!IsDexAidSet())
{
CmaKey = CmaKeys.GenerateKey(bAid);
}
else
{
CmaKey = CmaKeys.GenerateKey(new byte[0x8] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
}
string[] entrys = Directory.GetFileSystemEntries(gameFolder, "*", SearchOption.AllDirectories);
long noEntrys = entrys.LongLength;
@ -413,15 +446,35 @@ namespace CHOVY_TRANSFER
string scesys;
if (!isPs1)
{
pgameFolder = Path.Combine(backupDir, "PGAME", sAid, titleId, "game");
pgameFolderl = Path.Combine(backupDir, "PGAME", sAid, titleId, "license");
scesys = Path.Combine(backupDir, "PGAME", sAid, titleId, "sce_sys");
if(!IsDexAidSet())
{
pgameFolder = Path.Combine(backupDir, "PGAME", sAid, titleId, "game");
pgameFolderl = Path.Combine(backupDir, "PGAME", sAid, titleId, "license");
scesys = Path.Combine(backupDir, "PGAME", sAid, titleId, "sce_sys");
}
else
{
pgameFolder = Path.Combine(backupDir, "PGAME", "0000000000000000", titleId, "game");
pgameFolderl = Path.Combine(backupDir, "PGAME", "0000000000000000", titleId, "license");
scesys = Path.Combine(backupDir, "PSGAME", "0000000000000000", titleId, "sce_sys");
}
}
else
{
pgameFolder = Path.Combine(backupDir, "PSGAME", sAid, titleId, "game");
pgameFolderl = Path.Combine(backupDir, "PSGAME", sAid, titleId, "license");
scesys = Path.Combine(backupDir, "PSGAME", sAid, titleId, "sce_sys");
if(!IsDexAidSet())
{
pgameFolder = Path.Combine(backupDir, "PSGAME", sAid, titleId, "game");
pgameFolderl = Path.Combine(backupDir, "PSGAME", sAid, titleId, "license");
scesys = Path.Combine(backupDir, "PSGAME", sAid, titleId, "sce_sys");
}
else
{
pgameFolder = Path.Combine(backupDir, "PSGAME", "0000000000000000", titleId, "game");
pgameFolderl = Path.Combine(backupDir, "PSGAME", "0000000000000000", titleId, "license");
scesys = Path.Combine(backupDir, "PSGAME", "0000000000000000", titleId, "sce_sys");
}
}
Directory.CreateDirectory(pgameFolder);
@ -515,5 +568,18 @@ namespace CHOVY_TRANSFER
pspGames.Enabled = true;
}
private void dexToggle_Click(object sender, EventArgs e)
{
if(IsDexAidSet())
{
WriteSetting("dexAid", "false");
MessageBox.Show("Cex AID Will be used for CMA.", "CexAid", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
WriteSetting("dexAid", "true");
MessageBox.Show("Dex AID (0000000000000000) Will be used for CMA.","DexAid",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
}
}