Add radar/chat suppression hooks and custom-widget API

- ChatHooks: captures gmMainChatUI via ListenToElementMessage and hides it
  via UIElement::SetVisible(false), re-asserted every frame from EndSceneHook.
  Suppression toggle restores visibility when flipped off.
- RadarHooks: also suppresses gmRadarUI::DrawChildren (bezel/compass/coords)
  alongside DrawObjects so the whole retail radar goes blank.
- PluginContract v55: SetRadarSuppressed + SetChatSuppressed fn pointers
  exposed to plugins via RynthCoreHost.
This commit is contained in:
tombohar 2026-04-23 21:08:26 -04:00
commit 01c7a549bd
8 changed files with 312 additions and 20 deletions

View file

@ -485,6 +485,18 @@ internal struct RynthCoreAPI
/// (x0,y0 top-left, x1,y1 bottom-right exclusive). Returns 1 on success, 0
/// if the radar has not rendered yet this session. Requires API v53+.</summary>
public IntPtr GetRadarRectFn;
/// <summary>Function pointer: void SetRadarSuppressed(int enabled)
/// When enabled=1, the engine skips the original gmRadarUI::DrawObjects call
/// so the vanilla radar stops rendering and a plugin can own that rect.
/// Requires API v54+.</summary>
public IntPtr SetRadarSuppressedFn;
/// <summary>Function pointer: void SetChatSuppressed(int enabled)
/// When enabled=1, the engine calls UIElement::SetVisible(false) on the
/// gmMainChatUI each frame, hiding the retail chatbox entirely.
/// Requires API v55+.</summary>
public IntPtr SetChatSuppressedFn;
}
@ -492,7 +504,7 @@ internal struct RynthCoreAPI
/// <summary>Current API version. Bump when adding fields to RynthCoreAPI.</summary>
internal static class PluginContractVersion
{
public const uint Current = 53;
public const uint Current = 55;
}
internal static class ClientActionHookFlags
@ -891,3 +903,9 @@ internal unsafe delegate int GetObjectPalettesCallbackDelegate(uint objectId, ui
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate int GetRadarRectCallbackDelegate(int* x0, int* y0, int* x1, int* y1);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void SetRadarSuppressedCallbackDelegate(int enabled);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void SetChatSuppressedCallbackDelegate(int enabled);

View file

@ -117,6 +117,8 @@ internal static class PluginManager
private static DoJumpCallbackDelegate? _doJumpCallback;
private static LaunchJumpWithMotionCallbackDelegate? _launchJumpWithMotionCallback;
private static GetRadarRectCallbackDelegate? _getRadarRectCallback;
private static SetRadarSuppressedCallbackDelegate? _setRadarSuppressedCallback;
private static SetChatSuppressedCallbackDelegate? _setChatSuppressedCallback;
private static SetMotionCallbackDelegate? _setMotionCallback;
private static StopCompletelyCallbackDelegate? _stopCompletelyCallback;
private static TurnToHeadingCallbackDelegate? _turnToHeadingCallback;
@ -1679,6 +1681,8 @@ internal static class PluginManager
_doJumpCallback ??= DoJump;
_launchJumpWithMotionCallback ??= LaunchJumpWithMotion;
_getRadarRectCallback ??= GetRadarRect;
_setRadarSuppressedCallback ??= SetRadarSuppressed;
_setChatSuppressedCallback ??= SetChatSuppressed;
_setMotionCallback ??= SetMotion;
_stopCompletelyCallback ??= StopCompletely;
_turnToHeadingCallback ??= TurnToHeading;
@ -1851,6 +1855,8 @@ internal static class PluginManager
_api.DoJumpFn = Marshal.GetFunctionPointerForDelegate(_doJumpCallback);
_api.LaunchJumpWithMotionFn = Marshal.GetFunctionPointerForDelegate(_launchJumpWithMotionCallback);
_api.GetRadarRectFn = Marshal.GetFunctionPointerForDelegate(_getRadarRectCallback);
_api.SetRadarSuppressedFn = Marshal.GetFunctionPointerForDelegate(_setRadarSuppressedCallback);
_api.SetChatSuppressedFn = Marshal.GetFunctionPointerForDelegate(_setChatSuppressedCallback);
}
private static void ProbeClientHooks()
@ -2222,6 +2228,16 @@ internal static class PluginManager
return 1;
}
private static void SetRadarSuppressed(int enabled)
{
RadarHooks.SuppressOriginalDraw = enabled != 0;
}
private static void SetChatSuppressed(int enabled)
{
ChatHooks.SuppressOriginalChat = enabled != 0;
}
private static int SetMotion(uint motion, int enabled)
{
return ToAbiBool(ClientActionHooks.SetMotion(motion, enabled != 0));