Example #1
0
        private void button13_Click(object sender, EventArgs e)
        {
            //Open File Items
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            openFileDialog1.Title = "Select PS4 File";

            openFileDialog1.CheckFileExists = true;

            openFileDialog1.CheckPathExists = true;

            openFileDialog1.Filter = "PS4 File (*.*)|*.*";

            openFileDialog1.RestoreDirectory = true;

            openFileDialog1.Multiselect = false;

            openFileDialog1.ReadOnlyChecked = true;

            openFileDialog1.ShowReadOnly = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                var ps4filetype = PS4_Tools.Tools.Get_PS4_File_Type(openFileDialog1.FileName);
                MessageBox.Show("File is a " + ps4filetype.ToString());
                switch (ps4filetype)
                {
                case PS4_Tools.Tools.File_Type.PARAM_SFO:
                    var sfo = new Param_SFO.PARAM_SFO(openFileDialog1.FileName);
                    break;

                case PS4_Tools.Tools.File_Type.PS4_DDS:
                    var dd = PS4_Tools.Image.DDS.GetBytesFromDDS(openFileDialog1.FileName);
                    break;

                case PS4_Tools.Tools.File_Type.PS4_PKG:
                    var pkg = PS4_Tools.PKG.SceneRelated.Read_PKG(openFileDialog1.FileName);
                    break;

                case PS4_Tools.Tools.File_Type.UpdateFile:
                    var update   = new PS4_Tools.PUP();
                    var tempfile = update.Read_Pup(openFileDialog1.FileName);
                    break;

                case PS4_Tools.Tools.File_Type.ATRAC9:
                    var bytes = PS4_Tools.Media.Atrac9.LoadAt9(openFileDialog1.FileName);
                    System.Media.SoundPlayer player = new System.Media.SoundPlayer(new MemoryStream(bytes));
                    player.Play();
                    break;
                }
            }
        }
Example #2
0
 public string GetSubTitle(Param_SFO.PARAM_SFO psfo)
 {
     for (int i = 0; i < psfo.Tables.Count; i++)
     {
         if (psfo.Tables[i].Name == "SUBTITLE")
         {
             //get the value
             return(psfo.Tables[i].Value);
         }
     }
     return("");
 }
Example #3
0
 public string Get_ACCOUNT_ID(Param_SFO.PARAM_SFO psfo)
 {
     for (int i = 0; i < psfo.Tables.Count; i++)
     {
         if (psfo.Tables[i].Name == "ACCOUNT_ID")
         {
             //get the value
             return(psfo.Tables[i].Value);
         }
     }
     return("");
 }
Example #4
0
 public string Get_SAVEDATA_DIRECTORY(Param_SFO.PARAM_SFO psfo)
 {
     for (int i = 0; i < psfo.Tables.Count; i++)
     {
         if (psfo.Tables[i].Name == "SAVEDATA_DIRECTORY")
         {
             //get the value
             return(psfo.Tables[i].Value);
         }
     }
     return("");
 }
Example #5
0
 public string GetDetail(Param_SFO.PARAM_SFO psfo)
 {
     for (int i = 0; i < psfo.Tables.Count; i++)
     {
         if (psfo.Tables[i].Name == "DETAIL")
         {
             //get the value
             return(psfo.Tables[i].Value);
         }
     }
     return("");
 }
