aorecomp

Anarchy Online classic in the browser

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


docs/reverse-engineering.md (13402B)


Resuming reverse engineering and reading evidence

Use the original shipped client and its saved evidence for protocol claims. Ordinary analysis of the Go/Python source does not require native REA analysis. Do not run a new decompiler session merely to read an already retained result. The tool paths and recovery experiments below were recorded on 2026-10-12; they are historical investigation context, not requirements for future tools.

Original binary identities

These SHA256 values were recomputed from old_wip\clients\original-11.0/Gamefiles during the documentation handoff. Addresses in the protocol notes refer to these 32-bit PE files, not the modern installation. Most DLL addresses use image base 0x10000000; executable addresses commonly use 0x00400000. Keep virtual addresses, file offsets, export names, and actual procedure entries distinct.

Binary SHA256
anarchy.exe d739724f4c852dcbe1579b693f1b42c193a04e69df737b8f3e121a1a4caaa529
Clientr.exe e529a9a327a0d3a0d878c1125f01e2d005458c3ab6ab3c606c9ff8210bc83228
ffr.dll db3d15e99bab9289595ecfeca090d5f3b60942f5242db212f8b022ef9f187275
er.dll f36d7820adb97439421f56aad7502ef4da51ac58541afc934eefaf2b5ed197e8
nr.dll 40c0b1490a395c75267df571daba5763519d4d15bb948fb0158f61d5fa8f8abd
llr.dll 863205715f80f05470cfa3201d586b7db5fb6843cace6b638c8ea08a29c09156
kkr.dll 01ad7624eebc42c23b5a2ac9d90554e484d5a07c374cb6516df114ad52e80d5a
ddr.dll 6145c5ee5b26f427dee8cbad6f9de173427b0087ad63d859ca63244d66f7e95c
qqr.dll f833d5e6d79f9391196a17aa08449be1b8f1f7e65b4e44205117058fee8f4b74
bbr.dll 50994e37be641173d182faa493f8e989c72d66fbd785e007ea2f720b7682428f

The qqr.dll value is retained in its analysis snapshot rather than recomputed in this handoff. Verify a hash before interpreting an address in a changed file.

Retained evidence and snapshots

Portable *-evidence.json REA bundles normally contain top-level records plus artifact/provider/environment metadata. Each record has an evidence ID, operation, parameters, subject, normalized result, confidence/authority, and limitations. Static pseudocode is an interpretation of shipped bytes; it is not a runtime observation and may have uncertain types or function boundaries.

*-analysis.json files are importable REA analysis snapshots. Their top-level keys are binding, entries, evidence_bundle, target, and workflow_entries. Binding includes provider and analysis profile; target includes the binary SHA256. Import requires a matching target, provider, and canonical profile. These snapshots preserve cached evidence and metadata, not a guarantee that every future native query will avoid fresh Ghidra initialization.

Evidence bundle Primary target and topic Snapshot to consult
launcher-evidence.json anarchy.exe: dimensions, login, character list, framing launcher-analysis.json
clientr-evidence.json Clientr.exe: startup arguments clientr-analysis.json
network-client-evidence.json ffr.dll: redirect and cookie network-client-analysis.json
network-client-crash-evidence.json ffr.dll: logged-in/error event distinction, failed acknowledgement network-client-analysis.json
transport-evidence.json er.dll: TCP input and packet transport transport-analysis.json
message-evidence.json nr.dll: N3 envelope and compression message-analysis.json
engine-evidence.json llr.dll: N3 key hashing and base/playfield serialization engine-analysis.json
skin-engine-evidence.json llr.dll: appearance and named texture list skin-engine-analysis.json
vehicle-evidence.json qqr.dll: vehicle serialization vehicle-analysis.json
world-evidence.json kkr.dll: original world, SCFU, FullCharacter world-analysis.json
multiplayer-evidence.json kkr.dll: peer visibility and movement world-analysis.json
appearance-time-evidence.json kkr.dll: game clock and head mesh world-analysis.json
hands-evidence.json kkr.dll: named textures and original hand resources world-analysis.json
npc-native-evidence.json kkr.dll: latest population/patrol/native investigation world-analysis.json
npc-motion-native-evidence.json kkr.dll: movement controls, speed, follow/update readers npc-motion-analysis.json
zoning-evidence.json llr.dll: original teleport, redirect, despawn skin-engine-analysis.json
login3d-evidence.json ddr.dll: 3D login flow login3d-analysis.json
terrain-native-evidence.json bbr.dll: archived grid dimensions, delta decompression and interpolation assembly No snapshot retained

All table paths are under tools. The kkr.dll bundles are cumulative exports at different stages and contain overlapping records. npc-native-evidence.json is the kkr.dll export used for this record, with 87 records on 2026-10-12. Do not count repeated records in different exports as independent corroboration. Some llr.dll zoning records are retained in later snapshots as well; inspect their embedded records rather than assuming a file's name covers every operation.

The following files have different schemas:

Their historical server digests identify the experiment that produced them; they are not hashes of the current rebuilt server.

Read an evidence record without dumping the entire bundle

Large JSON files are often one line. Running rg on a broad term can print an entire megabyte line and obscure the useful result. Parse the file and select an evidence ID, procedure, or operation. For example, save this as a temporary Python script and run it using the venv from the workspace root:

import json
import pathlib

bundle = json.loads(pathlib.Path('local/reports/world-evidence.json').read_text())
record = next(record for record in bundle['records']
              if record['evidence_id'] ==
              'ev_543348b5eee9f00a2282718dec7eb1671e38df0f9c96fc8c1b4102659b79aa54')
print(json.dumps(record, indent=2))

Batch decompile records have normalized_result.items, with procedure metadata and pseudocode per item. Search results usually have an array of address/value matches. Inspect the selected operation's actual schema. Preserve its limitations when documenting a conclusion.

REA tools and recovery on this PC

The installed skill is .agents/skills/reverse-engineer-anything/SKILL.md. Read it and its native/artifact guide before a fresh native investigation. If registration is missing or a provider is unavailable, use its connection and recovery guide. Installed skills and installed npm packages do not themselves prove the MCP tools are connected in a new Codex session.

The investigated environment used REA 6.4.0, Ghidra 12.1.4, and Java 21. Example tool locations (adjust for your installation):

Node: C:\Program Files\nodejs\node.exe
Ghidra: C:\tools\rea-tools\ghidra_12.1.4_PUBLIC
Java: C:\tools\rea-tools\jdk-21.0.12.1+1
REA entry: node_modules/rea-agents/scripts/rea.mjs
MCP SDK: same node_modules directory, under @modelcontextprotocol/client/dist

The npm cache path is incidental and may change. Use connected tools first. Do not upgrade working tools or edit configuration just to repeat a saved query.

A focused native session typically consists of:

  1. open_binary with the original absolute binary path and matching snapshot_path.
  2. search_strings/search_procedures for the specific feature, or xrefs from a retained string/entry address.
  3. Resolve containing procedures before decompiling interior call addresses.
  4. batch_decompile explicit canonical entries; retain each result and uncertainty.
  5. export_evidence_bundle to a workspace path.
  6. close_binary with the matching snapshot_path and overwrite enabled.

Check the actual tool schemas in the future session. Reopening, provider switching, missing functions, and unresolved labels should be explicit; never silently substitute a modern binary or an unrelated procedure.

Slow Ghidra startup and the prior SDK workaround

New kkr.dll analysis queries sometimes required six to seven minutes of Ghidra startup, exceeding a roughly five-minute MCP call timeout. Importing cached snapshot metadata could complete quickly while the first uncached query still required that startup. Repeating the same timed-out request did not solve it.

The successful workaround used the official MCP JavaScript SDK to start the existing REA entry over stdio. It supplied these environment values:

GHIDRA_INSTALL_DIR=C:/tools/rea-tools/ghidra_12.1.4_PUBLIC
JAVA_HOME=C:/tools/rea-tools/jdk-21.0.12.1+1
REA_GHIDRA_STARTUP_TIMEOUT_MS=1500000

Client setup used Client from @modelcontextprotocol/client/dist/index.mjs and StdioClientTransport/getDefaultEnvironment from its client/dist/stdio.mjs. The transport command was the existing Node executable, with arguments [REA_ENTRY, '--mcp']. Individual calls used:

await client.callTool(
    {name: 'open_binary', arguments: {
        path: 'C:/path/to/ao/old_wip\\clients\\original-11.0/Gamefiles/kkr.dll',
        snapshot_path: 'C:/path/to/ao/local/reports/world-analysis.json'
    }},
    {timeout: 1800000}
);

The temporary helper accepted one JSON tool request per stdin line. A persistent exec session kept the provider alive between sequential requests. After startup, focused queries were fast. Export and close saved the target before stopping the helper. Those temporary helper scripts are not retained; recreate this small SDK bridge only if the same measured timeout recurs. It is an analysis workaround, not part of the AO server or a second REA implementation.

Long-running tool sessions should yield while the agent gives progress updates. Do not block communication with an uninterruptible multi-minute sleep, and do not issue dependent commands before the prior operation has completed.

Runtime evidence and Windows computer use

Use the installed computer-use skill and its currently supported APIs for Windows input/capture. The previous working native path was node_repl with @oai/sky. Native control through cua_repl was disabled in that environment. Browser UI tooling remains a separate capability.

Initialize sky in a fresh REPL, list current windows, and select exactly one returned original-client window by its full process path. Get fresh state, inspect the screenshot, perform one state-derived input, then refresh. Do not reuse screenshot IDs or window objects across a reboot/reset. Read the current skill for supported API details and safety boundaries.

Use the synthetic Python launch helpers for unattended launches rather than automating an authentication dialog. The native launcher remains the normal human launch route. Routine X/quit tests were completed by the agent; do not make the user perform these steps just to finish validation.

The prior press_key API generated short taps, not held keys. Held-W walking was once confirmed by the user; subsequent captures established changing positions and turning. For future long movement tests, inspect the current supported input API or another already authorized game control, rather than assuming a tap tests sustained motion.

Useful runtime artifacts

Files under tools Established observation
milestone.png, movement-evidence.json Original training rendering and movement capture.
multiplayer.png, runtime-evidence.json Two-client visibility and scene evidence.
npc.png Original Leet rendering/selection.
borealis.png Original Borealis arrival.
daylight-heads.png, appearance-runtime.log Head correction and live daylight behavior.
default-hands.png, skin-hands.jpg, hands-fixed.png Default green texture, original skin resource, applied correction.
control.jpg, control-dropdown.jpg Plain HTML controls and full zone list.
quit-runtime.log, quit-verified.log Captured sit/stand/logout and successful normal quit test.
quit-final.log, quit-complete.log Cancellation experiments; connection survives beyond the cancelled deadline.
npc-terrain-before.png, npc-terrain-after.png Isolated temporary Leet moving over the Omni Training hill.
npc-terrain-live-packets.json Live NPC altitude changes checked against independently sampled archived terrain.

Logs are historical observations, not an inventory of currently running processes. Derive runtime state from processes/listeners and fresh captures.