mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-14 20:56:56 +00:00
First steps
This commit is contained in:
@@ -386,7 +386,7 @@ DBG_INTERFACE bool ShouldUseNewAssertDialog()
|
||||
#endif // DBGFLAG_ASSERTDLG
|
||||
}
|
||||
|
||||
#if defined( POSIX )
|
||||
#if defined( POSIX ) && !defined( ANDROID )
|
||||
|
||||
#include <execinfo.h>
|
||||
|
||||
@@ -430,7 +430,7 @@ DBG_INTERFACE bool DoNewAssertDialog( const tchar *pFilename, int line, const tc
|
||||
return false;
|
||||
|
||||
// Assert not suppressed. Spew it, and optionally a backtrace.
|
||||
#if defined( POSIX )
|
||||
#if defined( POSIX ) && !defined( ANDROID )
|
||||
if( isatty( STDERR_FILENO ) )
|
||||
{
|
||||
#define COLOR_YELLOW "\033[1;33m"
|
||||
|
||||
+18
-14
@@ -22,7 +22,9 @@ const tchar* GetProcessorVendorId();
|
||||
|
||||
static bool cpuid(unsigned long function, unsigned long& out_eax, unsigned long& out_ebx, unsigned long& out_ecx, unsigned long& out_edx)
|
||||
{
|
||||
#if defined(GNUC)
|
||||
#if defined( __arm__ )
|
||||
return false;
|
||||
#elif defined(GNUC)
|
||||
asm("mov %%ebx, %%esi\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchg %%esi, %%ebx"
|
||||
@@ -80,7 +82,7 @@ static bool cpuid(unsigned long function, unsigned long& out_eax, unsigned long&
|
||||
|
||||
static bool CheckMMXTechnology(void)
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return true;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
@@ -142,7 +144,7 @@ static bool IsWin98OrOlder()
|
||||
|
||||
static bool CheckSSETechnology(void)
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return true;
|
||||
#else
|
||||
if ( IsWin98OrOlder() )
|
||||
@@ -162,7 +164,7 @@ static bool CheckSSETechnology(void)
|
||||
|
||||
static bool CheckSSE2Technology(void)
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
@@ -175,7 +177,7 @@ static bool CheckSSE2Technology(void)
|
||||
|
||||
bool CheckSSE3Technology(void)
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,ecx;
|
||||
@@ -188,7 +190,7 @@ bool CheckSSE3Technology(void)
|
||||
|
||||
bool CheckSSSE3Technology(void)
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return false;
|
||||
#else
|
||||
// SSSE 3 is implemented by both Intel and AMD
|
||||
@@ -203,7 +205,7 @@ bool CheckSSSE3Technology(void)
|
||||
|
||||
bool CheckSSE41Technology(void)
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return false;
|
||||
#else
|
||||
// SSE 4.1 is implemented by both Intel and AMD
|
||||
@@ -219,7 +221,7 @@ bool CheckSSE41Technology(void)
|
||||
|
||||
bool CheckSSE42Technology(void)
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return false;
|
||||
#else
|
||||
// SSE4.2 is an Intel-only feature
|
||||
@@ -239,7 +241,7 @@ bool CheckSSE42Technology(void)
|
||||
|
||||
bool CheckSSE4aTechnology( void )
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return false;
|
||||
#else
|
||||
// SSE 4a is an AMD-only feature
|
||||
@@ -259,7 +261,7 @@ bool CheckSSE4aTechnology( void )
|
||||
|
||||
static bool Check3DNowTechnology(void)
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax, unused;
|
||||
@@ -279,7 +281,7 @@ static bool Check3DNowTechnology(void)
|
||||
|
||||
static bool CheckCMOVTechnology()
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
@@ -292,7 +294,7 @@ static bool CheckCMOVTechnology()
|
||||
|
||||
static bool CheckFCMOVTechnology(void)
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
@@ -305,7 +307,7 @@ static bool CheckFCMOVTechnology(void)
|
||||
|
||||
static bool CheckRDTSCTechnology(void)
|
||||
{
|
||||
#if defined( _X360 ) || defined( _PS3 )
|
||||
#if defined( _X360 ) || defined( _PS3 ) || defined( __arm__ )
|
||||
return false;
|
||||
#else
|
||||
unsigned long eax,ebx,edx,unused;
|
||||
@@ -353,7 +355,9 @@ const tchar* GetProcessorVendorId()
|
||||
// Hyper-Threading Technology is necessarily enabled.
|
||||
static bool HTSupported(void)
|
||||
{
|
||||
#if defined( _X360 )
|
||||
#if defined( __arm__ )
|
||||
return false;
|
||||
#elif defined( _X360 )
|
||||
// not entirtely sure about the semantic of HT support, it being an intel name
|
||||
// are we asking about HW threads or HT?
|
||||
return true;
|
||||
|
||||
+3
-6
@@ -17,9 +17,6 @@
|
||||
#include <tier0/platform.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define rdtsc(x) \
|
||||
__asm__ __volatile__ ("rdtsc" : "=A" (x))
|
||||
|
||||
class TimeVal
|
||||
{
|
||||
public:
|
||||
@@ -142,11 +139,11 @@ uint64 CalculateCPUFreq()
|
||||
uint64 start_tsc, end_tsc;
|
||||
|
||||
gettimeofday( &start_time.m_TimeVal, 0 );
|
||||
rdtsc( start_tsc );
|
||||
start_tsc = Plat_Rdtsc();
|
||||
usleep( 5000 ); // sleep for 5 msec
|
||||
gettimeofday( &end_time.m_TimeVal, 0 );
|
||||
rdtsc( end_tsc );
|
||||
|
||||
end_tsc = Plat_Rdtsc();
|
||||
|
||||
// end_time - start_time calls into the overloaded TimeVal operator- way above, and returns a double.
|
||||
period3 = ( end_tsc - start_tsc ) / ( end_time - start_time );
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
#include <linux/stat.h>
|
||||
#endif
|
||||
|
||||
#include "tier0/memdbgon.h"
|
||||
// Benchmark mode uses this heavy-handed method
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <set>
|
||||
#endif
|
||||
|
||||
#if defined( LINUX )
|
||||
#if defined( LINUX ) && !defined( ANDROID )
|
||||
#include <execinfo.h>
|
||||
#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 )
|
||||
{
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
#elif defined(POSIX)
|
||||
|
||||
#if !defined(OSX)
|
||||
#ifndef ANDROID
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/unistd.h>
|
||||
#endif
|
||||
#define sem_unlink( arg )
|
||||
#define OS_TO_PTHREAD(x) (x)
|
||||
#else
|
||||
@@ -52,6 +54,10 @@ typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
|
||||
typedef void *LPVOID;
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
#include "tier0/valve_minmax_off.h"
|
||||
#include <memory>
|
||||
#include "tier0/valve_minmax_on.h"
|
||||
@@ -2034,6 +2040,8 @@ void CThread::Yield()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
::Sleep(0);
|
||||
#elif defined(ANDROID)
|
||||
sched_yield();
|
||||
#elif defined(POSIX)
|
||||
pthread_yield();
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ $Configuration
|
||||
// 360 will auto generate a def file for this import library
|
||||
$ModuleDefinitionFile " " [$X360]
|
||||
$AdditionalOptions "$BASE /AUTODEF:xbox\xbox.def" [$X360]
|
||||
$SystemLibraries "rt" [$LINUXALL]
|
||||
$SystemLibraries "rt" [$LINUXALL && !$ANDROID]
|
||||
}
|
||||
|
||||
$PreLinkEvent [$WINDOWS]
|
||||
|
||||
Reference in New Issue
Block a user