Plugin API v94: renumber the web panel after upstream's v93

Upstream release 2026.11.8.1 took v93 for GetMonsterHealth. The web panel's four slots now follow
GetMonsterHealthFn in the engine table and the SDK's RynthCoreApiNative, and the web panel is v94:
PluginContractVersion.Current, RynthCoreSdkApiVersion, HasWebPanel (Version >= 94), the comments,
docs/WEB_PANEL.md, the changelog and PluginManifestTests (HasWebPanel version cases, slot names).
Still provisional: unmerged upstream branches also use 94.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-08 13:13:05 -08:00
commit 2225b90b2c
16 changed files with 72 additions and 70 deletions

View file

@ -1,7 +1,8 @@
# In-game web panel: plugin API v93
# In-game web panel: plugin API v94
Branch `up/web-panel`, from upstream `main` 418d80b. Not deployed. The API number 93 is provisional
(upstream may take 93 first; it renumbers on merge). CoreCLR engine only.
Branch `pr/web-panel`, from upstream `main` c68204f (release 2026.11.8.1). Not deployed. The API number 94
follows upstream's v93 (GetMonsterHealth) and is provisional (unmerged upstream branches also use 94; whichever
merges second renumbers). CoreCLR engine only.
## What changed
@ -18,7 +19,7 @@ Branch `up/web-panel`, from upstream `main` 418d80b. Not deployed. The API numbe
- `/rc webpanel [status|close]`: a redacted one-line report, and a close.
- `engine.json` `"WebPanel": false`: kill switch. `OpenWebPanel` then answers `Unavailable`.
- `RynthCore.PluginSdk.targets` already raised a shared-SDK release build's `RynthPluginMinEngineApi` below 88 to the
SDK's API; that is now 93 for every such plugin. Plugins that must run on older cores declare 88 or higher.
SDK's API; that is now 94 for every such plugin. Plugins that must run on older cores declare 88 or higher.
- `tools\WebPanelHarness`: an offline 32-bit harness for the host (see the doc).
- Docs: `docs/WEB_PANEL.md` is the plugin contract.

View file

