2025-05-17 14:15:00 -04:00
|
|
|
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
2008-09-15 01:00:17 -05:00
|
|
|
//
|
|
|
|
// Purpose:
|
|
|
|
//
|
|
|
|
//=============================================================================//
|
|
|
|
|
|
|
|
#include "icvar.h"
|
|
|
|
|
|
|
|
// memdbgon must be the last include file in a .cpp file!!!
|
|
|
|
#include "tier0/memdbgon.h"
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------- //
|
|
|
|
// ConVar stuff.
|
|
|
|
// ------------------------------------------------------------------------------------------- //
|
|
|
|
static ICvar *s_pCVar;
|
|
|
|
|
|
|
|
class CShaderLibConVarAccessor : public IConCommandBaseAccessor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual bool RegisterConCommandBase( ConCommandBase *pCommand )
|
|
|
|
{
|
|
|
|
// Mark for easy removal
|
|
|
|
pCommand->AddFlags( FCVAR_MATERIAL_SYSTEM );
|
|
|
|
|
|
|
|
// Unlink from shaderlib only list
|
|
|
|
pCommand->SetNext( 0 );
|
|
|
|
|
|
|
|
// Link to engine's list instead
|
|
|
|
s_pCVar->RegisterConCommandBase( pCommand );
|
|
|
|
|
|
|
|
char const *pValue = s_pCVar->GetCommandLineValue( pCommand->GetName() );
|
|
|
|
if( pValue && !pCommand->IsCommand() )
|
|
|
|
{
|
|
|
|
( ( ConVar * )pCommand )->SetValue( pValue );
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
CShaderLibConVarAccessor g_ConVarAccessor;
|
|
|
|
|
|
|
|
|
|
|
|
void InitShaderLibCVars( CreateInterfaceFn cvarFactory )
|
|
|
|
{
|
|
|
|
s_pCVar = (ICvar*)cvarFactory( VENGINE_CVAR_INTERFACE_VERSION, NULL );
|
|
|
|
if ( s_pCVar )
|
|
|
|
{
|
|
|
|
ConCommandBaseMgr::OneTimeInit( &g_ConVarAccessor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ICvar *GetCVar()
|
|
|
|
{
|
|
|
|
return s_pCVar;
|
|
|
|
}
|