From 944fcaa7d642fabd78c8e5b7eb807c8d55fb0d63 Mon Sep 17 00:00:00 2001 From: CrepHidery Date: Sun, 31 May 2026 22:19:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20load=5Fpartition=5Fforce=E7=9A=84?= =?UTF-8?q?=E7=99=BD=E5=90=8D=E5=8D=95=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.cpp | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/common.cpp b/common.cpp index ab257a0..19b546d 100644 --- a/common.cpp +++ b/common.cpp @@ -1436,6 +1436,36 @@ void load_partition_force(spdio_t *io, const int id, const char *fn, unsigned st uint8_t *buf = io->temp_buf; double rtime = get_time(); char name[] = "w_force"; + const char* part_name = CMethod ? (*(io->Cptable + id)).name : (*(io->ptable + id)).name; + if (strstr(part_name, "calinv") || strstr(part_name, "factorynv")) + { + DEG_LOG(W, "Partition %s is skipped for force write due to potential risks.", part_name); + return; + } //skip calinv and factorynv + if (g_app_state.flash.selected_ab > 0) + { + size_t namelen = strlen(part_name); + bool has_ab = (namelen > 2 && (strcmp(part_name + namelen - 2, "_a") == 0 || strcmp(part_name + namelen - 2, "_b") == 0)); + if (!has_ab) + { + load_partition(io, part_name, fn, step, CMethod); + return; + } + } + else + { + const char* force_writelist[] = { "system", "super", "userdata" }; + int force_writelist_count = sizeof(force_writelist) / sizeof(force_writelist[0]); + for (int i = 0; i < force_writelist_count; i++) { + if (strcmp(part_name, force_writelist[i]) == 0) { + load_partition(io, part_name, fn, step, CMethod); + return; + } + } + //skip non-force-writable partitions + DEG_LOG(W, "Partition %s is skipped for force write as it's not in the force write list.", part_name); + return; + } if(!CMethod){ for (i = 0; i < io->part_count; i++) { memset(buf, 0, 36 * 2); @@ -1468,7 +1498,7 @@ void load_partition_force(spdio_t *io, const int id, const char *fn, unsigned st double etime = get_time(); double time_spent = etime - rtime; - DEG_LOG(I, "Force write %s successfully", (*(io->ptable + id)).name); + DEG_LOG(I, "Force write %s successfully", part_name); DEG_LOG(I, "Cost time %.6f seconds", time_spent); } } @@ -1504,7 +1534,7 @@ void load_partition_force(spdio_t *io, const int id, const char *fn, unsigned st double etime = get_time(); double time_spent = etime - rtime; - DEG_LOG(I, "Force write %s successfully", (*(io->Cptable + id)).name); + DEG_LOG(I, "Force write %s successfully", part_name); DEG_LOG(I, "Cost time %.6f seconds", time_spent); } } From 48a7ebe07cf2d484f214418fad03927d525cc435 Mon Sep 17 00:00:00 2001 From: CrepHidery Date: Sun, 31 May 2026 22:34:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20.gitignore=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 ++++ fdl_info.json | 1 - sfd_tool_config.json | 20 -------------------- 3 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 fdl_info.json delete mode 100644 sfd_tool_config.json diff --git a/.gitignore b/.gitignore index dddf16e..de69c65 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,7 @@ dist/ *.pot version.h + +# Ignore generated json files +fdl_info.json +sfd_tool_config.json \ No newline at end of file diff --git a/fdl_info.json b/fdl_info.json deleted file mode 100644 index a4a6832..0000000 --- a/fdl_info.json +++ /dev/null @@ -1 +0,0 @@ -{"fdl1_addr":0,"fdl1_path":"","fdl2_addr":0,"fdl2_path":""} diff --git a/sfd_tool_config.json b/sfd_tool_config.json deleted file mode 100644 index 95a28d4..0000000 --- a/sfd_tool_config.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "config_path": "sfd_tool_config.json", - "connection": { - "default_async_receive": true, - "default_cve_binary_path": "", - "default_cve_load_address": "", - "default_sprd4_mode": false, - "default_sprd4_one_step": false, - "default_use_cve": false, - "default_wait_seconds": 300.0 - }, - "default_backup_before_flash": false, - "default_verify_after_flash": true, - "last_fdl1_path": "", - "last_fdl2_path": "", - "last_pac_path": "", - "last_partition_export_dir": "", - "log_level": 0, - "ui_language": "zh_CN" -} \ No newline at end of file From cd7cd840c2b1c5ffd01b97c72a12c6148a2a8b4b Mon Sep 17 00:00:00 2001 From: CrepHidery Date: Sun, 31 May 2026 22:37:26 +0800 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20.gitignore=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index de69c65..665c855 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,7 @@ version.h # Ignore generated json files fdl_info.json -sfd_tool_config.json \ No newline at end of file +sfd_tool_config.json + +# Ignore generated .mo files +*.mo \ No newline at end of file