Fixes the three MUST-FIX findings from the 2026-08-11 combined dual-lens
review of commit b4edee97 (docs/research/2026-08-11-op8-review.md).
M1 — SetForAction destroyed ActivationType/InputScope on every write,
collapsing walk-mode's Hold, the three combat-scoped bindings, and
CameraInstantMouseLook's mouse chord the instant a row (including
Defaults, which touches all ~140 mapped rows at once) wrote back.
Widened the Bindings seam to carry the full Binding (chord + activation
+ scope), not a bare chord: KeyboardConfigController captures each
row's live Activation/Scope ONCE at build time (every multi-chord
action in KeyBindings.RetailDefaults() shares one pair across all its
bindings) and reapplies it on every write — rebind, Cancel/Revert, and
Defaults (which restores DAT-sourced KEYS only, never touches the
pair). New tests pin this across both Defaults and Cancel for a
Hold+MeleeCombat-scoped action.
M2 — InputMap 0x5 (CameraControls) and 0x6 (CameraAlternateControls)
aliased one InputAction each: both rows read/wrote the same live target,
so they showed identical stale chords, a rebind of one silently wiped
the other, and a row could conflict with its own twin. Building real
per-scheme dual-binding storage (or new InputAction members plus the
camera-dispatch code to consume them) is a feature, not a one-line fix.
Chose the third option: only ctx 0x5 — the scheme RetailDefaults()
actually has live support for — maps to InputAction; ctx 0x6 falls
through to the existing unmapped/store-only path (AP-203), fully
rendered, bindable, and persisted, honestly carrying no live effect.
This also retired 10 stale allowlist entries in the DAT-vs-
RetailDefaults() round-trip test: with the alias gone, ctx 0x5 alone
matches RetailDefaults() exactly for all twelve Camera actions.
M3 — the auto-reassign-on-conflict path was wired silent in production
(NotifyReassigned: _ => "") though the contract asked for a prompt and
retail confirms before overwriting (OpenOverwriteBindingDialog). Wired
a real confirm dialog through RetailDialogFactory.MakeConfirmation —
the same seam GameplayConfirmationController already uses — read
lazily since DialogFactory mounts after MountKeyboardConfig in
Initialize()'s order. Only reassigns on accept; decline leaves every
row untouched. AP-204 (which recorded the narrowing) is RETIRED; the
still-true OK/Cancel left-click-vs-right-click-release note moves to a
code comment (zero observable difference, doesn't warrant a register
row). Reverted the gate script's step 9 from documenting the silent
shape back to the real confirm-prompt behavior.
SHOULD-FIX addressed as one-liners in files already touched:
- S1: non-user-bindable conflicts are now checked BEFORE any row
conflict (retail's own order), and ALL conflicting rows are collected
(N-way), not just the first match.
- S3: Save wraps the file-write pair in the same try/catch
RuntimeKeyBindingTarget.Apply already uses for keybinds.json.
- S4: assigning "Mapping 3" on a row with no existing bindings now
lands on display index 2, not index 0 — ReplaceSlotValue trims only
TRAILING empty slots instead of stripping every default(KeyChord).
Right-click on an already-empty slot is now a no-op instead of
shifting later bindings.
- S6: UiButton.OnRightClick returns false (unhandled, bubbles to
parent) when no handler is set, disabled or not — matching the
pre-existing behavior the class doc already claimed.
Left for a future pass (not one-liners): S2 (ActionMap.ConflictingMaps
is still unread — the conflict scan treats all 306 rows as one flat
universe instead of respecting the DAT's own legitimately-shared-key
table) and S5 (the ~330 DAT layout imports still run eagerly at mount
instead of lazily on first open).
19 KeyboardConfigControllerTests (was 12): +2 activation/scope
preservation (Defaults, Cancel), +1 camera de-alias, +2 confirm-dialog
accept/decline, +1 non-bindable-takes-priority-over-row-conflict, +1
sparse-row third-slot placement. Full solution suite 13,154 passed / 4
skipped / 0 failed (this round's baseline 13,147/4/0, zero regressions).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
254 lines
15 KiB
C#
254 lines
15 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace AcDream.UI.Abstractions.Input;
|
|
|
|
/// <summary>
|
|
/// Campaign OP slice OP8: maps a retail DAT ActionMap row — the
|
|
/// <c>(InputMap id, Action id)</c> pair <c>AcDream.Core.Input.RetailActionMapRow</c>
|
|
/// carries — to acdream's own <see cref="InputAction"/>, when one exists.
|
|
///
|
|
/// <para>
|
|
/// <b>Why this table exists.</b> The DAT ActionMap singleton (empirically dumped
|
|
/// 2026-08-11, see <c>AcDream.Core.Input.RetailActionMap</c>'s class doc) carries 306
|
|
/// user-bindable rows. <see cref="InputAction"/> — the enum every OTHER acdream input
|
|
/// path (live dispatch, <c>KeyBindings</c>, <c>InputDispatcher</c>) already keys on —
|
|
/// has roughly half that many members, because it was authored around "what acdream
|
|
/// currently implements" (K.1a/K.1c), not "every action the 2013 client's keymap
|
|
/// screen can show." Two categories are the biggest gaps: 82 of the DAT's 87 Emote
|
|
/// rows have no acdream animation dispatch yet (only 5 are wired: Cry/Laugh/Cheer/
|
|
/// Wave/PointState — exactly the 5 that happen to carry retail default keys), and all
|
|
/// 48 CharacterSettings rows are hotkeys for the SAME <c>PlayerOption</c>/
|
|
/// <c>CharacterOptions</c> preference bits OP1's <c>CharacterOptionTable</c> and OP4's
|
|
/// Character-tab checkboxes already model — wiring "press this key, flip that same
|
|
/// server-synced bit" is a real feature (a hotkey-to-option-toggle dispatcher) that
|
|
/// does not exist yet anywhere in acdream and is out of scope for this slice (see the
|
|
/// OP8 register row).
|
|
/// </para>
|
|
///
|
|
/// <para>
|
|
/// <b>Every mapping below was verified two ways</b> before being added: (1) the DAT's
|
|
/// resolved English label/tooltip unambiguously names the SAME action as the
|
|
/// <see cref="InputAction"/> member's own XML doc, AND (2) where the retail default
|
|
/// key(s) for that DAT row are non-empty, they match
|
|
/// <see cref="KeyBindings.RetailDefaults"/>'s existing chord(s) for the candidate
|
|
/// <see cref="InputAction"/> (byte-verified 2026-08-11 against the installed dats —
|
|
/// see <c>RetailActionMapReaderTests.LiveDatTests</c> and this slice's
|
|
/// <c>RetailActionIdentityRoundTripTests</c>). A DAT row that could not be verified
|
|
/// BOTH ways is left OUT of this table on purpose — it renders on the Configure
|
|
/// Keyboard screen as a real, bindable, persisted row (see
|
|
/// <c>KeyboardConfigController</c>), it just does not yet reach any live acdream
|
|
/// consumer. Silently guessing a wrong mapping would misroute a user's rebind to the
|
|
/// WRONG gameplay action, which is worse than an honest "not wired yet."
|
|
/// </para>
|
|
///
|
|
/// <para>
|
|
/// <b>Known gaps deliberately left unmapped</b> (register row, OP8):
|
|
/// Spell Slot 10/11/12 (ctx <c>0x10000005</c>, DAT actions <c>0x6E/0x6F/0x70</c> —
|
|
/// <see cref="InputAction"/> only defines <c>UseSpellSlot_1..9</c>); Quickslot
|
|
/// 10/11/12/13 (ctx <c>0x1000000C</c>, DAT actions <c>0x1000004B/4C/4D/10000132</c> —
|
|
/// <see cref="InputAction"/>'s <c>UseQuickSlot_*</c> family jumps from 9 straight to
|
|
/// 14, a pre-existing enum gap this slice did not introduce and does not fix); every
|
|
/// CharacterSettings row (ctx <c>0x10000008</c>, all 48); 82 of 87 Emote rows (ctx
|
|
/// <c>0x10000006</c>); all 10 CameraAlternateControls rows (ctx <c>0x6</c> — the M2
|
|
/// de-alias carve-out, see the mapping table's own comment); and roughly half of the
|
|
/// UI-class rows (ctx <c>0x10000007</c>/<c>0x10000009</c> — panels acdream has no
|
|
/// toggle for, e.g. Vitae, Link Status, House, Map, Character Info, the
|
|
/// positive/negative Magic panels).
|
|
/// </para>
|
|
/// </summary>
|
|
public static class RetailActionIdentityTable
|
|
{
|
|
/// <summary>(InputMap id, Action id) → the acdream <see cref="InputAction"/> that
|
|
/// owns live dispatch for it. A DAT row whose key is absent has no acdream
|
|
/// consumer yet.</summary>
|
|
public static readonly IReadOnlyDictionary<(uint InputMapId, uint ActionId), InputAction> Map =
|
|
BuildTable();
|
|
|
|
public static bool TryResolve(uint inputMapId, uint actionId, out InputAction action) =>
|
|
Map.TryGetValue((inputMapId, actionId), out action);
|
|
|
|
private static Dictionary<(uint, uint), InputAction> BuildTable()
|
|
{
|
|
var t = new Dictionary<(uint, uint), InputAction>();
|
|
void M(uint inputMapId, uint actionId, InputAction action) => t[(inputMapId, actionId)] = action;
|
|
|
|
// ── MovementCommands (ctx 0x4) — 14/14, complete. ──────────────
|
|
M(0x4, 0x29, InputAction.MovementForward);
|
|
M(0x4, 0x2A, InputAction.MovementBackup);
|
|
M(0x4, 0x2B, InputAction.MovementStop);
|
|
M(0x4, 0x2C, InputAction.MovementStrafeRight);
|
|
M(0x4, 0x2D, InputAction.MovementStrafeLeft);
|
|
M(0x4, 0x2E, InputAction.MovementTurnRight);
|
|
M(0x4, 0x2F, InputAction.MovementTurnLeft);
|
|
M(0x4, 0x30, InputAction.MovementRunLock);
|
|
M(0x4, 0x31, InputAction.MovementJump);
|
|
M(0x4, 0x32, InputAction.MovementWalkMode);
|
|
M(0x4, 0x10000094, InputAction.Ready);
|
|
M(0x4, 0x10000095, InputAction.Crouch);
|
|
M(0x4, 0x10000096, InputAction.Sitting);
|
|
M(0x4, 0x10000097, InputAction.Sleeping);
|
|
|
|
// ── CameraControls (ctx 0x5) — 12/12. ──────────────────────────
|
|
// M2 REWORK (2026-08-11 review): CameraControls (ctx 0x5, the
|
|
// Numpad-default scheme RetailDefaults() actually carries) and
|
|
// CameraAlternateControls (ctx 0x6, the arrow-key alternate scheme
|
|
// RetailDefaults() never had — see
|
|
// RetailActionIdentityRoundTripTests' now-retired camera allowlist
|
|
// entries) were both previously mapped to the SAME InputAction.
|
|
// KeyBindings/Binding has no "which scheme" tag, and SetForAction is
|
|
// whole-action replacement, so the two rows aliased one live target:
|
|
// both showed identical (stale) chords, rebinding one silently wiped
|
|
// the other, and a row could conflict with its own twin. Building
|
|
// real per-scheme dual-binding storage (or ten new InputAction
|
|
// members plus the camera-dispatch code to consume them) is a real
|
|
// feature, not a one-line fix, and out of scope for this rework. Only
|
|
// ctx 0x5 — the scheme that already has a live, verified
|
|
// RetailDefaults() presence — maps here; ctx 0x6 falls through to the
|
|
// generic unmapped/store-only path below (AP-203), fully renderable,
|
|
// bindable and persisted, honestly carrying no live effect, exactly
|
|
// like every other unmapped row.
|
|
M(0x5, 0x33, InputAction.CameraMoveToward);
|
|
M(0x5, 0x34, InputAction.CameraMoveAway);
|
|
M(0x5, 0x35, InputAction.CameraRotateLeft);
|
|
M(0x5, 0x36, InputAction.CameraRotateRight);
|
|
M(0x5, 0x37, InputAction.CameraRotateUp);
|
|
M(0x5, 0x38, InputAction.CameraRotateDown);
|
|
M(0x5, 0x39, InputAction.CameraViewDefault);
|
|
M(0x5, 0x3A, InputAction.CameraViewFirstPerson);
|
|
M(0x5, 0x3B, InputAction.CameraViewLookDown);
|
|
M(0x5, 0x3C, InputAction.CameraViewMapMode);
|
|
M(0x5, 0x3D, InputAction.CameraInstantMouseLook);
|
|
M(0x5, 0x3E, InputAction.CameraActivateAlternateMode);
|
|
|
|
// ── Combat (ctx 0x10000002) — 1/1. ─────────────────────────────
|
|
M(0x10000002, 0x1000005A, InputAction.CombatToggleCombat);
|
|
|
|
// ── MeleeCombat (ctx 0x10000003) — 5/5. ────────────────────────
|
|
M(0x10000003, 0x1000005B, InputAction.CombatDecreaseAttackPower);
|
|
M(0x10000003, 0x1000005C, InputAction.CombatIncreaseAttackPower);
|
|
M(0x10000003, 0x1000005D, InputAction.CombatLowAttack);
|
|
M(0x10000003, 0x1000005E, InputAction.CombatMediumAttack);
|
|
M(0x10000003, 0x1000005F, InputAction.CombatHighAttack);
|
|
|
|
// ── MissileCombat (ctx 0x10000004) — 5/5. ──────────────────────
|
|
M(0x10000004, 0x100000EF, InputAction.CombatDecreaseMissileAccuracy);
|
|
M(0x10000004, 0x100000F0, InputAction.CombatIncreaseMissileAccuracy);
|
|
M(0x10000004, 0x100000F1, InputAction.CombatAimLow);
|
|
M(0x10000004, 0x100000F2, InputAction.CombatAimMedium);
|
|
M(0x10000004, 0x100000F3, InputAction.CombatAimHigh);
|
|
|
|
// ── MagicCombat (ctx 0x10000005) — 18/21 (Spell Slot 10/11/12 have
|
|
// no InputAction — register row). ────────────────────────────
|
|
M(0x10000005, 0x10000060, InputAction.CombatCastCurrentSpell);
|
|
M(0x10000005, 0x10000061, InputAction.CombatPrevSpell);
|
|
M(0x10000005, 0x10000062, InputAction.CombatNextSpell);
|
|
M(0x10000005, 0x10000063, InputAction.CombatPrevSpellTab);
|
|
M(0x10000005, 0x10000064, InputAction.CombatNextSpellTab);
|
|
M(0x10000005, 0x10000065, InputAction.UseSpellSlot_1);
|
|
M(0x10000005, 0x10000066, InputAction.UseSpellSlot_2);
|
|
M(0x10000005, 0x10000067, InputAction.UseSpellSlot_3);
|
|
M(0x10000005, 0x10000068, InputAction.UseSpellSlot_4);
|
|
M(0x10000005, 0x10000069, InputAction.UseSpellSlot_5);
|
|
M(0x10000005, 0x1000006A, InputAction.UseSpellSlot_6);
|
|
M(0x10000005, 0x1000006B, InputAction.UseSpellSlot_7);
|
|
M(0x10000005, 0x1000006C, InputAction.UseSpellSlot_8);
|
|
M(0x10000005, 0x1000006D, InputAction.UseSpellSlot_9);
|
|
// 0x6E/0x6F/0x70 (Spell Slot 10/11/12) — no InputAction. Unmapped.
|
|
M(0x10000005, 0x10000102, InputAction.CombatFirstSpell);
|
|
M(0x10000005, 0x10000103, InputAction.CombatLastSpell);
|
|
M(0x10000005, 0x10000104, InputAction.CombatFirstSpellTab);
|
|
M(0x10000005, 0x10000105, InputAction.CombatLastSpellTab);
|
|
|
|
// ── Emotes (ctx 0x10000006) — 5/87 (the only 5 acdream dispatches
|
|
// an animation for; also the only 5 with retail default keys). ──
|
|
M(0x10000006, 0x100000A2, InputAction.Cheer);
|
|
M(0x10000006, 0x100000A7, InputAction.Cry);
|
|
M(0x10000006, 0x100000B2, InputAction.Laugh);
|
|
M(0x10000006, 0x100000BE, InputAction.PointState);
|
|
M(0x10000006, 0x100000E5, InputAction.Wave);
|
|
|
|
// ── ItemSelectionCommands (ctx 0x10000007) — 17/26. ────────────
|
|
M(0x10000007, 0x1000002D, InputAction.SelectionSplitStack);
|
|
M(0x10000007, 0x1000002E, InputAction.SelectionPreviousSelection);
|
|
M(0x10000007, 0x1000002F, InputAction.SelectionClosestCompassItem);
|
|
M(0x10000007, 0x10000030, InputAction.SelectionPreviousCompassItem);
|
|
M(0x10000007, 0x10000031, InputAction.SelectionNextCompassItem);
|
|
M(0x10000007, 0x10000032, InputAction.SelectionClosestItem);
|
|
M(0x10000007, 0x10000033, InputAction.SelectionPreviousItem);
|
|
M(0x10000007, 0x10000034, InputAction.SelectionNextItem);
|
|
M(0x10000007, 0x10000035, InputAction.SelectionClosestMonster);
|
|
M(0x10000007, 0x10000036, InputAction.SelectionPreviousMonster);
|
|
M(0x10000007, 0x10000037, InputAction.SelectionNextMonster);
|
|
M(0x10000007, 0x10000038, InputAction.SelectionLastAttacker);
|
|
M(0x10000007, 0x10000039, InputAction.SelectionClosestPlayer);
|
|
M(0x10000007, 0x1000003A, InputAction.SelectionPreviousPlayer);
|
|
M(0x10000007, 0x1000003B, InputAction.SelectionNextPlayer);
|
|
M(0x10000007, 0x1000003C, InputAction.SelectionPreviousFellow);
|
|
M(0x10000007, 0x1000003D, InputAction.SelectionNextFellow);
|
|
|
|
// ── UICommands (ctx 0x10000009) — 22/42. ───────────────────────
|
|
M(0x10000009, 0x55, InputAction.CaptureScreenshot);
|
|
M(0x10000009, 0x7B, InputAction.ToggleHelp);
|
|
M(0x10000009, 0x7C, InputAction.TogglePluginManager);
|
|
M(0x10000009, 0x1000000E, InputAction.ToggleAllegiancePanel);
|
|
M(0x10000009, 0x1000000F, InputAction.ToggleFellowshipPanel);
|
|
M(0x10000009, 0x10000011, InputAction.ToggleSpellbookPanel);
|
|
M(0x10000009, 0x10000012, InputAction.ToggleSpellComponentsPanel);
|
|
M(0x10000009, 0x10000014, InputAction.ToggleAttributesPanel);
|
|
M(0x10000009, 0x10000015, InputAction.ToggleSkillsPanel);
|
|
M(0x10000009, 0x10000016, InputAction.ToggleWorldPanel);
|
|
M(0x10000009, 0x1000001A, InputAction.ToggleOptionsPanel);
|
|
M(0x10000009, 0x10000019, InputAction.ToggleInventoryPanel);
|
|
M(0x10000009, 0x10000114, InputAction.ToggleFloatingChatWindow1);
|
|
M(0x10000009, 0x10000115, InputAction.ToggleFloatingChatWindow2);
|
|
M(0x10000009, 0x10000116, InputAction.ToggleFloatingChatWindow3);
|
|
M(0x10000009, 0x10000117, InputAction.ToggleFloatingChatWindow4);
|
|
M(0x10000009, 0x10000025, InputAction.UseSelected);
|
|
M(0x10000009, 0x10000026, InputAction.LOGOUT);
|
|
M(0x10000009, 0x1000002B, InputAction.SelectionExamine);
|
|
// 0x1000001F ("Show/Hide Keyboard Configuration") deliberately left
|
|
// unmapped: it is the retail action that opens THIS screen
|
|
// (research doc §4.3/lane A §7 — wired directly by
|
|
// KeyboardConfigController's mount, not through InputAction).
|
|
|
|
// ── ChatCommands (ctx 0x1000000A) — 1/6. ───────────────────────
|
|
M(0x1000000A, 0x10000023, InputAction.EnterChatMode);
|
|
|
|
// ── ToggleChatEntry (ctx 0x1000000D) — 1/1. ────────────────────
|
|
M(0x1000000D, 0x10000024, InputAction.ToggleChatEntry);
|
|
|
|
// ── QuickslotCommands (ctx 0x1000000C) — 24/28 (Quickslot
|
|
// 10/11/12/13 have no InputAction — pre-existing enum gap). ──
|
|
M(0x1000000C, 0x10000042, InputAction.UseQuickSlot_1);
|
|
M(0x1000000C, 0x10000043, InputAction.UseQuickSlot_2);
|
|
M(0x1000000C, 0x10000044, InputAction.UseQuickSlot_3);
|
|
M(0x1000000C, 0x10000045, InputAction.UseQuickSlot_4);
|
|
M(0x1000000C, 0x10000046, InputAction.UseQuickSlot_5);
|
|
M(0x1000000C, 0x10000047, InputAction.UseQuickSlot_6);
|
|
M(0x1000000C, 0x10000048, InputAction.UseQuickSlot_7);
|
|
M(0x1000000C, 0x10000049, InputAction.UseQuickSlot_8);
|
|
M(0x1000000C, 0x1000004A, InputAction.UseQuickSlot_9);
|
|
M(0x1000000C, 0x1000004E, InputAction.SelectQuickSlot_1);
|
|
M(0x1000000C, 0x1000004F, InputAction.SelectQuickSlot_2);
|
|
M(0x1000000C, 0x10000050, InputAction.SelectQuickSlot_3);
|
|
M(0x1000000C, 0x10000051, InputAction.SelectQuickSlot_4);
|
|
M(0x1000000C, 0x10000052, InputAction.SelectQuickSlot_5);
|
|
M(0x1000000C, 0x10000053, InputAction.SelectQuickSlot_6);
|
|
M(0x1000000C, 0x10000054, InputAction.SelectQuickSlot_7);
|
|
M(0x1000000C, 0x10000055, InputAction.SelectQuickSlot_8);
|
|
M(0x1000000C, 0x10000056, InputAction.SelectQuickSlot_9);
|
|
M(0x1000000C, 0x1000010D, InputAction.CreateShortcut);
|
|
// 0x10000132 ("Quickslot 13") has no InputAction — same pre-existing
|
|
// UseQuickSlot_10..13 enum gap as the bare-numeral block above. Unmapped.
|
|
M(0x1000000C, 0x10000133, InputAction.UseQuickSlot_14);
|
|
M(0x1000000C, 0x10000134, InputAction.UseQuickSlot_15);
|
|
M(0x1000000C, 0x10000135, InputAction.UseQuickSlot_16);
|
|
M(0x1000000C, 0x10000136, InputAction.UseQuickSlot_17);
|
|
M(0x1000000C, 0x10000137, InputAction.UseQuickSlot_18);
|
|
|
|
// CharacterSettings (ctx 0x10000008) is intentionally EMPTY here —
|
|
// see class doc "Known gaps deliberately left unmapped".
|
|
|
|
return t;
|
|
}
|
|
}
|