aorecomp

Anarchy Online classic in the browser

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


docs/research-notes/team-leadership-smoke/menu-audit.md (9518B)


Native team popup input audit

Scope: bounded generated-source and packaged-resource audit of original AO 14.9.1 DDR/CCR code. No REA session opened, no production edits, no observed runtime outcome claimed. Original DDR SHA-256 and address translation are in local/team-research/wire-audit.md; DDR generated addresses add 0x1b000000, CCR adds 0x17000000 to original VAs (original image base0x10000000).

Trigger and mode gates

Original anarchy-vanilla-14.9.1/ccr.dll, embedded default binding at original VA0x1002b443 (guest0x2702b443):

COMMAND_TEAM_POPUPMENU [ & AnyPlayMode & TeamViewMode ! DraggingMode ! MouseLookMode ] = RightPress

This triggers on right press; waiting longer does not relax those mode gates. Packaged cd_image/text/help/The Team Window.txt says to right-click and hold a member name, with icons for make leader, expel, information, and leave. Static binding and help are consistent: press opens, holding permits selection. Exact timing of icon selection/release has not been traced in this audit.

Original CCR mode-name table file offsets0x470c0..0x472b0, pairs u32 stringVA,u32 modeID, gives AnyPlay8, MouseLook9, IconMenu19, TeamView25 and Dragging46. CCR CheckMode export0x10003ed0 (client/game/ccr.dll/lifted-0001.c) returns true when either byte input+0x1c+modeID or input+0x5b+modeID is nonzero. The former array is dynamic, the latter set/cleared by SetStaticInputMode/ClrStaticInputMode exports0x10003e90/0x10003ea0.

DDR TeamView constructor0x100494a0 builds a MouseDetectorButton at view+0x34. It passes mode25 at0x10049624 and invokes imported constructor at0x10049645. This is the native hover/mouse mode detector for the team view. Its exact CheckHotSpot mode update path has not been traced to completion.

Read-only runtime addresses

All values below are guest addresses/offsets. Read pointers from guest memory with the existing page-table lookup; do not call constructors or mutate state merely to make the menu appear.

DDR exported PopupMenu0x1004b210 is registered as AFCM event351 (0x15f) at 0x1004ae87..0x1004ae95. It calls TeamView0x1004a150 (client/game/ddr.dll/lifted-0019.c). That function requires in-team+0x38, then reads current mouse coordinates. Define rootX/rootY from root GUI+0x2c/ +0x30 and viewX/viewY from TeamView+4/+8. All comparisons are strict:

rootX + viewX + 3 < mouseX < rootX + viewX + 128
rootY + viewY + 70 < mouseY < rootY + viewY + 70 + 19*memberCount

Sources:0x1004a16a..0x1004a1bd. It computes row index as (mouseY - viewY - 50)/19 - 1 at0x1004a1bf..0x1004a1d5 and calls row lookup0x1004a8f0. A null row prevents a menu. Note the index calculation subtracts viewY but not rootY, even though bounds use both; reproduce the original inputs before inferring a missing server packet.

On a row, leader+0x39 chooses AFCM channel8/event34; nonleader chooses channel8/event35, both with that row identity. These are native icon-menu requests at0x1004a1e5..0x1004a1fd. Thus a nonleader still has a menu; the leader flag changes its contents. No additional server state gate appears in this function.

Selecting a member versus opening its menu

Each member-name InvisibleButton installs callback0x1004a540 at 0x1004ab43..0x1004ab53. That callback sends AFCM channel26/event269 with identity50000:memberID; it selects a member and does not open the popup. The popup trigger is the separate RightPress binding above.

Exported MakeLeader0x1004b220 is registered event352 (0x160), KickMember 0x1004b230 event353 (0x161), at0x1004ae97..0x1004aeb5. MakeLeader calls 0x1004a210, which receives identity from AFCM and invokes imported N3Msg_TransferTeamLeadership at0x1004a23c. Kick calls0x1004a250 and imported N3Msg_KickTeamMember at0x1004a27c. Native outbound action25/action22 shapes are covered by local/team-research/wire-audit.md.

Next diagnostic boundary

If no menu appears, inspect mode25 and excluded modes9/46 immediately before the press, then inspect the native mouse coordinates, rectangle and row index. If those gates pass, trace AFCM351 dispatch and icon-menu channel8/event34/35. This audit does not establish which gate failed in the parent's WASM run.

Follow-up: gates pass, inspect dispatch

Parent runtime probe confirmed viewXY[0,20], rootXY[1088,0], inTeam1, leader1, count3, mouse[1150,138], AnyPlay8 active, TeamView25 active, MouseLook9/Dragging46 inactive. This passes the audited rectangle and computes row index2. No popup was visible. This evidence narrows the next check to the binding, dispatch, or icon-menu state; it does not identify a missing adapter.

CCR InputConfig::CheckInput export0x100046e0 (lifted-0001.c) invokes 0x10003930 to match input keys and mode requirements. Match code is split across lifted-0000.c and lifted-0001.c. It iterates the hotkey list at input+0x10; each list node+8 contains Hotkey*. Hotkey layout used by matcher: +8 physical key, +0xc argument flags, +0x10 Command_t*, +0x14 required-mode count, +0x18 required-mode array pointer, +0x1c excluded-mode count, +0x20 excluded-mode array pointer. Each mode is tested against both dynamic and static arrays previously described. Command_t stores channel IDs at +4 onward, terminated by -1, and event ID at +0x1c (the Execute call pushes event then channel). Command execution0x10001570 calls AFCM and appends parameters according to the flags, then dispatches.

Read-only diagnostic: sentinel=u32(u32(input+0x10)+4), count= u32(u32(input+0x10)+8); traverse node=u32(sentinel), next=u32(node), hotkey=u32(node+8), bounded by sentinel/count. Find physical RightPress5 with Command_t first channel45 and event351 at+0x1c, required modes8/25 and excluded modes46/9. Physical RightPress5 is also exercised by client/tests/native_input.c; that test stubs command execution and does not prove this real popup binding exists.

CCR IconMenuModule initialization0x1001209f..0x100120b7 registers channel8/event34->RequestIconMenuTeamLeader0x10012400 and channel8/event35->RequestIconMenuTeamNoLeader0x100124b0 (ccr.dll/lifted-0006.c). Leader handler receives the supplied member identity via AFCM, destroys an existing active menu, constructs type7 via 0x10012750 and stores its pointer at guest0x27048b98 at0x1001247f. Nonleader constructs type8 and stores the same global at0x1001252f. During a held right button a nonzero global proves entry to this constructor path; zero narrows to earlier dispatch or immediate dismissal. Generated dispatch table contains both guest0x27012400 and guest0x2b04b210. No absent production adapter was established by this static scan.

Bounded contracts and live resolution

Ignored tmp_popup.c contracts the real generated DDR helper at guest 0x2b04a150, row lookup 0x2b04a8f0, and exported wrapper 0x2b04b210. Using the parent's live coordinates, team/leader flags and a valid three-member list, both entry points emit AFCM channel 8, event 34, identity 50000:22. The same contract also passes when compiled against client/build/wasm/shared/game/ddr.dll/lifted-0019.c, the output of tools/client/share_guest_bodies.py. This checks transformed shared-entry semantics on the host; it is not a separate WASM browser execution.

Ignored tmp_popup_input.c uses the original generated CCR frame and input functions, with a scene-hit-test stub that reinstates dynamic modes as the real hotspot pass does. Its real popup binding has argument flags 0, required modes 8 and 25, excluded modes 46 and 9, and command channel 45 / event 351. At a 0.016-second timer delta it executes once. Disabling mode 25, enabling mode 9, or enabling mode 46 each suppresses the command. The command spy checks the command object's channel/event fields; AFCM execution itself is stubbed, so this is a matcher/frame contract.

The initial local fixture incorrectly set dynamic mode 25 before the frame; FramePreProcess cleared it. Moving that update into the hotspot stub fixed the fixture. This was a fixture setup error, not production evidence.

Changing only the timer delta to 1.0 seconds suppresses this same positive binding. Native CCR ProcessInput at original 0x100045db..0x10004633 adds the frame delta to right-button elapsed time (input+0x13c), compares it to the hold threshold (input+0x14), and rewrites the input action to right-hold 6 at 0x10004616..0x10004622. A slow first frame can therefore skip the RightPress 5 binding. This reproduces a plausible mechanism without proving the failed live frames had that timer value.

The parent subsequently closed its other two owned WASM pages and observed the native menu appear on the same owner's team row, including MakeLeader, Kick and Info. Together these observations establish that the route is implemented and can work. They do not justify an adapter or server change for the earlier missing menu. No production files were changed by this audit, and no test clients or servers were started here.