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

@ -3,7 +3,6 @@ using AcDream.App.Net;
using AcDream.Core.Combat;
using AcDream.Core.Net.Messages;
using AcDream.Runtime.Gameplay;
using AcDream.UI.Abstractions.Panels.Settings;
namespace AcDream.App.Combat;
@ -20,30 +19,28 @@ internal interface ICombatGameplaySettingsSource
bool ViewCombatTarget { get; }
}
internal sealed class GameplaySettingsState : ICombatGameplaySettingsSource
{
public GameplaySettings Value { get; set; } = GameplaySettings.Default;
public bool AutoTarget => Value.AutoTarget;
public bool AutoRepeatAttack => Value.AutoRepeatAttack;
public bool ViewCombatTarget => Value.ViewCombatTarget;
}
/// <summary>
/// D7 Group-C re-point (Campaign OP slice OP4, 2026-08-11):
/// <c>AutoTarget</c>/<c>AutoRepeatAttack</c>/<c>ViewCombatTarget</c> move
/// from the client-local <c>GameplaySettings</c> record (what
/// <see cref="GameplaySettingsState"/> and the legacy
/// <c>RuntimeSettingsController</c> read) to the canonical
/// server-authoritative <see cref="RuntimeCharacterOptionsState"/> — the
/// CH3 precedent (server bit is authoritative; the Character-tab panel
/// row's LED click writes THROUGH <c>RuntimeCharacterOptionsState.
/// TrySetOption</c> before this source can ever observe the new value, so
/// no separate reseed/sync step is needed here). Also closes two
/// previously-unfiled divergences (character-options-map.md §0):
/// <c>AutoRepeatAttack</c> and (via <c>ClientCommandController</c>'s
/// <c>/consent</c> re-point, same commit) <c>AcceptCorpseLootingPermissions</c>
/// were client-local and never reached the wire even though retail
/// auto-saves both (<c>0x0005</c> immediately).
/// D7 Group-C re-point (Campaign OP slice OP4, 2026-08-11), widened at the
/// OP4 review-fix round (2026-08-11, MUST-FIX 3 / blast M2):
/// <c>AutoTarget</c>/<c>AutoRepeatAttack</c>/<c>ViewCombatTarget</c> read
/// exclusively from the canonical server-authoritative
/// <see cref="RuntimeCharacterOptionsState"/> — the CH3 precedent (server
/// bit is authoritative; the Character-tab panel row's LED click writes
/// THROUGH <c>RuntimeCharacterOptionsState.TrySetOption</c> before this
/// source can ever observe the new value, so no separate reseed/sync step
/// is needed here). This is now the ONLY <see cref="ICombatGameplaySettingsSource"/>
/// implementation — the client-local <c>GameplaySettings</c> record's own
/// three same-named fields, the legacy <c>RuntimeSettingsController</c>
/// mirror properties, and the dead <c>GameplaySettingsState</c> adapter
/// class were all deleted the same round (register row AP-196); the
/// Combat panel's own three LEDs (<c>CombatUiController</c>) were
/// re-pointed to this SAME seam, closing the "two writable copies"
/// divergence the fix round found. Also closes two previously-unfiled
/// divergences (character-options-map.md §0): <c>AutoRepeatAttack</c> and
/// (via <c>ClientCommandController</c>'s <c>/consent</c> re-point, same
/// commit) <c>AcceptCorpseLootingPermissions</c> were client-local and
/// never reached the wire even though retail auto-saves both
/// (<c>0x0005</c> immediately).
/// </summary>
internal sealed class CharacterOptionCombatSettingsSource : ICombatGameplaySettingsSource
{

View file

@ -643,9 +643,7 @@ internal sealed class RetailInteractionRetainedUiCompositionFactory
d.Settings.SetUiLocked),
Combat: new CombatRuntimeBindings(
d.Actions.Combat,
combatAttack,
() => d.Settings.Gameplay,
d.Settings.SetCombatGameplay),
combatAttack),
Magic: new MagicRuntimeBindings(
d.Character.Spellbook,
magic.Casting,

View file

@ -76,7 +76,9 @@ internal sealed class DispatcherMovementInputSource : IMovementInputSource
// to walking — impossible in retail.
//
// Campaign OP slice OP4 (2026-08-11): `!walking` was a hardcoded
// "run by default" assumption. PlayerOption RunAsDefaultMovement
// "run by default" assumption. Retail PlayerOption id 0xA
// (acclient.h's ToggleRun_PlayerOption — ACE calls the same bit
// RunAsDefaultMovement; N7, OP4 review-fix round 2026-08-11)
// (retail default ON, matching the prior hardcoded behavior
// exactly) now supplies the default; the walk-mode modifier
// still temporarily INVERTS whichever default is active, same

View file

@ -320,8 +320,25 @@ internal sealed class LiveSessionRuntimeFactory
// still diverge from server truth (e.g. an older save, or a
// character whose allegiance/society changed), and the server
// is always authoritative.
//
// OP4 review-fix round (2026-08-11, MF-1/blast M1): re-seed
// LockUI's visual push the SAME way — the radar's polled
// `GetOptionBit` lambda self-corrects every frame, but
// `host.Root.UiLocked` (InteractionRetainedUiComposition.cs)
// is a ONE-SHOT assignment taken pre-login, at composition
// time, from RuntimeCharacterOptionsState's constructor-
// default word. Routing the real value through SetUiLocked
// here — the exact seam ToggleUiLock/SaveGameplay already
// use to push RuntimeSettingsTargets.ApplyUiLock — converges
// the retained window lock to server truth on every fresh
// PlayerDescription, matching the radar's own convergence
// instead of only updating on the next manual /lockui toggle.
OnCharacterOptionsChanged: (_, options2) =>
_interaction.Settings.SyncChatFromServerOptions(options2));
{
_interaction.Settings.SyncChatFromServerOptions(options2);
_interaction.Settings.SetUiLocked(
_domain.Character.Options.GetOptionBit(CharacterOptionId.LockUI));
});
}
private LiveSessionCommandBindings CreateCommandBindings(

View file

@ -669,8 +669,10 @@ public sealed class GameWindow :
_movementInput = new AcDream.App.Input.DispatcherMovementInputSource(
_playerControllerSlot,
_inputCapture);
// Campaign OP slice OP4 (2026-08-11): PlayerOption
// RunAsDefaultMovement, polled — see RuntimeLocalPlayerMovementState.
// Campaign OP slice OP4 (2026-08-11): retail PlayerOption id 0xA
// (acclient.h's ToggleRun_PlayerOption — ACE's name for the same
// bit is RunAsDefaultMovement; N7, OP4 review-fix round
// 2026-08-11), polled — see RuntimeLocalPlayerMovementState.
// RunAsDefaultMovementSource's doc comment. Same one-time,
// whole-lifetime bind as DisableDistanceFogSource above.
_playerControllerSlot.RunAsDefaultMovementSource = () =>

View file

@ -57,7 +57,16 @@ void main() {
vec3 rgb = sampled.rgb * vTint;
if (uApplyFog > 0.5) {
// SHOULD-FIX S2/mech NOTE N-3 (OP4 review-fix round, 2026-08-11):
// PlayerOption DisableDistanceFog forces FogMode.Off (uFogParams.w
// == 0) — mesh_modern.frag/terrain_modern.frag both gate their own
// fog blend on this same word (`if (mode == 0) return lit;`), but the
// sky dome's blend here read only uApplyFog (the CPU per-submesh
// "is this layer foggable at all" flag) and never uFogParams.w, so
// toggling the option stopped terrain/objects fading into fog while
// the dome's horizon band kept blending toward fog color.
int fogMode = int(uFogParams.w);
if (uApplyFog > 0.5 && fogMode != 0) {
const float SKY_FOG_FLOOR = 0.2;
float skyFogFactor = max(vFogFactor, SKY_FOG_FLOOR);
rgb = mix(uFogColor.rgb, rgb, skyFogFactor);

View file

@ -92,7 +92,7 @@
},
{
"stage": "frag",
"sourceSha256": "8de9a5d8f819d1abf893f134cf8ed9fa7edf937a353a74d2befab7b05a3ff700",
"sourceSha256": "2ddf210d69b0c4a3c0870eecfb0ccba2097d93b365729739402bfe91e3b120d0",
"compiled": true
}
]

View file

@ -1,4 +1,3 @@
using AcDream.App.Combat;
using AcDream.Core.Net.Messages;
using AcDream.UI.Abstractions.Input;
using AcDream.UI.Abstractions.Panels.Settings;
@ -168,8 +167,7 @@ internal interface IRuntimeSettingsPreviewSource
/// are never constructed or disposed here.
/// </summary>
internal sealed class RuntimeSettingsController :
IRuntimeSettingsPreviewSource,
ICombatGameplaySettingsSource
IRuntimeSettingsPreviewSource
{
private const string DefaultToonKey = "default";
@ -183,6 +181,11 @@ internal sealed class RuntimeSettingsController :
private bool _startupAudioApplied;
private bool _startupApplied;
private bool _uiLockConverged = true;
// MUST-FIX 4 (OP4 review-fix round, 2026-08-11, blast M3): the last
// `locked` value actually pushed to `_runtimeTargets.ApplyUiLock` —
// the guard `SetUiLocked` compares against, decoupled from whatever
// `Gameplay.LockUI`'s own persisted/draft snapshot currently holds.
private bool? _lastAppliedUiLocked;
public RuntimeSettingsController(
IRuntimeSettingsStorage storage,
@ -233,12 +236,6 @@ internal sealed class RuntimeSettingsController :
public AudioSettings AudioPreview => _viewModel?.AudioDraft ?? Audio;
public bool AutoTarget => Gameplay.AutoTarget;
public bool AutoRepeatAttack => Gameplay.AutoRepeatAttack;
public bool ViewCombatTarget => Gameplay.ViewCombatTarget;
public void ApplyStartup(IRuntimeSettingsStartupTarget target)
{
ArgumentNullException.ThrowIfNull(target);
@ -352,12 +349,22 @@ internal sealed class RuntimeSettingsController :
public void SetUiLocked(bool locked)
{
if (Gameplay.LockUI == locked && _uiLockConverged)
// MUST-FIX 4 (OP4 review-fix round, 2026-08-11, blast M3): the
// guard used to compare `locked` against `Gameplay.LockUI` — valid
// only while `ToggleUiLock` computed `locked` AS `!Gameplay.LockUI`
// (pre-OP4). OP4 re-pointed `ToggleUiLock` to derive `locked` from
// the SERVER bit (`RuntimeCharacterOptionsState.GetOptionBit`)
// instead, a DIFFERENT store that can already equal the persisted
// `Gameplay.LockUI` without this method ever having pushed that
// value to `_runtimeTargets` — the guard must compare against what
// was ACTUALLY applied, not a value from an unrelated store.
if (_lastAppliedUiLocked == locked && _uiLockConverged)
return;
_uiLockConverged = false;
Gameplay = Gameplay with { LockUI = locked };
_runtimeTargets?.ApplyUiLock(locked);
_lastAppliedUiLocked = locked;
_viewModel?.SetGameplay(
_viewModel.GameplayDraft with { LockUI = locked });
@ -412,35 +419,6 @@ internal sealed class RuntimeSettingsController :
}
}
public void SetCombatGameplay(GameplaySettings gameplay)
{
Gameplay = gameplay ?? throw new ArgumentNullException(nameof(gameplay));
if (_viewModel is not null)
{
_viewModel.SetGameplay(_viewModel.GameplayDraft with
{
AutoTarget = gameplay.AutoTarget,
AutoRepeatAttack = gameplay.AutoRepeatAttack,
ViewCombatTarget = gameplay.ViewCombatTarget,
});
}
try
{
_storage.SaveGameplay(gameplay);
_viewModel?.ApplyExternalGameplayChange(current => current with
{
AutoTarget = gameplay.AutoTarget,
AutoRepeatAttack = gameplay.AutoRepeatAttack,
ViewCombatTarget = gameplay.ViewCombatTarget,
});
}
catch (Exception ex)
{
_log($"settings: combat option save failed: {ex.Message}");
}
}
/// <summary>
/// Campaign OP slice OP3: the five client-local preferences the "Use
/// Mouse Turning Settings" Gameplay-tab macro reads/writes. Read
@ -545,6 +523,7 @@ internal sealed class RuntimeSettingsController :
Gameplay = gameplay;
_uiLockConverged = false;
_runtimeTargets?.ApplyUiLock(gameplay.LockUI);
_lastAppliedUiLocked = gameplay.LockUI;
_uiLockConverged = true;
_log($"settings: gameplay saved to {_storage.Location}");
}

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 =>
{

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Globalization;
using System.Threading;
namespace AcDream.Core.Chat;
@ -45,6 +46,27 @@ public sealed class ChatLog
_maxEntries = maxEntries;
}
/// <summary>
/// OP4 review-fix round (2026-08-11, SHOULD-FIX S1): retail
/// <c>PlayerOption DisplayTimeStamps</c> — <c>ClientSystem::
/// AddTextToScroll @0x00563C50</c> — prefixes EVERY transcript line
/// with the timestamp, not just the subset that happens to route
/// through <c>RuntimeCommunicationState.AddText</c>. Moved HERE
/// (from AddText) because <see cref="Append"/> is the ONE seam every
/// chat producer (<see cref="OnLocalSpeech"/>, <see cref="OnEmote"/>,
/// <see cref="OnSoulEmote"/>, <see cref="OnPlayerKilled"/>,
/// <see cref="OnChannelBroadcast"/>, <see cref="OnTellReceived"/>,
/// <see cref="OnSystemMessage"/>, <see cref="OnPopup"/>,
/// <see cref="OnCombatLine"/>, <see cref="OnSelfSent"/>) funnels
/// through — AddText's own callers (ServerMessage/WeenieError) were a
/// strict subset, so heard speech, emotes, Turbine channels, and
/// combat text never gained the prefix. The transient SpewBox
/// (<c>RetailLogTextType.ClientLocal</c>) never touches this class at
/// all, so it stays exempt automatically — matching retail's own
/// exemption without a special case here.
/// </summary>
public Func<bool>? DisplayTimestampsSource { get; set; }
/// <summary>Fires every time a new entry is appended.</summary>
public event Action<ChatEntry>? EntryAppended;
@ -413,6 +435,14 @@ public sealed class ChatLog
private void Append(ChatEntry entry)
{
if (DisplayTimestampsSource?.Invoke() == true)
{
entry = entry with
{
Text = FormatTimestampPrefix() + entry.Text,
};
}
_buffer.Enqueue(entry);
while (_buffer.Count > _maxEntries)
_buffer.TryDequeue(out _);
@ -420,6 +450,24 @@ public sealed class ChatLog
EntryAppended?.Invoke(entry);
}
/// <summary>
/// SF-1/S4 (OP4 review-fix round, 2026-08-11): retail's constructor
/// default <c>"%#H:%M:%S "</c> (<c>PlayerModule::PlayerModule
/// @0x005D51F0</c>, BN-sourced string literal — wire research doc U6,
/// NOT byte-verified) is non-zero-padded 24h hour, then zero-padded
/// minute:second, trailing space. <c>H\:mm\:ss </c> with the colons
/// ESCAPED (not the culture-dependent <c>DateTimeFormatInfo.
/// TimeSeparator</c> placeholder) plus <see cref="CultureInfo.
/// InvariantCulture"/> is the exact .NET equivalent — the CRT's
/// <c>strftime</c> always emits a literal colon regardless of locale.
/// acdream hardcodes this constructor default rather than reading the
/// per-character override retail sources from
/// <c>GenericQualitiesData::InqString(m_pPlayerOptionsData, 1, ...)</c>
/// — see register row AP-197.
/// </summary>
private static string FormatTimestampPrefix() =>
DateTime.Now.ToString(@"H\:mm\:ss ", CultureInfo.InvariantCulture);
public void Clear()
{
while (_buffer.TryDequeue(out _)) { /* drain */ }

View file

@ -1,6 +1,7 @@
using AcDream.Core.Combat;
using AcDream.Core.Items;
using AcDream.Core.Net;
using AcDream.Core.Net.Messages;
using AcDream.Core.Spells;
using AcDream.Content;
using AcDream.Runtime;
@ -124,8 +125,17 @@ internal sealed class HeadlessGameplayOperations
runtime.ActionOwner.Combat.CurrentMode);
}
}
public bool AutoRepeatAttack => false;
public bool AutoTarget => true;
// S5 (OP4 review-fix round, 2026-08-11, blast M2): OP7 gives headless
// bots a real `characterOptions` config that writes these very bits
// (HeadlessCharacterOptionsSeeder) — reading the hardcoded values here
// instead of the live server bit meant a bot configured with
// AutoRepeatAttack ON would set the server bit while its own combat
// loop kept reading `false`. Read the SAME RuntimeCharacterOptionsState
// seam the graphical host's CharacterOptionCombatSettingsSource uses.
public bool AutoRepeatAttack =>
RequireRuntime().CharacterOwner.Options.GetOptionBit(CharacterOptionId.AutoRepeatAttack);
public bool AutoTarget =>
RequireRuntime().CharacterOwner.Options.GetOptionBit(CharacterOptionId.AutoTarget);
public uint? SelectClosestTarget()
{

View file

@ -100,16 +100,32 @@ public sealed class RuntimeCommunicationState : IDisposable
/// DisplayTimeStamps</c> — <c>ClientSystem::AddTextToScroll
/// @0x00563C50</c> (character-options-map.md §2.2, "Display
/// Timestamps") prefixes each transcript line with
/// <c>PlayerModule::m_TimeStampFormat</c> (ctor default the byte-
/// verified CRT strftime string <c>"%#H:%M:%S "</c> — non-zero-padded
/// 24h hour, then zero-padded minute:second, trailing space) when the
/// option is on. Polled — see <see cref="AcDream.Core.World.
/// WeatherSystem.DisableDistanceFogSource"/> for why. Applied only to
/// the persisted <see cref="Chat"/> transcript (matching retail's own
/// <c>ClientLocal</c> exemption in <see cref="AddText"/> below — the
/// transient <see cref="SpewBox"/> is never timestamped).
/// <c>PlayerModule::m_TimeStampFormat</c> (ctor default the
/// BN-sourced CRT strftime string <c>"%#H:%M:%S "</c> — wire research
/// doc U6, NOT byte-verified — non-zero-padded 24h hour, then
/// zero-padded minute:second, trailing space) when the option is on.
/// Polled — see <see cref="AcDream.Core.World.
/// WeatherSystem.DisableDistanceFogSource"/> for why.
///
/// <para>
/// SHOULD-FIX S1 (OP4 review-fix round, 2026-08-11): the actual
/// prefixing now happens inside <see cref="Chat"/>'s own
/// <c>Append</c> — the ONE seam every chat producer funnels through,
/// not just this class's own <see cref="AddText"/> callers (a strict
/// subset that missed heard speech, emotes, Turbine channels, and
/// combat text). This property forwards to
/// <see cref="ChatLog.DisplayTimestampsSource"/> so existing callers
/// (<c>GameWindow</c>'s one-time bind) keep working unchanged. The
/// transient <see cref="SpewBox"/> never touches <see cref="Chat"/>
/// at all, so it stays exempt automatically — matching retail's own
/// <c>ClientLocal</c> exemption without a special case here.
/// </para>
/// </summary>
public Func<bool>? DisplayTimestampsSource { get; set; }
public Func<bool>? DisplayTimestampsSource
{
get => Chat.DisplayTimestampsSource;
set => Chat.DisplayTimestampsSource = value;
}
public ChatCommandTargetState CommandTargets { get; }
public TurbineChatState TurbineChat { get; }
@ -216,14 +232,9 @@ public sealed class RuntimeCommunicationState : IDisposable
return;
}
// OP4: DisplayTimeStamps — see DisplayTimestampsSource's doc
// comment. Prefixed AFTER the trim above (retail's own order:
// AddTextToScroll trims first, then ClientSystem's caller-side
// timestamp prepend applies to the transcript line, never to the
// ClientLocal/SpewBox branch already returned above).
if (DisplayTimestampsSource?.Invoke() == true)
text = DateTime.Now.ToString("H:mm:ss ") + text;
// S1 (OP4 review-fix round, 2026-08-11): the DisplayTimeStamps
// prefix now applies inside Chat's own Append — see
// DisplayTimestampsSource's doc comment.
Chat.OnSystemMessage(text, (uint)type);
}

View file

@ -145,8 +145,11 @@ public sealed class RuntimeLocalPlayerMovementState
public bool AutoRunActive => _autoRunActive;
/// <summary>
/// Campaign OP slice OP4 (2026-08-11): retail <c>PlayerOption
/// RunAsDefaultMovement</c> (<c>ACCmdInterp::UITogglesRun</c>) —
/// Campaign OP slice OP4 (2026-08-11): retail <c>PlayerOption</c> id
/// <c>0xA</c> — <c>acclient.h</c>'s own enumerator spelling is
/// <c>ToggleRun_PlayerOption</c>; "RunAsDefaultMovement" is ACE's name
/// for the same bit, corrected here at the OP4 review-fix round
/// (2026-08-11, N7) — read via <c>ACCmdInterp::UITogglesRun</c> —
/// whether an ordinary held movement key runs by default (retail's own
/// client default: <see langword="true"/>) or walks by default,
/// requiring the walk-mode modifier to be held to invert. Distinct

View file

@ -24,9 +24,16 @@ namespace AcDream.UI.Abstractions.Panels.Settings;
/// </summary>
public sealed record GameplaySettings(
// CharacterOption (32-bit) subset — most-used gameplay toggles.
bool AutoTarget, // 0x2000 — combat: auto-acquire target on attack
bool AutoRepeatAttack, // 0x2 — combat: keep attacking after first hit
bool ViewCombatTarget, // 0x80 — keep the current combat target in view
//
// OP4 review-fix round (2026-08-11, MUST-FIX 3 / blast M2): AutoTarget,
// AutoRepeatAttack, and ViewCombatTarget were REMOVED from this record
// — the Combat panel's three LEDs now read/write the SAME canonical
// server-bit seam (RuntimeCharacterOptionsState via
// CharacterOptionCombatSettingsSource) the Character tab's rows for
// these same retail PlayerOptions already used, closing the
// "two writable copies" divergence (register row AP-196). This record
// remains the client-local persistence/draft store for every OTHER
// gameplay preference that has no such server-authoritative seam.
bool ToggleRun, // 0x400 — run-mode is tap-once vs hold-to-run
bool AdvancedCombatUI, // 0x1000 — show extra combat tooltips/panels
bool ShowTooltips, // 0x100 — show item tooltips on hover
@ -46,9 +53,6 @@ public sealed record GameplaySettings(
/// to retail's <c>Default_CharacterOption = 0x50C4A54A</c> +
/// <c>Default_CharacterOptions2 = 0x948700</c> — see class remarks.</summary>
public static GameplaySettings Default { get; } = new(
AutoTarget: true,
AutoRepeatAttack: true,
ViewCombatTarget: true,
ToggleRun: true,
AdvancedCombatUI: false,
ShowTooltips: true,

View file

@ -299,17 +299,15 @@ public sealed class SettingsPanel : IPanel
renderer.Text("Combat");
renderer.Separator();
bool autoTarget = g.AutoTarget;
if (renderer.Checkbox("Auto-target on attack", ref autoTarget))
_vm.SetGameplay(g with { AutoTarget = autoTarget });
bool autoRepeat = g.AutoRepeatAttack;
if (renderer.Checkbox("Auto-repeat attacks", ref autoRepeat))
_vm.SetGameplay(g with { AutoRepeatAttack = autoRepeat });
bool viewCombatTarget = g.ViewCombatTarget;
if (renderer.Checkbox("Keep combat target in view", ref viewCombatTarget))
_vm.SetGameplay(g with { ViewCombatTarget = viewCombatTarget });
// OP4 review-fix round (2026-08-11, MUST-FIX 3 / blast M2):
// Auto-target/Auto-repeat/Keep-in-view were removed from
// GameplaySettings — they now read/write the canonical server bit
// (RuntimeCharacterOptionsState) through CombatUiController, not
// this client-local draft. This panel has no production
// construction site (D.2b's retained UiHost/UiRoot stack is the
// one presentation surface — see CLAUDE.md's UI strategy section);
// the three checkboxes are simply retired rather than re-pointed
// to a seam this dat-free ImGui-shaped panel has no way to reach.
bool toggleRun = g.ToggleRun;
if (renderer.Checkbox("Run mode is toggle (vs hold)", ref toggleRun))

View file

@ -144,9 +144,6 @@ public sealed class SettingsStore
var d = GameplaySettings.Default;
return new GameplaySettings(
AutoTarget: ReadBool(gp, "autoTarget", d.AutoTarget),
AutoRepeatAttack: ReadBool(gp, "autoRepeatAttack", d.AutoRepeatAttack),
ViewCombatTarget: ReadBool(gp, "viewCombatTarget", d.ViewCombatTarget),
ToggleRun: ReadBool(gp, "toggleRun", d.ToggleRun),
AdvancedCombatUI: ReadBool(gp, "advancedCombatUI", d.AdvancedCombatUI),
ShowTooltips: ReadBool(gp, "showTooltips", d.ShowTooltips),
@ -603,9 +600,6 @@ public sealed class SettingsStore
["advancedCombatUI"] = g.AdvancedCombatUI,
["acceptLootPermits"] = g.AcceptLootPermits,
["allowGive"] = g.AllowGive,
["autoRepeatAttack"] = g.AutoRepeatAttack,
["autoTarget"] = g.AutoTarget,
["viewCombatTarget"] = g.ViewCombatTarget,
["coordinatesOnRadar"] = g.CoordinatesOnRadar,
["lockUI"] = g.LockUI,
["showCloak"] = g.ShowCloak,