public virtual void Read(ECU image) { //TODO, pull this ot and make as extension to generic axis //remove "scaling" reference -> populate object during construction this.scaling = this.defaultScaling; lock (image.imageStream) { image.imageStream.Seek(this.address, SeekOrigin.Begin); this.byteValues = new List <byte[]>(); this.floatValues = new List <float>(); this.displayValues = new List <string>(); for (int i = 0; i < this.elements; i++) { byte[] b = new byte[this.scaling.storageSize]; image.imageStream.Read(b, 0, this.scaling.storageSize); if (this.endian == "big") { b.ReverseBytes(); } this.byteValues.Add(b); this.displayValues.Add(this.scaling.toDisplay(b)); //Must add scaling stuff in here! } } }
public void ReadMap(EcuMap idaMap, ECU image) { //loop through base def and search for table names in map foreach (var romtable in AggregateBaseRomTables) { foreach (var idan in idaMap.CleanLocs) { if (romtable.Key.EqualsDefineString(idan.Key)) { ExposeTable(romtable.Key, LookupTableFactory.CreateLookupTable(romtable.Key, uint.Parse(idan.Value.ToString(), NumberStyles.AllowHexSpecifier), image.imageStream)); break; } } } ////TODO RAMTABLES //foreach (var ramtable in baseDef.RamTableList) //{ // foreach (var idan in idaMap.IdaCleanNames) // { // if (ramtable.Key.EqualsIdaString(idan.Key)) // { // break; // } // } //} }
public void ImportMapFile(string filepath, ECU image) { EcuMap im = new EcuMap(); im.ImportFromMapFileOrText(filepath); ReadMap(im, image); }
public void ImportMapText(string text, ECU image) { EcuMap im = new EcuMap(); im.ImportFromMapFileOrText(text); ReadMap(im, image); }
public override void Read(ECU image) { //TODO, pull this ot and make as extension to generic axis //remove "scaling" reference -> populate object during construction this.scaling = this.defaultScaling; this.displayValues = new List <string>(); foreach (string value in this.StaticData) { this.displayValues.Add(value.ToString()); } }
public virtual void Write() { ECU image = this.baseTable.parentImage; lock (image.imageStream) { image.imageStream.Seek(this.address, SeekOrigin.Begin); //write this.bytevalues! foreach (byte[] bytevalue in this.byteValues) { if (this.scaling.endian == "big") { bytevalue.ReverseBytes(); } image.imageStream.Write(bytevalue, 0, bytevalue.Length); } } }
public override void Read(ECU image) { //TODO, pull this ot and make as extension to generic axis //remove "scaling" reference -> populate object during construction this.scaling = this.defaultScaling; this.displayValues = new List<string>(); foreach (string value in this.StaticData) { this.displayValues.Add(value.ToString()); } }
public virtual void Read(ECU image) { //TODO, pull this ot and make as extension to generic axis //remove "scaling" reference -> populate object during construction this.scaling = this.defaultScaling; lock (image.imageStream) { image.imageStream.Seek(this.address, SeekOrigin.Begin); this.byteValues = new List<byte[]>(); this.floatValues = new List<float>(); this.displayValues = new List<string>(); for (int i = 0; i < this.elements; i++) { byte[] b = new byte[this.scaling.storageSize]; image.imageStream.Read(b, 0, this.scaling.storageSize); if (this.endian == "big") { b.ReverseBytes(); } this.byteValues.Add(b); this.displayValues.Add(this.scaling.toDisplay(b)); //Must add scaling stuff in here! } } }
public void ReadMap(EcuMap idaMap,ECU image) { //loop through base def and search for table names in map foreach (var romtable in AggregateBaseRomTables) { foreach (var idan in idaMap.CleanLocs) { if (romtable.Key.EqualsDefineString(idan.Key)) { ExposeTable(romtable.Key, LookupTableFactory.CreateLookupTable(romtable.Key, uint.Parse(idan.Value.ToString(), NumberStyles.AllowHexSpecifier), image.imageStream)); break; } } } ////TODO RAMTABLES //foreach (var ramtable in baseDef.RamTableList) //{ // foreach (var idan in idaMap.IdaCleanNames) // { // if (ramtable.Key.EqualsIdaString(idan.Key)) // { // break; // } // } //} }
public void openDeviceImage(string filename) { //Construct new romimage //TODO move this, application logic shouldn't be in GUI class. ECU newImage = new ECU(sharpTuner, 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 (ECU 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(); }
public void ImportMapFile(string filepath, ECU image) { EcuMap im = new EcuMap(); im.ImportFromMapFileOrText(filepath); ReadMap(im,image); }
public XMLtoIDCGUI(ECU di) { deviceImage = di; xmlConv = new XMLtoIDC(deviceImage); InitializeComponent(); }
public XMLtoIDC(ECU di) { deviceImage = di; workingDir = deviceImage.FileDirectory; }
public XMLtoIDC(ECU di) { deviceImage = di; workingDir = deviceImage.FilePath; }
//public static void setSsmInterface(SsmInterface s) //{ // ssmInterface = s; //} public void AddImage(ECU d) { ImageList.Add(d); activeImage = d; }
public void ImportMapText(string text, ECU image) { EcuMap im = new EcuMap(); im.ImportFromMapFileOrText(text); ReadMap(im,image); }
public List<Mod> GetValidMods(ECU d) { List<Mod> tm = new List<Mod>(); foreach (Mod m in AvailableMods) { //TODO: When a mod is loaded, detect "FFFFFFF" CALID!!! if (m.InitialCalibrationId == d.CalId && m.TryCheckApplyMod(d.FilePath, d.FilePath + ".temp", true, false)) { tm.Add(m); Trace.WriteLine("Loaded Mod: " + m.FileName); } else if (m.ModIdent == d.CalId && m.TryCheckApplyMod(d.FilePath, d.FilePath + ".temp", false, false)) { tm.Add(m); Trace.WriteLine("Loaded Mod: " + m.FileName); } } return tm; }
/// <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; }