From 2eac83f6d17a8e551722cd756c8bb1b5b4558eff Mon Sep 17 00:00:00 2001 From: derrod Date: Tue, 28 Apr 2020 15:55:19 +0200 Subject: [PATCH] [models] Add missing flags to FileManifests --- legendary/models/json_manifest.py | 4 +++- legendary/models/manifest.py | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/legendary/models/json_manifest.py b/legendary/models/json_manifest.py index 1cfd292..b86b3dd 100644 --- a/legendary/models/json_manifest.py +++ b/legendary/models/json_manifest.py @@ -136,7 +136,9 @@ class JSONFML(FML): _fm = FileManifest() _fm.filename = _fmj.pop('Filename', '') _fm.hash = blob_to_num(_fmj.pop('FileHash')).to_bytes(160//8, 'little') - _fm.flags = int(_fmj.pop('bIsUnixExecutable', False)) << 2 + _fm.flags |= int(_fmj.pop('bIsReadOnly', False)) + _fm.flags |= int(_fmj.pop('bIsCompressed', False)) << 1 + _fm.flags |= int(_fmj.pop('bIsUnixExecutable', False)) << 2 _fm.file_size = 0 _fm.chunk_parts = [] _fm.install_tags = _fmj.pop('InstallTags', list()) diff --git a/legendary/models/manifest.py b/legendary/models/manifest.py index 9892785..87c404f 100644 --- a/legendary/models/manifest.py +++ b/legendary/models/manifest.py @@ -397,6 +397,14 @@ class FileManifest: self.chunk_parts = [] self.file_size = 0 + @property + def read_only(self): + return self.flags & 0x1 + + @property + def compressed(self): + return self.flags & 0x2 + @property def executable(self): return self.flags & 0x4