fix(chat): CH1 review fixes — sbb-idiom channel catch-all, command-output typing

Applies the Opus review findings on CH1 (172c6f9a), the exact retail chat
color table. Two blockers plus should-fixes/nits, one commit:

BLOCKER 1 — LegacyChannelChatType.Resolve's channel-bit table was wrong.
Binary Ninja renders retail's `neg esi; sbb esi, esi` idiom (a branchless
select between Channel 0x08 and Channel_Send 0x09) as the trivial pseudo-C
`esi - esi` (always 0), hiding the real values. Corrected by decoding the
raw bytes at the PDB-paired binary: HEAR sbb site VA 0x00570F0A (mask -6 ->
0x08), SEND sbb site VA 0x00570D4F (mask -5 -> 0x09). The generic
admin/audit/sentinel catch-all is Channel/Channel_Send, NOT Abuse (0x0E) —
Abuse is retail's ONLY 0x0E producer (bit 0x0001). The unnamed
FellowBroadcast bit (0x4000000) is hear=Channel(0x08)/send=Fellowship(0x13),
not a flat 0x13. ACE's PDB-sourced Channel enum corroborates. Introduces
`RetailLogTextType`, the 34-value named enum for the wire LogTextType space
(values only, no color — Core stays presentation-free).

BLOCKER 2 — three ChatLog.OnSystemMessage sinks (ChatVM.ShowSystemMessage,
LiveSessionRuntimeFactory's ShowSystemMessage delegate,
HeadlessGameplayOperations.DisplayMessage) were typing ALL
ClientCommandController output 0x1A (bright red), including informational
command output (@version, /loc, friends list, usage lines). Retail types
the great majority of that output 0x00 Default (green) and reserves 0x1A
for genuine refusals/errors. Reverted to 0x00 with a comment noting the
refusal-vs-info split lands with CH2's SpewBox producer rewiring. The five
App composition sites that pass 0x1A for actual refusal text
(InteractionRetainedUiComposition, SessionPlayerComposition) were already
correct and are untouched (aside from converting the literal to the new
enum).

Also: AP-176 divergence-register row for OnWeenieError/OnCombatLine's
single-type approximation of retail's per-code/per-message dispatch; a
carry-forward test for the out-of-range LogTextType color fallback in
ChatWindowController; decomp-confirmed anchors replacing ACE-inferred
citations in CombatChatTranslator and ChatLog.OnPlayerKilled; required
(non-optional) logTextType parameters on OnLocalSpeech/OnTellReceived/
OnCombatLine/OnSelfSent since no production caller relied on a default;
LegacyChannelChatType.Resolve's parameter renamed channelBit -> channelId
with a doc note on multi-bit ids; corrections to the color-table research
doc's §3.3 wire tables; and issue #359 for the pre-existing (not
CH1-introduced) 0x019E PlayerKilled participant-suppression gap retail has
and acdream lacks.

dotnet build clean; full Release suite 11,835 passed / 4 skipped / 0 failed
(11,839 total), up from the CH1 baseline of 11,833/4/0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-09 16:02:59 +02:00
parent e306c979ae
commit 34d8a3c0e7
31 changed files with 481 additions and 213 deletions

View file

