From 3ab2543626a7d85bd111ee1dbf7a5985fcc3202f Mon Sep 17 00:00:00 2001 From: SmileyAG <58108407+SmileyAG@users.noreply.github.com> Date: Sun, 10 Mar 2024 20:18:13 +0400 Subject: [PATCH] Removed noclip_anglehack hook and patching bytes to activate noclip in CoF --- BunnymodXT/modules/HwDLL.cpp | 31 ------------------------------- BunnymodXT/modules/HwDLL.hpp | 1 - BunnymodXT/modules/ServerDLL.cpp | 29 ----------------------------- BunnymodXT/modules/ServerDLL.hpp | 1 - BunnymodXT/patterns.hpp | 16 ---------------- 5 files changed, 78 deletions(-) diff --git a/BunnymodXT/modules/HwDLL.cpp b/BunnymodXT/modules/HwDLL.cpp index f285b03d..cd4c39fe 100644 --- a/BunnymodXT/modules/HwDLL.cpp +++ b/BunnymodXT/modules/HwDLL.cpp @@ -774,7 +774,6 @@ void HwDLL::Clear() gLoadSky = nullptr; pHost_FilterTime_FPS_Cap_Byte = 0; cofSaveHack = nullptr; - noclip_anglehack = nullptr; frametime_remainder = nullptr; pstudiohdr = nullptr; scr_fov_value = nullptr; @@ -2008,26 +2007,6 @@ void HwDLL::FindStuff() } }); - void *CL_RegisterResources; - auto fCL_RegisterResources = FindAsync( - CL_RegisterResources, - patterns::engine::CL_RegisterResources, - [&](auto pattern) { - switch (pattern - patterns::engine::CL_RegisterResources.cbegin()) - { - default: - case 0: // CoF-5936. - noclip_anglehack = *reinterpret_cast(reinterpret_cast(CL_RegisterResources) + 216); - break; - case 1: // Steampipe. - noclip_anglehack = *reinterpret_cast(reinterpret_cast(CL_RegisterResources) + 237); - break; - case 2: // 4554. - noclip_anglehack = *reinterpret_cast(reinterpret_cast(CL_RegisterResources) + 204); - break; - } - }); - void *SV_LookupDelta; auto fSV_LookupDelta = FindAsync( SV_LookupDelta, @@ -2128,16 +2107,6 @@ void HwDLL::FindStuff() } } - { - auto pattern = fCL_RegisterResources.get(); - if (CL_RegisterResources) { - EngineDevMsg("[hw dll] Found CL_RegisterResources at %p (using the %s pattern).\n", CL_RegisterResources, pattern->name()); - EngineDevMsg("[hw dll] Found noclip_anglehack at %p.\n", noclip_anglehack); - } else { - EngineDevWarning("[hw dll] Could not find CL_RegisterResources.\n"); - } - } - { auto pattern = fHost_ValidSave.get(); if (ORIG_Host_ValidSave) { diff --git a/BunnymodXT/modules/HwDLL.hpp b/BunnymodXT/modules/HwDLL.hpp index 11e3a71e..ccd088df 100644 --- a/BunnymodXT/modules/HwDLL.hpp +++ b/BunnymodXT/modules/HwDLL.hpp @@ -561,7 +561,6 @@ class HwDLL : public IHookableNameFilterOrdered bool ducktap; edict_t **sv_player; - qboolean *noclip_anglehack; protected: void KeyDown(Key& btn); void KeyUp(Key& btn); diff --git a/BunnymodXT/modules/ServerDLL.cpp b/BunnymodXT/modules/ServerDLL.cpp index 8d9cda90..9871f520 100644 --- a/BunnymodXT/modules/ServerDLL.cpp +++ b/BunnymodXT/modules/ServerDLL.cpp @@ -312,7 +312,6 @@ void ServerDLL::Clear() offBhopcap = 0; pBhopcapWindows = 0; pCZDS_Velocity_Byte = 0; - pCoF_Noclip_Preventing_Check_Byte = 0; pCBasePlayer__Jump_OldButtons_Check_Byte = 0; offm_iClientFOV = 0; offm_rgAmmoLast = 0; @@ -767,20 +766,6 @@ void ServerDLL::FindStuff() } }); - auto fCoF_Noclip_Preventing_Check_Byte = FindAsync( - pCoF_Noclip_Preventing_Check_Byte, - patterns::server::CoF_Noclip_Preventing_Check_Byte, - [&](auto pattern) { - switch (pattern - patterns::server::CoF_Noclip_Preventing_Check_Byte.cbegin()) { - case 0: // CoF-5936 - case 1: // CoF-Mod-155 - pCoF_Noclip_Preventing_Check_Byte += 10; - break; - default: - assert(false); - } - }); - auto fCBasePlayer__Jump_OldButtons_Check_Byte = FindAsync( pCBasePlayer__Jump_OldButtons_Check_Byte, patterns::server::CBasePlayer__Jump_OldButtons_Check_Byte, @@ -899,12 +884,6 @@ void ServerDLL::FindStuff() } } - { - auto pattern = fCoF_Noclip_Preventing_Check_Byte.get(); - if (pCoF_Noclip_Preventing_Check_Byte) - EngineDevMsg("[server dll] Found noclip preventing check in CoF at %p (using the %s pattern).\n", pCoF_Noclip_Preventing_Check_Byte, pattern->name()); - } - { auto pattern = fCBasePlayer__Jump_OldButtons_Check_Byte.get(); if (pCBasePlayer__Jump_OldButtons_Check_Byte) @@ -1822,14 +1801,6 @@ void ServerDLL::CoFChanges() { if (is_cof) { - if (pCoF_Noclip_Preventing_Check_Byte) - { - if ((*reinterpret_cast(pCoF_Noclip_Preventing_Check_Byte) == 0x75) && (*HwDLL::GetInstance().noclip_anglehack)) - MemUtils::ReplaceBytes(reinterpret_cast(pCoF_Noclip_Preventing_Check_Byte), 1, reinterpret_cast("\xEB")); - else if ((*reinterpret_cast(pCoF_Noclip_Preventing_Check_Byte) == 0xEB) && !(*HwDLL::GetInstance().noclip_anglehack)) - MemUtils::ReplaceBytes(reinterpret_cast(pCoF_Noclip_Preventing_Check_Byte), 1, reinterpret_cast("\x75")); - } - if (pCBasePlayer__Jump_OldButtons_Check_Byte) { if (offm_rgAmmoLast == 0x25C0) { // CoF-5936 diff --git a/BunnymodXT/modules/ServerDLL.hpp b/BunnymodXT/modules/ServerDLL.hpp index 7c4650e9..073c6c85 100644 --- a/BunnymodXT/modules/ServerDLL.hpp +++ b/BunnymodXT/modules/ServerDLL.hpp @@ -207,7 +207,6 @@ class ServerDLL : public IHookableDirFilter ptrdiff_t pCBasePlayer__Jump_OldButtons_Check_Byte; - ptrdiff_t pCoF_Noclip_Preventing_Check_Byte; // Cry of Fear-specific ptrdiff_t offm_bInfiniteStamina; // Cry of Fear-specific ptrdiff_t offm_old_iAmmo; // Cry of Fear-specific ptrdiff_t offm_iPlayerSaveLock; // Cry of Fear-specific diff --git a/BunnymodXT/patterns.hpp b/BunnymodXT/patterns.hpp index 0955db24..452ae705 100644 --- a/BunnymodXT/patterns.hpp +++ b/BunnymodXT/patterns.hpp @@ -722,15 +722,6 @@ namespace patterns "55 8B EC 83 EC 24 83 3D ?? ?? ?? ?? 01" ); - PATTERNS(CL_RegisterResources, - "CoF-5936", - "55 8B EC 51 83 3D ?? ?? ?? ?? 00 75 ?? 83 3D ?? ?? ?? ?? 02", - "HL-Steampipe", - "55 8B EC A1 ?? ?? ?? ?? 57 85 C0 0F 85", - "HL-4554", - "A1 ?? ?? ?? ?? 56 85 C0 0F 85 ?? ?? ?? ?? 83 3D ?? ?? ?? ?? 02 75 0D 83 3D ?? ?? ?? ?? 05 0F 84 ?? ?? ?? ?? D9 05 ?? ?? ?? ?? D8 1D ?? ?? ?? ?? DF E0 F6 C4 ?? 75 0D" - ); - PATTERNS(SCR_NetGraph, "CoF-5936", "55 8B EC 81 EC 80 00 00 00 56 57 C7 45 ?? 00 00 00 00 C7 45 ?? 00 00 00 00", @@ -1100,13 +1091,6 @@ namespace patterns "55 8B EC 81 EC 1C 01 00 00 53 56 57 A1" ); - PATTERNS(CoF_Noclip_Preventing_Check_Byte, - "CoF-5936", - "8B 47 04 83 B8 ?? ?? ?? ?? 08 75 0D", - "CoF-Mod-155", - "8B 48 04 83 B9 ?? ?? ?? ?? 08 75 10" - ); - PATTERNS(CBasePlayer__Jump_OldButtons_Check_Byte, "CoF-Mod-155", "8B 45 ?? 8B 88 ?? ?? ?? ?? 83 E1 02 75 ?? E9",