From c3482bbd675c1a2d700714f5c6897734ddcb67c6 Mon Sep 17 00:00:00 2001 From: LLCoolDave Date: Sun, 4 Jun 2017 15:02:27 +0200 Subject: [PATCH] Adjust Rom name and identifier (for main screen hash). --- BaseClasses.py | 11 +++++++---- Main.py | 6 +++--- Plando.py | 4 ++-- Rom.py | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index f417626a..f1aee3d3 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -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): diff --git a/Main.py b/Main.py index 52477a38..69ab8c4d 100644 --- a/Main.py +++ b/Main.py @@ -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 diff --git a/Plando.py b/Plando.py index ffc4905d..1d5d8087 100644 --- a/Plando.py +++ b/Plando.py @@ -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 diff --git a/Rom.py b/Rom.py index 8d3b1e41..4da79d28 100644 --- a/Rom.py +++ b/Rom.py @@ -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])