Esempio n. 1
0
        void xe_update()
        {
            Classes.xebuild xe = new Classes.xebuild();
            xe.Uloadvariables(variables.dashversion, (Classes.xebuild.hacktypes)variables.ttyp, patches, chkxesettings.Checked, chkNoWrite.Checked, chkNoAva.Checked, chkClean.Checked, chkNoReeb.Checked, checkDLPatches.Checked,
                              chkLaunch.Checked);

            try
            {
                string[] files = { "kv.bin", "smc.bin", "smc_config.bin", "fcrt.bin" };
                foreach (string file in files)
                {
                    if (File.Exists(Path.Combine(variables.pathforit, @"xebuild\data\" + file)))
                    {
                        if (MessageBox.Show(file + " found. Delete it?\n Unless you put it there, delete it!", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                        {
                            File.Delete(Path.Combine(variables.pathforit, @"xebuild\data\" + file));
                        }
                    }
                }
            }
            catch (Exception ex) { if (variables.debugme)
                                   {
                                       Console.WriteLine(ex.ToString());
                                   }
            }

            Classes.xebuild.XebuildError er = xe.createxebuild();
            if (er == Classes.xebuild.XebuildError.none)
            {
                xe.xeExit += xe_xeUExit;
                xe.update();
            }
            else if (er == Classes.xebuild.XebuildError.nodash)
            {
                MessageBox.Show("No Dash Selected");
                return;
            }
            else
            {
                MessageBox.Show("Something Bad Happened");
                return;
            }
        }
Esempio n. 2
0
        public void createxebuild_v2(bool custom, Nand.PrivateN nand)
        {
            Classes.xebuild xe = new Classes.xebuild();
            xe.loadvariables(nand._cpukey, (Classes.xebuild.hacktypes)variables.ttyp, variables.dashversion,
                             variables.ctyp, patches, nand, chkxesettings.Checked, checkDLPatches.Checked,
                             chkLaunch.Checked, checkAUDclamp.Checked, chkRJtag.Checked, chkCR4.Checked);

            string ini = (variables.launchpath + @"\" + variables.dashversion + @"\_" + variables.ttyp + ".ini");

            if (!custom)
            {
                if (String.IsNullOrWhiteSpace(variables.filename1))
                {
                    loadFil(ref variables.filename1, true);
                    if (String.IsNullOrWhiteSpace(variables.filename1))
                    {
                        MessageBox.Show("No File Selected");
                        return;
                    }
                }
                if (!File.Exists(variables.filename1))
                {
                    MessageBox.Show("File is missing. Ensure it wasn't moved and app can access it.");
                    return;
                }
                if (Path.GetExtension(variables.filename1) != ".bin")
                {
                    MessageBox.Show("You must select a .bin file", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    return;
                }
                try
                {
                    string[] files = { "kv.bin", "smc.bin", "smc_config.bin", "fcrt.bin" };
                    foreach (string file in files)
                    {
                        if (File.Exists(Path.Combine(variables.pathforit, @"xebuild\data\" + file)))
                        {
                            if (MessageBox.Show(file + " found. Delete it?\n Unless you put it there, delete it!", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                            {
                                File.Delete(Path.Combine(variables.pathforit, @"xebuild\data\" + file));
                            }
                        }
                    }
                }
                catch (Exception ex) { if (variables.debugme)
                                       {
                                           Console.WriteLine(ex.ToString());
                                       }
                }
                if (!nand.cpukeyverification(nand._cpukey))
                {
                    Console.WriteLine("Wrong cpukey");
                    return;
                }
            }
            else
            {
                string[] filesa = { "kv.bin", "smc.bin", "smc_config.bin" };
                foreach (string file in filesa)
                {
                    if (!File.Exists(Path.Combine(variables.pathforit, @"xebuild\data\" + file)))
                    {
                        MessageBox.Show(file + " is missing");
                        Process.Start(Path.Combine(variables.pathforit, @"xebuild\data"));
                        return;
                    }
                }
                Regex objAlphaPattern = new Regex("[a-fA-F0-9]{32}$");
                bool  sts             = objAlphaPattern.IsMatch(variables.cpkey);
                if ((variables.cpkey.Length == 32 && sts))
                {
                    if (variables.debugme)
                    {
                        Console.WriteLine("Key verification");
                    }
                    long size = 0;
                    if (Nand.Nand.cpukeyverification(Oper.openfile(Path.Combine(variables.pathforit, @"xebuild\data\kv.bin"), ref size, 0), variables.cpkey))
                    {
                        Console.WriteLine("CpuKey is Correct");
                        if (Nand.Nand.getfcrtflag(File.ReadAllBytes(Path.Combine(variables.pathforit, @"xebuild\data\kv.bin")), variables.cpkey))
                        {
                            if (!File.Exists(Path.Combine(variables.pathforit, @"xebuild\data\fcrt.bin")))
                            {
                                MessageBox.Show("fcrt.bin is missing");
                                Process.Start(Path.Combine(variables.pathforit, @"xebuild\data"));
                                return;
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("Wrong CpuKey");
                    }
                }

                Forms.xeBuildOptions ldv = new Forms.xeBuildOptions();
                string   cba = "", cbb = "";
                string[] files = parse_ini.parselabel(ini, variables.ctyp.Ini + "bl");
                if (files.Length >= 2)
                {
                    if (files[0].Contains("cb"))
                    {
                        cba = files[0].Substring(files[0].IndexOf("_") + 1, files[0].IndexOf(".bin") - 4);
                    }
                    if (files[1].Contains("cbb"))
                    {
                        cbb = files[1].Substring(files[1].IndexOf("cbb_") + 4, files[1].IndexOf(".bin") - 4);
                    }
                }
                ldv.enumeratecbs(cba, cbb);
                ldv.ShowDialog();
            }

Start:
            switch (xe.createxebuild(custom))
            {
            case Classes.xebuild.XebuildError.nocpukey:
                MessageBox.Show("cpukey is missing");
                return;

            case Classes.xebuild.XebuildError.nodash:
                MessageBox.Show("No Dash Selected");
                return;

            case Classes.xebuild.XebuildError.noinis:
                MessageBox.Show("Ini's are missing");
                return;

            case Classes.xebuild.XebuildError.nobootloaders:
                Console.WriteLine("The specified console bootloader list ({0}) is missing from the ini ({1})", variables.ctyp.Ini + "bl", ini);
                Console.WriteLine("You can either add it manually or ask for it get added if its possible");
                return;

            case Classes.xebuild.XebuildError.wrongcpukey:
                MessageBox.Show("Wrong cpukey");
                return;

            case Classes.xebuild.XebuildError.noconsole:
                variables.ctyp = callconsoletypes(ConsoleTypes.Selected.All);
                if (variables.ctyp.ID == -1)
                {
                    return;
                }
                else
                {
                    xe.loadvariables(nand._cpukey, (Classes.xebuild.hacktypes)variables.ttyp, variables.dashversion,
                                     variables.ctyp, patches, nand, chkxesettings.Checked, checkDLPatches.Checked,
                                     chkLaunch.Checked, checkAUDclamp.Checked, chkRJtag.Checked, chkCR4.Checked);
                    goto Start;
                }

            case Classes.xebuild.XebuildError.none:
                copyfiles(nand._cpukey);
                xe.xeExit += xe_xeExit;
                xe.build();
                break;

            default:
                break;
            }
        }