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

@ -181,6 +181,10 @@ public struct RynthCoreApiNative
public IntPtr GetServerStateJsonFn; // int GetServerStateJson(byte* buffer, int capacity) -> UTF-8 byte length (>= capacity: too small)
// v87: what the player wields, from the server's messages (the client's own fields go stale)
public IntPtr GetWieldedItemsFn; // int GetWieldedItems(uint* ids, uint* locations, int max) -> count, -1 not ready
// v89: plugin windows (RynthCore docs/PLUGIN_WINDOWS.md): the engine's look, and panels by key
public IntPtr GetUiColorFn; // uint GetUiColor(int token) -> ABGR, 0 unknown
public IntPtr GetUiFontFn; // void* GetUiFont(int font) -> ImFont*, null unknown / off AC's thread
public IntPtr SetPanelOpenFn; // int SetPanelOpen(const char* key, int mode) -> 1 open, 0 closed, -1 no such panel
}
/// <summary>

View file

@ -146,6 +146,10 @@ public readonly unsafe struct RynthCoreHost
public bool HasGetServerStateJson => _api.Version >= 86 && _api.GetServerStateJsonFn != IntPtr.Zero;
/// <summary>v87: <see cref="TryGetWieldedItems"/> (what the player wields, from the server's messages).</summary>
public bool HasGetWieldedItems => _api.Version >= 87 && _api.GetWieldedItemsFn != IntPtr.Zero;
/// <summary>v89: <see cref="GetUiColor"/> and <see cref="GetUiFont"/> (the engine's look, for a plugin's own windows).</summary>
public bool HasUiTheme => _api.Version >= 89 && _api.GetUiColorFn != IntPtr.Zero && _api.GetUiFontFn != IntPtr.Zero;
/// <summary>v89: <see cref="SetPanelOpen"/> (open, close or toggle a panel by its key, a plugin window's title included).</summary>
public bool HasSetPanelOpen => _api.Version >= 89 && _api.SetPanelOpenFn != IntPtr.Zero;
/// <summary>v76: <see cref="CloseContainer"/> (close a corpse or chest like the client's window close).</summary>
public bool HasCloseContainer => _api.Version >= 76 && _api.CloseContainerFn != IntPtr.Zero;
/// <summary>v77: <see cref="GetScreenMode"/>, <see cref="GetUiHookFlags"/> and the UI callbacks
@ -1504,6 +1508,41 @@ public readonly unsafe struct RynthCoreHost
// ─── Chat parser ────────────────────────────────────────────────────────
/// <summary>
/// v89: a colour of the player's theme as ImGui's packed colour (ABGR, for draw lists and
/// PushStyleColor), or <paramref name="fallback"/> on an older engine. Any thread; cheap, so
/// read it each frame and a theme change shows at once.
/// </summary>
public uint GetUiColor(RynthUiColor token, uint fallback)
{
if (!HasUiTheme) return fallback;
uint c = ((delegate* unmanaged[Cdecl]<int, uint>)_api.GetUiColorFn)((int)token);
return c != 0 ? c : fallback;
}
/// <summary>
/// v89: the engine's <c>ImFont*</c> for <paramref name="font"/> at the text size of the panel being
/// drawn (wrap it in ImGuiNET's ImFontPtr and PushFont it). Zero on an older engine, for an
/// unknown font, or off AC's render thread (call it from RynthPluginRenderEmbed).
/// </summary>
public IntPtr GetUiFont(RynthUiFont font)
=> HasUiTheme ? ((delegate* unmanaged[Cdecl]<int, IntPtr>)_api.GetUiFontFn)((int)font) : IntPtr.Zero;
/// <summary>
/// v89: opens, closes or toggles the panel <paramref name="key"/> (a plugin window's title, or an
/// engine panel's), or asks. Returns 1 open / 0 closed afterwards (the change lands on the next
/// frame), -1 for no such panel or an older engine. Any thread.
/// </summary>
public int SetPanelOpen(string key, RynthPanelOpen mode)
{
if (!HasSetPanelOpen || string.IsNullOrEmpty(key) || key.Length > 64) return -1;
Span<byte> utf8 = stackalloc byte[260];
int n = System.Text.Encoding.UTF8.GetBytes(key, utf8[..^1]);
utf8[n] = 0;
fixed (byte* p = utf8)
return ((delegate* unmanaged[Cdecl]<byte*, int, int>)_api.SetPanelOpenFn)(p, (int)mode);
}
public bool InvokeChatParser(string text)
{
if (_api.InvokeChatParserFn == IntPtr.Zero || string.IsNullOrEmpty(text))

View file

@ -0,0 +1,39 @@
namespace RynthCore.PluginSdk;
// ─── Plugin windows: the engine's look (engine API v89) ─────────────────────
// RynthCoreHost.GetUiColor / GetUiFont / SetPanelOpen, for the windows a plugin
// declares in its sections manifest ("windows") and draws itself through
// RynthPluginRenderEmbed (RynthCore docs/PLUGIN_WINDOWS.md). Check
// RynthCoreHost.HasUiTheme / HasSetPanelOpen first: older engines have neither.
// The numbers match the engine's UiColorToken / UiFontToken and only grow.
/// <summary>A colour of the player's theme (RynthCoreHost.GetUiColor).</summary>
public enum RynthUiColor
{
Text = 0, TextMuted = 1,
/// <summary>The theme's accent (teal by default): titles, links, the current item.</summary>
Accent = 2,
/// <summary>The highlight (amber by default): warnings, things to notice.</summary>
Highlight = 3,
Button = 4, Border = 5, Field = 6, Selected = 7, RowAlt = 8, Background = 9, PanelGlass = 10,
AccentFill = 11, BoxBg = 12, FrameBg = 13, FrameHover = 14, FrameActive = 15,
/// <summary>Fixed, whatever the theme: good / bad.</summary>
Green = 16, Red = 17,
TitleBar = 18, WindowBorder = 19,
}
/// <summary>A font the engine bakes (RynthCoreHost.GetUiFont): sizes in pixels at 100% text size.</summary>
public enum RynthUiFont
{
Ui9 = 0, Ui10 = 1,
/// <summary>The default for plugin windows.</summary>
Ui11 = 2,
Ui14 = 3, Ui18 = 4, UiBold11 = 5, UiBold14 = 6,
Mono9 = 7, Mono10 = 8, Mono12 = 9, Chat10 = 10, Chat12 = 11, Chat14 = 12,
}
/// <summary>What RynthCoreHost.SetPanelOpen does.</summary>
public enum RynthPanelOpen
{
Ask = -1, Close = 0, Open = 1, Toggle = 2,
}

View file

@ -36,7 +36,7 @@
<PropertyGroup>
<!-- The engine API this SDK knows; tools\PluginManifestTests checks it equals PluginContractVersion.Current. -->
<RynthCoreSdkApiVersion>88</RynthCoreSdkApiVersion>
<RynthCoreSdkApiVersion>89</RynthCoreSdkApiVersion>
<_RynthPluginManifestOn Condition="'$(RynthPluginMinEngineApi)' != '' and '$(RynthPluginManifest)' != 'false'">true</_RynthPluginManifestOn>
</PropertyGroup>