2011-11-03 14:02:10 -05:00
|
|
|
|
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
2010-07-22 01:46:14 -05:00
|
|
|
|
//
|
|
|
|
|
// Purpose:
|
|
|
|
|
//
|
|
|
|
|
//===========================================================================//
|
|
|
|
|
|
|
|
|
|
#ifndef ICVAR_H
|
|
|
|
|
#define ICVAR_H
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
#pragma once
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "appframework/IAppSystem.h"
|
|
|
|
|
#include "tier1/iconvar.h"
|
|
|
|
|
#include "tier1/utlvector.h"
|
2011-11-03 14:02:10 -05:00
|
|
|
|
#include "tier0/memalloc.h"
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
|
|
|
|
class ConCommandBase;
|
|
|
|
|
class ConCommand;
|
|
|
|
|
class ConVar;
|
|
|
|
|
class Color;
|
2015-07-09 13:07:26 -04:00
|
|
|
|
class IConVarListener;
|
|
|
|
|
class CConVarDetail;
|
|
|
|
|
struct ConVarSnapshot_t;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// ConVars/ComCommands are marked as having a particular DLL identifier
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
typedef int CVarDLLIdentifier_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// Used to display console messages
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
abstract_class IConsoleDisplayFunc
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual void ColorPrint( const Color& clr, const char *pMessage ) = 0;
|
|
|
|
|
virtual void Print( const char *pMessage ) = 0;
|
|
|
|
|
virtual void DPrint( const char *pMessage ) = 0;
|
|
|
|
|
|
|
|
|
|
virtual void GetConsoleText( char *pchText, size_t bufSize ) const = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// Purpose: Applications can implement this to modify behavior in ICvar
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
#define CVAR_QUERY_INTERFACE_VERSION "VCvarQuery001"
|
|
|
|
|
abstract_class ICvarQuery : public IAppSystem
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
// Can these two convars be aliased?
|
|
|
|
|
virtual bool AreConVarsLinkable( const ConVar *child, const ConVar *parent ) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
2023-03-28 14:21:16 +03:00
|
|
|
|
union CVValue_t;
|
|
|
|
|
struct ConVarDesc_t;
|
|
|
|
|
|
|
|
|
|
struct characterset_t;
|
|
|
|
|
struct CSplitScreenSlot;
|
|
|
|
|
|
2010-07-22 01:46:14 -05:00
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// Purpose: DLL interface to ConVars/ConCommands
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
abstract_class ICvar : public IAppSystem
|
|
|
|
|
{
|
|
|
|
|
public:
|
2023-03-28 14:21:16 +03:00
|
|
|
|
// allow_developer - Allows finding convars with FCVAR_DEVELOPMENTONLY flag
|
2023-03-30 00:02:29 +03:00
|
|
|
|
virtual ConVarID FindConVar(const char *szName, bool bAllowDeveloper = false) = 0;
|
2023-03-28 14:21:16 +03:00
|
|
|
|
virtual ConVarID FindFirstConVar() = 0;
|
|
|
|
|
virtual ConVarID FindNextConVar(ConVarID previous) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-30 00:02:29 +03:00
|
|
|
|
virtual void SetConVarValue(ConVarID cvarid, CSplitScreenSlot nSlot, CVValue_t *pNewValue, CVValue_t *pOldValue) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-30 00:02:29 +03:00
|
|
|
|
virtual ConCommandID FindCommand(const char *szName) = 0;
|
2023-03-28 14:21:16 +03:00
|
|
|
|
virtual ConCommandID FindFirstCommand() = 0;
|
|
|
|
|
virtual ConCommandID FindNextCommand(ConCommandID previous) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-30 00:02:29 +03:00
|
|
|
|
virtual void DispatchConCommand(ConCommandID commandid, CCommandContext& ctx, CCommand& tok) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
|
|
|
|
// Install a global change callback (to be called when any convar changes)
|
2023-03-30 00:02:29 +03:00
|
|
|
|
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;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
|
|
|
|
// Reverts cvars which contain a specific flag
|
2023-03-30 00:02:29 +03:00
|
|
|
|
virtual void RevertFlaggedConVars(int nFlag) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-30 00:02:29 +03:00
|
|
|
|
virtual void SetMaxSplitScreenSlots(int nSlots) = 0;
|
|
|
|
|
virtual int GetMaxSplitScreenSlots() const = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-30 00:02:29 +03:00
|
|
|
|
virtual void RegisterCreationListeners(CCreationListenerCallbacks *callbacks) = 0;
|
|
|
|
|
virtual void RemoveCreationListeners(CCreationListenerCallbacks *callbacks) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-30 00:18:38 +03:00
|
|
|
|
virtual void unk1() = 0;
|
2023-03-30 00:02:29 +03:00
|
|
|
|
|
|
|
|
|
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;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-28 14:21:16 +03:00
|
|
|
|
virtual characterset_t GetCharacterSet() = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-30 00:02:29 +03:00
|
|
|
|
virtual void SetConVarsFromGameInfo(KeyValues *) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-30 00:02:29 +03:00
|
|
|
|
virtual void RegisterConVar(ConVarDesc_t*, void*, ConVarID&, ConVar&) = 0;
|
|
|
|
|
virtual void UnregisterConVar(ConVarID cvarid) = 0;
|
|
|
|
|
virtual ConVar* GetConVar(ConVarID cvarid) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-28 14:21:16 +03:00
|
|
|
|
virtual void RegisterConCommand(void*, void*, ConCommandID&, ConCommand&) = 0;
|
2023-03-30 00:02:29 +03:00
|
|
|
|
virtual void UnregisterConCommand(ConCommandID commandid) = 0;
|
|
|
|
|
virtual ConCommand* GetConCommand(ConCommandID commandid) = 0;
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
2023-03-28 14:21:16 +03:00
|
|
|
|
virtual void QueueThreadSetValue(ConVarRefAbstract *ref, CSplitScreenSlot nSlot, CVValue_t *value) = 0;
|
|
|
|
|
};
|
2010-07-22 01:46:14 -05:00
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// These global names are defined by tier1.h, duplicated here so you
|
|
|
|
|
// don't have to include tier1.h
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// These are marked DLL_EXPORT for Linux.
|
|
|
|
|
DECLARE_TIER1_INTERFACE( ICvar, cvar );
|
|
|
|
|
DECLARE_TIER1_INTERFACE( ICvar, g_pCVar );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ICVAR_H
|