mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
Initial android support (#17)
* Upload Android armv7 libs * Fix debug build * utlvector: fix undefined behavior * wscript: add --use-ccache option * wscript: store ccache in a separate directory * Propertly use gl4es * fontconfig: fix font detection * [android]remove fontconfig dependency * Add build guide for other platforms Co-authored-by: JusicP <slender87844@gmail.com> Co-authored-by: nillerusr <nillerusr@users.noreply.github.com>
This commit is contained in:
co-authored by
JusicP
nillerusr
parent
2a490d398c
commit
2c6669f5e3
@@ -3770,8 +3770,10 @@ bool CBaseFileSystem::IsFileWritable( char const *pFileName, char const *pPathID
|
||||
{
|
||||
#ifdef WIN32
|
||||
if( buf.st_mode & _S_IWRITE )
|
||||
#elif LINUX
|
||||
#elif defined (LINUX) && !defined (ANDROID)
|
||||
if( buf.st_mode & S_IWRITE )
|
||||
#elif ANDROID
|
||||
if( buf.st_mode & S_IWUSR )
|
||||
#else
|
||||
if( buf.st_mode & S_IWRITE )
|
||||
#endif
|
||||
@@ -3792,8 +3794,10 @@ bool CBaseFileSystem::IsFileWritable( char const *pFileName, char const *pPathID
|
||||
{
|
||||
#ifdef WIN32
|
||||
if ( buf.st_mode & _S_IWRITE )
|
||||
#elif LINUX
|
||||
#elif defined (LINUX) && !defined (ANDROID)
|
||||
if ( buf.st_mode & S_IWRITE )
|
||||
#elif ANDROID
|
||||
if ( buf.st_mode & S_IWUSR )
|
||||
#else
|
||||
if ( buf.st_mode & S_IWRITE )
|
||||
#endif
|
||||
@@ -3812,6 +3816,8 @@ bool CBaseFileSystem::SetFileWritable( char const *pFileName, bool writable, con
|
||||
|
||||
#ifdef _WIN32
|
||||
int pmode = writable ? ( _S_IWRITE | _S_IREAD ) : ( _S_IREAD );
|
||||
#elif ANDROID
|
||||
int pmode = writable ? ( S_IWUSR | S_IRUSR ) : ( S_IRUSR );
|
||||
#else
|
||||
int pmode = writable ? ( S_IWRITE | S_IREAD ) : ( S_IREAD );
|
||||
#endif
|
||||
@@ -5062,13 +5068,15 @@ CSysModule *CBaseFileSystem::LoadModule( const char *pFileName, const char *pPat
|
||||
|
||||
|
||||
#ifdef POSIX
|
||||
Q_snprintf( tempPathID, sizeof(tempPathID), "lib%s", pFileName );
|
||||
pModule = Sys_LoadModule( tempPathID );
|
||||
if( !pModule )
|
||||
#endif
|
||||
{
|
||||
pModule = Sys_LoadModule( pFileName );
|
||||
Q_snprintf( tempPathID, sizeof(tempPathID), "lib%s", pFileName );
|
||||
pModule = Sys_LoadModule( tempPathID );
|
||||
}
|
||||
#endif
|
||||
|
||||
if( !pModule )
|
||||
pModule = Sys_LoadModule( pFileName );
|
||||
|
||||
return pModule;
|
||||
}
|
||||
|
||||
@@ -972,7 +972,11 @@ void CStdioFile::FS_fclose()
|
||||
AUTO_LOCK( m_MutexLockedFD );
|
||||
|
||||
struct _stat buf;
|
||||
#ifdef ANDROID
|
||||
int fd = fileno( m_pFile ); // need to test this
|
||||
#else
|
||||
int fd = fileno_unlocked( m_pFile );
|
||||
#endif
|
||||
fstat( fd, &buf );
|
||||
|
||||
fflush( m_pFile );
|
||||
|
||||
@@ -879,10 +879,10 @@ int64 CZipPackFileHandle::AbsoluteBaseOffset()
|
||||
return m_pOwner->GetPackFileBaseOffset() + m_nBase;
|
||||
}
|
||||
|
||||
#if defined( _DEBUG ) && !defined( OSX )
|
||||
#if defined( _DEBUG ) && !defined( OSX ) && !defined( ANDROID )
|
||||
#include <atomic>
|
||||
static std::atomic<int> sLZMAPackFileHandles( 0 );
|
||||
#endif // defined( _DEBUG ) && !defined( OSX )
|
||||
#endif // defined( _DEBUG ) && !defined( OSX ) && !defined( ANDROID )
|
||||
|
||||
CLZMAZipPackFileHandle::CLZMAZipPackFileHandle( CZipPackFile* pOwner, int64 nBase, unsigned int nOriginalSize, unsigned int nCompressedSize,
|
||||
unsigned int nIndex, unsigned int nFilePointer )
|
||||
@@ -892,7 +892,7 @@ CLZMAZipPackFileHandle::CLZMAZipPackFileHandle( CZipPackFile* pOwner, int64 nBas
|
||||
m_pLZMAStream( NULL ), m_nSeekPosition( 0 ), m_nOriginalSize( nOriginalSize )
|
||||
{
|
||||
Reset();
|
||||
#if defined( _DEBUG ) && !defined( OSX )
|
||||
#if defined( _DEBUG ) && !defined( OSX ) && !defined( ANDROID )
|
||||
if ( ++sLZMAPackFileHandles == PACKFILE_COMPRESSED_FILE_HANDLES_WARNING )
|
||||
{
|
||||
// By my count a live filehandle is currently around 270k, mostly due to the LZMA dictionary (256k) with the
|
||||
@@ -901,17 +901,17 @@ CLZMAZipPackFileHandle::CLZMAZipPackFileHandle( CZipPackFile* pOwner, int64 nBas
|
||||
"These carry large buffers around, and can cause high memory usage\n",
|
||||
PACKFILE_COMPRESSED_FILE_HANDLES_WARNING );
|
||||
}
|
||||
#endif // defined( _DEBUG ) && !defined( OSX )
|
||||
#endif // defined( _DEBUG ) && !defined( OSX ) && !defined( ANDROID )
|
||||
}
|
||||
|
||||
CLZMAZipPackFileHandle::~CLZMAZipPackFileHandle()
|
||||
{
|
||||
delete m_pLZMAStream;
|
||||
m_pLZMAStream = NULL;
|
||||
#if defined( _DEBUG ) && !defined( OSX )
|
||||
#if defined( _DEBUG ) && !defined( OSX ) && !defined( ANDROID )
|
||||
sLZMAPackFileHandles--;
|
||||
Assert( sLZMAPackFileHandles >= 0 );
|
||||
#endif // defined( _DEBUG ) && !defined( OSX )
|
||||
#endif // defined( _DEBUG ) && !defined( OSX ) && !defined( ANDROID )
|
||||
}
|
||||
|
||||
int CLZMAZipPackFileHandle::Read( void* pBuffer, int nDestSize, int nBytes )
|
||||
|
||||
Reference in New Issue
Block a user