gate; the DAT authors it) The raw-property probe settles it exactly as the user reported: the powerbar caption's mode STATES author their OWN justification (0x14 Enum=0x3 = Right on JumpMode/MeleeMode/MissileMode) while the element default stays centered. ElementInfo.HJustify only ever read the effective DEFAULT state, so the earlier "authored Center" conclusion measured the wrong state. The meter's absorbed state-label entry now carries the state's own authored alignment (state 0x14 wins, element-level HJustify as the fallback, ElementReader's same enum mapping), and the caption draw aligns accordingly - 'Height' sits at the bar's right edge, retail's placement. Live vitals labels keep their centered draw. App suite 4,987/3 skips. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
83 lines
3.3 KiB
C#
83 lines
3.3 KiB
C#
using System.IO;
|
|
using AcDream.App.UI.Layout;
|
|
using DatReaderWriter;
|
|
using DatReaderWriter.Options;
|
|
|
|
namespace AcDream.App.Tests.UI.Layout;
|
|
|
|
/// <summary>
|
|
/// 2026-08-14 gate probe (the ACDREAM_PROBE_LIVE_MOUNT pattern): dumps the
|
|
/// authored per-state strings of the floaty powerbar layout (0x21000072 —
|
|
/// gmPowerbarUI's mode states 0x10000042 jump / 0x10000043 melee /
|
|
/// 0x10000044 missile / 0x10000045 DDD, RecvNotice_BeginPowerbar
|
|
/// @ 0x004DA730) and the combat panel's Power label (0x21000073 element
|
|
/// 0x10000052, root states 0x10000003 melee / 0x10000004 missile) from the
|
|
/// INSTALLED DAT, so the "Height"/"Power"/"Accuracy" fix binds exactly what
|
|
/// retail authors instead of guessing.
|
|
/// </summary>
|
|
public sealed class PowerbarLayoutProbeTests
|
|
{
|
|
[Fact]
|
|
public void ProbePowerbarAuthoredStrings()
|
|
{
|
|
if (Environment.GetEnvironmentVariable("ACDREAM_PROBE_POWERBAR") != "1")
|
|
return;
|
|
|
|
var datDir = Environment.GetEnvironmentVariable("ACDREAM_DAT_DIR")
|
|
?? Path.Combine(
|
|
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
|
"Documents",
|
|
"Asheron's Call");
|
|
using var dats = new DatCollection(datDir, DatAccessType.Read);
|
|
var strings = new DatStringResolver(dats);
|
|
|
|
Dump(dats, strings, JumpPowerbarController.LayoutId, "floaty-powerbar");
|
|
Dump(dats, strings, CombatUiController.LayoutId, "combat-panel");
|
|
}
|
|
|
|
private static void Dump(
|
|
DatCollection dats,
|
|
DatStringResolver strings,
|
|
uint layoutId,
|
|
string label)
|
|
{
|
|
ElementInfo? root = LayoutImporter.ImportInfos(dats, layoutId);
|
|
if (root is null)
|
|
{
|
|
Console.WriteLine($"[pbprobe] {label} 0x{layoutId:X8}: import FAILED");
|
|
return;
|
|
}
|
|
Console.WriteLine($"[pbprobe] === {label} 0x{layoutId:X8} ===");
|
|
DumpElement(strings, root, 0);
|
|
}
|
|
|
|
private static void DumpElement(DatStringResolver strings, ElementInfo e, int depth)
|
|
{
|
|
string indent = new(' ', depth * 2);
|
|
Console.WriteLine(
|
|
$"[pbprobe] {indent}0x{e.Id:X8} type={e.Type} ({e.X},{e.Y} {e.Width}x{e.Height}) "
|
|
+ $"defaultState=0x{e.DefaultStateId:X8}('{e.DefaultStateName}') states={e.States.Count} "
|
|
+ $"hjustify={e.HJustify} fontColor={(e.FontColor is { } fc ? fc.ToString() : "none")}");
|
|
foreach (var (stateId, state) in e.States)
|
|
{
|
|
string text = "";
|
|
if (state.Properties.Values.TryGetValue(0x17u, out var p)
|
|
&& p.Kind == UiPropertyKind.StringInfo)
|
|
{
|
|
text = strings.Resolve(p.StringInfoValue) ?? "<unresolved>";
|
|
text = $" text='{text}'";
|
|
}
|
|
string properties = string.Join(
|
|
" ",
|
|
state.Properties.Values
|
|
.OrderBy(static pair => pair.Key)
|
|
.Select(static pair =>
|
|
$"0x{pair.Key:X2}:{pair.Value.Kind}=0x{pair.Value.UnsignedValue:X}"));
|
|
Console.WriteLine(
|
|
$"[pbprobe] {indent} state 0x{stateId:X8} '{state.Name}'"
|
|
+ $" passToChildren={state.PassToChildren}{text} props[{properties}]");
|
|
}
|
|
foreach (ElementInfo child in e.Children)
|
|
DumpElement(strings, child, depth + 1);
|
|
}
|
|
}
|