aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-20 21:18:55 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-20 21:18:55 +0000
commite2c028702096367c6d10f3659d4c11f598829e2c (patch)
tree5c552595b812ce2d6f2a412ee4cea5791bde95ef /NorthstarDedicatedTest
parent6cacfd312ad4f433fa5acd3e1dc6383ca5685211 (diff)
downloadNorthstarLauncher-e2c028702096367c6d10f3659d4c11f598829e2c.tar.gz
NorthstarLauncher-e2c028702096367c6d10f3659d4c11f598829e2c.zip
auth fix and typo fix
Diffstat (limited to 'NorthstarDedicatedTest')
-rw-r--r--NorthstarDedicatedTest/clientauthhooks.cpp10
-rw-r--r--NorthstarDedicatedTest/context.cpp8
-rw-r--r--NorthstarDedicatedTest/context.h4
-rw-r--r--NorthstarDedicatedTest/modmanager.cpp6
-rw-r--r--NorthstarDedicatedTest/modmanager.h2
-rw-r--r--NorthstarDedicatedTest/scriptserverbrowser.cpp8
-rw-r--r--NorthstarDedicatedTest/squirrel.cpp104
-rw-r--r--NorthstarDedicatedTest/squirrel.h20
8 files changed, 87 insertions, 75 deletions
diff --git a/NorthstarDedicatedTest/clientauthhooks.cpp b/NorthstarDedicatedTest/clientauthhooks.cpp
index 889512a2..a139504d 100644
--- a/NorthstarDedicatedTest/clientauthhooks.cpp
+++ b/NorthstarDedicatedTest/clientauthhooks.cpp
@@ -11,15 +11,19 @@ AuthWithStryderType AuthWithStryder;
ConVar* Cvar_ns_has_agreed_to_send_token;
+// mirrored in script
+const int NOT_DECIDED_TO_SEND_TOKEN = 0;
+const int AGREED_TO_SEND_TOKEN = 1;
+const int DISAGREED_TO_SEND_TOKEN = 2;
+
void AuthWithStryderHook(void* a1)
{
// game will call this forever, until it gets a valid auth key
// so, we need to manually invalidate our key until we're authed with northstar, then we'll allow game to auth with stryder
-
- if (!g_MasterServerManager->m_bOriginAuthWithMasterServerDone)
+ if (!g_MasterServerManager->m_bOriginAuthWithMasterServerDone && Cvar_ns_has_agreed_to_send_token->m_nValue != DISAGREED_TO_SEND_TOKEN)
{
// if player has agreed to send token and we aren't already authing, try to auth
- if (Cvar_ns_has_agreed_to_send_token->m_nValue && !g_MasterServerManager->m_bOriginAuthWithMasterServerInProgress)
+ if (Cvar_ns_has_agreed_to_send_token->m_nValue == AGREED_TO_SEND_TOKEN && !g_MasterServerManager->m_bOriginAuthWithMasterServerInProgress)
g_MasterServerManager->AuthenticateOriginWithMasterServer(g_LocalPlayerUserID, g_LocalPlayerOriginToken);
// invalidate key so auth will fail
diff --git a/NorthstarDedicatedTest/context.cpp b/NorthstarDedicatedTest/context.cpp
index 4cfa445d..17de66b3 100644
--- a/NorthstarDedicatedTest/context.cpp
+++ b/NorthstarDedicatedTest/context.cpp
@@ -1,13 +1,13 @@
#include "pch.h"
#include "context.h"
-const char* GetContextName(ScriptContex context)
+const char* GetContextName(ScriptContext context)
{
- if (context == ScriptContex::CLIENT)
+ if (context == ScriptContext::CLIENT)
return "CLIENT";
- else if (context == ScriptContex::SERVER)
+ else if (context == ScriptContext::SERVER)
return "SERVER";
- else if (context == ScriptContex::UI)
+ else if (context == ScriptContext::UI)
return "UI";
return "";
diff --git a/NorthstarDedicatedTest/context.h b/NorthstarDedicatedTest/context.h
index ac2c5b30..b6097780 100644
--- a/NorthstarDedicatedTest/context.h
+++ b/NorthstarDedicatedTest/context.h
@@ -1,6 +1,6 @@
#pragma once
-enum class ScriptContex : int
+enum class ScriptContext : int
{
SERVER,
CLIENT,
@@ -8,4 +8,4 @@ enum class ScriptContex : int
NONE
};
-const char* GetContextName(ScriptContex context); \ No newline at end of file
+const char* GetContextName(ScriptContext context); \ No newline at end of file
diff --git a/NorthstarDedicatedTest/modmanager.cpp b/NorthstarDedicatedTest/modmanager.cpp
index 785f92d8..4f4a2da0 100644
--- a/NorthstarDedicatedTest/modmanager.cpp
+++ b/NorthstarDedicatedTest/modmanager.cpp
@@ -125,7 +125,7 @@ Mod::Mod(fs::path modDir, char* jsonBuf)
if (scriptObj.HasMember("ServerCallback") && scriptObj["ServerCallback"].IsObject())
{
ModScriptCallback callback;
- callback.Context = ScriptContex::SERVER;
+ callback.Context = ScriptContext::SERVER;
if (scriptObj["ServerCallback"].HasMember("Before") && scriptObj["ServerCallback"]["Before"].IsString())
callback.BeforeCallback = scriptObj["ServerCallback"]["Before"].GetString();
@@ -139,7 +139,7 @@ Mod::Mod(fs::path modDir, char* jsonBuf)
if (scriptObj.HasMember("ClientCallback") && scriptObj["ClientCallback"].IsObject())
{
ModScriptCallback callback;
- callback.Context = ScriptContex::CLIENT;
+ callback.Context = ScriptContext::CLIENT;
if (scriptObj["ClientCallback"].HasMember("Before") && scriptObj["ClientCallback"]["Before"].IsString())
callback.BeforeCallback = scriptObj["ClientCallback"]["Before"].GetString();
@@ -153,7 +153,7 @@ Mod::Mod(fs::path modDir, char* jsonBuf)
if (scriptObj.HasMember("UICallback") && scriptObj["UICallback"].IsObject())
{
ModScriptCallback callback;
- callback.Context = ScriptContex::UI;
+ callback.Context = ScriptContext::UI;
if (scriptObj["UICallback"].HasMember("Before") && scriptObj["UICallback"]["Before"].IsString())
callback.BeforeCallback = scriptObj["UICallback"]["Before"].GetString();
diff --git a/NorthstarDedicatedTest/modmanager.h b/NorthstarDedicatedTest/modmanager.h
index f88cd06a..5f2f6441 100644
--- a/NorthstarDedicatedTest/modmanager.h
+++ b/NorthstarDedicatedTest/modmanager.h
@@ -27,7 +27,7 @@ public:
// would've liked to make it possible to hook arbitrary codecallbacks, but couldn't find a function that calls some ui ones
//std::string HookedCodeCallback;
- ScriptContex Context;
+ ScriptContext Context;
// called before the codecallback is executed
std::string BeforeCallback;
diff --git a/NorthstarDedicatedTest/scriptserverbrowser.cpp b/NorthstarDedicatedTest/scriptserverbrowser.cpp
index 476c1b37..cc5dbcb5 100644
--- a/NorthstarDedicatedTest/scriptserverbrowser.cpp
+++ b/NorthstarDedicatedTest/scriptserverbrowser.cpp
@@ -8,6 +8,13 @@
// functions for viewing server browser
+// bool function NSIsMasterServerAuthenticated()
+SQRESULT SQ_IsMasterServerAuthenticated(void* sqvm)
+{
+ ClientSq_pushbool(sqvm, g_MasterServerManager->m_bOriginAuthWithMasterServerDone);
+ return SQRESULT_NOTNULL;
+}
+
// void function NSRequestServerList()
SQRESULT SQ_RequestServerList(void* sqvm)
{
@@ -306,6 +313,7 @@ void InitialiseScriptServerBrowser(HMODULE baseAddress)
if (IsDedicated())
return;
+ g_UISquirrelManager->AddFuncRegistration("bool", "NSIsMasterServerAuthenticated", "", "", SQ_IsMasterServerAuthenticated);
g_UISquirrelManager->AddFuncRegistration("void", "NSRequestServerList", "", "", SQ_RequestServerList);
g_UISquirrelManager->AddFuncRegistration("bool", "NSIsRequestingServerList", "", "", SQ_IsRequestingServerList);
g_UISquirrelManager->AddFuncRegistration("bool", "NSMasterServerConnectionSuccessful", "", "", SQ_MasterServerConnectionSuccessful);
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp
index 2b0ba172..1ea73fef 100644
--- a/NorthstarDedicatedTest/squirrel.cpp
+++ b/NorthstarDedicatedTest/squirrel.cpp
@@ -13,27 +13,27 @@ typedef SQInteger(*SQPrintType)(void* sqvm, char* fmt, ...);
SQPrintType ClientSQPrint;
SQPrintType UISQPrint;
SQPrintType ServerSQPrint;
-template<ScriptContex context> SQInteger SQPrintHook(void* sqvm, char* fmt, ...);
+template<ScriptContext context> SQInteger SQPrintHook(void* sqvm, char* fmt, ...);
-typedef void*(*CreateNewVMType)(void* a1, ScriptContex contextArg);
+typedef void*(*CreateNewVMType)(void* a1, ScriptContext contextArg);
CreateNewVMType ClientCreateNewVM; // only need a client one since ui doesn't have its own func for this
CreateNewVMType ServerCreateNewVM;
-template<ScriptContex context> void* CreateNewVMHook(void* a1, ScriptContex contextArg);
+template<ScriptContext context> void* CreateNewVMHook(void* a1, ScriptContext contextArg);
typedef void(*DestroyVMType)(void* a1, void* sqvm);
DestroyVMType ClientDestroyVM; // only need a client one since ui doesn't have its own func for this
DestroyVMType ServerDestroyVM;
-template<ScriptContex context> void DestroyVMHook(void* a1, void* sqvm);
+template<ScriptContext context> void DestroyVMHook(void* a1, void* sqvm);
typedef void(*ScriptCompileError)(void* sqvm, const char* error, const char* file, int line, int column);
ScriptCompileError ClientSQCompileError; // only need a client one since ui doesn't have its own func for this
ScriptCompileError ServerSQCompileError;
-template<ScriptContex context> void ScriptCompileErrorHook(void* sqvm, const char* error, const char* file, int line, int column);
+template<ScriptContext context> void ScriptCompileErrorHook(void* sqvm, const char* error, const char* file, int line, int column);
typedef char(*CallScriptInitCallbackType)(void* sqvm, const char* callback);
CallScriptInitCallbackType ClientCallScriptInitCallback;
CallScriptInitCallbackType ServerCallScriptInitCallback;
-template<ScriptContex context> char CallScriptInitCallbackHook(void* sqvm, const char* callback);
+template<ScriptContext context> char CallScriptInitCallbackHook(void* sqvm, const char* callback);
// core sqvm funcs
sq_compilebufferType ClientSq_compilebuffer;
@@ -88,12 +88,12 @@ sq_getboolType ClientSq_getbool;
sq_getboolType ServerSq_getbool;
-template<ScriptContex context> void ExecuteCodeCommand(const CCommand& args);
+template<ScriptContext context> void ExecuteCodeCommand(const CCommand& args);
// inits
-SquirrelManager<ScriptContex::CLIENT>* g_ClientSquirrelManager;
-SquirrelManager<ScriptContex::SERVER>* g_ServerSquirrelManager;
-SquirrelManager<ScriptContex::UI>* g_UISquirrelManager;
+SquirrelManager<ScriptContext::CLIENT>* g_ClientSquirrelManager;
+SquirrelManager<ScriptContext::SERVER>* g_ServerSquirrelManager;
+SquirrelManager<ScriptContext::UI>* g_UISquirrelManager;
SQInteger NSTestFunc(void* sqvm)
{
@@ -108,16 +108,16 @@ void InitialiseClientSquirrel(HMODULE baseAddress)
HookEnabler hook;
// client inits
- g_ClientSquirrelManager = new SquirrelManager<ScriptContex::CLIENT>();
+ g_ClientSquirrelManager = new SquirrelManager<ScriptContext::CLIENT>();
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x12B00, &SQPrintHook<ScriptContex::CLIENT>, reinterpret_cast<LPVOID*>(&ClientSQPrint)); // client print function
- RegisterConCommand("script_client", ExecuteCodeCommand<ScriptContex::CLIENT>, "Executes script code on the client vm", FCVAR_CLIENTDLL);
+ ENABLER_CREATEHOOK(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);
// ui inits
- g_UISquirrelManager = new SquirrelManager<ScriptContex::UI>();
+ g_UISquirrelManager = new SquirrelManager<ScriptContext::UI>();
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x12BA0, &SQPrintHook<ScriptContex::UI>, reinterpret_cast<LPVOID*>(&UISQPrint)); // ui print function
- RegisterConCommand("script_ui", ExecuteCodeCommand<ScriptContex::UI>, "Executes script code on the ui vm", FCVAR_CLIENTDLL);
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x12BA0, &SQPrintHook<ScriptContext::UI>, reinterpret_cast<LPVOID*>(&UISQPrint)); // ui print function
+ RegisterConCommand("script_ui", ExecuteCodeCommand<ScriptContext::UI>, "Executes script code on the ui vm", FCVAR_CLIENTDLL);
// inits for both client and ui, since they share some functions
ClientSq_compilebuffer = (sq_compilebufferType)((char*)baseAddress + 0x3110);
@@ -139,15 +139,15 @@ void InitialiseClientSquirrel(HMODULE baseAddress)
ClientSq_getfloat = (sq_getfloatType)((char*)baseAddress + 0x6100);
ClientSq_getbool = (sq_getboolType)((char*)baseAddress + 0x6130);
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x26130, &CreateNewVMHook<ScriptContex::CLIENT>, reinterpret_cast<LPVOID*>(&ClientCreateNewVM)); // client createnewvm function
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x26E70, &DestroyVMHook<ScriptContex::CLIENT>, reinterpret_cast<LPVOID*>(&ClientDestroyVM)); // client destroyvm function
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x79A50, &ScriptCompileErrorHook<ScriptContex::CLIENT>, reinterpret_cast<LPVOID*>(&ClientSQCompileError)); // client compileerror function
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x10190, &CallScriptInitCallbackHook<ScriptContex::CLIENT>, reinterpret_cast<LPVOID*>(&ClientCallScriptInitCallback)); // client callscriptinitcallback function
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x26130, &CreateNewVMHook<ScriptContext::CLIENT>, reinterpret_cast<LPVOID*>(&ClientCreateNewVM)); // client createnewvm function
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x26E70, &DestroyVMHook<ScriptContext::CLIENT>, reinterpret_cast<LPVOID*>(&ClientDestroyVM)); // client destroyvm function
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x79A50, &ScriptCompileErrorHook<ScriptContext::CLIENT>, reinterpret_cast<LPVOID*>(&ClientSQCompileError)); // client compileerror function
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x10190, &CallScriptInitCallbackHook<ScriptContext::CLIENT>, reinterpret_cast<LPVOID*>(&ClientCallScriptInitCallback)); // client callscriptinitcallback function
}
void InitialiseServerSquirrel(HMODULE baseAddress)
{
- g_ServerSquirrelManager = new SquirrelManager<ScriptContex::SERVER>();
+ g_ServerSquirrelManager = new SquirrelManager<ScriptContext::SERVER>();
HookEnabler hook;
@@ -170,19 +170,19 @@ void InitialiseServerSquirrel(HMODULE baseAddress)
ServerSq_getfloat = (sq_getfloatType)((char*)baseAddress + 0x60E0);
ServerSq_getbool = (sq_getboolType)((char*)baseAddress + 0x6110);
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x1FE90, &SQPrintHook<ScriptContex::SERVER>, reinterpret_cast<LPVOID*>(&ServerSQPrint)); // server print function
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x260E0, &CreateNewVMHook<ScriptContex::SERVER>, reinterpret_cast<LPVOID*>(&ServerCreateNewVM)); // server createnewvm function
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x26E20, &DestroyVMHook<ScriptContex::SERVER>, reinterpret_cast<LPVOID*>(&ServerDestroyVM)); // server destroyvm function
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x799E0, &ScriptCompileErrorHook<ScriptContex::SERVER>, reinterpret_cast<LPVOID*>(&ServerSQCompileError)); // server compileerror function
- ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x1D5C0, &CallScriptInitCallbackHook<ScriptContex::SERVER>, reinterpret_cast<LPVOID*>(&ServerCallScriptInitCallback)); // server callscriptinitcallback function
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x1FE90, &SQPrintHook<ScriptContext::SERVER>, reinterpret_cast<LPVOID*>(&ServerSQPrint)); // server print function
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x260E0, &CreateNewVMHook<ScriptContext::SERVER>, reinterpret_cast<LPVOID*>(&ServerCreateNewVM)); // server createnewvm function
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x26E20, &DestroyVMHook<ScriptContext::SERVER>, reinterpret_cast<LPVOID*>(&ServerDestroyVM)); // server destroyvm function
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x799E0, &ScriptCompileErrorHook<ScriptContext::SERVER>, reinterpret_cast<LPVOID*>(&ServerSQCompileError)); // server compileerror function
+ ENABLER_CREATEHOOK(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<ScriptContex::SERVER>, "Executes script code on the server vm", FCVAR_GAMEDLL | FCVAR_CLIENTCMD_CAN_EXECUTE | FCVAR_CHEAT);
+ RegisterConCommand("script", ExecuteCodeCommand<ScriptContext::SERVER>, "Executes script code on the server vm", FCVAR_GAMEDLL | FCVAR_CLIENTCMD_CAN_EXECUTE | FCVAR_CHEAT);
}
// hooks
-template<ScriptContex context> SQInteger SQPrintHook(void* sqvm, char* fmt, ...)
+template<ScriptContext context> SQInteger SQPrintHook(void* sqvm, char* fmt, ...)
{
va_list va;
va_start(va, fmt);
@@ -202,20 +202,20 @@ template<ScriptContex context> SQInteger SQPrintHook(void* sqvm, char* fmt, ...)
return 0;
}
-template<ScriptContex context> void* CreateNewVMHook(void* a1, ScriptContex realContext)
+template<ScriptContext context> void* CreateNewVMHook(void* a1, ScriptContext realContext)
{
void* sqvm;
- if (context == ScriptContex::CLIENT)
+ if (context == ScriptContext::CLIENT)
{
sqvm = ClientCreateNewVM(a1, realContext);
- if (realContext == ScriptContex::UI)
+ if (realContext == ScriptContext::UI)
g_UISquirrelManager->VMCreated(sqvm);
else
g_ClientSquirrelManager->VMCreated(sqvm);
}
- else if (context == ScriptContex::SERVER)
+ else if (context == ScriptContext::SERVER)
{
sqvm = ServerCreateNewVM(a1, context);
g_ServerSquirrelManager->VMCreated(sqvm);
@@ -225,23 +225,23 @@ template<ScriptContex context> void* CreateNewVMHook(void* a1, ScriptContex real
return sqvm;
}
-template<ScriptContex context> void DestroyVMHook(void* a1, void* sqvm)
+template<ScriptContext context> void DestroyVMHook(void* a1, void* sqvm)
{
- ScriptContex realContext = context; // ui and client use the same function so we use this for prints
+ ScriptContext realContext = context; // ui and client use the same function so we use this for prints
- if (context == ScriptContex::CLIENT)
+ if (context == ScriptContext::CLIENT)
{
if (g_ClientSquirrelManager->sqvm == sqvm)
g_ClientSquirrelManager->VMDestroyed();
else if (g_UISquirrelManager->sqvm == sqvm)
{
g_UISquirrelManager->VMDestroyed();
- realContext = ScriptContex::UI;
+ realContext = ScriptContext::UI;
}
ClientDestroyVM(a1, sqvm);
}
- else if (context == ScriptContex::SERVER)
+ else if (context == ScriptContext::SERVER)
{
g_ServerSquirrelManager->VMDestroyed();
ServerDestroyVM(a1, sqvm);
@@ -250,11 +250,11 @@ template<ScriptContex context> void DestroyVMHook(void* a1, void* sqvm)
spdlog::info("DestroyVM {} {}", GetContextName(realContext), sqvm);
}
-template<ScriptContex context> void ScriptCompileErrorHook(void* sqvm, const char* error, const char* file, int line, int column)
+template<ScriptContext context> void ScriptCompileErrorHook(void* sqvm, const char* error, const char* file, int line, int column)
{
- ScriptContex realContext = context; // ui and client use the same function so we use this for prints
- if (context == ScriptContex::CLIENT && sqvm == g_UISquirrelManager->sqvm)
- realContext = ScriptContex::UI;
+ ScriptContext realContext = context; // ui and client use the same function so we use this for prints
+ if (context == ScriptContext::CLIENT && sqvm == g_UISquirrelManager->sqvm)
+ realContext = ScriptContext::UI;
spdlog::error("{} SCRIPT COMPILE ERROR {}", GetContextName(realContext), error);
spdlog::error("{} line [{}] column [{}]", file, line, column);
@@ -265,19 +265,19 @@ template<ScriptContex context> void ScriptCompileErrorHook(void* sqvm, const cha
// though, that also has potential to be REALLY bad if we're compiling ui scripts lol
}
-template<ScriptContex context> char CallScriptInitCallbackHook(void* sqvm, const char* callback)
+template<ScriptContext context> char CallScriptInitCallbackHook(void* sqvm, const char* callback)
{
char ret;
- if (context == ScriptContex::CLIENT)
+ if (context == ScriptContext::CLIENT)
{
- ScriptContex realContext = context; // ui and client use the same function so we use this for prints
+ ScriptContext realContext = context; // ui and client use the same function so we use this for prints
bool shouldCallCustomCallbacks = false;
// since we don't hook arbitrary callbacks yet, make sure we're only doing callbacks on inits
if (!strcmp(callback, "UICodeCallback_UIInit"))
{
- realContext = ScriptContex::UI;
+ realContext = ScriptContext::UI;
shouldCallCustomCallbacks = true;
}
else if (!strcmp(callback, "ClientCodeCallback_MapSpawn"))
@@ -333,7 +333,7 @@ template<ScriptContex context> char CallScriptInitCallbackHook(void* sqvm, const
}
}
}
- else if (context == ScriptContex::SERVER)
+ else if (context == ScriptContext::SERVER)
{
// since we don't hook arbitrary callbacks yet, make sure we're only doing callbacks on inits
bool shouldCallCustomCallbacks = !strcmp(callback, "CodeCallback_MapSpawn");
@@ -351,7 +351,7 @@ template<ScriptContex context> char CallScriptInitCallbackHook(void* sqvm, const
{
for (ModScriptCallback modCallback : script.Callbacks)
{
- if (modCallback.Context == ScriptContex::SERVER && modCallback.BeforeCallback.length())
+ if (modCallback.Context == ScriptContext::SERVER && modCallback.BeforeCallback.length())
{
spdlog::info("Running custom {} script callback \"{}\"", GetContextName(context), modCallback.BeforeCallback);
ServerCallScriptInitCallback(sqvm, modCallback.BeforeCallback.c_str());
@@ -378,7 +378,7 @@ template<ScriptContex context> char CallScriptInitCallbackHook(void* sqvm, const
{
for (ModScriptCallback modCallback : script.Callbacks)
{
- if (modCallback.Context == ScriptContex::SERVER && modCallback.AfterCallback.length())
+ if (modCallback.Context == ScriptContext::SERVER && modCallback.AfterCallback.length())
{
spdlog::info("Running custom {} script callback \"{}\"", GetContextName(context), modCallback.AfterCallback);
ServerCallScriptInitCallback(sqvm, modCallback.AfterCallback.c_str());
@@ -392,12 +392,12 @@ template<ScriptContex context> char CallScriptInitCallbackHook(void* sqvm, const
return ret;
}
-template<ScriptContex context> void ExecuteCodeCommand(const CCommand& args)
+template<ScriptContext context> void ExecuteCodeCommand(const CCommand& args)
{
- if (context == ScriptContex::CLIENT)
+ if (context == ScriptContext::CLIENT)
g_ClientSquirrelManager->ExecuteCode(args.ArgS());
- else if (context == ScriptContex::UI)
+ else if (context == ScriptContext::UI)
g_UISquirrelManager->ExecuteCode(args.ArgS());
- else if (context == ScriptContex::SERVER)
+ else if (context == ScriptContext::SERVER)
g_ServerSquirrelManager->ExecuteCode(args.ArgS());
} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/squirrel.h b/NorthstarDedicatedTest/squirrel.h
index d02a0000..742c392c 100644
--- a/NorthstarDedicatedTest/squirrel.h
+++ b/NorthstarDedicatedTest/squirrel.h
@@ -60,7 +60,7 @@ struct SQFuncRegistration
};
// core sqvm funcs
-typedef SQRESULT(*sq_compilebufferType)(void* sqvm, CompileBufferState* compileBuffer, const char* file, int a1, ScriptContex a2);
+typedef SQRESULT(*sq_compilebufferType)(void* sqvm, CompileBufferState* compileBuffer, const char* file, int a1, ScriptContext a2);
extern sq_compilebufferType ClientSq_compilebuffer;
extern sq_compilebufferType ServerSq_compilebuffer;
@@ -126,7 +126,7 @@ typedef SQBool(*sq_getboolType)(void*, SQInteger stackpos);
extern sq_getboolType ClientSq_getbool;
extern sq_getboolType ServerSq_getbool;
-template<ScriptContex context> class SquirrelManager
+template<ScriptContext context> class SquirrelManager
{
private:
std::vector<SQFuncRegistration*> m_funcRegistrations;
@@ -148,7 +148,7 @@ public:
{
spdlog::info("Registering {} function {}", GetContextName(context), funcReg->squirrelFuncName);
- if (context == ScriptContex::CLIENT || context == ScriptContex::UI)
+ if (context == ScriptContext::CLIENT || context == ScriptContext::UI)
ClientRegisterSquirrelFunc(sqvm, funcReg, 1);
else
ServerRegisterSquirrelFunc(sqvm, funcReg, 1);
@@ -176,21 +176,21 @@ public:
CompileBufferState bufferState = CompileBufferState(strCode);
SQRESULT compileResult;
- if (context == ScriptContex::CLIENT || context == ScriptContex::UI)
+ if (context == ScriptContext::CLIENT || context == ScriptContext::UI)
compileResult = ClientSq_compilebuffer(sqvm2, &bufferState, "console", -1, context);
- else if (context == ScriptContex::SERVER)
+ else if (context == ScriptContext::SERVER)
compileResult = ServerSq_compilebuffer(sqvm2, &bufferState, "console", -1, context);
spdlog::info("sq_compilebuffer returned {}", compileResult);
if (compileResult >= 0)
{
- if (context == ScriptContex::CLIENT || context == ScriptContex::UI)
+ if (context == ScriptContext::CLIENT || context == ScriptContext::UI)
{
ClientSq_pushroottable(sqvm2);
SQRESULT callResult = ClientSq_call(sqvm2, 1, false, false);
spdlog::info("sq_call returned {}", callResult);
}
- else if (context == ScriptContex::SERVER)
+ else if (context == ScriptContext::SERVER)
{
ServerSq_pushroottable(sqvm2);
SQRESULT callResult = ServerSq_call(sqvm2, 1, false, false);
@@ -222,6 +222,6 @@ public:
}
};
-extern SquirrelManager<ScriptContex::CLIENT>* g_ClientSquirrelManager;
-extern SquirrelManager<ScriptContex::SERVER>* g_ServerSquirrelManager;
-extern SquirrelManager<ScriptContex::UI>* g_UISquirrelManager; \ No newline at end of file
+extern SquirrelManager<ScriptContext::CLIENT>* g_ClientSquirrelManager;
+extern SquirrelManager<ScriptContext::SERVER>* g_ServerSquirrelManager;
+extern SquirrelManager<ScriptContext::UI>* g_UISquirrelManager; \ No newline at end of file