From d4b26c96e2f3ec9898d59ffe85d06eaf083a8b84 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sun, 14 May 2023 17:55:28 -0400 Subject: [PATCH 01/26] bump version --- NorthstarDLL/plugins/plugin_abi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index c9fa9d25b..4e65c0742 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -2,7 +2,7 @@ #include #include "squirrel/squirrelclasstypes.h" -#define ABI_VERSION 2 +#define ABI_VERSION 3 enum GameState { From eae647670610e9e19227d7cace8719a062f3997b Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sun, 14 May 2023 18:37:10 -0400 Subject: [PATCH 02/26] prototyping RunFrame for plugins --- NorthstarDLL/plugins/plugin_abi.h | 1 + NorthstarDLL/plugins/plugins.cpp | 13 +++++++++++++ NorthstarDLL/plugins/plugins.h | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index 4e65c0742..9b72bd200 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -156,6 +156,7 @@ typedef void (*PLUGIN_INIT_TYPE)(PluginInitFuncs* funcs, PluginNorthstarData* da typedef void (*PLUGIN_INIT_SQVM_TYPE)(SquirrelFunctions* funcs); typedef void (*PLUGIN_INFORM_SQVM_CREATED_TYPE)(ScriptContext context, CSquirrelVM* sqvm); typedef void (*PLUGIN_INFORM_SQVM_DESTROYED_TYPE)(ScriptContext context); +typedef void (*PLUGIN_RUNFRAME)(); // Async Communication types diff --git a/NorthstarDLL/plugins/plugins.cpp b/NorthstarDLL/plugins/plugins.cpp index 001f35785..0d4590b0c 100644 --- a/NorthstarDLL/plugins/plugins.cpp +++ b/NorthstarDLL/plugins/plugins.cpp @@ -177,6 +177,8 @@ std::optional PluginManager::LoadPlugin(fs::path path, PluginInitFuncs* plugin.inform_dll_load = (PLUGIN_INFORM_DLL_LOAD_TYPE)GetProcAddress(pluginLib, "PLUGIN_INFORM_DLL_LOAD"); + plugin.run_frame = (PLUGIN_RUNFRAME)GetProcAddress(pluginLib, "PLUGIN_RUNFRAME"); + plugin.handle = m_vLoadedPlugins.size(); plugin.logger = std::make_shared(plugin.displayName.c_str(), NS::Colors::PLUGIN); RegisterLogger(plugin.logger); @@ -290,3 +292,14 @@ void PluginManager::InformDLLLoad(PluginLoadDLL dll, void* data) } } } + +void PluginManager::RunFrame() +{ + for (auto plugin : m_vLoadedPlugins) + { + if (plugin.run_frame != NULL) + { + plugin.run_frame(); + } + } +} diff --git a/NorthstarDLL/plugins/plugins.h b/NorthstarDLL/plugins/plugins.h index ffa277d08..248c62bbe 100644 --- a/NorthstarDLL/plugins/plugins.h +++ b/NorthstarDLL/plugins/plugins.h @@ -32,6 +32,8 @@ class Plugin PLUGIN_PUSH_PRESENCE_TYPE push_presence; PLUGIN_INFORM_DLL_LOAD_TYPE inform_dll_load; + + PLUGIN_RUNFRAME run_frame; }; class PluginManager @@ -50,6 +52,8 @@ class PluginManager void InformDLLLoad(PluginLoadDLL dll, void* data); + void RunFrame(); + private: std::string pluginPath; }; From 374c9618aa661eb063f9445f2bb199860cf5b2ca Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:31:11 -0400 Subject: [PATCH 03/26] add ptr to dlls to InformDLLLoad --- NorthstarDLL/plugins/plugin_abi.h | 2 +- NorthstarDLL/plugins/pluginbackend.cpp | 6 +++--- NorthstarDLL/plugins/plugins.cpp | 4 ++-- NorthstarDLL/plugins/plugins.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index 9b72bd200..ef0bf9ff7 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -162,4 +162,4 @@ typedef void (*PLUGIN_RUNFRAME)(); // Northstar -> Plugin typedef void (*PLUGIN_PUSH_PRESENCE_TYPE)(PluginGameStatePresence* data); -typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(PluginLoadDLL dll, void* data); +typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(PluginLoadDLL dll, void* data, void* dllPtr); diff --git a/NorthstarDLL/plugins/pluginbackend.cpp b/NorthstarDLL/plugins/pluginbackend.cpp index b442d702d..c861a8680 100644 --- a/NorthstarDLL/plugins/pluginbackend.cpp +++ b/NorthstarDLL/plugins/pluginbackend.cpp @@ -80,15 +80,15 @@ void PluginCommunicationHandler::GeneratePresenceObjects() ON_DLL_LOAD_RELIESON("engine.dll", PluginBackendEngine, ConCommand, (CModule module)) { - g_pPluginManager->InformDLLLoad(PluginLoadDLL::ENGINE, &g_pPluginCommunicationhandler->m_sEngineData); + g_pPluginManager->InformDLLLoad(PluginLoadDLL::ENGINE, &g_pPluginCommunicationhandler->m_sEngineData, reinterpret_cast( module.m_nAddress )); } ON_DLL_LOAD_RELIESON("client.dll", PluginBackendClient, ConCommand, (CModule module)) { - g_pPluginManager->InformDLLLoad(PluginLoadDLL::CLIENT, nullptr); + g_pPluginManager->InformDLLLoad(PluginLoadDLL::CLIENT, nullptr, reinterpret_cast(module.m_nAddress)); } ON_DLL_LOAD_RELIESON("server.dll", PluginBackendServer, ConCommand, (CModule module)) { - g_pPluginManager->InformDLLLoad(PluginLoadDLL::SERVER, nullptr); + g_pPluginManager->InformDLLLoad(PluginLoadDLL::SERVER, nullptr, reinterpret_cast(module.m_nAddress)); } diff --git a/NorthstarDLL/plugins/plugins.cpp b/NorthstarDLL/plugins/plugins.cpp index 0d4590b0c..b04078764 100644 --- a/NorthstarDLL/plugins/plugins.cpp +++ b/NorthstarDLL/plugins/plugins.cpp @@ -282,13 +282,13 @@ void PluginManager::PushPresence(PluginGameStatePresence* data) } } -void PluginManager::InformDLLLoad(PluginLoadDLL dll, void* data) +void PluginManager::InformDLLLoad(PluginLoadDLL dll, void* data, void* dllPtr) { for (auto plugin : m_vLoadedPlugins) { if (plugin.inform_dll_load != NULL) { - plugin.inform_dll_load(dll, data); + plugin.inform_dll_load(dll, data, dllPtr); } } } diff --git a/NorthstarDLL/plugins/plugins.h b/NorthstarDLL/plugins/plugins.h index 248c62bbe..7bc406c8b 100644 --- a/NorthstarDLL/plugins/plugins.h +++ b/NorthstarDLL/plugins/plugins.h @@ -50,7 +50,7 @@ class PluginManager void InformSQVMDestroyed(ScriptContext context); void PushPresence(PluginGameStatePresence* data); - void InformDLLLoad(PluginLoadDLL dll, void* data); + void InformDLLLoad(PluginLoadDLL dll, void* data, void* dllPtr); void RunFrame(); From 2f7a6a5326229c2c05c62a77ce650f66c0e06125 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:51:11 -0400 Subject: [PATCH 04/26] expose g_pCVar to plugins --- NorthstarDLL/core/convar/convar.cpp | 1 + NorthstarDLL/plugins/plugin_abi.h | 1 + 2 files changed, 2 insertions(+) diff --git a/NorthstarDLL/core/convar/convar.cpp b/NorthstarDLL/core/convar/convar.cpp index d4efc1a02..da5c0a98d 100644 --- a/NorthstarDLL/core/convar/convar.cpp +++ b/NorthstarDLL/core/convar/convar.cpp @@ -44,6 +44,7 @@ ON_DLL_LOAD("engine.dll", ConVar, (CModule module)) g_pPluginCommunicationhandler->m_sEngineData.conVarRegister = conVarRegister; g_pPluginCommunicationhandler->m_sEngineData.ConVar_Vtable = g_pConVar_Vtable; g_pPluginCommunicationhandler->m_sEngineData.IConVar_Vtable = g_pIConVar_Vtable; + g_pPluginCommunicationhandler->m_sEngineData.g_pCVar = R2::g_pCVar; } //----------------------------------------------------------------------------- diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index ef0bf9ff7..166c09541 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -114,6 +114,7 @@ struct PluginEngineData void* conVarRegister; void* ConVar_Vtable; void* IConVar_Vtable; + void* g_pCVar; }; struct PluginGameStatePresence From fa8c47f83ee47de0d7cedc336c44aeb77aa1cb39 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Fri, 9 Jun 2023 22:14:00 -0400 Subject: [PATCH 05/26] improve async call for plugins --- NorthstarDLL/squirrel/squirrel.cpp | 8 +++++--- NorthstarDLL/squirrel/squirrelclasstypes.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index 3bb5c1546..f93fb87ee 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -641,9 +641,11 @@ template void SquirrelManager::ProcessMessageBu pushobject(m_pSQVM->sqvm, &functionobj); // Push the function object pushroottable(m_pSQVM->sqvm); - if (message.isExternal) + int argsAmount = message.args.size(); + + if (message.isExternal && message.externalFunc != NULL) { - message.externalFunc(m_pSQVM->sqvm); + argsAmount = message.externalFunc(m_pSQVM->sqvm, message.userdata); } else { @@ -654,7 +656,7 @@ template void SquirrelManager::ProcessMessageBu } } - _call(m_pSQVM->sqvm, message.args.size()); + _call(m_pSQVM->sqvm, argsAmount); } } diff --git a/NorthstarDLL/squirrel/squirrelclasstypes.h b/NorthstarDLL/squirrel/squirrelclasstypes.h index ac8133346..faea853d0 100644 --- a/NorthstarDLL/squirrel/squirrelclasstypes.h +++ b/NorthstarDLL/squirrel/squirrelclasstypes.h @@ -116,7 +116,7 @@ concept is_iterable = requires(std::ranges::range_value_t x) // clang-format on -typedef void (*SquirrelMessage_External_Pop)(HSquirrelVM* sqvm); +typedef int (*SquirrelMessage_External_Pop)(HSquirrelVM* sqvm, void* userdata); typedef void (*sq_schedule_call_externalType)(ScriptContext context, const char* funcname, SquirrelMessage_External_Pop function); class SquirrelMessage @@ -125,6 +125,7 @@ class SquirrelMessage std::string functionName; FunctionVector args; bool isExternal = false; + void* userdata = NULL; SquirrelMessage_External_Pop externalFunc = NULL; }; From fdccb6bb7649cfa4b4c98dca428c769b24d78dfa Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 10 Jun 2023 11:58:18 -0400 Subject: [PATCH 06/26] fmt --- NorthstarDLL/plugins/pluginbackend.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NorthstarDLL/plugins/pluginbackend.cpp b/NorthstarDLL/plugins/pluginbackend.cpp index c861a8680..0d9215d2c 100644 --- a/NorthstarDLL/plugins/pluginbackend.cpp +++ b/NorthstarDLL/plugins/pluginbackend.cpp @@ -80,7 +80,8 @@ void PluginCommunicationHandler::GeneratePresenceObjects() ON_DLL_LOAD_RELIESON("engine.dll", PluginBackendEngine, ConCommand, (CModule module)) { - g_pPluginManager->InformDLLLoad(PluginLoadDLL::ENGINE, &g_pPluginCommunicationhandler->m_sEngineData, reinterpret_cast( module.m_nAddress )); + g_pPluginManager->InformDLLLoad( + PluginLoadDLL::ENGINE, &g_pPluginCommunicationhandler->m_sEngineData, reinterpret_cast(module.m_nAddress)); } ON_DLL_LOAD_RELIESON("client.dll", PluginBackendClient, ConCommand, (CModule module)) From 0c3b4be434d0ff58ca7995b8dd2074616f02d70c Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Mon, 12 Jun 2023 12:56:31 -0400 Subject: [PATCH 07/26] nuke presence for plugins --- NorthstarDLL/plugins/plugin_abi.h | 1 - NorthstarDLL/plugins/pluginbackend.cpp | 35 -------------------------- NorthstarDLL/plugins/pluginbackend.h | 2 -- NorthstarDLL/plugins/plugins.cpp | 13 ---------- NorthstarDLL/plugins/plugins.h | 2 -- 5 files changed, 53 deletions(-) diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index 166c09541..7a74e1a83 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -162,5 +162,4 @@ typedef void (*PLUGIN_RUNFRAME)(); // Async Communication types // Northstar -> Plugin -typedef void (*PLUGIN_PUSH_PRESENCE_TYPE)(PluginGameStatePresence* data); typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(PluginLoadDLL dll, void* data, void* dllPtr); diff --git a/NorthstarDLL/plugins/pluginbackend.cpp b/NorthstarDLL/plugins/pluginbackend.cpp index 0d9215d2c..db12e1276 100644 --- a/NorthstarDLL/plugins/pluginbackend.cpp +++ b/NorthstarDLL/plugins/pluginbackend.cpp @@ -43,41 +43,6 @@ void PluginCommunicationHandler::PushRequest(PluginDataRequestType type, PluginR requestQueue.push(PluginDataRequest {type, func}); } -void PluginCommunicationHandler::GeneratePresenceObjects() -{ - PluginGameStatePresence presence {}; - - presence.id = g_pGameStatePresence->id.c_str(); - presence.name = g_pGameStatePresence->name.c_str(); - presence.description = g_pGameStatePresence->description.c_str(); - presence.password = g_pGameStatePresence->password.c_str(); - - presence.isServer = g_pGameStatePresence->isServer; - presence.isLocal = g_pGameStatePresence->isLocal; - - if (g_pGameStatePresence->isLoading) - presence.state = GameState::LOADING; - else if (g_pGameStatePresence->uiMap == "") - presence.state = GameState::MAINMENU; - else if (g_pGameStatePresence->map == "mp_lobby" && g_pGameStatePresence->isLocal && g_pGameStatePresence->isLobby) - presence.state = GameState::LOBBY; - else - presence.state = GameState::INGAME; - - presence.map = g_pGameStatePresence->map.c_str(); - presence.mapDisplayname = g_pGameStatePresence->mapDisplayname.c_str(); - presence.playlist = g_pGameStatePresence->playlist.c_str(); - presence.playlistDisplayname = g_pGameStatePresence->playlistDisplayname.c_str(); - - presence.currentPlayers = g_pGameStatePresence->currentPlayers; - presence.maxPlayers = g_pGameStatePresence->maxPlayers; - presence.ownScore = g_pGameStatePresence->ownScore; - presence.otherHighestScore = g_pGameStatePresence->otherHighestScore; - presence.maxScore = g_pGameStatePresence->maxScore; - presence.timestampEnd = g_pGameStatePresence->timestampEnd; - g_pPluginManager->PushPresence(&presence); -} - ON_DLL_LOAD_RELIESON("engine.dll", PluginBackendEngine, ConCommand, (CModule module)) { g_pPluginManager->InformDLLLoad( diff --git a/NorthstarDLL/plugins/pluginbackend.h b/NorthstarDLL/plugins/pluginbackend.h index ef42c5089..ef926680c 100644 --- a/NorthstarDLL/plugins/pluginbackend.h +++ b/NorthstarDLL/plugins/pluginbackend.h @@ -31,8 +31,6 @@ class PluginCommunicationHandler void RunFrame(); void PushRequest(PluginDataRequestType type, PluginRespondDataCallable func); - void GeneratePresenceObjects(); - public: std::queue requestQueue; std::mutex requestMutex; diff --git a/NorthstarDLL/plugins/plugins.cpp b/NorthstarDLL/plugins/plugins.cpp index b04078764..cba6bbbce 100644 --- a/NorthstarDLL/plugins/plugins.cpp +++ b/NorthstarDLL/plugins/plugins.cpp @@ -173,8 +173,6 @@ std::optional PluginManager::LoadPlugin(fs::path path, PluginInitFuncs* plugin.inform_sqvm_created = (PLUGIN_INFORM_SQVM_CREATED_TYPE)GetProcAddress(pluginLib, "PLUGIN_INFORM_SQVM_CREATED"); plugin.inform_sqvm_destroyed = (PLUGIN_INFORM_SQVM_DESTROYED_TYPE)GetProcAddress(pluginLib, "PLUGIN_INFORM_SQVM_DESTROYED"); - plugin.push_presence = (PLUGIN_PUSH_PRESENCE_TYPE)GetProcAddress(pluginLib, "PLUGIN_RECEIVE_PRESENCE"); - plugin.inform_dll_load = (PLUGIN_INFORM_DLL_LOAD_TYPE)GetProcAddress(pluginLib, "PLUGIN_INFORM_DLL_LOAD"); plugin.run_frame = (PLUGIN_RUNFRAME)GetProcAddress(pluginLib, "PLUGIN_RUNFRAME"); @@ -271,17 +269,6 @@ void PluginManager::InformSQVMDestroyed(ScriptContext context) } } -void PluginManager::PushPresence(PluginGameStatePresence* data) -{ - for (auto plugin : m_vLoadedPlugins) - { - if (plugin.push_presence != NULL) - { - plugin.push_presence(data); - } - } -} - void PluginManager::InformDLLLoad(PluginLoadDLL dll, void* data, void* dllPtr) { for (auto plugin : m_vLoadedPlugins) diff --git a/NorthstarDLL/plugins/plugins.h b/NorthstarDLL/plugins/plugins.h index 7bc406c8b..d7901f72f 100644 --- a/NorthstarDLL/plugins/plugins.h +++ b/NorthstarDLL/plugins/plugins.h @@ -30,7 +30,6 @@ class Plugin PLUGIN_INFORM_SQVM_CREATED_TYPE inform_sqvm_created; PLUGIN_INFORM_SQVM_DESTROYED_TYPE inform_sqvm_destroyed; - PLUGIN_PUSH_PRESENCE_TYPE push_presence; PLUGIN_INFORM_DLL_LOAD_TYPE inform_dll_load; PLUGIN_RUNFRAME run_frame; @@ -48,7 +47,6 @@ class PluginManager void InformSQVMLoad(ScriptContext context, SquirrelFunctions* s); void InformSQVMCreated(ScriptContext context, CSquirrelVM* sqvm); void InformSQVMDestroyed(ScriptContext context); - void PushPresence(PluginGameStatePresence* data); void InformDLLLoad(PluginLoadDLL dll, void* data, void* dllPtr); From 447e18e35b428a44a607ed6dba1fa3fcdfe6230d Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Wed, 14 Jun 2023 00:49:23 -0400 Subject: [PATCH 08/26] update sq functions and async call --- NorthstarDLL/plugins/plugin_abi.h | 13 +++++++++---- NorthstarDLL/squirrel/squirrel.cpp | 3 ++- NorthstarDLL/squirrel/squirrel.h | 2 +- NorthstarDLL/squirrel/squirrelclasstypes.h | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index 7a74e1a83..c8389ee52 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -33,6 +33,7 @@ struct SquirrelFunctions sq_compilebufferType __sq_compilebuffer; sq_callType __sq_call; sq_raiseerrorType __sq_raiseerror; + sq_compilefileType __sq_compilefile; sq_newarrayType __sq_newarray; sq_arrayappendType __sq_arrayappend; @@ -48,10 +49,6 @@ struct SquirrelFunctions sq_pushassetType __sq_pushasset; sq_pushvectorType __sq_pushvector; sq_pushobjectType __sq_pushobject; - sq_getthisentityType __sq_getthisentity; - sq_getobjectType __sq_getobject; - - sq_stackinfosType __sq_stackinfos; sq_getstringType __sq_getstring; sq_getintegerType __sq_getinteger; @@ -61,14 +58,22 @@ struct SquirrelFunctions sq_getassetType __sq_getasset; sq_getuserdataType __sq_getuserdata; sq_getvectorType __sq_getvector; + sq_getthisentityType __sq_getthisentity; + sq_getobjectType __sq_getobject; + + sq_stackinfosType __sq_stackinfos; sq_createuserdataType __sq_createuserdata; sq_setuserdatatypeidType __sq_setuserdatatypeid; sq_getfunctionType __sq_getfunction; sq_schedule_call_externalType __sq_schedule_call_external; + sq_getentityfrominstanceType __sq_getentityfrominstance; sq_GetEntityConstantType __sq_GetEntityConstant_CBaseEntity; + + sq_pushnewstructinstanceType __sq_pushnewstructinstance; + sq_sealstructslotType __sq_sealstructslot; }; struct MessageSource diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index f93fb87ee..b06f15955 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -202,12 +202,13 @@ template void SquirrelManager::GenerateSquirrel // Allows for generating squirrelmessages from plugins. // Not used in this version, but will be used later -void AsyncCall_External(ScriptContext context, const char* func_name, SquirrelMessage_External_Pop function) +void AsyncCall_External(ScriptContext context, const char* func_name, SquirrelMessage_External_Pop function, void* userdata) { SquirrelMessage message {}; message.functionName = func_name; message.isExternal = true; message.externalFunc = function; + message.userdata = userdata; switch (context) { case ScriptContext::CLIENT: diff --git a/NorthstarDLL/squirrel/squirrel.h b/NorthstarDLL/squirrel/squirrel.h index 3d18d6c1d..901866625 100644 --- a/NorthstarDLL/squirrel/squirrel.h +++ b/NorthstarDLL/squirrel/squirrel.h @@ -38,7 +38,7 @@ const char* GetContextName_Short(ScriptContext context); eSQReturnType SQReturnTypeFromString(const char* pReturnType); const char* SQTypeNameFromID(const int iTypeId); -void AsyncCall_External(ScriptContext context, const char* func_name, SquirrelMessage_External_Pop function); +void AsyncCall_External(ScriptContext context, const char* func_name, SquirrelMessage_External_Pop function, void* userdata); ScriptContext ScriptContextFromString(std::string string); diff --git a/NorthstarDLL/squirrel/squirrelclasstypes.h b/NorthstarDLL/squirrel/squirrelclasstypes.h index faea853d0..c193f2fc5 100644 --- a/NorthstarDLL/squirrel/squirrelclasstypes.h +++ b/NorthstarDLL/squirrel/squirrelclasstypes.h @@ -117,7 +117,8 @@ concept is_iterable = requires(std::ranges::range_value_t x) // clang-format on typedef int (*SquirrelMessage_External_Pop)(HSquirrelVM* sqvm, void* userdata); -typedef void (*sq_schedule_call_externalType)(ScriptContext context, const char* funcname, SquirrelMessage_External_Pop function); +typedef void (*sq_schedule_call_externalType)( + ScriptContext context, const char* funcname, SquirrelMessage_External_Pop function, void* userdata); class SquirrelMessage { From 63fd065aa7c60ca3eaa8d2091cca5148efe40b6d Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Thu, 15 Jun 2023 14:46:19 -0400 Subject: [PATCH 09/26] completely nuke presence for plugins --- NorthstarDLL/NorthstarDLL.vcxproj | 2 - NorthstarDLL/NorthstarDLL.vcxproj.filters | 6 -- NorthstarDLL/dllmain.cpp | 2 - NorthstarDLL/engine/hoststate.cpp | 2 - NorthstarDLL/plugins/pluginbackend.h | 1 - NorthstarDLL/shared/gamepresence.cpp | 81 ----------------------- NorthstarDLL/shared/gamepresence.h | 48 -------------- NorthstarDLL/squirrel/squirrel.cpp | 1 - 8 files changed, 143 deletions(-) delete mode 100644 NorthstarDLL/shared/gamepresence.cpp delete mode 100644 NorthstarDLL/shared/gamepresence.h diff --git a/NorthstarDLL/NorthstarDLL.vcxproj b/NorthstarDLL/NorthstarDLL.vcxproj index 464c0b589..8c6064ef2 100644 --- a/NorthstarDLL/NorthstarDLL.vcxproj +++ b/NorthstarDLL/NorthstarDLL.vcxproj @@ -439,7 +439,6 @@ - @@ -535,7 +534,6 @@ - diff --git a/NorthstarDLL/NorthstarDLL.vcxproj.filters b/NorthstarDLL/NorthstarDLL.vcxproj.filters index 7c6de46ed..9f36be9eb 100644 --- a/NorthstarDLL/NorthstarDLL.vcxproj.filters +++ b/NorthstarDLL/NorthstarDLL.vcxproj.filters @@ -1158,9 +1158,6 @@ Header Files\plugins - - Header Files\shared - Header Files\util @@ -1426,9 +1423,6 @@ Source Files\plugins - - Source Files\shared - Source Files\util diff --git a/NorthstarDLL/dllmain.cpp b/NorthstarDLL/dllmain.cpp index 6fc49be86..c7cabece2 100644 --- a/NorthstarDLL/dllmain.cpp +++ b/NorthstarDLL/dllmain.cpp @@ -7,7 +7,6 @@ #include "plugins/plugins.h" #include "util/version.h" #include "squirrel/squirrel.h" -#include "shared/gamepresence.h" #include "server/serverpresence.h" #include "rapidjson/document.h" @@ -60,7 +59,6 @@ bool InitialiseNorthstar() g_pServerPresence = new ServerPresenceManager(); - g_pGameStatePresence = new GameStatePresence(); g_pPluginManager = new PluginManager(); g_pPluginManager->LoadPlugins(); diff --git a/NorthstarDLL/engine/hoststate.cpp b/NorthstarDLL/engine/hoststate.cpp index 50862e990..addcf54ee 100644 --- a/NorthstarDLL/engine/hoststate.cpp +++ b/NorthstarDLL/engine/hoststate.cpp @@ -186,8 +186,6 @@ void, __fastcall, (CHostState* self, double flCurrentTime, float flFrameTime)) if (g_pSquirrel->m_pSQVM != nullptr && g_pSquirrel->m_pSQVM->sqvm != nullptr) g_pSquirrel->ProcessMessageBuffer(); - - g_pGameStatePresence->RunFrame(); } ON_DLL_LOAD_RELIESON("engine.dll", HostState, ConVar, (CModule module)) diff --git a/NorthstarDLL/plugins/pluginbackend.h b/NorthstarDLL/plugins/pluginbackend.h index ef926680c..c0cf42b05 100644 --- a/NorthstarDLL/plugins/pluginbackend.h +++ b/NorthstarDLL/plugins/pluginbackend.h @@ -1,7 +1,6 @@ #pragma once #include "pch.h" #include "plugin_abi.h" -#include "shared/gamepresence.h" #include #include diff --git a/NorthstarDLL/shared/gamepresence.cpp b/NorthstarDLL/shared/gamepresence.cpp deleted file mode 100644 index 86a875267..000000000 --- a/NorthstarDLL/shared/gamepresence.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "pch.h" - -#include "gamepresence.h" -#include "plugins/pluginbackend.h" -#include "plugins/plugins.h" -#include "dedicated/dedicated.h" -#include "server/serverpresence.h" -#include "masterserver/masterserver.h" -#include "squirrel/squirrel.h" - -GameStatePresence* g_pGameStatePresence; - -GameStatePresence::GameStatePresence() -{ - g_pServerPresence->AddPresenceReporter(&m_GameStateServerPresenceReporter); -} - -void GameStateServerPresenceReporter::RunFrame(double flCurrentTime, const ServerPresence* pServerPresence) -{ - g_pGameStatePresence->id = pServerPresence->m_sServerId; - g_pGameStatePresence->name = pServerPresence->m_sServerName; - g_pGameStatePresence->description = pServerPresence->m_sServerDesc; - g_pGameStatePresence->password = pServerPresence->m_Password; - - g_pGameStatePresence->map = pServerPresence->m_MapName; - g_pGameStatePresence->playlist = pServerPresence->m_PlaylistName; - g_pGameStatePresence->currentPlayers = pServerPresence->m_iPlayerCount; - g_pGameStatePresence->maxPlayers = pServerPresence->m_iMaxPlayers; - - g_pGameStatePresence->isLocal = !IsDedicatedServer(); -} - -void GameStatePresence::RunFrame() -{ - if (g_pSquirrel->m_pSQVM != nullptr && g_pSquirrel->m_pSQVM->sqvm != nullptr) - g_pSquirrel->Call("NorthstarCodeCallback_GenerateUIPresence"); - - if (g_pSquirrel->m_pSQVM != nullptr && g_pSquirrel->m_pSQVM->sqvm != nullptr) - { - auto test = g_pSquirrel->Call("NorthstarCodeCallback_GenerateGameState"); - } - g_pPluginCommunicationhandler->GeneratePresenceObjects(); -} - -ADD_SQFUNC("void", NSPushGameStateData, "GameStateStruct gamestate", "", ScriptContext::CLIENT) -{ - SQStructInstance* structInst = g_pSquirrel->m_pSQVM->sqvm->_stackOfCurrentFunction[1]._VAL.asStructInstance; - g_pGameStatePresence->map = structInst->data[0]._VAL.asString->_val; - g_pGameStatePresence->mapDisplayname = structInst->data[1]._VAL.asString->_val; - g_pGameStatePresence->playlist = structInst->data[2]._VAL.asString->_val; - g_pGameStatePresence->playlistDisplayname = structInst->data[3]._VAL.asString->_val; - - g_pGameStatePresence->currentPlayers = structInst->data[4]._VAL.asInteger; - g_pGameStatePresence->maxPlayers = structInst->data[5]._VAL.asInteger; - g_pGameStatePresence->ownScore = structInst->data[6]._VAL.asInteger; - g_pGameStatePresence->otherHighestScore = structInst->data[7]._VAL.asInteger; - g_pGameStatePresence->maxScore = structInst->data[8]._VAL.asInteger; - g_pGameStatePresence->timestampEnd = ceil(structInst->data[9]._VAL.asFloat); - - if (g_pMasterServerManager->m_currentServer) - { - g_pGameStatePresence->id = g_pMasterServerManager->m_currentServer->id; - g_pGameStatePresence->name = g_pMasterServerManager->m_currentServer->name; - g_pGameStatePresence->description = g_pMasterServerManager->m_currentServer->description; - g_pGameStatePresence->password = g_pMasterServerManager->m_sCurrentServerPassword; - } - - return SQRESULT_NOTNULL; -} - -ADD_SQFUNC("void", NSPushUIPresence, "UIPresenceStruct presence", "", ScriptContext::UI) -{ - SQStructInstance* structInst = g_pSquirrel->m_pSQVM->sqvm->_stackOfCurrentFunction[1]._VAL.asStructInstance; - - g_pGameStatePresence->isLoading = structInst->data[0]._VAL.asInteger; - g_pGameStatePresence->isLobby = structInst->data[1]._VAL.asInteger; - g_pGameStatePresence->loadingLevel = structInst->data[2]._VAL.asString->_val; - g_pGameStatePresence->uiMap = structInst->data[3]._VAL.asString->_val; - - return SQRESULT_NOTNULL; -} diff --git a/NorthstarDLL/shared/gamepresence.h b/NorthstarDLL/shared/gamepresence.h deleted file mode 100644 index 167f83aba..000000000 --- a/NorthstarDLL/shared/gamepresence.h +++ /dev/null @@ -1,48 +0,0 @@ - -#pragma once -#include "pch.h" -#include "server/serverpresence.h" - -class GameStateServerPresenceReporter : public ServerPresenceReporter -{ - void RunFrame(double flCurrentTime, const ServerPresence* pServerPresence); -}; - -class GameStatePresence -{ - public: - std::string id; - std::string name; - std::string description; - std::string password; // NOTE: May be empty - - bool isServer; - bool isLocal = false; - bool isLoading; - bool isLobby; - std::string loadingLevel; - - std::string uiMap; - - std::string map; - std::string mapDisplayname; - std::string playlist; - std::string playlistDisplayname; - - int currentPlayers; - int maxPlayers; - - int ownScore; - int otherHighestScore; // NOTE: The highest score OR the second highest score if we have the highest - int maxScore; - - int timestampEnd; - - GameStatePresence(); - void RunFrame(); - - protected: - GameStateServerPresenceReporter m_GameStateServerPresenceReporter; -}; - -extern GameStatePresence* g_pGameStatePresence; diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index b06f15955..d5c18423a 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -201,7 +201,6 @@ template void SquirrelManager::GenerateSquirrel } // Allows for generating squirrelmessages from plugins. -// Not used in this version, but will be used later void AsyncCall_External(ScriptContext context, const char* func_name, SquirrelMessage_External_Pop function, void* userdata) { SquirrelMessage message {}; From 668466bfa8845b04883d9ff5e1c09f88265a0471 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Thu, 15 Jun 2023 18:09:14 -0400 Subject: [PATCH 10/26] small changes to header files --- NorthstarDLL/plugins/plugin_abi.h | 39 ++----------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index c8389ee52..9f031c697 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -4,14 +4,6 @@ #define ABI_VERSION 3 -enum GameState -{ - LOADING = 0, - MAINMENU = 1, - LOBBY = 2, - INGAME = 3 -}; - enum PluginLoadDLL { ENGINE = 0, @@ -122,32 +114,6 @@ struct PluginEngineData void* g_pCVar; }; -struct PluginGameStatePresence -{ - const char* id; - const char* name; - const char* description; - const char* password; - - bool isServer; - bool isLocal; - GameState state; - - const char* map; - const char* mapDisplayname; - const char* playlist; - const char* playlistDisplayname; - - int currentPlayers; - int maxPlayers; - - int ownScore; - int otherHighestScore; // NOTE: The highest score OR the second highest score if we have the highest - int maxScore; - - int timestampEnd; -}; - /// Async communication within the plugin system /// Due to the asynchronous nature of plugins, combined with the limitations of multi-compiler support /// and the custom memory allocator used by r2, is it difficult to safely get data across DLL boundaries @@ -162,9 +128,8 @@ typedef void (*PLUGIN_INIT_TYPE)(PluginInitFuncs* funcs, PluginNorthstarData* da typedef void (*PLUGIN_INIT_SQVM_TYPE)(SquirrelFunctions* funcs); typedef void (*PLUGIN_INFORM_SQVM_CREATED_TYPE)(ScriptContext context, CSquirrelVM* sqvm); typedef void (*PLUGIN_INFORM_SQVM_DESTROYED_TYPE)(ScriptContext context); + +typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(PluginLoadDLL dll, void* data, void* dllPtr); typedef void (*PLUGIN_RUNFRAME)(); // Async Communication types - -// Northstar -> Plugin -typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(PluginLoadDLL dll, void* data, void* dllPtr); From 2054898111527f889bd3e65ee99f1b1ecdc6c3af Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Thu, 15 Jun 2023 18:14:06 -0400 Subject: [PATCH 11/26] fix abi error not logging itself --- NorthstarDLL/plugins/plugins.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NorthstarDLL/plugins/plugins.cpp b/NorthstarDLL/plugins/plugins.cpp index cba6bbbce..4002583d7 100644 --- a/NorthstarDLL/plugins/plugins.cpp +++ b/NorthstarDLL/plugins/plugins.cpp @@ -128,7 +128,7 @@ std::optional PluginManager::LoadPlugin(fs::path path, PluginInitFuncs* if (strcmp(manifestJSON["api_version"].GetString(), std::to_string(ABI_VERSION).c_str())) { NS::log::PLUGINSYS->error( - "'{}' has an incompatible API version number '{}' in its manifest. Current ABI version is '{}'", pathstring, ABI_VERSION); + "'{}' has an incompatible API version number in its manifest. Current ABI version is '{}'", pathstring, ABI_VERSION); return std::nullopt; } // Passed all checks, going to actually load it now From d0e0c636b987f96619b0af7c23c211937bc7be75 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Thu, 15 Jun 2023 18:21:43 -0400 Subject: [PATCH 12/26] actually push all the sq functions --- NorthstarDLL/squirrel/squirrel.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index d5c18423a..b37f6fbd1 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -162,6 +162,7 @@ template void SquirrelManager::GenerateSquirrel s->__sq_compilebuffer = __sq_compilebuffer; s->__sq_call = __sq_call; s->__sq_raiseerror = __sq_raiseerror; + s->__sq_compilefile = __sq_compilefile; s->__sq_newarray = __sq_newarray; s->__sq_arrayappend = __sq_arrayappend; @@ -177,12 +178,8 @@ template void SquirrelManager::GenerateSquirrel s->__sq_pushasset = __sq_pushasset; s->__sq_pushvector = __sq_pushvector; s->__sq_pushobject = __sq_pushobject; - s->__sq_getstring = __sq_getstring; - s->__sq_getthisentity = __sq_getthisentity; - s->__sq_getobject = __sq_getobject; - - s->__sq_stackinfos = __sq_stackinfos; + s->__sq_getstring = __sq_getstring; s->__sq_getinteger = __sq_getinteger; s->__sq_getfloat = __sq_getfloat; s->__sq_getbool = __sq_getbool; @@ -190,14 +187,22 @@ template void SquirrelManager::GenerateSquirrel s->__sq_getasset = __sq_getasset; s->__sq_getuserdata = __sq_getuserdata; s->__sq_getvector = __sq_getvector; + s->__sq_getthisentity = __sq_getthisentity; + s->__sq_getobject = __sq_getobject; + + s->__sq_stackinfos = __sq_stackinfos; + s->__sq_createuserdata = __sq_createuserdata; s->__sq_setuserdatatypeid = __sq_setuserdatatypeid; s->__sq_getfunction = __sq_getfunction; + s->__sq_schedule_call_external = AsyncCall_External; + s->__sq_getentityfrominstance = __sq_getentityfrominstance; s->__sq_GetEntityConstant_CBaseEntity = __sq_GetEntityConstant_CBaseEntity; - s->__sq_schedule_call_external = AsyncCall_External; + s->sq_pushnewstructinstanceType = __sq_pushnewstructinstance; + s->sq_sealstructslotType = __sq_sealstructslot; } // Allows for generating squirrelmessages from plugins. From ca12e105bef1a64217da5b12cb9ad2749f586ffe Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Thu, 15 Jun 2023 18:25:30 -0400 Subject: [PATCH 13/26] oops --- NorthstarDLL/squirrel/squirrel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index b37f6fbd1..00ec8dad1 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -201,8 +201,8 @@ template void SquirrelManager::GenerateSquirrel s->__sq_getentityfrominstance = __sq_getentityfrominstance; s->__sq_GetEntityConstant_CBaseEntity = __sq_GetEntityConstant_CBaseEntity; - s->sq_pushnewstructinstanceType = __sq_pushnewstructinstance; - s->sq_sealstructslotType = __sq_sealstructslot; + s->__sq_pushnewstructinstance = __sq_pushnewstructinstance; + s->__sq_sealstructslot = __sq_sealstructslot; } // Allows for generating squirrelmessages from plugins. From b694846ea9b0a4e6dfe4f68ec172f79b452d043d Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Thu, 15 Jun 2023 22:13:51 -0400 Subject: [PATCH 14/26] actually call RunFrame --- NorthstarDLL/engine/hoststate.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NorthstarDLL/engine/hoststate.cpp b/NorthstarDLL/engine/hoststate.cpp index addcf54ee..4e52abc6c 100644 --- a/NorthstarDLL/engine/hoststate.cpp +++ b/NorthstarDLL/engine/hoststate.cpp @@ -186,6 +186,8 @@ void, __fastcall, (CHostState* self, double flCurrentTime, float flFrameTime)) if (g_pSquirrel->m_pSQVM != nullptr && g_pSquirrel->m_pSQVM->sqvm != nullptr) g_pSquirrel->ProcessMessageBuffer(); + + g_pPluginManager->RunFrame(); } ON_DLL_LOAD_RELIESON("engine.dll", HostState, ConVar, (CModule module)) From d92fc1e73d7655ed452e54e8186f927a820bee32 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 24 Jun 2023 20:51:11 -0400 Subject: [PATCH 15/26] fix compile err --- NorthstarDLL/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/NorthstarDLL/CMakeLists.txt b/NorthstarDLL/CMakeLists.txt index f9d61a2c4..55a151948 100644 --- a/NorthstarDLL/CMakeLists.txt +++ b/NorthstarDLL/CMakeLists.txt @@ -113,8 +113,6 @@ add_library(NorthstarDLL SHARED "shared/exploit_fixes/exploitfixes_utf8parser.cpp" "shared/exploit_fixes/ns_limits.cpp" "shared/exploit_fixes/ns_limits.h" - "shared/gamepresence.cpp" - "shared/gamepresence.h" "shared/keyvalues.cpp" "shared/keyvalues.h" "shared/maxplayers.cpp" From 1d73e33fa579079e93bfd6347c2e59fb47a3bc6e Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Tue, 25 Jul 2023 18:51:47 -0400 Subject: [PATCH 16/26] remove useless string include in plugin_abi.h --- HOSTSTATE.ipch | Bin 0 -> 41940 bytes NorthstarDLL/plugins/plugin_abi.h | 1 - PLUGINS.ipch | Bin 0 -> 43576 bytes 3 files changed, 1 deletion(-) create mode 100644 HOSTSTATE.ipch create mode 100644 PLUGINS.ipch diff --git a/HOSTSTATE.ipch b/HOSTSTATE.ipch new file mode 100644 index 0000000000000000000000000000000000000000..4af29b6a368704b7c3a727e9776becdfbc785146 GIT binary patch literal 41940 zcmeHQ>2BP}5w?;0&d&rv5dGZ6A{t3nvgwv^r+uHr``w!?k#LxIM<08fV#=h?^jRQBm&Z5|u<(}`D zVQSb`7A0Yn8OKqQU8R|o99em2U%5&9$-&W)VLUjgfK4Z7Q)B;V^1?WnOuslkIW<1N zI6OKqkEh0X|NP|a_~hI;J~=yoHa*`zJKDcE9zUC$wVx2M$??;}-^R|EWW{C$5ec%kj*j$1=*$NZ-f>}e8RCRVWV#Pi+Mc<$Lrlt%Mx<4Z5iEq`O0 z<&GB_BpqWM1wkHq*{$*A*f@_OANNo3c6)d8(WA{r+j~2o8h4_zM9^88AI$B$v7QdY zx}PsS-?I`>JiQyq{t6@;A1puF`_TBx3!P|@ZhYZosjP(p z+)grpD6dBBzr)`UyCR==f*RByTbYjs!c4EM#C7^`D;2%>SQlQniUpH_!?ol14#>a# zFCiaK&Y!%P9(-Z!Zhq1TFIPGHOTc>gQ@ohZr(<*S;(T&EJv=#{;*;_sk$#LH`rTag z$7lHIefSC8@-6&qfBNVVy)Q1h?FoJ!egiMtd&Ot;LZ24{_%YrT1Nd@s_PF=2#VtRp zZ+UWYbY#}|6?Thn%Bz9*Bm7;!E4<_5t@?%*V|jzg<_jdcx>+c@zDBm67uO7>Yu-=C)S0)Ef&GE_e)5D|5nF6f1<>&awyqHeRgUR@4 zdO8_T%_k>k=5+t)@pk|2Vps>0&o7?#zxx$FYG#gu$-yD!lgYvPWO@#*IK`BrszibP zdxRYRJ-s-l0n}d?LLh#w7RK9n_f7nl`TSggR4|Av!CXmVsqyBM zQ}gs}GCrKDbkbkFVf?XyU%jC_$kF!h{Ku+0NlhPq8!xeawRzRtLH~SBU;Pj-%e`Gh zDYN_%AxC}D4Rre*|ND3P%EC+6-4CCRtNGFQW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-Vkc_6kj>gI2*BB#nu z>(Q_tq7GFe#*gKjdFA?u=$MqW1_h;*Fy|E6D6^w+A`@J7>dL(I(X2r^H>efe3d%Yn z)0&!~MxTg%nVdv|-lBC2)$He~i6R#4sq?jqRxejtSchjCGoj=~k$oRkzZvJWM%Set zP^Dy7y9ErXLDON|Fp87}a{4;=lEn2#^&7^xDtmcPkN0*oXgPzDkB+E(UO`uF$zVUDEb(DjhGlFNEU}-% zSEQrzcW38Jqff#y!*qlfY?h%-I-hkl5>v2@3TUhZX=eJxm^LhqP?%QWNuxZmQPznl ziHaT>Cf!O4;US&4!$oH%G*I$K z)!(Dy4|-t~=m}Zx#H1cdA10c&l2w-1Gr|VvE{dMyDZ0z;FsPNlm38pDzQ6*N<{ zG~jWzp2%^fnFcwUaWOdv64miNg6;rLPHns<=;zAXZC)R8jxY<`9`~FU`cvu^W(N*` fSYD #include "squirrel/squirrelclasstypes.h" #define ABI_VERSION 3 diff --git a/PLUGINS.ipch b/PLUGINS.ipch new file mode 100644 index 0000000000000000000000000000000000000000..142bcc1141ad0ddb1f48a292e434bb97bda04304 GIT binary patch literal 43576 zcmeHQTW{Og5l+ziy^k%5qJHdRQOkB*ce7|vcx5GV*Rfs8-c4J!3`J5lW8T7xCGSt@ zujxzwP#;>LzoOspra7b>H0Bv@11tf{vP93EnKNf@XU=eP@N8o|8h`lV#*Le#UKDQZ zZ9dxgY-1-*=bBfty}uQEbd| z&v(o)HEb)3k}%4Q<0#3l(#%SZtUR=@++_91!O@XnJUFd@O($nlWB+LK(m0q*KRrJ= zH9omGJUTFsr^a~y{N(KTNe&+P^p+KcAefJ|SSIM;FfyasPvdfcZ20 zJbbQiq<~aj4e(F!_x;)6g|?qNZVh!c=0BBSPm|~}v4V}Kp6{l{3(roXG@54{pLuC+ z`5V(Lcf81;=`qGp5agkk-5Q^bjq@n-asL!=w|6%mJ=%PRnuP&~aG$^IJBHh#JMXzv5#b1!tFMY{2+m!-z`mT_3l2HtLNZEio_ z+TGsVG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BhOFwQUPaVWoCWBEQb)ULa&CDZMhOm! zxDK9PxzeGpL~$;!taP}{f246IU=dU3^W;-P!E zZ7!k&jjfo{q&g8flZ|YsgNH#yp?PB^9_3@31v=;iRvXEpOl{4hR_`1Bz1r+qPs8+< zdkicnd*mhddKzo4N7Le$R@GFmF(qi!(~Go4Oq90hsC30?5?v-%uM#_l+CsDP3|R$>yPR;Y?i9cmV27Sx1&K@#2GYh-abF0g5eYu`R`R-Q#Ogt$yj`njD7x@x-`d%b00C&SV&Gpb;T{TzxZ z9hJXZB@7xBAWpKUBfOw$0Z-x}w`}`K*`HM-F$K%0Y|=`wQANKP)A~7@3eyTaX_O~6 zP7c6lr@DHENw*Nx6sh!7t4N22Xz`7*@o34)D60Ay+!I$FuD$TW=TXGNzGPiHjp$f7W z?zOlpxJ=PCher^4+|;$pG|18Kk Date: Wed, 2 Aug 2023 15:27:58 -0400 Subject: [PATCH 17/26] remove PLUGINS.ipch --- PLUGINS.ipch | Bin 43576 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 PLUGINS.ipch diff --git a/PLUGINS.ipch b/PLUGINS.ipch deleted file mode 100644 index 142bcc1141ad0ddb1f48a292e434bb97bda04304..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 43576 zcmeHQTW{Og5l+ziy^k%5qJHdRQOkB*ce7|vcx5GV*Rfs8-c4J!3`J5lW8T7xCGSt@ zujxzwP#;>LzoOspra7b>H0Bv@11tf{vP93EnKNf@XU=eP@N8o|8h`lV#*Le#UKDQZ zZ9dxgY-1-*=bBfty}uQEbd| z&v(o)HEb)3k}%4Q<0#3l(#%SZtUR=@++_91!O@XnJUFd@O($nlWB+LK(m0q*KRrJ= zH9omGJUTFsr^a~y{N(KTNe&+P^p+KcAefJ|SSIM;FfyasPvdfcZ20 zJbbQiq<~aj4e(F!_x;)6g|?qNZVh!c=0BBSPm|~}v4V}Kp6{l{3(roXG@54{pLuC+ z`5V(Lcf81;=`qGp5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2KlA`|9%%W?T2rMsIvjTq$b&TeX$9nI|?(QsC zn`LD}r6yGP`8pnsB8A>+FG;prtA1gu!&pnIa{r=u`O!mqH@jF3TBhOFwQUPaVWoCWBEQb)ULa&CDZMhOm! zxDK9PxzeGpL~$;!taP}{f246IU=dU3^W;-P!E zZ7!k&jjfo{q&g8flZ|YsgNH#yp?PB^9_3@31v=;iRvXEpOl{4hR_`1Bz1r+qPs8+< zdkicnd*mhddKzo4N7Le$R@GFmF(qi!(~Go4Oq90hsC30?5?v-%uM#_l+CsDP3|R$>yPR;Y?i9cmV27Sx1&K@#2GYh-abF0g5eYu`R`R-Q#Ogt$yj`njD7x@x-`d%b00C&SV&Gpb;T{TzxZ z9hJXZB@7xBAWpKUBfOw$0Z-x}w`}`K*`HM-F$K%0Y|=`wQANKP)A~7@3eyTaX_O~6 zP7c6lr@DHENw*Nx6sh!7t4N22Xz`7*@o34)D60Ay+!I$FuD$TW=TXGNzGPiHjp$f7W z?zOlpxJ=PCher^4+|;$pG|18Kk Date: Thu, 3 Aug 2023 18:44:21 -0400 Subject: [PATCH 18/26] inform plugins of all loaded dlls --- NorthstarDLL/core/hooks.cpp | 5 +++++ NorthstarDLL/plugins/plugin_abi.h | 2 +- NorthstarDLL/plugins/pluginbackend.cpp | 19 ++++++++----------- NorthstarDLL/plugins/pluginbackend.h | 2 ++ NorthstarDLL/plugins/plugins.cpp | 2 +- NorthstarDLL/plugins/plugins.h | 2 +- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/NorthstarDLL/core/hooks.cpp b/NorthstarDLL/core/hooks.cpp index 4363c0e22..9ac93c02f 100644 --- a/NorthstarDLL/core/hooks.cpp +++ b/NorthstarDLL/core/hooks.cpp @@ -1,4 +1,5 @@ #include "dedicated/dedicated.h" +#include "plugins/pluginbackend.h" #include #include @@ -9,6 +10,7 @@ #include #include + AUTOHOOK_INIT() // called from the ON_DLL_LOAD macros @@ -409,7 +411,10 @@ HMODULE, WINAPI, (LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)) moduleAddress = _LoadLibraryExA(lpLibFileName, hFile, dwFlags); if (moduleAddress) + { CallLoadLibraryACallbacks(lpLibFileName, moduleAddress); + InformPluginsDLLLoad(lpLibFileName, moduleAddress); + } return moduleAddress; } diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index 138f77ee8..0826c22f5 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -128,7 +128,7 @@ typedef void (*PLUGIN_INIT_SQVM_TYPE)(SquirrelFunctions* funcs); typedef void (*PLUGIN_INFORM_SQVM_CREATED_TYPE)(ScriptContext context, CSquirrelVM* sqvm); typedef void (*PLUGIN_INFORM_SQVM_DESTROYED_TYPE)(ScriptContext context); -typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(PluginLoadDLL dll, void* data, void* dllPtr); +typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(const char* dll, void* data, void* dllPtr); typedef void (*PLUGIN_RUNFRAME)(); // Async Communication types diff --git a/NorthstarDLL/plugins/pluginbackend.cpp b/NorthstarDLL/plugins/pluginbackend.cpp index 567bd0f2f..db59a8f32 100644 --- a/NorthstarDLL/plugins/pluginbackend.cpp +++ b/NorthstarDLL/plugins/pluginbackend.cpp @@ -7,6 +7,8 @@ #include "core/convar/concommand.h" +#include + #define EXPORT extern "C" __declspec(dllexport) AUTOHOOK_INIT() @@ -42,18 +44,13 @@ void PluginCommunicationHandler::PushRequest(PluginDataRequestType type, PluginR requestQueue.push(PluginDataRequest {type, func}); } -ON_DLL_LOAD_RELIESON("engine.dll", PluginBackendEngine, ConCommand, (CModule module)) +void InformPluginsDLLLoad(const char* dllPath, void* address) { - g_pPluginManager->InformDLLLoad( - PluginLoadDLL::ENGINE, &g_pPluginCommunicationhandler->m_sEngineData, reinterpret_cast(module.m_nAddress)); -} + std::string dllName = fs::path(dllPath).filename().string(); -ON_DLL_LOAD_RELIESON("client.dll", PluginBackendClient, ConCommand, (CModule module)) -{ - g_pPluginManager->InformDLLLoad(PluginLoadDLL::CLIENT, nullptr, reinterpret_cast(module.m_nAddress)); -} + void* data = NULL; + if (strncmp(dllName.c_str(), "engine.dll", 10) == 0) + data = &g_pPluginCommunicationhandler->m_sEngineData; -ON_DLL_LOAD_RELIESON("server.dll", PluginBackendServer, ConCommand, (CModule module)) -{ - g_pPluginManager->InformDLLLoad(PluginLoadDLL::SERVER, nullptr, reinterpret_cast(module.m_nAddress)); + g_pPluginManager->InformDLLLoad(dllName.c_str(), data, address); } diff --git a/NorthstarDLL/plugins/pluginbackend.h b/NorthstarDLL/plugins/pluginbackend.h index 3ef35c983..3ca894c4e 100644 --- a/NorthstarDLL/plugins/pluginbackend.h +++ b/NorthstarDLL/plugins/pluginbackend.h @@ -38,4 +38,6 @@ class PluginCommunicationHandler void init_plugincommunicationhandler(); +void InformPluginsDLLLoad(const char* dllPath, void* address); + extern PluginCommunicationHandler* g_pPluginCommunicationhandler; diff --git a/NorthstarDLL/plugins/plugins.cpp b/NorthstarDLL/plugins/plugins.cpp index ab9823e16..aeeaf4a2b 100644 --- a/NorthstarDLL/plugins/plugins.cpp +++ b/NorthstarDLL/plugins/plugins.cpp @@ -300,7 +300,7 @@ void PluginManager::InformSQVMDestroyed(ScriptContext context) } } -void PluginManager::InformDLLLoad(PluginLoadDLL dll, void* data, void* dllPtr) +void PluginManager::InformDLLLoad(const char* dll, void* data, void* dllPtr) { for (auto plugin : m_vLoadedPlugins) { diff --git a/NorthstarDLL/plugins/plugins.h b/NorthstarDLL/plugins/plugins.h index d7901f72f..d91b28113 100644 --- a/NorthstarDLL/plugins/plugins.h +++ b/NorthstarDLL/plugins/plugins.h @@ -48,7 +48,7 @@ class PluginManager void InformSQVMCreated(ScriptContext context, CSquirrelVM* sqvm); void InformSQVMDestroyed(ScriptContext context); - void InformDLLLoad(PluginLoadDLL dll, void* data, void* dllPtr); + void InformDLLLoad(const char* dll, void* data, void* dllPtr); void RunFrame(); From 760a466ce9cc57a8879f6a2713385e7a046f9944 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Fri, 4 Aug 2023 17:13:26 -0400 Subject: [PATCH 19/26] also call in LoadLibraryW --- NorthstarDLL/core/hooks.cpp | 6 ++++-- NorthstarDLL/plugins/pluginbackend.cpp | 4 ++-- NorthstarDLL/plugins/pluginbackend.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NorthstarDLL/core/hooks.cpp b/NorthstarDLL/core/hooks.cpp index 9ac93c02f..da7f9f3e5 100644 --- a/NorthstarDLL/core/hooks.cpp +++ b/NorthstarDLL/core/hooks.cpp @@ -10,7 +10,6 @@ #include #include - AUTOHOOK_INIT() // called from the ON_DLL_LOAD macros @@ -413,7 +412,7 @@ HMODULE, WINAPI, (LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)) if (moduleAddress) { CallLoadLibraryACallbacks(lpLibFileName, moduleAddress); - InformPluginsDLLLoad(lpLibFileName, moduleAddress); + InformPluginsDLLLoad(fs::path(lpLibFileName), moduleAddress); } return moduleAddress; @@ -453,7 +452,10 @@ HMODULE, WINAPI, (LPCWSTR lpLibFileName)) HMODULE moduleAddress = _LoadLibraryW(lpLibFileName); if (moduleAddress) + { CallLoadLibraryWCallbacks(lpLibFileName, moduleAddress); + InformPluginsDLLLoad(fs::path(lpLibFileName), moduleAddress); + } return moduleAddress; } diff --git a/NorthstarDLL/plugins/pluginbackend.cpp b/NorthstarDLL/plugins/pluginbackend.cpp index db59a8f32..7c2189da0 100644 --- a/NorthstarDLL/plugins/pluginbackend.cpp +++ b/NorthstarDLL/plugins/pluginbackend.cpp @@ -44,9 +44,9 @@ void PluginCommunicationHandler::PushRequest(PluginDataRequestType type, PluginR requestQueue.push(PluginDataRequest {type, func}); } -void InformPluginsDLLLoad(const char* dllPath, void* address) +void InformPluginsDLLLoad(fs::path dllPath, void* address) { - std::string dllName = fs::path(dllPath).filename().string(); + std::string dllName = dllPath.filename().string(); void* data = NULL; if (strncmp(dllName.c_str(), "engine.dll", 10) == 0) diff --git a/NorthstarDLL/plugins/pluginbackend.h b/NorthstarDLL/plugins/pluginbackend.h index 3ca894c4e..77db64cd6 100644 --- a/NorthstarDLL/plugins/pluginbackend.h +++ b/NorthstarDLL/plugins/pluginbackend.h @@ -38,6 +38,6 @@ class PluginCommunicationHandler void init_plugincommunicationhandler(); -void InformPluginsDLLLoad(const char* dllPath, void* address); +void InformPluginsDLLLoad(fs::path dllPath, void* address); extern PluginCommunicationHandler* g_pPluginCommunicationhandler; From 611242a170bb70a60941d6a24e313b7498688bc2 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Tue, 12 Sep 2023 17:27:46 -0400 Subject: [PATCH 20/26] extern C some functions in plugin_abi.h --- NorthstarDLL/plugins/plugin_abi.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index 0826c22f5..9ec99b72d 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -85,9 +85,12 @@ struct LogMsg int pluginHandle; }; -typedef void (*loggerfunc_t)(LogMsg* msg); -typedef void (*PLUGIN_RELAY_INVITE_TYPE)(const char* invite); -typedef void* (*CreateObjectFunc)(ObjectType type); +extern "C" +{ + typedef void (*loggerfunc_t)(LogMsg* msg); + typedef void (*PLUGIN_RELAY_INVITE_TYPE)(const char* invite); + typedef void* (*CreateObjectFunc)(ObjectType type); +} struct PluginNorthstarData { @@ -128,7 +131,7 @@ typedef void (*PLUGIN_INIT_SQVM_TYPE)(SquirrelFunctions* funcs); typedef void (*PLUGIN_INFORM_SQVM_CREATED_TYPE)(ScriptContext context, CSquirrelVM* sqvm); typedef void (*PLUGIN_INFORM_SQVM_DESTROYED_TYPE)(ScriptContext context); -typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(const char* dll, void* data, void* dllPtr); +typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(const char* dll, PluginEngineData* data, void* dllPtr); typedef void (*PLUGIN_RUNFRAME)(); // Async Communication types From f9a965bcd8c6fe05ea1ab15de010191715544be9 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Tue, 12 Sep 2023 17:34:42 -0400 Subject: [PATCH 21/26] fix --- NorthstarDLL/plugins/plugins.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NorthstarDLL/plugins/plugins.cpp b/NorthstarDLL/plugins/plugins.cpp index aeeaf4a2b..f102d9bd8 100644 --- a/NorthstarDLL/plugins/plugins.cpp +++ b/NorthstarDLL/plugins/plugins.cpp @@ -306,7 +306,7 @@ void PluginManager::InformDLLLoad(const char* dll, void* data, void* dllPtr) { if (plugin.inform_dll_load != NULL) { - plugin.inform_dll_load(dll, data, dllPtr); + plugin.inform_dll_load(dll, (PluginEngineData*)data, dllPtr); } } } From f3fbd2fca09b348af0703d2ad67d628547c83701 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:52:34 -0400 Subject: [PATCH 22/26] remove trailing comment --- NorthstarDLL/plugins/plugin_abi.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index 9ec99b72d..dca1a71bd 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -133,5 +133,3 @@ typedef void (*PLUGIN_INFORM_SQVM_DESTROYED_TYPE)(ScriptContext context); typedef void (*PLUGIN_INFORM_DLL_LOAD_TYPE)(const char* dll, PluginEngineData* data, void* dllPtr); typedef void (*PLUGIN_RUNFRAME)(); - -// Async Communication types From 090c974f2e14157e9a450691f50f9dabd9f4b343 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:53:20 -0400 Subject: [PATCH 23/26] remove HOSTSTATE.ipch --- HOSTSTATE.ipch | Bin 41940 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 HOSTSTATE.ipch diff --git a/HOSTSTATE.ipch b/HOSTSTATE.ipch deleted file mode 100644 index 4af29b6a368704b7c3a727e9776becdfbc785146..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 41940 zcmeHQ>2BP}5w?;0&d&rv5dGZ6A{t3nvgwv^r+uHr``w!?k#LxIM<08fV#=h?^jRQBm&Z5|u<(}`D zVQSb`7A0Yn8OKqQU8R|o99em2U%5&9$-&W)VLUjgfK4Z7Q)B;V^1?WnOuslkIW<1N zI6OKqkEh0X|NP|a_~hI;J~=yoHa*`zJKDcE9zUC$wVx2M$??;}-^R|EWW{C$5ec%kj*j$1=*$NZ-f>}e8RCRVWV#Pi+Mc<$Lrlt%Mx<4Z5iEq`O0 z<&GB_BpqWM1wkHq*{$*A*f@_OANNo3c6)d8(WA{r+j~2o8h4_zM9^88AI$B$v7QdY zx}PsS-?I`>JiQyq{t6@;A1puF`_TBx3!P|@ZhYZosjP(p z+)grpD6dBBzr)`UyCR==f*RByTbYjs!c4EM#C7^`D;2%>SQlQniUpH_!?ol14#>a# zFCiaK&Y!%P9(-Z!Zhq1TFIPGHOTc>gQ@ohZr(<*S;(T&EJv=#{;*;_sk$#LH`rTag z$7lHIefSC8@-6&qfBNVVy)Q1h?FoJ!egiMtd&Ot;LZ24{_%YrT1Nd@s_PF=2#VtRp zZ+UWYbY#}|6?Thn%Bz9*Bm7;!E4<_5t@?%*V|jzg<_jdcx>+c@zDBm67uO7>Yu-=C)S0)Ef&GE_e)5D|5nF6f1<>&awyqHeRgUR@4 zdO8_T%_k>k=5+t)@pk|2Vps>0&o7?#zxx$FYG#gu$-yD!lgYvPWO@#*IK`BrszibP zdxRYRJ-s-l0n}d?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!0TrWag`7C#CnOIIVL;E%+IlPoV@F zTitB@S|ghpQ)M(J(tC3STa`J`>vL3W9n}-zr0pek?pulZy3a`=C0}dQrdK|#-gRW7 z)xDL|fg}dBBe=$M0P)JCJ}i;aiLuIc2TG(E0<9jpC85J8J$-Vkc_6kj>gI2*BB#nu z>(Q_tq7GFe#*gKjdFA?u=$MqW1_h;*Fy|E6D6^w+A`@J7>dL(I(X2r^H>efe3d%Yn z)0&!~MxTg%nVdv|-lBC2)$He~i6R#4sq?jqRxejtSchjCGoj=~k$oRkzZvJWM%Set zP^Dy7y9ErXLDON|Fp87}a{4;=lEn2#^&7^xDtmcPkN0*oXgPzDkB+E(UO`uF$zVUDEb(DjhGlFNEU}-% zSEQrzcW38Jqff#y!*qlfY?h%-I-hkl5>v2@3TUhZX=eJxm^LhqP?%QWNuxZmQPznl ziHaT>Cf!O4;US&4!$oH%G*I$K z)!(Dy4|-t~=m}Zx#H1cdA10c&l2w-1Gr|VvE{dMyDZ0z;FsPNlm38pDzQ6*N<{ zG~jWzp2%^fnFcwUaWOdv64miNg6;rLPHns<=;zAXZC)R8jxY<`9`~FU`cvu^W(N*` fSYD Date: Fri, 20 Oct 2023 20:11:01 -0400 Subject: [PATCH 24/26] add type information to PluginEngineData --- NorthstarDLL/core/convar/concommand.cpp | 4 +++- NorthstarDLL/core/convar/convar.cpp | 11 ++++++----- NorthstarDLL/plugins/plugin_abi.h | 22 +++++++++++++++++++--- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/NorthstarDLL/core/convar/concommand.cpp b/NorthstarDLL/core/convar/concommand.cpp index 732e0d1fd..93a4cd990 100644 --- a/NorthstarDLL/core/convar/concommand.cpp +++ b/NorthstarDLL/core/convar/concommand.cpp @@ -3,6 +3,7 @@ #include "engine/r2engine.h" #include "plugins/pluginbackend.h" +#include "plugins/plugin_abi.h" #include @@ -151,5 +152,6 @@ ON_DLL_LOAD("engine.dll", ConCommand, (CModule module)) ConCommandConstructor = module.Offset(0x415F60).RCast(); AddMiscConCommands(); - g_pPluginCommunicationhandler->m_sEngineData.ConCommandConstructor = (void*)ConCommandConstructor; + g_pPluginCommunicationhandler->m_sEngineData.ConCommandConstructor = + static_cast(ConCommandConstructor); } diff --git a/NorthstarDLL/core/convar/convar.cpp b/NorthstarDLL/core/convar/convar.cpp index 549ec776c..f9264550c 100644 --- a/NorthstarDLL/core/convar/convar.cpp +++ b/NorthstarDLL/core/convar/convar.cpp @@ -4,6 +4,7 @@ #include "core/sourceinterface.h" #include "plugins/pluginbackend.h" +#include "plugins/plugin_abi.h" #include @@ -40,11 +41,11 @@ ON_DLL_LOAD("engine.dll", ConVar, (CModule module)) R2::g_pCVarInterface = new SourceInterface("vstdlib.dll", "VEngineCvar007"); R2::g_pCVar = *R2::g_pCVarInterface; - g_pPluginCommunicationhandler->m_sEngineData.conVarMalloc = (void*)conVarMalloc; - g_pPluginCommunicationhandler->m_sEngineData.conVarRegister = (void*)conVarRegister; - g_pPluginCommunicationhandler->m_sEngineData.ConVar_Vtable = (void*)g_pConVar_Vtable; - g_pPluginCommunicationhandler->m_sEngineData.IConVar_Vtable = (void*)g_pIConVar_Vtable; - g_pPluginCommunicationhandler->m_sEngineData.g_pCVar = (void*)R2::g_pCVar; + g_pPluginCommunicationhandler->m_sEngineData.conVarMalloc = static_cast(conVarMalloc); + g_pPluginCommunicationhandler->m_sEngineData.conVarRegister = static_cast(conVarRegister); + g_pPluginCommunicationhandler->m_sEngineData.ConVar_Vtable = static_cast(g_pConVar_Vtable); + g_pPluginCommunicationhandler->m_sEngineData.IConVar_Vtable = static_cast(g_pIConVar_Vtable); + g_pPluginCommunicationhandler->m_sEngineData.g_pCVar = static_cast(R2::g_pCVar); } //----------------------------------------------------------------------------- diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index dca1a71bd..b7bd93a19 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -90,6 +90,22 @@ extern "C" typedef void (*loggerfunc_t)(LogMsg* msg); typedef void (*PLUGIN_RELAY_INVITE_TYPE)(const char* invite); typedef void* (*CreateObjectFunc)(ObjectType type); + + typedef void (*PluginFnCommandCallback_t)(void* command); + typedef void (*PluginConCommandConstructorType)( + void* newCommand, char* name, PluginFnCommandCallback_t callback, char* helpString, int flags, void* parent); + typedef void (*PluginConVarRegisterType)( + void* pConVar, + char* pszName, + char* pszDefaultValue, + int nFlags, + char* pszHelpString, + bool bMin, + float fMin, + bool bMax, + float fMax, + void* pCallback); + typedef void (*PluginConVarMallocType)(void* pConVarMaloc, int a2, int a3); } struct PluginNorthstarData @@ -108,9 +124,9 @@ struct PluginInitFuncs struct PluginEngineData { - void* ConCommandConstructor; - void* conVarMalloc; - void* conVarRegister; + PluginConCommandConstructorType ConCommandConstructor; + PluginConVarMallocType conVarMalloc; + PluginConVarRegisterType conVarRegister; void* ConVar_Vtable; void* IConVar_Vtable; void* g_pCVar; From 6f091ed0ffcd1f6a94e13d2647bed0d58c63fe41 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Fri, 20 Oct 2023 20:16:28 -0400 Subject: [PATCH 25/26] change static_cast to reinterpret_cast for previous commit --- NorthstarDLL/core/convar/concommand.cpp | 2 +- NorthstarDLL/core/convar/convar.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/NorthstarDLL/core/convar/concommand.cpp b/NorthstarDLL/core/convar/concommand.cpp index 93a4cd990..41f54c76a 100644 --- a/NorthstarDLL/core/convar/concommand.cpp +++ b/NorthstarDLL/core/convar/concommand.cpp @@ -153,5 +153,5 @@ ON_DLL_LOAD("engine.dll", ConCommand, (CModule module)) AddMiscConCommands(); g_pPluginCommunicationhandler->m_sEngineData.ConCommandConstructor = - static_cast(ConCommandConstructor); + reinterpret_cast(ConCommandConstructor); } diff --git a/NorthstarDLL/core/convar/convar.cpp b/NorthstarDLL/core/convar/convar.cpp index f9264550c..594989c20 100644 --- a/NorthstarDLL/core/convar/convar.cpp +++ b/NorthstarDLL/core/convar/convar.cpp @@ -41,11 +41,11 @@ ON_DLL_LOAD("engine.dll", ConVar, (CModule module)) R2::g_pCVarInterface = new SourceInterface("vstdlib.dll", "VEngineCvar007"); R2::g_pCVar = *R2::g_pCVarInterface; - g_pPluginCommunicationhandler->m_sEngineData.conVarMalloc = static_cast(conVarMalloc); - g_pPluginCommunicationhandler->m_sEngineData.conVarRegister = static_cast(conVarRegister); - g_pPluginCommunicationhandler->m_sEngineData.ConVar_Vtable = static_cast(g_pConVar_Vtable); - g_pPluginCommunicationhandler->m_sEngineData.IConVar_Vtable = static_cast(g_pIConVar_Vtable); - g_pPluginCommunicationhandler->m_sEngineData.g_pCVar = static_cast(R2::g_pCVar); + g_pPluginCommunicationhandler->m_sEngineData.conVarMalloc = reinterpret_cast(conVarMalloc); + g_pPluginCommunicationhandler->m_sEngineData.conVarRegister = reinterpret_cast(conVarRegister); + g_pPluginCommunicationhandler->m_sEngineData.ConVar_Vtable = reinterpret_cast(g_pConVar_Vtable); + g_pPluginCommunicationhandler->m_sEngineData.IConVar_Vtable = reinterpret_cast(g_pIConVar_Vtable); + g_pPluginCommunicationhandler->m_sEngineData.g_pCVar = reinterpret_cast(R2::g_pCVar); } //----------------------------------------------------------------------------- From 4c4cb1b8e9d7c24a6cb07a3c9f6fb82aa9424216 Mon Sep 17 00:00:00 2001 From: cat_or_not <41955154+catornot@users.noreply.github.com> Date: Sat, 21 Oct 2023 14:25:32 -0400 Subject: [PATCH 26/26] add const back to some Plugin typedefs --- NorthstarDLL/plugins/plugin_abi.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NorthstarDLL/plugins/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h index b7bd93a19..16b26a1c3 100644 --- a/NorthstarDLL/plugins/plugin_abi.h +++ b/NorthstarDLL/plugins/plugin_abi.h @@ -93,13 +93,13 @@ extern "C" typedef void (*PluginFnCommandCallback_t)(void* command); typedef void (*PluginConCommandConstructorType)( - void* newCommand, char* name, PluginFnCommandCallback_t callback, char* helpString, int flags, void* parent); + void* newCommand, const char* name, PluginFnCommandCallback_t callback, const char* helpString, int flags, void* parent); typedef void (*PluginConVarRegisterType)( void* pConVar, - char* pszName, - char* pszDefaultValue, + const char* pszName, + const char* pszDefaultValue, int nFlags, - char* pszHelpString, + const char* pszHelpString, bool bMin, float fMin, bool bMax,