@ -1,12 +1,12 @@
# In-game web panel (plugin API v93)
# In-game web panel (plugin API v94)
A plugin can show a web page in a panel over the Asheron's Call window. The page runs in WebView2.
The engine owns the window, the navigation allowlist, focus and the lifetime; the plugin passes a URL,
an allowlist and a profile key, then polls for state. This file is the contract plugin authors build against.
The API number 93 is provisional: upstream may take 93 first, in which case it renumbers on merge
(`PluginContractVersion.cs`). Write `HasWebPanel` checks, not `Version >= 93` checks. That keeps a plugin working
across a renumber only for shared-SDK release builds. A NativeAOT plugin build compiles the `Version >= 93` test
The API number 94 is provisional: unmerged upstream branches also use 94, and whichever merges second
renumbers (`PluginContractVersion.cs`). Write `HasWebPanel` checks, not `Version >= 94` checks. That keeps a plugin working
across a renumber only for shared-SDK release builds. A NativeAOT plugin build compiles the `Version >= 94` test
in, so a plugin built against the provisional SDK must not be distributed, and must be rebuilt after a renumber.
## Calls
@ -17,7 +17,7 @@ to call from any thread (AC's main thread, the plugin pump, an ImGui draw). Neve
| Call | Does |
|---|---|
| `bool HasWebPanel` | True only on an engine at API 93 or newer that fills all four function slots. Check it before any other call. |
| `bool HasWebPanel` | True only on an engine at API 94 or newer that fills all four function slots. Check it before any other call. |
| `int OpenWebPanel(WebPanelOptions)` | Opens the panel, or replaces the open one. Returns a handle > 0, or a negative `WebPanelResult`. |
| `int NavigateWebPanel(int handle, string url)` | Points the open panel at a URL. `1` queued. |
| `int CloseWebPanel(int handle)` | Closes the panel. `1` queued, `0` already closed. |
@ -198,7 +198,7 @@ the plugin to keep working on a core without the web panel, with ShellExecute as
1. **Declare `RynthPluginMinEngineApi` at the plugin's true minimum.** In release builds
(`-p:RynthPluginSharedSdk=true`, as `Publish-Update.ps1` and `Build-Installer.ps1` pass), a declared minimum
*below 88* is raised to the API of the SDK the plugin was built with (93 now), and the launcher then holds the
*below 88* is raised to the API of the SDK the plugin was built with (94 now), and the launcher then holds the
plugin back from older cores, which kills the fallback (`RynthCore.PluginSdk.targets`: `RynthCoreManagedPluginApi`
is 88). There is no separate opt-out property: declaring a minimum of **88 or higher** is the opt-out, and a
declared 88 or higher is used as it is. Declare the lowest API your plugin really needs at load, and make
@ -249,7 +249,7 @@ Poll the state from a second helper written the same way (`GetWebPanelState` and
`RynthCoreAPI` gains four function pointers at the end of the table, in this order, all `cdecl`:
`int WebPanelOpen(WebPanelOpenNative*)`, `int WebPanelNavigate(int handle, byte* url)`,
`int WebPanelClose(int handle)`, `int WebPanelGetState(int handle, WebPanelStateNative*)`.
Test `Version >= 93` before reading them: an older engine's table is shorter.
Test `Version >= 94` before reading them: an older engine's table is shorter.
`WebPanelOpenNative` (pack 4, 48 bytes on x86): `uint Size`, `uint Flags`, `byte* Url`, `byte* Allowlist`
(`\n`-separated), `byte* ProfileKey` (may be null), `byte* Title` (may be null), `int WidthPercent`, `int HeightPercent`,

View file

@ -70,7 +70,7 @@ internal static class EngineSettings
private static Compatibility.AutoIdMode _autoIdMode = Compatibility.AutoIdPolicy.DefaultMode;
// "TransitionGate": default true. False = queued game actions are never held for a death / portal.
private static bool _transitionGate = true;
// "WebPanel": default true. False = the v93 web panel calls answer Unavailable (plugins open the system browser).
// "WebPanel": default true. False = the v94 web panel calls answer Unavailable (plugins open the system browser).
private static bool _webPanel = true;
private static bool _loaded;
@ -716,7 +716,7 @@ internal static class EngineSettings
}
}
/// <summary>"WebPanel" in engine.json (default true): the v93 web panel (WebPanel\WebPanelHost.cs, a
/// <summary>"WebPanel" in engine.json (default true): the v94 web panel (WebPanel\WebPanelHost.cs, a
/// WebView2 window over the game for DreamWeave's market and tools; CoreCLR engine only). False is the
/// kill switch: WebPanelOpen answers Unavailable and plugins open the page in the system browser
/// instead. A panel already open stays until it is closed.</summary>

View file

@ -1070,24 +1070,24 @@ internal struct RynthCoreAPI
/// Read-only, any thread, no game calls. Requires API v93+.</summary>
public IntPtr GetMonsterHealthFn;
// ── v93: a WebView2 web panel over the game window (WebPanel\WebPanelApi.cs) ──
// ── v94: a WebView2 web panel over the game window (WebPanel\WebPanelApi.cs) ──
// No call blocks its caller (AC's main thread, the plugin pump and ImGui draws all call these).
/// <summary>v93: <c>int WebPanelOpen(WebPanelOpenNative* open)</c>: opens (or replaces) the web panel.
/// <summary>v94: <c>int WebPanelOpen(WebPanelOpenNative* open)</c>: opens (or replaces) the web panel.
/// Returns a handle &gt; 0, or BadArgs / UrlNotAllowed / NoGameWindow / Unavailable / ShuttingDown
/// (WebPanelCode). Requires API v93+ (provisional number).</summary>
/// (WebPanelCode). Requires API v94+ (provisional number).</summary>
public IntPtr WebPanelOpenFn;
/// <summary>v93: <c>int WebPanelNavigate(int handle, byte* url)</c>: 1 queued; -2 off the allowlist
/// <summary>v94: <c>int WebPanelNavigate(int handle, byte* url)</c>: 1 queued; -2 off the allowlist
/// (opened in the system browser when it is browser-safe); -6 stale handle.</summary>
public IntPtr WebPanelNavigateFn;
/// <summary>v93: <c>int WebPanelClose(int handle)</c>: 1 queued, 0 already closed, -6 stale handle.</summary>
/// <summary>v94: <c>int WebPanelClose(int handle)</c>: 1 queued, 0 already closed, -6 stale handle.</summary>
public IntPtr WebPanelCloseFn;
/// <summary>v93: <c>int WebPanelGetState(int handle, WebPanelStateNative* state)</c>: the WebPanelStatusCode
/// <summary>v94: <c>int WebPanelGetState(int handle, WebPanelStateNative* state)</c>: the WebPanelStatusCode
/// (a handle that is not the live one reads 6 Superseded), -1 bad args.</summary>
public IntPtr WebPanelGetStateFn;
}
/// <summary>v93 WebPanelOpen argument (Pack 4; 48 bytes on x86). Mirrors RynthCore.PluginSdk/WebPanelTypes.cs.</summary>
/// <summary>v94 WebPanelOpen argument (Pack 4; 48 bytes on x86). Mirrors RynthCore.PluginSdk/WebPanelTypes.cs.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 4)]
internal unsafe struct WebPanelOpenNative
{
@ -1109,7 +1109,7 @@ internal unsafe struct WebPanelOpenNative
public fixed uint Reserved[4];
}
/// <summary>v93 WebPanelGetState result (Pack 4; 48 bytes). Mirrors RynthCore.PluginSdk/WebPanelTypes.cs.</summary>
/// <summary>v94 WebPanelGetState result (Pack 4; 48 bytes). Mirrors RynthCore.PluginSdk/WebPanelTypes.cs.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 4)]
internal unsafe struct WebPanelStateNative
{
@ -1126,14 +1126,14 @@ internal unsafe struct WebPanelStateNative
public fixed uint Reserved[5];
}
/// <summary>v93 return codes of the web panel calls. Append only.</summary>
/// <summary>v94 return codes of the web panel calls. Append only.</summary>
internal enum WebPanelCode
{
Queued = 1, AlreadyClosed = 0, BadArgs = -1, UrlNotAllowed = -2, NoGameWindow = -3,
Unavailable = -4, ShuttingDown = -5, StaleHandle = -6, RuntimeMissing = -7, CreateFailed = -8, ProcessFailed = -9,
}
/// <summary>v93 WebPanelStateNative.Status values. Append only.</summary>
/// <summary>v94 WebPanelStateNative.Status values. Append only.</summary>
internal enum WebPanelStatusCode
{
None = 0, Starting = 1, Loading = 2, Ready = 3, Closed = 4, Failed = 5, Superseded = 6,

View file

@ -47,8 +47,9 @@ internal static class PluginContractVersion
// any thread (feature/hud-health-for-plugins, 2026-11-07). Note: feature/reload-state,
// feature/engine-events and the branches built on them (unmerged) also use 93 and 94; whichever
// merges second renumbers.
// v93: WebPanelOpen, WebPanelNavigate, WebPanelClose and WebPanelGetState: a WebView2 web panel over the
// game window (WebPanel\WebPanelApi.cs; DreamWeave's in-game market and tools). The number is
// PROVISIONAL: upstream may take 93 first, in which case this renumbers on merge.
public const uint Current = 93;
// v94: WebPanelOpen, WebPanelNavigate, WebPanelClose and WebPanelGetState: a WebView2 web panel over the
// game window (WebPanel\WebPanelApi.cs; DreamWeave's in-game market and tools), appended after v93's
// GetMonsterHealth (was v93 on up/web-panel; renumbered after upstream's v93). The number is
// PROVISIONAL: the unmerged branches named under v93 also use 94; whichever merges second renumbers.
public const uint Current = 94;
}

