private void PackME3DLC(string inPath, string DLCname) { GameData gameData = new GameData(MeType.ME3_TYPE, _configIni); if (!Directory.Exists(GameData.GamePath)) { MessageBox.Show("Game path is wrong!"); return; } string outPath = Path.Combine(Path.Combine(GameData.GamePath, "BIOGame", "DLCTemp"), DLCname, "CookedPCConsole", "Default.sfar"); ME3DLC dlc = new ME3DLC(this); dlc.fullRePack(inPath, outPath, DLCname, this, null); }
private void buttonSTART_Click(object sender, EventArgs e) { buttonsEnable(false); buttonPreInstallCheck.Enabled = false; buttonSTART.Enabled = false; labelFinalStatus.Text = "Process in progress..."; errors = ""; log = ""; Misc.startTimer(); log += "Prepare game data started..." + Environment.NewLine; updateStatusPrepare("In progress..."); if (GameData.gameType == MeType.ME1_TYPE) { Misc.VerifyME1Exe(gameData, false); } if (GameData.gameType == MeType.ME3_TYPE) { ME3DLC.unpackAllDLC(null, this); gameData.getPackages(true, true); } if (GameData.gameType != MeType.ME1_TYPE) { gameData.getTfcTextures(); } checkBoxPrepare.Checked = true; updateStatusPrepare(""); log += "Prepare game data finished" + Environment.NewLine + Environment.NewLine; if (Directory.Exists(GameData.DLCData)) { List <string> dirs = Directory.EnumerateDirectories(GameData.DLCData).ToList(); log += "Detected folowing folders in DLC path:" + Environment.NewLine; for (int dl = 0; dl < dirs.Count; dl++) { log += Path.GetFileName(dirs[dl]) + Environment.NewLine; } } else { log += "Not detected folders in DLC path" + Environment.NewLine; } log += Environment.NewLine; log += "Scan textures started..." + Environment.NewLine; updateStatusScan("In progress..."); if (checkBoxOptionFaster.Checked) { errors += treeScan.PrepareListOfTextures(null, cachePackageMgr, null, this, ref log, true); } else { errors += treeScan.PrepareListOfTextures(null, null, null, this, ref log, true); } textures = treeScan.treeScan; checkBoxScan.Checked = true; updateStatusScan(""); log += "Scan textures finished" + Environment.NewLine + Environment.NewLine; if (checkBoxOptionFaster.Checked) { if (GameData.gameType == MeType.ME1_TYPE) { log += "Remove mipmaps started..." + Environment.NewLine; updateStatusMipMaps("In progress..."); errors += mipMaps.removeMipMapsME1(1, textures, cachePackageMgr, null, this, checkBoxPreEnableRepack.Checked); errors += mipMaps.removeMipMapsME1(2, textures, cachePackageMgr, null, this, checkBoxPreEnableRepack.Checked); checkBoxMipMaps.Checked = true; updateStatusMipMaps(""); log += "Remove mipmaps finished" + Environment.NewLine + Environment.NewLine; } else { log += "Remove mipmaps started..." + Environment.NewLine; updateStatusMipMaps("In progress..."); errors += mipMaps.removeMipMapsME2ME3(textures, cachePackageMgr, null, this, checkBoxPreEnableRepack.Checked); checkBoxMipMaps.Checked = true; updateStatusMipMaps(""); log += "Remove mipmaps finished" + Environment.NewLine + Environment.NewLine; } } log += "Process textures started..." + Environment.NewLine; updateStatusTextures("In progress..."); applyModules(); checkBoxTextures.Checked = true; updateStatusTextures(""); log += "Process textures finished" + Environment.NewLine + Environment.NewLine; updateStatusStore("Progress..."); cachePackageMgr.CloseAllWithSave(checkBoxPreEnableRepack.Checked); checkBoxStore.Checked = true; updateStatusStore(""); if (!checkBoxOptionFaster.Checked) { if (GameData.gameType == MeType.ME1_TYPE) { log += "Remove mipmaps started..." + Environment.NewLine; updateStatusMipMaps("In progress..."); errors += mipMaps.removeMipMapsME1(1, textures, null, null, this, checkBoxPreEnableRepack.Checked); errors += mipMaps.removeMipMapsME1(2, textures, null, null, this, checkBoxPreEnableRepack.Checked); checkBoxMipMaps.Checked = true; updateStatusMipMaps(""); log += "Remove mipmaps finished" + Environment.NewLine + Environment.NewLine; } else { log += "Remove mipmaps started..." + Environment.NewLine; updateStatusMipMaps("In progress..."); errors += mipMaps.removeMipMapsME2ME3(textures, null, null, this, checkBoxPreEnableRepack.Checked); checkBoxMipMaps.Checked = true; updateStatusMipMaps(""); log += "Remove mipmaps finished" + Environment.NewLine + Environment.NewLine; } } log += "Updating LODs and other settings started..." + Environment.NewLine; updateStatusLOD("In progress..."); string path = gameData.EngineConfigIniPath; bool exist = File.Exists(path); if (!exist) { Directory.CreateDirectory(Path.GetDirectoryName(path)); } ConfIni engineConf = new ConfIni(path); LODSettings.updateLOD((MeType)gameId, engineConf); LODSettings.updateGFXSettings((MeType)gameId, engineConf); checkBoxLOD.Checked = true; updateStatusLOD(""); log += "Updating LODs and other settings finished" + Environment.NewLine + Environment.NewLine; if (checkBoxPreEnableRepack.Checked) { log += "Repack started..." + Environment.NewLine; for (int i = 0; i < GameData.packageFiles.Count; i++) { updateStatusRepackZlib("Repacking PCC files... " + ((i + 1) * 100 / GameData.packageFiles.Count) + " %"); Package package = new Package(GameData.packageFiles[i], true, true); if (package.compressed && package.compressionType != Package.CompressionType.Zlib) { package.Dispose(); package = new Package(GameData.packageFiles[i]); package.SaveToFile(true); } } checkBoxRepackZlib.Checked = true; updateStatusRepackZlib(""); log += "Repack finished" + Environment.NewLine + Environment.NewLine; } if (checkBoxPreEnablePack.Checked) { if (Directory.Exists(GameData.DLCData)) { TOCBinFile.UpdateAllTOCBinFiles(); log += "Repack started..." + Environment.NewLine; updateStatusPackDLC("In progress..."); List <string> DLCs = Directory.GetDirectories(GameData.DLCData).ToList(); for (int i = 0; i < DLCs.Count; i++) { List <string> files = Directory.GetFiles(DLCs[i], "Mount.dlc", SearchOption.AllDirectories).ToList(); if (files.Count == 0) { DLCs.RemoveAt(i--); } } string tmpDlcDir = Path.Combine(GameData.GamePath, "BIOGame", "DLCTemp"); for (int i = 0; i < DLCs.Count; i++) { string DLCname = Path.GetFileName(DLCs[i]); string outPath = Path.Combine(tmpDlcDir, DLCname, "CookedPCConsole", "Default.sfar"); ME3DLC dlc = new ME3DLC(null); dlc.fullRePack(DLCs[i], outPath, DLCname, null, this); } Directory.Delete(GameData.DLCData, true); Directory.Move(tmpDlcDir, GameData.DLCData); updateStatusPackDLC(""); log += "Repack started finished" + Environment.NewLine + Environment.NewLine; } checkBoxPackDLC.Checked = true; } var time = Misc.stopTimer(); labelFinalStatus.Text = "Process finished. Process total time: " + Misc.getTimerFormat(time); buttonExit.Enabled = true; buttonNormal.Enabled = true; log += "==========================================" + Environment.NewLine; log += "LOD settings:" + Environment.NewLine; LODSettings.readLOD((MeType)gameId, engineConf, ref log); log += "==========================================" + Environment.NewLine; string filename = "install-log.txt"; if (File.Exists(filename)) { File.Delete(filename); } using (FileStream fs = new FileStream(filename, FileMode.CreateNew)) { fs.WriteStringASCII(log); } filename = "errors-install.txt"; if (File.Exists(filename)) { File.Delete(filename); } if (errors != "") { using (FileStream fs = new FileStream(filename, FileMode.CreateNew)) { fs.WriteStringASCII(errors); } MessageBox.Show("WARNING: Some errors have occured!"); Process.Start(filename); } }