Beispiel #1
0
        private void modMakerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ModMaker modmaker = new ModMaker();

            //OpenMaximized(modmaker);
            modmaker.Show();
            taskbar.AddTool(modmaker, Properties.Resources.modmaker_64x64, true);
        }
        public CreateJobFromPCCDiff()
        {
            ModmakerParent = ModMaker.GetCurrentInstance().Result;
            if (ModmakerParent == null)
                return;

            
            InitializeComponent();
            vm = new CreateModPCCVM();
            DataContext = vm;
        }
Beispiel #3
0
        public CreateJobFromPCCDiff()
        {
            ModmakerParent = ModMaker.GetCurrentInstance().Result;
            if (ModmakerParent == null)
            {
                return;
            }


            InitializeComponent();
            vm          = new CreateModPCCVM();
            DataContext = vm;
        }
Beispiel #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            taskbar.strip = toolStrip1; //this be a toolstrip reference to class taskbar
            string loc = Path.GetDirectoryName(Application.ExecutablePath);

            lang = new Languages(loc + "\\exec\\languages.xml", 0);
            lang.SetLang(this);
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                AttachConsole(ATTACH_PARENT_PROCESS);
                if (args[1].Equals("-version-switch-from") && args.Length == 3)
                {
                    string version = Assembly.GetExecutingAssembly().GetName().Version.Build.ToString();
                    if (version.Equals(args[2]))
                    {
                        MessageBox.Show("Version switched to is the same as the one you had before the switch.");
                    }
                    else
                    {
                        MessageBox.Show("Version switched: " + args[2] + " => " + version);
                    }
                }
                else
                //automation
                if (args[1].Equals("-dlcinject") || args[1].Equals("-dlcextract") || args[1].Equals("-dlcaddfiles") || args[1].Equals("-dlcremovefiles") || args[1].Equals("-dlcunpack") || args[1].Equals("-dlcunpack-nodebug"))
                {
                    //autostart DLC editor 2 (used by FemShep's Mod Manager 3/3.1+)
                    //saves a little duplicate code
                    dLCEditor2ToolStripMenuItem.PerformClick();
                    return;
                }
                else
                if (args[1].Equals("-toceditorupdate"))
                {
                    //autostart the TOCEditor (used by FemShep's Mod Manager 3)
                    //saves a little duplicate code
                    tOCbinEditorToolStripMenuItem.PerformClick();
                    return;
                }
                if (args[1].Equals("-autotoc"))
                {
                    //autostart the AutoTOC Tool (uses a path) (used by FemShep's Mod Manager 3)
                    //saves a little duplicate code
                    autoTOCToolStripMenuItem.PerformClick();
                    return;
                }
                else
                if (args[1].Equals("-decompresspcc"))
                {
                    //autostart the TOCEditor (used by FemShep's Mod Manager 3.2)
                    //saves a little duplicate code
                    pCCRepackerToolStripMenuItem.PerformClick();
                    return;
                }
                else
                if (args[1].Equals("--help") || args[1].Equals("-h") || args[1].Equals("/?"))
                {
                    String[] version         = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.');
                    String   commandLineHelp = "\nME3Explorer r" + version[2] + " Command Line Options\n";
                    commandLineHelp += " -decompresspcc pccPath.pcc decompressedPath.pcc\n";
                    commandLineHelp += "     Automates PCCRepacker to decompress a pcc to the new location.\n\n";
                    commandLineHelp += " -dlcinject DLC.sfar SearchTerm PathToNewFile [SearchTerm2 PathToNewFile2]...\n";
                    commandLineHelp += "     Automates injecting pairs of files into a .sfar file using DLCEditor2. SearchTerm is a value you would type into the searchbox with the first result being the file that will be replaced.\n\n";
                    commandLineHelp += " -dlcextract DLC.sfar SearchTerm ExtractionPath\n";
                    commandLineHelp += "     Automates DLCEditor2 to extract the specified SearchTerm. SearchTerm is a value you would type into the searchbox with the first result being the file that will be extracted. The file is extracted to the specied ExtractionPath.\n\n";
                    commandLineHelp += " -dlcaddfiles DLC.sfar InternalPath NewFile [InternalPath2 NewFile2]...\n";
                    commandLineHelp += "     Automates DLCEditor2 to add the specified new files. InternalPath is the internal path in the SFAR the file NewFile will be placed at.\n\n";
                    commandLineHelp += " -dlcremovefiles DLC.sfar SearchTerm [SearchTerm2]...\n";
                    commandLineHelp += "     Automates removing a file or list of files from a DLC. SearchTerm is a value you would type into the Searchbox with the first result being the file that will be removed.\n\n";
                    commandLineHelp += " -dlcunpack DLC.sfar Unpackpath\n";
                    commandLineHelp += "     Automates unpacking an SFAR file to the specified directory. Shows the debug interface to show progress. To unpack a game DLC for use by the game, unpack to the Mass Effect 3 directory. Unpacking Patch_001.sfar will cause the game to crash at startup.\n\n";
                    commandLineHelp += " -dlcunpack-nodebug DLC.sfar Unpackpath\n";
                    commandLineHelp += "     Same as -dlcunpack but does not show the debugging interface.\n\n";
                    commandLineHelp += " -toceditorupdate PCConsoleTOCFile.bin SearchTerm size\n";
                    commandLineHelp += "     Automates DLCEditor2 to extract the specified SearchTerm. SearchTerm is a value you would type into the searchbox with the first result being the file that will be extracted. The file is extracted to the specied ExtractionPath.\n\n";
                    System.Console.WriteLine(commandLineHelp);
                    Environment.Exit(0);
                    Application.Exit();
                    return;
                }

                string ending = Path.GetExtension(args[1]).ToLower();
                switch (ending)
                {
                case ".pcc":
                    PCCEditor2 editor = new PCCEditor2();
                    editor.MdiParent = this;
                    editor.Show();
                    editor.WindowState = FormWindowState.Maximized;
                    editor.LoadFile(args[1]);
                    break;

                case ".txt":
                    ScriptCompiler sc = new ScriptCompiler();
                    sc.MdiParent = this;
                    sc.rtb1.LoadFile(args[1]);
                    sc.Compile();
                    sc.Show();
                    sc.WindowState = FormWindowState.Maximized;
                    break;

                case ".mod":
                    ModMaker m = new ModMaker();
                    m.Show();
                    string[] s = new string[1];
                    s[0] = args[1];
                    //m.LoadMods(s);
                    m.WindowState = FormWindowState.Maximized;
                    break;
                }
            }

            if (!String.IsNullOrEmpty(Properties.Settings.Default.ME3InstallDir))
            {
                ME3Directory.GamePath(Properties.Settings.Default.ME3InstallDir);
            }
            if (!String.IsNullOrEmpty(Properties.Settings.Default.ME2InstallDir))
            {
                ME2Directory.GamePath(Properties.Settings.Default.ME2InstallDir);
            }
            if (!String.IsNullOrEmpty(Properties.Settings.Default.ME1InstallDir))
            {
                ME1Directory.GamePath(Properties.Settings.Default.ME1InstallDir);
            }

            var vers = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.');

            versionToolStripMenuItem.Text += "0110 (r" + vers[2] + ")";
            versionToolStripMenuItem.Tag   = "versionItem";
            menuStrip1.Renderer            = new NoHighlightRenderer();
        }
