aorecomp

Anarchy Online classic in the browser

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


docs/reconstruction-feasibility.md (50037B)


Native reconstruction feasibility: 13.2 historical baseline

The selected target is now 14.9.1; see the current round-trip report. The report below records the earlier 13.2 experiments. Their editable source is preserved locally in old_wip/decompiled-13.2/; the root client/ tree now belongs to 14.9.1.

Inspected and tested 2026-10-14 against the selected client-target installation, whose version marker is 13.2. See binary inventory for the complete module inventory and API dependencies.

The editable source tree is now at client/ in the repository root. At the user's request, generated game C and runtime sources are included in Git. The root Makefile builds them directly into client/build/windows/game.exe; normal builds do not invoke the decompiler or overwrite source edits. The local/client/game paths below refer to the retained feasibility experiments and their evidence.

The new Makefile completed a cold build of 472 compilation units (467 generated game files, dispatch, and four runtime files), linked successfully, and passed no-op and single-source incremental rebuild checks. Its executable SHA-256 is 13cb63971695d9f16690c9dfadddbbe3ca8c099b97cf893b68b37f210c3fc56d. PID 28336 (character 39) visibly rendered Omni Training, survived the 60-second verification interval, and was terminated and waited for; no game or dxdiag process remained. The screenshot is client/build/verification-28336.jpg; logs and the executable path are in work/game/verification-28336.json and work/game/run-28336.log. Build logs are work/game/root-make*.log.

The requested reconstruction scope is the actual game: Clientr.exe and its 33 game DLLs. The user explicitly excludes the launcher, patcher, and separate utilities (Anarchy.exe, AnarchyPatcher.exe, ap.exe, and SpeedRead.exe). Third-party libraries remain native dependencies. Earlier launcher experiments are not requirements for completing the game reconstruction.

The initial isolated result was a pcrecomp-generated C baseline for three complete DLL export graphs: dr.dll, hr.dll, and ir.dll. They compile into independent 32-bit Windows DLLs and pass native differential tests against the original DLLs. The game also entered Omni Training and accepted movement with the rebuilt hr.dll verified as loaded. hr.dll is the more useful application milestone because the game statically imports it.

The larger experiment now compiles and links generated C for all 34 scoped modules into one Windows host. It connects to the local world server and continuously presents frames through DirectDraw. After Computer Use approval, activation and keyboard input succeeded, and the server received movement start/stop messages from the fully generated client. The user and automated screenshots now confirm a rendered Omni Training world, characters, and UI. Movement and stopping are now verified by screenshots and changed client-reported coordinates at the server. Broader gameplay remains unverified. The earlier automation hangs were approval waits, not demonstrated game input failures. Runtime and generator fixes are described below; this establishes native generated-C startup through a visible world, not full behavioral equivalence. Generated game function bodies require no manual edits in the production build.

Verified native source baseline

The requested native baseline is established for all 34 scoped game binaries. Their generated C is linked into one work/game/game.exe, rather than 34 new drop-in modules. Vendor libraries and Windows/DirectX remain native. This is the Windows reconstruction milestone, not the later portable/WASM milestone.

Requirement Current evidence
All actual game binaries accounted for audit_game.py checks the complete 51-file inventory against 34 game modules, identified vendor exclusions, and excluded launcher/utility executables.
Binary-to-C generation 44,566 discovered entries, including every scoped module entry point and executable export, with zero reported unsupported instructions. Generated sources, compiler command fingerprints, and all 467 object records pass the audit. Discovery counts do not prove every possible computed target is known.
C-to-Windows build link_game.py links all audited objects and dispatch entries with 32-bit clang 23.1.3. Production SHA-256 is b671c4d783c9e56630d936d8a938d45e642d7b7162e903d469e60a35bc981620.
Original game code is not an execution fallback The host maps all 34 game images non-executable, requires DEP, intercepts guest module loading, and rejects unknown guest targets and requests to make guest pages executable. Original images remain local data/layout inputs.
Game executes and renders User observation and automated captures show Omni Training, characters, animation, and UI. Timed captures at 20/35/50 seconds are retained from PID 8404.
Input, simulation, and networking work together Production PID 11212, character 38, accepted keypad-0 autorun and W to stop. Server-received coordinates changed from [52.625, 14.01, 59.875] to [52.45286, 14.01, 67.67362]; screenshots show displacement.
Generated source is editable and rebuildable test_game_source_edit.py temporarily inserts a trace into generated hr.dll entry sub_310012E1, compiles and links it, and asserts the trace executed in a 60-second game run. PID 24284 rendered the world. Production source, object, executable, and link log were restored exactly afterward.
Originals remain unchanged The final audit rehashes all 51 original EXE/DLL files successfully.
Each test client is cleaned up The bounded verifier terminates and waits in finally; its host job contains the vendor helper. Verification reports record exit, and the final process check found no game, Clientr, or dxdiag process.

