Skip to content

Commit ec4648f

Browse files
committed
Removed all previous references to WorkshopStopper9000 and added Error logging
1 parent b56f168 commit ec4648f

File tree

10 files changed

+69
-60
lines changed

10 files changed

+69
-60
lines changed

.github/workflows/ms-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ jobs:
3030
- name: Upload Artifact
3131
uses: actions/upload-artifact@v4
3232
with:
33-
name: workshopstopper9000
34-
path: Release/workshopstopper9000.dll
33+
name: p2sm++
34+
path: Release/p2sm++.dll

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@
3131
*.app
3232
/.vs
3333
/Release
34+
p2sm++.vcxproj.user

main.cpp

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//===========================================================================//
22
//
33
// Authors: Orsell & Nanoman2525 & NULLderef
4-
// Purpose: WorkshopStopper9000 plugin
4+
// Purpose: P2SourceModPlusPlus plugin
55
//
66
//===========================================================================//
77
#include "main.hpp"
@@ -10,51 +10,57 @@
1010
#include "tier0/memdbgon.h"
1111

1212
void Log(int level, bool dev, const char* pMsgFormat, ...);
13-
ConVar wss9000_developer("wss9000_developer", "0", FCVAR_HIDDEN, "Enable for developer messages.");
13+
ConVar p2sm_developer("p2sm_developer", "0", FCVAR_HIDDEN, "Enable for developer messages.");
1414

1515
//---------------------------------------------------------------------------------
1616
// The plugin is a static singleton that is exported as an interface
1717
//---------------------------------------------------------------------------------
18-
CWSS9000Plugin g_WSS9000Plugin;
19-
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CWSS9000Plugin, IServerPluginCallbacks, INTERFACEVERSION_ISERVERPLUGINCALLBACKS, g_WSS9000Plugin);
18+
CP2SMPlusPlusPlugin g_P2SMPlusPlusPlugin;
19+
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CP2SMPlusPlusPlugin, IServerPluginCallbacks, INTERFACEVERSION_ISERVERPLUGINCALLBACKS, g_P2SMPlusPlusPlugin);
2020

2121
//---------------------------------------------------------------------------------
2222
// Purpose: Logging for the plugin by adding a prefix and line break.
2323
// Max character limit of 1024 characters.
24-
// level: 0 = Msg/DevMsg, 1 = Warning/DevWarning
24+
// level: 0 = Msg/DevMsg, 1 = Warning/DevWarning, 2 = Error WILL STOP ENGINE!
2525
//---------------------------------------------------------------------------------
2626
void Log(int level, bool dev, const char* pMsgFormat, ...)
2727
{
28+
if (dev && !p2sm_developer.GetBool() && level != 2) return; // Stop developer messages when p2mm_developer isn't enabled.
29+
30+
// Take our log message and format any arguments it has into the message.
2831
va_list argptr;
29-
char szFormattedText[1024];
32+
char szFormattedText[1024] = { 0 };
3033
va_start(argptr, pMsgFormat);
3134
V_vsnprintf(szFormattedText, sizeof(szFormattedText), pMsgFormat, argptr);
3235
va_end(argptr);
3336

34-
char completeMsg[1024];
35-
V_snprintf(completeMsg, sizeof(completeMsg), "(WorkshopStopper9000 PLUGIN): %s\n", szFormattedText);
36-
37-
if (dev && !wss9000_developer.GetBool()) { return; }
37+
// Add a header to the log message.
38+
char completeMsg[1024] = { 0 };
39+
V_snprintf(completeMsg, sizeof(completeMsg), "(P2SourceModPlusPlus PLUGIN): %s\n", szFormattedText);
3840

3941
switch (level)
4042
{
4143
case 0:
42-
ConColorMsg(WSS9000_PLUGIN_CONSOLE_COLOR, completeMsg);
44+
ConColorMsg(P2SMPLUSPLUS_PLUGIN_CONSOLE_COLOR, completeMsg);
4345
return;
4446
case 1:
4547
Warning(completeMsg);
4648
return;
49+
case 2:
50+
Warning("(P2SourceModPlusPlus PLUGIN):\n!!!ERROR ERROR ERROR!!!:\nA FATAL ERROR OCCURED WITH THE ENGINE:\n%s", completeMsg);
51+
Error(completeMsg);
52+
return;
4753
default:
48-
Warning("(WorkshopStopper9000 PLUGIN): Log level set outside of 0-1, \"%i\", defaulting to ConColorMsg().\n", level);
49-
ConColorMsg(WSS9000_PLUGIN_CONSOLE_COLOR, completeMsg);
54+
Warning("(P2SourceModPlusPlus PLUGIN): Log level set outside of 0-1, \"%i\". Defaulting to level 0.\n", level);
55+
ConColorMsg(P2SMPLUSPLUS_PLUGIN_CONSOLE_COLOR, completeMsg);
5056
return;
5157
}
5258
}
5359

