fix(ui,runtime): OP4 review fixes — live re-seed, enable-gating, Combat panel re-point, universal timestamps

Both OP4 reviews converged on one headline bug (Character-tab rows never
re-read live server truth after their pre-login constructor-word seed) plus
overlapping MUST-FIXes. All ten converged/consolidated findings land here:

MUST-FIX:
- BoolOptionRow.SaveCurrentValue now re-reads its live binding (retail's
  GetValue()-into-SaveCurrentValue) on every OnShown — panel open, tab
  switch in, initial activation — instead of trusting the pre-login
  constructor word it was built with. Reset/tab-switch can now only
  restore values that were actually live at the last show. LockUI's
  host.Root.UiLocked one-shot mount seed now also converges on every
  PlayerDescription via the existing OnCharacterOptionsChanged hook.
- Apply/Reset are wired to OptionPage.OnOptionChanged in production
  (Ghosted when nothing changed, Normal when dirty, run once at bind so
  both start disabled per retail's PostInit); Defaults stays ungated.
- The Combat panel's three LEDs (Repeat Attacks/Auto Target/Keep in View)
  now read/write the same RuntimeCharacterOptionsState seam the Character
  tab uses instead of a disconnected client-local GameplaySettings copy —
  closes the "two writable copies" divergence. The three now-orphaned
  GameplaySettings fields and RuntimeSettingsController's mirror
  properties/SetCombatGameplay are deleted outright; the headless host's
  hardcoded AutoRepeatAttack/AutoTarget now read the live option bit.
- RuntimeSettingsController.SetUiLocked's convergence guard now compares
  against the last value actually applied to the runtime target instead
  of the persisted GameplaySettings.LockUI snapshot, which could already
  match a server-derived request without ever having been pushed.

SHOULD-FIX:
- DisplayTimeStamps now prefixes every chat producer (ChatLog.Append is
  the one seam all of them funnel through), not just AddText's own
  callers — heard speech, emotes, Turbine channels, and combat text were
  previously missed. The prefix format escapes its colons and forces
  InvariantCulture instead of the culture-dependent TimeSeparator
  placeholder.
- sky.frag now honors uFogParams.w (fog mode) like the mesh/terrain
  shaders, so Disable Distance Fog stops the sky dome's horizon band from
  blending toward fog color too.
- Corrected the "byte-verified" overclaim on the timestamp format string
  doc comment (BN-sourced, wire doc U6) and the AP-194 anchor-column
  class-name typo; the RunAsDefaultMovement doc comments now cite retail's
  actual acclient.h enumerator name.
- Added: DispatcherMovementInputSource's option x modifier truth table
  (incl. || AutoRunActive with the option off), the per-page Apply/Reset
  enable-gate tests, a real checkbox.OnClick/ToggleBehavior-driven click
  test, and hash-pins for the six header string keys.
- Gate script step 8 corrected for the logout-flush false-failure
  (closing the panel before relogging is load-bearing); a new step
  documents the enable-gate sequence and the Combat-panel/Character-tab
  cross-check.

Register: AP-196 (the Group-C default-source change + GameplaySettings
retirement) and AP-197 (the ignored per-character timestamp format
override) filed in this commit.

Full Release suite: 13,044 passed / 4 skipped / 0 failed (was 13,008/4/0;
net +36 tests from new coverage and legitimate assertion updates from the
GameplaySettings retirement).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-11 05:30:26 +02:00
parent 85afaae5fd
commit bc43fb1d1d
36 changed files with 923 additions and 220 deletions

View file

@ -368,6 +368,11 @@ public static class CharacterOptionsPageController
bool initial = bindings.CurrentValue(spec.Id);
checkbox.Selected = initial;
// MUST-FIX 1 (OP4 review-fix round, 2026-08-11): `read` re-seeds
// this row from the LIVE option word on every OnShown (panel
// open, tab switch in) — retail's SaveCurrentValue/GetValue.
// `refresh` pushes the re-read value onto the checkbox WITHOUT
// going through `apply` (which would send it back over the wire).
var row_ = new BoolOptionRow(
initial,
entry.ClientDefault,
@ -375,7 +380,9 @@ public static class CharacterOptionsPageController
{
checkbox.Selected = value;
bindings.SetOption(spec.Id, value);
});
},
read: () => bindings.CurrentValue(spec.Id),
refresh: value => checkbox.Selected = value);
page.Register(row_);
checkbox.OnClick = () => row_.SetCurrentValue(checkbox.Selected);

View file

@ -1,6 +1,6 @@
using AcDream.Core.Combat;
using AcDream.Core.Net.Messages;
using AcDream.Runtime.Gameplay;
using AcDream.UI.Abstractions.Panels.Settings;
namespace AcDream.App.UI.Layout;
@ -15,9 +15,26 @@ namespace AcDream.App.UI.Layout;
/// <c>RecvNotice_DesiredAttackPowerChanged</c> (0x004CC110),
/// <c>ListenToElementMessage</c> (0x004CC430), and
/// <c>RecvNotice_SetCombatMode</c> (0x004CC620).
///
/// <para>
/// MUST-FIX 3 (OP4 review-fix round, 2026-08-11, blast M2): the three
/// LEDs (Repeat Attacks / Auto Target / Keep in View) read and write
/// through the SAME <c>RuntimeCharacterOptionsState</c> server-bit seam
/// the Character tab's rows for these same retail <c>PlayerOption</c>s
/// already use — retired the client-local <c>GameplaySettings</c> mirror
/// this panel used to read/write, which had silently diverged into a
/// second, disconnected copy of the same three options (register row
/// AP-196).
/// </para>
/// </remarks>
public sealed class CombatUiController : IRetainedPanelController
{
/// <summary>The live read/write seam for the three combat LEDs —
/// identical shape to <see cref="CharacterOptionsPageController.Bindings"/>.</summary>
public sealed record Bindings(
Func<CharacterOptionId, bool> CurrentValue,
Action<CharacterOptionId, bool> SetOption);
public const uint LayoutId = 0x21000073u;
public const uint BasicPanelId = 0x1000005Cu;
public const uint SpellcastingPanelId = 0x10000061u;
@ -47,8 +64,7 @@ public sealed class CombatUiController : IRetainedPanelController
private readonly UiButton _keepInView;
private readonly CombatState _combat;
private readonly RuntimeCombatAttackState _attacks;
private readonly Func<GameplaySettings> _gameplay;
private readonly Action<GameplaySettings> _setGameplay;
private readonly Bindings _bindings;
private readonly Action<bool> _setWindowVisible;
private bool _disposed;
@ -65,8 +81,7 @@ public sealed class CombatUiController : IRetainedPanelController
UiButton keepInView,
CombatState combat,
RuntimeCombatAttackState attacks,
Func<GameplaySettings> gameplay,
Action<GameplaySettings> setGameplay,
Bindings bindings,
CombatUiLabels labels,
Action<bool> setWindowVisible)
{
@ -82,8 +97,7 @@ public sealed class CombatUiController : IRetainedPanelController
_keepInView = keepInView;
_combat = combat;
_attacks = attacks;
_gameplay = gameplay;
_setGameplay = setGameplay;
_bindings = bindings;
_setWindowVisible = setWindowVisible;
// Retail layout 0x21000073 contains two sibling pages: gmCombatUI's
@ -110,12 +124,18 @@ public sealed class CombatUiController : IRetainedPanelController
SetStaticText(speedLabel, labels.Speed, rightAligned: false);
SetStaticText(powerLabel, labels.Power, rightAligned: true);
// MUST-FIX 3 (OP4 review-fix round, 2026-08-11, blast M2): writes
// go through the SAME server-bit seam the Character tab's rows for
// these same retail PlayerOptions use — TrySetOption writes the
// local bit first, then either sends 0x0005 immediately
// (AutoRepeatAttack/AutoTarget are auto-save) or marks the batched
// module dirty (ViewCombatTarget is batched).
_repeatAttacks.OnClick = () =>
_setGameplay(_gameplay() with { AutoRepeatAttack = _repeatAttacks.Selected });
_bindings.SetOption(CharacterOptionId.AutoRepeatAttack, _repeatAttacks.Selected);
_autoTarget.OnClick = () =>
_setGameplay(_gameplay() with { AutoTarget = _autoTarget.Selected });
_bindings.SetOption(CharacterOptionId.AutoTarget, _autoTarget.Selected);
_keepInView.OnClick = () =>
_setGameplay(_gameplay() with { ViewCombatTarget = _keepInView.Selected });
_bindings.SetOption(CharacterOptionId.ViewCombatTarget, _keepInView.Selected);
_combat.CombatModeChanged += OnCombatModeChanged;
_attacks.StateChanged += OnAttackStateChanged;
@ -126,16 +146,14 @@ public sealed class CombatUiController : IRetainedPanelController
ImportedLayout layout,
CombatState combat,
RuntimeCombatAttackState attacks,
Func<GameplaySettings> gameplay,
Action<GameplaySettings> setGameplay,
Bindings bindings,
CombatUiLabels labels,
Action<bool> setWindowVisible)
{
ArgumentNullException.ThrowIfNull(layout);
ArgumentNullException.ThrowIfNull(combat);
ArgumentNullException.ThrowIfNull(attacks);
ArgumentNullException.ThrowIfNull(gameplay);
ArgumentNullException.ThrowIfNull(setGameplay);
ArgumentNullException.ThrowIfNull(bindings);
ArgumentNullException.ThrowIfNull(labels);
ArgumentNullException.ThrowIfNull(setWindowVisible);
@ -153,7 +171,7 @@ public sealed class CombatUiController : IRetainedPanelController
return new CombatUiController(
layout, basic, spellcasting, power, high, medium, low,
repeatAttacks, autoTarget, keepInView,
combat, attacks, gameplay, setGameplay, labels, setWindowVisible);
combat, attacks, bindings, labels, setWindowVisible);
}
public void SyncVisibility() => OnCombatModeChanged(_combat.CurrentMode);
@ -188,10 +206,9 @@ public sealed class CombatUiController : IRetainedPanelController
_high.Selected = _attacks.RequestedHeight == AttackHeight.High;
_medium.Selected = _attacks.RequestedHeight == AttackHeight.Medium;
_low.Selected = _attacks.RequestedHeight == AttackHeight.Low;
GameplaySettings gameplay = _gameplay();
_repeatAttacks.Selected = gameplay.AutoRepeatAttack;
_autoTarget.Selected = gameplay.AutoTarget;
_keepInView.Selected = gameplay.ViewCombatTarget;
_repeatAttacks.Selected = _bindings.CurrentValue(CharacterOptionId.AutoRepeatAttack);
_autoTarget.Selected = _bindings.CurrentValue(CharacterOptionId.AutoTarget);
_keepInView.Selected = _bindings.CurrentValue(CharacterOptionId.ViewCombatTarget);
}
private static void SetStaticText(UiText? text, string value, bool rightAligned)

View file

@ -59,17 +59,43 @@ public interface IOptionRow
public sealed class BoolOptionRow : IOptionRow
{
private readonly Action<bool>? _apply;
private readonly Func<bool>? _read;
private readonly Action<bool>? _refresh;
private Action? _notifyPageOptionChanged;
private bool _current;
private bool _saved;
private bool _default;
public BoolOptionRow(bool initial, bool defaultValue, Action<bool>? apply = null)
/// <param name="read">
/// MUST-FIX 1 (OP4 review-fix round, 2026-08-11 — converged mechanism
/// MF-1 / blast M1): retail's <c>UIOption_Checkbox::GetValue
/// @0x00486f60</c> — <c>PlayerModule::GetOption</c>, the LIVE
/// server-synced option word, not a widget-local cache. Optional so
/// every pre-existing non-DAT-backed caller (the synthetic pages in
/// <c>OptionPageModelTests</c>) keeps working unchanged; when supplied,
/// <see cref="SaveCurrentValue"/> re-reads through it instead of
/// trusting the row's own possibly-stale <see cref="_current"/>.
/// </param>
/// <param name="refresh">
/// Retail's own <c>Refresh()</c> push of the re-read value onto the
/// widget (e.g. <c>checkbox.Selected = value</c>) — invoked ONLY from
/// <see cref="SaveCurrentValue"/>'s re-read path, never through
/// <paramref name="apply"/>, so a re-seed never sends the value back
/// out over the wire.
/// </param>
public BoolOptionRow(
bool initial,
bool defaultValue,
Action<bool>? apply = null,
Func<bool>? read = null,
Action<bool>? refresh = null)
{
_current = initial;
_saved = initial;
_default = defaultValue;
_apply = apply;
_read = read;
_refresh = refresh;
}
/// <summary>The live value — what the LED currently shows.</summary>
@ -106,7 +132,28 @@ public sealed class BoolOptionRow : IOptionRow
public void AttachPageNotify(Action notify) => _notifyPageOptionChanged = notify;
public void SaveCurrentValue() => _saved = _current;
/// <summary>
/// MUST-FIX 1 (OP4 review-fix round, 2026-08-11): retail
/// <c>SaveCurrentValue @0x004868E0</c> is <c>m_current = GetValue();
/// m_saved = m_current;</c> — it re-reads the LIVE option word, not
/// just <c>m_saved = m_current</c> over whatever <c>m_current</c>
/// already held. <see cref="OptionPage.OnShown"/> calls
/// <see cref="OptionPage.Apply"/>, which calls this on every row —
/// so every panel (re)open, tab switch in, and the initial default-
/// tab activation self-corrects this row from the CURRENT server
/// truth, exactly on retail's own schedule. When no <c>read</c>
/// delegate was supplied (the synthetic non-DAT-backed test pages),
/// this degrades to the pre-fix <c>m_saved = m_current</c> shape.
/// </summary>
public void SaveCurrentValue()
{
if (_read is not null)
{
_current = _read();
_refresh?.Invoke(_current);
}
_saved = _current;
}
public void RestoreSavedValue()
{

View file

@ -217,22 +217,47 @@ public sealed class OptionsPanelController : IRetainedPanelController
UiElement? pageRoot = UiElement.FindDescendant(tabPanel, pageId);
if (pageRoot is null) continue;
BindPageButton(pageRoot, ApplyButtonId, page.Apply);
BindPageButton(pageRoot, ResetButtonId, page.Reset);
UiButton? apply = BindPageButton(pageRoot, ApplyButtonId, page.Apply);
UiButton? reset = BindPageButton(pageRoot, ResetButtonId, page.Reset);
BindPageButton(pageRoot, DefaultsButtonId, page.Defaults);
// MUST-FIX 2 (OP4 review-fix round, 2026-08-11): retail
// PlayerOptionPage::OnOptionChanged @0x004F27D0 — Apply/Reset
// Ghosted (disabled) when the page has nothing to commit/
// revert, Normal (enabled) otherwise; Defaults is NEVER gated
// (retail's override never fetches its child id at all).
if (apply is not null && reset is not null)
{
page.OnOptionChanged = () =>
{
uint state = page.Changed
? UiButtonStateMachine.Normal
: UiButtonStateMachine.Ghosted;
apply.TrySetRetailState(state);
reset.TrySetRetailState(state);
};
// Retail's PostInit calls InitOptions() then
// OnOptionChanged(0) so the pair starts disabled — run the
// gate once now, at bind time, for the same effect.
page.OnOptionChanged();
}
}
return controller;
}
private static void BindPageButton(UiElement pageRoot, uint elementId, Action onClick)
private static UiButton? BindPageButton(UiElement pageRoot, uint elementId, Action onClick)
{
if (UiElement.FindDescendant(pageRoot, elementId) is UiButton button)
{
button.OnClick = onClick;
else
Console.WriteLine(
$"[D.2b] OptionsPanelController: page 0x{pageRoot.DatElementId:X8}'s button "
+ $"0x{elementId:X8} not found — its handler was not wired.");
return button;
}
Console.WriteLine(
$"[D.2b] OptionsPanelController: page 0x{pageRoot.DatElementId:X8}'s button "
+ $"0x{elementId:X8} not found — its handler was not wired.");
return null;
}
/// <summary>

