V1.1.2 - Massive Update and bugs Fixes

This commit is contained in:
Bouletmarc 2022-05-07 20:39:50 -04:00 committed by GitHub
parent 268ea30529
commit e8dc601b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 2058 additions and 941 deletions

View File

@ -25,6 +25,9 @@ internal class ClassEditor
public List<string> DefinitionsMathX = new List<string>();
public List<string> DefinitionsMathY = new List<string>();
public List<string> DefinitionsMathTable = new List<string>();
public List<string> DefinitionsMathXInverted = new List<string>();
public List<string> DefinitionsMathYInverted = new List<string>();
public List<string> DefinitionsMathTableInverted = new List<string>();
public List<string> DefinitionsFormatX = new List<string>();
public List<string> DefinitionsFormatY = new List<string>();
public List<string> DefinitionsFormatTable = new List<string>();
@ -42,6 +45,28 @@ internal class ClassEditor
public List<string> DefinitionsHeaders = new List<string>();
public List<bool> DefinitionsIsXYInverted = new List<bool>();
public List<bool> DefinitionsIsTableInverted = new List<bool>();
public List<bool> DefinitionsIsReadOnly = new List<bool>();
public List<bool> DefinitionsIsUntested = new List<bool>();
public List<bool> DefinitionsIsNotDefined = new List<bool>();
public int SelectedROMLocation;
public int SelectedTableSize;
public int SelectedTableIndexInDefinitions;
public bool IsTableLoadedCorrectly = false;
public bool CanReloadTablesValues = false;
public string string_ECU_Name;
public byte[] ROM_Bytes;
public string AllROMDifferences;
public string AllROMDifferencesRedo;
public bool ValuesChanged = false;
public bool IsSingleByteX = false;
public bool IsSingleByteY = false;
public bool IsSingleByteTable = false;
public int[] BufferValuesArray = new int[200];
public int[] BufferTableSize = new int[2];
public string BufferMath = "";
private string LastMathDoneCheck = "";
private Editortable Editortable_0;
@ -60,9 +85,18 @@ internal class ClassEditor
float num = this.smethod_1();
string format = "0";
string text = Editortable_0.dataGridView_0.Rows[RowIndex].Cells[CellIndex].Value.ToString();
if (text.Contains("."))
if (text.Contains(".") || text.Contains(","))
{
format = "0.000";
string[] SplittedCmd = new string[0];
if (text.Contains(".")) SplittedCmd = text.Split('.');
if (text.Contains(",")) SplittedCmd = text.Split(',');
int FormatLenght = SplittedCmd[1].Length;
if (FormatLenght == 0) format = "0.0";
if (FormatLenght == 1) format = "0.0";
if (FormatLenght == 2) format = "0.00";
if (FormatLenght == 3) format = "0.000";
if (FormatLenght == 4) format = "0.0000";
}
if (Multiply4x)
{
@ -166,9 +200,9 @@ internal class ClassEditor
{
IncDecreaseSelection(true, bool_);
}
Class40 class40_0 = new Class40();
//Class40 class40_0 = new Class40();
//this.smethod_4(200).ContinueWith(new Action<Task>(this.<> c.<> 9.method_0));
this.smethod_4(200, class40_0).ContinueWith(new Action<Task>(class40_0.method_0));
//this.smethod_4(200, class40_0).ContinueWith(new Action<Task>(class40_0.method_0));
}
private Task smethod_4(int int_232, Class40 class40_0)
@ -196,7 +230,7 @@ internal class ClassEditor
{
//calculate value inversed to make bytes
double ThisValue = double.Parse(Editortable_0.dataGridView_0.Rows[j].Cells[i].Value.ToString().Replace(',', '.'), CultureInfo.InvariantCulture);
ThisValue = DoMath(ThisValue, BufferMath, true);
ThisValue = DoMath(ThisValue, BufferMath, true, "Table");
ReadBufferarray[i, j] = (Int16)ThisValue;
}
}
@ -229,9 +263,9 @@ internal class ClassEditor
byte[] array = new byte[this.SelectedTableSize * multiplier];
for (int i = 0; i < this.SelectedTableSize * multiplier; i++)
{
array[i] = this.byte_0[num + i];
array[i] = this.ROM_Bytes[num + i];
//Apply Changes
this.byte_0[num + i] = BytesBufferarray[i];
this.ROM_Bytes[num + i] = BytesBufferarray[i];
}
int num3 = 0;
@ -249,7 +283,13 @@ internal class ClassEditor
num3++;
}
if (!DiffDetected) Editortable_0.GForm_Main_0.method_1("No differences detected");
this.string_3 = this.string_3 + "Address: " + this.SelectedROMLocation.ToString() + Environment.NewLine + text;
if (DiffDetected)
{
this.AllROMDifferencesRedo = "";
this.Editortable_0.redoToolStripMenuItem.Enabled = false;
}
this.AllROMDifferences = this.AllROMDifferences + text;
//this.string_3 = this.string_3 + "Address: " + this.SelectedROMLocation.ToString() + Environment.NewLine + text;
//this.string_3 = this.string_3 + "Table: " + TableSize + Environment.NewLine + "Address: " + this.SelectedROMLocation.ToString() + Environment.NewLine + text;
}
@ -257,15 +297,14 @@ internal class ClassEditor
{
try
{
if (this.bool_2 && this.SelectedTableSize != 0 && this.SelectedROMLocation != 0)
if (this.ValuesChanged && this.SelectedTableSize != 0 && this.SelectedROMLocation != 0)
{
this.GetChanges();
this.string_2 = this.string_2 + this.string_3 + Environment.NewLine;
}
this.bool_2 = false;
this.ValuesChanged = false;
//################################################
byte[] SavingBytes = this.byte_0;
byte[] SavingBytes = this.ROM_Bytes;
//Remove fake bootloader section if it's a partial firmware .bin file
if (!this.Editortable_0.IsFullBinary)
@ -281,6 +320,16 @@ internal class ClassEditor
File.Create(string_4).Dispose();
File.WriteAllBytes(string_4, SavingBytes);
//Set LastFileOpened
string LastOpenFilePath = Application.StartupPath + @"\LastFileOpened.txt";
File.Create(LastOpenFilePath).Dispose();
File.WriteAllText(LastOpenFilePath, string_4);
//################################################
//Save rom differences changes to logs
string text = string_4 + "-logs.txt";
File.Create(text).Dispose();
File.WriteAllText(text, AllROMDifferences);
//################################################
//string text = string_4 + "~temp";
//string text2 = string_4 + "~temp2";
@ -307,12 +356,12 @@ internal class ClassEditor
public void FixChecksums()
{
if (!this.Editortable_0.IsFullBinary) this.byte_0 = this.Editortable_0.GForm_Main_0.VerifyChecksumFWBin(this.byte_0);
if (this.Editortable_0.IsFullBinary) this.byte_0 = this.Editortable_0.GForm_Main_0.VerifyChecksumFullBin(this.byte_0);
if (!this.Editortable_0.IsFullBinary) this.ROM_Bytes = this.Editortable_0.GForm_Main_0.VerifyChecksumFWBin(this.ROM_Bytes);
if (this.Editortable_0.IsFullBinary) this.ROM_Bytes = this.Editortable_0.GForm_Main_0.VerifyChecksumFullBin(this.ROM_Bytes);
}
public void SetTableValues(int[] TableSize, int ROMLocationX, string TopLeftString, string RowHeaderString, string[] HeaderStringList, string ThisMathX, string ThisFormatX, bool IsXYInverted, int ROMLocationTable, string ThisMathTable, string ThisTableFormat, bool IsTableInverted)
public void SetTableValues(int[] TableSize, int ROMLocationX, string TopLeftString, string RowHeaderString, string[] HeaderStringList, string ThisMathX, string ThisFormatX, bool IsXYInverted, int ROMLocationTable, string ThisMathTable, string ThisTableFormat, bool IsTableInverted, bool IsReadOnly)
{
try
{
@ -350,8 +399,8 @@ internal class ClassEditor
else num = (double)this.GetIntValue(ROMLocationX + i * 2);
string HeaderStr = "";
if (ThisFormatX != "") HeaderStr = DoMath(num, ThisMathX, false).ToString(ThisFormatX);
if (ThisFormatX == "") HeaderStr = DoMath(num, ThisMathX, false).ToString();
if (ThisFormatX != "") HeaderStr = DoMath(num, ThisMathX, false, "X").ToString(ThisFormatX);
if (ThisFormatX == "") HeaderStr = DoMath(num, ThisMathX, false, "X").ToString();
Editortable_0.dataGridView_0.Columns.Add(HeaderStr, HeaderStr);
}
else
@ -399,8 +448,8 @@ internal class ClassEditor
double num = 0;
if (IsSingleByteX) num = (double)this.GetSingleByteValue(ROMLocationX + num10);
else num = (double)this.GetIntValue(ROMLocationX + num10 * 2);
if (ThisFormatX != "") Editortable_0.dataGridView_0.Rows[num10].HeaderCell.Value = DoMath(num, ThisMathX, false).ToString(ThisFormatX);
if (ThisFormatX == "") Editortable_0.dataGridView_0.Rows[num10].HeaderCell.Value = DoMath(num, ThisMathX, false).ToString();
if (ThisFormatX != "") Editortable_0.dataGridView_0.Rows[num10].HeaderCell.Value = DoMath(num, ThisMathX, false, "X").ToString(ThisFormatX);
if (ThisFormatX == "") Editortable_0.dataGridView_0.Rows[num10].HeaderCell.Value = DoMath(num, ThisMathX, false, "X").ToString();
}
else
{
@ -413,23 +462,61 @@ internal class ClassEditor
}
//TableMath (Get full 1full row of value at a time)
object[] values = new object[0];
string[] values = new string[0];
if (IsXYInverted)
{
values = new object[TableSize[1]];
values = new string[TableSize[1]];
for (int i = 0; i < TableSize[1]; i++)
{
if (ThisTableFormat != "") values[i] = DoMath((double)numArray2[rowIndex, i], ThisMathTable, false).ToString(ThisTableFormat);
if (ThisTableFormat == "") values[i] = DoMath((double)numArray2[rowIndex, i], ThisMathTable, false).ToString();
if (ThisTableFormat.Contains("X"))
{
//Display Values in Hexadecimals
string Mathhh = DoMath((double)numArray2[rowIndex, i], ThisMathTable, false, "Table").ToString();
try
{
if (ThisTableFormat == "X4") values[i] = Int16.Parse(Mathhh).ToString(ThisTableFormat);
else if (ThisTableFormat == "X8") values[i] = Int32.Parse(Mathhh).ToString(ThisTableFormat);
else values[i] = int.Parse(Mathhh).ToString(ThisTableFormat);
}
catch
{
values[i] = Mathhh;
}
}
else
{
values = new object[TableSize[0]];
//Display Values in double/int
if (ThisTableFormat != "") values[i] = DoMath((double)numArray2[rowIndex, i], ThisMathTable, false, "Table").ToString(ThisTableFormat);
if (ThisTableFormat == "") values[i] = DoMath((double)numArray2[rowIndex, i], ThisMathTable, false, "Table").ToString();
}
}
}
else
{
values = new string[TableSize[0]];
for (int i = 0; i < TableSize[0]; i++)
{
if (ThisTableFormat != "") values[i] = DoMath((double)numArray2[i, rowIndex], ThisMathTable, false).ToString(ThisTableFormat);
if (ThisTableFormat == "") values[i] = DoMath((double)numArray2[i, rowIndex], ThisMathTable, false).ToString();
if (ThisTableFormat.Contains("X"))
{
//Display Values in Hexadecimals
string Mathhh = DoMath((double)numArray2[i, rowIndex], ThisMathTable, false, "Table").ToString();
try
{
if (ThisTableFormat == "X4") values[i] = Int16.Parse(Mathhh).ToString(ThisTableFormat);
else if (ThisTableFormat == "X8") values[i] = Int32.Parse(Mathhh).ToString(ThisTableFormat);
else values[i] = int.Parse(Mathhh).ToString(ThisTableFormat);
}
catch
{
values[i] = Mathhh;
}
}
else
{
//Display Values in double/int
if (ThisTableFormat != "") values[i] = DoMath((double)numArray2[i, rowIndex], ThisMathTable, false, "Table").ToString(ThisTableFormat);
if (ThisTableFormat == "") values[i] = DoMath((double)numArray2[i, rowIndex], ThisMathTable, false, "Table").ToString();
}
}
}
Editortable_0.dataGridView_0.Rows.Insert(rowIndex, values);
@ -458,13 +545,13 @@ internal class ClassEditor
string valueinner = "";
if (IsXYInverted)
{
if (ThisTableFormat != "") valueinner = DoMath((double)numArray2[i, i2], ThisMathTable, false).ToString(ThisTableFormat);
if (ThisTableFormat == "") valueinner = DoMath((double)numArray2[i, i2], ThisMathTable, false).ToString();
if (ThisTableFormat != "") valueinner = DoMath((double)numArray2[i, i2], ThisMathTable, false, "Table").ToString(ThisTableFormat);
if (ThisTableFormat == "") valueinner = DoMath((double)numArray2[i, i2], ThisMathTable, false, "Table").ToString();
}
else
{
if (ThisTableFormat != "") valueinner = DoMath((double)numArray2[i2, i], ThisMathTable, false).ToString(ThisTableFormat);
if (ThisTableFormat == "") valueinner = DoMath((double)numArray2[i2, i], ThisMathTable, false).ToString();
if (ThisTableFormat != "") valueinner = DoMath((double)numArray2[i2, i], ThisMathTable, false, "Table").ToString(ThisTableFormat);
if (ThisTableFormat == "") valueinner = DoMath((double)numArray2[i2, i], ThisMathTable, false, "Table").ToString();
}
Editortable_0.dataGridView_0.Rows[i2].Cells[i].Value = valueinner;
@ -473,6 +560,7 @@ internal class ClassEditor
}
//##############################################################################################################
Editortable_0.dataGridView_0.ReadOnly = IsReadOnly;
foreach (object obj in Editortable_0.dataGridView_0.Columns)
{
DataGridViewColumn dataGridViewColumn = (DataGridViewColumn)obj;
@ -485,11 +573,11 @@ internal class ClassEditor
dataGridViewRow2.Height = 20;
}
this.SetBackColor(TableSize[0], Editortable.float_1[0], Editortable.float_1[1]);
this.bool_0 = true;
this.IsTableLoadedCorrectly = true;
}
catch (Exception ex)
{
this.bool_0 = false;
this.IsTableLoadedCorrectly = false;
DarkMessageBox.Show("Failed to load table. " + ex.ToString());
}
}
@ -584,20 +672,110 @@ internal class ClassEditor
return ReturnStr;
}
public double DoMath(double ThisValueCheck, string ThisMath, bool Reverse)
public string SwipeMathFunc(string ThisMath)
{
double ReturnVal = DoMathFinal(ThisValueCheck, ThisMath, Reverse);
string ReturnStr = "";
List<char> MathFuncList = new List<char>();
List<double> ValuesList = new List<double>();
bool WeHaveVal1 = false;
while (ThisMath != "")
{
if (!WeHaveVal1) ValuesList.Add(GetNextValue(ThisMath));
MathFuncList.Add(GetNextMath(ThisMath));
ThisMath = ThisMath.Substring(GetNearestMathIndex(ThisMath) + 1);
ValuesList.Add(GetNextValue(ThisMath));
int NearestIndex = GetNearestMathIndex(ThisMath);
if (NearestIndex != -1) ThisMath = ThisMath.Substring(GetNearestMathIndex(ThisMath));
WeHaveVal1 = true;
if (!ThisMath.Contains("/") && !ThisMath.Contains("*") && !ThisMath.Contains("+"))
{
ThisMath = ""; //No remaining maths to perform
}
}
//Create swiped math function
for (int i = 0; i < ValuesList.Count; i++)
{
if (i > 0)
{
if (i > 1) ReturnStr = ReturnStr + MathFuncList[i - 2].ToString();
else ReturnStr = ReturnStr + MathFuncList[MathFuncList.Count - 1].ToString();
}
ReturnStr = ReturnStr + ValuesList[i];
}
return ReturnStr;
}
public double DoMath(double ThisValueCheck, string ThisMath, bool Reverse, string Direction)
{
//Check if the reversed math function exist, if not we perform the reversed math function manually
bool ReversFinalForMath = Reverse;
if (Reverse)
{
if (Direction == "X" && DefinitionsMathXInverted[SelectedTableIndexInDefinitions] != "")
{
ThisMath = DefinitionsMathXInverted[SelectedTableIndexInDefinitions];
ReversFinalForMath = false;
}
if (Direction == "Y" && DefinitionsMathYInverted[SelectedTableIndexInDefinitions] != "")
{
ThisMath = DefinitionsMathYInverted[SelectedTableIndexInDefinitions];
ReversFinalForMath = false;
}
if (Direction == "Table" && DefinitionsMathTableInverted[SelectedTableIndexInDefinitions] != "")
{
ThisMath = DefinitionsMathTableInverted[SelectedTableIndexInDefinitions];
ReversFinalForMath = false;
}
}
//Perform Math
double ReturnVal = DoMathFinal(ThisValueCheck, ThisMath, ReversFinalForMath);
//################################################
//Confirm Math function in reverse
if (!Reverse)
{
double ReversedVal = DoMathFinal(ReturnVal, ThisMath, true);
bool PerformedNormalReverse = true;
//Has the reversed math function existing
if (Direction == "X" && DefinitionsMathXInverted[SelectedTableIndexInDefinitions] != "")
{
ThisMath = DefinitionsMathXInverted[SelectedTableIndexInDefinitions];
PerformedNormalReverse = false;
}
if (Direction == "Y" && DefinitionsMathYInverted[SelectedTableIndexInDefinitions] != "")
{
ThisMath = DefinitionsMathYInverted[SelectedTableIndexInDefinitions];
PerformedNormalReverse = false;
}
if (Direction == "Table" && DefinitionsMathTableInverted[SelectedTableIndexInDefinitions] != "")
{
ThisMath = DefinitionsMathTableInverted[SelectedTableIndexInDefinitions];
PerformedNormalReverse = false;
}
//Has NOT the reversed math function existing
double ReversedVal = DoMathFinal(ReturnVal, ThisMath, PerformedNormalReverse);
if (((int) ReversedVal).ToString() != ((int) ThisValueCheck).ToString()
&& ((int)ReversedVal + 1).ToString() != ((int)ThisValueCheck).ToString()
&& ((int)ReversedVal - 1).ToString() != ((int)ThisValueCheck).ToString())
{
Editortable_0.GForm_Main_0.method_1("Problem with math: " + ThisMath + " | Values: " + ((int)ThisValueCheck).ToString() + " != " + ((int)ReversedVal).ToString());
if (LastMathDoneCheck != ThisMath)
{
Editortable_0.GForm_Main_0.method_1("Problem with inverted math: " + ThisMath + " | Values: " + ((int)ThisValueCheck).ToString() + " != " + ((int)ReversedVal).ToString());
LastMathDoneCheck = ThisMath;
}
//suggested to set 'ReadOnly' parameters when there is math problem.
//when there is math problem, it mean the inverted function of your math doesn't return the exact bytes values as within the binary.
//The problem come from the math inversion in the function bellow 'DoMathFinal'
//DefinitionsIsReadOnly
}
}
@ -627,8 +805,22 @@ internal class ClassEditor
ThisMath = ThisMath.Replace("X", ThisValue.ToString());
//########################################################
//double ValTest1 = GetNextValue(ThisMath);
char MathTestChar = GetNextMath(ThisMath);
string ThisMathTest = ThisMath.Substring(GetNearestMathIndex(ThisMath) + 1);
double ValTest2 = GetNextValue(ThisMathTest);
if (Reverse && MathTestChar == '*' && ValTest2 == 100)
{
IsDivXValFirst = true;
ThisMath = SwipeMathFunc(ThisMath);
}
//########################################################
if (Reverse) ThisMath = InvertMathString(ThisMath);
//Console.WriteLine("Math: " + ThisMath + " | Reversed: " + Reverse);
bool WeHaveVal1 = false;
double Val1 = 0;
while (ThisMath != "")
@ -641,7 +833,8 @@ internal class ClassEditor
if (MathChar == '*') ReturnVal = Val1 * Val2;
if (MathChar == '/') ReturnVal = Val1 / Val2;
if (MathChar == '+') ReturnVal = Val1 + Val2;
if (MathChar == '-') ReturnVal = Val1 - Val2;
//Console.WriteLine("Doing: " + Val1 + MathChar.ToString() + Val2 + "=" + ReturnVal);
if (Reverse && MathChar == '*' && !IsDivXValFirst) ReturnVal = Val2 / Val1;
@ -652,7 +845,6 @@ internal class ClassEditor
Val1 = ReturnVal;
//Check for remaining maths
//if (!ThisMath.Contains("/") && !ThisMath.Contains("*") && !ThisMath.Contains("+") && !ThisMath.Contains("-"))
if (!ThisMath.Contains("/") && !ThisMath.Contains("*") && !ThisMath.Contains("+"))
{
ThisMath = ""; //No remaining maths to perform
@ -670,8 +862,8 @@ internal class ClassEditor
if (IsSingleByteY) Valuue = GetSingleByteValue(ThisLocation + i);
else Valuue = GetIntValue(ThisLocation + (i * 2));
if (HeaderFormat == "") strArray[i] = DoMath((double) Valuue, ThisMath, false).ToString();
if (HeaderFormat != "") strArray[i] = DoMath((double) Valuue, ThisMath, false).ToString(HeaderFormat);
if (HeaderFormat == "") strArray[i] = DoMath((double) Valuue, ThisMath, false, "Y").ToString();
if (HeaderFormat != "") strArray[i] = DoMath((double) Valuue, ThisMath, false, "Y").ToString(HeaderFormat);
}
return strArray;
}
@ -729,41 +921,47 @@ internal class ClassEditor
{
try
{
this.byte_0 = File.ReadAllBytes(string_4);
this.ROM_Bytes = File.ReadAllBytes(string_4);
//Create a fake bootloader section
if (!Editortable_0.IsFullBinary)
{
byte[] BufferBytes = new byte[0x8000 + this.byte_0.Length];
byte[] BufferBytes = new byte[0x8000 + this.ROM_Bytes.Length];
for (int i = 0; i < 0x8000; i++) BufferBytes[i] = 0xff;
for (int i = 0; i < this.byte_0.Length; i++) BufferBytes[0x8000 + i] = this.byte_0[i];
for (int i = 0; i < this.ROM_Bytes.Length; i++) BufferBytes[0x8000 + i] = this.ROM_Bytes[i];
this.byte_0 = BufferBytes;
this.ROM_Bytes = BufferBytes;
}
//Get ECU filename (33 37 38 30 35 2D -> 37805- 'in ASCII chars') (37805-RRB-A140)
this.string_ECU_Name = "";
for (int i = 0; i < this.byte_0.Length; i++)
for (int i = 0; i < this.ROM_Bytes.Length; i++)
{
if (this.byte_0[i] == 0x33 &&
this.byte_0[i + 1] == 0x37 &&
this.byte_0[i + 2] == 0x38 &&
this.byte_0[i + 3] == 0x30 &&
(this.byte_0[i + 4] == 0x35 || this.byte_0[i + 4] == 0x36) &&
this.byte_0[i + 5] == 0x2D)
if (this.ROM_Bytes[i] == 0x33 &&
this.ROM_Bytes[i + 1] == 0x37 &&
this.ROM_Bytes[i + 2] == 0x38 &&
this.ROM_Bytes[i + 3] == 0x30 &&
(this.ROM_Bytes[i + 4] == 0x35 || this.ROM_Bytes[i + 4] == 0x36) &&
this.ROM_Bytes[i + 5] == 0x2D)
{
for (int i2 = 0; i2 < 14; i2++)
{
this.string_ECU_Name += (char)this.byte_0[i + i2];
this.string_ECU_Name += (char)this.ROM_Bytes[i + i2];
}
break;
}
}
//##################################################################################################
//Load all differences made in ROM from logs
string text = string_4 + "-logs.txt";
if (File.Exists(text))
{
AllROMDifferences = File.ReadAllText(text);
}
return true;
//##################################################################################################
/*this.string_0 = array[0]; //37805-RRB-A140
this.string_1 = array[1]; //Unused
using (FileStream fileStream = new FileStream(string_4, FileMode.Open))
{
using (ZipArchive zipArchive = new ZipArchive(fileStream, ZipArchiveMode.Read))
@ -804,6 +1002,7 @@ internal class ClassEditor
}
Editortable_0.GForm_Main_0.method_1("Cannot load Error#1");
return false;*/
//##################################################################################################
}
catch
{
@ -815,12 +1014,12 @@ internal class ClassEditor
public int GetIntValue(int int_232)
{
return (int)((short)((int)this.byte_0[int_232] << 8 | (int)this.byte_0[int_232 + 1]));
return (int)((short)((int)this.ROM_Bytes[int_232] << 8 | (int)this.ROM_Bytes[int_232 + 1]));
}
public int GetSingleByteValue(int int_232)
{
return (int)this.byte_0[int_232];
return (int)this.ROM_Bytes[int_232];
}
public void SetBackColor(int int_232, float float_0, float float_1)
@ -847,6 +1046,10 @@ internal class ClassEditor
public Color GetColor(float float_0, float float_1, float float_2)
{
Color result;
if (float_0 > float_1) return Color.White; //More than Maximum
if (float_0 < float_2) return Color.White; //Less than Minimum
try
{
int num = (int)(1023f * (float_0 - float_1) / (float_2 - float_1));
@ -958,20 +1161,29 @@ internal class ClassEditor
DefinitionsTableSize = new List<string>();
DefinitionsMathX = new List<string>();
DefinitionsMathY = new List<string>();
DefinitionsMathTable = new List<string>();
DefinitionsMathXInverted = new List<string>();
DefinitionsMathYInverted = new List<string>();
DefinitionsMathTableInverted = new List<string>();
DefinitionsValueMin = new List<float>();
DefinitionsValueMax = new List<float>();
DefinitionsChangeAmount = new List<double>();
DefinitionsIsSingleByteX = new List<bool>();
DefinitionsIsSingleByteY = new List<bool>();
DefinitionsIsSingleByteTable = new List<bool>();
DefinitionsFormatX = new List<string>();
DefinitionsHeaders = new List<string>();
DefinitionsFormatX = new List<string>();
DefinitionsFormatY = new List<string>();
DefinitionsFormatTable = new List<string>();
DefinitionsIsXYInverted = new List<bool>();
DefinitionsIsTableInverted = new List<bool>();
DefinitionsIsReadOnly = new List<bool>();
DefinitionsIsUntested = new List<bool>();
DefinitionsIsNotDefined = new List<bool>();
Editortable_0.GForm_Main_0.method_1("Loading ECU definitions for: " + ThisECU);
bool ECUFound = false;
bool IsFileGenerated = false;
foreach (string ThisFilePath in AllDefinitionFiles)
{
string[] AllLines = File.ReadAllLines(ThisFilePath);
@ -987,6 +1199,9 @@ internal class ClassEditor
string CurrentMathX = "";
string CurrentMathY = "";
string CurrentMathTable = "";
string CurrentMathXInverted = "";
string CurrentMathYInverted = "";
string CurrentMathTableInverted = "";
float CurrentValueMin = 0f;
float CurrentValueMax = 255f;
double CurrentChangeAmount = 1;
@ -999,13 +1214,18 @@ internal class ClassEditor
string CurrentHeaders = "";
bool CurrentIsXYInverted = false;
bool CurrentIsTableInverted = false;
bool CurrentIsReadOnly = false;
bool CurrentIsUntested = false;
bool CurrentIsNotDefined = false;
IsFileGenerated = false;
for (int i = 0; i < AllLines.Length; i++)
{
string Thisline = AllLines[i];
if (Thisline.Contains("ROM Parameters")) GettingEcuList = false; //make sure we are not reading false contents
if (Thisline.Contains("THIS FILE AS BEEN GENERATED")) DarkMessageBox.Show("This Definitions file as been generated to get the ROM Locations.\nThe ROM Locations can possibly be wrong and\nthe tables can display corrupted values!");
if (Thisline.Contains("THIS FILE AS BEEN GENERATED")) IsFileGenerated = true;
//Get supported ecu list from file and check if it's match
if (Thisline[0] != '#' && Thisline != "")
@ -1033,6 +1253,9 @@ internal class ClassEditor
if (Commands[0] == "MathX") CurrentMathX = Commands[1];
if (Commands[0] == "MathY") CurrentMathY = Commands[1];
if (Commands[0] == "MathTable") CurrentMathTable = Commands[1];
if (Commands[0] == "MathXInverted") CurrentMathXInverted = Commands[1];
if (Commands[0] == "MathYInverted") CurrentMathYInverted = Commands[1];
if (Commands[0] == "MathTableInverted") CurrentMathTableInverted = Commands[1];
if (Commands[0] == "ValueMin") CurrentValueMin = (float) double.Parse(Commands[1].Replace(',', '.'), CultureInfo.InvariantCulture);
if (Commands[0] == "ValueMax") CurrentValueMax = (float) double.Parse(Commands[1].Replace(',', '.'), CultureInfo.InvariantCulture);
if (Commands[0] == "ChangeAmount") CurrentChangeAmount = double.Parse(Commands[1].Replace(',', '.'), CultureInfo.InvariantCulture);
@ -1045,6 +1268,9 @@ internal class ClassEditor
if (Commands[0] == "Headers") CurrentHeaders = Commands[1];
if (Commands[0] == "IsXYInverted") CurrentIsXYInverted = bool.Parse(Commands[1].ToLower());
if (Commands[0] == "IsTableInverted") CurrentIsTableInverted = bool.Parse(Commands[1].ToLower());
if (Commands[0] == "IsReadOnly") CurrentIsReadOnly = bool.Parse(Commands[1].ToLower());
if (Commands[0] == "IsUntested") CurrentIsUntested = bool.Parse(Commands[1].ToLower());
if (Commands[0] == "IsNotDefined") CurrentIsNotDefined = bool.Parse(Commands[1].ToLower());
}
}
@ -1055,6 +1281,8 @@ internal class ClassEditor
if (CurrentName != "")
{
CurrentName = CurrentName.Replace("\\x00b0", "°");
CurrentUnit1 = CurrentUnit1.Replace("\\x00b0", "°");
CurrentUnit2 = CurrentUnit2.Replace("\\x00b0", "°");
DefinitionsLocationsX.Add(CurrentLocationX);
DefinitionsLocationsY.Add(CurrentLocationY);
DefinitionsLocationsTable.Add(CurrentLocationTable);
@ -1065,6 +1293,9 @@ internal class ClassEditor
DefinitionsMathX.Add(CurrentMathX);
DefinitionsMathY.Add(CurrentMathY);
DefinitionsMathTable.Add(CurrentMathTable);
DefinitionsMathXInverted.Add(CurrentMathXInverted);
DefinitionsMathYInverted.Add(CurrentMathYInverted);
DefinitionsMathTableInverted.Add(CurrentMathTableInverted);
DefinitionsValueMin.Add(CurrentValueMin);
DefinitionsValueMax.Add(CurrentValueMax);
DefinitionsChangeAmount.Add(CurrentChangeAmount);
@ -1077,6 +1308,9 @@ internal class ClassEditor
DefinitionsHeaders.Add(CurrentHeaders);
DefinitionsIsXYInverted.Add(CurrentIsXYInverted);
DefinitionsIsTableInverted.Add(CurrentIsTableInverted);
DefinitionsIsReadOnly.Add(CurrentIsReadOnly);
DefinitionsIsUntested.Add(CurrentIsUntested);
DefinitionsIsNotDefined.Add(CurrentIsNotDefined);
//Reset values to default
CurrentLocationX = "";
@ -1089,6 +1323,9 @@ internal class ClassEditor
CurrentMathX = "";
CurrentMathY = "";
CurrentMathTable = "";
CurrentMathXInverted = "";
CurrentMathYInverted = "";
CurrentMathTableInverted = "";
CurrentValueMin = 0f;
CurrentValueMax = 255f;
CurrentChangeAmount = 1f;
@ -1101,13 +1338,21 @@ internal class ClassEditor
CurrentFormatTable = "";
CurrentIsXYInverted = false;
CurrentIsTableInverted = false;
CurrentIsReadOnly = false;
CurrentIsUntested = false;
CurrentIsNotDefined = false;
}
}
}
}
if (ECUFound)
{
Editortable_0.GForm_Main_0.method_1("Definitions loaded!");
if (ECUFound) return;
if (IsFileGenerated) DarkMessageBox.Show("This Definitions file as been generated to get the ROM Locations.\nThe ROM Locations can possibly be wrong and\nthe tables can display corrupted values!");
return;
}
}
if (!ECUFound) Editortable_0.GForm_Main_0.method_1("Definitions NOT loaded!");
@ -1123,33 +1368,6 @@ internal class ClassEditor
}
}
public int SelectedROMLocation;
public int SelectedTableSize;
public bool bool_0 = false;
public bool bool_1 = false;
public string string_ECU_Name;
public byte[] byte_0;
public string string_2;
public string string_3;
public bool bool_2 = false;
public bool IsSingleByteX = false;
public bool IsSingleByteY = false;
public bool IsSingleByteTable = false;
public int[] BufferValuesArray = new int[200];
//public byte[] BufferBytesArray = new byte[400];
public int[] BufferTableSize = new int[2];
public string BufferMath = "";
public int[] int_219 = new int[400];
public int[] int_220 = new int[128];
public int[] int_221 = new int[30];
public int[] int_222 = new int[16];
public int[] int_223 = new int[14];
public int[] int_224 = new int[12];
public int[] int_225 = new int[10];
public int[] int_226 = new int[8];
public int[] int_231 = new int[2];
[CompilerGenerated]
private sealed class Class40

View File

@ -94,10 +94,10 @@ public class Class_Cypher
public static uint GetKey41(uint uint_0, byte byte_0)
{
uint uint_ = 0U;
uint num = 0U;
uint num2 = 0U;
uint num3 = 0U;
byte uint_2 = 0;
uint uint_2 = 0U;
uint KeyBytes1 = 0U;
uint KeyBytes2 = 0U;
uint FinalAdder = 0U;
switch (byte_0)
{
@ -132,10 +132,10 @@ public class Class_Cypher
IL_111: //Test#1 work for 0x01 algorithm
//CIVIC 06-10 (All models??) | AE 0D 23 FF 40 65 58 B3
uint_ = 2U;
uint_2 = 0;
num = 2920096767U;
num2 = 1080383667U;
num3 = 0U;
uint_2 = 0U;
KeyBytes1 = 2920096767U;
KeyBytes2 = 1080383667U;
FinalAdder = 0U;
goto IL_170;
//#########################################
IL_127:
@ -144,28 +144,28 @@ public class Class_Cypher
//#########################################
IL_146: //Test#2 (Default Switch, NOT WORK**)
uint_ = 2U;
uint_2 = 0;
num = 3129510011U;
num2 = 0U;
num3 = 955378367U;
uint_2 = 0U;
KeyBytes1 = 3129510011U;
KeyBytes2 = 0U;
FinalAdder = 955378367U;
goto IL_170;
//#########################################
IL_15C: //Test#3 should works without issue
//RIDGELINE 06-13 | 16 A4 AB B0 BF E8 5A 6D
uint_ = 1U;
uint_2 = 0;
num = 379890608U;
num2 = 3219675757U;
num3 = 0U;
uint_2 = 0U;
KeyBytes1 = 379890608U;
KeyBytes2 = 3219675757U;
FinalAdder = 0U;
goto IL_170;
//#########################################
IL_160: //Test#4 should works without issue
//CRV 07-10 KEY BYTES | 6D 75 32 AC 9D 62 3B 64
uint_ = 2U;
uint_2 = 0;
num = BitConverter.ToUInt32(new byte[] { 0xac, 0x32, 0x75, 0x6d }, 0);
num2 = BitConverter.ToUInt32(new byte[] { 0x64, 0x3b, 0x62, 0x9d }, 0);
num3 = 0U;
uint_2 = 0U;
KeyBytes1 = BitConverter.ToUInt32(new byte[] { 0xac, 0x32, 0x75, 0x6d }, 0);
KeyBytes2 = BitConverter.ToUInt32(new byte[] { 0x64, 0x3b, 0x62, 0x9d }, 0);
FinalAdder = 0U;
goto IL_170;
//#########################################
//#########################################
@ -174,18 +174,18 @@ public class Class_Cypher
IL_161:
//FREED 11-13 | 95 58 3E 2C F3 96 B5 6F
uint_ = 3U;
uint_2 = 0;
num = BitConverter.ToUInt32(new byte[] { 0x2c, 0x3e, 0x58, 0x95 }, 0);
num2 = BitConverter.ToUInt32(new byte[] { 0x6f, 0xb5, 0x96, 0xf3 }, 0);
num3 = 0U;
uint_2 = 0U;
KeyBytes1 = BitConverter.ToUInt32(new byte[] { 0x2c, 0x3e, 0x58, 0x95 }, 0);
KeyBytes2 = BitConverter.ToUInt32(new byte[] { 0x6f, 0xb5, 0x96, 0xf3 }, 0);
FinalAdder = 0U;
goto IL_170;
IL_165:
//RDX KEY BYTES | 67 E9 76 C1 78 3E 17 39
uint_ = 2U;
uint_2 = 0;
num = BitConverter.ToUInt32(new byte[] { 0xC1, 0x76, 0xE9, 0x67 }, 0);
num2 = BitConverter.ToUInt32(new byte[] { 0x39, 0x17, 0x3E, 0x78 }, 0);
num3 = 0U;
uint_2 = 0U;
KeyBytes1 = BitConverter.ToUInt32(new byte[] { 0xC1, 0x76, 0xE9, 0x67 }, 0);
KeyBytes2 = BitConverter.ToUInt32(new byte[] { 0x39, 0x17, 0x3E, 0x78 }, 0);
FinalAdder = 0U;
//#########################################
//#########################################
//#########################################
@ -196,9 +196,9 @@ public class Class_Cypher
Console.WriteLine("num3:" + num3.ToString()); //num3 = 0
Console.WriteLine("uint_:" + uint_.ToString()); //uint_ = 2
Console.WriteLine("uint_2:" + uint_2.ToString()); //uint_2 = 0*/
uint num6 = Class_Cypher.smethod_3(num + uint_0, uint_);
uint num7 = Class_Cypher.smethod_4(num2 + uint_0, (uint)uint_2);
return (num6 ^ num7 ^ (uint_0 & 65535U) * (uint_0 >> 16)) + num3;
uint num6 = Class_Cypher.smethod_3(KeyBytes1 + uint_0, uint_);
uint num7 = Class_Cypher.smethod_4(KeyBytes2 + uint_0, uint_2);
return (num6 ^ num7 ^ (uint_0 & 65535U) * (uint_0 >> 16)) + FinalAdder;
}
public static uint smethod_3(uint uint_0, uint uint_1)

View File

@ -5,17 +5,30 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
class Class_DefinitionMaker
public class Class_DefinitionMaker
{
List<string> AllECUS = new List<string>();
List<string> AllFoundFunctions = new List<string>();
List<int> AllFoundAddress = new List<int>();
List<int> AllFoundAddressX = new List<int>();
List<int> AllFoundAddressY = new List<int>();
List<string> AllFileNames = new List<string>();
List<byte> AllBootLoaderSumBytes = new List<byte>();
public string FirmwareFolder = "";
GForm_Main GForm_Main_0;
public Class_DefinitionMaker(ref GForm_Main GForm_Main_1)
{
GForm_Main_0 = GForm_Main_1;
}
//##########################################################################################################################
//##########################################################################################################################
//##########################################################################################################################
@ -24,11 +37,6 @@ class Class_DefinitionMaker
public void CreateDefinitionsFiles()
{
//##########################################################################################################################
//string FirmwareFolder = Application.StartupPath + @"\Firmwares";
string FirmwareFolder = @"C:\Users\boule\Documents\Visual Studio 2019\Projects\RWD_2_BIN\bin\Debug\Firmwares";
//##########################################################################################################################
string[] AllFiles = Directory.GetFiles(FirmwareFolder, "*.bin");
foreach (string ThisFile in AllFiles)
{
@ -46,47 +54,47 @@ class Class_DefinitionMaker
//#######################################################################################################################
DoneParameter = false;
int ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("00 0A 00 0A 00 C8 00"), 16, false);
if (ThisAddr != -1) AddToList(Path.GetFileNameWithoutExtension(ThisFile), "VTEC Engagement", ThisAddr);
if (ThisAddr != -1) AddToList(Path.GetFileNameWithoutExtension(ThisFile), "VTEC Engagement", ThisAddr, -1, -1);
//#######################################################################################################################
//#######################################################################################################################
DoneParameter = false;
ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("FA 01 2C FF FF 40"), 71, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Revlimiter", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 1", ThisAddr + 8);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 2", ThisAddr + 16);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 3", ThisAddr + 24);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 4", ThisAddr + 32);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 5", ThisAddr + 36);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 6", ThisAddr + 52);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 7", ThisAddr + 60);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Revlimiter", ThisAddr, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 1", ThisAddr + 8, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 2", ThisAddr + 16, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 3", ThisAddr + 24, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 4", ThisAddr + 32, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 5", ThisAddr + 36, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 6", ThisAddr + 52, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 7", ThisAddr + 60, -1, -1);
DoneParameter = true;
}
if (ThisAddr == -1 && !DoneParameter) ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("FA 01 2C FF FF 3A"), 71, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Revlimiter", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 1", ThisAddr + 8);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 2", ThisAddr + 16);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 3", ThisAddr + 24);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 4", ThisAddr + 32);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 5", ThisAddr + 36);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 6", ThisAddr + 52);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 7", ThisAddr + 60);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Revlimiter", ThisAddr, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 1", ThisAddr + 8, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 2", ThisAddr + 16, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 3", ThisAddr + 24, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 4", ThisAddr + 32, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 5", ThisAddr + 36, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 6", ThisAddr + 52, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 7", ThisAddr + 60, -1, -1);
DoneParameter = true;
}
if (ThisAddr == -1 && !DoneParameter) ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("00 00 00 00 80 00 80 00 00 00 00 00 00"), 84, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Revlimiter", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 1", ThisAddr + 8);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 2", ThisAddr + 16);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 3", ThisAddr + 24);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 4", ThisAddr + 32);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 5", ThisAddr + 36);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 6", ThisAddr + 52);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 7", ThisAddr + 60);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Revlimiter", ThisAddr, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 1", ThisAddr + 8, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 2", ThisAddr + 16, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 3", ThisAddr + 24, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 4", ThisAddr + 32, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 5", ThisAddr + 36, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 6", ThisAddr + 52, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "--Revlimiter 7", ThisAddr + 60, -1, -1);
DoneParameter = true;
}
//#######################################################################################################################
@ -95,25 +103,25 @@ class Class_DefinitionMaker
ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("00 32 00 1E 01 2C 00 00 08 66 66 00 00"), -2, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Speedlimiter", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Speedlimiter", ThisAddr, -1, -1);
DoneParameter = true;
}
if (ThisAddr == -1 && !DoneParameter) ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("00 32 00 1E 02 BC 02 DC 01 2C"), -2, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Speedlimiter", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Speedlimiter", ThisAddr, -1, -1);
DoneParameter = true;
}
if (ThisAddr == -1 && !DoneParameter) ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("01 90 00 14 01 2C 00 00 08 66 66 00 00"), -2, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Speedlimiter", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Speedlimiter", ThisAddr, -1, -1);
DoneParameter = true;
}
if (ThisAddr == -1 && !DoneParameter) ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("01 2C 00 00 08 66 66 00 00"), -6, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Speedlimiter", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Speedlimiter", ThisAddr, -1, -1);
DoneParameter = true;
}
//#######################################################################################################################
@ -122,13 +130,13 @@ class Class_DefinitionMaker
ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("0C 80 0F A0 12 C0 19 00"), 8, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Injector Voltage Compensation", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Injector Voltage Compensation", ThisAddr, -1, -1);
DoneParameter = true;
}
if (ThisAddr == -1 && !DoneParameter) ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("FC 18 FF 38 80 00 80 00"), -92, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Injector Voltage Compensation", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Injector Voltage Compensation", ThisAddr, -1, -1);
DoneParameter = true;
}
//#######################################################################################################################
@ -136,37 +144,61 @@ class Class_DefinitionMaker
//MISSING ON SOME ROMS, HAVE TO CHECK FOR OTHERS BYTES ARRAY
DoneParameter = false;
ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("00 1E 00 00 00 03 00 05 00"), -8, false);
if (ThisAddr != -1) AddToList(Path.GetFileNameWithoutExtension(ThisFile), "MAF Load Limit", ThisAddr);
if (ThisAddr != -1) AddToList(Path.GetFileNameWithoutExtension(ThisFile), "MAF Load Limit", ThisAddr, -1, -1);
//#######################################################################################################################
//#######################################################################################################################
DoneParameter = false;
ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("7F FF F0 60 EF 98"), 181, false);
ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("7F FF F0 60 EF 98"), 182, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Minimum IPW", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Minimum IPW", ThisAddr, -1, -1);
DoneParameter = true;
}
if (ThisAddr == -1 && !DoneParameter) ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("05 66 05 66 02 00 00 00 00 01"), 36, true);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Minimum IPW", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Minimum IPW", ThisAddr, -1, -1);
DoneParameter = true;
}
//#######################################################################################################################
//#######################################################################################################################
//GET COOLANT TEMP LOCATION
DoneParameter = false;
int ThisAddrY = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("01 C2 02 12 02 53 03 20 27 10"), 166, false);
if (ThisAddrY != -1 && !DoneParameter) DoneParameter = true;
if (ThisAddrY == -1 && !DoneParameter) ThisAddrY = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("80 00 7F FF 7F FF 7F FF 7F FF"), 286, false);
if (ThisAddrY != -1 && !DoneParameter) DoneParameter = true;
if (ThisAddrY == -1 && !DoneParameter) ThisAddrY = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("80 00 FE D4 FF"), 174, false); //MAY CAUSE CERTAIN ISSUE
if (ThisAddrY != -1 && !DoneParameter) DoneParameter = true;
//####################################################################
DoneParameter = false;
ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("00 00 00 00 00 00 00 01 00 1E"), 16, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Idle Speed", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Idle Speed", ThisAddr, -1, ThisAddrY);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Post Start Idle Speed", ThisAddr + 16, -1, ThisAddrY);
DoneParameter = true;
}
if (ThisAddr == -1 && !DoneParameter) ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("C8 01 90 03 20 61 A8 00"), -75, true);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Idle Speed", ThisAddr);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Idle Speed", ThisAddr, -1, ThisAddrY);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "Post Start Idle Speed", ThisAddr + 16, -1, ThisAddrY);
DoneParameter = true;
}
//#######################################################################################################################
//#######################################################################################################################
DoneParameter = false;
ThisAddr = CheckForBytesAndGetAddress(AllBytes, StringToByteArray("01 90 01 90 01 90 FF 38"), 48, false);
if (ThisAddr != -1 && !DoneParameter)
{
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "WOT Determiniation 1(TPS)", ThisAddr, -1, -1);
AddToList(Path.GetFileNameWithoutExtension(ThisFile), "WOT Determiniation 2(TPS)", ThisAddr + 24, -1, -1);
DoneParameter = true;
}
//MISSING: WOT Determiniation (MAP)
//#######################################################################################################################
//#######################################################################################################################
}
GenerateDefinitions();
@ -189,6 +221,8 @@ class Class_DefinitionMaker
string FoundFunc = AllFoundFunctions[i];
int FoundAddr = AllFoundAddress[i];
int FoundAddrX = AllFoundAddressX[i];
int FoundAddrY = AllFoundAddressY[i];
if (FoundFunc == "VTEC Engagement")
{
@ -268,10 +302,10 @@ class Class_DefinitionMaker
AllStringFile = AllStringFile + "#############################" + Environment.NewLine;
}
if (FoundFunc == "Idle Speed")
if (FoundFunc == "Idle Speed" || FoundFunc == "Post Start Idle Speed")
{
AllStringFile = AllStringFile + "ROMLocationTable:0x" + FoundAddr.ToString("X") + Environment.NewLine;
//AllStringFile = AllStringFile + "ROMLocationY:0x" + FoundAddr.ToString("X") + Environment.NewLine;
if (FoundAddrY != -1) AllStringFile = AllStringFile + "ROMLocationY:0x" + FoundAddrY.ToString("X") + Environment.NewLine;
AllStringFile = AllStringFile + "Name:" + FoundFunc + Environment.NewLine;
AllStringFile = AllStringFile + "Unit1:Coolant Temp" + Environment.NewLine;
AllStringFile = AllStringFile + "Unit2:RPM" + Environment.NewLine;
@ -279,7 +313,23 @@ class Class_DefinitionMaker
AllStringFile = AllStringFile + "ValueMin:-1000" + Environment.NewLine;
AllStringFile = AllStringFile + "ValueMax:4000" + Environment.NewLine;
AllStringFile = AllStringFile + "ChangeAmount:50" + Environment.NewLine;
//AllStringFile = AllStringFile + "MathY:X/10" + Environment.NewLine;
if (FoundAddrY != -1) AllStringFile = AllStringFile + "MathY:X/10" + Environment.NewLine;
AllStringFile = AllStringFile + "#############################" + Environment.NewLine;
}
if (FoundFunc == "WOT Determiniation 1(TPS)" || FoundFunc == "WOT Determiniation 2(TPS)")
{
AllStringFile = AllStringFile + "ROMLocationTable:0x" + FoundAddr.ToString("X") + Environment.NewLine;
AllStringFile = AllStringFile + "Name:" + FoundFunc + Environment.NewLine;
AllStringFile = AllStringFile + "Unit1:RPM" + Environment.NewLine;
AllStringFile = AllStringFile + "Unit2:TPS(%)" + Environment.NewLine;
AllStringFile = AllStringFile + "TableSize:6x1" + Environment.NewLine;
AllStringFile = AllStringFile + "ValueMin:-50" + Environment.NewLine;
AllStringFile = AllStringFile + "ValueMax:200" + Environment.NewLine;
AllStringFile = AllStringFile + "MathTable:X*0.005" + Environment.NewLine;
AllStringFile = AllStringFile + "FormatTable:0.00" + Environment.NewLine;
AllStringFile = AllStringFile + "ChangeAmount:1" + Environment.NewLine;
AllStringFile = AllStringFile + "Headers:1000,2000,3000,4000,5000,6000" + Environment.NewLine;
AllStringFile = AllStringFile + "#############################" + Environment.NewLine;
}
}
@ -295,6 +345,8 @@ class Class_DefinitionMaker
File.Create(DirectoryPath + @"\" + ThisFile + ".txt").Dispose();
File.WriteAllText(DirectoryPath + @"\" + ThisFile + ".txt", AllString);
GForm_Main_0.method_1("File saved:" + DirectoryPath + @"\" + ThisFile + ".txt");
}
private string GenerateNewHeader(string ThisEECU)
@ -317,11 +369,13 @@ class Class_DefinitionMaker
return ReturnStr;
}
private void AddToList(string ThisECUName, string ThisFunction, int ThisAddr)
private void AddToList(string ThisECUName, string ThisFunction, int ThisAddr, int ThisAddrX, int ThisAddrY)
{
AllECUS.Add(ThisECUName);
AllFoundFunctions.Add(ThisFunction);
AllFoundAddress.Add(ThisAddr);
AllFoundAddressX.Add(ThisAddrX);
AllFoundAddressY.Add(ThisAddrY);
}
public byte[] StringToByteArray(string hex)
@ -361,7 +415,7 @@ class Class_DefinitionMaker
{
return i + AddressOffset;
}
else
if (FoundSameBytes && GetLastInstance)
{
LastIndexFound = i + AddressOffset;
}
@ -378,17 +432,13 @@ class Class_DefinitionMaker
public void GetFilesDifferenceCount()
{
//##########################################################################################################################
//string FirmwareFolder = Application.StartupPath + @"\Firmwares";
string FirmwareFolder = @"C:\Users\boule\Documents\Visual Studio 2019\Projects\RWD_2_BIN\bin\Debug\Firmwares";
//##########################################################################################################################
string[] AllFiles = Directory.GetFiles(FirmwareFolder, "*.bin");
string SavingText = "#######################################################################" + Environment.NewLine;
SavingText = SavingText + "# SHOWING THE AMOUNT OF BYTES DIFFERENCES BETWEEN 2 ECU FILE" + Environment.NewLine;
SavingText = SavingText + "# IF THERE WERE MORE THAN 500 DIFFERENCES, THE 2 FILES ARE NOT LISTED" + Environment.NewLine;
SavingText = SavingText + "#######################################################################" + Environment.NewLine;
GForm_Main_0.method_1(SavingText);
List<string> AllFileDiffChecked = new List<string>();
@ -420,8 +470,8 @@ class Class_DefinitionMaker
if (ByteDiffCount < 500)
{
Console.WriteLine(Path.GetFileNameWithoutExtension(ThisFile) + " && " + Path.GetFileNameWithoutExtension(ThisFile2) + " > " + ByteDiffCount);
SavingText = SavingText + Path.GetFileNameWithoutExtension(ThisFile) + " && " + Path.GetFileNameWithoutExtension(ThisFile2) + " > " + ByteDiffCount + Environment.NewLine;
GForm_Main_0.method_1(Path.GetFileNameWithoutExtension(ThisFile) + " && " + Path.GetFileNameWithoutExtension(ThisFile2) + " > " + ByteDiffCount);
//SavingText = SavingText + Path.GetFileNameWithoutExtension(ThisFile) + " && " + Path.GetFileNameWithoutExtension(ThisFile2) + " > " + ByteDiffCount + Environment.NewLine;
}
AllFileDiffChecked.Add(ThisFile2 + "|" + ThisFile);
@ -434,9 +484,366 @@ class Class_DefinitionMaker
}
string SavingPath = Application.StartupPath + @"\DifferencesCountInECUFiles.txt";
//string SavingPath = Application.StartupPath + @"\DifferencesCountInECUFiles.txt";
//File.Create(SavingPath).Dispose();
//File.WriteAllText(SavingPath, SavingText);
}
//##########################################################################################################################
//##########################################################################################################################
//##########################################################################################################################
//##########################################################################################################################
//##########################################################################################################################
public void CreateExtractedDefinition()
{
//string ExtractedDefinitionFile = @"C:\Users\boule\Desktop\Kserie\roms\hondata\37805-RWC-A620_Definition.txt";
//string SavingPath = Application.StartupPath + @"\37805-RWC-A620_Definition.txt";
int DumpsCount = CurrentExtractedDumps - 1;
if (DumpsCount >= 1)
{
for (int k = 0; k < DumpsCount; k++)
{
string ExtractedDefinitionFile = ThisEndPath + "ExtractedDefinition" + (k + 1).ToString() + ".txt";
string SavingPath = ThisEndPath + "GeneratedDefinition" + (k + 1).ToString() + ".txt";
if (File.Exists(ExtractedDefinitionFile))
{
string[] AllLines = File.ReadAllLines(ExtractedDefinitionFile);
List<string> AllParamName = new List<string>();
List<string> AllParamLocations = new List<string>();
List<bool> AllParamReadOnly = new List<bool>();
List<bool> AllParamUntested = new List<bool>();
List<string> AllTableName = new List<string>();
List<string> AllTableLocations = new List<string>();
List<string> AllTableLocationsX = new List<string>();
List<string> AllTableLocationsY = new List<string>();
List<int> AllRowCount = new List<int>();
List<int> AllColCount = new List<int>();
List<bool> AllTableReadOnly = new List<bool>();
List<bool> AllTableUntested = new List<bool>();
string CurrentParam = "";
for (int i = 0; i < AllLines.Length; i++)
{
try
{
if (AllLines[i].Contains("[Parameter"))
{
if (AllLines[i] != CurrentParam)
{
CurrentParam = AllLines[i];
AllParamName.Add(AllLines[i + 2].Split('=')[1]);
AllParamLocations.Add(AllLines[i + 7].Split('=')[1]);
if (AllLines[i + 17].Split('=')[1] == "0") AllParamReadOnly.Add(false);
if (AllLines[i + 17].Split('=')[1] == "1") AllParamReadOnly.Add(true);
if (AllLines[i + 18].Split('=')[1] == "0") AllParamUntested.Add(false);
if (AllLines[i + 18].Split('=')[1] == "1") AllParamUntested.Add(true);
}
}
if (AllLines[i].Contains("[Table"))
{
if (AllLines[i] != CurrentParam)
{
CurrentParam = AllLines[i];
AllTableName.Add(AllLines[i + 2].Split('=')[1]);
AllTableLocations.Add(AllLines[i + 5].Split('=')[1]);
AllColCount.Add(int.Parse(AllLines[i + 10].Split('=')[1]));
if (AllLines[i + 18].Split('=')[1] == "1") AllRowCount.Add(1);
if (AllLines[i + 18].Split('=')[1] == "0") AllRowCount.Add(20); //#####
if (AllLines[i + 6].Split('=')[1] != "0x00000") AllTableLocationsX.Add(AllLines[i + 6].Split('=')[1]);
if (AllLines[i + 6].Split('=')[1] == "0x00000") AllTableLocationsX.Add("");
if (AllLines[i + 7].Split('=')[1] != "0x00000") AllTableLocationsY.Add(AllLines[i + 7].Split('=')[1]);
if (AllLines[i + 7].Split('=')[1] == "0x00000") AllTableLocationsY.Add("");
if (AllLines[i + 15].Split('=')[1] == "0") AllTableReadOnly.Add(false);
if (AllLines[i + 15].Split('=')[1] == "1") AllTableReadOnly.Add(true);
if (AllLines[i + 16].Split('=')[1] == "0") AllTableUntested.Add(false);
if (AllLines[i + 16].Split('=')[1] == "1") AllTableUntested.Add(true);
}
}
}
catch (Exception ex)
{
GForm_Main_0.method_1("PROBLEM OCCURED while Generating Definitions file: " + ex);
}
}
string SavingStr = "";
for (int i = 0; i < AllParamName.Count; i++)
{
SavingStr = SavingStr + "ROMLocationTable:" + AllParamLocations[i] + Environment.NewLine;
SavingStr = SavingStr + "Name:" + AllParamName[i] + Environment.NewLine;
SavingStr = SavingStr + "TableSize:1x1" + Environment.NewLine;
SavingStr = SavingStr + "IsSingleByteTable:true" + Environment.NewLine;
SavingStr = SavingStr + "IsNotDefined:true" + Environment.NewLine;
if (AllParamReadOnly[i]) SavingStr = SavingStr + "IsReadOnly:true" + Environment.NewLine;
if (AllParamUntested[i]) SavingStr = SavingStr + "IsUntested:true" + Environment.NewLine;
if (i < AllParamName.Count - 2) SavingStr = SavingStr + "#############################" + Environment.NewLine;
}
SavingStr = SavingStr + "#############################################################" + Environment.NewLine;
SavingStr = SavingStr + "#############################################################" + Environment.NewLine;
SavingStr = SavingStr + "#############################################################" + Environment.NewLine;
for (int i = 0; i < AllTableName.Count; i++)
{
SavingStr = SavingStr + "ROMLocationTable:" + AllTableLocations[i] + Environment.NewLine;
if (AllTableLocationsX[i] != "") SavingStr = SavingStr + "ROMLocationX:" + AllTableLocationsX[i] + Environment.NewLine;
if (AllTableLocationsY[i] != "") SavingStr = SavingStr + "ROMLocationY:" + AllTableLocationsY[i] + Environment.NewLine;
SavingStr = SavingStr + "Name:" + AllTableName[i] + Environment.NewLine;
SavingStr = SavingStr + "TableSize:" + AllColCount[i] + "x" + AllRowCount[i] + Environment.NewLine;
SavingStr = SavingStr + "ValueMin:-32768" + Environment.NewLine;
SavingStr = SavingStr + "ValueMax:32768" + Environment.NewLine;
//SavingStr = SavingStr + "IsSingleByteTable:true" + Environment.NewLine;
SavingStr = SavingStr + "IsNotDefined:true" + Environment.NewLine;
if (AllTableReadOnly[i]) SavingStr = SavingStr + "IsReadOnly:true" + Environment.NewLine;
if (AllTableUntested[i]) SavingStr = SavingStr + "IsUntested:true" + Environment.NewLine;
SavingStr = SavingStr + "#############################" + Environment.NewLine;
}
File.Create(SavingPath).Dispose();
File.WriteAllText(SavingPath, SavingText);
File.WriteAllText(SavingPath, SavingStr);
GForm_Main_0.method_1("Generated Definitions file created: " + SavingPath);
}
}
}
}
// REQUIRED CONSTS
const int PROCESS_QUERY_INFORMATION = 0x0400;
const int MEM_COMMIT = 0x00001000;
const int PAGE_READWRITE = 0x04;
const int PROCESS_WM_READ = 0x0010;
// REQUIRED METHODS
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
[DllImport("kernel32.dll")]
static extern void GetSystemInfo(out SYSTEM_INFO lpSystemInfo);
[DllImport("kernel32.dll", SetLastError = true)]
static extern int VirtualQueryEx(IntPtr hProcess, IntPtr lpAddress, out MEMORY_BASIC_INFORMATION lpBuffer, uint dwLength);
public int BlockSizeExtracted = 30000000;
public Int64 CurrentIndex = 4000000;
public IntPtr proc_min_address;
public IntPtr proc_max_address;
public long proc_min_address_l;
public long proc_max_address_l;
public Process process;
public bool Done = false;
public string ThisEndPath = Application.StartupPath + @"\Extracted\";
public int CurrentExtractedDumps = 1;
public int ExtractedBlockDone = 1;
// REQUIRED STRUCTS
public struct MEMORY_BASIC_INFORMATION
{
public int BaseAddress;
public int AllocationBase;
public int AllocationProtect;
public int RegionSize;
public int State;
public int Protect;
public int lType;
}
public struct SYSTEM_INFO
{
public ushort processorArchitecture;
ushort reserved;
public uint pageSize;
public IntPtr minimumApplicationAddress;
public IntPtr maximumApplicationAddress;
public IntPtr activeProcessorMask;
public uint numberOfProcessors;
public uint processorType;
public uint allocationGranularity;
public ushort processorLevel;
public ushort processorRevision;
}
public bool Extract()
{
try
{
SYSTEM_INFO sys_info = new SYSTEM_INFO();
GetSystemInfo(out sys_info);
//CurrentIndex = 4000000;
CurrentIndex = 0;
Done = false;
ExtractedBlockDone = 1;
CurrentExtractedDumps = 1;
RemovePastDump();
long MaxIndex = (CurrentIndex + BlockSizeExtracted);
proc_min_address = (IntPtr)CurrentIndex;
proc_max_address = (IntPtr)MaxIndex;
proc_min_address_l = (long)proc_min_address;
proc_max_address_l = (long)proc_max_address;
GForm_Main_0.method_1("------------------------------------------");
GForm_Main_0.method_1("Extracting...");
if (!Directory.Exists(ThisEndPath)) Directory.CreateDirectory(ThisEndPath);
Process[] ProcList = Process.GetProcessesByName("FlashProManager");
if (ProcList.Length == 0)
{
GForm_Main_0.method_1("FlashProManager is not running");
return false;
}
else
{
process = Process.GetProcessesByName("FlashProManager")[0];
GForm_Main_0.method_1("FlashProManager is running...");
//RemovePastDump();
string ReloadDump = "";
while (!Done)
{
int Percent = (int)(((CurrentIndex - 4000000) * 100) / (Int64.Parse(sys_info.maximumApplicationAddress.ToString()) - 1));
//Console.Write("\nSEARCH #" + SearchID + " " + Percent + "%");
GForm_Main_0.method_4(Percent);
if ((CurrentIndex + BlockSizeExtracted) > Int64.Parse(sys_info.maximumApplicationAddress.ToString()))
{
Done = true;
}
else
{
MaxIndex = (CurrentIndex + BlockSizeExtracted);
proc_min_address = (IntPtr)CurrentIndex;
proc_max_address = (IntPtr)MaxIndex;
proc_min_address_l = (long)proc_min_address;
proc_max_address_l = (long)proc_max_address;
ExtractMemoryBlock();
//ReloadDump = ReloadDumpFile();
ReloadDump = File.ReadAllText(ThisEndPath + "DumpHex" + ExtractedBlockDone);
//5B446566696E6974696F6E5D ->[Definition]
if (ReloadDump.Contains("[Definition]"))
{
//GForm_Main_0.method_1("Found Definition in DumpHex" + ExtractedBlockDone);
Console.WriteLine("Found Definition in DumpHex" + ExtractedBlockDone);
CurrentExtractedDumps++;
string DumpedDefinition = ReloadDump.Substring(ReloadDump.IndexOf("[Definition]"));
DumpedDefinition = DumpedDefinition.Substring(0, DumpedDefinition.LastIndexOf("ConditionalEnableValue=") + 24);
DumpedDefinition = DumpedDefinition.Replace("..", "\n");
string SaveDefPath = ThisEndPath + "ExtractedDefinition" + (CurrentExtractedDumps-1).ToString() + ".txt";
GForm_Main_0.method_1("Extracted Definitions file created: " + SaveDefPath);
File.Create(SaveDefPath).Dispose();
File.WriteAllText(SaveDefPath, DumpedDefinition);
}
}
CurrentIndex += BlockSizeExtracted;
ExtractedBlockDone++;
}
RemovePastDump();
GForm_Main_0.ResetProgressBar();
if (CurrentExtractedDumps == 1)
{
GForm_Main_0.method_1("No definitions found loaded in memory\nTry saving your calibration in FlashProManager with small changes and retry this feature");
return false;
}
else
{
GForm_Main_0.method_1((CurrentExtractedDumps - 1) + " definitions found!");
return true;
}
}
}
catch (Exception message)
{
GForm_Main_0.ResetProgressBar();
GForm_Main_0.method_1("Cannot extract! Error:\n" + message);
return false;
}
}
void RemovePastDump()
{
string[] FileList = Directory.GetFiles(ThisEndPath, "Dump*");
if (FileList.Length > 0)
{
for (int i = 0; i < FileList.Length; i++)
{
File.Delete(FileList[i]);
}
}
}
/*string ReloadDumpFile()
{
string ReloadDump = File.ReadAllText(ThisEndPath + "Dump" + ExtractedBlockDone + ".txt");
ReloadDump = ReloadDump.Replace("\n", "");
ReloadDump = ReloadDump.Replace("\r", "");
ReloadDump = ReloadDump.Replace(" ", "");
File.WriteAllText(ThisEndPath + "Dump" + ExtractedBlockDone + ".txt", ReloadDump);
//ExtractedBytes = File.ReadAllBytes(ThisEndPath + "DumpHex");
return ReloadDump;
}*/
void ExtractMemoryBlock()
{
int bytesRead = 0;
IntPtr processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_WM_READ, false, process.Id);
MEMORY_BASIC_INFORMATION mem_basic_info = new MEMORY_BASIC_INFORMATION();
//StreamWriter sw = new StreamWriter(ThisEndPath + "Dump" + ExtractedBlockDone + ".txt");
StreamWriter sw2 = new StreamWriter(ThisEndPath + "DumpHex" + ExtractedBlockDone);
while (proc_min_address_l < proc_max_address_l)
{
VirtualQueryEx(processHandle, proc_min_address, out mem_basic_info, 28);
if (mem_basic_info.Protect == PAGE_READWRITE && mem_basic_info.State == MEM_COMMIT)
{
byte[] buffer = new byte[mem_basic_info.RegionSize];
ReadProcessMemory((int)processHandle, mem_basic_info.BaseAddress, buffer, mem_basic_info.RegionSize, ref bytesRead);
for (int i = 0; i < mem_basic_info.RegionSize; i++)
{
//sw.WriteLine(buffer[i].ToString("X2"));
sw2.Write((char)buffer[i]);
}
}
proc_min_address_l += mem_basic_info.RegionSize;
proc_min_address = new IntPtr(proc_min_address_l);
}
//sw.Close();
sw2.Close();
}
//##########################################################################################################################
@ -447,11 +854,6 @@ class Class_DefinitionMaker
public void ExtractAllBootLoaderSum_1Mb()
{
//##########################################################################################################################
//string FirmwareFolder = Application.StartupPath + @"\Firmwares";
string FirmwareFolder = @"C:\Users\boule\Documents\Visual Studio 2019\Projects\RWD_2_BIN\bin\Debug\Firmwares";
//##########################################################################################################################
AllFileNames = new List<string>();
AllBootLoaderSumBytes = new List<byte>();
@ -471,6 +873,8 @@ class Class_DefinitionMaker
string SavingPath = Application.StartupPath + @"\BootLoaderSumBytesList.txt";
File.Create(SavingPath).Dispose();
File.WriteAllText(SavingPath, SavingText);
GForm_Main_0.method_1("File saved:" + SavingPath);
}
public byte GetBootloaderSum(byte[] FWFileBytes)

