commit 5458202ffc985803273c5e7206a9da8124d2b5f6
parent b07efd1537c9db061ecbc3a6ab779997a2e830bf
Author: anon <anon@example.com>
Date: Sat, 24 Oct 2026 07:18:05 +0000
Test native weapon backlog drains and reject synthetic healing results
Diffstat:
4 files changed, 116 insertions(+), 4 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -362,6 +362,10 @@ replay/failure tests and WASM checks are recorded in [IP training](docs/ip-train
- [ ] Use one First Aid item. Check: it restores the expected health, consumes
the applicable quantity/charge and cannot be reused during its skill lock.
+ Resolve incoming queued-hit delivery without fake weapon outcomes: two-client
+ WASM checks reject zero-damage backlog flushing because leftover results alter
+ native attack presentation. Native queue regression cases now cover the
+ receive-time drain and empty/nonempty ring behavior; see the research below.
- [x] Use one nano-restoring item. Check: nano recovery, consumption and its lock
match that item rather than inheriting the health item's behavior.
- [x] Use one sitting treatment kit. Check: it works in the permitted posture
diff --git a/client/tests/critical_result.c b/client/tests/critical_result.c
@@ -3,6 +3,7 @@
void sub_360AECB0(void);
void sub_3607A320(void);
+void sub_3607A2E0(void);
void sub_3607A660(void);
void sub_360AB4C0(void);
void sub_360AB500(void);
@@ -67,7 +68,8 @@ static void actor_getter(void)
static void actor_setter(void)
{
assert(g_ecx == 0x500020e4);
- assert(MEM32(g_esp + 4) == 27 && MEM32(g_esp + 8) == 87);
+ assert(MEM32(g_esp + 4) == 27);
+ assert(MEM32(g_esp + 8) <= MEM32(0x50002300));
writes++;
MEM32(0x50002300) = MEM32(g_esp + 8);
g_esp += 12;
@@ -107,7 +109,7 @@ static void feedback(void)
assert(g_ecx == 0x50000900);
assert(MEM32(g_esp + 4) == (target_local ? 30 : 32));
assert(MEM32(g_esp + 8) == 0x50002000);
- assert(MEM32(g_esp + 12) == 13);
+ assert(MEM32(g_esp + 12) == 13 || MEM32(g_esp + 12) == 0);
assert(MEM32(g_esp + 16) == 0x50001000);
assert(MEM32(g_esp + 20) == 0 && MEM32(g_esp + 24) == 90);
assert(MEM32(g_esp + 28) == expected_result);
@@ -143,7 +145,9 @@ recomp_func_t recomp_lookup(uint32_t address)
switch (address) {
case 0x3606da90: return actor_lookup;
case 0x3607a320: return sub_3607A320;
+ case 0x3607a2e0: return sub_3607A2E0;
case 0x3607a660: return sub_3607A660;
+ case 0x360ab5a0: return sub_360AB5A0;
case 0x360ab4c0: return sub_360AB4C0;
case 0x360ab500: return sub_360AB500;
case 0x360ab560: return sub_360AB560;
@@ -283,11 +287,77 @@ static void missing_attacker_results(void)
}
}
+static void backlog_results(void)
+{
+ for (unsigned index = 0; index <= 49; index += 49) {
+ expected_result = 4;
+ death_reason = 0;
+ ammunition = 3;
+ target_local = 1;
+ missing_attacker = missing_target = 0;
+ setup();
+ MEM32(0x50003050) = 2;
+ MEM32(0x50003058) = 50000;
+ MEM32(0x5000305c) = 2;
+ MEM32(0x50005014) = MEM32(0x50005018) = index;
+ sub_360AECB0();
+ assert(MEM32(0x50002300) == 100 && writes == 0);
+
+ g_esp = 0x5000ff00;
+ g_ecx = 0x50000000;
+ sub_360AECB0();
+
+ assert(g_esp == 0x5000ff04);
+ assert(MEM32(0x50002300) == 74 && reads == 2 && writes == 2);
+ assert(feedbacks == 2 && ammo_updates == 2 && deaths == 0);
+ assert(MEM32(0x50005014) == MEM32(0x50005018));
+ assert(MEM32(0x50003050) == 2 && MEM32(0x5000305c) == 2);
+ }
+}
+
+static void zero_result_backlog(void)
+{
+ const struct { unsigned pending, zeros, health, read, write; } cases[] = {
+ {0, 1, 100, 0, 1}, {0, 2, 100, 2, 2},
+ {1, 1, 87, 2, 2}, {1, 2, 87, 2, 3}
+ };
+ for (unsigned i = 0; i < sizeof(cases) / sizeof(cases[0]); i++) {
+ expected_result = 4;
+ death_reason = 0;
+ ammunition = 3;
+ target_local = 1;
+ missing_attacker = missing_target = 0;
+ setup();
+ MEM32(0x50003050) = 2;
+ MEM32(0x50003058) = 50000;
+ MEM32(0x5000305c) = 2;
+ if (cases[i].pending) sub_360AECB0();
+ MEM32(0x50000024) = 0;
+
+ for (unsigned n = 0; n < cases[i].zeros; n++) {
+ g_esp = 0x5000ff00;
+ g_ecx = 0x50000000;
+ sub_360AECB0();
+ }
+
+ assert(g_esp == 0x5000ff04);
+ assert(MEM32(0x50002300) == cases[i].health);
+ assert(MEM32(0x50005014) == cases[i].write);
+ assert(MEM32(0x50005018) == cases[i].read);
+ assert(reads == cases[i].read && writes == cases[i].read && feedbacks == cases[i].read);
+ assert(ammo_updates == cases[i].write && MEM32(0x50006020) == 3);
+ assert(MEM32(0x50003050) == 2 && MEM32(0x5000305c) == 2 && deaths == 0);
+ if (cases[i].read != cases[i].write) assert(MEM32(0x50008100 + cases[i].read * 8) == 0);
+ }
+}
+
int main(void)
{
assert(guest_map("critical result fixture", 0x50000000, 0x10000));
assert(guest_map("critical result imports", 0x36160000, 0x20000));
queued_results();
missing_attacker_results();
- puts("native critical results: queue, single damage, feedback result, death and ammo routing passed");
+ backlog_results();
+ zero_result_backlog();
+ puts("native weapon results: impact, backlog drain, zero-result parity, feedback, death and ammo passed");
}
diff --git a/docs/critical-hits.md b/docs/critical-hits.md
@@ -15,13 +15,22 @@ It executes AttackInfo activation `100aecb0`, holder delivery/slot lookup
impact consumption `100ab5a0`, raw-stat assignment helper `10075db0` and
missing-attacker fallback `1007be50`.
-Nine cases pass on Linux and WASM. For a known attacker, receipt queues the
+For a known attacker with an empty active weapon ring, receipt queues the
supplied amount 13 and result 4 or 5, assigns ammunition immediately, and leaves
HP 100 until impact. Impact changes HP to 87 exactly once. A second empty-queue
consumption changes nothing. Other cases cover index 49 wrapping to 0,
ammunition 3/0/-1, local defender/observer feedback and death routing. Death
reason 7 is an arbitrary branch probe, not an established weapon-death reason.
+Additional cases exercise the receive-time backlog drain through unchanged
+`1007a2e0`. A second result arriving before the first impact immediately
+consumes both 13-damage outcomes, leaving HP 74 and an empty ring, including
+index wraparound. One/two zero results from empty/nonempty active rings
+verify that no fixed count guarantees an empty ring. These cases preserve
+the current opponent, fight state and supplied ammo; the feedback stub counts
+calls, including zero amounts, rather than testing the text formatter's
+zero-amount suppression. See [combat healing delivery](first-aid.md).
+
The fixture's amount 13 is an input, not a critical-damage calculation. It
also deliberately supplies a different packet target: the known attacker's
impact uses its current opponent, which is why target changes and weapon
diff --git a/docs/first-aid.md b/docs/first-aid.md
@@ -130,6 +130,35 @@ contract, ideally alongside a correlated original-server combat-heal capture.
The authored combat-use rule still applies; this result does not justify
delaying First Aid until incoming combat stops.
+A controlled follow-up tested the weapon receiver's backlog branch rather
+than assuming every result waits for an animation. `0x1007a660` samples ring
+presence before appending; when a result was already pending, it immediately
+drains the whole ring through `0x1007a2e0 -> 0x100ab5a0`. The native contract
+in `client/tests/critical_result.c` covers two real results, ring wraparound,
+and one/two zero results from empty and nonempty active rings.
+
+Synthetic zero-damage results are not a neutral healing barrier. One zero
+drains existing damage but can itself remain queued when the ring was empty.
+Two zeros leave one zero when the first message drained an existing result.
+No fixed count guarantees an empty ring for both initial states. A queued
+zero counts as an ordinary outcome for animation/weapon effects, can release
+the player's recharge hold, and makes a later real result drain immediately.
+Zero-damage text suppression does not suppress these paths.
+
+Two published WASM clients reproduced the baseline: a pending 7-damage result
+survived an absolute heal to 205, then reduced native HP to 198 while server
+HP remained 205. One zero removed an existing real result before healing;
+two zeros left a zero on both replicas. Starting in active combat with an
+empty ring, one zero remained queued and the next real 8-damage result applied
+immediately on receipt. Server attack deadlines and native targets stayed
+unchanged, but the damage-presentation timing changed. This rejects the
+candidate despite the narrow HP improvement; it is not enabled in production.
+Read-only samples, wire captures, screenshots and assertions are retained in
+`local/weapon-impact-smoke/verification.json`; full static evidence and the
+corrected candidate analysis are in `local/weapon-impact-research/`.
+The test browsers, temporary server and two owned characters were cleaned up,
+and the ordinary preview was restored on the default ports.
+
Public implementation comparisons also leave delivery unresolved.
[CellAO's 2016 Hit implementation](https://github.com/CellAO/CellAO-NightPredator/blob/ca77f375a7dabe3be769da94e6c2a3d093344c2c/CellAO/Server/ZoneEngine/Core/Functions/GameFunctions/hit.cs#L112-L153)
changes the base health stat and relies on an absolute dirty-stat flush; the