aorecomp

Anarchy Online classic in the browser

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


commit f6d2d473209dfaf5a6dc38df968b49bb927f2478
parent 5d66b1f8f742eac6c54b48aa216b81dd6cda0ea3
Author: anon <anon@example.com>
Date:   Tue, 27 Oct 2026 03:17:27 +0000

Keep nano effects on valid actor attachment positions

Diffstat:
MTODO.md | 15+++++++++++++++
Mclient/Makefile.linux | 8++++++++
Mclient/Makefile.wasm | 4++++
Mclient/game/kkr.dll/lifted-0086.c | 15+++++++++++++--
Aclient/tests/effect_attachment.c | 178+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adocs/nano-effect-attachments.md | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 312 insertions(+), 2 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -59,6 +59,10 @@ tool funds; ordinary funding and higher-QL recipe rules remain open. See [Blood Plasma](docs/blood-plasma.md). Quest and mission checkboxes below are still open; they have not been implemented by the shop or dialogue work. +The fresh NT audit has reached four ordinary Leet kills and 400 earned XP, +including death/return and cold recovery. It exposed and fixed an inactive-mesh +projectile that blocked repeated native casts. Level-up and normal funding of +useful purchases remain open; see [nano effect attachments](docs/nano-effect-attachments.md). Next execution order: @@ -1295,6 +1299,17 @@ introduction and starting-item gameplay remain open below. failed reservation/refund and COMMIT. Two native clients verify the phase transitions, exact refund and a shot during nano recharge. See [shared timing and verification](docs/nano-weapon-timing.md). +- [x] Keep repeated native nano casts usable when a target's animation mesh + is inactive or its skeleton is throttled. A fresh NT's Ice Flechette projectile + used a rendering placeholder as its destination and blocked the local casting + queue for about 29 minutes. Check the shared attachment fix with regression + tests and ordinary repeated casts against visible and off-screen targets, + including reconnect. Preserve authored recharge and normal bone attachments. + The shared readiness guard passed native/paged/WASM regressions. Two GPU + clients verified three visible-target casts, four casts with an inactive target + mesh, and four more after a cold restart. Ordinary combat earned another 200 XP; + the same equipment, inventory and learned nano survived death and return. + See [effect attachment evidence](docs/nano-effect-attachments.md). - [ ] [P2] Establish original authoritative weapon/nano scheduling beyond the execution-window reconstruction. Check separate native controller and nano queue clocks across AggDef, short nano recharge, late107, reload overlap and diff --git a/client/Makefile.linux b/client/Makefile.linux @@ -259,6 +259,8 @@ test: build/linux/window build/linux/graphics build/linux/atoi build/linux/stric ./build/linux/resolved-calls python3 ../tools/client/test_resolve_guest_calls.py ./build/linux/shadow-contact + ./build/linux/effect-attachment + ./build/linux/effect-attachment-paged ./build/linux/network-queue ./build/linux/vertex-upload ./build/linux/vertex-upload-paged @@ -570,6 +572,12 @@ build/linux/shadow-contact: tests/shadow_contact.c game/kkr.dll/lifted-0081.c ru test: build/linux/shadow-contact +build/linux/effect-attachment build/linux/effect-attachment-paged: tests/effect_attachment.c game/kkr.dll/lifted-0086.c game/kkr.dll/lifted-0087.c game/bbr.dll/lifted-0069.c game/mr.dll/lifted-0001.c runtime/guest_memory.c runtime/recomp_state.c runtime/recomp_types.h runtime/guest_memory.h + @mkdir -p $(@D) + $(CC) $(CPPFLAGS) $(CFLAGS) $(if $(filter %-paged,$@),-U__linux__) -ffunction-sections -fdata-sections $(filter %.c,$^) -Wl,--gc-sections -lm -o $@ + +test: build/linux/effect-attachment build/linux/effect-attachment-paged + build/linux/animation-initialization: tests/animation_initialization.c game/bbr.dll/lifted-0032.c runtime/guest_memory.c runtime/recomp_state.c runtime/recomp_types.h runtime/guest_memory.h @mkdir -p $(@D) $(CC) $(CPPFLAGS) $(CFLAGS) -ffunction-sections -fdata-sections $(filter %.c,$^) -Wl,--gc-sections -pthread -lm -o $@ diff --git a/client/Makefile.wasm b/client/Makefile.wasm @@ -192,6 +192,10 @@ build/wasm/animation-initialization.js: tests/animation_initialization.c game/bb @mkdir -p $(@D) $(CC) $(CPPFLAGS) $(CFLAGS) -ffunction-sections -fdata-sections $(filter %.c,$^) -Wl,--gc-sections -lm -o $@ +build/wasm/effect-attachment.js: tests/effect_attachment.c game/kkr.dll/lifted-0086.c game/kkr.dll/lifted-0087.c game/bbr.dll/lifted-0069.c game/mr.dll/lifted-0001.c runtime/guest_memory.c runtime/recomp_state.c runtime/recomp_types.h runtime/guest_memory.h + @mkdir -p $(@D) + $(CC) $(CPPFLAGS) $(CFLAGS) -ffunction-sections -fdata-sections $(filter %.c,$^) -Wl,--gc-sections -lm -o $@ + build/wasm/dynel-lookup.js: tests/dynel_lookup.c game/llr.dll/lifted-0008.c runtime/guest_memory.c runtime/recomp_state.c runtime/recomp_types.h runtime/guest_memory.h @mkdir -p $(@D) $(CC) $(CPPFLAGS) $(CFLAGS) -ffunction-sections -fdata-sections $(filter %.c,$^) -Wl,--gc-sections -lm -o $@ diff --git a/client/game/kkr.dll/lifted-0086.c b/client/game/kkr.dll/lifted-0086.c @@ -11746,6 +11746,18 @@ L_36133834: _flag_k = FK_TEST; if (TEST_Z(_flag_a, _flag_b)) goto L_361338E1; /* 0x36133840: je 0x361338e1 */ L_36133846: + /* RCATMesh_t::GetAttractor (bbr.dll!25112790) returns a distant + * placeholder for inactive indexed meshes. MaybeUpdateSkeleton + * (bbr.dll!2510F990) also skips throttled skeletons. Keep the local + * attachment at identity until its pose is available, so the caller + * uses the actor root instead of launching an effect at the placeholder. */ + { + uint32_t mesh = MEM32(eax + 0x28); + if (((edi >= 1000 && edi < 1019) || (edi >= 2000 && edi < 2024)) && + (MEM32(mesh + 0x280) || + (!MEM8(mesh + 0x288) && MEM32(mesh + 0x284) != 0xffffffffu))) + goto L_361338BC; + } _flag_a = (uint32_t)(edi); _flag_b = (uint32_t)(0x3E8u); _cf = (uint32_t)CMP_B(_flag_a, _flag_b); edi = edi - 0x3E8u; /* 0x36133846: sub edi, 0x3e8 */ @@ -13090,4 +13102,4 @@ L_36133F7B: ebp = POP32_VAL(esp); /* 0x36133F9D: pop ebp */ RECOMP_FLAGS_OUT(); esp += 8; { RECOMP_REGS_OUT(); return; } /* 0x36133F9E: ret 4 */ RECOMP_REGS_OUT(); -} -\ No newline at end of file +} diff --git a/client/tests/effect_attachment.c b/client/tests/effect_attachment.c @@ -0,0 +1,178 @@ +#include "recomp_types.h" +#include <assert.h> + +void sub_36131C00(void), sub_361331E0(void), sub_36133580(void), sub_36133FC0(void); +void sub_25112790(void), sub_3B004580(void); +enum { pair = 0x50000000, endpoint = 0x50001000, owner = 0x50002000, + visual = 0x50003000, mesh = 0x50004000, world = 0x50005000, + output = 0x50006000 }; +static unsigned bone_calls, attractor_calls, skeleton_calls; +static int bone_exists; + +static void find_owner(void) { g_eax = owner; g_esp += 4; } +static void cast_owner(void) { g_eax = owner; g_esp += 4; } +static void get_visual(void) { assert(g_ecx == owner); g_eax = visual; g_esp += 4; } +static void get_world(void) { assert(g_ecx == mesh + 0x3c); g_eax = world; g_esp += 4; } +static void update_orientation(void) { g_esp += 4; } +static void update_skeleton(void) { ++skeleton_calls; g_esp += 4; } +static void get_bone(void) +{ + ++bone_calls; + if (bone_exists) *(float *)ADDR(MEM32(g_esp + 8) + 0x34) = 3; + g_eax = bone_exists; + g_esp += 12; +} +static void get_attractor(void) +{ + assert(g_ecx == mesh); + ++attractor_calls; + *(float *)ADDR(MEM32(g_esp + 8) + 0x34) = 2; + g_eax = 1; + g_esp += 12; +} + +recomp_func_t recomp_lookup_manual(uint32_t address) { return NULL; } +recomp_func_t recomp_lookup_import(uint32_t address) { abort(); } +recomp_func_t recomp_lookup(uint32_t address) +{ + switch (address) { + case 0x361331e0: return sub_361331E0; + case 0x36133580: return sub_36133580; + case 0x36133fc0: return sub_36133FC0; + case 0x36133bd0: return update_orientation; + case 0x3615fd86: return cast_owner; + case 0x3615f7fc: return get_bone; + case 0x3615f73c: return sub_25112790; + case 0x2510f990: return update_skeleton; + case 0x250f6a70: return get_attractor; + case 0x70000000: return find_owner; + case 0x70000004: return get_visual; + case 0x70000008: return get_world; + case 0x3b004580: return sub_3B004580; + default: fprintf(stderr, "Unexpected attachment dependency: %08x\n", address); abort(); + } +} + +static void arrange(void) +{ + memset((void *)ADDR(0x50000000), 0, 0x10000); + bone_calls = attractor_calls = skeleton_calls = 0; + bone_exists = 0; + MEM8(pair + 0x20) = 1; + MEM32(pair + 0x28) = endpoint; + MEM8(endpoint) = 1; + MEM8(endpoint + 9) = 1; + MEM32(endpoint + 4) = 4; + MEM32(endpoint + 0x94) = 1006; + MEM32(owner + 0x11c) = 0x100; + MEM32(owner + 0xc8) = visual; + MEM32(visual + 0x28) = mesh; + const float transform[] = {0,0,-1,0, 0,1,0,0, 1,0,0,0, 64,14,75,1}; + memcpy((void *)ADDR(world), transform, sizeof(transform)); + MEM32(0x3616ff70) = 0x70000000; + MEM32(0x3616ffe8) = 0x70000004; + MEM32(0x3616f3a0) = 0x70000008; + MEM32(0x36170198) = 0x3b004580; + g_fs_base = 0x5000e000; + MEM32(g_fs_base) = 0x12345678; +} + +static void read_target(float y) +{ + g_ecx = pair; + g_esp = 0x5000ff00; + MEM32(g_esp + 4) = output; + g_ebx = 111; g_esi = 222; g_edi = 333; g_ebp = 444; + g_fp_top = 8; + sub_36131C00(); + const float expected[] = {64,y,75}; + assert(!memcmp((void *)ADDR(output), expected, sizeof(expected))); + assert(g_eax == output && g_esp == 0x5000ff08); + assert(g_ebx == 111 && g_esi == 222 && g_edi == 333 && g_ebp == 444); + assert(g_fp_top == 8 && MEM32(g_fs_base) == 0x12345678); + assert(MEM32(endpoint + 4) == 4); +} + +static void inactive_mesh_uses_root_then_recovers(void) +{ + /* The real attractor getter would return its distant placeholder. */ + arrange(); + MEM32(mesh + 0x284) = 7; + + /* Keep the endpoint valid at the actor root while inactive. */ + read_target(14); + assert(bone_calls == 0 && attractor_calls == 0 && skeleton_calls == 0); + + /* Activation restores the authored attachment on the same pair. */ + MEM8(mesh + 0x288) = 1; + read_target(16); + assert(bone_calls == 1 && attractor_calls == 1 && skeleton_calls == 1); +} + +static void throttled_skeleton_uses_root_then_recovers(void) +{ + /* An active mesh cannot update its skeleton yet. */ + arrange(); + MEM8(mesh + 0x288) = 1; + MEM32(mesh + 0x280) = 2; + + read_target(14); + assert(bone_calls == 0 && attractor_calls == 0 && skeleton_calls == 0); + MEM32(mesh + 0x280) = 0; + read_target(16); + assert(bone_calls == 1 && attractor_calls == 1 && skeleton_calls == 1); +} + +static void unindexed_mesh_keeps_attachment(void) +{ + arrange(); + MEM32(mesh + 0x284) = UINT32_MAX; + + read_target(16); + + assert(bone_calls == 1 && attractor_calls == 1 && skeleton_calls == 1); +} + +static void ready_mesh_keeps_named_bone(void) +{ + arrange(); + MEM8(mesh + 0x288) = 1; + bone_exists = 1; + + read_target(17); + + assert(bone_calls == 1 && attractor_calls == 0 && skeleton_calls == 0); +} + +static void unavailable_mesh_keeps_root_and_rejects_invalid_attachment(void) +{ + /* An inactive mesh with a throttled skeleton. */ + arrange(); + MEM32(mesh + 0x280) = 2; + MEM32(endpoint + 0x94) = 0; + + /* A root request does not require a skeleton. */ + read_target(14); + MEM32(endpoint + 0x94) = 9999; + g_ecx = endpoint; + g_esp = 0x5000ff00; + sub_361331E0(); + + /* Unavailable bones do not make an unsupported attachment valid. */ + assert((g_eax & 255) == 0 && MEM32(endpoint + 4) == 0); + assert(bone_calls == 0 && attractor_calls == 0 && skeleton_calls == 0); + assert(g_esp == 0x5000ff04); +} + +int main(void) +{ + assert(guest_map("effect attachment fixture", 0x50000000, 0x10000)); + assert(guest_map("effect attachment imports", 0x36160000, 0x20000)); + assert(guest_map("effect attachment names", 0x362e0000, 0x10000)); + inactive_mesh_uses_root_then_recovers(); + throttled_skeleton_uses_root_then_recovers(); + unindexed_mesh_keeps_attachment(); + ready_mesh_keeps_named_bone(); + unavailable_mesh_keeps_root_and_rejects_invalid_attachment(); + puts("effect attachment: inactive/throttled roots, activation recovery and unindexed bones passed"); +} diff --git a/docs/nano-effect-attachments.md b/docs/nano-effect-attachments.md @@ -0,0 +1,94 @@ +# Nano effects and unavailable attachment poses + +A nano's projectile must finish before its native casting queue can be removed. +An inactive mesh's rendering placeholder is not a usable projectile destination. +The shared effect attachment resolver now uses the actor root while the skeleton +is unavailable, then resumes its authored attachment when the pose is ready. +This is a visual fallback; it does not change server casting or recharge rules. + +## Reproduction and evidence + +A normally created Atrox Nano-Technician uploaded Ice Flechette, trained skills +with starting IP, equipped its issued pistol and shirt, and killed two ordinary +level 1 Leets. No character stats, funds, items, enemies or rewards were edited. +After one cast in the second fight, subsequent shortcut presses were rejected +locally with "Nanobots are recharging." Only one cast request reached the server. +Its admission arrived after 4 ms and completion after another 330 ms. + +Read-only WASM samples separate the relevant gates: + +- The queue remained in phase 2 with completion gate 0 and owner Flags128. +- NormalTime576.310 exceeded its recharge deadline143.537. +- Effect123 was still present and updating, with completion byte 0. +- Its source was near `(60.78, 15.67, 75.99)`, but its destination was + `(-140917.875, 100014.03125, 11168.2900390625)`. +- Speed100 and distance173198.421875 imply about 1732 seconds of flight. + +The maintained native paths explain those observations: + +- KKR `100649e8 ->100668a0/10066880` rejects a new cast while the school's queue + remains. Phase-2 cleanup `100659f0 ->10065940` waits for its effect before + checking expiry `100658e0`. +- Projectile `3612a8f0 ->3612afc0` finishes when speed times elapsed time reaches + the destination distance. Nano completion107 releases a separate queue gate. +- `36133580` resolves target attachment1006 as `Bip01 Head_ac`, then falls back + to `Attractor01_head` if that lookup fails. +- BBR `25112790` deliberately returns a successful transform translated by + `(100000, 100000, 100000)` for an inactive indexed mesh. Composition with the + actor's world transform produces the observed distant destination. +- BBR `2510f990` skips skeleton updates while mesh+280 is nonzero. Calling that + updater alone also does not remove the inactive-mesh sentinel condition. + +The resolver in `client/game/kkr.dll/lifted-0086.c`, `sub_36133580`, now retains +its initialized local identity for valid bone/attractor requests when either +readiness condition fails. Its existing caller composes that with the actor's +world transform. Root requests, invalid attachment rejection, ready bones and +unindexed meshes retain their existing paths. Rendering throttles and the BBR +placeholder producer remain unchanged. The same readiness conditions protect +shadow height initialization. + +This uses maintained source, existing matching original-controller extracts and +live WASM observations. No new binary analysis session was opened. Original +controller evidence and its limits are recorded in [nano timing](nano-weapon-timing.md). +The detailed samples, wire stream and source hashes are under +`local/nt-starter-play/`. + +## Verification + +`client/tests/effect_attachment.c` exercises the target getter through its real +attachment resolver, original placeholder producer and matrix composition. It +checks inactive and throttled root fallback, recovery on the same endpoint, +unindexed and ready bone attachments, root requests, invalid attachment +rejection, and the guest stack/register/FPU/exception-chain contract. +The corrected fixture fails against the original source and passes with the fix +on Linux in direct and paged memory modes and in WebAssembly. + +The full native client suite passed all 110 fixture commands. Focused Go casting, +reservation and asset regressions passed 18 roots / 36 results; eight asset checks +also passed against the published bundle. The published source digest matches +the maintained inputs, and the headed browser reports the GPU OpenGL driver. + +Two WASM clients received all three completions in the visible-target check. +That character later died while the test paused to inspect the live encounter; +it resurrected in the same client, recovered with four laboratory charges, and retained +its 200 earned XP, 1158 remaining IP, four credits and every item instance. +The issued health First Aid kit remained at three charges, consistent with the +separate unsupported [combat-healing delivery](combat-healing-delivery.md) path. + +After ordinary travel through Entertainment, Trade and Backyard18, a browser +reconnect repeated combat against an off-screen Leet. Its mesh was inactive +through all seven captured projectile samples. Their distances were 1.62..4.99m, +and all four nuke requests completed on both clients. The pistol finished the +kill, leaving 45/79 HP and 300 total earned XP. The nano queue and its temporary +timers were empty afterward; the independent weapon timer remained valid. +Two more successful laboratory uses restored health/nano, leaving 17 charges. + +A cold server restart retained the exact player/item snapshots, including the +independent backyard return contexts, earned XP, credits and remaining IP. +Two clients then completed four further native nukes and another ordinary kill. +The final character retained 400 earned XP and 1158 IP, with the casting queue +and temporary nano timers cleared. No administrative provisioning was used. + +These checks fix a concrete repeated-casting blocker. They do not establish the +complete normal-play progression loop, level-up, historical creature balance or +ordinary funding of useful shop upgrades.