Example #1
0
def main():
    parser = argparse.ArgumentParser(
        description='Read map data from Pokemon RGB.')
    parser.add_argument('rom_path', help='The game ROM to be read')
    args = parser.parse_args()

    rom_path = os.path.abspath(args.rom_path)
    print("Using rom path", rom_path)
    print("Loading rom...", extract_maps.load_rom(rom_path))
    extract_maps.load_map_pointers()
    map_headers = extract_maps.read_all_map_headers()

    rom = extract_maps.rom
    map_ids = extract_maps.maps
    maps = get_maps(rom, map_headers)

    squares = defaultdict(dict)

    for map_id, map_dict in maps.items():
        map_dict['name'] = map_ids[map_id].lower().replace(' ', '-')

        grass_blocks, water_blocks = read_map_blocks(map_dict['blocks'])
        map_dict['grass_blocks'] = grass_blocks
        map_dict['water_blocks'] = water_blocks
        grass_squares, water_squares = get_squares(map_dict)

        squares[map_id]['grass'] = grass_squares
        squares[map_id]['water'] = water_squares

        if grass_squares or water_squares:
            write_csv(map_dict['name'], squares[map_id])

    for map_id, map_dict in maps.items():
        print(map_dict['name'])

    return {}
                shift = result / map2_width
                shift += 1
                calculated = map2_blocks_pointer + (map2_width * shift)
                output += "shift: " + str(shift) + "\n"
                formula = map2_cname + "Blocks" + " + (" + map2_cname + "Width * " + str(shift) + ")"
        
        output += "formula: " + formula + "\n"

        result = connected_pointer - calculated
        output += "result: " + str(result) + "\n"

        output += "\n\n"
    
    if in_connection_id != None:
        return formula
    if do_output == True:
        return output

if __name__ == "__main__":
    extract_maps.load_rom()
    extract_maps.load_map_pointers()
    extract_maps.read_all_map_headers()
    
    #trouble:
    #print_connections(13)
    #print_connections(15)
    
    for map_id in extract_maps.map_headers.keys():
        if map_id not in extract_maps.bad_maps:
            print print_connections(map_id, do_output=True)
Example #3
0
    # print blockdata
    blocks2d = create_array(width, height)
    block_x = 0
    print ' tileset_id = {0}'.format(tileset_id)

    for blocknum in xrange(len(blockdata)):
        line = ""

        block_x = blocknum % width
        block_y = blocknum / width

        index = block_y * width + block_x

        block = blockdata[index]
        blocks2d[block_y][block_x] = block

        # lines.append(line)
    # print myblocks
    print_map(blocks2d)


## MAIN ##

headers = ex.read_all_map_headers()

map_properties = ["name", "tileset", "map_pointer", "x", "y"]

do_tileblocks()

draw_map(58)
        temp = pointer_byte1
        pointer_byte1 = pointer_byte2
        pointer_byte2 = temp
        del temp

        #combine these into a single pointer
        partial_pointer = (pointer_byte2 + (pointer_byte1 << 8))

        #get the full pointer
        first_text_pointer = extract_maps.calculate_pointer(
            partial_pointer, bank)

        #if (first_text_pointer <= (text_list_pointer+range)):
        print "map " + map["name"] + " (" + str(map["id"]) + ")"
        print spacing + "text_pointer (list) = " + hex(text_list_pointer)
        print spacing + "first_text_pointer (first text) = " + hex(
            first_text_pointer)
        print spacing + "difference = " + str(first_text_pointer -
                                              text_list_pointer)
        #return False

    return True


if __name__ == "__main__":
    extract_maps.load_rom()
    extract_maps.load_map_pointers()
    extract_maps.read_all_map_headers()

    print test_first_text_pointer_bytes()
		
		block_x = blocknum % width 
		block_y = blocknum / width
		
		index = block_y * width + block_x
			
		block = blockdata[index]
		blocks2d[block_y][block_x] = block
		
		# lines.append(line)
	# print myblocks
	print_map(blocks2d)

## MAIN ## 

headers = ex.read_all_map_headers()

map_properties = [
"name",
"tileset",
"map_pointer",
"x",
"y"
]

do_tileblocks();

draw_map(58)


        isolate_incbins()
        process_incbins()
    
    results = []
    ordered_keys = sorted(processed_incbins, key=lambda entry: processed_incbins[entry]["interval"])
    ordered_keys.reverse()
    for key in ordered_keys:
        results.append(processed_incbins[key])

    return results

if __name__ == "__main__":
    #load map headers
    load_rom()
    load_map_pointers()
    read_all_map_headers()
    
    #load incbins (mandatory)
    load_asm()
    #isolate_incbins()
    #process_incbins()
    #print processed_incbins
    
    #line_number = find_incbin_to_replace_for(0x492c3)
    #newlines = split_incbin_line_into_three(line_number, 0x492c3, 12)
    #diff = generate_diff_insert(line_number, newlines)
    #print diff

    #insert_map_header_asm(86)
    #dump_all_remaining_maps()
    results = []
    ordered_keys = sorted(
        processed_incbins,
        key=lambda entry: processed_incbins[entry]["interval"])
    ordered_keys.reverse()
    for key in ordered_keys:
        results.append(processed_incbins[key])

    return results


if __name__ == "__main__":
    #load map headers
    load_rom()
    load_map_pointers()
    read_all_map_headers()

    #load incbins (mandatory)
    load_asm()
    #isolate_incbins()
    #process_incbins()
    #print processed_incbins

    #line_number = find_incbin_to_replace_for(0x492c3)
    #newlines = split_incbin_line_into_three(line_number, 0x492c3, 12)
    #diff = generate_diff_insert(line_number, newlines)
    #print diff

    #insert_map_header_asm(86)
    #dump_all_remaining_maps()