diff --git a/BaseClasses.py b/BaseClasses.py index c237d1b5..91cc69d0 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -135,6 +135,15 @@ class World(object): return False + @property + 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 = ['default', '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) + class CollectionState(object): diff --git a/Main.py b/Main.py index 4cb3a900..0b140644 100644 --- a/Main.py +++ b/Main.py @@ -13,14 +13,15 @@ import os __version__ = '0.2-dev' -logic_hash = [182, 244, 92, 144, 149, 200, 93, 183, 124, 169, 226, 46, 111, 163, 5, 193, 13, 112, 125, 101, 128, 84, 31, 67, 107, 94, 184, 100, 189, 18, 8, 171, - 142, 57, 173, 38, 37, 211, 253, 131, 98, 239, 167, 116, 32, 186, 70, 148, 66, 151, 143, 86, 59, 83, 16, 51, 240, 152, 60, 242, 190, 117, 76, 122, - 15, 221, 62, 39, 174, 177, 223, 34, 150, 50, 178, 238, 95, 219, 10, 162, 222, 0, 165, 202, 74, 36, 206, 209, 251, 105, 175, 135, 121, 88, 214, 247, - 154, 161, 71, 19, 85, 157, 40, 96, 225, 27, 230, 49, 231, 207, 64, 35, 249, 134, 132, 108, 63, 24, 4, 127, 255, 14, 145, 23, 81, 216, 113, 90, 194, - 110, 65, 229, 43, 1, 11, 168, 147, 103, 156, 77, 80, 220, 28, 227, 213, 198, 172, 79, 75, 140, 44, 146, 188, 17, 6, 102, 56, 235, 166, 89, 218, 246, - 99, 78, 187, 126, 119, 196, 69, 137, 181, 55, 20, 215, 199, 130, 9, 45, 58, 185, 91, 33, 197, 72, 115, 195, 114, 29, 30, 233, 141, 129, 155, 159, 47, - 224, 236, 21, 234, 191, 136, 104, 87, 106, 26, 73, 250, 248, 228, 48, 53, 243, 237, 241, 61, 180, 12, 208, 245, 232, 192, 2, 7, 170, 123, 176, 160, 201, - 153, 217, 252, 158, 25, 205, 22, 133, 254, 138, 203, 118, 210, 204, 82, 97, 52, 164, 68, 139, 120, 109, 54, 3, 41, 179, 212, 42] +logic_hash = [102, 208, 240, 103, 170, 178, 182, 42, 44, 146, 141, 72, 177, 138, 38, 113, 10, 107, 213, 157, 68, 87, 181, 252, 125, 85, 1, 225, + 43, 186, 159, 196, 149, 71, 165, 203, 105, 109, 58, 12, 80, 216, 222, 153, 241, 189, 247, 21, 35, 76, 248, 90, 36, 86, 163, 77, + 115, 131, 9, 169, 4, 50, 75, 98, 54, 13, 99, 221, 158, 129, 229, 133, 40, 174, 234, 227, 96, 193, 207, 101, 172, 110, 194, 233, + 120, 148, 243, 25, 190, 173, 6, 180, 119, 37, 61, 95, 118, 51, 79, 136, 15, 152, 147, 217, 5, 242, 11, 17, 83, 231, 18, 117, 228, + 63, 34, 156, 33, 128, 62, 237, 88, 249, 224, 219, 167, 122, 46, 65, 26, 235, 106, 55, 130, 226, 114, 211, 39, 137, 206, 59, 176, + 3, 30, 89, 201, 245, 116, 127, 41, 154, 23, 8, 100, 150, 188, 183, 195, 0, 14, 134, 53, 78, 70, 69, 160, 126, 139, 214, 192, 205, + 82, 60, 49, 244, 168, 121, 191, 104, 124, 92, 73, 251, 91, 22, 175, 236, 47, 204, 198, 19, 123, 166, 27, 52, 7, 24, 253, 215, 84, + 239, 254, 97, 45, 48, 202, 132, 143, 199, 212, 112, 250, 20, 171, 223, 64, 218, 161, 111, 144, 145, 230, 140, 31, 81, 2, 238, 246, + 155, 142, 185, 28, 164, 210, 16, 255, 232, 74, 200, 108, 135, 220, 57, 209, 184, 179, 187, 197, 162, 93, 67, 66, 151, 94, 32, 56, 29] def main(args, seed=None): @@ -34,7 +35,7 @@ def main(args, seed=None): random.seed(None) world.seed = random.randint(0, 999999999) else: - world.seed = seed + world.seed = int(seed) random.seed(world.seed) world.spoiler += 'ALttP Entrance Randomizer Version %s - Seed: %s\n\n' % (__version__, world.seed) @@ -76,7 +77,7 @@ def main(args, seed=None): sprite = None rom = bytearray(open(args.rom, 'rb').read()) - patched_rom = patch_rom(world, rom, logic_hash, args.quickswap, args.heartbeep, sprite) + patched_rom = patch_rom(world, rom, bytearray(logic_hash), args.quickswap, args.heartbeep, sprite) outfilebase = 'ER_%s_%s_%s_%s' % (world.mode, world.goal, world.shuffle, world.seed) diff --git a/Rom.py b/Rom.py index 3afe1e89..1b79d867 100644 --- a/Rom.py +++ b/Rom.py @@ -231,7 +231,8 @@ def patch_rom(world, rom, hashtable, quickswap=False, beep='normal', sprite=None write_strings(rom, world) # set rom name - write_bytes(rom, 0x7FC0, [0x45, 0x6E, 0x74, 0x72, 0x61, 0x6E, 0x63, 0x65, 0x52, 0x61, 0x6E, 0x64, 0x6F, 0x6D, 0x69, 0x7A, 0x65, 0x72, 0x00, 0x00, 0x00]) + # 21 bytes + write_bytes(rom, 0x7FC0, bytearray('ER_020_%09d_%04d' % (world.seed, world.option_identifier), 'utf8')) # set heart beep rate write_byte(rom, 0x180033, {'off': 0x00, 'half': 0x40, 'quarter': 0x80, 'normal': 0x20}[beep])