aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL')
-rw-r--r--NorthstarDLL/misccommands.cpp12
-rw-r--r--NorthstarDLL/r2engine.h12
-rw-r--r--NorthstarDLL/squirrel.cpp6
-rw-r--r--NorthstarDLL/squirrel.h14
4 files changed, 38 insertions, 6 deletions
diff --git a/NorthstarDLL/misccommands.cpp b/NorthstarDLL/misccommands.cpp
index 3aae19d0..ea832de6 100644
--- a/NorthstarDLL/misccommands.cpp
+++ b/NorthstarDLL/misccommands.cpp
@@ -147,8 +147,16 @@ void FixupCvarFlags()
{"rpt_password", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}};
for (auto& fixup : CVAR_FIXUP_ADD_FLAGS)
- R2::g_pCVar->FindCommandBase(std::get<0>(fixup))->m_nFlags |= std::get<1>(fixup);
+ {
+ ConCommandBase* command = R2::g_pCVar->FindCommandBase(std::get<0>(fixup));
+ if (command)
+ command->m_nFlags |= std::get<1>(fixup);
+ }
for (auto& fixup : CVAR_FIXUP_REMOVE_FLAGS)
- R2::g_pCVar->FindCommandBase(std::get<0>(fixup))->m_nFlags &= ~std::get<1>(fixup);
+ {
+ ConCommandBase* command = R2::g_pCVar->FindCommandBase(std::get<0>(fixup));
+ if (command)
+ command->m_nFlags &= ~std::get<1>(fixup);
+ }
}
diff --git a/NorthstarDLL/r2engine.h b/NorthstarDLL/r2engine.h
index 5566f339..844f9e94 100644
--- a/NorthstarDLL/r2engine.h
+++ b/NorthstarDLL/r2engine.h
@@ -160,26 +160,30 @@ namespace R2
// +0x16
char m_Name[64];
+
// +0x56
+ char pad1[0x202];
+
+ void** m_ConVars; // this is a KeyValues* object but not got that struct mapped out atm
- char pad1[0x44A];
+ char pad2[0x240];
// +0x4A0
ePersistenceReady m_iPersistenceReady;
// +0x4A1
- char pad2[0x59];
+ char pad3[0x59];
// +0x4FA
char m_PersistenceBuffer[PERSISTENCE_MAX_SIZE];
- char pad3[0x2006];
+ char pad4[0x2006];
// +0xF500
char m_UID[32];
// +0xF520
- char pad4[0x1E208];
+ char pad5[0x1E208];
};
#pragma pack(pop)
diff --git a/NorthstarDLL/squirrel.cpp b/NorthstarDLL/squirrel.cpp
index 5c2d8b1b..23935827 100644
--- a/NorthstarDLL/squirrel.cpp
+++ b/NorthstarDLL/squirrel.cpp
@@ -488,6 +488,8 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module))
g_pSquirrel<ScriptContext::CLIENT>->__sq_getasset = module.Offset(0x6010).As<sq_getassetType>();
g_pSquirrel<ScriptContext::CLIENT>->__sq_getuserdata = module.Offset(0x63D0).As<sq_getuserdataType>();
g_pSquirrel<ScriptContext::CLIENT>->__sq_getvector = module.Offset(0x6140).As<sq_getvectorType>();
+ g_pSquirrel<ScriptContext::CLIENT>->__sq_getthisentity = module.Offset(0x12F80).As<sq_getthisentityType>();
+ g_pSquirrel<ScriptContext::CLIENT>->__sq_getentity = module.Offset(0x6140).As<sq_getentityType>();
g_pSquirrel<ScriptContext::UI>->__sq_getstring = g_pSquirrel<ScriptContext::CLIENT>->__sq_getstring;
g_pSquirrel<ScriptContext::UI>->__sq_getinteger = g_pSquirrel<ScriptContext::CLIENT>->__sq_getinteger;
g_pSquirrel<ScriptContext::UI>->__sq_getfloat = g_pSquirrel<ScriptContext::CLIENT>->__sq_getfloat;
@@ -496,6 +498,8 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module))
g_pSquirrel<ScriptContext::UI>->__sq_getasset = g_pSquirrel<ScriptContext::CLIENT>->__sq_getasset;
g_pSquirrel<ScriptContext::UI>->__sq_getuserdata = g_pSquirrel<ScriptContext::CLIENT>->__sq_getuserdata;
g_pSquirrel<ScriptContext::UI>->__sq_getvector = g_pSquirrel<ScriptContext::CLIENT>->__sq_getvector;
+ g_pSquirrel<ScriptContext::UI>->__sq_getthisentity = g_pSquirrel<ScriptContext::CLIENT>->__sq_getthisentity;
+ g_pSquirrel<ScriptContext::CLIENT>->__sq_getentity = g_pSquirrel<ScriptContext::CLIENT>->__sq_getentity;
g_pSquirrel<ScriptContext::CLIENT>->__sq_createuserdata = module.Offset(0x38D0).As<sq_createuserdataType>();
g_pSquirrel<ScriptContext::CLIENT>->__sq_setuserdatatypeid = module.Offset(0x6490).As<sq_setuserdatatypeidType>();
@@ -563,6 +567,8 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module))
g_pSquirrel<ScriptContext::SERVER>->__sq_getuserdata = module.Offset(0x63B0).As<sq_getuserdataType>();
g_pSquirrel<ScriptContext::SERVER>->__sq_getvector = module.Offset(0x6120).As<sq_getvectorType>();
g_pSquirrel<ScriptContext::SERVER>->__sq_get = module.Offset(0x7C00).As<sq_getType>();
+ g_pSquirrel<ScriptContext::SERVER>->__sq_getthisentity = module.Offset(0x203B0).As<sq_getthisentityType>();
+ g_pSquirrel<ScriptContext::SERVER>->__sq_getentity = module.Offset(0x6120).As<sq_getentityType>();
g_pSquirrel<ScriptContext::SERVER>->__sq_createuserdata = module.Offset(0x38D0).As<sq_createuserdataType>();
g_pSquirrel<ScriptContext::SERVER>->__sq_setuserdatatypeid = module.Offset(0x6470).As<sq_setuserdatatypeidType>();
diff --git a/NorthstarDLL/squirrel.h b/NorthstarDLL/squirrel.h
index 4f644703..de99b9d0 100644
--- a/NorthstarDLL/squirrel.h
+++ b/NorthstarDLL/squirrel.h
@@ -121,6 +121,8 @@ 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_getentityType)(HSquirrelVM*, SQInteger iStackPos);
// sq stack userpointer funcs
typedef void* (*sq_createuserdataType)(HSquirrelVM* sqvm, SQInteger iSize);
@@ -168,6 +170,8 @@ template <ScriptContext context> class SquirrelManager
sq_getassetType __sq_getasset;
sq_getuserdataType __sq_getuserdata;
sq_getvectorType __sq_getvector;
+ sq_getthisentityType __sq_getthisentity;
+ sq_getentityType __sq_getentity;
sq_createuserdataType __sq_createuserdata;
sq_setuserdatatypeidType __sq_setuserdatatypeid;
@@ -312,6 +316,16 @@ template <ScriptContext context> class SquirrelManager
{
return __sq_setuserdatatypeid(sqvm, stackpos, typeId);
}
+
+ template <typename T> inline SQBool getthisentity(HSquirrelVM* sqvm, T* ppEntity)
+ {
+ return __sq_getentity(sqvm, (void**)ppEntity);
+ }
+
+ template <typename T> inline T* getentity(HSquirrelVM* sqvm, SQInteger iStackPos)
+ {
+ return (T*)__sq_getentity(sqvm, iStackPos);
+ }
#pragma endregion
};