working on rendering

This commit is contained in:
2025-12-23 15:03:44 +02:00
parent 5a71b3023a
commit 3b4e2eea32
65 changed files with 1971 additions and 190 deletions

View File

@@ -94,6 +94,12 @@ public:
return buffer;
}
virtual const char *ReadString( IFileHandle *pFile ) override {
char *szString = (char*)V_malloc(Size(pFile)+1);
Read(pFile, szString, Size(pFile));
szString[Size(pFile)] = 0;
return szString;
};
};

View File

@@ -1,6 +1,7 @@
#include "tier2/ifilesystem.h"
#include "tier1/interface.h"
#include "tier0/lib.h"
#include "errno.h"
class CLIBCFileHandle : public IFileHandle
{
@@ -29,6 +30,9 @@ public:
case FILEMODE_READ:
szOperation = "rb";
break;
case FILEMODE_WRITE:
szOperation = "wb";
break;
default:
V_printf("Operation is not supported\n");
break;
@@ -36,7 +40,10 @@ public:
pFile = V_fopen(szFileName, szOperation);
if (!pFile)
{
Plat_FatalErrorFunc("Failed to open %s: %s\n",strerror(errno));
return NULL;
}
pHandle = new CLIBCFileHandle;
pHandle->m_pFileSystem = this;
@@ -48,7 +55,10 @@ public:
}
virtual size_t Write( IFileHandle *pFile, const void *pData, size_t nDataSize ) override
{
return 0;
CLIBCFileHandle *pHandle = (CLIBCFileHandle*)pFile;
if (!pHandle)
return 0;
return V_fwrite( pData, 1, nDataSize, pHandle->m_pFile);
}
virtual size_t Read( IFileHandle *pFile, void *pData, size_t nDataSize ) override
{
@@ -109,6 +119,7 @@ public:
}
virtual CUtlBuffer<unsigned char> Read( IFileHandle *pFile ) override { return NULL; };
virtual const char *ReadString( IFileHandle *pFile ) override { return NULL; };
};
EXPOSE_FILESYSTEM(CLIBCFileSystem, "sysfs");