Skip to content

Commit

Permalink
v1.0.7 - ROM Editor, Fixes, Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bouletmarc authored Apr 24, 2022
1 parent 458d53b commit 8f01d1b
Show file tree
Hide file tree
Showing 10 changed files with 6,252 additions and 15 deletions.
1,921 changes: 1,921 additions & 0 deletions ClassEditor.cs

Large diffs are not rendered by default.

10 changes: 1 addition & 9 deletions Class_RWD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ public static void LoadBIN(string f_name, string f_nameFW)
{
GForm_Main_0.method_1("Checksum is not 4bytes long!");
}
//Console.WriteLine(Get_rwd_checksum(dataEncrypted, 0, (uint)dataEncrypted.Length).ToString("X8"));

//Save Encrypted rwd firmware
string ThisPath = Path.GetDirectoryName(f_name) + @"\" + Path.GetFileNameWithoutExtension(f_name) + ".rwd";
Expand All @@ -153,10 +152,6 @@ public static void LoadBIN(string f_name, string f_nameFW)
CompressFile(ThisPath, ThisPath + ".gz");
}

/*'39990-TLA-A030': { #CR-V thanks to joe1
'checksum-offsets': [(0, 0x6bf80), (1, 0x6bffe)] #original bin checksums are 0x419b at offset 0x6FF80 and 0x24ef at 0x6FFFE, but since we start the bin from 0x4000 after bootloader, we offset the checksum accordingly
},*/

//######################################################################################################
//######################################################################################################
public static void LoadRWD(string f_name, bool FullDecrypt, bool Saving)
Expand Down Expand Up @@ -691,8 +686,7 @@ private static List<byte[]> decrypt(string search_value)
string search_exact = search_value.ToUpper();
string search_padded = search_value_padded.ToUpper();
GForm_Main_0.method_1("Searching:");
GForm_Main_0.method_1(search_exact);
GForm_Main_0.method_1(search_padded);
GForm_Main_0.method_1("'" + search_exact + "' and '" + search_padded + "'");

string[] operators = new string[8] {
"fn:^", //XOR
Expand Down Expand Up @@ -740,7 +734,6 @@ private static List<byte[]> decrypt(string search_value)
int CurrentDone = 0;
foreach (string Line in key_perms)
{
//Console.WriteLine(Line);
string k1 = "";
string k2 = "";
string k3 = "";
Expand Down Expand Up @@ -842,7 +835,6 @@ private static List<byte[]> decrypt(string search_value)

GForm_Main_0.ResetProgressBar();

GForm_Main_0.method_1(Environment.NewLine);
foreach (string cipher in display_ciphers) {
GForm_Main_0.method_1(String.Format("cipher: {0}", cipher));
}
Expand Down
3,520 changes: 3,520 additions & 0 deletions Editortable.cs

Large diffs are not rendered by default.

751 changes: 751 additions & 0 deletions Editortable.resx

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion FlashToolTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -61,6 +61,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ClassEditor.cs" />
<Compile Include="ClassDecryptString.cs" />
<Compile Include="ClassListView.cs">
<SubType>Component</SubType>
Expand Down Expand Up @@ -95,6 +96,9 @@
<SubType>Form</SubType>
</Compile>
<Compile Include="Class_Startup.cs" />
<Compile Include="Editortable.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LineG.cs">
<SubType>Form</SubType>
</Compile>
Expand All @@ -121,6 +125,9 @@
<EmbeddedResource Include="GForm_J2534Select.resx">
<DependentUpon>GForm_J2534Select.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Editortable.resx">
<DependentUpon>Editortable.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
Expand Down
10 changes: 9 additions & 1 deletion GForm_ConvertBIN.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -176,7 +177,14 @@ private void textBox_bin_DoubleClick(object sender, EventArgs e)
DialogResult result = this.openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
this.textBox_bin.Text = this.openFileDialog1.FileName;
if ((File.ReadAllBytes(this.openFileDialog1.FileName).Length - 1) == 0xF7FFF)
{
this.textBox_bin.Text = this.openFileDialog1.FileName;
}
else
{
DarkMessageBox.Show(this, "This file is not compatible!");
}
}
}

