feat(ui): Campaign OP slice OP2 — tab control, template ListBox, UIOption widget mappings
Ships the two new widget primitives the retail Options panel needs plus the
four remaining UIOption_* factory mappings, so every tab page (OP3-OP6) has
somewhere to mount.
- ElementReader/ElementInfo gain three new dat-property readers, following
the existing effective-state-resolution pattern (never a per-state
first-wins scan, per the round-5 N1 lesson): the Type-8 tab table
(property 0x2E -> TabTable), a ListBox's row-template list (property
0x64 -> TemplateList), and scrollbar linkage (property 0x72 ->
ScrollbarElementId). LayoutImporter gains one hook
(IUiChildrenAttachedListener) so a widget can resolve cross-references
its own dat properties name by id once its subtree actually exists.
- UiTabControl (Type 8): switches exactly one page-slot child visible,
syncs each tab button's Open/Closed state via the existing
RetailTabBinding helper, and honors the authored default tab on mount.
- UiTemplateListBox (Type 5 with an authored template list): wraps a
UiScrollablePanel viewport (sealed, so composition not inheritance) and
ports AddItemFromTemplateList(index) — the resolver seam a page
controller wires with real DAT access via the SAME
LayoutImporter.ImportInfos(dats, layoutId, elementId) overload
RetailDialogFactory already uses for its catalog LayoutDesc.
- DatWidgetFactory maps the four remaining UIOption_* widgets, each
verified against the regenerated options_2100002B.json fixture before
writing any code: 0x10000037 (Slider) is structurally an ordinary
horizontal UIElement_Scrollbar, so it reuses BuildScrollbar directly;
0x10000038 (Menu) is structurally identical to the vendor category
dropdown UiMenu already models, so it reuses `new UiMenu()` like the
Type-6 case; 0x10000036 (CheckboxSlider) composes an existing
UIOption_Checkbox child + UIOption_Slider child via the new
UiOptionToggleSlider wrapper; 0x10000044 (CheckboxBitfield64) authors
zero children in the dat (every row is added at runtime via retail's own
AddChild(lowMask, highMask, label, tooltip) call shape), so it's a new
UiCheckboxBitfield64 composing UiButton per row. No new drawing code
anywhere in this set.
- Five new committed fixtures (options_2100002B/2100002A/21000028/
2100005C/21000029) plus 25 new conformance tests pinning the tab table
(4 entries, Gameplay default), all three template arrays, scrollbar
linkage, every new widget-type mapping, and a UiTabControl behavioral
test (switch -> exactly one page visible, click-through the tab
button). The Character ListBox's authored 6-header/49-toggle shape
(lane B section counts) is proven reachable end-to-end through
AddItemFromTemplateList against the committed fixture.
- Regenerating fixtures also touched 27 PRE-EXISTING, unrelated fixtures
(an Outline/OutlineColor field pair added by an earlier commit,
bcc34ee3, that predates when those fixtures were last regenerated).
Per the slice contract, that drift was NOT committed — reverted back to
HEAD, only the five new Options-panel fixtures are new files here.
- Filed TS-72: UiCheckboxBitfield64's click-toggle bit math (AND/OR
set/clear semantics) is a documented approximation — the decompiled
excerpt this campaign pulled covers UIOption_CheckboxBitfield64::Apply's
WRITE side, not its own click-handler's bit math. Flagged for OP5 (the
Chat tab controller, the first consumer that reaches the wire) to
verify against the real decomp before any live transaction depends on
it; nothing user-reachable can observe this yet.
Full Release suite: 12,770 passed / 4 skipped / 0 failed (was 12,745/4/0
post-OP1 — 25 net new tests, zero regressions).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
0df0a60424
commit
df9c7a35eb
17 changed files with 51896 additions and 1 deletions
|
|
@ -17,6 +17,27 @@ public enum HJustify : byte { Left = 0, Center = 1, Right = 2 }
|
|||
/// </summary>
|
||||
public enum VJustify : byte { Top = 0, Center = 1, Bottom = 2 }
|
||||
|
||||
/// <summary>
|
||||
/// One row of a Type-8 tab control's authored tab table (dat property <c>0x2E</c>, an
|
||||
/// array of <c>StructBaseProperty</c> with <c>MasterPropertyId 0x2F</c>). Retail
|
||||
/// <c>0x2100002B</c> §1.3: <see cref="ButtonElementId"/> is the clickable tab button
|
||||
/// (struct member <c>0x30</c>), <see cref="PageElementId"/> is the page-slot child it
|
||||
/// activates (<c>0x31</c>), and <see cref="IsDefault"/> marks the one entry
|
||||
/// (<c>0x32</c>) whose page is shown when the tab control first mounts.
|
||||
/// </summary>
|
||||
public readonly record struct UiTabTableEntry(uint ButtonElementId, uint PageElementId, bool IsDefault);
|
||||
|
||||
/// <summary>
|
||||
/// One row of a Type-5 ListBox's authored row-template list (dat property <c>0x64</c>,
|
||||
/// an array of <c>StructBaseProperty</c>). Retail <c>0x2100002B</c> §1.5:
|
||||
/// <see cref="TemplateLayoutId"/> is the LayoutDesc DID carrying the template element
|
||||
/// (struct member <c>0x63</c>), <see cref="TemplateElementId"/> is the template root
|
||||
/// within that layout (<c>0x62</c>). Retail
|
||||
/// <c>UIElement_ListBox::AddItemFromTemplateList(index)</c> instantiates row
|
||||
/// <c>index</c>'s subtree through this pair.
|
||||
/// </summary>
|
||||
public readonly record struct UiTemplateListEntry(uint TemplateLayoutId, uint TemplateElementId);
|
||||
|
||||
/// <summary>
|
||||
/// GL-free, dat-free snapshot of a resolved layout element.
|
||||
/// Populated by the LayoutDesc importer from <c>DatReaderWriter.ElementDesc</c>
|
||||
|
|
@ -158,6 +179,33 @@ public sealed class ElementInfo
|
|||
/// </summary>
|
||||
public List<ElementInfo> Children = new();
|
||||
|
||||
/// <summary>
|
||||
/// Tab table read from dat property <c>0x2E</c> (Type-8 <c>UIElement_TabControl</c>
|
||||
/// only — empty on every other element). Populated once via
|
||||
/// <see cref="ElementReader.ApplyCanonicalLegacyProjection"/> using the canonical
|
||||
/// effective-state resolution, exactly like <see cref="Outline"/>/<see cref="OutlineColor"/>
|
||||
/// above — never scanned per-state as each <c>StateDesc</c> is read (round-5 N1's
|
||||
/// "first wins on any state can pick a non-effective override" trap applies equally
|
||||
/// here; see the comment on the skipped per-state 0x21 read in
|
||||
/// <c>LayoutImporter.ReadState</c>).
|
||||
/// </summary>
|
||||
public List<UiTabTableEntry> TabTable = new();
|
||||
|
||||
/// <summary>
|
||||
/// ListBox row-template list read from dat property <c>0x64</c> (Type-5
|
||||
/// <c>UIElement_ListBox</c> elements that author one — empty otherwise). Populated
|
||||
/// the same way as <see cref="TabTable"/>.
|
||||
/// </summary>
|
||||
public List<UiTemplateListEntry> TemplateList = new();
|
||||
|
||||
/// <summary>
|
||||
/// Element id of this ListBox's linked scrollbar, read from dat property
|
||||
/// <c>0x72</c> (e.g. the Character page's ListBox <c>0x100001FA</c> names
|
||||
/// scrollbar <c>0x100001FB</c>). 0 when the element authors no scrollbar
|
||||
/// reference. Populated the same way as <see cref="TabTable"/>.
|
||||
/// </summary>
|
||||
public uint ScrollbarElementId;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves a property for a state using retail's DirectState-as-base rule. A
|
||||
/// named state's key overrides DirectState by presence, including false/zero.
|
||||
|
|
@ -438,6 +486,96 @@ public static class ElementReader
|
|||
info.OutlineColor = new Vector4(c.Red / 255f, c.Green / 255f, c.Blue / 255f, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
// Tab table (0x2E): array of StructBaseProperty (MasterPropertyId 0x2F) — the
|
||||
// Type-8 tab control's authored {button element, page element, isDefault} rows
|
||||
// (docs/research/2026-08-10-options-panel-structure.md §1.3). Recomputed fresh
|
||||
// from the current effective state every call, so Merge's base+derived state
|
||||
// combination is picked up automatically without a separate scalar-merge rule.
|
||||
info.TabTable = ReadTabTable(info);
|
||||
|
||||
// Row-template list (0x64): a ListBox's authored {template layout DID (0x63),
|
||||
// template element id (0x62)} rows consumed by AddItemFromTemplateList
|
||||
// (same doc §1.5).
|
||||
info.TemplateList = ReadTemplateList(info);
|
||||
|
||||
// Scrollbar linkage (0x72): the element id of the ListBox's paired scrollbar
|
||||
// (same doc §10.1 — e.g. Character ListBox 0x100001FA names scrollbar
|
||||
// 0x100001FB).
|
||||
info.ScrollbarElementId = ReadReferencedElementId(info, 0x72u);
|
||||
}
|
||||
|
||||
private static List<UiTabTableEntry> ReadTabTable(ElementInfo info)
|
||||
{
|
||||
var entries = new List<UiTabTableEntry>();
|
||||
if (!info.TryGetEffectiveProperty(0x2Eu, out var property)
|
||||
|| property.Kind != UiPropertyKind.Array)
|
||||
return entries;
|
||||
|
||||
foreach (UiPropertyValue item in property.ArrayValue)
|
||||
{
|
||||
if (item.Kind != UiPropertyKind.Struct) continue;
|
||||
uint buttonId = ReadStructMemberId(item.StructValue, 0x30u);
|
||||
uint pageId = ReadStructMemberId(item.StructValue, 0x31u);
|
||||
bool isDefault = item.StructValue.TryGetValue(0x32u, out var flag)
|
||||
&& flag.Kind == UiPropertyKind.Bool
|
||||
&& flag.BoolValue;
|
||||
entries.Add(new UiTabTableEntry(buttonId, pageId, isDefault));
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
private static List<UiTemplateListEntry> ReadTemplateList(ElementInfo info)
|
||||
{
|
||||
var entries = new List<UiTemplateListEntry>();
|
||||
if (!info.TryGetEffectiveProperty(0x64u, out var property)
|
||||
|| property.Kind != UiPropertyKind.Array)
|
||||
return entries;
|
||||
|
||||
foreach (UiPropertyValue item in property.ArrayValue)
|
||||
{
|
||||
if (item.Kind != UiPropertyKind.Struct) continue;
|
||||
uint layoutDid = ReadStructMemberId(item.StructValue, 0x63u);
|
||||
uint elementId = ReadStructMemberId(item.StructValue, 0x62u);
|
||||
entries.Add(new UiTemplateListEntry(layoutDid, elementId));
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coerces a struct member (a nested <see cref="UiPropertyValue"/> keyed by its own
|
||||
/// master-property id) into an element/DID-shaped uint. Mirrors
|
||||
/// <c>DatWidgetFactory.ReferencedElementId</c>'s Enum/DataId/Integer kind handling
|
||||
/// exactly — element and DID references are authored inconsistently across dat
|
||||
/// property kinds, so every reader that resolves one needs the same tolerance.
|
||||
/// </summary>
|
||||
private static uint ReadStructMemberId(IReadOnlyDictionary<uint, UiPropertyValue> members, uint key)
|
||||
{
|
||||
if (!members.TryGetValue(key, out var value))
|
||||
return 0u;
|
||||
return value.Kind switch
|
||||
{
|
||||
UiPropertyKind.Enum or UiPropertyKind.DataId => (uint)value.UnsignedValue,
|
||||
UiPropertyKind.Integer when value.IntegerValue >= 0 => (uint)value.IntegerValue,
|
||||
_ => 0u,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Same Enum/DataId/Integer coercion as <see cref="ReadStructMemberId"/>,
|
||||
/// applied to a top-level effective property instead of a struct member — used for
|
||||
/// scalar element-id references like property 0x72.</summary>
|
||||
private static uint ReadReferencedElementId(ElementInfo info, uint propertyId)
|
||||
{
|
||||
if (!info.TryGetEffectiveProperty(propertyId, out var property))
|
||||
return 0u;
|
||||
return property.Kind switch
|
||||
{
|
||||
UiPropertyKind.Enum or UiPropertyKind.DataId => (uint)property.UnsignedValue,
|
||||
UiPropertyKind.Integer when property.IntegerValue >= 0 => (uint)property.IntegerValue,
|
||||
_ => 0u,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue