Exemple #1
0
        public static void OpenAllPaks(List <string> listfiles)
        {
            List <string> allfiles = new List <string>();

            foreach (string file in listfiles)
            {
                string        safefile = Path.GetFileName(file);
                List <string> pakfiles = Pak.Open(file, safefile);
                allfiles.AddRange(pakfiles);
            }

            FormGameTools2.ListFiles(allfiles);
        }
Exemple #2
0
        public override void Open(OpenFileDialog openFileDialog, bool export = false, bool useGTFSView = false)
        {
            openFileDialog.FileName = "";
            openFileDialog.Filter   = "All PS2|*.pak;*.raw|"
                                      + "PS2 Raw|*.raw|"
                                      + "Pak|*.pak|"
                                      + "All Files (*.*)|*.*";

            DialogResult res = openFileDialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                string[] filenameParts = openFileDialog.SafeFileName.Split('.');
                Array.Reverse(filenameParts);

                if (filenameParts[0].ToUpper() == "PAK")
                {
                    List <string> files = Pak.Open(openFileDialog.FileName, openFileDialog.SafeFileName);
                    FormGameTools2.ListFiles(files);
                }
                else if (filenameParts[0].ToUpper() == "RAW")
                {
                    GTFS   fs      = new GTFS(openFileDialog.FileName);
                    byte[] bHeader = GT.ReadBytes(fs, 4, false);

                    if ((bHeader[0] == 0x10 && bHeader[1] == 0x00 && bHeader[2] == 0x00 && bHeader[3] == 0x00) || //PS2 object
                        (bHeader[0] == 0x20 && bHeader[1] == 0x00 && bHeader[2] == 0x00 && bHeader[3] == 0x00))   //PS2 level
                    {
                        ModelPS2 model = new ModelPS2(openFileDialog.FileName, openFileDialog.SafeFileName, useGTFSView);
                        FormGameTools2.UseViewer(model);
                    }
                    else if ((bHeader[0] == 0x01 && bHeader[1] == 0x00 && bHeader[2] == 0x00 && bHeader[3] == 0x00) ||
                             (bHeader[0] == 0x03 && bHeader[1] == 0x00 && bHeader[2] == 0x00 && bHeader[3] == 0x00))
                    {
                        TexturePS2 texture = new TexturePS2(openFileDialog.FileName, openFileDialog.SafeFileName, useGTFSView);
                        new GameTools3D.FormTextureView(texture).Show();
                    }
                    else
                    {
                        MessageBox.Show("Unknown header (hex): " + GT.ByteArrayToString(bHeader, " "));
                    }
                }
                else
                {
                    MessageBox.Show("Unexpected file extension: " + filenameParts[0]);
                }
            }
        }
Exemple #3
0
        public override void Open(OpenFileDialog openFileDialog, bool export = false, bool useGTFSView = false)
        {
            openFileDialog.FileName = "";
            openFileDialog.Filter   = "All Xbox|*.pak;*.xbr;*.xbt|"
                                      + "Xbox Resource|*.xbr|"
                                      + "Xbox Texture|*.xbt|"
                                      + "Pak|*.pak|"
                                      + "All Files (*.*)|*.*";

            DialogResult res = openFileDialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                string[] filenameParts = openFileDialog.SafeFileName.Split('.');
                Array.Reverse(filenameParts);

                if (filenameParts[0].ToUpper() == "PAK")
                {
                    List <string> files = Pak.Open(openFileDialog.FileName, openFileDialog.SafeFileName);
                    FormGameTools2.ListFiles(files);
                }
                else if (filenameParts[0].ToUpper() == "XBR")
                {
                    ModelXbox model = new ModelXbox(openFileDialog.FileName, openFileDialog.SafeFileName, useGTFSView);
                    if (export)
                    {
                        new GameTools3D.Formats.ColladaExporter(model);
                    }
                    FormGameTools2.UseViewer(model);
                }
                else if (filenameParts[0].ToUpper() == "XBT")
                {
                    TextureXbox texture = new TextureXbox(openFileDialog.FileName, openFileDialog.SafeFileName, useGTFSView);
                    new GameTools3D.FormTextureView(texture).Show();
                }
                else
                {
                    MessageBox.Show("Unexpected file extension: " + filenameParts[0]);
                }
            }
        }
Exemple #4
0
 public override void OpenAllPaks(List <string> dirfiles)
 {
     Pak.OpenAllPaks(dirfiles);
 }