Skip to content

Commit 92d495a

Browse files
committed
Replaced workshop stopping hooks with improved one that is more stable
1 parent 893574d commit 92d495a

4 files changed

Lines changed: 58 additions & 11 deletions

File tree

globals.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
class CBasePlayer;
2424
class CPortal_Player;
2525
class CBaseEntity;
26-
class CUGCFileRequestManager;
26+
class CWorkshopManager;
27+
class CEnvProjectedTexture;
2728

2829
// Color macros for console printing.
2930
#define P2SMPLUSPLUS_PLUGIN_VERSION "1.1.0" // Update this when a new version of the plugin is released.

p2sm.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ const char* CP2SMPlusPlusPlugin::GetPluginDescription(void)
3939
return "P2SourceModPlusPlus Plugin | Plugin Version: " P2SMPLUSPLUS_PLUGIN_VERSION;
4040
}
4141

42-
//---------------------------------------------------------------------------------
43-
// Purpose: Stop the UGC manager from automatically download workshop maps.
44-
// Simply do nothing so that nothing gets updated and therefore nothing gets downloaded.
45-
// !WARNING! This makes the game extremely unstable if the plugin is unloaded while the game is running.
46-
//---------------------------------------------------------------------------------
47-
static void (__fastcall* CUGCFileRequestManager__Update_orig)(CUGCFileRequestManager* thisPtr);
48-
static void __fastcall CUGCFileRequestManager__Update_hook(CUGCFileRequestManager* thisPtr) { }
49-
5042
//---------------------------------------------------------------------------------
5143
// Purpose: Called when the plugin is loaded, initialization process.
5244
// Loads the interfaces we need from the engine and applies our patches.

sdk.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,38 @@ void __fastcall CPortal_Player__FlashlightTurnOff_hook(CPortal_Player* thisPtr,
6464
return;
6565
}
6666

67+
//---------------------------------------------------------------------------------
68+
// Purpose: Stop the UGC manager from automatically download workshop maps.
69+
// Simply do nothing so that nothing gets updated and therefore nothing gets downloaded.
70+
// !WARNING! This makes the game extremely unstable if the plugin is unloaded while the game is running.
71+
//---------------------------------------------------------------------------------
72+
bool (__fastcall* CWorkshopManager__CreateFileDownloadRequest_orig)(CWorkshopManager* thisPtr, void* edx,
73+
uint64 hFileHandle,
74+
uint64 fileID,
75+
const char *lpszDirectory,
76+
const char *lpszFilename,
77+
uint32 unPriority,
78+
uint32 unTimeLastUpdated,
79+
bool bForceUpdate);
80+
bool __fastcall CWorkshopManager__CreateFileDownloadRequest_hook(CWorkshopManager* thisPtr, void* edx,
81+
uint64 hFileHandle,
82+
uint64 fileID,
83+
const char *lpszDirectory,
84+
const char *lpszFilename,
85+
uint32 unPriority,
86+
uint32 unTimeLastUpdated,
87+
bool bForceUpdate)
88+
{
89+
return false;
90+
}
91+
92+
//---------------------------------------------------------------------------------
93+
// Purpose: Stop engine from disabling any other env_projectedtexture entities when one turns on.
94+
// ! Engine limit still exists though with a max of eight env_projectedtextures.
95+
//---------------------------------------------------------------------------------
96+
// void (__fastcall* CEnvProjectedTexture__EnforceSingleProjectionRules_orig)(CEnvProjectedTexture* thisPtr, void* edx, bool bWarnOnEnforcement);
97+
// void __fastcall CEnvProjectedTexture__EnforceSingleProjectionRules_hook(CEnvProjectedTexture* thisPtr, void* edx, bool bWarnOnEnforcement) { }
98+
6799
/// Interfaced UTIL Functions \\\
68100
69101
//---------------------------------------------------------------------------------

sdk.hpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,37 @@ typedef struct
2828
//---------------------------------------------------------------------------------
2929

3030
// Respawn Hooks.
31-
extern void (__fastcall* CPortal_Player__PlayerDeathThink_orig)(CPortal_Player* thisptr);
32-
void __fastcall CPortal_Player__PlayerDeathThink_hook(CPortal_Player* thisptr);
31+
extern void (__fastcall* CPortal_Player__PlayerDeathThink_orig)(CPortal_Player* thisPtr);
32+
void __fastcall CPortal_Player__PlayerDeathThink_hook(CPortal_Player* thisPtr);
3333

3434
// Flashlight Hooks.
3535
extern bool (__fastcall* CPortal_Player__FlashlightTurnOn_orig)(CPortal_Player* thisPtr, void* edx, bool playSound);
3636
bool __fastcall CPortal_Player__FlashlightTurnOn_hook(CPortal_Player* thisPtr, void* edx, bool playSound);
3737
extern void (__fastcall* CPortal_Player__FlashlightTurnOff_orig)(CPortal_Player* thisPtr, void* edx, bool playSound);
3838
void __fastcall CPortal_Player__FlashlightTurnOff_hook(CPortal_Player* thisPtr, void* edx, bool playSound);
3939

40+
// Workshop download stopping hooks.
41+
extern bool (__fastcall* CWorkshopManager__CreateFileDownloadRequest_orig)(CWorkshopManager* thisPtr, void* edx,
42+
uint64 hFileHandle,
43+
uint64 fileID,
44+
const char *lpszDirectory,
45+
const char *lpszFilename,
46+
uint32 unPriority,
47+
uint32 unTimeLastUpdated,
48+
bool bForceUpdate);
49+
bool __fastcall CWorkshopManager__CreateFileDownloadRequest_hook(CWorkshopManager* thisPtr, void* edx,
50+
uint64 hFileHandle,
51+
uint64 fileID,
52+
const char *lpszDirectory,
53+
const char *lpszFilename,
54+
uint32 unPriority,
55+
uint32 unTimeLastUpdated,
56+
bool bForceUpdate);
57+
58+
// env_projectedtexture enforcement function hook.
59+
// extern void (__fastcall* CEnvProjectedTexture__EnforceSingleProjectionRules_orig)(CEnvProjectedTexture* thisPtr, void* edx, bool bWarnOnEnforcement);
60+
// void __fastcall CEnvProjectedTexture__EnforceSingleProjectionRules_hook(CEnvProjectedTexture* thisPtr, void* edx, bool bWarnOnEnforcement);
61+
4062
//---------------------------------------------------------------------------------
4163
// Interfaced game functions.
4264
//---------------------------------------------------------------------------------

0 commit comments

Comments
 (0)