Skip to content

Commit

Permalink
Removed noclip_anglehack hook and patching bytes to activate noclip i…
Browse files Browse the repository at this point in the history
…n CoF
  • Loading branch information
SmileyAG authored and YaLTeR committed Mar 13, 2024
1 parent 5c98ee1 commit 3ab2543
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 78 deletions.
31 changes: 0 additions & 31 deletions BunnymodXT/modules/HwDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<qboolean**>(reinterpret_cast<uintptr_t>(CL_RegisterResources) + 216);
break;
case 1: // Steampipe.
noclip_anglehack = *reinterpret_cast<qboolean**>(reinterpret_cast<uintptr_t>(CL_RegisterResources) + 237);
break;
case 2: // 4554.
noclip_anglehack = *reinterpret_cast<qboolean**>(reinterpret_cast<uintptr_t>(CL_RegisterResources) + 204);
break;
}
});

void *SV_LookupDelta;
auto fSV_LookupDelta = FindAsync(
SV_LookupDelta,
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion BunnymodXT/modules/HwDLL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
29 changes: 0 additions & 29 deletions BunnymodXT/modules/ServerDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1822,14 +1801,6 @@ void ServerDLL::CoFChanges()
{
if (is_cof)
{
if (pCoF_Noclip_Preventing_Check_Byte)
{
if ((*reinterpret_cast<byte*>(pCoF_Noclip_Preventing_Check_Byte) == 0x75) && (*HwDLL::GetInstance().noclip_anglehack))
MemUtils::ReplaceBytes(reinterpret_cast<void*>(pCoF_Noclip_Preventing_Check_Byte), 1, reinterpret_cast<const byte*>("\xEB"));
else if ((*reinterpret_cast<byte*>(pCoF_Noclip_Preventing_Check_Byte) == 0xEB) && !(*HwDLL::GetInstance().noclip_anglehack))
MemUtils::ReplaceBytes(reinterpret_cast<void*>(pCoF_Noclip_Preventing_Check_Byte), 1, reinterpret_cast<const byte*>("\x75"));
}

if (pCBasePlayer__Jump_OldButtons_Check_Byte)
{
if (offm_rgAmmoLast == 0x25C0) { // CoF-5936
Expand Down
1 change: 0 additions & 1 deletion BunnymodXT/modules/ServerDLL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions BunnymodXT/patterns.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 3ab2543

Please sign in to comment.