introduces ios support? still needs metal

This commit is contained in:
2025-06-29 01:21:55 +03:00
parent af4f0c3cad
commit cdeaac7c0c
79 changed files with 2176 additions and 1349 deletions

View File

@@ -1,4 +1,5 @@
#include "console.h"
#include "filesystem.h"
#include "tier1/utlstring.h"
#include "tier1/utlvector.h"
@@ -64,33 +65,43 @@ void IConsole::Execute2( CUtlVector<CUtlString> &args )
(cmd->GetCallback())(args.GetSize(), strbuffer);
}
void IConsole::Execute( void )
{
CUtlVector<CUtlVector<CUtlString>> commands = ParseCommandLine(g_commandBuffer);
g_commandBuffer = 0;
for (auto &command: commands)
{
IConsole::Execute2(command);
}
}
//-----------------------------------------------------------------------------
// Parses command buffer.
//-----------------------------------------------------------------------------
void IConsole::Execute( void )
{
CUtlVector<CUtlVector<CUtlString>> IConsole::ParseCommandLine( CUtlString psz )
{
CUtlVector<CUtlString> arguments;
CUtlVector<CUtlVector<CUtlString>> commands;
CUtlString szArgument;
bool bIsQuote = false;
for (auto &c: (CUtlVector<char>&)g_commandBuffer)
for ( auto &c: (CUtlVector<char>&)psz )
{
if (c == '\"')
if ( c == '\"' )
{
bIsQuote = !bIsQuote;
continue;
}
if (c == ';' || c == '\n' || c == '\0')
if ( c == ';' || c == '\n' )
{
if (bIsQuote)
{
if (c != '\0')
szArgument.AppendTail(c);
continue;
}
if (szArgument != 0)
arguments.AppendTail(szArgument);
IConsole::Execute2(arguments);
if ( arguments.GetSize() > 0 )
commands.AppendTail(arguments);
szArgument = 0;
arguments = {};
continue;
@@ -110,7 +121,11 @@ void IConsole::Execute( void )
}
szArgument.AppendTail(c);
};
g_commandBuffer = 0;
if (szArgument != 0)
arguments.AppendTail(szArgument);
if ( arguments.GetSize() > 0 )
commands.AppendTail(arguments);
return commands;
}
void IConsole::AddCommand( const char *psz )
@@ -232,3 +247,23 @@ ConCommandFn ConCommand::GetCallback( void )
{
return m_callback;
}
void IConsole_Exec( int argc, char **argv)
{
if (argc != 2)
return;
FileHandle_t f = IFileSystem::Open(argv[1], IFILE_READ);
if (!f)
return;
CUtlBuffer<char> b(IFileSystem::Size(f)+1);
IFileSystem::Read(f, b, b.GetSize());
b[IFileSystem::Size(f)] = 0;
IConsole::AddCommand(b);
IConsole::AddCommand(";");
IConsole::Execute();
}
ConCommand IConsole_ExecCmd("exec", IConsole_Exec);