private void buttonPatch_Click(object sender, EventArgs e) { Invoke(new BoolDelegate(SetInteractionEnabled), false); string outDirPath = @"new/patched"; var outDir = Directory.CreateDirectory(outDirPath); Thread thread = new Thread(delegate() { foreach (var ctrl in FileSelectControls) { ctrl.OutDir = outDir.FullName; ctrl.StartWorker(); while (ctrl.IsWorkerRunning()) { Thread.Sleep(300); } } TempUtil.RemoveTempFolder(); Invoke(new BoolDelegate(SetInteractionEnabled), true); }); thread.Start(); }
private void PatchForm_Load(object sender, EventArgs e) { TempUtil.RemoveTempFolder(); if (!Directory.Exists("new/patches")) { MessageBox.Show(this, "Patch folder could not be found at " + Path.GetFullPath("new/patches") + "." + Environment.NewLine + "Please make sure the archive containing the patch files was fully extracted and no files were moved or renamed, then run the patcher again.", "Patches not found!", MessageBoxButtons.OK, MessageBoxIcon.Error ); Close(); return; } if (!CheckForExecutable("comptoe") || !CheckForExecutable("xdelta")) { Close(); return; } if (!LoadOutputChecksums()) { Close(); return; } string ebootModPath = Path.GetFullPath("ebootmod/ebootMOD.exe"); if (!File.Exists(ebootModPath)) { MessageBox.Show(this, "ebootMOD could not be found at " + ebootModPath + "." + Environment.NewLine + "ebootMOD is required to patch EBOOT.BIN. Please read the readme, find a copy of ebootMOD, and place it at the appropriate location." + Environment.NewLine + "The patcher will still run, but will not be able to patch EBOOT.BIN until you do so.", "ebootMOD not found!", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } fileSelectControlElf.LabelText = "EBOOT.BIN"; fileSelectControlElf.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "EBOOT.BIN"); fileSelectControlElf.PatchDir = "new/patches"; fileSelectControlElf.PatchFunction = ElfPatcher.PatchElf; fileSelectControlElf.OutputChecksum = OutputChecksums.GetValueOrDefault("ToV.elf", null); fileSelectControlString.LabelText = "string.svo"; fileSelectControlString.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "string.svo"); fileSelectControlString.PatchDir = "new/patches"; fileSelectControlString.PatchFunction = Patcher.PatchString; fileSelectControlString.OutputChecksum = OutputChecksums.GetValueOrDefault("string.svo", null); fileSelectControlScenario.LabelText = "scenario.dat"; fileSelectControlScenario.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "scenario.dat"); fileSelectControlScenario.PatchDir = "new/patches/scenario"; fileSelectControlScenario.PatchFunction = Patcher.PatchScenario; fileSelectControlScenario.OutputChecksum = OutputChecksums.GetValueOrDefault("scenario.dat", null); fileSelectControlBtl.LabelText = "btl.svo"; fileSelectControlBtl.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "btl.svo"); fileSelectControlBtl.PatchDir = "new/patches/btl"; fileSelectControlBtl.PatchFunction = Patcher.PatchBtl; fileSelectControlBtl.OutputChecksum = OutputChecksums.GetValueOrDefault("btl.svo", null); fileSelectControlChat.LabelText = "chat.svo"; fileSelectControlChat.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "chat.svo"); fileSelectControlChat.PatchDir = "new/patches/chat"; fileSelectControlChat.PatchFunction = Patcher.PatchChat; fileSelectControlChat.OutputChecksum = OutputChecksums.GetValueOrDefault("chat.svo", null); fileSelectControlUI.LabelText = "UI.svo"; fileSelectControlUI.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "UI.svo"); fileSelectControlUI.PatchDir = "new/patches/UI"; fileSelectControlUI.PatchFunction = Patcher.PatchUI; fileSelectControlUI.OutputChecksum = OutputChecksums.GetValueOrDefault("UI.svo", null); fileSelectControlEffect.LabelText = "effect.svo"; fileSelectControlEffect.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "effect.svo"); fileSelectControlEffect.PatchDir = "new/patches/effect"; fileSelectControlEffect.PatchFunction = Patcher.PatchEffect; fileSelectControlEffect.OutputChecksum = OutputChecksums.GetValueOrDefault("effect.svo", null); fileSelectControlChara.LabelText = "chara.svo"; fileSelectControlChara.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "chara.svo"); fileSelectControlChara.PatchDir = "new/patches/chara"; fileSelectControlChara.PatchFunction = Patcher.PatchChara; fileSelectControlChara.OutputChecksum = OutputChecksums.GetValueOrDefault("chara.svo", null); fileSelectControlMenu.LabelText = "menu.svo"; fileSelectControlMenu.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "menu.svo"); fileSelectControlMenu.PatchDir = "new/patches"; fileSelectControlMenu.PatchFunction = Patcher.PatchMenu; fileSelectControlMenu.OutputChecksum = OutputChecksums.GetValueOrDefault("menu.svo", null); fileSelectControlParam.LabelText = "PARAM.SFO"; fileSelectControlParam.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "PARAM.SFO"); fileSelectControlParam.PatchDir = null; fileSelectControlParam.PatchFunction = Patcher.PatchParam; fileSelectControlParam.OutputChecksum = OutputChecksums.GetValueOrDefault("PARAM.SFO", null); fileSelectControlTrophy.LabelText = "TROPHY.TRP"; fileSelectControlTrophy.FilePath = Path.Combine(Directory.GetCurrentDirectory(), "TROPHY.TRP"); fileSelectControlTrophy.PatchDir = "new/patches"; fileSelectControlTrophy.PatchFunction = PatchTrophyAfterWarning; fileSelectControlTrophy.OutputChecksum = OutputChecksums.GetValueOrDefault("TROPHY.TRP", null); FileSelectControls.Add(fileSelectControlElf); FileSelectControls.Add(fileSelectControlBtl); FileSelectControls.Add(fileSelectControlChara); FileSelectControls.Add(fileSelectControlChat); FileSelectControls.Add(fileSelectControlEffect); FileSelectControls.Add(fileSelectControlMenu); FileSelectControls.Add(fileSelectControlScenario); FileSelectControls.Add(fileSelectControlString); FileSelectControls.Add(fileSelectControlUI); FileSelectControls.Add(fileSelectControlParam); FileSelectControls.Add(fileSelectControlTrophy); }