Esempio n. 1
0
        public override void Open(OpenFileDialog openFileDialog, bool export = false, bool useGTFSView = false)
        {
            openFileDialog.FileName = "";
            openFileDialog.Filter   = "All PC|*.pak;*.raw|"
                                      + "PC 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
                {
                    MessageBox.Show("Unexpected file extension: " + filenameParts[0]);
                }
            }
        }
Esempio n. 2
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);
        }
Esempio n. 3
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]);
                }
            }
        }
Esempio n. 4
0
        public override void Open(OpenFileDialog openFileDialog, bool export = false, bool useGTFSView = false)
        {
            openFileDialog.FileName = "";
            openFileDialog.Filter   = "All Yesterday|*.obb;*.*|"
                                      + "Android Archive (*.obb)|*.obb|"
                                      + "All Files (*.*)|*.*";

            DialogResult res = openFileDialog.ShowDialog();

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

                if (filenameParts[0].ToUpper() == "OBB")
                {
                    List <string> files = OBB.Open(openFileDialog.FileName, openFileDialog.SafeFileName);
                    FormGameTools2.ListFiles(files);
                }
                else if (openFileDialog.SafeFileName[0] == 'V' || openFileDialog.SafeFileName == "RESOURCE.B31" || openFileDialog.SafeFileName == "RESOURCE.CRD")
                {
                    Video.Open(openFileDialog.FileName, openFileDialog.SafeFileName);
                }
                else if (filenameParts[1].Contains("DATAA") || filenameParts[0].Contains("S0"))
                {
                    Audio.Open(openFileDialog.FileName, openFileDialog.SafeFileName);
                }
                else if (filenameParts[1].Contains("RESOURCE") || filenameParts[0].Contains("SP"))
                {
                    ResourceImage.Open(openFileDialog.FileName, openFileDialog.SafeFileName);
                }
                else if (filenameParts[1].Contains("RESOURCE") &&
                         filenameParts[0] != "003" &&
                         filenameParts[0] != "TAB" &&
                         filenameParts[0] != "FNT" &&
                         filenameParts[0] != "DIS" &&
                         (filenameParts[0][0] != 'S' && filenameParts[0][0] != 'P') //Not sure what these are at all...
                         )
                {
                    //Resource
                    ResourceImage.Open(openFileDialog.FileName, openFileDialog.SafeFileName);
                }
                else
                {
                    MessageBox.Show("Unexpected file extension: " + filenameParts[0]);
                }
            }
        }
Esempio n. 5
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]);
                }
            }
        }
Esempio n. 6
0
        public override void Open(OpenFileDialog openFileDialog, bool export = false, bool useGTFSView = false)
        {
            openFileDialog.FileName = "";
            openFileDialog.Filter   = "All GameCube|*.pak;*.gcr;*.gct|"
                                      + "GameCube Resource|*.gcr|"
                                      + "GameCube Texture|*.gct|"
                                      + "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() == "GCR")
                {
                    //ModelGCN model = new ModelGCN(openFileDialog.FileName, openFileDialog.SafeFileName);
                    //FormGameTools2.UseViewer(model);
                }
                else if (filenameParts[0].ToUpper() == "GCT")
                {
                    //TextureGCN texture = new TextureGCN(openFileDialog.FileName, openFileDialog.SafeFileName);
                    //new GameTools3D.FormTextureView(texture).Show();
                }
                else
                {
                    MessageBox.Show("Unexpected file extension: " + filenameParts[0]);
                }
            }
        }