def read_location_names(f):
    #load existing script & pointer table
    f.seek(0xEF100)
    location_name_bin = f.read(0x4ff)

    f.seek(0x268400)
    for idx in range(0x49):
        location_name_ptrs[idx] = read_multi(f, 2)

    for idx in range(0x49):
        start = location_name_ptrs[idx]
        end = location_name_ptrs.get(idx + 1,
                                     location_name_bin.find(b'\0', start) + 1)
        location_names[idx] = bytes_to_dialogue(location_name_bin[start:end])
def read_dialogue(fout):
    #load existing script & pointer table
    fout.seek(0xD0000)
    script_bin = fout.read(0x1F0FF)

    #TODO battle script

    fout.seek(0xCE600)
    bankidx = read_multi(fout, 2)
    for idx in range(0xC0C):  #C0D through CFF pointers are repurposed
        script_ptrs[idx] = read_multi(fout,
                                      2) + (0x10000 if idx >= bankidx else 0)

    for idx in range(0xC0C):  #C0D through CFF pointers are repurposed
        start = script_ptrs[idx]
        end = script_ptrs.get(idx + 1, 0)
        if end == 0:
            end = script_bin.find(b'\x00', start)
        script[idx] = bytes_to_dialogue(script_bin[start:end])