fix(engine): hand plugins the ImGui context for overlay windows, Char/Hub on the ImGui dashboard, warn on hidden log categories
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
b4488ecb6f
commit
08c63f4cc3
5 changed files with 124 additions and 12 deletions
59
Changelog/2026-10-05-ilt-hub-context-char-hub-logging.md
Normal file
59
Changelog/2026-10-05-ilt-hub-context-char-hub-logging.md
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
# ILT Hub windows draw again, Char/Hub on the ImGui dashboard, hidden-log warning
|
||||||
|
|
||||||
|
**Date:** 2026-10-05
|
||||||
|
**Component:** RynthCore Engine (merge branch `merge/aelrynth-2026.10.5.1`, after installer 2026.10.5.2)
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Fixes three problems found testing installer 2026.10.5.2.
|
||||||
|
|
||||||
|
## ILT Hub (and the other RynthAi windows) never appeared
|
||||||
|
|
||||||
|
RynthAi logged `[Overlay] OnRenderOverlay skipped: no ImGui context.` on both clients.
|
||||||
|
|
||||||
|
- **Cause:** the merged engine handed plugins the ImGui context only when the ImGui shell is on.
|
||||||
|
In this build the shell can only be turned on through an environment variable. RynthAi's own
|
||||||
|
ImGui windows (ILT Hub, Mini Remote, Inventory HUDs, Item Info, translator window, nav overlay)
|
||||||
|
draw only with that context, so they all skipped. UbRythai also refused to start without it
|
||||||
|
(its `Initialize` returns 11).
|
||||||
|
- **Fix (`ImGui/EngineFrameController.cs`):** plugins also get the context when plugin overlay
|
||||||
|
windows are enabled (`EnablePluginOverlayWindows`, default on) and the ImGui layer is on.
|
||||||
|
The plugin host copies the context once at init, so plugin init waits for the first ImGui
|
||||||
|
frame. The wait is capped at about 5 s (300 pump frames). If ImGui init fails or stalls,
|
||||||
|
plugins start anyway and a warning is logged.
|
||||||
|
- The merged RynthAi reads the context only for those windows, so this does not switch it into
|
||||||
|
its old legacy ImGui UI (the reason upstream withheld it).
|
||||||
|
|
||||||
|
## Char and Hub buttons were missing
|
||||||
|
|
||||||
|
With the ImGui layer on, the engine always shows upstream's ImGui RynthAi dashboard
|
||||||
|
(`RynthAiFace`) in the game window. Char and Hub had only been ported to the Avalonia dashboard,
|
||||||
|
which is no longer shown there.
|
||||||
|
|
||||||
|
- **Fix (`ImGui/Panels/RynthAiFace.cs`):** the launcher row now has 10 buttons. After Patrol:
|
||||||
|
- **Char:** opens the ILT Hub (`/ra hub show`).
|
||||||
|
- **Hub:** left-click toggles the Mini Remote (`/ra remote`); right-click opens the Inventory
|
||||||
|
HUDs setup (`/ra huds`).
|
||||||
|
|
||||||
|
## Engine log nearly empty
|
||||||
|
|
||||||
|
The 2026.10.5.2 session logs had only loader lines and two warnings.
|
||||||
|
|
||||||
|
- **Cause:** `engine.json` had `LoggingLevel: Info` with every `LogCategories` entry at
|
||||||
|
`Trace`. A category's value is the level its lines are written at, so every engine and
|
||||||
|
plugin line became a Trace line and was dropped by the Info global level. The startup banner
|
||||||
|
went through the same filter.
|
||||||
|
- **Fix (`EntryPoint.cs`, `LogSettings.cs`):**
|
||||||
|
- The startup banner (build, OS/CLR, logging summary) is always written.
|
||||||
|
- A new warning names any category set above the global level. It is logged at startup and
|
||||||
|
whenever `engine.json` changes, e.g. `LogSettings: General=Trace, ... write above the
|
||||||
|
global LoggingLevel (Info), so those lines are NOT logged.`
|
||||||
|
- Your `engine.json` now has `LoggingLevel: Trace` (changed at 09:10), so the next session
|
||||||
|
logs everything as-is.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
- `src/RynthCore.Engine/ImGui/EngineFrameController.cs`
|
||||||
|
- `src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs`
|
||||||
|
- `src/RynthCore.Engine/LogSettings.cs`
|
||||||
|
- `src/RynthCore.Engine/EntryPoint.cs`
|
||||||
|
|
@ -154,11 +154,14 @@ public static class EntryPoint
|
||||||
|
|
||||||
InstallManagedExceptionHandlers();
|
InstallManagedExceptionHandlers();
|
||||||
|
|
||||||
RynthLog.Info("================================================================");
|
// The banner bypasses the category levels: it must be in every log, whatever engine.json says.
|
||||||
RynthLog.Info($"RynthCore.Engine init build={BuildStamp} initCount={_initCount} pid={Environment.ProcessId}");
|
LogTagged("engine", "================================================================", "INF");
|
||||||
RynthLog.Info($" os={Environment.OSVersion} clr={Environment.Version} cwd={Environment.CurrentDirectory}");
|
LogTagged("engine", $"RynthCore.Engine init build={BuildStamp} initCount={_initCount} pid={Environment.ProcessId}", "INF");
|
||||||
RynthLog.Info($" logging {logSummary}");
|
LogTagged("engine", $" os={Environment.OSVersion} clr={Environment.Version} cwd={Environment.CurrentDirectory}", "INF");
|
||||||
RynthLog.Info("================================================================");
|
LogTagged("engine", $" logging {logSummary}", "INF");
|
||||||
|
LogTagged("engine", "================================================================", "INF");
|
||||||
|
string hiddenCategories = LogSettings.HiddenCategoriesWarning();
|
||||||
|
if (hiddenCategories.Length > 0) RynthLog.Warn(hiddenCategories);
|
||||||
|
|
||||||
// Live logging config: launcher edits to engine.json apply without a client restart.
|
// Live logging config: launcher edits to engine.json apply without a client restart.
|
||||||
// Stopped in EngineLifecycle.Shutdown before the module can be unloaded.
|
// Stopped in EngineLifecycle.Shutdown before the module can be unloaded.
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ internal static class EngineFrameController
|
||||||
private static bool _imguiInitFailed;
|
private static bool _imguiInitFailed;
|
||||||
private static bool _coreResolved;
|
private static bool _coreResolved;
|
||||||
private static bool _pluginsInitialized;
|
private static bool _pluginsInitialized;
|
||||||
|
// Pump frames plugin init has waited for the ImGui context (PumpPluginFrame; ~16 ms each).
|
||||||
|
private static int _pluginInitContextWaits;
|
||||||
|
private const int PluginInitContextMaxWaits = 300;
|
||||||
private static IntPtr _context;
|
private static IntPtr _context;
|
||||||
private static IntPtr _gameHwnd;
|
private static IntPtr _gameHwnd;
|
||||||
|
|
||||||
|
|
@ -473,14 +476,26 @@ internal static class EngineFrameController
|
||||||
return; // never re-enter PluginManager from two stacks
|
return; // never re-enter PluginManager from two stacks
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Plugins only get the ImGui context when they may draw with it
|
// Plugins only get the ImGui context when they may draw with it: the
|
||||||
// (EnableImGuiShell, FORCE-gated). The engine's own ImGui panels
|
// ImGui shell (EnableImGuiShell, FORCE-gated) or their own overlay
|
||||||
// don't need plugins to see it, and handing it over switched
|
// windows (EnablePluginOverlayWindows: RynthAi's ILT Hub, HUDs, Item
|
||||||
// RynthAi into its legacy-ImGui setup (first ImGui-on test,
|
// Info; RynthPluginRenderOverlay). RynthAi only reads the context for
|
||||||
// 2026-09-28) - plugins must behave exactly as in Avalonia-only mode.
|
// those windows, so this does not switch it into a legacy-ImGui setup.
|
||||||
IntPtr pluginContext = Plugins.EngineSettings.EnableImGuiShell ? _context : IntPtr.Zero;
|
bool pluginsDraw = Plugins.EngineSettings.EnableImGuiShell
|
||||||
|
|| (Plugins.EngineSettings.EnablePluginOverlayWindows && Plugins.EngineSettings.EnableImGuiBackend);
|
||||||
|
// _context is written by the render thread (Init); this is the pump thread.
|
||||||
|
IntPtr pluginContext = pluginsDraw ? System.Threading.Volatile.Read(ref _context) : IntPtr.Zero;
|
||||||
if (!_pluginsInitialized)
|
if (!_pluginsInitialized)
|
||||||
{
|
{
|
||||||
|
// The plugin host copies the context once at init, so wait for the
|
||||||
|
// render path's ImGui init (first ImGui frame) rather than hand over
|
||||||
|
// zero for the whole session. Bounded: a failed or stalled ImGui init
|
||||||
|
// must not hold plugins (and the bot) back.
|
||||||
|
if (pluginsDraw && pluginContext == IntPtr.Zero && !_imguiInitFailed
|
||||||
|
&& ++_pluginInitContextWaits <= PluginInitContextMaxWaits)
|
||||||
|
return;
|
||||||
|
if (pluginsDraw && pluginContext == IntPtr.Zero)
|
||||||
|
RynthLog.Warn($"EngineFrameController: plugins initialised without an ImGui context (imguiInitFailed={_imguiInitFailed}, waits={_pluginInitContextWaits}) - plugin overlay windows will not draw this session.");
|
||||||
_pluginsInitialized = true;
|
_pluginsInitialized = true;
|
||||||
PluginManager.InitPlugins(pluginContext, device, _gameHwnd);
|
PluginManager.InitPlugins(pluginContext, device, _gameHwnd);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -477,7 +477,7 @@ internal sealed partial class RynthAiFace : IImGuiPanel
|
||||||
private void Launchers(float x0, float width)
|
private void Launchers(float x0, float width)
|
||||||
{
|
{
|
||||||
float y = ImGuiNET.ImGui.GetCursorScreenPos().Y;
|
float y = ImGuiNET.ImGui.GetCursorScreenPos().Y;
|
||||||
const int buttons = 8;
|
const int buttons = 10;
|
||||||
float bw = MathF.Floor((width - buttons * LauncherGap) / buttons);
|
float bw = MathF.Floor((width - buttons * LauncherGap) / buttons);
|
||||||
// Short labels only when every button has room for its icon and label.
|
// Short labels only when every button has room for its icon and label.
|
||||||
bool labels = bw >= 68;
|
bool labels = bw >= 68;
|
||||||
|
|
@ -516,6 +516,18 @@ internal sealed partial class RynthAiFace : IImGuiPanel
|
||||||
}
|
}
|
||||||
else _drawers.Toggle(_patrol);
|
else _drawers.Toggle(_patrol);
|
||||||
}
|
}
|
||||||
|
x += bw + LauncherGap;
|
||||||
|
|
||||||
|
// Char and Hub open RynthAi's own ImGui overlay windows (ILT Hub, Mini Remote, Inventory
|
||||||
|
// HUDs). They draw only when the engine hands plugins its ImGui context.
|
||||||
|
Launcher("##l_char", PhosphorIcons.User, "Char", "Character hub (ILT Hub) - same as /ra hub show",
|
||||||
|
x, y, bw, labels, () => RynthAiCommands.ApplyRemoteCommand("hub", "show"));
|
||||||
|
x += bw + LauncherGap;
|
||||||
|
Launcher("##l_hub", PhosphorIcons.SquaresFour, "Hub",
|
||||||
|
"Hub. Left-click: Mini Remote (/ra remote). Right-click: Inventory HUDs setup (/ra huds).",
|
||||||
|
x, y, bw, labels, () => RynthAiCommands.ApplyRemoteCommand("remote", "toggle"));
|
||||||
|
if (ImGuiNET.ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
||||||
|
RynthAiCommands.ApplyRemoteCommand("huds", "show");
|
||||||
|
|
||||||
ImGuiNET.ImGui.SetCursorScreenPos(new Vector2(x0, y + LauncherH));
|
ImGuiNET.ImGui.SetCursorScreenPos(new Vector2(x0, y + LauncherH));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,27 @@ internal static class LogSettings
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Categories whose emit level is more verbose than the global level, so none of their lines
|
||||||
|
/// are written (e.g. every category at Trace with LoggingLevel Info: an almost empty log).
|
||||||
|
/// Empty when nothing is hidden.
|
||||||
|
/// </summary>
|
||||||
|
internal static string HiddenCategoriesWarning()
|
||||||
|
{
|
||||||
|
EntryPoint.EngineLogLevel global = EntryPoint.LoggingLevel;
|
||||||
|
EntryPoint.EngineLogLevel[] levels = Volatile.Read(ref _levels);
|
||||||
|
var hidden = new StringBuilder();
|
||||||
|
for (int i = 0; i < levels.Length; i++)
|
||||||
|
{
|
||||||
|
if (levels[i] == EntryPoint.EngineLogLevel.Off || levels[i] <= global) continue;
|
||||||
|
if (hidden.Length > 0) hidden.Append(", ");
|
||||||
|
hidden.Append((LogCategory)i).Append('=').Append(levels[i]);
|
||||||
|
}
|
||||||
|
return hidden.Length == 0 ? ""
|
||||||
|
: $"LogSettings: {hidden} write above the global LoggingLevel ({global}), so those lines are NOT logged. " +
|
||||||
|
"Raise LoggingLevel to the most verbose category level, or set the categories to Info.";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Starts the once-a-second engine.json poll. Idempotent.</summary>
|
/// <summary>Starts the once-a-second engine.json poll. Idempotent.</summary>
|
||||||
internal static void StartWatcher()
|
internal static void StartWatcher()
|
||||||
{
|
{
|
||||||
|
|
@ -199,6 +220,8 @@ internal static class LogSettings
|
||||||
// Bypasses the category levels so a change is visible whenever Info is in range.
|
// Bypasses the category levels so a change is visible whenever Info is in range.
|
||||||
if (EntryPoint.ShouldLog(EntryPoint.EngineLogLevel.Info))
|
if (EntryPoint.ShouldLog(EntryPoint.EngineLogLevel.Info))
|
||||||
EntryPoint.LogTagged("engine", $"LogSettings: engine.json changed - logging reloaded ({summary}).", "INF");
|
EntryPoint.LogTagged("engine", $"LogSettings: engine.json changed - logging reloaded ({summary}).", "INF");
|
||||||
|
string hidden = HiddenCategoriesWarning();
|
||||||
|
if (hidden.Length > 0) RynthLog.Warn(hidden);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue