diff --git a/tools/pbpack.py b/tools/pbpack.py index 7bee6f413..32f78ac70 100755 --- a/tools/pbpack.py +++ b/tools/pbpack.py @@ -249,7 +249,7 @@ def dump(self): for i, entry in enumerate(self.table_entries, start=1): print(' %u: Offset %u Length %u CRC 0x%x' % (i, entry.offset, entry.length, entry.crc)) - def __init__(self, is_system): + def __init__(self, is_system=True): self.table_size = 512 if is_system else 256 self.content_start = self.MANIFEST_SIZE_BYTES + self.table_size * self.TABLE_ENTRY_SIZE_BYTES diff --git a/tools/unpack.py b/tools/unpack.py index c666e5fc6..4724732f4 100644 --- a/tools/unpack.py +++ b/tools/unpack.py @@ -21,11 +21,15 @@ def main(): parser = argparse.ArgumentParser(description= 'Unpack pbpacked data to recover original file content.') + parser.add_argument('pbpack', type=str, help='app_resources.pbpack file to unpack') + parser.add_argument('--app', default=False, action='store_true', + help='Indicate this pbpack is an app pbpack') + args = parser.parse_args() if os.path.exists(args.pbpack): - resource_pack = ResourcePack().deserialize(open(args.pbpack,'rb')) + resource_pack = ResourcePack().deserialize(open(args.pbpack,'rb'), is_system=not args.app) for idx, resource_data in enumerate(resource_pack.contents): with open(str(idx) + '.dat','wb') as outfile: outfile.write(resource_data)