View file

@ -67,11 +67,14 @@ public sealed record RadarRuntimeBindings(
SelectionState Selection,
Action<bool> SetUiLocked);
// MUST-FIX 3 (OP4 review-fix round, 2026-08-11, blast M2): the
// GameplaySettings read/write pair was removed — MountCombat wires the
// three LEDs through the same OptionsRuntimeBindings server-bit seam the
// Character tab's rows use (CombatUiController.Bindings), not a
// client-local settings mirror.
public sealed record CombatRuntimeBindings(
CombatState State,
RuntimeCombatAttackState Attacks,
Func<GameplaySettings> Gameplay,
Action<GameplaySettings> SetGameplay);
RuntimeCombatAttackState Attacks);
public sealed record MagicRuntimeBindings(
Spellbook Spellbook,
@ -1190,12 +1193,17 @@ public sealed class RetailUiRuntime : IDisposable
}
float combatWidth = RetailCombatLayout.FitFavoriteSlots(layout);
// MUST-FIX 3 (OP4 review-fix round, 2026-08-11, blast M2): the SAME
// server-bit seam MountOptionsPanel wires the Character tab's rows
// through — see CharacterOptionsPageController.Bindings below.
CombatUiController? controller = Layout.CombatUiController.Bind(
layout,
_bindings.Combat.State,
_bindings.Combat.Attacks,
_bindings.Combat.Gameplay,
_bindings.Combat.SetGameplay,
new Layout.CombatUiController.Bindings(
CurrentValue: id => _bindings.Options.CurrentCharacterOption((uint)id),
SetOption: (id, value) => _bindings.Options.CommandBus().Publish(
new SetSingleCharacterOptionRuntimeCmd((uint)id, value))),
labels,
visible =>
{