no engine anymore

This commit is contained in:
2025-07-30 23:53:26 +03:00
parent 8a29e6b86f
commit 395ced9e28
159 changed files with 2767 additions and 9484 deletions

View File

@@ -5,6 +5,7 @@
#include "tier1/commandline.h"
CUtlVector<CUtlString> tier1_CompiledFiles = {
"tier1/interface.cpp",
"tier1/commandline.cpp",
"tier1/utlbuffer.cpp",
"tier1/utlmap.cpp",
@@ -13,21 +14,20 @@ CUtlVector<CUtlString> tier1_CompiledFiles = {
};
CUtlString tier1_lib;
int tier1_build()
DECLARE_BUILD_STAGE(tier1)
{
CCProject compileProject = {};
CLDProject ldProject = {};
CProject_t compileProject = {};
LinkProject_t ldProject = {};
compileProject.m_szName = "tier1";
compileProject.files = tier1_CompiledFiles;
compileProject.includeDirectories = all_IncludeDirectories;
compileProject.bFPIC = true;
ldProject = compileProject.Compile();
ldProject = ccompiler->Compile(&compileProject);
ldProject.linkType = ELINK_STATIC_LIBRARY;
CUtlString outputProject = ldProject.Link();
CUtlString outputProject = linker->Link(&ldProject);
tier1_lib = outputProject;
return 0;
};
DECLARE_BUILD_STAGE(tier1, tier1_build);

View File

@@ -1,16 +1,33 @@
#include "tier1/commandline.h"
#include "tier1/utlvector.h"
CUtlVector<char*> cl_params;
void ICommandLine::CreateCommandLine( int argc, char **argv )
class CCommandLine : public ICommandLine
{
cl_params.AppendTail(argv,argc);
public:
virtual void CreateCommandLine( int argc, char **argv ) override;
virtual bool CheckParam( const char *psz ) override;
virtual char *ParamValue( const char* psz, const char *szDefaultValue = 0 ) override;
virtual void AddParam( char *psz ) override;
virtual void RemoveParam( char *psz ) override;
virtual int ParamCount() override;
virtual int FindParam( const char *psz ) override;
virtual const char *GetParam(int nIndex) override;
private:
CUtlVector<char*> m_params;
};
void CCommandLine::CreateCommandLine( int argc, char **argv )
{
m_params.AppendTail(argv,argc);
}
bool ICommandLine::CheckParam( const char *psz )
bool CCommandLine::CheckParam( const char *psz )
{
for (auto szParam: cl_params) {
for (auto szParam: m_params) {
if (!V_strcmp(szParam, psz))
{
return true;
@@ -19,44 +36,49 @@ bool ICommandLine::CheckParam( const char *psz )
return false;
}
char *ICommandLine::ParamValue( const char *psz, const char *szDefaultValue )
char *CCommandLine::ParamValue( const char *psz, const char *szDefaultValue )
{
int i = 0;
for (auto szParam: cl_params) {
for (auto szParam: m_params) {
i++;
if (i>=cl_params.GetSize())
if (i>=m_params.GetSize())
break;
if (!V_strcmp(szParam, psz))
return cl_params[i];
return m_params[i];
}
return (char*)szDefaultValue;
}
void ICommandLine::AddParam( char *psz )
void CCommandLine::AddParam( char *psz )
{
m_params.AppendTail(psz);
}
void ICommandLine::RemoveParam( char *psz )
void CCommandLine::RemoveParam( char *psz )
{
}
int ICommandLine::ParamCount()
int CCommandLine::ParamCount()
{
return cl_params.GetSize();
return m_params.GetSize();
}
int ICommandLine::FindParam( const char *psz )
int CCommandLine::FindParam( const char *psz )
{
int i = 0;
for (auto szParam: cl_params) {
for (auto szParam: m_params) {
if (!V_strcmp(szParam, psz))
return i;
i++;
}
return 0;
}
const char *ICommandLine::GetParam(int nIndex)
const char *CCommandLine::GetParam(int nIndex)
{
return cl_params[nIndex];
return m_params[nIndex];
}
static ICommandLine g_CommandLine;
ICommandLine *CommandLine()
{
static CCommandLine s_CommandLine;
return &s_CommandLine;
}

29
tier1/interface.cpp Normal file
View File

@@ -0,0 +1,29 @@
#include "tier1/interface.h"
#include "tier1/utlvector.h"
CInterfaceRegistry *g_pInterfaceRegistries = NULL;
CInterfaceRegistry::CInterfaceRegistry( InstantiateInterfaceFn fn, const char *szName )
: m_szName(szName)
{
m_CreateFn = fn;
m_pNext = g_pInterfaceRegistries;
g_pInterfaceRegistries = this;
};
void *CreateInterface( const char *szName, int *pReturnCode )
{
CInterfaceRegistry *pRegistry = g_pInterfaceRegistries;
while (pRegistry)
{
if (!V_strcmp(szName, pRegistry->m_szName))
{
if (pReturnCode)
*pReturnCode = 0;
return pRegistry->m_CreateFn();
}
pRegistry = pRegistry->m_pNext;
}
if (pReturnCode)
*pReturnCode = 1;
return 0;
}