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:
parent
9b5e2765b7
commit
a24ed6df7c
322 changed files with 83009 additions and 7504 deletions
|
|
@ -13,28 +13,51 @@ public unsafe sealed class RynthPluginRuntime<TPlugin>
|
|||
private int _exceptionCount;
|
||||
private const int MaxLoggedExceptions = 20;
|
||||
|
||||
// Init results besides the plugin's own Initialize() return value. The
|
||||
// engine treats any non-zero result as "Init failed" (PluginManager marks
|
||||
// the plugin failed, logs the code, and never ticks or shuts it down).
|
||||
public const int InitNullApi = 9;
|
||||
public const int InitApiTooOld = 10;
|
||||
public const int InitThrew = 11;
|
||||
|
||||
public TPlugin? Plugin => _plugin;
|
||||
public bool IsInitialized => _initialized && _plugin != null;
|
||||
|
||||
// Init and Shutdown are called straight from [UnmanagedCallersOnly]
|
||||
// exports: an exception escaping them takes acclient.exe down (NativeAOT
|
||||
// fails fast), so both catch everything and log.
|
||||
public int Init(RynthCoreApiNative* api)
|
||||
{
|
||||
if (api == null)
|
||||
return 9;
|
||||
return InitNullApi;
|
||||
|
||||
var plugin = new TPlugin();
|
||||
RynthCoreApiNative hostApi = *api;
|
||||
TPlugin? plugin = null;
|
||||
try
|
||||
{
|
||||
plugin = new TPlugin();
|
||||
RynthCoreApiNative hostApi = *api;
|
||||
|
||||
if (hostApi.Version < plugin.MinimumApiVersion)
|
||||
return 10;
|
||||
if (hostApi.Version < plugin.MinimumApiVersion)
|
||||
return InitApiTooOld;
|
||||
|
||||
plugin.Attach(hostApi);
|
||||
int result = plugin.Initialize();
|
||||
if (result != 0)
|
||||
return result;
|
||||
plugin.Attach(hostApi);
|
||||
int result = plugin.Initialize();
|
||||
if (result != 0)
|
||||
return result;
|
||||
|
||||
_plugin = plugin;
|
||||
_initialized = true;
|
||||
return 0;
|
||||
_plugin = plugin;
|
||||
_initialized = true;
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Shutdown isn't called on a plugin whose Init failed, and isn't
|
||||
// attempted here either: on a half-initialized plugin it could
|
||||
// do more harm (e.g. save settings it never loaded).
|
||||
try { plugin?.LogInternal($"[RynthCore] Initialize threw {ex.GetType().Name}: {ex.Message} - plugin not started."); }
|
||||
catch { }
|
||||
return InitThrew;
|
||||
}
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
|
|
@ -46,6 +69,11 @@ public unsafe sealed class RynthPluginRuntime<TPlugin>
|
|||
{
|
||||
_plugin!.Shutdown();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
try { _plugin?.LogInternal($"[RynthCore] Shutdown threw {ex.GetType().Name}: {ex.Message}"); }
|
||||
catch { }
|
||||
}
|
||||
finally
|
||||
{
|
||||
_plugin = null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue