forked from mirror/Archipelago
Some checks failed
Analyze modified files / flake8 (push) Failing after 2m28s
Build / build-win (push) Has been cancelled
Build / build-ubuntu2204 (push) Has been cancelled
ctest / Test C++ ubuntu-latest (push) Has been cancelled
ctest / Test C++ windows-latest (push) Has been cancelled
Analyze modified files / mypy (push) Has been cancelled
Build and Publish Docker Images / Push Docker image to Docker Hub (push) Successful in 5m4s
Native Code Static Analysis / scan-build (push) Failing after 5m2s
type check / pyright (push) Successful in 1m7s
unittests / Test Python 3.11.2 ubuntu-latest (push) Failing after 16m23s
unittests / Test Python 3.12 ubuntu-latest (push) Failing after 28m19s
unittests / Test Python 3.13 ubuntu-latest (push) Failing after 14m49s
unittests / Test hosting with 3.13 on ubuntu-latest (push) Successful in 5m0s
unittests / Test Python 3.13 macos-latest (push) Has been cancelled
unittests / Test Python 3.11 windows-latest (push) Has been cancelled
unittests / Test Python 3.13 windows-latest (push) Has been cancelled
58 lines
1.9 KiB
Python
58 lines
1.9 KiB
Python
"""This is a dummy module that only exists to override the built in pyodide module."""
|
|
|
|
from __future__ import annotations
|
|
import pkgutil
|
|
import json
|
|
from typing import TYPE_CHECKING
|
|
|
|
|
|
def postMessage(message: str) -> None:
|
|
"""Fake function for printing messages with JS."""
|
|
print(message)
|
|
|
|
|
|
def getFile(filename):
|
|
"""Fake function for loading files with Javascript."""
|
|
try:
|
|
with open(filename, "rb") as file:
|
|
return file.read()
|
|
except Exception:
|
|
try:
|
|
return pkgutil.get_data(__name__, filename)
|
|
except Exception:
|
|
with open(f"worlds/dk64/{filename}", "rb") as file:
|
|
return file.read()
|
|
|
|
|
|
def getStringFile(filename):
|
|
"""Fake function for loading files with Javascript."""
|
|
try:
|
|
with open(filename, "r") as file:
|
|
return file.read()
|
|
except Exception:
|
|
try:
|
|
return pkgutil.get_data(__name__, filename).decode()
|
|
except Exception:
|
|
with open(f"worlds/dk64/{filename}", "r") as file:
|
|
return file.read()
|
|
|
|
|
|
pointer_addresses = None
|
|
rom_symbols = None
|
|
try:
|
|
with open("./static/patches/pointer_addresses.json", "rb") as file:
|
|
pointer_addresses = json.loads(file.read())
|
|
|
|
with open("./static/patches/symbols.json", "rb") as file:
|
|
rom_symbols = json.loads(file.read())
|
|
except Exception:
|
|
try:
|
|
pointer_addresses = json.loads(pkgutil.get_data(__name__, "static/patches/pointer_addresses.json").decode())
|
|
rom_symbols = json.loads(pkgutil.get_data(__name__, "static/patches/symbols.json").decode())
|
|
except Exception:
|
|
with open(f"worlds/dk64/static/patches/pointer_addresses.json", "rb") as file:
|
|
pointer_addresses = json.loads(file.read())
|
|
|
|
with open(f"worlds/dk64/static/patches/symbols.json", "rb") as file:
|
|
rom_symbols = json.loads(file.read())
|