From dcfee62c584d53d0f6e54716e4dfc5606cba59a7 Mon Sep 17 00:00:00 2001 From: GAMMACASE Date: Thu, 30 Mar 2023 00:02:29 +0300 Subject: [PATCH] Further ICVar reversal --- public/icvar.h | 46 ++++++++++++++++++++++-------------------- public/tier1/iconvar.h | 12 ++++++++++- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/public/icvar.h b/public/icvar.h index 9b2d4bae..b1ad3dc9 100644 --- a/public/icvar.h +++ b/public/icvar.h @@ -68,49 +68,51 @@ abstract_class ICvar : public IAppSystem { public: // allow_developer - Allows finding convars with FCVAR_DEVELOPMENTONLY flag - virtual ConVarID FindConVar(const char *name, bool allow_developer = false) = 0; + virtual ConVarID FindConVar(const char *szName, bool bAllowDeveloper = false) = 0; virtual ConVarID FindFirstConVar() = 0; virtual ConVarID FindNextConVar(ConVarID previous) = 0; - virtual void SetConVarValue(ConVarID cvarid, CSplitScreenSlot nSlot, CVValue_t *value, void*) = 0; + virtual void SetConVarValue(ConVarID cvarid, CSplitScreenSlot nSlot, CVValue_t *pNewValue, CVValue_t *pOldValue) = 0; - virtual ConCommandID FindCommand(const char *name) = 0; + virtual ConCommandID FindCommand(const char *szName) = 0; virtual ConCommandID FindFirstCommand() = 0; virtual ConCommandID FindNextCommand(ConCommandID previous) = 0; - virtual void DispatchConCommand(ConCommandID command, CCommandContext& ctx, CCommand& tok) = 0; + virtual void DispatchConCommand(ConCommandID commandid, CCommandContext& ctx, CCommand& tok) = 0; // Install a global change callback (to be called when any convar changes) - virtual void InstallGlobalChangeCallback(FnChangeCallback_t callback) = 0; - virtual void RemoveGlobalChangeCallback(FnChangeCallback_t callback) = 0; - virtual void CallGlobalChangeCallbacks(ConVar *var, const char *pOldString, float flOldValue) = 0; + virtual void InstallGlobalChangeCallback(FnChangeCallbackGlobal_t callback) = 0; + virtual void RemoveGlobalChangeCallback(FnChangeCallbackGlobal_t callback) = 0; + virtual void CallGlobalChangeCallbacks(ConVarRefAbstract *cvar, CSplitScreenSlot nSlot, const char *pNewValue, const char* pOldValue) = 0; // Reverts cvars which contain a specific flag - virtual void RevertFlaggedConVars(int nFlag) = 0; + virtual void RevertFlaggedConVars(int nFlag) = 0; - virtual void SetMaxSplitScreenSlots(int nSlots) = 0; - virtual int GetMaxSplitScreenSlots() const = 0; + virtual void SetMaxSplitScreenSlots(int nSlots) = 0; + virtual int GetMaxSplitScreenSlots() const = 0; - virtual void RegisterCreationListener() = 0; - virtual void RemoveCreationListener() = 0; + virtual void RegisterCreationListeners(CCreationListenerCallbacks *callbacks) = 0; + virtual void RemoveCreationListeners(CCreationListenerCallbacks *callbacks) = 0; virtual void unk2() = 0; - virtual void unk3() = 0; - virtual void unk4() = 0; - virtual void unk5() = 0; - virtual void unk6() = 0; + + virtual void ResetConVarsToDefaultValues(const char *pszSearchString) = 0; + + virtual ConVarSnapshot_t TakeConVarSnapshot() = 0; + virtual void ResetConVarsFromSnapshot(ConVarSnapshot_t *snapshot) = 0; + virtual void DestroyConVarSnapshot(ConVarSnapshot_t *snapshot) = 0; virtual characterset_t GetCharacterSet() = 0; - virtual void unk8() = 0; + virtual void SetConVarsFromGameInfo(KeyValues *) = 0; - virtual void RegisterConVar(ConVarDesc_t, void*, ConVarID&, ConVar&) = 0; - virtual void UnregisterConVar(ConVarID cvar) = 0; - virtual ConVar* GetConVar(ConVarID cvar) = 0; + virtual void RegisterConVar(ConVarDesc_t*, void*, ConVarID&, ConVar&) = 0; + virtual void UnregisterConVar(ConVarID cvarid) = 0; + virtual ConVar* GetConVar(ConVarID cvarid) = 0; virtual void RegisterConCommand(void*, void*, ConCommandID&, ConCommand&) = 0; - virtual void UnregisterConCommand(ConCommandID command) = 0; - virtual ConCommand* GetConCommand(ConCommandID command) = 0; + virtual void UnregisterConCommand(ConCommandID commandid) = 0; + virtual ConCommand* GetConCommand(ConCommandID commandid) = 0; virtual void QueueThreadSetValue(ConVarRefAbstract *ref, CSplitScreenSlot nSlot, CVValue_t *value) = 0; }; diff --git a/public/tier1/iconvar.h b/public/tier1/iconvar.h index c0d20d7c..7970c0d7 100644 --- a/public/tier1/iconvar.h +++ b/public/tier1/iconvar.h @@ -89,6 +89,16 @@ DECLARE_HANDLE_32BIT(ConCommandID); //----------------------------------------------------------------------------- // Called when a ConVar changes value //----------------------------------------------------------------------------- -typedef void ( *FnChangeCallback_t )( IConVar *var, const char *pOldValue, float flOldValue ); +typedef void ( *FnChangeCallbackGlobal_t )( ConVarRefAbstract *cvar, CSplitScreenSlot nSlot, const char *pNewValue, const char* pOldValue ); +typedef void ( *FnChangeCallback_t )( ConVarRefAbstract *cvar, CSplitScreenSlot nSlot, CVValue_t *pNewValue, CVValue_t* pOldValue ); + +//----------------------------------------------------------------------------- +// ConVar & ConCommand creation listener callbacks +//----------------------------------------------------------------------------- +struct CCreationListenerCallbacks +{ + void(*FnConVarCreationCallback)(CCreationListenerCallbacks *pThisCallback, ConVarRefAbstract *pNewCvar); + void(*FnConCommandCreationCallback)(CCreationListenerCallbacks *pThisCallback, ConCommandID commandID); +}; #endif // ICONVAR_H