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