TLOZ: APworld support (#1884)
- Remove a relative import in Rules.py - Clean up a few unused imports in __init__.py - Use pkgutil instead of open when applying base patch - make sure rom_name is initialized correctly in modify_multidata * use os.path.join() instead of explicit "/"
This commit is contained in:
parent
f1ccf1b663
commit
7a4e903906
|
@ -1,6 +1,6 @@
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from ..generic.Rules import add_rule
|
from worlds.generic.Rules import add_rule
|
||||||
from .Locations import food_locations, shop_locations
|
from .Locations import food_locations, shop_locations
|
||||||
from .ItemPool import dangerous_weapon_locations
|
from .ItemPool import dangerous_weapon_locations
|
||||||
from .Options import StartingPosition
|
from .Options import StartingPosition
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
import pkgutil
|
from pkgutil import get_data
|
||||||
from typing import NamedTuple, Union, Dict, Any
|
from typing import Dict, Any
|
||||||
|
|
||||||
import bsdiff4
|
import bsdiff4
|
||||||
|
|
||||||
|
@ -168,9 +167,8 @@ class TLoZWorld(World):
|
||||||
# Remove map/compass check so they're always on
|
# Remove map/compass check so they're always on
|
||||||
# Removing a bit from the boss roars flags, so we can have more dungeon items. This allows us to
|
# Removing a bit from the boss roars flags, so we can have more dungeon items. This allows us to
|
||||||
# go past 0x1F items for dungeon items.
|
# go past 0x1F items for dungeon items.
|
||||||
base_patch_location = os.path.dirname(__file__) + "/z1_base_patch.bsdiff4"
|
base_patch = get_data(__name__, os.path.join(os.path.dirname(__file__), "z1_base_patch.bsdiff4"))
|
||||||
with open(base_patch_location, "rb") as base_patch:
|
rom_data = bsdiff4.patch(rom.read(), base_patch)
|
||||||
rom_data = bsdiff4.patch(rom.read(), base_patch.read())
|
|
||||||
rom_data = bytearray(rom_data)
|
rom_data = bytearray(rom_data)
|
||||||
# Set every item to the new nothing value, but keep room flags. Type 2 boss roars should
|
# Set every item to the new nothing value, but keep room flags. Type 2 boss roars should
|
||||||
# become type 1 boss roars, so we at least keep the sound of roaring where it should be.
|
# become type 1 boss roars, so we at least keep the sound of roaring where it should be.
|
||||||
|
@ -275,6 +273,8 @@ class TLoZWorld(World):
|
||||||
def modify_multidata(self, multidata: dict):
|
def modify_multidata(self, multidata: dict):
|
||||||
import base64
|
import base64
|
||||||
self.rom_name_available_event.wait()
|
self.rom_name_available_event.wait()
|
||||||
|
rom_name = getattr(self, "rom_name", None)
|
||||||
|
if rom_name:
|
||||||
new_name = base64.b64encode(bytes(self.rom_name)).decode()
|
new_name = base64.b64encode(bytes(self.rom_name)).decode()
|
||||||
multidata["connect_names"][new_name] = multidata["connect_names"][self.multiworld.player_name[self.player]]
|
multidata["connect_names"][new_name] = multidata["connect_names"][self.multiworld.player_name[self.player]]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue