Add files via upload
This commit is contained in:
parent
7414417fca
commit
34ae46cf4d
201
ClassEditor.cs
201
ClassEditor.cs
|
@ -184,63 +184,72 @@ internal class ClassEditor
|
||||||
int multiplier = 2;
|
int multiplier = 2;
|
||||||
if (this.IsSingleByteX || this.IsSingleByteY || this.IsSingleByteTable) multiplier = 1; //###############################
|
if (this.IsSingleByteX || this.IsSingleByteY || this.IsSingleByteTable) multiplier = 1; //###############################
|
||||||
|
|
||||||
|
|
||||||
|
Editortable_0.GForm_Main_0.method_1("Checking for differences...");
|
||||||
|
|
||||||
//Get all Tables values
|
//Get all Tables values
|
||||||
for (int i = 0; i < this.BufferTableSize[1]; i++)
|
double[,] ReadBufferarray = new double[this.BufferTableSize[0], this.BufferTableSize[1]];
|
||||||
|
for (int i = 0; i < this.BufferTableSize[0]; i++) //10columns
|
||||||
{
|
{
|
||||||
for (int k = 0; k < this.BufferTableSize[0]; k++)
|
for (int j = 0; j < this.BufferTableSize[1]; j++) //20rows
|
||||||
{
|
{
|
||||||
//calculate value inversed to make bytes
|
//calculate value inversed to make bytes
|
||||||
double ThisValue = double.Parse(Editortable_0.dataGridView_0.Rows[i].Cells[k].Value.ToString(), CultureInfo.InvariantCulture);
|
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);
|
||||||
|
ReadBufferarray[i, j] = (Int16)ThisValue;
|
||||||
if (multiplier == 2)
|
|
||||||
{
|
|
||||||
byte[] ThisBytesToChange = BitConverter.GetBytes((Int16) ThisValue);
|
|
||||||
if (ThisBytesToChange.Length <= 2)
|
|
||||||
{
|
|
||||||
BufferBytesArray[(i * 2)] = ThisBytesToChange[1];
|
|
||||||
BufferBytesArray[(i * 2) + 1] = ThisBytesToChange[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Editortable_0.GForm_Main_0.method_1("Modified Value doesn't return into '2bytes' format");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
byte ThisByteToChange = (byte) ThisValue;
|
|
||||||
BufferBytesArray[i] = ThisByteToChange;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#############
|
||||||
|
double[] ValuesBufferarray = new double[this.SelectedTableSize];
|
||||||
|
for (int i = 0; i < this.BufferTableSize[0]; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < this.BufferTableSize[1]; j++)
|
||||||
|
{
|
||||||
|
ValuesBufferarray[i * this.BufferTableSize[1] + j] = ReadBufferarray[i, j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//#############
|
||||||
|
byte[] BytesBufferarray = new byte[this.SelectedTableSize * multiplier];
|
||||||
|
for (int i = 0; i < this.SelectedTableSize; i++)
|
||||||
|
{
|
||||||
|
if (multiplier == 2)
|
||||||
|
{
|
||||||
|
byte[] ThisBytesToChange = BitConverter.GetBytes((Int16) ValuesBufferarray[i]);
|
||||||
|
BytesBufferarray[(i * 2)] = ThisBytesToChange[1];
|
||||||
|
BytesBufferarray[(i * 2) + 1] = ThisBytesToChange[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BytesBufferarray[i] = (byte) ValuesBufferarray[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//#############
|
||||||
byte[] array = new byte[this.SelectedTableSize * multiplier];
|
byte[] array = new byte[this.SelectedTableSize * multiplier];
|
||||||
for (int i = 0; i < this.SelectedTableSize * multiplier; i++)
|
for (int i = 0; i < this.SelectedTableSize * multiplier; i++)
|
||||||
{
|
{
|
||||||
array[i] = this.byte_0[num + i];
|
array[i] = this.byte_0[num + i];
|
||||||
//Apply Changes
|
//Apply Changes
|
||||||
this.byte_0[num + i] = BufferBytesArray[i];
|
this.byte_0[num + i] = BytesBufferarray[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Console.WriteLine(BufferBytesArray[0].ToString("X2"));
|
|
||||||
Console.WriteLine(BufferBytesArray[1].ToString("X2"));
|
|
||||||
Console.WriteLine(array[0].ToString("X2"));
|
|
||||||
Console.WriteLine(array[1].ToString("X2"));*/
|
|
||||||
|
|
||||||
int num3 = 0;
|
int num3 = 0;
|
||||||
string text = null;
|
string text = null;
|
||||||
foreach (int num4 in BufferBytesArray)
|
bool DiffDetected = false;
|
||||||
|
foreach (int num4 in BytesBufferarray)
|
||||||
{
|
{
|
||||||
//if ((!this.bool_3 || num3 < 200) && num4.ToString() != array[num3].ToString())
|
//if ((!this.bool_3 || num3 < 200) && num4.ToString() != array[num3].ToString())
|
||||||
//if (((Is1x20Table && (!this.IsSingleByteX || num3 < 200)) || (!Is1x20Table)) && num4.ToString() != array[num3].ToString())
|
//if (((Is1x20Table && (!this.IsSingleByteX || num3 < 200)) || (!Is1x20Table)) && num4.ToString() != array[num3].ToString())
|
||||||
if (num4.ToString() != array[num3].ToString())
|
if (num4.ToString() != array[num3].ToString())
|
||||||
{
|
{
|
||||||
string BufText = "Change at line: " + num3.ToString() + "[" + array[num3].ToString("X2") + "->" + num4.ToString("X2") + "]";
|
string BufText = "Change at line: " + num3.ToString() + "[" + array[num3].ToString("X2") + "->" + num4.ToString("X2") + "] | At: 0x" + (this.SelectedROMLocation + num3).ToString("X");
|
||||||
text = text + BufText + Environment.NewLine;
|
text = text + BufText + Environment.NewLine;
|
||||||
Editortable_0.GForm_Main_0.method_1(BufText);
|
Editortable_0.GForm_Main_0.method_1(BufText);
|
||||||
|
DiffDetected = true;
|
||||||
}
|
}
|
||||||
num3++;
|
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;
|
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;
|
//this.string_3 = this.string_3 + "Table: " + TableSize + Environment.NewLine + "Address: " + this.SelectedROMLocation.ToString() + Environment.NewLine + text;
|
||||||
}
|
}
|
||||||
|
@ -269,8 +278,9 @@ internal class ClassEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
//Fix Checksums
|
//Fix Checksums
|
||||||
if (!this.Editortable_0.IsFullBinary) SavingBytes = this.Editortable_0.GForm_Main_0.VerifyChecksumFWBin(SavingBytes);
|
FixChecksums();
|
||||||
if (this.Editortable_0.IsFullBinary) SavingBytes = this.Editortable_0.GForm_Main_0.VerifyChecksumFullBin(SavingBytes);
|
//if (!this.Editortable_0.IsFullBinary) SavingBytes = this.Editortable_0.GForm_Main_0.VerifyChecksumFWBin(SavingBytes);
|
||||||
|
//if (this.Editortable_0.IsFullBinary) SavingBytes = this.Editortable_0.GForm_Main_0.VerifyChecksumFullBin(SavingBytes);
|
||||||
|
|
||||||
File.Create(string_4).Dispose();
|
File.Create(string_4).Dispose();
|
||||||
File.WriteAllBytes(string_4, SavingBytes);
|
File.WriteAllBytes(string_4, SavingBytes);
|
||||||
|
@ -298,6 +308,13 @@ 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void SetTableValues(int[] TableSize, int ROMLocationX, string TopLeftString, string RowHeaderString, string[] HeaderStringList, string ThisMathX, string ThisFormatX, bool IsInverted, int ROMLocationTable, string ThisMathTable, string ThisTableFormat)
|
public void SetTableValues(int[] TableSize, int ROMLocationX, string TopLeftString, string RowHeaderString, string[] HeaderStringList, string ThisMathX, string ThisFormatX, bool IsInverted, int ROMLocationTable, string ThisMathTable, string ThisTableFormat)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -427,9 +444,6 @@ internal class ClassEditor
|
||||||
//##############################################
|
//##############################################
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (IsSingleByteX) BufferBytesArray = new byte[SelectedTableSize];
|
|
||||||
else BufferBytesArray = new byte[SelectedTableSize * 2];
|
|
||||||
|
|
||||||
//Normal 'single' table
|
//Normal 'single' table
|
||||||
if (IsInverted)
|
if (IsInverted)
|
||||||
{
|
{
|
||||||
|
@ -438,17 +452,8 @@ internal class ClassEditor
|
||||||
for (int i = 0; i < TableSize[1]; i++)
|
for (int i = 0; i < TableSize[1]; i++)
|
||||||
{
|
{
|
||||||
double num = 0;
|
double num = 0;
|
||||||
if (IsSingleByteX)
|
if (IsSingleByteX) num = (double)this.GetSingleByteValue(ROMLocationX + i);
|
||||||
{
|
else num = (double)this.GetIntValue(ROMLocationX + i * 2);
|
||||||
num = (double)this.GetSingleByteValue(ROMLocationX + i);
|
|
||||||
BufferBytesArray[i] = byte_0[ROMLocationX + i];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
num = (double)this.GetIntValue(ROMLocationX + i * 2);
|
|
||||||
BufferBytesArray[(i * 2)] = byte_0[ROMLocationX + (i * 2)];
|
|
||||||
BufferBytesArray[(i * 2) + 1] = byte_0[ROMLocationX + (i * 2) + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferValuesArray[i] = (int) num;
|
BufferValuesArray[i] = (int) num;
|
||||||
|
|
||||||
|
@ -469,19 +474,12 @@ internal class ClassEditor
|
||||||
for (int k = 0; k < TableSize[0]; k++)
|
for (int k = 0; k < TableSize[0]; k++)
|
||||||
{
|
{
|
||||||
double num = 0;
|
double num = 0;
|
||||||
if (IsSingleByteX)
|
if (IsSingleByteX) num = (double)this.GetSingleByteValue(ROMLocationX + k);
|
||||||
{
|
else num = (double)this.GetIntValue(ROMLocationX + k * 2);
|
||||||
num = (double)this.GetSingleByteValue(ROMLocationX + k);
|
|
||||||
BufferBytesArray[k] = byte_0[ROMLocationX + k];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
num = (double)this.GetIntValue(ROMLocationX + k * 2);
|
|
||||||
BufferBytesArray[(k * 2)] = byte_0[ROMLocationX + (k * 2)];
|
|
||||||
BufferBytesArray[(k * 2) + 1] = byte_0[ROMLocationX + (k * 2) + 1];
|
|
||||||
}
|
|
||||||
BufferValuesArray[k] = (int) num;
|
BufferValuesArray[k] = (int) num;
|
||||||
|
|
||||||
|
//Console.WriteLine("num: " + num);
|
||||||
|
|
||||||
if (ThisFormatX == "") list.Add(DoMath(num, ThisMathX, false).ToString());
|
if (ThisFormatX == "") list.Add(DoMath(num, ThisMathX, false).ToString());
|
||||||
if (ThisFormatX != "") list.Add(DoMath(num, ThisMathX, false).ToString(ThisFormatX));
|
if (ThisFormatX != "") list.Add(DoMath(num, ThisMathX, false).ToString(ThisFormatX));
|
||||||
}
|
}
|
||||||
|
@ -528,17 +526,11 @@ internal class ClassEditor
|
||||||
if (IndexOfMathDiv == 0) return 0;
|
if (IndexOfMathDiv == 0) return 0;
|
||||||
if (IndexOfMathMul == 0) return 0;
|
if (IndexOfMathMul == 0) return 0;
|
||||||
if (IndexOfMathAdd == 0) return 0;
|
if (IndexOfMathAdd == 0) return 0;
|
||||||
//if (IndexOfMathSub == 0) return 0;
|
|
||||||
|
|
||||||
if (IndexOfMathDiv == -1) IndexOfMathDiv = 99;
|
if (IndexOfMathDiv == -1) IndexOfMathDiv = 99;
|
||||||
if (IndexOfMathMul == -1) IndexOfMathMul = 99;
|
if (IndexOfMathMul == -1) IndexOfMathMul = 99;
|
||||||
if (IndexOfMathAdd == -1) IndexOfMathAdd = 99;
|
if (IndexOfMathAdd == -1) IndexOfMathAdd = 99;
|
||||||
//if (IndexOfMathSub == -1) IndexOfMathSub = 99;
|
|
||||||
|
|
||||||
/*if (IndexOfMathDiv > 0 && IndexOfMathDiv < IndexOfMathMul && IndexOfMathDiv < IndexOfMathAdd && IndexOfMathDiv < IndexOfMathSub) IndexOfNearest = IndexOfMathDiv;
|
|
||||||
if (IndexOfMathMul > 0 && IndexOfMathMul < IndexOfMathDiv && IndexOfMathMul < IndexOfMathAdd && IndexOfMathMul < IndexOfMathSub) IndexOfNearest = IndexOfMathMul;
|
|
||||||
if (IndexOfMathAdd > 0 && IndexOfMathAdd < IndexOfMathMul && IndexOfMathAdd < IndexOfMathDiv && IndexOfMathAdd < IndexOfMathSub) IndexOfNearest = IndexOfMathAdd;
|
|
||||||
if (IndexOfMathSub > 0 && IndexOfMathSub < IndexOfMathMul && IndexOfMathSub < IndexOfMathAdd && IndexOfMathSub < IndexOfMathDiv) IndexOfNearest = IndexOfMathSub;*/
|
|
||||||
if (IndexOfMathDiv > 0 && IndexOfMathDiv < IndexOfMathMul && IndexOfMathDiv < IndexOfMathAdd) IndexOfNearest = IndexOfMathDiv;
|
if (IndexOfMathDiv > 0 && IndexOfMathDiv < IndexOfMathMul && IndexOfMathDiv < IndexOfMathAdd) IndexOfNearest = IndexOfMathDiv;
|
||||||
if (IndexOfMathMul > 0 && IndexOfMathMul < IndexOfMathDiv && IndexOfMathMul < IndexOfMathAdd) IndexOfNearest = IndexOfMathMul;
|
if (IndexOfMathMul > 0 && IndexOfMathMul < IndexOfMathDiv && IndexOfMathMul < IndexOfMathAdd) IndexOfNearest = IndexOfMathMul;
|
||||||
if (IndexOfMathAdd > 0 && IndexOfMathAdd < IndexOfMathMul && IndexOfMathAdd < IndexOfMathDiv) IndexOfNearest = IndexOfMathAdd;
|
if (IndexOfMathAdd > 0 && IndexOfMathAdd < IndexOfMathMul && IndexOfMathAdd < IndexOfMathDiv) IndexOfNearest = IndexOfMathAdd;
|
||||||
|
@ -557,36 +549,20 @@ internal class ClassEditor
|
||||||
private double GetNextValue(string ThisMath)
|
private double GetNextValue(string ThisMath)
|
||||||
{
|
{
|
||||||
double Value = 0;
|
double Value = 0;
|
||||||
//bool IsNegative = false;
|
|
||||||
|
|
||||||
int Nearestindex = GetNearestMathIndex(ThisMath);
|
int Nearestindex = GetNearestMathIndex(ThisMath);
|
||||||
if (Nearestindex == 0)
|
if (Nearestindex == 0) ThisMath = ThisMath.Substring(1);
|
||||||
{
|
|
||||||
/*if (ThisMath[0] == '-')
|
|
||||||
{
|
|
||||||
IsNegative = true;
|
|
||||||
ThisMath = ThisMath.Substring(1);
|
|
||||||
Nearestindex = GetNearestMathIndex(ThisMath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{*/
|
|
||||||
ThisMath = ThisMath.Substring(1);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
//Nearestindex = GetNearestMathIndex(ThisMath);
|
|
||||||
|
|
||||||
if (Nearestindex == -1)
|
if (Nearestindex == -1)
|
||||||
{
|
{
|
||||||
Value = double.Parse(ThisMath, CultureInfo.InvariantCulture);
|
Value = double.Parse(ThisMath.Replace(',', '.'), CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string ThisVarStr = ThisMath.Substring(0, Nearestindex);
|
string ThisVarStr = ThisMath.Substring(0, Nearestindex);
|
||||||
Value = double.Parse(ThisVarStr, CultureInfo.InvariantCulture);
|
Value = double.Parse(ThisVarStr.Replace(',', '.'), CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (IsNegative) Value = -Value;
|
|
||||||
|
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,11 +580,10 @@ internal class ClassEditor
|
||||||
ValuesList.Add(GetNextValue(ThisMath));
|
ValuesList.Add(GetNextValue(ThisMath));
|
||||||
|
|
||||||
int NearestIndex = GetNearestMathIndex(ThisMath);
|
int NearestIndex = GetNearestMathIndex(ThisMath);
|
||||||
if (NearestIndex != -1) ThisMath = ThisMath.Substring(GetNearestMathIndex(ThisMath) + 1);
|
if (NearestIndex != -1) ThisMath = ThisMath.Substring(GetNearestMathIndex(ThisMath));
|
||||||
|
|
||||||
WeHaveVal1 = true;
|
WeHaveVal1 = true;
|
||||||
|
|
||||||
//if (!ThisMath.Contains("/") && !ThisMath.Contains("*") && !ThisMath.Contains("+") && !ThisMath.Contains("-"))
|
|
||||||
if (!ThisMath.Contains("/") && !ThisMath.Contains("*") && !ThisMath.Contains("+"))
|
if (!ThisMath.Contains("/") && !ThisMath.Contains("*") && !ThisMath.Contains("+"))
|
||||||
{
|
{
|
||||||
ThisMath = ""; //No remaining maths to perform
|
ThisMath = ""; //No remaining maths to perform
|
||||||
|
@ -630,31 +605,56 @@ internal class ClassEditor
|
||||||
return ReturnStr;
|
return ReturnStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double DoMath(double ThisValue, string ThisMath, bool Reverse)
|
|
||||||
|
public double DoMath(double ThisValueCheck, string ThisMath, bool Reverse)
|
||||||
|
{
|
||||||
|
double ReturnVal = DoMathFinal(ThisValueCheck, ThisMath, Reverse);
|
||||||
|
|
||||||
|
//Confirm Math function in reverse
|
||||||
|
if (!Reverse)
|
||||||
|
{
|
||||||
|
double ReversedVal = DoMathFinal(ReturnVal, ThisMath, true);
|
||||||
|
if (((int) ReversedVal).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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ReturnVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
//public double DoMath(double ThisValue, string ThisMath, bool Reverse)
|
||||||
|
public double DoMathFinal(double ThisValue, string ThisMath, bool Reverse)
|
||||||
{
|
{
|
||||||
double ReturnVal = ThisValue;
|
double ReturnVal = ThisValue;
|
||||||
|
|
||||||
//No Math found, return value with no math calculation
|
//No Math found, return value with no math calculation
|
||||||
if (ThisMath == "X" || ThisMath == "") return ReturnVal;
|
if (ThisMath == "X" || ThisMath == "") return ReturnVal;
|
||||||
|
|
||||||
//Put X at the end
|
//Put X at the end in reverse
|
||||||
|
bool IsDivXValFirst = false;
|
||||||
if (Reverse)
|
if (Reverse)
|
||||||
{
|
{
|
||||||
|
if (ThisMath.Contains("X/")) IsDivXValFirst = true;
|
||||||
|
|
||||||
if (ThisMath[ThisMath.Length - 1] != 'X')
|
if (ThisMath[ThisMath.Length - 1] != 'X')
|
||||||
{
|
{
|
||||||
string XandMath = ThisMath.Substring(ThisMath.IndexOf('X'), 2);
|
string XandMath = ThisMath.Substring(ThisMath.IndexOf('X'), 2);
|
||||||
ThisMath = ThisMath.Replace(XandMath, "") + XandMath[1].ToString() + XandMath[0].ToString();
|
ThisMath = ThisMath.Replace(XandMath, "") + XandMath[1].ToString() + XandMath[0].ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Console.WriteLine("Math: " + ThisMath + " (" + Reverse + ")");
|
||||||
|
|
||||||
ThisMath = ThisMath.Replace("X", ThisValue.ToString());
|
ThisMath = ThisMath.Replace("X", ThisValue.ToString());
|
||||||
|
//Console.WriteLine("Math func: " + ThisMath + " (" + Reverse + ")");
|
||||||
|
|
||||||
|
//128.0/X*14.7 --> 128/ (X/14.7) (real order: X/14.7*128
|
||||||
|
//32767/X --> 32767/X
|
||||||
|
//X/50 --> X*50
|
||||||
|
|
||||||
//128/X*14.7
|
|
||||||
//12/34*14.7
|
|
||||||
//---
|
|
||||||
//14.7/X*128
|
|
||||||
if (Reverse) ThisMath = InvertMathString(ThisMath);
|
if (Reverse) ThisMath = InvertMathString(ThisMath);
|
||||||
//if (Reverse) Console.WriteLine(ThisMath);
|
//Console.WriteLine("Math func: " + ThisMath + " (" + Reverse + ")");
|
||||||
|
|
||||||
bool WeHaveVal1 = false;
|
bool WeHaveVal1 = false;
|
||||||
double Val1 = 0;
|
double Val1 = 0;
|
||||||
|
@ -665,13 +665,20 @@ internal class ClassEditor
|
||||||
ThisMath = ThisMath.Substring(GetNearestMathIndex(ThisMath) + 1);
|
ThisMath = ThisMath.Substring(GetNearestMathIndex(ThisMath) + 1);
|
||||||
double Val2 = GetNextValue(ThisMath);
|
double Val2 = GetNextValue(ThisMath);
|
||||||
|
|
||||||
|
//Console.WriteLine("Math: " + Val1 + MathChar.ToString() + Val2 + " (" + Reverse + ")");
|
||||||
|
|
||||||
if (MathChar == '*') ReturnVal = Val1 * Val2;
|
if (MathChar == '*') ReturnVal = Val1 * Val2;
|
||||||
if (MathChar == '/') ReturnVal = Val1 / Val2;
|
if (MathChar == '/') ReturnVal = Val1 / Val2;
|
||||||
if (MathChar == '+') ReturnVal = Val1 + Val2;
|
if (MathChar == '+') ReturnVal = Val1 + Val2;
|
||||||
if (MathChar == '-') ReturnVal = Val1 - Val2;
|
if (MathChar == '-') ReturnVal = Val1 - Val2;
|
||||||
|
|
||||||
|
if (Reverse && MathChar == '*' && !IsDivXValFirst) ReturnVal = Val2 / Val1;
|
||||||
|
|
||||||
int NearestIndex = GetNearestMathIndex(ThisMath);
|
int NearestIndex = GetNearestMathIndex(ThisMath);
|
||||||
if (NearestIndex != -1) ThisMath = ThisMath.Substring(GetNearestMathIndex(ThisMath) + 1);
|
if (NearestIndex != -1) ThisMath = ThisMath.Substring(GetNearestMathIndex(ThisMath));
|
||||||
|
|
||||||
|
//Console.WriteLine("Math remain: " + ThisMath + " (" + Reverse + ")");
|
||||||
|
//Console.WriteLine("New/End Val1: " + ReturnVal + " (" + Reverse + ")");
|
||||||
|
|
||||||
WeHaveVal1 = true;
|
WeHaveVal1 = true;
|
||||||
Val1 = ReturnVal;
|
Val1 = ReturnVal;
|
||||||
|
@ -683,7 +690,6 @@ internal class ClassEditor
|
||||||
ThisMath = ""; //No remaining maths to perform
|
ThisMath = ""; //No remaining maths to perform
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (Reverse) Console.WriteLine(ReturnVal);
|
|
||||||
return ReturnVal;
|
return ReturnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,6 +909,7 @@ internal class ClassEditor
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Buffer 10 x 20
|
||||||
public T[,] smethod_35<T>(T[] gparam_0, int int_232, int int_233)
|
public T[,] smethod_35<T>(T[] gparam_0, int int_232, int int_233)
|
||||||
{
|
{
|
||||||
T[,] array = new T[int_232, int_233];
|
T[,] array = new T[int_232, int_233];
|
||||||
|
@ -1054,9 +1061,9 @@ internal class ClassEditor
|
||||||
if (Commands[0] == "MathX") CurrentMathX = Commands[1];
|
if (Commands[0] == "MathX") CurrentMathX = Commands[1];
|
||||||
if (Commands[0] == "MathY") CurrentMathY = Commands[1];
|
if (Commands[0] == "MathY") CurrentMathY = Commands[1];
|
||||||
if (Commands[0] == "MathTable") CurrentMathTable = Commands[1];
|
if (Commands[0] == "MathTable") CurrentMathTable = Commands[1];
|
||||||
if (Commands[0] == "ValueMin") CurrentValueMin = (float) double.Parse(Commands[1], CultureInfo.InvariantCulture);
|
if (Commands[0] == "ValueMin") CurrentValueMin = (float) double.Parse(Commands[1].Replace(',', '.'), CultureInfo.InvariantCulture);
|
||||||
if (Commands[0] == "ValueMax") CurrentValueMax = (float) double.Parse(Commands[1], CultureInfo.InvariantCulture);
|
if (Commands[0] == "ValueMax") CurrentValueMax = (float) double.Parse(Commands[1].Replace(',', '.'), CultureInfo.InvariantCulture);
|
||||||
if (Commands[0] == "ChangeAmount") CurrentChangeAmount = double.Parse(Commands[1], CultureInfo.InvariantCulture);
|
if (Commands[0] == "ChangeAmount") CurrentChangeAmount = double.Parse(Commands[1].Replace(',', '.'), CultureInfo.InvariantCulture);
|
||||||
if (Commands[0] == "IsSingleByteX") CurrentIsSingleByteX = bool.Parse(Commands[1].ToLower());
|
if (Commands[0] == "IsSingleByteX") CurrentIsSingleByteX = bool.Parse(Commands[1].ToLower());
|
||||||
if (Commands[0] == "IsSingleByteY") CurrentIsSingleByteY = bool.Parse(Commands[1].ToLower());
|
if (Commands[0] == "IsSingleByteY") CurrentIsSingleByteY = bool.Parse(Commands[1].ToLower());
|
||||||
if (Commands[0] == "IsSingleByteTable") CurrentIsSingleByteTable = bool.Parse(Commands[1].ToLower());
|
if (Commands[0] == "IsSingleByteTable") CurrentIsSingleByteTable = bool.Parse(Commands[1].ToLower());
|
||||||
|
@ -1155,7 +1162,7 @@ internal class ClassEditor
|
||||||
public bool IsSingleByteTable = false;
|
public bool IsSingleByteTable = false;
|
||||||
|
|
||||||
public int[] BufferValuesArray = new int[200];
|
public int[] BufferValuesArray = new int[200];
|
||||||
public byte[] BufferBytesArray = new byte[400];
|
//public byte[] BufferBytesArray = new byte[400];
|
||||||
public int[] BufferTableSize = new int[2];
|
public int[] BufferTableSize = new int[2];
|
||||||
public string BufferMath = "";
|
public string BufferMath = "";
|
||||||
|
|
||||||
|
|
209
Editortable.cs
209
Editortable.cs
|
@ -17,26 +17,16 @@ public class Editortable : DarkForm
|
||||||
private IContainer icontainer_1;
|
private IContainer icontainer_1;
|
||||||
public bool bool_0 = true;
|
public bool bool_0 = true;
|
||||||
public static float float_0 = 1f;
|
public static float float_0 = 1f;
|
||||||
//private Timer timer_0 = new Timer();
|
|
||||||
private List<string> list_0 = new List<string>();
|
private List<string> list_0 = new List<string>();
|
||||||
public string[] string_0 = new string[] { "6.00", "8.00", "12.00", "14.00", "16.00" };
|
|
||||||
public string[] string_1;
|
|
||||||
public string[] string_2;
|
|
||||||
public string string_3;
|
|
||||||
public string[] string_4;
|
|
||||||
public string[] string_5;
|
|
||||||
public static float[] float_1 = new float[2];
|
public static float[] float_1 = new float[2];
|
||||||
private TableLayoutPanel tableLayoutPanel1;
|
private TableLayoutPanel tableLayoutPanel1;
|
||||||
private DarkTreeView treeView1;
|
private DarkTreeView treeView1;
|
||||||
private DarkGroupBox groupBox1;
|
private DarkGroupBox groupBox1;
|
||||||
public DataGridView dataGridView_0;
|
public DataGridView dataGridView_0;
|
||||||
internal ClassEditor ClassEditor_0;
|
internal ClassEditor ClassEditor_0;
|
||||||
public string string_8;
|
public string LoadedFilename;
|
||||||
public bool IsFullBinary = true;
|
public bool IsFullBinary = true;
|
||||||
public static ImageList imageList_0;
|
public static ImageList imageList_0;
|
||||||
public int int_0;
|
|
||||||
public int int_1;
|
|
||||||
public int LastPackageChecksum;
|
|
||||||
private OpenFileDialog openFileDialog1;
|
private OpenFileDialog openFileDialog1;
|
||||||
private SaveFileDialog saveFileDialog1;
|
private SaveFileDialog saveFileDialog1;
|
||||||
public GForm_Main GForm_Main_0;
|
public GForm_Main GForm_Main_0;
|
||||||
|
@ -53,29 +43,20 @@ public class Editortable : DarkForm
|
||||||
private ToolStripSeparator toolStripSeparator2;
|
private ToolStripSeparator toolStripSeparator2;
|
||||||
private ToolStripMenuItem increaseSelectionToolStripMenuItem;
|
private ToolStripMenuItem increaseSelectionToolStripMenuItem;
|
||||||
private ToolStripMenuItem decreaseSelectionToolStripMenuItem;
|
private ToolStripMenuItem decreaseSelectionToolStripMenuItem;
|
||||||
public System.Windows.Forms.Timer timer_1 = new System.Windows.Forms.Timer();
|
|
||||||
|
|
||||||
internal Editortable(ref GForm_Main GForm_Main_1)
|
internal Editortable(ref GForm_Main GForm_Main_1)
|
||||||
{
|
{
|
||||||
GForm_Main_0 = GForm_Main_1;
|
GForm_Main_0 = GForm_Main_1;
|
||||||
|
|
||||||
this.timer_1.Interval = 0xbb8;
|
|
||||||
this.timer_1.Tick += new EventHandler(this.timer_1_Tick);
|
|
||||||
|
|
||||||
//this.string_7_S2K = new string[] { "Fuel Low Cam", "Fuel High Cam", "Ignition Timing Low Cam", "Ignition Timing High Cam", "VTEC Engagement", "Revlimiter", "Injector Voltage Compensation" };
|
|
||||||
//this.string_6_RWC = new string[] { "Mass Airflow Conversion Curve", "VTEC Engagement", "Revlimiter", "--Revlimiter 2", "--Revlimiter 3", "--Revlimiter 4", "--Revlimiter 5", "--Revlimiter 6", "--Revlimiter 7", "Speedlimiter", "Injector Voltage Compensation", "Minimum IPW" };
|
|
||||||
|
|
||||||
this.int_1 = 1;
|
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
|
|
||||||
Editortable_0 = this;
|
Editortable_0 = this;
|
||||||
|
|
||||||
if (this.ClassEditor_0 != null) this.ClassEditor_0 = null;
|
if (this.ClassEditor_0 != null) this.ClassEditor_0 = null;
|
||||||
this.ClassEditor_0 = new ClassEditor(ref Editortable_0);
|
this.ClassEditor_0 = new ClassEditor(ref Editortable_0);
|
||||||
}
|
|
||||||
|
|
||||||
private void timer_1_Tick(object sender, EventArgs e)
|
|
||||||
{
|
this.Text = this.Text + " (" + this.GForm_Main_0.Version + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
|
@ -85,18 +66,18 @@ public class Editortable : DarkForm
|
||||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Editortable));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Editortable));
|
||||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this.treeView1 = new DarkUI.Controls.DarkTreeView();
|
||||||
this.groupBox1 = new DarkUI.Controls.DarkGroupBox();
|
this.groupBox1 = new DarkUI.Controls.DarkGroupBox();
|
||||||
this.dataGridView_0 = new System.Windows.Forms.DataGridView();
|
this.dataGridView_0 = new System.Windows.Forms.DataGridView();
|
||||||
this.treeView1 = new DarkUI.Controls.DarkTreeView();
|
|
||||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||||
this.darkToolStrip1 = new DarkUI.Controls.DarkToolStrip();
|
this.darkToolStrip1 = new DarkUI.Controls.DarkToolStrip();
|
||||||
this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();
|
this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();
|
||||||
this.openbinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.openbinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.savebinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.savebinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.fixChecksumsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.openDefinitionsFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.openDefinitionsFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.fixChecksumsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.toolStripDropDownButton2 = new System.Windows.Forms.ToolStripDropDownButton();
|
this.toolStripDropDownButton2 = new System.Windows.Forms.ToolStripDropDownButton();
|
||||||
this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
@ -122,10 +103,30 @@ public class Editortable : DarkForm
|
||||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
|
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
|
||||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
this.tableLayoutPanel1.RowCount = 1;
|
this.tableLayoutPanel1.RowCount = 1;
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 186F));
|
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.Size = new System.Drawing.Size(1100, 517);
|
||||||
this.tableLayoutPanel1.TabIndex = 11;
|
this.tableLayoutPanel1.TabIndex = 11;
|
||||||
//
|
//
|
||||||
|
// treeView1
|
||||||
|
//
|
||||||
|
this.treeView1.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||||
|
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.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.treeView1.MaxDragChange = 20;
|
||||||
|
this.treeView1.Name = "treeView1";
|
||||||
|
this.treeView1.NonFocusedNodeColor = System.Drawing.Color.FromArgb(((int)(((byte)(92)))), ((int)(((byte)(92)))), ((int)(((byte)(92)))));
|
||||||
|
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.TabIndex = 2;
|
||||||
|
this.treeView1.SelectedNodesChanged += new System.EventHandler(this.treeView1_AfterSelect);
|
||||||
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
this.groupBox1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
|
this.groupBox1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
|
||||||
|
@ -188,26 +189,6 @@ public class Editortable : DarkForm
|
||||||
this.dataGridView_0.DoubleClick += new System.EventHandler(this.method_3);
|
this.dataGridView_0.DoubleClick += new System.EventHandler(this.method_3);
|
||||||
this.dataGridView_0.KeyDown += new System.Windows.Forms.KeyEventHandler(this.method_4);
|
this.dataGridView_0.KeyDown += new System.Windows.Forms.KeyEventHandler(this.method_4);
|
||||||
//
|
//
|
||||||
// treeView1
|
|
||||||
//
|
|
||||||
this.treeView1.BackColor = System.Drawing.SystemColors.ControlDark;
|
|
||||||
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.Margin = new System.Windows.Forms.Padding(2);
|
|
||||||
this.treeView1.MaxDragChange = 20;
|
|
||||||
this.treeView1.Name = "treeView1";
|
|
||||||
this.treeView1.NonFocusedNodeColor = System.Drawing.Color.FromArgb(((int)(((byte)(92)))), ((int)(((byte)(92)))), ((int)(((byte)(92)))));
|
|
||||||
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.TabIndex = 2;
|
|
||||||
this.treeView1.SelectedNodesChanged += new System.EventHandler(this.treeView1_AfterSelect);
|
|
||||||
//
|
|
||||||
// openFileDialog1
|
// openFileDialog1
|
||||||
//
|
//
|
||||||
this.openFileDialog1.DefaultExt = "*.bin";
|
this.openFileDialog1.DefaultExt = "*.bin";
|
||||||
|
@ -270,6 +251,15 @@ public class Editortable : DarkForm
|
||||||
this.savebinToolStripMenuItem.Text = "Save .bin";
|
this.savebinToolStripMenuItem.Text = "Save .bin";
|
||||||
this.savebinToolStripMenuItem.Click += new System.EventHandler(this.button2_Click);
|
this.savebinToolStripMenuItem.Click += new System.EventHandler(this.button2_Click);
|
||||||
//
|
//
|
||||||
|
// fixChecksumsToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.fixChecksumsToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
|
||||||
|
this.fixChecksumsToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
||||||
|
this.fixChecksumsToolStripMenuItem.Name = "fixChecksumsToolStripMenuItem";
|
||||||
|
this.fixChecksumsToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
|
||||||
|
this.fixChecksumsToolStripMenuItem.Text = "Fix Checksums";
|
||||||
|
this.fixChecksumsToolStripMenuItem.Click += new System.EventHandler(this.fixChecksumsToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// toolStripSeparator1
|
// toolStripSeparator1
|
||||||
//
|
//
|
||||||
this.toolStripSeparator1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
|
this.toolStripSeparator1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
|
||||||
|
@ -287,15 +277,6 @@ public class Editortable : DarkForm
|
||||||
this.openDefinitionsFolderToolStripMenuItem.Text = "Open Definitions Folder";
|
this.openDefinitionsFolderToolStripMenuItem.Text = "Open Definitions Folder";
|
||||||
this.openDefinitionsFolderToolStripMenuItem.Click += new System.EventHandler(this.openDefinitionsFolderToolStripMenuItem_Click);
|
this.openDefinitionsFolderToolStripMenuItem.Click += new System.EventHandler(this.openDefinitionsFolderToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// fixChecksumsToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.fixChecksumsToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
|
|
||||||
this.fixChecksumsToolStripMenuItem.Enabled = false;
|
|
||||||
this.fixChecksumsToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(153)))), ((int)(((byte)(153)))));
|
|
||||||
this.fixChecksumsToolStripMenuItem.Name = "fixChecksumsToolStripMenuItem";
|
|
||||||
this.fixChecksumsToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
|
|
||||||
this.fixChecksumsToolStripMenuItem.Text = "Fix Checksums";
|
|
||||||
//
|
|
||||||
// toolStripDropDownButton2
|
// toolStripDropDownButton2
|
||||||
//
|
//
|
||||||
this.toolStripDropDownButton2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
|
this.toolStripDropDownButton2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
|
||||||
|
@ -319,7 +300,7 @@ public class Editortable : DarkForm
|
||||||
this.undoToolStripMenuItem.Enabled = false;
|
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)(153)))), ((int)(((byte)(153)))), ((int)(((byte)(153)))));
|
||||||
this.undoToolStripMenuItem.Name = "undoToolStripMenuItem";
|
this.undoToolStripMenuItem.Name = "undoToolStripMenuItem";
|
||||||
this.undoToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
this.undoToolStripMenuItem.Size = new System.Drawing.Size(172, 22);
|
||||||
this.undoToolStripMenuItem.Text = "Undo";
|
this.undoToolStripMenuItem.Text = "Undo";
|
||||||
//
|
//
|
||||||
// redoToolStripMenuItem
|
// redoToolStripMenuItem
|
||||||
|
@ -328,7 +309,7 @@ public class Editortable : DarkForm
|
||||||
this.redoToolStripMenuItem.Enabled = false;
|
this.redoToolStripMenuItem.Enabled = false;
|
||||||
this.redoToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(153)))), ((int)(((byte)(153)))));
|
this.redoToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(153)))), ((int)(((byte)(153)))), ((int)(((byte)(153)))));
|
||||||
this.redoToolStripMenuItem.Name = "redoToolStripMenuItem";
|
this.redoToolStripMenuItem.Name = "redoToolStripMenuItem";
|
||||||
this.redoToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
this.redoToolStripMenuItem.Size = new System.Drawing.Size(172, 22);
|
||||||
this.redoToolStripMenuItem.Text = "Redo";
|
this.redoToolStripMenuItem.Text = "Redo";
|
||||||
//
|
//
|
||||||
// toolStripSeparator2
|
// toolStripSeparator2
|
||||||
|
@ -337,14 +318,14 @@ public class Editortable : DarkForm
|
||||||
this.toolStripSeparator2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
this.toolStripSeparator2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
||||||
this.toolStripSeparator2.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
this.toolStripSeparator2.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||||
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
|
this.toolStripSeparator2.Size = new System.Drawing.Size(169, 6);
|
||||||
//
|
//
|
||||||
// increaseSelectionToolStripMenuItem
|
// increaseSelectionToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.increaseSelectionToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
|
this.increaseSelectionToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
|
||||||
this.increaseSelectionToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
this.increaseSelectionToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
||||||
this.increaseSelectionToolStripMenuItem.Name = "increaseSelectionToolStripMenuItem";
|
this.increaseSelectionToolStripMenuItem.Name = "increaseSelectionToolStripMenuItem";
|
||||||
this.increaseSelectionToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
this.increaseSelectionToolStripMenuItem.Size = new System.Drawing.Size(172, 22);
|
||||||
this.increaseSelectionToolStripMenuItem.Text = "Increase Selection";
|
this.increaseSelectionToolStripMenuItem.Text = "Increase Selection";
|
||||||
this.increaseSelectionToolStripMenuItem.Click += new System.EventHandler(this.increaseSelectionToolStripMenuItem_Click);
|
this.increaseSelectionToolStripMenuItem.Click += new System.EventHandler(this.increaseSelectionToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -353,7 +334,7 @@ public class Editortable : DarkForm
|
||||||
this.decreaseSelectionToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
|
this.decreaseSelectionToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
|
||||||
this.decreaseSelectionToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
this.decreaseSelectionToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
||||||
this.decreaseSelectionToolStripMenuItem.Name = "decreaseSelectionToolStripMenuItem";
|
this.decreaseSelectionToolStripMenuItem.Name = "decreaseSelectionToolStripMenuItem";
|
||||||
this.decreaseSelectionToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
this.decreaseSelectionToolStripMenuItem.Size = new System.Drawing.Size(172, 22);
|
||||||
this.decreaseSelectionToolStripMenuItem.Text = "Decrease Selection";
|
this.decreaseSelectionToolStripMenuItem.Text = "Decrease Selection";
|
||||||
this.decreaseSelectionToolStripMenuItem.Click += new System.EventHandler(this.decreaseSelectionToolStripMenuItem_Click);
|
this.decreaseSelectionToolStripMenuItem.Click += new System.EventHandler(this.decreaseSelectionToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -380,10 +361,7 @@ public class Editortable : DarkForm
|
||||||
|
|
||||||
public void Editortable_Load(object sender, EventArgs e)
|
public void Editortable_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Text = "Honda Rom Tables Editor";
|
this.CreateRightClicMenu();
|
||||||
//this.timer_0.Interval = 500;
|
|
||||||
//this.timer_0.Tick += new EventHandler(this.timer_0_Tick);
|
|
||||||
this.method_5();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadDefinitionsFor(string string_9)
|
public bool LoadDefinitionsFor(string string_9)
|
||||||
|
@ -410,7 +388,7 @@ public class Editortable : DarkForm
|
||||||
public void method_1()
|
public void method_1()
|
||||||
{
|
{
|
||||||
ClassEditor_0.bool_1 = false;
|
ClassEditor_0.bool_1 = false;
|
||||||
if (!ClassEditor_0.LoadROMbytes(string_8))
|
if (!ClassEditor_0.LoadROMbytes(LoadedFilename))
|
||||||
{
|
{
|
||||||
DarkMessageBox.Show("Failed to open Binary file.");
|
DarkMessageBox.Show("Failed to open Binary file.");
|
||||||
}
|
}
|
||||||
|
@ -427,14 +405,11 @@ public class Editortable : DarkForm
|
||||||
|
|
||||||
private void CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
private void CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
||||||
{
|
{
|
||||||
ClassEditor_0.bool_2 = true;
|
if (ClassEditor_0.bool_1)
|
||||||
if (ClassEditor_0.bool_1) ClassEditor_0.SetBackColor(dataGridView_0.Columns.Count, float_1[0], float_1[1]);
|
|
||||||
|
|
||||||
/*this.timer_0.Enabled = false;
|
|
||||||
if (ClassEditor_0.bool_0)
|
|
||||||
{
|
{
|
||||||
this.timer_0.Enabled = true;
|
ClassEditor_0.bool_2 = true;
|
||||||
}*/
|
ClassEditor_0.SetBackColor(dataGridView_0.Columns.Count, float_1[0], float_1[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNodesImages()
|
public void SetNodesImages()
|
||||||
|
@ -458,7 +433,7 @@ public class Editortable : DarkForm
|
||||||
this.treeView1.Nodes.Add(ThisNode);
|
this.treeView1.Nodes.Add(ThisNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (DarkTreeNode node in this.treeView1.Nodes)
|
/*foreach (DarkTreeNode node in this.treeView1.Nodes)
|
||||||
{
|
{
|
||||||
if (node.Nodes.Count > 0)
|
if (node.Nodes.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -470,20 +445,6 @@ public class Editortable : DarkForm
|
||||||
node2.SelectedImageKey = "Normal";
|
node2.SelectedImageKey = "Normal";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (node.Text.Contains("Fuel"))
|
|
||||||
{
|
|
||||||
node2.ImageKey = "Table";
|
|
||||||
node2.SelectedImageKey = "Table";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (node.Text.Contains("Target"))
|
|
||||||
{
|
|
||||||
node2.ImageKey = "Table";
|
|
||||||
node2.SelectedImageKey = "Table";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
node2.ImageKey = "Degree";
|
|
||||||
node2.SelectedImageKey = "Degree";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((node.Text.Contains("Revlimiter") || node.Text.Contains("Speedlimiter")) || node.Text.Contains("Limit"))
|
if ((node.Text.Contains("Revlimiter") || node.Text.Contains("Speedlimiter")) || node.Text.Contains("Limit"))
|
||||||
|
@ -495,63 +456,8 @@ public class Editortable : DarkForm
|
||||||
{
|
{
|
||||||
node.ImageKey = "Degree";
|
node.ImageKey = "Degree";
|
||||||
node.SelectedImageKey = "Degree";
|
node.SelectedImageKey = "Degree";
|
||||||
}
|
}//...
|
||||||
else if (node.Text.Contains("VTC High") || node.Text.Contains("Timing High Cam"))
|
}*/
|
||||||
{
|
|
||||||
node.ImageKey = "HighCam";
|
|
||||||
node.SelectedImageKey = "HighCam";
|
|
||||||
}
|
|
||||||
else if (node.Text.Contains("VTC Low") || node.Text.Contains("Timing Low Cam"))
|
|
||||||
{
|
|
||||||
node.ImageKey = "LowCam";
|
|
||||||
node.SelectedImageKey = "LowCam";
|
|
||||||
}
|
|
||||||
else if (node.Text.Contains("Fuel High"))
|
|
||||||
{
|
|
||||||
node.ImageKey = "HighFuel";
|
|
||||||
node.SelectedImageKey = "HighFuel";
|
|
||||||
}
|
|
||||||
else if (node.Text.Contains("Fuel Low"))
|
|
||||||
{
|
|
||||||
node.ImageKey = "LowFuel";
|
|
||||||
node.SelectedImageKey = "LowFuel";
|
|
||||||
}
|
|
||||||
else if (node.Text.Contains("Target High"))
|
|
||||||
{
|
|
||||||
node.ImageKey = "HighFuel";
|
|
||||||
node.SelectedImageKey = "HighFuel";
|
|
||||||
}
|
|
||||||
else if (node.Text.Contains("Target Low"))
|
|
||||||
{
|
|
||||||
node.ImageKey = "LowFuel";
|
|
||||||
node.SelectedImageKey = "LowFuel";
|
|
||||||
}
|
|
||||||
else if (node.Text.Contains("AFM Fuel"))
|
|
||||||
{
|
|
||||||
node.ImageKey = "LowFuel";
|
|
||||||
node.SelectedImageKey = "LowFuel";
|
|
||||||
}
|
|
||||||
else if ((node.Text.Contains("VTEC") || node.Text.Contains("Idle")) || node.Text.Contains("WOT"))
|
|
||||||
{
|
|
||||||
node.ImageKey = "Vtec";
|
|
||||||
node.SelectedImageKey = "Vtec";
|
|
||||||
}
|
|
||||||
else if (node.Text.Contains("Knock"))
|
|
||||||
{
|
|
||||||
node.ImageKey = "Knock";
|
|
||||||
node.SelectedImageKey = "Knock";
|
|
||||||
}
|
|
||||||
else if (node.Text.Contains("Overrun"))
|
|
||||||
{
|
|
||||||
node.ImageKey = "Bang";
|
|
||||||
node.SelectedImageKey = "Bang";
|
|
||||||
}
|
|
||||||
else if ((node.Text.Contains("Compensation") || node.Text.Contains("Conversion")) || node.Text.Contains("LAF"))
|
|
||||||
{
|
|
||||||
node.ImageKey = "Red";
|
|
||||||
node.SelectedImageKey = "Red";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void method_3(object sender, EventArgs e)
|
private void method_3(object sender, EventArgs e)
|
||||||
|
@ -564,7 +470,7 @@ public class Editortable : DarkForm
|
||||||
ClassEditor_0.ShortcutsCommand(e, 0);
|
ClassEditor_0.ShortcutsCommand(e, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void method_5()
|
public void CreateRightClicMenu()
|
||||||
{
|
{
|
||||||
ContextMenu menu = new ContextMenu {
|
ContextMenu menu = new ContextMenu {
|
||||||
MenuItems = {
|
MenuItems = {
|
||||||
|
@ -600,12 +506,6 @@ public class Editortable : DarkForm
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void timer_0_Tick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
ClassEditor_0.SetBackColor(dataGridView_0.Columns.Count, float_1[0], float_1[1]);
|
|
||||||
//this.timer_0.Enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*public static ImageList ImageList_0
|
/*public static ImageList ImageList_0
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -767,7 +667,7 @@ public class Editortable : DarkForm
|
||||||
byte[] FilesBytes = File.ReadAllBytes(openFileDialog1.FileName);
|
byte[] FilesBytes = File.ReadAllBytes(openFileDialog1.FileName);
|
||||||
if ((FilesBytes.Length - 1) == 0xFFFFF)
|
if ((FilesBytes.Length - 1) == 0xFFFFF)
|
||||||
{
|
{
|
||||||
this.Editortable_0.string_8 = openFileDialog1.FileName;
|
this.Editortable_0.LoadedFilename = openFileDialog1.FileName;
|
||||||
this.IsFullBinary = true;
|
this.IsFullBinary = true;
|
||||||
|
|
||||||
//Load Binary into ROM Table Editor
|
//Load Binary into ROM Table Editor
|
||||||
|
@ -783,7 +683,7 @@ public class Editortable : DarkForm
|
||||||
byte[] FilesBytes = File.ReadAllBytes(openFileDialog1.FileName);
|
byte[] FilesBytes = File.ReadAllBytes(openFileDialog1.FileName);
|
||||||
if ((FilesBytes.Length - 1) == 0xF7FFF)
|
if ((FilesBytes.Length - 1) == 0xF7FFF)
|
||||||
{
|
{
|
||||||
this.Editortable_0.string_8 = openFileDialog1.FileName;
|
this.Editortable_0.LoadedFilename = openFileDialog1.FileName;
|
||||||
this.IsFullBinary = false;
|
this.IsFullBinary = false;
|
||||||
|
|
||||||
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);
|
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);
|
||||||
|
@ -850,5 +750,10 @@ public class Editortable : DarkForm
|
||||||
{
|
{
|
||||||
ClassEditor_0.IncDecreaseSelection(true, false);
|
ClassEditor_0.IncDecreaseSelection(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fixChecksumsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ClassEditor_0.FixChecksums();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
174
GForm_Main.cs
174
GForm_Main.cs
|
@ -30,13 +30,10 @@ public class GForm_Main : DarkForm
|
||||||
private DarkButton darkButton6;
|
private DarkButton darkButton6;
|
||||||
private DarkButton darkButton3;
|
private DarkButton darkButton3;
|
||||||
public Editortable Editortable_0;
|
public Editortable Editortable_0;
|
||||||
public string Version = "v1.0.8";
|
public string Version = "v1.0.9";
|
||||||
|
|
||||||
public GForm_Main()
|
public GForm_Main()
|
||||||
{
|
{
|
||||||
//Console.WriteLine(379890608U.ToString("X8"));
|
|
||||||
//Console.WriteLine(3219675757U.ToString("X8"));
|
|
||||||
//Console.WriteLine(BitConverter.ToUInt32(new byte[] { 0x23, 0xff, 0x0d, 0xae }, 0).ToString());
|
|
||||||
|
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
|
|
||||||
|
@ -78,12 +75,16 @@ public class GForm_Main : DarkForm
|
||||||
|
|
||||||
public void method_1(string string_3)
|
public void method_1(string string_3)
|
||||||
{
|
{
|
||||||
//With newline automaticly added
|
try
|
||||||
Console.WriteLine(string_3);
|
{
|
||||||
GForm_Main.Class5 @class = new GForm_Main.Class5();
|
//With newline automaticly added
|
||||||
@class.gform0_0 = this;
|
Console.WriteLine(string_3);
|
||||||
@class.string_0 = string_3;
|
GForm_Main.Class5 @class = new GForm_Main.Class5();
|
||||||
this.darkTextBox_0.BeginInvoke(new MethodInvoker(@class.method_0));
|
@class.gform0_0 = this;
|
||||||
|
@class.string_0 = string_3;
|
||||||
|
this.darkTextBox_0.BeginInvoke(new MethodInvoker(@class.method_0));
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,11 +130,13 @@ public class GForm_Main : DarkForm
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Device device = api.GetDevice(""))
|
Device device = api.GetDevice("");
|
||||||
{
|
Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false);
|
||||||
using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
|
//using (Device device = api.GetDevice(""))
|
||||||
{
|
//{
|
||||||
LoadJ2534Channel(channel);
|
// using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
|
||||||
|
// {
|
||||||
|
channel = LoadJ2534Channel(channel);
|
||||||
/*MessageFilter messageFilter = new MessageFilter();
|
/*MessageFilter messageFilter = new MessageFilter();
|
||||||
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
|
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
|
||||||
messageFilter.Mask = new byte[]
|
messageFilter.Mask = new byte[]
|
||||||
|
@ -220,8 +223,8 @@ public class GForm_Main : DarkForm
|
||||||
this.darkButton_Unlock41.Enabled = true;
|
this.darkButton_Unlock41.Enabled = true;
|
||||||
this.darkButton_Unlock01.Enabled = true;
|
this.darkButton_Unlock01.Enabled = true;
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -347,13 +350,16 @@ public class GForm_Main : DarkForm
|
||||||
{
|
{
|
||||||
ECU_Unlocked = false;
|
ECU_Unlocked = false;
|
||||||
|
|
||||||
using (API api = APIFactory.GetAPI(GForm_Main.string_0))
|
API api = APIFactory.GetAPI(GForm_Main.string_0);
|
||||||
{
|
//using (API api = APIFactory.GetAPI(GForm_Main.string_0))
|
||||||
using (Device device = api.GetDevice(""))
|
//{
|
||||||
{
|
Device device = api.GetDevice("");
|
||||||
using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
|
Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false);
|
||||||
{
|
//using (Device device = api.GetDevice(""))
|
||||||
LoadJ2534Channel(channel);
|
//{
|
||||||
|
// using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
|
||||||
|
// {
|
||||||
|
channel = LoadJ2534Channel(channel);
|
||||||
/*MessageFilter messageFilter = new MessageFilter();
|
/*MessageFilter messageFilter = new MessageFilter();
|
||||||
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
|
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
|
||||||
messageFilter.Mask = new byte[]
|
messageFilter.Mask = new byte[]
|
||||||
|
@ -520,9 +526,9 @@ public class GForm_Main : DarkForm
|
||||||
{
|
{
|
||||||
this.method_1("Result NOT OK!!");
|
this.method_1("Result NOT OK!!");
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] SendJ2534Message(Channel channel, byte[] MessageBytes)
|
public byte[] SendJ2534Message(Channel channel, byte[] MessageBytes)
|
||||||
|
@ -592,15 +598,18 @@ public class GForm_Main : DarkForm
|
||||||
|
|
||||||
public void method_ReadROM(object sender, DoWorkEventArgs e)
|
public void method_ReadROM(object sender, DoWorkEventArgs e)
|
||||||
{
|
{
|
||||||
using (API api = APIFactory.GetAPI(GForm_Main.string_0))
|
API api = APIFactory.GetAPI(GForm_Main.string_0);
|
||||||
{
|
//using (API api = APIFactory.GetAPI(GForm_Main.string_0))
|
||||||
|
//{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Device device = api.GetDevice(""))
|
Device device = api.GetDevice("");
|
||||||
{
|
Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false);
|
||||||
using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
|
//using (Device device = api.GetDevice(""))
|
||||||
{
|
//{
|
||||||
LoadJ2534Channel(channel);
|
// using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
|
||||||
|
// {
|
||||||
|
channel = LoadJ2534Channel(channel);
|
||||||
/*MessageFilter messageFilter = new MessageFilter();
|
/*MessageFilter messageFilter = new MessageFilter();
|
||||||
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
|
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
|
||||||
messageFilter.Mask = new byte[]
|
messageFilter.Mask = new byte[]
|
||||||
|
@ -649,14 +658,14 @@ 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);
|
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);
|
device.SetProgrammingVoltage(Pin.PIN_12, -1);
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
DarkMessageBox.Show(this, ex.Message);
|
DarkMessageBox.Show(this, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1156,7 +1165,7 @@ public class GForm_Main : DarkForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadJ2534Channel(Channel channel)
|
private Channel LoadJ2534Channel(Channel channel)
|
||||||
{
|
{
|
||||||
MessageFilter messageFilter = new MessageFilter();
|
MessageFilter messageFilter = new MessageFilter();
|
||||||
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
|
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
|
||||||
|
@ -1189,53 +1198,58 @@ public class GForm_Main : DarkForm
|
||||||
new SConfig(Parameter.DATA_RATE, 500000)
|
new SConfig(Parameter.DATA_RATE, 500000)
|
||||||
};
|
};
|
||||||
channel.SetConfig(config);
|
channel.SetConfig(config);
|
||||||
|
|
||||||
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
//private unsafe void backgroundWorker_0_DoWork_1(object sender, DoWorkEventArgs e)
|
//private unsafe void backgroundWorker_0_DoWork_1(object sender, DoWorkEventArgs e)
|
||||||
private void backgroundWorker_0_DoWork_1(object sender, DoWorkEventArgs e)
|
private void backgroundWorker_0_DoWork_1(object sender, DoWorkEventArgs e)
|
||||||
{
|
{
|
||||||
using (API api = APIFactory.GetAPI(GForm_Main.string_0))
|
API api = APIFactory.GetAPI(GForm_Main.string_0);
|
||||||
|
//using (API api = APIFactory.GetAPI(GForm_Main.string_0))
|
||||||
|
//{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
Device device = api.GetDevice("");
|
||||||
{
|
Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false);
|
||||||
using (Device device = api.GetDevice(""))
|
//using (Device device = api.GetDevice(""))
|
||||||
{
|
//{
|
||||||
using (Channel channel = device.GetChannel(Protocol.ISO15765, Baud.CAN, ConnectFlag.CAN_29BIT_ID, false))
|
// 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[]
|
||||||
{
|
{
|
||||||
LoadJ2534Channel(channel);
|
byte.MaxValue,
|
||||||
/*MessageFilter messageFilter = new MessageFilter();
|
byte.MaxValue,
|
||||||
messageFilter.FilterType = Filter.FLOW_CONTROL_FILTER;
|
byte.MaxValue,
|
||||||
messageFilter.Mask = new byte[]
|
byte.MaxValue
|
||||||
{
|
};
|
||||||
byte.MaxValue,
|
messageFilter.Pattern = new byte[]
|
||||||
byte.MaxValue,
|
{
|
||||||
byte.MaxValue,
|
24, //0x18
|
||||||
byte.MaxValue
|
218, //0xDA
|
||||||
};
|
241, //0xF1
|
||||||
messageFilter.Pattern = new byte[]
|
GForm_Main.byte_3 //0x00
|
||||||
{
|
};
|
||||||
24, //0x18
|
messageFilter.FlowControl = new byte[]
|
||||||
218, //0xDA
|
{
|
||||||
241, //0xF1
|
24, //0x18
|
||||||
GForm_Main.byte_3 //0x00
|
218, //0xDA
|
||||||
};
|
GForm_Main.byte_3, //0x00 -> 0x10|0x11
|
||||||
messageFilter.FlowControl = new byte[]
|
241 //0xF1
|
||||||
{
|
};
|
||||||
24, //0x18
|
MessageFilter filter = messageFilter;
|
||||||
218, //0xDA
|
channel.StartMsgFilter(filter);
|
||||||
GForm_Main.byte_3, //0x00 -> 0x10|0x11
|
SConfig[] config = new SConfig[]
|
||||||
241 //0xF1
|
{
|
||||||
};
|
new SConfig(Parameter.LOOP_BACK, 1),
|
||||||
MessageFilter filter = messageFilter;
|
new SConfig(Parameter.DATA_RATE, 500000)
|
||||||
channel.StartMsgFilter(filter);
|
};
|
||||||
SConfig[] config = new SConfig[]
|
channel.SetConfig(config);*/
|
||||||
{
|
|
||||||
new SConfig(Parameter.LOOP_BACK, 1),
|
|
||||||
new SConfig(Parameter.DATA_RATE, 500000)
|
|
||||||
};
|
|
||||||
channel.SetConfig(config);*/
|
|
||||||
|
|
||||||
if (!ECU_Unlocked)
|
if (!ECU_Unlocked)
|
||||||
{
|
{
|
||||||
MessageBox.Show("ECU is NOT Unlocked!");
|
MessageBox.Show("ECU is NOT Unlocked!");
|
||||||
}
|
}
|
||||||
|
@ -1391,14 +1405,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);
|
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
|
device.SetProgrammingVoltage(Pin.PIN_12, -1); //Set 0V on Pin12
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
DarkMessageBox.Show(this, ex.Message);
|
DarkMessageBox.Show(this, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteROMtoECU(Channel channel_0, byte[] byte_5, BackgroundWorker backgroundWorker_X = null)
|
public void WriteROMtoECU(Channel channel_0, byte[] byte_5, BackgroundWorker backgroundWorker_X = null)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue