Пример #1
0
    def extract(self, dg, verbose=False):
        # Read first DWORD. If it's 0xFFFF0001 we'll get resource IDs in the file links and the next DWORD is the
        # number of file links. Otherwise the first DWORD is the number of file links.
        data = dg.get_dword()
        if data == 0xFFFF0001:
            self.version_mark = True
            if verbose:
                print("First DWORD is 0xFFFF0001, setting version mark flag")
            sectlen = data = dg.get_dword()
        else:
            self.version_mark = False
            if verbose:
                print(
                    "First DWORD is %s, clearing version mark flag as not 0xFFFF0001"
                    % format(data, '#010x'))
            sectlen = data

        # Now read in the specified number of file links
        self.filelinks = []
        if verbose:
            print("Reading %s FileLinks" % sectlen)
        for _ in range(sectlen):
            tmp = FileLink(dg, self.version_mark)
            self.filelinks.append(tmp)

        # RCOLIDs
        self.item_count = dg.get_dword()
        self.rcol_ids = []
        if verbose:
            print("Reading %s RCOL IDs" % self.item_count)
        for index in range(self.item_count):
            rcol_id = PackedFileType(dg.get_dword())
            if verbose:
                print("    %d => %s" % (index, str(rcol_id)))
            self.rcol_ids.append(rcol_id)
Пример #2
0
    def extract(self, dg, shallow=False, verbose=False):
        # First get the common RCOLDataBlock header
        super(GMNDData, self).extract(dg)

        # Some nodes
        self.objgraphnode = cObjectGraphNode(dg)
        self.sgres = cSGResource(dg)

        # Got name so terminate early if shallow
        if shallow:
            return

        # Forced relocation?
        if self.version == 11:
            tmp = dg.get_word()
            if tmp == 2:
                self.forced_relocation = True
            elif tmp == 512:
                self.forced_relocation = False
            else:
                raise ValueError("Unexpected forced relocation value %d" % tmp)

        # Assisted geometry
        if self.version == 11 or self.version == 12:
            tmp = dg.get_word()
            if tmp == 1:
                self.assisted_geometry = True
            elif tmp == 256:
                self.assisted_geometry = False
            else:
                raise ValueError("Unexpected assisted geometry value %d" % tmp)
            # Unknown
            tmp = dg.get_byte()
            if tmp != 1:
                raise ValueError("Expected unknown parameter value 1, got %d" %
                                 tmp)

        # Attached RCOLs
        count = dg.get_dword()
        self.attached_RCOLs = []
        for _ in range(count):
            rcol_type = PackedFileType(dg.get_dword())
            if rcol_type.is_rcol():
                rcol_type.RCOLConstructor()(dg, verbose)
            else:
                raise ValueError("%s is not an RCOL type" % str(rcol_type))
 def register(cls):
     PackedFileType.register(PackedFile.LGHTA, cls)
     PackedFileType.register(PackedFile.LGHTD, cls)
     PackedFileType.register(PackedFile.LGHTP, cls)
     PackedFileType.register(PackedFile.LGHTS, cls)
Пример #4
0
 def get_nodetype(data):
     return PackedFileType(data)
Пример #5
0
 def register(cls):
     PackedFileType.register(cls.typeEnum, cls)