Exemple #1
0
 def from_packed(cls, packed: bytes):
     state_bytes, message_bytes, target_instance_ID = cls._struct.unpack(
         packed)
     return cls(
         unpack_ascii(state_bytes),
         unpack_ascii(message_bytes),
         target_instance_ID,
     )
Exemple #2
0
 def from_packed(cls, packed: bytes):
     asset_type_bytes, asset_ID, name_length = cls._struct.unpack(
         packed[:12])
     return cls(
         unpack_ascii(asset_type_bytes),
         asset_ID,
         name_length,
         unpack_ascii(packed[12:12 + name_length]),
     )
Exemple #3
0
    def from_packed(cls, packed: bytes):
        magic, root_node_instance_ID, unknown, object_count = cls._struct.unpack(packed[:13])

        offset = 13
        objects = []
        for i in range(object_count):
            object_type = unpack_ascii(packed[offset:offset+4])
            object_ = cls._script_object_classes[object_type].from_packed(packed[offset:])

            objects.append(object_)
            offset += object_.packed_size

        return cls(unpack_ascii(magic), root_node_instance_ID, unknown, object_count, tuple(objects))
    def from_packed(cls, packed: bytes):
        magic, unknown_1, unknown_2, object_count = cls._struct.unpack(
            packed[:13])
        scannable_object_info = ScannableObjectInfo.from_packed(packed[13:])

        return cls(
            unpack_ascii(magic),
            unknown_1,
            unknown_2,
            object_count,
            scannable_object_info,
            DGRP.from_packed(packed[13 + scannable_object_info.packed_size:]),
        )
Exemple #5
0
    def from_packed(cls, packed: bytes, subproperty_struct_classes: dict = {}):
        instance_type_bytes, instance_size, instance_ID, connection_count = cls._struct.unpack(
            packed[:12])
        instance_type = unpack_ascii(instance_type_bytes)

        offset = 12
        connections = []
        for i in range(connection_count):
            connections.append(
                Connection.from_packed(packed[offset:offset + 12]))
            offset += 12

        return cls(
            instance_type,
            instance_size,
            instance_ID,
            connection_count,
            tuple(connections),
            PropertyStruct.from_packed(packed[offset:],
                                       subproperty_struct_classes),
        )
 def from_packed(cls, packed: bytes):
     asset_type_bytes, asset_ID = cls._struct.unpack(packed)
     return cls(unpack_ascii(asset_type_bytes), asset_ID)
Exemple #7
0
 def from_packed(cls, packed: bytes):
     language_ID_bytes, strings_offset, strings_size = cls._struct.unpack(
         packed)
     return cls(unpack_ascii(language_ID_bytes), strings_offset,
                strings_size)
Exemple #8
0
 def from_packed(cls, packed: bytes):
     compressed_int, asset_type_bytes, asset_ID, size, offset = cls._struct.unpack(
         packed)
     return cls(bool(compressed_int), unpack_ascii(asset_type_bytes),
                asset_ID, size, offset)