commit e05b17e6cd4b7bbc9bd845db96773478b794de0f
parent 5f783c8f329cccfa6fd2688d06aace5b657cf5aa
Author: anon <anon@example.com>
Date: Fri, 16 Oct 2026 07:23:46 +0000
Verify native Linux and Windows world interaction and save smoke harness
Diffstat:
6 files changed, 209 insertions(+), 7 deletions(-)
diff --git a/decompiled/README.md b/decompiled/README.md
@@ -28,7 +28,8 @@ dependencies are tracked. After changing compiler flags, use `-B -j4`.
Normal builds need neither Python nor a decompiler.
`Makefile.linux` builds the native x86-64 WSL port and its focused tests.
-That port reaches DLL initialization but is not yet playable; see the
+That port renders Bronto Burger and passes movement, inventory and map checks;
+it runs without Wine or Windows DLLs. See the
Linux port report for commands and current evidence.
The clean standalone Make build compiled all 595 units (game, data, dispatch
@@ -38,9 +39,9 @@ The [standalone report](../docs/standalone-14.9.1.md) records the validation;
the initial [round-trip report](../docs/reconstruction-14.9.1.md) describes the
compiler/runtime fixes and stock/rebuilt chat comparison.
-The result combines all game modules into one Windows executable. Vendor DLLs
-and Windows/DirectX remain native dependencies. This is a source-editable native
-baseline, not yet the portable/WASM build.
+The result combines all game modules into one executable. The Windows build
+uses native vendor DLLs and Windows/DirectX. The Linux build uses translated
+support-library C and Linux platform adapters. A WASM build remains future work.
## Local inputs and validation
@@ -52,9 +53,10 @@ The game still needs its ordinary external assets and native vendor libraries.
`client-standalone-14.9.1` is the validation folder containing those inputs but
none of the original game modules.
-For the validation helpers, the workspace venv executable is stale. Use Python at
-`python3`
-with `PYTHONPATH=C:/path/to/ao/venv/Lib/site-packages` where needed.
+The validation helpers use `venv/Scripts/python.exe` from the repository root.
+`tools/reconstruction/verify_linux_game.py` runs the isolated Linux movement,
+inventory/map and screenshot check; prerequisites and results are in the
+Linux port report.
Start `tools/reconstruction/work/fonts/server-14.9.1/server.exe` with its own
directory as the working directory. It serves localhost 7510/7511/8081.
diff --git a/docs/images/linux-inventory-14.9.1.png b/docs/images/linux-inventory-14.9.1.png
Binary files differ.
diff --git a/docs/images/linux-map-14.9.1.png b/docs/images/linux-map-14.9.1.png
Binary files differ.
diff --git a/docs/images/windows-bronto-burger-14.9.1.png b/docs/images/windows-bronto-burger-14.9.1.png
Binary files differ.
diff --git a/tools/reconstruction/linux_game_smoke.gdb.py b/tools/reconstruction/linux_game_smoke.gdb.py
@@ -0,0 +1,73 @@
+"""Loaded by GDB through verify_linux_game.py, on the native Linux client."""
+import json
+import pathlib
+import struct
+
+import gdb
+
+
+output = pathlib.Path('../tools/reconstruction/work/linux-game-smoke')
+
+
+def send_key(symbol, down):
+ event = int(gdb.parse_and_eval('(void*)malloc(56)'))
+ window = int(gdb.parse_and_eval('(unsigned int)SDL_GetWindowID((void*)linux_graphics_window())'))
+ data = struct.pack('<IIIBBxxiiH', 0x300 if down else 0x301, 0, window, int(down), 0, 0, ord(symbol), 0)
+ gdb.selected_inferior().write_memory(event, data.ljust(56, b'\0'))
+ result = int(gdb.parse_and_eval('(int)SDL_PushEvent((void*)%d)' % event))
+ gdb.execute('call (void)free((void*)%d)' % event, to_string=True)
+ assert result == 1
+
+
+def capture(label):
+ # Save presentation arguments before inferior calls can change registers.
+ target = int(gdb.parse_and_eval('$rdi'))
+ rectangle = int(gdb.parse_and_eval('$rsi'))
+ inferior = gdb.selected_inferior()
+ width, height = struct.unpack('<II', inferior.read_memory(target, 8))
+ left, top, right, bottom = struct.unpack('<iiii', inferior.read_memory(rectangle, 16))
+ assert 0 <= left < right <= width and 0 <= top < bottom <= height
+ pixels = int(gdb.parse_and_eval('(void*)malloc(%d)' % (width * height * 4)))
+ gdb.execute('call ((void (*)(void*, void*))gl_target_read)((void*)%d, (void*)%d)' % (target, pixels), to_string=True)
+ data = bytes(inferior.read_memory(pixels, width * height * 4))
+ gdb.execute('call (void)free((void*)%d)' % pixels, to_string=True)
+ with (output / (label + '.rgba')).open('wb') as file:
+ for row in range(top, bottom):
+ file.write(data[(row * width + left) * 4:(row * width + right) * 4])
+ (output / (label + '.json')).write_text(json.dumps([right - left, bottom - top]))
+ print('Captured', label)
+
+
+def on_present():
+ frame = int(gdb.parse_and_eval('$ao_frames'))
+ captures = {500: 'baseline', 530: 'inventory-open', 560: 'inventory-closed',
+ 590: 'map-open', 620: 'map-closed', 680: 'moved'}
+ events = {510: ('i', True), 511: ('i', False), 540: ('i', True), 541: ('i', False),
+ 570: ('p', True), 571: ('p', False), 600: ('p', True), 601: ('p', False),
+ 630: ('w', True), 660: ('w', False)}
+ if frame in captures:
+ capture(captures[frame])
+ if frame in events:
+ send_key(*events[frame])
+
+
+gdb.execute('set pagination off')
+gdb.execute('set confirm off')
+gdb.execute('set print thread-events off')
+for symbol in ['external_call', 'guest_memory_fault', 'unavailable_method']:
+ gdb.Breakpoint(symbol, internal=True)
+gdb.execute('set $ao_frames = 0')
+gdb.execute('''break gl_target_present
+commands
+silent
+set $ao_frames = $ao_frames + 1
+python on_present()
+if $ao_frames == 700
+printf "Smoke inputs complete at frame 700.\\n"
+quit
+end
+continue
+end''')
+gdb.execute('run')
+gdb.execute('thread apply all bt 10')
+raise RuntimeError('Client stopped before completing the input sequence')
diff --git a/tools/reconstruction/verify_linux_game.py b/tools/reconstruction/verify_linux_game.py
@@ -0,0 +1,127 @@
+"""Run the isolated Bronto Burger input/capture check from Windows."""
+import hashlib
+import json
+import os
+import pathlib
+import re
+import socket
+import subprocess
+import time
+import urllib.request
+
+
+root = pathlib.Path(__file__).resolve().parents[2]
+work = root / 'tools/reconstruction/work'
+client = root / 'client-standalone-14.9.1'
+fixture = work / 'linux-server-probe'
+output = work / 'linux-game-smoke'
+
+
+def run_linux():
+ # Refuse to share ports with a running development server.
+ for port in [7510, 7511, 8081]:
+ with socket.socket() as connection:
+ assert connection.connect_ex(('127.0.0.1', port)) != 0, 'Server port already in use: %d' % port
+
+ with (output / 'server.log').open('w') as log:
+ server = subprocess.Popen([str(fixture / 'server')], cwd=fixture,
+ stdout=log, stderr=subprocess.STDOUT)
+ try:
+ deadline = time.monotonic() + 10
+ ready = False
+ while server.poll() is None and time.monotonic() < deadline:
+ with socket.socket() as connection:
+ ready = connection.connect_ex(('127.0.0.1', 8081)) == 0
+ if ready:
+ break
+ time.sleep(.1)
+ assert ready, 'Isolated server did not become ready; inspect server.log'
+ urllib.request.urlopen('http://127.0.0.1:8081/time', b'hour=13&minute=30', timeout=5).read()
+
+ # GDB injects SDL events and reads the actual presented render target.
+ environment = os.environ.copy()
+ environment.update(GALLIUM_DRIVER='d3d12', ANARCHY_SETUP='Setupf', ANARCHY='.')
+ subprocess.run([
+ 'timeout', '--signal=INT', '--kill-after=5s', '180s', 'gdb', '-nx', '-batch',
+ '-x', str(root / 'tools/reconstruction/linux_game_smoke.gdb.py'), '--args',
+ str(root / 'decompiled/build/linux/game'), 'localtest', 'localtest',
+ '73', '2130706433', '7511', '0', '0',
+ ], cwd=client, env=environment, timeout=190, check=True)
+ finally:
+ if server.poll() is None:
+ server.terminate()
+ server.wait(timeout=5)
+ print('Isolated Linux server stopped.', flush=True)
+
+
+def run_windows():
+ import PIL.Image
+
+ for port in [7510, 7511, 8081]:
+ with socket.socket() as connection:
+ assert connection.connect_ex(('127.0.0.1', port)) != 0, 'Server port already in use: %d' % port
+
+ # Preserve the isolated character, preferences and client diagnostic files.
+ preferences = client / 'Prefs'
+ backups = {path: path.read_bytes() for path in preferences.rglob('*') if path.is_file()}
+ for name in ['stderr.txt', 'DXDiagOutput.txt', 'AnarchyCrashLog.txt']:
+ path = client / name
+ backups[path] = path.read_bytes() if path.exists() else None
+ users = fixture / 'data/users.yaml'
+ backups[users] = users.read_bytes()
+ output.mkdir(exist_ok=True)
+ for path in output.glob('*.json'):
+ path.unlink()
+ try:
+ data = users.read_text()
+ assert re.findall(r'(?m)^- id: (\d+)$', data) == ['73'], 'Expected the isolated character fixture'
+ data = re.sub(r'(?m)^ position:.*$', ' position: [960, 16.5, 510]', data)
+ data = re.sub(r'(?m)^ rotation:.*$', ' rotation: [0, 0.9238795, 0, -0.3826834]', data)
+ users.write_text(data)
+ with (output / 'client.log').open('w') as log:
+ subprocess.run([
+ 'wsl', '-d', 'Ubuntu-26.04', '--cd', '/path/to/ao',
+ '--exec', 'python3', 'tools/reconstruction/verify_linux_game.py',
+ ], stdout=log, stderr=subprocess.STDOUT, timeout=205, check=True)
+ if (client / 'stderr.txt').exists():
+ (output / 'stderr.txt').write_bytes((client / 'stderr.txt').read_bytes())
+ finally:
+ for path in preferences.rglob('*'):
+ if path.is_file() and path not in backups:
+ path.unlink()
+ for path, data in backups.items():
+ if data is None:
+ path.unlink(missing_ok=True)
+ else:
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_bytes(data)
+
+ # Completion and movement are automatic checks; inspect the six PNGs for visual correctness.
+ log = (output / 'client.log').read_text()
+ assert 'Smoke inputs complete at frame 700.' in log, log[-4000:]
+ positions = re.findall(r'Character 73 action=([12]) position=\[([^]]+)\]',
+ (output / 'server.log').read_text())
+ starts = [position for action, position in positions if action == '1']
+ stops = [position for action, position in positions if action == '2']
+ assert starts and stops and starts[0] != stops[-1], positions
+ for label in ['baseline', 'inventory-open', 'inventory-closed', 'map-open', 'map-closed', 'moved']:
+ size = json.loads((output / (label + '.json')).read_text())
+ pixels = (output / (label + '.rgba')).read_bytes()
+ PIL.Image.frombytes('RGBA', tuple(size), pixels).convert('RGB').save(output / (label + '.png'))
+ with (root / 'decompiled/build/linux/game').open('rb') as executable:
+ executable_hash = hashlib.file_digest(executable, 'sha256').hexdigest()
+ report = {
+ 'frames': 700, 'movement_start': starts[0], 'movement_stop': stops[-1],
+ 'executable_sha256': executable_hash,
+ 'visual_review_required': True,
+ }
+ (output / 'report.json').write_text(json.dumps(report, indent=2))
+ print(json.dumps(report, indent=2))
+ print('Inspect screenshots in', output)
+
+
+if __name__ == '__main__':
+ if os.name == 'nt':
+ run_windows()
+ else:
+ run_linux()