mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
implement binary patching for multimystery (for now no gui/cli support)
This commit is contained in:
@@ -3,7 +3,6 @@ import asyncio
|
||||
import functools
|
||||
import json
|
||||
import logging
|
||||
import urllib.request
|
||||
import zlib
|
||||
import collections
|
||||
import typing
|
||||
@@ -613,23 +612,17 @@ async def main():
|
||||
except Exception as e:
|
||||
logging.error('Failed to read multiworld data (%s)' % e)
|
||||
return
|
||||
import socket
|
||||
ip = socket.gethostbyname(socket.gethostname())
|
||||
try:
|
||||
ip = urllib.request.urlopen('https://checkip.amazonaws.com/').read().decode('utf8').strip()
|
||||
except Exception as e:
|
||||
try:
|
||||
ip = urllib.request.urlopen('https://v4.ident.me').read().decode('utf8').strip()
|
||||
except:
|
||||
logging.exception(e)
|
||||
pass # we could be offline, in a local game, so no point in erroring out
|
||||
|
||||
logging.info('Hosting game at %s:%d (%s)' % (ip, ctx.port, 'No password' if not ctx.password else 'Password: %s' % ctx.password))
|
||||
ip = Utils.get_public_ipv4()
|
||||
|
||||
logging.info('Hosting game at %s:%d (%s)' % (
|
||||
ip, ctx.port, 'No password' if not ctx.password else 'Password: %s' % ctx.password))
|
||||
|
||||
ctx.disable_save = args.disable_save
|
||||
if not ctx.disable_save:
|
||||
if not ctx.save_filename:
|
||||
ctx.save_filename = (ctx.data_filename[:-9] if ctx.data_filename[-9:] == 'multidata' else (ctx.data_filename + '_')) + 'multisave'
|
||||
ctx.save_filename = (ctx.data_filename[:-9] if ctx.data_filename[-9:] == 'multidata' else (
|
||||
ctx.data_filename + '_')) + 'multisave'
|
||||
try:
|
||||
with open(ctx.save_filename, 'rb') as f:
|
||||
jsonobj = json.loads(zlib.decompress(f.read()).decode("utf-8"))
|
||||
|
Reference in New Issue
Block a user