Remove option_identifier

It is no longer needed because we set the hash based on an actual
hash of the rom contents, so it is not based on the title field anymore.
This commit is contained in:
Kevin Cathcart 2019-07-11 18:48:21 -04:00
parent aab696fa9c
commit c4570b732d
2 changed files with 3 additions and 32 deletions

View File

@ -281,36 +281,6 @@ class World(object):
return False
def option_identifier(self, maxbytes, player):
id_value = 0
id_value_max = 1
def markbool(value):
nonlocal id_value, id_value_max
id_value += id_value_max * bool(value)
id_value_max *= 2
def marksequence(options, value):
nonlocal id_value, id_value_max
id_value += id_value_max * options.index(value)
id_value_max *= len(options)
markbool(self.logic == 'noglitches')
marksequence(['standard', 'open', 'swordless'], self.mode)
markbool(self.place_dungeon_items)
marksequence(['ganon', 'pedestal', 'dungeons', 'triforcehunt', 'crystals'], self.goal)
marksequence(['vanilla', 'simple', 'restricted', 'full', 'crossed', 'insanity', 'restricted_legacy', 'full_legacy', 'madness_legacy', 'insanity_legacy', 'dungeonsfull', 'dungeonssimple'], self.shuffle)
marksequence(['easy', 'normal', 'hard', 'expert', 'insane'], self.difficulty)
marksequence(['none', 'display', 'timed', 'timed-ohko', 'timed-countdown', 'ohko'], self.timer)
marksequence(['on', 'off', 'random'], self.progressive)
marksequence(['freshness', 'flood', 'vt21', 'vt22', 'vt25', 'vt26', 'balanced'], self.algorithm)
markbool(self.check_beatable_only)
markbool(self.shuffle_ganon)
markbool(self.keysanity)
markbool(self.retro)
marksequence(range(1, 256), self.players)
marksequence(range(1, self.players + 1), player)
assert id_value_max < (1 << (maxbytes * 8))
return id_value
class CollectionState(object):
def __init__(self, parent):

5
Rom.py
View File

@ -974,8 +974,9 @@ def patch_rom(world, player, rom):
# set rom name
# 21 bytes
rom.name = bytearray('ER062%09d' % world.seed, 'utf8') + world.option_identifier(7, player).to_bytes(7, 'big')
assert(len(rom.name) == 21)
from Main import __version__
rom.name = bytearray('ER_{0}_{1:09}\0'.format(__version__,world.seed), 'utf8')
assert len(rom.name) <= 21
rom.write_bytes(0x7FC0, rom.name)
# Write title screen Code