Snapshot for release 2026.10.21.1 (internal 6556f92)

This commit is contained in:
Tom Bohar 2026-10-21 09:35:06 -04:00
commit 5defb009a6
27 changed files with 756 additions and 523 deletions

View file

@ -591,11 +591,11 @@ internal static class Program
Eq((int)Marshal.OffsetOf<RynthCore.PluginSdk.TrainingEntryNative>(f.Name), (int)Marshal.OffsetOf<RynthCore.Engine.Plugins.TrainingEntryNative>(f.Name), "TrainingEntryNative." + f.Name + " offset");
Eq(RynthCore.PluginSdk.TrainingInfoFlags.Busy, RynthCore.Engine.Plugins.TrainingInfoFlags.Busy, "info flag bits");
Eq(RynthCore.PluginSdk.TrainingEntryFlags.Trainable, RynthCore.Engine.Plugins.TrainingEntryFlags.Trainable, "entry flag bits");
// The three v79 slots follow v78's, then v80's two and v81's GetMergeStackResultFn (v82-v85 follow).
var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).SkipLast(8).TakeLast(6).ToArray();
// The three v79 slots follow v78's, then v80's two and v81's GetMergeStackResultFn (v82-v89 follow).
var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).SkipLast(11).TakeLast(6).ToArray();
Check(names.SequenceEqual(new[] { "GetTrainingInfoFn", "RaiseFn", "TrainSkillFn", "GetContainerOrderFn", "PutItemInContainerFn", "GetMergeStackResultFn" }),
"v79, v80 then v81 slots last: " + string.Join(",", names));
var sdkNames = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SkipLast(8).TakeLast(6).ToArray();
var sdkNames = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SkipLast(11).TakeLast(6).ToArray();
Check(sdkNames.SequenceEqual(names), "SDK v79, v80 and v81 slots in the same order");
}
@ -607,19 +607,21 @@ internal static class Program
var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).ToArray();
var sdkNames = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).ToArray();
// v81's GetMergeStackResultFn follows v80's two slots.
Check(names.SkipLast(9).TakeLast(2).SequenceEqual(new[] { "GetContainerOrderFn", "PutItemInContainerFn" }), "v80 slots before v81's to v85's: " + string.Join(",", names.SkipLast(9).TakeLast(2)));
Check(sdkNames.SkipLast(9).TakeLast(2).SequenceEqual(names.SkipLast(9).TakeLast(2)), "SDK v80 slots in the same order");
Check(names.SkipLast(7).Last() == "SalvageDirectFn", "v82 slot before v83's");
Check(names.SkipLast(12).TakeLast(2).SequenceEqual(new[] { "GetContainerOrderFn", "PutItemInContainerFn" }), "v80 slots before v81's to v85's: " + string.Join(",", names.SkipLast(12).TakeLast(2)));
Check(sdkNames.SkipLast(12).TakeLast(2).SequenceEqual(names.SkipLast(12).TakeLast(2)), "SDK v80 slots in the same order");
Check(names.SkipLast(10).Last() == "SalvageDirectFn", "v82 slot before v83's");
// v83: GetObjectServerAge and RemoveClientObject (ghost creatures), then v84's slot.
Check(names.SkipLast(5).TakeLast(2).SequenceEqual(new[] { "GetObjectServerAgeFn", "RemoveClientObjectFn" }), "v83 slots before v84's: " + string.Join(",", names.SkipLast(5).TakeLast(2)));
Check(names.SkipLast(8).TakeLast(2).SequenceEqual(new[] { "GetObjectServerAgeFn", "RemoveClientObjectFn" }), "v83 slots before v84's: " + string.Join(",", names.SkipLast(8).TakeLast(2)));
// v84: GetObjectProperties (every property of an object, /ub propertydump), then v85's two.
Check(names.SkipLast(4).Last() == "GetObjectPropertiesFn", "v84 slot before v85's: " + names.SkipLast(4).Last());
Check(names.SkipLast(7).Last() == "GetObjectPropertiesFn", "v84 slot before v85's: " + names.SkipLast(7).Last());
// v85: ArmConfirmation and GetLastConfirmation (the server's yes/no prompts), then v86's slot.
Check(names.SkipLast(2).TakeLast(2).SequenceEqual(new[] { "ArmConfirmationFn", "GetLastConfirmationFn" }), "v85 slots before v86's: " + string.Join(",", names.SkipLast(2).TakeLast(2)));
Check(names.SkipLast(5).TakeLast(2).SequenceEqual(new[] { "ArmConfirmationFn", "GetLastConfirmationFn" }), "v85 slots before v86's: " + string.Join(",", names.SkipLast(5).TakeLast(2)));
// v86: GetServerStateJson (which server this is, for every plugin), then v87's slot.
Check(names.SkipLast(1).Last() == "GetServerStateJsonFn", "v86 slot before v87's: " + names.SkipLast(1).Last());
// v87: GetWieldedItems ends the table (what the player wields, from the server's messages).
Check(names.Last() == "GetWieldedItemsFn", "v87 slot last: " + names.Last());
Check(names.SkipLast(4).Last() == "GetServerStateJsonFn", "v86 slot before v87's: " + names.SkipLast(4).Last());
// v87: GetWieldedItems (what the player wields, from the server's messages), then v89's three.
Check(names.SkipLast(3).Last() == "GetWieldedItemsFn", "v87 slot before v89's: " + names.SkipLast(3).Last());
// v89: plugin windows (the engine's look, panels by key) end the table.
Check(names.TakeLast(3).SequenceEqual(new[] { "GetUiColorFn", "GetUiFontFn", "SetPanelOpenFn" }), "v89 slots last: " + string.Join(",", names.TakeLast(3)));
Check(typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SequenceEqual(typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name)), "SDK table has the engine's slots in the same order");
Eq(Marshal.SizeOf<RynthCore.PluginSdk.RynthCoreApiNative>(), Marshal.SizeOf<RynthCore.Engine.Plugins.RynthCoreAPI>(), "SDK table size = engine table size");
Eq((int)Marshal.OffsetOf<RynthCore.PluginSdk.RynthCoreApiNative>("PutItemInContainerFn"),
@ -644,6 +646,11 @@ internal static class Program
(int)Marshal.OffsetOf<RynthCore.Engine.Plugins.RynthCoreAPI>("GetServerStateJsonFn"), "GetServerStateJsonFn offset");
Eq((int)Marshal.OffsetOf<RynthCore.PluginSdk.RynthCoreApiNative>("GetWieldedItemsFn"),
(int)Marshal.OffsetOf<RynthCore.Engine.Plugins.RynthCoreAPI>("GetWieldedItemsFn"), "GetWieldedItemsFn offset");
foreach (string slot in new[] { "GetUiColorFn", "GetUiFontFn", "SetPanelOpenFn" })
Eq((int)Marshal.OffsetOf<RynthCore.PluginSdk.RynthCoreApiNative>(slot),
(int)Marshal.OffsetOf<RynthCore.Engine.Plugins.RynthCoreAPI>(slot), slot + " offset");
Eq((int)Marshal.OffsetOf<RynthCore.Engine.Plugins.RynthCoreAPI>("GetUiColorFn"),
(int)Marshal.OffsetOf<RynthCore.Engine.Plugins.RynthCoreAPI>("GetWieldedItemsFn") + IntPtr.Size, "GetUiColorFn right after GetWieldedItemsFn");
}
private sealed class ProbePlugin : RynthCore.PluginCore.RynthPluginBase { }