Expand Down
46 changes: 42 additions & 4 deletions GForm_Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ public class GForm_Main : DarkForm
byte Unlocking_Mode = 0x41;
bool WritingBinaryMode = true; //if false we are in writing firmware mode
private DarkButton darkButton_FlashFW;
GForm_Main GForm_Main_0;
private GForm_Main GForm_Main_0;
private DarkGroupBox DarkgroupBox1;
private DarkButton darkButton4;
private DarkButton darkButton5;
private DarkButton darkButton6;
private DarkButton darkButton3;
public Editortable Editortable_0;

public GForm_Main()
{
Expand All @@ -43,6 +45,8 @@ public GForm_Main()

GForm_Main_0 = this;

Editortable_0 = new Editortable(ref GForm_Main_0);

Class_RWD.Load(ref GForm_Main_0);
}

Expand Down Expand Up @@ -1184,7 +1188,8 @@ private void LoadJ2534Channel(Channel channel)
channel.SetConfig(config);
}

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)
{
using (API api = APIFactory.GetAPI(GForm_Main.string_0))
{
Expand Down Expand Up @@ -1582,6 +1587,7 @@ private void InitializeComponent()
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.DarkgroupBox1 = new DarkUI.Controls.DarkGroupBox();
this.darkButton4 = new DarkUI.Controls.DarkButton();
this.darkButton6 = new DarkUI.Controls.DarkButton();
this.darkGroupBox_0.SuspendLayout();
this.DarkgroupBox1.SuspendLayout();
this.SuspendLayout();
Expand Down Expand Up @@ -1897,6 +1903,7 @@ private void InitializeComponent()
// DarkgroupBox1
//
this.DarkgroupBox1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51)))));
this.DarkgroupBox1.Controls.Add(this.darkButton6);
this.DarkgroupBox1.Controls.Add(this.darkButton4);
this.DarkgroupBox1.Controls.Add(this.darkButton3);
this.DarkgroupBox1.Controls.Add(this.darkButton2);
Expand All @@ -1917,6 +1924,16 @@ private void InitializeComponent()
this.darkButton4.Text = "Fix Checksums";
this.darkButton4.Click += new System.EventHandler(this.darkButton4_Click);
//
// darkButton6
//
this.darkButton6.Checked = false;
this.darkButton6.Location = new System.Drawing.Point(6, 106);
this.darkButton6.Name = "darkButton6";
this.darkButton6.Size = new System.Drawing.Size(192, 23);
this.darkButton6.TabIndex = 69;
this.darkButton6.Text = "Open ROM Editor";
this.darkButton6.Click += new System.EventHandler(this.darkButton6_Click);
//
// GForm_Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
Expand Down Expand Up @@ -2299,7 +2316,7 @@ private void darkButton4_Click(object sender, EventArgs e)
if (openFileDialog1.FilterIndex == 1)
{
byte[] FilesBytes = File.ReadAllBytes(openFileDialog1.FileName);
if (FilesBytes.Length == 0xFFFFF)
if ((FilesBytes.Length - 1) == 0xFFFFF)
{
byte[] NewFilesBytes = VerifyChecksumFullBin(FilesBytes);
if (NewFilesBytes != FilesBytes)
Expand All @@ -2325,7 +2342,7 @@ private void darkButton4_Click(object sender, EventArgs e)
string ThisR = gform.FileRWD;
gform.Dispose();
byte[] FilesBytes = File.ReadAllBytes(ThisB);
if (FilesBytes.Length == 0xF7FFF)
if ((FilesBytes.Length - 1) == 0xF7FFF)
{
Class_RWD.LoadRWD(ThisR, true, false);
byte[] NewFilesBytes = VerifyChecksumFWBin(FilesBytes);
Expand Down Expand Up @@ -2357,4 +2374,25 @@ private void darkLabel_4_Click(object sender, EventArgs e)
GForm_Credits GForm_Credits_0 = new GForm_Credits();
GForm_Credits_0.ShowDialog();
}

private void darkButton6_Click(object sender, EventArgs e)
{
try
{
this.Editortable_0.Show();
}
catch (Exception ex)
{
try
{
this.Editortable_0 = null;
this.Editortable_0 = new Editortable(ref GForm_Main_0);
this.Editortable_0.Show();
}
catch
{

}
}
}
}
Binary file modified bin/Debug/FlashToolTest.exe
Binary file not shown.
Binary file modified bin/Debug/FlashToolTest.pdb
Binary file not shown.
Binary file modified bin/Debug/FlashToolTest.zip
Binary file not shown.

0 comments on commit 8f01d1b

Please sign in to comment.