From ddb7e1c3ca0dc59575350b1d38b7307f8ae14397 Mon Sep 17 00:00:00 2001 From: derrod Date: Wed, 26 Oct 2022 15:16:25 +0200 Subject: [PATCH] [models] Add support for Manifest version 21 This adds an uninstall "action". As yet unused. Not sure if the order is correct, we'll have to see. (Legendary won't support it until Epic does anyway) --- legendary/models/manifest.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/legendary/models/manifest.py b/legendary/models/manifest.py index a9d8688..cddda85 100644 --- a/legendary/models/manifest.py +++ b/legendary/models/manifest.py @@ -221,6 +221,8 @@ class ManifestMeta: self.prereq_name = '' self.prereq_path = '' self.prereq_args = '' + self.uninstall_action_path = '' + self.uninstall_action_args = '' # this build id is used for something called "delta file" which I guess I'll have to implement eventually self._build_id = '' @@ -265,9 +267,13 @@ class ManifestMeta: _meta.prereq_path = read_fstring(bio) _meta.prereq_args = read_fstring(bio) - # apparently there's a newer version that actually stores *a* build id. - if _meta.data_version > 0: + # Manifest version 18 with data version >= 1 stores build ID + if _meta.data_version >= 1: _meta._build_id = read_fstring(bio) + # Manifest version 21 with data version >= 2 stores uninstall commands + if _meta.data_version >= 2: + _meta.uninstall_action_path = read_fstring(bio) + _meta.uninstall_action_args = read_fstring(bio) if (size_read := bio.tell()) != _meta.meta_size: logger.warning(f'Did not read entire manifest metadata! Version: {_meta.data_version}, ' @@ -569,7 +575,7 @@ class FML: logger.warning(f'Did not read {diff} bytes from chunk part!') bio.seek(diff) - # MD5 hash + MIME type + # MD5 hash + MIME type (Manifest feature level 19) if _fml.version >= 1: for fm in _fml.elements: _has_md5 = struct.unpack('= 2: for fm in _fml.elements: fm.hash_sha256 = bio.read(32)