diff --git a/palworld_server_toolkit/editor.py b/palworld_server_toolkit/editor.py index 160efe4..0790bcd 100644 --- a/palworld_server_toolkit/editor.py +++ b/palworld_server_toolkit/editor.py @@ -327,6 +327,7 @@ def read( type_hints=type_hints, custom_properties=custom_properties, allow_nan=allow_nan, + reduce_memory=getattr(args, "reduce_memory", False) ) as reader: skip_loading_progress(reader, len(data)).start() gvas_file.header = GvasHeader.read(reader) @@ -391,7 +392,8 @@ def parse_skiped_item(properties, skip_path, progress=True, recursive=True, mp=N with FProgressArchiveReader( writer.bytes(), PALWORLD_TYPE_HINTS, - localProperties + localProperties, + reduce_memory=getattr(args, "reduce_memory", False) ) as reader: if progress: skip_loading_progress(reader, len(properties['value'])).start() diff --git a/palworld_server_toolkit/palobject.py b/palworld_server_toolkit/palobject.py index 5c229f2..d41043f 100644 --- a/palworld_server_toolkit/palobject.py +++ b/palworld_server_toolkit/palobject.py @@ -9,6 +9,7 @@ import pickle import msgpack import ctypes +import sys def toUUID(uuid_str): @@ -578,6 +579,10 @@ class FProgressArchiveReader(FArchiveReader): processlist = {} def __init__(self, *args, **kwargs): + reduce_memory = False + if 'reduce_memory' in kwargs: + reduce_memory = kwargs['reduce_memory'] + del kwargs['reduce_memory'] super().__init__(*args, **kwargs) self.fallbackData = None self.mp_loading = False @@ -587,9 +592,9 @@ def __init__(self, *args, **kwargs): if 'MemFree:' == line[0:8]: remain = line.split(": ")[1].strip().split(" ") if remain[1] == 'kB' and int(remain[0]) > 1048576 > 4: # Over 4 GB memory remains - self.mp_loading = False if getattr(args, "reduce_memory", False) else True + self.mp_loading = False if reduce_memory else True elif sys.platform == 'darwin' or sys.platform == 'win32': - self.mp_loading = False if getattr(args, "reduce_memory", False) else True + self.mp_loading = False if reduce_memory else True def progress(self): return self.data.tell()