From 46bed8d09f32360377350d71816a76abdfbf2c7c Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Wed, 24 Aug 2022 00:32:31 +0100 Subject: Adjust folder structure (#242) * Adjust folder structure * change launcher directory name --- NorthstarDLL/scriptutility.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 NorthstarDLL/scriptutility.cpp (limited to 'NorthstarDLL/scriptutility.cpp') diff --git a/NorthstarDLL/scriptutility.cpp b/NorthstarDLL/scriptutility.cpp new file mode 100644 index 00000000..98c6f3a3 --- /dev/null +++ b/NorthstarDLL/scriptutility.cpp @@ -0,0 +1,29 @@ +#include "pch.h" +#include "scriptutility.h" +#include "squirrel.h" + +template SQRESULT SQ_StringToAsset(void* sqvm) +{ + if (context == ScriptContext::SERVER) + { + const char* asset = ServerSq_getstring(sqvm, 1); + ServerSq_pushAsset(sqvm, asset, -1); + } + else + { + const char* asset = ClientSq_getstring(sqvm, 1); + ClientSq_pushAsset(sqvm, asset, -1); + } + return SQRESULT_NOTNULL; +} + +void InitialiseClientSquirrelUtilityFunctions(HMODULE baseAddress) +{ + g_ClientSquirrelManager->AddFuncRegistration("asset", "StringToAsset", "string assetName", "", SQ_StringToAsset); + g_UISquirrelManager->AddFuncRegistration("asset", "StringToAsset", "string assetName", "", SQ_StringToAsset); +} + +void InitialiseServerSquirrelUtilityFunctions(HMODULE baseAddress) +{ + g_ServerSquirrelManager->AddFuncRegistration("asset", "StringToAsset", "string assetName", "", SQ_StringToAsset); +} \ No newline at end of file -- cgit v1.2.3