示例#1
0
 private void openMenuItem_Click(object sender, System.EventArgs e)
 {
     openFileDialog.Filter = "FFTPatcher files (*.fftpatch)|*.fftpatch";
     if (openFileDialog.ShowDialog(this) == DialogResult.OK)
     {
         TryAndHandle(delegate() { FFTPatch.LoadPatch(openFileDialog.FileName); }, true);
     }
 }
示例#2
0
        private void saveAsPspMenuItem_Click(object sender, EventArgs e)
        {
            string fn = SavePatch(false);

            if (!string.IsNullOrEmpty(fn))
            {
                // HACK
                if (FFTPatch.Context != Context.US_PSP)
                {
                    FFTPatch.ConvertPsxPatchToPsp(fn);
                    FFTPatch.LoadPatch(fn);
                }
            }
        }
示例#3
0
        private static bool HandleCommandLinePatch(string[] args)
        {
            System.Collections.Generic.KeyValuePair <string, string> patchFilepaths = PatcherLib.Utilities.Utilities.GetPatchFilepaths(args, ".fftpatch");

            if ((string.IsNullOrEmpty(patchFilepaths.Key)) || (string.IsNullOrEmpty(patchFilepaths.Value)))
            {
                return(false);
            }
            else
            {
                Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(patchFilepaths.Key);

                try
                {
                    FFTPatch fftPatch = new FFTPatch();
                    fftPatch.LoadPatch(patchFilepaths.Key);

                    if (fftPatch.Context == PatcherLib.Datatypes.Context.US_PSP)
                    {
                        if (!patchFilepaths.Value.ToLower().Trim().EndsWith(".psv"))
                        {
                            PspIso.PatchISOSimple(fftPatch, patchFilepaths.Value);
                        }
                    }
                    else
                    {
                        if (patchFilepaths.Value.ToLower().Trim().EndsWith(".psv"))
                        {
                            PsxIso.PatchPsxSavestateSimple(fftPatch, patchFilepaths.Value);
                        }
                        else
                        {
                            PsxIso.PatchPsxIsoSimple(fftPatch, patchFilepaths.Value);
                        }
                    }
                }
                catch (Exception ex)
                {
                    AttachConsole(ATTACH_PARENT_PROCESS);
                    Console.WriteLine("Error: " + ex.Message);
                }

                return(true);
            }
        }