aorecomp

Anarchy Online classic in the browser

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


docs/research-notes/ignore-research/text-message.md (7529B)


Original world TextMessage vicinity payload

The final byte of a plain message is a channel-mode field, not a terminating NUL. The earlier docs/protocol.md NUL interpretation was incomplete: a normal say mode happens to be0. This follows from the original producer, unchanged FFR/NR wrapping and the parent's captured shout ending02. No production edits were made in this scope. All owned REA sessions are closed.

Exact layout

Offsets are from the native dfdf world packet, after removing the separate eight-byte WebSocket stream prefix. Declared packet size excludes transport alignment bytes following the packet.

Offset Field
16 BEu32 TextMessage subtype
20 Target identity type BEu32
24 Target identity ID BEu32
28 BEu32 payload byte count L
32 BEu16 text byte count N
34 Exactly N text bytes; no terminator
34+N One mode byte
35+N Zero or more optional metadata bytes, through declared packet end

Therefore L>=N+3; equality holds when metadata is absent. The original producer does not impose the earlier parser's L==N+3 for all messages. Mode must be read at counted-text end, rather than at packet end when metadata is present. Parent capture decoding and exact retained packet bytes are in text-captured-frames.json; capture SHA and commands are in text-manifest.json. Filtering only selected before-/blocked test frames is a bounded retained sample, not a complete transport-stream decoder.

DDR command parser1000d540 sets the outgoing local mode; main processing 10009670 serializes two BE text-length bytes, copies exactly that text, writes mode, then appends1000b740 metadata. It sends Network module0x13/event0x79 for mode1, event0x78 for mode2, and event0x77 otherwise. It also supplies selected identity separately to the network module. Evidence parser ev_fe429984672f71b88db53803eba85385817137f25418ea7c16ce041c00bd3556, serializer ev_2257b2e1f61464ab1dc90724b71e50f75c04a0f642511d6953a7ec2ff7f3a00b.

FFR NetworkModule handlers10006ae0/10006b40/10006ba0 receive identity, explicit payload byte length and raw pointer. Client SendVicinity10002ec0, SendShout10002fa0 and SendWhisper10003080 write target identity, payload length and exactly those bytes into BinaryStream, choosing TextMessage subtype3,4,2 respectively. They do not scan the payload for a terminator or append one. Identity writer1000f220 writes both identity integers. NR constructor10004950 stores the subtype and exact provided body length and copies that many bytes; CreateDataBlock10004c20 writes subtype at+16 and copies its raw body at+20. Evidence FFR handlers ev_142ec37a14499125471ae4db69b9cea676aa84e167c62895b8ec3646207fb233, ev_c01633fdd57a0aae175e3ab28cb33c7b26a20c3011fa3849511348a80b1c326f, ev_8e23319970671ec19b2713de83833a8983001d93c0e27afb5bccb4b86000059b, FFR senders ev_74ddee74efc8a860c945fad27b1f4b290e8c603f4715508d0c2e92ddf25f92c4, ev_348d9cdffe3e85cdfcad9d29fed096d69694466bdf1de44bb8544a9fe01e8eca, ev_9e5ab07f8240e698bd2e7f9a31d1b23a6669358e23a0272aa2a17bc3918fb6a1, identity writer ev_de54c19a8a8e5ce526ed17c2fc9a3e9b9e1900f737b1a6179d7e035d935b3769, NR constructor ev_a858b986e3e5694fad3c35d9be3d06466e14a6175c3c43b0a945ca85ab2f73d7, NR serializer ev_aa82e813076ca6be5f383500c0f53dcda42bd930ab71777ae3f5b6afcf8831ca.

Commands, mode and subtype

Public command Mode World subtype Text prepared by native parser
/say or /v 0 3 Remaining text
/whisper or /w 1 2 whispers: followed by remaining text
/shout or /s 2 4 shouts: followed by remaining text
/me 3 3 Remaining text

Aliases and /me literal are retained in ev_c950cbb7a522b7b394fd68fe7dc08d2efb14638c9066232bef464a687876af7c. Mode3 uses the same world vicinity sender as mode0. There is no independent public range/subtype selector in this path: mode directly chooses the FFR event. Strict accepted pairs(3,0),(2,1),(4,2),(3,3) therefore validate the native public producer contract. This does not prove what the unavailable original server would do with a deliberately mismatched subtype/mode.

Native receiving vicinity10008d50 selects whisper/shout/emote colors using the first byte of S2C34's D blob; other modes use vicinity. It combines the sender name with supplied text; it does not require the server to reconstruct shouts: or whispers: . Preserve native text and mode separately. Evidence ev_8ea3a6cc92b39932e975b917cf206bae2190f1a177f9d79f7574fb6705b7826a. Original-server distance radii are outside this shipped-client evidence.

Optional metadata and authority boundary

The sole caller of metadata writer1000b740 is10009670. Its complete original assembly makes two conditional calls to generic encoder100a5df0:

  1. When the ChatReference pointer R is nonzero, format BIIISS: byte0, BEu32R[+0], BEu32R[+4], BEu32R[+8], string fromR+0x10, string fromR+0x20. These last offsets are pointers within native string objects; null uses the empty C string. No broad semantic names are assigned to the three raw integer fields in this scope.
  2. When the voice pointer V is nonzero, format BBBSS: byte1, low byte ofV[+0], low byte ofV[+4], string pointerV+0xc, string pointerV+0x1c. Again null string pointers become empty strings.

There is no overall record count or record length: records concatenate in that order, at most one of each in this public producer. S scans a C string, writes BEu16 length excluding NUL, then copies those bytes; I writes BEu32 and B writes one byte. Type0 has17 fixed bytes plus its string bytes; type1 has7 fixed bytes plus its string bytes. If both pointers are null, writer returns0 and writes nothing. Native links from ATextString::GetLink and voice state supply the optional pointers. This scope establishes the wire fields, not validation of every link/voice object's semantic content. Evidence writer pseudo ev_858be4dbba41bcc1c0861b05b5f02add2997252555e3fe476c547efb496a8f17, complete assembly (including varargs values omitted by Ghidra pseudo) ev_3811a24be4bed4686060821abd42a4f0caec2b8854ca1f8e764d9db34d1747be, format literals ev_00f9ca4856d2fedb180f902c492a5a2b92874becbed92fffaffa60ca1fbd58dd, sole caller ev_347f06fd3916ce38e8c23244b39c3512e36c47836d18e7153dd0d3cfb0ed65a3, generic encoder wrapper ev_6d6022a4ddf3bae5d249db5a4d845e6f75ec2545922abb48fdcf2a8152c702b4, encoder100a5e10 ev_f9d07bd3cfc274be7766f4f7597b9ffcf345893df6b27a60eb6fc4dba4a9323b.

The receiving metadata parser10008350 also accepts a separate record2 plus one flags byte; flag0x01 bypasses ordinary tell/vicinity ignore filtering. Public metadata writer1000b740 does not emit record2. No assertion is made about its intended authority or every other original sender. Therefore never blindly relay arbitrary client metadata as authoritative flags.

For the focused server fix, bounds-check counted text and its required mode byte, validate native subtype/mode pairs, preserve supplied text/mode, and accept but drop trailing metadata until its support is implemented. That preserves plain commands without transmitting unknown authority flags. It leaves link/voice metadata forwarding as explicit incomplete functionality. A later forwarding implementation can validate exact native0/1 schemas and exhaustion (native ordering/one each), rejecting2, unknown and truncated records. That recommendation is implementation guidance derived from the producer/receiver distinction, not recovered original-server policy.