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
{
//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 object[TableSize[0]];
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;
}
}
}
}
Editortable_0.GForm_Main_0.method_1("Definitions loaded!");
if (ECUFound) return;
if (ECUFound)
{
Editortable_0.GForm_Main_0.method_1("Definitions loaded!");
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";
File.Create(SavingPath).Dispose();
File.WriteAllText(SavingPath, SavingText);
//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, 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)

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

View File

@ -3398,230 +3398,202 @@ 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 (text == "06")
{
if (num2 <= 0x1bed68db)
try
{
if (num2 != 0x17eb23f8)
this.listViewLive.Items[num].SubItems[2].Text = this.string_17;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
if ((num2 == 0x1bed68db) && (text == "06"))
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_17;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
else if (text == "14")
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_12;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
else if (num2 == 0x1ceb2bd7)
catch
{
if (text == "11")
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_9;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
}
else if (num2 != 0x1ced6a6e)
{
if ((num2 == 0x1ded6c01) && (text == "04"))
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_16;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
}
else if (text == "05")
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_14;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
}
else if (num2 <= 0x6cede85e)
else if (text == "14")
{
if (num2 != 0x6bede6cb)
try
{
if ((num2 == 0x6cede85e) && (text == "0E"))
this.listViewLive.Items[num].SubItems[2].Text = this.string_12;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_15;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
else if (text == "0F")
catch
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_13;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
}
else if (num2 == 0x6dede9f1)
else if (text == "11")
{
if (text == "0D")
try
{
try
this.listViewLive.Items[num].SubItems[2].Text = this.string_9;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_10;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
catch
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
}
else if (num2 != 0x6eedeb84)
{
if ((num2 == 0x6feded17) && (text == "0B"))
catch
{
try
}
}
else if (text == "04")
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_16;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_7;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
catch
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
else if (text == "05")
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_14;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
else if (text == "0E")
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_15;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
else if (text == "0F")
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_13;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
else if (text == "0D")
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_10;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
else if (text == "0B")
{
try
{
this.listViewLive.Items[num].SubItems[2].Text = this.string_7;
if ((this.listViewLive.Items[num].SubItems[3].Text == "000") || (this.listViewLive.Items[num].SubItems[3].Text == ""))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) <= int.Parse(this.listViewLive.Items[num].SubItems[3].Text))
{
this.listViewLive.Items[num].SubItems[3].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
if (int.Parse(this.listViewLive.Items[num].SubItems[2].Text) >= int.Parse(this.listViewLive.Items[num].SubItems[4].Text))
{
this.listViewLive.Items[num].SubItems[4].Text = this.listViewLive.Items[num].SubItems[2].Text;
}
}
catch
{
}
}
else if (text == "0C")
@ -4689,99 +4661,59 @@ public class frmOBD2Scan : DarkForm
}
else
{
uint num2 = ClassDecryptString.DecryptThisString(string_21);
if (num2 > 0x44a7f051)
if (string_21 == "Load%")
{
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"))
{
return (double.TryParse(this.string_14, out result) ? result : 0.0);
}
}
else if (num2 == 0xd0b33ab6)
{
if (string_21 == "RPM")
{
return (double.TryParse(this.string_8, out result) ? result : 0.0);
}
}
else if ((num2 == 0xeef6e76e) && (string_21 == "BATTERY"))
{
return (double.TryParse(this.string_11, out result) ? result : 0.0);
}
}
else if (num2 == 0x670409f2)
{
if (string_21 == "BTDC")
{
return (double.TryParse(this.string_15, out result) ? result : 0.0);
}
}
else if (num2 == 0x840ae12e)
{
if (string_21 == "Battery")
{
return (double.TryParse(this.string_11, out result) ? result : 0.0);
}
}
else if ((num2 == 0xce8f3e48) && (string_21 == "STFT"))
{
return (double.TryParse(this.string_17, out result) ? result : 0.0);
}
return (double.TryParse(this.string_16, out result) ? result : 0.0);
}
else if (num2 > 0x1ce412e4)
else if (string_21 == "ECT")
{
if (num2 > 0x2f6e59dd)
{
if (num2 == 0x345d4ece)
{
if (string_21 == "TPS")
{
goto TR_000C;
}
}
else if ((num2 == 0x44a7f051) && (string_21 == "Map"))
{
goto TR_000F;
}
}
else if (num2 == 0x24599f11)
{
if (string_21 == "MAP")
{
goto TR_000F;
}
}
else if ((num2 == 0x2f6e59dd) && (string_21 == "TPlate"))
{
goto TR_000C;
}
return (double.TryParse(this.string_14, out result) ? result : 0.0);
}
else if (num2 == 0xa6b8020)
else if (string_21 == "RPM")
{
if (string_21 == "Speed")
{
return (double.TryParse(this.string_10, out result) ? result : 0.0);
}
return (double.TryParse(this.string_8, out result) ? result : 0.0);
}
else if (num2 == 0x1ab73171)
else if (string_21 == "BATTERY")
{
if (string_21 == "IAT")
{
return (double.TryParse(this.string_13, out result) ? result : 0.0);
}
return (double.TryParse(this.string_11, out result) ? result : 0.0);
}
else if ((num2 == 0x1ce412e4) && (string_21 == "O2"))
else if (string_21 == "BTDC")
{
return (double.TryParse(this.string_15, out result) ? result : 0.0);
}
else if (string_21 == "Battery")
{
return (double.TryParse(this.string_11, out result) ? result : 0.0);
}
else if (string_21 == "STFT")
{
return (double.TryParse(this.string_17, out result) ? result : 0.0);
}
else if (string_21 == "TPS")
{
goto TR_000C;
}
else if (string_21 == "Map")
{
goto TR_000F;
}
else if (string_21 == "MAP")
{
goto TR_000F;
}
else if (string_21 == "TPlate")
{
goto TR_000C;
}
else if (string_21 == "Speed")
{
return (double.TryParse(this.string_10, out result) ? result : 0.0);
}
else if (string_21 == "IAT")
{
return (double.TryParse(this.string_13, out result) ? result : 0.0);
}
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.