Evidence is local under local/client/game: completion-audit.json, source-edit-verification.json, source-edit-compile.log, verification-11212.json, run-11212.log, movement-11212-before.jpg, movement-11212-after.jpg, and movement-11212.json. The movement messages are preserved with their original timestamps in that last file. The diagnostic stderr log contains six C++ exception observations (e06d7363), followed by continued rendering and movement; the client remained alive until the verifier deliberately terminated it.

The source-edit test intentionally changes a generated function for verification; it does not add a permanent hand-maintained patch to generated game bodies. Run it only with other client runs stopped. The final production audit was repeated after restoration. The tested edit changes a diagnostic side effect, not gameplay semantics.

This verifies a working editable native baseline, not every gameplay path or binary-perfect behavior. Remaining runtime limitations below include general SEH, libpng error-path longjmp, thread notifications, and DLL unloading. The runtime still models x86 registers and uses an x86 Windows ABI bridge. Keep the strict missing-target failures and extend regression coverage as individual subsystems are changed. The recommended next work is to separate one platform boundary while retaining this native build as the regression reference.

These builds replace each DLL's original CRT/DLL initialization machinery with the current compiler's startup code. They reconstruct the exported game logic, not every byte or every startup function of the original DLL. Neither replacement contains the original executable .text bytes or delegates its game logic to the original DLL. Original data is retained locally where the lifted code needs it. The surrounding game remains the original native executable and DLLs.

Results and exact versions

Tool Revision inspected or executed Actual result
pcrecomp 904ac3129d0c9d05efbeec19a1dce6abbe7f5d26 Executed: standalone dr/hr/ir differential tests pass; game moves with rebuilt hr/ir. All 34 game modules now lift to C and compile/link into a GUI host with visually verified world rendering and input-to-network processing; broader generated gameplay remains unverified.
CnCNet petool 17ca90af4dcac09c49fd719cfd6856e645a300c7 Executed on dr.dll: tool builds, project generation succeeds, default GNU link exits successfully but produces an invalid reconstruction with zero sections. Object-based DLL link crashes the linker. No working replacement or C patch demonstrated.
DDisasm Source version 1.9.6, 1d17f292e3672078eeb753473847306ca3f0f1ff Source/documentation reviewed; not installed or executed on AO.
gtirb-pprinter Source version 2.2.6, 4f251d9d6df3e274beaad93998eed6f34f506852 PE32 DLL assembly/linking implementation reviewed; not executed on AO.
xwa Upstream README/site reviewed only Companion-project reference; implementation was not evaluated and no AO experiment was run.
recomp-kit, WindowsRecompTool, Unicorn, reccmp, Rebrew Not tested No performance, correctness, or AO compatibility claims.

The native compiler is the existing llvm-mingw-20261006-ucrt-x86_64 distribution, using bin/i686-w64-mingw32-clang.exe: clang 23.1.3, commit 0d261d1ca552c95a8f007e061c787ac7132fbcbc. Python is 3.12.14, with capstone 5.0.7 and pefile 2024.8.26. The petool link experiment uses the existing GNU PE ld.exe from the Rust Windows GNU toolchain; exact commands and diagnostics are saved with the experiment. No compiler or linker version is inferred from the name of its surrounding Rust toolchain directory.

Reproduce the successful C builds

Run these commands from C:/path/to/ao. The venv executable is stale in this environment, so the working bundled interpreter uses its installed Python packages. The pcrecomp checkout is local at local/references/reconstruction-reference/pcrecomp and must be at the revision above.

$env:PYTHONPATH = 'C:/path/to/ao/venv/Lib/site-packages'
& 'python3' old_wip/reconstruction/build_dr.py
& 'python3' old_wip/reconstruction/build_hr.py

& 'python3' old_wip/reconstruction/test_dr.py
& local/client/hr-test.exe

The scripts verify the input hashes before generating files:

Input SHA-256
client-target/dr.dll e43d7323092d4b6ce6039a787ab4925621ad09ff2775728d8bd33356f93faa0a
client-target/hr.dll eaf5dcd428234a395245aedc1f77098e7774cc8fec01914c4bec87ca89192078

Both builds verify original export names/ordinals against their output. All 51 source-module hashes were reverified unchanged after the experiments, and the pcrecomp checkout remained clean.

Build/test output is retained locally in work/dr-build.log, work/dr-test.log, and work/hr-test.log beneath tools/client.

Both builds use pcrecomp's tools/lift/translator.py for PE loading and function discovery, and tools/lift/lift32_cpu.py for C emission. The selected bounds are written to work/dr-functions.txt and work/hr-functions.txt. No upstream lifter changes are required by these successful builds. Generation fails if emitted source contains RECOMP_TODO, rather than silently accepting unsupported instructions.

