private static void Pack(string path) { var ext = Path.GetExtension(Path.GetFileNameWithoutExtension(path)); switch (ext) { case ".dar": { DAR.Pack(path); break; } case ".qar": { QAR.Pack(path); break; } default: break; } }
private void Misc() { UnpackStage(); foreach (var dar in Directory.GetFiles("STAGEDAT", "*.dar")) { DAR.Unpack(dar); } foreach (var qar in Directory.GetFiles("STAGEDAT", "*.qar")) { QAR.Unpack(qar); } return; return; //foreach (var file in Directory.GetFiles(@"SLOT\txp")) //{ // TXP.Extract(file); //} //using (var fs = File.OpenRead(@"D:\Projects\Sandbox\PeaceWalkerTools\PeaceWalkerTools\bin\Debug\_Extracted\291_54242D62.gcx")) //{ // var set = Briefing.ReadBriefingTitles(fs); //} //SaveSlotOlangExcel(); //SlotOlangUtility.ReplaceSlotOlang(); //foreach (var olang in Directory.GetFiles("SLOT_", "*.olang")) //{ // var olf = OlangFile.Read(olang); // SerializationHelper.Save(olf, olang + ".xml"); //} //SimplePDT.ExtractSimplePDTs(); SlotData.Unpack(@"E:\Peace Walker\PSP_GAME\USRDIR"); //Slot.Pack(@"E:\Peace Walker\PSP_GAME\USRDIR"); //foreach (var pdt in Directory.GetFiles(@"E:\Games\Emulators\PSP\memstick\PSP\SAVEDATA\NPJH50045DLC", "*.pdt")) //{ // var raw = File.ReadAllBytes(pdt); // var key = raw[0]; // for (int i = 0; i < raw.Length; i++) // { // raw[i] ^= key; // } // File.WriteAllBytes(pdt + ".dec", raw); //} return; ReplaceYPK(); //ReplaceOlang(); foreach (var dar in Directory.GetFiles("Extracted", "*.dar.inf")) { DAR.Pack(dar); } PackStage(); return; //OlangUtility.ReplaceText("Olang.xlsx", @".\olang"); //foreach (var item in Directory.GetFiles(@".\Extracted", "*.dar.inf")) //{ // DAR.Pack(item); //} //Slot.Read(@"E:\Peace Walker\PSP_GAME\USRDIR"); return; //Briefing.UnpackBriefing2(); //ExtractOlang(); //UnpackOlang(); //UnpackOlang(); //StageDataFile.Read(@"E:\Games\Metal Gear Solid\PW\Metal_Gear_Solid_Peace_Walker_USA\PSP_GAME\USRDIR\STAGEDAT.PDT"); //foreach (var file in Directory.GetFiles(@"D:\Projects\SandBox\TranslatePW\Font\bin\Debug\Extracted", "*.qar")) //{ // //DAR.Unpack(file); // QAR.Unpack(file); //} ////QAR.Extract(@"D:\Projects\SandBox\TranslatePW\Font\bin\Debug\Extracted\264_51AC44B4.qar"); //foreach (var file in Directory.GetFiles(@"D:\Projects\SandBox\TranslatePW\Font\bin\Debug\Extracted", "*.qar")) //{ // QAR.Extract(file); //} //foreach (var file in Directory.GetFiles(@"D:\Projects\SandBox\TranslatePW\Font\bin\Debug\Extracted", "*.txp", SearchOption.AllDirectories)) //{ // TXP.Unpack(file); //} return; //UnpackOlang(); //MergeOlang(); //TXP.Extract(@"D:\Projects\SandBox\TranslatePW\Font\bin\Debug\Extracted\001_3B69F53C_qar\owl_item_def.txp"); //TXP.Extract(@"D:\Projects\SandBox\TranslatePW\Font\bin\Debug\Extracted\216_F1C6B4F2_qar\w05s06r053_bwin_a0.txp"); //Replace(); //return; //var offset0 = 0; //3F800000 //var offset1 = 28;//5 //var offset2 = 1534176;//1 //var path = @"D:\Downloads\BaiduYunDownload\PWHD\disc0_rel\STAGEDAT.PDT"; //var path = @"E:\Peace Walker\PSP_GAME\USRDIR\stagedat.pdt"; //StageDataFile.Read(path); //StageDataFile.Decrypt(path); //var key4 = raw[3]; //for (int i = 0; i < raw.Length; i+=4) //{ // raw[i] = (byte)(raw[i] ^ key1); // raw[i+1] = (byte)(raw[i+1] ^ key2); // raw[i+2] = (byte)(raw[i+2] ^ key3); // raw[i+3] = (byte)(raw[i+3] ^ key4); //} //File.WriteAllBytes(@"E:\Games\Metal Gear Solid\Metal Gear Solid - Peace Walker\Metal Gear Solid Peace Walker GEN-D3\PSP_GAME\USRDIR\stagedat.pdt.dec", raw); //foreach (var file in Directory.GetFiles(@"E:\Games\Metal Gear Solid\Metal Gear Solid - Peace Walker\Metal Gear Solid Peace Walker GEN-D3\PSP_GAME\USRDIR\dlc")) //{ // var raw = File.ReadAllBytes(file); // var key = raw[0]; // for (int i = 0; i < raw.Length; i++) // { // raw[i] = (byte)(raw[i] ^ key); // } // File.WriteAllBytes(file + ".DEC", raw); //} //UnpackItem.Unpack(); //ReplaceSpecial(); //var location = @"E:\Games\Metal Gear Solid\Metal Gear Solid - Peace Walker\Metal Gear Solid Peace Walker GEN-D3\PSP_GAME\USRDIR"; //var fileName = "STAGEDAT.PDT"; //var raw = File.ReadAllBytes(Path.Combine(location,fileName)); //var raw2 = new byte[raw.Length-4]; //Buffer.BlockCopy(raw,4,raw2,0,raw2.Length); //ZlibStream.UncompressBuffer(raw2); //var font = new PGF(); //var data = File.ReadAllBytes(@"E:\Games\Emulators\PSP\flash0\font\jpn0.pgf"); //font.ReadPtr(data, data.Length); //UnpackBriefing(); //return; //UnpackBriefing2(); //Olang.DumpLang(); }
private static void Test() { //ReplaceSpiritOhd(); //return; //UnpackStage(); //var e = @"D:\Projects\Sandbox\PeaceWalkerTools\PeaceWalkerTools\bin\Debug\_Extracted\535_C9D05E75_qar\tgs_epigraph.txp"; //TXP.Unpack(e); //return; //foreach (var file in Directory.GetFiles(@"STAGEDAT", "*.txp", SearchOption.AllDirectories)) //{ // try // { // TXP.Unpack(file); // } // catch { } //} //TXP.Pack(@"STAGEDAT\C2D56E89_qar\tgs_epigraph.txp"); // 프롤로그 //TXP.Pack(@"STAGEDAT\9215ECCE_qar\chapter.txp"); // 서장 //TXP.Pack(@"STAGEDAT\8B049318_qar\chapter.txp"); // 챕터 //return; //foreach (var file in Directory.GetFiles(@"STAGEDAT", "*.qar")) //{ // QAR.Unpack(file); //} //foreach (var file in Directory.GetFiles(@"STAGEDAT", "*.txp", SearchOption.AllDirectories)) //{ // TXP.Unpack(file); //} //return; //SlotData.Unpack(Settings.SourceUserFolder); //foreach (var file in Directory.GetFiles("SLOT", "*.slot")) //{ // SlotFile.Unpack(file); //} Briefing.Repack(Settings.SourceUserFolder, Path.Combine(Settings.TranslationFolder, "Briefing.xlsx")); File.Copy(Path.Combine(Settings.SourceUserFolder, "BRIEFING.DAT"), Path.Combine(Settings.InstallFolder, "BRIEFING.DAT"), true); SlotOlangUtility.ReplaceText(Path.Combine(Settings.TranslationFolder, "SlotOlang.xlsx")); PackSlot(); OlangUtility.ReplaceText(Path.Combine(Settings.TranslationFolder, "Olang.xlsx"), Path.Combine(Settings.Working, @"Olang\New")); ReplaceYPK(); var stageLocation = Path.Combine(Settings.Working, "STAGEDAT"); ReplaceOlang(Path.Combine(Settings.Working, @"Olang\New"), stageLocation); foreach (var dar in Directory.GetFiles(stageLocation, "*.dar.inf")) { DAR.Pack(dar); } //foreach (var qar in Directory.GetFiles(stageLocation, "*.qar")) //{ // QAR.Unpack(qar); //} //foreach (var qar in Directory.GetFiles(stageLocation, "*.qar.inf")) //{ // QAR.Pack(qar); //} QAR.Pack(@"STAGEDAT\C2D56E89.qar.inf"); QAR.Pack(@"STAGEDAT\9215ECCE.qar.inf"); QAR.Pack(@"STAGEDAT\8B049318.qar.inf"); PackStage(); }