fix(net): Campaign LA LA7a review fixes — AD-97 register row, corrected restore justification

The Opus retail-lens review decoded the PDB-paired binary at
CPlayerSystem::RestoreCharacter@0x0055d760 and refuted the
uninitialized-edx justification: the two extra arguments are real
push imm32 of a constant PStringBase (BN mis-renders them, but they
pack to >=4 bytes each), so retail 0xF7D9 is >=16 bytes where ours
is 8. The guid-only CODE stands (ACE reads only the guid; holtburger
consensus) but it is an adaptation, not a corrected decompile — filed
as divergence register AD-97 and the doc comment now states the true
mechanism.

Also from the review: the 0xF643 conditional-parse doc now names BOTH
ACE flag-only failure branches (NameInUse + Corrupt); CharacterError
0x08 doc corrected (ACE misnames it ServerCrash2 — the port corrects
an ACE misnaming; ACE omits three values, not four); LA7b hazard notes
added (ACE silent no-reply on unknown restore guid; retail SendToLogon
vs SendToControl routing; NumErrors never rendered); two review-nit
tests (flag=0 Undef flag-only, non-Ok body with trailing bytes
ignored).

Core.Net suite: 953 passed / 0 failed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-14 16:01:52 +02:00
parent 6a32f37589
commit 4338b1c1f3
5 changed files with 100 additions and 34 deletions

View file

@ -8,27 +8,36 @@ namespace AcDream.Core.Net.Messages;
/// (opcode <c>0xF643</c>).
///
/// <para>
/// <b>Request — guid-only, by reference consensus.</b> The decompiled call
/// site (<c>Proto_UI::SendAdminRestoreCharacter</c> at <c>0x00546cf0</c>,
/// declared with three parameters — a u32 and two <c>PStringBase&lt;char&gt;</c>
/// pointers — and packing two strings after the u32) LOOKS like it sends
/// guid + two strings. It does not: its only real caller,
/// <c>CPlayerSystem::RestoreCharacter</c> at <c>0x0055d760</c>, declares
/// <c>class PStringBase&lt;char&gt;* edx;</c> as a local and passes it
/// straight through UNINITIALIZED as the second argument, and passes
/// <c>this</c> (a <c>CPlayerSystem*</c>, not a string) as the third. Both
/// are textbook decompiler register-corruption artifacts (uninitialized
/// register reuse + a mistyped extra parameter from an over-declared
/// callee signature), not real arguments the real call site ever
/// supplied. ACE
/// <b>Request — guid-only, an ADAPTATION (register row AD-97).</b> Retail
/// really does send more than the guid. The PDB-paired binary at
/// <c>CPlayerSystem::RestoreCharacter@0x0055d760</c> is 26 bytes:
/// <c>push 0x008173B4; push 0x008173B4; push guid;
/// call Proto_UI::SendAdminRestoreCharacter@0x00546cf0</c> — two REAL
/// constant <c>PStringBase&lt;char&gt;*</c> arguments (Binary Ninja renders
/// them as an uninitialized <c>edx</c> local and <c>this</c>; that
/// rendering is the artifact, the two <c>push imm32</c> are not).
/// <c>SendAdminRestoreCharacter</c> packs both
/// (<c>PStringBase::Pack@0x004fc6f0</c> emits ≥4 bytes even for an empty
/// string), so retail's request is ≥16 bytes where ours is 8. We send
/// guid-only because ACE
/// (<c>CharacterHandler.CharacterRestore</c>,
/// <c>ACE.Server/Network/Handlers/CharacterHandler.cs:331-385</c>, reads
/// only <c>ReadUInt32()</c>) and holtburger
/// <c>ACE.Server/Network/Handlers/CharacterHandler.cs:331-385</c>) reads
/// only <c>ReadUInt32()</c> and ignores any tail, and holtburger
/// (<c>holtburger-protocol/src/messages/character/types.rs::CharacterRestoreRequestData</c>,
/// guid-only) independently agree on guid-only. We follow the two
/// independent, uncorrupted references (design spec §11 item 4 — wire
/// consensus, no divergence-register row needed: this isn't a deviation
/// from retail, it's picking the correct reading of a corrupted decompile).
/// sent from a real client command path) ships guid-only against ACE
/// successfully. The omitted tail is a recorded retail deviation —
/// divergence register AD-97.
/// </para>
///
/// <para>
/// <b>LA7b hazards.</b> (1) ACE's restore handler has a SILENT no-reply
/// path: an unknown guid hits
/// <c>Characters.SingleOrDefault(...) == null → return;</c> — no 0xF643,
/// no 0xF659. Selection state must never await a restore reply
/// unconditionally. (2) Routing: ACE sends the response on
/// <c>GameMessageGroup.UIQueue</c>; retail transmits the request via
/// <c>Proto_UI::SendToControl</c> (the delete request goes via
/// <c>SendToLogon</c>) — relevant when LA7b picks the outbound queue.
/// </para>
///
/// <code>
@ -55,12 +64,13 @@ namespace AcDream.Core.Net.Messages;
/// </code>
///
/// <para>
/// But retail's <c>CharacterRestore</c> handler can ALSO reply on this same
/// But ACE's <c>CharacterRestore</c> handler can ALSO reply on this same
/// opcode via the character-CREATE response path when restore itself fails
/// (e.g. <c>SendCharacterCreateResponse(session, CharacterGenerationVerificationResponse.NameInUse)</c>
/// when the freed name collides) — that shape is flag-only, with NO
/// trailing fields (<c>GameMessageCharacterCreateResponse.cs</c>: the guid /
/// name / trailing u32 are only written <c>if (response == ... .Ok)</c>).
/// — TWO real branches: <c>NameInUse</c> (the freed name collided) and
/// <c>Corrupt</c> (<c>SaveCharacter</c> returned false). Both shapes are
/// flag-only, with NO trailing fields
/// (<c>GameMessageCharacterCreateResponse.cs</c>: the guid / name /
/// trailing u32 are only written <c>if (response == ... .Ok)</c>).
/// <see cref="Parse"/> mirrors that conditionality: the trailing three
/// fields are read only when <c>verificationFlag == 1</c>. Because the two
/// message families are wire-identical when they collide, a caller cannot
@ -95,9 +105,9 @@ public static class CharacterRestore
/// <summary>
/// Build the body bytes for an outbound <c>CharacterRestore</c> request.
/// Layout: opcode(4) + characterGuid(4). Guid-only — see the class doc
/// comment for why the decompiled call site's apparent extra strings
/// are not real.
/// Layout: opcode(4) + characterGuid(4). Guid-only — an adaptation of
/// retail's ≥16-byte shape; see the class doc comment and divergence
/// register AD-97.
/// </summary>
public static byte[] BuildRequestBody(uint characterGuid)
{