This commit is contained in:
SilicaAndPina 2020-04-05 19:10:39 +12:00
parent 073536db3d
commit 4852d3e074
6 changed files with 125 additions and 16 deletions

View File

@ -36,6 +36,8 @@
this.KeyGen = new System.Windows.Forms.Button();
this.LicenseGen = new System.Windows.Forms.Button();
this.Unity = new System.Windows.Forms.CheckBox();
this.ProjectName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
@ -46,7 +48,7 @@
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.pictureBox1.Location = new System.Drawing.Point(12, 12);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(408, 114);
this.pictureBox1.Size = new System.Drawing.Size(408, 131);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
@ -54,10 +56,11 @@
//
this.DevName.BackColor = System.Drawing.SystemColors.HotTrack;
this.DevName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.DevName.Location = new System.Drawing.Point(12, 156);
this.DevName.ForeColor = System.Drawing.SystemColors.Window;
this.DevName.Location = new System.Drawing.Point(92, 175);
this.DevName.MaxLength = 17;
this.DevName.Name = "DevName";
this.DevName.Size = new System.Drawing.Size(408, 20);
this.DevName.Size = new System.Drawing.Size(328, 20);
this.DevName.TabIndex = 1;
this.DevName.TextChanged += new System.EventHandler(this.DevName_TextChanged);
//
@ -66,18 +69,19 @@
this.TextColor.AutoSize = true;
this.TextColor.BackColor = System.Drawing.Color.Transparent;
this.TextColor.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.TextColor.Location = new System.Drawing.Point(12, 140);
this.TextColor.Location = new System.Drawing.Point(12, 175);
this.TextColor.Name = "TextColor";
this.TextColor.Size = new System.Drawing.Size(97, 13);
this.TextColor.Size = new System.Drawing.Size(75, 13);
this.TextColor.TabIndex = 2;
this.TextColor.Text = "Device Name / ID:";
this.TextColor.Text = "Device Name:";
//
// KeyGen
//
this.KeyGen.BackColor = System.Drawing.SystemColors.Highlight;
this.KeyGen.Enabled = false;
this.KeyGen.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.KeyGen.Location = new System.Drawing.Point(12, 182);
this.KeyGen.ForeColor = System.Drawing.SystemColors.Window;
this.KeyGen.Location = new System.Drawing.Point(12, 213);
this.KeyGen.Name = "KeyGen";
this.KeyGen.Size = new System.Drawing.Size(201, 26);
this.KeyGen.TabIndex = 3;
@ -89,7 +93,8 @@
//
this.LicenseGen.BackColor = System.Drawing.SystemColors.Highlight;
this.LicenseGen.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.LicenseGen.Location = new System.Drawing.Point(219, 182);
this.LicenseGen.ForeColor = System.Drawing.SystemColors.Window;
this.LicenseGen.Location = new System.Drawing.Point(219, 213);
this.LicenseGen.Name = "LicenseGen";
this.LicenseGen.Size = new System.Drawing.Size(201, 26);
this.LicenseGen.TabIndex = 4;
@ -102,12 +107,36 @@
this.Unity.AutoSize = true;
this.Unity.BackColor = System.Drawing.Color.Transparent;
this.Unity.ForeColor = System.Drawing.SystemColors.Control;
this.Unity.Location = new System.Drawing.Point(344, 140);
this.Unity.Location = new System.Drawing.Point(344, 151);
this.Unity.Name = "Unity";
this.Unity.Size = new System.Drawing.Size(76, 17);
this.Unity.TabIndex = 5;
this.Unity.Text = "PSM Unity";
this.Unity.UseVisualStyleBackColor = false;
this.Unity.CheckedChanged += new System.EventHandler(this.Unity_CheckedChanged);
//
// ProjectName
//
this.ProjectName.BackColor = System.Drawing.SystemColors.HotTrack;
this.ProjectName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ProjectName.ForeColor = System.Drawing.SystemColors.Window;
this.ProjectName.Location = new System.Drawing.Point(92, 149);
this.ProjectName.MaxLength = 30;
this.ProjectName.Name = "ProjectName";
this.ProjectName.Size = new System.Drawing.Size(246, 20);
this.ProjectName.TabIndex = 6;
this.ProjectName.Text = "*";
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label1.Location = new System.Drawing.Point(12, 151);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(74, 13);
this.label1.TabIndex = 7;
this.label1.Text = "Project Name:";
//
// PSMKeyGen
//
@ -115,7 +144,9 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = global::LocalPSM_.Properties.Resources.bg;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(432, 236);
this.ClientSize = new System.Drawing.Size(432, 262);
this.Controls.Add(this.label1);
this.Controls.Add(this.ProjectName);
this.Controls.Add(this.Unity);
this.Controls.Add(this.LicenseGen);
this.Controls.Add(this.KeyGen);
@ -145,6 +176,8 @@
private System.Windows.Forms.Button KeyGen;
private System.Windows.Forms.Button LicenseGen;
private System.Windows.Forms.CheckBox Unity;
private System.Windows.Forms.TextBox ProjectName;
private System.Windows.Forms.Label label1;
}
}

View File

