Run the original macOS ARM64 game code on iOS: - tools/retarget.py: header-only Mach-O retargeting to an iOS dylib - platform/native: UIKit host and macOS API shims (AppKit for SDL's Cocoa backend, CoreGraphics displays, CoreAudio device, Metal device properties, Wuffs PNG decoding, Steam and peripheral stubs) - touch, overlay, iOS keyboard and hardware keyboard input - tools/build_native.py: build, sign, install, data copy, launch - docs: build guide, controls, architecture Also includes the earlier static-translation research (ARM64 -> WASM -> native) under docs/research, runtime/, tests/ and tools/. No game files are included; the build reads them from a local install.
29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Symbolize [fx-crash] lines from build/native/console.log against the original factorio.dSYM.
|
|
|
|
Usage: python3 tools/symbolize_native.py [console.log]
|
|
Factorio.dylib offsets map to the original executable's addresses as 0x100000000 + offset.
|
|
"""
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
DSYM = Path.home() / ("Library/Application Support/Steam/steamapps/common/Factorio/"
|
|
"factorio.app/Contents/MacOS/factorio.dSYM/Contents/Resources/DWARF/factorio")
|
|
log = Path(sys.argv[1]) if len(sys.argv) > 1 else ROOT / "build/native/console.log"
|
|
lines = [l.rstrip() for l in log.read_text(errors="replace").splitlines() if "[fx-crash]" in l]
|
|
addrs = []
|
|
for line in lines:
|
|
m = re.search(r"Factorio\.dylib\+(0x[0-9a-f]+)", line)
|
|
if m:
|
|
addrs.append(hex(0x100000000 + int(m.group(1), 16)))
|
|
symbols = iter(subprocess.check_output(["atos", "-o", str(DSYM), "-arch", "arm64", "-l", "0x100000000", *addrs],
|
|
text=True).splitlines()) if addrs else iter(())
|
|
for line in lines:
|
|
if "Factorio.dylib+" in line:
|
|
print(line.split("[fx-crash] ", 1)[1], "=>", next(symbols))
|
|
elif not re.search(r"\] x\d+ =", line):
|
|
print(line.split("[fx-crash] ", 1)[1])
|