diff options
author | F1F7Y <64418963+F1F7Y@users.noreply.github.com> | 2023-07-07 12:28:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-07 12:28:35 +0200 |
commit | 513705e33f59273c5b463c0da874a0066e8d0589 (patch) | |
tree | 76c66af8d46d0cdd864cefcc2ef9a237a80ddb5b /NorthstarDLL/shared | |
parent | 043fb83d8febc9d277064d5b24e60832375a110f (diff) | |
download | NorthstarLauncher-513705e33f59273c5b463c0da874a0066e8d0589.tar.gz NorthstarLauncher-513705e33f59273c5b463c0da874a0066e8d0589.zip |
Memory class renaming (#469)
- Renames `MemoryAddress` to `CMemoryAddress`
- Renames `CMemoryAddress::As` to `CMemoryAddress::RCast`
Diffstat (limited to 'NorthstarDLL/shared')
-rw-r--r-- | NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp | 8 | ||||
-rw-r--r-- | NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp | 4 | ||||
-rw-r--r-- | NorthstarDLL/shared/exploit_fixes/ns_limits.cpp | 2 | ||||
-rw-r--r-- | NorthstarDLL/shared/keyvalues.cpp | 6 | ||||
-rw-r--r-- | NorthstarDLL/shared/maxplayers.cpp | 18 | ||||
-rw-r--r-- | NorthstarDLL/shared/misccommands.cpp | 2 |
6 files changed, 20 insertions, 20 deletions
diff --git a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp index 338de306..2a0a9c2c 100644 --- a/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp +++ b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp @@ -98,7 +98,7 @@ bool, __fastcall, (void* pMsg)) // 48 8B D1 48 8B 49 18 48 8B 01 48 FF 60 10 auto entry = msg->m_ConVars + i; // Safety check for memory access - if (MemoryAddress(entry).IsMemoryReadable(sizeof(*entry))) + if (CMemoryAddress(entry).IsMemoryReadable(sizeof(*entry))) { // Find null terminators bool nameValid = false, valValid = false; @@ -405,9 +405,9 @@ ON_DLL_LOAD("engine.dll", EngineExploitFixes, (CModule module)) // patch to set bWasWritingStringTableSuccessful in CNetworkStringTableContainer::WriteBaselines if it fails { - MemoryAddress writeAddress(&bWasWritingStringTableSuccessful - module.Offset(0x234EDC).m_nAddress); + CMemoryAddress writeAddress(&bWasWritingStringTableSuccessful - module.Offset(0x234EDC).m_nAddress); - MemoryAddress addr = module.Offset(0x234ED2); + CMemoryAddress addr = module.Offset(0x234ED2); addr.Patch("C7 05"); addr.Offset(2).Patch((BYTE*)&writeAddress, sizeof(writeAddress)); @@ -435,7 +435,7 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerExploitFixes, ConVar, (CModule module)) // Prevent these from actually doing anything for (auto exportName : ANTITAMPER_EXPORTS) { - MemoryAddress exportAddr = module.GetExport(exportName); + CMemoryAddress exportAddr = module.GetExport(exportName); if (exportAddr) { // Just return, none of them have any args or are userpurge diff --git a/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp b/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp index de0b0f21..3d97f750 100644 --- a/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp +++ b/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp @@ -67,7 +67,7 @@ bool __fastcall CheckUTF8Valid(INT64* a1, DWORD* a2, char* strData) { while (1) { - if (!MemoryAddress(v4).IsMemoryReadable(1)) + if (!CMemoryAddress(v4).IsMemoryReadable(1)) return false; // INVALID v11 = *v4++; // crash potential @@ -195,5 +195,5 @@ ON_DLL_LOAD("engine.dll", EngineExploitFixes_UTF8Parser, (CModule module)) { AUTOHOOK_DISPATCH() - sub_F1320 = module.FindPattern("83 F9 7F 77 08 88 0A").As<INT64(__fastcall*)(DWORD, char*)>(); + sub_F1320 = module.FindPattern("83 F9 7F 77 08 88 0A").RCast<INT64(__fastcall*)(DWORD, char*)>(); } diff --git a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp index e69ef41c..c9085cb0 100644 --- a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp +++ b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp @@ -289,7 +289,7 @@ ON_DLL_LOAD_RELIESON("engine.dll", ServerLimits, ConVar, (CModule module)) FCVAR_GAMEDLL, "Increase usercmd processing budget by tickinterval * value per tick"); - CEngineServer__GetTimescale = module.Offset(0x240840).As<float (*)()>(); + CEngineServer__GetTimescale = module.Offset(0x240840).RCast<float (*)()>(); } ON_DLL_LOAD("server.dll", ServerLimitsServer, (CModule module)) diff --git a/NorthstarDLL/shared/keyvalues.cpp b/NorthstarDLL/shared/keyvalues.cpp index 06ed8d68..aa22ca65 100644 --- a/NorthstarDLL/shared/keyvalues.cpp +++ b/NorthstarDLL/shared/keyvalues.cpp @@ -1289,9 +1289,9 @@ KeyValues* KeyValues::MakeCopy(void) const ON_DLL_LOAD("vstdlib.dll", KeyValues, (CModule module)) { - V_UTF8ToUnicode = module.GetExport("V_UTF8ToUnicode").As<int (*)(const char*, wchar_t*, int)>(); - V_UnicodeToUTF8 = module.GetExport("V_UnicodeToUTF8").As<int (*)(const wchar_t*, char*, int)>(); - KeyValuesSystem = module.GetExport("KeyValuesSystem").As<CKeyValuesSystem* (*)()>(); + V_UTF8ToUnicode = module.GetExport("V_UTF8ToUnicode").RCast<int (*)(const char*, wchar_t*, int)>(); + V_UnicodeToUTF8 = module.GetExport("V_UnicodeToUTF8").RCast<int (*)(const wchar_t*, char*, int)>(); + KeyValuesSystem = module.GetExport("KeyValuesSystem").RCast<CKeyValuesSystem* (*)()>(); } AUTOHOOK_INIT() diff --git a/NorthstarDLL/shared/maxplayers.cpp b/NorthstarDLL/shared/maxplayers.cpp index dcf4044e..b2a09578 100644 --- a/NorthstarDLL/shared/maxplayers.cpp +++ b/NorthstarDLL/shared/maxplayers.cpp @@ -64,7 +64,7 @@ namespace R2 // use R2 namespace for game funcs } } // namespace R2 -template <class T> void ChangeOffset(MemoryAddress addr, unsigned int offset) +template <class T> void ChangeOffset(CMemoryAddress addr, unsigned int offset) { addr.Patch((BYTE*)&offset, sizeof(T)); } @@ -432,8 +432,8 @@ ON_DLL_LOAD("server.dll", MaxPlayersOverride_Server, (CModule module)) ChangeOffset<unsigned int>(module.Offset(0x5C6654 + 3), CPlayerResource_OriginalSize + PlayerResource_KillStats_Start); ChangeOffset<unsigned int>(module.Offset(0x5C665B + 3), CPlayerResource_OriginalSize + PlayerResource_KillStats_Start); - *module.Offset(0x14E7390).As<DWORD*>() = 0; - auto DT_PlayerResource_Construct = module.Offset(0x5C4FE0).As<__int64(__fastcall*)()>(); + *module.Offset(0x14E7390).RCast<DWORD*>() = 0; + auto DT_PlayerResource_Construct = module.Offset(0x5C4FE0).RCast<__int64(__fastcall*)()>(); DT_PlayerResource_Construct(); constexpr int CTeam_OriginalSize = 3336; @@ -446,8 +446,8 @@ ON_DLL_LOAD("server.dll", MaxPlayersOverride_Server, (CModule module)) // CTeam::CTeam - increase memset length to clean newly allocated data ChangeOffset<unsigned int>(module.Offset(0x2395AE + 2), 256 + CTeam_AddedSize); - *module.Offset(0xC945A0).As<DWORD*>() = 0; - auto DT_Team_Construct = module.Offset(0x238F50).As<__int64(__fastcall*)()>(); + *module.Offset(0xC945A0).RCast<DWORD*>() = 0; + auto DT_Team_Construct = module.Offset(0x238F50).RCast<__int64(__fastcall*)()>(); DT_Team_Construct(); } @@ -621,8 +621,8 @@ ON_DLL_LOAD("client.dll", MaxPlayersOverride_Client, (CModule module)) // Some other get name func 2 (that seems to be unused too) - change m_bConnected address ChangeOffset<unsigned int>(module.Offset(0x164834 + 3), C_PlayerResource_OriginalSize + PlayerResource_Connected_Start); - *module.Offset(0xC35068).As<DWORD*>() = 0; - auto DT_PlayerResource_Construct = module.Offset(0x163400).As<__int64(__fastcall*)()>(); + *module.Offset(0xC35068).RCast<DWORD*>() = 0; + auto DT_PlayerResource_Construct = module.Offset(0x163400).RCast<__int64(__fastcall*)()>(); DT_PlayerResource_Construct(); constexpr int C_Team_OriginalSize = 3200; @@ -638,7 +638,7 @@ ON_DLL_LOAD("client.dll", MaxPlayersOverride_Client, (CModule module)) // DT_Team size ChangeOffset<unsigned int>(module.Offset(0xC3AA0C), C_Team_ModifiedSize); - *module.Offset(0xC3AFF8).As<DWORD*>() = 0; - auto DT_Team_Construct = module.Offset(0x17F950).As<__int64(__fastcall*)()>(); + *module.Offset(0xC3AFF8).RCast<DWORD*>() = 0; + auto DT_Team_Construct = module.Offset(0x17F950).RCast<__int64(__fastcall*)()>(); DT_Team_Construct(); } diff --git a/NorthstarDLL/shared/misccommands.cpp b/NorthstarDLL/shared/misccommands.cpp index 15e12720..5d9ced99 100644 --- a/NorthstarDLL/shared/misccommands.cpp +++ b/NorthstarDLL/shared/misccommands.cpp @@ -172,7 +172,7 @@ void FixupCvarFlags() // make all engine client commands FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS // these are usually checked through CGameClient::IsEngineClientCommand, but we get more control over this if we just do it through // cvar flags - const char** ppEngineClientCommands = CModule("engine.dll").Offset(0x7C5EF0).As<const char**>(); + const char** ppEngineClientCommands = CModule("engine.dll").Offset(0x7C5EF0).RCast<const char**>(); int i = 0; do |