aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest')
-rw-r--r--NorthstarDedicatedTest/clientauthhooks.cpp5
-rw-r--r--NorthstarDedicatedTest/clientvideooverrides.cpp2
-rw-r--r--NorthstarDedicatedTest/filesystem.cpp8
-rw-r--r--NorthstarDedicatedTest/host.cpp2
-rw-r--r--NorthstarDedicatedTest/keyvalues.cpp2
-rw-r--r--NorthstarDedicatedTest/miscserverfixes.cpp5
-rw-r--r--NorthstarDedicatedTest/modlocalisation.cpp2
-rw-r--r--NorthstarDedicatedTest/modmanager.cpp10
-rw-r--r--NorthstarDedicatedTest/modmanager.h2
-rw-r--r--NorthstarDedicatedTest/rpakfilesystem.cpp12
-rw-r--r--NorthstarDedicatedTest/scriptmodmenu.cpp20
-rw-r--r--NorthstarDedicatedTest/squirrel.cpp4
12 files changed, 34 insertions, 40 deletions
diff --git a/NorthstarDedicatedTest/clientauthhooks.cpp b/NorthstarDedicatedTest/clientauthhooks.cpp
index f1dc3f8c..4784dada 100644
--- a/NorthstarDedicatedTest/clientauthhooks.cpp
+++ b/NorthstarDedicatedTest/clientauthhooks.cpp
@@ -6,9 +6,6 @@
#include "masterserver.h"
#include "convar.h"
-typedef void (*AuthWithStryderType)(void* a1);
-AuthWithStryderType AuthWithStryder;
-
ConVar* Cvar_ns_has_agreed_to_send_token;
// mirrored in script
@@ -16,6 +13,8 @@ const int NOT_DECIDED_TO_SEND_TOKEN = 0;
const int AGREED_TO_SEND_TOKEN = 1;
const int DISAGREED_TO_SEND_TOKEN = 2;
+typedef void (*AuthWithStryderType)(void* a1);
+AuthWithStryderType AuthWithStryder;
void AuthWithStryderHook(void* a1)
{
// game will call this forever, until it gets a valid auth key
diff --git a/NorthstarDedicatedTest/clientvideooverrides.cpp b/NorthstarDedicatedTest/clientvideooverrides.cpp
index 3aaae863..53eb892a 100644
--- a/NorthstarDedicatedTest/clientvideooverrides.cpp
+++ b/NorthstarDedicatedTest/clientvideooverrides.cpp
@@ -13,7 +13,7 @@ void* BinkOpenHook(const char* path, uint32_t flags)
// figure out which mod is handling the bink
Mod* fileOwner = nullptr;
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Enabled)
continue;
diff --git a/NorthstarDedicatedTest/filesystem.cpp b/NorthstarDedicatedTest/filesystem.cpp
index 73cb5a1a..09bf8e97 100644
--- a/NorthstarDedicatedTest/filesystem.cpp
+++ b/NorthstarDedicatedTest/filesystem.cpp
@@ -87,12 +87,12 @@ bool TryReplaceFile(const char* pPath, bool shouldCompile)
return false;
if (shouldCompile)
- g_ModManager->CompileAssetsForFile(pPath);
+ g_pModManager->CompileAssetsForFile(pPath);
// idk how efficient the lexically normal check is
// can't just set all /s in path to \, since some paths aren't in writeable memory
- auto file = g_ModManager->m_modFiles.find(g_ModManager->NormaliseModFilePath(fs::path(pPath)));
- if (file != g_ModManager->m_modFiles.end())
+ auto file = g_pModManager->m_modFiles.find(g_pModManager->NormaliseModFilePath(fs::path(pPath)));
+ if (file != g_pModManager->m_modFiles.end())
{
SetNewModSearchPaths(file->second.owningMod);
return true;
@@ -143,7 +143,7 @@ VPKData* MountVPKHook(IFileSystem* fileSystem, const char* vpkPath)
spdlog::info("MountVPK {}", vpkPath);
VPKData* ret = MountVPK(fileSystem, vpkPath);
- for (Mod mod : g_ModManager->m_loadedMods)
+ for (Mod mod : g_pModManager->m_loadedMods)
{
if (!mod.Enabled)
continue;
diff --git a/NorthstarDedicatedTest/host.cpp b/NorthstarDedicatedTest/host.cpp
index 9217c128..6d57f585 100644
--- a/NorthstarDedicatedTest/host.cpp
+++ b/NorthstarDedicatedTest/host.cpp
@@ -12,7 +12,7 @@ void Host_InitHook(bool bDedicated)
// get all mod convars
std::vector<std::string> vModConvarNames;
- for (auto& mod : g_ModManager->m_loadedMods)
+ for (auto& mod : g_pModManager->m_loadedMods)
for (auto& cvar : mod.ConVars)
vModConvarNames.push_back(cvar->Name);
diff --git a/NorthstarDedicatedTest/keyvalues.cpp b/NorthstarDedicatedTest/keyvalues.cpp
index f79ff194..b73f6012 100644
--- a/NorthstarDedicatedTest/keyvalues.cpp
+++ b/NorthstarDedicatedTest/keyvalues.cpp
@@ -29,7 +29,7 @@ void ModManager::TryBuildKeyValues(const char* filename)
{
spdlog::info("Building KeyValues for file {}", filename);
- std::string normalisedPath = g_ModManager->NormaliseModFilePath(fs::path(filename));
+ std::string normalisedPath = g_pModManager->NormaliseModFilePath(fs::path(filename));
fs::path compiledPath = GetCompiledAssetsPath() / filename;
fs::path compiledDir = compiledPath.parent_path();
fs::create_directories(compiledDir);
diff --git a/NorthstarDedicatedTest/miscserverfixes.cpp b/NorthstarDedicatedTest/miscserverfixes.cpp
index eca7f798..139ae0c0 100644
--- a/NorthstarDedicatedTest/miscserverfixes.cpp
+++ b/NorthstarDedicatedTest/miscserverfixes.cpp
@@ -9,11 +9,6 @@ ON_DLL_LOAD("server.dll", MiscServerFixes, [](HMODULE baseAddress)
{
uintptr_t ba = (uintptr_t)baseAddress;
- // ret at the start of the concommand GenerateObjFile as it can crash servers
- {
- NSMem::BytePatch(ba + 0x38D920, "C3");
- }
-
// nop out call to VGUI shutdown since it crashes the game when quitting from the console
{
NSMem::NOP(ba + 0x154A96, 5);
diff --git a/NorthstarDedicatedTest/modlocalisation.cpp b/NorthstarDedicatedTest/modlocalisation.cpp
index 0fc02596..b6cb38dd 100644
--- a/NorthstarDedicatedTest/modlocalisation.cpp
+++ b/NorthstarDedicatedTest/modlocalisation.cpp
@@ -21,7 +21,7 @@ bool AddLocalisationFileHook(void* g_pVguiLocalize, const char* path, const char
loadModLocalisationFiles = false;
- for (Mod mod : g_ModManager->m_loadedMods)
+ for (Mod mod : g_pModManager->m_loadedMods)
if (mod.Enabled)
for (std::string& localisationFile : mod.LocalisationFiles)
AddLocalisationFile(g_pVguiLocalize, localisationFile.c_str(), pathId, unknown);
diff --git a/NorthstarDedicatedTest/modmanager.cpp b/NorthstarDedicatedTest/modmanager.cpp
index 88aea71e..27576456 100644
--- a/NorthstarDedicatedTest/modmanager.cpp
+++ b/NorthstarDedicatedTest/modmanager.cpp
@@ -18,7 +18,7 @@
#include "rpakfilesystem.h"
#include "configurables.h"
-ModManager* g_ModManager;
+ModManager* g_pModManager;
Mod::Mod(fs::path modDir, char* jsonBuf)
{
@@ -444,7 +444,7 @@ void ModManager::LoadMods()
{
if (fs::is_regular_file(file))
{
- std::string kvStr = g_ModManager->NormaliseModFilePath(file.path().lexically_relative(mod.ModDirectory / "keyvalues"));
+ std::string kvStr = g_pModManager->NormaliseModFilePath(file.path().lexically_relative(mod.ModDirectory / "keyvalues"));
mod.KeyValues.emplace(STR_HASH(kvStr), kvStr);
}
}
@@ -503,7 +503,7 @@ void ModManager::LoadMods()
for (fs::directory_entry file : fs::recursive_directory_iterator(m_loadedMods[i].ModDirectory / MOD_OVERRIDE_DIR))
{
std::string path =
- g_ModManager->NormaliseModFilePath(file.path().lexically_relative(m_loadedMods[i].ModDirectory / MOD_OVERRIDE_DIR));
+ g_pModManager->NormaliseModFilePath(file.path().lexically_relative(m_loadedMods[i].ModDirectory / MOD_OVERRIDE_DIR));
if (file.is_regular_file() && m_modFiles.find(path) == m_modFiles.end())
{
ModOverrideFile modFile;
@@ -624,7 +624,7 @@ void ModManager::CompileAssetsForFile(const char* filename)
void ConCommand_reload_mods(const CCommand& args)
{
- g_ModManager->LoadMods();
+ g_pModManager->LoadMods();
}
fs::path GetModFolderPath()
@@ -638,7 +638,7 @@ fs::path GetCompiledAssetsPath()
ON_DLL_LOAD_RELIESON("engine.dll", ModManager, ConCommand, [](HMODULE baseAddress)
{
- g_ModManager = new ModManager;
+ g_pModManager = new ModManager;
RegisterConCommand("reload_mods", ConCommand_reload_mods, "reloads mods", FCVAR_NONE);
}) \ No newline at end of file
diff --git a/NorthstarDedicatedTest/modmanager.h b/NorthstarDedicatedTest/modmanager.h
index faaba7db..6d89e934 100644
--- a/NorthstarDedicatedTest/modmanager.h
+++ b/NorthstarDedicatedTest/modmanager.h
@@ -144,4 +144,4 @@ class ModManager
fs::path GetModFolderPath();
fs::path GetCompiledAssetsPath();
-extern ModManager* g_ModManager; \ No newline at end of file
+extern ModManager* g_pModManager; \ No newline at end of file
diff --git a/NorthstarDedicatedTest/rpakfilesystem.cpp b/NorthstarDedicatedTest/rpakfilesystem.cpp
index 03df9917..1e44ed50 100644
--- a/NorthstarDedicatedTest/rpakfilesystem.cpp
+++ b/NorthstarDedicatedTest/rpakfilesystem.cpp
@@ -52,9 +52,9 @@ void PakLoadManager::UnloadPaks()
void HandlePakAliases(char** map)
{
// convert the pak being loaded to it's aliased one, e.g. aliasing mp_hub_timeshift => sp_hub_timeshift
- for (int64_t i = g_ModManager->m_loadedMods.size() - 1; i > -1; i--)
+ for (int64_t i = g_pModManager->m_loadedMods.size() - 1; i > -1; i--)
{
- Mod* mod = &g_ModManager->m_loadedMods[i];
+ Mod* mod = &g_pModManager->m_loadedMods[i];
if (!mod->Enabled)
continue;
@@ -69,7 +69,7 @@ void HandlePakAliases(char** map)
void LoadPreloadPaks()
{
// note, loading from ./ is necessary otherwise paks will load from gamedir/r2/paks
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Enabled)
continue;
@@ -89,7 +89,7 @@ void LoadCustomMapPaks(char** pakName, bool* bNeedToFreePakName)
bool bHasOriginalPak = fs::exists(fs::path("./r2/paks/Win64/") / *pakName);
// note, loading from ./ is necessary otherwise paks will load from gamedir/r2/paks
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Enabled)
continue;
@@ -189,8 +189,8 @@ void* ReadFullFileFromDiskHook(const char* requestedPath, void* a2)
// resolve modded stbsp path so we can load mod stbsps
- auto modFile = g_ModManager->m_modFiles.find(g_ModManager->NormaliseModFilePath(fs::path("maps" / filename)));
- if (modFile != g_ModManager->m_modFiles.end())
+ auto modFile = g_pModManager->m_modFiles.find(g_pModManager->NormaliseModFilePath(fs::path("maps" / filename)));
+ if (modFile != g_pModManager->m_modFiles.end())
{
// need to allocate a new string for this
std::string newPath = (modFile->second.owningMod->ModDirectory / "mod" / modFile->second.path).string();
diff --git a/NorthstarDedicatedTest/scriptmodmenu.cpp b/NorthstarDedicatedTest/scriptmodmenu.cpp
index 75f75d44..df25cd1e 100644
--- a/NorthstarDedicatedTest/scriptmodmenu.cpp
+++ b/NorthstarDedicatedTest/scriptmodmenu.cpp
@@ -9,7 +9,7 @@ SQRESULT SQ_GetModNames(void* sqvm)
{
g_pClientSquirrel->sq_newarray(sqvm, 0);
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
g_pClientSquirrel->sq_pushstring(sqvm, mod.Name.c_str(), -1);
g_pClientSquirrel->sq_arrayappend(sqvm, -2);
@@ -24,7 +24,7 @@ SQRESULT SQ_IsModEnabled(void* sqvm)
const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
@@ -43,7 +43,7 @@ SQRESULT SQ_SetModEnabled(void* sqvm)
const SQBool enabled = g_pClientSquirrel->sq_getbool(sqvm, 2);
// manual lookup, not super performant but eh not a big deal
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
@@ -61,7 +61,7 @@ SQRESULT SQ_GetModDescription(void* sqvm)
const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
@@ -79,7 +79,7 @@ SQRESULT SQ_GetModVersion(void* sqvm)
const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
@@ -97,7 +97,7 @@ SQRESULT SQ_GetModDownloadLink(void* sqvm)
const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
@@ -115,7 +115,7 @@ SQRESULT SQ_GetModLoadPriority(void* sqvm)
const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
@@ -133,7 +133,7 @@ SQRESULT SQ_IsModRequiredOnClient(void* sqvm)
const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
@@ -152,7 +152,7 @@ SQRESULT SQ_GetModConvars(void* sqvm)
g_pClientSquirrel->sq_newarray(sqvm, 0);
// manual lookup, not super performant but eh not a big deal
- for (Mod& mod : g_ModManager->m_loadedMods)
+ for (Mod& mod : g_pModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
@@ -172,7 +172,7 @@ SQRESULT SQ_GetModConvars(void* sqvm)
// void function NSReloadMods()
SQRESULT SQ_ReloadMods(void* sqvm)
{
- g_ModManager->LoadMods();
+ g_pModManager->LoadMods();
return SQRESULT_NULL;
}
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp
index 32092ec9..3802404c 100644
--- a/NorthstarDedicatedTest/squirrel.cpp
+++ b/NorthstarDedicatedTest/squirrel.cpp
@@ -176,7 +176,7 @@ template <ScriptContext context> bool CallScriptInitCallbackHook(void* sqvm, con
if (shouldCallCustomCallbacks)
{
- for (Mod mod : g_ModManager->m_loadedMods)
+ for (Mod mod : g_pModManager->m_loadedMods)
{
if (!mod.Enabled)
continue;
@@ -203,7 +203,7 @@ template <ScriptContext context> bool CallScriptInitCallbackHook(void* sqvm, con
// run after callbacks
if (shouldCallCustomCallbacks)
{
- for (Mod mod : g_ModManager->m_loadedMods)
+ for (Mod mod : g_pModManager->m_loadedMods)
{
if (!mod.Enabled)
continue;