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:
parent
85afaae5fd
commit
bc43fb1d1d
36 changed files with 923 additions and 220 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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 = () =>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
},
|
||||
{
|
||||
"stage": "frag",
|
||||
"sourceSha256": "8de9a5d8f819d1abf893f134cf8ed9fa7edf937a353a74d2befab7b05a3ff700",
|
||||
"sourceSha256": "2ddf210d69b0c4a3c0870eecfb0ccba2097d93b365729739402bfe91e3b120d0",
|
||||
"compiled": true
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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 =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue