aboutsummaryrefslogtreecommitdiff
path: root/primedev
diff options
context:
space:
mode:
authorF1F7Y <64418963+F1F7Y@users.noreply.github.com>2024-09-02 17:50:37 +0200
committerGitHub <noreply@github.com>2024-09-02 17:50:37 +0200
commitce21abe9c4c58d7c7d986fb01824ab107081ad2f (patch)
treed723f3ddab3994adfd0391eed5d53faf8db26e65 /primedev
parent79fbb9b9a751d6c3a863b1fed95cd8480a1586ab (diff)
downloadNorthstarLauncher-1.27.6.tar.gz
NorthstarLauncher-1.27.6.zip
vscript: Move squirrel types to their respective files (#788)v1.27.6-rc4v1.27.6
Refactor logic to move Squirrel types to their own respective files and extend existing layouts in the process where applicable. Contains additional smaller fixes.
Diffstat (limited to 'primedev')
-rw-r--r--primedev/Northstar.cmake18
-rw-r--r--primedev/mods/modsavefiles.cpp2
-rw-r--r--primedev/scripts/scriptdatatables.cpp6
-rw-r--r--primedev/scripts/scripthttprequesthandler.cpp10
-rw-r--r--primedev/scripts/scriptjson.cpp12
-rw-r--r--primedev/scripts/scriptjson.h2
-rw-r--r--primedev/squirrel/squirrel.cpp22
-rw-r--r--primedev/squirrel/squirrel.h64
-rw-r--r--primedev/squirrel/squirrelautobind.h8
-rw-r--r--primedev/squirrel/squirrelclasstypes.h137
-rw-r--r--primedev/squirrel/squirreldatatypes.h501
-rw-r--r--primedev/vscript/languages/squirrel_re/include/squirrel.h95
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqarray.h12
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqclosure.h29
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqcompiler.h26
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqfunctionproto.h24
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqlexer.h9
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqobject.h93
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqopcodes.h13
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqstate.h120
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqstring.h15
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqstruct.h24
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqtable.h21
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/squserdata.h15
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqvector.h12
-rw-r--r--primedev/vscript/languages/squirrel_re/squirrel/sqvm.h69
-rw-r--r--primedev/vscript/languages/squirrel_re/vsquirrel.h16
-rw-r--r--primedev/vscript/vscript.h20
28 files changed, 728 insertions, 667 deletions
diff --git a/primedev/Northstar.cmake b/primedev/Northstar.cmake
index b8038073..05c3c72a 100644
--- a/primedev/Northstar.cmake
+++ b/primedev/Northstar.cmake
@@ -151,7 +151,6 @@ add_library(
"squirrel/squirrelautobind.cpp"
"squirrel/squirrelautobind.h"
"squirrel/squirrelclasstypes.h"
- "squirrel/squirreldatatypes.h"
"util/printcommands.cpp"
"util/printcommands.h"
"util/printmaps.cpp"
@@ -162,6 +161,23 @@ add_library(
"util/version.h"
"util/wininfo.cpp"
"util/wininfo.h"
+ "vscript/languages/squirrel_re/include/squirrel.h"
+ "vscript/languages/squirrel_re/squirrel/sqarray.h"
+ "vscript/languages/squirrel_re/squirrel/sqclosure.h"
+ "vscript/languages/squirrel_re/squirrel/sqcompiler.h"
+ "vscript/languages/squirrel_re/squirrel/sqfunctionproto.h"
+ "vscript/languages/squirrel_re/squirrel/sqlexer.h"
+ "vscript/languages/squirrel_re/squirrel/sqobject.h"
+ "vscript/languages/squirrel_re/squirrel/sqopcodes.h"
+ "vscript/languages/squirrel_re/squirrel/sqstate.h"
+ "vscript/languages/squirrel_re/squirrel/sqstring.h"
+ "vscript/languages/squirrel_re/squirrel/sqstruct.h"
+ "vscript/languages/squirrel_re/squirrel/sqtable.h"
+ "vscript/languages/squirrel_re/squirrel/squserdata.h"
+ "vscript/languages/squirrel_re/squirrel/sqvector.h"
+ "vscript/languages/squirrel_re/squirrel/sqvm.h"
+ "vscript/languages/squirrel_re/vsquirrel.h"
+ "vscript/vscript.h"
"windows/libsys.cpp"
"windows/libsys.h"
"dllmain.cpp"
diff --git a/primedev/mods/modsavefiles.cpp b/primedev/mods/modsavefiles.cpp
index 68e33864..13239c99 100644
--- a/primedev/mods/modsavefiles.cpp
+++ b/primedev/mods/modsavefiles.cpp
@@ -537,7 +537,7 @@ ADD_SQFUNC("int", NSGetTotalSpaceRemaining, "", "", ScriptContext::CLIENT | Scri
// ok, I'm just gonna explain what the fuck is going on here because this
// is the pinnacle of my stupidity and I do not want to touch this ever
// again, yet someone will eventually have to maintain this.
-template <ScriptContext context> std::string EncodeJSON(HSquirrelVM* sqvm)
+template <ScriptContext context> std::string EncodeJSON(HSQUIRRELVM sqvm)
{
// new rapidjson
rapidjson_document doc;
diff --git a/primedev/scripts/scriptdatatables.cpp b/primedev/scripts/scriptdatatables.cpp
index 5e685b48..76e57b95 100644
--- a/primedev/scripts/scriptdatatables.cpp
+++ b/primedev/scripts/scriptdatatables.cpp
@@ -44,7 +44,7 @@ struct Datatable
ConVar* Cvar_ns_prefer_datatable_from_disk;
-template <ScriptContext context> Datatable* (*SQ_GetDatatableInternal)(HSquirrelVM* sqvm);
+template <ScriptContext context> Datatable* (*SQ_GetDatatableInternal)(HSQUIRRELVM sqvm);
struct CSVData
{
@@ -852,12 +852,12 @@ void ConCommand_dump_datatables(const CCommand& args)
ON_DLL_LOAD_RELIESON("server.dll", ServerScriptDatatables, ServerSquirrel, (CModule module))
{
- SQ_GetDatatableInternal<ScriptContext::SERVER> = module.Offset(0x1250f0).RCast<Datatable* (*)(HSquirrelVM*)>();
+ SQ_GetDatatableInternal<ScriptContext::SERVER> = module.Offset(0x1250f0).RCast<Datatable* (*)(HSQUIRRELVM)>();
}
ON_DLL_LOAD_RELIESON("client.dll", ClientScriptDatatables, ClientSquirrel, (CModule module))
{
- SQ_GetDatatableInternal<ScriptContext::CLIENT> = module.Offset(0x1C9070).RCast<Datatable* (*)(HSquirrelVM*)>();
+ SQ_GetDatatableInternal<ScriptContext::CLIENT> = module.Offset(0x1C9070).RCast<Datatable* (*)(HSQUIRRELVM)>();
SQ_GetDatatableInternal<ScriptContext::UI> = SQ_GetDatatableInternal<ScriptContext::CLIENT>;
}
diff --git a/primedev/scripts/scripthttprequesthandler.cpp b/primedev/scripts/scripthttprequesthandler.cpp
index 69828a5a..f45e83f0 100644
--- a/primedev/scripts/scripthttprequesthandler.cpp
+++ b/primedev/scripts/scripthttprequesthandler.cpp
@@ -450,7 +450,7 @@ template <ScriptContext context> int HttpRequestHandler::MakeHttpRequest(const H
// int NS_InternalMakeHttpRequest(int method, string baseUrl, table<string, string> headers, table<string, string> queryParams,
// string contentType, string body, int timeout, string userAgent)
-template <ScriptContext context> SQRESULT SQ_InternalMakeHttpRequest(HSquirrelVM* sqvm)
+template <ScriptContext context> SQRESULT SQ_InternalMakeHttpRequest(HSQUIRRELVM sqvm)
{
if (!g_httpRequestHandler || !g_httpRequestHandler->IsRunning())
{
@@ -475,7 +475,7 @@ template <ScriptContext context> SQRESULT SQ_InternalMakeHttpRequest(HSquirrelVM
SQTable* headerTable = sqvm->_stackOfCurrentFunction[3]._VAL.asTable;
for (int idx = 0; idx < headerTable->_numOfNodes; ++idx)
{
- tableNode* node = &headerTable->_nodes[idx];
+ SQTable::_HashNode* node = &headerTable->_nodes[idx];
if (node->key._Type == OT_STRING && node->val._Type == OT_ARRAY)
{
@@ -497,7 +497,7 @@ template <ScriptContext context> SQRESULT SQ_InternalMakeHttpRequest(HSquirrelVM
SQTable* queryTable = sqvm->_stackOfCurrentFunction[4]._VAL.asTable;
for (int idx = 0; idx < queryTable->_numOfNodes; ++idx)
{
- tableNode* node = &queryTable->_nodes[idx];
+ SQTable::_HashNode* node = &queryTable->_nodes[idx];
if (node->key._Type == OT_STRING && node->val._Type == OT_ARRAY)
{
@@ -527,14 +527,14 @@ template <ScriptContext context> SQRESULT SQ_InternalMakeHttpRequest(HSquirrelVM
}
// bool NSIsHttpEnabled()
-template <ScriptContext context> SQRESULT SQ_IsHttpEnabled(HSquirrelVM* sqvm)
+template <ScriptContext context> SQRESULT SQ_IsHttpEnabled(HSQUIRRELVM sqvm)
{
g_pSquirrel<context>->pushbool(sqvm, !IsHttpDisabled());
return SQRESULT_NOTNULL;
}
// bool NSIsLocalHttpAllowed()
-template <ScriptContext context> SQRESULT SQ_IsLocalHttpAllowed(HSquirrelVM* sqvm)
+template <ScriptContext context> SQRESULT SQ_IsLocalHttpAllowed(HSQUIRRELVM sqvm)
{
g_pSquirrel<context>->pushbool(sqvm, IsLocalHttpAllowed());
return SQRESULT_NOTNULL;
diff --git a/primedev/scripts/scriptjson.cpp b/primedev/scripts/scriptjson.cpp
index 8959bf47..91553ae3 100644
--- a/primedev/scripts/scriptjson.cpp
+++ b/primedev/scripts/scriptjson.cpp
@@ -9,8 +9,8 @@
#undef GetObject // fuck microsoft developers
#endif
-template <ScriptContext context> void
-DecodeJsonArray(HSquirrelVM* sqvm, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>* arr)
+template <ScriptContext context>
+void DecodeJsonArray(HSQUIRRELVM sqvm, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>* arr)
{
g_pSquirrel<context>->newarray(sqvm, 0);
@@ -48,8 +48,8 @@ DecodeJsonArray(HSquirrelVM* sqvm, rapidjson::GenericValue<rapidjson::UTF8<char>
}
}
-template <ScriptContext context> void
-DecodeJsonTable(HSquirrelVM* sqvm, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>* obj)
+template <ScriptContext context>
+void DecodeJsonTable(HSQUIRRELVM sqvm, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>* obj)
{
g_pSquirrel<context>->newtable(sqvm);
@@ -107,7 +107,7 @@ template <ScriptContext context> void EncodeJSONTable(
{
for (int i = 0; i < table->_numOfNodes; i++)
{
- tableNode* node = &table->_nodes[i];
+ SQTable::_HashNode* node = &table->_nodes[i];
if (node->key._Type == OT_STRING)
{
rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>> newObj(rapidjson::kObjectType);
@@ -240,7 +240,7 @@ ADD_SQFUNC(
doc.SetObject();
// temp until this is just the func parameter type
- HSquirrelVM* vm = (HSquirrelVM*)sqvm;
+ HSQUIRRELVM vm = (HSQUIRRELVM)sqvm;
SQTable* table = vm->_stackOfCurrentFunction[1]._VAL.asTable;
EncodeJSONTable<context>(table, &doc, doc.GetAllocator());
diff --git a/primedev/scripts/scriptjson.h b/primedev/scripts/scriptjson.h
index b747106b..f766e3f0 100644
--- a/primedev/scripts/scriptjson.h
+++ b/primedev/scripts/scriptjson.h
@@ -10,4 +10,4 @@ template <ScriptContext context> void EncodeJSONTable(
rapidjson::MemoryPoolAllocator<SourceAllocator>& allocator);
template <ScriptContext context> void
-DecodeJsonTable(HSquirrelVM* sqvm, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>* obj);
+DecodeJsonTable(HSQUIRRELVM sqvm, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>* obj);
diff --git a/primedev/squirrel/squirrel.cpp b/primedev/squirrel/squirrel.cpp
index 29540cce..4141d04d 100644
--- a/primedev/squirrel/squirrel.cpp
+++ b/primedev/squirrel/squirrel.cpp
@@ -11,6 +11,8 @@
#include "ns_version.h"
#include "core/vanilla.h"
+#include "vscript/vscript.h"
+
#include <any>
AUTOHOOK_INIT()
@@ -253,8 +255,8 @@ template <ScriptContext context> void SquirrelManager<context>::ExecuteCode(cons
spdlog::info("Executing {} script code {} ", GetContextName(context), pCode);
- std::string strCode(pCode);
- CompileBufferState bufferState = CompileBufferState(strCode);
+ // NOTE: SQBufferState doesn't strdup pCode!
+ SQBufferState bufferState = SQBufferState(pCode);
SQRESULT compileResult = compilebuffer(&bufferState, "console");
spdlog::info("sq_compilebuffer returned {}", PrintSQRESULT.at(compileResult));
@@ -309,14 +311,14 @@ template <ScriptContext context> void SquirrelManager<context>::AddFuncOverride(
}
// hooks
-bool IsUIVM(ScriptContext context, HSquirrelVM* pSqvm)
+bool IsUIVM(ScriptContext context, HSQUIRRELVM pSqvm)
{
NOTE_UNUSED(context);
return ScriptContext(pSqvm->sharedState->cSquirrelVM->vmContext) == ScriptContext::UI;
}
-template <ScriptContext context> void* (*sq_compiler_create)(HSquirrelVM* sqvm, void* a2, void* a3, SQBool bShouldThrowError);
-template <ScriptContext context> void* __fastcall sq_compiler_createHook(HSquirrelVM* sqvm, void* a2, void* a3, SQBool bShouldThrowError)
+template <ScriptContext context> void* (*sq_compiler_create)(HSQUIRRELVM sqvm, void* a2, void* a3, SQBool bShouldThrowError);
+template <ScriptContext context> void* __fastcall sq_compiler_createHook(HSQUIRRELVM sqvm, void* a2, void* a3, SQBool bShouldThrowError)
{
// store whether errors generated from this compile should be fatal
if (IsUIVM(context, sqvm))
@@ -327,8 +329,8 @@ template <ScriptContext context> void* __fastcall sq_compiler_createHook(HSquirr
return sq_compiler_create<context>(sqvm, a2, a3, bShouldThrowError);
}
-template <ScriptContext context> SQInteger (*SQPrint)(HSquirrelVM* sqvm, const char* fmt);
-template <ScriptContext context> SQInteger SQPrintHook(HSquirrelVM* sqvm, const char* fmt, ...)
+template <ScriptContext context> SQInteger (*SQPrint)(HSQUIRRELVM sqvm, const char* fmt);
+template <ScriptContext context> SQInteger SQPrintHook(HSQUIRRELVM sqvm, const char* fmt, ...)
{
NOTE_UNUSED(sqvm);
@@ -398,9 +400,9 @@ template <ScriptContext context> void __fastcall DestroyVMHook(void* a1, CSquirr
spdlog::info("DestroyVM {} {}", GetContextName(realContext), (void*)sqvm);
}
-template <ScriptContext context> void (*SQCompileError)(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column);
+template <ScriptContext context> void (*SQCompileError)(HSQUIRRELVM sqvm, const char* error, const char* file, int line, int column);
template <ScriptContext context>
-void __fastcall ScriptCompileErrorHook(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column)
+void __fastcall ScriptCompileErrorHook(HSQUIRRELVM sqvm, const char* error, const char* file, int line, int column)
{
bool bIsFatalError = g_pSquirrel<context>->m_bFatalCompilationErrors;
ScriptContext realContext = context; // ui and client use the same function so we use this for prints
@@ -544,7 +546,7 @@ template <ScriptContext context> void ConCommand_script(const CCommand& args)
g_pSquirrel<context>->ExecuteCode(args.ArgS());
}
-template <ScriptContext context> SQRESULT SQ_StubbedFunc(HSquirrelVM* sqvm)
+template <ScriptContext context> SQRESULT SQ_StubbedFunc(HSQUIRRELVM sqvm)
{
SQStackInfos si;
g_pSquirrel<context>->sq_stackinfos(sqvm, 0, si);
diff --git a/primedev/squirrel/squirrel.h b/primedev/squirrel/squirrel.h
index 086ab9c6..ae6e80c9 100644
--- a/primedev/squirrel/squirrel.h
+++ b/primedev/squirrel/squirrel.h
@@ -129,72 +129,72 @@ public:
inline void defconst(CSquirrelVM* sqvm, const SQChar* pName, int nValue) { __sq_defconst(sqvm, pName, nValue); }
inline SQRESULT
- compilebuffer(CompileBufferState* bufferState, const SQChar* bufferName = "unnamedbuffer", const SQBool bShouldThrowError = false)
+ compilebuffer(SQBufferState* bufferState, const SQChar* bufferName = "unnamedbuffer", const SQBool bShouldThrowError = false)
{
return __sq_compilebuffer(m_pSQVM->sqvm, bufferState, bufferName, -1, bShouldThrowError);
}
- inline SQRESULT _call(HSquirrelVM* sqvm, const SQInteger args) { return __sq_call(sqvm, args + 1, false, true); }
+ inline SQRESULT _call(HSQUIRRELVM sqvm, const SQInteger args) { return __sq_call(sqvm, args + 1, false, true); }
- inline SQInteger raiseerror(HSquirrelVM* sqvm, const SQChar* sError) { return __sq_raiseerror(sqvm, sError); }
+ inline SQInteger raiseerror(HSQUIRRELVM sqvm, const SQChar* sError) { return __sq_raiseerror(sqvm, sError); }
inline bool compilefile(CSquirrelVM* sqvm, const char* path, const char* name, int a4)
{
return __sq_compilefile(sqvm, path, name, a4);
}
- inline void newarray(HSquirrelVM* sqvm, const SQInteger stackpos = 0) { __sq_newarray(sqvm, stackpos); }
+ inline void newarray(HSQUIRRELVM sqvm, const SQInteger stackpos = 0) { __sq_newarray(sqvm, stackpos); }
- inline SQRESULT arrayappend(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_arrayappend(sqvm, stackpos); }
+ inline SQRESULT arrayappend(HSQUIRRELVM sqvm, const SQInteger stackpos) { return __sq_arrayappend(sqvm, stackpos); }
- inline SQRESULT newtable(HSquirrelVM* sqvm) { return __sq_newtable(sqvm); }
+ inline SQRESULT newtable(HSQUIRRELVM sqvm) { return __sq_newtable(sqvm); }
- inline SQRESULT newslot(HSquirrelVM* sqvm, SQInteger idx, SQBool bStatic) { return __sq_newslot(sqvm, idx, bStatic); }
+ inline SQRESULT newslot(HSQUIRRELVM sqvm, SQInteger idx, SQBool bStatic) { return __sq_newslot(sqvm, idx, bStatic); }
- inline void pushroottable(HSquirrelVM* sqvm) { __sq_pushroottable(sqvm); }
+ inline void pushroottable(HSQUIRRELVM sqvm) { __sq_pushroottable(sqvm); }
- inline void pushstring(HSquirrelVM* sqvm, const SQChar* sVal, int length = -1) { __sq_pushstring(sqvm, sVal, length); }
+ inline void pushstring(HSQUIRRELVM sqvm, const SQChar* sVal, int length = -1) { __sq_pushstring(sqvm, sVal, length); }
- inline void pushinteger(HSquirrelVM* sqvm, const SQInteger iVal) { __sq_pushinteger(sqvm, iVal); }
+ inline void pushinteger(HSQUIRRELVM sqvm, const SQInteger iVal) { __sq_pushinteger(sqvm, iVal); }
- inline void pushfloat(HSquirrelVM* sqvm, const SQFloat flVal) { __sq_pushfloat(sqvm, flVal); }
+ inline void pushfloat(HSQUIRRELVM sqvm, const SQFloat flVal) { __sq_pushfloat(sqvm, flVal); }
- inline void pushbool(HSquirrelVM* sqvm, const SQBool bVal) { __sq_pushbool(sqvm, bVal); }
+ inline void pushbool(HSQUIRRELVM sqvm, const SQBool bVal) { __sq_pushbool(sqvm, bVal); }
- inline void pushasset(HSquirrelVM* sqvm, const SQChar* sVal, int length = -1) { __sq_pushasset(sqvm, sVal, length); }
+ inline void pushasset(HSQUIRRELVM sqvm, const SQChar* sVal, int length = -1) { __sq_pushasset(sqvm, sVal, length); }
- inline void pushvector(HSquirrelVM* sqvm, const Vector3 pVal) { __sq_pushvector(sqvm, (float*)&pVal); }
+ inline void pushvector(HSQUIRRELVM sqvm, const Vector3 pVal) { __sq_pushvector(sqvm, (float*)&pVal); }
- inline void pushobject(HSquirrelVM* sqvm, SQObject* obj) { __sq_pushobject(sqvm, obj); }
+ inline void pushobject(HSQUIRRELVM sqvm, SQObject* obj) { __sq_pushobject(sqvm, obj); }
- inline const SQChar* getstring(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_getstring(sqvm, stackpos); }
+ inline const SQChar* getstring(HSQUIRRELVM sqvm, const SQInteger stackpos) { return __sq_getstring(sqvm, stackpos); }
- inline SQInteger getinteger(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_getinteger(sqvm, stackpos); }
+ inline SQInteger getinteger(HSQUIRRELVM sqvm, const SQInteger stackpos) { return __sq_getinteger(sqvm, stackpos); }
- inline SQFloat getfloat(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_getfloat(sqvm, stackpos); }
+ inline SQFloat getfloat(HSQUIRRELVM sqvm, const SQInteger stackpos) { return __sq_getfloat(sqvm, stackpos); }
- inline SQBool getbool(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_getbool(sqvm, stackpos); }
+ inline SQBool getbool(HSQUIRRELVM sqvm, const SQInteger stackpos) { return __sq_getbool(sqvm, stackpos); }
- inline SQRESULT get(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_get(sqvm, stackpos); }
+ inline SQRESULT get(HSQUIRRELVM sqvm, const SQInteger stackpos) { return __sq_get(sqvm, stackpos); }
- inline Vector3 getvector(HSquirrelVM* sqvm, const SQInteger stackpos) { return *(Vector3*)__sq_getvector(sqvm, stackpos); }
+ inline Vector3 getvector(HSQUIRRELVM sqvm, const SQInteger stackpos) { return *(Vector3*)__sq_getvector(sqvm, stackpos); }
- inline int sq_getfunction(HSquirrelVM* sqvm, const char* name, SQObject* returnObj, const char* signature)
+ inline int sq_getfunction(HSQUIRRELVM sqvm, const char* name, SQObject* returnObj, const char* signature)
{
return __sq_getfunction(sqvm, name, returnObj, signature);
}
- inline SQRESULT getasset(HSquirrelVM* sqvm, const SQInteger stackpos, const char** result)
+ inline SQRESULT getasset(HSQUIRRELVM sqvm, const SQInteger stackpos, const char** result)
{
return __sq_getasset(sqvm, stackpos, result);
}
- inline long long sq_stackinfos(HSquirrelVM* sqvm, int level, SQStackInfos& out)
+ inline long long sq_stackinfos(HSQUIRRELVM sqvm, int level, SQStackInfos& out)
{
return __sq_stackinfos(sqvm, level, &out, sqvm->_callstacksize);
}
- inline Mod* getcallingmod(HSquirrelVM* sqvm, int depth = 0)
+ inline Mod* getcallingmod(HSQUIRRELVM sqvm, int depth = 0)
{
SQStackInfos stackInfo {};
if (1 + depth >= sqvm->_callstacksize)
@@ -211,26 +211,26 @@ public:
}
return nullptr;
}
- template <typename T> inline SQRESULT getuserdata(HSquirrelVM* sqvm, const SQInteger stackpos, T* data, uint64_t* typeId)
+ template <typename T> inline SQRESULT getuserdata(HSQUIRRELVM sqvm, const SQInteger stackpos, T* data, uint64_t* typeId)
{
return __sq_getuserdata(sqvm, stackpos, (void**)data, typeId); // this sometimes crashes idk
}
- template <typename T> inline T* createuserdata(HSquirrelVM* sqvm, SQInteger size)
+ template <typename T> inline T* createuserdata(HSQUIRRELVM sqvm, SQInteger size)
{
void* ret = __sq_createuserdata(sqvm, size);
memset(ret, 0, size);
return (T*)ret;
}
- inline SQRESULT setuserdatatypeid(HSquirrelVM* sqvm, const SQInteger stackpos, uint64_t typeId)
+ inline SQRESULT setuserdatatypeid(HSQUIRRELVM sqvm, const SQInteger stackpos, uint64_t typeId)
{
return __sq_setuserdatatypeid(sqvm, stackpos, typeId);
}
- template <typename T> inline SQBool getthisentity(HSquirrelVM* sqvm, T* ppEntity) { return __sq_getthisentity(sqvm, (void**)ppEntity); }
+ template <typename T> inline SQBool getthisentity(HSQUIRRELVM sqvm, T* ppEntity) { return __sq_getthisentity(sqvm, (void**)ppEntity); }
- template <typename T> inline T* getentity(HSquirrelVM* sqvm, SQInteger iStackPos)
+ template <typename T> inline T* getentity(HSQUIRRELVM sqvm, SQInteger iStackPos)
{
SQObject obj;
__sq_getobject(sqvm, iStackPos, &obj);
@@ -239,9 +239,9 @@ public:
return (T*)__sq_getentityfrominstance(m_pSQVM, &obj, __sq_GetEntityConstant_CBaseEntity());
}
- inline SQRESULT pushnewstructinstance(HSquirrelVM* sqvm, const int fieldCount) { return __sq_pushnewstructinstance(sqvm, fieldCount); }
+ inline SQRESULT pushnewstructinstance(HSQUIRRELVM sqvm, const int fieldCount) { return __sq_pushnewstructinstance(sqvm, fieldCount); }
- inline SQRESULT sealstructslot(HSquirrelVM* sqvm, const int fieldIndex) { return __sq_sealstructslot(sqvm, fieldIndex); }
+ inline SQRESULT sealstructslot(HSQUIRRELVM sqvm, const int fieldIndex) { return __sq_sealstructslot(sqvm, fieldIndex); }
#pragma endregion
};
diff --git a/primedev/squirrel/squirrelautobind.h b/primedev/squirrel/squirrelautobind.h
index 0fc599f3..cb1d2108 100644
--- a/primedev/squirrel/squirrelautobind.h
+++ b/primedev/squirrel/squirrelautobind.h
@@ -15,7 +15,7 @@ extern SquirrelAutoBindContainer* g_pSqAutoBindContainer;
class __squirrelautobind;
#define ADD_SQFUNC(returnType, funcName, argTypes, helpText, runOnContext) \
- template <ScriptContext context> SQRESULT CONCAT2(Script_, funcName)(HSquirrelVM * sqvm); \
+ template <ScriptContext context> SQRESULT CONCAT2(Script_, funcName)(HSQUIRRELVM sqvm); \
namespace \
{ \
__squirrelautobind CONCAT2(__squirrelautobind, __LINE__)( \
@@ -35,10 +35,10 @@ class __squirrelautobind;
returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \
}); \
} \
- template <ScriptContext context> SQRESULT CONCAT2(Script_, funcName)(HSquirrelVM * sqvm)
+ template <ScriptContext context> SQRESULT CONCAT2(Script_, funcName)(HSQUIRRELVM sqvm)
#define REPLACE_SQFUNC(funcName, runOnContext) \
- template <ScriptContext context> SQRESULT CONCAT2(Script_, funcName)(HSquirrelVM * sqvm); \
+ template <ScriptContext context> SQRESULT CONCAT2(Script_, funcName)(HSQUIRRELVM sqvm); \
namespace \
{ \
__squirrelautobind CONCAT2(__squirrelautobind, __LINE__)( \
@@ -57,7 +57,7 @@ class __squirrelautobind;
__STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \
}); \
} \
- template <ScriptContext context> SQRESULT CONCAT2(Script_, funcName)(HSquirrelVM * sqvm)
+ template <ScriptContext context> SQRESULT CONCAT2(Script_, funcName)(HSQUIRRELVM sqvm)
class __squirrelautobind
{
diff --git a/primedev/squirrel/squirrelclasstypes.h b/primedev/squirrel/squirrelclasstypes.h
index 55897b69..f53f6d18 100644
--- a/primedev/squirrel/squirrelclasstypes.h
+++ b/primedev/squirrel/squirrelclasstypes.h
@@ -1,83 +1,14 @@
#pragma once
-#include "squirreldatatypes.h"
-#include <queue>
-
-enum SQRESULT : SQInteger
-{
- SQRESULT_ERROR = -1,
- SQRESULT_NULL = 0,
- SQRESULT_NOTNULL = 1,
-};
-
-typedef SQRESULT (*SQFunction)(HSquirrelVM* sqvm);
+#include "vscript/vscript.h"
-enum class eSQReturnType
-{
- Float = 0x1,
- Vector = 0x3,
- Integer = 0x5,
- Boolean = 0x6,
- Entity = 0xD,
- String = 0x21,
- Default = 0x20,
- Arrays = 0x25,
- Asset = 0x28,
- Table = 0x26,
-};
+#include <queue>
const std::map<SQRESULT, const char*> PrintSQRESULT = {
{SQRESULT::SQRESULT_ERROR, "SQRESULT_ERROR"},
{SQRESULT::SQRESULT_NULL, "SQRESULT_NULL"},
{SQRESULT::SQRESULT_NOTNULL, "SQRESULT_NOTNULL"}};
-struct CompileBufferState
-{
- const SQChar* buffer;
- const SQChar* bufferPlusLength;
- const SQChar* bufferAgain;
-
- CompileBufferState(const std::string& code)
- {
- buffer = code.c_str();
- bufferPlusLength = code.c_str() + code.size();
- bufferAgain = code.c_str();
- }
-};
-
-struct SQFuncRegistration
-{
- const char* squirrelFuncName;
- const char* cppFuncName;
- const char* helpText;
- const char* returnTypeString;
- const char* argTypes;
- uint32_t unknown1;
- uint32_t devLevel;
- const char* shortNameMaybe;
- uint32_t unknown2;
- eSQReturnType returnType;
- uint32_t* externalBufferPointer;
- uint64_t externalBufferSize;
- uint64_t unknown3;
- uint64_t unknown4;
- SQFunction funcPtr;
-
- SQFuncRegistration()
- {
- memset(this, 0, sizeof(SQFuncRegistration));
- this->returnType = eSQReturnType::Default;
- }
-};
-
-enum class ScriptContext : int
-{
- INVALID = -1,
- SERVER,
- CLIENT,
- UI,
-};
-
typedef std::vector<std::function<void()>> FunctionVector;
typedef std::function<void()> VoidFunction;
@@ -185,56 +116,56 @@ typedef int64_t (*RegisterSquirrelFuncType)(CSquirrelVM* sqvm, SQFuncRegistratio
typedef void (*sq_defconstType)(CSquirrelVM* sqvm, const SQChar* name, int value);
typedef SQRESULT (*sq_compilebufferType)(
- HSquirrelVM* sqvm, CompileBufferState* compileBuffer, const char* file, int a1, SQBool bShouldThrowError);
-typedef SQRESULT (*sq_callType)(HSquirrelVM* sqvm, SQInteger iArgs, SQBool bShouldReturn, SQBool bThrowError);
-typedef SQInteger (*sq_raiseerrorType)(HSquirrelVM* sqvm, const SQChar* pError);
+ HSQUIRRELVM sqvm, SQBufferState* compileBuffer, const char* file, int a1, SQBool bShouldThrowError);
+typedef SQRESULT (*sq_callType)(HSQUIRRELVM sqvm, SQInteger iArgs, SQBool bShouldReturn, SQBool bThrowError);
+typedef SQInteger (*sq_raiseerrorType)(HSQUIRRELVM sqvm, const SQChar* pError);
typedef bool (*sq_compilefileType)(CSquirrelVM* sqvm, const char* path, const char* name, int a4);
// sq stack array funcs
-typedef void (*sq_newarrayType)(HSquirrelVM* sqvm, SQInteger iStackpos);
-typedef SQRESULT (*sq_arrayappendType)(HSquirrelVM* sqvm, SQInteger iStackpos);
+typedef void (*sq_newarrayType)(HSQUIRRELVM sqvm, SQInteger iStackpos);
+typedef SQRESULT (*sq_arrayappendType)(HSQUIRRELVM sqvm, SQInteger iStackpos);
// sq table funcs
-typedef SQRESULT (*sq_newtableType)(HSquirrelVM* sqvm);
-typedef SQRESULT (*sq_newslotType)(HSquirrelVM* sqvm, SQInteger idx, SQBool bStatic);
+typedef SQRESULT (*sq_newtableType)(HSQUIRRELVM sqvm);
+typedef SQRESULT (*sq_newslotType)(HSQUIRRELVM sqvm, SQInteger idx, SQBool bStatic);
// sq stack push funcs
-typedef void (*sq_pushroottableType)(HSquirrelVM* sqvm);
-typedef void (*sq_pushstringType)(HSquirrelVM* sqvm, const SQChar* pStr, SQInteger iLength);
-typedef void (*sq_pushintegerType)(HSquirrelVM* sqvm, SQInteger i);
-typedef void (*sq_pushfloatType)(HSquirrelVM* sqvm, SQFloat f);
-typedef void (*sq_pushboolType)(HSquirrelVM* sqvm, SQBool b);
-typedef void (*sq_pushassetType)(HSquirrelVM* sqvm, const SQChar* str, SQInteger iLength);
-typedef void (*sq_pushvectorType)(HSquirrelVM* sqvm, const SQFloat* pVec);
-typedef void (*sq_pushobjectType)(HSquirrelVM* sqvm, SQObject* pVec);
+typedef void (*sq_pushroottableType)(HSQUIRRELVM sqvm);
+typedef void (*sq_pushstringType)(HSQUIRRELVM sqvm, const SQChar* pStr, SQInteger iLength);
+typedef void (*sq_pushintegerType)(HSQUIRRELVM sqvm, SQInteger i);
+typedef void (*sq_pushfloatType)(HSQUIRRELVM sqvm, SQFloat f);
+typedef void (*sq_pushboolType)(HSQUIRRELVM sqvm, SQBool b);
+typedef void (*sq_pushassetType)(HSQUIRRELVM sqvm, const SQChar* str, SQInteger iLength);
+typedef void (*sq_pushvectorType)(HSQUIRRELVM sqvm, const SQFloat* pVec);
+typedef void (*sq_pushobjectType)(HSQUIRRELVM sqvm, SQObject* pVec);
// sq stack get funcs
-typedef const SQChar* (*sq_getstringType)(HSquirrelVM* sqvm, SQInteger iStackpos);
-typedef SQInteger (*sq_getintegerType)(HSquirrelVM* sqvm, SQInteger iStackpos);
-typedef SQFloat (*sq_getfloatType)(HSquirrelVM*, SQInteger iStackpos);
-typedef SQBool (*sq_getboolType)(HSquirrelVM*, SQInteger iStackpos);
-typedef SQRESULT (*sq_getType)(HSquirrelVM* sqvm, SQInteger iStackpos);
-typedef SQRESULT (*sq_getassetType)(HSquirrelVM* sqvm, SQInteger iStackpos, const char** pResult);
-typedef SQRESULT (*sq_getuserdataType)(HSquirrelVM* sqvm, SQInteger iStackpos, void** pData, uint64_t* pTypeId);
-typedef SQFloat* (*sq_getvectorType)(HSquirrelVM* sqvm, SQInteger iStackpos);
-typedef SQBool (*sq_getthisentityType)(HSquirrelVM*, void** ppEntity);
-typedef void (*sq_getobjectType)(HSquirrelVM*, SQInteger iStackPos, SQObject* pOutObj);
-
-typedef long long (*sq_stackinfosType)(HSquirrelVM* sqvm, int iLevel, SQStackInfos* pOutObj, int iCallStackSize);
+typedef const SQChar* (*sq_getstringType)(HSQUIRRELVM sqvm, SQInteger iStackpos);
+typedef SQInteger (*sq_getintegerType)(HSQUIRRELVM sqvm, SQInteger iStackpos);
+typedef SQFloat (*sq_getfloatType)(HSQUIRRELVM, SQInteger iStackpos);
+typedef SQBool (*sq_getboolType)(HSQUIRRELVM, SQInteger iStackpos);
+typedef SQRESULT (*sq_getType)(HSQUIRRELVM sqvm, SQInteger iStackpos);
+typedef SQRESULT (*sq_getassetType)(HSQUIRRELVM sqvm, SQInteger iStackpos, const char** pResult);
+typedef SQRESULT (*sq_getuserdataType)(HSQUIRRELVM sqvm, SQInteger iStackpos, void** pData, uint64_t* pTypeId);
+typedef SQFloat* (*sq_getvectorType)(HSQUIRRELVM sqvm, SQInteger iStackpos);
+typedef SQBool (*sq_getthisentityType)(HSQUIRRELVM, void** ppEntity);
+typedef void (*sq_getobjectType)(HSQUIRRELVM, SQInteger iStackPos, SQObject* pOutObj);
+
+typedef long long (*sq_stackinfosType)(HSQUIRRELVM sqvm, int iLevel, SQStackInfos* pOutObj, int iCallStackSize);
// sq stack userpointer funcs
-typedef void* (*sq_createuserdataType)(HSquirrelVM* sqvm, SQInteger iSize);
-typedef SQRESULT (*sq_setuserdatatypeidType)(HSquirrelVM* sqvm, SQInteger iStackpos, uint64_t iTypeId);
+typedef void* (*sq_createuserdataType)(HSQUIRRELVM sqvm, SQInteger iSize);
+typedef SQRESULT (*sq_setuserdatatypeidType)(HSQUIRRELVM sqvm, SQInteger iStackpos, uint64_t iTypeId);
// sq misc entity funcs
typedef void* (*sq_getentityfrominstanceType)(CSquirrelVM* sqvm, SQObject* pInstance, char** ppEntityConstant);
typedef SQObject* (*sq_createscriptinstanceType)(void* ent);
typedef char** (*sq_GetEntityConstantType)();
-typedef int (*sq_getfunctionType)(HSquirrelVM* sqvm, const char* name, SQObject* returnObj, const char* signature);
+typedef int (*sq_getfunctionType)(HSQUIRRELVM sqvm, const char* name, SQObject* returnObj, const char* signature);
// structs
-typedef SQRESULT (*sq_pushnewstructinstanceType)(HSquirrelVM* sqvm, int fieldCount);
-typedef SQRESULT (*sq_sealstructslotType)(HSquirrelVM* sqvm, int slotIndex);
+typedef SQRESULT (*sq_pushnewstructinstanceType)(HSQUIRRELVM sqvm, int fieldCount);
+typedef SQRESULT (*sq_sealstructslotType)(HSQUIRRELVM sqvm, int slotIndex);
#pragma endregion
diff --git a/primedev/squirrel/squirreldatatypes.h b/primedev/squirrel/squirreldatatypes.h
deleted file mode 100644
index 84ab15ec..00000000
--- a/primedev/squirrel/squirreldatatypes.h
+++ /dev/null
@@ -1,501 +0,0 @@
-#pragma once
-/*
- This file has been generated by IDA.
- It contains local type definitions from
- the type library 'server.dll'
-*/
-
-struct HSquirrelVM;
-struct CallInfo;
-struct SQTable;
-struct SQString;
-struct SQFunctionProto;
-struct SQClosure;
-struct SQSharedState;
-struct StringTable;
-struct SQStructInstance;
-struct SQStructDef;
-struct SQNativeClosure;
-struct SQArray;
-struct tableNode;
-struct SQUserData;
-struct CSquirrelVM;
-
-typedef void (*releasehookType)(void* val, int size);
-
-// stolen from ttf2sdk: sqvm types
-typedef float SQFloat;
-typedef long SQInteger;
-typedef unsigned long SQUnsignedInteger;
-typedef char SQChar;
-typedef SQUnsignedInteger SQBool;
-
-/* 127 */
-enum SQObjectType : int
-{
- _RT_NULL = 0x1,
- _RT_INTEGER = 0x2,
- _RT_FLOAT = 0x4,
- _RT_BOOL = 0x8,
- _RT_STRING = 0x10,
- _RT_TABLE = 0x20,
- _RT_ARRAY = 0x40,
- _RT_USERDATA = 0x80,
- _RT_CLOSURE = 0x100,
- _RT_NATIVECLOSURE = 0x200,
- _RT_GENERATOR = 0x400,
- OT_USERPOINTER = 0x800,
- _RT_USERPOINTER = 0x800,
- _RT_THREAD = 0x1000,
- _RT_FUNCPROTO = 0x2000,
- _RT_CLASS = 0x4000,
- _RT_INSTANCE = 0x8000,
- _RT_WEAKREF = 0x10000,
- OT_VECTOR = 0x40000,
- SQOBJECT_CANBEFALSE = 0x1000000,
- OT_NULL = 0x1000001,
- OT_BOOL = 0x1000008,
- SQOBJECT_DELEGABLE = 0x2000000,
- SQOBJECT_NUMERIC = 0x4000000,
- OT_INTEGER = 0x5000002,
- OT_FLOAT = 0x5000004,
- SQOBJECT_REF_COUNTED = 0x8000000,
- OT_STRING = 0x8000010,
- OT_ARRAY = 0x8000040,
- OT_CLOSURE = 0x8000100,
- OT_NATIVECLOSURE = 0x8000200,
- OT_ASSET = 0x8000400,
- OT_THREAD = 0x8001000,
- OT_FUNCPROTO = 0x8002000,
- OT_CLAAS = 0x8004000,
- OT_STRUCT = 0x8200000,
- OT_WEAKREF = 0x8010000,
- OT_TABLE = 0xA000020,
- OT_USERDATA = 0xA000080,
- OT_INSTANCE = 0xA008000,
- OT_ENTITY = 0xA400000,
-};
-
-/* 156 */
-union SQObjectValue
-{
- SQString* asString;
- SQTable* asTable;
- SQClosure* asClosure;
- SQFunctionProto* asFuncProto;
- SQStructDef* asStructDef;
- long long as64Integer;
- SQNativeClosure* asNativeClosure;
- SQArray* asArray;
- HSquirrelVM* asThread;
- float asFloat;
- int asInteger;
- SQUserData* asUserdata;
- SQStructInstance* asStructInstance;
-};
-
-/* 160 */
-struct SQVector
-{
- SQObjectType _Type;
- float x;
- float y;
- float z;
-};
-
-/* 128 */
-struct SQObject
-{
- SQObjectType _Type;
- int structNumber;
- SQObjectValue _VAL;
-};
-
-/* 138 */
-struct alignas(8) SQString
-{
- void* vftable;
- int uiRef;
- int padding;
- SQString* _next_maybe;
- SQSharedState* sharedState;
- int length;
- unsigned char gap_24[4];
- char _hash[8];
- char _val[1];
-};
-
-/* 137 */
-struct alignas(8) SQTable
-{
- void* vftable;
- unsigned char gap_08[4];
- int uiRef;
- unsigned char gap_10[8];
- void* pointer_18;
- void* pointer_20;
- void* _sharedState;
- long long field_30;
- tableNode* _nodes;
- int _numOfNodes;
- int size;
- int field_48;
- int _usedNodes;
- unsigned char _gap_50[20];
- int field_64;
- unsigned char _gap_68[80];
-};
-
-/* 140 */
-struct alignas(8) SQClosure
-{
- void* vftable;
- unsigned char gap_08[4];
- int uiRef;
- void* pointer_10;
- void* pointer_18;
- void* pointer_20;
- void* sharedState;
- SQObject obj_30;
- SQObject _function;
- SQObject* _outervalues;
- unsigned char gap_58[8];
- unsigned char gap_60[96];
- SQObject* objectPointer_C0;
- unsigned char gap_C8[16];
-};
-
-/* 139 */
-struct alignas(8) SQFunctionProto
-{
- void* vftable;
- unsigned char gap_08[4];
- int uiRef;
- unsigned char gap_10[8];
- void* pointer_18;
- void* pointer_20;
- void* sharedState;
- void* pointer_30;
- SQObjectType _fileNameType;
- SQString* _fileName;
- SQObjectType _funcNameType;
- SQString* _funcName;
- SQObject obj_58;
- unsigned char gap_68[12];
- int _stacksize;
- unsigned char gap_78[48];
- int nParameters;
- unsigned char gap_AC[60];
- int nDefaultParams;
- unsigned char gap_EC[200];
-};
-
-/* 152 */
-struct SQStructDef
-{
- void* vtable;
- int uiRef;
- unsigned char padding_C[4];
- unsigned char unknown[24];
- SQSharedState* sharedState;
- SQObjectType _nameType;
- SQString* _name;
- unsigned char gap_38[16];
- SQObjectType _variableNamesType;
- SQTable* _variableNames;
- unsigned char gap_[32];
-};
-
-/* 157 */
-struct alignas(8) SQNativeClosure
-{
- void* vftable;
- int uiRef;
- unsigned char gap_C[4];
- long long value_10;
- long long value_18;
- long long value_20;
- SQSharedState* sharedState;
- char unknown_30;
- unsigned char padding_34[7];
- long long value_38;
- long long value_40;
- long long value_48;
- long long value_50;
- long long value_58;
- SQObjectType _nameType;
- SQString* _name;
- long long value_70;
- long long value_78;
- unsigned char justInCaseGap_80[300];
-};
-
-/* 162 */
-struct SQArray
-{
- void* vftable;
- int uiRef;
- unsigned char gap_24[36];
- SQObject* _values;
- int _usedSlots;
- int _allocated;
-};
-
-/* 129 */
-struct alignas(8) HSquirrelVM
-{
- void* vftable;
- int uiRef;
- unsigned char gap_8[12];
- void* _toString;
- void* _roottable_pointer;
- void* pointer_28;
- CallInfo* ci;
- CallInfo* _callstack;
- int _callstacksize;
- int _stackbase;
- SQObject* _stackOfCurrentFunction;
- SQSharedState* sharedState;
- void* pointer_58;
- void* pointer_60;
- int _top;
- SQObject* _stack;
- unsigned char gap_78[8];
- SQObject* _vargvstack;
- unsigned char gap_88[8];
- SQObject temp_reg;
- unsigned char gapA0[8];
- void* pointer_A8;
- unsigned char gap_B0[8];
- SQObject _roottable_object;
- SQObject _lasterror;
- SQObject _errorHandler;
- long long field_E8;
- int traps;
- unsigned char gap_F4[12];
- int _nnativecalls;
- int _suspended;
- int _suspended_root;
- int _unk;
- int _suspended_target;
- int trapAmount;
- int _suspend_varargs;
- int unknown_field_11C;
- SQObject object_120;
-};
-
-/* 150 */
-struct SQStructInstance
-{
- void* vftable;
- __int32 uiRef;
- BYTE gap_C[4];
- __int64 unknown_10;
- void* pointer_18;
- __int64 unknown_20;
- SQSharedState* _sharedState;
- unsigned int size;
- BYTE gap_34[4];
- SQObject data[1]; // This struct is dynamically sized, so this size is unknown
-};
-
-/* 148 */
-struct SQSharedState
-{
- unsigned char gap_0[72];
- void* unknown;
- unsigned char gap_50[16344];
- SQObjectType _unknownTableType00;
- long long _unknownTableValue00;
- unsigned char gap_4038[16];
- StringTable* _stringTable;
- unsigned char gap_4050[32];
- SQObjectType _unknownTableType0;
- long long _unknownTableValue0;
- SQObjectType _unknownObjectType1;
- long long _unknownObjectValue1;
- unsigned char gap_4090[8];
- SQObjectType _unknownArrayType2;
- long long _unknownArrayValue2;
- SQObjectType _gobalsArrayType;
- SQStructInstance* _globalsArray;
- unsigned char gap_40B8[16];
- SQObjectType _nativeClosuresType;
- SQTable* _nativeClosures;
- SQObjectType _typedConstantsType;
- SQTable* _typedConstants;
- SQObjectType _untypedConstantsType;
- SQTable* _untypedConstants;
- SQObjectType _globalsMaybeType;
- SQTable* _globals;
- SQObjectType _functionsType;
- SQTable* _functions;
- SQObjectType _structsType;
- SQTable* _structs;
- SQObjectType _typeDefsType;
- SQTable* _typeDefs;
- SQObjectType unknownTableType;
- SQTable* unknownTable;
- SQObjectType _squirrelFilesType;
- SQTable* _squirrelFiles;
- unsigned char gap_4158[80];
- SQObjectType _nativeClosures2Type;
- SQTable* _nativeClosures2;
- SQObjectType _entityTypesMaybeType;
- SQTable* _entityTypesMaybe;
- SQObjectType unknownTable2Type;
- SQTable* unknownTable2;
- unsigned char gap_41D8[72];
- SQObjectType _compilerKeywordsType;
- SQTable* _compilerKeywords;
- HSquirrelVM* _currentThreadMaybe;
- unsigned char gap_4238[8];
- SQObjectType unknownTable3Type;
- SQTable* unknownTable3;
- unsigned char gap_4250[16];
- SQObjectType unknownThreadType;
- SQTable* unknownThread;
- SQObjectType _tableNativeFunctionsType;
- SQTable* _tableNativeFunctions;
- SQObjectType _unknownTableType4;
- long long _unknownObjectValue4;
- SQObjectType _unknownObjectType5;
- long long _unknownObjectValue5;
- SQObjectType _unknownObjectType6;
- long long _unknownObjectValue6;
- SQObjectType _unknownObjectType7;
- long long _unknownObjectValue7;
- SQObjectType _unknownObjectType8;
- long long _unknownObjectValue8;
- SQObjectType _unknownObjectType9;
- long long _unknownObjectValue9;
- SQObjectType _unknownObjectType10;
- long long _unknownObjectValue10;
- SQObjectType _unknownObjectType11;
- long long _unknownObjectValue11;
- SQObjectType _unknownObjectType12;
- long long _unknownObjectValue12;
- SQObjectType _unknownObjectType13;
- long long _unknownObjectValue13;
- SQObjectType _unknownObjectType14;
- long long _unknownObjectValue14;
- SQObjectType _unknownObjectType15;
- long long _unknownObjectValue15;
- unsigned char gap_4340[16];
- void* printFunction;
- unsigned char gap_4358[16];
- void* logEntityFunction;
- unsigned char gap_4370[40];
- SQObjectType _waitStringType;
- SQString* _waitStringValue;
- SQObjectType _SpinOffAndWaitForStringType;
- SQString* _SpinOffAndWaitForStringValue;
- SQObjectType _SpinOffAndWaitForSoloStringType;
- SQString* _SpinOffAndWaitForSoloStringValue;
- SQObjectType _SpinOffStringType;
- SQString* _SpinOffStringValue;
- SQObjectType _SpinOffDelayedStringType;
- SQString* _SpinOffDelayedStringValue;
- CSquirrelVM* cSquirrelVM;
- bool enableDebugInfo; // functionality stripped
- unsigned char gap_43F1[23];
-};
-
-/* 165 */
-struct tableNode
-{
- SQObject val;
- SQObject key;
- tableNode* next;
-};
-
-/* 136 */
-struct alignas(8) CallInfo
-{
- long long ip;
- SQObject* _literals;
- SQObject obj10;
- SQObject closure;
- int _etraps[4];
- int _root;
- short _vargs_size;
- short _vargs_base;
- unsigned char gap[16];
-};
-
-/* 149 */
-struct StringTable
-{
- unsigned char gap_0[12];
- int _numofslots;
- unsigned char gap_10[200];
-};
-
-/* 141 */
-struct alignas(8) SQStackInfos
-{
- char* _name;
- char* _sourceName;
- int _line;
-};
-
-/* 151 */
-struct alignas(4) SQInstruction
-{
- int op;
- int arg1;
- int output;
- short arg2;
- short arg3;
-};
-
-/* 154 */
-struct SQLexer
-{
- unsigned char gap_0[112];
-};
-
-/* 153 */
-struct SQCompiler
-{
- unsigned char gap_0[4];
- int _token;
- unsigned char gap_8[8];
- SQObject object_10;
- SQLexer lexer;
- unsigned char gap_90[752];
- HSquirrelVM* sqvm;
- unsigned char gap_288[8];
-};
-
-/* 155 */
-struct CSquirrelVM
-{
- BYTE gap_0[8];
- HSquirrelVM* sqvm;
- BYTE gap_10[8];
- SQObject unknownObject_18;
- __int64 unknown_28;
- BYTE gap_30[12];
- __int32 vmContext;
- BYTE gap_40[648];
- char* (*formatString)(__int64 a1, const char* format, ...);
- BYTE gap_2D0[24];
-};
-
-struct SQUserData
-{
- void* vftable;
- int uiRef;
- char gap_12[4];
- long long unknown_10;
- long long unknown_18;
- long long unknown_20;
- long long sharedState;
- long long unknown_30;
- int size;
- char padding1[4];
- releasehookType releaseHook;
- long long typeId;
- char data[1];
-};
diff --git a/primedev/vscript/languages/squirrel_re/include/squirrel.h b/primedev/vscript/languages/squirrel_re/include/squirrel.h
new file mode 100644
index 00000000..b068ff06
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/include/squirrel.h
@@ -0,0 +1,95 @@
+#pragma once
+
+class Mod;
+struct SQBufferState;
+class CBaseEntity;
+
+struct SQVM;
+struct SQObject;
+struct SQTable;
+struct SQArray;
+struct SQString;
+struct SQClosure;
+struct SQFunctionProto;
+struct SQStructDef;
+struct SQNativeClosure;
+struct SQStructInstance;
+struct SQUserData;
+struct SQSharedState;
+
+typedef float SQFloat;
+typedef long SQInteger;
+typedef unsigned long SQUnsignedInteger;
+typedef char SQChar;
+typedef SQUnsignedInteger SQBool;
+
+typedef SQVM* HSQUIRRELVM;
+
+enum SQRESULT : SQInteger
+{
+ SQRESULT_ERROR = -1,
+ SQRESULT_NULL = 0,
+ SQRESULT_NOTNULL = 1,
+};
+
+enum class eSQReturnType
+{
+ Float = 0x1,
+ Vector = 0x3,
+ Integer = 0x5,
+ Boolean = 0x6,
+ Entity = 0xD,
+ String = 0x21,
+ Default = 0x20,
+ Arrays = 0x25,
+ Asset = 0x28,
+ Table = 0x26,
+};
+
+struct SQBufferState
+{
+ const SQChar* buffer;
+ const SQChar* bufferPlusLength;
+ const SQChar* bufferAgain;
+
+ SQBufferState(const SQChar* pszCode)
+ {
+ buffer = pszCode;
+ bufferPlusLength = pszCode + strlen(pszCode);
+ bufferAgain = pszCode;
+ }
+};
+
+typedef SQRESULT (*SQFunction)(HSQUIRRELVM sqvm);
+
+struct SQFuncRegistration
+{
+ const char* squirrelFuncName;
+ const char* cppFuncName;
+ const char* helpText;
+ const char* returnTypeString;
+ const char* argTypes;
+ uint32_t unknown1;
+ uint32_t devLevel;
+ const char* shortNameMaybe;
+ uint32_t unknown2;
+ eSQReturnType returnType;
+ uint32_t* externalBufferPointer;
+ uint64_t externalBufferSize;
+ uint64_t unknown3;
+ uint64_t unknown4;
+ SQFunction funcPtr;
+
+ SQFuncRegistration()
+ {
+ memset(this, 0, sizeof(SQFuncRegistration));
+ this->returnType = eSQReturnType::Default;
+ }
+};
+
+struct alignas(8) SQStackInfos
+{
+ char* _name;
+ char* _sourceName;
+ int _line;
+};
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqarray.h b/primedev/vscript/languages/squirrel_re/squirrel/sqarray.h
new file mode 100644
index 00000000..3214dc81
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqarray.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+#include "vscript/languages/squirrel_re/squirrel/sqobject.h"
+
+struct SQArray : public SQCollectable
+{
+ SQObject* _values;
+ int _usedSlots;
+ int _allocated;
+};
+static_assert(sizeof(SQArray) == 0x40);
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqclosure.h b/primedev/vscript/languages/squirrel_re/squirrel/sqclosure.h
new file mode 100644
index 00000000..85c3adef
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqclosure.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+#include "vscript/languages/squirrel_re/squirrel/sqobject.h"
+
+struct alignas(8) SQClosure : public SQCollectable
+{
+ SQObject obj_30;
+ SQObject _function;
+ SQObject* _outervalues;
+ unsigned char gap_58[8];
+};
+static_assert(sizeof(SQClosure) == 96);
+
+struct alignas(8) SQNativeClosure : public SQCollectable
+{
+ char unknown_30;
+ unsigned char padding_34[7];
+ long long value_38;
+ long long value_40;
+ long long value_48;
+ long long value_50;
+ long long value_58;
+ SQObjectType _nameType;
+ SQString* _name;
+ long long value_70;
+ long long value_78;
+};
+static_assert(sizeof(SQNativeClosure) == 128);
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqcompiler.h b/primedev/vscript/languages/squirrel_re/squirrel/sqcompiler.h
new file mode 100644
index 00000000..5a54751c
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqcompiler.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+#include "vscript/languages/squirrel_re/squirrel/sqlexer.h"
+
+struct SQCompiler
+{
+ BYTE gap0[4];
+ int _token;
+ BYTE gap_8[8];
+ SQObject object_10;
+ SQLexer lexer;
+ int64_t qword90;
+ int64_t qword98;
+ BYTE gapA0[280];
+ bool bFatalError;
+ BYTE gap1B9[143];
+ int64_t qword248;
+ int64_t qword250;
+ int64_t qword258;
+ int64_t qword260;
+ BYTE gap268[280];
+ HSQUIRRELVM pSQVM;
+ unsigned char gap_288[8];
+};
+static_assert(sizeof(SQCompiler) == 0x390);
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqfunctionproto.h b/primedev/vscript/languages/squirrel_re/squirrel/sqfunctionproto.h
new file mode 100644
index 00000000..77bec7eb
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqfunctionproto.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+#include "vscript/languages/squirrel_re/squirrel/sqobject.h"
+
+// NOTE [Fifty]: Variable sized struct
+struct alignas(8) SQFunctionProto : public SQCollectable
+{
+ void* pointer_30;
+ SQObjectType _fileNameType;
+ SQString* _fileName;
+ SQObjectType _funcNameType;
+ SQString* _funcName;
+ SQObject obj_58;
+ unsigned char gap_68[12];
+ int _stacksize;
+ unsigned char gap_78[48];
+ int nParameters;
+ unsigned char gap_AC[60];
+ int nDefaultParams;
+ unsigned char gap_EC[200];
+};
+// TODO [Fifty]: Find out the size of the base struct
+static_assert(offsetof(SQFunctionProto, _fileName) == 0x40); // Sanity this check for now
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqlexer.h b/primedev/vscript/languages/squirrel_re/squirrel/sqlexer.h
new file mode 100644
index 00000000..dc19bea8
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqlexer.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+
+// TODO [Fifty]: Verify size
+struct SQLexer
+{
+ unsigned char gap_0[112];
+};
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqobject.h b/primedev/vscript/languages/squirrel_re/squirrel/sqobject.h
new file mode 100644
index 00000000..ea5c0da9
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqobject.h
@@ -0,0 +1,93 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+
+struct SQTable;
+
+struct SQRefCounted
+{
+ void* vftable;
+ SQInteger uiRef;
+ void* weakRef; // Probably
+};
+
+struct SQCollectable : public SQRefCounted
+{
+ SQCollectable* _next;
+ SQCollectable* _prev;
+ SQSharedState* _sharedstate;
+};
+
+struct SQDelegable : public SQCollectable
+{
+ SQTable* _delegate;
+};
+
+enum SQObjectType : int
+{
+ _RT_NULL = 0x1,
+ _RT_INTEGER = 0x2,
+ _RT_FLOAT = 0x4,
+ _RT_BOOL = 0x8,
+ _RT_STRING = 0x10,
+ _RT_TABLE = 0x20,
+ _RT_ARRAY = 0x40,
+ _RT_USERDATA = 0x80,
+ _RT_CLOSURE = 0x100,
+ _RT_NATIVECLOSURE = 0x200,
+ _RT_GENERATOR = 0x400,
+ OT_USERPOINTER = 0x800,
+ _RT_USERPOINTER = 0x800,
+ _RT_THREAD = 0x1000,
+ _RT_FUNCPROTO = 0x2000,
+ _RT_CLASS = 0x4000,
+ _RT_INSTANCE = 0x8000,
+ _RT_WEAKREF = 0x10000,
+ OT_VECTOR = 0x40000,
+ SQOBJECT_CANBEFALSE = 0x1000000,
+ OT_NULL = 0x1000001,
+ OT_BOOL = 0x1000008,
+ SQOBJECT_DELEGABLE = 0x2000000,
+ SQOBJECT_NUMERIC = 0x4000000,
+ OT_INTEGER = 0x5000002,
+ OT_FLOAT = 0x5000004,
+ SQOBJECT_REF_COUNTED = 0x8000000,
+ OT_STRING = 0x8000010,
+ OT_ARRAY = 0x8000040,
+ OT_CLOSURE = 0x8000100,
+ OT_NATIVECLOSURE = 0x8000200,
+ OT_ASSET = 0x8000400,
+ OT_THREAD = 0x8001000,
+ OT_FUNCPROTO = 0x8002000,
+ OT_CLAAS = 0x8004000,
+ OT_STRUCT = 0x8200000,
+ OT_WEAKREF = 0x8010000,
+ OT_TABLE = 0xA000020,
+ OT_USERDATA = 0xA000080,
+ OT_INSTANCE = 0xA008000,
+ OT_ENTITY = 0xA400000,
+};
+
+union SQObjectValue
+{
+ SQString* asString;
+ SQTable* asTable;
+ SQClosure* asClosure;
+ SQFunctionProto* asFuncProto;
+ SQStructDef* asStructDef;
+ long long as64Integer;
+ SQNativeClosure* asNativeClosure;
+ SQArray* asArray;
+ HSQUIRRELVM asThread;
+ float asFloat;
+ int asInteger;
+ SQUserData* asUserdata;
+ SQStructInstance* asStructInstance;
+};
+
+struct SQObject
+{
+ SQObjectType _Type;
+ int structNumber;
+ SQObjectValue _VAL;
+};
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqopcodes.h b/primedev/vscript/languages/squirrel_re/squirrel/sqopcodes.h
new file mode 100644
index 00000000..be0756c1
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqopcodes.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+
+// TODO [Fifty]: Verify size
+struct alignas(4) SQInstruction
+{
+ int op;
+ int arg1;
+ int output;
+ short arg2;
+ short arg3;
+};
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqstate.h b/primedev/vscript/languages/squirrel_re/squirrel/sqstate.h
new file mode 100644
index 00000000..d5282ac7
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqstate.h
@@ -0,0 +1,120 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+
+class CSquirrelVM;
+struct SQCompiler;
+
+// TODO [Fifty]: Verify size
+struct StringTable
+{
+ unsigned char gap_0[12];
+ int _numofslots;
+ unsigned char gap_10[200];
+};
+
+struct SQSharedState
+{
+ unsigned char gap_0[72];
+ void* unknown;
+ unsigned char gap_50[16344];
+ SQObjectType _unknownTableType00;
+ long long _unknownTableValue00;
+ unsigned char gap_4038[16];
+ StringTable* _stringTable;
+ unsigned char gap_4050[32];
+ SQObjectType _unknownTableType0;
+ long long _unknownTableValue0;
+ SQObjectType _unknownObjectType1;
+ long long _unknownObjectValue1;
+ unsigned char gap_4090[8];
+ SQObjectType _unknownArrayType2;
+ long long _unknownArrayValue2;
+ SQObjectType _gobalsArrayType;
+ SQStructInstance* _globalsArray;
+ unsigned char gap_40B8[16];
+ SQObjectType _nativeClosuresType;
+ SQTable* _nativeClosures;
+ SQObjectType _typedConstantsType;
+ SQTable* _typedConstants;
+ SQObjectType _untypedConstantsType;
+ SQTable* _untypedConstants;
+ SQObjectType _globalsMaybeType;
+ SQTable* _globals;
+ SQObjectType _functionsType;
+ SQTable* _functions;
+ SQObjectType _structsType;
+ SQTable* _structs;
+ SQObjectType _typeDefsType;
+ SQTable* _typeDefs;
+ SQObjectType unknownTableType;
+ SQTable* unknownTable;
+ SQObjectType _squirrelFilesType;
+ SQTable* _squirrelFiles;
+ unsigned char gap_4158[80];
+ SQObjectType _nativeClosures2Type;
+ SQTable* _nativeClosures2;
+ SQObjectType _entityTypesMaybeType;
+ SQTable* _entityTypesMaybe;
+ SQObjectType unknownTable2Type;
+ SQTable* unknownTable2;
+ unsigned char gap_41D8[64];
+ SQCompiler* pCompiler;
+ SQObjectType _compilerKeywordsType;
+ SQTable* _compilerKeywords;
+ HSQUIRRELVM _currentThreadMaybe;
+ unsigned char gap_4238[8];
+ SQObjectType unknownTable3Type;
+ SQTable* unknownTable3;
+ unsigned char gap_4250[16];
+ SQObjectType unknownThreadType;
+ SQTable* unknownThread;
+ SQObjectType _tableNativeFunctionsType;
+ SQTable* _tableNativeFunctions;
+ SQObjectType _unknownTableType4;
+ long long _unknownObjectValue4;
+ SQObjectType _unknownObjectType5;
+ long long _unknownObjectValue5;
+ SQObjectType _unknownObjectType6;
+ long long _unknownObjectValue6;
+ SQObjectType _unknownObjectType7;
+ long long _unknownObjectValue7;
+ SQObjectType _unknownObjectType8;
+ long long _unknownObjectValue8;
+ SQObjectType _unknownObjectType9;
+ long long _unknownObjectValue9;
+ SQObjectType _unknownObjectType10;
+ long long _unknownObjectValue10;
+ SQObjectType _unknownObjectType11;
+ long long _unknownObjectValue11;
+ SQObjectType _unknownObjectType12;
+ long long _unknownObjectValue12;
+ SQObjectType _unknownObjectType13;
+ long long _unknownObjectValue13;
+ SQObjectType _unknownObjectType14;
+ long long _unknownObjectValue14;
+ SQObjectType _unknownObjectType15;
+ long long _unknownObjectValue15;
+ unsigned __int8 gap_4340[8];
+ void* fnFatalErrorCallback;
+ void* fnPrintCallback;
+ unsigned __int8 gap_4358[16];
+ void* logEntityFunction;
+ unsigned char gap_4370[1];
+ SQChar szContextName[8];
+ unsigned char gap[31];
+ SQObjectType _waitStringType;
+ SQString* _waitStringValue;
+ SQObjectType _SpinOffAndWaitForStringType;
+ SQString* _SpinOffAndWaitForStringValue;
+ SQObjectType _SpinOffAndWaitForSoloStringType;
+ SQString* _SpinOffAndWaitForSoloStringValue;
+ SQObjectType _SpinOffStringType;
+ SQString* _SpinOffStringValue;
+ SQObjectType _SpinOffDelayedStringType;
+ SQString* _SpinOffDelayedStringValue;
+ CSquirrelVM* cSquirrelVM;
+ bool enableDebugInfo; // functionality stripped
+ unsigned char gap_43F1[23];
+};
+static_assert(sizeof(SQSharedState) == 17416);
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqstring.h b/primedev/vscript/languages/squirrel_re/squirrel/sqstring.h
new file mode 100644
index 00000000..5b17f489
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqstring.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+#include "vscript/languages/squirrel_re/squirrel/sqobject.h"
+
+// NOTE [Fifty]: Variable sized struct
+struct alignas(8) SQString : public SQRefCounted
+{
+ SQSharedState* sharedState;
+ int length;
+ unsigned char gap_24[4];
+ char _hash[8];
+ char _val[1];
+};
+static_assert(sizeof(SQString) == 56); // [Fifty]: Game allocates 56 + strlen
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqstruct.h b/primedev/vscript/languages/squirrel_re/squirrel/sqstruct.h
new file mode 100644
index 00000000..1e357df8
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqstruct.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+#include "vscript/languages/squirrel_re/squirrel/sqobject.h"
+
+struct SQStructDef : public SQCollectable
+{
+ SQObjectType _nameType;
+ SQString* _name;
+ unsigned char gap_38[16];
+ SQObjectType _variableNamesType;
+ SQTable* _variableNames;
+ unsigned char gap_[32];
+};
+static_assert(sizeof(SQStructDef) == 128);
+
+// NOTE [Fifty]: Variable sized struct
+struct SQStructInstance : public SQCollectable
+{
+ unsigned int size;
+ BYTE gap_34[4];
+ SQObject data[1];
+};
+static_assert(sizeof(SQStructInstance) == 72);
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqtable.h b/primedev/vscript/languages/squirrel_re/squirrel/sqtable.h
new file mode 100644
index 00000000..e0ced436
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqtable.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+#include "vscript/languages/squirrel_re/squirrel/sqobject.h"
+
+struct alignas(8) SQTable : public SQDelegable
+{
+ struct _HashNode
+ {
+ SQObject val;
+ SQObject key;
+ _HashNode* next;
+ };
+
+ _HashNode* _nodes;
+ int _numOfNodes;
+ int size;
+ int field_48;
+ int _usedNodes;
+};
+static_assert(sizeof(SQTable) == 80);
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/squserdata.h b/primedev/vscript/languages/squirrel_re/squirrel/squserdata.h
new file mode 100644
index 00000000..98ede887
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/squserdata.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+#include "vscript/languages/squirrel_re/squirrel/sqobject.h"
+
+// NOTE [Fifty]: Variable sized struct
+struct SQUserData : public SQDelegable
+{
+ int size;
+ char padding1[4];
+ void* (*releasehook)(void* val, int size);
+ long long typeId;
+ char data[1];
+};
+static_assert(sizeof(SQUserData) == 88); // [Fifty]: Game allocates 87 + size (passed to the function)
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqvector.h b/primedev/vscript/languages/squirrel_re/squirrel/sqvector.h
new file mode 100644
index 00000000..63984e90
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqvector.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+
+// TODO [Fifty]: Verify size
+struct SQVector
+{
+ SQObjectType _Type;
+ float x;
+ float y;
+ float z;
+};
diff --git a/primedev/vscript/languages/squirrel_re/squirrel/sqvm.h b/primedev/vscript/languages/squirrel_re/squirrel/sqvm.h
new file mode 100644
index 00000000..d16092e7
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/squirrel/sqvm.h
@@ -0,0 +1,69 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+#include "vscript/languages/squirrel_re/squirrel/sqstring.h"
+
+struct SQVM;
+
+enum class ScriptContext : int
+{
+ INVALID = -1,
+ SERVER,
+ CLIENT,
+ UI,
+};
+
+struct alignas(8) SQVM
+{
+ struct alignas(8) CallInfo
+ {
+ long long ip;
+ SQObject* _literals;
+ SQObject obj10;
+ SQObject closure;
+ int _etraps[4];
+ int _root;
+ short _vargs_size;
+ short _vargs_base;
+ unsigned char gap[16];
+ };
+
+ void* vftable;
+ int uiRef;
+ unsigned char gap_8[12];
+ void* _toString;
+ void* _roottable_pointer;
+ void* pointer_28;
+ CallInfo* ci;
+ CallInfo* _callstack;
+ int _callstacksize;
+ int _stackbase;
+ SQObject* _stackOfCurrentFunction;
+ SQSharedState* sharedState;
+ void* pointer_58;
+ void* pointer_60;
+ int _top;
+ SQObject* _stack;
+ unsigned char gap_78[8];
+ SQObject* _vargvstack;
+ unsigned char gap_88[8];
+ SQObject temp_reg;
+ unsigned char gapA0[8];
+ void* pointer_A8;
+ unsigned char gap_B0[8];
+ SQObject _roottable_object;
+ SQObject _lasterror;
+ SQObject _errorHandler;
+ long long field_E8;
+ int traps;
+ unsigned char gap_F4[12];
+ int _nnativecalls;
+ int _suspended;
+ int _suspended_root;
+ int _unk;
+ int _suspended_target;
+ int trapAmount;
+ int _suspend_varargs;
+ int unknown_field_11C;
+ SQObject object_120;
+};
diff --git a/primedev/vscript/languages/squirrel_re/vsquirrel.h b/primedev/vscript/languages/squirrel_re/vsquirrel.h
new file mode 100644
index 00000000..43be685e
--- /dev/null
+++ b/primedev/vscript/languages/squirrel_re/vsquirrel.h
@@ -0,0 +1,16 @@
+#pragma once
+
+struct CSquirrelVM
+{
+ BYTE gap_0[8];
+ HSQUIRRELVM sqvm;
+ BYTE gap_10[8];
+ SQObject unknownObject_18;
+ __int64 unknown_28;
+ BYTE gap_30[12];
+ __int32 vmContext;
+ BYTE gap_40[648];
+ char* (*formatString)(__int64 a1, const char* format, ...);
+ BYTE gap_2D0[24];
+};
+static_assert(sizeof(CSquirrelVM) == 744);
diff --git a/primedev/vscript/vscript.h b/primedev/vscript/vscript.h
new file mode 100644
index 00000000..4c9f072a
--- /dev/null
+++ b/primedev/vscript/vscript.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "vscript/languages/squirrel_re/include/squirrel.h"
+
+#include "vscript/languages/squirrel_re/squirrel/sqarray.h"
+#include "vscript/languages/squirrel_re/squirrel/sqclosure.h"
+#include "vscript/languages/squirrel_re/squirrel/sqcompiler.h"
+#include "vscript/languages/squirrel_re/squirrel/sqfunctionproto.h"
+#include "vscript/languages/squirrel_re/squirrel/sqlexer.h"
+#include "vscript/languages/squirrel_re/squirrel/sqobject.h"
+#include "vscript/languages/squirrel_re/squirrel/sqopcodes.h"
+#include "vscript/languages/squirrel_re/squirrel/sqstate.h"
+#include "vscript/languages/squirrel_re/squirrel/sqstring.h"
+#include "vscript/languages/squirrel_re/squirrel/sqstruct.h"
+#include "vscript/languages/squirrel_re/squirrel/sqtable.h"
+#include "vscript/languages/squirrel_re/squirrel/squserdata.h"
+#include "vscript/languages/squirrel_re/squirrel/sqvector.h"
+#include "vscript/languages/squirrel_re/squirrel/sqvm.h"
+
+#include "vscript/languages/squirrel_re/vsquirrel.h"