View File

@ -8,6 +8,7 @@ using System.Drawing;
using System.Windows.Forms;
using DarkUI.Controls;
using DarkUI.Forms;
using System.Runtime.CompilerServices;
public class Editortable : DarkForm
{
@ -17,9 +18,7 @@ public class Editortable : DarkForm
private IContainer icontainer_1;
public bool bool_0 = true;
public static float float_0 = 1f;
private List<string> list_0 = new List<string>();
public static float[] float_1 = new float[2];
private TableLayoutPanel tableLayoutPanel1;
private DarkTreeView treeView1;
private DarkGroupBox groupBox1;
public DataGridView dataGridView_0;
@ -39,9 +38,22 @@ public class Editortable : DarkForm
private ToolStripMenuItem openDefinitionsFolderToolStripMenuItem;
private ToolStripDropDownButton toolStripDropDownButton2;
private ToolStripMenuItem undoToolStripMenuItem;
private ToolStripMenuItem redoToolStripMenuItem;
public ToolStripMenuItem redoToolStripMenuItem;
private ToolStripSeparator toolStripSeparator2;
private ToolStripMenuItem increaseSelectionToolStripMenuItem;
private SplitContainer splitContainer1;
private SplitContainer splitContainer2;
private DarkTextBox darkTextBox_0;
private ToolStripDropDownButton toolStripDropDownButton3;
private ToolStripMenuItem developpersToolsToolStripMenuItem;
private ToolStripMenuItem generateDefinitionsFilesToolStripMenuItem;
private ToolStripMenuItem getDifferencesInAllFirmwaresFilesToolStripMenuItem;
private ToolStripMenuItem extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem;
private ToolStripMenuItem extractDefinitionToolStripMenuItem;
private FolderBrowserDialog folderBrowserDialog1;
private ToolStripMenuItem removeBootloaderInbinToolStripMenuItem;
private ToolStripSeparator toolStripSeparator3;
private ToolStripMenuItem generateDefinitionFileFromExtractedDefinitionToolStripMenuItem;
private ToolStripMenuItem decreaseSelectionToolStripMenuItem;
internal Editortable(ref GForm_Main GForm_Main_1)
@ -55,17 +67,48 @@ public class Editortable : DarkForm
if (this.ClassEditor_0 != null) this.ClassEditor_0 = null;
this.ClassEditor_0 = new ClassEditor(ref Editortable_0);
this.Text = "Honda Rom Tables Editor (" + this.GForm_Main_0.Version + ")";
}
this.Text = this.Text + " (" + this.GForm_Main_0.Version + ")";
public void Loadingg()
{
string LastOpenFilePath = Application.StartupPath + @"\LastFileOpened.txt";
if (File.Exists(LastOpenFilePath))
{
DialogResult result = DarkMessageBox.Show(this, "Do you want to reopen the last file you have worked on?", "Reopen last file used", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (result == DialogResult.Yes)
{
LoadThisFile(File.ReadAllText(LastOpenFilePath));
}
}
}
public void method_Log(string string_3)
{
this.darkTextBox_0.Text += string_3;
//Console.Write(string_3);
}
public void method_1(string string_3)
{
try
{
//With newline automaticly added
//Console.WriteLine(string_3);
Editortable.Class5 @class = new Editortable.Class5();
@class.Editortable_0 = this;
@class.string_0 = string_3;
this.darkTextBox_0.BeginInvoke(new MethodInvoker(@class.method_0));
}
catch { }
}
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Editortable));
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.treeView1 = new DarkUI.Controls.DarkTreeView();
this.groupBox1 = new DarkUI.Controls.DarkGroupBox();
this.dataGridView_0 = new System.Windows.Forms.DataGridView();
@ -84,38 +127,41 @@ public class Editortable : DarkForm
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.increaseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.decreaseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tableLayoutPanel1.SuspendLayout();
this.toolStripDropDownButton3 = new System.Windows.Forms.ToolStripDropDownButton();
this.developpersToolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.generateDefinitionsFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.getDifferencesInAllFirmwaresFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.extractDefinitionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.darkTextBox_0 = new DarkUI.Controls.DarkTextBox();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.removeBootloaderInbinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.generateDefinitionFileFromExtractedDefinitionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView_0)).BeginInit();
this.darkToolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 260F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.treeView1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 1, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 28);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 517F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1100, 517);
this.tableLayoutPanel1.TabIndex = 11;
//
// treeView1
//
this.treeView1.BackColor = System.Drawing.SystemColors.ControlDark;
this.treeView1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeView1.EvenNodeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.treeView1.FocusedNodeColor = System.Drawing.Color.FromArgb(((int)(((byte)(75)))), ((int)(((byte)(110)))), ((int)(((byte)(175)))));
this.treeView1.ImageIndex = 0;
this.treeView1.ImageList = null;
this.treeView1.Location = new System.Drawing.Point(2, 2);
this.treeView1.Location = new System.Drawing.Point(0, 0);
this.treeView1.Margin = new System.Windows.Forms.Padding(2);
this.treeView1.MaxDragChange = 20;
this.treeView1.Name = "treeView1";
@ -123,7 +169,7 @@ public class Editortable : DarkForm
this.treeView1.OddNodeColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(60)))), ((int)(((byte)(62)))));
this.treeView1.SelectedImageIndex = 0;
this.treeView1.SelectWithArrowKeys = false;
this.treeView1.Size = new System.Drawing.Size(256, 513);
this.treeView1.Size = new System.Drawing.Size(297, 517);
this.treeView1.TabIndex = 2;
this.treeView1.SelectedNodesChanged += new System.EventHandler(this.treeView1_AfterSelect);
//
@ -132,11 +178,11 @@ public class Editortable : DarkForm
this.groupBox1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.groupBox1.Controls.Add(this.dataGridView_0);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(262, 2);
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
this.groupBox1.Size = new System.Drawing.Size(836, 513);
this.groupBox1.Size = new System.Drawing.Size(799, 361);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Table:";
@ -147,52 +193,50 @@ public class Editortable : DarkForm
this.dataGridView_0.AllowUserToDeleteRows = false;
this.dataGridView_0.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.dataGridView_0.BackgroundColor = System.Drawing.SystemColors.ControlDarkDark;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView_0.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.ControlDarkDark;
dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView_0.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
this.dataGridView_0.ColumnHeadersHeight = 20;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.ControlLight;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridView_0.DefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.ControlLight;
dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridView_0.DefaultCellStyle = dataGridViewCellStyle8;
this.dataGridView_0.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView_0.EnableHeadersVisualStyles = false;
this.dataGridView_0.GridColor = System.Drawing.SystemColors.ControlDarkDark;
this.dataGridView_0.Location = new System.Drawing.Point(2, 15);
this.dataGridView_0.Margin = new System.Windows.Forms.Padding(2);
this.dataGridView_0.Name = "dataGridView_0";
this.dataGridView_0.ReadOnly = true;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.ControlDarkDark;
dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView_0.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.ControlDarkDark;
dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView_0.RowHeadersDefaultCellStyle = dataGridViewCellStyle9;
this.dataGridView_0.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
this.dataGridView_0.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridView_0.RowTemplate.Height = 31;
this.dataGridView_0.Size = new System.Drawing.Size(832, 496);
this.dataGridView_0.Size = new System.Drawing.Size(795, 344);
this.dataGridView_0.TabIndex = 4;
this.dataGridView_0.TabStop = false;
this.dataGridView_0.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.CellValueChanged);
this.dataGridView_0.DoubleClick += new System.EventHandler(this.method_3);
this.dataGridView_0.KeyDown += new System.Windows.Forms.KeyEventHandler(this.method_4);
//
// openFileDialog1
//
this.openFileDialog1.DefaultExt = "*.bin";
this.openFileDialog1.Filter = "Honda full binary rom file|*.bin|Honda decompressed firmware binary|*.bin";
this.openFileDialog1.Filter = "Honda binary rom file|*.bin";
this.openFileDialog1.Title = "Open File";
//
// saveFileDialog1
@ -208,7 +252,8 @@ public class Editortable : DarkForm
this.darkToolStrip1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.darkToolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripDropDownButton1,
this.toolStripDropDownButton2});
this.toolStripDropDownButton2,
this.toolStripDropDownButton3});
this.darkToolStrip1.Location = new System.Drawing.Point(0, 0);
this.darkToolStrip1.Name = "darkToolStrip1";
this.darkToolStrip1.Padding = new System.Windows.Forms.Padding(5, 0, 1, 0);
@ -297,11 +342,11 @@ public class Editortable : DarkForm
// undoToolStripMenuItem
//
this.undoToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.undoToolStripMenuItem.Enabled = false;
this.undoToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(153)))), ((int)(((byte)(153)))));
this.undoToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.undoToolStripMenuItem.Name = "undoToolStripMenuItem";
this.undoToolStripMenuItem.Size = new System.Drawing.Size(172, 22);
this.undoToolStripMenuItem.Text = "Undo";
this.undoToolStripMenuItem.Click += new System.EventHandler(this.undoToolStripMenuItem_Click);
//
// redoToolStripMenuItem
//
@ -311,6 +356,7 @@ public class Editortable : DarkForm
this.redoToolStripMenuItem.Name = "redoToolStripMenuItem";
this.redoToolStripMenuItem.Size = new System.Drawing.Size(172, 22);
this.redoToolStripMenuItem.Text = "Redo";
this.redoToolStripMenuItem.Click += new System.EventHandler(this.redoToolStripMenuItem_Click);
//
// toolStripSeparator2
//
@ -338,23 +384,168 @@ public class Editortable : DarkForm
this.decreaseSelectionToolStripMenuItem.Text = "Decrease Selection";
this.decreaseSelectionToolStripMenuItem.Click += new System.EventHandler(this.decreaseSelectionToolStripMenuItem_Click);
//
// toolStripDropDownButton3
//
this.toolStripDropDownButton3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.toolStripDropDownButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripDropDownButton3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.removeBootloaderInbinToolStripMenuItem,
this.toolStripSeparator3,
this.developpersToolsToolStripMenuItem});
this.toolStripDropDownButton3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.toolStripDropDownButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton3.Image")));
this.toolStripDropDownButton3.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripDropDownButton3.Name = "toolStripDropDownButton3";
this.toolStripDropDownButton3.Size = new System.Drawing.Size(47, 25);
this.toolStripDropDownButton3.Text = "Tools";
//
// developpersToolsToolStripMenuItem
//
this.developpersToolsToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.developpersToolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.generateDefinitionsFilesToolStripMenuItem,
this.getDifferencesInAllFirmwaresFilesToolStripMenuItem,
this.extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem,
this.extractDefinitionToolStripMenuItem,
this.generateDefinitionFileFromExtractedDefinitionToolStripMenuItem});
this.developpersToolsToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.developpersToolsToolStripMenuItem.Name = "developpersToolsToolStripMenuItem";
this.developpersToolsToolStripMenuItem.Size = new System.Drawing.Size(214, 22);
this.developpersToolsToolStripMenuItem.Text = "Developpers Tools";
//
// generateDefinitionsFilesToolStripMenuItem
//
this.generateDefinitionsFilesToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.generateDefinitionsFilesToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.generateDefinitionsFilesToolStripMenuItem.Name = "generateDefinitionsFilesToolStripMenuItem";
this.generateDefinitionsFilesToolStripMenuItem.Size = new System.Drawing.Size(367, 22);
this.generateDefinitionsFilesToolStripMenuItem.Text = "Generate Definitions files from all firmwares files";
this.generateDefinitionsFilesToolStripMenuItem.Click += new System.EventHandler(this.generateDefinitionsFilesToolStripMenuItem_Click);
//
// getDifferencesInAllFirmwaresFilesToolStripMenuItem
//
this.getDifferencesInAllFirmwaresFilesToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.getDifferencesInAllFirmwaresFilesToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.getDifferencesInAllFirmwaresFilesToolStripMenuItem.Name = "getDifferencesInAllFirmwaresFilesToolStripMenuItem";
this.getDifferencesInAllFirmwaresFilesToolStripMenuItem.Size = new System.Drawing.Size(367, 22);
this.getDifferencesInAllFirmwaresFilesToolStripMenuItem.Text = "Get differences count in all firmwares files";
this.getDifferencesInAllFirmwaresFilesToolStripMenuItem.Click += new System.EventHandler(this.getDifferencesInAllFirmwaresFilesToolStripMenuItem_Click);
//
// extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem
//
this.extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem.Name = "extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem";
this.extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem.Size = new System.Drawing.Size(367, 22);
this.extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem.Text = "Extract all bootloader \'sum\' byte from all firmwares files";
this.extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem.Click += new System.EventHandler(this.extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem_Click);
//
// extractDefinitionToolStripMenuItem
//
this.extractDefinitionToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.extractDefinitionToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.extractDefinitionToolStripMenuItem.Name = "extractDefinitionToolStripMenuItem";
this.extractDefinitionToolStripMenuItem.Size = new System.Drawing.Size(367, 22);
this.extractDefinitionToolStripMenuItem.Text = "Extract Definition file";
this.extractDefinitionToolStripMenuItem.Click += new System.EventHandler(this.extractDefinitionToolStripMenuItem_Click);
//
// splitContainer1
//
this.splitContainer1.BackColor = System.Drawing.SystemColors.ControlDark;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 28);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.treeView1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1100, 517);
this.splitContainer1.SplitterDistance = 297;
this.splitContainer1.TabIndex = 4;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.groupBox1);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.darkTextBox_0);
this.splitContainer2.Size = new System.Drawing.Size(799, 517);
this.splitContainer2.SplitterDistance = 361;
this.splitContainer2.TabIndex = 0;
//
// darkTextBox_0
//
this.darkTextBox_0.Dock = System.Windows.Forms.DockStyle.Fill;
this.darkTextBox_0.Location = new System.Drawing.Point(0, 0);
this.darkTextBox_0.Multiline = true;
this.darkTextBox_0.Name = "darkTextBox_0";
this.darkTextBox_0.Size = new System.Drawing.Size(799, 152);
this.darkTextBox_0.TabIndex = 56;
this.darkTextBox_0.Text = "Honda CANBUS Tools";
//
// toolStripSeparator3
//
this.toolStripSeparator3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.toolStripSeparator3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.toolStripSeparator3.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(211, 6);
//
// removeBootloaderInbinToolStripMenuItem
//
this.removeBootloaderInbinToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.removeBootloaderInbinToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.removeBootloaderInbinToolStripMenuItem.Name = "removeBootloaderInbinToolStripMenuItem";
this.removeBootloaderInbinToolStripMenuItem.Size = new System.Drawing.Size(214, 22);
this.removeBootloaderInbinToolStripMenuItem.Text = "Remove Bootloader in .bin";
this.removeBootloaderInbinToolStripMenuItem.Click += new System.EventHandler(this.removeBootloaderInbinToolStripMenuItem_Click);
//
// generateDefinitionFileFromExtractedDefinitionToolStripMenuItem
//
this.generateDefinitionFileFromExtractedDefinitionToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.generateDefinitionFileFromExtractedDefinitionToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.generateDefinitionFileFromExtractedDefinitionToolStripMenuItem.Name = "generateDefinitionFileFromExtractedDefinitionToolStripMenuItem";
this.generateDefinitionFileFromExtractedDefinitionToolStripMenuItem.Size = new System.Drawing.Size(367, 22);
this.generateDefinitionFileFromExtractedDefinitionToolStripMenuItem.Text = "Generate Definition file from Extracted Definition";
this.generateDefinitionFileFromExtractedDefinitionToolStripMenuItem.Click += new System.EventHandler(this.generateDefinitionFileFromExtractedDefinitionToolStripMenuItem_Click);
//
// Editortable
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1100, 545);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.darkToolStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "Editortable";
this.Text = "Honda Rom Tables Editor";
this.Load += new System.EventHandler(this.Editortable_Load);
this.tableLayoutPanel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView_0)).EndInit();
this.darkToolStrip1.ResumeLayout(false);
this.darkToolStrip1.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
this.splitContainer2.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -374,10 +565,7 @@ public class Editortable : DarkForm
{
ClassEditor_0.LoadThisECUDefinitions(string_9);
foreach (string str2 in ClassEditor_0.DefinitionsName)
{
this.list_0.Add(str2);
}
//foreach (string str2 in ClassEditor_0.DefinitionsName) this.NodesNameList.Add(str2);
return true;
}
}
@ -387,7 +575,7 @@ public class Editortable : DarkForm
public void method_1()
{
ClassEditor_0.bool_1 = false;
ClassEditor_0.CanReloadTablesValues = false;
if (!ClassEditor_0.LoadROMbytes(LoadedFilename))
{
DarkMessageBox.Show("Failed to open Binary file.");
@ -398,29 +586,57 @@ public class Editortable : DarkForm
}
else
{
this.SetNodesImages();
this.CreateNodes();
}
ClassEditor_0.bool_1 = true;
ClassEditor_0.CanReloadTablesValues = true;
}
private void CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (ClassEditor_0.bool_1)
if (ClassEditor_0.CanReloadTablesValues)
{
ClassEditor_0.bool_2 = true;
ClassEditor_0.ValuesChanged = true;
ClassEditor_0.SetBackColor(dataGridView_0.Columns.Count, float_1[0], float_1[1]);
}
}
public void SetNodesImages()
public void CreateNodes()
{
this.treeView1.Nodes.Clear();
int num = 0;
List<string> AllUndefininedNodes = new List<string>();
List<string> AllUntestedNodes = new List<string>();
List<string> AllReadOnlyNodes = new List<string>();
//Makes Nodes
foreach (string str in this.list_0)
for (int i = 0; i < ClassEditor_0.DefinitionsName.Count; i++)
{
//#############################################
if (ClassEditor_0.DefinitionsIsReadOnly[i])
{
AllReadOnlyNodes.Add(ClassEditor_0.DefinitionsName[i]);
}
if (ClassEditor_0.DefinitionsIsUntested[i] && !ClassEditor_0.DefinitionsIsReadOnly[i])
{
AllUntestedNodes.Add(ClassEditor_0.DefinitionsName[i]);
}
if (ClassEditor_0.DefinitionsIsNotDefined[i] && !ClassEditor_0.DefinitionsIsUntested[i] && !ClassEditor_0.DefinitionsIsReadOnly[i])
{
AllUndefininedNodes.Add(ClassEditor_0.DefinitionsName[i]);
}
//#############################################
if (!ClassEditor_0.DefinitionsIsNotDefined[i] && !ClassEditor_0.DefinitionsIsUntested[i] && !ClassEditor_0.DefinitionsIsReadOnly[i])
{
string str = ClassEditor_0.DefinitionsName[i];
DarkTreeNode ThisNode = new DarkTreeNode();
if (str.ToString().Contains("----"))
{
ThisNode.Text = str.Replace("----", "");
this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes[this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes.Count - 1].Nodes.Add(ThisNode);
continue;
}
if (str.ToString().Contains("--"))
{
ThisNode.Text = str.Replace("--", "");
@ -432,7 +648,72 @@ public class Editortable : DarkForm
ThisNode.Text = str;
this.treeView1.Nodes.Add(ThisNode);
}
}
//Make Undefined Nodes
DarkTreeNode ThisNodeUnDefined = new DarkTreeNode();
ThisNodeUnDefined.Text = "Undefined parameters";
if (AllUndefininedNodes.Count > 0) this.treeView1.Nodes.Add(ThisNodeUnDefined);
for (int i = 0; i < AllUndefininedNodes.Count; i++)
{
string str = AllUndefininedNodes[i];
DarkTreeNode ThisNode = new DarkTreeNode();
if (str.ToString().Contains("--"))
{
ThisNode.Text = str.Replace("--", "");
this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes.Add(ThisNode);
//this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes[this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes.Count - 1].Nodes.Add(ThisNode);
continue;
}
num++;
ThisNode.Text = str;
this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes.Add(ThisNode);
}
//Make Untested Nodes
DarkTreeNode ThisNodeUnTested = new DarkTreeNode();
ThisNodeUnTested.Text = "Untested parameters";
if (AllUntestedNodes.Count > 0) this.treeView1.Nodes.Add(ThisNodeUnTested);
for (int i = 0; i < AllUntestedNodes.Count; i++)
{
string str = AllUntestedNodes[i];
DarkTreeNode ThisNode = new DarkTreeNode();
if (str.ToString().Contains("--"))
{
ThisNode.Text = str.Replace("--", "");
this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes.Add(ThisNode);
//this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes[this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes.Count - 1].Nodes.Add(ThisNode);
continue;
}
num++;
ThisNode.Text = str;
this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes.Add(ThisNode);
}
//Make ReadOnly Nodes
DarkTreeNode ThisNodeReadOnly = new DarkTreeNode();
ThisNodeReadOnly.Text = "ReadOnly parameters";
if (AllUntestedNodes.Count > 0) this.treeView1.Nodes.Add(ThisNodeReadOnly);
for (int i = 0; i < AllReadOnlyNodes.Count; i++)
{
string str = AllReadOnlyNodes[i];
DarkTreeNode ThisNode = new DarkTreeNode();
if (str.ToString().Contains("--"))
{
ThisNode.Text = str.Replace("--", "");
this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes.Add(ThisNode);
//this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes[this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes.Count - 1].Nodes.Add(ThisNode);
continue;
}
num++;
ThisNode.Text = str;
this.treeView1.Nodes[this.treeView1.Nodes.Count - 1].Nodes.Add(ThisNode);
}
//####################################################################################
/*foreach (DarkTreeNode node in this.treeView1.Nodes)
{
if (node.Nodes.Count > 0)
@ -458,11 +739,7 @@ public class Editortable : DarkForm
node.SelectedImageKey = "Degree";
}//...
}*/
}
private void method_3(object sender, EventArgs e)
{
dataGridView_0.ReadOnly = false;
//####################################################################################
}
private void method_4(object sender, KeyEventArgs e)
@ -569,16 +846,15 @@ public class Editortable : DarkForm
{
if (this.treeView1.SelectedNodes.Count == 0) return;
if ((this.treeView1.SelectedNode != null) && ClassEditor_0.bool_1)
if ((this.treeView1.SelectedNode != null) && ClassEditor_0.CanReloadTablesValues)
{
ClassEditor_0.bool_1 = false;
ClassEditor_0.CanReloadTablesValues = false;
//##################################################################################
if (ClassEditor_0.bool_2 && ClassEditor_0.SelectedTableSize != 0 && ClassEditor_0.SelectedROMLocation != 0)
if (ClassEditor_0.ValuesChanged && ClassEditor_0.SelectedTableSize != 0 && ClassEditor_0.SelectedROMLocation != 0)
{
ClassEditor_0.GetChanges();
ClassEditor_0.string_2 = ClassEditor_0.string_2 + ClassEditor_0.string_3 + Environment.NewLine;
}
ClassEditor_0.bool_2 = false;
ClassEditor_0.ValuesChanged = false;
//##################################################################################
this.groupBox1.Text = "Table: " + this.treeView1.SelectedNode.Text;
@ -592,7 +868,7 @@ public class Editortable : DarkForm
if (NodeIndex == -1)
{
Editortable_0.GForm_Main_0.method_1("ROM Indexing error with Nodes!");
ClassEditor_0.bool_1 = true;
ClassEditor_0.CanReloadTablesValues = true;
return;
}
@ -601,7 +877,7 @@ public class Editortable : DarkForm
{
try
{
ClassEditor_0.bool_1 = true;
ClassEditor_0.CanReloadTablesValues = true;
this.treeView1.SelectNode(this.treeView1.SelectedNode.Nodes[0]);
}
catch { }
@ -649,15 +925,29 @@ public class Editortable : DarkForm
textArray1 = ClassEditor_0.GetAdvancedHeader(TableSizze[0], ParamHeaderLocation, ClassEditor_0.DefinitionsMathY[NodeIndex], ClassEditor_0.DefinitionsFormatY[NodeIndex]);
}
this.groupBox1.Text = "Table: " + this.treeView1.SelectedNode.Text + " (" + ClassEditor_0.DefinitionsLocationsTable[NodeIndex] + ")";
ClassEditor_0.SelectedTableIndexInDefinitions = NodeIndex;
//Show Value in Datagridview
ClassEditor_0.SetTableValues(TableSizze, ParamLocation, ClassEditor_0.DefinitionsUnit1[NodeIndex], ClassEditor_0.DefinitionsUnit2[NodeIndex], textArray1, ClassEditor_0.DefinitionsMathX[NodeIndex], ClassEditor_0.DefinitionsFormatX[NodeIndex], ClassEditor_0.DefinitionsIsXYInverted[NodeIndex], ClassEditor_0.HexStringToInt(ClassEditor_0.DefinitionsLocationsTable[NodeIndex]), ClassEditor_0.DefinitionsMathTable[NodeIndex], ClassEditor_0.DefinitionsFormatTable[NodeIndex], ClassEditor_0.DefinitionsIsTableInverted[NodeIndex]);
ClassEditor_0.SetTableValues(TableSizze,
ParamLocation,
ClassEditor_0.DefinitionsUnit1[NodeIndex],
ClassEditor_0.DefinitionsUnit2[NodeIndex],
textArray1, ClassEditor_0.DefinitionsMathX[NodeIndex],
ClassEditor_0.DefinitionsFormatX[NodeIndex],
ClassEditor_0.DefinitionsIsXYInverted[NodeIndex],
ClassEditor_0.HexStringToInt(ClassEditor_0.DefinitionsLocationsTable[NodeIndex]),
ClassEditor_0.DefinitionsMathTable[NodeIndex], ClassEditor_0.DefinitionsFormatTable[NodeIndex],
ClassEditor_0.DefinitionsIsTableInverted[NodeIndex],
ClassEditor_0.DefinitionsIsReadOnly[NodeIndex]);
}
}
ClassEditor_0.bool_1 = true;
ClassEditor_0.CanReloadTablesValues = true;
}
private int CheckForBootLoaderSum(string ThisECUName)
public int CheckForBootLoaderSum(string ThisECUName)
{
string BLSumPath = Application.StartupPath + @"\BootLoaderSumBytesList.txt";
if (File.Exists(BLSumPath))
@ -714,33 +1004,21 @@ public class Editortable : DarkForm
return ECUName;
}
private void button1_Click(object sender, EventArgs e)
public void LoadThisFile(string ThisFilePath)
{
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
if (openFileDialog1.FilterIndex == 1)
{
byte[] FilesBytes = File.ReadAllBytes(openFileDialog1.FileName);
if ((FilesBytes.Length - 1) == 0xFFFFF)
{
this.Editortable_0.LoadedFilename = openFileDialog1.FileName;
this.IsFullBinary = true;
this.Text = "Honda Rom Tables Editor (" + this.GForm_Main_0.Version + ") | " + Path.GetFileName(ThisFilePath);
//Load Binary into ROM Table Editor
this.Editortable_0.method_1();
}
else
{
DarkMessageBox.Show(this, "This file is not compatible!");
}
}
if (openFileDialog1.FilterIndex == 2)
{
byte[] FilesBytes = File.ReadAllBytes(openFileDialog1.FileName);
string LastOpenFilePath = Application.StartupPath + @"\LastFileOpened.txt";
File.Create(LastOpenFilePath).Dispose();
File.WriteAllText(LastOpenFilePath, ThisFilePath);
byte[] FilesBytes = File.ReadAllBytes(ThisFilePath);
this.Editortable_0.LoadedFilename = ThisFilePath;
if ((FilesBytes.Length - 1) == 0xFFFFF) this.IsFullBinary = true;
//Load BootLoader Sum byte for decrypted firmware (not a full binary rom)
if ((FilesBytes.Length - 1) == 0xF7FFF)
{
this.Editortable_0.LoadedFilename = openFileDialog1.FileName;
this.IsFullBinary = false;
int BtSumInt = CheckForBootLoaderSum(ExtractECUNameFromThisFile(FilesBytes));
@ -751,7 +1029,7 @@ public class Editortable : DarkForm
//Open RWD firmware
openFileDialog1.Filter = "Honda Compressed RWD Firmware|*.gz;*.rwd";
openFileDialog1.DefaultExt = "*.gz";
result = openFileDialog1.ShowDialog();
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
Class_RWD.LoadRWD(openFileDialog1.FileName, true, false);
@ -759,9 +1037,13 @@ public class Editortable : DarkForm
}
else
{
Class_RWD.BootloaderSum = (byte) BtSumInt;
Class_RWD.BootloaderSum = (byte)BtSumInt;
}
}
//Load File
if ((FilesBytes.Length - 1) == 0xF7FFF || (FilesBytes.Length - 1) == 0xFFFFF)
{
//Load Binary into ROM Table Editor
this.Editortable_0.method_1();
}
@ -771,6 +1053,13 @@ public class Editortable : DarkForm
DarkMessageBox.Show(this, "This file is not compatible!");
}
}
private void button1_Click(object sender, EventArgs e)
{
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
LoadThisFile(openFileDialog1.FileName);
}
}
@ -821,5 +1110,207 @@ public class Editortable : DarkForm
{
ClassEditor_0.FixChecksums();
}
private void generateDefinitionsFilesToolStripMenuItem_Click(object sender, EventArgs e)
{
DarkMessageBox.Show(this, "Select the folder where all decrypted firmwares .bin are located.", "Select firmwares folder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
DialogResult result = folderBrowserDialog1.ShowDialog();
if (result == DialogResult.OK)
{
GForm_Main_0.Class_DefinitionMaker_0.FirmwareFolder = folderBrowserDialog1.SelectedPath;
GForm_Main_0.Class_DefinitionMaker_0.CreateDefinitionsFiles();
}
}
private void getDifferencesInAllFirmwaresFilesToolStripMenuItem_Click(object sender, EventArgs e)
{
DarkMessageBox.Show(this, "Select the folder where all decrypted firmwares .bin are located.", "Select firmwares folder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
DialogResult result = folderBrowserDialog1.ShowDialog();
if (result == DialogResult.OK)
{
GForm_Main_0.Class_DefinitionMaker_0.FirmwareFolder = folderBrowserDialog1.SelectedPath;
GForm_Main_0.Class_DefinitionMaker_0.GetFilesDifferenceCount();
}
}
private void extractAllBootloadersumByteFromAllFirmwaresFilesToolStripMenuItem_Click(object sender, EventArgs e)
{
DarkMessageBox.Show(this, "Select the folder where all decrypted firmwares .bin are located.", "Select firmwares folder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
DialogResult result = folderBrowserDialog1.ShowDialog();
if (result == DialogResult.OK)
{
GForm_Main_0.Class_DefinitionMaker_0.FirmwareFolder = folderBrowserDialog1.SelectedPath;
GForm_Main_0.Class_DefinitionMaker_0.ExtractAllBootLoaderSum_1Mb();
}
}
private void extractDefinitionToolStripMenuItem_Click(object sender, EventArgs e)
{
GForm_Main_0.Class_DefinitionMaker_0.Extract();
if (GForm_Main_0.Class_DefinitionMaker_0.CurrentExtractedDumps > 1) GForm_Main_0.Class_DefinitionMaker_0.CreateExtractedDefinition();
}
[CompilerGenerated]
private sealed class Class5
{
public Class5()
{
}
internal void method_0()
{
this.Editortable_0.darkTextBox_0.AppendText(this.string_0 + Environment.NewLine);
}
public Editortable Editortable_0;
public string string_0;
}
private void undoToolStripMenuItem_Click(object sender, EventArgs e)
{
//this.ClassEditor_0.AllROMDifferences.Contains(Environment.NewLine)
if (this.ClassEditor_0.AllROMDifferences != "")
{
string[] lines = this.ClassEditor_0.AllROMDifferences.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
if (lines.Length > 0)
{
for (int i = lines.Length - 1; i >= 0; i--)
{
if (lines[i] != "")
{
string CommandsLine = lines[i].Replace(" ", "");
if (CommandsLine.Contains(":"))
{
string[] CmdsSpli1 = CommandsLine.Split(':');
int Index = int.Parse(CmdsSpli1[1].Split('[')[0]);
string RemainingCmds = CmdsSpli1[1].Split('[')[1].Replace("->", ";");
int num1 = int.Parse(RemainingCmds.Split(';')[0]);
int num2 = int.Parse(RemainingCmds.Split(';')[1].Split(']')[0]);
int intLocationnValue = int.Parse(CmdsSpli1[2].Replace("0x", ""), System.Globalization.NumberStyles.HexNumber);
//Apply Changes
this.ClassEditor_0.ROM_Bytes[intLocationnValue] = (byte)num1;
//Send Logs
string BufText = "Undo change at line: " + Index.ToString() + "[" + num2.ToString("X2") + "->" + num1.ToString("X2") + "] | At: 0x" + (intLocationnValue).ToString("X") + Environment.NewLine;
GForm_Main_0.method_1(BufText);
//Remove from rom differences (string list)
string BufferROMDiff = "";
if (i > 0)
{
for (int i2 = 0; i2 < i; i2++) BufferROMDiff = BufferROMDiff + lines[i2];
this.ClassEditor_0.AllROMDifferences = BufferROMDiff;
}
//add to Redo list
this.ClassEditor_0.AllROMDifferencesRedo = this.ClassEditor_0.AllROMDifferencesRedo + lines[i] + Environment.NewLine;
redoToolStripMenuItem.Enabled = true;
//return
i = -1;
}
}
}
}
}
}
private void redoToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.ClassEditor_0.AllROMDifferencesRedo != "")
{
string[] lines = this.ClassEditor_0.AllROMDifferencesRedo.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
if (lines.Length > 0)
{
for (int i = lines.Length - 1; i >= 0; i--)
{
if (lines[i] != "")
{
string CommandsLine = lines[i].Replace(" ", "");
if (CommandsLine.Contains(":"))
{
string[] CmdsSpli1 = CommandsLine.Split(':');
int Index = int.Parse(CmdsSpli1[1].Split('[')[0]);
string RemainingCmds = CmdsSpli1[1].Split('[')[1].Replace("->", ";");
int num1 = int.Parse(RemainingCmds.Split(';')[0]);
int num2 = int.Parse(RemainingCmds.Split(';')[1].Split(']')[0]);
int intLocationnValue = int.Parse(CmdsSpli1[2].Replace("0x", ""), System.Globalization.NumberStyles.HexNumber);
//Apply Changes
this.ClassEditor_0.ROM_Bytes[intLocationnValue] = (byte)num2;
//Send Logs
string BufText = "Redo change at line: " + Index.ToString() + "[" + num1.ToString("X2") + "->" + num2.ToString("X2") + "] | At: 0x" + (intLocationnValue).ToString("X") + Environment.NewLine;
GForm_Main_0.method_1(BufText);
//Remove from Redo list
string BufferROMDiff = "";
if (i > 0)
{
for (int i2 = 0; i2 < i; i2++) BufferROMDiff = BufferROMDiff + lines[i2];
this.ClassEditor_0.AllROMDifferencesRedo = BufferROMDiff;
}
//add to rom differences (string list)
this.ClassEditor_0.AllROMDifferences = this.ClassEditor_0.AllROMDifferences + lines[i] + Environment.NewLine;
if (this.ClassEditor_0.AllROMDifferencesRedo == "") redoToolStripMenuItem.Enabled = false;
//return
i = -1;
}
}
}
}
}
}
private void removeBootloaderInbinToolStripMenuItem_Click(object sender, EventArgs e)
{
DarkMessageBox.Show(this, "Select the file to remove the Bootloader(Start) section from\nThe created .bin with removed bootloader can now be used as a 'decrypted firmware .bin'\nYou can also remake a firmware .rwd update file from this .bin and use it to flash on the ECU!", "Select full binary rom .bin", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
byte[] FilesBytes = File.ReadAllBytes(openFileDialog1.FileName);
if ((FilesBytes.Length - 1) == 0xFFFFF)
{
//remove 0x0000 to 0x8000
byte[] FilesBytesRWD = new byte[FilesBytes.Length - 0x8000];
for (int i = 0; i < FilesBytesRWD.Length; i++)
{
FilesBytesRWD[i] = FilesBytes[i + 0x8000];
}
string SaveeePath = Path.GetDirectoryName(openFileDialog1.FileName) + @"\" + Path.GetFileNameWithoutExtension(openFileDialog1.FileName) + "_NoBootloader.bin";
File.Create(SaveeePath).Dispose();
File.WriteAllBytes(SaveeePath, FilesBytesRWD);
GForm_Main_0.method_1("Removed Bootloader file created: " + SaveeePath);
}
else
{
Console.WriteLine((FilesBytes.Length - 1).ToString("X"));
DarkMessageBox.Show(this, "This file is not compatible!");
}
}
}
private void generateDefinitionFileFromExtractedDefinitionToolStripMenuItem_Click(object sender, EventArgs e)
{
GForm_Main_0.Class_DefinitionMaker_0.CurrentExtractedDumps = 2;
GForm_Main_0.Class_DefinitionMaker_0.CreateExtractedDefinition();
}
}

