Check Enemizer version
This commit is contained in:
parent
f27d9e904f
commit
d4f296835c
31
Rom.py
31
Rom.py
|
@ -145,7 +145,38 @@ def read_rom(stream) -> bytearray:
|
||||||
buffer = buffer[0x200:]
|
buffer = buffer[0x200:]
|
||||||
return buffer
|
return buffer
|
||||||
|
|
||||||
|
|
||||||
|
def check_enemizer(enemizercli):
|
||||||
|
if getattr(check_enemizer, "done", None):
|
||||||
|
return
|
||||||
|
if not os.path.exists(enemizercli) and not os.path.exists(enemizercli + ".exe"):
|
||||||
|
raise Exception(f"Enemizer not found at {enemizercli}, please install a multiworld fork of Enemizer. "
|
||||||
|
f"Such as https://github.com/Ijwu/Enemizer/releases")
|
||||||
|
if sys.platform == "win32":
|
||||||
|
try:
|
||||||
|
import pythoncom
|
||||||
|
from win32com.client import Dispatch
|
||||||
|
except ImportError:
|
||||||
|
logging.info("Could not check Enemizer Version info as pywin32 bindings are missing.")
|
||||||
|
else:
|
||||||
|
# version info is saved on the lib, for some reason
|
||||||
|
library = os.path.join(os.path.dirname(enemizercli), "EnemizerLibrary.dll")
|
||||||
|
pythoncom.CoInitialize()
|
||||||
|
ver_parser = Dispatch('Scripting.FileSystemObject')
|
||||||
|
info = ver_parser.GetFileVersion(library)
|
||||||
|
|
||||||
|
if info == 'No Version Information Available':
|
||||||
|
info = None
|
||||||
|
version = tuple(int(part) for part in info.split("."))
|
||||||
|
if version < (6, 1, 0, 179):
|
||||||
|
raise Exception(
|
||||||
|
f"Enemizer found at {enemizercli} is outdated ({info}), please install a multiworld fork of Enemizer. "
|
||||||
|
f"Such as https://github.com/Ijwu/Enemizer/releases")
|
||||||
|
check_enemizer.done = True
|
||||||
|
|
||||||
|
|
||||||
def patch_enemizer(world, player: int, rom: LocalRom, enemizercli, random_sprite_on_hit):
|
def patch_enemizer(world, player: int, rom: LocalRom, enemizercli, random_sprite_on_hit):
|
||||||
|
check_enemizer(enemizercli)
|
||||||
randopatch_path = os.path.abspath(output_path(f'enemizer_randopatch_{player}.sfc'))
|
randopatch_path = os.path.abspath(output_path(f'enemizer_randopatch_{player}.sfc'))
|
||||||
options_path = os.path.abspath(output_path(f'enemizer_options_{player}.json'))
|
options_path = os.path.abspath(output_path(f'enemizer_options_{player}.json'))
|
||||||
enemizer_output_path = os.path.abspath(output_path(f'enemizer_output_{player}.sfc'))
|
enemizer_output_path = os.path.abspath(output_path(f'enemizer_output_{player}.sfc'))
|
||||||
|
|
|
@ -58,7 +58,7 @@ else: # unix
|
||||||
|
|
||||||
def launch_room(room: Room, config: dict):
|
def launch_room(room: Room, config: dict):
|
||||||
# requires db_session!
|
# requires db_session!
|
||||||
if room.last_activity >= datetime.utcnow() - timedelta(minutes=room.timeout):
|
if room.last_activity >= datetime.utcnow() - timedelta(seconds=room.timeout):
|
||||||
multiworld = multiworlds.get(room.id, None)
|
multiworld = multiworlds.get(room.id, None)
|
||||||
if not multiworld:
|
if not multiworld:
|
||||||
multiworld = MultiworldInstance(room, config)
|
multiworld = MultiworldInstance(room, config)
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<br>
|
<br>
|
||||||
<div class="container container-fluid">
|
|
||||||
|
<div class="container container-fluid d-flex">
|
||||||
<div class="jumbotron jumbotron-fluid">
|
<div class="jumbotron jumbotron-fluid">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="col-md-5 p-lg-2 mx-auto my-2">
|
<div class="col-md-5 p-lg-2 mx-auto my-2">
|
||||||
|
@ -40,9 +41,15 @@
|
||||||
<p class="lead">Currently you still require a locally installed client to play, that handles
|
<p class="lead">Currently you still require a locally installed client to play, that handles
|
||||||
connecting to the server and patching a vanilla game to the randomized one. Get started on the
|
connecting to the server and patching a vanilla game to the randomized one. Get started on the
|
||||||
<a href="https://github.com/Berserker66/MultiWorld-Utilities/wiki">Wiki</a>.</p>
|
<a href="https://github.com/Berserker66/MultiWorld-Utilities/wiki">Wiki</a>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<iframe src="https://discordapp.com/widget?id=731205301247803413&theme=light" width="300" height="500"
|
||||||
|
allowtransparency="true" frameborder="0"></iframe>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue