sdat2img.py: added marshmallow 6.0 support
Esse commit está contido em:
+14
-8
@@ -3,7 +3,7 @@
|
||||
#====================================================
|
||||
# FILE: sdat2img.py
|
||||
# AUTHORS: xpirt - luxi78 - howellzhu
|
||||
# DATE: 2015-07-08 17:54:09 CST
|
||||
# DATE: 2015-10-11 14:25:44 CST
|
||||
#====================================================
|
||||
|
||||
import sys, os
|
||||
@@ -18,7 +18,7 @@ except IndexError:
|
||||
try:
|
||||
input = raw_input
|
||||
except NameError: pass
|
||||
input ("Press any key to exit...\n")
|
||||
input ("Press ENTER to exit...\n")
|
||||
sys.exit()
|
||||
|
||||
BLOCK_SIZE = 4096
|
||||
@@ -37,7 +37,11 @@ def parse_transfer_list_file(path):
|
||||
version = int(trans_list.readline()) # 1st line = transfer list version
|
||||
new_blocks = int(trans_list.readline()) # 2nd line = total number of blocks
|
||||
|
||||
# version 2 introduced with android-5.1.0_r1
|
||||
# system.transfer.list:
|
||||
# - version 1: android-5.0.0_r1
|
||||
# - version 2: android-5.1.0_r1
|
||||
# - version 3: android-6.0.0_r1
|
||||
|
||||
# skip next 2 lines. we don't need this stuff now
|
||||
if version >= 2:
|
||||
trans_list.readline() # 3rd line = stash entries needed simultaneously
|
||||
@@ -46,10 +50,12 @@ def parse_transfer_list_file(path):
|
||||
for line in trans_list:
|
||||
line = line.split(' ') # 5th & next lines should be only commands
|
||||
cmd = line[0]
|
||||
if 'erase' == cmd:
|
||||
erase_block_set = rangeset(line[1])
|
||||
elif 'new' == cmd:
|
||||
if 'new' == cmd:
|
||||
new_block_set = rangeset(line[1])
|
||||
elif 'zero' == cmd:
|
||||
zero_block_set = rangeset(line[1])
|
||||
elif 'erase' == cmd:
|
||||
erase_block_set = rangeset(line[1])
|
||||
else:
|
||||
# skip lines starting with numbers, they're not commands anyway.
|
||||
if not cmd[0].isdigit():
|
||||
@@ -58,7 +64,7 @@ def parse_transfer_list_file(path):
|
||||
sys.exit(1)
|
||||
|
||||
trans_list.close()
|
||||
return version, new_blocks, erase_block_set, new_block_set
|
||||
return version, new_blocks, new_block_set, zero_block_set, erase_block_set
|
||||
|
||||
def init_output_file_size(output_file_obj, erase_block_set):
|
||||
max_block_num = max(pair[1] for pair in erase_block_set)
|
||||
@@ -67,7 +73,7 @@ def init_output_file_size(output_file_obj, erase_block_set):
|
||||
output_file_obj.flush()
|
||||
|
||||
def main(argv):
|
||||
version, new_blocks, erase_block_set, new_block_set = parse_transfer_list_file(TRANSFER_LIST_FILE)
|
||||
version, new_blocks, new_block_set, zero_block_set, erase_block_set = parse_transfer_list_file(TRANSFER_LIST_FILE)
|
||||
output_img = open(OUTPUT_IMAGE_FILE, 'wb')
|
||||
init_output_file_size(output_img, erase_block_set)
|
||||
new_data_file = open(NEW_DATA_FILE, 'rb')
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário