diff --git a/PrerootedCreator/ExtraFiles.cs b/PrerootedCreator/ExtraFiles.cs index 4fb9e4f..ec2be06 100644 --- a/PrerootedCreator/ExtraFiles.cs +++ b/PrerootedCreator/ExtraFiles.cs @@ -27,6 +27,27 @@ public static void AddExtraFiles(BackgroundWorker worker, string name, string ft } } + public static void AddExtraFlashable(BackgroundWorker worker, string filename, string ftffile) + { + Logger.WriteLog("Adding flashable zip: " + Path.GetFileName(filename)); + string fixedname = Path.GetFileName(filename).Replace(' ', '_'); + + string cmd = "\n# " + fixedname + "\n" + + "if\n" + + "\tpackage_extract_file(\"" + fixedname + "\", \"/tmp/" + fixedname + "\") == \"t\"\n" + + "then\n" + + "\trun_program(\"/tmp/busybox\", \"mkdir\", \"/tmp/" + Path.GetFileNameWithoutExtension(fixedname) + "_extracted" + "\");\n" + + "\trun_program(\"/tmp/busybox\", \"unzip\", \"-d\", \"/tmp/" + Path.GetFileNameWithoutExtension(fixedname) + "_extracted" + "\", \"/tmp/" + fixedname + "\");\n" + + "\tset_perm(0, 0, 0755, \"/tmp/" + Path.GetFileNameWithoutExtension(fixedname) + "_extracted" + "/META-INF/com/google/android/update-binary\");\n" + + "\trun_program(\"/tmp/" + Path.GetFileNameWithoutExtension(fixedname) + "_extracted" + "/META-INF/com/google/android/update-binary\", file_getprop(\"/tmp/prfargs\", \"version\"), file_getprop(\"/tmp/prfargs\", \"outfile\"), \"/tmp/" + fixedname + "\");\n" + + "\tdelete_recursive(\"/tmp/" + Path.GetFileNameWithoutExtension(fixedname) + "_extracted" + "\");\n" + + "\tdelete(\"/tmp/" + fixedname + "\");\n" + + "endif;\n" + + "#InsertExtra\n"; + Utility.EditScript(worker, "#InsertExtra", cmd); + Zipping.AddToZip(worker, "flashable.zip", filename, fixedname, false); + } + private static void AddKernel(BackgroundWorker worker, string ftffile) { ExtractAndAdd(worker, "kernel", ".elf", ftffile, "boot"); @@ -76,7 +97,6 @@ private static void ExtractAndAdd(BackgroundWorker worker, string name, string e Zipping.UnzipFile(worker, ftffile, name + ".sin", string.Empty, System.IO.Path.GetTempPath(), false); if (File.Exists(System.IO.Path.GetTempPath() + "\\" + name + ".sin")) { - //Logger.WriteLog("Adding " + name + " to zip"); Logger.WriteLog(" " + name); SinExtract.ExtractSin(worker, System.IO.Path.GetTempPath() + "\\" + name + ".sin", System.IO.Path.GetTempPath() + "\\" + name + extension, false); diff --git a/PrerootedCreator/Form1.Designer.cs b/PrerootedCreator/Form1.Designer.cs index 57a780b..36a7568 100644 --- a/PrerootedCreator/Form1.Designer.cs +++ b/PrerootedCreator/Form1.Designer.cs @@ -49,11 +49,17 @@ private void InitializeComponent() this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.add_extra_button = new System.Windows.Forms.Button(); + this.remove_extra_button = new System.Windows.Forms.Button(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.extra_listbox = new System.Windows.Forms.ListBox(); + this.extra_lbl = new System.Windows.Forms.Label(); this.include_checklist = new PRFCreator.CustomCheckedListBox(); this.options_checklist = new PRFCreator.CustomCheckedListBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); + this.groupBox4.SuspendLayout(); this.SuspendLayout(); // // ftf_label @@ -117,7 +123,7 @@ private void InitializeComponent() // // create_button // - this.create_button.Location = new System.Drawing.Point(518, 294); + this.create_button.Location = new System.Drawing.Point(518, 394); this.create_button.Name = "create_button"; this.create_button.Size = new System.Drawing.Size(79, 23); this.create_button.TabIndex = 8; @@ -129,7 +135,7 @@ private void InitializeComponent() // this.status_textbox.BackColor = System.Drawing.SystemColors.ControlLightLight; this.status_textbox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.status_textbox.Location = new System.Drawing.Point(15, 162); + this.status_textbox.Location = new System.Drawing.Point(15, 262); this.status_textbox.Name = "status_textbox"; this.status_textbox.ReadOnly = true; this.status_textbox.Size = new System.Drawing.Size(582, 129); @@ -138,7 +144,7 @@ private void InitializeComponent() // // progressBar // - this.progressBar.Location = new System.Drawing.Point(15, 297); + this.progressBar.Location = new System.Drawing.Point(15, 397); this.progressBar.Name = "progressBar"; this.progressBar.Size = new System.Drawing.Size(435, 16); this.progressBar.TabIndex = 10; @@ -151,6 +157,7 @@ private void InitializeComponent() this.version_label.Name = "version_label"; this.version_label.Size = new System.Drawing.Size(0, 12); this.version_label.TabIndex = 11; + this.version_label.Click += new System.EventHandler(this.versionlbl_Click); // // rec_textbox // @@ -184,7 +191,7 @@ private void InitializeComponent() // this.job_label.AutoSize = true; this.job_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.job_label.Location = new System.Drawing.Point(457, 297); + this.job_label.Location = new System.Drawing.Point(457, 397); this.job_label.Name = "job_label"; this.job_label.Size = new System.Drawing.Size(30, 15); this.job_label.TabIndex = 15; @@ -194,7 +201,7 @@ private void InitializeComponent() // this.jobnum_label.AutoSize = true; this.jobnum_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.jobnum_label.Location = new System.Drawing.Point(485, 297); + this.jobnum_label.Location = new System.Drawing.Point(485, 397); this.jobnum_label.Name = "jobnum_label"; this.jobnum_label.Size = new System.Drawing.Size(0, 15); this.jobnum_label.TabIndex = 16; @@ -246,6 +253,56 @@ private void InitializeComponent() this.groupBox3.TabIndex = 23; this.groupBox3.TabStop = false; // + // add_extra_button + // + this.add_extra_button.Location = new System.Drawing.Point(495, 30); + this.add_extra_button.Name = "add_extra_button"; + this.add_extra_button.Size = new System.Drawing.Size(75, 23); + this.add_extra_button.TabIndex = 25; + this.add_extra_button.Text = "Add"; + this.add_extra_button.UseVisualStyleBackColor = true; + this.add_extra_button.Click += new System.EventHandler(this.add_extra_button_Click); + // + // remove_extra_button + // + this.remove_extra_button.Location = new System.Drawing.Point(495, 63); + this.remove_extra_button.Name = "remove_extra_button"; + this.remove_extra_button.Size = new System.Drawing.Size(75, 23); + this.remove_extra_button.TabIndex = 26; + this.remove_extra_button.Text = "Remove"; + this.remove_extra_button.UseVisualStyleBackColor = true; + this.remove_extra_button.Click += new System.EventHandler(this.remove_extra_button_Click); + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.extra_listbox); + this.groupBox4.Controls.Add(this.extra_lbl); + this.groupBox4.Controls.Add(this.remove_extra_button); + this.groupBox4.Controls.Add(this.add_extra_button); + this.groupBox4.Location = new System.Drawing.Point(15, 157); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(582, 94); + this.groupBox4.TabIndex = 27; + this.groupBox4.TabStop = false; + // + // extra_listbox + // + this.extra_listbox.FormattingEnabled = true; + this.extra_listbox.Location = new System.Drawing.Point(6, 30); + this.extra_listbox.Name = "extra_listbox"; + this.extra_listbox.Size = new System.Drawing.Size(474, 56); + this.extra_listbox.TabIndex = 28; + // + // extra_lbl + // + this.extra_lbl.AutoSize = true; + this.extra_lbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.75F); + this.extra_lbl.Location = new System.Drawing.Point(6, 10); + this.extra_lbl.Name = "extra_lbl"; + this.extra_lbl.Size = new System.Drawing.Size(55, 15); + this.extra_lbl.TabIndex = 15; + this.extra_lbl.Text = "Extra Zip"; + // // include_checklist // this.include_checklist.AccessibleDescription = ""; @@ -283,7 +340,8 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(611, 326); + this.ClientSize = new System.Drawing.Size(611, 426); + this.Controls.Add(this.groupBox4); this.Controls.Add(this.version_label); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox3); @@ -295,7 +353,6 @@ private void InitializeComponent() this.Controls.Add(this.job_label); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(627, 365); this.MinimumSize = new System.Drawing.Size(627, 365); this.Name = "Form1"; this.Text = "PRFCreator"; @@ -305,6 +362,8 @@ private void InitializeComponent() this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox3.ResumeLayout(false); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -334,6 +393,11 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox groupBox2; public CustomCheckedListBox options_checklist; private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Button add_extra_button; + private System.Windows.Forms.Button remove_extra_button; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.Label extra_lbl; + public System.Windows.Forms.ListBox extra_listbox; } } diff --git a/PrerootedCreator/Form1.cs b/PrerootedCreator/Form1.cs index 7ced3be..075a458 100644 --- a/PrerootedCreator/Form1.cs +++ b/PrerootedCreator/Form1.cs @@ -18,7 +18,7 @@ public Form1() private void Form1_Load(object sender, EventArgs e) { - version_label.Text = "v0.7"; + version_label.Text = "v0.8"; openFileDialog1.FileName = string.Empty; openFileDialog1.Multiselect = false; @@ -53,6 +53,12 @@ private void su_button_Click(object sender, EventArgs e) openFileDialog1.FileName = string.Empty; } + private void versionlbl_Click(object sender, EventArgs e) + { + MessageBox.Show("PRFCreator " + version_label.Text + "\n\nCreated by zxz0O0\nThanks to Androxyde, [NUT], E:V:A and dotnetzip developers\n" + + "See xda-developers.com for more informations", "PRFCreator"); + } + private void create_button_Click(object sender, EventArgs e) { if (isWorking) @@ -116,6 +122,14 @@ public void ControlsEnabled(bool Enabled) options_checklist.Invoke(new MethodInvoker(delegate { options_checklist.Enabled = Enabled; })); else options_checklist.Enabled = Enabled; + if (add_extra_button.InvokeRequired) + add_extra_button.Invoke(new MethodInvoker(delegate { add_extra_button.Enabled = Enabled; })); + else + add_extra_button.Enabled = Enabled; + if (remove_extra_button.InvokeRequired) + remove_extra_button.Invoke(new MethodInvoker(delegate { remove_extra_button.Enabled = Enabled; })); + else + remove_extra_button.Enabled = Enabled; } private void dr_button_Click(object sender, EventArgs e) @@ -131,5 +145,29 @@ private void dr_button_Click(object sender, EventArgs e) rec_textbox.Text = openFileDialog1.FileName; openFileDialog1.FileName = string.Empty; } + + private void add_extra_button_Click(object sender, EventArgs e) + { + if (isWorking) + return; + + openFileDialog1.Filter = "Zip Files|*.zip|All files|*"; + DialogResult result = openFileDialog1.ShowDialog(); + if (result != DialogResult.OK) + return; + + if (!extra_listbox.Items.Contains(openFileDialog1.FileName)) + extra_listbox.Items.Add(openFileDialog1.FileName); + + openFileDialog1.FileName = string.Empty; + } + + private void remove_extra_button_Click(object sender, EventArgs e) + { + if (isWorking) + return; + + extra_listbox.Items.Remove(extra_listbox.SelectedItem); + } } } diff --git a/PrerootedCreator/Job.cs b/PrerootedCreator/Job.cs index 6b496ab..4e1c773 100644 --- a/PrerootedCreator/Job.cs +++ b/PrerootedCreator/Job.cs @@ -29,11 +29,13 @@ private static int GetJobCount() count--; if (!File.Exists(form.rec_textbox.Text)) //if recovery is not included count--; + if (form.extra_listbox.Items.Count < 1) //no additional zip files + count--; return count; } - private static Action[] jobs = { UnpackSystem, UnpackSystemEXT4, EditScript, AddSystem, AddExtras, AddSuperSU, AddRecovery, SignZip, Complete }; + private static Action[] jobs = { UnpackSystem, UnpackSystemEXT4, EditScript, AddSystem, AddExtras, AddSuperSU, AddRecovery, AddExtraFlashable, SignZip, Complete }; public static void Worker() { JobNum = 0; @@ -130,6 +132,16 @@ private static void AddExtras(BackgroundWorker worker) ExtraFiles.AddExtraFiles(worker, item.ToLower(), form.ftf_textbox.Text); } + private static void AddExtraFlashable(BackgroundWorker worker) + { + if (form.extra_listbox.Items.Count < 1) + return; + + SetJobNum(++JobNum); + foreach (string file in form.extra_listbox.Items) + ExtraFiles.AddExtraFlashable(worker, file, form.ftf_textbox.Text); + } + private static void AddSuperSU(BackgroundWorker worker) { SetJobNum(++JobNum); diff --git a/PrerootedCreator/Resources/flashable.zip b/PrerootedCreator/Resources/flashable.zip index bb751af..aa05f3b 100644 Binary files a/PrerootedCreator/Resources/flashable.zip and b/PrerootedCreator/Resources/flashable.zip differ diff --git a/flashable.zip-files/META-INF/com/google/android/updater-script-names b/flashable.zip-files/META-INF/com/google/android/updater-script-names index 5e383c3..8ee032d 100644 --- a/flashable.zip-files/META-INF/com/google/android/updater-script-names +++ b/flashable.zip-files/META-INF/com/google/android/updater-script-names @@ -142,3 +142,6 @@ then delete_recursive("/tmp/dualrecovery_extracted"); delete("/tmp/dualrecovery.zip"); endif; + +# ===================== Extra Flashable ===================== +#InsertExtra diff --git a/flashable.zip-files/META-INF/com/google/android/updater-script-uuid b/flashable.zip-files/META-INF/com/google/android/updater-script-uuid index c0786a5..cf97500 100644 --- a/flashable.zip-files/META-INF/com/google/android/updater-script-uuid +++ b/flashable.zip-files/META-INF/com/google/android/updater-script-uuid @@ -141,3 +141,6 @@ then delete_recursive("/tmp/dualrecovery_extracted"); delete("/tmp/dualrecovery.zip"); endif; + +# ===================== Extra Flashable ===================== +#InsertExtra