diff options
author | Maya <malte.hoermeyer@web.de> | 2022-07-21 02:54:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-21 02:54:00 +0200 |
commit | 938d89713eb055340b5e8866de3000b61e4a0f13 (patch) | |
tree | 65c266a244c27ff47ec0f4086a15a97a099ee493 /NorthstarDedicatedTest/squirrel.cpp | |
parent | d20cf6f08af37830d3bfc934cef356fa6a1aa102 (diff) | |
download | NorthstarLauncher-938d89713eb055340b5e8866de3000b61e4a0f13.tar.gz NorthstarLauncher-938d89713eb055340b5e8866de3000b61e4a0f13.zip |
Implemented Json into the squirrel vm (#172)
* Implemented Json into the squirrel vm
* Formatting
* More Formatting
* Even more Formatting
* Added Init functions to dllMain
* Formatting
* Changed to use Source Allocator
* Renaming Part 1
* Renaming Part 2
Diffstat (limited to 'NorthstarDedicatedTest/squirrel.cpp')
-rw-r--r-- | NorthstarDedicatedTest/squirrel.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp index a0680d9a..4d305ee2 100644 --- a/NorthstarDedicatedTest/squirrel.cpp +++ b/NorthstarDedicatedTest/squirrel.cpp @@ -94,6 +94,12 @@ sq_getboolType ServerSq_getbool; sq_getType ClientSq_sq_get; sq_getType ServerSq_sq_get; +sq_newSlotType ServerSq_newSlot; +sq_newSlotType ClientSq_newSlot; + +sq_newTableType ServerSq_newTable; +sq_newTableType ClientSq_newTable; + template <ScriptContext context> void ExecuteCodeCommand(const CCommand& args); // inits @@ -153,6 +159,10 @@ void InitialiseClientSquirrel(HMODULE baseAddress) ClientSq_defconst = (sq_defconst)((char*)baseAddress + 0x12120); + // Table functions + ClientSq_newTable = (sq_newTableType)((char*)baseAddress + 0x5940); + ClientSq_newSlot = (sq_newSlotType)((char*)baseAddress + 0x70B0); + ENABLER_CREATEHOOK( hook, (char*)baseAddress + 0x26130, @@ -210,6 +220,9 @@ void InitialiseServerSquirrel(HMODULE baseAddress) ServerSq_defconst = (sq_defconst)((char*)baseAddress + 0x1F550); + ServerSq_newSlot = (sq_newSlotType)((char*)baseAddress + 0x7080); + ServerSq_newTable = (sq_newTableType)((char*)baseAddress + 0x3960); + ENABLER_CREATEHOOK( hook, (char*)baseAddress + 0x1FE90, @@ -499,6 +512,58 @@ template <ScriptContext context> int64_t RegisterSquirrelFuncHook(void* sqvm, SQ return ClientRegisterSquirrelFunc(sqvm, funcReg, unknown); } +const char* sq_getTypeName(int type) +{ + switch (type) + { + case OT_ASSET: + return "asset"; + case OT_INTEGER: + return "int"; + case OT_BOOL: + return "bool"; + case SQOBJECT_NUMERIC: + return "float or int"; + case OT_NULL: + return "null"; + case OT_VECTOR: + return "vector"; + case 0: + return "var"; + case OT_USERDATA: + return "userdata"; + case OT_FLOAT: + return "float"; + case OT_STRING: + return "string"; + case 0x8000040: + return "array"; + case 0x8000200: + return "function"; + case 0x8100000: + return "structdef"; + case OT_THREAD: + return "thread"; + case OT_FUNCPROTO: + return "function"; + case OT_CLAAS: + return "class"; + case OT_WEAKREF: + return "weakref"; + case 0x8080000: + return "unimplemented function"; + case 0x8200000: + return "struct instance"; + case 0xA000020: + return "table"; + case 0xA008000: + return "instance"; + case 0xA400000: + return "entity"; + } + return ""; +} + SQReturnTypeEnum GetReturnTypeEnumFromString(const char* returnTypeString) { |