@ -139,6 +139,7 @@ namespace LocalPSM_
KeyGen.Enabled = false;
DevName.Enabled = false;
ProjectName.Enabled = false;
Unity.Enabled = false;
LicenseGen.Enabled = false;
@ -159,6 +160,7 @@ namespace LocalPSM_
KeyGen.Enabled = true;
DevName.Enabled = true;
ProjectName.Enabled = true;
Unity.Enabled = true;
LicenseGen.Enabled = true;
DevName_TextChanged(null, null);
@ -215,7 +217,27 @@ namespace LocalPSM_
krng[i] = (byte)DevName.Text[i - 0x454];
}
File.WriteAllBytes("_PSM_DEFAULT_.krng", krng);
for (int i = 0x70; i != 0x90; i++)
{
if (ProjectName.Text.Length < i - 0x70)
krng[i] = (byte)ProjectName.Text[i - 0x70];
else
krng[i] = 0x00;
}
string keyRngName = ProjectName.Text;
if (keyRngName == "*")
keyRngName = "+asterisk+";
for (int i = 0x8; i != 0x28; i++)
{
if (keyRngName.Length < i - 0x8)
krng[i] = (byte)keyRngName[i - 0x8];
else
krng[i] = 0x00;
}
File.WriteAllBytes(keyRngName + ".krng", krng);
File.WriteAllBytes("kdev.p12", Properties.Resources.UnityDev_private);
@ -234,7 +256,7 @@ namespace LocalPSM_
File.WriteAllBytes(DevName.Text + ".seed", Seed);
moveToKeys(DevName.Text + ".seed");
moveToKeys("_PSM_DEFAULT_.krng");
moveToKeys(keyRngName + ".krng");
moveToKeys("kdev.p12");
}
else
@ -247,7 +269,27 @@ namespace LocalPSM_
krng[i] = (byte)DevName.Text[i - 0x454];
}
File.WriteAllBytes("+asterisk+.krng", krng);
for (int i = 0x70; i != 0x90; i++)
{
if (ProjectName.Text.Length > i - 0x70)
krng[i] = (byte)ProjectName.Text[i - 0x70];
else
krng[i] = 0x00;
}
string keyRngName = ProjectName.Text;
if (keyRngName == "*")
keyRngName = "+asterisk+";
for (int i = 0x8; i != 0x28; i++)
{
if (keyRngName.Length > i - 0x8)
krng[i] = (byte)keyRngName[i - 0x8];
else
krng[i] = 0x00;
}
File.WriteAllBytes(Path.ChangeExtension(keyRngName,"krng"), krng);
File.WriteAllBytes("kdev.p12", Properties.Resources.psmdev_private);
@ -266,7 +308,7 @@ namespace LocalPSM_
File.WriteAllBytes(DevName.Text + ".seed", Seed);
moveToKeys(DevName.Text + ".seed");
moveToKeys("+asterisk+.krng");
moveToKeys(keyRngName + ".krng");
moveToKeys("kdev.p12");
}
@ -278,9 +320,18 @@ namespace LocalPSM_
{
File.WriteAllBytes("Code", Properties.Resources.unity_Code);
File.WriteAllBytes("protected_kconsole_cache.dat", Properties.Resources.unity_protected_kconsole_cache);
File.WriteAllBytes("target_kdbg_list.dat", Properties.Resources.unity_target_kdbg_list);
File.WriteAllBytes("vseed.dat", Properties.Resources.unity_vseed);
byte[] Kdbg = Properties.Resources.unity_target_kdbg_list;
for (int i = 0x38; i != 0x58; i++)
{
if (ProjectName.Text.Length > i - 0x38)
Kdbg[i] = (byte)ProjectName.Text[i - 0x38];
else
Kdbg[i] = 0x00;
}
File.WriteAllBytes("target_kdbg_list.dat", Kdbg);
moveToCache("Code");
moveToCache("protected_kconsole_cache.dat");
moveToCache("target_kdbg_list.dat");
@ -291,9 +342,19 @@ namespace LocalPSM_
File.WriteAllBytes("activever.dat", Properties.Resources.psm_activever);
File.WriteAllBytes("Code", Properties.Resources.psm_Code);
File.WriteAllBytes("protected_kconsole_cache.dat", Properties.Resources.psm_protected_kconsole_cache);
File.WriteAllBytes("target_kdbg_list.dat", Properties.Resources.psm_target_kdbg_list);
File.WriteAllBytes("vseed.dat", Properties.Resources.psm_vseed);
byte[] Kdbg = Properties.Resources.psm_target_kdbg_list;
for (int i = 0x38; i != 0x58; i++)
{
if (ProjectName.Text.Length > i - 0x38)
Kdbg[i] = (byte)ProjectName.Text[i - 0x38];
else
Kdbg[i] = 0x00;
}
File.WriteAllBytes("target_kdbg_list.dat", Kdbg);
moveToCache("activever.dat");
moveToCache("Code");
moveToCache("protected_kconsole_cache.dat");
@ -307,6 +368,7 @@ namespace LocalPSM_
{
KeyGen.Enabled = false;
DevName.Enabled = false;
ProjectName.Enabled = false;
Unity.Enabled = false;
LicenseGen.Enabled = false;
@ -317,6 +379,7 @@ namespace LocalPSM_
KeyGen.Enabled = true;
DevName.Enabled = true;
ProjectName.Enabled = true;
Unity.Enabled = true;
LicenseGen.Enabled = true;
@ -336,5 +399,18 @@ namespace LocalPSM_
}
private void Unity_CheckedChanged(object sender, EventArgs e)
{
if(Unity.Checked)
{
if(ProjectName.Text == "*")
ProjectName.Text = "_PSM_DEFAULT_";
}
else
{
if (ProjectName.Text == "_PSM_DEFAULT_")
ProjectName.Text = "*";
}
}
}
}

Binary file not shown.

Binary file not shown.