@ -13,7 +13,7 @@ public sealed class ChatLogTests
ChatEntry? seen = null;
log.EntryAppended += e => seen = e;
log.OnLocalSpeech("Alice", "hi", 0xAA, isRanged: false);
log.OnLocalSpeech("Alice", "hi", 0xAA, isRanged: false, logTextType: 0x02u);
Assert.Equal(1, log.Count);
Assert.NotNull(seen);
@ -26,7 +26,7 @@ public sealed class ChatLogTests
public void OnLocalSpeech_Ranged_SetsRangedKind()
{
var log = new ChatLog();
log.OnLocalSpeech("Bob", "SHOUT", 0xBB, isRanged: true);
log.OnLocalSpeech("Bob", "SHOUT", 0xBB, isRanged: true, logTextType: 0x02u);
Assert.Equal(ChatKind.RangedSpeech, log.Snapshot()[0].Kind);
}
@ -44,7 +44,7 @@ public sealed class ChatLogTests
public void OnTellReceived_SetsTellKind()
{
var log = new ChatLog();
log.OnTellReceived("Alice", "psst", 0xAA);
log.OnTellReceived("Alice", "psst", 0xAA, logTextType: 0x03u);
Assert.Equal(ChatKind.Tell, log.Snapshot()[0].Kind);
}
@ -62,7 +62,7 @@ public sealed class ChatLogTests
public void OnSelfSent_EchoesOutbound()
{
var log = new ChatLog();
log.OnSelfSent(ChatKind.Tell, "hey", targetOrChannel: "Alice");
log.OnSelfSent(ChatKind.Tell, "hey", logTextType: 0x04u, targetOrChannel: "Alice");
var e = log.Snapshot()[0];
Assert.Equal("Alice", e.Sender);
Assert.Equal("hey", e.Text);
@ -72,10 +72,10 @@ public sealed class ChatLogTests
public void RingBuffer_DropsOldestBeyondCapacity()
{
var log = new ChatLog(maxEntries: 3);
log.OnLocalSpeech("A", "1", 0, false);
log.OnLocalSpeech("B", "2", 0, false);
log.OnLocalSpeech("C", "3", 0, false);
log.OnLocalSpeech("D", "4", 0, false);
log.OnLocalSpeech("A", "1", 0, false, logTextType: 0x02u);
log.OnLocalSpeech("B", "2", 0, false, logTextType: 0x02u);
log.OnLocalSpeech("C", "3", 0, false, logTextType: 0x02u);
log.OnLocalSpeech("D", "4", 0, false, logTextType: 0x02u);
var snap = log.Snapshot();
Assert.Equal(3, snap.Length);
@ -87,7 +87,7 @@ public sealed class ChatLogTests
public void Clear_EmptiesBuffer()
{
var log = new ChatLog();
log.OnLocalSpeech("A", "1", 0, false);
log.OnLocalSpeech("A", "1", 0, false, logTextType: 0x02u);
log.Clear();
Assert.Equal(0, log.Count);
}
@ -172,7 +172,7 @@ public sealed class ChatLogTests
// ranged shout). Substitute "You" so the chat line reads
// "You: hello" instead of ": hello".
var log = new ChatLog();
log.OnLocalSpeech(sender: "", text: "hello", senderGuid: 0, isRanged: false);
log.OnLocalSpeech(sender: "", text: "hello", senderGuid: 0, isRanged: false, logTextType: 0x02u);
var e = log.Snapshot()[0];
Assert.Equal("You", e.Sender);
Assert.Equal("hello", e.Text);
@ -182,7 +182,7 @@ public sealed class ChatLogTests
public void OnLocalSpeech_NonEmptySender_KeepsAsIs()
{
var log = new ChatLog();
log.OnLocalSpeech(sender: "Alice", text: "hi", senderGuid: 0xAA, isRanged: false);
log.OnLocalSpeech(sender: "Alice", text: "hi", senderGuid: 0xAA, isRanged: false, logTextType: 0x02u);
Assert.Equal("Alice", log.Snapshot()[0].Sender);
}
@ -192,7 +192,7 @@ public sealed class ChatLogTests
public void OnCombatLine_DefaultsInfoKind_TagsEntryAsCombat()
{
var log = new ChatLog();
log.OnCombatLine("You hit Mosswart for 5 slashing damage (50.0%).");
log.OnCombatLine("You hit Mosswart for 5 slashing damage (50.0%).", logTextType: 0x06u);
var e = log.Snapshot()[0];
Assert.Equal(ChatKind.Combat, e.Kind);
Assert.Equal(CombatLineKind.Info, e.CombatKind);
@ -204,21 +204,21 @@ public sealed class ChatLogTests
{
var log = new ChatLog();
log.OnCombatLine("Mosswart hit you for 8 fire damage to your chest.",
CombatLineKind.Warning);
logTextType: 0x06u, kind: CombatLineKind.Warning);
Assert.Equal(CombatLineKind.Warning, log.Snapshot()[0].CombatKind);
log.OnCombatLine("Attack sequence finished with WeenieError 0x1234.",
CombatLineKind.Error);
logTextType: 0x06u, kind: CombatLineKind.Error);
Assert.Equal(CombatLineKind.Error, log.Snapshot()[1].CombatKind);
}
// ── Campaign CH slice CH1: LogTextType ingestion-site mapping ──────────
[Fact]
public void OnLocalSpeech_DefaultsLogTextType_ToSpeech()
public void OnLocalSpeech_ExplicitLogTextType_PinsSpeechValue()
{
var log = new ChatLog();
log.OnLocalSpeech("Alice", "hi", 0xAA, isRanged: false);
log.OnLocalSpeech("Alice", "hi", 0xAA, isRanged: false, logTextType: 0x02u);
Assert.Equal(0x02u, log.Snapshot()[0].LogTextType);
}
@ -275,10 +275,10 @@ public sealed class ChatLogTests
}
[Fact]
public void OnTellReceived_DefaultsLogTextType_ToTell()
public void OnTellReceived_ExplicitLogTextType_PinsTellValue()
{
var log = new ChatLog();
log.OnTellReceived("Alice", "psst", 0xAA);
log.OnTellReceived("Alice", "psst", 0xAA, logTextType: 0x03u);
Assert.Equal(0x03u, log.Snapshot()[0].LogTextType);
}
@ -291,18 +291,18 @@ public sealed class ChatLogTests
}
[Fact]
public void OnSelfSent_Tell_DefaultsLogTextType_ToSpeechDirectSend()
public void OnSelfSent_Tell_ExplicitLogTextType_PinsSpeechDirectSendValue()
{
var log = new ChatLog();
log.OnSelfSent(ChatKind.Tell, "hey", targetOrChannel: "Alice");
log.OnSelfSent(ChatKind.Tell, "hey", logTextType: 0x04u, targetOrChannel: "Alice");
Assert.Equal(0x04u, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnSelfSent_Channel_DefaultsLogTextType_ToSocialSend()
public void OnSelfSent_Channel_ExplicitLogTextType_PinsSocialSendValue()
{
var log = new ChatLog();
log.OnSelfSent(ChatKind.Channel, "hi all", targetOrChannel: "Fellowship");
log.OnSelfSent(ChatKind.Channel, "hi all", logTextType: 0x0Bu, targetOrChannel: "Fellowship");
Assert.Equal(0x0Bu, log.Snapshot()[0].LogTextType);
}
@ -310,7 +310,7 @@ public sealed class ChatLogTests
public void OnSelfSent_ExplicitLogTextType_Overrides()
{
var log = new ChatLog();
log.OnSelfSent(ChatKind.Channel, "hi all", targetOrChannel: "Fellowship", logTextType: 0x13u);
log.OnSelfSent(ChatKind.Channel, "hi all", logTextType: 0x13u, targetOrChannel: "Fellowship");
Assert.Equal(0x13u, log.Snapshot()[0].LogTextType);
}
@ -324,12 +324,15 @@ public sealed class ChatLogTests
// Co-Vassals / Allegiance Broadcast.
[InlineData(0x1000000u, "Co-Vassals", 0x0Au)]
[InlineData(0x2000000u, "Allegiance Broadcast", 0x0Au)]
// Unnamed bit reuses Fellowship's slot.
[InlineData(0x4000000u, "?", 0x13u)]
// FellowBroadcast — hear is the plain Channel slot (corrected
// 2026-08-09, Opus review of 172c6f9a — was wrongly 0x13).
[InlineData(0x4000000u, "?", 0x08u)]
// The one named non-family bit inside the generic bucket (Help).
[InlineData(0x0400u, "Help", 0x0Fu)]
// Generic admin/audit/sentinel catch-all.
[InlineData(0x0900u, "Audit", 0x0Eu)]
// Generic admin/audit/sentinel catch-all — Channel (hear), NOT Abuse
// (corrected 2026-08-09, Opus review of 172c6f9a — Abuse is retail's
// ONLY 0x0E producer, bit 0x0001, and this test's 0x0900 doesn't hit it).
[InlineData(0x0900u, "Audit", 0x08u)]
public void OnChannelBroadcast_DerivesLogTextType_FromLegacyChannelBit(
uint channelBit, string channelName, uint expectedLogTextType)
{
@ -359,10 +362,10 @@ public sealed class ChatLogTests
}
[Fact]
public void OnCombatLine_DefaultLogTextType_IsGenericCombat()
public void OnCombatLine_ExplicitLogTextType_PinsGenericCombatValue()
{
var log = new ChatLog();
log.OnCombatLine("You hit Mosswart for 5 slashing damage (50.0%).");
log.OnCombatLine("You hit Mosswart for 5 slashing damage (50.0%).", logTextType: 0x06u);
Assert.Equal(0x06u, log.Snapshot()[0].LogTextType);
}
}