From d46cd9114bf2330df4ae1fe4fc82b9e864603038 Mon Sep 17 00:00:00 2001 From: BlankenshipG Date: Thu, 8 Oct 2026 21:38:09 -0400 Subject: [PATCH] feat(dashboard): Mini Remote drawer on the RynthAi dashboard (2026.10.5.21) A fourth left-edge drawer holds RynthAi's whole Mini Remote (rates, target and summon bars, item slots, toggles, bank, rebuff, Translate, Guardian) with its Options menu. Right-click Hub opens it, as right-click Patrol opens the Patrol drawer; popped out it shows the floating Mini Remote. New optional plugin export RynthPluginRenderEmbed: the plugin draws a named surface into the engine's current ImGui window on the render thread and reports the size it wants. No RynthCoreAPI change. Pairs with RynthAi 0.5.27. Co-authored-by: Cursor --- ...release-2026.10.5.21-mini-remote-drawer.md | 56 +++++++++++++ .../ImGui/Panels/DashboardDrawers.cs | 4 +- .../ImGui/Panels/RynthAiFace.Drawers.cs | 84 +++++++++++++++++++ .../ImGui/Panels/RynthAiFace.cs | 16 +++- src/RynthCore.Engine/Plugins/LoadedPlugin.cs | 8 ++ .../Plugins/PluginContract.cs | 7 ++ src/RynthCore.Engine/Plugins/PluginLoader.cs | 3 + src/RynthCore.Engine/Plugins/PluginManager.cs | 45 ++++++++++ .../UI/RynthAiDashboardState.cs | 21 ++++- 9 files changed, 236 insertions(+), 8 deletions(-) create mode 100644 Changelog/2026-10-08-release-2026.10.5.21-mini-remote-drawer.md diff --git a/Changelog/2026-10-08-release-2026.10.5.21-mini-remote-drawer.md b/Changelog/2026-10-08-release-2026.10.5.21-mini-remote-drawer.md new file mode 100644 index 0000000..c5dd3d6 --- /dev/null +++ b/Changelog/2026-10-08-release-2026.10.5.21-mini-remote-drawer.md @@ -0,0 +1,56 @@ +# RynthCore 2026.10.5.21: Mini Remote drawer on the RynthAi dashboard + +Released 2026-10-08. Previous release: 2026.10.5.20 (T11 item state tooltip). +Pairs with RynthAi 0.5.27-legacy-ui. + +## What's new + +- **Mini Remote drawer.** The RynthAi dashboard has a fourth left-edge drawer, + under Ranges, Loaded files and Patrol. It holds RynthAi's whole Mini Remote: + - session rates with Reset XP / Report + - the attack target and summon health bars, with the summon's time left + - the 5 x 6 item slots (click to use, right-click to assign, drag items in) + - the macro toggles, bank balances and rebuff buttons + - the Translate row and the Guardian answer +- **Options inside the drawer.** The remote's Options button, or a right-click on + it, opens the same menu as the floating window: which sections show, the ILT Hub + windows, horizontal layout, Inventory HUDs setup, and "Floating window too". +- **Opening it.** Use the drawer tab, or right-click the **Hub** launcher (as + right-clicking Patrol opens its drawer). Left-click Hub still toggles the floating + Mini Remote. On a popped-out dashboard (no drawers), right-click Hub shows the + floating Mini Remote. +- The drawer sizes itself to the remote: one column when stacked, three side by side + in horizontal layout. It is never taller than the screen; past that it scrolls. +- The drawer's open / closed state is saved with the dashboard, as line 11 of + `rynthai_avalonia.cache`. + +## Changed + +- Right-click **Hub** no longer opens Inventory HUDs setup directly. It is in the + Mini Remote's Options menu (and `/ra huds`). + +## Plugin API + +- New optional plugin export: + `int RynthPluginRenderEmbed(const char* surface, float width, float height, float* wantWidth, float* wantHeight)` + (Cdecl). + - The engine calls it on the render thread, inside a child window of the size + given, in the main ImGui context. + - The plugin draws the named UTF-8 surface there and reports the content size it + wants. + - Returns 1 if it drew, 0 if it isn't ready or doesn't know the surface. +- The export is resolved at load, like `RynthPluginRenderOverlay`. + - A plugin without it shows a "needs RynthAi 0.5.27 or later" note in the drawer. + - If it throws, the export is switched off for the session; the plugin keeps + running. +- No `RynthCoreAPI` struct change; the API version is unchanged. + +## Files + +- `ImGui/Panels/RynthAiFace.Drawers.cs`: `RemoteDrawer`. +- `ImGui/Panels/RynthAiFace.cs`: the drawer added to the dashboard; Hub right-click. +- `ImGui/Panels/DashboardDrawers.cs`: header comment. +- `Plugins/PluginManager.cs`: `RenderEmbed` (render thread, login gated). +- `Plugins/LoadedPlugin.cs`, `Plugins/PluginLoader.cs`: `RenderEmbedPtr`. +- `Plugins/PluginContract.cs`: export documented. +- `UI/RynthAiDashboardState.cs`: `RemoteOpen` (cache line 11). diff --git a/src/RynthCore.Engine/ImGui/Panels/DashboardDrawers.cs b/src/RynthCore.Engine/ImGui/Panels/DashboardDrawers.cs index 00af2e3..cca13f5 100644 --- a/src/RynthCore.Engine/ImGui/Panels/DashboardDrawers.cs +++ b/src/RynthCore.Engine/ImGui/Panels/DashboardDrawers.cs @@ -10,8 +10,8 @@ // // The mechanics live here (tabs, slide, side, placement, the one window); // each drawer only draws its panel (DashboardDrawer.DrawPanel) and says how -// big it is. Drawers today: Ranges (RangesSlideOut.cs), Loaded files and -// Patrol (RynthAiFace.Drawers.cs). +// big it is. Drawers today: Ranges (RangesSlideOut.cs), Loaded files, +// Patrol and Mini Remote (RynthAiFace.Drawers.cs). // // A top-level ImGui window of its own, begun from inside the dashboard's Draw // and placed against the dashboard's window every frame, so it follows the diff --git a/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.Drawers.cs b/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.Drawers.cs index cc3946b..943e7b2 100644 --- a/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.Drawers.cs +++ b/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.Drawers.cs @@ -12,12 +12,19 @@ // recorded hazards and the saved routes. Was the Patrol // launcher's right-click popup; right-click now opens this // drawer (popped out: still the popup). +// Mini Remote RynthAi's Mini Remote (session rates, target, summon, +// item slots, toggles, bank, rebuff, Translate, Guardian) +// with its Options menu. The plugin draws it here through +// RynthPluginRenderEmbed("miniremote") and says how big it +// wants the panel; the Hub launcher's right-click opens it +// (popped out: the floating Mini Remote instead). // AC thread only (inside the dashboard's Draw). // ============================================================================ using System; using System.Numerics; using ImGuiNET; +using RynthCore.Engine.Plugins; using RynthCore.Engine.UI; using RynthCore.Engine.UI.Data; @@ -136,4 +143,81 @@ internal sealed partial class RynthAiFace finally { ImGuiNET.ImGui.EndChild(); } } } + + /// RynthAi's Mini Remote, drawn by the plugin into this drawer (the Hub launcher's right-click). + private sealed class RemoteDrawer : DashboardDrawer + { + /// The plugin surface name, NUL-terminated for the export. + private static ReadOnlySpan Surface => "miniremote\0"u8; + + // Content bounds in unscaled pixels; the plugin's wish is clamped to them. + private const float MinW = 200, MaxW = 760, MinH = 60, DefaultH = 120; + + /// The content size the plugin last asked for (pixels); zero until it has drawn here. + private Vector2 _want; + + public override string Key => "remote"; + public override string Icon => PhosphorIcons.SquaresFour; + public override string Name => "Mini Remote drawer"; + public override bool SavedOpen => RynthAiDashboardState.RemoteOpen; + public override void SaveOpen(bool open) => RynthAiDashboardState.SetRemoteOpen(open); + + public override string TabTooltip(bool right) => + "Mini Remote: session rates, attack target, summon, item slots, toggles, bank, rebuff, Translate.\n" + + "Its Options button picks the sections and opens the ILT Hub windows (also: right-click Hub).\n" + + (right ? "Click to slide it out (to the right: there's no room on the left)." : "Click to slide it out."); + + public override float Width(float k) => + Math.Clamp(_want.X > 0 ? _want.X : MinW * k, MinW * k, MaxW * k) + 2 * Pad * k; + + public override float Height(float k) + { + float frame = (Pad + TitleH + 4 + Pad) * k; + // Never taller than the screen: the body scrolls instead. + float screen = ImGuiNET.ImGui.GetIO().DisplaySize.Y; + float maxBody = screen > 1 ? MathF.Max(MinH * k, screen - frame - 8 * k) : 900 * k; + return frame + Math.Clamp(_want.Y > 0 ? _want.Y : DefaultH * k, MinH * k, maxBody); + } + + public override void DrawPanel(Vector2 origin, float panelW, float panelH, float k) + { + float y = PanelFrame(origin, panelW, panelH, k, PhosphorIcons.SquaresFour, "MINI REMOTE", null, "Hide the Mini Remote drawer"); + float x = origin.X + Pad * k; + ImGuiNET.ImGui.SetCursorScreenPos(new Vector2(x, y)); + Vector2 size = new(panelW - 2 * Pad * k, MathF.Max(1, origin.Y + panelH - Pad * k - y)); + ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero); + bool open = ImGuiNET.ImGui.BeginChild("##remote_body", size, ImGuiChildFlags.None, ImGuiWindowFlags.NoBackground); + ImGuiNET.ImGui.PopStyleVar(); + try + { + if (!open) return; + // The plugin's widgets use the default UI font, as in its floating Mini Remote. + ImGuiNET.ImGui.PushFont(ImGuiFonts.Get(UiFont.Ui11)); + try + { + int result = PluginManager.RenderEmbed("RynthAi", Surface, size, out Vector2 want); + if (result == PluginManager.EmbedDrawn) + { + if (want.X > 0 && want.Y > 0) _want = want; + } + else + { + _want = Vector2.Zero; + ImGuiNET.ImGui.PushStyleColor(ImGuiCol.Text, DMute); + ImGuiNET.ImGui.TextWrapped(result switch + { + PluginManager.EmbedNoPlugin => + "This RynthAi can't draw its Mini Remote here (it needs RynthAi 0.5.27 or later). Left-click Hub for the floating Mini Remote.", + PluginManager.EmbedFailed => + "The Mini Remote failed to draw here (see the log). Left-click Hub for the floating Mini Remote.", + _ => "The Mini Remote shows here once RynthAi is ready: in the world, with plugin windows on (engine.json EnablePluginOverlayWindows).", + }); + ImGuiNET.ImGui.PopStyleColor(); + } + } + finally { ImGuiNET.ImGui.PopFont(); } + } + finally { ImGuiNET.ImGui.EndChild(); } + } + } } diff --git a/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs b/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs index d0f493a..82dffa9 100644 --- a/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs +++ b/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs @@ -18,7 +18,7 @@ // the buttons above it. // drawers tabs on the left edge (DashboardDrawers.cs), one open at a // time, a window of their own beside the dashboard: Ranges -// (RangesSlideOut.cs), Loaded files and Patrol +// (RangesSlideOut.cs), Loaded files, Patrol and Mini Remote // (RynthAiFace.Drawers.cs). Everything that slides out goes // left; only the bars stay at the bottom (Tom 2026-10-05). // Minimized keeps the title row, the control row and the bars. The window's @@ -76,6 +76,7 @@ internal sealed partial class RynthAiFace : IImGuiPanel // The drawers on the dashboard's left edge (their own window, placed against this one). private readonly DashboardDrawers _drawers; private readonly PatrolDrawer _patrol = new(); + private readonly RemoteDrawer _remote = new(); // This frame's data, for the drawers. private RynthAiView? _view; private RynthAiSnapshot _raw = Empty; @@ -92,7 +93,7 @@ internal sealed partial class RynthAiFace : IImGuiPanel public RynthAiFace() { // Tab order top to bottom; the first one saved open wins at load. - _drawers = new DashboardDrawers(new RangesSlideOut(), new FilesDrawer(this), _patrol); + _drawers = new DashboardDrawers(new RangesSlideOut(), new FilesDrawer(this), _patrol, _remote); } public Vector2? MinSize => new Vector2(MinWidth, _contentHeight > 0 ? _contentHeight @@ -531,11 +532,18 @@ internal sealed partial class RynthAiFace : IImGuiPanel ImGuiNET.ImGui.OpenPopup("##charmenu"); } x += bw + LauncherGap; + // Right-click is the Mini Remote drawer, as Patrol's is its drawer; popped out there are + // no drawers, so it shows the floating Mini Remote. Inventory HUDs setup is in the + // Mini Remote's Options menu. Launcher("##l_hub", PhosphorIcons.SquaresFour, "Hub", - "Hub. Left-click: Mini Remote (/ra remote). Right-click: Inventory HUDs setup (/ra huds).", + popped ? "Hub. Left-click: floating Mini Remote (/ra remote). Right-click: show the floating Mini Remote." + : "Hub. Left-click: floating Mini Remote (/ra remote). Right-click: the Mini Remote drawer (left), with its Options.", x, y, bw, labels, () => RynthAiCommands.ApplyRemoteCommand("remote", "toggle")); if (ImGuiNET.ImGui.IsItemClicked(ImGuiMouseButton.Right)) - RynthAiCommands.ApplyRemoteCommand("huds", "show"); + { + if (popped) RynthAiCommands.ApplyRemoteCommand("remote", "show"); + else _drawers.Toggle(_remote); + } ImGuiNET.ImGui.SetCursorScreenPos(new Vector2(x0, y + LauncherH)); } diff --git a/src/RynthCore.Engine/Plugins/LoadedPlugin.cs b/src/RynthCore.Engine/Plugins/LoadedPlugin.cs index b2ce607..0ce3f41 100644 --- a/src/RynthCore.Engine/Plugins/LoadedPlugin.cs +++ b/src/RynthCore.Engine/Plugins/LoadedPlugin.cs @@ -60,6 +60,13 @@ internal sealed class LoadedPlugin /// Set after the first RenderOverlay call has been logged (render thread only). public bool RenderOverlayLogged { get; set; } + /// + /// Optional int RynthPluginRenderEmbed(const char* surface, float width, float height, + /// float* wantWidth, float* wantHeight), Cdecl: the plugin draws a named surface into the + /// engine's current ImGui window (PluginManager.RenderEmbed). Zeroed after it throws. + /// + public IntPtr RenderEmbedPtr { get; set; } + // ─── v77 UI exports (resolved lazily by PluginManager.ResolveUiExports) ─── public bool UiExportsResolved { get; set; } public IntPtr OnScreenChangedPtr { get; set; } @@ -129,5 +136,6 @@ internal sealed class LoadedPlugin Tick = null; Render = null; RenderOverlay = null; + RenderEmbedPtr = IntPtr.Zero; } } diff --git a/src/RynthCore.Engine/Plugins/PluginContract.cs b/src/RynthCore.Engine/Plugins/PluginContract.cs index 72d76f3..9bf7aff 100644 --- a/src/RynthCore.Engine/Plugins/PluginContract.cs +++ b/src/RynthCore.Engine/Plugins/PluginContract.cs @@ -15,6 +15,13 @@ // off (Avalonia mode): only windows that have no // Avalonia panel. Gated by engine.json // "EnablePluginOverlayWindows" (default true). +// int RynthPluginRenderEmbed(const char* surface, float width, float height, +// float* wantWidth, float* wantHeight) +// — draws a named surface (UTF-8, e.g. RynthAi's +// "miniremote") into the engine's current ImGui +// window on AC's render thread, inside a +// width x height child; reports the size it wants. +// 1 = drawn, 0 = not ready / unknown surface. // void RynthPluginOnServerMessage(uint opcode, byte* data, int length) // — v78, reassembled server messages the plugin // asked for with SetServerMessageInterestFn diff --git a/src/RynthCore.Engine/Plugins/PluginLoader.cs b/src/RynthCore.Engine/Plugins/PluginLoader.cs index 8e73b3a..b77b53e 100644 --- a/src/RynthCore.Engine/Plugins/PluginLoader.cs +++ b/src/RynthCore.Engine/Plugins/PluginLoader.cs @@ -513,6 +513,9 @@ internal static class PluginLoader if (renderOverlayPtr != IntPtr.Zero) plugin.RenderOverlay = Marshal.GetDelegateForFunctionPointer(renderOverlayPtr); + // Called through a function pointer (PluginManager.RenderEmbed), so no delegate here. + plugin.RenderEmbedPtr = GetProcAddress(handle, "RynthPluginRenderEmbed"); + // Read name/version from the plugin if available if (plugin.GetName != null) { diff --git a/src/RynthCore.Engine/Plugins/PluginManager.cs b/src/RynthCore.Engine/Plugins/PluginManager.cs index ebc7651..f7a2697 100644 --- a/src/RynthCore.Engine/Plugins/PluginManager.cs +++ b/src/RynthCore.Engine/Plugins/PluginManager.cs @@ -1242,6 +1242,51 @@ internal static partial class PluginManager internal static string DescribeOverlayState() => $"overlayCalls={_overlayCalls} loginSeen={_loginCompleteObserved} overlayPlugins={_overlayBound}"; + /// RenderEmbed results. + internal const int EmbedDrawn = 1, EmbedNotReady = 0, EmbedNoPlugin = -1, EmbedFailed = -2; + + /// + /// Lets the plugin named (display name contains it) draw the + /// surface (NUL-terminated) into the current ImGui window, + /// through its optional RynthPluginRenderEmbed export. The caller has begun a child of + /// in the main ImGui context; the plugin draws only inside it and + /// reports the content size it wants in (zero when it didn't say). + /// Render thread only. Returns , (the + /// plugin isn't ready: before login, no ImGui context), (not + /// loaded, or too old to have the export) or (it threw: the export + /// is switched off for this session; the plugin keeps running). + /// + internal static unsafe int RenderEmbed(string pluginName, ReadOnlySpan surfaceUtf8, System.Numerics.Vector2 size, out System.Numerics.Vector2 want) + { + want = System.Numerics.Vector2.Zero; + if (!_loginCompleteObserved) return EmbedNotReady; // same not-in-world guard as RenderAll + LoadedPlugin[] plugins = System.Threading.Volatile.Read(ref _pluginsRenderSnapshot); + for (int i = 0; i < plugins.Length; i++) + { + LoadedPlugin p = plugins[i]; + if (!p.Initialized || p.Failed || !p.DisplayName.Contains(pluginName, StringComparison.OrdinalIgnoreCase)) + continue; + IntPtr fn = p.RenderEmbedPtr; + if (fn == IntPtr.Zero) return EmbedNoPlugin; + float w = 0, h = 0; + try + { + int r; + fixed (byte* s = surfaceUtf8) + r = ((delegate* unmanaged[Cdecl])fn)(s, size.X, size.Y, &w, &h); + want = new System.Numerics.Vector2(float.IsFinite(w) ? MathF.Max(0, w) : 0, float.IsFinite(h) ? MathF.Max(0, h) : 0); + return r == 1 ? EmbedDrawn : EmbedNotReady; + } + catch (Exception ex) + { + p.RenderEmbedPtr = IntPtr.Zero; + RynthLog.Error($"PluginManager: {p.DisplayName} RenderEmbed threw {ex.GetType().Name}: {ex.Message} - embedded surfaces off for this session (plugin keeps running)."); + return EmbedFailed; + } + } + return EmbedNoPlugin; + } + public static void ShutdownAll() { RynthLog.Plugin($"PluginManager: Shutting down {_plugins.Count} plugin(s)..."); diff --git a/src/RynthCore.Engine/UI/RynthAiDashboardState.cs b/src/RynthCore.Engine/UI/RynthAiDashboardState.cs index 31f2692..a39f9a2 100644 --- a/src/RynthCore.Engine/UI/RynthAiDashboardState.cs +++ b/src/RynthCore.Engine/UI/RynthAiDashboardState.cs @@ -6,7 +6,8 @@ // minimized|expanded, line 2 unused, line 3 target|notarget, line 4 // vitals|novitals; line 5 filesopen|nofiles, the Loaded files drawer; line 9 // ranges|noranges, the Ranges drawer; line 10 patrol|nopatrol, the Patrol -// drawer: the left-edge drawers, ImGui/Panels/DashboardDrawers.cs). Line 2 +// drawer; line 11 remote|noremote, the Mini Remote drawer: the left-edge +// drawers, ImGui/Panels/DashboardDrawers.cs). Line 2 // was the Monsters button's Simple/Advanced mode, retired 2026-10-01 with the // basic Monsters panel: it is still written ("advanced") so the lines after // it keep their places, and ignored on read. Lines 7 and 8 (the dashboard's @@ -37,6 +38,7 @@ internal static class RynthAiDashboardState private static volatile bool _barCollapsed; // the RynthCore bar shows only its grip + expand private static volatile bool _rangesOpen; // the Ranges drawer beside the dashboard is open private static volatile bool _patrolOpen; // the Patrol drawer beside the dashboard is open + private static volatile bool _remoteOpen; // the Mini Remote drawer beside the dashboard is open // Lines 7 and 8, unused since 2026-10-05: written back as read. private static string _line7 = "-", _line8 = "-"; private static bool _loaded; @@ -140,6 +142,19 @@ internal static class RynthAiDashboardState UiBackgroundWriter.Enqueue("rynthai dashboard state", Save); } + /// The Mini Remote drawer (RynthAi's Mini Remote drawn by the plugin) is open beside the dashboard. Any thread. + public static bool RemoteOpen + { + get { EnsureLoaded(); return _remoteOpen; } + } + + public static void SetRemoteOpen(bool open) + { + EnsureLoaded(); + _remoteOpen = open; + UiBackgroundWriter.Enqueue("rynthai dashboard state", Save); + } + /// Reads the file if it hasn't been read yet. Engine init calls this so AC's thread never does. public static void EnsureLoaded() { @@ -163,6 +178,7 @@ internal static class RynthAiDashboardState if (lines.Length >= 8 && lines[7].Trim().Length > 0) _line8 = lines[7].Trim(); _rangesOpen = lines.Length >= 9 && lines[8].Trim().Equals("ranges", StringComparison.OrdinalIgnoreCase); _patrolOpen = lines.Length >= 10 && lines[9].Trim().Equals("patrol", StringComparison.OrdinalIgnoreCase); + _remoteOpen = lines.Length >= 11 && lines[10].Trim().Equals("remote", StringComparison.OrdinalIgnoreCase); } } catch { /* corrupt cache: start expanded */ } @@ -180,7 +196,8 @@ internal static class RynthAiDashboardState + (_showTargetBar ? "target" : "notarget") + "\n" + (_showVitals ? "vitals" : "novitals") + "\n" + (_filesOpen ? "filesopen" : "nofiles") + "\n" + (_barCollapsed ? "barcollapsed" : "bar") + "\n" + _line7 + "\n" + _line8 + "\n" - + (_rangesOpen ? "ranges" : "noranges") + "\n" + (_patrolOpen ? "patrol" : "nopatrol") + "\n"); + + (_rangesOpen ? "ranges" : "noranges") + "\n" + (_patrolOpen ? "patrol" : "nopatrol") + "\n" + + (_remoteOpen ? "remote" : "noremote") + "\n"); } catch { /* best-effort */ } }