private void FREEDOM_Click(object sender, EventArgs e) { Action enable = () => { this.FREEDOM.Enabled = true; }; if (RifPath.Text == "" || !File.Exists(RifPath.Text)) { MessageBox.Show("INVALID RIF PATH!\nPlease try \"Find from CMA\"", "RIF ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Versionkey.Text.Length != 32) { MessageBox.Show("INVALID VERSION KEY!\nPlease try \"Find from CMA\"", "VERKEY ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ISOPath.Text == "" || !File.Exists(ISOPath.Text)) { MessageBox.Show("INVALID ISO PATH!", "ISO ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.FREEDOM.Enabled = false; string CmaDir = ReadSetting("CmaDir"); if (CmaDir == "") { FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.Description = "Select CMA Backups Directory"; fbd.ShowDialog(); CmaDir = fbd.SelectedPath; } string TitleID = GetTitleID(ISOPath.Text); string TmpDir = Path.Combine(Application.StartupPath, "_tmp"); string GameWorkDir = Path.Combine(TmpDir, TitleID); string EbootFile = Path.Combine(GameWorkDir, "EBOOT.PBP"); string EbootSignature = Path.Combine(GameWorkDir, "__sce_ebootpbp"); Directory.CreateDirectory(TmpDir); Directory.CreateDirectory(GameWorkDir); //Read RIF data byte[] ContentId = new byte[0x24]; byte[] RifAid = new byte[0x08]; FileStream rif = File.OpenRead(RifPath.Text); rif.Seek(0x10, SeekOrigin.Begin); rif.Read(ContentId, 0x00, 0x24); rif.Seek(0x08, SeekOrigin.Begin); rif.Read(RifAid, 0x00, 0x08); rif.Close(); string ContentID = Encoding.UTF8.GetString(ContentId); string Aid = BitConverter.ToString(RifAid).Replace("-", "").ToLower(); string BackupWorkDir = Path.Combine(CmaDir, "PGAME", Aid, TitleID); TotalProgress.Maximum = 100; Status.Text = "Overthrowing The PSPEMU Monarchy 0%"; string BootupImage = ""; if (isMini(ISOPath.Text)) { BootupImage = Path.Combine(Application.StartupPath, "_tmp", "minis.png"); Resources.MINIS.Save(BootupImage); } else { BootupImage = Path.Combine(Application.StartupPath, "_tmp", "chovy.png"); Resources.ChovyLogo.Save(BootupImage); } Process signnp = pbp.GenPbpFromIso(ISOPath.Text, EbootFile, ContentID, Versionkey.Text, CompressPBP.Checked, BootupImage); while (!signnp.HasExited) { string Progress = signnp.StandardOutput.ReadLine(); if (Progress.StartsWith("Writing ISO blocks: ")) { Progress = Progress.Remove(0, 19); int ProgressInt = int.Parse(Progress.Substring(0, 3)); TotalProgress.Value = ProgressInt; Status.Text = "Overthrowing The PSPEMU Monarchy " + ProgressInt.ToString() + "%"; } Application.DoEvents(); } TotalProgress.Value = 0; Status.Text = "Signing the Declaration of Independance 0%"; UInt64 IntAid = BitConverter.ToUInt64(RifAid, 0x00); Thread thrd = new Thread(() => { int ChovyGenRes = pbp.gen__sce_ebootpbp(EbootFile, IntAid, EbootSignature); if (!File.Exists(EbootSignature) || ChovyGenRes != 0) { MessageBox.Show("CHOVY-GEN Failed! Please check CHOVY.DLL exists\nand that the Microsoft Visual C++ 2015 Redistributable Update 3 RC is installed"); enable(); return; } }); thrd.Start(); while (thrd.IsAlive) { Application.DoEvents(); } /* * BUILD PSVIMG FILE */ // Pacakge GAME byte[] CmaKey = CmaKeys.GenerateKey(RifAid); string[] entrys = Directory.GetFileSystemEntries(GameWorkDir, "*", SearchOption.AllDirectories); long noEntrys = entrys.LongLength; string parentPath = "ux0:pspemu/temp/game/PSP/GAME/" + TitleID; int noBlocks = 0; foreach (string fileName in Directory.GetFiles(GameWorkDir, "*", SearchOption.AllDirectories)) { noBlocks += Convert.ToInt32(new FileInfo(fileName).Length / PSVIMGConstants.PSVIMG_BLOCK_SIZE); } TotalProgress.Maximum = noBlocks; string BackupDir = Path.Combine(BackupWorkDir, "game"); Directory.CreateDirectory(BackupDir); string psvimgFilepath = Path.Combine(BackupDir, "game.psvimg"); FileStream gamePsvimg = File.OpenWrite(psvimgFilepath); gamePsvimg.SetLength(0); PSVIMGBuilder builder = new PSVIMGBuilder(gamePsvimg, CmaKey); foreach (string entry in entrys) { string relativePath = entry.Remove(0, GameWorkDir.Length); relativePath = relativePath.Replace('\\', '/'); bool isDir = File.GetAttributes(entry).HasFlag(FileAttributes.Directory); if (isDir) { builder.AddDir(entry, parentPath, relativePath); } else { builder.AddFileAsync(entry, parentPath, relativePath); while (!builder.HasFinished) { try { int tBlocks = builder.BlocksWritten; TotalProgress.Value = tBlocks; decimal progress = Math.Floor(((decimal)tBlocks / (decimal)noBlocks) * 100); Status.Text = "Signing the Declaration of Independance " + progress.ToString() + "%"; } catch (Exception) { } Application.DoEvents(); } } } long ContentSize = builder.Finish(); gamePsvimg = File.OpenRead(psvimgFilepath); FileStream gamePsvmd = File.OpenWrite(Path.Combine(BackupDir, "game.psvmd")); PSVMDBuilder.CreatePsvmd(gamePsvmd, gamePsvimg, ContentSize, "game", CmaKey); gamePsvmd.Close(); gamePsvimg.Close(); // Package LICENSE BackupDir = Path.Combine(BackupWorkDir, "license"); psvimgFilepath = Path.Combine(BackupDir, "license.psvimg"); Directory.CreateDirectory(BackupDir); FileStream licensePsvimg = File.OpenWrite(psvimgFilepath); licensePsvimg.SetLength(0); builder = new PSVIMGBuilder(licensePsvimg, CmaKey); builder.AddFile(RifPath.Text, "ux0:pspemu/temp/game/PSP/LICENSE", "/" + ContentID + ".rif"); ContentSize = builder.Finish(); licensePsvimg = File.OpenRead(psvimgFilepath); FileStream licensePsvmd = File.OpenWrite(Path.Combine(BackupDir, "license.psvmd")); PSVMDBuilder.CreatePsvmd(licensePsvmd, licensePsvimg, ContentSize, "license", CmaKey); licensePsvmd.Close(); licensePsvimg.Close(); // Write PARAM.SFO & ICON0.PNG string SceSysWorkDir = Path.Combine(BackupWorkDir, "sce_sys"); Directory.CreateDirectory(SceSysWorkDir); byte[] ParamSfo = GetSfo(ISOPath.Text); byte[] Icon0 = GetIcon(ISOPath.Text); File.WriteAllBytes(Path.Combine(SceSysWorkDir, "param.sfo"), ParamSfo); File.WriteAllBytes(Path.Combine(SceSysWorkDir, "icon0.png"), Icon0); Status.Text = "YOU HAVE MADE A SOCIAL CONTRACT WITH FREEDOM!"; TotalProgress.Value = 0; try { Directory.Delete(TmpDir, true); } catch (Exception) { }; if (!MutedAudio) { Stream str = Resources.Murica; SoundPlayer snd = new SoundPlayer(str); snd.Play(); } enable(); MessageBox.Show("YOU HAVE MADE A SOCIAL CONTRACT WITH FREEDOM!", "FREEDOM!", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void transVita_Click(object sender, EventArgs e) { if (!Directory.Exists(Path.Combine(driveLetterDst.Text, cmaDir.Text))) { MessageBox.Show("CMA Folder Doesn't Exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!Directory.Exists(Path.Combine(driveLetterSrc.Text, pspFolder.Text))) { MessageBox.Show("PSP Folder Doesn't Exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (pspGames.SelectedIndex < 0) { MessageBox.Show("No PSP Game Selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } transVita.Enabled = false; driveLetterDst.Enabled = false; driveLetterSrc.Enabled = false; pspFolder.ReadOnly = true; cmaDir.ReadOnly = true; pspGames.Enabled = false; string titleId = pspGames.SelectedItem.ToString().Substring(0, 9); string gameFolder = Path.Combine(driveLetterSrc.Text, pspFolder.Text, "GAME", titleId); string ebootFile = Path.Combine(gameFolder, "EBOOT.PBP"); string cid = GetContentIdFromPbp(ebootFile); string licenseFile = Path.Combine(driveLetterSrc.Text, pspFolder.Text, "LICENSE", cid + ".RIF"); string sigFile = Path.Combine(gameFolder, "__sce_ebootpbp"); string backupDir = Path.Combine(driveLetterDst.Text, cmaDir.Text); bool isPs1 = IsPs1(ebootFile); if (!File.Exists(licenseFile)) { MessageBox.Show("Could not find LICENSE file!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); transVita.Enabled = true; driveLetterDst.Enabled = true; driveLetterSrc.Enabled = true; pspFolder.ReadOnly = false; cmaDir.ReadOnly = false; pspGames.Enabled = true; return; } FileStream rif = File.OpenRead(licenseFile); byte[] bAid = new byte[0x08]; rif.Seek(0x08, SeekOrigin.Begin); rif.Read(bAid, 0x00, 0x08); rif.Close(); string sAid = BitConverter.ToString(bAid).Replace("-", "").ToLower(); UInt64 uAid = BitConverter.ToUInt64(bAid, 0x00); if (File.Exists(sigFile)) { File.Delete(sigFile); } int ChovyGenRes = 100; Thread ChovyGen = new Thread(() => { ChovyGenRes = chovy_gen(ebootFile, uAid, sigFile); }); ChovyGen.Start(); while (ChovyGen.IsAlive) { Application.DoEvents(); } if (!File.Exists(sigFile) || ChovyGenRes != 0) { MessageBox.Show("CHOVY-GEN Failed! Please check CHOVY.DLL exists\nand that the Microsoft Visual C++ 2015 Redistributable Update 3 RC is installed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); transVita.Enabled = true; driveLetterDst.Enabled = true; driveLetterSrc.Enabled = true; pspFolder.ReadOnly = false; cmaDir.ReadOnly = false; pspGames.Enabled = true; return; } /* * BUILD PSVIMG FILE(s) */ // Pacakge GAME byte[] CmaKey; if (!IsDexAidSet()) { CmaKey = CmaKeys.GenerateKey(bAid); } else { CmaKey = CmaKeys.GenerateKey(new byte[0x8] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); } string[] entrys = Directory.GetFileSystemEntries(gameFolder, "*", SearchOption.AllDirectories); long noEntrys = entrys.LongLength; string parentPath = "ux0:pspemu/temp/game/PSP/GAME/" + titleId; int noBlocks = 0; foreach (string fileName in Directory.GetFiles(gameFolder, "*", SearchOption.AllDirectories)) { noBlocks += Convert.ToInt32(new FileInfo(fileName).Length / PSVIMGConstants.PSVIMG_BLOCK_SIZE); } progressBar.Maximum = noBlocks; string pgameFolder; string pgameFolderl; string scesys; if (!isPs1) { if (!IsDexAidSet()) { pgameFolder = Path.Combine(backupDir, "PGAME", sAid, titleId, "game"); pgameFolderl = Path.Combine(backupDir, "PGAME", sAid, titleId, "license"); scesys = Path.Combine(backupDir, "PGAME", sAid, titleId, "sce_sys"); } else { pgameFolder = Path.Combine(backupDir, "PGAME", "0000000000000000", titleId, "game"); pgameFolderl = Path.Combine(backupDir, "PGAME", "0000000000000000", titleId, "license"); scesys = Path.Combine(backupDir, "PSGAME", "0000000000000000", titleId, "sce_sys"); } } else { if (!IsDexAidSet()) { pgameFolder = Path.Combine(backupDir, "PSGAME", sAid, titleId, "game"); pgameFolderl = Path.Combine(backupDir, "PSGAME", sAid, titleId, "license"); scesys = Path.Combine(backupDir, "PSGAME", sAid, titleId, "sce_sys"); } else { pgameFolder = Path.Combine(backupDir, "PSGAME", "0000000000000000", titleId, "game"); pgameFolderl = Path.Combine(backupDir, "PSGAME", "0000000000000000", titleId, "license"); scesys = Path.Combine(backupDir, "PSGAME", "0000000000000000", titleId, "sce_sys"); } } Directory.CreateDirectory(pgameFolder); Directory.CreateDirectory(pgameFolderl); Directory.CreateDirectory(scesys); string psvimgFilepathl = Path.Combine(pgameFolderl, "license.psvimg"); string psvimgFilepath = Path.Combine(pgameFolder, "game.psvimg"); string psvmdFilepathl = Path.Combine(pgameFolderl, "license.psvmd"); string psvmdFilepath = Path.Combine(pgameFolder, "game.psvmd"); FileStream gamePsvimg = File.OpenWrite(psvimgFilepath); gamePsvimg.SetLength(0); PSVIMGBuilder builder = new PSVIMGBuilder(gamePsvimg, CmaKey); foreach (string entry in entrys) { string relativePath = entry.Remove(0, gameFolder.Length); relativePath = relativePath.Replace('\\', '/'); bool isDir = File.GetAttributes(entry).HasFlag(FileAttributes.Directory); if (isDir) { builder.AddDir(entry, parentPath, relativePath); } else { builder.AddFileAsync(entry, parentPath, relativePath); while (!builder.HasFinished) { try { int tBlocks = builder.BlocksWritten; progressBar.Value = tBlocks; decimal progress = Math.Floor(((decimal)tBlocks / (decimal)noBlocks) * 100); progressStatus.Text = progress.ToString() + "%"; } catch (Exception) { } Application.DoEvents(); } } } long ContentSize = builder.Finish(); gamePsvimg = File.OpenRead(psvimgFilepath); FileStream gamePsvmd = File.OpenWrite(psvmdFilepath); PSVMDBuilder.CreatePsvmd(gamePsvmd, gamePsvimg, ContentSize, "game", CmaKey); gamePsvmd.Close(); gamePsvimg.Close(); // Package LICENSE FileStream licensePsvimg = File.OpenWrite(psvimgFilepathl); licensePsvimg.SetLength(0); builder = new PSVIMGBuilder(licensePsvimg, CmaKey); builder.AddFile(licenseFile, "ux0:pspemu/temp/game/PSP/LICENSE", "/" + cid + ".rif"); ContentSize = builder.Finish(); licensePsvimg = File.OpenRead(psvimgFilepathl); FileStream licensePsvmd = File.OpenWrite(psvmdFilepathl); PSVMDBuilder.CreatePsvmd(licensePsvmd, licensePsvimg, ContentSize, "license", CmaKey); licensePsvmd.Close(); licensePsvimg.Close(); // Write PARAM.SFO & ICON0.PNG byte[] ParamSfo = GetSfo(ebootFile); byte[] Icon0 = GetIcon0(ebootFile); File.WriteAllBytes(Path.Combine(scesys, "param.sfo"), ParamSfo); File.WriteAllBytes(Path.Combine(scesys, "icon0.png"), Icon0); if (!isPs1) { MessageBox.Show("Success!\nYou can now Restore the game onto your PSVita from\n[Content Mannager] (Copy Content) -> (PC) -> (Applications) -> (PC -> This System) -> (PSP/Others)", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Success!\nYou can now Restore the game onto your PSVita from\n[Content Mannager] (Copy Content) -> (PC) -> (Applications) -> (PC -> This System) -> (PlayStation)", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } progressBar.Value = 0; progressStatus.Text = "0%"; transVita.Enabled = true; driveLetterDst.Enabled = true; driveLetterSrc.Enabled = true; pspFolder.ReadOnly = false; cmaDir.ReadOnly = false; pspGames.Enabled = true; }
private void FREEDOM_Click(object sender, EventArgs e) { Action enable = () => { this.FREEDOM.Enabled = true; this.Ps1Menu.Enabled = true; this.FindFromCMA.Enabled = true; this.RifPath.ReadOnly = false; this.Versionkey.ReadOnly = false; this.ISOPath.ReadOnly = false; this.CompressPBP.Enabled = true; this.BrowseButton.Enabled = true; }; Action disable = () => { this.FREEDOM.Enabled = false; this.Ps1Menu.Enabled = false; this.FindFromCMA.Enabled = false; this.RifPath.ReadOnly = true; this.Versionkey.ReadOnly = true; this.ISOPath.ReadOnly = true; this.CompressPBP.Enabled = false; this.BrowseButton.Enabled = false; }; disable(); bool isZrif = false; if (RifPath.Text == "" || !File.Exists(RifPath.Text)) { // Check if valid 'zRIF' try { ZlibStream.UncompressBuffer(Convert.FromBase64String(RifPath.Text)); isZrif = true; } catch (Exception) { MessageBox.Show("INVALID RIF!\nPlease try \"Find from CMA\"", "RIF ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); enable(); return; } } if (Versionkey.Text.Length != 32) { MessageBox.Show("INVALID VERSION KEY!\nPlease try \"Find from CMA\"", "VERKEY ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); enable(); return; } if (ISOPath.Text == "" || !File.Exists(ISOPath.Text)) { MessageBox.Show("INVALID ISO PATH!", "ISO ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); enable(); return; } this.FREEDOM.Enabled = false; string CmaDir = ReadSetting("CmaDir"); if (CmaDir == "") { FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.Description = "Select CMA Backups Directory"; fbd.ShowDialog(); CmaDir = fbd.SelectedPath; } string TitleID = GetTitleID(ISOPath.Text); string TmpDir = Path.Combine(Application.StartupPath, "_tmp"); string GameWorkDir = Path.Combine(TmpDir, TitleID); string EbootFile = Path.Combine(GameWorkDir, "EBOOT.PBP"); string EbootSignature = Path.Combine(GameWorkDir, "__sce_ebootpbp"); Directory.CreateDirectory(TmpDir); Directory.CreateDirectory(GameWorkDir); //Read RIF data byte[] ContentId = new byte[0x24]; byte[] RifAid = new byte[0x08]; Stream rif = null; if (!isZrif) { rif = File.OpenRead(RifPath.Text); } else { rif = new MemoryStream(ZlibStream.UncompressBuffer(Convert.FromBase64String(RifPath.Text))); } rif.Seek(0x10, SeekOrigin.Begin); rif.Read(ContentId, 0x00, 0x24); rif.Seek(0x08, SeekOrigin.Begin); rif.Read(RifAid, 0x00, 0x08); string ContentID = Encoding.UTF8.GetString(ContentId); string AidStr = BitConverter.ToString(RifAid).Replace("-", "").ToLower(); if (IsDexAidSet()) { AidStr = "0000000000000000"; } string BackupWorkDir = Path.Combine(CmaDir, "PGAME", AidStr, TitleID); TotalProgress.Maximum = 100; Status.Text = "Overthrowing The PSPEMU Monarchy 0%"; Thread BuildPbpThread = new Thread(() => { // Try New System try { FileStream EbootStream = File.OpenWrite(EbootFile); FileStream IsoStream = File.OpenRead(ISOPath.Text); Bitmap BootupImage; if (isMini(ISOPath.Text)) { BootupImage = Resources.MINIS; } else { BootupImage = Resources.ChovyLogo; } byte[] Sfo = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PARAM.SFO"); byte[] Icon0Png = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\ICON0.PNG"); byte[] Icon1 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\ICON1.PMF"); byte[] Pic0 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PIC0.PNG"); byte[] Pic1 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PIC1.PNG"); byte[] Snd0 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\SND0.AT3"); Pbp.BuildPbp(EbootStream, IsoStream, CompressPBP.Checked, FromHex(Versionkey.Text), BootupImage, ContentID, Sfo, Icon0Png, Icon1, Pic0, Pic1, Snd0); IsoStream.Close(); EbootStream.Close(); } catch (Exception exp) { MessageBox.Show(exp.Message, "Error.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }); BuildPbpThread.Start(); while (BuildPbpThread.IsAlive) { if (Pbp.DoEvents) { TotalProgress.Maximum = Pbp.NumberOfSectors; TotalProgress.Value = Pbp.SectorsDone; if (Pbp.SectorsDone != 0 && Pbp.NumberOfSectors != 0) { decimal progress = Math.Floor(((decimal)Pbp.SectorsDone / (decimal)Pbp.NumberOfSectors) * 100); Status.Text = "Overthrowing The PSPEMU Monarchy " + progress.ToString() + "%"; } else { Status.Text = "Overthrowing The PSPEMU Monarchy 0%"; } Application.DoEvents(); } } TotalProgress.Value = 0; Status.Text = "Signing the Declaration of Independance 0%"; UInt64 IntAid = BitConverter.ToUInt64(RifAid, 0x00); Thread ChovyGenThread = new Thread(() => { int ChovyGenRes = Pbp.gen__sce_ebootpbp(EbootFile, IntAid, EbootSignature); }); ChovyGenThread.Start(); while (ChovyGenThread.IsAlive) { Application.DoEvents(); } /* * BUILD PSVIMG FILE */ // Pacakge GAME byte[] CmaKey; if (IsDexAidSet()) { CmaKey = CmaKeys.GenerateKey(new byte[0x8] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); } else { CmaKey = CmaKeys.GenerateKey(RifAid); } string[] entrys = Directory.GetFileSystemEntries(GameWorkDir, "*", SearchOption.AllDirectories); long noEntrys = entrys.LongLength; string parentPath = "ux0:pspemu/temp/game/PSP/GAME/" + TitleID; int noBlocks = 0; foreach (string fileName in Directory.GetFiles(GameWorkDir, "*", SearchOption.AllDirectories)) { noBlocks += Convert.ToInt32(new FileInfo(fileName).Length / PSVIMGConstants.PSVIMG_BLOCK_SIZE); } TotalProgress.Maximum = noBlocks; string BackupDir = Path.Combine(BackupWorkDir, "game"); Directory.CreateDirectory(BackupDir); string psvimgFilepath = Path.Combine(BackupDir, "game.psvimg"); FileStream gamePsvimg = File.OpenWrite(psvimgFilepath); gamePsvimg.SetLength(0); PSVIMGBuilder builder = new PSVIMGBuilder(gamePsvimg, CmaKey); foreach (string entry in entrys) { string relativePath = entry.Remove(0, GameWorkDir.Length); relativePath = relativePath.Replace('\\', '/'); bool isDir = File.GetAttributes(entry).HasFlag(FileAttributes.Directory); if (isDir) { builder.AddDir(entry, parentPath, relativePath); } else { builder.AddFileAsync(entry, parentPath, relativePath); while (!builder.HasFinished) { try { int tBlocks = builder.BlocksWritten; TotalProgress.Value = tBlocks; decimal progress = Math.Floor(((decimal)tBlocks / (decimal)noBlocks) * 100); Status.Text = "Signing the Declaration of Independance " + progress.ToString() + "%"; } catch (Exception) { } Application.DoEvents(); } } } long ContentSize = builder.Finish(); gamePsvimg = File.OpenRead(psvimgFilepath); FileStream gamePsvmd = File.OpenWrite(Path.Combine(BackupDir, "game.psvmd")); PSVMDBuilder.CreatePsvmd(gamePsvmd, gamePsvimg, ContentSize, "game", CmaKey); gamePsvmd.Close(); gamePsvimg.Close(); // Package LICENSE BackupDir = Path.Combine(BackupWorkDir, "license"); psvimgFilepath = Path.Combine(BackupDir, "license.psvimg"); Directory.CreateDirectory(BackupDir); FileStream licensePsvimg = File.OpenWrite(psvimgFilepath); licensePsvimg.SetLength(0); builder = new PSVIMGBuilder(licensePsvimg, CmaKey); if (!isZrif) { builder.AddFile(RifPath.Text, "ux0:pspemu/temp/game/PSP/LICENSE", "/" + ContentID + ".rif"); } else { rif.Seek(0x00, SeekOrigin.Begin); builder.AddFileFromStream(rif, "ux0:pspemu/temp/game/PSP/LICENSE", "/" + ContentID + ".rif"); } rif.Close(); ContentSize = builder.Finish(); licensePsvimg = File.OpenRead(psvimgFilepath); FileStream licensePsvmd = File.OpenWrite(Path.Combine(BackupDir, "license.psvmd")); PSVMDBuilder.CreatePsvmd(licensePsvmd, licensePsvimg, ContentSize, "license", CmaKey); licensePsvmd.Close(); licensePsvimg.Close(); // Write PARAM.SFO & ICON0.PNG string SceSysWorkDir = Path.Combine(BackupWorkDir, "sce_sys"); Directory.CreateDirectory(SceSysWorkDir); byte[] ParamSfo = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\PARAM.SFO"); byte[] Icon0 = ReadFileFromISO(ISOPath.Text, @"PSP_GAME\ICON0.PNG"); File.WriteAllBytes(Path.Combine(SceSysWorkDir, "param.sfo"), ParamSfo); File.WriteAllBytes(Path.Combine(SceSysWorkDir, "icon0.png"), Icon0); Status.Text = "YOU HAVE MADE A SOCIAL CONTRACT WITH FREEDOM!"; TotalProgress.Value = 0; try { Directory.Delete(TmpDir, true); } catch (Exception) { }; if (!MutedAudio) { Stream str = Resources.Murica; SoundPlayer snd = new SoundPlayer(str); snd.Play(); } enable(); MessageBox.Show("YOU HAVE MADE A SOCIAL CONTRACT WITH FREEDOM!", "FREEDOM!", MessageBoxButtons.OK, MessageBoxIcon.Information); }