Add multi-viewport support, FPS governor, mana stone looting, and viewport focus fixes

Engine:
- ViewportPlatformBackend: Win32 platform backend for ImGui multi-viewport (pop-out windows)
- ViewportRendererBackend: D3D9 swap chain rendering for viewport windows
- ViewportPlatformBackend: WS_EX_NOACTIVATE + MA_NOACTIVATE always + SW_SHOWNA — viewport
  windows never steal focus; single click works without prior window activation
- ImGuiController/RynthCoreShell: wire multi-viewport callbacks, map always renders
  independent of main dashboard visibility
- Win32Backend: improved input handling for viewport windows
- EndSceneHook: FPS governor (focused/background targets), periodic FPS measurement
- D3D9VTable: vtable discovery improvements
- PluginContract/PluginManager/RynthCoreHost: expose UseObjectOn, GetItemType,
  GetObjectIntProperty to plugins

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
tombohar 2026-04-19 20:29:34 -04:00
commit 0d8579b796
24 changed files with 1876 additions and 38 deletions

View file

@ -455,6 +455,12 @@ internal struct RynthCoreAPI
/// Force-resets the client's ClientUISystem busy count to zero.
/// Use after portal teleports that interrupt actions and leave the hourglass cursor stuck.</summary>
public IntPtr ForceResetBusyCountFn;
/// <summary>Function pointer: int GetObjectPalettes(uint objectId, uint* subIds, uint* offsets, int maxCount)
/// Fills subIds and offsets with the item's ObjDesc subpalette data (sorted by offset).
/// Returns total subpalette count, or -1 if no data was captured for this object.
/// subIds[i] is the palette DID; offsets[i] is the range-start offset (used as slot index).</summary>
public IntPtr GetObjectPalettesFn;
}
@ -462,7 +468,7 @@ internal struct RynthCoreAPI
/// <summary>Current API version. Bump when adding fields to RynthCoreAPI.</summary>
internal static class PluginContractVersion
{
public const uint Current = 49;
public const uint Current = 50;
}
internal static class ClientActionHookFlags
@ -846,3 +852,6 @@ internal delegate uint GetObjectBitfieldCallbackDelegate(uint objectId);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void ForceResetBusyCountCallbackDelegate();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate int GetObjectPalettesCallbackDelegate(uint objectId, uint* subIds, uint* offsets, int maxCount);

View file

@ -188,6 +188,7 @@ internal static class PluginManager
private static GetObjectMotionOnCallbackDelegate? _getObjectMotionOnCallback;
private static GetObjectStateCallbackDelegate? _getObjectStateCallback;
private static GetObjectBitfieldCallbackDelegate? _getObjectBitfieldCallback;
private static GetObjectPalettesCallbackDelegate? _getObjectPalettesCallback;
private static IntPtr _accountNameScratchPtr;
private static IntPtr _worldNameScratchPtr;
[ThreadStatic] private static IntPtr _objectNameScratchPtr;
@ -1836,6 +1837,8 @@ internal static class PluginManager
_api.GetObjectStateFn = Marshal.GetFunctionPointerForDelegate(_getObjectStateCallback);
_api.GetObjectBitfieldFn = Marshal.GetFunctionPointerForDelegate(_getObjectBitfieldCallback);
_api.ForceResetBusyCountFn = Marshal.GetFunctionPointerForDelegate(_forceResetBusyCountCallback);
_getObjectPalettesCallback ??= GetObjectPalettesAction;
_api.GetObjectPalettesFn = Marshal.GetFunctionPointerForDelegate(_getObjectPalettesCallback);
}
private static void ProbeClientHooks()
@ -2362,6 +2365,12 @@ internal static class PluginManager
return ClientObjectHooks.TryGetObjectBitfield(objectId, out uint bitfield) ? bitfield : 0u;
}
private static unsafe int GetObjectPalettesAction(uint objectId, uint* subIds, uint* offsets, int maxCount)
{
if (subIds == null || offsets == null || maxCount <= 0) return -1;
return PaletteCache.Fill(objectId, subIds, offsets, maxCount);
}
private static int HasAppraisalDataAction(uint objectId)
{
return AppraisalHooks.HasAppraisalData(objectId) ? 1 : 0;