diff --git a/Changelog/2026-10-08-release-0.5.27-mini-remote-drawer.md b/Changelog/2026-10-08-release-0.5.27-mini-remote-drawer.md new file mode 100644 index 0000000..ade5a19 --- /dev/null +++ b/Changelog/2026-10-08-release-0.5.27-mini-remote-drawer.md @@ -0,0 +1,39 @@ +# RynthAi 0.5.27-legacy-ui: Mini Remote in the RynthAi dashboard + +Released 2026-10-08. Previous release: 0.5.26-legacy-ui (T11 item state). +Needs RynthCore 2026.10.5.21 or later for the drawer. Older engines never call the +new export, and the floating Mini Remote works as before. + +## What's new + +- **The Mini Remote draws inside the engine's RynthAi dashboard**, in its new Mini + Remote drawer (right-click Hub, or the drawer tab). It has every section: + - session rates, Reset XP and Report + - the attack target and summon bars, with the summon's time left + - the item slots, with drag and drop + - toggles, bank, rebuff, Translate and the Guardian answer +- **Options menu in the drawer.** It has the same section switches, ILT Hub windows + and horizontal layout as the floating window. Lock position and Hide don't apply + there, so they are replaced by **Floating window too** (also shows the floating + Mini Remote) and Inventory HUDs setup. +- Pack counts, the slot selection and the target / summon polling run while the + remote shows in the drawer or the floating window (`HudController.MiniRemoteActive`). + The same signal keeps the ILT Hub's bank and gear data fresh. + +## Plugin API + +- New export `RynthPluginRenderEmbed(const char* surface, float width, float height, float* wantWidth, float* wantHeight)`. + - Surface `"miniremote"` draws the Mini Remote into the engine's current ImGui + window. + - It reports the width of its column layout and the height drawn. + - Returns 0 before login, before the HUDs exist, or for an unknown surface. + +## Files + +- `PluginExports.cs`: `RynthPluginRenderEmbed`. +- `RynthAiPlugin.LocalFeatures.cs`: `RenderEmbeddedMiniRemote`. The ILT Hub's + "Mini Remote visible" now counts the drawer. +- `Huds/HudController.cs`: `MiniRemoteActive`, `RenderEmbedded`. +- `Huds/MiniRemoteHud.cs`: `RenderEmbedded`, `EmbeddedWidth`, and the Options menu's + drawer variant. +- `RynthAiVersionCommand.cs`: 0.5.27-legacy-ui. diff --git a/Plugins/RynthCore.Plugin.RynthAi/Huds/HudController.cs b/Plugins/RynthCore.Plugin.RynthAi/Huds/HudController.cs index e125f87..95d3bf5 100644 --- a/Plugins/RynthCore.Plugin.RynthAi/Huds/HudController.cs +++ b/Plugins/RynthCore.Plugin.RynthAi/Huds/HudController.cs @@ -7,6 +7,9 @@ // * Inventory HUDs setup window (HudSetupUi): picks what the two HUDs show. Opened from // the Inventory Management settings (ImGui Advanced Settings, the Avalonia Settings // panel) or "/ra huds". +// * The same Mini Remote inside the engine's RynthAi dashboard (its Mini Remote drawer, +// RynthPluginRenderEmbed "miniremote"): RenderEmbedded. Data polling runs while either +// the floating window or the drawer shows it (MiniRemoteActive). // Every HUD is an ordinary ImGui window, so it can be docked into / undocked from other // ImGui windows and dragged outside the game window (multi-viewport). // @@ -119,6 +122,19 @@ internal sealed class HudController private static long NowMs => Environment.TickCount64; + /// + /// How long after its last frame in the RynthAi dashboard's Mini Remote drawer the remote + /// still counts as on screen (the drawer draws every frame while it is out). + /// + private const long EmbeddedVisibleMs = 1500; + + /// When the Mini Remote last drew in the dashboard drawer (TickCount64); written on the render thread. + private long _embeddedDrawnAt = long.MinValue / 2; + + /// The Mini Remote is on screen: the floating window or the dashboard drawer. Any thread. + public bool MiniRemoteActive => + State.ShowMiniRemote || NowMs - System.Threading.Interlocked.Read(ref _embeddedDrawnAt) < EmbeddedVisibleMs; + // ── Pump thread ───────────────────────────────────────────────────────── public void Tick() @@ -132,7 +148,8 @@ internal sealed class HudController long now = NowMs; // The pack is only scanned while something shows it. - bool needPack = State.ShowItemHud || State.ShowMiniRemote || State.ShowSetup; + bool remote = MiniRemoteActive; + bool needPack = State.ShowItemHud || remote || State.ShowSetup; if (needPack && (_scanRequested || now - _lastScanAt >= PackScanIntervalMs)) { _scanRequested = false; @@ -141,10 +158,10 @@ internal sealed class HudController } Icons.Tick(); - if (State.ShowMiniRemote || State.ShowSetup || State.ShowItemHud) TrackPackSelection(now); + if (needPack) TrackPackSelection(now); // Target / summon polling sends health queries and appraisals, so it only runs while shown. - if (State.ShowMiniRemote && (State.MiniShowTarget || State.MiniShowPet)) + if (remote && (State.MiniShowTarget || State.MiniShowPet)) _combat.Tick(); if (now - _lastSaveAt >= SaveIntervalMs) @@ -477,4 +494,22 @@ internal sealed class HudController ImGuiNET.ImGui.PopStyleColor(pushed); } } + + /// + /// Draws the Mini Remote into the engine's current ImGui window (the RynthAi dashboard's + /// Mini Remote drawer) and returns the content size it wants. Render thread. + /// + public System.Numerics.Vector2 RenderEmbedded() + { + System.Threading.Interlocked.Exchange(ref _embeddedDrawnAt, NowMs); + int pushed = LegacyDashboardRenderer.PushDashboardStyle(); + try + { + return _miniRemote.RenderEmbedded(); + } + finally + { + ImGuiNET.ImGui.PopStyleColor(pushed); + } + } } diff --git a/Plugins/RynthCore.Plugin.RynthAi/Huds/MiniRemoteHud.cs b/Plugins/RynthCore.Plugin.RynthAi/Huds/MiniRemoteHud.cs index 610b3d2..0f2a9fa 100644 --- a/Plugins/RynthCore.Plugin.RynthAi/Huds/MiniRemoteHud.cs +++ b/Plugins/RynthCore.Plugin.RynthAi/Huds/MiniRemoteHud.cs @@ -19,6 +19,10 @@ // Translate chat translator on/off and the receive <-> send language swap // Guardian the last Temple guardian answer with a Give button (only while it is recent) // All game actions are posted to the pump thread. +// +// RenderEmbedded draws the same sections and Options menu inside the engine's RynthAi dashboard +// (its Mini Remote drawer, opened by the Hub launcher's right-click or the drawer tab) and +// reports the size it wants; the drawer is sized from that. using System; using System.Linq; using System.Numerics; @@ -81,11 +85,59 @@ internal sealed class MiniRemoteHud // Right-click on the window body opens the options, unless a slot's own menu is open. if (_slotMenuIndex < 0 && ImGui.IsWindowHovered(ImGuiHoveredFlags.ChildWindows) && ImGui.IsMouseReleased(ImGuiMouseButton.Right)) ImGui.OpenPopup(OptionsPopup); - RenderOptions(s); + RenderOptions(s, embedded: false); _slotMenuIndex = -1; ImGui.End(); } + /// + /// The same sections drawn into the caller's current window (the engine's RynthAi dashboard + /// drawer, which sizes itself from the result) instead of a window of their own. Returns the + /// content size it wants: the column layout's width, and the height drawn. + /// + public Vector2 RenderEmbedded() + { + var s = _hud.State; + _slotMenuIndex = -1; + float startY = ImGui.GetCursorPosY(); + ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(4, 3)); + try + { + var hub = _hud.Hub(); + RenderHeaderRow(s); + if (s.MiniRemoteHorizontal) RenderHorizontal(s, hub); + else RenderVertical(s, hub); + + if (_slotMenuIndex < 0 && ImGui.IsWindowHovered(ImGuiHoveredFlags.ChildWindows) && ImGui.IsMouseReleased(ImGuiMouseButton.Right)) + ImGui.OpenPopup(OptionsPopup); + RenderOptions(s, embedded: true); + + float height = ImGui.GetCursorPosY() - startY - ImGui.GetStyle().ItemSpacing.Y; + return new Vector2(EmbeddedWidth(s), Math.Max(0f, height) + 2f); + } + finally + { + ImGui.PopStyleVar(); + _slotMenuIndex = -1; + } + } + + /// + /// The width the sections need: one column stacked, else one per non-empty column side by side. + /// Never measured from what was drawn, since widgets fill the width they are given. + /// + private static float EmbeddedWidth(HudState s) + { + float colW = ColumnWidth(); + if (!s.MiniRemoteHorizontal) return colW; + int cols = 0; + if (s.MiniShowStats || s.MiniShowTarget || s.MiniShowPet) cols++; + if (s.MiniShowGems || s.MiniShowToggles) cols++; + if (s.MiniShowBank || s.MiniShowRebuff || s.MiniShowTranslate || s.MiniShowGuardian) cols++; + cols = Math.Max(1, cols); + return cols * colW + (cols - 1) * ImGui.GetStyle().ItemSpacing.X; + } + // ── Layout ────────────────────────────────────────────────────────────── /// [V/H] and [Options] buttons. Fixed widths so the auto-resizing window can't grow from them. @@ -464,7 +516,11 @@ internal sealed class MiniRemoteHud if (ImGui.IsItemHovered()) ImGui.SetTooltip("Cancel the running rebuff."); } - private void RenderOptions(HudState s) + /// + /// The Options popup. : drawn in the dashboard drawer, where the + /// window's lock and hide don't apply and the floating window is a separate choice. + /// + private void RenderOptions(HudState s, bool embedded) { if (!ImGui.BeginPopup(OptionsPopup)) return; RenderHubMenu(_hud.Hub()); @@ -481,9 +537,18 @@ internal sealed class MiniRemoteHud Flag("Guardian answer", ref s.MiniShowGuardian); ImGui.Separator(); Flag("Horizontal layout", ref s.MiniRemoteHorizontal); - Flag("Lock position", ref s.MiniRemoteLocked); - if (ImGui.MenuItem("Inventory HUDs setup...")) s.ShowSetup = true; - if (ImGui.MenuItem("Hide Mini Remote")) s.ShowMiniRemote = false; + if (embedded) + { + Flag("Floating window too", ref s.ShowMiniRemote); + if (ImGui.IsItemHovered()) ImGui.SetTooltip("Also show the Mini Remote as its own window (/ra remote)."); + if (ImGui.MenuItem("Inventory HUDs setup...")) s.ShowSetup = true; + } + else + { + Flag("Lock position", ref s.MiniRemoteLocked); + if (ImGui.MenuItem("Inventory HUDs setup...")) s.ShowSetup = true; + if (ImGui.MenuItem("Hide Mini Remote")) s.ShowMiniRemote = false; + } ImGui.EndPopup(); } diff --git a/Plugins/RynthCore.Plugin.RynthAi/PluginExports.cs b/Plugins/RynthCore.Plugin.RynthAi/PluginExports.cs index 2539317..23d6436 100644 --- a/Plugins/RynthCore.Plugin.RynthAi/PluginExports.cs +++ b/Plugins/RynthCore.Plugin.RynthAi/PluginExports.cs @@ -78,6 +78,31 @@ public static unsafe class PluginExports catch { /* an exception crossing UnmanagedCallersOnly would fail-fast the client */ } } + /// + /// Engine dashboard drawers (RynthCore 2026.10.5.21+): draws the named UTF-8 surface into the + /// engine's current ImGui window on the render thread and reports the size it wants. + /// Surfaces: "miniremote" (the Mini Remote drawer). 1 = drawn, 0 = not ready / unknown. + /// + [UnmanagedCallersOnly(EntryPoint = "RynthPluginRenderEmbed", CallConvs = new[] { typeof(CallConvCdecl) })] + public static int RenderEmbed(byte* surface, float width, float height, float* wantWidth, float* wantHeight) + { + try + { + if (surface == null) return 0; + ReadOnlySpan name = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(surface); + if (!name.SequenceEqual("miniremote"u8)) return 0; + var plugin = Runtime.Plugin; + if (plugin == null || !plugin.RenderEmbeddedMiniRemote(out System.Numerics.Vector2 want)) return 0; + if (wantWidth != null) *wantWidth = want.X; + if (wantHeight != null) *wantHeight = want.Y; + return 1; + } + catch + { + return 0; // an exception crossing UnmanagedCallersOnly would fail-fast the client + } + } + [UnmanagedCallersOnly(EntryPoint = "RynthPluginOnChatBarEnter", CallConvs = new[] { typeof(CallConvCdecl) })] public static void OnChatBarEnter(IntPtr textUtf16, IntPtr eatFlag) => Runtime.OnChatBarEnter(textUtf16, eatFlag); diff --git a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LocalFeatures.cs b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LocalFeatures.cs index 91c105a..4425c56 100644 --- a/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LocalFeatures.cs +++ b/Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.LocalFeatures.cs @@ -116,7 +116,7 @@ public sealed partial class RynthAiPlugin // while it is up the Hub keeps its bank / gear data fresh. var huds = _huds; _iltHub.MiniRemoteCommand = mode => "[ILT Hub] " + huds.HandleCommand("remote", mode); - _iltHub.MiniRemoteVisible = () => huds.State.ShowMiniRemote; + _iltHub.MiniRemoteVisible = () => huds.MiniRemoteActive; EnsureItemInfoUi(); } @@ -268,6 +268,36 @@ public sealed partial class RynthAiPlugin } } + /// + /// RynthPluginRenderEmbed "miniremote": the Mini Remote inside the engine's RynthAi dashboard + /// drawer, drawn into the engine's current ImGui window. False (nothing drawn) until login and + /// the HUDs exist. Render thread. + /// + public bool RenderEmbeddedMiniRemote(out System.Numerics.Vector2 want) + { + want = default; + var huds = _huds; + if (!_initialized || !_loginComplete || Host.ImGuiContext == IntPtr.Zero || huds == null) + return false; + + IntPtr previousContext = ImGui.GetCurrentContext(); + ImGui.SetCurrentContext(Host.ImGuiContext); + try + { + want = huds.RenderEmbedded(); + return true; + } + catch (Exception ex) + { + RynthLog.Exception(LogCat.UI, ex, "RenderEmbeddedMiniRemote"); + return false; + } + finally + { + ImGui.SetCurrentContext(previousContext); + } + } + /// Chat Translate window in the dashboard colours (no-op while hidden). private void RenderTranslateWindow() {