def test_can_load_map_pointers(self): extractor = map_extractor(rom_path) extractor.load_rom() extractor.load_map_pointers() extract_maps.load_rom() extract_maps.load_map_pointers() self.assertEqual(extract_maps.map_pointers, extractor.map_pointers)
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)
import extract_maps as ex # import extract_tileblocks ex.load_rom() ex.load_map_pointers() # header attributes ################### # connections # address # referenced_texts # object_data # bank # id # number_of_referenced_texts # texts_pointer # script_pointer # tileset # name # num_connections # object_data_pointer # y # x # connection_byte # map_pointer ################ # warp_tos # warps # things # number_of_warps
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()
import extract_maps as ex # import extract_tileblocks ex.load_rom() ex.load_map_pointers() # header attributes ################### # connections # address # referenced_texts # object_data # bank # id # number_of_referenced_texts # texts_pointer # script_pointer # tileset # name # num_connections # object_data_pointer # y # x # connection_byte # map_pointer ################ # warp_tos
if processed_incbins == {}: 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()