mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-22 14:16:50 +00:00
BSD: Add support (#140)
* BSD: Add support * BSD: other fixes There is still a bug when vgui haven't got text, maybe because of resources. Also there is bug where when trying to start new game caption names shows wrong. * BSD: Debugging * BSD: modify preprocessor and fix windows * BSD: Remove debugging and fix labels in gameui * BSD: Remove disabling some DX9 commands * BSD: Remove -g flag
This commit is contained in:
parent
807eaae850
commit
53bd92f7a8
2
.gitignore
vendored
2
.gitignore
vendored
@ -37,3 +37,5 @@ waf3*/
|
|||||||
.vscode/
|
.vscode/
|
||||||
.depproj/
|
.depproj/
|
||||||
source-engine.sln
|
source-engine.sln
|
||||||
|
hl2/
|
||||||
|
|
||||||
|
@ -631,8 +631,8 @@ void GLMDisplayInfo::Dump( int which )
|
|||||||
{
|
{
|
||||||
SDLAPP_FUNC;
|
SDLAPP_FUNC;
|
||||||
|
|
||||||
GLMPRINTF(("\n #%d: GLMDisplayInfo @ %08x, pixwidth=%d pixheight=%d",
|
GLMPRINTF(("\n #%d: GLMDisplayInfo @ %p, pixwidth=%d pixheight=%d",
|
||||||
which, (int)this, m_info.m_displayPixelWidth, m_info.m_displayPixelHeight ));
|
which, this, m_info.m_displayPixelWidth, m_info.m_displayPixelHeight ));
|
||||||
|
|
||||||
FOR_EACH_VEC( *m_modes, i )
|
FOR_EACH_VEC( *m_modes, i )
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ public:
|
|||||||
|
|
||||||
// Get the next N events. The function returns the number of events that were filled into your array.
|
// Get the next N events. The function returns the number of events that were filled into your array.
|
||||||
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false );
|
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false );
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(BSD)
|
||||||
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent = false );
|
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent = false );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1004,7 +1004,7 @@ int CSDLMgr::GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debug
|
|||||||
return nToWrite;
|
return nToWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(BSD)
|
||||||
|
|
||||||
int CSDLMgr::PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent )
|
int CSDLMgr::PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent )
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#elif defined(OSX)
|
#elif defined(OSX) || defined(BSD)
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#else
|
#else
|
||||||
#include <bits/wordsize.h>
|
#include <bits/wordsize.h>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "vguifont.h"
|
#include "vguifont.h"
|
||||||
|
|
||||||
#if defined(LINUX) || defined(OSX)
|
#ifdef POSIX
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
typedef void *(*FontDataHelper)( const char *pchFontName, int &size, const char *fontFileName );
|
typedef void *(*FontDataHelper)( const char *pchFontName, int &size, const char *fontFileName );
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
IFileSystem *FileSystem() { return m_pFileSystem; }
|
IFileSystem *FileSystem() { return m_pFileSystem; }
|
||||||
IMaterialSystem *MaterialSystem() { return m_pMaterialSystem; }
|
IMaterialSystem *MaterialSystem() { return m_pMaterialSystem; }
|
||||||
|
|
||||||
#if defined(LINUX) || defined(OSX)
|
#ifdef POSIX
|
||||||
FT_Library GetFontLibraryHandle() { return library; }
|
FT_Library GetFontLibraryHandle() { return library; }
|
||||||
void SetFontDataHelper( FontDataHelper helper ) { m_pFontDataHelper = helper; }
|
void SetFontDataHelper( FontDataHelper helper ) { m_pFontDataHelper = helper; }
|
||||||
#endif
|
#endif
|
||||||
@ -96,7 +96,7 @@ private:
|
|||||||
CUtlVector<CFontAmalgam> m_FontAmalgams;
|
CUtlVector<CFontAmalgam> m_FontAmalgams;
|
||||||
CUtlVector<font_t *> m_Win32Fonts;
|
CUtlVector<font_t *> m_Win32Fonts;
|
||||||
|
|
||||||
#if defined(LINUX) || defined(OSX)
|
#ifdef POSIX
|
||||||
FT_Library library;
|
FT_Library library;
|
||||||
FontDataHelper m_pFontDataHelper;
|
FontDataHelper m_pFontDataHelper;
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,7 +23,7 @@ struct newChar_t
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "Win32Font.h"
|
#include "Win32Font.h"
|
||||||
typedef CWin32Font font_t;
|
typedef CWin32Font font_t;
|
||||||
#elif defined(LINUX) || defined(OSX)
|
#elif defined(POSIX)
|
||||||
#include "linuxfont.h"
|
#include "linuxfont.h"
|
||||||
typedef CLinuxFont font_t;
|
typedef CLinuxFont font_t;
|
||||||
#else
|
#else
|
||||||
@ -31,4 +31,4 @@ typedef CLinuxFont font_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif //VGUIFONT_H
|
#endif //VGUIFONT_H
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
#include <copyfile.h>
|
#include <copyfile.h>
|
||||||
#import <mach/mach_host.h>
|
#import <mach/mach_host.h>
|
||||||
#import <sys/sysctl.h>
|
#import <sys/sysctl.h>
|
||||||
|
#elif defined(BSD)
|
||||||
|
# include <sys/sysctl.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <fcntl.h>
|
||||||
|
# define HW_MEMSIZE HW_PHYSMEM
|
||||||
#elif defined(LINUX)
|
#elif defined(LINUX)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -105,7 +110,7 @@
|
|||||||
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
|
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
|
||||||
#elif defined(OSX)
|
#elif defined(OSX)
|
||||||
#define BUG_REPOSITORY_URL "/Volumes/bugs"
|
#define BUG_REPOSITORY_URL "/Volumes/bugs"
|
||||||
#elif defined(LINUX)
|
#elif defined(LINUX) || defined(BSD)
|
||||||
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
|
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
|
||||||
#else
|
#else
|
||||||
//#error
|
//#error
|
||||||
@ -139,7 +144,7 @@ unsigned long GetRam()
|
|||||||
MEMORYSTATUS stat;
|
MEMORYSTATUS stat;
|
||||||
GlobalMemoryStatus( &stat );
|
GlobalMemoryStatus( &stat );
|
||||||
return (stat.dwTotalPhys / (1024 * 1024));
|
return (stat.dwTotalPhys / (1024 * 1024));
|
||||||
#elif defined(OSX)
|
#elif defined(OSX) || defined(BSD)
|
||||||
int mib[2] = { CTL_HW, HW_MEMSIZE };
|
int mib[2] = { CTL_HW, HW_MEMSIZE };
|
||||||
u_int namelen = sizeof(mib) / sizeof(mib[0]);
|
u_int namelen = sizeof(mib) / sizeof(mib[0]);
|
||||||
uint64_t memsize;
|
uint64_t memsize;
|
||||||
@ -340,6 +345,12 @@ void DisplaySystemVersion( char *osversion, int maxlen )
|
|||||||
|
|
||||||
fclose( fpKernelVer );
|
fclose( fpKernelVer );
|
||||||
}
|
}
|
||||||
|
#elif BSD
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
osversion = (char *)"FreeBSD";
|
||||||
|
#else
|
||||||
|
osversion = (char *)"*BSD";
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2246,7 +2257,7 @@ void NonFileSystem_CreatePath (const char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(BSD)
|
||||||
#define COPYFILE_ALL 0
|
#define COPYFILE_ALL 0
|
||||||
#define BSIZE 65535
|
#define BSIZE 65535
|
||||||
int copyfile( const char *local, const char *remote, void *ignored, int ignoredFlags )
|
int copyfile( const char *local, const char *remote, void *ignored, int ignoredFlags )
|
||||||
|
@ -3947,7 +3947,7 @@ bool DLL_LOCAL Host_IsValidSignature( const char *pFilename, bool bAllowUnknown
|
|||||||
#if defined( SWDS ) || defined(_X360)
|
#if defined( SWDS ) || defined(_X360)
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
if ( sv.IsDedicated() || IsOSX() || IsLinux() )
|
if ( sv.IsDedicated() || IsOSX() || IsLinux() || IsBSD() )
|
||||||
{
|
{
|
||||||
// dedicated servers and Mac and Linux binaries don't check signatures
|
// dedicated servers and Mac and Linux binaries don't check signatures
|
||||||
return true;
|
return true;
|
||||||
|
@ -2714,6 +2714,14 @@ bool CGameServer::SpawnServer( const char *szMapName, const char *szMapFile, con
|
|||||||
event->SetString( "os", "LINUX" );
|
event->SetString( "os", "LINUX" );
|
||||||
#elif defined ( OSX )
|
#elif defined ( OSX )
|
||||||
event->SetString( "os", "OSX" );
|
event->SetString( "os", "OSX" );
|
||||||
|
#elif defined(BSD)
|
||||||
|
event->SetString("os",
|
||||||
|
# ifdef __FreeBSD__
|
||||||
|
"FreeBSD"
|
||||||
|
# else
|
||||||
|
"BSD"
|
||||||
|
# endif
|
||||||
|
);
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,9 +21,10 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
//$ #include <uuid/uuid.h>
|
//$ #include <uuid/uuid.h>
|
||||||
typedef unsigned char uuid_t[16];
|
|
||||||
#ifdef OSX
|
#ifdef OSX
|
||||||
#include <uuid/uuid.h>
|
#include <uuid/uuid.h>
|
||||||
|
#elif defined(BSD)
|
||||||
|
#include <uuid.h>
|
||||||
#else
|
#else
|
||||||
typedef unsigned char uuid_t[16];
|
typedef unsigned char uuid_t[16];
|
||||||
#endif
|
#endif
|
||||||
@ -397,6 +398,9 @@ public:
|
|||||||
uuid_t newId;
|
uuid_t newId;
|
||||||
#ifdef OSX
|
#ifdef OSX
|
||||||
uuid_generate( newId );
|
uuid_generate( newId );
|
||||||
|
#elif defined(BSD)
|
||||||
|
uint32_t status;
|
||||||
|
uuid_create( &newId, &status );
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
#elif defined(OSX)
|
#elif defined(OSX)
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
#elif defined(BSD)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#define HW_MEMSIZE HW_PHYSMEM
|
||||||
#endif
|
#endif
|
||||||
#if defined(LINUX)
|
#if defined(LINUX)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -456,21 +460,14 @@ void Sys_Error_Internal( bool bMinidump, const char *error, va_list argsList )
|
|||||||
|
|
||||||
// We always get here because the above filter evaluates to EXCEPTION_EXECUTE_HANDLER
|
// We always get here because the above filter evaluates to EXCEPTION_EXECUTE_HANDLER
|
||||||
}
|
}
|
||||||
#elif defined( OSX )
|
#elif defined(POSIX)
|
||||||
// Doing this doesn't quite work the way we want because there is no "crashing" thread
|
// Doing this doesn't quite work the way we want because there is no "crashing" thread
|
||||||
// and we see "No thread was identified as the cause of the crash; No signature could be created because we do not know which thread crashed" on the back end
|
// and we see "No thread was identified as the cause of the crash; No signature could be created because we do not know which thread crashed" on the back end
|
||||||
//SteamAPI_WriteMiniDump( 0, NULL, build_number() );
|
//SteamAPI_WriteMiniDump( 0, NULL, build_number() );
|
||||||
printf("\n ##### Sys_Error: %s", text );
|
printf("\n ##### Sys_Error: %s", text );
|
||||||
fflush(stdout );
|
fflush(stdout );
|
||||||
|
|
||||||
int *p = 0;
|
raise(SIGTRAP);
|
||||||
*p = 0xdeadbeef;
|
|
||||||
#elif defined( LINUX )
|
|
||||||
// Doing this doesn't quite work the way we want because there is no "crashing" thread
|
|
||||||
// and we see "No thread was identified as the cause of the crash; No signature could be created because we do not know which thread crashed" on the back end
|
|
||||||
//SteamAPI_WriteMiniDump( 0, NULL, build_number() );
|
|
||||||
int *p = 0;
|
|
||||||
*p = 0xdeadbeef;
|
|
||||||
#else
|
#else
|
||||||
#warning "need minidump impl on sys_error"
|
#warning "need minidump impl on sys_error"
|
||||||
#endif
|
#endif
|
||||||
@ -671,7 +668,7 @@ void Sys_InitMemory( void )
|
|||||||
#elif defined(POSIX)
|
#elif defined(POSIX)
|
||||||
uint64_t memsize = ONE_HUNDRED_TWENTY_EIGHT_MB;
|
uint64_t memsize = ONE_HUNDRED_TWENTY_EIGHT_MB;
|
||||||
|
|
||||||
#if defined(OSX)
|
#if defined(OSX) || defined(BSD)
|
||||||
int mib[2] = { CTL_HW, HW_MEMSIZE };
|
int mib[2] = { CTL_HW, HW_MEMSIZE };
|
||||||
u_int namelen = sizeof(mib) / sizeof(mib[0]);
|
u_int namelen = sizeof(mib) / sizeof(mib[0]);
|
||||||
size_t len = sizeof(memsize);
|
size_t len = sizeof(memsize);
|
||||||
@ -1589,7 +1586,9 @@ CON_COMMAND( star_memory, "Dump memory stats" )
|
|||||||
struct mstats memstats = mstats( );
|
struct mstats memstats = mstats( );
|
||||||
Msg( "Available %.2f MB, Used: %.2f MB, #mallocs = %lu\n",
|
Msg( "Available %.2f MB, Used: %.2f MB, #mallocs = %lu\n",
|
||||||
memstats.bytes_free / ( 1024.0 * 1024.0), memstats.bytes_used / ( 1024.0 * 1024.0 ), memstats.chunks_used );
|
memstats.bytes_free / ( 1024.0 * 1024.0), memstats.bytes_used / ( 1024.0 * 1024.0 ), memstats.chunks_used );
|
||||||
#else
|
#elif BSD
|
||||||
|
# warning TODO: Implement memory stats (peace of sheet of course)
|
||||||
|
#else // Win32
|
||||||
MEMORYSTATUS stat;
|
MEMORYSTATUS stat;
|
||||||
GlobalMemoryStatus( &stat );
|
GlobalMemoryStatus( &stat );
|
||||||
Msg( "Available: %.2f MB, Used: %.2f MB, Free: %.2f MB\n",
|
Msg( "Available: %.2f MB, Used: %.2f MB, Free: %.2f MB\n",
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include <Psapi.h>
|
#include <Psapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( OSX )
|
#if defined( OSX ) || defined(BSD)
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ static void posix_signal_handler( int i )
|
|||||||
#define DO_TRY if ( sigsetjmp( g_mark, 1 ) == 0 )
|
#define DO_TRY if ( sigsetjmp( g_mark, 1 ) == 0 )
|
||||||
#define DO_CATCH else
|
#define DO_CATCH else
|
||||||
|
|
||||||
#if defined( OSX )
|
#if defined( OSX ) || defined(BSD)
|
||||||
#define __sighandler_t sig_t
|
#define __sighandler_t sig_t
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ public:
|
|||||||
FreeLibrary( hInst );
|
FreeLibrary( hInst );
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined( OSX )
|
#elif defined( OSX ) || defined(BSD)
|
||||||
|
|
||||||
static const struct
|
static const struct
|
||||||
{
|
{
|
||||||
@ -548,8 +548,13 @@ public:
|
|||||||
#define _XTAG( _x ) { _x, #_x }
|
#define _XTAG( _x ) { _x, #_x }
|
||||||
_XTAG( HW_PHYSMEM ),
|
_XTAG( HW_PHYSMEM ),
|
||||||
_XTAG( HW_USERMEM ),
|
_XTAG( HW_USERMEM ),
|
||||||
|
#ifdef BSD
|
||||||
|
_XTAG( HW_PHYSMEM ),
|
||||||
|
_XTAG( HW_NCPU ),
|
||||||
|
#else
|
||||||
_XTAG( HW_MEMSIZE ),
|
_XTAG( HW_MEMSIZE ),
|
||||||
_XTAG( HW_AVAILCPU ),
|
_XTAG( HW_AVAILCPU ),
|
||||||
|
#endif
|
||||||
#undef _XTAG
|
#undef _XTAG
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#elif defined(_X360)
|
#elif defined(_X360)
|
||||||
// nothing to include for 360
|
// nothing to include for 360
|
||||||
#elif defined(OSX)
|
#elif defined(OSX)
|
||||||
#elif defined(LINUX)
|
#elif defined(LINUX) || defined(BSD)
|
||||||
#include "tier0/dynfunction.h"
|
#include "tier0/dynfunction.h"
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
#include "tier0/dynfunction.h"
|
#include "tier0/dynfunction.h"
|
||||||
@ -833,11 +833,7 @@ LRESULT CGame::WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
// return 0 if handled message, 1 if not
|
// return 0 if handled message, 1 if not
|
||||||
return lRet;
|
return lRet;
|
||||||
}
|
}
|
||||||
#elif defined(OSX)
|
#elif defined(OSX) || defined(LINUX) || defined(_WIN32) || defined(BSD)
|
||||||
|
|
||||||
#elif defined(LINUX)
|
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
|
@ -2841,7 +2841,7 @@ time_t CBaseFileSystem::FastFileTime( const CSearchPath *path, const char *pFile
|
|||||||
{
|
{
|
||||||
return buf.st_mtime;
|
return buf.st_mtime;
|
||||||
}
|
}
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(BSD)
|
||||||
char caseFixedName[ MAX_PATH ];
|
char caseFixedName[ MAX_PATH ];
|
||||||
bool found = findFileInDirCaseInsensitive_safe( pTmpFileName, caseFixedName );
|
bool found = findFileInDirCaseInsensitive_safe( pTmpFileName, caseFixedName );
|
||||||
if ( found && FS_stat( caseFixedName, &buf ) != -1 )
|
if ( found && FS_stat( caseFixedName, &buf ) != -1 )
|
||||||
|
@ -1527,7 +1527,7 @@ void CBaseFileSystem::DoAsyncCallback( const FileAsyncRequest_t &request, void *
|
|||||||
if ( pDataToFree )
|
if ( pDataToFree )
|
||||||
{
|
{
|
||||||
Assert( !request.pfnAlloc );
|
Assert( !request.pfnAlloc );
|
||||||
#if defined( OSX ) || defined( LINUX )
|
#if defined( OSX ) || defined( LINUX ) || defined(BSD)
|
||||||
// The ugly delete[] (void*) method generates a compile warning on osx, as it should.
|
// The ugly delete[] (void*) method generates a compile warning on osx, as it should.
|
||||||
free( pDataToFree );
|
free( pDataToFree );
|
||||||
#else
|
#else
|
||||||
|
@ -579,7 +579,7 @@ int CFileSystem_Stdio::FS_chmod( const char *pathT, int pmode )
|
|||||||
CBaseFileSystem::FixUpPath ( pathT, path, sizeof( path ) );
|
CBaseFileSystem::FixUpPath ( pathT, path, sizeof( path ) );
|
||||||
|
|
||||||
int rt = _chmod( path, pmode );
|
int rt = _chmod( path, pmode );
|
||||||
#if defined(LINUX)
|
#if defined(LINUX) || defined(BSD)
|
||||||
if (rt==-1)
|
if (rt==-1)
|
||||||
{
|
{
|
||||||
char caseFixedName[ MAX_PATH ];
|
char caseFixedName[ MAX_PATH ];
|
||||||
@ -707,7 +707,7 @@ int CFileSystem_Stdio::FS_stat( const char *pathT, struct _stat *buf, bool *pbLo
|
|||||||
}
|
}
|
||||||
#endif // defined(_WIN32) && defined(FILESYSTEM_MSVC2015_STAT_BUG_WORKAROUND)
|
#endif // defined(_WIN32) && defined(FILESYSTEM_MSVC2015_STAT_BUG_WORKAROUND)
|
||||||
|
|
||||||
#if defined(LINUX)
|
#if defined(LINUX) || defined(BSD)
|
||||||
if ( rt == -1 )
|
if ( rt == -1 )
|
||||||
{
|
{
|
||||||
char caseFixedName[ MAX_PATH ];
|
char caseFixedName[ MAX_PATH ];
|
||||||
@ -866,7 +866,7 @@ CStdioFile *CStdioFile::FS_fopen( const char *filenameT, const char *options, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LINUX)
|
#if defined(LINUX) || defined(BSD)
|
||||||
if(!pFile && !strchr(options,'w') && !strchr(options,'+') ) // try opening the lower cased version
|
if(!pFile && !strchr(options,'w') && !strchr(options,'+') ) // try opening the lower cased version
|
||||||
{
|
{
|
||||||
char caseFixedName[ MAX_PATH ];
|
char caseFixedName[ MAX_PATH ];
|
||||||
|
@ -1130,7 +1130,7 @@ void CBasePanel::UpdateBackgroundState()
|
|||||||
vgui::GetAnimationController()->RunAnimationCommand( m_pGameLogo, "alpha", targetTitleAlpha, 0.0f, duration, AnimationController::INTERPOLATOR_LINEAR );
|
vgui::GetAnimationController()->RunAnimationCommand( m_pGameLogo, "alpha", targetTitleAlpha, 0.0f, duration, AnimationController::INTERPOLATOR_LINEAR );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Msg( "animating title (%d => %d at time %.2f)\n", m_pGameMenuButton->GetAlpha(), (int)targetTitleAlpha, engine->Time());
|
// Msg( "animating title (%d => %d at time %.2f)\n", m_pGameMenuButtons[0]->GetAlpha(), (int)targetTitleAlpha, engine->Time());
|
||||||
for ( i=0; i<m_pGameMenuButtons.Count(); ++i )
|
for ( i=0; i<m_pGameMenuButtons.Count(); ++i )
|
||||||
{
|
{
|
||||||
vgui::GetAnimationController()->RunAnimationCommand( m_pGameMenuButtons[i], "alpha", targetTitleAlpha, 0.0f, duration, AnimationController::INTERPOLATOR_LINEAR );
|
vgui::GetAnimationController()->RunAnimationCommand( m_pGameMenuButtons[i], "alpha", targetTitleAlpha, 0.0f, duration, AnimationController::INTERPOLATOR_LINEAR );
|
||||||
@ -1650,7 +1650,7 @@ void CBasePanel::PerformLayout()
|
|||||||
for ( int i=0; i<m_pGameMenuButtons.Count(); ++i )
|
for ( int i=0; i<m_pGameMenuButtons.Count(); ++i )
|
||||||
{
|
{
|
||||||
// Get the size of the logo text
|
// Get the size of the logo text
|
||||||
//int textWide, textTall;
|
// int textWide, textTall;
|
||||||
m_pGameMenuButtons[i]->SizeToContents();
|
m_pGameMenuButtons[i]->SizeToContents();
|
||||||
//vgui::surface()->GetTextSize( m_pGameMenuButtons[i]->GetFont(), ModInfo().GetGameTitle(), textWide, textTall );
|
//vgui::surface()->GetTextSize( m_pGameMenuButtons[i]->GetFont(), ModInfo().GetGameTitle(), textWide, textTall );
|
||||||
|
|
||||||
@ -2220,7 +2220,7 @@ void CBasePanel::RunMenuCommand(const char *command)
|
|||||||
|
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
#elif defined( OSX ) || defined( LINUX )
|
#elif defined( OSX ) || defined( LINUX ) || defined(BSD)
|
||||||
FILE *fp = fopen( "/tmp/hl2_relaunch", "w+" );
|
FILE *fp = fopen( "/tmp/hl2_relaunch", "w+" );
|
||||||
if ( fp )
|
if ( fp )
|
||||||
{
|
{
|
||||||
|
@ -161,7 +161,7 @@ bool CVGuiSystemModuleLoader::LoadPlatformModules(CreateInterfaceFn *factorylist
|
|||||||
{
|
{
|
||||||
dllPath = it->GetString("dll_osx");
|
dllPath = it->GetString("dll_osx");
|
||||||
}
|
}
|
||||||
else if ( IsLinux() )
|
else if ( IsLinux() || IsBSD() )
|
||||||
{
|
{
|
||||||
dllPath = it->GetString("dll_linux");
|
dllPath = it->GetString("dll_linux");
|
||||||
}
|
}
|
||||||
|
2
ivp
2
ivp
@ -1 +1 @@
|
|||||||
Subproject commit 428231315f701259387d0720170b05c23263ff4c
|
Subproject commit 2306a2531691b46f739cb0b587c1f3527c7b1c11
|
@ -10,7 +10,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "shlwapi.h" // registry stuff
|
#include "shlwapi.h" // registry stuff
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#elif defined ( LINUX ) || defined( OSX )
|
#elif defined(POSIX)
|
||||||
#define O_EXLOCK 0
|
#define O_EXLOCK 0
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -205,7 +205,7 @@ class CVCRHelpers : public IVCRHelpers
|
|||||||
public:
|
public:
|
||||||
virtual void ErrorMessage( const char *pMsg )
|
virtual void ErrorMessage( const char *pMsg )
|
||||||
{
|
{
|
||||||
#if defined( WIN32 ) || defined( LINUX )
|
#if defined( WIN32 ) || defined( LINUX ) || defined(BSD)
|
||||||
NOVCR( ::MessageBox( NULL, pMsg, "VCR Error", MB_OK ) );
|
NOVCR( ::MessageBox( NULL, pMsg, "VCR Error", MB_OK ) );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -950,7 +950,7 @@ bool GrabSourceMutex()
|
|||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
return true;
|
return true;
|
||||||
#elif defined (LINUX)
|
#elif defined (LINUX) || defined(BSD)
|
||||||
/*
|
/*
|
||||||
* Linux
|
* Linux
|
||||||
*/
|
*/
|
||||||
@ -1198,7 +1198,7 @@ DLL_EXPORT int LauncherMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
|
|||||||
DLL_EXPORT int LauncherMain( int argc, char **argv )
|
DLL_EXPORT int LauncherMain( int argc, char **argv )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if defined LINUX && !defined ANDROID
|
#if (defined(LINUX) || defined(BSD)) && !defined ANDROID
|
||||||
// Temporary fix to stop us from crashing in printf/sscanf functions that don't expect
|
// Temporary fix to stop us from crashing in printf/sscanf functions that don't expect
|
||||||
// localization to mess with your "." and "," float seperators. Mac OSX also sets LANG
|
// localization to mess with your "." and "," float seperators. Mac OSX also sets LANG
|
||||||
// to en_US.UTF-8 before starting up (in info.plist I believe).
|
// to en_US.UTF-8 before starting up (in info.plist I believe).
|
||||||
@ -1225,7 +1225,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
|
|||||||
Msg("SDL version: %d.%d.%d rev: %s\n", (int)ver.major, (int)ver.minor, (int)ver.patch, SDL_GetRevision());
|
Msg("SDL version: %d.%d.%d rev: %s\n", (int)ver.major, (int)ver.minor, (int)ver.patch, SDL_GetRevision());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined LINUX && defined USE_SDL && defined TOGLES && !defined ANDROID
|
#if (defined LINUX || defined BSD) && defined USE_SDL && defined TOGLES && !defined ANDROID
|
||||||
SDL_SetHint(SDL_HINT_VIDEO_X11_FORCE_EGL, "1");
|
SDL_SetHint(SDL_HINT_VIDEO_X11_FORCE_EGL, "1");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1247,12 +1247,6 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
|
|||||||
// Hook the debug output stuff.
|
// Hook the debug output stuff.
|
||||||
SpewOutputFunc( LauncherDefaultSpewFunc );
|
SpewOutputFunc( LauncherDefaultSpewFunc );
|
||||||
|
|
||||||
if ( 0 && IsWin98OrOlder() )
|
|
||||||
{
|
|
||||||
Error( "This build does not currently run under Windows 98/Me." );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Quickly check the hardware key, essentially a warning shot.
|
// Quickly check the hardware key, essentially a warning shot.
|
||||||
if ( !Plat_VerifyHardwareKeyPrompt() )
|
if ( !Plat_VerifyHardwareKeyPrompt() )
|
||||||
{
|
{
|
||||||
@ -1559,7 +1553,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
|
|||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined( OSX ) || defined( LINUX )
|
#elif defined( OSX ) || defined( LINUX ) || defined(BSD)
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if ( stat( RELAUNCH_FILE, &st ) == 0 )
|
if ( stat( RELAUNCH_FILE, &st ) == 0 )
|
||||||
{
|
{
|
||||||
@ -1576,7 +1570,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
szCmd[nChars] = 0;
|
szCmd[nChars] = 0;
|
||||||
char szOpenLine[ MAX_PATH ];
|
char szOpenLine[ MAX_PATH ];
|
||||||
#if defined( LINUX )
|
#if defined( LINUX ) || defined(BSD)
|
||||||
Q_snprintf( szOpenLine, sizeof(szOpenLine), "xdg-open \"%s\"", szCmd );
|
Q_snprintf( szOpenLine, sizeof(szOpenLine), "xdg-open \"%s\"", szCmd );
|
||||||
#else
|
#else
|
||||||
Q_snprintf( szOpenLine, sizeof(szOpenLine), "open \"%s\"", szCmd );
|
Q_snprintf( szOpenLine, sizeof(szOpenLine), "open \"%s\"", szCmd );
|
||||||
|
@ -59,7 +59,7 @@ BEGIN_VS_SHADER_FLAGS( Occlusion_DX9, "Help for Occlusion", SHADER_NOT_EDITABLE
|
|||||||
SET_STATIC_PIXEL_SHADER( white_ps20 );
|
SET_STATIC_PIXEL_SHADER( white_ps20 );
|
||||||
|
|
||||||
// Workaround for weird AMD bug - if sRGB write isn't enabled here then sRGB write enable in subsequent world rendering passes will randomly not take effect (even though we're enabling it) in the driver.
|
// Workaround for weird AMD bug - if sRGB write isn't enabled here then sRGB write enable in subsequent world rendering passes will randomly not take effect (even though we're enabling it) in the driver.
|
||||||
if ( ( IsLinux() || IsWindows() ) && gl_amd_occlusion_workaround.GetBool() )
|
if ( ( IsLinux() || IsWindows() || IsBSD() ) && gl_amd_occlusion_workaround.GetBool() )
|
||||||
{
|
{
|
||||||
pShaderShadow->EnableSRGBWrite( true );
|
pShaderShadow->EnableSRGBWrite( true );
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
#if !defined(COMPILER_MSVC64) && !defined(LINUX) && !defined(OSX)
|
#if !defined(COMPILER_MSVC64) && !defined(LINUX) && !defined(COMPILER_CLANG)
|
||||||
// Implement for 64-bit Windows if needed.
|
// Implement for 64-bit Windows if needed.
|
||||||
// Clang hits "fatal error: error in backend:" and other errors when trying
|
// Clang hits "fatal error: error in backend:" and other errors when trying
|
||||||
// to compile the inline assembly below. 3DNow support is highly unlikely to
|
// to compile the inline assembly below. 3DNow support is highly unlikely to
|
||||||
@ -102,7 +102,7 @@ float FASTCALL _3DNow_VectorNormalize (Vector& vec)
|
|||||||
movd radius, mm1
|
movd radius, mm1
|
||||||
femms
|
femms
|
||||||
}
|
}
|
||||||
#elif LINUX
|
#elif LINUX
|
||||||
long long a,c;
|
long long a,c;
|
||||||
int b,d;
|
int b,d;
|
||||||
memcpy(&a,&vec[0],sizeof(a));
|
memcpy(&a,&vec[0],sizeof(a));
|
||||||
|
@ -3343,7 +3343,7 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
|
|||||||
|
|
||||||
// SSE Generally performs better than 3DNow when present, so this is placed
|
// SSE Generally performs better than 3DNow when present, so this is placed
|
||||||
// first to allow SSE to override these settings.
|
// first to allow SSE to override these settings.
|
||||||
#if !defined( OSX ) && !defined( PLATFORM_WINDOWS_PC64 ) && !defined(LINUX)
|
#if !defined( OSX ) && !defined( PLATFORM_WINDOWS_PC64 ) && !defined(LINUX) && !defined(BSD)
|
||||||
if ( bAllow3DNow && pi.m_b3DNow )
|
if ( bAllow3DNow && pi.m_b3DNow )
|
||||||
{
|
{
|
||||||
s_b3DNowEnabled = true;
|
s_b3DNowEnabled = true;
|
||||||
|
@ -61,7 +61,7 @@ void AppShutdown( CAppSystemGroup *pAppSystemGroup );
|
|||||||
extern int ValveCocoaMain( int argc, char **argv, CAppSystemGroup *pAppSystemGroup ); \
|
extern int ValveCocoaMain( int argc, char **argv, CAppSystemGroup *pAppSystemGroup ); \
|
||||||
return ValveCocoaMain( argc, argv, &_globalVarName ); \
|
return ValveCocoaMain( argc, argv, &_globalVarName ); \
|
||||||
}
|
}
|
||||||
#elif defined( LINUX )
|
#elif defined( LINUX ) || defined(BSD)
|
||||||
#define DEFINE_WINDOWED_APPLICATION_OBJECT_GLOBALVAR( _globalVarName ) \
|
#define DEFINE_WINDOWED_APPLICATION_OBJECT_GLOBALVAR( _globalVarName ) \
|
||||||
int main( int argc, char **argv ) \
|
int main( int argc, char **argv ) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
// Get the next N events. The function returns the number of events that were filled into your array.
|
// Get the next N events. The function returns the number of events that were filled into your array.
|
||||||
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false ) = 0;
|
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false ) = 0;
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(BSD)
|
||||||
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvents = false ) = 0;
|
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvents = false ) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -39,11 +39,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// stdio.h
|
// stdio.h
|
||||||
#ifndef NULL
|
#if !defined(NULL) || defined(__FreeBSD__)
|
||||||
|
#ifdef NULL
|
||||||
|
# undef NULL
|
||||||
|
#endif
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,7 +64,11 @@
|
|||||||
|
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
// need this for _alloca
|
// need this for _alloca
|
||||||
#include <alloca.h>
|
# ifdef BSD
|
||||||
|
# define va_list __va_list
|
||||||
|
# else
|
||||||
|
# include <alloca.h>
|
||||||
|
# endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -104,6 +108,7 @@
|
|||||||
#define IsLinux() false
|
#define IsLinux() false
|
||||||
#define IsOSX() false
|
#define IsOSX() false
|
||||||
#define IsPosix() false
|
#define IsPosix() false
|
||||||
|
#define IsBSD() false
|
||||||
#define PLATFORM_WINDOWS 1 // Windows PC or Xbox 360
|
#define PLATFORM_WINDOWS 1 // Windows PC or Xbox 360
|
||||||
#ifndef _X360
|
#ifndef _X360
|
||||||
#define IsWindows() true
|
#define IsWindows() true
|
||||||
@ -156,7 +161,13 @@
|
|||||||
#else
|
#else
|
||||||
#define IsOSX() false
|
#define IsOSX() false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef BSD
|
||||||
|
#define IsBSD() true
|
||||||
|
#else
|
||||||
|
#define IsBSD() false
|
||||||
|
#endif
|
||||||
|
|
||||||
#define IsPosix() true
|
#define IsPosix() true
|
||||||
#define IsPlatformOpenGL() true
|
#define IsPlatformOpenGL() true
|
||||||
#else
|
#else
|
||||||
@ -439,20 +450,20 @@ typedef void * HINSTANCE;
|
|||||||
#else
|
#else
|
||||||
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
|
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
|
||||||
// So if being debugged, use INT3 which is precise.
|
// So if being debugged, use INT3 which is precise.
|
||||||
#ifdef OSX
|
#if defined(OSX) || defined(BSD)
|
||||||
#if defined(__arm__) || defined(__aarch64__)
|
# if defined(__arm__) || defined(__aarch64__)
|
||||||
#ifdef __clang__
|
# ifdef __clang__
|
||||||
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0)
|
# define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0)
|
||||||
#elif defined __GNUC__
|
# elif defined __GNUC__
|
||||||
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_trap(); } else { raise(SIGTRAP); } } while(0)
|
# define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_trap(); } else { raise(SIGTRAP); } } while(0)
|
||||||
|
# else
|
||||||
|
# define DebuggerBreak() raise(SIGTRAP)
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __asm ( "int $3" ); } else { raise(SIGTRAP); } } while(0)
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
#define DebuggerBreak() raise(SIGTRAP)
|
# define DebuggerBreak() raise(SIGTRAP)
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __asm ( "int $3" ); } else { raise(SIGTRAP); } } while(0)
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define DebuggerBreak() raise(SIGTRAP)
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#define DebuggerBreakIfDebugging() if ( !Plat_IsInDebugSession() ) ; else DebuggerBreak()
|
#define DebuggerBreakIfDebugging() if ( !Plat_IsInDebugSession() ) ; else DebuggerBreak()
|
||||||
@ -550,7 +561,7 @@ typedef void * HINSTANCE;
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#if defined( GNUC )
|
#if defined( GNUC )
|
||||||
#define stackalloc( _size ) alloca( ALIGN_VALUE( _size, 16 ) )
|
#define stackalloc( _size ) alloca( ALIGN_VALUE( _size, 16 ) )
|
||||||
#ifdef _LINUX
|
#if defined(_LINUX) || defined(BSD)
|
||||||
#define mallocsize( _p ) ( malloc_usable_size( _p ) )
|
#define mallocsize( _p ) ( malloc_usable_size( _p ) )
|
||||||
#elif defined(OSX)
|
#elif defined(OSX)
|
||||||
#define mallocsize( _p ) ( malloc_size( _p ) )
|
#define mallocsize( _p ) ( malloc_size( _p ) )
|
||||||
@ -1377,10 +1388,11 @@ PLATFORM_INTERFACE void* Plat_SimpleLog( const tchar* file, int line );
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Returns true if debugger attached, false otherwise
|
// Returns true if debugger attached, false otherwise
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#if defined(_WIN32) || defined(LINUX) || defined(OSX)
|
#if defined(_WIN32) || defined(LINUX) || defined(OSX) || defined(BSD)
|
||||||
PLATFORM_INTERFACE bool Plat_IsInDebugSession();
|
PLATFORM_INTERFACE bool Plat_IsInDebugSession();
|
||||||
PLATFORM_INTERFACE void Plat_DebugString( const char * );
|
PLATFORM_INTERFACE void Plat_DebugString( const char * );
|
||||||
#else
|
#else
|
||||||
|
#warning "Plat_IsInDebugSession isn't working properly"
|
||||||
inline bool Plat_IsInDebugSession( bool bForceRecheck = false ) { return false; }
|
inline bool Plat_IsInDebugSession( bool bForceRecheck = false ) { return false; }
|
||||||
#define Plat_DebugString(s) ((void)0)
|
#define Plat_DebugString(s) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -285,7 +285,7 @@ PLATFORM_INTERFACE void ThreadSetAffinity( ThreadHandle_t hThread, int nAffinity
|
|||||||
#error Every platform needs to define ThreadMemoryBarrier to at least prevent compiler reordering
|
#error Every platform needs to define ThreadMemoryBarrier to at least prevent compiler reordering
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( _LINUX ) || defined( _OSX )
|
#if defined( _LINUX ) || defined( _OSX ) || defined(BSD)
|
||||||
#define USE_INTRINSIC_INTERLOCKED
|
#define USE_INTRINSIC_INTERLOCKED
|
||||||
// linux implementation
|
// linux implementation
|
||||||
inline int32 ThreadInterlockedIncrement( int32 volatile *p )
|
inline int32 ThreadInterlockedIncrement( int32 volatile *p )
|
||||||
@ -486,7 +486,7 @@ PLATFORM_INTERFACE void ThreadNotifySyncReleasing(void *p);
|
|||||||
|
|
||||||
#ifndef NO_THREAD_LOCAL
|
#ifndef NO_THREAD_LOCAL
|
||||||
|
|
||||||
#if defined(WIN32) || defined(OSX) || defined( _PS3 ) || ( defined (_LINUX) )
|
#if defined(WIN32) || defined(OSX) || defined( _PS3 ) || ( defined (_LINUX) ) || defined(BSD)
|
||||||
#ifndef __AFXTLS_H__ // not compatible with some Windows headers
|
#ifndef __AFXTLS_H__ // not compatible with some Windows headers
|
||||||
|
|
||||||
#if defined(_PS3)
|
#if defined(_PS3)
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _LINUX
|
#if defined(_LINUX) || defined(BSD)
|
||||||
#include <dlfcn.h> // dlopen,dlclose, et al
|
#include <dlfcn.h> // dlopen,dlclose, et al
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ CFLAGS = {
|
|||||||
# disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP
|
# disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP
|
||||||
'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS', '/Zc:threadSafeInit-'],
|
'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS', '/Zc:threadSafeInit-'],
|
||||||
'clang': ['-fno-strict-aliasing', '-fvisibility=hidden'],
|
'clang': ['-fno-strict-aliasing', '-fvisibility=hidden'],
|
||||||
'gcc': ['-g0', '-fno-strict-aliasing', '-fvisibility=hidden'],
|
'gcc': ['-fno-strict-aliasing', '-fvisibility=hidden'],
|
||||||
'owcc': ['-fno-short-enum', '-ffloat-store', '-g0']
|
'owcc': ['-fno-short-enum', '-ffloat-store', '-g0']
|
||||||
},
|
},
|
||||||
'fast': {
|
'fast': {
|
||||||
@ -73,7 +73,7 @@ CFLAGS = {
|
|||||||
'debug': {
|
'debug': {
|
||||||
'msvc': ['/Od', '/MTd'],
|
'msvc': ['/Od', '/MTd'],
|
||||||
'owcc': ['-g', '-O0', '-fno-omit-frame-pointer', '-funwind-tables', '-fno-omit-leaf-frame-pointer'],
|
'owcc': ['-g', '-O0', '-fno-omit-frame-pointer', '-funwind-tables', '-fno-omit-leaf-frame-pointer'],
|
||||||
'default': ['-g', '-O0'] #, '-ftree-vectorize', '-ffast-math', '-fno-tree-partial-pre']
|
'default': ['-g', '-O0'] #, '-ftree-vectorize', '-ffast-math']
|
||||||
},
|
},
|
||||||
'sanitize': {
|
'sanitize': {
|
||||||
'msvc': ['/Od', '/RTC1', '/MT'],
|
'msvc': ['/Od', '/RTC1', '/MT'],
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(BSD)
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif defined(_LINUX)
|
#elif defined(_LINUX)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#elif defined(OSX)
|
#elif defined(OSX) || defined(BSD)
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ bool CheckSSE4aTechnology( void )
|
|||||||
|
|
||||||
static bool Check3DNowTechnology(void)
|
static bool Check3DNowTechnology(void)
|
||||||
{
|
{
|
||||||
#if defined( _X360 ) || defined( _PS3 ) || defined (__arm__) || defined(__SANITIZE_ADDRESS__)
|
#if defined( _X360 ) || defined( _PS3 ) || defined (__arm__) || defined(__SANITIZE_ADDRESS__) || (defined(BSD) && defined(COMPILER_CLANG))
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
uint32 eax, unused;
|
uint32 eax, unused;
|
||||||
@ -448,7 +448,9 @@ uint64 CalculateCPUFreq(); // from cpu_linux.cpp
|
|||||||
static int64 CalculateClockSpeed()
|
static int64 CalculateClockSpeed()
|
||||||
{
|
{
|
||||||
#if defined( _WIN32 )
|
#if defined( _WIN32 )
|
||||||
#if !defined( _X360 )
|
#if defined( _X360 )
|
||||||
|
return 3200000000LL;
|
||||||
|
#else
|
||||||
LARGE_INTEGER waitTime, startCount, curCount;
|
LARGE_INTEGER waitTime, startCount, curCount;
|
||||||
CCycleCount start, end;
|
CCycleCount start, end;
|
||||||
|
|
||||||
@ -476,15 +478,14 @@ static int64 CalculateClockSpeed()
|
|||||||
freq = 2000000000;
|
freq = 2000000000;
|
||||||
}
|
}
|
||||||
return freq;
|
return freq;
|
||||||
|
|
||||||
#else
|
|
||||||
return 3200000000LL;
|
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(BSD)
|
||||||
|
return CalculateCPUFreq() * 1000000.0f;
|
||||||
#elif defined(POSIX)
|
#elif defined(POSIX)
|
||||||
int64 freq =(int64)CalculateCPUFreq();
|
int64 freq =(int64)CalculateCPUFreq();
|
||||||
if ( freq == 0 ) // couldn't calculate clock speed
|
if ( freq == 0 ) // couldn't calculate clock speed
|
||||||
{
|
{
|
||||||
Error( "Unable to determine CPU Frequency\n" );
|
Warning( "Unable to determine CPU Frequency\n" );
|
||||||
}
|
}
|
||||||
return freq;
|
return freq;
|
||||||
#endif
|
#endif
|
||||||
@ -583,7 +584,7 @@ const CPUInformation* GetCPUInformation()
|
|||||||
pi.m_nLogicalProcessors = 1;
|
pi.m_nLogicalProcessors = 1;
|
||||||
Assert( !"couldn't read cpu information from /proc/cpuinfo" );
|
Assert( !"couldn't read cpu information from /proc/cpuinfo" );
|
||||||
}
|
}
|
||||||
#elif defined(OSX)
|
#elif defined(OSX) || defined(BSD)
|
||||||
int mib[2], num_cpu = 1;
|
int mib[2], num_cpu = 1;
|
||||||
size_t len;
|
size_t len;
|
||||||
mib[0] = CTL_HW;
|
mib[0] = CTL_HW;
|
||||||
|
@ -11,6 +11,11 @@
|
|||||||
#include <linux/sysctl.h>
|
#include <linux/sysctl.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
# ifdef __APPLE__
|
||||||
|
# define CPUFREQ_SYSCTL "hw.cpufrequency_max"
|
||||||
|
# else
|
||||||
|
# define CPUFREQ_SYSCTL "dev.cpu.0.freq"
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -46,18 +51,15 @@ static inline uint64 diff(uint64 v1, uint64 v2)
|
|||||||
return -d;
|
return -d;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OSX
|
#if defined(OSX) || defined(BSD)
|
||||||
|
|
||||||
// Mac
|
// Mac or BSD
|
||||||
uint64 GetCPUFreqFromPROC()
|
uint64 GetCPUFreqFromPROC()
|
||||||
{
|
{
|
||||||
int mib[2] = {CTL_HW, HW_CPU_FREQ};
|
uint64 freq_hz = 0;
|
||||||
uint64 frequency = 0;
|
size_t freq_size = sizeof(freq_hz);
|
||||||
size_t len = sizeof(frequency);
|
int retval = sysctlbyname(CPUFREQ_SYSCTL, &freq_hz, &freq_size, NULL, 0);
|
||||||
|
return freq_hz;
|
||||||
if (sysctl(mib, 2, &frequency, &len, NULL, 0) == -1)
|
|
||||||
return 0;
|
|
||||||
return frequency;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -99,14 +101,8 @@ uint64 GetCPUFreqFromPROC()
|
|||||||
|
|
||||||
uint64 CalculateCPUFreq()
|
uint64 CalculateCPUFreq()
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) || defined(BSD)
|
||||||
uint64 freq_hz = 0;
|
return GetCPUFreqFromPROC();
|
||||||
size_t freq_size = sizeof(freq_hz);
|
|
||||||
int retval = sysctlbyname("hw.cpufrequency_max", &freq_hz, &freq_size, NULL, 0);
|
|
||||||
// MoeMod : TODO dont know how to get freq on Apple Silicon
|
|
||||||
if(!freq_hz)
|
|
||||||
freq_hz = 3200000000;
|
|
||||||
return freq_hz;
|
|
||||||
#else
|
#else
|
||||||
// Try to open cpuinfo_max_freq. If the kernel was built with cpu scaling support disabled, this will fail.
|
// Try to open cpuinfo_max_freq. If the kernel was built with cpu scaling support disabled, this will fail.
|
||||||
FILE *fp = fopen( "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq", "r" );
|
FILE *fp = fopen( "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq", "r" );
|
||||||
@ -127,9 +123,9 @@ uint64 CalculateCPUFreq()
|
|||||||
return retVal * 1000;
|
return retVal * 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(__arm__) && !defined(__aarch64__)
|
#if !defined(__arm__) && !defined(__aarch64__)
|
||||||
|
// fallback mechanism to calculate when failed
|
||||||
// Compute the period. Loop until we get 3 consecutive periods that
|
// Compute the period. Loop until we get 3 consecutive periods that
|
||||||
// are the same to within a small error. The error is chosen
|
// are the same to within a small error. The error is chosen
|
||||||
// to be +/- 0.02% on a P-200.
|
// to be +/- 0.02% on a P-200.
|
||||||
@ -179,7 +175,10 @@ uint64 CalculateCPUFreq()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return period;
|
return period;
|
||||||
#endif
|
#else
|
||||||
|
// ARM hard-coded frequency
|
||||||
return (uint64)2000000000;
|
return (uint64)2000000000;
|
||||||
|
#endif // if !ARM
|
||||||
|
#endif // if APPLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,12 +16,17 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef OSX
|
#if defined(OSX) || defined(BSD)
|
||||||
#include <mach/mach.h>
|
# ifdef BSD
|
||||||
#include <mach/mach_time.h>
|
# include <sys/proc.h>
|
||||||
|
# include <sys/user.h>
|
||||||
|
# else
|
||||||
|
# include <mach/mach.h>
|
||||||
|
# include <mach/mach_time.h>
|
||||||
|
# endif
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
@ -436,41 +441,29 @@ PLATFORM_INTERFACE void Plat_SetAllocErrorFn( Plat_AllocErrorFn fn )
|
|||||||
|
|
||||||
#endif // !NO_HOOK_MALLOC
|
#endif // !NO_HOOK_MALLOC
|
||||||
|
|
||||||
#if defined( OSX )
|
#if defined( OSX ) || defined(BSD)
|
||||||
|
|
||||||
// From the Apple tech note: http://developer.apple.com/library/mac/#qa/qa1361/_index.html
|
// From the Apple tech note: http://developer.apple.com/library/mac/#qa/qa1361/_index.html
|
||||||
bool Plat_IsInDebugSession()
|
bool Plat_IsInDebugSession()
|
||||||
{
|
{
|
||||||
|
static int s_IsInDebugSession;
|
||||||
int junk;
|
int junk;
|
||||||
int mib[4];
|
|
||||||
struct kinfo_proc info;
|
struct kinfo_proc info;
|
||||||
size_t size;
|
size_t size;
|
||||||
static int s_IsInDebugSession = -1;
|
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()};
|
||||||
|
#ifndef BSD
|
||||||
|
info.kp_proc.p_flag = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( s_IsInDebugSession == -1 )
|
size = sizeof(info);
|
||||||
{
|
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
|
||||||
// Initialize the flags so that, if sysctl fails for some bizarre
|
|
||||||
// reason, we get a predictable result.
|
|
||||||
|
|
||||||
info.kp_proc.p_flag = 0;
|
// We're being debugged if the P_TRACED flag is set.
|
||||||
|
#ifdef BSD
|
||||||
// Initialize mib, which tells sysctl the info we want, in this case
|
s_IsInDebugSession = info.ki_flag & P_TRACED;
|
||||||
// we're looking for information about a specific process ID.
|
#else
|
||||||
|
s_IsInDebugSession = info.kp_proc.p_flag & P_TRACED;
|
||||||
mib[0] = CTL_KERN;
|
#endif
|
||||||
mib[1] = KERN_PROC;
|
|
||||||
mib[2] = KERN_PROC_PID;
|
|
||||||
mib[3] = getpid();
|
|
||||||
|
|
||||||
// Call sysctl.
|
|
||||||
|
|
||||||
size = sizeof(info);
|
|
||||||
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
|
|
||||||
|
|
||||||
// We're being debugged if the P_TRACED flag is set.
|
|
||||||
|
|
||||||
s_IsInDebugSession = ( (info.kp_proc.p_flag & P_TRACED) != 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
return !!s_IsInDebugSession;
|
return !!s_IsInDebugSession;
|
||||||
}
|
}
|
||||||
@ -509,7 +502,6 @@ bool Plat_IsInDebugSession()
|
|||||||
return ( tracerpid > 0 );
|
return ( tracerpid > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // defined( LINUX )
|
#endif // defined( LINUX )
|
||||||
|
|
||||||
void Plat_DebugString( const char * psz )
|
void Plat_DebugString( const char * psz )
|
||||||
@ -567,7 +559,7 @@ PLATFORM_INTERFACE const char *Plat_GetCommandLineA()
|
|||||||
|
|
||||||
PLATFORM_INTERFACE bool GetMemoryInformation( MemoryInformation *pOutMemoryInfo )
|
PLATFORM_INTERFACE bool GetMemoryInformation( MemoryInformation *pOutMemoryInfo )
|
||||||
{
|
{
|
||||||
#if defined( LINUX ) || defined( OSX )
|
#if defined( LINUX ) || defined( OSX ) || defined(BSD)
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
#error "Need to fill out GetMemoryInformation or at least return false for this platform"
|
#error "Need to fill out GetMemoryInformation or at least return false for this platform"
|
||||||
@ -579,7 +571,7 @@ PLATFORM_INTERFACE bool Is64BitOS()
|
|||||||
{
|
{
|
||||||
#if defined OSX
|
#if defined OSX
|
||||||
return true;
|
return true;
|
||||||
#elif defined LINUX
|
#elif defined(LINUX) || defined(BSD)
|
||||||
FILE *pp = popen( "uname -m", "r" );
|
FILE *pp = popen( "uname -m", "r" );
|
||||||
if ( pp != NULL )
|
if ( pp != NULL )
|
||||||
{
|
{
|
||||||
@ -789,7 +781,7 @@ static void InstallHooks( void )
|
|||||||
__realloc_hook = ReallocHook;
|
__realloc_hook = ReallocHook;
|
||||||
|
|
||||||
}
|
}
|
||||||
#elif OSX
|
#elif OSX || BSD
|
||||||
|
|
||||||
|
|
||||||
static void RemoveHooks( void )
|
static void RemoveHooks( void )
|
||||||
|
@ -43,6 +43,11 @@
|
|||||||
#define OS_TO_PTHREAD(x) pthread_from_mach_thread_np( x )
|
#define OS_TO_PTHREAD(x) pthread_from_mach_thread_np( x )
|
||||||
#endif // !OSX
|
#endif // !OSX
|
||||||
|
|
||||||
|
#ifdef BSD
|
||||||
|
# undef OS_TO_PTRHEAD
|
||||||
|
# define OS_TO_PTHREAD(x) (pthread_t)(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _PS3
|
#ifndef _PS3
|
||||||
@ -1680,7 +1685,7 @@ bool CThreadFullMutex::Release()
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined( WIN32 ) || defined( _PS3 ) || defined( _OSX ) || defined (_LINUX)
|
#if defined( WIN32 ) || defined( _PS3 ) || defined( _OSX ) || defined (_LINUX) || defined(BSD)
|
||||||
#if !defined(_PS3)
|
#if !defined(_PS3)
|
||||||
namespace GenericThreadLocals
|
namespace GenericThreadLocals
|
||||||
{
|
{
|
||||||
|
@ -2211,7 +2211,7 @@ bool EvaluateConditional( const char *str )
|
|||||||
return bNot;
|
return bNot;
|
||||||
|
|
||||||
if ( Q_stristr( str, "$LINUX" ) )
|
if ( Q_stristr( str, "$LINUX" ) )
|
||||||
return (IsLinux() || IsOSX()) ^ bNot;
|
return ( IsLinux() || IsBSD() || IsOSX() ) ^ bNot;
|
||||||
|
|
||||||
if ( Q_stristr( str, "$POSIX" ) )
|
if ( Q_stristr( str, "$POSIX" ) )
|
||||||
return IsPosix() ^ bNot;
|
return IsPosix() ^ bNot;
|
||||||
|
@ -2953,7 +2953,7 @@ extern "C" void qsort_s( void *base, size_t num, size_t width, int (*compare )(v
|
|||||||
|
|
||||||
void V_qsort_s( void *base, size_t num, size_t width, int ( __cdecl *compare )(void *, const void *, const void *), void * context )
|
void V_qsort_s( void *base, size_t num, size_t width, int ( __cdecl *compare )(void *, const void *, const void *), void * context )
|
||||||
{
|
{
|
||||||
#if defined OSX
|
#if defined(OSX) || defined(BSD)
|
||||||
// the arguments are swapped 'round on the mac - awesome, huh?
|
// the arguments are swapped 'round on the mac - awesome, huh?
|
||||||
return qsort_r( base, num, width, context, compare );
|
return qsort_r( base, num, width, context, compare );
|
||||||
#else
|
#else
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include "glmgr_flush.inl"
|
#include "glmgr_flush.inl"
|
||||||
|
|
||||||
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
|
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION )) || defined(BSD)
|
||||||
#include "appframework/ilaunchermgr.h"
|
#include "appframework/ilaunchermgr.h"
|
||||||
extern ILauncherMgr *g_pLauncherMgr;
|
extern ILauncherMgr *g_pLauncherMgr;
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include "tier1.h"
|
#include "tier1.h"
|
||||||
#include "tier2/tier2.h"
|
#include "tier2/tier2.h"
|
||||||
|
|
||||||
#if defined(_LINUX) && !defined(__ANDROID__)
|
#if (defined(_LINUX) || defined(BSD)) && !defined(__ANDROID__)
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -54,7 +54,7 @@
|
|||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
|
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION )) || defined(BSD)
|
||||||
#include "appframework/ilaunchermgr.h"
|
#include "appframework/ilaunchermgr.h"
|
||||||
ILauncherMgr *g_pLauncherMgr = NULL;
|
ILauncherMgr *g_pLauncherMgr = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include "glmgr_flush.inl"
|
#include "glmgr_flush.inl"
|
||||||
|
|
||||||
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
|
#if defined(BSD) || defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
|
||||||
#include "appframework/ilaunchermgr.h"
|
#include "appframework/ilaunchermgr.h"
|
||||||
extern ILauncherMgr *g_pLauncherMgr;
|
extern ILauncherMgr *g_pLauncherMgr;
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
|
#if defined(BSD) || defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
|
||||||
#include "appframework/ilaunchermgr.h"
|
#include "appframework/ilaunchermgr.h"
|
||||||
ILauncherMgr *g_pLauncherMgr = NULL;
|
ILauncherMgr *g_pLauncherMgr = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,13 +28,15 @@
|
|||||||
#include "vgui_key_translation.h"
|
#include "vgui_key_translation.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
|
||||||
#ifdef OSX
|
#if defined(OSX) || defined(BSD)
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#elif defined(LINUX)
|
#elif defined(LINUX)
|
||||||
#include <sys/vfs.h>
|
#include <sys/vfs.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef OSX
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SDL
|
#ifdef USE_SDL
|
||||||
#include "SDL_clipboard.h"
|
#include "SDL_clipboard.h"
|
||||||
@ -290,7 +292,7 @@ void CSystem::ShellExecute(const char *command, const char *file)
|
|||||||
if ( pid == 0 )
|
if ( pid == 0 )
|
||||||
{
|
{
|
||||||
// Child
|
// Child
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(BSD)
|
||||||
// Escape steam runtime if necessary
|
// Escape steam runtime if necessary
|
||||||
const char *szSteamRuntime = getenv( "STEAM_RUNTIME" );
|
const char *szSteamRuntime = getenv( "STEAM_RUNTIME" );
|
||||||
if ( szSteamRuntime )
|
if ( szSteamRuntime )
|
||||||
@ -585,7 +587,7 @@ int CSystem::GetAvailableDrives(char *buf, int bufLen)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
double CSystem::GetFreeDiskSpace(const char *path)
|
double CSystem::GetFreeDiskSpace(const char *path)
|
||||||
{
|
{
|
||||||
#if __DARWIN_ONLY_64_BIT_INO_T
|
#if __DARWIN_ONLY_64_BIT_INO_T || BSD
|
||||||
// MoeMod: newer macOS only support 64bit, so no statfs64 is provided
|
// MoeMod: newer macOS only support 64bit, so no statfs64 is provided
|
||||||
struct statfs buf;
|
struct statfs buf;
|
||||||
int ret = statfs( path, &buf );
|
int ret = statfs( path, &buf );
|
||||||
|
@ -43,7 +43,7 @@ CFontManager::CFontManager()
|
|||||||
m_FontAmalgams.AddToTail();
|
m_FontAmalgams.AddToTail();
|
||||||
m_Win32Fonts.EnsureCapacity( MAX_INITIAL_FONTS );
|
m_Win32Fonts.EnsureCapacity( MAX_INITIAL_FONTS );
|
||||||
|
|
||||||
#if defined(LINUX) || defined(OSX)
|
#ifdef POSIX
|
||||||
FT_Error error = FT_Init_FreeType( &library );
|
FT_Error error = FT_Init_FreeType( &library );
|
||||||
if ( error )
|
if ( error )
|
||||||
Error( "Unable to initalize freetype library, is it installed?" );
|
Error( "Unable to initalize freetype library, is it installed?" );
|
||||||
@ -75,7 +75,7 @@ CFontManager::~CFontManager()
|
|||||||
{
|
{
|
||||||
ClearAllFonts();
|
ClearAllFonts();
|
||||||
m_FontAmalgams.RemoveAll();
|
m_FontAmalgams.RemoveAll();
|
||||||
#if defined(LINUX) || defined(OSX)
|
#ifdef POSIX
|
||||||
FT_Done_FreeType( library );
|
FT_Done_FreeType( library );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ font_t *CFontManager::CreateOrFindWin32Font(const char *windowsFontName, int tal
|
|||||||
i = m_Win32Fonts.AddToTail();
|
i = m_Win32Fonts.AddToTail();
|
||||||
m_Win32Fonts[i] = NULL;
|
m_Win32Fonts[i] = NULL;
|
||||||
|
|
||||||
#if defined(LINUX) || defined(OSX)
|
#ifdef POSIX
|
||||||
int memSize = 0;
|
int memSize = 0;
|
||||||
void *pchFontData = m_pFontDataHelper( windowsFontName, memSize, NULL );
|
void *pchFontData = m_pFontDataHelper( windowsFontName, memSize, NULL );
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ FallbackFont_t g_FallbackFonts[] =
|
|||||||
{ NULL, "Monaco" } // every other font falls back to this
|
{ NULL, "Monaco" } // every other font falls back to this
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined(LINUX)
|
#elif defined(LINUX) || defined(BSD)
|
||||||
static const char *g_szValidAsianFonts[] = { "Marlett", "WenQuanYi Zen Hei", "unifont", NULL };
|
static const char *g_szValidAsianFonts[] = { "Marlett", "WenQuanYi Zen Hei", "unifont", NULL };
|
||||||
|
|
||||||
// list of how fonts fallback
|
// list of how fonts fallback
|
||||||
@ -649,7 +649,7 @@ const char *CFontManager::GetForeignFallbackFontName()
|
|||||||
return "Tahoma";
|
return "Tahoma";
|
||||||
#elif defined(OSX)
|
#elif defined(OSX)
|
||||||
return "Helvetica";
|
return "Helvetica";
|
||||||
#elif defined(LINUX)
|
#elif defined(LINUX) || defined(BSD)
|
||||||
return "WenQuanYi Zen Hei";
|
return "WenQuanYi Zen Hei";
|
||||||
#elif defined(_PS3)
|
#elif defined(_PS3)
|
||||||
return "Tahoma";
|
return "Tahoma";
|
||||||
@ -750,7 +750,7 @@ void CFontManager::GetKernedCharWidth( vgui::HFont font, wchar_t ch, wchar_t chB
|
|||||||
if ( m_FontAmalgams[font].GetFontForChar( chAfter ) != pFont )
|
if ( m_FontAmalgams[font].GetFontForChar( chAfter ) != pFont )
|
||||||
chAfter = 0;
|
chAfter = 0;
|
||||||
|
|
||||||
#if defined(LINUX) || defined(OSX)
|
#ifdef POSIX
|
||||||
pFont->GetKernedCharWidth( ch, chBefore, chAfter, wide, flabcA, flabcC );
|
pFont->GetKernedCharWidth( ch, chBefore, chAfter, wide, flabcA, flabcC );
|
||||||
#else
|
#else
|
||||||
pFont->GetKernedCharWidth( ch, chBefore, chAfter, wide, flabcA );
|
pFont->GetKernedCharWidth( ch, chBefore, chAfter, wide, flabcA );
|
||||||
|
@ -39,7 +39,7 @@ def build(bld):
|
|||||||
'../../public/tier0',
|
'../../public/tier0',
|
||||||
'../../public/tier1',
|
'../../public/tier1',
|
||||||
'../../common',
|
'../../common',
|
||||||
] + bld.env.INCLUDES_FT2
|
] + bld.env.INCLUDES_FC + bld.env.INCLUDES_FT2
|
||||||
|
|
||||||
defines = []
|
defines = []
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif defined( OSX )
|
#elif defined( OSX )
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#elif defined( LINUX )
|
#elif defined( LINUX ) || defined(BSD)
|
||||||
//#error
|
//#error
|
||||||
#elif defined( _X360 )
|
#elif defined( _X360 )
|
||||||
#else
|
#else
|
||||||
|
@ -146,7 +146,7 @@ CMatSystemSurface g_MatSystemSurface;
|
|||||||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CMatSystemSurface, ISurface,
|
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CMatSystemSurface, ISurface,
|
||||||
VGUI_SURFACE_INTERFACE_VERSION, g_MatSystemSurface );
|
VGUI_SURFACE_INTERFACE_VERSION, g_MatSystemSurface );
|
||||||
|
|
||||||
#if defined(LINUX) || defined(OSX)
|
#if defined(LINUX) || defined(OSX) || defined(BSD)
|
||||||
CUtlDict< CMatSystemSurface::font_entry, unsigned short > CMatSystemSurface::m_FontData;
|
CUtlDict< CMatSystemSurface::font_entry, unsigned short > CMatSystemSurface::m_FontData;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -407,7 +407,7 @@ InitReturnVal_t CMatSystemSurface::Init( void )
|
|||||||
FontManager().SetLanguage( "english" );
|
FontManager().SetLanguage( "english" );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LINUX) || defined(OSX)
|
#if defined(LINUX) || defined(OSX) || defined(BSD)
|
||||||
FontManager().SetFontDataHelper( &CMatSystemSurface::FontDataHelper );
|
FontManager().SetFontDataHelper( &CMatSystemSurface::FontDataHelper );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1907,7 +1907,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon
|
|||||||
}
|
}
|
||||||
Assert( success );
|
Assert( success );
|
||||||
return success;
|
return success;
|
||||||
#elif defined(LINUX) || defined(OSX)
|
#elif defined(LINUX) || defined(OSX) || defined(BSD)
|
||||||
|
|
||||||
int size;
|
int size;
|
||||||
if ( CMatSystemSurface::FontDataHelper( fontName, size, fontFileName ) )
|
if ( CMatSystemSurface::FontDataHelper( fontName, size, fontFileName ) )
|
||||||
@ -1921,7 +1921,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LINUX) || defined(OSX)
|
#if defined(LINUX) || defined(OSX) || defined(BSD)
|
||||||
|
|
||||||
static void RemoveSpaces( CUtlString &str )
|
static void RemoveSpaces( CUtlString &str )
|
||||||
{
|
{
|
||||||
|
@ -556,7 +556,7 @@ private:
|
|||||||
int m_nFullscreenViewportHeight;
|
int m_nFullscreenViewportHeight;
|
||||||
ITexture *m_pFullscreenRenderTarget;
|
ITexture *m_pFullscreenRenderTarget;
|
||||||
|
|
||||||
#if defined(LINUX) || defined(OSX)
|
#if defined(LINUX) || defined(OSX) || defined(BSD)
|
||||||
struct font_entry
|
struct font_entry
|
||||||
{
|
{
|
||||||
void *data;
|
void *data;
|
||||||
|
@ -58,14 +58,14 @@ DEFINE_ENUM_BITWISE_OPERATORS( EPlatform_t );
|
|||||||
const EPlatform_t thisPlatform = PLATFORM_XBOX_360;
|
const EPlatform_t thisPlatform = PLATFORM_XBOX_360;
|
||||||
#elif defined( _PS3 )
|
#elif defined( _PS3 )
|
||||||
const EPlatform_t thisPlatform = PLATFORM_PS3;
|
const EPlatform_t thisPlatform = PLATFORM_PS3;
|
||||||
#elif defined ( _LINUX )
|
#elif defined ( _LINUX ) || defined(BSD)
|
||||||
const EPlatform_t thisPlatform = PLATFORM_LINUX;
|
const EPlatform_t thisPlatform = PLATFORM_LINUX;
|
||||||
#else
|
#else
|
||||||
#error "UNABLE TO DETERMINE PLATFORM"
|
#error "UNABLE TO DETERMINE PLATFORM"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined( OSX ) || defined( LINUX )
|
#if defined( OSX ) || defined( LINUX ) || defined(BSD)
|
||||||
ILauncherMgr *g_pLauncherMgr = NULL;
|
ILauncherMgr *g_pLauncherMgr = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1382,7 +1382,7 @@ bool CVideoCommonServices::ProcessFullScreenInput( bool &bAbortEvent, bool &bPau
|
|||||||
bool bEscPressed = ( m_bScanEsc ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Escape ) : false;
|
bool bEscPressed = ( m_bScanEsc ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Escape ) : false;
|
||||||
bool bReturnPressed = ( m_bScanReturn ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Return ) : false;
|
bool bReturnPressed = ( m_bScanReturn ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Return ) : false;
|
||||||
bool bSpacePressed = ( m_bScanSpace ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Space ) : false;
|
bool bSpacePressed = ( m_bScanSpace ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Space ) : false;
|
||||||
#elif defined(LINUX)
|
#elif defined(LINUX) || defined(BSD)
|
||||||
g_pLauncherMgr->PumpWindowsMessageLoop();
|
g_pLauncherMgr->PumpWindowsMessageLoop();
|
||||||
|
|
||||||
// Escape, return, or space stops or pauses the playback
|
// Escape, return, or space stops or pauses the playback
|
||||||
|
11
wscript
11
wscript
@ -221,6 +221,14 @@ def define_platform(conf):
|
|||||||
'_DLL_EXT=.dylib'
|
'_DLL_EXT=.dylib'
|
||||||
])
|
])
|
||||||
|
|
||||||
|
elif conf.env.DEST_OS in ['freebsd', 'openbsd', 'netbsd', 'dragonflybsd']: # Tested only in freebsd
|
||||||
|
conf.env.append_unique('DEFINES', [
|
||||||
|
'POSIX=1', '_POSIX=1', 'PLATFORM_POSIX=1',
|
||||||
|
'GNUC', # but uses clang
|
||||||
|
'BSD=1',
|
||||||
|
'_DLL_EXT=.so'
|
||||||
|
])
|
||||||
|
|
||||||
if conf.options.DEBUG_ENGINE:
|
if conf.options.DEBUG_ENGINE:
|
||||||
conf.env.append_unique('DEFINES', [
|
conf.env.append_unique('DEFINES', [
|
||||||
'DEBUG', '_DEBUG'
|
'DEBUG', '_DEBUG'
|
||||||
@ -370,6 +378,9 @@ def configure(conf):
|
|||||||
elif conf.env.DEST_CPU in ['arm', 'aarch64']:
|
elif conf.env.DEST_CPU in ['arm', 'aarch64']:
|
||||||
flags += ['-fsigned-char']
|
flags += ['-fsigned-char']
|
||||||
|
|
||||||
|
if conf.env.DEST_OS == 'freebsd':
|
||||||
|
linkflags += ['-lexecinfo']
|
||||||
|
|
||||||
if conf.env.DEST_OS != 'win32':
|
if conf.env.DEST_OS != 'win32':
|
||||||
cflags += flags
|
cflags += flags
|
||||||
linkflags += flags
|
linkflags += flags
|
||||||
|
Loading…
Reference in New Issue
Block a user