Пример #1
0
 private void makeinsert_Click(object sender, EventArgs e)
 {
     PatchMaker pm = new PatchMaker(ROM.romfile.Directory);
     pm.restore();
     pm.compilePatch();
     pm.generatePatch();
 }
Пример #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            TraceListener log = new TextWriterTraceListener("NSMBe4-log.txt");
            Trace.Listeners.Add(log);
            Trace.Listeners.Add(new ConsoleTraceListener());

            string langDir = System.IO.Path.Combine(Application.StartupPath, "Languages");
            string langFileName = System.IO.Path.Combine(langDir, Properties.Settings.Default.LanguageFile + ".ini");
            if (System.IO.File.Exists(langFileName))
            {
                System.IO.StreamReader rdr = new StreamReader(langFileName);
                LanguageManager.Load(rdr.ReadToEnd().Split('\n'));
                rdr.Close();
            }
            else
            {
                MessageBox.Show("File " + langFileName + " could not be found, so the language has defaulted to English.");
                LanguageManager.Load(Properties.Resources.english.Split('\n'));
            }

            //This makes the editor behave BAD when no internet.
            //This actually catches the error now, but I'm leaving it disabled because the Sprite DB outputs a corrupt file

            //if (Properties.Settings.Default.AutoUpdateSD)
            //    SpriteData.update();

            string path = "";
            string[] args = Environment.GetCommandLineArgs();

            if (args.Length > 1)
                path = args[1];
            else
            {
                OpenFileDialog openROMDialog = new OpenFileDialog();
                openROMDialog.Filter = LanguageManager.Get("LevelChooser", "ROMFilter");
                if (openROMDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    path = openROMDialog.FileName;
            }

            if (path != "")
            {
                try
                {
                    ROM.load(path);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not open ROM file for writing. Is it open with other program?\n"+ex.Message);
                    return;
                }

                if(args.Length > 2 && args[2] == "asmpatch")
                {
                    PatchMaker pm = new PatchMaker(ROM.romfile.Directory);
                    pm.generatePatch();
                }
                else if(args.Length > 2 && args[2] == "getcodeaddr")
                {
                    PatchMaker pm = new PatchMaker(ROM.romfile.Directory);
                    Console.Out.WriteLine(String.Format("{0:X8}", pm.getCodeAddr()));
                }
                else
                {
                    SpriteData.Load();
                    if (Properties.Settings.Default.mdi)
                        Application.Run(new MdiParentForm());
                    else
                        Application.Run(new LevelChooser());
                }
            }
        }
Пример #3
0
 private void padarm7bin_Click(object sender, EventArgs e)
 {
     PatchMaker pm = new PatchMaker(ROM.romfile.Directory);
     pm.compilePatch();
     pm.generatePatch();
 }
Пример #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string langDir = System.IO.Path.Combine(Application.StartupPath, "Languages");
            string langFileName = System.IO.Path.Combine(langDir, Properties.Settings.Default.LanguageFile + ".ini");
            if (System.IO.File.Exists(langFileName))
            {
                System.IO.StreamReader rdr = new StreamReader(langFileName);
                LanguageManager.Load(rdr.ReadToEnd().Split('\n'));
                rdr.Close();
            }
            else
            {
                MessageBox.Show("File " + langFileName + " could not be found, so the language has defaulted to English.");
                LanguageManager.Load(Properties.Resources.English.Split('\n'));
            }

            //This makes the editor behave BAD when no internet.
            //This actually catches the error now, but I'm leaving it disabled because the Sprite DB outputs a corrupt file

            //if (Properties.Settings.Default.AutoUpdateSD)
            //    SpriteData.update();

            string path = "";
            string[] args = Environment.GetCommandLineArgs();
            string[] backups = null;

            if (Properties.Settings.Default.BackupFiles != "" &&
                MessageBox.Show("NSMBe did not shut down correctly and has recovered some of your levels.\nWould you like to open those now? If not, they can be opened later from the /Backup folder", "Open backups?", MessageBoxButtons.YesNo) == DialogResult.Yes) {
                backups = Properties.Settings.Default.BackupFiles.Split(';');
                path = backups[0];
            }
            else if (args.Length > 1)
                path = args[1];
            else
            {
                OpenFileDialog openROMDialog = new OpenFileDialog();
                openROMDialog.Filter = LanguageManager.Get("LevelChooser", "ROMFilter");
                if (openROMDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    path = openROMDialog.FileName;
            }

            if (path != "")
            {
            //                try
                {
                    ROM.load(path);
                }
              /*              catch (Exception ex)
                {
                    MessageBox.Show("Could not open ROM file for writing. Is it open with other program?\n\n"+ex.Message);
                    return;
                }
            */
                if(args.Length > 2 && args[2] == "asmpatch")
                {
                    PatchMaker pm = new PatchMaker(ROM.romfile.Directory);
                    pm.restore();
                    pm.generatePatch();
                }
                else if(args.Length > 2 && args[2] == "getcodeaddr")
                {
                    PatchMaker pm = new PatchMaker(ROM.romfile.Directory);
                    pm.restore();
                    Console.Out.WriteLine(String.Format("{0:X8}", pm.getCodeAddr()));
                }
                else
                {
                    if (backups != null)
                        for (int l = 1; l < backups.Length; l++)
                            ROM.fileBackups.Add(backups[l]);

                    SpriteData.Load();
                    if (Properties.Settings.Default.mdi)
                        Application.Run(new MdiParentForm());
                    else
                        Application.Run(new LevelChooser());
                }
            }
        }