aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/squirrel.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-07-29 02:57:31 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-07-29 02:57:31 +0100
commit30e67549449a0ffbb58f7fc736bdd9e4ce7ec9d5 (patch)
treef6a53098ce2489829f8428ea1714d666cc6901ef /NorthstarDedicatedTest/squirrel.cpp
parenta5a937d19fcb51fe4168345d09596784e174726e (diff)
downloadNorthstarLauncher-30e67549449a0ffbb58f7fc736bdd9e4ce7ec9d5.tar.gz
NorthstarLauncher-30e67549449a0ffbb58f7fc736bdd9e4ce7ec9d5.zip
add script api for mods and add temp fix for scripts.rson not loading right
Diffstat (limited to 'NorthstarDedicatedTest/squirrel.cpp')
-rw-r--r--NorthstarDedicatedTest/squirrel.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp
index b57e22ae..17758282 100644
--- a/NorthstarDedicatedTest/squirrel.cpp
+++ b/NorthstarDedicatedTest/squirrel.cpp
@@ -34,6 +34,7 @@ CallScriptInitCallbackType ClientCallScriptInitCallback;
CallScriptInitCallbackType ServerCallScriptInitCallback;
template<Context context> char CallScriptInitCallbackHook(void* sqvm, const char* callback);
+// core sqvm funcs
sq_compilebufferType ClientSq_compilebuffer;
sq_compilebufferType ServerSq_compilebuffer;
@@ -46,6 +47,37 @@ sq_callType ServerSq_call;
RegisterSquirrelFuncType ClientRegisterSquirrelFunc;
RegisterSquirrelFuncType ServerRegisterSquirrelFunc;
+
+// sq stack array funcs
+sq_newarrayType ClientSq_newarray;
+sq_newarrayType ServerSq_newarray;
+
+sq_arrayappendType ClientSq_arrayappend;
+sq_arrayappendType ServerSq_arrayappend;
+
+
+// sq stack push funcs
+sq_pushstringType ClientSq_pushstring;
+sq_pushstringType ServerSq_pushstring;
+
+sq_pushintegerType ClientSq_pushinteger;
+sq_pushintegerType ServerSq_pushinteger;
+
+sq_pushfloatType ClientSq_pushfloat;
+sq_pushfloatType ServerSq_pushfloat;
+
+
+// sq stack get funcs
+sq_getstringType ClientSq_getstring;
+sq_getstringType ServerSq_getstring;
+
+sq_getintegerType ClientSq_getinteger;
+sq_getintegerType ServerSq_getinteger;
+
+sq_getfloatType ClientSq_getfloat;
+sq_getfloatType ServerSq_getfloat;
+
+
template<Context context> void ExecuteCodeCommand(const CCommand& args);
// inits
@@ -80,6 +112,17 @@ void InitialiseClientSquirrel(HMODULE baseAddress)
ClientSq_call = (sq_callType)((char*)baseAddress + 0x8650);
ClientRegisterSquirrelFunc = (RegisterSquirrelFuncType)((char*)baseAddress + 0x108E0);
+ ClientSq_newarray = (sq_newarrayType)((char*)baseAddress + 0x39F0);
+ ClientSq_arrayappend = (sq_arrayappendType)((char*)baseAddress + 0x3C70);
+
+ ClientSq_pushstring = (sq_pushstringType)((char*)baseAddress + 0x3440);
+ ClientSq_pushinteger = (sq_pushintegerType)((char*)baseAddress + 0x36A0);
+ ClientSq_pushfloat = (sq_pushfloatType)((char*)baseAddress + 0x3800);
+
+ ClientSq_getstring = (sq_getstringType)((char*)baseAddress + 0x60C0);
+ ClientSq_getinteger = (sq_getintegerType)((char*)baseAddress + 0x60E0);
+ ClientSq_getfloat = (sq_getfloatType)((char*)baseAddress + 0x6100);
+
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x26130, &CreateNewVMHook<CLIENT>, reinterpret_cast<LPVOID*>(&ClientCreateNewVM)); // client createnewvm function
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x26E70, &DestroyVMHook<CLIENT>, reinterpret_cast<LPVOID*>(&ClientDestroyVM)); // client destroyvm function
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x79A50, &ScriptCompileErrorHook<CLIENT>, reinterpret_cast<LPVOID*>(&ClientSQCompileError)); // client compileerror function
@@ -98,6 +141,17 @@ void InitialiseServerSquirrel(HMODULE baseAddress)
ServerSq_call = (sq_callType)((char*)baseAddress + 0x8620);
ServerRegisterSquirrelFunc = (RegisterSquirrelFuncType)((char*)baseAddress + 0x1DD10);
+ ServerSq_newarray = (sq_newarrayType)((char*)baseAddress + 0x39F0);
+ ServerSq_arrayappend = (sq_arrayappendType)((char*)baseAddress + 0x3C70);
+
+ ServerSq_pushstring = (sq_pushstringType)((char*)baseAddress + 0x3440);
+ ServerSq_pushinteger = (sq_pushintegerType)((char*)baseAddress + 0x36A0);
+ ServerSq_pushfloat = (sq_pushfloatType)((char*)baseAddress + 0x3800);
+
+ ServerSq_getstring = (sq_getstringType)((char*)baseAddress + 0x60A0);
+ ServerSq_getinteger = (sq_getintegerType)((char*)baseAddress + 0x60C0);
+ ServerSq_getfloat = (sq_getfloatType)((char*)baseAddress + 0x60E0);
+
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x1FE90, &SQPrintHook<SERVER>, reinterpret_cast<LPVOID*>(&ServerSQPrint)); // server print function
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x260E0, &CreateNewVMHook<SERVER>, reinterpret_cast<LPVOID*>(&ServerCreateNewVM)); // server createnewvm function
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x26E20, &DestroyVMHook<SERVER>, reinterpret_cast<LPVOID*>(&ServerDestroyVM)); // server destroyvm function