Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-14 17:27:30 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-14 17:27:30 +0300
commit218cf8f81301db41d32c044128553adaf6fa8ef0 (patch)
tree221cbf99315d6ac9de8f91fc3423801f4a11fff1
parent9c2ef235f166989d96903d196dfe30fe47461f52 (diff)
NAND-C partition write feature
-rw-r--r--MainForm.Designer.cs9
-rw-r--r--MainForm.cs31
-rw-r--r--MainForm.resx14
-rw-r--r--Properties/Resources.resx6
-rw-r--r--WorkerForm.cs49
5 files changed, 91 insertions, 18 deletions
diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs
index 0fadb102..3851908a 100644
--- a/MainForm.Designer.cs
+++ b/MainForm.Designer.cs
@@ -164,6 +164,7 @@
this.listViewGames = new System.Windows.Forms.ListView();
this.gameName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.dumpNANDCPartitionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.flashNANDCPartitionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
this.groupBoxOptions.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxArt)).BeginInit();
@@ -264,6 +265,7 @@
this.toolFlashTheWholeNANDStripMenuItem,
this.dumpNANDBToolStripMenuItem,
this.dumpNANDCPartitionToolStripMenuItem,
+ this.flashNANDCPartitionToolStripMenuItem,
this.toolStripMenuItem9,
this.uninstallToolStripMenuItem});
this.kernelToolStripMenuItem.Name = "kernelToolStripMenuItem";
@@ -1123,6 +1125,12 @@
resources.ApplyResources(this.dumpNANDCPartitionToolStripMenuItem, "dumpNANDCPartitionToolStripMenuItem");
this.dumpNANDCPartitionToolStripMenuItem.Click += new System.EventHandler(this.dumpNANDCPartitionToolStripMenuItem_Click);
//
+ // flashNANDCPartitionToolStripMenuItem
+ //
+ this.flashNANDCPartitionToolStripMenuItem.Name = "flashNANDCPartitionToolStripMenuItem";
+ resources.ApplyResources(this.flashNANDCPartitionToolStripMenuItem, "flashNANDCPartitionToolStripMenuItem");
+ this.flashNANDCPartitionToolStripMenuItem.Click += new System.EventHandler(this.flashNANDCPartitionToolStripMenuItem_Click);
+ //
// MainForm
//
this.AllowDrop = true;
@@ -1297,6 +1305,7 @@
private System.Windows.Forms.ToolStripMenuItem downloadBoxArtForSelectedGamesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem donateToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem dumpNANDCPartitionToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem flashNANDCPartitionToolStripMenuItem;
}
}
diff --git a/MainForm.cs b/MainForm.cs
index 48afef65..f86f069d 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -940,6 +940,20 @@ namespace com.clusterrr.hakchi_gui
return workerForm.DialogResult == DialogResult.OK;
}
+ bool DoNandCFlash()
+ {
+ openDumpFileDialog.FileName = "nandc.hsqs";
+ openDumpFileDialog.DefaultExt = "hsqs";
+ if (openDumpFileDialog.ShowDialog() != DialogResult.OK)
+ return false;
+ var workerForm = new WorkerForm(this);
+ workerForm.Text = Resources.FlashingNand;
+ workerForm.Task = WorkerForm.Tasks.FlashNandC;
+ workerForm.NandDump = openDumpFileDialog.FileName;
+ workerForm.Start();
+ return workerForm.DialogResult == DialogResult.OK;
+ }
+
bool FlashCustomKernel()
{
var workerForm = new WorkerForm(this);
@@ -1133,13 +1147,26 @@ namespace com.clusterrr.hakchi_gui
private void dumpNANDBToolStripMenuItem_Click(object sender, EventArgs e)
{
if (RequirePatchedKernel() == DialogResult.No) return;
- if (DoNandBDump()) MessageBox.Show(Resources.NandDumped, Resources.Done, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ if (DoNandBDump())
+ MessageBox.Show(Resources.NandDumped, Resources.Done, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void dumpNANDCPartitionToolStripMenuItem_Click(object sender, EventArgs e)
{
if (RequirePatchedKernel() == DialogResult.No) return;
- if (DoNandCDump()) MessageBox.Show(Resources.NandDumped, Resources.Done, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ if (DoNandCFlash())
+ MessageBox.Show(Resources.NandDumped, Resources.Done, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+
+ private void flashNANDCPartitionToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (MessageBox.Show(Resources.FlashNandCQ, Resources.AreYouSure, MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ == DialogResult.Yes)
+ {
+ if (RequirePatchedKernel() == DialogResult.No) return;
+ if (DoNandCFlash())
+ MessageBox.Show("NAND-C flashed", Resources.Done, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
}
private void flashCustomKernelToolStripMenuItem_Click(object sender, EventArgs e)
diff --git a/MainForm.resx b/MainForm.resx
index e3f8a96f..29d7cb05 100644
--- a/MainForm.resx
+++ b/MainForm.resx
@@ -186,11 +186,17 @@
<value>Dump decrypted NAND-B partition</value>
</data>
<data name="dumpNANDCPartitionToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
- <value>270, 22</value>
+ <value>276, 22</value>
</data>
<data name="dumpNANDCPartitionToolStripMenuItem.Text" xml:space="preserve">
<value>Dump NAND-C partition</value>
</data>
+ <data name="flashNANDCPartitionToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
+ <value>276, 22</value>
+ </data>
+ <data name="flashNANDCPartitionToolStripMenuItem.Text" xml:space="preserve">
+ <value>Flash NAND-C partition (experts only!)</value>
+ </data>
<data name="toolStripMenuItem9.Size" type="System.Drawing.Size, System.Drawing">
<value>267, 6</value>
</data>
@@ -3606,6 +3612,12 @@
<data name="&gt;&gt;dumpNANDCPartitionToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
+ <data name="&gt;&gt;flashNANDCPartitionToolStripMenuItem.Name" xml:space="preserve">
+ <value>flashNANDCPartitionToolStripMenuItem</value>
+ </data>
+ <data name="&gt;&gt;flashNANDCPartitionToolStripMenuItem.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>MainForm</value>
</data>
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
index 224bbd89..b6138c6a 100644
--- a/Properties/Resources.resx
+++ b/Properties/Resources.resx
@@ -700,6 +700,12 @@
<data name="br" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\flags\br.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="FlashingNand" xml:space="preserve">
+ <value>Flashing NAND memory...</value>
+ </data>
+ <data name="FlashNandCQ" xml:space="preserve">
+ <value>Do you want to flash NAND-C partition image? It will replace all user data.</value>
+ </data>
<data name="hu" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\flags\hu.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
diff --git a/WorkerForm.cs b/WorkerForm.cs
index 06311acf..ef8038cc 100644
--- a/WorkerForm.cs
+++ b/WorkerForm.cs
@@ -19,7 +19,7 @@ namespace com.clusterrr.hakchi_gui
{
public partial class WorkerForm : Form
{
- public enum Tasks { DumpKernel, FlashKernel, DumpNand, FlashNand, DumpNandB, DumpNandC, Memboot, UploadGames, DownloadCovers, AddGames, CompressGames, DecompressGames, DeleteGames };
+ public enum Tasks { DumpKernel, FlashKernel, DumpNand, FlashNand, DumpNandB, DumpNandC, FlashNandC, Memboot, UploadGames, DownloadCovers, AddGames, CompressGames, DecompressGames, DeleteGames };
public Tasks Task;
//public string UBootDump;
public static string KernelDumpPath
@@ -288,6 +288,7 @@ namespace com.clusterrr.hakchi_gui
break;
case Tasks.DumpNandB:
case Tasks.DumpNandC:
+ case Tasks.FlashNandC:
DoPartitionDump(Task);
break;
case Tasks.UploadGames:
@@ -718,30 +719,48 @@ namespace com.clusterrr.hakchi_gui
partitionSize = int.Parse(clovershell.ExecuteSimple("df /dev/mapper/root-crypt | tail -n 1 | awk '{ print $2 }'"));
break;
case Tasks.DumpNandC:
+ case Tasks.FlashNandC:
partitionSize = int.Parse(clovershell.ExecuteSimple("df /dev/nandc | tail -n 1 | awk '{ print $2 }'"));
break;
}
maxProgress = 5 + (int)Math.Ceiling(partitionSize / 1024.0 * 1.05);
SetProgress(progress, maxProgress);
- SetStatus(Resources.DumpingNand);
- using (var file = new TrackableFileStream(NandDump, FileMode.Create))
+ if (task != Tasks.FlashNandC)
{
- file.OnProgress += delegate (long Position, long Length)
+ SetStatus(Resources.DumpingNand);
+ using (var file = new TrackableFileStream(NandDump, FileMode.Create))
{
- progress = (int)(5 + Position / 1024 / 1024);
- SetProgress(progress, maxProgress);
- };
- switch (task)
+ file.OnProgress += delegate (long Position, long Length)
+ {
+ progress = (int)(5 + Position / 1024 / 1024);
+ SetProgress(progress, maxProgress);
+ };
+ switch (task)
+ {
+ case Tasks.DumpNandB:
+ clovershell.Execute("dd if=/dev/mapper/root-crypt", null, file);
+ break;
+ case Tasks.DumpNandC:
+ clovershell.Execute("dd if=/dev/nandc", null, file);
+ break;
+ }
+ file.Close();
+ }
+ }
+ else
+ {
+ SetStatus(Resources.FlashingNand);
+ using (var file = new TrackableFileStream(NandDump, FileMode.Open))
{
- case Tasks.DumpNandB:
- clovershell.Execute("dd if=/dev/mapper/root-crypt", null, file);
- break;
- case Tasks.DumpNandC:
- clovershell.Execute("dd if=/dev/nandc", null, file);
- break;
+ file.OnProgress += delegate (long Position, long Length)
+ {
+ progress = (int)(5 + Position / 1024 / 1024);
+ SetProgress(progress, maxProgress);
+ };
+ clovershell.Execute("dd of=/dev/nandc", file);
+ file.Close();
}
- file.Close();
}
SetStatus(Resources.Done);