aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/modmanager.cpp
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2022-03-28 23:48:05 +0200
committerGitHub <noreply@github.com>2022-03-28 23:48:05 +0200
commitb8a7feabea6456f7fa5e8403c8d9bd2630401045 (patch)
treed6fa62ef39eb4fcfac1c1711f49ad86b2b6c59d3 /NorthstarDedicatedTest/modmanager.cpp
parent379cbc8bc251307777a14b901e5617e834398485 (diff)
downloadNorthstarLauncher-b8a7feabea6456f7fa5e8403c8d9bd2630401045.tar.gz
NorthstarLauncher-b8a7feabea6456f7fa5e8403c8d9bd2630401045.zip
More exploit fixes by KIttenPopo (#126)
* Quick fix for a bug I caused * Typo * Update kitten-fixes branch to my repo (#122) * Added string hash macro * Added convenient vtfunc macro * Made lil ConCommand creation macro * Fixed multiple NET_SetConVar exploits * Quick fixerino * Fix convar struct (and other things) * Revive clang-format (but good, i think) * Update .clang-format * Reformatted code to meet .clang-format requirements * Minor formatting fixes * Fixed Northstar "crashing" when console is closed * Update .clang-format * Quick fix for a bug I caused * Typo * NSMem Update * ExplotFixes: Only block excessive convar counts if server * Update ExploitFixes.cpp * Update ExploitFixes.cpp * Updated bytepatch format * reformatted all code for clang-format * Updated my clang-format to v13.0.0 * 3 fixes in 1 - ANTITAMPER fixed - NSMem simplification update - Fixed bad byte string in serverauthentication.cpp * Improved ExploitFixes logging and NET_SetConVar patch * clang-format unironically sabotaged my code * Made ns_exploitfixes_log on by default * Fixed IsMemoryReadable (oops) Co-authored-by: KittenPopo <Pokeberry123@gmail.com>
Diffstat (limited to 'NorthstarDedicatedTest/modmanager.cpp')
-rw-r--r--NorthstarDedicatedTest/modmanager.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/NorthstarDedicatedTest/modmanager.cpp b/NorthstarDedicatedTest/modmanager.cpp
index 99bb5fdb..0ac7e4b6 100644
--- a/NorthstarDedicatedTest/modmanager.cpp
+++ b/NorthstarDedicatedTest/modmanager.cpp
@@ -194,7 +194,7 @@ ModManager::ModManager()
m_hScriptsRsonHash = STR_HASH("scripts\\vscripts\\scripts.rson");
m_hPdefHash = STR_HASH(
"cfg\\server\\persistent_player_data_version_231.pdef" // this can have multiple versions, but we use 231 so that's what we hash
- );
+ );
LoadMods();
}
@@ -283,7 +283,8 @@ void ModManager::LoadMods()
// preexisting convars note: we don't delete convars if they already exist because they're used for script stuff, unfortunately this
// causes us to leak memory on reload, but not much, potentially find a way to not do this at some point
for (ModConVar* convar : mod.ConVars)
- if (!g_pCVar->FindVar(convar->Name.c_str())) // make sure convar isn't registered yet, unsure if necessary but idk what behaviour is for defining same convar multiple times
+ if (!g_pCVar->FindVar(convar->Name.c_str())) // make sure convar isn't registered yet, unsure if necessary but idk what
+ // behaviour is for defining same convar multiple times
new ConVar(convar->Name.c_str(), convar->DefaultValue.c_str(), convar->Flags, convar->HelpString.c_str());
// read vpk paths
@@ -305,8 +306,7 @@ void ModManager::LoadMods()
dVpkJson.Parse<rapidjson::ParseFlag::kParseCommentsFlag | rapidjson::ParseFlag::kParseTrailingCommasFlag>(
vpkJsonStringStream.str().c_str());
- bUseVPKJson =
- !dVpkJson.HasParseError() && dVpkJson.IsObject();
+ bUseVPKJson = !dVpkJson.HasParseError() && dVpkJson.IsObject();
}
for (fs::directory_entry file : fs::directory_iterator(mod.ModDirectory / "vpk"))
@@ -324,7 +324,8 @@ void ModManager::LoadMods()
(file.path().parent_path() / formattedPath.substr(strlen("english"), formattedPath.find(".bsp") - 3)).string();
ModVPKEntry& modVpk = mod.Vpks.emplace_back();
- modVpk.m_bAutoLoad = !bUseVPKJson || (dVpkJson.HasMember("Preload") && dVpkJson["Preload"].IsObject() && dVpkJson["Preload"].HasMember(vpkName) && dVpkJson["Preload"][vpkName].IsTrue());
+ modVpk.m_bAutoLoad = !bUseVPKJson || (dVpkJson.HasMember("Preload") && dVpkJson["Preload"].IsObject() &&
+ dVpkJson["Preload"].HasMember(vpkName) && dVpkJson["Preload"][vpkName].IsTrue());
modVpk.m_sVpkPath = vpkName;
if (m_hasLoadedMods && modVpk.m_bAutoLoad)
@@ -352,8 +353,7 @@ void ModManager::LoadMods()
dRpakJson.Parse<rapidjson::ParseFlag::kParseCommentsFlag | rapidjson::ParseFlag::kParseTrailingCommasFlag>(
rpakJsonStringStream.str().c_str());
- bUseRpakJson =
- !dRpakJson.HasParseError() && dRpakJson.IsObject();
+ bUseRpakJson = !dRpakJson.HasParseError() && dRpakJson.IsObject();
}
// read pak aliases
@@ -377,11 +377,13 @@ void ModManager::LoadMods()
std::string pakName(file.path().filename().string());
ModRpakEntry& modPak = mod.Rpaks.emplace_back();
- modPak.m_bAutoLoad = !bUseRpakJson || (dRpakJson.HasMember("Preload") && dRpakJson["Preload"].IsObject() && dRpakJson["Preload"].HasMember(pakName) && dRpakJson["Preload"][pakName].IsTrue());
+ modPak.m_bAutoLoad =
+ !bUseRpakJson || (dRpakJson.HasMember("Preload") && dRpakJson["Preload"].IsObject() &&
+ dRpakJson["Preload"].HasMember(pakName) && dRpakJson["Preload"][pakName].IsTrue());
modPak.m_sPakPath = pakName;
// not using atm because we need to resolve path to rpak
- //if (m_hasLoadedMods && modPak.m_bAutoLoad)
+ // if (m_hasLoadedMods && modPak.m_bAutoLoad)
// g_PakLoadManager->LoadPakAsync(pakName.c_str());
}
}