aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


docs/reconstruction-14.9.1.md (8645B)


Anarchy Online 14.9.1 native C round trip

The subsequent standalone source build removes the original game PE input dependency described in this initial round-trip report.

Test date: 2026-10-14. The selected target is 14.9.1. The complete actual game, Clientr.exe plus 33 game DLLs, was mechanically translated to C, compiled, linked, and run at the approved Omni Entertainment Bronto Burger view.

Rebuilt 14.9.1 at Bronto Burger

Scope and build

The inventory covers 50 top-level PE files. Reconstruction includes all 34 game modules and excludes launcher/patcher utilities and identified vendor libraries. All 50 original binary hashes pass the final audit. See the 14.9.1 inventory for hashes and dependency edges.

The generator found 53,768 dispatchable entries, emitted 556 game C compilation units, and reported zero unsupported instructions. All module entry points and executable exports are in the dispatch set. These discovery counts do not prove that every possible computed target is known.

The compiler is i686-w64-mingw32-clang.exe, clang 23.1.3 from llvm-mingw-20261006-ucrt-x86_64, using -O2 -fno-strict-aliasing -fms-extensions. The linker combines the game modules into one 32-bit Windows executable, with image base 0x60000000 and a 16 MiB native stack. This is not a set of drop-in replacement DLLs.

The editable source is in client/. Its Makefile compiles source directly without regenerating it. Generated C, runtime and build files belong in Git; original PE inputs, assets, objects and executables remain local. The selected 14.9.1 assets remain in anarchy-vanilla-14.9.1.

Runtime fix required by this version

The first run failed during configuration parsing. The existing native bridge copied 24 DWORD argument slots, but ccr.dll!InputConfig_t::CreateHotkey at original VA 0x10003260 passes 31 to MSVCRT sscanf: input, format, and 29 output pointers. Its call at 0x10003370 uses format 0x10047048, containing 29 %s conversions, then removes 0x7C bytes from the stack. The original instructions and generated C agree; seven destination pointers were lost in the bridge.

The runtime now copies 32 slots, covering the observed call while preserving the copy area's 16-byte alignment. native32_probe.py reproduces the runtime change. native32_probe.c exercises a 31-argument native MSVCRT sscanf call through an NX guest callback and checks all 29 outputs. It and the existing native runtime, exception-frame, callback and loader tests pass.

REA evidence: ev_fdfdb2b6f24f04ee17ed2f38006595b604a59433ae9c9e19f8e480fc0cc69837. The decompilation, exact byte audit and findings are retained under work/game-14.9.1/ccr-sscanf-*. The REA session was closed afterward.

No production generated game-function body was manually edited. The version-specific fix is in the native runtime. Image addresses, imports, dispatch tables and exception-continuation metadata were regenerated together.

Observed execution

The corrected experiment executable ran as PID 28360, character 62, for 120.07 seconds before the verifier intentionally terminated and waited for it. Its native F12 screenshot was taken 26 seconds after launch, with the world, BB, building behind it, northeast compass direction, and classic GUI visible.

Keypad-0 started movement and W stopped it. The server recorded:

13:03:33 Character 62 action=1 position=[960 16.375 510]
13:03:39 Character 62 action=1 position=[953 16.375 503]
13:03:39 Character 62 action=2 position=[953 16.375 503]

The three identical chat lines in stock and rebuilt 14.9.1 have zero differing white/red foreground pixels in (0, 690)-(250, 750), without smoothing or alignment changes. Both masks hash to 39c29ba641b6a8549dbc6e09f85a0da2e8200e02d1157ea7af840332b0fcefc4. This checks the pictured glyphs, not every font or string. The rebuilt PNG hash is 2f2a0ccfc23f3c9062763d1982fe6197d63c14fb73d43b93f3ff385ac50d3757. The displayed capture is from the subsequent Make-built executable, PID 11968, taken 42 seconds after launch; the initial experiment capture remains local.

Evidence is in local/client/game-14.9.1: completion-audit.json, verification-28360.json, run-28360.log, stderr-28360.log, movement-28360.json, font-comparison.json, and runtime-tests.log. The initial failed run is retained separately as PID 20812; a crash dialog was not counted as successful startup.

Editable Make build

A full build from an empty build/ compiled all 561 units: 556 generated game files, the dispatch table, and four runtime files. All exported game C matches the generator output byte-for-byte (509,623,346 bytes). Recreating the 34 image inputs with prepare_images.py also produces identical bytes. The root Makefile subsequently reported nothing to rebuild.

The Make-built executable SHA-256 is 9eae12ad4432015d4970b30726281787014ebd2a5604e25b503223f7348e2e4e. Its native-module inspection found only ace.dll and mss32.dll loaded from the original client directory; no original game DLL was loaded natively. PID 11968 (character 63) rendered the captured BB scene and stayed alive for 120.29 seconds before deliberate termination and cleanup. Build and comparison records are make-cold.log, make-root-noop.log, export-audit.json, and native-modules-11968.json in the experiment directory.

The source-edit test inserted a trace into the generated hr.dll entry and used the same Makefile. Only client/hr.dll/lifted-0000.c recompiled before the link step. The trace executed in PID 2300 (character 64), which rendered BB in source-edit-2300-66.png and survived 120.26 seconds. The modified executable hash was a7d3cf7940491ee836f6d081629605a2a32fa1228ce5e2f4b96b55fda9acc12c. The test restored the original source, object and executable bytes; the export audit then reconfirmed that all 556 production C files match generated output. The log recorded 12 first-chance C++ exceptions while rendering continued; these were not treated as crashes or proof of general exception coverage.

A subsequent production relink and no-op Make check passed. The final local executable hash is 2f06f4cc13a829a76856ffccd171fe61ef2dfee7380f94cb58fc8fff679723a2. The source-edit proof is source-edit-verification.json; build records are source-edit-compile.log, make-restored.log, and make-final-noop.log.

Reproduction

Use the installed bundled Python and venv packages described in the editable-source README. The initial generation pipeline, which does not overwrite edited sources, is:

python tools/client/inventory.py
python tools/client/native32_probe.py
python tools/client/build_game.py
python tools/client/link_game.py
python tools/client/audit_game.py
python tools/client/export_game.py

Export stages a fresh tree in decompiled-14.9.1 and refuses to overwrite its source/runtime/image directories. Normal editing uses client/ and the root Makefile instead. Generation is based on pcrecomp commit 904ac3129d0c9d05efbeec19a1dce6abbe7f5d26 with the existing local discovery, instruction and C++ exception fixes. It uses pefile 2024.8.26.

Start the isolated 14.9.1 server described in stock validation, then run:

python tools/client/verify_game.py client/build/windows/game.exe
python tools/client/test_game_source_edit.py
python tools/client/compare_game_capture.py

The verifier supplies the approved BB position, direction and afternoon time. For automated visual capture, send capture_game.js to the Computer Use Node REPL after initializing sky; use its JavaScript directly, not string eval. F12 writes the actual DirectDraw frame. Windows Graphics Capture remains unreliable for this game's world surface.

Limits

This establishes native generated-C world rendering, input and networking with the development server. It does not establish full gameplay equivalence or a portable/WASM build. Windows/DirectX, vendor libraries and the x86 ABI bridge remain dependencies. Original game images provide data/resources/layout, but their pages remain non-executable; unknown guest targets fail explicitly.

The native bridge has a finite 32-slot limit. General SEH, all possible C++ exception paths, arbitrary DLL unloading and broad gameplay remain outside the validated scope. The isolated server retains the earlier development data and protocol adaptations; it is not a complete 14.9.1 content implementation.