View file

@ -28,6 +28,8 @@ internal static class Program
SelectionCurrentPick();
SelectionActiveAndOwner();
StateJson();
ManifestWindows();
WindowPlanChoices();
Console.WriteLine();
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed.");
@ -434,6 +436,69 @@ internal static class Program
Check(System.Text.Encoding.UTF8.GetString(big, 0, length) == json && big[length] == 0, "fits: text and NUL");
}
// ── Plugin windows (v89, docs/PLUGIN_WINDOWS.md) ───────────────────
private const string WindowsManifest = """
{ "version": 1,
"windows": [
{ "id": "characters", "title": "Characters", "surface": "window:characters", "icon": "\uE68E",
"width": 420, "height": 260, "minWidth": 280, "minHeight": 140, "bar": true, "edgeToEdge": true },
{ "id": "bank", "title": "Bank", "surface": "window:bank", "server": "ilt" },
{ "id": "tiny", "title": "Tiny", "surface": "window:tiny", "width": 10, "height": 99999, "minWidth": 5000 },
{ "id": "badicon", "title": "Bad Icon", "surface": "window:x", "icon": "AB" },
{ "id": "characters", "title": "Again", "surface": "window:again" },
{ "id": "dupe", "title": "characters", "surface": "window:dupe" },
{ "id": "Bad Id", "title": "No", "surface": "window:no" },
{ "id": "nosurface", "title": "No surface" },
{ "id": "popout", "title": "Popout", "surface": "window:x:popout" },
{ "id": "srv", "title": "Bad server", "surface": "window:s", "server": "Not An Id" }
] }
""";
private static void ManifestWindows()
{
Case("manifest: windows a plugin draws");
SectionManifest m = SectionManifestParser.Parse("RynthNet", WindowsManifest, out string err);
Check(err.Length == 0, "parses: " + err);
Check(m.Windows.Length == 4, $"four kept (got {m.Windows.Length}: {string.Join(", ", m.Windows.Select(w => w.Title))})");
SectionWindowDecl c = m.Windows[0];
Check(c.Plugin == "RynthNet" && c.Id == "characters" && c.Title == "Characters" && c.Surface == "window:characters", "identity");
Check(c.Icon == "\uE68E" && c.Bar && c.EdgeToEdge && c.IsUniversal, "icon, bar, edge to edge, every world");
Check(c.Width == 420 && c.Height == 260 && c.MinWidth == 280 && c.MinHeight == 140, "sizes as given");
SectionWindowDecl bank = m.Windows[1];
Check(bank.Server == "ilt" && !bank.IsUniversal && !bank.Bar && bank.Icon == "", "a server's window, no bar, no icon");
Check(bank.Width == SectionManifestParser.DefaultWindowWidth && bank.Height == SectionManifestParser.DefaultWindowHeight, "default size");
SectionWindowDecl tiny = m.Windows[2];
Check(tiny.Width == SectionManifestParser.MinWindowSize && tiny.Height == SectionManifestParser.MaxWindowSize, "sizes clamped");
Check(tiny.MinWidth <= tiny.Width && tiny.MinHeight <= tiny.Height, "the minimum never exceeds the size");
Check(m.Windows[3].Title == "Bad Icon" && m.Windows[3].Icon == "", "an icon outside the icon font is dropped, the window kept");
Check(SectionManifestParser.Icon("\uE68E\uE4D6") == "\uE68E\uE4D6" && SectionManifestParser.Icon("\uE68E\uE4D6\uE000") == "", "one or two glyphs");
// An old manifest has none; an engine before v89 just ignores the key.
Check(SectionManifestParser.Parse("p", GoodManifest, out _).Windows.Length == 0, "no windows key: none");
var many = "{\"windows\":[" + string.Join(",", Enumerable.Range(0, 20).Select(i => $"{{\"id\":\"w{i}\",\"title\":\"W{i}\",\"surface\":\"window:w{i}\"}}")) + "]}";
Check(SectionManifestParser.Parse("p", many, out _).Windows.Length == SectionManifestParser.MaxWindows, "capped at MaxWindows");
}
private static void WindowPlanChoices()
{
Case("plugin windows: which are hosted");
SectionManifest net = SectionManifestParser.Parse("RynthNet", WindowsManifest, out _);
SectionManifest other = SectionManifestParser.Parse("Other",
"{\"windows\":[{\"id\":\"c\",\"title\":\"Characters\",\"surface\":\"window:c\"},{\"id\":\"inv\",\"title\":\"Inventory\",\"surface\":\"window:i\"}]}", out _);
var offIlt = new[] { new ServerState("ilt", "Infinite Leaftide", false, false, ServerForce.Auto, true, "") };
var onIlt = new[] { new ServerState("ilt", "Infinite Leaftide", true, true, ServerForce.Auto, true, "") };
var refused = new List<string>();
var plan = WindowPlan.Build(new[] { net, other }, offIlt, t => t == "Inventory", refused);
Check(plan.ContainsKey("Characters") && plan["Characters"].Plugin == "RynthNet", "the first plugin keeps a title");
Check(!plan.ContainsKey("Bank"), "a server's window waits for its server");
Check(!plan.ContainsKey("Inventory"), "an engine panel's title is refused");
Check(refused.Count == 2 && refused.Exists(r => r.Contains("Other") && r.Contains("RynthNet")) && refused.Exists(r => r.Contains("engine panel")),
"both refusals say why: " + string.Join(" | ", refused));
var on = WindowPlan.Build(new[] { net }, onIlt, _ => false, new List<string>());
Check(on.ContainsKey("Bank"), "and shows while its server is active");
Check(WindowPlan.Signature(net.Windows[0]) != WindowPlan.Signature(net.Windows[1]), "signatures differ per window");
}
// ── Harness ────────────────────────────────────────────────────────
private static void Case(string name)

View file

@ -23,6 +23,7 @@
<Compile Include="..\..\src\RynthCore.Engine\UI\Sections\ServerForce.cs" Link="Engine\ServerForce.cs" />
<Compile Include="..\..\src\RynthCore.Engine\UI\Sections\SectionManifest.cs" Link="Engine\SectionManifest.cs" />
<Compile Include="..\..\src\RynthCore.Engine\UI\Sections\SectionCatalog.cs" Link="Engine\SectionCatalog.cs" />
<Compile Include="..\..\src\RynthCore.Engine\UI\Sections\WindowPlan.cs" Link="Engine\WindowPlan.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\IltDetect.cs" Link="Engine\IltDetect.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\AelrynthWire.cs" Link="Engine\AelrynthWire.cs" />
<!-- The Diagnostics server picker's plan and the plugin API v86 server-state JSON. -->