diff options
Diffstat (limited to 'NorthstarDedicatedTest/squirrel.cpp')
-rw-r--r-- | NorthstarDedicatedTest/squirrel.cpp | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp index 5caaef15..328d414f 100644 --- a/NorthstarDedicatedTest/squirrel.cpp +++ b/NorthstarDedicatedTest/squirrel.cpp @@ -95,7 +95,10 @@ SquirrelManager<ScriptContext::CLIENT>* g_ClientSquirrelManager; SquirrelManager<ScriptContext::SERVER>* g_ServerSquirrelManager; SquirrelManager<ScriptContext::UI>* g_UISquirrelManager; -SQInteger NSTestFunc(void* sqvm) { return 1; } +SQInteger NSTestFunc(void* sqvm) +{ + return 1; +} void InitialiseClientSquirrel(HMODULE baseAddress) { @@ -105,7 +108,9 @@ void InitialiseClientSquirrel(HMODULE baseAddress) g_ClientSquirrelManager = new SquirrelManager<ScriptContext::CLIENT>(); ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x12B00, &SQPrintHook<ScriptContext::CLIENT>, + hook, + (char*)baseAddress + 0x12B00, + &SQPrintHook<ScriptContext::CLIENT>, reinterpret_cast<LPVOID*>(&ClientSQPrint)); // client print function RegisterConCommand( "script_client", ExecuteCodeCommand<ScriptContext::CLIENT>, "Executes script code on the client vm", FCVAR_CLIENTDLL); @@ -140,16 +145,24 @@ void InitialiseClientSquirrel(HMODULE baseAddress) ClientSq_sq_get = (sq_getType)((char*)baseAddress + 0x7C30); ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x26130, &CreateNewVMHook<ScriptContext::CLIENT>, + hook, + (char*)baseAddress + 0x26130, + &CreateNewVMHook<ScriptContext::CLIENT>, reinterpret_cast<LPVOID*>(&ClientCreateNewVM)); // client createnewvm function ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x26E70, &DestroyVMHook<ScriptContext::CLIENT>, + hook, + (char*)baseAddress + 0x26E70, + &DestroyVMHook<ScriptContext::CLIENT>, reinterpret_cast<LPVOID*>(&ClientDestroyVM)); // client destroyvm function ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x79A50, &ScriptCompileErrorHook<ScriptContext::CLIENT>, + hook, + (char*)baseAddress + 0x79A50, + &ScriptCompileErrorHook<ScriptContext::CLIENT>, reinterpret_cast<LPVOID*>(&ClientSQCompileError)); // client compileerror function ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x10190, &CallScriptInitCallbackHook<ScriptContext::CLIENT>, + hook, + (char*)baseAddress + 0x10190, + &CallScriptInitCallbackHook<ScriptContext::CLIENT>, reinterpret_cast<LPVOID*>(&ClientCallScriptInitCallback)); // client callscriptinitcallback function } @@ -181,25 +194,37 @@ void InitialiseServerSquirrel(HMODULE baseAddress) ServerSq_sq_get = (sq_getType)((char*)baseAddress + 0x7C00); ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x1FE90, &SQPrintHook<ScriptContext::SERVER>, + hook, + (char*)baseAddress + 0x1FE90, + &SQPrintHook<ScriptContext::SERVER>, reinterpret_cast<LPVOID*>(&ServerSQPrint)); // server print function ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x260E0, &CreateNewVMHook<ScriptContext::SERVER>, + hook, + (char*)baseAddress + 0x260E0, + &CreateNewVMHook<ScriptContext::SERVER>, reinterpret_cast<LPVOID*>(&ServerCreateNewVM)); // server createnewvm function ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x26E20, &DestroyVMHook<ScriptContext::SERVER>, + hook, + (char*)baseAddress + 0x26E20, + &DestroyVMHook<ScriptContext::SERVER>, reinterpret_cast<LPVOID*>(&ServerDestroyVM)); // server destroyvm function ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x799E0, &ScriptCompileErrorHook<ScriptContext::SERVER>, + hook, + (char*)baseAddress + 0x799E0, + &ScriptCompileErrorHook<ScriptContext::SERVER>, reinterpret_cast<LPVOID*>(&ServerSQCompileError)); // server compileerror function ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x1D5C0, &CallScriptInitCallbackHook<ScriptContext::SERVER>, + hook, + (char*)baseAddress + 0x1D5C0, + &CallScriptInitCallbackHook<ScriptContext::SERVER>, reinterpret_cast<LPVOID*>(&ServerCallScriptInitCallback)); // server callscriptinitcallback function // cheat and clientcmd_can_execute allows clients to execute this, but since it's unsafe we only allow it when cheats are enabled // for script_client and script_ui, we don't use cheats, so clients can execute them on themselves all they want RegisterConCommand( - "script", ExecuteCodeCommand<ScriptContext::SERVER>, "Executes script code on the server vm", + "script", + ExecuteCodeCommand<ScriptContext::SERVER>, + "Executes script code on the server vm", FCVAR_GAMEDLL | FCVAR_CLIENTCMD_CAN_EXECUTE | FCVAR_CHEAT); } |