View file

@ -305,10 +305,10 @@ internal static partial class PluginManager
private static GetAmbientLightCallbackDelegate? _getAmbientLightCallback; // v91
private static GetMonsterHealthCallbackDelegate? _getMonsterHealthCallback; // v93
#if ENGINE_CORECLR
private static WebPanelOpenCallbackDelegate? _webPanelOpenCallback; // v93
private static WebPanelNavigateCallbackDelegate? _webPanelNavigateCallback; // v93
private static WebPanelCloseCallbackDelegate? _webPanelCloseCallback; // v93
private static WebPanelGetStateCallbackDelegate? _webPanelGetStateCallback; // v93
private static WebPanelOpenCallbackDelegate? _webPanelOpenCallback; // v94
private static WebPanelNavigateCallbackDelegate? _webPanelNavigateCallback; // v94
private static WebPanelCloseCallbackDelegate? _webPanelCloseCallback; // v94
private static WebPanelGetStateCallbackDelegate? _webPanelGetStateCallback; // v94
#endif
private static ForceResetBusyCountCallbackDelegate? _forceResetBusyCountCallback;
private static GetObjectSpellIdsCallbackDelegate? _getObjectSpellIdsCallback;
@ -3261,7 +3261,7 @@ internal static partial class PluginManager
unsafe { _getAmbientLightCallback ??= AmbientLight.Get; }
unsafe { _getMonsterHealthCallback ??= GetMonsterHealthAction; } // v93
#if ENGINE_CORECLR
// v93: the AOT engine leaves these slots zero, so HasWebPanel is false there.
// v94: the AOT engine leaves these slots zero, so HasWebPanel is false there.
unsafe { _webPanelOpenCallback ??= WebPanel.WebPanelApi.Open; }
unsafe { _webPanelNavigateCallback ??= WebPanel.WebPanelApi.Navigate; }
_webPanelCloseCallback ??= WebPanel.WebPanelApi.Close;

View file

@ -49,7 +49,7 @@
</PropertyGroup>
<!--
v93 web panel: WebView2 on the CoreCLR engine only. NativeAOT cannot host the Core wrapper's COM
v94 web panel: WebView2 on the CoreCLR engine only. NativeAOT cannot host the Core wrapper's COM
interop, so that build drops the host and its Win32/WebView2 glue (WebPanelApi.cs answers Unavailable
there and PluginManager leaves the table slots zero).
-->

View file

@ -4,7 +4,7 @@ namespace RynthCore.Engine.WebPanel;
#if ENGINE_CORECLR
/// <summary>
/// The engine side of the v93 web panel calls (PluginContract.cs WebPanelOpenFn..WebPanelGetStateFn): reads
/// The engine side of the v94 web panel calls (PluginContract.cs WebPanelOpenFn..WebPanelGetStateFn): reads
/// the native arguments (every string copied before the call returns) and hands them to the one
/// WebPanelHost. No call here blocks its caller (AC's main thread, the plugin pump and ImGui draws all call
/// these). engine.json "WebPanel": false makes Open answer Unavailable (plugins fall back to the browser).
@ -128,7 +128,7 @@ internal static unsafe class WebPanelApi
}
}
#else
/// <summary>The NativeAOT engine has no web panel: PluginManager leaves the v93 slots zero (HasWebPanel false).</summary>
/// <summary>The NativeAOT engine has no web panel: PluginManager leaves the v94 slots zero (HasWebPanel false).</summary>
internal static unsafe class WebPanelApi
{
internal static int Open(WebPanelOpenNative* open) => (int)WebPanelCode.Unavailable;

View file

@ -6,7 +6,7 @@ namespace RynthCore.Engine.WebPanel;
internal readonly record struct WebPanelSnapshot(int Handle, int Status, uint Flags, int Error, int LastHttpStatus, uint NavigationCount);
/// <summary>
/// The pure decisions of the v93 ABI glue (WebPanelApi.cs), kept apart so tools\WebPanelTests can check them
/// The pure decisions of the v94 ABI glue (WebPanelApi.cs), kept apart so tools\WebPanelTests can check them
/// without the engine: refusals, the GetState argument check, and writing the result struct.
/// </summary>
internal static unsafe class WebPanelApiRules

View file

@ -8,7 +8,7 @@ namespace RynthCore.Engine.WebPanel;
internal sealed record WebPanelRequest(string Url, string[] Allowlist, string ProfileFolder, string Title, int WidthPercent, int HeightPercent, uint Flags);
/// <summary>
/// Reads the v93 WebPanelOpen argument. The SDK passes pointers into stack or pooled buffers that are gone
/// Reads the v94 WebPanelOpen argument. The SDK passes pointers into stack or pooled buffers that are gone
/// the moment the call returns, so every string is copied here, synchronously, before anything is queued.
/// Pure: no Win32, no WebView2.
/// </summary>

View file

@ -204,7 +204,7 @@ public struct RynthCoreApiNative
public IntPtr GetAmbientLightFn; // int GetAmbientLight(uint* client, uint* applied) -> 1 hook live, 0 not
// v93: the monster plates' last server health reading per object
public IntPtr GetMonsterHealthFn; // int GetMonsterHealth(uint id, float* ratio, uint* ageMs) -> 1 reading, 0 none
// v93: a WebView2 web panel over the game window (APPEND-AT-END (ABI); number provisional)
// v94: a WebView2 web panel over the game window (APPEND-AT-END (ABI); number provisional)
public IntPtr WebPanelOpenFn; // int WebPanelOpen(WebPanelOpenNative*) -> handle > 0, or BadArgs/UrlNotAllowed/NoGameWindow/Unavailable/ShuttingDown
public IntPtr WebPanelNavigateFn; // int WebPanelNavigate(int handle, byte* url) -> 1 queued; -2 off-list; -6 stale
public IntPtr WebPanelCloseFn; // int WebPanelClose(int handle) -> 1 queued, 0 already closed, -6 stale

View file

@ -1877,17 +1877,17 @@ public readonly unsafe struct RynthCoreHost
return true;
}
// ── v93: a web panel over the game window (number provisional) ───────────
// ── v94: a web panel over the game window (number provisional) ───────────
/// <summary>
/// v93: <see cref="OpenWebPanel"/>, <see cref="NavigateWebPanel"/>, <see cref="CloseWebPanel"/> and
/// <see cref="GetWebPanelState"/>. True only on an engine at API 93 or newer that fills all four.
/// v94: <see cref="OpenWebPanel"/>, <see cref="NavigateWebPanel"/>, <see cref="CloseWebPanel"/> and
/// <see cref="GetWebPanelState"/>. True only on an engine at API 94 or newer that fills all four.
/// </summary>
public bool HasWebPanel => _api.Version >= 93 && _api.WebPanelOpenFn != IntPtr.Zero && _api.WebPanelNavigateFn != IntPtr.Zero
public bool HasWebPanel => _api.Version >= 94 && _api.WebPanelOpenFn != IntPtr.Zero && _api.WebPanelNavigateFn != IntPtr.Zero
&& _api.WebPanelCloseFn != IntPtr.Zero && _api.WebPanelGetStateFn != IntPtr.Zero;
/// <summary>
/// v93: opens the web panel over the game window (a second call replaces the first). Returns a handle
/// v94: opens the web panel over the game window (a second call replaces the first). Returns a handle
/// &gt; 0, or a <see cref="WebPanelResult"/> (BadArgs for an empty URL or allowlist, more than 16
/// entries or a newline inside one; Unavailable on an older engine). Never blocks; the panel loads
/// after this returns - poll <see cref="GetWebPanelState"/>. Any thread.
@ -1941,7 +1941,7 @@ public readonly unsafe struct RynthCoreHost
}
/// <summary>
/// v93: points the panel <paramref name="handle"/> at <paramref name="url"/>. 1 queued; -2
/// v94: points the panel <paramref name="handle"/> at <paramref name="url"/>. 1 queued; -2
/// (UrlNotAllowed) when it is off the allowlist (the engine opens it in the system browser when that is
/// safe); -6 (StaleHandle) when the handle is not the live panel. Never blocks. Any thread.
/// </summary>
@ -1965,7 +1965,7 @@ public readonly unsafe struct RynthCoreHost
}
}
/// <summary>v93: closes the panel <paramref name="handle"/>. 1 queued, 0 already closed, -6 stale handle. Never blocks. Any thread.</summary>
/// <summary>v94: closes the panel <paramref name="handle"/>. 1 queued, 0 already closed, -6 stale handle. Never blocks. Any thread.</summary>
public int CloseWebPanel(int handle)
{
if (!HasWebPanel) return (int)WebPanelResult.Unavailable;
@ -1973,7 +1973,7 @@ public readonly unsafe struct RynthCoreHost
}
/// <summary>
/// v93: where the panel <paramref name="handle"/> is. A handle that is not the live panel reads
/// v94: where the panel <paramref name="handle"/> is. A handle that is not the live panel reads
/// Superseded. None (and a default <paramref name="state"/>) on an older engine or bad arguments.
/// Any thread.
/// </summary>

View file

@ -4,11 +4,11 @@ using System.Runtime.InteropServices;
namespace RynthCore.PluginSdk;
// v93: a WebView2 web panel over the game window. The native structs mirror
// v94: a WebView2 web panel over the game window. The native structs mirror
// RynthCore.Engine/Plugins/PluginContract.cs field for field (tools\PluginManifestTests checks sizes and
// offsets). The API number is provisional.
/// <summary>v93 WebPanelOpen argument (Pack 4; 48 bytes on x86). Mirrors the engine's WebPanelOpenNative.</summary>
/// <summary>v94 WebPanelOpen argument (Pack 4; 48 bytes on x86). Mirrors the engine's WebPanelOpenNative.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public unsafe struct WebPanelOpenNative
{
@ -30,7 +30,7 @@ public unsafe struct WebPanelOpenNative
public fixed uint Reserved[4];
}
/// <summary>v93 WebPanelGetState result (Pack 4; 48 bytes). Mirrors the engine's WebPanelStateNative.</summary>
/// <summary>v94 WebPanelGetState result (Pack 4; 48 bytes). Mirrors the engine's WebPanelStateNative.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public unsafe struct WebPanelStateNative
{

View file

@ -36,7 +36,7 @@
<PropertyGroup>
<!-- The engine API this SDK knows; tools\PluginManifestTests checks it equals PluginContractVersion.Current. -->
<RynthCoreSdkApiVersion>93</RynthCoreSdkApiVersion>
<RynthCoreSdkApiVersion>94</RynthCoreSdkApiVersion>
<!-- The first engine API that loads managed plugins and gives them Runtime\PluginShared (2026.10.19.1). -->
<RynthCoreManagedPluginApi>88</RynthCoreManagedPluginApi>
<_RynthPluginManifestOn Condition="'$(RynthPluginMinEngineApi)' != '' and '$(RynthPluginManifest)' != 'false'">true</_RynthPluginManifestOn>

View file

@ -627,7 +627,7 @@ namespace EngineSettingsTests
}
}
// engine.json WebPanel (2026-11-07, the v93 web panel kill switch): default on, only a hand-set false is
// engine.json WebPanel (2026-11-07, the v94 web panel kill switch): default on, only a hand-set false is
// written, other saves keep it, a value that is not a boolean is ignored.
private static void WebPanelDefaultOnAndSaved()
{

View file

@ -593,7 +593,7 @@ internal static class Program
"targets: the manifest and the runtime attribute both use the derived minimum");
}
// v93: the web panel's four slots are appended right after GetMonsterHealthFn, in order, on both sides.
// v94: the web panel's four slots are appended right after GetMonsterHealthFn, in order, on both sides.
private static void WebPanelFieldsAppended()
{
string[] slots = { "WebPanelOpenFn", "WebPanelNavigateFn", "WebPanelCloseFn", "WebPanelGetStateFn" };
@ -621,7 +621,7 @@ internal static class Program
Eq((int)Marshal.OffsetOf(sdk, f), (int)Marshal.OffsetOf(engine, f), engine.Name + "." + f + " offset");
}
// v93: the SDK's WebPanelOpenNative/WebPanelStateNative are the engine's, byte for byte.
// v94: the SDK's WebPanelOpenNative/WebPanelStateNative are the engine's, byte for byte.
private static void WebPanelStructsMatch()
{
int p = IntPtr.Size;
@ -641,7 +641,7 @@ internal static class Program
Console.WriteLine($" (WebPanelStructsMatch ran with IntPtr.Size={IntPtr.Size})");
}
// v93: every code value agrees between the engine's enums and the SDK's.
// v94: every code value agrees between the engine's enums and the SDK's.
private static void WebPanelCodesMatch()
{
Dictionary<string, long> Vals(Type t) => Enum.GetNames(t).ToDictionary(n => n, n => Convert.ToInt64(Enum.Parse(t, n)));
@ -662,27 +662,27 @@ internal static class Program
Eq((uint)RynthCore.PluginSdk.WebPanelFlags.PageKeepsEscape, 2u, "open flag PageKeepsEscape");
}
// v93: HasWebPanel needs Version >= 93 AND all four slots (an old engine's table is shorter and the
// v94: HasWebPanel needs Version >= 94 AND all four slots (an old engine's table is shorter and the
// runtime copies the full new-size struct, so slots past its end are garbage, not zero).
private static void HasWebPanel_FalseOnOldOrPartialTable()
{
IntPtr x = (IntPtr)0xDEAD;
RynthCoreHost Host(uint version, IntPtr a, IntPtr b, IntPtr c, IntPtr d)
=> new RynthCoreHost(new RynthCoreApiNative { Version = version, WebPanelOpenFn = a, WebPanelNavigateFn = b, WebPanelCloseFn = c, WebPanelGetStateFn = d });
Check(!Host(92, x, x, x, x).HasWebPanel, "Version 92 with garbage slots: false");
Check(!Host(93, IntPtr.Zero, x, x, x).HasWebPanel, "Open zero: false");
Check(!Host(93, x, IntPtr.Zero, x, x).HasWebPanel, "Navigate zero: false");
Check(!Host(93, x, x, IntPtr.Zero, x).HasWebPanel, "Close zero: false");
Check(!Host(93, x, x, x, IntPtr.Zero).HasWebPanel, "GetState zero: false");
Check(Host(93, x, x, x, x).HasWebPanel, "Version 93, all four: true");
var old = Host(92, x, x, x, x);
Check(!Host(93, x, x, x, x).HasWebPanel, "Version 93 with garbage slots: false");
Check(!Host(94, IntPtr.Zero, x, x, x).HasWebPanel, "Open zero: false");
Check(!Host(94, x, IntPtr.Zero, x, x).HasWebPanel, "Navigate zero: false");
Check(!Host(94, x, x, IntPtr.Zero, x).HasWebPanel, "Close zero: false");
Check(!Host(94, x, x, x, IntPtr.Zero).HasWebPanel, "GetState zero: false");
Check(Host(94, x, x, x, x).HasWebPanel, "Version 94, all four: true");
var old = Host(93, x, x, x, x);
Eq(old.OpenWebPanel(new WebPanelOptions { Url = "https://a.example/", Allowlist = new[] { "a.example" } }), (int)WebPanelResult.Unavailable, "Open without the API: Unavailable");
Eq(old.NavigateWebPanel(1, "https://a.example/"), (int)WebPanelResult.Unavailable, "Navigate without the API: Unavailable");
Eq(old.CloseWebPanel(1), (int)WebPanelResult.Unavailable, "Close without the API: Unavailable");
Eq(old.GetWebPanelState(1, out var st), WebPanelStatus.None, "GetState without the API: None");
Eq(st.Handle, 0, "GetState without the API: default state");
// Bad arguments are refused before the engine is called (the slots hold garbage, so a call would crash).
var live = Host(93, x, x, x, x);
var live = Host(94, x, x, x, x);
Eq(live.OpenWebPanel(new WebPanelOptions { Url = "", Allowlist = new[] { "a" } }), (int)WebPanelResult.BadArgs, "empty URL: BadArgs");
Eq(live.OpenWebPanel(new WebPanelOptions { Url = "https://a/", Allowlist = Array.Empty<string>() }), (int)WebPanelResult.BadArgs, "empty allowlist: BadArgs");
Eq(live.OpenWebPanel(new WebPanelOptions { Url = "https://a/", Allowlist = new[] { "a\nb" } }), (int)WebPanelResult.BadArgs, "newline in an entry: BadArgs");
@ -703,7 +703,7 @@ internal static class Program
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-v91 follow:
// eleven slots to v89, then v90's thirteen, v91's two, v93's one and the web panel's four).
// eleven slots to v89, then v90's thirteen, v91's two, v93's one and v94's four).
var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).SkipLast(31).TakeLast(6).ToArray();
Check(names.SequenceEqual(new[] { "GetTrainingInfoFn", "RaiseFn", "TrainSkillFn", "GetContainerOrderFn", "PutItemInContainerFn", "GetMergeStackResultFn" }),
"v79, v80 then v81 slots last: " + string.Join(",", names));
@ -718,12 +718,12 @@ internal static class Program
{
var all = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).ToArray();
var sdkAll = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).ToArray();
// v93: the web panel's four slots end the table; the checks after these are on the table before them.
string[] v93 = { "WebPanelOpenFn", "WebPanelNavigateFn", "WebPanelCloseFn", "WebPanelGetStateFn" };
Check(all.TakeLast(v93.Length).SequenceEqual(v93), "v93 slots last: " + string.Join(",", all.TakeLast(v93.Length)));
Check(sdkAll.TakeLast(v93.Length).SequenceEqual(v93), "SDK v93 slots last: " + string.Join(",", sdkAll.TakeLast(v93.Length)));
all = all.SkipLast(v93.Length).ToArray();
sdkAll = sdkAll.SkipLast(v93.Length).ToArray();
// v94: the web panel's four slots end the table; the checks after these are on the table before them.
string[] v94 = { "WebPanelOpenFn", "WebPanelNavigateFn", "WebPanelCloseFn", "WebPanelGetStateFn" };
Check(all.TakeLast(v94.Length).SequenceEqual(v94), "v94 slots last: " + string.Join(",", all.TakeLast(v94.Length)));
Check(sdkAll.TakeLast(v94.Length).SequenceEqual(v94), "SDK v94 slots last: " + string.Join(",", sdkAll.TakeLast(v94.Length)));
all = all.SkipLast(v94.Length).ToArray();
sdkAll = sdkAll.SkipLast(v94.Length).ToArray();
// v93: the monster plates' health readings end the table (2026-11-07), right after v91's two.
Check(all.Last() == "GetMonsterHealthFn", "v93 slot last: " + all.Last());
Check(sdkAll.Last() == "GetMonsterHealthFn", "SDK v93 slot last: " + sdkAll.Last());