View File

@ -157,6 +157,24 @@
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="toolStripDropDownButton3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>424, 17</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAAAAAAAEAIAAokQAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAEAAAABAAgGAAAAXHKoZgAAgABJ

View File

@ -21,7 +21,7 @@ public class GForm_Main : DarkForm
private DarkButton darkButton2;
private OpenFileDialog openFileDialog1;
byte Unlocking_Mode = 0x41;
bool WritingBinaryMode = true; //if false we are in writing firmware mode
bool WritingBinaryMode = true; //if false we are in writing firmware mode, this is set later anyway
private DarkButton darkButton_FlashFW;
private GForm_Main GForm_Main_0;
private DarkGroupBox DarkgroupBox1;
@ -30,7 +30,12 @@ public class GForm_Main : DarkForm
private DarkButton darkButton6;
private DarkButton darkButton3;
public Editortable Editortable_0;
public string Version = "v1.1.1";
public string Version = "v1.1.2";
private DarkTextBox darkTextBoxJ2534Command;
private DarkLabel darkLabel1;
private DarkButton darkButtonJ2534Command;
public Class_DefinitionMaker Class_DefinitionMaker_0;
private bool BadResponceReceived = false;
public GForm_Main()
{
@ -49,10 +54,7 @@ public class GForm_Main : DarkForm
this.Text = this.Text + " (" + Version + ")";
Class_DefinitionMaker Class_DefinitionMaker_0 = new Class_DefinitionMaker();
//Class_DefinitionMaker_0.CreateDefinitionsFiles();
//Class_DefinitionMaker_0.GetFilesDifferenceCount(); //may not be used anymore
//Class_DefinitionMaker_0.ExtractAllBootLoaderSum_1Mb(); //may not be used anymore
Class_DefinitionMaker_0 = new Class_DefinitionMaker(ref GForm_Main_0);
}
@ -75,6 +77,9 @@ public class GForm_Main : DarkForm
{
this.darkTextBox_0.Text += string_3;
//Console.Write(string_3);
//Send to ROM Editor logs
Editortable_0.method_Log(string_3);
}
@ -88,6 +93,9 @@ public class GForm_Main : DarkForm
@class.gform0_0 = this;
@class.string_0 = string_3;
this.darkTextBox_0.BeginInvoke(new MethodInvoker(@class.method_0));
//Send to ROM Editor logs
Editortable_0.method_1(string_3);
}
catch { }
}
@ -120,6 +128,20 @@ public class GForm_Main : DarkForm
}
}
private void SetCommandText(byte[] CommandArray)
{
try
{
darkTextBoxJ2534Command.Text = "";
for (int i = 0; i < CommandArray.Length; i++)
{
darkTextBoxJ2534Command.Text = darkTextBoxJ2534Command.Text + CommandArray[i].ToString("X2");
if (i < CommandArray.Length - 1) darkTextBoxJ2534Command.Text = darkTextBoxJ2534Command.Text + ",";
}
}
catch { }
}
private void darkButton1_Click(object sender, EventArgs e)
{
@ -130,52 +152,18 @@ public class GForm_Main : DarkForm
this.darkButton_Unlock01.Enabled = false;
this.darkButton_FlashRom.Enabled = false;
this.darkButton_FlashFW.Enabled = false;
this.darkButtonJ2534Command.Enabled = false;
using (API api = APIFactory.GetAPI(GForm_Main.string_0))
{
try
{
Device device = api.GetDevice("");
Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false);
//using (Device device = api.GetDevice(""))
//{
// using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
// {
channel = LoadJ2534Channel(channel);
/*MessageFilter messageFilter = new MessageFilter();
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
messageFilter.Mask = new byte[]
using (Device device = api.GetDevice(""))
{
byte.MaxValue,
byte.MaxValue,
byte.MaxValue,
byte.MaxValue
};
messageFilter.Pattern = new byte[]
using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
{
24, //0x18
218, //0xDA
241, //0xF1
GForm_Main.byte_3 //0x00
};
messageFilter.FlowControl = new byte[]
{
24, //0x18
218, //0xDA
GForm_Main.byte_3, //0x00 -> 0x10|0x11
241 //0xF1
};
MessageFilter filter = messageFilter;
channel.StartMsgFilter(filter);
SConfig[] config = new SConfig[]
{
new SConfig(Parameter.LOOP_BACK, 1),
new SConfig(Parameter.DATA_RATE, 500000)
};
channel.SetConfig(config);*/
LoadJ2534Channel(channel);
//#############################################################
//#############################################################
int num2 = 0;
byte[] arraySend1 = new byte[]
{
@ -183,7 +171,8 @@ public class GForm_Main : DarkForm
241, //0xF1
144 //0x90
};
byte[] Received = SendJ2534Message(channel, arraySend1);
byte[] Received = SendJ2534Message(channel, arraySend1, 5);
if (BadResponceReceived) return;
int num4 = GForm_Main.smethod_0(Received, byte_1);
if (num4 != -1)
@ -202,7 +191,9 @@ public class GForm_Main : DarkForm
241, //0xF1
129 //0x81
};
Received = SendJ2534Message(channel, arraySend1);
Received = SendJ2534Message(channel, arraySend1, 5);
if (BadResponceReceived) return;
int num6 = GForm_Main.smethod_0(Received, byte_0);
if (num6 != -1)
{
@ -227,9 +218,10 @@ public class GForm_Main : DarkForm
{
this.darkButton_Unlock41.Enabled = true;
this.darkButton_Unlock01.Enabled = true;
this.darkButtonJ2534Command.Enabled = true;
}
}
}
//}
//}
}
catch (Exception ex)
{
@ -270,8 +262,31 @@ public class GForm_Main : DarkForm
}
private void method_7_Nothing(object sender, RunWorkerCompletedEventArgs e)
{
if (!ECU_Unlocked)
{
ECU_Unlocked = false;
this.darkButton_DownloadROM.Enabled = false;
this.darkButton_FlashRom.Enabled = false;
this.darkButton_FlashFW.Enabled = false;
DarkMessageBox.Show("Failed to Unlock ECU, Check Log");
}
if (ECU_Unlocked)
{
if (Unlocking_Mode == 0x41)
{
//Unlock ALL buttons (Read&Writes) for 0x27,0x41 Unlock
this.darkButton_DownloadROM.Enabled = true;
this.darkButton_FlashRom.Enabled = true;
this.darkButton_FlashFW.Enabled = true;
}
else
{
//Unlock FlashFW button (Write FW ONLY) for 0x27,0x01 Unlock
this.darkButton_FlashFW.Enabled = true;
}
}
}
private void method_7(object sender, RunWorkerCompletedEventArgs e)
@ -355,47 +370,15 @@ public class GForm_Main : DarkForm
{
ECU_Unlocked = false;
API api = APIFactory.GetAPI(GForm_Main.string_0);
//using (API api = APIFactory.GetAPI(GForm_Main.string_0))
//{
Device device = api.GetDevice("");
Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false);
//using (Device device = api.GetDevice(""))
//{
// using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
// {
channel = LoadJ2534Channel(channel);
/*MessageFilter messageFilter = new MessageFilter();
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
messageFilter.Mask = new byte[]
using (API api = APIFactory.GetAPI(GForm_Main.string_0))
{
byte.MaxValue,
byte.MaxValue,
byte.MaxValue,
byte.MaxValue
};
messageFilter.Pattern = new byte[]
try
{
24, //0x18
218, //0xDA
241, //0xF1
GForm_Main.byte_3 //0x00
};
messageFilter.FlowControl = new byte[]
using (Device device = api.GetDevice(""))
{
24, //0x18
218, //0xDA
GForm_Main.byte_3, //0x00 -> 0x10|0x11
241 //0xF1
};
MessageFilter filter = messageFilter;
channel.StartMsgFilter(filter);
SConfig[] config = new SConfig[]
using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
{
new SConfig(Parameter.LOOP_BACK, 1),
new SConfig(Parameter.DATA_RATE, 500000)
};
channel.SetConfig(config);*/
LoadJ2534Channel(channel);
device.SetProgrammingVoltage(Pin.PIN_12, 5000);
@ -404,7 +387,9 @@ public class GForm_Main : DarkForm
16, //0x10
3 //0x03 Not supposed to be 02 or FB?? ##########################################
};
byte[] Received = SendJ2534Message(channel, arraySend1);
byte[] Received = SendJ2534Message(channel, arraySend1, 3);
if (BadResponceReceived) return;
if (Received != null)
{
this.method_1("Diag Mode Set");
@ -418,7 +403,8 @@ public class GForm_Main : DarkForm
byte SeedSendByte = this.Unlocking_Mode;
arraySend1[1] = SeedSendByte;
this.method_1("Requesting Seed");
Received = SendJ2534Message(channel, arraySend1);
Received = SendJ2534Message(channel, arraySend1, 3);
if (BadResponceReceived) return;
byte[] byte_ = new byte[]
{
@ -476,16 +462,16 @@ public class GForm_Main : DarkForm
66 //0x42
};
arraySend1[1] = (byte)(SeedSendByte + 1);
byte[] array8 = arraySend1;
if (!TwoBytesMode) Array.Resize<byte>(ref array8, array8.Length + 5);
if (TwoBytesMode) Array.Resize<byte>(ref array8, array8.Length + 2);
array8[6] = bytes[0]; //SecurityKey Byte1
array8[7] = bytes[1]; //SecurityKey Byte2
byte[] array8 = new byte[arraySend1.Length + 5];
if (TwoBytesMode) array8 = new byte[arraySend1.Length + 2];
for (int i = 0; i < arraySend1.Length; i++) array8[i] = arraySend1[i];
array8[2] = bytes[0]; //SecurityKey Byte1
array8[3] = bytes[1]; //SecurityKey Byte2
if (!TwoBytesMode)
{
array8[8] = bytes[2]; //SecurityKey Byte3
array8[9] = bytes[3]; //SecurityKey Byte4
array8[10] = b; //Algorithm Byte
array8[2] = bytes[2]; //SecurityKey Byte3
array8[3] = bytes[3]; //SecurityKey Byte4
array8[4] = b; //Algorithm Byte
}
byte[] byte_2 = new byte[]
{
@ -494,7 +480,8 @@ public class GForm_Main : DarkForm
};
byte_2[1] = (byte)(SeedSendByte + 1);
Received = SendJ2534Message(channel, array8);
Received = SendJ2534Message(channel, array8, 3);
if (BadResponceReceived) return;
if (Received != null)
{
@ -503,27 +490,11 @@ public class GForm_Main : DarkForm
{
this.method_1("Security Authorized: ECU Unlocked");
ECU_Unlocked = true;
if (!TwoBytesMode)
{
//Unlock ALL buttons (Read&Writes) for 0x27,0x41 Unlock
this.darkButton_DownloadROM.Enabled = true;
this.darkButton_FlashRom.Enabled = true;
this.darkButton_FlashFW.Enabled = true;
}
else
{
//Unlock FlashFW button (Write FW ONLY) for 0x27,0x01 Unlock
this.darkButton_FlashFW.Enabled = true;
}
}
else
{
this.method_1("Recv:" + GForm_Main.smethod_1(Received));
ECU_Unlocked = false;
this.darkButton_DownloadROM.Enabled = false;
this.darkButton_FlashRom.Enabled = false;
this.darkButton_FlashFW.Enabled = false;
MessageBox.Show("Failed to Unlock ECU, Check Log");
}
}
}
@ -531,13 +502,20 @@ public class GForm_Main : DarkForm
{
this.method_1("Result NOT OK!!");
}
//}
//}
//}
}
}
}
catch (Exception ex)
{
DarkMessageBox.Show(ex.Message);
}
}
}
public byte[] SendJ2534Message(Channel channel, byte[] MessageBytes)
public byte[] SendJ2534Message(Channel channel, byte[] MessageBytes, int receivelenght)
{
BadResponceReceived = false;
byte[] arrayCommand = new byte[]
{
24, //0x18
@ -546,6 +524,8 @@ public class GForm_Main : DarkForm
241 //0xF1
};
SetCommandText(MessageBytes);
//Add the rest of the messages bytes to the final array
byte[] arrayCommandFinal = new byte[arrayCommand.Length + MessageBytes.Length];
int MessageIndex = 0;
@ -561,12 +541,12 @@ public class GForm_Main : DarkForm
}
//Send message
SAE.J2534.Message messageCommands = new SAE.J2534.Message(arrayCommand, TxFlag.CAN_29BIT_ID | TxFlag.ISO15765_FRAME_PAD);
SAE.J2534.Message messageCommands = new SAE.J2534.Message(arrayCommandFinal, TxFlag.CAN_29BIT_ID | TxFlag.ISO15765_FRAME_PAD);
channel.SendMessage(messageCommands);
this.method_1("Send:" + GForm_Main.smethod_1(messageCommands.Data));
//Receive message
GetMessageResults messagesReceived = channel.GetMessages(3, 1000);
GetMessageResults messagesReceived = channel.GetMessages(receivelenght, 1000);
if (messagesReceived.Result.IsOK())
{
//this.method_1("Programming Mode Set!");
@ -585,8 +565,9 @@ public class GForm_Main : DarkForm
string str2 = mode.ToString();
Class_ODB.NegativeResponse negativeResponse = (Class_ODB.NegativeResponse)this.byte_6[1];
this.method_1("BAD Response: " + str2 + "|" + negativeResponse.ToString());
BadResponceReceived = true;
}
if (IndexReceived >= 3)
if (IndexReceived >= receivelenght)
{
this.method_1("Recv:" + GForm_Main.smethod_1(message3.Data));
return message3.Data; //after 3messages received, return the last messages bytes
@ -597,55 +578,22 @@ public class GForm_Main : DarkForm
else
{
this.method_1("Result NOT OK!!");
BadResponceReceived = true;
}
return null;
}
public void method_ReadROM(object sender, DoWorkEventArgs e)
{
API api = APIFactory.GetAPI(GForm_Main.string_0);
//using (API api = APIFactory.GetAPI(GForm_Main.string_0))
//{
using (API api = APIFactory.GetAPI(GForm_Main.string_0))
{
try
{
Device device = api.GetDevice("");
Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false);
//using (Device device = api.GetDevice(""))
//{
// using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
// {
channel = LoadJ2534Channel(channel);
/*MessageFilter messageFilter = new MessageFilter();
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
messageFilter.Mask = new byte[]
using (Device device = api.GetDevice(""))
{
byte.MaxValue,
byte.MaxValue,
byte.MaxValue,
byte.MaxValue
};
messageFilter.Pattern = new byte[]
using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
{
24, //0x18
218, //0xDA
241, //0xF1
GForm_Main.byte_3 //0x00
};
messageFilter.FlowControl = new byte[]
{
24, //0x18
218, //0xDA
GForm_Main.byte_3, //0x00 -> 0x10|0x11
241 //0xF1
};
MessageFilter filter = messageFilter;
channel.StartMsgFilter(filter);
SConfig[] config = new SConfig[]
{
new SConfig(Parameter.LOOP_BACK, 1),
new SConfig(Parameter.DATA_RATE, 500000)
};
channel.SetConfig(config);*/
LoadJ2534Channel(channel);
device.SetProgrammingVoltage(Pin.PIN_12, 5000);
@ -663,19 +611,20 @@ public class GForm_Main : DarkForm
this.backgroundWorker_1.ReportProgress(0, "Successfully read " + this.byte_7.Length + "bytes of flash memory in " + timeSpan.Minutes + ":" + timeSpan.Seconds);
device.SetProgrammingVoltage(Pin.PIN_12, -1);
}
//}
//}
}
}
}
catch (Exception ex)
{
DarkMessageBox.Show(this, ex.Message);
DarkMessageBox.Show(ex.Message);
}
}
//}
}
public static int smethod_0(byte[] byte_12, byte[] byte_13)
{
if (byte_12 == null) return -1;
if (byte_13.Length > byte_12.Length)
{
return -1;
@ -837,7 +786,9 @@ public class GForm_Main : DarkForm
99
};
byte[] Received = SendJ2534Message(channel_0, arraySend1);
byte[] Received = SendJ2534Message(channel_0, arraySend1, 3);
if (BadResponceReceived) return;
if (Received != null)
{
//if (messages.Result != ResultCode.DEVICE_NOT_CONNECTED)
@ -1141,7 +1092,7 @@ public class GForm_Main : DarkForm
WritingBinaryMode = false;
//Decrypt firmware file and get needed variable (Decryption byte)
Class_RWD.LoadRWD(openFileDialog1.FileName, false, false);
Class_RWD.LoadRWD(dialog.FileName, false, false);
//###############################
//Get Checksum and Fix it
@ -1207,52 +1158,17 @@ public class GForm_Main : DarkForm
return channel;
}
//private unsafe void backgroundWorker_0_DoWork_1(object sender, DoWorkEventArgs e)
private void backgroundWorker_0_DoWork_1(object sender, DoWorkEventArgs e)
{
API api = APIFactory.GetAPI(GForm_Main.string_0);
//using (API api = APIFactory.GetAPI(GForm_Main.string_0))
//{
using (API api = APIFactory.GetAPI(GForm_Main.string_0))
{
try
{
Device device = api.GetDevice("");
Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false);
//using (Device device = api.GetDevice(""))
//{
// using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
// {
channel = LoadJ2534Channel(channel);
/*MessageFilter messageFilter = new MessageFilter();
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
messageFilter.Mask = new byte[]
using (Device device = api.GetDevice(""))
{
byte.MaxValue,
byte.MaxValue,
byte.MaxValue,
byte.MaxValue
};
messageFilter.Pattern = new byte[]
using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
{
24, //0x18
218, //0xDA
241, //0xF1
GForm_Main.byte_3 //0x00
};
messageFilter.FlowControl = new byte[]
{
24, //0x18
218, //0xDA
GForm_Main.byte_3, //0x00 -> 0x10|0x11
241 //0xF1
};
MessageFilter filter = messageFilter;
channel.StartMsgFilter(filter);
SConfig[] config = new SConfig[]
{
new SConfig(Parameter.LOOP_BACK, 1),
new SConfig(Parameter.DATA_RATE, 500000)
};
channel.SetConfig(config);*/
LoadJ2534Channel(channel);
if (!ECU_Unlocked)
{
@ -1273,7 +1189,9 @@ public class GForm_Main : DarkForm
2 //0x02
};
byte[] Received = SendJ2534Message(channel, arraySend1);
byte[] Received = SendJ2534Message(channel, arraySend1, 3);
if (BadResponceReceived) return;
if (Received != null)
{
this.method_1("Programming Mode Set!");
@ -1285,11 +1203,13 @@ public class GForm_Main : DarkForm
{
0x31, //0x31
0x01, //0x01
0xFF, //0xFF
0x00 //0x00
0x00, //0xFF ###################################
0xFF //0x00 ###################################
};
Received = SendJ2534Message(channel, arraySend1);
Received = SendJ2534Message(channel, arraySend1, 3);
if (BadResponceReceived) return;
if (Received != null)
{
this.method_1("Memory Erased!");
@ -1298,29 +1218,32 @@ public class GForm_Main : DarkForm
//Set WRITE_DATA_BY_IDENTIFIER
arraySend1 = new byte[]
{
0x2E, //0x22 -> Write Data by ID (F101)
0xF1, //0xF1
0x01, //0x01
0x2E, //0x2E -> Write Data by ID (F101)
0x01, //0xF1 ###################################
0xF1, //0x01 ###################################
Class_RWD._keys[0], //Key1
Class_RWD._keys[1], //Key2
Class_RWD._keys[2] //Key3
};
Received = SendJ2534Message(channel, arraySend1);
Received = SendJ2534Message(channel, arraySend1, 3);
if (BadResponceReceived) return;
if (Received != null)
{
this.method_1("WRITE_DATA_BY_IDENTIFIER Set!");
}
//###################
//Request Download
byte Addrr = 0x04;
byte memory_address_bytes = 0x04;
byte memory_size_bytes = 0x04;
uint memory_address = Class_RWD.start;
uint memory_size = Class_RWD.size;
arraySend1 = new byte[]
{
0x34, //0x34
0x00, //0x00
Addrr, //0x04
0x00, //0x00 data_format=0x00
memory_address_bytes, //0x04
0x00, //0x00 -> Set later
0x00, //0x00 -> Set later
0x00, //0x00 -> Set later
@ -1330,30 +1253,45 @@ public class GForm_Main : DarkForm
0x00, //0x00 -> Set later
0x00 //0x00 -> Set later
};
arraySend1[2] = (byte) ((Addrr << 4) | Addrr);
if (memory_address >= Math.Pow(2, Addrr * 8)) throw new Exception(string.Format("invalid memory_address: 0x{0}", memory_address.ToString("X4")));
for (int i = 0; i < Addrr; i++)
arraySend1[2] = (byte) ((memory_size_bytes << 4) | memory_address_bytes);
if (memory_address >= Math.Pow(2, memory_address_bytes * 8)) throw new Exception(string.Format("invalid memory_address: 0x{0}", memory_address.ToString("X4")));
for (int i = 0; i < memory_address_bytes; i++)
{
uint b = (memory_address >> ((Addrr - i - 1) * 8)) & 0xFF;
uint b = (memory_address >> ((memory_address_bytes - i - 1) * 8)) & 0xFF;
arraySend1[3 + i] = (byte) b;
}
if (memory_size >= Math.Pow(2, Addrr * 8)) throw new Exception(string.Format("invalid memory_size: 0x{0}", memory_size.ToString("X4")));
for (int i = 0; i < Addrr; i++)
if (memory_size >= Math.Pow(2, memory_size_bytes * 8)) throw new Exception(string.Format("invalid memory_size: 0x{0}", memory_size.ToString("X4")));
for (int i = 0; i < memory_size_bytes; i++)
{
uint b = (memory_size >> ((Addrr - i - 1) * 8)) & 0xFF;
arraySend1[3 + Addrr + i] = (byte)b;
uint b = (memory_size >> ((memory_size_bytes - i - 1) * 8)) & 0xFF;
arraySend1[3 + memory_size_bytes + i] = (byte)b;
}
Received = SendJ2534Message(channel, arraySend1);
Received = SendJ2534Message(channel, arraySend1, 3);
if (BadResponceReceived) return;
if (Received != null)
{
this.method_1("Request download started");
stopwatch.Start();
var block_size = (Received[Received.Length - 2] + Received[Received.Length - 1]); //Get the two last bytes
//if (max_num_bytes_len >= 1 && max_num_bytes_len <= 4)
//{
var max_num_bytes = 0;
for (int i = 0; i < 4; i++)
{
max_num_bytes = (max_num_bytes << 8) | Received[Received.Length - 5 + i];
}
//}
// account for service id and block sequence count (one byte each)
//var block_size = (Received[Received.Length - 2] + Received[Received.Length - 1]); //Get the two last bytes
var block_size = max_num_bytes;
var chunk_size = block_size - 2;
var cnt = 0;
//Perform Write firmware to ECU
for (int i = 0; i < Class_RWD._firmware_encrypted.Length; i += chunk_size)
{
cnt += 1;
@ -1380,8 +1318,7 @@ public class GForm_Main : DarkForm
MessageIndex++;
}
Received = SendJ2534Message(channel, arrayCommandFinal);
//int Percent = (i / Class_RWD._firmware_encrypted.Length * 100);
Received = SendJ2534Message(channel, arrayCommandFinal, 3);
int Percent = ((i * 100) / Class_RWD._firmware_encrypted.Length);
this.method_5(Percent);
/*if (Received != null)
@ -1410,14 +1347,14 @@ public class GForm_Main : DarkForm
this.backgroundWorker_0.ReportProgress(0, "Successfully write " + this.byte_7.Length + "bytes of flash memory in " + timeSpan.Minutes + ":" + timeSpan.Seconds);
device.SetProgrammingVoltage(Pin.PIN_12, -1); //Set 0V on Pin12
}
//}
//}
}
}
}
catch (Exception ex)
{
DarkMessageBox.Show(this, ex.Message);
DarkMessageBox.Show(ex.Message);
}
}
//}
}
public void WriteROMtoECU(Channel channel_0, byte[] byte_5, BackgroundWorker backgroundWorker_X = null)
@ -1432,7 +1369,7 @@ public class GForm_Main : DarkForm
int num = 256;
for (int i = 0; i < 1015808; i += num)
{
this.method_14(channel_0, byte_5, i, b, num, -1);
this.method_14_Write(channel_0, byte_5, i, b, num, -1);
if (b == 255)
{
b = 0;
@ -1457,7 +1394,9 @@ public class GForm_Main : DarkForm
};
byte[] buffer2 = new byte[] { GForm_Main.byte_3, 0x77 };
byte[] Received = SendJ2534Message(channel_0, arraySend1);
byte[] Received = SendJ2534Message(channel_0, arraySend1, 3);
if (BadResponceReceived) return;
if (Received != null)
{
int num3 = GForm_Main.smethod_2(Received, buffer2, 0);
@ -1473,7 +1412,9 @@ public class GForm_Main : DarkForm
0xff, //0xff
1 //0x01
};
Received = SendJ2534Message(channel_0, arraySend1);
Received = SendJ2534Message(channel_0, arraySend1, 3);
if (BadResponceReceived) return;
if (Received != null)
{
this.method_1("Routine control check dependencies");
@ -1481,7 +1422,7 @@ public class GForm_Main : DarkForm
}
}
public void method_14(Channel channel_0, byte[] byte_5X, int int_23, byte byte_6X, int int_24, int int_25 = -1)
public void method_14_Write(Channel channel_0, byte[] byte_5X, int int_23, byte byte_6X, int int_24, int int_25 = -1)
{
if (int_25 == -1)
{
@ -1610,6 +1551,9 @@ public class GForm_Main : DarkForm
this.DarkgroupBox1 = new DarkUI.Controls.DarkGroupBox();
this.darkButton6 = new DarkUI.Controls.DarkButton();
this.darkButton4 = new DarkUI.Controls.DarkButton();
this.darkTextBoxJ2534Command = new DarkUI.Controls.DarkTextBox();
this.darkLabel1 = new DarkUI.Controls.DarkLabel();
this.darkButtonJ2534Command = new DarkUI.Controls.DarkButton();
this.darkGroupBox_0.SuspendLayout();
this.DarkgroupBox1.SuspendLayout();
this.SuspendLayout();
@ -1619,7 +1563,7 @@ public class GForm_Main : DarkForm
this.darkTextBox_0.Location = new System.Drawing.Point(218, 63);
this.darkTextBox_0.Multiline = true;
this.darkTextBox_0.Name = "darkTextBox_0";
this.darkTextBox_0.Size = new System.Drawing.Size(399, 443);
this.darkTextBox_0.Size = new System.Drawing.Size(399, 408);
this.darkTextBox_0.TabIndex = 55;
this.darkTextBox_0.Text = "Honda CANBUS Tools";
//
@ -1956,11 +1900,42 @@ public class GForm_Main : DarkForm
this.darkButton4.Text = "Fix Checksums";
this.darkButton4.Click += new System.EventHandler(this.darkButton4_Click);
//
// darkTextBoxJ2534Command
//
this.darkTextBoxJ2534Command.Location = new System.Drawing.Point(313, 477);
this.darkTextBoxJ2534Command.Name = "darkTextBoxJ2534Command";
this.darkTextBoxJ2534Command.Size = new System.Drawing.Size(230, 20);
this.darkTextBoxJ2534Command.TabIndex = 72;
//
// darkLabel1
//
this.darkLabel1.AutoSize = true;
this.darkLabel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.darkLabel1.Location = new System.Drawing.Point(218, 480);
this.darkLabel1.Name = "darkLabel1";
this.darkLabel1.Size = new System.Drawing.Size(89, 13);
this.darkLabel1.TabIndex = 71;
this.darkLabel1.Text = "J2534 Command:";
//
// darkButtonJ2534Command
//
this.darkButtonJ2534Command.Checked = false;
this.darkButtonJ2534Command.Enabled = false;
this.darkButtonJ2534Command.Location = new System.Drawing.Point(549, 475);
this.darkButtonJ2534Command.Name = "darkButtonJ2534Command";
this.darkButtonJ2534Command.Size = new System.Drawing.Size(53, 23);
this.darkButtonJ2534Command.TabIndex = 70;
this.darkButtonJ2534Command.Text = "Send";
this.darkButtonJ2534Command.Click += new System.EventHandler(this.darkButtonJ2534Command_Click);
//
// GForm_Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(629, 571);
this.Controls.Add(this.darkButtonJ2534Command);
this.Controls.Add(this.darkTextBoxJ2534Command);
this.Controls.Add(this.darkLabel1);
this.Controls.Add(this.DarkgroupBox1);
this.Controls.Add(this.darkLabel_8);
this.Controls.Add(this.darkLabel_7);
@ -2353,10 +2328,33 @@ public class GForm_Main : DarkForm
else
{
this.method_1("This file is not compatible!");
if ((FilesBytes.Length - 1) == 0xF7FFF) this.method_1("Try changing the file extention filter in the 'OpenFileDialog' box");
}
}
if (openFileDialog1.FilterIndex == 2)
{
/*byte[] FilesBytes = File.ReadAllBytes(openFileDialog1.FileName);
int BtSumInt = this.Editortable_0.CheckForBootLoaderSum(this.Editortable_0.ExtractECUNameFromThisFile(FilesBytes));
if (BtSumInt == -1)
{
DarkMessageBox.Show(this, "Since this decompressed firmware .bin file is missing the bootloader section\nSelect the firmware .rwd file from which is as been decompressed from", "MISSING BOOTLOADER SECTION FOR CHECKSUMS VERIFICATIONS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
//Open RWD firmware
openFileDialog1.Filter = "Honda Compressed RWD Firmware|*.gz;*.rwd";
openFileDialog1.DefaultExt = "*.gz";
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
Class_RWD.LoadRWD(openFileDialog1.FileName, true, false);
}
}
else
{
Class_RWD.BootloaderSum = (byte)BtSumInt;
}*/
GForm_FWChkSum gform = new GForm_FWChkSum();
gform.FileBIN = openFileDialog1.FileName;
if (gform.ShowDialog() == DialogResult.OK)
@ -2380,6 +2378,7 @@ public class GForm_Main : DarkForm
else
{
this.method_1("This file is not compatible!");
if ((FilesBytes.Length - 1) == 0xFFFFF) this.method_1("Try changing the file extention filter in the 'OpenFileDialog' box");
}
}
}
@ -2403,6 +2402,7 @@ public class GForm_Main : DarkForm
try
{
this.Editortable_0.Show();
this.Editortable_0.Loadingg();
}
catch (Exception ex)
{
@ -2411,6 +2411,7 @@ public class GForm_Main : DarkForm
this.Editortable_0 = null;
this.Editortable_0 = new Editortable(ref GForm_Main_0);
this.Editortable_0.Show();
this.Editortable_0.Loadingg();
}
catch
{
@ -2418,4 +2419,50 @@ public class GForm_Main : DarkForm
}
}
}
private byte[] GetBytesArrayFromCommandText()
{
string CMDText = darkTextBoxJ2534Command.Text;
byte[] ReturnArray = new byte[0];
if (CMDText != "")
{
if (CMDText.Contains(","))
{
string[] SplittedBytes = CMDText.Split(',');
ReturnArray = new byte[SplittedBytes.Length];
for (int i = 0; i < SplittedBytes.Length; i++)
{
ReturnArray[i] = (byte) int.Parse(SplittedBytes[i], System.Globalization.NumberStyles.HexNumber);
}
}
}
return ReturnArray;
}
private void darkButtonJ2534Command_Click(object sender, EventArgs e)
{
using (API api = APIFactory.GetAPI(GForm_Main.string_0))
{
try
{
using (Device device = api.GetDevice(""))
{
using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
{
LoadJ2534Channel(channel);
SendJ2534Message(channel, GetBytesArrayFromCommandText(), 3);
}
}
}
catch (Exception ex)
{
DarkMessageBox.Show(ex.Message);
}
}
}
}

View File

@ -3398,14 +3398,7 @@ public class frmOBD2Scan : DarkForm
string text = this.listViewLive.Items[num].SubItems[0].Text;
if (text != null)
{
uint num2 = ClassDecryptString.DecryptThisString(text);
if (num2 <= 0x1ded6c01)
{
if (num2 <= 0x1bed68db)
{
if (num2 != 0x17eb23f8)
{
if ((num2 == 0x1bed68db) && (text == "06"))
if (text == "06")
{
try
{
@ -3427,7 +3420,6 @@ public class frmOBD2Scan : DarkForm
{
}
}
}
else if (text == "14")
{
try
@ -3450,10 +3442,7 @@ public class frmOBD2Scan : DarkForm
{
}
}
}
else if (num2 == 0x1ceb2bd7)
{
if (text == "11")
else if (text == "11")
{
try
{
@ -3475,10 +3464,7 @@ public class frmOBD2Scan : DarkForm
{
}
}
}
else if (num2 != 0x1ced6a6e)
{
if ((num2 == 0x1ded6c01) && (text == "04"))
else if (text == "04")
{
try
{
@ -3500,7 +3486,6 @@ public class frmOBD2Scan : DarkForm
{
}
}
}
else if (text == "05")
{
try
@ -3523,12 +3508,7 @@ public class frmOBD2Scan : DarkForm
{
}
}
}
else if (num2 <= 0x6cede85e)
{
if (num2 != 0x6bede6cb)
{
if ((num2 == 0x6cede85e) && (text == "0E"))
else if (text == "0E")
{
try
{
@ -3550,7 +3530,6 @@ public class frmOBD2Scan : DarkForm
{
}
}
}
else if (text == "0F")
{
try
@ -3573,10 +3552,7 @@ public class frmOBD2Scan : DarkForm
{
}
}
}
else if (num2 == 0x6dede9f1)
{
if (text == "0D")
else if (text == "0D")
{
try
{
@ -3598,10 +3574,7 @@ public class frmOBD2Scan : DarkForm
{
}
}
}
else if (num2 != 0x6eedeb84)
{
if ((num2 == 0x6feded17) && (text == "0B"))
else if (text == "0B")
{
try
{
@ -3623,7 +3596,6 @@ public class frmOBD2Scan : DarkForm
{
}
}
}
else if (text == "0C")
{
try
@ -4688,100 +4660,60 @@ public class frmOBD2Scan : DarkForm
goto TR_0002;
}
else
{
uint num2 = ClassDecryptString.DecryptThisString(string_21);
if (num2 > 0x44a7f051)
{
if (num2 > 0xce8f3e48)
{
if (num2 > 0xeef6e76e)
{
if (num2 == 0xf87c4b44)
{
if (string_21 == "Load%")
{
return (double.TryParse(this.string_16, out result) ? result : 0.0);
}
}
else if ((num2 == 0xfd283657) && (string_21 == "ECT"))
else if (string_21 == "ECT")
{
return (double.TryParse(this.string_14, out result) ? result : 0.0);
}
}
else if (num2 == 0xd0b33ab6)
{
if (string_21 == "RPM")
else if (string_21 == "RPM")
{
return (double.TryParse(this.string_8, out result) ? result : 0.0);
}
}
else if ((num2 == 0xeef6e76e) && (string_21 == "BATTERY"))
else if (string_21 == "BATTERY")
{
return (double.TryParse(this.string_11, out result) ? result : 0.0);
}
}
else if (num2 == 0x670409f2)
{
if (string_21 == "BTDC")
else if (string_21 == "BTDC")
{
return (double.TryParse(this.string_15, out result) ? result : 0.0);
}
}
else if (num2 == 0x840ae12e)
{
if (string_21 == "Battery")
else if (string_21 == "Battery")
{
return (double.TryParse(this.string_11, out result) ? result : 0.0);
}
}
else if ((num2 == 0xce8f3e48) && (string_21 == "STFT"))
else if (string_21 == "STFT")
{
return (double.TryParse(this.string_17, out result) ? result : 0.0);
}
}
else if (num2 > 0x1ce412e4)
{
if (num2 > 0x2f6e59dd)
{
if (num2 == 0x345d4ece)
{
if (string_21 == "TPS")
else if (string_21 == "TPS")
{
goto TR_000C;
}
}
else if ((num2 == 0x44a7f051) && (string_21 == "Map"))
else if (string_21 == "Map")
{
goto TR_000F;
}
}
else if (num2 == 0x24599f11)
{
if (string_21 == "MAP")
else if (string_21 == "MAP")
{
goto TR_000F;
}
}
else if ((num2 == 0x2f6e59dd) && (string_21 == "TPlate"))
else if (string_21 == "TPlate")
{
goto TR_000C;
}
}
else if (num2 == 0xa6b8020)
{
if (string_21 == "Speed")
else if (string_21 == "Speed")
{
return (double.TryParse(this.string_10, out result) ? result : 0.0);
}
}
else if (num2 == 0x1ab73171)
{
if (string_21 == "IAT")
else if (string_21 == "IAT")
{
return (double.TryParse(this.string_13, out result) ? result : 0.0);
}
}
else if ((num2 == 0x1ce412e4) && (string_21 == "O2"))
else if (string_21 == "O2")
{
return (double.TryParse(this.string_12, out result) ? result : 0.0);
}

Binary file not shown.

View File

@ -13,3 +13,10 @@ C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\bin\Debug\ECU
C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\obj\Debug\GForm_Main.resources
C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\obj\Debug\GForm_PlatformSelect.resources
C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\obj\Debug\GForm_J2534Select.resources
C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\obj\Debug\GForm_ConvertBIN.resources
C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\obj\Debug\GForm_FWChkSum.resources
C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\bin\Debug\OBD2.txt
C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\obj\Debug\FlashToolTest.frmOBD2Scan.resources
C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\obj\Debug\GForm_Credits.resources
C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\obj\Debug\Editortable.resources
C:\Users\boule\Documents\Visual Studio 2019\Projects\FlashToolTest\bin\Debug\BootLoaderSumBytesList.txt

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.