static public void ExtractIsoToFolder(string SourceIsoPath, string DestExtractPath) { var Iso = new Dvd9Xbox360FileSystem(File.OpenRead(SourceIsoPath)); var Out = new LocalFileSystem(DestExtractPath); FileSystem.CopyTree(Iso, "/", Out, "/", null, (Entry, Current, End) => { if (Current == 0) { Console.WriteLine(); } Console.Write("{0} {1:0.00}% ({2})\r", Entry.FullName, ((double)Current / (double)End) * 100, End); }); }
public void InitWithGamePath(string GamePath) { FileSystem GameRootFS; if (Directory.Exists(GamePath)) { GameRootFS = new LocalFileSystem(GamePath); } else { this.GameIsoStream = File.Open(GamePath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read); GameRootFS = new Dvd9Xbox360FileSystem(this.GameIsoStream); } InitWithFileSystem(GameRootFS); CheckPatchPaths(); }
public void LoadVfsTest() { var Stream = MapStream.Unserialize(new MemoryStream(File.OpenRead(Utils.TestInputPath + "/mini_iso.bin").ReadAll())); var Dvd9Xbox360 = new Dvd9Xbox360().Load(Stream); var Vfs = new Dvd9Xbox360FileSystem(Dvd9Xbox360); Assert.AreEqual( "ai.svo,btl.svo,chara.svo,chat.svo,common.svo,cook.svo,effect.svo,item.svo,map.svo,menu.svo,mg.svo,string.svo,UI.svo", Vfs.FindFiles("/", "*.svo").Select(Item => Item.Name).ToStringArray(",") ); using (var ConfigStream = Vfs.OpenFile("/snd/config.bin", FileMode.Open)) { var TextReaded = ConfigStream.ReadString(4, Encoding.UTF8); Assert.AreEqual("nusc", TextReaded); } }
static public void Run(MainWindow MainWindow, Action <ProgressHandler> OnProgress, string OriginalGamePath, string TranslatedGamePath, bool UseJTAGFolder) { //string OriginalPath = GamePath; //string TranslatedISOPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(OriginalPath), "Tales of Vesperia [PAL] [Español].iso"); if (OriginalGamePath == TranslatedGamePath) { MessageBox.Show("No se puede actualizar el mismo archivo directamente.", "Hubo un error", MessageBoxButton.OK, MessageBoxImage.Error); return; } const bool CheckMd5 = true; //const bool CheckMd5 = false; var RunTask = Task.Run(() => { try { MainWindow.InProgress = true; TryCatchIfNotDebugger(() => { //throw (new Exception("Test ERROR!")); var Patcher = new Patcher((string)null); var PatchAll = new PatchAll(Patcher); if (!UseJTAGFolder) { var Iso = new Dvd9Xbox360FileSystem(File.OpenRead(OriginalGamePath)); PatchAll.CheckFileSystemVesperiaExceptions(Iso); } Patcher.Progress += (ProgressHandler) => { OnProgress(ProgressHandler); }; if (!UseJTAGFolder) { Patcher.ProgressHandler.ExecuteActionsWithProgressTracking("Preparándose para parchear", () => { Patcher.ProgressHandler.AddProgressLevel("Comprobando MD5 de la ISO", 1, () => { if (CheckMd5) { var ExpectedMd5 = "546f74b4e48bb985fcd365496e03bd10"; var ComputedMd5 = Hashing.GetMd5Hash(OriginalGamePath, (Current, Total) => { Patcher.ProgressHandler.SetLevelProgressTo(Current, Total); }); if (ComputedMd5 != ExpectedMd5) { throw (new Exception( "El md5 de la ISO a parchear no coincide.\n" + "Si estás intentando reparchear el juego, asegúrate de haber borrado la anterior ISO en español.\n" + "Se tiene que parchear usando la ISO original PAL, y no se puede usar la ISO en español ni ninguna otra ISO para el reparcheo.\n" + "Md5 calculado: " + ComputedMd5 + "\n" + "Md5 esperado: " + ExpectedMd5 + "\n" + "")); } } }); }, () => { if (CheckMd5) { if (File.Exists(TranslatedGamePath)) { try { File.Delete(TranslatedGamePath); } catch { } } } var TranslatedGameDvdPath = System.IO.Path.ChangeExtension(TranslatedGamePath, ".dvd"); //LayerBreak=1913760 //s-tov.iso File.WriteAllLines(TranslatedGameDvdPath, new[] { "LayerBreak=1913760", System.IO.Path.GetFileName(TranslatedGamePath), }); Patcher.ProgressHandler.AddProgressLevel("Copiando ISO", 1, () => { Console.WriteLine("Copying ISO..."); if (!File.Exists(TranslatedGamePath) || (new FileInfo(TranslatedGamePath).Length != new FileInfo(OriginalGamePath).Length)) { using (var In = File.OpenRead(OriginalGamePath)) using (var Out = File.Open(TranslatedGamePath, FileMode.Create, FileAccess.Write, FileShare.None)) { Out.WriteStream(In, (Current, Total) => { //Console.WriteLine("{0}%", ((double)Current / (double)Total) * 100); Patcher.ProgressHandler.SetLevelProgressTo(Current, Total); }); } } Console.WriteLine("Done"); }); }); } if (!Patcher.ExternalPatchData) { PatchDataDecompress(); } Patcher.InitWithGamePath(TranslatedGamePath); PatchAll.CheckFileSystemVesperiaExceptions(Patcher.GameFileSystem); PatchAll.Handle(); if (!Patcher.ExternalPatchData) { PatchDataDelete(); } MessageBox.Show("¡El parcheador ha terminado de traducir Tales of Vesperia al español!", "¡Felicidades!", MessageBoxButton.OK, MessageBoxImage.Information); }); } finally { MainWindow.InProgress = false; } }); }