LttP: now that Enemizer allows for AP rom name, rename it. (#730)

* LttP: now that Enemizer allows for AP rom name, rename it.

* LttP: fix missing Enemizer message parenthesis
This commit is contained in:
Fabian Dill 2022-06-30 19:00:37 +02:00 committed by GitHub
parent d7a9b98ce8
commit cea7278faf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -19,7 +19,7 @@ import threading
import xxtea
import concurrent.futures
import bsdiff4
from typing import Optional
from typing import Optional, List
from BaseClasses import CollectionState, Region, Location
from worlds.alttp.Shops import ShopType, ShopPriceType
@ -186,7 +186,7 @@ def check_enemizer(enemizercli):
# some time may have passed since the lock was acquired, as such a quick re-check doesn't hurt
if getattr(check_enemizer, "done", None):
return
wanted_version = (7, 0, 1)
# version info is saved on the lib, for some reason
library_info = os.path.join(os.path.dirname(enemizercli), "EnemizerCLI.Core.deps.json")
with open(library_info) as f:
@ -197,10 +197,11 @@ def check_enemizer(enemizercli):
version = lib.split("/")[-1]
version = tuple(int(element) for element in version.split("."))
enemizer_logger.debug(f"Found Enemizer version {version}")
if version < (6, 4, 0):
if version < wanted_version:
raise Exception(
f"Enemizer found at {enemizercli} is outdated ({info}), please update your Enemizer. "
f"Such as https://github.com/Ijwu/Enemizer/releases")
f"Enemizer found at {enemizercli} is outdated ({version}) < ({wanted_version}), "
f"please update your Enemizer. "
f"Such as from https://github.com/Ijwu/Enemizer/releases")
break
else:
raise Exception(f"Could not find Enemizer library version information in {library_info}")
@ -1645,8 +1646,7 @@ def patch_rom(world, rom, player, enemized):
# set rom name
# 21 bytes
from Main import __version__
# TODO: Adjust Enemizer to accept AP and AD
rom.name = bytearray(f'BM{__version__.replace(".", "")[0:3]}_{player}_{world.seed:11}\0', 'utf8')[:21]
rom.name = bytearray(f'AP{__version__.replace(".", "")[0:3]}_{player}_{world.seed:11}\0', 'utf8')[:21]
rom.name.extend([0] * (21 - len(rom.name)))
rom.write_bytes(0x7FC0, rom.name)
@ -1677,7 +1677,7 @@ def patch_race_rom(rom, world, player):
rom.encrypt(world, player)
def get_price_data(price: int, price_type: int) -> bytes:
def get_price_data(price: int, price_type: int) -> List[int]:
if price_type != ShopPriceType.Rupees:
# Set special price flag 0x8000
# Then set the type of price we're setting 0x7F00 (this starts from Hearts, not Rupees, subtract 1)