def METHOD_NAME(rom_filename, w, h):
    rom = ROMWithTables(open(rom_filename, 'rb'))
    overworld.patchOverworldTilesets(rom)
    core.cleanup(rom)
    tilesets = loadTileInfo(rom)
    the_map = Map(w, h, tilesets)
    setup_room_types(the_map)
    MazeGen(the_map)
    imggen = ImageGen(tilesets, the_map, rom)
    imggen.enabled = False
    wfcmap = WFCMap(the_map, tilesets) #, step_callback=imggen.on_step)
    try:
        wfcmap.initialize()
    except ContradictionException as e:
        print(f"Failed on setup {e.x // 10} {e.y // 8} {e.x % 10} {e.y % 8}")
        imggen.on_step(wfcmap, err=(e.x, e.y))
        return
    imggen.on_step(wfcmap)
    for x, y in xyrange(w, h):
        for n in range(50):
            try:
                wfcmap.build(x * 10, y * 8, 10, 8)
                imggen.on_step(wfcmap)
                break
            except ContradictionException as e:
                print(f"Failed {x} {y} {e.x%10} {e.y%8} {n}")
                imggen.on_step(wfcmap, err=(e.x, e.y))
                wfcmap.clear()
            if n == 49:
                raise RuntimeError("Failed to fill chunk")
        print(f"Done {x} {y}")
    imggen.on_step(wfcmap)
    wfcmap.store_tile_data(the_map)
    LocationGenerator(the_map)
    for room in the_map:
        generate_enemies(room)
    if imggen.enabled:
        store_map(rom, the_map)
        from mapexport import MapExport
        MapExport(rom).export_all(w, h, dungeons=False)
        rom.save("test.gbc")
    return the_map