Container for a sharptune instance
Exemplo n.º 1
0
        /// <summary>
        /// Determines which command to run.
        /// </summary>
        private static bool Run(string[] args)
        {
            if (args.Length < 1)
            {
                SharpTune.Program.RomModGui();
                return(true);
            }

            SharpTuner.Init();

            if (args[0] == "convtools")
            {
                return(ConvTool.Run(Utils.ShiftLeftTruncate(args)));
            }
            else if (args[0] == "rommod")
            {
                return(SharpTune.RomMod.RomMod.Run(Utils.ShiftLeftTruncate(args)));
            }
            else if (args[0] == "xmltoidc")
            {
                //TODO FIX THIS!!
                //NSFW.XMLtoIDC.Run(args);
            }
            else if (args.Length == 2 && args[0] == "help")
            {
                PrintHelp(args[1]);
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Determines which command to run.
        /// </summary>
        private static bool Run(string[] args)
        {
            if (args.Length < 1)
            {
                SharpTune.Program.RomModGui();
                return(true);
            }

            SharpTuner.Init();

            if (args[0] == "ecumaptool")
            {
                return(EcuMapTool.Run(Utils.ShiftLeftTruncate(args)));
            }
            else if (args[0] == "rommod")
            {
                return(SharpTune.RomMod.RomMod.Run(Utils.ShiftLeftTruncate(args)));
            }
            else if (args[0] == "xmltoidc")
            {
                //TODO FIX THIS!!
                //NSFW.XMLtoIDC.Run(args);
            }
            else if (args.Length == 2 && args[0] == "help")
            {
                PrintHelp(args[1]);
                return(true);
            }
            else if (args[0] == "deftools")
            {
                Trace.WriteLine("Running definition tools!");
                return(DefinitionTools.DefinitionTool(args));
            }
            return(false);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Determines which command to run.
 /// </summary>
 private static bool Run(string[] args)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     sharpTuner = new SharpTuner();
     if (args.Length < 1)
     {
         Application.Run(sharpTuner.mainWindow);
         return(true);
     }
     else
     {
         sharpTuner.Init();
         if (args[0] == "ecumaptool")
         {
             return(EcuMapTool.Run(sharpTuner.AvailableDevices, Utils.ShiftLeftTruncate(args)));
         }
         else if (args[0] == "rommod")
         {
             return(SharpTune.RomMod.RomMod.Run(sharpTuner.AvailableDevices, Utils.ShiftLeftTruncate(args)));
         }
         else if (args[0] == "xmlconvertor")
         {
             ECU      di  = new ECU(sharpTuner, args[1]);
             XMLtoIDC xti = new XMLtoIDC(di);
             //TODO clean up this routine: xti.Run(args);
         }
         else if (args.Length == 2 && args[0] == "help")
         {
             PrintHelp_RomMod(args[1]);
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.toolStripStatusLabel1.Text = "SharpTune Version " + SharpTuner.Version;
            MessageBox.Show(@"
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    " + @"THIS SOFTWARE IS PROVIDED 'AS IS' AND WITHOUT ANY WARRANTY
    OF ANY KIND, WHETHER ORAL, WRITTEN, EXPRESS, IMPLIED OR STATUTORY, 
    INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
    
    " + @"Source code for this program and all included software, 
    patches, data, and information can be found at:
    http://github.com/Merp/SharpTune
    http://github.com/Merp/MerpMod
    http://github.com/Merp/SubaruDefs.", "SharpTune");
            // Instantiate the writer
            //TODO switch to traces instead of console redirection.
            _writer = new TextBoxStreamWriter(txtConsole);
            // Redirect the out Console stream
            Console.SetOut(_writer);
            SharpTuner.Init();
        }
Exemplo n.º 5
0
        public void openDeviceImage(string filename)
        {
            //Construct new romimage
            DeviceImage newImage = new DeviceImage(filename);

            if (newImage.CalId == null)
            {
                Trace.TraceWarning(String.Format("Unable to identify rom at {0}", newImage.FilePath.ToString()));
                MessageBox.Show("Unable to idenfity rom at " + newImage.FilePath.ToString());
                return;
            }
            foreach (DeviceImage image in SharpTuner.ImageList)
            {
                if (image.FilePath == filename)
                {
                    Console.Write("Rom is already open!");
                    return;
                }
            }
            this.closeDeviceImageToolStripMenuItem.Enabled = true;
            obfuscateCALIDToolStripMenuItem.Enabled        = true;
            SharpTuner.AddImage(newImage);
            this.openDeviceListBox.Items.Add(SharpTuner.ActiveImage.FileName);
            Trace.WriteLine("Successfully opened " + SharpTuner.ActiveImage.CalId + " filename: " + SharpTuner.ActiveImage.FileName);
            Refresh();
        }
Exemplo n.º 6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     this.toolStripStatusLabel1.Text = "SharpTune Version " + SharpTuner.Version;
     MessageBox.Show("THIS SOFTWARE IS PROVIDED 'AS IS' AND WITHOUT ANY WARRANTY OF ANY KIND, WHETHER ORAL, WRITTEN, EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.", "SharpTune");
     // Instantiate the writer
     //TODO switch to traces instead of console redirection.
     _writer = new TextBoxStreamWriter(txtConsole);
     // Redirect the out Console stream
     Console.SetOut(_writer);
     SharpTuner.Init();
 }
Exemplo n.º 7
0
        private void definitionLocationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog d = new FolderBrowserDialog();

            if (SharpTuner.ActiveImage != null)
            {
                string path = SharpTuner.ActiveImage.ToString();
                d.SelectedPath = path;
            }
            DialogResult ret = Utils.STAShowFDialog(d);

            if (ret == DialogResult.OK)
            {
                Settings.Default.SubaruDefsRepoPath = d.SelectedPath.ToString();
                SharpTuner.Init();
                SharpTuner.RefreshImages();
            }
        }
Exemplo n.º 8
0
        private void manuallySelectPatchToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            //Open dialog to change patch file location
            //Then refresh patches

            FolderBrowserDialog d = new FolderBrowserDialog();
            //d.RootFolder = Environment.SpecialFolder.MyComputer;
            string path = Settings.Default.PatchPath;

            d.SelectedPath = path;

            //d.ShowDialog();
            DialogResult ret = Utils.STAShowFDialog(d);

            if (ret == DialogResult.OK)
            {
                Settings.Default.PatchPath = d.SelectedPath;
                SharpTuner.LoadMods();
                SharpTuner.InitSettings();
                SharpTuner.RefreshImages();
            }
        }
Exemplo n.º 9
0
        private static Random random = new Random((int)DateTime.Now.Ticks); //thanks to McAden

        #endregion Fields

        #region Constructors

        public CalidUtility(SharpTuner st, MainWindow mw)
        {
            this.sharpTuner = st;
            this.currentImage = st.activeImage;
            InitializeComponent();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// 
        public ECU(SharpTuner st, string fPath)
        {
            sharpTuner = st;
            FileInfo f = new FileInfo(fPath);
            this.FileSize = f.Length;
            this.FileName = f.Name;
            this.FilePath = fPath;
            this.FileDirectory = fPath.Replace(f.Name, "");
            
            TryOpenRom(fPath);

            if (this.CalId == null)
            {
                UndefinedWindow uw = new UndefinedWindow(sharpTuner, fPath);
                uw.ShowDialog();
                TryOpenRom(fPath);
            }
        }
Exemplo n.º 11
0
 public MainWindow(SharpTuner st)
 {
     sharpTuner = st;
     InitializeComponent();
 }
Exemplo n.º 12
0
 public CalidUtility(SharpTuner st, MainWindow mw)
 {
     this.sharpTuner   = st;
     this.currentImage = st.activeImage;
     InitializeComponent();
 }
Exemplo n.º 13
0
 public MainWindow(SharpTuner st)
 {
     sharpTuner = st;
     InitializeComponent();
 }
Exemplo n.º 14
0
 /// <summary>
 /// Determines which command to run.
 /// </summary>
 private static bool Run(string[] args)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     sharpTuner = new SharpTuner();
     if (args.Length < 1)
     {
         Application.Run(sharpTuner.mainWindow);
         return true;
     }
     else
     {
         sharpTuner.Init();
         if (args[0] == "ecumaptool")
         {
             return EcuMapTool.Run(sharpTuner.AvailableDevices, Utils.ShiftLeftTruncate(args));
         }
         else if (args[0] == "rommod")
         {
             return SharpTune.RomMod.RomMod.Run(sharpTuner.AvailableDevices, Utils.ShiftLeftTruncate(args));
         }
         else if (args[0] == "xmlconvertor")
         {
             ECU di = new ECU(sharpTuner, args[1]);
             XMLtoIDC xti = new XMLtoIDC(di);
             //TODO clean up this routine: xti.Run(args);
         }
         else if (args.Length == 2 && args[0] == "help")
         {
             PrintHelp_RomMod(args[1]);
             return true;
         }
     }
     return false;
 }