Update to latest Rom and add writing support for timed modes and treasure hunt.

This commit is contained in:
LLCoolDave 2017-06-04 13:10:22 +02:00
parent b87eb3891d
commit fd158e332f
5 changed files with 52 additions and 2 deletions

View File

@ -28,6 +28,11 @@ class World(object):
self.sewer_light_cone = mode == 'standard'
self.light_world_light_cone = False
self.dark_world_light_cone = False
self.treasure_hunt_count = 0
self.treasure_hunt_icon = 'Power Star'
self.clock_mode = 'off'
self.aga_randomness = 'off'
self.lock_aga_door_in_escape = False
def get_region(self, regionname):
if isinstance(regionname, Region):

View File

@ -61,6 +61,8 @@ item_table = {'Bow': (True, False, False, 0x0B, 'You have\nchosen the\narcher cl
'Red Pendant': (True, False, True, [0x02, 0x34, 0x60, 0x00, 0x69, 0x02], None, None, None, None, None, None),
'Blue Pendant': (True, False, True, [0x01, 0x32, 0x60, 0x00, 0x69, 0x03], None, None, None, None, None, None),
'Triforce': (True, False, False, 0x6A, '\n YOU WIN!', None, None, None, None, None),
'Power Star': (True, False, False, 0x6B, 'a small victory', None, None, None, None, None),
'Triforce Piece': (True, False, False, 0x6C, 'a small victory', None, None, None, None, None),
'Crystal 1': (True, False, True, [0x02, 0x34, 0x64, 0x40, 0x7F, 0x06], None, None, None, None, None, None),
'Crystal 2': (True, False, True, [0x10, 0x34, 0x64, 0x40, 0x79, 0x06], None, None, None, None, None, None),
'Crystal 3': (True, False, True, [0x40, 0x34, 0x64, 0x40, 0x6C, 0x06], None, None, None, None, None, None),
@ -96,6 +98,12 @@ item_table = {'Bow': (True, False, False, 0x0B, 'You have\nchosen the\narcher cl
'Rupees (50)': (False, False, False, 0x41, 'Just couch\ncash. Move\nright along.', None, None, None, None, None),
'Rupees (100)': (False, False, False, 0x40, 'A rupee stash!\nHell yeah!', None, None, None, None, None),
'Rupees (300)': (False, False, False, 0x46, 'A rupee hoard!\nHell yeah!', None, None, None, None, None),
'Rupoor': (False, False, False, 0x59, 'a debt collector', None, None, None, None, None),
'Red Clock': (False, False, False, 0x5B, 'a waste of time', None, None, None, None, None),
'Blue Clock': (False, False, False, 0x5C, 'a bit of time', None, None, None, None, None),
'Green Clock': (False, False, False, 0x5D, 'a lot of time', None, None, None, None, None),
'Single RNG': (False, False, False, 0x62, 'something you don\'t yet have', None, None, None, None, None),
'Multi RNG': (False, False, False, 0x63, 'something you may already have', None, None, None, None, None),
'Magic Upgrade (1/2)': (True, False, False, 0x4E, 'Your magic\npower has been\ndoubled!', None, None, None, None, None), # can be required to beat mothula in an open seed in very very rare circumstance
'Magic Upgrade (1/4)': (True, False, False, 0x4F, 'Your magic\npower has been\nquadrupled!', None, None, None, None, None), # can be required to beat mothula in an open seed in very very rare circumstance
# ToDo Use dungeons specific items once they work correctly

View File

@ -381,6 +381,11 @@ def copy_world(world):
ret.required_medallions = list(world.required_medallions)
ret.agahnim_fix_required = world.agahnim_fix_required
ret.swamp_patch_required = world.swamp_patch_required
ret.treasure_hunt_count = world.treasure_hunt_count
ret.treasure_hunt_icon = world.treasure_hunt_icon
ret.sewer_light_cone = world.sewer_light_cone
ret.light_world_light_cone = world.light_world_light_cone
ret.dark_world_light_cone = world.dark_world_light_cone
create_regions(ret)
# connect copied world

34
Rom.py
View File

@ -8,7 +8,7 @@ import hashlib
import logging
JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = 'ab6634609335a28e99bd915c7b1f3906'
RANDOMIZERBASEHASH = 'fd9d7a9ff91c4f09544203d3bb6fb7fe'
def patch_rom(world, rom, hashtable, quickswap=False, beep='normal', sprite=None):
@ -175,9 +175,41 @@ def patch_rom(world, rom, hashtable, quickswap=False, beep='normal', sprite=None
write_byte(rom, 0x34914, 0x3A) # Bow and Arrow
write_byte(rom, 0x180028, 0x49) # Fighter Sword
# set up clocks for timed modes
if world.clock_mode == 'off':
write_bytes(rom, 0x180190, [0x00, 0x00, 0x00]) # turn off clock mode
write_bytes(rom, 0x180200, [0x00, 0x00, 0x00, 0x00]) # red clock adjustment time (in frames, uint32)
write_bytes(rom, 0x180204, [0x00, 0x00, 0x00, 0x00]) # blue clock adjustment time (in frames, uint32)
write_bytes(rom, 0x180208, [0x00, 0x00, 0x00, 0x00]) # green clock adjustment time (in frames, uint32)
write_bytes(rom, 0x18020C, [0x00, 0x00, 0x00, 0x00]) # starting time (in frames, uint32)
elif world.clock_mode == 'ohko':
write_bytes(rom, 0x180190, [0x01, 0x02, 0x01]) # ohko timer with resetable timer functionality
write_bytes(rom, 0x180200, [0x00, 0x00, 0x00, 0x00]) # red clock adjustment time (in frames, uint32)
write_bytes(rom, 0x180204, [0x00, 0x00, 0x00, 0x00]) # blue clock adjustment time (in frames, uint32)
write_bytes(rom, 0x180208, [0x50, 0x46, 0x00, 0x00]) # green clock adjustment time (in frames, uint32)
write_bytes(rom, 0x18020C, [0xA0, 0x8C, 0x00, 0x00]) # starting time (in frames, uint32)
if world.clock_mode == 'stopwatch':
write_bytes(rom, 0x180190, [0x02, 0x01, 0x00]) # set stopwatch mode
write_bytes(rom, 0x180200, [0x1C, 0x20, 0x00, 0x00]) # red clock adjustment time (in frames, uint32)
write_bytes(rom, 0x180204, [0x1C, 0x20, 0x00, 0x00]) # blue clock adjustment time (in frames, uint32)
write_bytes(rom, 0x180208, [0x38, 0x40, 0x00, 0x00]) # green clock adjustment time (in frames, uint32)
write_bytes(rom, 0x18020C, [0x00, 0x00, 0x00, 0x00]) # starting time (in frames, uint32)
if world.clock_mode == 'countdown':
write_bytes(rom, 0x180190, [0x01, 0x01, 0x00]) # set countdown, with no reset available
write_bytes(rom, 0x180200, [0x1C, 0x20, 0x00, 0x00]) # red clock adjustment time (in frames, uint32)
write_bytes(rom, 0x180204, [0x1C, 0x20, 0x00, 0x00]) # blue clock adjustment time (in frames, uint32)
write_bytes(rom, 0x180208, [0x38, 0x40, 0x00, 0x00]) # green clock adjustment time (in frames, uint32)
write_bytes(rom, 0x18020C, [0x80, 0x32, 0x02, 0x00]) # starting time (in frames, uint32)
# set up goals for treasure hunt
write_bytes(rom, 0x180165, [0x0E, 0x28] if world.treasure_hunt_icon == 'Triforce' else [0x0D, 0x28])
write_byte(rom, 0x180167, world.treasure_hunt_count % 256)
# assorted fixes
write_byte(rom, 0x180030, 0x00) # Disable SRAM trace
write_byte(rom, 0x180036, 0x0A) # Rupoor negative value
write_byte(rom, 0x180169, 0x01 if world.lock_aga_door_in_escape else 0x00) # Lock or unlock aga tower door during escape sequence.
write_byte(rom, 0x180086, 0x00 if world.aga_randomness == 'vanilla' else 0x02 if world.aga_randomness == 'table' else 0x01) # set blue ball and ganon warp randomness
if world.goal == 'pedestal':
write_byte(rom, 0x18003E, 0x01) # make ganon invincible

File diff suppressed because one or more lines are too long