From a384108d6e61aac3edded64b87718dd3cd139eb6 Mon Sep 17 00:00:00 2001 From: ColdWindScholar <3590361911@qq.com> Date: Sat, 9 Dec 2023 21:04:31 +0800 Subject: [PATCH] Fix Some Bugs --- run.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/run.py b/run.py index 6a42087..e1994cd 100644 --- a/run.py +++ b/run.py @@ -1126,7 +1126,7 @@ def packChoo(project): elif types[f] == 'dtbo': makedtbo(parts[f], project) else: - inpacker(parts[f], project, form, imgtype) + inpacker(parts[f], project, form, imgtype, json_) elif filed == '66': packsuper(project) elif filed == '77': @@ -1157,7 +1157,7 @@ def packChoo(project): elif types[int(filed)] == 'dtbo': makedtbo(parts[int(filed)], project) else: - inpacker(parts[int(filed)], project, form, imgtype) + inpacker(parts[int(filed)], project, form, imgtype, json_) else: ywarn("Input error!") else: @@ -1339,7 +1339,10 @@ def makedtbo(sf, project): input("任意按钮继续") -def inpacker(name, project, form, ftype): +def inpacker(name, project, form, ftype, json_=None): + if json_ is None: + json_ = {} + def rdi(name_): try: dir_path = os.path.join(project, "TI_out") @@ -1393,7 +1396,10 @@ def rdi(name_): os.remove(project + os.sep + "TI_out" + os.sep + name + ".patch.dat") except: pass - utils.img2sdat(out_img, project + os.sep + "TI_out", 4, name) + if 'dat_ver' in json_.keys(): + utils.img2sdat(out_img, project + os.sep + "TI_out", int(json_['dat_ver']), name) + else: + utils.img2sdat(out_img, project + os.sep + "TI_out", 4, name) try: os.remove(out_img) except: