A snapshot of the working tree for aelrynth.com/git/: the code, build files and public docs. Internal review notes and agent instructions are left out. MIT licensed; see LICENSE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
3.4 KiB
C#
62 lines
3.4 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using RynthCore.PluginCore;
|
|
using RynthCore.PluginSdk;
|
|
|
|
namespace RynthCore.Plugin.RynthJuice;
|
|
|
|
/// <summary>
|
|
/// C ABI exports the engine's PluginLoader resolves by name (GetProcAddress).
|
|
/// Note there is intentionally NO RynthPluginRender export: that drives plugin
|
|
/// ImGui drawing, which RynthJuice doesn't use. All geometry is submitted from
|
|
/// the tick (RynthPluginTick) through the engine's Nav3D renderer, which has its
|
|
/// own draw hook and runs regardless of the ImGui shell.
|
|
/// </summary>
|
|
public static unsafe class PluginExports
|
|
{
|
|
private static readonly RynthPluginRuntime<RynthJuicePlugin> Runtime = new();
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginInit", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
private static int Init(RynthCoreApiNative* api) => Runtime.Init(api);
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginShutdown", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static void Shutdown() => Runtime.Shutdown();
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginName", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static IntPtr GetName() => RynthJuicePlugin.NamePointer;
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginVersion", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static IntPtr GetVersion() => RynthJuicePlugin.VersionPointer;
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginTick", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static void Tick() => Runtime.OnTick();
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginOnLoginComplete", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static void OnLoginComplete() => Runtime.OnLoginComplete();
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginOnLogout", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static void OnLogout() => Runtime.OnLogout();
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginOnUpdateHealth", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static void OnUpdateHealth(uint targetId, float healthRatio, uint currentHealth, uint maxHealth)
|
|
=> Runtime.OnUpdateHealth(targetId, healthRatio, currentHealth, maxHealth);
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginOnCombatDamage", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static void OnCombatDamage(uint damage, uint damageType, uint crit, uint isAttacker)
|
|
=> Runtime.OnCombatDamage(damage, damageType, crit, isAttacker);
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginOnDeleteObject", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static void OnDeleteObject(uint objectId) => Runtime.OnDeleteObject(objectId);
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginOnCreateObject", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static void OnCreateObject(uint objectId) => Runtime.OnCreateObject(objectId);
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginOnChatWindowText", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static void OnChatWindowText(IntPtr textUtf16, int chatType, IntPtr eatFlag)
|
|
=> Runtime.OnChatWindowText(textUtf16, chatType, eatFlag);
|
|
|
|
[UnmanagedCallersOnly(EntryPoint = "RynthPluginOnChatBarEnter", CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
public static void OnChatBarEnter(IntPtr textUtf16, IntPtr eatFlag)
|
|
=> Runtime.OnChatBarEnter(textUtf16, eatFlag);
|
|
}
|