Exemple #1
0
def load_all_maps(w):
    rom, rom_data = w.rom_contents, w.rom_data
    banks = mapped.get_banks(rom, rom_data)
    for bank_n in range(len(banks)):
        maps = mapped.get_map_headers(rom, bank_n, banks)
        for map_n in range(len(maps)):
            print(bank_n, map_n)
            w.load_map(bank_n, map_n)
Exemple #2
0
PROFILE = False

print("imported things")

app = QtWidgets.QApplication(sys.argv)
print("created stupid app")
window = mapped_gui.Window(no_argv=True)
print("created stupid window")
window.load_rom(sys.argv[1])
print("loaded stupid rom")
print(window.game.name)
bank_n = int(sys.argv[2])
map_n = int(sys.argv[3])
rom_contents = window.game.rom_contents
rom_data = window.game.rom_data
banks = mapped.get_banks(rom_contents, rom_data)
map_header_ptr = mapped.get_map_headers(rom_contents, bank_n, banks)[map_n]
map = mapped.parse_map_header(rom_contents, map_header_ptr)
h = mapped.parse_map_data(rom_contents, map['map_data_ptr'])
t1_header = mapped.parse_tileset_header(
        rom_contents,
        h['global_tileset_ptr'],
        #int(sys.argv[2], 16),
        window.game.name
        )
t2_header = mapped.parse_tileset_header(
        rom_contents,
        #int(sys.argv[3], 16),
        h['local_tileset_ptr'],
        window.game.name
        )
                else:
                    block_img.paste(part_img, (x, y, x+8, y+8))

            if (beh_mem & 0x20) and layer == 1:
                layer_imgs.append(base_block_img.copy())
            else:
                layer_imgs.append(block_img)
        block_imgs.append(layer_imgs)
    return block_imgs

with open(ROMPATH, "rb") as rom_file:
    rom_contents = rom_file.read()

rom_code = get_rom_code(rom_contents)
rom_offsets, game_id = get_rom_data(rom_code)
banks = get_banks(rom_contents, rom_offsets)

tilesets = set()
offsets = {}

# Loop over all maps and add their tileset offsets
for bank_n in range(len(banks)):
    map_headers = get_map_headers(rom_contents, bank_n, banks)
    
    for map_n, map_header_address in enumerate(map_headers):
        # Last map, I haven't found a better way to handle this
        if bank_n >= 42 and map_n > 0:
            break

        map_header = parse_map_header(rom_contents, map_header_address)
        map_data_header = mapped.parse_map_data(
Exemple #4
0
PROFILE = False

print("imported things")

app = QtWidgets.QApplication(sys.argv)
print("created stupid app")
window = mapped_gui.Window(no_argv=True)
print("created stupid window")
window.load_rom(sys.argv[1])
print("loaded stupid rom")
print(window.game.name)
bank_n = int(sys.argv[2])
map_n = int(sys.argv[3])
rom_contents = window.game.rom_contents
rom_data = window.game.rom_data
banks = mapped.get_banks(rom_contents, rom_data)
map_header_ptr = mapped.get_map_headers(rom_contents, bank_n, banks)[map_n]
map = mapped.parse_map_header(rom_contents, map_header_ptr)
h = mapped.parse_map_data(rom_contents, map['map_data_ptr'])
t1_header = mapped.parse_tileset_header(
    rom_contents,
    h['global_tileset_ptr'],
    #int(sys.argv[2], 16),
    window.game.name)
t2_header = mapped.parse_tileset_header(
    rom_contents,
    #int(sys.argv[3], 16),
    h['local_tileset_ptr'],
    window.game.name)
print("parsed stupid headers")
print("running real test now")