Add radar rect API, jump primitives, account profile tweaks

- Hook gmRadarUI::DrawObjects to capture the UI singleton; expose
  host.TryGetRadarRect via UIElement::GetSurfaceBox (API v53).
- Plumb CommenceJump/DoJump/LaunchJumpWithMotion through
  ClientActionHooks and PlayerPhysicsHooks.
- Account profile dialog + LaunchAccountProfile adjustments.
- Viewport platform backend tweak.
This commit is contained in:
tombohar 2026-04-22 21:28:29 -04:00
commit 2c3d2410a8
13 changed files with 540 additions and 15 deletions

View file

@ -461,6 +461,30 @@ internal struct RynthCoreAPI
/// 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;
/// <summary>Function pointer: int CommenceJump()
/// Calls ClientCombatSystem::CommenceJump (spacebar key-down). Starts the
/// power-bar charge cycle. Pair with DoJump(autonomous) to release.</summary>
public IntPtr CommenceJumpFn;
/// <summary>Function pointer: int DoJump(int autonomous)
/// Calls ClientCombatSystem::DoJump (spacebar key-up). Releases a jump
/// at the current power-bar level. Pass autonomous=1 for the normal
/// player-driven jump (matches keyboard behavior).</summary>
public IntPtr DoJumpFn;
/// <summary>Function pointer: int LaunchJumpWithMotion(int shift, int w, int x, int z, int c)
/// Writes motion vector directly into CMotionInterp, calls DoJump(1), then
/// clears the motion. This is the only way to jump with forward/back/strafe
/// momentum — SetMotion does not bake velocity into the physics sim in time
/// for DoJump. Mirrors UB's UBHelper.Jumper algorithm.</summary>
public IntPtr LaunchJumpWithMotionFn;
/// <summary>Function pointer: int GetRadarRect(int* x0, int* y0, int* x1, int* y1)
/// Returns the retail gmRadarUI element's current screen rect in pixels
/// (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;
}
@ -468,7 +492,7 @@ internal struct RynthCoreAPI
/// <summary>Current API version. Bump when adding fields to RynthCoreAPI.</summary>
internal static class PluginContractVersion
{
public const uint Current = 50;
public const uint Current = 53;
}
internal static class ClientActionHookFlags
@ -625,6 +649,15 @@ internal delegate int SetAutoRunCallbackDelegate(int enabled);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int TapJumpCallbackDelegate();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int CommenceJumpCallbackDelegate();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int DoJumpCallbackDelegate(int autonomous);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int LaunchJumpWithMotionCallbackDelegate(int shift, int w, int x, int z, int c);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int SetMotionCallbackDelegate(uint motion, int enabled);
@ -855,3 +888,6 @@ internal delegate void ForceResetBusyCountCallbackDelegate();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate int GetObjectPalettesCallbackDelegate(uint objectId, uint* subIds, uint* offsets, int maxCount);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate int GetRadarRectCallbackDelegate(int* x0, int* y0, int* x1, int* y1);

View file

@ -113,6 +113,10 @@ internal static class PluginManager
private static SetAutonomyLevelCallbackDelegate? _setAutonomyLevelCallback;
private static SetAutoRunCallbackDelegate? _setAutoRunCallback;
private static TapJumpCallbackDelegate? _tapJumpCallback;
private static CommenceJumpCallbackDelegate? _commenceJumpCallback;
private static DoJumpCallbackDelegate? _doJumpCallback;
private static LaunchJumpWithMotionCallbackDelegate? _launchJumpWithMotionCallback;
private static GetRadarRectCallbackDelegate? _getRadarRectCallback;
private static SetMotionCallbackDelegate? _setMotionCallback;
private static StopCompletelyCallbackDelegate? _stopCompletelyCallback;
private static TurnToHeadingCallbackDelegate? _turnToHeadingCallback;
@ -1671,6 +1675,10 @@ internal static class PluginManager
_setAutonomyLevelCallback ??= SetAutonomyLevel;
_setAutoRunCallback ??= SetAutoRun;
_tapJumpCallback ??= TapJump;
_commenceJumpCallback ??= CommenceJump;
_doJumpCallback ??= DoJump;
_launchJumpWithMotionCallback ??= LaunchJumpWithMotion;
_getRadarRectCallback ??= GetRadarRect;
_setMotionCallback ??= SetMotion;
_stopCompletelyCallback ??= StopCompletely;
_turnToHeadingCallback ??= TurnToHeading;
@ -1839,6 +1847,10 @@ internal static class PluginManager
_api.ForceResetBusyCountFn = Marshal.GetFunctionPointerForDelegate(_forceResetBusyCountCallback);
_getObjectPalettesCallback ??= GetObjectPalettesAction;
_api.GetObjectPalettesFn = Marshal.GetFunctionPointerForDelegate(_getObjectPalettesCallback);
_api.CommenceJumpFn = Marshal.GetFunctionPointerForDelegate(_commenceJumpCallback);
_api.DoJumpFn = Marshal.GetFunctionPointerForDelegate(_doJumpCallback);
_api.LaunchJumpWithMotionFn = Marshal.GetFunctionPointerForDelegate(_launchJumpWithMotionCallback);
_api.GetRadarRectFn = Marshal.GetFunctionPointerForDelegate(_getRadarRectCallback);
}
private static void ProbeClientHooks()
@ -2183,6 +2195,33 @@ internal static class PluginManager
return ToAbiBool(ClientActionHooks.TapJump());
}
private static int CommenceJump()
{
return ToAbiBool(ClientActionHooks.CommenceJump());
}
private static int DoJump(int autonomous)
{
return ToAbiBool(ClientActionHooks.DoJump(autonomous != 0));
}
private static int LaunchJumpWithMotion(int shift, int w, int x, int z, int c)
{
return ToAbiBool(ClientActionHooks.LaunchJumpWithMotion(shift != 0, w != 0, x != 0, z != 0, c != 0));
}
private static unsafe int GetRadarRect(int* x0, int* y0, int* x1, int* y1)
{
if (x0 == null || y0 == null || x1 == null || y1 == null)
return 0;
if (!RadarHooks.TryGetRadarRect(out int rx0, out int ry0, out int rx1, out int ry1))
return 0;
*x0 = rx0; *y0 = ry0; *x1 = rx1; *y1 = ry1;
return 1;
}
private static int SetMotion(uint motion, int enabled)
{
return ToAbiBool(ClientActionHooks.SetMotion(motion, enabled != 0));