Ejemplo n.º 1
0
        private void FindFromCMA_Click(object sender, EventArgs e)
        {
            this.Hide();
            string cmaDir    = "";
            string accountId = "0000000000000000";

            try
            {
                //try qcma
                cmaDir    = Registry.CurrentUser.OpenSubKey(@"Software\codestation\qcma").GetValue("appsPath").ToString();
                accountId = Registry.CurrentUser.OpenSubKey(@"Software\codestation\qcma").GetValue("lastAccountId").ToString();
            }
            catch (Exception)
            {
                try
                {
                    //try sony cma
                    cmaDir = Registry.CurrentUser.OpenSubKey(@"Software\Sony Corporation\Content Manager Assistant\Settings").GetValue("ApplicationHomePath").ToString();
                }
                catch (Exception)
                {
                    try
                    {
                        //try devkit cma
                        cmaDir = Registry.CurrentUser.OpenSubKey(@"Software\SCE\PSP2\Services\Content Manager Assistant for PlayStation(R)Vita DevKit\Settings").GetValue("ApplicationHomePath").ToString();
                    }
                    catch (Exception)
                    {
                        try
                        {
                            string DefaultDir = Path.Combine(Environment.GetEnvironmentVariable("HOMEDRIVE"), Environment.GetEnvironmentVariable("HOMEPATH"), "Documents", "PS Vita");
                            if (Directory.Exists(DefaultDir))
                            {
                                cmaDir = DefaultDir;
                            }
                        }
                        catch (Exception)
                        {
                            //Do nothing
                        }
                    }
                }
            }


            CHOVYCmaSelector ccs = new CHOVYCmaSelector(cmaDir, accountId);

            ccs.FormClosing += Ccs_FormClosing;
            ccs.ShowDialog();
        }
Ejemplo n.º 2
0
        private void Ccs_FormClosing(object sender, FormClosingEventArgs e)
        {
            CHOVYCmaSelector ccs    = (CHOVYCmaSelector)sender;
            string           CmaDir = ccs.GetCmaDir();
            string           CmaAid = ccs.GetCmaAid();
            string           Backup = ccs.GetSelectedBackup();

            WriteSetting("CmaDir", CmaDir);

            if (Backup == "")
            {
                return;
            }

            string BackupPath = Path.Combine(CmaDir, "PGAME", CmaAid, Backup, "game", "game.psvimg");

            if (!File.Exists(BackupPath))
            {
                MessageBox.Show("Could not find \n" + BackupPath + "\n Perhaps backup failed?", "License Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ccs.Hide();
                this.Show();
                this.Focus();
                return;
            }

            byte[] AID = BitConverter.GetBytes(Convert.ToInt64(CmaAid, 16));
            Array.Reverse(AID);
            byte[] Key = CmaKeys.GenerateKey(AID);

            PSVIMGStream GamePsvimg = new PSVIMGStream(File.OpenRead(BackupPath), Key);

            BackupPath = Path.Combine(CmaDir, "PGAME", CmaAid, Backup, "license", "license.psvimg");
            if (!File.Exists(BackupPath))
            {
                MessageBox.Show("Could not find \n" + BackupPath + "\n Perhaps backup failed?", "License Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ccs.Hide();
                this.Show();
                this.Focus();
                return;
            }

            PSVIMGStream LicensePsvimg = new PSVIMGStream(File.OpenRead(BackupPath), Key);

            PSVIMGFileStream EbootPbp = new PSVIMGFileStream(GamePsvimg, "/EBOOT.PBP");

            byte[] VersionKey = Pbp.GetVersionKey(EbootPbp);
            string VerKey     = BitConverter.ToString(VersionKey).Replace("-", "");

            WriteSetting("VersionKey", VerKey);

            string           ContentID  = Pbp.GetContentId(EbootPbp);
            PSVIMGFileStream LicenseRif = new PSVIMGFileStream(LicensePsvimg, "/" + ContentID + ".rif");

            byte[] LicenseRifBytes = new byte[LicenseRif.Length];
            LicenseRif.Read(LicenseRifBytes, 0x00, LicenseRifBytes.Length);

            LicenseRif.Close();
            LicensePsvimg.Close();
            EbootPbp.Close();
            GamePsvimg.Close();

            byte[] zRifBytes = ZlibStream.CompressBuffer(LicenseRifBytes);
            string Rif       = Convert.ToBase64String(zRifBytes);

            WriteSetting("RifPath", Rif);

            Versionkey.Text = VerKey;
            RifPath.Text    = Rif;

            ccs.Hide();
            this.Show();
            this.Focus();

            MessageBox.Show("KEYS HAVE BEEN EXTRACTED FROM CMA, YOU MAY NOW LIBERATE YOURSELF", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }