Bootstrap¶
static class
原生 C++ 加载器 (dotnet_loader) 调用的托管入口点。包含宿主初始化、插件装配、事件/表单/调度/地图渲染等回调转发逻辑。
命名空间 Endstone.Loader
继承 object
方法¶
void Attach(System.IntPtr gcHandle, System.IntPtr nativePlugin)¶
int DispatchCommand(System.IntPtr gcHandle, System.IntPtr senderPtr, System.IntPtr commandNameUtf8, System.IntPtr argsUtf8, int argCount)¶
Native command entry: dispatches to the managed command handler.
void DispatchEvent(System.IntPtr gcHandle, System.IntPtr cbHandle, System.IntPtr eventPtr)¶
Native event handler entry: dispatches to the managed callback.
void FormDispatch(System.IntPtr playerPtr, int resultKind, ulong formId, int buttonIndex, System.IntPtr payloadUtf8)¶
Native form callback entry: dispatches submit/close to the managed form.
int GetLoaderFilters(System.IntPtr loaderGcHandle, System.IntPtr buffer, int bufferSize)¶
Serializes a loader's as a JSON array of strings into the caller-provided buffer; returns 1 on success. Only structural checks (non-empty list, non-empty strings) happen here; regex syntax is validated natively with std::regex — the same engine endstone uses — so no pattern is rejected or accepted by a mismatched engine. Failures are logged with the loader's assembly/type so the log identifies which plugin's loader implementation is broken.
int Init(System.IntPtr logFn, System.IntPtr bridgeTable)¶
System.IntPtr LoadPlugin(System.IntPtr assemblyPathUtf8, System.IntPtr infoBuffer, int bufferSize)¶
Loads a plugin assembly, finds the [Plugin]-annotated PluginBase subclass, instantiates it and returns a GCHandle. Writes JSON plugin info ({"name","version","description","authors","commands"}) — or an error message on failure — into the caller-provided UTF-8 buffer.
System.IntPtr LoadPluginViaLoader(System.IntPtr loaderGcHandle, System.IntPtr fileUtf8, System.IntPtr infoBuffer, int bufferSize)¶
Loads a plugin through a managed instance (registered via PluginManager.RegisterLoader). Returns a GCHandle to the PluginBase it produces, or 0 on failure / when the file is skipped.
void MapRenderDispatch(System.IntPtr canvasPtr, System.IntPtr mapPtr, System.IntPtr playerPtr, ulong rendererId)¶
Native map render entry: forwards endstone's render() to the managed renderer.
void OnDisable(System.IntPtr gcHandle)¶
void OnEnable(System.IntPtr gcHandle)¶
void OnLoad(System.IntPtr gcHandle)¶
int QueryCommands(System.IntPtr gcHandle, System.IntPtr buffer, int bufferSize)¶
Re-queries command declarations (called by native side after OnLoad). Writes a JSON array of command definitions; returns 1 when the buffer was written, 0 when the plugin handle is unknown.
void Release(System.IntPtr gcHandle)¶
void SetServer(System.IntPtr serverPtr)¶
void TaskDispatch(ulong managedTaskId)¶
Native scheduler task entry: fires the managed callback by managed task id.