diff --git a/engine/cmodel.cpp b/engine/cmodel.cpp index 9eb72eb7..357eb96a 100644 --- a/engine/cmodel.cpp +++ b/engine/cmodel.cpp @@ -873,9 +873,9 @@ bool IntersectRayWithBoxBrush( TraceInfo_t *pTraceInfo, const cbrush_t *pBrush, FPExceptionDisabler hideExceptions; // Load the unaligned ray/box parameters into SIMD registers - fltx4 start = LoadUnaligned3SIMD(pTraceInfo->m_start.Base()); - fltx4 extents = LoadUnaligned3SIMD(pTraceInfo->m_extents.Base()); - fltx4 delta = LoadUnaligned3SIMD(pTraceInfo->m_delta.Base()); + fltx4 start = LoadAlignedSIMD(pTraceInfo->m_start.Base()); + fltx4 extents = LoadAlignedSIMD(pTraceInfo->m_extents.Base()); + fltx4 delta = LoadAlignedSIMD(pTraceInfo->m_delta.Base()); fltx4 boxMins = LoadAlignedSIMD( pBox->mins.Base() ); fltx4 boxMaxs = LoadAlignedSIMD( pBox->maxs.Base() ); @@ -899,7 +899,7 @@ bool IntersectRayWithBoxBrush( TraceInfo_t *pTraceInfo, const cbrush_t *pBrush, fltx4 crossPlane = OrSIMD(XorSIMD(startOutMins,endOutMins), XorSIMD(startOutMaxs,endOutMaxs)); // now build the per-axis interval of t for intersections - fltx4 invDelta = LoadUnaligned3SIMD(pTraceInfo->m_invDelta.Base()); + fltx4 invDelta = LoadAlignedSIMD(pTraceInfo->m_invDelta.Base()); fltx4 tmins = MulSIMD( offsetMinsExpanded, invDelta ); fltx4 tmaxs = MulSIMD( offsetMaxsExpanded, invDelta ); // now sort the interval per axis @@ -1037,9 +1037,9 @@ bool IntersectRayWithBox( const Ray_t &ray, const VectorAligned &inInvDelta, con pTrace->fraction = 1.0f; // Load the unaligned ray/box parameters into SIMD registers - fltx4 start = LoadUnaligned3SIMD(ray.m_Start.Base()); - fltx4 extents = LoadUnaligned3SIMD(ray.m_Extents.Base()); - fltx4 delta = LoadUnaligned3SIMD(ray.m_Delta.Base()); + fltx4 start = LoadAlignedSIMD(ray.m_Start.Base()); + fltx4 extents = LoadAlignedSIMD(ray.m_Extents.Base()); + fltx4 delta = LoadAlignedSIMD(ray.m_Delta.Base()); fltx4 boxMins = LoadAlignedSIMD( inBoxMins.Base() ); fltx4 boxMaxs = LoadAlignedSIMD( inBoxMaxs.Base() ); @@ -1372,9 +1372,9 @@ void FASTCALL CM_ClipBoxToBrush( TraceInfo_t * RESTRICT pTraceInfo, const cbrush inline bool IsTraceBoxIntersectingBoxBrush( TraceInfo_t *pTraceInfo, cboxbrush_t *pBox ) { - fltx4 start = LoadUnaligned3SIMD(pTraceInfo->m_start.Base()); - fltx4 mins = LoadUnaligned3SIMD(pTraceInfo->m_mins.Base()); - fltx4 maxs = LoadUnaligned3SIMD(pTraceInfo->m_maxs.Base()); + fltx4 start = LoadAlignedSIMD(pTraceInfo->m_start.Base()); + fltx4 mins = LoadAlignedSIMD(pTraceInfo->m_mins.Base()); + fltx4 maxs = LoadAlignedSIMD(pTraceInfo->m_maxs.Base()); fltx4 boxMins = LoadAlignedSIMD( pBox->mins.Base() ); fltx4 boxMaxs = LoadAlignedSIMD( pBox->maxs.Base() ); @@ -1569,15 +1569,15 @@ void FASTCALL CM_TraceToLeaf( TraceInfo_t * RESTRICT pTraceInfo, int ndxLeaf, fl if (IsX360()) { // set up some relatively constant variables we'll use in the loop below - fltx4 traceStart = LoadUnaligned3SIMD(pTraceInfo->m_start.Base()); - fltx4 traceDelta = LoadUnaligned3SIMD(pTraceInfo->m_delta.Base()); - fltx4 traceInvDelta = LoadUnaligned3SIMD(pTraceInfo->m_invDelta.Base()); + fltx4 traceStart = LoadAlignedSIMD(pTraceInfo->m_start.Base()); + fltx4 traceDelta = LoadAlignedSIMD(pTraceInfo->m_delta.Base()); + fltx4 traceInvDelta = LoadAlignedSIMD(pTraceInfo->m_invDelta.Base()); static const fltx4 vecEpsilon = FLTX4(DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON); // only used in !IS_POINT version: fltx4 extents; if (!IS_POINT) { - extents = LoadUnaligned3SIMD(pTraceInfo->m_extents.Base()); + extents = LoadAlignedSIMD(pTraceInfo->m_extents.Base()); } // TODO: this loop probably ought to be unrolled so that we can make a more efficient diff --git a/engine/cmodel_private.h b/engine/cmodel_private.h index 3f712a37..5bf52eee 100644 --- a/engine/cmodel_private.h +++ b/engine/cmodel_private.h @@ -42,13 +42,13 @@ struct TraceInfo_t m_nCheckDepth = -1; } - Vector m_start; - Vector m_end; - Vector m_mins; - Vector m_maxs; - Vector m_extents; - Vector m_delta; - Vector m_invDelta; + VectorAligned m_start; + VectorAligned m_end; + VectorAligned m_mins; + VectorAligned m_maxs; + VectorAligned m_extents; + VectorAligned m_delta; + VectorAligned m_invDelta; trace_t m_trace; trace_t m_stabTrace; diff --git a/engine/gl_rsurf.cpp b/engine/gl_rsurf.cpp index 5731704c..de87c60b 100644 --- a/engine/gl_rsurf.cpp +++ b/engine/gl_rsurf.cpp @@ -4934,7 +4934,7 @@ static bool EnumerateLeafInBox_R(mnode_t * RESTRICT node, const EnumLeafBoxInfo_ */ // take advantage of high throughput/high latency - fltx4 planeNormal = LoadUnaligned3SIMD( plane->normal.Base() ); + fltx4 planeNormal = LoadAlignedSIMD( plane->normal.Base() ); fltx4 vecBoxMin = LoadAlignedSIMD(pInfo->m_vecBoxMin); fltx4 vecBoxMax = LoadAlignedSIMD(pInfo->m_vecBoxMax); fltx4 cornermin, cornermax; diff --git a/engine/spatialpartition.cpp b/engine/spatialpartition.cpp index aaeeb62d..4c2047cc 100644 --- a/engine/spatialpartition.cpp +++ b/engine/spatialpartition.cpp @@ -987,7 +987,7 @@ private: int m_iTree; }; - +/* class CIntersectPoint : public CPartitionVisitor { public: @@ -1009,7 +1009,7 @@ public: private: fltx4 m_f4Point; }; - +*/ class CIntersectBox : public CPartitionVisitor { @@ -1040,8 +1040,8 @@ class CIntersectRay : public CPartitionVisitor public: CIntersectRay( CVoxelTree *pPartition, const Ray_t &ray, const Vector &vecInvDelta ) : CPartitionVisitor( pPartition ) { - m_f4Start = LoadUnaligned3SIMD( ray.m_Start.Base() ); - m_f4Delta = LoadUnaligned3SIMD( ray.m_Delta.Base() ); + m_f4Start = LoadAlignedSIMD( ray.m_Start.Base() ); + m_f4Delta = LoadAlignedSIMD( ray.m_Delta.Base() ); m_f4InvDelta = LoadUnaligned3SIMD( vecInvDelta.Base() ); } @@ -1069,10 +1069,10 @@ class CIntersectSweptBox : public CPartitionVisitor public: CIntersectSweptBox( CVoxelTree *pPartition, const Ray_t &ray, const Vector &vecInvDelta ) : CPartitionVisitor( pPartition ) { - m_f4Start = LoadUnaligned3SIMD( ray.m_Start.Base() ); - m_f4Delta = LoadUnaligned3SIMD( ray.m_Delta.Base() ); + m_f4Start = LoadAlignedSIMD( ray.m_Start.Base() ); + m_f4Delta = LoadAlignedSIMD( ray.m_Delta.Base() ); + m_f4Extents = LoadAlignedSIMD( ray.m_Extents.Base() ); m_f4InvDelta = LoadUnaligned3SIMD( vecInvDelta.Base() ); - m_f4Extents = LoadUnaligned3SIMD( ray.m_Extents.Base() ); } bool Intersects( const float *pMins, const float *pMaxs ) const diff --git a/filesystem/filesystem_stdio.cpp b/filesystem/filesystem_stdio.cpp index 29caa925..5a8391ff 100644 --- a/filesystem/filesystem_stdio.cpp +++ b/filesystem/filesystem_stdio.cpp @@ -696,6 +696,7 @@ int CFileSystem_Stdio::FS_stat( const char *pathT, struct _stat *buf, bool *pbLo int rt = _stat( path, buf ); // Workaround bug wherein stat() randomly fails on Windows XP. See comment on function. +/* #if defined(_WIN32) && defined(FILESYSTEM_MSVC2015_STAT_BUG_WORKAROUND) if ( rt == -1 ) { @@ -706,6 +707,7 @@ int CFileSystem_Stdio::FS_stat( const char *pathT, struct _stat *buf, bool *pbLo } } #endif // defined(_WIN32) && defined(FILESYSTEM_MSVC2015_STAT_BUG_WORKAROUND) +*/ #if defined(LINUX) || defined(PLATFORM_BSD) if ( rt == -1 ) diff --git a/game/shared/multiplay_gamerules.cpp b/game/shared/multiplay_gamerules.cpp index abecba9e..c380aac7 100644 --- a/game/shared/multiplay_gamerules.cpp +++ b/game/shared/multiplay_gamerules.cpp @@ -1151,12 +1151,14 @@ ConVarRef suitcharger( "sk_suitcharger" ); void StripChar(char *szBuffer, const char cWhiteSpace ) { + char *src, *dst; - while ( char *pSpace = strchr( szBuffer, cWhiteSpace ) ) + for (src = dst = szBuffer; *src != '\0'; src++) { - char *pNextChar = pSpace + sizeof(char); - V_strcpy( pSpace, pNextChar ); + *dst = *src; + if (*dst != cWhiteSpace) dst++; } + *dst = '\0'; } void CMultiplayRules::GetNextLevelName( char *pszNextMap, int bufsize, bool bRandom /* = false */ ) diff --git a/public/mathlib/mathlib.h b/public/mathlib/mathlib.h index aeb4aede..38600f11 100644 --- a/public/mathlib/mathlib.h +++ b/public/mathlib/mathlib.h @@ -114,7 +114,7 @@ inline T clamp( T const &val, T const &minVal, T const &maxVal ) // FIXME: this should move to a different file struct cplane_t { - Vector normal; + VectorAligned normal; float dist; byte type; // for fast side tests byte signbits; // signx + (signy<<1) + (signz<<1) diff --git a/public/vtf/vtf.h b/public/vtf/vtf.h index 6cb2e79e..436468fe 100644 --- a/public/vtf/vtf.h +++ b/public/vtf/vtf.h @@ -471,14 +471,11 @@ struct VTFFileHeaderV7_1_t : public VTFFileBaseHeader_t unsigned int flags; unsigned short numFrames; unsigned short startFrame; -#if !defined( POSIX ) && !defined( _X360 ) - VectorAligned reflectivity; -#else + // must manually align in order to maintain pack(1) expected layout with existing binaries - char pad1[4]; - Vector reflectivity; - char pad2[4]; -#endif + char pad1[4]; + VectorAligned reflectivity; + float bumpScale; ImageFormat imageFormat; unsigned char numMipLevels; diff --git a/scripts/waifulib/vpc_parser.py b/scripts/waifulib/vpc_parser.py index b5ebca1c..b0b3eee5 100644 --- a/scripts/waifulib/vpc_parser.py +++ b/scripts/waifulib/vpc_parser.py @@ -90,6 +90,9 @@ def fix_dos_path( path ): if find_path == '': find_path = './' else: find_path += '/' + if not os.path.exists(find_path): + return find_path+filename + dirlist = os.listdir(find_path) for file in dirlist: if file == filename: diff --git a/stub_steam/steam_api.cpp b/stub_steam/steam_api.cpp new file mode 100644 index 00000000..d658d741 --- /dev/null +++ b/stub_steam/steam_api.cpp @@ -0,0 +1,185 @@ +#define _CRT_SECURE_NO_WARNINGS +#define STEAM_API_EXPORTS + +#if defined __GNUC__ + #define S_API extern "C" __attribute__ ((visibility("default"))) +#elif defined _MSC_VER +#define S_API extern "C" __declspec(dllexport) +#endif +#define NULL 0 + +S_API void *g_pSteamClientGameServer; +void *g_pSteamClientGameServer = NULL; + +//steam_api.h +S_API bool SteamAPI_Init() { + return true; +} + +S_API bool SteamAPI_InitSafe() { + return true; +} + +S_API void SteamAPI_Shutdown() { + +} + +S_API bool SteamAPI_RestartAppIfNecessary() { + return false; +} + +S_API void SteamAPI_ReleaseCurrentThreadMemory() { + +} + +S_API void SteamAPI_WriteMiniDump() { + +} + +S_API void SteamAPI_SetMiniDumpComment() { + +} + +S_API void SteamAPI_RunCallbacks() { +} + +S_API void SteamAPI_RegisterCallback() { + +} + +S_API void SteamAPI_UnregisterCallback() { + +} + +S_API void SteamAPI_RegisterCallResult() { + +} + +S_API void SteamAPI_UnregisterCallResult() { + +} + +S_API bool SteamAPI_IsSteamRunning() { + return false; +} + +S_API void Steam_RunCallbacks() { + +} + +S_API void Steam_RegisterInterfaceFuncs() { +} + +S_API int Steam_GetHSteamUserCurrent() { + return 0; +} + +S_API const char *SteamAPI_GetSteamInstallPath() { + return NULL; +} + +S_API int SteamAPI_GetHSteamPipe() { + return 0; +} + +S_API void SteamAPI_SetTryCatchCallbacks() { + +} + +S_API void SteamAPI_SetBreakpadAppID() { + +} + +S_API void SteamAPI_UseBreakpadCrashHandler() { + +} + +S_API int GetHSteamPipe() { + return 0; +} + +S_API int GetHSteamUser() { + return 0; +} + +S_API int SteamAPI_GetHSteamUser() { + return 0; +} + +S_API void *SteamInternal_ContextInit() { + return NULL; +} + +S_API void *SteamInternal_CreateInterface() { + return NULL; +} + +S_API void *SteamApps() { + return NULL; +} + +S_API void *SteamClient() { + return NULL; +} + +S_API void *SteamFriends() { + return NULL; +} + +S_API void *SteamHTTP() { + return NULL; +} + +S_API void *SteamMatchmaking() { + return NULL; +} + +S_API void *SteamMatchmakingServers() { + return NULL; +} + +S_API void *SteamNetworking() { + return NULL; +} + +S_API void *SteamRemoteStorage() { + return NULL; +} + +S_API void *SteamScreenshots() { + return NULL; +} + +S_API void *SteamUser() { + return NULL; +} + +S_API void *SteamUserStats() { + return NULL; +} + +S_API void *SteamUtils() { + return NULL; +} + +S_API int SteamGameServer_GetHSteamPipe() { + return 0; +} + +S_API int SteamGameServer_GetHSteamUser() { + return 0; +} + +S_API int SteamGameServer_GetIPCCallCount() { + return 0; +} + +S_API int SteamGameServer_InitSafe() { + return 0; +} + +S_API void SteamGameServer_RunCallbacks() { +} + +S_API void SteamGameServer_Shutdown() { +} diff --git a/stub_steam/wscript b/stub_steam/wscript new file mode 100755 index 00000000..a11b2df7 --- /dev/null +++ b/stub_steam/wscript @@ -0,0 +1,46 @@ +#! /usr/bin/env python +# encoding: utf-8 + +from waflib import Utils +import os + +top = '.' +PROJECT_NAME = 'steam_api' + +def options(opt): + # stub + return + +def configure(conf): + return + +def build(bld): + source = [ + 'steam_api.cpp' + ] + + includes = [ + '.', + '../public', + '../public/tier0', + ] + bld.env.INCLUDES_SDL2 + + defines = [] + + libs = [] + + install_path = None if bld.env.BUILD_SDK else bld.env.LIBDIR + + bld.shlib( + source = source, + target = PROJECT_NAME, + name = PROJECT_NAME, + features = 'c cxx', + includes = includes, + defines = defines, + install_path = install_path, + use = libs, + subsystem = bld.env.MSVC_SUBSYSTEM, + idx = bld.get_taskgen_count() + ) + diff --git a/thirdparty b/thirdparty index aac07c72..c5b901ec 160000 --- a/thirdparty +++ b/thirdparty @@ -1 +1 @@ -Subproject commit aac07c72058aea6267ea60b70a25602b41469d28 +Subproject commit c5b901ecef515ea068fa8b8a19ca5cd5353905cb diff --git a/tier0/wscript b/tier0/wscript index f376af51..82ca624b 100755 --- a/tier0/wscript +++ b/tier0/wscript @@ -86,7 +86,7 @@ def build(bld): else: libs = ['DL', 'M', 'LOG'] - install_path = bld.env.LIBDIR + install_path = None if bld.env.BUILD_SDK else bld.env.LIBDIR bld.shlib( source = source, diff --git a/vstdlib/osversion.cpp b/vstdlib/osversion.cpp deleted file mode 100644 index 6ed8e1f0..00000000 --- a/vstdlib/osversion.cpp +++ /dev/null @@ -1,427 +0,0 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -// $NoKeywords: $ -// -//=============================================================================// - -#include "vstdlib/osversion.h" -#include "winlite.h" -#include "strtools.h" -#include "tier0/dbg.h" - -#ifdef OSX -#include -#endif - -//----------------------------------------------------------------------------- -// Purpose: return the OS type for this machine -//----------------------------------------------------------------------------- -EOSType GetOSType() -{ - static EOSType eOSVersion = k_eOSUnknown; - -#if defined( _WIN32 ) && !defined( _X360 ) - if ( eOSVersion == k_eOSUnknown || eOSVersion == k_eWinUnknown ) - { - eOSVersion = k_eWinUnknown; - OSVERSIONINFOEX osvi; - Q_memset( &osvi, 0x00, sizeof(osvi) ); - osvi.dwOSVersionInfoSize = sizeof(osvi); - - if ( GetVersionEx( (OSVERSIONINFO *) &osvi ) ) - { - switch ( osvi.dwPlatformId ) - { - case VER_PLATFORM_WIN32_NT: - if ( osvi.dwMajorVersion <= 4 ) - { - eOSVersion = k_eWinNT; - } - else if ( osvi.dwMajorVersion == 5 ) - { - switch( osvi.dwMinorVersion ) - { - case 0: - eOSVersion = k_eWin2000; - break; - case 1: - eOSVersion = k_eWinXP; - break; - case 2: - eOSVersion = k_eWin2003; - break; - } - } - else if ( osvi.dwMajorVersion >= 6 ) - { - if ( osvi.wProductType == VER_NT_WORKSTATION ) - { - switch ( osvi.dwMinorVersion ) - { - case 0: - eOSVersion = k_eWinVista; - break; - case 1: - eOSVersion = k_eWindows7; - break; - } - } - else /* ( osvi.wProductType != VER_NT_WORKSTATION ) */ - { - switch ( osvi.dwMinorVersion ) - { - case 0: - eOSVersion = k_eWin2008; // Windows 2008, not R2 - break; - case 1: - eOSVersion = k_eWin2008; // Windows 2008 R2 - break; - } - } - } - break; - case VER_PLATFORM_WIN32_WINDOWS: - switch ( osvi.dwMinorVersion ) - { - case 0: - eOSVersion = k_eWin95; - break; - case 10: - eOSVersion = k_eWin98; - break; - case 90: - eOSVersion = k_eWinME; - break; - } - break; - case VER_PLATFORM_WIN32s: - eOSVersion = k_eWin311; - break; - } - } - } -#elif defined(OSX) - if ( eOSVersion == k_eOSUnknown ) - { - SInt32 MajorVer = 0; - SInt32 MinorVer = 0; - SInt32 PatchVer = 0; - OSErr err = noErr; - err = Gestalt( gestaltSystemVersionMajor, &MajorVer ); - if ( err != noErr ) - return k_eOSUnknown; - err = Gestalt( gestaltSystemVersionMinor, &MinorVer ); - if ( err != noErr ) - return k_eOSUnknown; - err = Gestalt( gestaltSystemVersionBugFix, &PatchVer ); - if ( err != noErr ) - return k_eOSUnknown; - - switch ( MajorVer ) - { - case 10: - { - switch( MinorVer ) - { - case 4: - eOSVersion = k_eMacOS104; - break; - case 5: - eOSVersion = k_eMacOS105; - switch ( PatchVer ) - { - case 8: - eOSVersion = k_eMacOS1058; - default: - break; - } - break; - case 6: - eOSVersion = k_eMacOS106; - switch ( PatchVer ) - { - case 1: - case 2: - break; - case 3: - default: - // note the default here - 10.6.4 (5,6...) >= 10.6.3, so we want to - // identify as 10.6.3 for sysreqs purposes - eOSVersion = k_eMacOS1063; - break; - } - break; - case 7: - eOSVersion = k_eMacOS107; - break; - default: - break; - } - } - default: - break; - } - } -#elif defined(LINUX) - if ( eOSVersion == k_eOSUnknown ) - { - - FILE *fpKernelVer = fopen( "/proc/version", "r" ); - - if ( !fpKernelVer ) - return k_eLinuxUnknown; - - char rgchVersionLine[1024]; - char *pchRet = fgets( rgchVersionLine, sizeof(rgchVersionLine), fpKernelVer ); - fclose( fpKernelVer ); - - eOSVersion = k_eLinuxUnknown; - - // move past "Linux version " - const char *pchVersion = rgchVersionLine + Q_strlen( "Linux version " ); - if ( pchRet && *pchVersion == '2' && *(pchVersion+1) == '.' ) - { - pchVersion += 2; // move past "2." - if ( *pchVersion == '2' && *(pchVersion+1) == '.' ) - eOSVersion = k_eLinux22; - else if ( *pchVersion == '4' && *(pchVersion+1) == '.' ) - eOSVersion = k_eLinux24; - else if ( *pchVersion == '6' && *(pchVersion+1) == '.' ) - eOSVersion = k_eLinux26; - } - } -#endif - return eOSVersion; -} - -//----------------------------------------------------------------------------- -// Purpose: get platform-specific OS details (distro, on linux) -// returns a pointer to the input buffer on success (for convenience), -// NULL on failure. -//----------------------------------------------------------------------------- -const char *GetOSDetailString( char *pchOutBuf, int cchOutBuf ) -{ -#if defined WIN32 - (void)( pchOutBuf ); - (void)( cchOutBuf ); - // no interesting details - return NULL; -#else -#if defined LINUX - // we're about to go poking around to see if we can figure out distribution - // looking @ any /etc file is fragile (people can change 'em), - // but since this is just hardware survey data, we're not super concerned. - // a bunch of OS-specific issue files - const char *pszIssueFile[] = - { - "/etc/redhat-release", - "/etc/fedora-release", - "/etc/slackware-release", - "/etc/debian_release", - "/etc/mandrake-release", - "/etc/yellowdog-release", - "/etc/gentoo-release", - "/etc/lsb-release", - "/etc/SUSE-release", - }; - if ( !pchOutBuf ) - return NULL; - - for (int i = 0; i < Q_ARRAYSIZE( pszIssueFile ); i++ ) - { - FILE *fdInfo = fopen( pszIssueFile[i], "r" ); - if ( !fdInfo ) - continue; - - // prepend the buffer with the name of the file we found for easier grouping - snprintf( pchOutBuf, cchOutBuf, "%s\n", pszIssueFile[i] ); - int cchIssueFile = strlen( pszIssueFile[i] ) + 1; - ssize_t cubRead = fread( (void*) (pchOutBuf + cchIssueFile) , sizeof(char), cchOutBuf - cchIssueFile, fdInfo ); - fclose( fdInfo ); - - if ( cubRead < 0 ) - return NULL; - - // null terminate - pchOutBuf[ MIN( cubRead, cchOutBuf-1 ) ] = '\0'; - return pchOutBuf; - } -#endif - // if all else fails, just send back uname -a - if ( !pchOutBuf ) - return NULL; - FILE *fpUname = popen( "uname -mrsv", "r" ); - if ( !fpUname ) - return NULL; - size_t cchRead = fread( pchOutBuf, sizeof(char), cchOutBuf, fpUname ); - pclose( fpUname ); - - pchOutBuf[ MIN( cchRead, (size_t)cchOutBuf-1 ) ] = '\0'; - return pchOutBuf; -#endif -} - - -//----------------------------------------------------------------------------- -// Purpose: get a friendly name for an OS type -//----------------------------------------------------------------------------- -const char *GetNameFromOSType( EOSType eOSType ) -{ - switch ( eOSType ) - { - case k_eWinUnknown: - return "Windows"; - case k_eWin311: - return "Windows 3.11"; - case k_eWin95: - return "Windows 95"; - case k_eWin98: - return "Windows 98"; - case k_eWinME: - return "Windows ME"; - case k_eWinNT: - return "Windows NT"; - case k_eWin2000: - return "Windows 2000"; - case k_eWinXP: - return "Windows XP"; - case k_eWin2003: - return "Windows 2003"; - case k_eWinVista: - return "Windows Vista"; - case k_eWindows7: - return "Windows 7"; - case k_eWin2008: - return "Windows 2008"; -#ifdef POSIX - case k_eMacOSUnknown: - return "Mac OS"; - case k_eMacOS104: - return "MacOS 10.4"; - case k_eMacOS105: - return "MacOS 10.5"; - case k_eMacOS1058: - return "MacOS 10.5.8"; - case k_eMacOS106: - return "MacOS 10.6"; - case k_eMacOS1063: - return "MacOS 10.6.3"; - case k_eMacOS107: - return "MacOS 10.7"; - case k_eLinuxUnknown: - return "Linux"; - case k_eLinux22: - return "Linux 2.2"; - case k_eLinux24: - return "Linux 2.4"; - case k_eLinux26: - return "Linux 2.6"; -#endif - default: - case k_eOSUnknown: - return "Unknown"; - } -} - - -// friendly name to OS type, MUST be same size as EOSType enum -struct OSTypeNameTuple -{ - EOSType m_OSType; - const char *m_pchOSName; - -}; - -const OSTypeNameTuple k_rgOSTypeToName[] = -{ - { k_eOSUnknown, "unknown" }, - { k_eMacOSUnknown, "macos" }, - { k_eMacOS104, "macos104" }, - { k_eMacOS105, "macos105" }, - { k_eMacOS1058, "macos1058" }, - { k_eMacOS106, "macos106" }, - { k_eMacOS1063, "macos1063" }, - { k_eMacOS107, "macos107" }, - { k_eLinuxUnknown, "linux" }, - { k_eLinux22, "linux22" }, - { k_eLinux24, "linux24" }, - { k_eLinux26, "linux26" }, - { k_eWinUnknown, "windows" }, - { k_eWin311, "win311" }, - { k_eWin95, "win95" }, - { k_eWin98, "win98" }, - { k_eWinME, "winME" }, - { k_eWinNT, "winNT" }, - { k_eWin2000, "win200" }, - { k_eWinXP, "winXP" }, - { k_eWin2003, "win2003" }, - { k_eWinVista, "winVista" }, - { k_eWindows7, "win7" }, - { k_eWin2008, "win2008" }, -}; - -//----------------------------------------------------------------------------- -// Purpose: convert a friendly OS name to a eostype -//----------------------------------------------------------------------------- -EOSType GetOSTypeFromString_Deprecated( const char *pchName ) -{ - EOSType eOSType; -#ifdef WIN32 - eOSType = k_eWinUnknown; -#else - eOSType = k_eOSUnknown; -#endif - - // if this fires, make sure all OS types are in the map - Assert( Q_ARRAYSIZE( k_rgOSTypeToName ) == k_eOSTypeMax ); - if ( !pchName || Q_strlen( pchName ) == 0 ) - return eOSType; - - for ( int iOS = 0; iOS < Q_ARRAYSIZE( k_rgOSTypeToName ) ; iOS++ ) - { - if ( !Q_stricmp( k_rgOSTypeToName[iOS].m_pchOSName, pchName ) ) - return k_rgOSTypeToName[iOS].m_OSType; - } - return eOSType; -} - -bool OSTypesAreCompatible( EOSType eOSTypeDetected, EOSType eOSTypeRequired ) -{ - // check windows (on the positive side of the number line) - if ( eOSTypeRequired >= k_eWinUnknown ) - return ( eOSTypeDetected >= eOSTypeRequired ); - - if ( eOSTypeRequired == k_eOSUnknown ) - return true; - - // osx - if ( eOSTypeRequired >= k_eMacOSUnknown && eOSTypeRequired < k_eOSUnknown ) - return ( eOSTypeDetected >= eOSTypeRequired && eOSTypeDetected < k_eOSUnknown ); - - // and linux - if ( eOSTypeRequired >= k_eLinuxUnknown && eOSTypeRequired < k_eMacOSUnknown ) - return ( eOSTypeDetected >= eOSTypeRequired && eOSTypeDetected < k_eMacOSUnknown ); - - return false; -} - -// these strings "windows", "macos", "linux" are part of the -// interface, which is why they're hard-coded here, rather than using -// the strings in k_rgOSTypeToName -const char *GetPlatformName( bool *pbIs64Bit ) -{ - if ( pbIs64Bit ) - *pbIs64Bit = Is64BitOS(); - - EOSType eType = GetOSType(); - if ( OSTypesAreCompatible( eType, k_eWinUnknown ) ) - return "windows"; - if ( OSTypesAreCompatible( eType, k_eMacOSUnknown ) ) - return "macos"; - if ( OSTypesAreCompatible( eType, k_eLinuxUnknown ) ) - return "linux"; - return "unknown"; -} - diff --git a/vstdlib/wscript b/vstdlib/wscript index f989fa18..102e643f 100755 --- a/vstdlib/wscript +++ b/vstdlib/wscript @@ -21,7 +21,6 @@ def build(bld): 'cvar.cpp', 'jobthread.cpp', 'KeyValuesSystem.cpp', - 'osversion.cpp', 'random.cpp', 'vcover.cpp', '../public/tier0/memoverride.cpp' @@ -55,7 +54,7 @@ def build(bld): elif bld.env.DEST_OS == 'darwin': linkflags += ['-framework', 'CoreServices'] - install_path = bld.env.LIBDIR + install_path = None if bld.env.BUILD_SDK else bld.env.LIBDIR bld.shlib( source = source, diff --git a/wscript b/wscript index 171cccce..3eb22d6d 100644 --- a/wscript +++ b/wscript @@ -62,7 +62,7 @@ projects={ 'serverbrowser', 'soundemittersystem', 'studiorender', - 'thirdparty/StubSteamAPI', + 'stub_steam', 'tier0', 'tier1', 'tier2', @@ -130,7 +130,7 @@ projects={ 'vpklib', 'vstdlib', 'vtf', - 'thirdparty/StubSteamAPI' + 'stub_steam' ] }