-
Notifications
You must be signed in to change notification settings - Fork 13
Legacy: PluginPreload routine
You are reading the documentation of YYToolkit Legacy (v2.x.x) - for documentation on current-gen YYTK, see the Homepage.
If Early Launch is enabled, the PluginPreload routine is called exactly once, before YYToolkit hands control over to the runner's main()
function.
It is responsible for creation of low-level hooks on functions that only get called early in the runner, and it is thus impossible to hook them later within PluginEntry()
.
It is not advised you use this function unless you absolutely need your plugin to respond to Early Launch being enabled.
DllExport YYTKStatus PluginPreload(
YYTKPlugin* PluginObject // A pointer to the dedicated plugin object
)
{
// Run pre-init hooks on low-level runner code
return YYTK_OK; // Successful PluginPreload.
}
This is an example of a PluginPreload function.
YYTKStatus PluginPreload(
YYTKPlugin* PluginObject
);
The internal object representing a plugin entry.
You may keep a pointer to it, as the object is accessible throughout the lifetime of the plugin.
The function must return YYTK_OK
if initialization succeeds. In other cases, it returns a matching YYTKStatus
to help with troubleshooting.
The PluginPreload
routine must always be exported, or else the function won't be called - any other functions defined in the plugin module (DLL) don't have to be exported, unless specified otherwise.
This function will NOT be called on any versions earlier than v0.1.1!
This function is only called if Early Launch is enabled.
Calling game functions via the CallBuiltin
routine may result in undefined behavior, as the function table might not yet be initialized.
To prevent this, consider moving the misbehaving code to PluginEntry()
.