Skip to content

Commit 0cac604

Browse files
committed
feat: Continued reorganize and build apon the hook system
1 parent ef8092a commit 0cac604

File tree

11 files changed

+324
-132
lines changed

11 files changed

+324
-132
lines changed

src/commands.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "stdafx.hpp"
99
#include "commands.hpp"
1010

11+
#include "signatures.hpp"
1112
#include "utils.hpp"
1213

1314
//---------------------------------------------------------------------------------
@@ -22,15 +23,15 @@ ConVar p2sm_multiplayer_instantrespawn("p2sm_multiplayer_instantrespawn", "0", F
2223

2324
static void ChangePtexVolumetricState(IConVar* var, const char* pOldValue, float flOldValue)
2425
{
25-
if (!dynamic_cast<ConVar*>(var)->GetBool())
26+
if (dynamic_cast<ConVar*>(var)->GetBool())
2627
{
27-
Log(INFO, false, "Disabled volumetrics for projected textures...");
28-
Memory::ReplacePattern("engine", "0F 84 47 0C 00 00 80 BF 10 02 00 00 00 0F 85 3A 0C 00 00", "0F 85 47 0C 00 00 80 BF 10 02 00 00 00 0F 84 3A 0C 00 00");
28+
Log(INFO, false, "Enabled volumetrics for projected textures...");
29+
Memory::ReplacePattern("engine", Signature::CShadowMgr_DrawVolumetrics_VolState, Signature::CShadowMgr_DrawVolumetrics_VolState_Patch);
2930
}
3031
else
3132
{
32-
Log(INFO, false, "Enabled volumetrics for projected textures...");
33-
Memory::ReplacePattern("engine", "0F 85 47 0C 00 00 80 BF 10 02 00 00 00 0F 84 3A 0C 00 00", "0F 84 47 0C 00 00 80 BF 10 02 00 00 00 0F 85 3A 0C 00 00");
33+
Log(INFO, false, "Disabled volumetrics for projected textures...");
34+
Memory::ReplacePattern("engine", Signature::CShadowMgr_DrawVolumetrics_VolState_Patch, Signature::CShadowMgr_DrawVolumetrics_VolState);
3435
}
3536
}
3637
ConVar p2sm_ptex_volumetrics("p2sm_ptex_volumetrics", "0", FCVAR_NONE, "Enable or disable volumetrics for projected textures.", ChangePtexVolumetricState);

src/modules/cportal_player.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ REDECL(CPortal_Player::FlashlightTurnOff);
2727
/**
2828
* @brief For hooking onto the function that is called before a player respawns to skip the delay that is usual there and instead force a instant respawn of the player.
2929
*/
30-
DECL_HOOK(CPortal_Player::PlayerDeathThink_Hook, CPortal_Player_PlayerDeathThink);
30+
DEFINE_HOOK(CPortal_Player, PlayerDeathThink);
3131
DETOUR_T(void, CPortal_Player::PlayerDeathThink)
3232
{
3333
if (p2sm_multiplayer_instantrespawn.GetBool())
@@ -36,17 +36,17 @@ DETOUR_T(void, CPortal_Player::PlayerDeathThink)
3636
return;
3737
}
3838

39-
h_CPortal_Player_PlayerDeathThink.Disable();
39+
h_PlayerDeathThink->Disable();
4040
CPortal_Player::PlayerDeathThink(thisPtr);
41-
h_CPortal_Player_PlayerDeathThink.Enable();
41+
h_PlayerDeathThink->Enable();
4242
}
4343

4444
/**
4545
* @brief Player flashlight turn on hook.
4646
* @param playSound If flashlight sound should play. Coded to always pass as false.
4747
* @return If flashlight was enabled successfully.
4848
*/
49-
DECL_HOOK(CPortal_Player::FlashlightTurnOn_Hook, CPortal_Player_FlashlightTurnOn);
49+
DEFINE_HOOK(CPortal_Player, FlashlightTurnOn);
5050
DETOUR_T(bool, CPortal_Player::FlashlightTurnOn, bool playSound)
5151
{
5252
CBaseEntity* pEntity = static_cast<CBaseEntity*>(thisPtr);
@@ -69,7 +69,8 @@ DETOUR_T(bool, CPortal_Player::FlashlightTurnOn, bool playSound)
6969
* @brief Player flashlight turn off hook.
7070
* @param playSound If flashlight sound should play. Coded to always pass as false.
7171
*/
72-
DECL_HOOK(CPortal_Player::FlashlightTurnOff_Hook, CPortal_Player_FlashlightTurnOff);
72+
DEFINE_HOOK(CPortal_Player, FlashlightTurnOff);
73+
//Hook* CPortal_Player::h_CPortal_Player_FlashlightTurnOff = nullptr;
7374
DETOUR_T(void, CPortal_Player::FlashlightTurnOff, bool playSound)
7475
{
7576
CBaseEntity* pEntity = static_cast<CBaseEntity*>(thisPtr);

src/modules/cportal_player.hpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
#ifndef CPORTAL_PLAYER_HPP
1111
#define CPORTAL_PLAYER_HPP
1212

13+
#include "hook.hpp"
1314
#include "utils/platform.hpp"
1415

16+
class Hook;
17+
1518
// Respawn Hooks.
1619
// extern void (__fastcall* CPortal_Player__PlayerDeathThink_orig)(CPortal_Player* thisPtr);
1720
// void __fastcall CPortal_Player__PlayerDeathThink_hook(CPortal_Player* thisPtr);
@@ -28,23 +31,17 @@ class CPortal_Player
2831
#pragma region Public Members
2932

3033
// Player respawn hook.
34+
DECL_HOOK(PlayerDeathThink);
3135
DECL_DETOUR_T(void, PlayerDeathThink);
32-
// using _PlayerDeathThink = void(__thiscall*)(void* thisPtr);
33-
// static _PlayerDeathThink PlayerDeathThink;
34-
// static void __fastcall PlayerDeathThink_Hook(void* thisPtr, int edx);
3536

3637
// Flashlight turn on hook.
38+
DECL_HOOK(FlashlightTurnOn);
3739
DECL_DETOUR_T(bool, FlashlightTurnOn, bool playSound);
38-
// using _FlashlightTurnOn = bool(__thiscall*)(void* thisPtr, bool playSound);
39-
// static _FlashlightTurnOn FlashlightTurnOn;
40-
// static bool __fastcall FlashlightTurnOn_Hook(void* thisPtr, int edx, bool playSound);
4140

4241
// Flashlight turn off hook.
42+
DECL_HOOK(FlashlightTurnOff);
4343
DECL_DETOUR_T(void, FlashlightTurnOff, bool playSound);
44-
// using _FlashlightTurnOff = void(__thiscall*)(void* thisPtr, bool playSound);
45-
// static _FlashlightTurnOff FlashlightTurnOff;
46-
// static void __fastcall FlashlightTurnOff_Hook(void* thisPtr, int edx, bool playSound);
47-
44+
4845
static void RespawnPlayer(int playerEntityIndex);
4946
static void SetFlashlightState(int playerEntityIndex, bool enabled);
5047

src/modules/misc.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ REDECL(CPrecipitation::Spawn);
1919
* @brief Stop the UGC manager from automatically download workshop maps. Simply return doing nothing so that nothing gets updated and therefore nothing gets downloaded.
2020
* @warning This makes the game extremely unstable, most of the time crashing, if the plugin is unloaded while the game is running.
2121
*/
22-
DECL_HOOK(CUGCFileRequestManager::Update_Hook, CUGCFileRequestManager_Update);
22+
DEFINE_HOOK(CUGCFileRequestManager, Update);
2323
DETOUR_T(void, CUGCFileRequestManager::Update)
2424
{
2525
return;
@@ -28,11 +28,11 @@ DETOUR_T(void, CUGCFileRequestManager::Update)
2828
/**
2929
* @brief func_precipitation entity brushes are bugged where they need to set to the world origin to function properly.
3030
*/
31-
DECL_HOOK(CPrecipitation::Spawn_Hook, CPrecipitation_Spawn);
31+
DEFINE_HOOK(CPrecipitation, Spawn);
3232
DETOUR_T(void, CPrecipitation::Spawn)
3333
{
34-
h_CPrecipitation_Spawn.Disable();
34+
h_Spawn->Disable();
3535
CPrecipitation::Spawn(thisPtr);
36-
h_CPrecipitation_Spawn.Enable();
36+
h_Spawn->Enable();
3737
Utils::SetOrigin(static_cast<CBaseEntity*>(thisPtr), Vector(0,0,0), false);
3838
}

src/modules/misc.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
#include "hook.hpp"
1414
#include "platform.hpp"
1515

16+
class Hook;
17+
1618
class CUGCFileRequestManager
1719
{
1820
public: // MARK: CUGCFileRequestManager Public Members
1921
#pragma region Public Members
2022

2123
// Workshop download stopping hooks.
24+
DECL_HOOK(Update);
2225
DECL_DETOUR_T(void, Update);
2326

2427
#pragma endregion
@@ -34,6 +37,7 @@ class CPrecipitation
3437
#pragma region Public Members
3538

3639
// func_precipitation origin fix hook.
40+
DECL_HOOK(Spawn);
3741
DECL_DETOUR_T(void, Spawn);
3842

3943
#pragma endregion

src/p2sm.cpp

Lines changed: 10 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "utils.hpp"
1717
#include "globals.hpp"
18+
#include "patch-hook.hpp"
1819

1920
//---------------------------------------------------------------------------------
2021
// The plugin is a static singleton that is exported as an interface
@@ -127,74 +128,16 @@ bool CP2SMPlusPlusPlugin::Load(CreateInterfaceFn interfaceFactory, const CreateI
127128

128129
Log(INFO, true, "Executing game patches...");
129130

130-
#if _WIN32
131-
// When a player, both client or host, goes through a linked_portal_door entity in multiplayer, the host will crash. This fixes that.
132-
Log(INFO, true, "Fixing linked portal doors for multiplayer...");
133-
Memory::ReplacePattern(MODULE_SERVER, "0F B6 87 04 05 00 00 8B 16", "EB 14 87 04 05 00 00 8B 16");
134-
135-
// Increase runtime max from 0.03 to 0.05.
136-
// Helps add some more leeway to some things we do in VScript without the engine complaining and shutting down the rest of the script.
137-
Log(INFO, true, "Patching max runtime for VScript...");
138-
Memory::ReplacePattern(MODULE_VSCRIPT, "00 00 00 E0 51 B8 9E 3F", "9a 99 99 99 99 99 a9 3f");
139-
140-
// Increase the projected texture limit and disable the game auto-disabling others when there is more than one active. Thanks to \n and BetweenReality with help with these.
141-
//! Engine limit still exists though with a max of eight env_projectedtextures.
142-
Log(INFO, true, "Patching max amount of projected textures at once and auto disabling of projected textures...");
143-
// CEnvProjectedTexture::EnforceSingleProjectionRules
144-
Memory::ReplacePattern(MODULE_SERVER, "8B F0 3B F3 0F 84 95 00 00 00", "E9 9D 00 00 00 84 95 00 00 00"); // Skip for loop jump and jump to function return.
145-
146-
// CClientShadowMgr::CalculateRenderTargetsAndSizes
147-
Memory::ReplacePattern(MODULE_CLIENT, "F7 D8 1B C0 83 E0 07 40 5F", "B8 08 00 00 00 90 90 90 5F"); // Force the number of max projected texture to be 8.
148-
Log(INFO, true, "Increasing shadow map resolution for projected textures...");
149-
Memory::ReplacePattern(MODULE_CLIENT, "0F 95 C3 89 8E", "0F 94 C3 89 8E"); // Allow for higher resolution shadow maps without tools mode.
150-
151-
Log(INFO, true, "Patching all projected textures to have volumetrics...");
152-
// CShadowMgr::DrawVolumetrics
153-
// TODO: Make volumetric intensity customizable.
154-
Memory::ReplacePattern("engine", "0F 85 47 0C 00 00 80 BF 10 02 00 00 00 0F 84 3A 0C 00 00", "0F 84 47 0C 00 00 80 BF 10 02 00 00 00 0F 85 3A 0C 00 00"); // Make volumetrics work for projected textures.
155-
156-
157-
#else // Linux Patching. Due to the way this plugin is structured, it's currently not possible to compile this for Linux. Literally 1984 I know, but I don't have enough time or experience to figure it out by myself. One day.
158-
#endif
131+
if (!Patches::EnablePatches())
132+
{
133+
this->m_bNoUnload = true;
134+
throw std::runtime_error("Failed to enable patches!");
135+
}
159136

160137
#if _WIN32
161138
// MinHook initialization and hooking.
162139
Log(INFO, true, "Initializing MinHook and hooking functions...");
163-
MH_Initialize();
164-
165-
// Hook the death think function so players can be spawned immediate when the p2sm_instantrespawn ConVar is on.
166-
Log(INFO, true, "Hooking CPortal_Player::PlayerDeathThink...");
167-
MH_CreateHook(
168-
Memory::Scan<void*>(SERVER, "53 8B DC 83 EC 08 83 E4 F0 83 C4 04 55 8B 6B ? 89 6C 24 ? 8B EC A1 ? ? ? ? F3 0F 10 40 ? F3 0F 58 05 ? ? ? ? 83 EC 28 56 57 6A 00 51 8B F1 F3 0F 11 04 24 E8 ? ? ? ? 6A 03"),
169-
&CPortal_Player__PlayerDeathThink_hook, reinterpret_cast<void**>(&CPortal_Player__PlayerDeathThink_orig)
170-
);
171-
172-
// Hook flashlight functions.
173-
Log(INFO, true, "Hooking CPortal_Player::FlashlightTurnOn...");
174-
MH_CreateHook(
175-
Memory::Scan<void*>(SERVER, "A1 ? ? ? ? 8B 50 ? 83 7A ? ? 75"),
176-
&CPortal_Player__FlashlightTurnOn_hook, reinterpret_cast<void**>(&CPortal_Player__FlashlightTurnOn_orig)
177-
);
178-
Log(INFO, true, "Hooking CPortal_Player::FlashlightTurnOff...");
179-
MH_CreateHook(
180-
Memory::Scan<void*>(SERVER, "A1 ? ? ? ? 8B 50 ? 83 7A ? ? 74 ? 8B 81"),
181-
&CPortal_Player__FlashlightTurnOff_hook, reinterpret_cast<void**>(&CPortal_Player__FlashlightTurnOff_orig)
182-
);
183-
184-
// Stop workshop map downloads by not returning false on the download request.
185-
//!! TEMP TO FIX ORIGINAL HOOK THAT SUDDENLY BROKE
186-
MH_CreateHook(
187-
Memory::Scan<void*>(MODULE_CLIENT, "55 8B EC 81 EC 48 01 00 00 57"),
188-
&CUGCFileRequestManager__Update_hook, reinterpret_cast<void**>(&CUGCFileRequestManager__Update_orig)
189-
);
190140

191-
// Log(INFO, true, "Hooking CEnvProjectedTexture::EnforceSingleProjectionRules...");
192-
// MH_CreateHook(
193-
// Memory::Scan<void*>(CLIENT, "55 8B EC 8B 45 ? 8B 55 ? 50 8B 45 ? 52 8B 55 ? 50 8B 45 ? 52 8B 55 ? 50 8B 45"),
194-
// &CWorkshopManager__CreateFileDownloadRequest_hook, reinterpret_cast<void**>(&CWorkshopManager__CreateFileDownloadRequest_orig)
195-
// );
196-
197-
MH_EnableHook(MH_ALL_HOOKS);
198141

199142
#else // Linux Hooking. Due to the way this plugin is structured, it's currently not possible to compile this for Linux. Literally 1984 I know, but I don't have enough time or experience to figure it out by myself. One day.
200143
#endif // _WIN32
@@ -255,11 +198,10 @@ void CP2SMPlusPlusPlugin::Unload(void)
255198
#if _WIN32
256199
Log(INFO, true, "Un-patching game patches...");
257200

258-
Log(INFO, true, "Un-patching linked portal doors...");
259-
Memory::ReplacePattern("server", "EB 14 87 04 05 00 00 8B 16", "0F B6 87 04 05 00 00 8B 16");
260-
261-
Log(INFO, true, "Un-patching max runtime for VScript...");
262-
Memory::ReplacePattern("vscript", "00 00 00 00 00 00 E0 3F", "00 00 00 E0 51 B8 9E 3F");
201+
if (!Patches::DisablePatches())
202+
{
203+
throw std::runtime_error("Failed to disable patches!");
204+
}
263205

264206
Log(INFO, true, "Disconnecting hooked functions and un-initializing MinHook...");
265207
MH_DisableHook(MH_ALL_HOOKS);

src/patch-hook.cpp

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/*******************************************************************
2+
* @file patch-hook.cpp
3+
* @brief Perform hooks and patches for the plugin.
4+
* @author Orsell
5+
* @date 06 2025
6+
*********************************************************************/
7+
8+
#include "stdafx.hpp"
9+
#include "patch-hook.hpp"
10+
11+
#include "misc.hpp"
12+
#include "utils.hpp"
13+
#include "signatures.hpp"
14+
#include "hook.hpp"
15+
16+
/**
17+
* @brief Enable and execute the patches for the plugin.
18+
* @return True if patches executed successfully.
19+
*/
20+
bool Patches::EnablePatches()
21+
{
22+
try
23+
{
24+
// When a player, both client or host, goes through a linked_portal_door entity in multiplayer, the host will crash. This fixes that.
25+
Log(INFO, true, "Fixing linked portal doors for multiplayer...");
26+
Memory::ReplacePattern("server", Signature::CPortal_Player_NotifySystemEvent_EventTeleportUserID, Signature::CPortal_Player_NotifySystemEvent_EventTeleportUserID_Patch);
27+
28+
// Increase runtime max from 0.03 to 0.05.
29+
// Helps add some more leeway to some things we do in VScript without the engine complaining and shutting down the rest of the script.
30+
Log(INFO, true, "Patching max runtime for VScript...");
31+
Memory::ReplacePattern("vscript", Signature::SQVM_RuntimeTimeout, Signature::SQVM_RuntimeTimeout_Patch);
32+
33+
// Disable the game auto-disabling others when there is more than one active. Thanks to \n and BetweenReality with help with these.
34+
Log(INFO, true, "Patching max amount of projected textures at once and auto disabling of projected textures...");
35+
// CEnvProjectedTexture::EnforceSingleProjectionRules
36+
Memory::ReplacePattern("server", Signature::CEnvProjectedTexture_EnforceSingleProjectionRules_Loop, Signature::CEnvProjectedTexture_EnforceSingleProjectionRules_Loop_Patch);
37+
38+
// CClientShadowMgr::CalculateRenderTargetsAndSizes | Increase the projected texture limit from 1 -> 8
39+
Memory::ReplacePattern("client", Signature::CClientShadowMgr_CalculateRenderTargetsAndSizes_PtexLimit, Signature::CClientShadowMgr_CalculateRenderTargetsAndSizes_PtexLimit_Patch);
40+
Log(INFO, true, "Increasing shadow map resolution for projected textures...");
41+
// Increase the resolution shadow maps without tools mode.
42+
Memory::ReplacePattern("client", Signature::CClientShadowMgr_CalculateRenderTargetsAndSizes_ShadowRes, Signature::CClientShadowMgr_CalculateRenderTargetsAndSizes_ShadowRes_Patch);
43+
44+
// Log(INFO, true, "Patching all projected textures to have volumetrics...");
45+
// CShadowMgr::DrawVolumetrics
46+
// TODO: Make volumetric intensity customizable.
47+
// Memory::ReplacePattern("engine", "0F 85 47 0C 00 00 80 BF 10 02 00 00 00 0F 84 3A 0C 00 00", "0F 84 47 0C 00 00 80 BF 10 02 00 00 00 0F 85 3A 0C 00 00"); // Make volumetrics work for projected textures.
48+
}
49+
catch (const std::exception& ex)
50+
{
51+
Log(INFO, false, "Failed to perform patch operations! Exception: \"%s\"", ex.what());
52+
assert(false && "Patch operations failure!");
53+
return false;
54+
}
55+
56+
return true;
57+
}
58+
59+
bool Patches::DisablePatches()
60+
{
61+
try
62+
{
63+
Log(INFO, true, "Un-patching linked portal doors...");
64+
Memory::ReplacePattern("server", "EB 14 87 04 05 00 00 8B 16", "0F B6 87 04 05 00 00 8B 16");
65+
66+
Log(INFO, true, "Un-patching max runtime for VScript...");
67+
Memory::ReplacePattern("vscript", "00 00 00 00 00 00 E0 3F", "00 00 00 E0 51 B8 9E 3F");
68+
69+
Log(INFO, true, "un-patching max amount of projected textures at once and auto disabling of projected textures...");
70+
Memory::ReplacePattern("server", "E9 9D 00 00 00 84 95 00 00 00", "8B F0 3B F3 0F 84 95 00 00 00");
71+
Memory::ReplacePattern("client", "B8 08 00 00 00 90 90 90 5F", "F7 D8 1B C0 83 E0 07 40 5F");
72+
73+
Log(INFO, true, "Increasing shadow map resolution for projected textures...");
74+
Memory::ReplacePattern("client", "0F 94 C3 89 8E", "0F 95 C3 89 8E");
75+
}
76+
catch (const std::exception& ex)
77+
{
78+
Log(INFO, false, "Failed to perform un-patch operations! Exception: \"%s\"", ex.what());
79+
assert(false && "Un-patch operations failure!");
80+
return false;
81+
}
82+
83+
return true;
84+
}
85+
86+
bool Hooks::EnableHooks()
87+
{
88+
MH_Initialize();
89+
90+
CUGCFileRequestManager::h_Update->SetFunc<void*>(
91+
Memory::Scan<void*>(MODULE_CLIENT, "55 8B EC 81 EC 48 01 00 00 57"));
92+
93+
for (const auto hook : Hook::GetHooks())
94+
{
95+
Log(INFO, false, "HOOKED: %s", hook->GetName().c_str());
96+
hook->Enable();
97+
}
98+
99+
// Hook the death think function so players can be spawned immediate when the p2sm_multiplayer_instantrespawn ConVar is on.
100+
// Log(INFO, true, "Hooking CPortal_Player::PlayerDeathThink...");
101+
// MH_CreateHook(
102+
// Memory::Scan<void*>(MODULE_SERVER, "53 8B DC 83 EC 08 83 E4 F0 83 C4 04 55 8B 6B ? 89 6C 24 ? 8B EC A1 ? ? ? ? F3 0F 10 40 ? F3 0F 58 05 ? ? ? ? 83 EC 28 56 57 6A 00 51 8B F1 F3 0F 11 04 24 E8 ? ? ? ? 6A 03"),
103+
// &CPortal_Player__PlayerDeathThink_hook, reinterpret_cast<void**>(&CPortal_Player__PlayerDeathThink_orig)
104+
// );
105+
//
106+
// // Hook flashlight functions.
107+
// Log(INFO, true, "Hooking CPortal_Player::FlashlightTurnOn...");
108+
// MH_CreateHook(
109+
// Memory::Scan<void*>(MODULE_SERVER, "A1 ? ? ? ? 8B 50 ? 83 7A ? ? 75"),
110+
// &CPortal_Player__FlashlightTurnOn_hook, reinterpret_cast<void**>(&CPortal_Player__FlashlightTurnOn_orig)
111+
// );
112+
// Log(INFO, true, "Hooking CPortal_Player::FlashlightTurnOff...");
113+
// MH_CreateHook(
114+
// Memory::Scan<void*>(MODULE_SERVER, "A1 ? ? ? ? 8B 50 ? 83 7A ? ? 74 ? 8B 81"),
115+
// &CPortal_Player__FlashlightTurnOff_hook, reinterpret_cast<void**>(&CPortal_Player__FlashlightTurnOff_orig)
116+
// );
117+
118+
// Stop workshop map downloads by not returning false on the download request.
119+
//!! TEMP TO FIX ORIGINAL HOOK THAT SUDDENLY BROKE
120+
// Log(INFO, true, "Hooking CWorkshopManager::CreateFileDownloadRequest...");
121+
// MH_CreateHook(
122+
// Memory::Scan<void*>(MODULE_CLIENT, "55 8B EC 81 EC 48 01 00 00 57"),
123+
// &CUGCFileRequestManager__Update_hook, reinterpret_cast<void**>(&CUGCFileRequestManager__Update_orig)
124+
// );
125+
126+
// Log(INFO, true, "Hooking CEnvProjectedTexture::EnforceSingleProjectionRules...");
127+
// MH_CreateHook(
128+
// Memory::Scan<void*>(CLIENT, "55 8B EC 8B 45 ? 8B 55 ? 50 8B 45 ? 52 8B 55 ? 50 8B 45 ? 52 8B 55 ? 50 8B 45"),
129+
// &CWorkshopManager__CreateFileDownloadRequest_hook, reinterpret_cast<void**>(&CWorkshopManager__CreateFileDownloadRequest_orig)
130+
// );
131+
132+
MH_EnableHook(MH_ALL_HOOKS);
133+
134+
return true;
135+
}

0 commit comments

Comments
 (0)