Ejemplo n.º 1
0
def rewrite_snes_meta(title, version, lorom=False):
    close_file(outfile)

    for o in get_all_objects():
        if o.random_degree != get_random_degree():
            random_degree = "??"
            break
    else:
        random_degree = int(round((get_random_degree()**0.5) * 100))
        if random_degree >= 100:
            random_degree = "!!"
        else:
            random_degree = "{0:0>2}".format(random_degree)
    rewrite_snes_title("%s %s %s" % (title, random_degree, get_seed()),
                       outfile, version, lorom=lorom)
    rewrite_snes_checksum(outfile, lorom=lorom)
Ejemplo n.º 2
0
def rewrite_title_screen():
    title_len_1, title_len_2 = 17, 20
    s1 = 'v{0} SN {1}'.format(VERSION, get_seed())

    if any(hasattr(o, 'custom_random_degree') for o in ALL_OBJECTS):
        random_degree = 'CUSTOM'
    else:
        random_degree = round(get_random_degree() ** 0.5, 2)
    s2 = '{0} {1}'.format(random_degree, get_flags())

    s1 = s1.strip()
    s2 = s2.strip()
    assert len(s1) <= title_len_1
    assert len(s2) <= title_len_2
    while len(s1) < title_len_1:
        s1 = ' {0} '.format(s1)
    s1 = s1[:title_len_1]
    while len(s2) < title_len_2:
        s2 = ' {0} '.format(s2)
    s2 = s2[:title_len_2]
    assert len(s1) == title_len_1
    assert len(s2) == title_len_2

    f = open(get_outfile(), 'r+b')
    f.seek(addresses.title_text_1)
    f.write(NameMixin.encode(s1))
    f.seek(addresses.title_text_2)
    f.write(NameMixin.encode(s2))
    f.close()