Adjust Rom name and identifier (for main screen hash).

This commit is contained in:
LLCoolDave 2017-06-04 15:02:27 +02:00
parent a20eaae13f
commit c3482bbd67
4 changed files with 13 additions and 10 deletions

View File

@ -4,12 +4,13 @@ import logging
class World(object):
def __init__(self, shuffle, logic, mode, difficulty, goal, place_dungeon_items):
def __init__(self, shuffle, logic, mode, difficulty, goal, algorithm, place_dungeon_items):
self.shuffle = shuffle
self.logic = logic
self.mode = mode
self.difficulty = difficulty
self.goal = goal
self.algorithm = algorithm
self.regions = []
self.itempool = []
self.seed = None
@ -152,10 +153,12 @@ class World(object):
def option_identifier(self):
logic = 0 if self.logic == 'noglitches' else 1
mode = 0 if self.mode == 'open' else 1
goal = 0 if self.goal == 'ganon' else 1 if self.goal == 'pedestal' else 2
shuffle = ['vanilla', 'simple', 'restricted', 'full', 'madness', 'insanity', 'dungeonsfull', 'dungeonssimple'].index(self.shuffle)
dungeonitems = 0 if self.place_dungeon_items else 1
return logic | (mode << 1) | (goal << 2) | (shuffle << 4) | (dungeonitems << 8)
goal = ['ganon', 'pedestal', 'dungeons', 'starhunt', 'triforcehunt'].index(self.goal)
shuffle = ['vanilla', 'simple', 'restricted', 'full', 'madness', 'insanity', 'dungeonsfull', 'dungeonssimple'].index(self.shuffle)
difficulty = ['normal', 'timed', 'timed-ohko', 'timed-countdown'].index(self.difficulty)
algorithm = ['freshness', 'flood', 'vt21', 'vt22'].index(self.algorithm)
return logic | (mode << 1) | (dungeonitems << 2) | (goal << 3) | (shuffle << 6) | (difficulty << 10) | (algorithm << 12)
class CollectionState(object):

View File

@ -27,7 +27,7 @@ def main(args, seed=None):
start = time.clock()
# initialize the world
world = World(args.shuffle, args.logic, args.mode, args.difficulty, args.goal, not args.nodungeonitems)
world = World(args.shuffle, args.logic, args.mode, args.difficulty, args.goal, args.algorithm, not args.nodungeonitems)
logger = logging.getLogger('')
if seed is None:
@ -80,7 +80,7 @@ def main(args, seed=None):
else:
sprite = None
outfilebase = 'ER_%s_%s_%s_%s' % (world.mode, world.goal, world.shuffle, world.seed)
outfilebase = 'ER_%s_%s_%s_%s_%s_%s' % (world.mode, world.goal, world.shuffle, world.difficulty, world.algorithm, world.seed)
if not args.suppress_rom:
rom = bytearray(open(args.rom, 'rb').read())
@ -394,7 +394,7 @@ def generate_itempool(world):
def copy_world(world):
# ToDo: Not good yet
ret = World(world.shuffle, world.logic, world.mode, world.difficulty, world.goal, world.place_dungeon_items)
ret = World(world.shuffle, world.logic, world.mode, world.difficulty, world.goal, world.algorithm, world.place_dungeon_items)
ret.required_medallions = list(world.required_medallions)
ret.agahnim_fix_required = world.agahnim_fix_required
ret.swamp_patch_required = world.swamp_patch_required

View File

@ -27,7 +27,7 @@ def main(args, seed=None):
start = time.clock()
# initialize the world
world = World('vanilla', 'noglitches', 'standard', 'normal', 'ganon', False)
world = World('vanilla', 'noglitches', 'standard', 'normal', 'ganon', 'freshness', False)
logger = logging.getLogger('')
hasher = hashlib.md5()
@ -149,7 +149,7 @@ def fill_world(world, plando):
def copy_world(world):
# ToDo: Not good yet
ret = World(world.shuffle, world.logic, world.mode, world.difficulty, world.goal, world.place_dungeon_items)
ret = World(world.shuffle, world.logic, world.mode, world.difficulty, world.goal, world.algorithm, world.place_dungeon_items)
ret.required_medallions = list(world.required_medallions)
ret.agahnim_fix_required = world.agahnim_fix_required
ret.swamp_patch_required = world.swamp_patch_required

2
Rom.py
View File

@ -265,7 +265,7 @@ def patch_rom(world, rom, hashtable, quickswap=False, beep='normal', sprite=None
# set rom name
# 21 bytes
write_bytes(rom, 0x7FC0, bytearray('ER_020_%09d_%04d' % (world.seed, world.option_identifier), 'utf8'))
write_bytes(rom, 0x7FC0, bytearray('ER_030_%09d_' % world.seed, 'utf8') + world.option_identifier.to_bytes(4, 'big'))
# set heart beep rate
write_byte(rom, 0x180033, {'off': 0x00, 'half': 0x40, 'quarter': 0x80, 'normal': 0x20}[beep])