Example #6
0
        public void CreateSFX(Param_SFO.PARAM_SFO psfo)
        {
            string FileHeader;

            if (version == Form1.Playstation.ps4)
            {
                //table items
                FileHeader = CreateSFXHeader();
                string XMLItem = FileHeader + "\n<paramsfo>";//begin the tag
                foreach (var item in psfo.Tables)
                {
                    XMLItem += "\n\t<param key=\"" + item.Name + "\">" + item.Value + "</param>";
                }
                XMLItem += "\n</paramsfo>";//close the tag
                SaveFileDialog dlg = new SaveFileDialog();
                dlg.Filter       = "PARAM.SFX | PARAM.SFX";
                dlg.DefaultExt   = "SFX";
                dlg.AddExtension = true;
                dlg.FileName     = "PARAM.SFX";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    //user wants to save in a new location or whatever
                    System.IO.File.WriteAllText(dlg.FileName, XMLItem, Encoding.UTF8);
                    MessageBox.Show("File Saved");
                    System.Diagnostics.Process.Start("explorer.exe", System.IO.Path.GetDirectoryName(dlg.FileName));
                }
            }
            else
            {
                MessageBox.Show("SFX For PS3 may be a bit buggy", "SFO Extarct", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                FileHeader = CreateSFXHeader();
                string XMLItem = FileHeader + "\n<paramsfo>";//begin the tag
                foreach (var item in psfo.Tables)
                {
                    #region << Get Format >>
                    var frmt = "";
                    if (item.Indextable.param_data_fmt == Param_SFO.PARAM_SFO.FMT.ASCII)
                    {
                        frmt = "utf8-S";
                    }
                    if (item.Indextable.param_data_fmt == Param_SFO.PARAM_SFO.FMT.UINT32)
                    {
                        frmt = "int32";
                    }
                    if (item.Indextable.param_data_fmt == Param_SFO.PARAM_SFO.FMT.UTF_8)
                    {
                        frmt = "utf8";
                    }
                    if (item.Indextable.param_data_fmt == Param_SFO.PARAM_SFO.FMT.Utf8Null)
                    {
                        frmt = "utf8";
                    }
                    #endregion << Get Format >>


                    XMLItem += "\n\t<param key=\"" + item.Name + "\"" + "fmt=\"" + frmt + "\" max_len=\"" + item.Indextable.param_data_max_len + "\"" + ">" + item.Value + "</param>";
                }
                XMLItem += "\n</paramsfo>";//close the tag
                SaveFileDialog dlg = new SaveFileDialog();
                dlg.Filter       = "PARAM.SFX | PARAM.SFX";
                dlg.DefaultExt   = "SFX";
                dlg.AddExtension = true;
                dlg.FileName     = "PARAM.SFX";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    //user wants to save in a new location or whatever
                    System.IO.File.WriteAllText(dlg.FileName, XMLItem, Encoding.UTF8);
                    MessageBox.Show("File Saved");
                    System.Diagnostics.Process.Start("explorer.exe", System.IO.Path.GetDirectoryName(dlg.FileName));
                }
            }
        }
Example #7
0
 public RawView(Param_SFO.PARAM_SFO _sfo, Form1.Playstation _version)
 {
     pSFO    = _sfo;
     version = _version;
     InitializeComponent();
 }
Example #8
0
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            string selectedgame = "";

            if (this.comboBox1.InvokeRequired)
            {
                this.comboBox1.BeginInvoke((MethodInvoker) delegate() { selectedgame = comboBox1.SelectedItem.ToString(); });
            }
            else
            {
                selectedgame = comboBox1.SelectedItem.ToString();
            }
            GameInfo result = new GameInfo();

            for (int i = 0; i < gamelist.Count; i++)
            {
                System.Threading.Thread.Sleep(100);
                if (gamelist[i].Title == selectedgame)
                {
                    result = gamelist[i];
                }
            }
            UpdateProgress("Copying Files to temp dir");
            //var result = gamelist.Single(s => s.Title == selectedgame);
            //First We Do Param.Sfo
            UpdateProgress("Copying Param.sfo");
            if (File.Exists(AppCommonPath() + @"CONTENTS\sce_sys\param.sfo"))
            {
                File.Delete(AppCommonPath() + @"CONTENTS\sce_sys\param.sfo");
            }
            File.WriteAllBytes(AppCommonPath() + @"CONTENTS\sce_sys\param.sfo", result.param);
            //File.Copy(, AppCommonPath() + @"CONTENTS\sce_sys\param.sfo", true);
            //Next Trophy
            UpdateProgress("Copying trophy00.trp");
            if (File.Exists(AppCommonPath() + @"CONTENTS\sce_sys\trophy\trophy00.trp"))
            {
                File.Delete(AppCommonPath() + @"CONTENTS\sce_sys\trophy\trophy00.trp");
            }
            File.WriteAllBytes(AppCommonPath() + @"CONTENTS\sce_sys\trophy\trophy00.trp", result.TrophyFile);
            // File.Copy(textBox2.Text, AppCommonPath() + @"CONTENTS\sce_sys\trophy\trophy00.trp", true);
            //np title
            UpdateProgress("Copying nptitle.dat");
            if (File.Exists(AppCommonPath() + @"CONTENTS\sce_sys\nptitle.dat"))
            {
                File.Delete(AppCommonPath() + @"CONTENTS\sce_sys\nptitle.dat");
            }
            File.WriteAllBytes(AppCommonPath() + @"CONTENTS\sce_sys\nptitle.dat", result.nptitle);
            //File.Copy(textBox3.Text, AppCommonPath() + @"CONTENTS\sce_sys\nptitle.dat", true);
            //np bind
            UpdateProgress("Copying npbind.dat");
            if (File.Exists(AppCommonPath() + @"CONTENTS\sce_sys\npbind.dat"))
            {
                File.Delete(AppCommonPath() + @"CONTENTS\sce_sys\npbind.dat");
            }
            File.WriteAllBytes(AppCommonPath() + @"CONTENTS\sce_sys\npbind.dat", result.npbind);
            //File.Copy(textBox4.Text, AppCommonPath() + @"CONTENTS\sce_sys\npbind.dat", true);
            string tmpcontentid = "EP2165-XDPX30000_00-TROPHYUNLOCKXXXX";

            //string tmpcontentid = "EP2165-CUSA09960_00-F13GAMEDISCXXXXX";

            UpdateProgress("Fixing Param.sfo");
            var sfo = new Param_SFO.PARAM_SFO(AppCommonPath() + @"CONTENTS\sce_sys\param.sfo");

            //save the title as Unlocker For
            for (int i = 0; i < sfo.Tables.Count; i++)
            {
                if (sfo.Tables[i].Name == "TITLE")
                {
                    var tempitem = sfo.Tables[i];
                    tempitem.Value = "Unlocker for " + sfo.Title;
                    sfo.Tables[i]  = tempitem;
                }
                if (sfo.Tables[i].Name == "APP_VER")
                {
                    var tempitem = sfo.Tables[i];
                    tempitem.Value = "01.00";
                    sfo.Tables[i]  = tempitem;
                }
                //CONTENT_ID
                //if (sfo.Tables[i].Name == "CONTENT_ID")
                //{
                //    var tempitem = sfo.Tables[i];
                //    tempitem.Value = tmpcontentid;
                //    sfo.Tables[i] = tempitem;
                //}

                //if (sfo.Tables[i].Name == "TITLE_ID")
                //{
                //    var tempitem = sfo.Tables[i];
                //    tempitem.Value = "XDPX30000";
                //    sfo.Tables[i] = tempitem;
                //}
            }
            sfo.SaveSFO(sfo, AppCommonPath() + @"CONTENTS\sce_sys\param.sfo");
            //we save it with the new title
            //sfo.Tables = "Unlocker for " + sfo.Title;
            //now build the pkg with the new sfo

            UpdateProgress("Creating GP4 Project");
            var project = PS4_Tools.PKG.SceneRelated.GP4.ReadGP4(AppCommonPath() + "Trophy_Unlocker.gp4");

            UpdateProgress("GP4 content id " + sfo.ContentID);
            project.Volume.Package.Content_id = sfo.ContentID;//this hould be litrally all we need

            PS4_Tools.PKG.SceneRelated.GP4.SaveGP4(AppCommonPath() + "Trophy_Unlocker.gp4", project);


            //now build the pkg
            UpdateProgress("Creating PKG");
            bool BusyCoping = true;

            new System.Threading.Thread(new System.Threading.ThreadStart(delegate
            {
                Orbis_CMD("", "img_create --oformat pkg \"" + AppCommonPath() + "Trophy_Unlocker.gp4\" \"" + saveFileDialog1.SelectedPath + "\"");
                //orbis_pub_cmd.exe img_create --skip_digest --oformat pkg C:\Users\3deEchelon\AppData\Roaming\Ps4Tools\PS2Emu\PS2Classics.gp4 C:\Users\3deEchelon\AppData\Roaming\Ps4Tools\PS2Emu\
                BusyCoping = false;
            })).Start();

            while (BusyCoping == true)
            {
                Application.DoEvents();
                //Thread.Sleep(TimeSpan.FromSeconds(5));//sleep for 5 seconds
            }
            //saved
            //get the app version
            string version = "";

            for (int i = 0; i < sfo.Tables.Count; i++)
            {
                if (sfo.Tables[i].Name == "VERSION")
                {
                    var tempitem = sfo.Tables[i];
                    version = tempitem.Value;
                }
            }
            UpdateProgress("Renaming PKG");
            if (File.Exists(saveFileDialog1.SelectedPath + @"\" + RemoveSpecialCharacters(sfo.Title) + ".pkg"))
            {
                File.Delete(saveFileDialog1.SelectedPath + @"\" + RemoveSpecialCharacters(sfo.Title) + ".pkg");
            }
            File.Move(saveFileDialog1.SelectedPath + @"\" + sfo.ContentID + "-A" + sfo.APP_VER.Replace(".", "") + "-V" + version.Replace(".", "") + ".pkg", saveFileDialog1.SelectedPath + @"\" + RemoveSpecialCharacters(sfo.Title) + ".pkg");
            // PS4_Tools.PKG.SceneRelated.Rename_pkg_To_Title(saveFileDialog1.SelectedPath +@"\"+ sfo.ContentID +"-A" + sfo.APP_VER.Replace(".","") + "-V"+ version.Replace(".","")+ ".pkg", saveFileDialog1.SelectedPath + @"\",true);
            ////delete the old one
            //if(File.Exists(saveFileDialog1.SelectedPath + @"\" + sfo.ContentID + "-A" + sfo.APP_VER.Replace(".", "") + "-V" + version.Replace(".", "") + ".pkg"))
            //{
            //    File.Delete(saveFileDialog1.SelectedPath + @"\" + sfo.ContentID + "-A" + sfo.APP_VER.Replace(".", "") + "-V" + version.Replace(".", "") + ".pkg");
            //}
            UpdateProgress("Done");
            Process.Start(saveFileDialog1.SelectedPath);
        }