Example #1
0
        private void DoSA2PCSplit(ProgressDialog progress, string gameFolder, string iniFolder, string outputFolder)
        {
            // split data dll
            #region Split Data DLL

            progress.StepProgress();
            progress.SetStep("Splitting Data DLL");

            SplitData dllSplitData = new SplitData();

            if (File.Exists(Path.Combine(gameFolder, "resource/gd_PC/DLL/Win32/Data_DLL_orig.dll")))
            {
                dllSplitData = new SplitData()
                {
                    dataFile = "resource/gd_PC/DLL/Win32/Data_DLL_orig.dll",
                    iniFile  = "data_dll.ini"
                };
            }
            else
            {
                dllSplitData = new SplitData()
                {
                    dataFile = "resource/gd_PC/DLL/Win32/Data_DLL.dll",
                    iniFile  = "data_dll.ini"
                };
            }

            SplitData_Sub(dllSplitData, progress, gameFolder, iniFolder, outputFolder);
            #endregion

            // run split mdl commands
            progress.StepProgress();
            progress.SetStep("Splitting character model files");

            foreach (SplitMDLData splitMDL in sa2PCSplitMDL)
            {
                string filePath         = Path.Combine(gameFolder, splitMDL.dataFile);
                string fileOutputFolder = Path.GetDirectoryName(Path.Combine(outputFolder, splitMDL.dataFile));
                Directory.CreateDirectory(fileOutputFolder);

                SA_Tools.SAArc.sa2MDL.Split(splitMDL.isBigEndian, filePath,
                                            fileOutputFolder, splitMDL.animationFiles);
            }

            // split sonic2app
            #region Split sonic2app
            {
                progress.StepProgress();
                progress.SetStep("Splitting Sonic2App");

                SplitData_Sub(sonic2AppSplit, progress, gameFolder, iniFolder, outputFolder);
            }
            #endregion
        }
Example #2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            using (ProgressDialog progress = new ProgressDialog("Splitting", splitControls.Count, false, true))
            {
                foreach (SplitUIControl splitControl in splitControls)
                {
                    string shortName = Path.GetFileName(splitControl.GetFilePath());

                    progress.SetStep(shortName);

                    string outputFolder = splitControl.GetOutputFolder();

                    SplitType splitType = splitControl.GetSplitType();

                    switch (splitType)
                    {
                    case SplitType.BinDLL:
                        // do our normal split
                        SplitData splitData = new SplitData()
                        {
                            dataFile = splitControl.GetFilePath(),
                            iniFile  = splitControl.GetDataMappingPath()
                        };

                        string oldEnvironment = Environment.CurrentDirectory;

                        Environment.CurrentDirectory = Path.GetDirectoryName(splitData.dataFile);
                        BinSplitData_Sub(splitData, outputFolder);

                        break;

                    case SplitType.MDL:
                        SA_Tools.SAArc.sa2MDL.Split(splitControl.IsBigEndian(), splitControl.GetFilePath(),
                                                    outputFolder, splitControl.AnimFiles);
                        break;

                    case SplitType.MTN:
                        // use the command line split
                        break;

                    case SplitType.NB:
                        // use the command line split
                        break;

                    default:
                        break;
                    }

                    progress.StepProgress();
                }
            }
        }
Example #3
0
        private void DoSADXSplit(ProgressDialog progress, string gameFolder, string iniFolder, string outputFolder)
        {
            progress.StepProgress();
            progress.SetStep("Splitting EXE & DLLs");

            foreach (SplitData splitData in sadxpcsplits)
            {
                SplitData_Sub(splitData, progress, gameFolder, iniFolder, outputFolder);
            }

            // do our last split, chrmodels
            SplitData chrmodelsSplitData = new SplitData();

            if (File.Exists(Path.Combine(gameFolder, "system/CHRMODELS_orig.dll")))
            {
                chrmodelsSplitData = new SplitData()
                {
                    dataFile = "system/CHRMODELS_orig.dll",
                    iniFile  = "chrmodels.ini"
                };
            }
            else
            {
                chrmodelsSplitData = new SplitData()
                {
                    dataFile = "system/CHRMODELS.dll",
                    iniFile  = "chrmodels.ini"
                };
            }

            SplitData_Sub(chrmodelsSplitData, progress, gameFolder, iniFolder, outputFolder);

            // copy sadxlvl.ini
            string sadxlvlIniSourcePath = Path.GetFullPath(Path.Combine(iniFolder, "sadxlvl.ini"));
            string sadxlvlIniOutputPath = Path.GetFullPath(Path.Combine(outputFolder, "sadxlvl.ini"));

            File.Copy(sadxlvlIniSourcePath, sadxlvlIniOutputPath, true);

            // copy objdefs.ini
            File.Copy(Path.Combine(iniFolder, "objdefs.ini"), Path.Combine(outputFolder, "objdefs.ini"), true);

            // copy objdefs files (this needs to be turned into a recursive folder copy)
            string objdefsPath       = GetObjDefsDirectory();
            string outputObjdefsPath = Path.Combine(outputFolder, "objdefs");

            CopyFolder(objdefsPath, outputObjdefsPath);
        }
Example #4
0
        private void BinSplitData_Sub(SplitData splitData, string outputFolder)
        {
            string datafilename      = splitData.dataFile;
            string inifilename       = splitData.iniFile;
            string projectFolderName = outputFolder;

            if (projectFolderName[projectFolderName.Length - 1] != '/')
            {
                projectFolderName = string.Concat(projectFolderName, '/');
            }

            #region Validating Inputs
            if (!File.Exists(datafilename))
            {
                Console.WriteLine(datafilename + " not found. Aborting.");
                Console.WriteLine("Press any key to exit.");
                Console.ReadLine();

                throw new Exception(SA_Tools.Split.SplitERRORVALUE.NoSourceFile.ToString());
                //return (int)ERRORVALUE.NoSourceFile;
            }

            if (!File.Exists(inifilename))
            {
                Console.WriteLine(inifilename + " not found. Aborting.");
                Console.WriteLine("Press any key to exit.");
                Console.ReadLine();

                throw new Exception(SA_Tools.Split.SplitERRORVALUE.NoDataMapping.ToString());
                //return (int)ERRORVALUE.NoDataMapping;
            }

            if (!Directory.Exists(projectFolderName))
            {
                // try creating the directory
                bool created = true;

                try
                {
                    // check to see if trailing charcter closes
                    Directory.CreateDirectory(projectFolderName);
                }
                catch
                {
                    created = false;
                }

                if (!created)
                {
                    // couldn't create directory.
                    Console.WriteLine("Output folder did not exist and couldn't be created.");
                    Console.WriteLine("Press any key to exit.");
                    Console.ReadLine();

                    throw new Exception(SA_Tools.Split.SplitERRORVALUE.InvalidProject.ToString());
                    //return (int)ERRORVALUE.InvalidProject;
                }
            }
            #endregion

            // switch on file extension - if dll, use dll splitter
            System.IO.FileInfo fileInfo = new System.IO.FileInfo(datafilename);

            int result = (fileInfo.Extension.ToLower().Contains("dll")) ? SA_Tools.SplitDLL.SplitDLL.SplitDLLFile(datafilename, inifilename, projectFolderName) :
                         SA_Tools.Split.Split.SplitFile(datafilename, inifilename, projectFolderName);
        }