From 03a892aded788181e1c33ee8e9c3a4d2c8ee6ce4 Mon Sep 17 00:00:00 2001 From: espeon65536 <81029175+espeon65536@users.noreply.github.com> Date: Tue, 4 Jan 2022 10:16:09 -0600 Subject: [PATCH] OoT updates (#160) * OoT: disable mixed entrance pools and decoupled entrances for now * OoT: fix error message crash in get_hint_area * Oot Adjuster: kill zootdec if it's not the vanilla rom anymore * OoT Adjuster: fix dmaTable issue Adjuster should now work on compiled versions of the software * OoT: don't skip dungeon items shuffled as any_dungeon for barren hints * OoT: wrap zootdec remove in try-finally --- OoTAdjuster.py | 27 ++++++++++++++++++--------- worlds/oot/Hints.py | 2 +- worlds/oot/Options.py | 4 ++-- worlds/oot/Rom.py | 2 +- worlds/oot/__init__.py | 9 ++++++++- worlds/oot/data/Compress/dmaTable.dat | 1 + 6 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 worlds/oot/data/Compress/dmaTable.dat diff --git a/OoTAdjuster.py b/OoTAdjuster.py index a9746e9a..36c37b04 100644 --- a/OoTAdjuster.py +++ b/OoTAdjuster.py @@ -12,6 +12,7 @@ from worlds.oot.Cosmetics import patch_cosmetics from worlds.oot.Options import cosmetic_options, sfx_options from worlds.oot.Rom import Rom, compress_rom_file from worlds.oot.N64Patch import apply_patch_file +from worlds.oot.Utils import data_path from Utils import local_path logger = logging.getLogger('OoTAdjuster') @@ -211,9 +212,11 @@ def adjust(args): ootworld.logic_rules = 'glitched' if args.is_glitched else 'glitchless' ootworld.death_link = args.deathlink + delete_zootdec = False if os.path.splitext(args.rom)[-1] in ['.z64', '.n64']: # Load up the ROM rom = Rom(file=args.rom, force_use=True) + delete_zootdec = True elif os.path.splitext(args.rom)[-1] == '.apz5': # Load vanilla ROM rom = Rom(file=args.vanilla_rom, force_use=True) @@ -222,15 +225,21 @@ def adjust(args): else: raise Exception("Invalid file extension; requires .n64, .z64, .apz5") # Call patch_cosmetics - patch_cosmetics(ootworld, rom) - rom.write_byte(rom.sym('DEATH_LINK'), args.deathlink) - # Output new file - path_pieces = os.path.splitext(args.rom) - decomp_path = path_pieces[0] + '-adjusted-decomp.n64' - comp_path = path_pieces[0] + '-adjusted.n64' - rom.write_to_file(decomp_path) - compress_rom_file(decomp_path, comp_path) - os.remove(decomp_path) + try: + patch_cosmetics(ootworld, rom) + rom.write_byte(rom.sym('DEATH_LINK'), args.deathlink) + # Output new file + path_pieces = os.path.splitext(args.rom) + decomp_path = path_pieces[0] + '-adjusted-decomp.n64' + comp_path = path_pieces[0] + '-adjusted.n64' + rom.write_to_file(decomp_path) + os.chdir(data_path("Compress")) + compress_rom_file(decomp_path, comp_path) + os.remove(decomp_path) + finally: + if delete_zootdec: + os.chdir(os.path.split(__file__)[0]) + os.remove("ZOOTDEC.z64") return comp_path if __name__ == '__main__': diff --git a/worlds/oot/Hints.py b/worlds/oot/Hints.py index f282aeee..0f28ca9c 100644 --- a/worlds/oot/Hints.py +++ b/worlds/oot/Hints.py @@ -312,7 +312,7 @@ def get_hint_area(spot): spot_queue.extend(list(filter(lambda ent: ent not in already_checked, parent_region.entrances))) - raise HintAreaNotFound('No hint area could be found for %s [World %d]' % (spot, spot.world.id)) + raise HintAreaNotFound('No hint area could be found for %s [World %d]' % (spot, spot.player)) else: return spot.name diff --git a/worlds/oot/Options.py b/worlds/oot/Options.py index b0e7fa1e..e46927a3 100644 --- a/worlds/oot/Options.py +++ b/worlds/oot/Options.py @@ -191,8 +191,8 @@ world_options: typing.Dict[str, type(Option)] = { "owl_drops": OwlDrops, "warp_songs": WarpSongs, "spawn_positions": SpawnPositions, - "mix_entrance_pools": MixEntrancePools, - "decouple_entrances": DecoupleEntrances, + # "mix_entrance_pools": MixEntrancePools, + # "decouple_entrances": DecoupleEntrances, "triforce_hunt": TriforceHunt, "triforce_goal": TriforceGoal, "extra_triforce_percentage": ExtraTriforces, diff --git a/worlds/oot/Rom.py b/worlds/oot/Rom.py index d4396254..8c4129e2 100644 --- a/worlds/oot/Rom.py +++ b/worlds/oot/Rom.py @@ -282,7 +282,7 @@ class Rom(BigStream): def compress_rom_file(input_file, output_file): - compressor_path = data_path("Compress") + compressor_path = "." if platform.system() == 'Windows': executable_path = "Compress.exe" diff --git a/worlds/oot/__init__.py b/worlds/oot/__init__.py index 66d08895..ee936a44 100644 --- a/worlds/oot/__init__.py +++ b/worlds/oot/__init__.py @@ -186,6 +186,8 @@ class OOTWorld(World): self.mq_dungeons_random = False # this will be a deprecated option later self.ocarina_songs = False # just need to pull in the OcarinaSongs module self.big_poe_count = 1 # disabled due to client-side issues for now + self.mix_entrance_pools = False + self.decouple_entrances = False # Set internal names used by the OoT generator self.keysanity = self.shuffle_smallkeys in ['keysanity', 'remove', 'any_dungeon', 'overworld'] @@ -827,7 +829,12 @@ class OOTWorld(World): or (loc.player in item_hint_players and loc.name in world.worlds[loc.player].added_hint_types['item'])): autoworld.major_item_locations.append(loc) - if loc.game == "Ocarina of Time" and loc.item.code and (not loc.locked or loc.item.type == 'Song'): + if loc.game == "Ocarina of Time" and loc.item.code and (not loc.locked or + (loc.item.type == 'Song' or + (loc.item.type == 'SmallKey' and world.worlds[loc.player].shuffle_smallkeys == 'any_dungeon') or + (loc.item.type == 'FortressSmallKey' and world.worlds[loc.player].shuffle_fortresskeys == 'any_dungeon') or + (loc.item.type == 'BossKey' and world.worlds[loc.player].shuffle_bosskeys == 'any_dungeon') or + (loc.item.type == 'GanonBossKey' and world.worlds[loc.player].shuffle_ganon_bosskey == 'any_dungeon'))): if loc.player in barren_hint_players: hint_area = get_hint_area(loc) items_by_region[loc.player][hint_area]['weight'] += 1 diff --git a/worlds/oot/data/Compress/dmaTable.dat b/worlds/oot/data/Compress/dmaTable.dat new file mode 100644 index 00000000..7db35a81 --- /dev/null +++ b/worlds/oot/data/Compress/dmaTable.dat @@ -0,0 +1 @@ +0 1 2 3 4 5 6 7 8 9 15 16 17 18 19 20 21 22 23 24 25 26 942 944 946 948 950 952 954 956 958 960 962 964 966 968 970 972 974 976 978 980 982 984 986 988 990 992 994 996 998 1000 1002 1004 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 \ No newline at end of file