5460
//---------------------------------------------------------------------------------
5561
// Purpose: constructor
5662
//---------------------------------------------------------------------------------
57-
CWSS9000Plugin::CWSS9000Plugin()
63+
CP2SMPlusPlusPlugin::CP2SMPlusPlusPlugin()
5864
{
5965
this->m_bPluginLoaded = false;
6066
this->m_bNoUnload = false; // If we fail to load, we don't want to run anything on Unload() to get what the error was.
@@ -63,17 +69,19 @@ CWSS9000Plugin::CWSS9000Plugin()
6369
//---------------------------------------------------------------------------------
6470
// Purpose: destructor
6571
//---------------------------------------------------------------------------------
66-
CWSS9000Plugin::~CWSS9000Plugin() {}
72+
CP2SMPlusPlusPlugin::~CP2SMPlusPlusPlugin() {}
6773

6874
//---------------------------------------------------------------------------------
6975
// Purpose: Description of plugin outputted when the "plugin_print" console command is executed.
7076
//---------------------------------------------------------------------------------
71-
const char* CWSS9000Plugin::GetPluginDescription(void)
77+
const char* CP2SMPlusPlusPlugin::GetPluginDescription(void)
7278
{
73-
return "WorkshopStopper9000 Plugin | Plugin Version: " WSS9000_PLUGIN_VERSION;
79+
return "P2SourceModPlusPlus Plugin | Plugin Version: " P2SMPLUSPLUS_PLUGIN_VERSION;
7480
}
7581

76-
// STOP THEM WORKSHOP DOWNLOADS!
82+
//---------------------------------------------------------------------------------
83+
// Purpose: Stop the UGC manager from automatically download workshop maps.
84+
//---------------------------------------------------------------------------------
7785
class CUGCFileRequestManager;
7886
void (__fastcall* CUGCFileRequestManager__Update_orig)(CUGCFileRequestManager* thisptr);
7987
void __fastcall CUGCFileRequestManager__Update_hook(CUGCFileRequestManager* thisptr) { return; }
@@ -82,7 +90,7 @@ void __fastcall CUGCFileRequestManager__Update_hook(CUGCFileRequestManager* thi
8290
// Purpose: Called when the plugin is loaded, initialization process.
8391
// Loads the interfaces we need from the engine and applies our patches.
8492
//---------------------------------------------------------------------------------
85-
bool CWSS9000Plugin::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory)
93+
bool CP2SMPlusPlusPlugin::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory)
8694
{
8795
if (m_bPluginLoaded)
8896
{
@@ -130,7 +138,7 @@ bool CWSS9000Plugin::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn
130138
//---------------------------------------------------------------------------------
131139
// Purpose: Called when the plugin is turning off/unloading.
132140
//---------------------------------------------------------------------------------
133-
void CWSS9000Plugin::Unload(void)
141+
void CP2SMPlusPlusPlugin::Unload(void)
134142
{
135143
// If the plugin errors for some reason, prevent it from unloading.
136144
if (m_bNoUnload)
@@ -153,24 +161,24 @@ void CWSS9000Plugin::Unload(void)
153161
// Purpose: Unused callbacks
154162
//---------------------------------------------------------------------------------
155163
#pragma region UNUSED_CALLBACKS
156-
void CWSS9000Plugin::SetCommandClient(int index) {}
157-
void CWSS9000Plugin::ServerActivate(edict_t* pEdictList, int edictCount, int clientMax) {}
158-
void CWSS9000Plugin::LevelInit(char const* pMapName) {}
159-
PLUGIN_RESULT CWSS9000Plugin::ClientCommand(edict_t* pEntity, const CCommand& args) { return PLUGIN_CONTINUE; }
160-
void CWSS9000Plugin::ClientActive(edict_t* pEntity) {}
161-
void CWSS9000Plugin::GameFrame(bool simulating) {}
162-
void CWSS9000Plugin::LevelShutdown(void) {}
163-
void CWSS9000Plugin::Pause(void) {}
164-
void CWSS9000Plugin::UnPause(void) {}
165-
void CWSS9000Plugin::ClientDisconnect(edict_t* pEntity) {}
166-
void CWSS9000Plugin::ClientFullyConnect(edict_t* pEntity) {}
167-
void CWSS9000Plugin::ClientPutInServer(edict_t* pEntity, char const* playername) {}
168-
void CWSS9000Plugin::ClientSettingsChanged(edict_t* pEdict) {}
169-
PLUGIN_RESULT CWSS9000Plugin::ClientConnect(bool* bAllowConnect, edict_t* pEntity, const char* pszName, const char* pszAddress, char* reject, int maxrejectlen) { return PLUGIN_CONTINUE; }
170-
PLUGIN_RESULT CWSS9000Plugin::NetworkIDValidated(const char* pszUserName, const char* pszNetworkID) { return PLUGIN_CONTINUE; }
171-
void CWSS9000Plugin::OnQueryCvarValueFinished(QueryCvarCookie_t iCookie, edict_t* pPlayerEntity, EQueryCvarValueStatus eStatus, const char* pCvarName, const char* pCvarValue) {}
172-
void CWSS9000Plugin::OnEdictAllocated(edict_t* edict) {}
173-
void CWSS9000Plugin::OnEdictFreed(const edict_t* edict) {}
174-
bool CWSS9000Plugin::BNetworkCryptKeyCheckRequired(uint32 unFromIP, uint16 usFromPort, uint32 unAccountIdProvidedByClient, bool bClientWantsToUseCryptKey) { return false; }
175-
bool CWSS9000Plugin::BNetworkCryptKeyValidate(uint32 unFromIP, uint16 usFromPort, uint32 unAccountIdProvidedByClient, int nEncryptionKeyIndexFromClient, int numEncryptedBytesFromClient, byte* pbEncryptedBufferFromClient, byte* pbPlainTextKeyForNetchan) { return true; }
164+
void CP2SMPlusPlusPlugin::SetCommandClient(int index) {}
165+
void CP2SMPlusPlusPlugin::ServerActivate(edict_t* pEdictList, int edictCount, int clientMax) {}
166+
void CP2SMPlusPlusPlugin::LevelInit(char const* pMapName) {}
167+
PLUGIN_RESULT CP2SMPlusPlusPlugin::ClientCommand(edict_t* pEntity, const CCommand& args) { return PLUGIN_CONTINUE; }
168+
void CP2SMPlusPlusPlugin::ClientActive(edict_t* pEntity) {}
169+
void CP2SMPlusPlusPlugin::GameFrame(bool simulating) {}
170+
void CP2SMPlusPlusPlugin::LevelShutdown(void) {}
171+
void CP2SMPlusPlusPlugin::Pause(void) {}
172+
void CP2SMPlusPlusPlugin::UnPause(void) {}
173+
void CP2SMPlusPlusPlugin::ClientDisconnect(edict_t* pEntity) {}
174+
void CP2SMPlusPlusPlugin::ClientFullyConnect(edict_t* pEntity) {}
175+
void CP2SMPlusPlusPlugin::ClientPutInServer(edict_t* pEntity, char const* playername) {}
176+
void CP2SMPlusPlusPlugin::ClientSettingsChanged(edict_t* pEdict) {}
177+
PLUGIN_RESULT CP2SMPlusPlusPlugin::ClientConnect(bool* bAllowConnect, edict_t* pEntity, const char* pszName, const char* pszAddress, char* reject, int maxrejectlen) { return PLUGIN_CONTINUE; }
178+
PLUGIN_RESULT CP2SMPlusPlusPlugin::NetworkIDValidated(const char* pszUserName, const char* pszNetworkID) { return PLUGIN_CONTINUE; }
179+
void CP2SMPlusPlusPlugin::OnQueryCvarValueFinished(QueryCvarCookie_t iCookie, edict_t* pPlayerEntity, EQueryCvarValueStatus eStatus, const char* pCvarName, const char* pCvarValue) {}
180+
void CP2SMPlusPlusPlugin::OnEdictAllocated(edict_t* edict) {}
181+
void CP2SMPlusPlusPlugin::OnEdictFreed(const edict_t* edict) {}
182+
bool CP2SMPlusPlusPlugin::BNetworkCryptKeyCheckRequired(uint32 unFromIP, uint16 usFromPort, uint32 unAccountIdProvidedByClient, bool bClientWantsToUseCryptKey) { return false; }
183+
bool CP2SMPlusPlusPlugin::BNetworkCryptKeyValidate(uint32 unFromIP, uint16 usFromPort, uint32 unAccountIdProvidedByClient, int nEncryptionKeyIndexFromClient, int numEncryptedBytesFromClient, byte* pbEncryptedBufferFromClient, byte* pbPlainTextKeyForNetchan) { return true; }
176184
#pragma endregion

main.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//===========================================================================//
22
//
33
// Authors: Orsell & Nanoman2525 & NULLderef
4-
// Purpose: WorkshopStopper9000 plugin
4+
// Purpose: P2SourceModPlusPlus plugin
55
//
66
//===========================================================================//
77
#include "cdll_int.h"
@@ -10,18 +10,18 @@
1010

1111
#include "scanner.hpp"
1212

13-
#define WSS9000_PLUGIN_VERSION "1.0.0" // Update this when a new version of the plugin is released.
14-
#define WSS9000_PLUGIN_CONSOLE_COLOR Color(100, 192, 252, 255) // Light Blue
13+
#define P2SMPLUSPLUS_PLUGIN_VERSION "1.0.0" // Update this when a new version of the plugin is released.
14+
#define P2SMPLUSPLUS_PLUGIN_CONSOLE_COLOR Color(100, 192, 252, 255) // Light Blue
1515

1616
//---------------------------------------------------------------------------------
17-
// Purpose: Portal 2: Multiplayer Mod server plugin class
17+
// Purpose: P2SourceModPlusPlus server plugin class
1818
//---------------------------------------------------------------------------------
1919

20-
class CWSS9000Plugin : public IServerPluginCallbacks
20+
class CP2SMPlusPlusPlugin : public IServerPluginCallbacks
2121
{
2222
public:
23-
CWSS9000Plugin();
24-
~CWSS9000Plugin();
23+
CP2SMPlusPlusPlugin();
24+
~CP2SMPlusPlusPlugin();
2525

2626
// IServerPluginCallbacks methods.
2727
virtual bool Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory);
@@ -53,4 +53,4 @@ class CWSS9000Plugin : public IServerPluginCallbacks
5353
bool m_bPluginLoaded;
5454
bool m_bNoUnload;
5555
};
56-
extern CWSS9000Plugin g_WSS9000Plugin;
56+
extern CP2SMPlusPlusPlugin g_WSS9000Plugin;

workshopstopper9000.sln renamed to p2sm++.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.11.35327.3
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "workshopstopper9000", "workshopstopper9000.vcxproj", "{531796FA-476D-47F1-84FA-CD3613D68536}"
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "p2sm++", "p2sm++.vcxproj", "{531796FA-476D-47F1-84FA-CD3613D68536}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
File renamed without changes.

workshopstopper9000.vcxproj renamed to p2sm++.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
</ItemGroup>
99
<PropertyGroup Label="Globals">
1010
<ProjectGuid>{531796FA-476D-47F1-84FA-CD3613D68536}</ProjectGuid>
11-
<RootNamespace>workshopstopper9000</RootNamespace>
11+
<RootNamespace>p2sm++</RootNamespace>
1212
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
13-
<ProjectName>WorkshopStopper9000</ProjectName>
13+
<ProjectName>P2SourceModPlusPlus</ProjectName>
1414
</PropertyGroup>
1515
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
1616
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
@@ -33,7 +33,7 @@
3333
<IntDir>.\Release\.\</IntDir>
3434
</PropertyGroup>
3535
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
36-
<TargetName>workshopstopper9000</TargetName>
36+
<TargetName>p2sm++</TargetName>
3737
</PropertyGroup>
3838
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
3939
<TargetExt>.dll</TargetExt>
@@ -47,7 +47,7 @@
4747
<Optimization>MinSpace</Optimization>
4848
<AdditionalIncludeDirectories>;public;public\tier0;public\tier1</AdditionalIncludeDirectories>
4949
<MultiProcessorCompilation>true</MultiProcessorCompilation>
50-
<PreprocessorDefinitions>VPC;RAD_TELEMETRY_DISABLED;_HAS_ITERATOR_DEBUGGING=0;WIN32;_WIN32;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;%(PreprocessorDefinitions);COMPILER_MSVC32;COMPILER_MSVC;_DLL_EXT=.dll;DLLNAME=workshopstopper9000;BINK_VIDEO;AVI_VIDEO;WMV_VIDEO;DEV_BUILD;FRAME_POINTER_OMISSION_DISABLED;_MBCS;_EXTERNAL_DLL_EXT=.dll;VPCGAMECAPS=HL2MP;SOURCE1=1;VPCGAME=hl2mp</PreprocessorDefinitions>
50+
<PreprocessorDefinitions>VPC;RAD_TELEMETRY_DISABLED;_HAS_ITERATOR_DEBUGGING=0;WIN32;_WIN32;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;%(PreprocessorDefinitions);COMPILER_MSVC32;COMPILER_MSVC;_DLL_EXT=.dll;DLLNAME=p2sm++;BINK_VIDEO;AVI_VIDEO;WMV_VIDEO;DEV_BUILD;FRAME_POINTER_OMISSION_DISABLED;_MBCS;_EXTERNAL_DLL_EXT=.dll;VPCGAMECAPS=HL2MP;SOURCE1=1;VPCGAME=hl2mp</PreprocessorDefinitions>
5151
<StringPooling>false</StringPooling>
5252
<ExceptionHandling>false</ExceptionHandling>
5353
<BasicRuntimeChecks>Default</BasicRuntimeChecks>

p2sm++.vdf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"plugin"
2+
{
3+
"file" "addons/p2sm++"
4+
}

scanner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ namespace Memory {
405405
void* addr = Memory::Scanner::Scan<void*>(Memory::Modules::Get(target_module), patternBytes);
406406
if (!addr)
407407
{
408-
Log(1, false, "Failed to replace pattern! Turn on wss9000_developer for more info...");
408+
Log(1, false, "Failed to replace pattern! Turn on p2sm_developer for more info...");
409409
Log(1, true, "Target Module: %s", target_module.c_str());
410410
Log(1, true, "Pattern Bytes To Find: %s", patternBytes.c_str());
411411
Log(1, true, "Bytes To Replace Pattern Bytes With: %s", replace_with.c_str());

workshopstopper9000.vdf

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)