diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2023-12-20 13:24:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-20 14:24:07 +0100 |
commit | 0438b5c8cfa99ac01c7e142d959aa40f88f1cc70 (patch) | |
tree | bbfdded20f8686cf188dba148db4b6c1b1211872 /NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp | |
parent | 210dab2b0e5c686829bafdc857d2910f6b216b85 (diff) | |
download | NorthstarLauncher-0438b5c8cfa99ac01c7e142d959aa40f88f1cc70.tar.gz NorthstarLauncher-0438b5c8cfa99ac01c7e142d959aa40f88f1cc70.zip |
Cherry pick "remove unnecessary namespaces" from primedev (#618)v1.21.2-rc2
Cherry-picks the removal of unnecessary namespaces from `primedev`
https://github.com/F1F7Y/NorthstarPrime/
Co-authored-by: F1F7Y <filip.bartos07@proton.me>
Diffstat (limited to 'NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp')
-rw-r--r-- | NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp index 8821a40d..8064d5ac 100644 --- a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp +++ b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp @@ -84,7 +84,7 @@ bool, __fastcall, (void* pMsg)) // 48 8B D1 48 8B 49 18 48 8B 01 48 FF 60 10 }; auto msg = (NET_SetConVar*)pMsg; - bool bIsServerFrame = Tier0::ThreadInServerFrameThread(); + bool bIsServerFrame = ThreadInServerFrameThread(); std::string BLOCK_PREFIX = std::string {"NET_SetConVar ("} + (bIsServerFrame ? "server" : "client") + "): Blocked dangerous/invalid msg: "; @@ -118,7 +118,7 @@ bool, __fastcall, (void* pMsg)) // 48 8B D1 48 8B 49 18 48 8B 01 48 FF 60 10 if (!nameValid || !valValid) return BLOCKED_INFO("Missing null terminators"); - ConVar* pVar = R2::g_pCVar->FindVar(entry->name); + ConVar* pVar = g_pCVar->FindVar(entry->name); if (pVar) { @@ -263,19 +263,19 @@ bool, __fastcall, (const char* pModName)) // 48 83 EC 28 48 8B 0D ? ? ? ? 48 8D { // somewhat temp, store the modname here, since we don't have a proper ptr in engine to it rn int iSize = strlen(pModName); - R2::g_pModName = new char[iSize + 1]; - strcpy(R2::g_pModName, pModName); + g_pModName = new char[iSize + 1]; + strcpy(g_pModName, pModName); if (g_pVanillaCompatibility->GetVanillaCompatibility()) return false; - return (!strcmp("r2", pModName) || !strcmp("r1", pModName)) && !Tier0::CommandLine()->CheckParm("-norestrictservercommands"); + return (!strcmp("r2", pModName) || !strcmp("r1", pModName)) && !CommandLine()->CheckParm("-norestrictservercommands"); } // ratelimit stringcmds, and prevent remote clients from calling commands that they shouldn't // clang-format off AUTOHOOK(CGameClient__ExecuteStringCommand, engine.dll + 0x1022E0, -bool, __fastcall, (R2::CBaseClient* self, uint32_t unknown, const char* pCommandString)) +bool, __fastcall, (CBaseClient* self, uint32_t unknown, const char* pCommandString)) // clang-format on { if (Cvar_ns_should_log_all_clientcommands->GetBool()) @@ -283,7 +283,7 @@ bool, __fastcall, (R2::CBaseClient* self, uint32_t unknown, const char* pCommand if (!g_pServerLimits->CheckStringCommandLimits(self)) { - R2::CBaseClient__Disconnect(self, 1, "Sent too many stringcmd commands"); + CBaseClient__Disconnect(self, 1, "Sent too many stringcmd commands"); return false; } @@ -292,10 +292,10 @@ bool, __fastcall, (R2::CBaseClient* self, uint32_t unknown, const char* pCommand memset(commandBuf, 0, sizeof(commandBuf)); CCommand tempCommand = *(CCommand*)&commandBuf; - if (!R2::CCommand__Tokenize(tempCommand, pCommandString, R2::cmd_source_t::kCommandSrcCode) || !tempCommand.ArgC()) + if (!CCommand__Tokenize(tempCommand, pCommandString, cmd_source_t::kCommandSrcCode) || !tempCommand.ArgC()) return false; - ConCommand* command = R2::g_pCVar->FindCommand(tempCommand.Arg(0)); + ConCommand* command = g_pCVar->FindCommand(tempCommand.Arg(0)); // if the command doesn't exist pass it on to ExecuteStringCommand for script clientcommands and stuff if (command && !command->IsFlagSet(FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS)) @@ -304,7 +304,7 @@ bool, __fastcall, (R2::CBaseClient* self, uint32_t unknown, const char* pCommand if (IsDedicatedServer()) return false; - if (strcmp(self->m_UID, R2::g_pLocalPlayerUserID)) + if (strcmp(self->m_UID, g_pLocalPlayerUserID)) return false; } @@ -355,7 +355,7 @@ void, __fastcall, (void* self)) bWasWritingStringTableSuccessful = true; CBaseClient__SendServerInfo(self); if (!bWasWritingStringTableSuccessful) - R2::CBaseClient__Disconnect( + CBaseClient__Disconnect( self, 1, "Overflowed CNetworkStringTableContainer::WriteBaselines, try restarting your client and reconnecting"); } @@ -457,5 +457,5 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerExploitFixes, ConVar, (CModule module)) Cvar_ns_should_log_all_clientcommands = new ConVar("ns_should_log_all_clientcommands", "0", FCVAR_NONE, "Whether to log all clientcommands"); - Cvar_sv_cheats = R2::g_pCVar->FindVar("sv_cheats"); + Cvar_sv_cheats = g_pCVar->FindVar("sv_cheats"); } |