Add files via upload

This commit is contained in:
Bluzume 2019-08-19 11:11:48 +12:00 committed by GitHub
parent a613b06508
commit d1e3af2073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 150 additions and 0 deletions

View File

@ -72,6 +72,7 @@
<DependentUpon>CHOVYCmaSelector.cs</DependentUpon>
</Compile>
<Compile Include="cmakeys.cs" />
<Compile Include="KIRK.cs" />
<Compile Include="param.cs" />
<Compile Include="pbp.cs" />
<Compile Include="Program.cs" />

View File

@ -46,6 +46,7 @@
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.CompressPBP = new System.Windows.Forms.CheckBox();
this.label6 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PsmChan)).BeginInit();
this.groupBox1.SuspendLayout();
@ -252,12 +253,23 @@
this.CompressPBP.Text = "Compress PBP";
this.CompressPBP.UseVisualStyleBackColor = true;
//
// label6
//
this.label6.AutoSize = true;
this.label6.ForeColor = System.Drawing.Color.Lime;
this.label6.Location = new System.Drawing.Point(735, 62);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(96, 13);
this.label6.TabIndex = 18;
this.label6.Text = "100% percent free!\r\n";
//
// 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.label6);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.FREEDOM);
@ -302,6 +314,7 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox CompressPBP;
private System.Windows.Forms.Label label6;
}
}

136
CHOVY/KIRK.cs Normal file
View File

@ -0,0 +1,136 @@
/*using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CHOVY
{
class KIRK
{
public MemoryStream kirk_buf = new MemoryStream(); // 1DC0 1DD4
public unsafe struct MAC_KEY
{
public int type;
public byte[] key;
public byte[] pad;
//public fixed byte key[0xF];
//public fixed byte pad[0xF];
public int pad_size;
}
public static int sceDrmBBMacInit(MAC_KEY mkey, int type)
{
mkey.type = type;
mkey.pad_size = 0;
mkey.key = new byte[0xF];
mkey.pad = new byte[0xF];
return 0;
}
int sceDrmBBMacUpdate(MAC_KEY mkey, Stream buf, int size)
{
int retv = 0;
int ksize;
int p;
int type;
kirk_buf.SetLength(0x0814);
if (mkey.pad_size + size <= 16)
{
buf.Write(mkey.pad, 0x00, mkey.pad_size);
buf.Seek(mkey.pad_size / -1, SeekOrigin.Current);
mkey.pad_size += size;
retv = 0;
}
else
{
//kbuf = kirk_buf + 0x14;
kirk_buf.Seek(0x14, SeekOrigin.Begin);
// copy pad data first
kirk_buf.Write(mkey.pad, 0x0, mkey.pad_size);
kirk_buf.Seek(mkey.pad_size / -1, SeekOrigin.Current);
p = mkey.pad_size;
mkey.pad_size += size;
mkey.pad_size &= 0x0f;
if (mkey.pad_size == 0)
mkey.pad_size = 16;
size -= mkey.pad_size;
// save last data to pad buf
buf.Seek(size, SeekOrigin.Begin);
buf.Write(mkey.pad, 0x00, mkey.pad_size);
type = (mkey.type == 2) ? 0x3A : 0x38;
while (size >= 0)
{
ksize = (size + p >= 0x0800) ? 0x0800 : size + p;
kirk_buf.Seek(p,SeekOrigin.Current);
for(int i = 0; i < (ksize - p); i++)
{
byte by = (byte)buf.ReadByte();
kirk_buf.WriteByte(by);
}
retv = sub_158(kirk_buf, ksize, mkey.key, type);
if (retv)
goto _exit;
size -= (ksize - p);
buf.Seek(ksize - p,SeekOrigin.Current);
p = 0;
}
}
_exit:
return retv;
}
static int sub_158(byte[] buf, int size, byte[] key, int key_type)
{
int i, retv;
for (i = 0; i < 16; i++)
{
buf[0x14 + i] ^= key[i];
}
retv = kirk4(buf, size, key_type);
if (retv)
return retv;
// copy last 16 bytes to keys
for (i = 0; i < 16; i++)
{
key[i] = buf[i + size + 4];
}
return 0;
}
[DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int kirk_init();
// [DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
// public unsafe static extern int sceDrmBBMacInit(MAC_KEY* mkey, int type);
[DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern int sceDrmBBMacUpdate(MAC_KEY* mkey, byte[] buf, int size);
[DllImport("KIRK.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern int bbmac_getkey(MAC_KEY* mkey, byte[] bbmac, byte[] vkey);
}
}
*/