Beispiel #5
0
        private void modMakerToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            ModMaker modmaker = new ModMaker();

            modmaker.Show();
        }
        private void LoadMOD(string filename)
        {
            ModMaker modmaker = new ModMaker();
            string basetemppath = Path.Combine(TemporaryPath, "MOD CONVERSION");

            // KFreon: Setup temp folder
            for (int i = 0; i < 3; i++)
                try
                {
                    if (Directory.Exists(basetemppath))
                        Directory.Delete(basetemppath);
                    else
                        break;
                }
                catch
                {
                    System.Threading.Thread.Sleep(100);
                }
            Directory.CreateDirectory(basetemppath);

            // KFreon: Load mods
            Overall.UpdateText("Loading Mod: " + filename);
            int nummods;
            modmaker.LoadMods(new string[] { filename }, out nummods, true);
            Overall.UpdateText("Formatting/Updating .mods...");
            bool conflict;
            var result = modmaker.FormatJobs(true, true, out conflict);
            // Heff: prompt user to chose version and re-run with version chosen
            if (conflict)
            {
                this.Invoke(new Action(() =>
                {
                    var gameVers = VersionPickDialog.AskForGameVersion(this, message: "Could not detect game version, the files in this .mod were present in more than one game. \n"
                        + "Please choose the correct version:");
                    result = modmaker.FormatJobs(true, true, out conflict, gameVers);
                }));
            }

            if (result.Count == 0)
            {
                Overall.UpdateText("ERROR! See debug output.");
                OverallProg.ChangeProgressBar(0, 1);
                return;
            }

            List<TreeTexInfo> TreeTexes = Tree.GetTreeAsList();
            int count = 1;
            OverallProg.ChangeProgressBar(0, nummods);
            foreach (KFreonLib.Scripting.ModMaker.ModJob job in KFreonLib.Scripting.ModMaker.JobList)
            {
                if (cts.IsCancellationRequested)
                    break;

                if (job.JobType != "TEXTURE")
                    DebugOutput.PrintLn("Job:" + job.Name + " isn't a texture job. Ignoring...");
                else
                {
                    Overall.UpdateText("Converting job: " + count++ + " of " + nummods);

                    // KFreon: Change Trees if necessary
                    if (WhichGame != job.WhichGame)
                        ChangeTrees(job.WhichGame);   // wait here?

                    uint inthash = KFreonLib.Textures.Methods.FindHashByName(job.Texname, job.PCCs, job.ExpIDs, TreeTexes);
                    string hash = KFreonLib.Textures.Methods.FormatTexmodHashAsString(inthash);

                    if (hash == "0")
                        DebugOutput.PrintLn("Unable to find hash for " + job.Texname + ". Continuing...");
                    else
                    {
                        string newname = "MASSEFFECT" + WhichGame + ".EXE_" + hash + ".dds";
                        string newpath = Path.Combine(basetemppath, newname);
                        File.WriteAllBytes(newpath, job.data);
                        LoadExternal(newpath, false);
                    }
                }
            }

            if (!cts.IsCancellationRequested)
                Overall.UpdateText("Loaded " + (count - 1) + " jobs out of " + KFreonLib.Scripting.ModMaker.JobList.Count + " from Modmaker.");
            else
                Overall.UpdateText("Mod loading cancelled!");
            OverallProg.ChangeProgressBar(1, 1);
            RedrawTreeView();
        }
        private void LoadMOD(string filename)
        {
            ModMaker modmaker = new ModMaker();
            string basetemppath = Path.Combine(TemporaryPath, "MOD CONVERSION");

            // KFreon: Setup temp folder
            for (int i = 0; i < 3; i++)
                try
                {
                    if (Directory.Exists(basetemppath))
                        Directory.Delete(basetemppath);
                    else
                        break;
                }
                catch
                {
                    System.Threading.Thread.Sleep(100);
                }
            Directory.CreateDirectory(basetemppath);

            // KFreon: Load mods
            Overall.UpdateText("Loading Mod: " + filename);
            int nummods;
            modmaker.LoadMods(new string[] { filename }, out nummods, true);
            Overall.UpdateText("Formatting/Updating .mods...");
            modmaker.FormatJobs(true, true);


            List<TreeTexInfo> TreeTexes = Tree.GetTreeAsList();
            int count = 1;
            OverallProg.ChangeProgressBar(0, nummods);
            foreach (KFreonLib.Scripting.ModMaker.ModJob job in KFreonLib.Scripting.ModMaker.JobList)
            {
                if (cts.IsCancellationRequested)
                    break;

                if (job.JobType != "TEXTURE")
                    DebugOutput.PrintLn("Job:" + job.Name + " isn't a texture job. Ignoring...");
                else
                {
                    Overall.UpdateText("Converting job: " + count++ + " of " + nummods);

                    // KFreon: Change Trees if necessary
                    if (WhichGame != job.WhichGame)
                        ChangeTrees(job.WhichGame);   // wait here?

                    uint inthash = KFreonLib.Textures.Methods.FindHashByName(job.Texname, job.PCCs, job.ExpIDs, TreeTexes);
                    string hash = KFreonLib.Textures.Methods.FormatTexmodHashAsString(inthash);

                    if (hash == "0")
                        DebugOutput.PrintLn("Unable to find hash for " + job.Texname + ". Continuing...");
                    else
                    {
                        string newname = "MASSEFFECT" + WhichGame + ".EXE_" + hash + ".dds";
                        string newpath = Path.Combine(basetemppath, newname);
                        File.WriteAllBytes(newpath, job.data);
                        LoadExternal(newpath, false);
                    }
                }
            }

            if (!cts.IsCancellationRequested)
                Overall.UpdateText("Loaded " + (count - 1) + " jobs out of " + KFreonLib.Scripting.ModMaker.JobList.Count + " from Modmaker.");
            else
                Overall.UpdateText("Mod loading cancelled!");
            OverallProg.ChangeProgressBar(1, 1);
            RedrawTreeView();
        }