feat(engine): RynthPluginRenderOverlay - plugin extra windows while the ImGui shell is off
PluginManager.RenderOverlayAll runs the optional export when EnableImGuiShell is off (engine.json EnablePluginOverlayWindows, default true). A throw disables only that plugin's overlay, never the plugin. Fixes RynthAi ILT Hub window never showing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
10c45ec412
commit
7a58cdc095
7 changed files with 102 additions and 1 deletions
31
Changelog/2026-10-04-plugin-overlay-windows.md
Normal file
31
Changelog/2026-10-04-plugin-overlay-windows.md
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Engine — plugin overlay windows while the ImGui shell is off
|
||||
|
||||
**Date:** 2026-10-04
|
||||
**Branch:** `SK-local`
|
||||
**Ships in:** installer 2026.10.4.9 (previous 2026.10.4.8)
|
||||
|
||||
## Problem
|
||||
`EngineSettings.EnableImGuiShell` is hard-off unless the developer env var
|
||||
`RYNTHCORE_FORCE_IMGUI=1` is set. `EngineFrameController.RunImGuiFrame` skipped both
|
||||
`RynthCoreShell.Render` and `PluginManager.RenderAll`, so any plugin window without an Avalonia
|
||||
panel could never show. That included RynthAi's ILT Hub (log: the Hub was created and the server
|
||||
features came back, but no window) and its Item Info settings window.
|
||||
|
||||
## Added
|
||||
- **Optional plugin export `void RynthPluginRenderOverlay()`** (`PluginContract.cs`,
|
||||
`PluginLoader.cs`, `LoadedPlugin.RenderOverlay`). With the ImGui shell off, the engine calls it
|
||||
every frame through the new `PluginManager.RenderOverlayAll()`. A plugin draws only its extra
|
||||
windows there, beside the Avalonia UI. Plugins without the export are unaffected. Their full ImGui
|
||||
UIs stay hidden, so nothing duplicates an Avalonia panel. The old ImGui bar stays hidden too.
|
||||
- **Failure isolation:** if `RenderOverlay` throws, only that plugin's overlay windows are switched
|
||||
off for the session. The plugin is **not** marked `Failed`, so its tick, automation and Avalonia
|
||||
panels keep running. (`RenderAll` keeps its old behaviour.)
|
||||
- **engine.json `"EnablePluginOverlayWindows"`** (default `true`) to hide the overlay windows.
|
||||
`EngineSettings.Save` writes it, and the launcher's `EngineJsonStore` preserves it.
|
||||
The windows need `EnableImGuiBackend` (default `true`).
|
||||
- Same not-in-world guard as `RenderAll` (no drawing between logoff and the next login complete).
|
||||
|
||||
## Build
|
||||
- `RynthCore.Engine` Release build succeeds (no new warnings). Shipped with RynthAi 0.6.15, which
|
||||
exports `RynthPluginRenderOverlay` (ILT Hub + Item Info windows).
|
||||
- Not yet verified in game.
|
||||
|
|
@ -517,6 +517,12 @@ internal static class EngineFrameController
|
|||
RynthCoreShell.Render(_frameCount);
|
||||
PluginManager.RenderAll();
|
||||
}
|
||||
else if (Plugins.EngineSettings.EnablePluginOverlayWindows)
|
||||
{
|
||||
// Avalonia mode: only the opt-in extra windows (RynthPluginRenderOverlay),
|
||||
// never the plugins' full ImGui UIs that Avalonia panels already cover.
|
||||
PluginManager.RenderOverlayAll();
|
||||
}
|
||||
|
||||
bool captureMouse =
|
||||
ImGuiNET.ImGui.IsWindowHovered(ImGuiHoveredFlags.AnyWindow) ||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ internal static class EngineSettings
|
|||
private static bool _enableEngine = true;
|
||||
private static int _engineHookCount = int.MaxValue;
|
||||
private static bool _enableImGuiBackend = true;
|
||||
private static bool _enablePluginOverlayWindows = true;
|
||||
private static bool _enableHangMinidump = true;
|
||||
private static bool _drawCustomVitalBars = true;
|
||||
private static bool _preventIdleLogoff = true;
|
||||
|
|
@ -146,6 +147,19 @@ internal static class EngineSettings
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>When true (default) and the ImGui shell is off, plugins that export
|
||||
/// RynthPluginRenderOverlay draw their extra ImGui windows (RynthAi: ILT Hub, Item Info)
|
||||
/// beside the Avalonia UI. engine.json "EnablePluginOverlayWindows": false hides them.
|
||||
/// Needs <see cref="EnableImGuiBackend"/>.</summary>
|
||||
public static bool EnablePluginOverlayWindows
|
||||
{
|
||||
get
|
||||
{
|
||||
EnsureLoaded();
|
||||
return _enablePluginOverlayWindows;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When true, MainThreadHangWatchdog writes a minidump to
|
||||
/// Logs\dumps\ the first time AC's main thread is confirmed permanently
|
||||
/// wedged — a targeted post-mortem to replace always-on procdump (which
|
||||
|
|
@ -304,6 +318,12 @@ internal static class EngineSettings
|
|||
_enableImGuiBackend = ibEl.GetBoolean();
|
||||
}
|
||||
|
||||
if (doc.RootElement.TryGetProperty("EnablePluginOverlayWindows", out var powEl) &&
|
||||
(powEl.ValueKind == JsonValueKind.True || powEl.ValueKind == JsonValueKind.False))
|
||||
{
|
||||
_enablePluginOverlayWindows = powEl.GetBoolean();
|
||||
}
|
||||
|
||||
if (doc.RootElement.TryGetProperty("EnableHangMinidump", out var hmEl) &&
|
||||
(hmEl.ValueKind == JsonValueKind.True || hmEl.ValueKind == JsonValueKind.False))
|
||||
{
|
||||
|
|
@ -359,6 +379,7 @@ internal static class EngineSettings
|
|||
w.WriteBoolean("EnableEngine", _enableEngine);
|
||||
w.WriteNumber("EngineHookCount", _engineHookCount);
|
||||
w.WriteBoolean("EnableImGuiBackend", _enableImGuiBackend);
|
||||
w.WriteBoolean("EnablePluginOverlayWindows", _enablePluginOverlayWindows);
|
||||
w.WriteBoolean("EnableHangMinidump", _enableHangMinidump);
|
||||
w.WriteBoolean("DrawCustomVitalBars", _drawCustomVitalBars);
|
||||
w.WriteBoolean("PreventIdleLogoff", _preventIdleLogoff);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ internal sealed class LoadedPlugin
|
|||
public PluginOnEnchantmentRemovedDelegate? OnEnchantmentRemoved { get; set; }
|
||||
public PluginTickDelegate? Tick { get; set; }
|
||||
public PluginRenderDelegate? Render { get; set; }
|
||||
/// <summary>Optional RynthPluginRenderOverlay: ImGui windows drawn while the ImGui shell is off.</summary>
|
||||
public PluginRenderDelegate? RenderOverlay { get; set; }
|
||||
|
||||
// ─── Runtime state ───────────────────────────────────────────────
|
||||
public bool Initialized { get; set; }
|
||||
|
|
@ -100,5 +102,6 @@ internal sealed class LoadedPlugin
|
|||
OnEnchantmentRemoved = null;
|
||||
Tick = null;
|
||||
Render = null;
|
||||
RenderOverlay = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@
|
|||
// const char* RynthPluginName() — human-readable name
|
||||
// const char* RynthPluginVersion() — version string (e.g. "1.0.0")
|
||||
// void RynthPluginTick() — per-frame logic (before render)
|
||||
// void RynthPluginRender() — per-frame ImGui drawing
|
||||
// void RynthPluginRender() — per-frame ImGui drawing (ImGui shell on)
|
||||
// void RynthPluginRenderOverlay() — per-frame ImGui drawing while the ImGui shell is
|
||||
// off (Avalonia mode): only windows that have no
|
||||
// Avalonia panel. Gated by engine.json
|
||||
// "EnablePluginOverlayWindows" (default true).
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -482,6 +482,10 @@ internal static class PluginLoader
|
|||
if (renderPtr != IntPtr.Zero)
|
||||
plugin.Render = Marshal.GetDelegateForFunctionPointer<PluginRenderDelegate>(renderPtr);
|
||||
|
||||
IntPtr renderOverlayPtr = GetProcAddress(handle, "RynthPluginRenderOverlay");
|
||||
if (renderOverlayPtr != IntPtr.Zero)
|
||||
plugin.RenderOverlay = Marshal.GetDelegateForFunctionPointer<PluginRenderDelegate>(renderOverlayPtr);
|
||||
|
||||
// Read name/version from the plugin if available
|
||||
if (plugin.GetName != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1043,6 +1043,38 @@ internal static class PluginManager
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ImGui-shell-off counterpart of <see cref="RenderAll"/>: calls the optional
|
||||
/// RynthPluginRenderOverlay export, where a plugin draws only the extra windows that have
|
||||
/// no Avalonia panel (e.g. RynthAi's ILT Hub). They float beside the Avalonia UI and add to it.
|
||||
/// A throw switches off just that plugin's overlay windows; the plugin is NOT marked Failed,
|
||||
/// so its tick/automation and Avalonia panels keep running.
|
||||
/// </summary>
|
||||
public static void RenderOverlayAll()
|
||||
{
|
||||
if (!_loginCompleteObserved)
|
||||
return; // same not-in-world crash zone guard as RenderAll
|
||||
|
||||
LoadedPlugin[] plugins = System.Threading.Volatile.Read(ref _pluginsRenderSnapshot);
|
||||
for (int i = 0; i < plugins.Length; i++)
|
||||
{
|
||||
var plugin = plugins[i];
|
||||
var overlay = plugin.RenderOverlay;
|
||||
if (!plugin.Initialized || plugin.Failed || overlay == null)
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
overlay();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
plugin.RenderOverlay = null;
|
||||
RynthLog.Error($"PluginManager: {plugin.DisplayName} RenderOverlay threw {ex.GetType().Name}: {ex.Message} - overlay windows off for this session (plugin keeps running).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ShutdownAll()
|
||||
{
|
||||
RynthLog.Plugin($"PluginManager: Shutting down {_plugins.Count} plugin(s)...");
|
||||
|
|
|
|||
Loading…
Reference in a new issue