aorecomp

Anarchy Online classic in the browser

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


docs/research-notes/chat-metadata-research/metadata.md (12807B)


Original 14.9.1 chat references and voice metadata

Research only. No production files changed. Static Ghidra evidence is not a live original-server observation. Complete retained evidence and snapshots are in this directory; manifest.json binds the exports, original DLLs, and source excerpts. All owned REA sessions were closed after export.

Original artifacts: anarchy-vanilla-14.9.1/ddr.dll SHA256 3c937161de8f690351c3c08e158431417cee9ced77a41b677e7123b61a8c9883, ccr.dll SHA256 4c6d8dfc7eaa39044935d94e678ee4ead922decad36ed616a7843dcb51e7c55a. The sessions reused matching local/ignore-research / Knowledge evidence.

Wire grammar (answered)

B is one byte, I is BE u32, S is BE u16 byte count then C-string bytes excluding its terminating NUL, and D is BE u16 count then explicit raw bytes. Null/empty S and zero-length D are exactly 00 00: there is no NUL fallback. Individual S/D count limit is 65535; the enclosing chat body's u16 count also limits the aggregate. Encoder DDR100a5e10 checks output capacity. Its wrapper is 100a5df0. [ev_f9d07bd3cfc274be7766f4f7597b9ffcf345893df6b27a60eb6fc4dba4a9323b]

C2S kind body D contents
30 tell ISD subtype byte 0, then optional records
57 private group ISD optional records only
65 public group GSD optional records only

S2C forms are respectively ISD, IISD and GISD (the extra I is sender identity). Do not prepend a tell subtype to either group D. Actual sender queue10009670 uses buffer+1 for tell, stores queue subtype at buffer[0], and increments the metadata length; groups pass buffer itself. Public tell/reply producer has subtype0. Complete original objdump excerpts are retained in native-ranges.json. [ev_2257b2e1f61464ab1dc90724b71e50f75c04a0f642511d6953a7ec2ff7f3a00b, ev_bc25c7f170f74e891a66a3e732367f4bd5a74d7eb18a94d36404a7bdc6d3cb62, ev_e6044001c6e91114dae6131623138939611ed34f3d5495ac122ef57e15fd61dc, ev_1903cc53cd32f451ef566b2a4df6d9c923774272fada3b290ce84d51e6260f1b, ev_7cbc389c64ec7925fb38fe8fc6d10d58ba346da89444cedd4d6c95b7832f2ddd]

DDR1000b740 emits, in order, zero or one of each:

There is no record count or per-record wrapper length. Reference fields come from object+0,+4,+8, string object+0xc and +0x1c. Voice fields are low8 of object+0 and +4, then string objects+8 and +0x18. The public producer emits no record2. Receiver10008350 accepts record2 flag data, whose bit1 can bypass the Ignore guard; unknown authority makes that unsuitable for client relay. Receiver permits duplicate reference/voice allocations rather than enforcing the public writer's uniqueness. Require bounded exhaustion instead of relying on the native parser to reject malformed/repeated records. [ev_858be4dbba41bcc1c0861b05b5f02add2997252555e3fe476c547efb496a8f17, ev_3811a24be4bed4686060821abd42a4f0caec2b8854ca1f8e764d9db34d1747be, ev_581bcf0bf6503e15f8fe1969ce3f20653429831c94d69ccb7c124a0de882509a]

Reference producers, text and clicking (answered within native UI paths)

Comm RefDroppedMessage10016a70 calls1000c060, gets stored Knowledge reference from RefMan, and creates a ChatReference with three zero integers and both strings initially empty. A stored character reference supplies source identity in ints0/1 (normally50000/character ID), third int remains0, second S receives the cached description, and GetCharName supplies the visible label. A stored item supplies low/high template IDs in ints0/1 and QL in int2, second S remains empty, and dummy item GetName supplies the label. Other Knowledge subtypes are suppressed in this path. Actual item drop10016ab0 calls1000c2f0 and obtains the same three integers from N3Msg_GetReferenceData, then the item name. [ev_e38cd7c6a6a7ffe4b7959de7823b096cfeacf44f1ae4d7a1ef82da7148ea73e3, ev_14530bb779270189ea68f2891f5c114c9714d0c40548b6fc51f5f6ab880e9086, ev_99bc019459a0f93b0647f7830b3e245748e3b10d85f3b628c935241fdbdfc0e0, ev_6a1051dda1a79a60ff0832f20662ba8739190f35f96e7cd646fdc95499999a42]

Important correction: first S is NOT necessarily the inline label. These traced producers leave it empty. CCR TextInput::InsertLink1001ff30 delegates to ATextString::InsertLink10006870, which inserts 0x11 label 0x12 directly into the chat text and attaches the reference. It does not fill first S. Input insertion rejects another link if 0x11 is already present. The received line uses DDR100045d0 -> InsertLink(-1, reference, firstS); the -1 branch attaches the reference without inserting any label or consulting that label argument. Therefore requiring first S to match displayed label would reject native output. [ev_57d2a5d86a2fe54104c47dc42a99bb54ee381110d76365e47bd982aef01ed481, ev_a20336c89f9ec920e293a17af772fc6878efcdc82f5254ff37ac6e139b31c160, ev_c5af1faad05ac54edc9129232df176af81de40e8fc84ec36034a11ff48228b95]

Click chain: Comm::LeftClickMessage10016af0 ->1000c490 ->100052c0 -> ATextString::GetLink100075b0. It scans the inline marker region using glyph widths. If the third integer is0, sends AFCM module0x14/event0x70 with second S as counted text and first two integers as identity. InfoSystem's registration maps this to ShowTextMessage10075800, which copies text into an ATextString and shows it with that identity. If third integer is nonzero, event0x71 maps to ShowTemplateMessage10075b50: QL is third & 0xffff, high template0 becomes low template, and N3Msg_CreateDummyItemID decides whether to show then release the dummy item. No stronger integer acceptance boundary was established; no modern emulator field bounds were imported. [ev_e3c0d2cf9d58dac10f8ed91986f3880f7a082887ce2c1b675772a4d094770bd3, ev_c7b67a088c5920e9475e38701bd78493bb2aed0f16801359eed5d8ac6facd8cd, ev_e8bb84b2babb3f3ed7d339ce0866c1d673f3a654d5748421aeffa3254763938e, ev_dde8d9621e921ed45a49a9e044c7db6e5f53f2ea7d0261cf7553e6679e77ba04, ev_d410fa2bb15e2dbaaeb3b8dc330f7ca754867588a28b82d9b49d7bc18636b131, ev_315a34fb0cb0d5549286e80675cd888053c28f6cfa603cd7c306fbb3a3306033, ev_6150e6a1b00d98aa800447b2a4307dda2f37c14091fff5fa9f992984f1690575]

Practical workflow: create a Knowledge character reference with the native Alt-click/G action (previous reference-research), drag the Knowledge icon to the chat input and release left button, type any surrounding text, then send normally. Item icons can likewise be dropped onto the Comm input. Click the received visible link with left release. Default bindings explicitly name COMMAND_DROP_REF_ON_COMMVIEW and COMMAND_DROP_ITEM_ON_COMMVIEW = LeftRelease, and COMMAND_CLICK_ON_COMMVIEW = LeftRelease, with a Shift alternative outside world-item/character modes. Exact retained bindings are in bindings.txt. [ev_3dff589882a6c4f42e12afb434b594089dd46f9bd63d70e693e8b79b3ec4f06f]

ATextString's UTF8 lookahead can inspect following bytes without individual remaining-length tests; well-formed string/marker validation is prudent. This does not establish all CCR text parsing safe. Cached Knowledge character descriptions are limited to1024 by OR AddCharRef/Load, but that is a producer limit, NOT a general bound on both metadata strings. See the earlier docs/research-notes/knowledge-research/persistence.md and replacement fixture.

Voice production and resolution (answered; audio backend boundary explicit)

DDR1000d540 /voice requires owner raw stat389 mask0x1 and exactly one argument. Tokenizer1000d160 splits whitespace and supports quoted tokens; it copies tokens without case folding or a character whitelist. Zero/multiple args are errors. The effect argument goes unchanged to Voice+0x18. The help lists yes/no/heal/help/inc/run, but the parser does NOT whitelist these six effects: 10001740 requires a candidate with both local .wav and .txt present instead. Consequently custom effect basenames are a native capability. [ev_fe429984672f71b88db53803eba85385817137f25418ea7c16ce041c00bd3556, ev_d3236b0f109ca9b457d57c28d277487a7b6f2741c9b78e1e49d7a894f483b0ce, ev_3d25ae859574836b26f9c808b772943f7191267f170f968a2a1a4201fd7af842]

The two bytes are owner GetSkill4 and GetSkill59. Native mappings10002950 and 10002ae0 are breed1solitus,2opifex,3nano,4atrox (other=>solitus), sex3female, sex2male (other=>male). Numeric out-of-range bytes therefore use fallback, not unchecked enum indexing. Style100021b0 comes from VoiceSndFxType: 0 simple,1 distunguished,2 cool,3 military, other=>simple. The wire/path typo distunguished is literal; display branch uses distinguished. /voicetype10002360 accepts case-insensitive first letters s/d/c/m, not full word equality. [ev_fe2e12e65771b3a6345eeaa463b6a57eaeab187951ebb8abcd5df7c3d306af90, ev_bc1f3ecf30d6e78496764c827fce3cf70641b979c933a4f985738e1115828904, ev_7304569f34f4d62c4e988ac5e9203f4ce2f28e63282b89c5434a18bccd681b74, ev_55f66553760673b402c2658ee3eb31d8abbb1303160a67677560d03f5c03e242]

Builder10002450 tries the following stems in order (literal _ and _01):

  1. nickname_effect_01
  2. breed_sex_style_effect_01
  3. sex_style_effect_01
  4. sex_effect_01
  5. effect_01

Consumers prefix CDPath plus sound/sfx/player/. Existence preflight10001740 requires both extensions. Text lookup10001ce0 uses .txt, fopen(rt), and the first fgets(...,1024) line from the first available candidate. Audio10001a10 uses .wav, stat, then SandyInterfaceModule_t::PlayPlayerFX(path,1.0). These candidate/path constructions all use dynamic std::string and vector storage; no fixed path sprintf buffer or smaller effect/style length cap was found in this bounded DDR path. The1024 array is bounded file CONTENT storage. No claim is made about untraced Sandy audio backend internals.

Follow-up: voice-playback.md extends this boundary into MMR and recovers a 260-byte descriptor filename field and a browser manifest lookup gate. The absence of a smaller cap in DDR alone must not be read as safety of arbitrary downstream filename lengths.

The supplied asset tree has no cd_image/sound/sfx/player directory. The preflight calls direct CRT stat for both files, and text lookup uses direct fopen; neither gate uses a virtual resource database. Unless a filesystem adapter supplies these files, a real /voice command cannot pass preflight in the current asset set. Missing target voice assets remain an implementation constraint. Synthetic files can exercise metadata/consumer behavior, but that must be reported as a fixture, not recovered original audio. [ev_66ea06d394078287ea062031b028d2963824307c7db38df1941ac655ddfd3a34, ev_a37e1a5bd0622770a6d2ad8771789cc64d6c95c4309338def4551c1ab0c6f622, ev_59df807c0b511621015b10c5546fe942482ce490d2964264b2b7ba353f0d2144, ev_9f16b9bc36e187b942bfef12c536ef884a4d68d620a8b5d6d7d6be5364df939c, ev_2fd83904049125e82448e12d66162cb7c6f7fd3a4a209c905a99eb732bd68915]

Nickname candidate is used on RECEIVE as well as preflight: tell10007af0, group10008620 and vicinity10008d50 pass message+8 (resolved sender name) into both text and audio lookup. It is not supplied in voice metadata. These paths substitute local text if nonempty and otherwise retain received text. Helper 10001fd0 interprets the local line's bracket control prefix (including MT). Audio is separately subject to expansion/stat389, rate/duplicate suppression, and hearFriends/vicinity/guild/team preferences. Group flag0x40 rejects voice; the normal send queue1000c5f0 routes voice through the selected chat target, so it is not intrinsically restricted to vicinity despite the help wording. [ev_16fcb32fbd4a0d830065ae9c1c1d57f06ae60bf4a2d51f5bcf31ce76b5f865f4, ev_f7590d1ab782aa2205a6c4d8d0628112f7bf9d8649415152bc475c7c391cc04d, ev_8ea3a6cc92b39932e975b917cf206bae2190f1a177f9d79f7574fb6705b7826a, ev_be55b8f4db016021a0c10224754846cfc9cdbd9f151484b5d789c667e46555c8, ev_a26f08d8cf178fa1caa68d7dfc9327b7da4f355831224d250220d78f2488b6f5]

Server-facing inference and limits

For a bounded relay, validate counted fields, exact exhaustion, record order and uniqueness; reject unknown or privileged record2. Reject embedded NUL in strings consumed as C strings. The public producer accepts custom effects, quoted spaces, relative asset paths and case-sensitive names. The relay preserves those native capabilities, without a six-effect whitelist, path restriction, style allowlist or invented small numeric cap. Authenticated sender identity/name must come from transport, not an arbitrary metadata name.

These are reconstruction choices informed by consumers, not recovered original-server policy. Original network service moderation, replay/history handling, item-template validity and every downstream audio decoder remain unresolved. No live voice audio/reference round trip was run by this research agent; parent owns actual WASM integration tests.