コード例 #1
0
ファイル: CHOVY.cs プロジェクト: luizbionicle/chovy-sign
        private void FindFromCMA_Click(object sender, EventArgs e)
        {
            /* Ccs_FormClosing(null, null);
             * return;*/

            this.Hide();
            string cmaDir    = "";
            string accountId = "0000000000000000";

            try
            {
                cmaDir = ReadSetting("CmaDir");
            }
            catch (Exception)
            {
                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();
        }
コード例 #2
0
ファイル: CHOVY.cs プロジェクト: luizbionicle/chovy-sign
        private void Ccs_FormClosing(object sender, FormClosingEventArgs e)
        {
            CHOVYCmaSelector ccs    = (CHOVYCmaSelector)sender;
            string           CmaDir = ccs.GetCmaDir();
            string           CmaAid = ccs.GetCmaAid();
            string           Backup = ccs.GetSelectedBackup();

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

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

            string output = Path.Combine(Application.StartupPath, "_tmp");

            Directory.CreateDirectory(output);

            string OutputPbp     = Path.Combine(output, "ux0_pspemu_temp_game_PSP_GAME_" + Backup, "EBOOT.PBP");
            string GameFolder    = Path.Combine(output, "ux0_pspemu_temp_game_PSP_GAME_" + Backup);
            string LicenseFolder = Path.Combine(output, "ux0_pspemu_temp_game_PSP_LICENSE");

            Status.Text = "Declaring Independance from the GAME.PSVIMG";
            string BackupPath = Path.Combine(CmaDir, "PGAME", CmaAid, Backup, "game", "game.psvimg");

            if (!File.Exists(BackupPath))
            {
                return;
            }
            TotalProgress.Style = ProgressBarStyle.Marquee;
            Process psvimg = psvimgtools.PSVIMG_EXTRACT(CmaAid, BackupPath, output);

            while (!psvimg.HasExited)
            {
                Application.DoEvents();
            }
            if (!Directory.Exists(GameFolder) || psvimg.ExitCode != 0)
            {
                MessageBox.Show("PSVIMG-EXTRACT.EXE FAILED!\nArguments:\n" + psvimg.StartInfo.Arguments + "\nStdOut:\n" + psvimg.StandardOutput.ReadToEnd() + "\nStdErr:\n" + psvimg.StandardError.ReadToEnd());
                return;
            }

            Status.Text = "Declaring Independance from the LICENSE.PSVIMG";
            BackupPath  = Path.Combine(CmaDir, "PGAME", CmaAid, Backup, "license", "license.psvimg");
            psvimg      = psvimgtools.PSVIMG_EXTRACT(CmaAid, BackupPath, output);
            while (!psvimg.HasExited)
            {
                Application.DoEvents();
            }
            if (!Directory.Exists(LicenseFolder) || psvimg.ExitCode != 0)
            {
                MessageBox.Show("PSVIMG-EXTRACT.EXE FAILED!\nArguments:\n" + psvimg.StartInfo.Arguments + "\nStdOut:\n" + psvimg.StandardOutput.ReadToEnd() + "\nStdErr:\n" + psvimg.StandardError.ReadToEnd());
                return;
            }

            /* -- This was some debug stuff
             * OpenFileDialog Openpbp = new OpenFileDialog();
             * Openpbp.ShowDialog();
             * string OutputPbp = Openpbp.FileName;
             *
             * OpenFileDialog OpenRif = new OpenFileDialog();
             * OpenRif.ShowDialog();
             * string Rif = OpenRif.FileName;
             */

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

            WriteSetting("VersionKey", VerKey);

            string ContentID   = pbp.GetContentId(OutputPbp);
            string Rif         = Path.Combine(Application.StartupPath, "GAME.RIF");
            string LicensePath = Path.Combine(output, "ux0_pspemu_temp_game_PSP_LICENSE", ContentID + ".rif");

            if (!File.Exists(LicensePath))
            {
                MessageBox.Show("Cannot find RIF", "RIF ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            File.Copy(LicensePath, Rif, true);
            WriteSetting("RifPath", Rif);
            WriteSetting("CmaDir", CmaDir);

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

            if (Directory.Exists(output))
            {
                try
                {
                    Directory.Delete(output, true);
                }
                catch (Exception) { }
            }

            Status.Text         = "Progress %";
            TotalProgress.Style = ProgressBarStyle.Continuous;
        }
コード例 #3
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);

            string Rif = Path.Combine(Application.StartupPath, "GAME.RIF");

            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");

            LicenseRif.WriteToFile(Rif);

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

            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);
        }