Handwritten code is in tools/client/*_bridge.c; mechanically generated C, data headers, export definitions, compiled DLLs, and harness executables are in the ignored local/client directory. Rebuilding does not overwrite handwritten wrappers. The compiler receives generated C through the bridge translation unit, with -shared -O2 -fno-strict-aliasing; the hr build also links winmm for timeGetTime.

The explicit CPU structure is a compile-time representation of registers and flags. Each instruction's effect becomes C compiled to native code; the result does not interpret original x86 instruction bytes at runtime. Calls dispatch by original function address. Each public invocation owns its CPU and scratch stack, so independent calls do not share emulated registers. Guest pointer values are real 32-bit host pointers in this milestone.

dr.dll: checksums and MD5

The export call graph contains nine distinct functions. Four C ABI wrappers expose updcrc, MD5Init, MD5Update, and MD5Final. The original .data content is retained for the lookup tables and constants; original executable bytes and CRT startup are excluded.

The native harness loads the original and rebuilt DLLs simultaneously and checks:

Observed result:

PASS: MD5 known vector; 16388 native differential cases across four threads
PASS: all lengths 0..4096, CRC returns, incremental MD5 states, output guards

The same tests also pass for work/dr-hybrid.dll, which substitutes handwritten dr_md5init.c for the generated MD5Init function while retaining eight lifted functions. test_dr.py regenerates the hybrid separately; it leaves the generated baseline and original binary untouched. The handwritten implementation uses the same CPU * boundary and dispatch identity, so public callers continue to use the existing DLL export. This demonstrates an editable generated/handwritten C build, not original-assembly interoperability.

This establishes execution of the reconstructed export graph, concurrent invocations, and a tested handwritten replacement. It is not evidence that all larger game DLLs will lift correctly.

hr.dll: timer classes and floating-point ABI

The 21 exports refer to 19 distinct functions. Constructor/assignment aliases share implementations. Explicit wrappers preserve the Microsoft x86 thiscall receiver in ECX, callee stack cleanup, C-style operator calls, hidden result pointers, returned object pointers, and x87 float return convention. The build asserts exact equality of export names and ordinals with the original DLL.

The exported code uses two external operations: timeGetTime and the _ftol conversion thunk. The former calls the real Windows API. The latter is expressed in C as truncation to a signed 64-bit value, with integer-indefinite handling for NaN, infinity, and values outside the representable range. The original CRT's allocation and startup dependencies are not required by this exported graph.

The harness calls every export in both loaded DLLs. It patches only their loaded timeGetTime import slots inside the test process to provide the same clock; original files remain unchanged. Tests cover:

Observed result:

PASS: all 21 hr exports, 1014 numeric cases, controlled clock and rollover

This is substantial behavioral evidence, not universal floating-point equivalence. The pcrecomp CPU runtime stores x87 values as double, not x87 extended precision, and does not reproduce the caller's complete FPU control word, exception masks, or exception-status side effects. The tested arithmetic and timer cases agree under the test process's normal environment. A future module with numerically sensitive x87 code needs explicit precision/control-word tests. The hr timer's shared initialization state is retained; its concurrent first-use behavior has not been independently validated.

Application milestone

The original client launched from an isolated working copy and entered Omni Training (baseline process 28032). The replacement run (process 7984) also entered Omni Training and walked after KP_0, then stopped with W. The local server logged character 8 moving from [52.625, 14.01, 65.875] to [52.460117, 14.01, 67.67337], with action 1/action 2 events.

The live process module inspection verifies:

Module: hr.dll
Process: 7984
Path: C:\path\to\ao\local\client\client\hr.dll
Load base: 0x74200000
SHA-256: 3436bce13daadea1f00137f4ef2fa2bcd2b6a4a3f0bfea3fc593f600838bbfed

Local evidence is retained under local/client: baseline-modules.json, rebuilt-modules.json, baseline.png, rebuilt-startup.png, rebuilt-walking.png, game-smoke.txt, and server logs. Both replacement DLLs were copied only into the isolated client. dr.dll was not loaded in the observed game process, so the game run is application evidence for hr only; dr has standalone differential evidence.

prepare_client.py creates the isolated original-client and server-data copies. It copies originals over an existing experiment directory, so preparation belongs before installing replacement DLLs. launch_client.py obtains a synthetic local session from the existing localhost server and directly starts Clientr.exe. The launch bypasses the original launcher and login UI; no login-screen claim is made. The isolated server ran as process 12496 from work/server.exe with work as its working directory, using the copied work/data. The replacement client was left running for inspection at completion of this experiment.

For a fresh reproduction, close experiment clients before preparing the copy. Use an available localhost server or start the isolated server below; do not start another server on ports already occupied by this experiment. Go's VCS stamping is disabled because this checkout's ownership prevents its Git metadata probe in the current environment.

& 'python3' old_wip/reconstruction/prepare_client.py
go build -buildvcs=false -o local/client/server.exe ./server
$experiment = 'C:/path/to/ao/local/client'
Start-Process -FilePath "$experiment/server.exe" -WorkingDirectory $experiment -WindowStyle Hidden -RedirectStandardOutput "$experiment/server.stdout.log" -RedirectStandardError "$experiment/server.log"
& 'python3' old_wip/reconstruction/launch_client.py

Observe the original baseline, close that experiment client, and wait for its printed process ID to exit before continuing. Install the replacements and launch the same copy again:

Copy-Item local/client/hr.dll local/client/client/hr.dll
Copy-Item local/client/dr.dll local/client/client/dr.dll
& 'python3' old_wip/reconstruction/launch_client.py

The highest achieved milestone is a native game entering its world and accepting movement with a statically recompiled C module actually loaded. This is a useful game smoke test, not exhaustive gameplay validation, a complete source build of the game, or a Linux/WASM build.

petool: bounded experiment on dr.dll

Reproduce the preserved experiment with the same Python environment:

& 'python3' old_wip/reconstruction/petool_experiment.py

The script compiles the pinned upstream C files and generates the project from the immutable input into work/petool-dr. Existing generated projects are reused. Logs are local under local/client/petool-*.log.

  1. petool compilation and genprj succeed.

  2. An initial ld.lld invocation rejects the GNU linker flags --section-alignment=0x1000 and --subsystem=windows. That is a linker-driver mismatch, not evidence about AO reconstruction.

  3. The available GNU PE linker accepts the generated script:

    ld.exe -m i386pe --section-alignment=0x1000 --subsystem=windows -T drp.lds -o drp.exe
    Exit: 0
    

    Parsing that output reveals zero sections, characteristics 0x306, image base 0x400000, and entry RVA 0x0fc01c6b. A successful linker exit therefore did not produce a usable reconstructed DLL.

  4. pe2obj succeeds. The smallest DLL-oriented retry uses the converted object in the linker script, --dll, and --image-base=0x10000000:

    ld.exe -m i386pe --dll --image-base=0x10000000 --section-alignment=0x1000 --subsystem=windows -T dr-object.lds -o dr-object.dll
    Exit: 3221225477 (0xc0000005)
    

    The linker crashes. No replacement DLL was loaded, and no C function patch was demonstrated through this path.

The source explains why treating the default output as a DLL is insufficient: genmak.c always emits an EXE target and restores only the import data directory; genlds.c pins original sections and handles virtual-only tails/resources specially. Exports, DLL characteristics, relocation handling, and globals need verification. pe2obj preserves original machine code; it is not decompilation. See genmak.c, genlds.c, and pe2obj.c.

The README documents entry-jump patches and external C objects as its incremental replacement mechanism. Such a patch can intercept callers that target the patched entry, including function pointers, but does not automatically cover interior entry points. This experiment did not reach that stage. Repairing the GNU linker/template path is a separate investigation, with no reliable effort estimate from the present failure; it is not justified before using the already working C DLLs. petool README

DDisasm: supported design, unexecuted locally

DDisasm genuinely supports PE and x86-32. The GTIRB PE printer handles DLL selection, entry points, import libraries, exported ordinals/data, and resources. For PE32 it selects ml.exe, lib.exe, and link.exe, with UASM/LLVM fallback paths. Lack of PE32 output support is not an established blocker. PE printer source

The upstream x86 Windows tests include DLLs, C++ exceptions, virtual dispatch, and SEH with/without SAFESEH; thread-local/thread tests are still TODOs. These tests show intended coverage, not AO correctness. Windows x86 tests

Open issue 86 reports missing preservation of delay-loaded imports through DDisasm/GTIRB printing. Check a chosen module's delay-import directory before an experiment; this limitation should not be attributed to AO modules without that evidence. Delay-import issue

No working local DDisasm executable was available. WSL distribution enumeration worked, but a command probe hung and was canceled; this does not establish that WSL itself is unavailable. No AO disassembly/reassembly was executed with this tool. The following is an unexecuted minimal experiment for a configured x86 MSVC environment, from a separate output directory:

ddisasm C:/path/to/ao/client-target/dr.dll --ir dr.gtirb
gtirb-pprinter dr.gtirb --asm dr.asm
gtirb-pprinter dr.gtirb --binary dr.dll

Installation/build setup would be required first. A successful result would establish reassemblable native x86 source, not portable C. It is a reasonable fallback experiment, but no actual AO failure or repair estimate is available.

Extend the shared native32 runtime across all game-owned modules. The small DLL replacements remain useful differential references, but writing individual ABI bridges for every C++ export does not scale to the full client. Keep the original client immutable and run experiments only in the isolated working copy.

The existing builds already provide a small mixed-source model: generated game functions, handwritten MD5Init and ABI/API adapters, and current native DLL startup. They do not demonstrate original-assembly/translated-C callback interoperability or automatic recovery of larger C++ DLL boundaries. For the next DLL, inspect its exports, initialization, cross-module ownership, vtables, callback paths, and runtime requirements before assuming the same small bridge is sufficient.

Keep generated code disposable and handwritten replacements separate. Extend the demonstrated single-function replacement approach only when its entry and callers can be tested through the public DLL interface. Defer broad graphics and network portability while extending the native replacement baseline.

The current model still requires 32-bit pointers and native Windows APIs. Moving it to Linux or WASM will require a deliberate address-space and ABI strategy; the successful native DLLs do not remove those later requirements. All game data and generated proprietary code remain local in ignored directories, and nothing from this experiment was uploaded or published.

ir.dll export reconstruction

build_ir.py translates 36 functions reachable from the two cdecl exports, encrypt and answer_challenge. Original SHA-256: 1270dbc45b92f71044346059251b9053de2953f278a97aa8ac3d501ae3ec5e97. The original CRT initializer list is empty; compiler startup supplies the DLL entrypoint. ir_bridge.c preserves MSVCRT allocation ownership, PRNG state, and imported calls. Data relocations are applied to the retained data image.

ir_test.c passed 1,052 encrypt cases and 64 answer_challenge cases across four threads, including short-key rejection, matching PRNG consumption, unchanged inputs and guard memory, and result buffers accepted by native MSVCRT _msize, realloc, and free. These results do not cover malformed hexadecimal keys or allocation failure. REA evidence is retained in work/ir-rea.json.

An isolated game run installed rebuilt dr/hr/ir and confirmed hr and ir loaded from the experiment directory, with their hashes captured. The local server recorded character 10 in playfield 950 and movement actions. dr was not loaded. The Windows capture showed a black client surface, so this run does not verify rendering. verify_client.py retains module evidence in work/ir-client-verification.json and terminates/waits for the client in a finally block. Both clients used during verification were confirmed exited. work/ir-game-smoke.txt and work/ir-client-capture.jpg retain the server and screen evidence. This extends the loaded-module milestone, not the whole-game reconstruction milestone.

$env:PYTHONPATH = 'C:/path/to/ao/venv/Lib/site-packages'
& 'python3' old_wip/reconstruction/build_ir.py
& local/client/ir-test.exe C:/path/to/ao/client-target/ir.dll C:/path/to/ao/local/client/ir.dll

Shared native32 runtime and full-module translation

native32_probe.py prepares a local copy of upstream native32 for the installed 32-bit clang compiler (-fms-extensions and <intrin.h>). The original upstream checkout stays unchanged. The patched runtime rejects attempts to execute original mapped code, including code embedded in data sections. Every mapped image page is non-executable, process DEP is checked, and missing guest targets terminate with a diagnostic. Upstream's optional native-execution fallback is disabled. These are execution guarantees for mapped game images; host import routing must also prevent native loading of another original game DLL.

The adapted upstream selftest and a separate two-module probe pass. The latter checks Windows-to-generated-C callbacks through execute faults, nested calls between native and generated functions, floating-point return values, and failure on unknown data-section targets or explicit original-code execution. The upstream test's lexical SEH block is replaced with a VEH observer because the GNU compiler target cannot emit that test's MSVC SEH construct. The asserted exception behavior is retained. Logs are under work/native32.

build_game.py covers the 34 actual game modules. Thirteen identified third-party modules and four separate launcher/patcher/utility executables are excluded explicitly. Originals are hash-checked against the inventory. Relocatable images receive distinct addresses in ignored copies. work/game/scope.json records the address mapping and exclusions.

The bulk pipeline uses pcrecomp's global-register C generator with exception resume metadata, generates all discovered functions, and compiles small C translation units. Unsupported instruction sites abort with an explicit diagnostic if reached. translation.json records completed module compilations; per-module unsupported.json files record instruction gaps. Discovery is not proof of complete executable-code coverage. This pipeline is under development: compilation counts do not establish a linked or running whole-game replacement.

The complete game scope now compiles and links: 34 modules, 44,566 discovered entries, 3,847,927 emitted instruction instances, 467 object files, and zero reported unsupported instructions. The first fully linked work/game/game.exe was 216,219,136 bytes. In the first complete run (PID 20388), all imported DLL initializers completed and execution reached the translated Clientr entrypoint. The run then exited with code 3 because the host refused the vendor dxdiag.exe child. The diagnostic was in the game's redirected stderr.txt, preserved as work/game/stderr-20388.log, alongside run-20388.log and verification-20388.json. This establishes full compilation/linking and startup execution, not a functioning game session. The client exited and was waited for.

The host now permits the inventoried native DirectX dxdiag.exe helper, and verification checks its SHA-256 before launch. A kill-on-close Windows job contains the host and its children. A subsequent run reached an access violation in translated bbr code. Fault diagnostics traced this to MSVCRT _EH_prolog, which cannot use an ordinary native function bridge because it constructs the caller's exception frame. A guest-stack implementation now matches the actual 32-bit MSVCRT helper's registers, frame words and SEH-chain effects in three native-oracle cases (eh_prolog_test.c, run by native32_probe.py).

After that fix, PID 17688 reached a C++ catch but could not resume at 0x25108F40: the generated owner function omitted a block reachable only through exception handling, so no lifted exception frame was registered. Evidence is in work/game/stderr-17688.log and verification-17688.json. The process remained alive for the 30-second observation and was then terminated and waited for; UI enumeration found an Anarchy Error Handling window, but its contents were not captured. This is not evidence of a working game. game_eh.py now adds catch continuations to their owning function's control-flow body and reads catch returns from their actual CFG, avoiding adjacent functions. test_game_eh.py generates C from a synthetic x86 fixture, compiles it, and executes a throw/catch through native32; the catch-only continuation runs and restores the guest stack and SEH chain. An early full-dispatch probe with corrected bbr and cached kkr objects (PID 11572) passed that catch, connected to the local world server as character 19, and received world packets. It then faulted reading address 0x18 in bbr.dll!RResource_t::AddRef (0x250D0C30), called from 0x250852C0 with a null object. UI enumeration again found Anarchy Error Handling. The harness terminated and waited for the client after 30 seconds. The logs are stderr-11572.log, verification-11572.json, and the local server log. This probe used the previous kkr objects while its corrected oversized unit compiled; it does not validate the complete new generation or visible gameplay.

Debug-string capture in the next probe (PID 21272, character 20) identified the resource failure: AO could not find the Instantiate factories for RTriMesh_t and AnarchyGroundDataDB_t. Both are bbr exports, at 0x250C7E80 and 0x2504F1E0. ar!FindCreateFunction (0x240069C0) searches native Toolhelp module snapshots, which omit the manually mapped game DLLs. Its failed search returns null before the resource AddRef. The host must include loaded game modules in this enumeration; suppressing the null dereference would not create the missing resources. PID 21272 was also terminated and waited for.

The host now prepends attached game modules to current-process Toolhelp enumeration, preserving the native entries afterward. A regression uses two independent snapshots, resolves the actual bbr mesh factory export, invokes a test C body through the NX bridge, and confirms inactive guest exclusion and non-executable original pages. The full native32 regression suite passes. This models the game's current enumeration path; the guest portion is read from current loader state rather than frozen when Windows creates the snapshot.

With that fix, PID 7912 (character 21) remained alive for 30 seconds, exchanged world packets, and produced an empty redirected stderr. The harness terminated and waited for it. Rendering and movement have not yet been established for this full generated game. This diagnostic link still used cached kkr objects. Future verification observes for 60 seconds to allow visual and input checks, with the same unconditional termination and wait.

PID 4696 (character 22) survived the 60-second probe with empty stderr and continuing world-server heartbeats. Window enumeration identified exactly one generated-game window titled Anarchy Online. A combined automation keypress and screenshot call hung, so neither key delivery nor rendered pixels were verified. The process was terminated and waited for. Runtime sampling and a separate input call are needed before claiming interactive gameplay.

The next 60-second run (PID 3840, character 23) also had no logged errors. A read-only ten-second sample measured about one CPU core and 3.6-4.05 million indirect calls per second, frequently in bbr matrix/list-sorting code. This establishes active execution during sampling, not frame presentation or input response. The unsynchronized samples and thread CPU deltas are preserved in work/game/runtime-sample-3840.json and .log; the client was terminated and waited for afterward.

A native-client control (PID 5560, character 24, using the earlier rebuilt hr/ir DLLs) completed both the same W input and screenshot operations in about 0.2 seconds. The server recorded movement actions 1 and 2. Its capture was black apart from the game cursor, so window capture alone is not a reliable rendered world check for this setup. The generated client's separate W-only operation hung; that difference requires investigation before interactive equivalence can be claimed. The native control was terminated and waited for; its report is work/game/native-control-5560.json and capture work/native-control-5560.jpg.

The complete corrected generation finished, including kkr, and was linked using the current full dispatch and object list. PID 11740 (character 26) ran for 60 seconds with continuous successful windowed DirectDraw Blt calls after world loading. A temporary runtime diagnostic counted native calls made by bbr!Randy_t::Flip and logged the first 64 and every 500th call, with timestamps and return values. Periodic Blt calls returned HRESULT 0 roughly every 1.1 seconds; this demonstrates continued presentation attempts, not pixel accuracy or measured FPS. The diagnostic preserves arguments, return values and LastError in a focused regression. Logs are work/game/stderr-11740.log and verification-11740.json; the client was terminated and waited for. A static instruction audit also found no missing instruction sites or incorrect loop cleanup in Render, SortList, or SortCmp (work/lift-support/sort-render-instruction-audit.txt). Fresh UI enumeration found its unique Anarchy Online window, but a separate W-only input operation again hung and was interrupted. No screenshot was attempted and no movement was recorded for character 26. The full corrected generation therefore retains the input-verification gap.

Message-boundary diagnostics in PID 19788 (character 27) narrowed this gap: the main Clientr thread continued PeekMessage polling and frame presentation, and observed window-text/focus callbacks entered and returned normally through the machine lock. GetMessage/DispatchMessage counts stayed at 13 while the automation input call hung; no keyboard event or server movement was observed. This does not establish a game input defect: delivery itself remains unknown. The temporary trace capped text/callback events, so its late-event coverage is limited. The process was terminated and waited for. Evidence is work/game/stderr-19788.log, verification-19788.json, and the static pump audit work/lift-support/client-message-pump-audit.txt.

A controlled main-thread host variant (PID 5784) did not resolve the input automation hang; it is not applied to the source. Inspection instead found a PE subsystem mismatch: the generated host was console-subsystem, whereas Clientr is GUI-subsystem. A live WaitForInputIdle query failed with error 1471 (not a GUI process). link_game.py now uses -mwindows. With the original worker-thread host retained, PID 14116 passed WaitForInputIdle immediately and continued polling/presenting throughout the 60-second test. The automation keypress still did not complete or produce observed key messages. Both clients were terminated and waited for. This corrects GUI readiness without claiming that it resolves input delivery.

PID 21120 isolated the automation failure further: sky.activate_window alone hung before any keypress or screenshot was attempted. The generated window's message polling and presentation continued. It was terminated and waited for.

The final normal build was relinked without the temporary message/presentation diagnostics, retaining the GUI-subsystem correction. PID 10808 (character 31) connected to the world server, exchanged heartbeats, survived 60 seconds with empty stderr, and was then terminated and waited for. No client or dxdiag helper remained. work/game/final-build.json identifies this executable (216,377,856 bytes, SHA-256 b671c4d783c9e56630d936d8a938d45e642d7b7162e903d469e60a35bc981620) and confirms all 34 original scoped modules still match their initial hashes. The normal executable is work/game/game.exe; the bounded launcher is verify_game.py. Visible world correctness and real user movement still require verification before this can be called a working full-game round trip.

The next investigation isolated window registration using small visible fixtures with the same NX callback bridge. The native-HINSTANCE fixture (PID 19436) closed normally after its bounded timer, with original mapped pages still NX. The pending sky.activate_window promise subsequently settled with the exact error Computer Use app approval timed out. This is an app-control permission failure, not evidence of an unresponsive window or incorrect guest callback. The earlier game activation calls were interrupted before their eventual errors were collected, so their precise terminal result remains unknown; an equivalent approval wait is the leading explanation. No runtime changes are justified by these inconclusive UI attempts.

The static investigation confirmed Clientr passes its mapped HINSTANCE to RegisterClassA and CreateWindowExA. Whether that affects any real Windows behavior is unproven. A/B fixtures and a native-callback control remain local in work; only the native-HINSTANCE fixture was launched, and it exited with code 0 and was waited for. Neither the fixture nor the game remains running.

The user subsequently approved Computer Use access. With the normal GUI build unchanged, PID 4600 (character 32) completed activation, screenshot capture, and a W keypress immediately. At 08:08:21 local time, the server received movement actions 1 and 2 at position [52.625, 14.01, 65.875]. This verifies input delivery and translated input-to-network processing; equal positions in the brief tap do not prove displacement. The capture shows a black viewport with the glowing game cursor, matching the earlier native-control capture. That observation alone could not distinguish a capture limitation from a real black viewport. Evidence is work/game/capture-4600.jpg, verification-4600.json, empty stderr-4600.log, and the local server log. The 60-second run ended with unconditional termination and wait; no client or dxdiag helper remained.

Repeatable visual verification

With the same normal executable, PID 27388 (character 33) rendered the world visibly to the user and to Computer Use's Windows.Graphics.Capture screenshot. work/game/capture-27388.jpg shows the holo world entrance, scenery, characters, and UI. This disproves a general inability of that capture mechanism to read the game. The cause of the earlier black captures remains unknown; loading, focus/desktop state, and lighting were not isolated experimentally.

capture_game.js is a Computer Use Node REPL snippet for repeated observations. Start verify_game.py, initialize sky as described by the Computer Use skill, then send the contents of capture_game.js directly as the Node REPL tool's code. The REPL does not permit importing this local file or evaluating a source string with eval. The snippet resolves the unique generated-game window, activates it, and captures at 20, 35, and 50 seconds relative to the verifier's recorded launch time. It saves JPEGs and actual elapsed times under work/game. The verifier owns the client lifetime and terminates/waits after 60 seconds, including if the capture routine fails. App-control approval and an available desktop session remain prerequisites.

This procedure was exercised on PID 8404 (character 35): captures completed at 20.127, 35.081, and 50.083 seconds. All three show Omni Training scenery, characters, and UI, with animation changing between frames. Evidence is work/game/capture-8404-{20,35,50}.jpg, captures-8404.json, verification-8404.json, and stderr-8404.log. The latter contains C++ exception diagnostics (e06d7363), so this was not an empty-stderr run. The exception observer logs before handling; these entries alone do not establish an unhandled failure. The run continued rendering, survived 60 seconds, and was terminated and waited for. A black image alone is an inconclusive observation, not an automatic rendering-failure verdict; inspect the successive frames alongside connection/runtime evidence. These screenshots establish rendering, not complete visual equivalence or a gameplay regression suite.

An ignored DirectDraw7 backbuffer capture prototype and pixel/bridge tests are retained in work as a possible diagnostic fallback. It was not linked into the game or exercised against a live DirectDraw surface; the successful ordinary captures did not require rendering-runtime changes.

Another remaining runtime limitation is MSVCRT _setjmp3/longjmp, imported by bundled libpng code in bbr.dll and kr.dll. An ordinary native bridge records its own temporary native stack frame, so it cannot safely implement a later guest longjmp. No observed run has reached that failure. A focused follow-up is the PNG loader with valid and truncated inputs, followed by generated resume labels and guest register/SEH restoration if needed; returning zero from a stub would not implement the error path.

Recovered aliases can duplicate large shared control-flow bodies. In kkr.dll, the initial 100-function translation unit contained 604,408 instruction instances and about 88 MB of C. The generator now splits oversized batches at 16 MiB without splitting individual functions, while retaining ordinary batch filenames and object caches. This limits future recompilation when one function changes. Filtering instructions by the reported function end would create 21 missing branch/fallthrough dispatch targets in this unit, so that apparent shortcut was rejected. The retained investigation is work/lift-support/kkr_extent_profile.json; no extent optimization is applied to the current build.

A full kkr audit of upstream generate.true_extent reduced instruction instances from 1,465,182 to 757,496, but two entries lost known jump-table targets and 2,779 candidates split an original backward edge across generated function dispatch. That can replace a loop with native recursion. Conservatively retaining the original bodies for these candidates leaves only a 1.63% reduction. The full audit is retained in work/lift-support/kkr_extent_audit.json; blanket replacement with this smaller traversal was also rejected.

Compiling the unchanged generated sub_350DB320 body alone took 15.1 seconds at -O1 and 31.5 seconds at -O2 on this host while the bulk compiler was also running. Both compilations succeeded. This is a compile-cost measurement, not a runtime correctness or performance comparison. The bulk build retains -O2.

The following integration bugs were found and corrected during generation:

The host in game_host.c maps all 34 DLL/Clientr images before binding imports, routes dynamic module lookup and loading, patches vendor loader imports, supplies Clientr command-line identity, and runs DLL initialization in dependency order. An empty-dispatch probe mapped/bound all 34 images with zero unresolved imports. With the partial generated dispatch linked, native process 4780 completed initialization in br, lr, hr, aar, ir, cr, nr, er, or, mr, and ar before explicitly stopping at kr, which was not yet compiled into that executable. It exited with code 3. This establishes execution of generated startup code across multiple game DLLs, not game startup completion. The host rejects static PE TLS, guest DLL unloading, and attempts to make mapped game pages executable. DLL thread notifications and general structured exception handling remain limitations.

A later partial run (PID 17600) also completed kr, hhr, and ppr initialization before stopping at bbr, still absent from that link. Evidence is preserved in work/game/run-17600.log and verification-17600.json; the process exited 3. Dynamic loading originally leaked DllMain's register state into its suspended caller. DllMain now enters through the runtime's existing NX callback bridge, which saves/restores the register model. game_host_test.c, run by native32_probe.py, regresses the caller's ECX, stack, current-function value, and floating state, and confirms the mapped page remains non-executable.

test_native_hr.py independently tests the bulk/global-register hr translation against the original native DLL. It maps the rebased image, runs generated DllMain, and invokes all 21 exported addresses through the NX callback bridge. The existing 1,014-case numeric, object-method, controlled-clock and rollover tests pass. These tests exercise the new generator/runtime path, separately from the earlier standalone CPU-structure DLL replacement. Logs are under work/native-hr.

$env:PYTHONPATH = 'C:/path/to/ao/venv/Lib/site-packages'
& 'python3' tools/client/native32_probe.py
& 'python3' old_wip/reconstruction/test_game_eh.py
& 'python3' tools/client/build_game.py
& 'python3' tools/client/link_game.py
& 'python3' tools/client/audit_game.py
# Requires the local development server on port 7500 and prepared work/client.
& 'python3' tools/client/verify_game.py
# Separately verifies a temporary source edit and restores the production build.
& 'python3' tools/client/test_game_source_edit.py

Completed modules can be reused when generator, upstream sources, input hashes, compiler match the saved build state and the recorded objects exist. The link script can also link a partial dispatch for early diagnostics: this intentionally fails on a missing translated target instead of running original code. Verification logs and the termination report are in work/game/run.log and work/game/verification.json.

All future game verification runs must terminate their client process and wait for its exit, including failure paths, before reporting results or replacing DLLs.

For movement verification, first capture and inspect the loaded world. Send KP_0 through Computer Use to start autorun, capture again, allow several seconds of movement, then send w and capture the stopped view. Compare the server's character-specific action positions, not just whether input messages arrived. The older bundled keyboard GIF's Alt+Up shortcut produced only a start/stop tap in this configuration; keypad zero was exercised successfully in the current client. Keep these actions within the verifier's 60-second lifetime.