Skip to content

Commit

Permalink
im stupid?
Browse files Browse the repository at this point in the history
  • Loading branch information
jvnipers committed May 19, 2024
1 parent 6462079 commit d582e94
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
18 changes: 10 additions & 8 deletions src/cs2fixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
*/

#include "cs2fixes.h"
#include "iserver.h"

#include "tier0/dbg.h"
#include "tier0/vprof.h"
#include "common.h"
#include "icvar.h"

Expand Down Expand Up @@ -55,8 +58,6 @@ void Panic(const char *msg, ...)
va_end(args);
}

class GameSessionConfiguration_t { };

SH_DECL_HOOK3_void(ICvar, DispatchConCommand, SH_NOATTRIB, 0, ConCommandHandle, const CCommandContext&, const CCommand&);

CS2Fixes g_CS2Fixes;
Expand All @@ -71,6 +72,8 @@ bool CS2Fixes::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool

Message( "Starting plugin.\n" );

SH_ADD_HOOK(ICvar, DispatchConCommand, g_pCVar, SH_MEMBER(this, &CS2Fixes::Hook_DispatchConCommand), false);

UnlockConVars();
UnlockConCommands();
ConVar_Register(FCVAR_RELEASE | FCVAR_CLIENT_CAN_EXECUTE | FCVAR_GAMEDLL);
Expand All @@ -82,18 +85,17 @@ bool CS2Fixes::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool

bool CS2Fixes::Unload(char *error, size_t maxlen)
{
SH_REMOVE_HOOK(ICvar, DispatchConCommand, g_pCVar, SH_MEMBER(this, &CS2Fixes::Hook_DispatchConCommand), false);

ConVar_Unregister();

return true;
}

void CS2Fixes::AllPluginsLoaded()
void CS2Fixes::Hook_DispatchConCommand(ConCommandHandle cmdHandle, const CCommandContext& ctx, const CCommand& args)
{
/* This is where we'd do stuff that relies on the mod or other plugins
* being initialized (for example, cvars added and events registered).
*/
VPROF_BUDGET("CS2Fixes::Hook_DispatchConCommand", "ConCommands");

Message( "AllPluginsLoaded\n" );
SH_CALL(g_pCVar, &ICvar::DispatchConCommand)(cmdHandle, ctx, args);
}

bool CS2Fixes::Pause(char *error, size_t maxlen)
Expand Down
5 changes: 3 additions & 2 deletions src/cs2fixes.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#pragma once

#include <ISmmPlugin.h>
#include "igameevents.h"
#include <iserver.h>

class CS2Fixes : public ISmmPlugin, public IMetamodListener
{
Expand All @@ -28,9 +30,8 @@ class CS2Fixes : public ISmmPlugin, public IMetamodListener
bool Unload(char *error, size_t maxlen);
bool Pause(char *error, size_t maxlen);
bool Unpause(char *error, size_t maxlen);
void AllPluginsLoaded();
public: //hooks

public:
void Hook_DispatchConCommand(ConCommandHandle cmd, const CCommandContext& ctx, const CCommand& args);


Expand Down
4 changes: 3 additions & 1 deletion src/cvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ void UnlockConVars()

if (!pCvar)
continue;


/*
for (int i = 0; i < sizeof(pUnCheatCvars) / sizeof(*pUnCheatCvars); i++)
{
if (!V_strcmp(pCvar->m_pszName, pUnCheatCvars[i]))
pCvar->flags &= ~FCVAR_CHEAT;
}
*/

if (!(pCvar->flags & g_iFlagsToRemove))
continue;
Expand Down

0 comments on commit d582e94

Please sign in to comment.