RynthCore as of 2026-10-04 (internal 843c801): RynthNav auto-travel and the navigation map, plugin API v75 (server and titles), launcher with Available plugins, download progress and the update on the front page, opt-in usage statistics, NPC names, radar colours, title-bar text size, FPS limiter, client action unlocks, release 2026.10.4.6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Tom Bohar 2026-10-04 18:34:27 -04:00
commit a24ed6df7c
322 changed files with 83009 additions and 7504 deletions

View file

@ -11,7 +11,7 @@
// * ImGui-gated (only when EngineSettings.EnableImGuiBackend is true):
// Win32Backend.NewFrame / DX9Backend.NewFrame, ImGui.NewFrame/EndFrame/
// Render, RynthCoreShell + plugin RenderAll, DX9Backend.RenderDrawData,
// mouse/keyboard capture flag updates, multi-viewport platform pump.
// mouse/keyboard capture flag updates.
//
// Renamed 2026-05-10 from ImGuiController — the type now owns more than
// ImGui's frame; the ImGui block is just one branch of its work.
@ -42,17 +42,6 @@ internal static class EngineFrameController
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern bool GetClientRect(IntPtr hWnd, out ClientRect lpRect);
[DllImport("user32.dll")]
private static extern bool ClientToScreen(IntPtr hWnd, ref ClientPoint lpPoint);
[StructLayout(LayoutKind.Sequential)]
private struct ClientRect { public int Left, Top, Right, Bottom; }
[StructLayout(LayoutKind.Sequential)]
private struct ClientPoint { public int X, Y; }
private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
private static bool _imguiInitialized;
@ -103,6 +92,8 @@ internal static class EngineFrameController
RynthLog.Render($"EngineFrameController: Game HWND = 0x{_gameHwnd:X8}");
EntryPoint.GameHwnd = _gameHwnd;
_coreResolved = true;
// Pop-outs hold D3DPOOL_DEFAULT render targets: release them before AC resets a lost device.
D3D9.DeviceResetHook.InstallFromDevice(pDevice);
return true;
}
@ -114,6 +105,11 @@ internal static class EngineFrameController
if (!EnsureCore(pDevice))
return false;
// Before any context exists: the loaded cimgui.dll must be the exact
// build ImGui.NET wraps, or every struct read below is at wrong offsets.
if (!ImGuiSelfTest.Run(EntryPoint.ImGuiNativeHandle))
return false;
IntPtr previousContext = ImGuiNET.ImGui.GetCurrentContext();
if (previousContext != IntPtr.Zero)
RynthLog.Render($"EngineFrameController: Existing ImGui context detected (0x{previousContext:X8}) - isolating RynthCore context.");
@ -143,23 +139,20 @@ internal static class EngineFrameController
}
io.ConfigFlags |= ImGuiConfigFlags.DockingEnable;
// ViewportsEnable was enabling ImGui multi-viewport platform/renderer
// callbacks against a cimgui.dll that is NOT built with
// IMGUI_ENABLE_VIEWPORTS. The platform/renderer callback chain then
// recursed (Platform → Renderer → Platform → ...) on AC's render
// thread, eating the 1MB stack in ~17s and AV'ing in ntdll mid-push.
// CLAUDE.md flags this: Multi-viewport "requires cimgui built with
// IMGUI_ENABLE_VIEWPORTS" — flag re-introduced this in the engine
// and triggered the silent stack-overflow on every login.
// io.ConfigFlags |= ImGuiConfigFlags.ViewportsEnable;
// Popped-out plugin windows use WS_EX_TOOLWINDOW so they don't show
// up as extra "Asheron's Call" entries in the taskbar — critical for
// users running many clients side by side.
io.ConfigViewportsNoTaskBarIcon = true;
ImGuiNET.ImGui.StyleColorsDark();
// Multi-viewport (ViewportsEnable) is deliberately never enabled: it
// runs many native->managed platform/renderer callbacks per frame on
// AC's thread and creates HWNDs from inside EndScene. Pop-out panels,
// if built, are driven explicitly by the engine instead
// (docs/IMGUI_PARITY_PLAN.md section 4.2).
// One-shot offset probe for diagnostics — safe to keep installed.
ViewportProbe.Run();
// DPI scale for fonts and style metrics. Logged next to Avalonia's
// scale: docked positions are stored in Avalonia logical units, so
// the two must agree for a panel to land in the same place in
// either face (plan section 4.4).
_uiScale = UiScale.ForWindow(_gameHwnd);
RynthLog.UI($"EngineFrameController: ImGui scale {_uiScale:0.##} (Avalonia input scale {UI.AvaloniaOverlay.InputScale:0.##}).");
RynthTheme.Apply(ImGuiNET.ImGui.GetStyle(), _uiScale);
ImGuiFonts.Build(io, _uiScale);
if (!Win32Backend.Init(_gameHwnd))
return false;
@ -167,26 +160,11 @@ internal static class EngineFrameController
if (!DX9Backend.InitImGui(pDevice))
return false;
// Viewport backends only run when ViewportsEnable is on. Installing
// their callbacks on PlatformIO without the flag has no upside and
// just expands the crash surface.
if ((io.ConfigFlags & ImGuiConfigFlags.ViewportsEnable) != 0)
{
bool platformOk = ViewportPlatformBackend.Init(_gameHwnd);
bool rendererOk = platformOk && ViewportRendererBackend.Init(pDevice);
if (!platformOk || !rendererOk)
{
RynthLog.Render($"EngineFrameController: viewport init failed (platform={platformOk}, renderer={rendererOk}) — disabling ViewportsEnable.");
io.ConfigFlags &= ~ImGuiConfigFlags.ViewportsEnable;
}
ViewportPlatformBackend.ImGuiContext = _context;
}
_lastFrameTicks = Stopwatch.GetTimestamp();
_imguiInitialized = true;
initSucceeded = true;
RynthLog.Render("EngineFrameController: Fully initialized - RynthCore shell active.");
RynthLog.UI("EngineFrameController: ImGui initialized.");
return true;
}
finally
@ -213,14 +191,16 @@ internal static class EngineFrameController
{
ImGuiNET.ImGui.SetCurrentContext(contextToDestroy);
// Zero the WndProc context guard BEFORE DestroyContext so any
// deferred OS messages that arrive at viewport HWNDs during or
// after teardown don't try to call into freed ImGui memory.
ViewportPlatformBackend.ImGuiContext = IntPtr.Zero;
PluginManager.ShutdownAll();
// No context may be destroyed while a font worker runs (ImGuiFonts, re-bake note).
ImGuiFonts.WaitForWorkers();
// Pop-outs share the main font atlas: their contexts go before the main one.
ImGuiPopOuts.Shutdown();
OverlayTextureRenderer.Shutdown();
ViewportRendererBackend.Shutdown();
ViewportPlatformBackend.Shutdown();
// Its lists are drawn by DX9Backend from the DIP hook, which is still live.
UnderUiLayer.Shutdown();
ScriptIcons.Shutdown(); // script window icon textures, before the backend goes
RetailSprites.Shutdown(); // retail UI pictures (Inventory Classic view), likewise
DX9Backend.Shutdown();
// Do NOT call Win32Backend.Shutdown() here. EngineLifecycle.Shutdown
// owns that step explicitly, AFTER AvaloniaOverlay.Stop — floating
@ -230,6 +210,7 @@ internal static class EngineFrameController
// those destroys to AC's proc, which ignores them, and the orphaned
// panel HWND outlives the engine load.
ImGuiNET.ImGui.DestroyContext(contextToDestroy);
ImGuiFonts.Free(); // the atlas referenced these buffers; the context is gone now
_imguiInitialized = false;
_coreResolved = false;
@ -299,6 +280,11 @@ internal static class EngineFrameController
// is the dump-verified 0x0067E779 READ-AV when done on the pump thread.
// Sampled every frame (positions are volatile), zero-alloc.
Compatibility.ClientObjectHooks.PrefetchPositions();
// Refresh the cached player id every frame (unthrottled: the native leaf is
// two loads) and the other small main-thread snapshots (cast gate, pose,
// ...). Off-thread callers are served from these instead of reading AC
// memory from the pump thread. Also runs from the Client::UseTime drain.
Compatibility.MainThreadSnapshots.Tick();
// Same main-thread guard: snapshot XP/luminance/deaths/vitae (main-thread-only
// Inq* reads) so the GetEngineStatusJson host bridge can serve them off-thread (throttled).
Compatibility.ClientObjectHooks.PrefetchPlayerStats();
@ -363,8 +349,21 @@ internal static class EngineFrameController
// calls it at all.
// ── ImGui-gated work ─────────────────────────────────────────
if (Plugins.EngineSettings.EnableImGuiBackend)
RunImGuiFrame(pDevice);
// The frame is BUILT here and SUBMITTED after the Nav3D fallback and
// the vital HUD, so ImGui windows sit above both. The Avalonia quad
// (EndSceneHook, after this returns) stays topmost while both stacks
// run, matching input order: Avalonia gets the first hit test.
bool imguiEnabled = Plugins.EngineSettings.EnableImGuiBackend;
bool imguiBuilt = false;
long uiTicks = 0;
if (!imguiEnabled)
_imguiIdle = true; // switched off in game: input state resets when it comes back
else
{
long t0 = Stopwatch.GetTimestamp();
imguiBuilt = BuildImGuiFrame(pDevice);
uiTicks = Stopwatch.GetTimestamp() - t0;
}
// Fallback render — only fires when the injector missed this
// frame's 3D→UI transition. _coreInitialized is enough — this
@ -372,13 +371,22 @@ internal static class EngineFrameController
if (!nav3DAlreadyRendered)
DX9Backend.RenderNav3D(pDevice);
// Custom D3D9 vital HUD (Health/Stamina/Mana). Always-on (independent
// of EnableImGuiBackend) so it shows even in Avalonia-only mode; drawn
// last so it sits on top of the world + AC UI. Reads the vitals
// snapshot maintained on this same (AC main) thread and does its own
// device state save/restore. No-op until vitals are seeded.
if (Plugins.EngineSettings.DrawCustomVitalBars)
D3D9.VitalHud.Draw(pDevice);
// The world overlays built last frame (nameplates, combat text) normally
// drew at this frame's 3D->UI transition, under AC's UI. If that wasn't
// seen, they draw here - still under the ImGui panels. No-op when they
// already drew (UnderUiLayer presents a list once).
UnderUiLayer.PresentFallback(pDevice);
if (imguiEnabled)
{
long t0 = Stopwatch.GetTimestamp();
if (imguiBuilt)
SubmitImGuiFrame(pDevice);
// Popped-out panels: their own contexts, windows and render targets.
if (_imguiInitialized)
ImGuiPopOuts.RenderAll(pDevice, _uiScale, PanelsLive);
UiFrameStats.Record(uiTicks + (Stopwatch.GetTimestamp() - t0));
}
}
catch (Exception ex)
{
@ -392,9 +400,30 @@ internal static class EngineFrameController
// never fires again — every subsequent frame falls back to the
// end-of-frame draw (which paints over the UI).
D3D9.Nav3DRenderInjector.ResetFrame();
// What this frame built for the world overlays is presented next frame.
UnderUiLayer.EndFrame();
}
}
/// <summary>
/// The main-thread prefetches of the always-on pipeline above, for a client without
/// the EndScene hook (Decal in the process): called from the Client::UseTime detour
/// (AC's main thread) once GameTickHooks.HeadlessPrefetch is set. Same calls, same
/// order, each throttled and main-thread-gated internally. The EndScene path doesn't
/// use this (it runs the calls inline, unchanged).
/// </summary>
internal static void RunHeadlessPrefetch()
{
Compatibility.ClientObjectHooks.PrefetchPlayerSkills();
Compatibility.ClientObjectHooks.PrefetchKnownSpells();
Compatibility.ClientObjectHooks.PrefetchAttackable();
Compatibility.ClientObjectHooks.PrefetchObjectIdentity();
Compatibility.ClientObjectHooks.PrefetchPositions();
Compatibility.ClientObjectHooks.PrefetchPlayerStats();
try { Plugins.PluginManager.TrySeedLiveObjectsFromCObjectMaintOnce(); }
catch (Exception ex) { RynthLog.Plugin($"CObjectMaint seed threw {ex.GetType().Name}: {ex.Message}"); }
}
/// <summary>
/// The plugin lifecycle/tick work that used to run inline in
/// <see cref="OnEndScene"/>. Driven by the dedicated managed plugin pump
@ -419,15 +448,28 @@ internal static class EngineFrameController
return; // never re-enter PluginManager from two stacks
try
{
// Plugins only get the ImGui context when they may draw with it
// (EnableImGuiShell, FORCE-gated). The engine's own ImGui panels
// don't need plugins to see it, and handing it over switched
// RynthAi into its legacy-ImGui setup (first ImGui-on test,
// 2026-09-28) - plugins must behave exactly as in Avalonia-only mode.
IntPtr pluginContext = Plugins.EngineSettings.EnableImGuiShell ? _context : IntPtr.Zero;
if (!_pluginsInitialized)
{
_pluginsInitialized = true;
PluginManager.InitPlugins(_context, device, _gameHwnd);
PluginManager.InitPlugins(pluginContext, device, _gameHwnd);
}
PluginManager.ProcessPendingActions(_context, device, _gameHwnd);
// Decal bridge mode with the in-game renderer (DecalInGameImGui): chat and
// chat-bar lines come from the bridge. One flag check in every other client.
if (Compatibility.DecalBridgeHost.Active)
Compatibility.DecalBridgeHost.Drain();
PluginManager.ProcessPendingActions(pluginContext, device, _gameHwnd);
PluginManager.FlushPendingDeletes(); // closes the create→delete race window
PluginManager.TickAll();
// Panel data: plugin exports for the UI are called here, on the same
// thread as the plugin tick, and published as immutable snapshots.
UI.Data.UiDataHub.Step();
}
catch (Exception ex)
{
@ -439,26 +481,97 @@ internal static class EngineFrameController
}
}
/// <summary>
/// Runs the ImGui-specific portion of the per-frame pipeline:
/// backend NewFrame plumbing, ImGui frame open/close, RynthCore shell +
/// plugin RenderAll, draw-data submission, capture flag update, and the
/// multi-viewport platform pump. Bypassed entirely when
/// EngineSettings.EnableImGuiBackend is false.
/// </summary>
private static void RunImGuiFrame(IntPtr pDevice)
/// <summary>True when anything ImGui should be drawn this frame.</summary>
private static bool HasImGuiContent()
{
if (_imguiInitFailed) return;
if (Plugins.EngineSettings.EnableImGuiShell || ImGuiFontTest.Enabled) return true;
if (!PanelsLive) return false;
ImGuiPanelHost.RestoreOnce();
return ImGuiPanelHost.NeedsFrame || ImGuiBar.Visible || ImGuiBar.PoppedOut || Hud.MonsterHud.WantsFrame;
}
/// <summary>
/// Panel faces show only in the world, like the Avalonia overlay (hidden
/// between characters, not closed).
/// </summary>
private static bool PanelsLive => Compatibility.LoginLifecycleHooks.HasObservedLoginComplete;
/// <summary>DPI scale the fonts and style were built for (see Init).</summary>
private static float _uiScale = 1f;
/// <summary>The scale the fonts and style were built for.</summary>
internal static float FontScale => _uiScale;
/// <summary>A popped-out panel was clicked: the main context's text edit ends next frame. AC thread.</summary>
internal static void DropMainTextFocus() => _dropImGuiTextFocus = true;
// ── Diagnostics (/rc imgui diag) ─────────────────────────────────
private static long _framesBuilt;
private static System.Numerics.Vector2 _lastDisplaySize;
/// <summary>One line per fact about the ImGui layer's state. Game thread (reads plain fields).</summary>
internal static System.Collections.Generic.List<string> DescribeState()
{
var lines = new System.Collections.Generic.List<string>
{
$"layer={(Plugins.EngineSettings.EnableImGuiBackend ? "on" : "off")} initialized={_imguiInitialized} initFailed={_imguiInitFailed} selfTest={ImGuiSelfTest.LastResult}",
$"inWorld={PanelsLive} content={HasImGuiContentNoRestore()} idle={_imguiIdle} framesBuilt={_framesBuilt} uiScale={_uiScale:0.##} avaloniaScale={UI.AvaloniaOverlay.InputScale:0.##} display={_lastDisplaySize.X:0}x{_lastDisplaySize.Y:0}",
DX9Backend.DescribeLastFrame(),
UnderUiLayer.Describe(),
$"capture: {Win32Backend.DescribeCapture()}",
};
lines.AddRange(ImGuiPopOuts.Describe());
return lines;
}
private static bool HasImGuiContentNoRestore() =>
Plugins.EngineSettings.EnableImGuiShell || ImGuiFontTest.Enabled || (PanelsLive && (ImGuiPanelHost.NeedsFrame || ImGuiBar.Visible || ImGuiBar.PoppedOut || Hud.MonsterHud.WantsFrame));
// Keyboard owner between the stacks (plan §3.2 d): whichever side started
// text entry most recently keeps the keyboard.
private static bool _prevImGuiText, _prevAvaloniaText, _dropImGuiTextFocus;
/// <summary>True while frames are being skipped because nothing ImGui is open.</summary>
private static bool _imguiIdle = true;
/// <summary>
/// Builds the ImGui frame (NewFrame ... Render) and publishes the capture
/// flags. Returns true when there is draw data for <see cref="SubmitImGuiFrame"/>.
/// Only called while EngineSettings.EnableImGuiBackend is true.
///
/// Early-out: with no ImGui content there is no ImGui frame at all. Queued
/// input is dropped (nothing would drain it) and capture flags are cleared,
/// so the idle cost is one GetClientRect.
/// </summary>
private static bool BuildImGuiFrame(IntPtr pDevice)
{
if (_imguiInitFailed) return false;
if (!_imguiInitialized)
{
// Initialised as soon as the backend is enabled (not lazily on first
// content), so the cimgui self-test result is in the log at startup.
if (!Init(pDevice))
{
_imguiInitFailed = true;
return;
return false;
}
}
Win32Backend.UpdateClientMetrics(out int clientW, out int clientH);
// Monster nameplates: pick the monsters (throttled) before deciding
// whether there is a frame to build, so plates alone can ask for one.
Hud.MonsterHud.Update(PanelsLive);
if (!HasImGuiContent())
{
_imguiIdle = true;
Win32Backend.DiscardQueuedInput();
Win32Backend.ClearCaptureFlags();
return false;
}
IntPtr previousContext = ImGuiNET.ImGui.GetCurrentContext();
ImGuiNET.ImGui.SetCurrentContext(_context);
bool frameStarted = false;
@ -466,11 +579,36 @@ internal static class EngineFrameController
try
{
_frameCount++;
DX9Backend.NewFrame();
Win32Backend.NewFrame();
ImGuiIOPtr io = ImGuiNET.ImGui.GetIO();
long now = Stopwatch.GetTimestamp();
if (_imguiIdle)
{
// Resuming: keys/buttons released while idle must not read as held,
// and the idle gap must not become one huge DeltaTime.
_imguiIdle = false;
Win32Backend.ResetImGuiInputState(io);
_lastFrameTicks = now;
}
_frameCount++;
// A panel's text size changed: re-bake the fonts (only the sizes in
// use) and replace the font texture, between frames.
// The new atlas is baked on a worker (ImGuiFonts.PumpRebuild), once per run of
// changes (RequestRebuild debounces); here it is swapped in and its texture made.
DX9Backend.ReleaseRetiredFontTexture(); // the texture a rebuild replaced last frame
long rebuildStart = Stopwatch.GetTimestamp();
if (ImGuiFonts.PumpRebuild(io, _uiScale, out string rebuilt))
{
DX9Backend.RebuildFontTexture(pDevice);
double rebuildMs = (Stopwatch.GetTimestamp() - rebuildStart) * 1000.0 / Stopwatch.Frequency;
RynthLog.UI($"ImGuiFonts: text size change: {rebuilt}; render thread {rebuildMs:0.0} ms (swap + texture).");
}
// Script window icons decoded since the last frame become textures, and the least
// recently drawn go, before anything draws (no draw list points at them any more).
ScriptIcons.BeginFrame(pDevice);
RetailSprites.BeginFrame(pDevice); // retail UI pictures decoded since the last frame (kept, never evicted)
DX9Backend.NewFrame();
Win32Backend.NewFrame(clientW, clientH);
// Fallback: if Win32Backend could not determine display size, read from the D3D9 viewport.
if (io.DisplaySize.X <= 1 || io.DisplaySize.Y <= 1)
@ -480,65 +618,52 @@ internal static class EngineFrameController
io.DisplaySize = new System.Numerics.Vector2(vpW, vpH);
}
long now = Stopwatch.GetTimestamp();
float dt = (float)(now - _lastFrameTicks) / Stopwatch.Frequency;
_lastFrameTicks = now;
io.DeltaTime = dt > 0f ? dt : 1f / 60f;
// With ViewportsEnable on, ImGui routes mouse and window positions in
// absolute screen coords. The main viewport's Pos must equal the game
// client's screen origin so clicks over the main viewport map to the
// correct windows, and popped-out viewports share a coord system with
// the main one.
if ((io.ConfigFlags & ImGuiConfigFlags.ViewportsEnable) != 0)
{
int screenX = 0, screenY = 0;
if (_gameHwnd != IntPtr.Zero)
{
ClientPoint p = new ClientPoint { X = 0, Y = 0 };
if (ClientToScreen(_gameHwnd, ref p)) { screenX = p.X; screenY = p.Y; }
}
ImGuiViewportPtr mainVp = ImGuiNET.ImGui.GetMainViewport();
mainVp.Pos = new System.Numerics.Vector2(screenX, screenY);
mainVp.Size = io.DisplaySize;
mainVp.WorkPos = new System.Numerics.Vector2(screenX, screenY);
mainVp.WorkSize = io.DisplaySize;
}
ImGuiNET.ImGui.NewFrame();
frameStarted = true;
// EnableImGuiShell gates the in-AC ImGui surface as a whole: both the
// RynthCore overlay bar and any plugin-drawn ImGui windows. Plugins
// still load, init, and tick when this is off — they just don't
// draw, so Avalonia panels can drive them via the plugin's C exports.
if (_dropImGuiTextFocus)
{
// An Avalonia TextBox took the keyboard: end ImGui's text edit.
_dropImGuiTextFocus = false;
ImGuiNET.ImGui.SetWindowFocus(null);
}
// EnableImGuiShell gates the old diagnostic shell and plugin-drawn
// ImGui windows (plugin code on AC's thread: FORCE-gated, stays off).
if (Plugins.EngineSettings.EnableImGuiShell)
{
RynthCoreShell.Render(_frameCount);
PluginManager.RenderAll();
}
bool captureMouse =
ImGuiNET.ImGui.IsWindowHovered(ImGuiHoveredFlags.AnyWindow) ||
ImGuiNET.ImGui.IsAnyItemActive();
bool captureKeyboard = ImGuiNET.ImGui.IsAnyItemActive();
if (PanelsLive)
{
// World overlays: built into UnderUiLayer's list, drawn next frame at
// AC's 3D->UI transition (under AC's UI and every panel), no input.
Hud.MonsterHud.Draw(_uiScale);
if (ImGuiBar.Visible)
ImGuiBar.Draw(_uiScale);
ImGuiPanelHost.DrawAll(_uiScale);
ImGuiBar.SyncPopOut(_uiScale);
}
if (ImGuiFontTest.Enabled)
ImGuiFontTest.Draw(_uiScale);
ImGuiNET.ImGui.EndFrame();
frameEnded = true;
ImGuiNET.ImGui.Render();
Win32Backend.UpdateCaptureFlags(captureMouse, captureKeyboard);
ImGuiAssertLog.Poll();
_framesBuilt++;
_lastDisplaySize = io.DisplaySize;
ImDrawDataPtr drawData = ImGuiNET.ImGui.GetDrawData();
DX9Backend.RenderDrawData(drawData, pDevice);
// OverlayTextureRenderer.Render is now driven from EndSceneHook.EndSceneDetour
// directly so the Avalonia compositor runs even when EnableImGuiBackend=false.
// Leaving it out of this call site avoids double-blit when ImGui is also active.
if ((io.ConfigFlags & ImGuiConfigFlags.ViewportsEnable) != 0)
{
ImGuiNET.ImGui.UpdatePlatformWindows();
ImGuiNET.ImGui.RenderPlatformWindowsDefault();
}
// io.WantCaptureMouse already applies ImGui's own button-ownership
// rule; io.WantTextInput is true only while a text field is edited.
// MonsterHud.WantsMouse: the cursor is on a clickable nameplate (or a
// press that began on one is held), so that click is the plate's.
Win32Backend.UpdateCaptureFlags(io.WantCaptureMouse || Hud.MonsterHud.WantsMouse, io.WantTextInput);
ArbitrateTextFocus(io.WantTextInput);
return true;
}
catch (Exception ex)
{
@ -552,7 +677,46 @@ internal static class EngineFrameController
{
}
Win32Backend.ClearCaptureFlags();
RynthLog.Info($"EngineFrameController: frame {_frameCount} ImGui error: {ex.GetType().Name}: {ex.Message}");
return false;
}
finally
{
ImGuiNET.ImGui.SetCurrentContext(previousContext);
}
}
private static void ArbitrateTextFocus(bool imguiText)
{
bool avaloniaText = Win32Backend.AvaloniaTextInputActive;
if (imguiText && !_prevImGuiText && avaloniaText)
{
// An ImGui field just started typing: Avalonia gives up the keyboard.
Win32Backend.AvaloniaTextInputActive = false;
UI.AvaloniaOverlay.ClearTextFocus();
avaloniaText = false;
}
else if (avaloniaText && !_prevAvaloniaText && imguiText)
{
_dropImGuiTextFocus = true;
}
_prevImGuiText = imguiText;
_prevAvaloniaText = avaloniaText;
}
/// <summary>Draws the frame <see cref="BuildImGuiFrame"/> produced.</summary>
private static void SubmitImGuiFrame(IntPtr pDevice)
{
IntPtr previousContext = ImGuiNET.ImGui.GetCurrentContext();
ImGuiNET.ImGui.SetCurrentContext(_context);
try
{
DX9Backend.RenderDrawData(ImGuiNET.ImGui.GetDrawData(), pDevice);
}
catch (Exception ex)
{
RynthLog.Info($"EngineFrameController: frame {_frameCount} ImGui submit error: {ex.GetType().Name}: {ex.Message}");
}
finally
{