コード例 #1
0
ファイル: find_pointers.py プロジェクト: 46OkuMen/dante98
                all_locations = [
                    int(pointer_location, 16),
                ]

                #print(pointer_locations)

                if (GF, text_location) in pointer_locations.keys():
                    all_locations = pointer_locations[(GF, text_location)]
                    all_locations.append(int(pointer_location, 16))

                pointer_locations[(GF, text_location)] = all_locations
                print(pointer_locations[(GF, text_location)])

    # Setup the worksheet for this file
    worksheet = PtrXl.add_worksheet(GF.filename)

    row = 1

    for (gamefile, text_location), pointer_locations in sorted(
        (pointer_locations).items()):
        obj = BorlandPointer(gamefile, pointer_locations, text_location)
        #print(text_location)
        #print(pointer_locations)
        for pointer_loc in pointer_locations:
            worksheet.write(row, 0, hex(text_location))
            worksheet.write(row, 1, hex(pointer_loc))
            try:
                worksheet.write(row, 2, obj.text())
            except:
                worksheet.write(row, 2, u'')
コード例 #2
0
            worksheet_name = GF.filename
        else:
            GF = Gamefile(os.path.join('original_cd', f), disk=OriginalCdAp)
            file_blocks = CdRom.file_blocks[f]
            pointer_constant = CdRom.pointer_constant[f]
            pointer_tables = CdRom.pointer_tables[f]
            pointer_disambiguation = CdRom.pointer_disambiguation
            worksheet_name = 'CD ' + GF.filename

        found_text_locations = []
        print(f)

        previous_pointer_locations = []

        try:
            worksheet = PtrXl.add_worksheet(worksheet_name)
        except AttributeError:
            print("You have the worksheet open. Close it and try again")
            worksheet = PtrXl.add_worksheet(worksheet_name)
        row = 1

        for table in pointer_tables:
            print(hex(table[0]), hex(table[1]))
            stride = table[2]
            table_bytes = GF.filestring[table[0]:table[1]]
            pointer_location = table[0]
            #print(table_bytes)
            while table_bytes:
                possible_value = int.from_bytes(table_bytes[0:2],
                                                byteorder='little')
                if possible_value in garbage_pointer_values: