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.
46 lines
2.8 KiB
Python
46 lines
2.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Validate downloaded build-4 reports and audit the signed iOS executable."""
|
|
import hashlib
|
|
import json
|
|
import subprocess
|
|
from datetime import datetime
|
|
from pathlib import Path
|
|
ROOT=Path(__file__).resolve().parents[1]
|
|
OUT=ROOT/'build/target-deserialiser'
|
|
reports={name:json.loads((OUT/('iphone-'+name+'-result.json')).read_text())
|
|
for name in ('target','layout','map-header','version')}
|
|
target=reports['target']
|
|
assert all(r['app_build']=='4' and r['app_version']=='0.1.0' for r in reports.values())
|
|
assert len({r['run_id'] for r in reports.values()})==1
|
|
assert len({r['build_id'] for r in reports.values()})==1
|
|
times=[datetime.fromisoformat(r['recorded_at'].replace('Z','+00:00')) for r in reports.values()]
|
|
assert (max(times)-min(times)).total_seconds()<30
|
|
assert target['status']=='pass' and target['code']==0
|
|
assert target['allocations']==4 and target['pool_capacity']==64 and target['initialized_targets']==64
|
|
assert target['heap_bytes']==2104
|
|
assert reports['version']['status']=='pass'
|
|
assert reports['map-header']['status']=='pass'
|
|
assert reports['map-header']['modern_64_bit'] and reports['map-header']['legacy_32_bit_sentinel']
|
|
layout=reports['layout']
|
|
desktop=json.loads((ROOT/'build/save-layout/desktop-real-save.json').read_text())
|
|
assert layout['status']==0 and layout['input_sha256']==desktop['input_sha256']
|
|
for key in ('header_offset','next_offset','mod_count','tick_fields_hex'):
|
|
assert layout[key]==desktop['decoded_layout'][key]
|
|
binary=ROOT/'build/ios-device/Build/Products/Release-iphoneos/FactorioPort.app/FactorioPort'
|
|
assert target['build_id'].encode() in binary.read_bytes()
|
|
dependencies=subprocess.check_output(['xcrun','otool','-L',str(binary)],text=True)
|
|
imports=subprocess.check_output(['xcrun','nm','-u',str(binary)],text=True)
|
|
symbols=subprocess.check_output(['xcrun','nm',str(binary)],text=True)
|
|
assert 'steam' not in (dependencies+imports).lower()
|
|
for symbol in ('_factorio_rng_original','_factorio_version_original','_factorio_map_header_original',
|
|
'_factorio_target_original','_native_target_allocate'):
|
|
assert symbol not in symbols
|
|
report={'status':'pass','app_build':'4','run_id':target['run_id'],'build_id':target['build_id'],
|
|
'device':'iPhone 15 Pro','target_constructor':target,
|
|
'same_launch_version_map_header_and_actual_save':'pass',
|
|
'input_sha256':layout['input_sha256'],'steam_dependency_or_import':False,
|
|
'desktop_oracle_symbols':False,'signed_binary_sha256':hashlib.sha256(binary.read_bytes()).hexdigest(),
|
|
'scope':'original initialization graph and existing header probes; no loaded world or gameplay'}
|
|
(OUT/'device-verification.json').write_text(json.dumps(report,indent=2)+'\n')
|
|
print('PASS: build 4 same-launch device reports, actual-save regression, signed binary dependency/oracle audit')
|