コード例 #1
0
ファイル: Program.cs プロジェクト: efonte/PeaceWalkerTools
        private static void Process(string[] args)
        {
            if (args.Length == 0)
            {
                return;
            }

            foreach (var path in args)
            {
                if (File.Exists(path))
                {
                    var ext = Path.GetExtension(path);

                    switch (ext)
                    {
                    case ".dar":
                    {
                        DAR.Unpack(path);
                        break;
                    }

                    case ".qar":
                    {
                        QAR.Unpack(path);
                        break;
                    }

                    case ".txp":
                    {
                        TXP.Unpack(path);
                        break;
                    }

                    case ".inf":
                    {
                        Pack(path);
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Misc.cs プロジェクト: efonte/PeaceWalkerTools
        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();
        }