feat: Update PluginApi for Darktide

This commit is contained in:
Lucas Schwiderski 2023-05-25 15:39:43 +02:00
parent 0b4d6eb9fe
commit 51e00b6394
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8

View file

@ -146,47 +146,20 @@ struct RenderDevicePluginArguments {
functions that you do not support.
*/
struct PluginApi {
/* Returns the name of the plugin. */
const char *(*get_name)();
/* Called to initialize the plugin once it has been loaded into memory. For plugins loaded at
boot, this function is called once all plugins have been loaded (so you can query for other
plugins in this function). For plugins loaded on demand, this function is called as soon
as the plugin have been loaded. */
void (*loaded)(GetApiFunction get_engine_api);
/* Called just before the plugin is unloaded. */
void (*unloaded)();
/* Called at the start of a "hot reload" of the plugin DLL. Should return a
pointer to a serialized "state" for the plugin.*/
void *(*start_reload)(GetApiFunction get_engine_api);
/* Called to finalized the "hot reload" after the plugin has been reloaded with
the new code. Should restore the state from the serialized state data. Note
that it is the responsibility of the plugin to free the state data. */
void (*finish_reload)(GetApiFunction get_engine_api, void *state);
/* Called when the engine sets up the DataCompiler. You can use the functions in the DataCompiler
API to add custom data types to the DataCompiler. */
void (*setup_data_compiler)(GetApiFunction get_engine_api);
/* Called when the engine shuts down the data compiler. */
void (*shutdown_data_compiler)();
/* Called when the engine sets up the ResourceManager. At this point you can use the ResourceManagerApi
to add support for resource manager loading of your custom data types. */
void (*setup_resources)(GetApiFunction get_engine_api);
/* Called when the engine shuts down the ResourceManager. */
void (*shutdown_resources)();
/* Called when the engine reloads its resources. The plugin should return true if it is able
to hot-reload resources of the specified type. */
int (*can_refresh)(uint64_t type);
/* Called when the engine reloads its resources, to tell the plugin to refresh the given resource. */
void (*refresh)(uint64_t type, uint64_t name);
#ifdef __cplusplus
uint32_t version = 65;
// Copied from existing plugins' binary
uint32_t flags = 3;
#else
uint32_t version;
uint32_t flags;
#endif
void * fn_0;
void * fn_1;
void * fn_2;
void * fn_3;
void * fn_4;
void * fn_5;
/* Called when the engine sets up the game. At this point, you can use the functions in the LuaApi
to add functions to the engine's Lua API. */
@ -198,29 +171,12 @@ struct PluginApi {
/* Called when the engine shuts down the game. */
void (*shutdown_game)();
/* Called after the world has been created and is about to be added to the engines list of worlds */
void (*register_world)(CApiWorld *world);
void * fn_9;
void * fn_10;
void * fn_11;
/* Called before a world is about to be destroyed and removed from the engines list of worlds. */
void (*unregister_world)(CApiWorld *world);
/* Called when units are spawned by the engine. */
void (*units_spawned)(CApiUnit **units, unsigned count);
/* Called when units are unspawned by the engine. */
void (*units_unspawned)(CApiUnit **units, unsigned count);
/* Called by the engine to draw debug visuals into the world. */
void (*debug_draw)(CApiWorld *world, struct StateReflectionStream *srs);
/* Deprecated. */
void *(*get_render_env)();
/* Deprecated. */
void (*render)(struct RenderDevicePluginArguments *arguments);
/* Reserved for expansion of the API. */
void *reserved[32];
/* Returns the name of the plugin. */
const char *(*get_name)();
};
/*