Esempio n. 1
0
        /// <summary>
        /// Patch param.sfo.
        /// </summary>
        private bool PatchSFO()
        {
            if (File.Exists(tempPath + @"\app0\sce_sys\param.sfo"))
            {
                ASCIIEncoding encode = new ASCIIEncoding();
                byte[]        contID = encode.GetBytes(textContentID.Text);
                byte[]        titID  = encode.GetBytes(titleID);
                byte[]        gName  = encode.GetBytes(textBoxGameName.Text);

                try {
                    using (BinaryWriter binWriter = new BinaryWriter(new FileStream(tempPath + @"\app0\sce_sys\param.sfo", FileMode.Open, FileAccess.ReadWrite))) {
                        binWriter.BaseStream.Seek(0x2F8, SeekOrigin.Begin); // Content ID.
                        binWriter.Write(contID, 0, contID.Length);

                        binWriter.BaseStream.Seek(0x5D0, SeekOrigin.Begin); // Game Name.
                        binWriter.Write(gName, 0, gName.Length);

                        binWriter.BaseStream.Seek(0x650, SeekOrigin.Begin); // Title ID.
                        binWriter.Write(titID, 0, titID.Length);
                        binWriter.Close();
                    } return(true);
                } catch (Exception exc) { MessagBox.Error(exc.ToString()); }
            }
            else
            {
                MessagBox.Error("Can't access '" + tempPath + @"\app0\sce_sys\param.sfo'" + " !");
            }
            return(false);
        }
Esempio n. 2
0
 /// <summary>
 /// Ask a custom question before doing stuff with the registry.
 /// </summary>
 /// <param name="caption">The title of the question window.</param>
 /// <param name="mes">The message to display.</param>
 /// <returns>True, when the user clicked OK, else false.</returns>
 private bool Question(string caption, string mes)
 {
     if (MessagBox.Question(caption, "\n" + mes + "\nAre you sure?") == DialogResult.OK)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
        /// <summary>
        /// Open a File Fialog to Choose the ISO.
        /// </summary>
        private void ChooseISO()
        {
            string iso = MessagBox.ShowOpenFile("Select PS2 ISO", "ISO Image (*.iso)|*.iso", lastIsoPath);

            if (iso != string.Empty)
            {
                ps2Iso = lastIsoPath = iso;
            }
        }
Esempio n. 4
0
 /// <summary>
 /// On Options Tool Strip Default Text and Code Viewer click.
 /// </summary>
 /// <param name="sender">The Sender.</param>
 /// <param name="e">The Event Arguments.</param>
 private void OptionsDefTxtCVieToolStrip_Click(object sender, EventArgs e)
 {
     if (MessagBox.Question(Buttons.YesNo, textViewer + Environment.NewLine + Environment.NewLine + "Do you want to use a other Application ?") == DialogResult.Yes)
     {
         string newEditor = MessagBox.ShowOpenFile("Choose Editor", "All Files (*.*)|*.*", textViewer);
         if (newEditor != string.Empty)
         {
             textViewer = newEditor;
         }
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Patch Title ID into nptitle.dat.
 /// </summary>
 private void PatchNpDat()
 {
     if (!File.Exists(tempPath + @"\app0\sce_sys\nptitle.dat"))
     {
         MessagBox.Error("Can not access '" + tempPath + @"\app0\sce_sys\nptitle.dat' !"); return;
     }
     using (BinaryWriter binWriter = new BinaryWriter(new FileStream(tempPath + @"\app0\sce_sys\nptitle.dat", FileMode.Open, FileAccess.ReadWrite))) {
         binWriter.BaseStream.Seek(0x10, SeekOrigin.Begin);
         byte[] _titleId = Encoding.ASCII.GetBytes(titleID);
         binWriter.Write(_titleId, 0, _titleId.Length);
         binWriter.Close();
     }
 }
        /// <summary>
        /// Fake Sign and spoof authentication informations.
        /// </summary>
        /// <param name="deci">The TitleIDs decimal value as a hex string.</param>
        private bool FakeSign(string deci)
        {
            int    index = toolStripComboBox.SelectedIndex;
            string _elfs = string.Empty;
            int    count = 0;
            bool   err   = false;

            ProcessStartInfo run  = new ProcessStartInfo();
            Process          call = new Process();

            call.ErrorDataReceived += Ps2_ErrorHandler;
            run.FileName            = make_fself;
            run.UseShellExecute     = false;
            run.CreateNoWindow      = run.RedirectStandardError = true;

            foreach (string elf in Apps[index])
            {
                string auth = Auths[index][count];
                auth = deci + auth.Substring(4, auth.Length - 4);

                _elfs = string.Empty;
                foreach (string found in elfs)
                {
                    if (found.Contain(elf))
                    {
                        _elfs = found;
                    }
                }
                if (_elfs == string.Empty)
                {
                    MessagBox.Error("Couldn't find: " + elf); return(false);
                }

                run.Arguments = "--paid " + auth.Substring(0, 16).EndianSwapp() + " --auth-info " + auth + " " + _elfs + " " + _elfs.Replace(".elf", "fself").Replace(".prx", "fself");
                MessagBox.Debug(run.Arguments);
                call.StartInfo = run;

                try { call.Start(); }
                catch (Exception io) { MessagBox.Error(io.ToString()); err = true; break; }

                call.BeginErrorReadLine();
                call.WaitForExit();
                count++;
            }

            if (err)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 7
0
        /// <summary>
        /// Pre Clean the template_pkg folder before reusing it.
        /// </summary>
        private void PreClean()
        {
            if (File.Exists(tempPath + @"\app0\image\disc01.iso"))
            {
                File.Delete(tempPath + @"\app0\image\disc01.iso");
            }
            if (File.Exists(tempPath + @"\app0\eboot.fself"))
            {
                File.Delete(tempPath + @"\app0\eboot.fself");
            }
            if (File.Exists(tempPath + @"\app0\ps2-emu-compiler.fself"))
            {
                File.Delete(tempPath + @"\app0\ps2-emu-compiler.fself");
            }
            if (File.Exists(tempPath + @"\app0\sce_module\libSceFios2.fself"))
            {
                File.Delete(tempPath + @"\app0\sce_module\libSceFios2.fself");
            }
            if (File.Exists(tempPath + @"\app0\sce_module\libc.fself"))
            {
                File.Delete(tempPath + @"\app0\sce_module\libc.fself");
            }

            string[] projects = Directory.GetFiles(tempPath, "*.gp4");
            if (projects.Length == 2)
            {
                if (projects[0].GetName().XReplace(@"(\w{2})(\d{4})-(\w{4})(\d{5})_(\d{2})-([a-zA-Z0-9]{16})", "").Replace(".gp4", "") == string.Empty)
                {
                    File.Delete(projects[0]);
                }
                else if (projects[1].GetName().XReplace(@"(\w{2})(\d{4})-(\w{4})(\d{5})_(\d{2})-([a-zA-Z0-9]{16})", "").Replace(".gp4", "") == string.Empty)
                {
                    File.Delete(projects[1]);
                }
            }
            else if (projects.Length > 2)
            {
                if (MessagBox.Question("Found more then two project files ! (.gp4)\nShall i delete all of them ? (excluding the template for sure)") == DialogResult.OK)
                {
                    foreach (string line in projects)
                    {
                        if (!line.Contain("template.gp4") && line.Contain(".gp4"))
                        {
                            File.Delete(line);
                        }
                    }
                }
            }
        }
Esempio n. 8
0
 /// <summary>
 /// On Button Open Click.
 /// </summary>
 /// <param name="sender">The Sender.</param>
 /// <param name="e">The Event Arguments.</param>
 private void ButtonOpen_Click(object sender, EventArgs e)
 {
     if (!_iso)
     {
         ChooseISO();
     }
     else
     {
         string outPath = MessagBox.ShowFolderBrowse("Choose Folder to save PKG", lastOutPath);
         if (outPath != string.Empty)
         {
             pkgOut = lastOutPath = outPath;
         }
     }
 }
Esempio n. 9
0
 /// <summary>
 /// On Tool Strip Change Passcode click.
 /// </summary>
 /// <param name="sender">The Sender.</param>
 /// <param name="e">The Event Arguments.</param>
 private void ChangePasscodeToolStrip_Click(object sender, EventArgs e)
 {
     MessagBox.Size     = new Size(270, 146);
     MessagBox.TextBack = Color.Black;
     MessagBox.TextFore = Color.Yellow;
     if (MessagBox.Input(newPass, "Enter new:", "Passcode", 66) == DialogResult.OK)
     {
         newPass = MessagBox.UsrInput;
         if (newPass.Length < 66)
         {
             newPass = "******";
             MessagBox.Error("The Entered new Passcode is to short.\nTry Again.");
         }
     }
     MessagBox.TextBack = Color.White;
     MessagBox.TextFore = Color.Black;
     MessagBox.Size     = new Size(0, 0);
 }
Esempio n. 10
0
        /// <summary>
        /// Build the PKG now.
        /// </summary>
        private void MakePKG(string gp4)
        {
            ProcessStartInfo run  = new ProcessStartInfo();
            Process          call = new Process();

            call.ErrorDataReceived += Ps2_ErrorHandler;
            run.FileName            = orbis_pub_cmd;
            run.UseShellExecute     = false;
            run.CreateNoWindow      = run.RedirectStandardError = true;
            run.Arguments           = "img_create " + gp4 + " " + gp4.Replace(".gp4", ".pkg");
            call.StartInfo          = run;

            try { call.Start(); }
            catch (Exception io) { MessagBox.Error(io.ToString()); }

            call.BeginErrorReadLine();
            call.WaitForExit();
        }
Esempio n. 11
0
 /// <summary>
 /// On Options Tool Strip Clear Settings click.
 /// </summary>
 /// <param name="sender">The Sender.</param>
 /// <param name="e">The Event Arguments.</param>
 private void optionsClearSettingsToolStrip_Click(object sender, EventArgs e)
 {
     if (MessagBox.Question(Buttons.YesNo, "Clear Settings ?") == DialogResult.Yes)
     {
         Settings sett = new Settings();
         sett.Reset();
         sett.Save();
         sett.Reload();
         lastIsoPath   = sett.LastIsoPath;
         lastOutPath   = sett.LastOutPath;
         make_fself    = sett.MakeFSELF;
         orbis_pub_cmd = sett.PubCmd;
         db            = sett.DB;
         textViewer    = sett.TxtViewer;
     }
     MessagBox.Info("Will close Application now.");
     Close();
 }
Esempio n. 12
0
        /// <summary>
        /// On Drag Drop.
        /// </summary>
        /// <param name="sender">The Sender.</param>
        /// <param name="e">The Event Arguments.</param>
        private void Fakeps2pkggen_DragDrop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);

            if (files.Length > 1)
            {
                MessagBox.Error("No Multi File support here.");
            }
            else
            {
                if (files[0].Contains(".iso", ignore))
                {
                    ps2Iso = lastIsoPath = files[0];
                    if (_iso)
                    {
                        textIsoAndOutPath.Text = files[0];
                    }
                }
                else if (files[0].Contains("make_fself.exe", ignore))
                {
                    make_fself = files[0];
                }
                else if (files[0].Contains("orbis-pub-cmd-ps2.exe", ignore))
                {
                    orbis_pub_cmd = files[0];
                }
                else if (files[0].Contains("authinfo_emu.txt", ignore))
                {
                    db = files[0];
                }
                else if (files[0].IsFolder())
                {
                    pkgOut = lastOutPath = files[0];
                    if (!_iso)
                    {
                        textIsoAndOutPath.Text = files[0];
                    }
                }
                else
                {
                    MessagBox.Error("I have no clue what you want from me mate.");
                }
            }
        }
Esempio n. 13
0
        /// <summary>
        /// On Button Edit Script click.
        /// </summary>
        /// <param name="sender">The Sender.</param>
        /// <param name="e">The Event Arguments.</param>
        private void ButtonEditScript_Click(object sender, EventArgs e)
        {
            if (Fakeps2pkggen.textViewer == string.Empty)
            {
                MessagBox.Error("No default text viewer set.\nPlease tell me which app you want to use to edit your script file.\nOptions > Paths > Default Text/Code Viewer");
                return;
            }

            if (Directory.Exists(Directory.GetCurrentDirectory() + @"\template\app0\patches\"))
            {
                string[] files = Directory.GetFiles(Directory.GetCurrentDirectory() + @"\template\app0\patches\", "*_config.lua");
                if (files.Length == 1)
                {
                    scriptFile = files[0];
                    if (File.Exists(scriptFile))
                    {
                        Process          editor = new Process();
                        ProcessStartInfo run    = new ProcessStartInfo();
                        run.FileName     = Fakeps2pkggen.textViewer;
                        run.Arguments    = scriptFile;
                        editor.StartInfo = run;
                        editor.Start();
                        editor.WaitForExit();
                    }
                    else
                    {
                        MessagBox.Error("Cant access the script file !\nWill return.");
                    }
                }
                else
                {
                    MessagBox.Error("I found more then one TitleID script file within the patches folder !\nDon't know which to use.");
                }
            }
            else
            {
                MessagBox.Error("Someting went wrong !\nCan't access " + Directory.GetCurrentDirectory() + @"\template\app0\patches\" + " \nMake sure the path exists.");
            }
        }
Esempio n. 14
0
 /// <summary>
 /// Display a custom error message.
 /// </summary>
 /// <param name="mes">The message to display.</param>
 internal static void Error(string mes)
 {
     MessagBox.Error("Error", mes);
 }
Esempio n. 15
0
        /// <summary>
        /// On Tool Strip Build click.
        /// </summary>
        /// <param name="sender">The Sender.</param>
        /// <param name="e">The Event Arguments.</param>
        private void ToolStripBuild_Click(object sender, EventArgs e)
        {
            if (toolStripComboBox.SelectedIndex > -1)
            {
                if (textContentID.Text != string.Empty)
                {
                    if (textBoxGameName.Text != string.Empty)
                    {
                        if (HaseContentIDFormat(textContentID.Text))
                        {
                            if (ps2Iso != string.Empty)
                            {
                                if (pkgOut != string.Empty)
                                {
                                    if (BaseIsFine())
                                    {
                                        // Copy ISO and check if destination dir is empty.
                                        idl.Text = "Cleaning old files up";
                                        PreClean();
                                        idl.Text = "Coping ISO";
                                        File.Copy(ps2Iso, tempPath + @"\app0\image\disc01.iso");

                                        // Get decimal of ItelID and convert to byte string, then overload to hte fake signing routine.
                                        idl.Text = "Fake Signing ELFs";
                                        titleID  = textBoxPs2TID.Text;
                                        if (!FakeSign(GetDecimalBytes(titleID.Substring(4, 5))))
                                        {
                                            idl.Text = "Error Fake Signing ELFs"; return;
                                        }

                                        // Copy and check the gp4 file and change all needed stuff.
                                        string gp4 = PatchGp4();
                                        if (gp4 == string.Empty)
                                        {
                                            MessagBox.Error("Error to many _cli.conf/_config.lua files with a title ID found.\nI don't know which one to use.\nPlease clean 'app0/patches/'.");
                                            idl.Text = "Error to many _cli.conf/_config.lua files.";
                                            return;
                                        }

                                        // Do the same with the config file.
                                        PatchConfig();

                                        // And do not forget the sfo.
                                        if (!PatchSFO())
                                        {
                                            return;
                                        }

                                        // Call orbis pub cmd.
                                        idl.Text = "Generating PKG";
                                        MakePKG(gp4);
                                        if (!error)
                                        {
                                            MessagBox.Show("Done !");
                                        }
                                    }
                                    else
                                    {
                                        MessagBox.Error("Base is not Ok !\nEither Tools:\n'make_fself.exe, orbis-pub-cmd-ps2.exe, authinfo.txt, template dir'\nOr Emu files:\n'eboot.elf, ps2-emu-compiler.elf, libSceFios2.prx, libc.prx, config-emu-ps4.txt'\ncan't be found.");
                                    }
                                }
                                else
                                {
                                    MessagBox.Error("No Output Folder set !");
                                }
                            }
                            else
                            {
                                MessagBox.Error("No PS2 ISO selected !");
                            }
                        }
                        else
                        {
                            MessagBox.Error("Content ID is not in Form of: XXYYYY-XXXXYYYYY_YY-XXXXXXXXXXXXXXXX");
                        }
                    }
                    else
                    {
                        MessagBox.Error("Game Name is empty !");
                    }
                }
                else
                {
                    MessagBox.Error("Content ID is empty !");
                }
            }
            else
            {
                MessagBox.Error("No FW Selected !");
            }
        }
Esempio n. 16
0
        /// <summary>
        /// On Button Save click.
        /// </summary>
        /// <param name="sender">The Sender.</param>
        /// <param name="e">The Event Arguments.</param>
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            if (comboEeIgnore.SelectedIndex == -1)
            {
                MessagBox.Error("No 'Ignore Segfault' mode choosen !"); return;
            }
            List <string> newConf = new List <string>();

            if (rtbEeHook.Lines.Length > 0)
            {
                foreach (string line in rtbEeHook.Lines)
                {
                    newConf.Add("--ee-hook=" + line);
                }
            }
            newConf.Add("--gs-vert-precision=" + textBoxGsVert.Text);
            newConf.Add("--idec-cycles-per-qwc==" + textBoxIdec.Text);
            if (checkGsOpt.Checked)
            {
                newConf.Add("--gs-optimize-30fps=1");
            }
            else
            {
                newConf.Add("--gs-optimize-30fps=0");
            }
            if (checkFpu.Checked)
            {
                newConf.Add("--fpu-no-clamping=1");
            }
            else
            {
                newConf.Add("--fpu-no-clamping=0");
            }
            if (checkCop2.Checked)
            {
                newConf.Add("--cop2-no-clamping=1");
            }
            else
            {
                newConf.Add("--cop2-no-clamping=0");
            }
            if (checkVu1Di.Checked)
            {
                newConf.Add("--vu1-di-bits=1");
            }
            else
            {
                newConf.Add("--vu1-di-bits=0");
            }
            if (checkGsOverride.Checked)
            {
                newConf.Add("--gs-override-small-tri-area=1");
            }
            else
            {
                newConf.Add("--gs-override-small-tri-area=0");
            }
            if (checkAssertPath.Checked)
            {
                newConf.Add("--assert-path1-ad=1");
            }
            else
            {
                newConf.Add("--assert-path1-ad=0");
            }
            newConf.Add(comboEeIgnore.SelectedText);

            try {
                File.Delete(configFile);
                File.Create(configFile).Close();
                File.WriteAllLines(configFile, newConf.ToArray());
            } catch (IOException io) { MessagBox.Error("IO Exception !\n\n" + io); }
            finally { saved = true; }
        }
Esempio n. 17
0
        /// <summary>
        /// On Load of Form.
        /// </summary>
        /// <param name="sender">The Sender.</param>
        /// <param name="e">The Event Arguments.</param>
        private void EmulatorOptions_Load(object sender, EventArgs e)
        {
            init = false;
            if (Directory.Exists(Directory.GetCurrentDirectory() + @"\template\app0\patches\"))
            {
                string[] files = Directory.GetFiles(Directory.GetCurrentDirectory() + @"\template\app0\patches\", "*_cli.conf");
                if (files.Length == 1)
                {
                    configFile = files[0];
                    if (File.Exists(configFile))
                    {
                        eehook = new List <string>();
                        comboEeIgnore.Items.Add("Read");
                        comboEeIgnore.Items.Add("Write");
                        gsopt  = fpu = cop2 = vu1 = gsoverr = assert = saved = userChange = false;
                        gsvert = idec = eeignore = string.Empty;

                        string[] config = File.ReadAllLines(configFile);
                        foreach (string line in config)
                        {
                            if (line.Contain("--ee-hook="))
                            {
                                rtbEeHook.Text += line.Replace("--ee-hook=", "") + Environment.NewLine;
                            }
                            else if (line.Contain("--gs-vert-precision="))
                            {
                                textBoxGsVert.Text = line.Replace("--gs-vert-precision=", "");
                            }
                            else if (line.Contain("--idec-cycles-per-qwc="))
                            {
                                textBoxIdec.Text = line.Replace("--idec-cycles-per-qwc=", "");
                            }
                            else if (line.Contain("--gs-optimize-30fps="))
                            {
                                if (line.Replace("--gs-optimize-30fps=", "").Equals("1"))
                                {
                                    checkGsOpt.Checked = true;
                                }
                                else
                                {
                                    checkGsOpt.Checked = false;
                                }
                            }
                            else if (line.Contain("--fpu-no-clamping="))
                            {
                                if (line.Replace("--fpu-no-clamping=", "").Equals("1"))
                                {
                                    checkFpu.Checked = true;
                                }
                                else
                                {
                                    checkFpu.Checked = false;
                                }
                            }
                            else if (line.Contain("--cop2-no-clamping="))
                            {
                                if (line.Replace("--cop2-no-clamping=", "").Equals("1"))
                                {
                                    checkCop2.Checked = true;
                                }
                                else
                                {
                                    checkCop2.Checked = false;
                                }
                            }
                            else if (line.Contain("--vu1-di-bits="))
                            {
                                if (line.Replace("--vu1-di-bits=", "").Equals("1"))
                                {
                                    checkVu1Di.Checked = true;
                                }
                                else
                                {
                                    checkVu1Di.Checked = false;
                                }
                            }
                            else if (line.Contain("--gs-override-small-tri-area="))
                            {
                                if (line.Replace("--gs-override-small-tri-area=", "").Equals("1"))
                                {
                                    checkGsOverride.Checked = true;
                                }
                                else
                                {
                                    checkGsOverride.Checked = false;
                                }
                            }
                            else if (line.Contain("--assert-path1-ad="))
                            {
                                if (line.Replace("--assert-path1-ad=", "").Equals("1"))
                                {
                                    checkAssertPath.Checked = true;
                                }
                                else
                                {
                                    checkAssertPath.Checked = false;
                                }
                            }
                            else if (line.Contain("--ee-ignore-segfault="))
                            {
                                if (line.Replace("--ee-ignore-segfault=", "").Equals("Read"))
                                {
                                    comboEeIgnore.SelectedText = "Read";
                                }
                                else
                                {
                                    comboEeIgnore.SelectedText = "Write";
                                }
                            }
                        }
                        eehook.AddRange(rtbEeHook.Lines);
                        eeignore = comboEeIgnore.SelectedText;
                        gsvert   = textBoxGsVert.Text;
                        idec     = textBoxIdec.Text;
                        gsopt    = checkGsOpt.Checked;
                        fpu      = checkFpu.Checked;
                        cop2     = checkCop2.Checked;
                        vu1      = checkVu1Di.Checked;
                        gsoverr  = checkGsOverride.Checked;
                        assert   = checkAssertPath.Checked;
                    }
                    else
                    {
                        MessagBox.Error("Cant access the config file !\nWill return.");
                        DialogResult = DialogResult.Abort;
                    }
                }
                else
                {
                    MessagBox.Error("I found more then one TitleID config file within the patches folder !\nDon't know which to use.");
                    DialogResult = DialogResult.Abort;
                }
            }
            else
            {
                MessagBox.Error("Can't access " + Directory.GetCurrentDirectory() + @"\template\app0\patches\" + " \nMake sure the path exists.");
                DialogResult = DialogResult.Abort;
            }
            init = true;
        }
Esempio n. 18
0
        /// <summary>
        /// On Form Closing.
        /// </summary>
        /// <param name="sender">The Sender.</param>
        /// <param name="e">The Event Arguments.</param>
        private void EmulatorOptions_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (userChange && !saved)
            {
                if (eehook.Count != rtbEeHook.Lines.Length)
                {
                    goto changed;
                }

                int maxlen = 0;
                if (eehook.Count > rtbEeHook.Lines.Length)
                {
                    maxlen = rtbEeHook.Lines.Length;
                }
                else
                {
                    maxlen = eehook.Count;
                }

                string[] backup = eehook.ToArray();
                string[] actual = rtbEeHook.Lines;
                for (int i = 0; i < maxlen; i++)
                {
                    if (!backup[i].Equals(actual[i]))
                    {
                        goto changed;
                    }
                }

                if (comboEeIgnore.SelectedText != eeignore)
                {
                    goto changed;
                }
                else if (textBoxGsVert.Text != gsvert)
                {
                    goto changed;
                }
                else if (textBoxIdec.Text != idec)
                {
                    goto changed;
                }
                else if (checkGsOpt.Checked != gsopt)
                {
                    goto changed;
                }
                else if (checkFpu.Checked != fpu)
                {
                    goto changed;
                }
                else if (checkCop2.Checked != cop2)
                {
                    goto changed;
                }
                else if (checkVu1Di.Checked != vu1)
                {
                    goto changed;
                }
                else if (checkGsOverride.Checked != gsoverr)
                {
                    goto changed;
                }
                else if (checkAssertPath.Checked != assert)
                {
                    goto changed;
                }
                else
                {
                    return;
                }

changed:
                if (MessagBox.Question(Buttons.YesNo, "You changed some options but didn't save.\nAre you sure to Close the App now ?") == DialogResult.No)
                {
                    e.Cancel = true;
                }
            }
        }
Esempio n. 19
0
 /// <summary>
 /// On Tool Strip Authentication Information click.
 /// </summary>
 /// <param name="sender">The Sender.</param>
 /// <param name="e">The Event Arguments.</param>
 private void AuthinfotxtToolStrip_Click(object sender, EventArgs e)
 {
     MessagBox.Info(db);
 }
Esempio n. 20
0
 /// <summary>
 /// On Tool Strip orbis-pub-cmd-exe click.
 /// </summary>
 /// <param name="sender">The Sender.</param>
 /// <param name="e">The Event Arguments.</param>
 private void OrbispubcmdexeToolStrip_Click(object sender, EventArgs e)
 {
     MessagBox.Info(orbis_pub_cmd);
 }
Esempio n. 21
0
 /// <summary>
 /// On Tool Strip make_fself.exe click.
 /// </summary>
 /// <param name="sender">The Sender.</param>
 /// <param name="e">The Event Arguments.</param>
 private void MakefselfToolStrip_Click(object sender, EventArgs e)
 {
     MessagBox.Info(make_fself);
 }
Esempio n. 22
0
 /// <summary>
 /// Error Event Handler for the make_fself.exe and orbis-pub-cmd-ps2.exe Process.
 /// </summary>
 /// <param name="sendingProcess">The Process which triggered this Event.</param>
 /// <param name="outLine">The Received Data Event Arguments.</param>
 private static void Ps2_ErrorHandler(object sendingProcess, DataReceivedEventArgs outLine)
 {
     MessagBox.Error(outLine.Data); error = true;
 }
Esempio n. 23
0
        /// <summary>
        /// On Load of Form do.
        /// </summary>
        /// <param name="sender">The Sender.</param>
        /// <param name="e">The Event Arguments.</param>
        private void Fakeps2pkggen_Load(object sender, EventArgs e)
        {
            // Get settings.
            Settings sett = new Settings();

            lastIsoPath              = sett.LastIsoPath;
            lastOutPath              = sett.LastOutPath;
            make_fself               = sett.MakeFSELF;
            orbis_pub_cmd            = sett.PubCmd;
            db                       = sett.DB;
            textViewer               = sett.TxtViewer;
            MessagBox.ButtonPosition = ButtonPosition.Center;
            _iso                     = true;

            // Just in case.
            string currDir = Directory.GetCurrentDirectory();

            if (make_fself == string.Empty)
            {
                make_fself = currDir + @"\make_fself.exe";
            }
            if (orbis_pub_cmd == string.Empty)
            {
                orbis_pub_cmd = currDir + @"\orbis-pub-cmd-ps2.exe";
            }
            if (db == string.Empty)
            {
                db = currDir + @"\template\authinfo_emu.txt";
            }
            if (!File.Exists(make_fself))
            {
                MessagBox.Error("Can not find make_fself.exe.\nEither drop the file into me, so i know where it is or\npleace it into my directory so i can acces it.");
            }
            if (!File.Exists(orbis_pub_cmd))
            {
                MessagBox.Error("Can not find orbis-pub-cmd-ps2.exe.\nEither drop the file into me, so i know where it is or\npleace it into my directory so i can acces it.");
            }
            if (!Directory.Exists(currDir + @"\template"))
            {
                MessagBox.Error("Can not find the Template folder !\nPlease place the Template folder within same dir.");
            }
            else
            {
                tempPath = currDir + @"\template";
            }

            // Get default text viewer if the setttings value is empty.
            if (textViewer == string.Empty)
            {
                textViewer = SwissKnife.GetDefaultApp(@"textfile\");
                if (textViewer == string.Empty)
                {
                    MessagBox.Info("Can't get the default TXT Viewer for editing the script.\nPlease tell me which app to use.\nOptions > Paths > Default Text/Code Viewer");
                }
            }

            // Set elfs path.
            elfs = new string[2] {
                tempPath + @"\app0\eboot.elf",
                tempPath + @"\app0\ps2-emu-compiler.elf",
            };

            // Load Authentication DataBase.
            if (!File.Exists(db))
            {
                MessagBox.Error("Can not find authinfo.txt.\nEither drop the file into me, so i know where it is or\npleace it into my directory so i can acces it.");
            }
            else
            {
                Fws = new List <string>();
                List <string[]> _Apps = new List <string[]>();
                List <string[]> _Auths = new List <string[]>();
                List <string>   _apps = new List <string>();
                List <string>   _auths = new List <string>();
                bool            app, auth, fw;
                app = auth = fw = false;
                foreach (string line in File.ReadAllLines(db))
                {
                    if (!string.IsNullOrEmpty(line))
                    {
                        if (line.Contains("[FW=", ignore))
                        {
                            if (Fws.Count > 0 && app)
                            {
                                MessagBox.Error("DataBase Inconsistent !"); break;
                            }

                            string[] tag = line.Split(']');
                            Fws.Add(tag[0].XReplace(@"[[]FW=?", string.Empty, RegexOptions.IgnoreCase));
                            fw = true;
                            if (Fws.Count > 1)
                            {
                                _Apps.Add(_apps.ToArray());
                                _Auths.Add(_auths.ToArray());
                                _apps  = new List <string>();
                                _auths = new List <string>();
                            }
                        }
                        else if (line.Contains("[Name=", ignore))
                        {
                            if (!fw)
                            {
                                if (!auth)
                                {
                                    MessagBox.Error("DataBase Inconsistent !"); break;
                                }
                            }

                            string[] tag = line.Split(']');
                            _apps.Add(tag[0].XReplace(@"[[]Name=?\s?", string.Empty, RegexOptions.IgnoreCase));
                            auth = fw = false;
                            app  = true;
                        }
                        else if (line.Contains("[Auth=", ignore))
                        {
                            if (!app)
                            {
                                if (fw)
                                {
                                    MessagBox.Error("DataBase Inconsistent !"); break;
                                }
                            }

                            string[] tag = line.Split(']');
                            _auths.Add(tag[0].XReplace(@"[[]Auth=?", string.Empty, RegexOptions.IgnoreCase));
                            app  = false;
                            auth = true;
                        }
                    }
                }

                _Apps.Add(_apps.ToArray());
                _Auths.Add(_auths.ToArray());

                if (Fws.Count != _Apps.Count || Fws.Count != _Auths.Count)
                {
                    MessagBox.Error("DataBase Inconsistent !");
                    Fws.Clear();
                }
                else
                {
                    if (Fws.Count > 0)
                    {
                        // If any fws where found add them to the combo Box.
                        toolStripComboBox.Items.AddRange(Fws.ToArray());
                        Apps  = _Apps.ToArray();
                        Auths = _Auths.ToArray();
                    }
                }
            }

            // Set basic passcode.
            newPass  = "******";
            idl.Text = "Ready For Action !";
        }