diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2023-09-24 12:43:27 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2023-09-24 12:43:27 +0200 |
commit | b92f3d1d6ad49881eb31ac911a8ad368743af108 (patch) | |
tree | 60d8ad809d19a5c392349f4dd38e4b818796150b /src/init.cpp | |
parent | 13df46ba41efe2d94e3dbec240ff0889ac054eb7 (diff) | |
download | SouthRPC-b92f3d1d6ad49881eb31ac911a8ad368743af108.tar.gz SouthRPC-b92f3d1d6ad49881eb31ac911a8ad368743af108.zip |
implement RPC
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/src/init.cpp b/src/init.cpp index 165c574..d0005c0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -10,7 +10,7 @@ extern "C" __declspec(dllexport) void PLUGIN_INIT(PluginInitFuncs* funcs, PluginNorthstarData* data) { spdlog::default_logger()->sinks().pop_back(); - spdlog::default_logger()->sinks().push_back(std::make_shared<PluginSink>(funcs->logger)); + spdlog::default_logger()->sinks().push_back(std::make_shared<PluginSink>(funcs->logger, data->pluginHandle)); plugin = new Plugin(funcs, data); } @@ -18,20 +18,22 @@ void PLUGIN_INIT(PluginInitFuncs* funcs, PluginNorthstarData* data) extern "C" __declspec(dllexport) void PLUGIN_DEINIT() { - if (plugin) - { - delete plugin; - plugin = nullptr; - } + assert(plugin); + + delete plugin; + plugin = nullptr; } extern "C" __declspec(dllexport) void PLUGIN_INFORM_DLL_LOAD(PluginLoadDLL dll, void* data) { + assert(plugin); + switch (dll) { case PluginLoadDLL::ENGINE: plugin->LoadEngineData(data); - break; + plugin->StartServer(); case PluginLoadDLL::CLIENT: + break; case PluginLoadDLL::SERVER: break; default: @@ -40,6 +42,34 @@ void PLUGIN_INFORM_DLL_LOAD(PluginLoadDLL dll, void* data) { } } +extern "C" __declspec(dllexport) +void PLUGIN_INIT_SQVM_CLIENT(SquirrelFunctions* funcs) +{ + assert(plugin); + plugin->LoadSQVMFunctions(ScriptContext::CLIENT, funcs); +} + +extern "C" __declspec(dllexport) +void PLUGIN_INIT_SQVM_SERVER(SquirrelFunctions* funcs) +{ + assert(plugin); + plugin->LoadSQVMFunctions(ScriptContext::SERVER, funcs); +} + +extern "C" __declspec(dllexport) +void PLUGIN_INFORM_SQVM_CREATED(ScriptContext context, CSquirrelVM* sqvm) +{ + assert(plugin); + plugin->LoadSQVM(context, sqvm); +} + +extern "C" __declspec(dllexport) +void PLUGIN_INFORM_SQVM_DESTROYED(ScriptContext context) +{ + assert(plugin); + plugin->RemoveSQVM(context); +} + // There is no deinit logic for Plugins // Recreate it using DllMain BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) |