From ba26be9bea801f219fa6340178fd6b13f02d574e Mon Sep 17 00:00:00 2001 From: BobTheBob9 Date: Thu, 15 Sep 2022 00:20:56 +0100 Subject: clang format, fix issues with server registration and rpak loading --- NorthstarDLL/squirrel.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'NorthstarDLL/squirrel.cpp') diff --git a/NorthstarDLL/squirrel.cpp b/NorthstarDLL/squirrel.cpp index cf5cb49e..5c2d8b1b 100644 --- a/NorthstarDLL/squirrel.cpp +++ b/NorthstarDLL/squirrel.cpp @@ -101,7 +101,7 @@ template class SquirrelManager; template void SquirrelManager::VMCreated(CSquirrelVM* newSqvm) { - m_pSQVM = newSqvm; + m_pSQVM = newSqvm; for (SQFuncRegistration* funcReg : m_funcRegistrations) { @@ -205,8 +205,8 @@ bool IsUIVM(ScriptContext context, HSquirrelVM* pSqvm) g_pSquirrel->m_pSQVM->sqvm == pSqvm; } -template void* (*sq_compiler_create)(HSquirrelVM* sqvm, void* a2, void* a3, SQBool bShouldThrowError); -template void* sq_compiler_createHook(HSquirrelVM* sqvm, void* a2, void* a3, SQBool bShouldThrowError) +template void* (*__fastcall sq_compiler_create)(HSquirrelVM* sqvm, void* a2, void* a3, SQBool bShouldThrowError); +template 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)) @@ -238,8 +238,8 @@ template SQInteger SQPrintHook(HSquirrelVM* sqvm, const return 0; } -template CSquirrelVM* (*CreateNewVM)(void* a1, ScriptContext realContext); -template CSquirrelVM* CreateNewVMHook(void* a1, ScriptContext realContext) +template CSquirrelVM* (*__fastcall CreateNewVM)(void* a1, ScriptContext realContext); +template CSquirrelVM* __fastcall CreateNewVMHook(void* a1, ScriptContext realContext) { CSquirrelVM* sqvm = CreateNewVM(a1, realContext); if (realContext == ScriptContext::UI) @@ -251,8 +251,8 @@ template CSquirrelVM* CreateNewVMHook(void* a1, ScriptCo return sqvm; } -template void (*DestroyVM)(void* a1, HSquirrelVM* sqvm); -template void DestroyVMHook(void* a1, HSquirrelVM* sqvm) +template void (*__fastcall DestroyVM)(void* a1, HSquirrelVM* sqvm); +template void __fastcall DestroyVMHook(void* a1, HSquirrelVM* sqvm) { ScriptContext realContext = context; // ui and client use the same function so we use this for prints if (IsUIVM(context, sqvm)) @@ -266,8 +266,10 @@ template void DestroyVMHook(void* a1, HSquirrelVM* sqvm) spdlog::info("DestroyVM {} {}", GetContextName(realContext), (void*)sqvm); } -template void (*SQCompileError)(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column); -template void ScriptCompileErrorHook(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column) +template +void (*__fastcall SQCompileError)(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column); +template +void __fastcall ScriptCompileErrorHook(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column) { bool bIsFatalError = g_pSquirrel->m_bFatalCompilationErrors; ScriptContext realContext = context; // ui and client use the same function so we use this for prints @@ -306,8 +308,10 @@ template void ScriptCompileErrorHook(HSquirrelVM* sqvm, // dont call the original function since it kills game lol } -template int64_t(*RegisterSquirrelFunction)(CSquirrelVM* sqvm, SQFuncRegistration* funcReg, char unknown); -template int64_t RegisterSquirrelFunctionHook(CSquirrelVM* sqvm, SQFuncRegistration* funcReg, char unknown) +template +int64_t (*__fastcall RegisterSquirrelFunction)(CSquirrelVM* sqvm, SQFuncRegistration* funcReg, char unknown); +template +int64_t __fastcall RegisterSquirrelFunctionHook(CSquirrelVM* sqvm, SQFuncRegistration* funcReg, char unknown) { if (IsUIVM(context, sqvm->sqvm)) { @@ -331,8 +335,8 @@ template int64_t RegisterSquirrelFunctionHook(CSquirrelV return g_pSquirrel->RegisterSquirrelFunc(sqvm, funcReg, unknown); } -template bool (*CallScriptInitCallback)(void* sqvm, const char* callback); -template bool CallScriptInitCallbackHook(void* sqvm, const char* callback) +template bool (*__fastcall CallScriptInitCallback)(void* sqvm, const char* callback); +template bool __fastcall CallScriptInitCallbackHook(void* sqvm, const char* callback) { ScriptContext realContext = context; bool bShouldCallCustomCallbacks = true; @@ -439,7 +443,7 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) g_pSquirrel = new SquirrelManager; g_pSquirrel = new SquirrelManager; - + g_pSquirrel->__sq_defconst = module.Offset(0x12120).As(); g_pSquirrel->__sq_defconst = g_pSquirrel->__sq_defconst; @@ -516,10 +520,7 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) MAKEHOOK(module.Offset(0x26E70), &DestroyVMHook, &DestroyVM); MAKEHOOK(module.Offset(0x79A50), &ScriptCompileErrorHook, &SQCompileError); - MAKEHOOK( - module.Offset(0x10190), - &CallScriptInitCallbackHook, - &CallScriptInitCallback); + MAKEHOOK(module.Offset(0x10190), &CallScriptInitCallbackHook, &CallScriptInitCallback); RegisterConCommand("script_client", ConCommand_script, "Executes script code on the client vm", FCVAR_CLIENTDLL); RegisterConCommand("script_ui", ConCommand_script, "Executes script code on the ui vm", FCVAR_CLIENTDLL); -- cgit v1.2.3