diff --git a/dedicated/console/TextConsoleUnix.cpp b/dedicated/console/TextConsoleUnix.cpp index 4f71845149..108d38b7e4 100644 --- a/dedicated/console/TextConsoleUnix.cpp +++ b/dedicated/console/TextConsoleUnix.cpp @@ -336,8 +336,11 @@ void CTextConsoleUnix::ShutDown() pthread_t tid = g_threadid; g_threadid = (pthread_t)-1; - +#if defined ( ANDROID ) + pthread_kill( tid, SIGUSR1 ); +#else pthread_cancel( tid ); +#endif pthread_join( tid, &status ); } diff --git a/game/server/nav_area.h b/game/server/nav_area.h index 0c97a662bd..7d96f17794 100644 --- a/game/server/nav_area.h +++ b/game/server/nav_area.h @@ -343,8 +343,8 @@ public: bool IsOverlapping( const Extent &extent ) const; // return true if 'extent' overlaps our 2D extents bool IsOverlappingX( const CNavArea *area ) const; // return true if 'area' overlaps our X extent bool IsOverlappingY( const CNavArea *area ) const; // return true if 'area' overlaps our Y extent - inline float GetZ( const Vector * RESTRICT pPos ) const ; // return Z of area at (x,y) of 'pos' - inline float GetZ( const Vector &pos ) const; // return Z of area at (x,y) of 'pos' + inline float GetZ( const Vector * RESTRICT pPos ) const RESTRICT ; // return Z of area at (x,y) of 'pos' + inline float GetZ( const Vector &pos ) const RESTRICT; // return Z of area at (x,y) of 'pos' float GetZ( float x, float y ) const RESTRICT; // return Z of area at (x,y) of 'pos' bool Contains( const Vector &pos ) const; // return true if given point is on or above this area, but no others bool Contains( const CNavArea *area ) const; diff --git a/ivp b/ivp index 58cb1243b4..64e06cde5f 160000 --- a/ivp +++ b/ivp @@ -1 +1 @@ -Subproject commit 58cb1243b4b2b005eeed808df84e994942c84751 +Subproject commit 64e06cde5f7b651eb794a5c46ac1ceae198ec182 diff --git a/materialsystem/cmatlightmaps.h b/materialsystem/cmatlightmaps.h index f2b135ffa5..1103fd5cd2 100644 --- a/materialsystem/cmatlightmaps.h +++ b/materialsystem/cmatlightmaps.h @@ -113,7 +113,7 @@ private: float *pFloatImageBump3, int pLightmapSize[2], int pOffsetIntoLightmapPage[2], FloatBitMap_t *pfmOut ); void BumpedLightmapBitsToPixelWriter_HDRI( float* pFloatImage, float *pFloatImageBump1, float *pFloatImageBump2, - float *pFloatImageBump3, int pLightmapSize[2], int pOffsetIntoLightmapPage[2], FloatBitMap_t *pfmOut ); + float *pFloatImageBump3, int pLightmapSize[2], int pOffsetIntoLightmapPage[2], FloatBitMap_t *pfmOut ) RESTRICT; void LightmapBitsToPixelWriter_LDR( float* pFloatImage, int pLightmapSize[2], int pOffsetIntoLightmapPage[2], FloatBitMap_t *pfmOut ); void LightmapBitsToPixelWriter_HDRF( float* pFloatImage, int pLightmapSize[2], int pOffsetIntoLightmapPage[2], FloatBitMap_t *pfmOut ); diff --git a/public/XUnzip.cpp b/public/XUnzip.cpp index e58f55b2be..85641a29c9 100644 --- a/public/XUnzip.cpp +++ b/public/XUnzip.cpp @@ -4243,6 +4243,13 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags) { #ifdef _WIN32 SetFileTime(h,&ze.ctime,&ze.atime,&ze.mtime); +#elif defined( ANDROID ) + struct timespec ts[2]; + ts[0].tv_sec = ze.atime; + ts[0].tv_nsec = 0; + ts[1].tv_sec = ze.mtime; + ts[1].tv_nsec = 0; + utimensat((int)h, NULL, ts, 0); #else struct timeval tv[2]; tv[0].tv_sec = ze.atime; diff --git a/public/materialsystem/imesh.h b/public/materialsystem/imesh.h index 5f23f24e71..17533969e0 100644 --- a/public/materialsystem/imesh.h +++ b/public/materialsystem/imesh.h @@ -1244,11 +1244,11 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX7_t &vertex ) const char *pRead = (char *)&vertex; char *pCurrPos = (char *)m_pCurrPosition; __m128 m1 = _mm_load_ps( (float *)pRead ); - __m128 m2 = _mm_load_ps( (float *)(pRead + 16) ); - __m128 m3 = _mm_load_ps( (float *)(pRead + 32) ); + __m128 m2 = _mm_load_ps( (float *)((int)pRead + 16) ); + __m128 m3 = _mm_load_ps( (float *)((int)pRead + 32) ); _mm_stream_ps( (float *)pCurrPos, m1 ); - _mm_stream_ps( (float *)(pCurrPos + 16), m2 ); - _mm_stream_ps( (float *)(pCurrPos + 32), m3 ); + _mm_stream_ps( (float *)((int)pCurrPos + 16), m2 ); + _mm_stream_ps( (float *)((int)pCurrPos + 32), m3 ); #else Error( "Implement CMeshBuilder::FastVertexSSE(dx7)" ); #endif @@ -1436,13 +1436,13 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex ) :: "r" (pRead), "r" (pCurrPos) : "memory"); */ __m128 m1 = _mm_load_ps( (float *)pRead ); - __m128 m2 = _mm_load_ps( (float *)(pRead + 16) ); - __m128 m3 = _mm_load_ps( (float *)(pRead + 32) ); - __m128 m4 = _mm_load_ps( (float *)(pRead + 48) ); + __m128 m2 = _mm_load_ps( (float *)((int)pRead + 16) ); + __m128 m3 = _mm_load_ps( (float *)((int)pRead + 32) ); + __m128 m4 = _mm_load_ps( (float *)((int)pRead + 48) ); _mm_stream_ps( (float *)pCurrPos, m1 ); - _mm_stream_ps( (float *)(pCurrPos + 16), m2 ); - _mm_stream_ps( (float *)(pCurrPos + 32), m3 ); - _mm_stream_ps( (float *)(pCurrPos + 48), m4 ); + _mm_stream_ps( (float *)((int)pCurrPos + 16), m2 ); + _mm_stream_ps( (float *)((int)pCurrPos + 32), m3 ); + _mm_stream_ps( (float *)((int)pCurrPos + 48), m4 ); #else Error( "Implement CMeshBuilder::FastVertexSSE((dx8)" ); #endif diff --git a/public/pixelwriter.h b/public/pixelwriter.h index 4c3c8b4fa7..11c023c51e 100644 --- a/public/pixelwriter.h +++ b/public/pixelwriter.h @@ -42,28 +42,28 @@ public: FORCEINLINE void ActivateByteSwapping( bool bSwap ); #endif - FORCEINLINE void Seek( int x, int y ); - FORCEINLINE void* SkipBytes( int n ); + FORCEINLINE void Seek( int x, int y ) RESTRICT; + FORCEINLINE void* SkipBytes( int n ) RESTRICT; FORCEINLINE void SkipPixels( int n ); FORCEINLINE void WritePixel( int r, int g, int b, int a = 255 ); - FORCEINLINE void WritePixelNoAdvance( int r, int g, int b, int a = 255 ); + FORCEINLINE void WritePixelNoAdvance( int r, int g, int b, int a = 255 ) RESTRICT; FORCEINLINE void WritePixelSigned( int r, int g, int b, int a = 255 ); FORCEINLINE void WritePixelNoAdvanceSigned( int r, int g, int b, int a = 255 ); FORCEINLINE void ReadPixelNoAdvance( int &r, int &g, int &b, int &a ); // Floating point formats - FORCEINLINE void WritePixelNoAdvanceF( float r, float g, float b, float a = 1.0f ); + FORCEINLINE void WritePixelNoAdvanceF( float r, float g, float b, float a = 1.0f ) RESTRICT; FORCEINLINE void WritePixelF( float r, float g, float b, float a = 1.0f ); // SIMD formats - FORCEINLINE void WritePixel( FLTX4 rgba ); + FORCEINLINE void WritePixel( FLTX4 rgba ) RESTRICT; FORCEINLINE void WritePixelNoAdvance( FLTX4 rgba ); #ifdef _X360 // here are some explicit formats so we can avoid the switch: FORCEINLINE void WritePixelNoAdvance_RGBA8888( FLTX4 rgba ); FORCEINLINE void WritePixelNoAdvance_BGRA8888( FLTX4 rgba ); // as above, but with m_pBits passed in to avoid a LHS - FORCEINLINE void WritePixelNoAdvance_BGRA8888( FLTX4 rgba, void *pBits ); + FORCEINLINE void WritePixelNoAdvance_BGRA8888( FLTX4 rgba, void *pBits ) RESTRICT; // for writing entire SIMD registers at once when they have // already been packed, and when m_pBits is vector-aligned // (which is a requirement for write-combined memory) @@ -73,9 +73,9 @@ public: #endif - FORCEINLINE unsigned char GetPixelSize() { return m_Size; } + FORCEINLINE unsigned char GetPixelSize() RESTRICT { return m_Size; } - FORCEINLINE bool IsUsingFloatFormat() const; + FORCEINLINE bool IsUsingFloatFormat() RESTRICT const; FORCEINLINE unsigned char *GetCurrentPixel() { return m_pBits; } private: @@ -108,7 +108,7 @@ private: #endif }; -FORCEINLINE_PIXEL bool CPixelWriter::IsUsingFloatFormat() const +FORCEINLINE_PIXEL bool CPixelWriter::IsUsingFloatFormat() RESTRICT const { return (m_nFlags & PIXELWRITER_USING_FLOAT_FORMAT) != 0; } @@ -379,7 +379,7 @@ FORCEINLINE void CPixelWriter::ActivateByteSwapping( bool bSwap ) //----------------------------------------------------------------------------- // Sets where we're writing to //----------------------------------------------------------------------------- -FORCEINLINE_PIXEL void CPixelWriter::Seek( int x, int y ) +FORCEINLINE_PIXEL void CPixelWriter::Seek( int x, int y ) RESTRICT { m_pBits = m_pBase + y * m_BytesPerRow + x * m_Size; } @@ -407,7 +407,7 @@ FORCEINLINE_PIXEL void CPixelWriter::SkipPixels( int n ) //----------------------------------------------------------------------------- // Writes a pixel without advancing the index PC ONLY //----------------------------------------------------------------------------- -FORCEINLINE_PIXEL void CPixelWriter::WritePixelNoAdvanceF( float r, float g, float b, float a ) +FORCEINLINE_PIXEL void CPixelWriter::WritePixelNoAdvanceF( float r, float g, float b, float a ) RESTRICT { Assert( IsUsingFloatFormat() ); @@ -473,7 +473,7 @@ FORCEINLINE_PIXEL void CPixelWriter::WritePixelSigned( int r, int g, int b, int //----------------------------------------------------------------------------- // Writes a pixel without advancing the index //----------------------------------------------------------------------------- -FORCEINLINE_PIXEL void CPixelWriter::WritePixelNoAdvance( int r, int g, int b, int a ) +FORCEINLINE_PIXEL void CPixelWriter::WritePixelNoAdvance( int r, int g, int b, int a ) RESTRICT { Assert( !IsUsingFloatFormat() ); diff --git a/public/studio.h b/public/studio.h index bc70313b7c..f67a78cc23 100644 --- a/public/studio.h +++ b/public/studio.h @@ -2655,8 +2655,8 @@ public: const void *m_expectedVModel; // double-check that the data I point to hasn't changed - bool ValidateAgainst( const CStudioHdr * RESTRICT pstudiohdr ); - void SetValidationPair( const CStudioHdr *RESTRICT pstudiohdr ); + bool ValidateAgainst( const CStudioHdr * RESTRICT pstudiohdr ) RESTRICT; + void SetValidationPair( const CStudioHdr *RESTRICT pstudiohdr ) RESTRICT; friend class CStudioHdr; }; diff --git a/public/tier1/bitbuf.h b/public/tier1/bitbuf.h index b92e010c39..ebf40cc437 100644 --- a/public/tier1/bitbuf.h +++ b/public/tier1/bitbuf.h @@ -181,7 +181,7 @@ public: void WriteOneBitAt( int iBit, int nValue ); // Write signed or unsigned. Range is only checked in debug. - void WriteUBitLong( unsigned int data, int numbits, bool bCheckRange=true ); + void WriteUBitLong( unsigned int data, int numbits, bool bCheckRange=true ) RESTRICT; void WriteSBitLong( int data, int numbits ); // Tell it whether or not the data is unsigned. If it's signed, @@ -241,7 +241,7 @@ public: int GetNumBytesWritten() const; int GetNumBitsWritten() const; int GetMaxNumBits(); - int GetNumBitsLeft(); + int GetNumBitsLeft() RESTRICT; int GetNumBytesLeft(); unsigned char* GetData(); const unsigned char* GetData() const; @@ -250,7 +250,7 @@ public: bool CheckForOverflow(int nBits); inline bool IsOverflowed() const {return m_bOverflow;} - void SetOverflowFlag(); + void SetOverflowFlag() RESTRICT; public: @@ -292,7 +292,7 @@ inline int bf_write::GetMaxNumBits() return m_nDataBits; } -inline int bf_write::GetNumBitsLeft() +inline int bf_write::GetNumBitsLeft() RESTRICT { return m_nDataBits - m_iCurBit; } @@ -323,7 +323,7 @@ BITBUF_INLINE bool bf_write::CheckForOverflow(int nBits) return m_bOverflow; } -BITBUF_INLINE void bf_write::SetOverflowFlag() +BITBUF_INLINE void bf_write::SetOverflowFlag() RESTRICT { #ifdef DBGFLAG_ASSERT if ( m_bAssertOnOverflow ) @@ -635,7 +635,7 @@ public: public: int GetNumBytesLeft(); int GetNumBytesRead(); - int GetNumBitsLeft(); + int GetNumBitsLeft() RESTRICT; int GetNumBitsRead() const; // Has the buffer overflowed? @@ -645,7 +645,7 @@ public: inline bool SeekRelative(int iBitDelta); // Seek to an offset from the current position. // Called when the buffer is overflowed. - void SetOverflowFlag(); + void SetOverflowFlag() RESTRICT; public: @@ -678,7 +678,7 @@ inline int bf_read::GetNumBytesRead() return BitByte(m_iCurBit); } -inline int bf_read::GetNumBitsLeft() +inline int bf_read::GetNumBitsLeft() RESTRICT { return m_nDataBits - m_iCurBit; } diff --git a/tier0/assert_dialog.cpp b/tier0/assert_dialog.cpp index 89af64c1a8..e13b47e0be 100644 --- a/tier0/assert_dialog.cpp +++ b/tier0/assert_dialog.cpp @@ -386,7 +386,7 @@ DBG_INTERFACE bool ShouldUseNewAssertDialog() #endif // DBGFLAG_ASSERTDLG } -#if defined( POSIX ) +#if defined( POSIX ) && !defined ( ANDROID ) #include @@ -441,7 +441,9 @@ DBG_INTERFACE bool DoNewAssertDialog( const tchar *pFilename, int line, const tc pFilename, line, pExpression); if ( getenv( "POSIX_ASSERT_BACKTRACE" ) ) { +#if !defined ( ANDROID ) SpewBacktrace(); +#endif } } else diff --git a/tier0/cpu_usage.cpp b/tier0/cpu_usage.cpp index da313a89b3..1fc1752bac 100644 --- a/tier0/cpu_usage.cpp +++ b/tier0/cpu_usage.cpp @@ -124,9 +124,13 @@ float GetCPUUsage() float GetCPUUsage() { +#ifdef ANDROID + return 0; +#else double loadavg[3]; getloadavg( loadavg, 3 ); return loadavg[0]; +#endif } #endif //POSIX diff --git a/tier0/stacktools.cpp b/tier0/stacktools.cpp index 7b0da4f3a7..f32dc4d525 100644 --- a/tier0/stacktools.cpp +++ b/tier0/stacktools.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -27,7 +27,7 @@ #include #endif -#if defined( LINUX ) +#if defined( LINUX ) && !defined( ANDROID ) #include #endif @@ -38,7 +38,7 @@ #if !defined( ENABLE_RUNTIME_STACK_TRANSLATION ) //disable the whole toolset -#if defined( LINUX ) +#if defined( LINUX ) && !defined( ANDROID ) int GetCallStack( void **pReturnAddressesOut, int iArrayCount, int iSkipCount ) { diff --git a/tier0/threadtools.cpp b/tier0/threadtools.cpp index 001e703a89..caafef6cf6 100644 --- a/tier0/threadtools.cpp +++ b/tier0/threadtools.cpp @@ -2034,6 +2034,8 @@ void CThread::Yield() { #ifdef _WIN32 ::Sleep(0); +#elif defined(ANDROID) + sched_yield(); #elif defined(POSIX) pthread_yield(); #endif diff --git a/tier1/bitbuf.cpp b/tier1/bitbuf.cpp index 825a97cef8..bb53b3bef5 100644 --- a/tier1/bitbuf.cpp +++ b/tier1/bitbuf.cpp @@ -849,7 +849,7 @@ void bf_read::SetDebugName( const char *pName ) m_pDebugName = pName; } -void bf_read::SetOverflowFlag() +void bf_read::SetOverflowFlag() RESTRICT { if ( m_bAssertOnOverflow ) { @@ -992,7 +992,7 @@ unsigned int bf_read::PeekUBitLong( int numbits ) return r; } -unsigned int bf_read::ReadUBitLongNoInline( int numbits ) +unsigned int bf_read::ReadUBitLongNoInline( int numbits ) RESTRICT { return ReadUBitLong( numbits ); } diff --git a/tier1/strtools.cpp b/tier1/strtools.cpp index 7f2fd27074..cfef6b133c 100644 --- a/tier1/strtools.cpp +++ b/tier1/strtools.cpp @@ -1421,7 +1421,7 @@ int _V_UCS2ToUnicode( const ucs2 *pUCS2, wchar_t *pUnicode, int cubDestSizeInByt size_t nMaxUTF8 = cubDestSizeInBytes; char *pIn = (char *)pUCS2; char *pOut = (char *)pUnicode; - if ( conv_t > 0 ) + if ( conv_t > (void*)0 ) { cchResult = iconv( conv_t, &pIn, &nLenUnicde, &pOut, &nMaxUTF8 ); iconv_close( conv_t ); @@ -1461,7 +1461,7 @@ int _V_UnicodeToUCS2( const wchar_t *pUnicode, int cubSrcInBytes, char *pUCS2, i size_t nMaxUCS2 = cubDestSizeInBytes; char *pIn = (char*)pUnicode; char *pOut = pUCS2; - if ( conv_t > 0 ) + if ( conv_t > (void*)0 ) { cchResult = iconv( conv_t, &pIn, &nLenUnicde, &pOut, &nMaxUCS2 ); iconv_close( conv_t ); @@ -1509,7 +1509,7 @@ int _V_UCS2ToUTF8( const ucs2 *pUCS2, char *pUTF8, int cubDestSizeInBytes ) size_t nMaxUTF8 = cubDestSizeInBytes - 1; char *pIn = (char *)pUCS2; char *pOut = (char *)pUTF8; - if ( conv_t > 0 ) + if ( conv_t > (void*)0 ) { const size_t nBytesToWrite = nMaxUTF8; cchResult = iconv( conv_t, &pIn, &nLenUnicde, &pOut, &nMaxUTF8 ); @@ -1554,7 +1554,7 @@ int _V_UTF8ToUCS2( const char *pUTF8, int cubSrcInBytes, ucs2 *pUCS2, int cubDes size_t nMaxUTF8 = cubDestSizeInBytes; char *pIn = (char *)pUTF8; char *pOut = (char *)pUCS2; - if ( conv_t > 0 ) + if ( conv_t > (void*)0 ) { cchResult = iconv( conv_t, &pIn, &nLenUnicde, &pOut, &nMaxUTF8 ); iconv_close( conv_t );