Created
June 21, 2020 20:56
-
-
Save mgius/48b6c71808da53cdaff57b41b49db1cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import pyz3r | |
BASE_ROM_LOCATION = "ZeldaBase.sfc" | |
OUT_ROM_LOCATION = "ZeldaPatched.sfc" | |
async def load_base_rom(): | |
return await pyz3r.rom.read("ZeldaBase.sfc") | |
async def main(): | |
# load default randomizer settings from alttpr | |
alttpr = await pyz3r.alttpr() | |
all_settings = await alttpr.randomizer_settings() | |
default_settings = all_settings['presets']['default'] | |
# Open is what seems to be not working, so validate that here | |
assert default_settings['world_state'] == 'open' | |
seed = await pyz3r.alttpr( | |
settings=default_settings | |
) | |
# and double check what was returned is open | |
assert seed.settings['world_state'] == 'open' | |
base_rom = await pyz3r.rom.read(BASE_ROM_LOCATION) | |
patched_rom = await seed.create_patched_game(base_rom) | |
await pyz3r.rom.write(patched_rom, OUT_ROM_LOCATION) | |
print(f"Hash: {seed.hash}") | |
print(f"Code: {seed.code}") | |
if __name__ == '__main__': | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment