Browse Source

Haiku: Add support

pull/193/head
Er2 2 years ago
parent
commit
2305298f10
  1. 2
      README.md
  2. 2
      appframework/posixapp.cpp
  3. 4
      appframework/sdlmgr.cpp
  4. 1
      appframework/wscript
  5. 9
      common/freetype/config/ftconfig.h
  6. 18
      engine/bugreporter.cpp
  7. 16
      engine/sv_main.cpp
  8. 15
      engine/sys_dll.cpp
  9. 6
      engine/sys_mainwind.cpp
  10. 4
      engine/wscript
  11. 2
      gameui/BasePanel.cpp
  12. 2
      gameui/VGuiSystemModuleLoader.cpp
  13. 2
      ivp
  14. 8
      launcher/launcher.cpp
  15. 2
      launcher_main/main.cpp
  16. 1
      materialsystem/stdshaders/wscript
  17. 2
      mathlib/3dnow.cpp
  18. 2
      mathlib/mathlib_base.cpp
  19. 2
      public/XUnzip.cpp
  20. 2
      public/appframework/AppFramework.h
  21. 2
      public/appframework/ilaunchermgr.h
  22. 4
      public/filesystem_init.cpp
  23. 0
      public/sse2neon.h
  24. 3
      public/steam/steamtypes.h
  25. 10
      public/tier0/platform.h
  26. 4
      public/tier0/threadtools.h
  27. 2
      public/tier1/fmtstr.h
  28. 2
      public/tier1/utlbuffer.h
  29. 2
      public/togl/linuxwin/cglmtex.h
  30. 4
      public/togl/linuxwin/glfuncs.h
  31. 2
      serverbrowser/ServerBrowserDialog.cpp
  32. 4
      tier0/assert_dialog.cpp
  33. 18
      tier0/cpu_posix.cpp
  34. 2
      tier0/cpu_usage.cpp
  35. 22
      tier0/platform_posix.cpp
  36. 9
      tier0/threadtools.cpp
  37. 6
      tier0/wscript
  38. 2
      tier1/KeyValues.cpp
  39. 4
      tier1/interface.cpp
  40. 10
      tier1/strtools.cpp
  41. 8
      tier1/wscript
  42. 2
      togl/linuxwin/cglmbuffer.cpp
  43. 2
      togl/linuxwin/dxabstract.cpp
  44. 8
      togl/linuxwin/glentrypoints.cpp
  45. 8
      togl/linuxwin/glmgr.cpp
  46. 4
      togl/linuxwin/glmgr_flush.inl
  47. 47
      togl/linuxwin/glmgrbasics.cpp
  48. 1
      togles/wscript
  49. 10
      vgui2/src/system_posix.cpp
  50. 2
      vgui2/src/wscript
  51. 1
      vgui2/vgui_controls/wscript
  52. 18
      vgui2/vgui_surfacelib/FontManager.cpp
  53. 2
      vgui2/vgui_surfacelib/wscript
  54. 2
      vguimatsurface/FontTextureCache.cpp
  55. 8
      vguimatsurface/MatSystemSurface.cpp
  56. 2
      vguimatsurface/MatSystemSurface.h
  57. 6
      video/videoservices.cpp
  58. 2
      waf
  59. 30
      wscript

2
README.md

@ -15,7 +15,7 @@ Source code is based on TF2 2018 leak. Don't use it for commercial purposes. @@ -15,7 +15,7 @@ Source code is based on TF2 2018 leak. Don't use it for commercial purposes.
This project is using waf buildsystem. If you have waf-related questions look https://waf.io/book
# Features:
- Android, OSX, FreeBSD, Windows support
- Android, OSX, Windows, FreeBSD, Haiku support
- Arm support( except windows )
- 64bit support
- Modern toolchains support

2
appframework/posixapp.cpp

@ -118,7 +118,7 @@ bool CSteamApplication::Create( ) @@ -118,7 +118,7 @@ bool CSteamApplication::Create( )
m_pFileSystem = (IFileSystem*)AddSystem( fileSystemModule, FILESYSTEM_INTERFACE_VERSION );
if ( !m_pFileSystem )
{
Error( "Unable to load %s", pFileSystemDLL );
Error( "Unable to load %s\n", pFileSystemDLL );
return false;
}

4
appframework/sdlmgr.cpp

@ -270,7 +270,7 @@ public: @@ -270,7 +270,7 @@ public:
// 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 );
#if defined(LINUX) || defined(PLATFORM_BSD)
#if defined(POSIX) && !defined(OSX)
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent = false );
#endif
@ -1004,7 +1004,7 @@ int CSDLMgr::GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debug @@ -1004,7 +1004,7 @@ int CSDLMgr::GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debug
return nToWrite;
}
#if defined(LINUX) || defined(PLATFORM_BSD)
#if defined(POSIX) && !defined(OSX)
int CSDLMgr::PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent )
{

1
appframework/wscript

@ -42,6 +42,7 @@ def build(bld): @@ -42,6 +42,7 @@ def build(bld):
includes = [
'.',
'../common',
'../public',
'../public/tier0',
'../public/tier1'

9
common/freetype/config/ftconfig.h

@ -3,6 +3,15 @@ @@ -3,6 +3,15 @@
#ifdef ANDROID
#include <sys/cdefs.h>
#elif defined(PLATFORM_HAIKU)
#include <BeBuild.h>
# if B_HAIKU_64_BIT
# define __WORDSIZE 64
# elif B_HAIKU_32_BIT
# define __WORDSIZE 32
# else
# error "Unknown Haiku bit size"
# endif
#elif defined(OSX) || defined(PLATFORM_BSD)
#include <stdint.h>
#else

18
engine/bugreporter.cpp

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
# include <sys/types.h>
# include <fcntl.h>
# define HW_MEMSIZE HW_PHYSMEM
#elif defined(LINUX)
#elif defined(LINUX) || defined(PLATFORM_HAIKU)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@ -110,7 +110,7 @@ @@ -110,7 +110,7 @@
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
#elif defined(OSX)
#define BUG_REPOSITORY_URL "/Volumes/bugs"
#elif defined(LINUX) || defined(PLATFORM_BSD)
#elif defined(POSIX)
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
#else
//#error
@ -345,12 +345,14 @@ void DisplaySystemVersion( char *osversion, int maxlen ) @@ -345,12 +345,14 @@ void DisplaySystemVersion( char *osversion, int maxlen )
fclose( fpKernelVer );
}
#elif PLATFORM_HAIKU
osversion = (char *)"Haiku OS";
#elif PLATFORM_BSD
#ifdef __FreeBSD__
osversion = (char *)"FreeBSD";
#else
osversion = (char *)"*BSD";
#endif
# ifdef PLATFORM_FBSD
osversion = (char *)"FreeBSD";
# else
osversion = (char *)"*BSD";
# endif
#endif
}
@ -2257,7 +2259,7 @@ void NonFileSystem_CreatePath (const char *path) @@ -2257,7 +2259,7 @@ void NonFileSystem_CreatePath (const char *path)
}
}
#if defined(LINUX) || defined(PLATFORM_BSD)
#if defined(POSIX) && !defined(OSX)
#define COPYFILE_ALL 0
#define BSIZE 65535
int copyfile( const char *local, const char *remote, void *ignored, int ignoredFlags )

16
engine/sv_main.cpp

@ -2714,14 +2714,16 @@ bool CGameServer::SpawnServer( const char *szMapName, const char *szMapFile, con @@ -2714,14 +2714,16 @@ bool CGameServer::SpawnServer( const char *szMapName, const char *szMapFile, con
event->SetString( "os", "LINUX" );
#elif defined ( OSX )
event->SetString( "os", "OSX" );
#elif defined(PLATFORM_HAIKU)
event->SetString( "os", "Haiku" );
#elif defined(PLATFORM_BSD)
event->SetString("os",
# ifdef __FreeBSD__
"FreeBSD"
# else
"BSD"
# endif
);
event->SetString("os",
# ifdef PLATFORM_FBSD
"FreeBSD"
# else
"BSD"
# endif
);
#else
#error
#endif

15
engine/sys_dll.cpp

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
#include <sys/types.h>
#include <sys/sysctl.h>
#define HW_MEMSIZE HW_PHYSMEM
#elif defined(PLATFORM_HAIKU)
# include <OS.h>
#endif
#if defined(LINUX)
#include <unistd.h>
@ -464,7 +466,7 @@ void Sys_Error_Internal( bool bMinidump, const char *error, va_list argsList ) @@ -464,7 +466,7 @@ void Sys_Error_Internal( bool bMinidump, const char *error, va_list argsList )
// 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() );
printf("\n ##### Sys_Error: %s", text );
printf("\n ##### Sys_Error: %s\n", text );
fflush(stdout );
raise(SIGTRAP);
@ -677,6 +679,11 @@ void Sys_InitMemory( void ) @@ -677,6 +679,11 @@ void Sys_InitMemory( void )
{
memsize = ONE_HUNDRED_TWENTY_EIGHT_MB;
}
#elif defined(PLATFORM_HAIKU)
system_info info;
get_system_info(&info);
memsize = (uint64_t)(info.max_pages * B_PAGE_SIZE);
#elif defined(LINUX)
const int fd = open("/proc/meminfo", O_RDONLY);
if (fd < 0)
@ -1586,14 +1593,14 @@ CON_COMMAND( star_memory, "Dump memory stats" ) @@ -1586,14 +1593,14 @@ CON_COMMAND( star_memory, "Dump memory stats" )
struct mstats memstats = mstats( );
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 );
#elif PLATFORM_BSD
# warning TODO: Implement memory stats (peace of sheet of course)
#else // Win32
#elif _WIN32
MEMORYSTATUS stat;
GlobalMemoryStatus( &stat );
Msg( "Available: %.2f MB, Used: %.2f MB, Free: %.2f MB\n",
stat.dwTotalPhys/( 1024.0f*1024.0f ) - 32.0f,
( stat.dwTotalPhys - stat.dwAvailPhys )/( 1024.0f*1024.0f ) - 32.0f,
stat.dwAvailPhys/( 1024.0f*1024.0f ) );
#else
# warning TODO: Implement memory stats (peace of sheet of course)
#endif
}

6
engine/sys_mainwind.cpp

@ -25,9 +25,7 @@ @@ -25,9 +25,7 @@
#elif defined(_X360)
// nothing to include for 360
#elif defined(OSX)
#elif defined(LINUX) || defined(PLATFORM_BSD)
#include "tier0/dynfunction.h"
#elif defined(_WIN32)
#elif defined(POSIX) || defined(_WIN32)
#include "tier0/dynfunction.h"
#else
#error
@ -833,7 +831,7 @@ LRESULT CGame::WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -833,7 +831,7 @@ LRESULT CGame::WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
// return 0 if handled message, 1 if not
return lRet;
}
#elif defined(OSX) || defined(LINUX) || defined(_WIN32) || defined(PLATFORM_BSD)
#elif defined(POSIX) || defined(_WIN32)
#else
#error

4
engine/wscript

@ -365,7 +365,9 @@ def build(bld): @@ -365,7 +365,9 @@ def build(bld):
libs += ['USER32', 'WINMM', 'WININET', 'DSOUND', 'DXGUID', 'GDI32', 'bzip2']
elif bld.env.DEST_OS == 'darwin' and not bld.env.DEDICATED:
libs += ['APPKIT', 'COREAUDIO', 'AUDIOTOOLBOX', 'SYSTEMCONFIGURATION']
elif bld.env.DEST_OS == 'haiku':
libs += ['NETWORK']
install_path = bld.env.LIBDIR
bld.shlib(

2
gameui/BasePanel.cpp

@ -2223,7 +2223,7 @@ void CBasePanel::RunMenuCommand(const char *command) @@ -2223,7 +2223,7 @@ void CBasePanel::RunMenuCommand(const char *command)
RegCloseKey(hKey);
}
#elif defined( OSX ) || defined( LINUX ) || defined(PLATFORM_BSD)
#elif defined( POSIX )
FILE *fp = fopen( "/tmp/hl2_relaunch", "w+" );
if ( fp )
{

2
gameui/VGuiSystemModuleLoader.cpp

@ -161,7 +161,7 @@ bool CVGuiSystemModuleLoader::LoadPlatformModules(CreateInterfaceFn *factorylist @@ -161,7 +161,7 @@ bool CVGuiSystemModuleLoader::LoadPlatformModules(CreateInterfaceFn *factorylist
{
dllPath = it->GetString("dll_osx");
}
else if ( IsLinux() || IsBSD() )
else if ( IsPosix() )
{
dllPath = it->GetString("dll_linux");
}

2
ivp

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit 960c7228f8e8d710625891991e88b1ec3aa92e45
Subproject commit e96e2ec4e77354d74f16554a0cbb1eff627e4a63

8
launcher/launcher.cpp

@ -950,7 +950,7 @@ bool GrabSourceMutex() @@ -950,7 +950,7 @@ bool GrabSourceMutex()
#ifdef ANDROID
return true;
#elif defined (LINUX) || defined(PLATFORM_BSD)
#elif defined (POSIX) && !defined(OSX)
/*
* Linux
*/
@ -1198,7 +1198,7 @@ DLL_EXPORT int LauncherMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR @@ -1198,7 +1198,7 @@ DLL_EXPORT int LauncherMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
DLL_EXPORT int LauncherMain( int argc, char **argv )
#endif
{
#if (defined(LINUX) || defined(PLATFORM_BSD)) && !defined ANDROID
#if (defined(POSIX)) && !defined ANDROID
// 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
// 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 ) @@ -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());
#endif
#if (defined LINUX || defined PLATFORM_BSD) && defined USE_SDL && defined TOGLES && !defined ANDROID
#if defined POSIX && defined USE_SDL && defined TOGLES && !defined ANDROID
SDL_SetHint(SDL_HINT_VIDEO_X11_FORCE_EGL, "1");
#endif
@ -1553,7 +1553,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv ) @@ -1553,7 +1553,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
RegCloseKey(hKey);
}
#elif defined( OSX ) || defined( LINUX ) || defined(PLATFORM_BSD)
#elif defined( POSIX )
struct stat st;
if ( stat( RELAUNCH_FILE, &st ) == 0 )
{

2
launcher_main/main.cpp

@ -216,6 +216,7 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time ) @@ -216,6 +216,7 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time )
int main( int argc, char *argv[] )
{
#ifndef PLATFORM_HAIKU
char ld_path[4196];
char *path = "bin/";
char *ld_env;
@ -234,6 +235,7 @@ int main( int argc, char *argv[] ) @@ -234,6 +235,7 @@ int main( int argc, char *argv[] )
setenv("NO_EXECVE_AGAIN", "1", 1);
execve(argv[0], argv, environ);
}
#endif
void *launcher = dlopen( "bin/liblauncher" DLL_EXT_STRING, RTLD_NOW );
if ( !launcher )

1
materialsystem/stdshaders/wscript

@ -141,6 +141,7 @@ def build(bld): @@ -141,6 +141,7 @@ def build(bld):
includes = [
'.',
'../../common',
'../../public',
'../../public/tier0',
'../../public/tier1',

2
mathlib/3dnow.cpp

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#if !defined(COMPILER_MSVC64) && !defined(LINUX) && !defined(COMPILER_CLANG)
#if !defined(COMPILER_MSVC64) && !defined(POSIX) && !defined(COMPILER_CLANG)
// Implement for 64-bit Windows if needed.
// Clang hits "fatal error: error in backend:" and other errors when trying
// to compile the inline assembly below. 3DNow support is highly unlikely to

2
mathlib/mathlib_base.cpp

@ -3343,7 +3343,7 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright @@ -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
// first to allow SSE to override these settings.
#if !defined( OSX ) && !defined( PLATFORM_WINDOWS_PC64 ) && !defined(LINUX) && !defined(PLATFORM_BSD)
#if !defined( OSX ) && !defined( PLATFORM_WINDOWS_PC64 ) && !defined(POSIX)
if ( bAllow3DNow && pi.m_b3DNow )
{
s_b3DNowEnabled = true;

2
public/XUnzip.cpp

@ -4243,7 +4243,7 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags) @@ -4243,7 +4243,7 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags)
{
#ifdef _WIN32
SetFileTime(h,&ze.ctime,&ze.atime,&ze.mtime);
#elif defined( ANDROID )
#elif defined( ANDROID ) || defined(PLATFORM_HAIKU)
struct timespec ts[2];
ts[0].tv_sec = ze.atime;
ts[0].tv_nsec = 0;

2
public/appframework/AppFramework.h

@ -61,7 +61,7 @@ void AppShutdown( CAppSystemGroup *pAppSystemGroup ); @@ -61,7 +61,7 @@ void AppShutdown( CAppSystemGroup *pAppSystemGroup );
extern int ValveCocoaMain( int argc, char **argv, CAppSystemGroup *pAppSystemGroup ); \
return ValveCocoaMain( argc, argv, &_globalVarName ); \
}
#elif defined( LINUX ) || defined(PLATFORM_BSD)
#elif defined(POSIX)
#define DEFINE_WINDOWED_APPLICATION_OBJECT_GLOBALVAR( _globalVarName ) \
int main( int argc, char **argv ) \
{ \

2
public/appframework/ilaunchermgr.h

@ -52,7 +52,7 @@ public: @@ -52,7 +52,7 @@ public:
// 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;
#if defined(LINUX) || defined(PLATFORM_BSD)
#if defined(POSIX) && !defined(OSX)
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvents = false ) = 0;
#endif

4
public/filesystem_init.cpp

@ -344,7 +344,11 @@ bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen ) @@ -344,7 +344,11 @@ bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen )
Q_FixSlashes( exedir );
#ifdef PLATFORM_HAIKU
const char* libDir = "lib";
#else
const char* libDir = "bin";
#endif
// Return the bin directory as the executable dir if it's not in there
// because that's really where we're running from...

0
common/sse2neon.h → public/sse2neon.h

3
public/steam/steamtypes.h

@ -56,6 +56,9 @@ typedef __int32 intp; @@ -56,6 +56,9 @@ typedef __int32 intp;
typedef unsigned __int32 uintp;
#endif
#elif defined(PLATFORM_HAIKU)
// Already defined
#else // _WIN32
typedef short int16;

10
public/tier0/platform.h

@ -66,6 +66,8 @@ @@ -66,6 +66,8 @@
// need this for _alloca
# ifdef PLATFORM_BSD
# define va_list __va_list
# elif defined(PLATFORM_HAIKU)
# include <SupportDefs.h>
# else
# include <alloca.h>
# endif
@ -213,12 +215,14 @@ typedef signed char int8; @@ -213,12 +215,14 @@ typedef signed char int8;
#else // _WIN32
#if !defined(PLATFORM_HAIKU)
typedef short int16;
typedef unsigned short uint16;
typedef int int32;
typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
#endif
typedef long int lint64;
typedef unsigned long int ulint64;
@ -561,7 +565,7 @@ typedef void * HINSTANCE; @@ -561,7 +565,7 @@ typedef void * HINSTANCE;
//-----------------------------------------------------------------------------
#if defined( GNUC )
#define stackalloc( _size ) alloca( ALIGN_VALUE( _size, 16 ) )
#if defined(_LINUX) || defined(PLATFORM_BSD)
#if defined(_LINUX) || defined(PLATFORM_BSD) || defined(PLATFORM_HAIKU)
#define mallocsize( _p ) ( malloc_usable_size( _p ) )
#elif defined(OSX)
#define mallocsize( _p ) ( malloc_size( _p ) )
@ -1388,11 +1392,11 @@ PLATFORM_INTERFACE void* Plat_SimpleLog( const tchar* file, int line ); @@ -1388,11 +1392,11 @@ PLATFORM_INTERFACE void* Plat_SimpleLog( const tchar* file, int line );
//-----------------------------------------------------------------------------
// Returns true if debugger attached, false otherwise
//-----------------------------------------------------------------------------
#if defined(_WIN32) || defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
#if defined(_WIN32) || defined(POSIX)
PLATFORM_INTERFACE bool Plat_IsInDebugSession();
PLATFORM_INTERFACE void Plat_DebugString( const char * );
#else
#warning "Plat_IsInDebugSession isn't working properly"
#error "Plat_IsInDebugSession isn't working properly"
inline bool Plat_IsInDebugSession( bool bForceRecheck = false ) { return false; }
#define Plat_DebugString(s) ((void)0)
#endif

4
public/tier0/threadtools.h

@ -319,7 +319,7 @@ PLATFORM_INTERFACE void ThreadSetAffinity( ThreadHandle_t hThread, int nAffinity @@ -319,7 +319,7 @@ PLATFORM_INTERFACE void ThreadSetAffinity( ThreadHandle_t hThread, int nAffinity
#error Every platform needs to define ThreadMemoryBarrier to at least prevent compiler reordering
#endif
#if defined( _LINUX ) || defined( _OSX ) || defined(PLATFORM_BSD)
#if defined(POSIX)
#define USE_INTRINSIC_INTERLOCKED
// linux implementation
inline int32 ThreadInterlockedIncrement( int32 volatile *p )
@ -520,7 +520,7 @@ PLATFORM_INTERFACE void ThreadNotifySyncReleasing(void *p); @@ -520,7 +520,7 @@ PLATFORM_INTERFACE void ThreadNotifySyncReleasing(void *p);
#ifndef NO_THREAD_LOCAL
#if defined(WIN32) || defined(OSX) || defined( _PS3 ) || ( defined (_LINUX) ) || defined(PLATFORM_BSD)
#if defined(WIN32) || defined(POSIX) || defined( _PS3 )
#ifndef __AFXTLS_H__ // not compatible with some Windows headers
#if defined(_PS3)

2
public/tier1/fmtstr.h

@ -304,8 +304,10 @@ public: @@ -304,8 +304,10 @@ public:
explicit CNumStr( uint64 un64 ) { SetUint64( un64 ); }
#if defined(COMPILER_GCC) && defined(PLATFORM_64BITS)
#if !defined(PLATFORM_HAIKU)
explicit CNumStr( lint64 n64 ) { SetInt64( (int64)n64 ); }
explicit CNumStr( ulint64 un64 ) { SetUint64( (uint64)un64 ); }
#endif
#endif
explicit CNumStr( double f ) { SetDouble( f ); }

2
public/tier1/utlbuffer.h

@ -109,7 +109,7 @@ typedef unsigned short ushort; @@ -109,7 +109,7 @@ typedef unsigned short ushort;
template < class A >
static const char *GetFmtStr( int nRadix = 10, bool bPrint = true ) { Assert( 0 ); return ""; }
#if defined( LINUX ) || defined( __clang__ ) || ( defined( _MSC_VER ) && _MSC_VER >= 1900 )
#if defined( LINUX ) || defined( __clang__ ) || ( defined( _MSC_VER ) && _MSC_VER >= 1900 ) || defined(PLATFORM_HAIKU)
template <> const char *GetFmtStr< short > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%hd"; }
template <> const char *GetFmtStr< ushort > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%hu"; }
template <> const char *GetFmtStr< int > ( int nRadix, bool bPrint ) { Assert( nRadix == 10 ); return "%d"; }

2
public/togl/linuxwin/cglmtex.h

@ -293,7 +293,7 @@ struct GLMTexSamplingParams @@ -293,7 +293,7 @@ struct GLMTexSamplingParams
m_packed.m_isValid = true;
}
#ifndef OSX
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
FORCEINLINE void SetToSamplerObject( GLuint nSamplerObject ) const
{
static const GLenum dxtogl_addressMode[] = { GL_REPEAT, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER, (GLenum)-1 };

4
public/togl/linuxwin/glfuncs.h

@ -126,7 +126,9 @@ GL_FUNC_VOID(OpenGL,true,glDisableClientState,(GLenum a),(a)) @@ -126,7 +126,9 @@ GL_FUNC_VOID(OpenGL,true,glDisableClientState,(GLenum a),(a))
GL_FUNC_VOID(OpenGL,true,glClientActiveTexture,(GLenum a),(a))
GL_FUNC_VOID(OpenGL,true,glVertexPointer,(GLint a,GLenum b,GLsizei c,const GLvoid *d),(a,b,c,d))
GL_FUNC_VOID(OpenGL,true,glTexCoordPointer,(GLint a,GLenum b,GLsizei c,const GLvoid *d),(a,b,c,d))
#ifndef PLATFORM_HAIKU
GL_FUNC_VOID(OpenGL,true,glProgramEnvParameters4fvEXT,(GLenum a,GLuint b,GLsizei c,const GLfloat *d),(a,b,c,d))
#endif
GL_FUNC_VOID(OpenGL,true,glColor4sv,(const GLshort *a),(a))
GL_FUNC_VOID(OpenGL,true,glStencilOpSeparate,(GLenum a,GLenum b,GLenum c,GLenum d),(a,b,c,d))
GL_FUNC_VOID(OpenGL,true,glStencilFuncSeparate,(GLenum a,GLenum b,GLint c,GLuint d),(a,b,c,d))
@ -223,7 +225,7 @@ GL_EXT(GL_EXT_direct_state_access,-1,-1) @@ -223,7 +225,7 @@ GL_EXT(GL_EXT_direct_state_access,-1,-1)
GL_FUNC_VOID(GL_EXT_direct_state_access,false,glBindMultiTextureEXT,(GLenum a,GLuint b, GLuint c),(a,b,c))
GL_EXT(GL_NV_bindless_texture,-1,-1)
#ifndef OSX
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
GL_FUNC_VOID(OpenGL, true, glGenSamplers, (GLuint a, GLuint *b), (a, b))
GL_FUNC_VOID(OpenGL, true, glDeleteSamplers, (GLsizei a, const GLuint *b), (a, b))
GL_FUNC_VOID(OpenGL, true, glBindSampler, (GLuint a, GLuint b), (a, b))

2
serverbrowser/ServerBrowserDialog.cpp

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
#define WIN32_LEAN_AND_MEAN
#include <winsock.h>
#endif
#if defined(LINUX) || defined(PLATFORM_BSD)
#if defined(POSIX)
#include <arpa/inet.h>
#endif

4
tier0/assert_dialog.cpp

@ -386,7 +386,7 @@ DBG_INTERFACE bool ShouldUseNewAssertDialog() @@ -386,7 +386,7 @@ DBG_INTERFACE bool ShouldUseNewAssertDialog()
#endif // DBGFLAG_ASSERTDLG
}
#if defined( POSIX ) && !defined ( ANDROID )
#if defined( POSIX ) && !defined ( ANDROID ) && !defined(PLATFORM_HAIKU)
#include <execinfo.h>
@ -441,7 +441,7 @@ DBG_INTERFACE bool DoNewAssertDialog( const tchar *pFilename, int line, const tc @@ -441,7 +441,7 @@ DBG_INTERFACE bool DoNewAssertDialog( const tchar *pFilename, int line, const tc
pFilename, line, pExpression);
if ( getenv( "POSIX_ASSERT_BACKTRACE" ) )
{
#if !defined ( ANDROID )
#if !defined ( ANDROID ) && !defined(PLATFORM_HAIKU)
SpewBacktrace();
#endif
}

18
tier0/cpu_posix.cpp

@ -9,8 +9,10 @@ @@ -9,8 +9,10 @@
#include <sys/types.h>
#ifdef LINUX
#include <linux/sysctl.h>
#elif defined(PLATFORM_HAIKU)
# include <OS.h>
#else
#include <sys/sysctl.h>
# include <sys/sysctl.h>
# ifdef __APPLE__
# define CPUFREQ_SYSCTL "hw.cpufrequency_max"
# else
@ -62,6 +64,18 @@ uint64 GetCPUFreqFromPROC() @@ -62,6 +64,18 @@ uint64 GetCPUFreqFromPROC()
return freq_hz;
}
#elif defined(PLATFORM_HAIKU)
// Haiku and BeOS
uint64 GetCPUFreqFromPROC()
{
cpu_info *info;
status_t status = get_cpu_info(0, 1, info);
if (status != 0)
return 0;
return info->current_frequency;
}
#else
// Linux
@ -101,7 +115,7 @@ uint64 GetCPUFreqFromPROC() @@ -101,7 +115,7 @@ uint64 GetCPUFreqFromPROC()
uint64 CalculateCPUFreq()
{
#if defined(__APPLE__) || defined(PLATFORM_BSD)
#if !defined(LINUX)
return GetCPUFreqFromPROC();
#else
// Try to open cpuinfo_max_freq. If the kernel was built with cpu scaling support disabled, this will fail.

2
tier0/cpu_usage.cpp

@ -124,7 +124,7 @@ float GetCPUUsage() @@ -124,7 +124,7 @@ float GetCPUUsage()
float GetCPUUsage()
{
#ifdef ANDROID
#if defined(ANDROID) || defined(PLATFORM_HAIKU)
return 0;
#else
double loadavg[3];

22
tier0/platform_posix.cpp

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
#include <sys/resource.h>
#include <unistd.h>
#if defined(OSX) || defined(PLATFORM_BSD)
#if defined(OSX) || defined(PLATFORM_FBSD)
# ifdef PLATFORM_BSD
# include <sys/proc.h>
# include <sys/user.h>
@ -446,6 +446,9 @@ PLATFORM_INTERFACE void Plat_SetAllocErrorFn( Plat_AllocErrorFn fn ) @@ -446,6 +446,9 @@ PLATFORM_INTERFACE void Plat_SetAllocErrorFn( Plat_AllocErrorFn fn )
// From the Apple tech note: http://developer.apple.com/library/mac/#qa/qa1361/_index.html
bool Plat_IsInDebugSession()
{
#if defined(PLATFORM_BSD) && !defined(PLATFORM_FBSD)
return false; // TODO: OpenBSD and NetBSD support
#else
static int s_IsInDebugSession;
int junk;
struct kinfo_proc info;
@ -466,6 +469,7 @@ bool Plat_IsInDebugSession() @@ -466,6 +469,7 @@ bool Plat_IsInDebugSession()
#endif
return !!s_IsInDebugSession;
#endif
}
#elif defined( LINUX )
@ -502,6 +506,14 @@ bool Plat_IsInDebugSession() @@ -502,6 +506,14 @@ bool Plat_IsInDebugSession()
return ( tracerpid > 0 );
}
#else
# warning "TODO: Plat_IsInDebugSession()"
bool Plat_IsInDebugSession()
{
return false;
}
#endif // defined( LINUX )
void Plat_DebugString( const char * psz )
@ -559,11 +571,7 @@ PLATFORM_INTERFACE const char *Plat_GetCommandLineA() @@ -559,11 +571,7 @@ PLATFORM_INTERFACE const char *Plat_GetCommandLineA()
PLATFORM_INTERFACE bool GetMemoryInformation( MemoryInformation *pOutMemoryInfo )
{
#if defined( LINUX ) || defined( OSX ) || defined(PLATFORM_BSD)
return false;
#else
#error "Need to fill out GetMemoryInformation or at least return false for this platform"
#endif
return false;
}
@ -571,7 +579,7 @@ PLATFORM_INTERFACE bool Is64BitOS() @@ -571,7 +579,7 @@ PLATFORM_INTERFACE bool Is64BitOS()
{
#if defined OSX
return true;
#elif defined(LINUX) || defined(PLATFORM_BSD)
#elif defined(POSIX)
FILE *pp = popen( "uname -m", "r" );
if ( pp != NULL )
{

9
tier0/threadtools.cpp

@ -27,13 +27,8 @@ @@ -27,13 +27,8 @@
#define GetLastError() errno
typedef void *LPVOID;
#if !defined(OSX)
#if defined(ANDROID)
#include <fcntl.h>
#include <unistd.h>
#else
#include <sys/fcntl.h>
#include <sys/unistd.h>
#endif
#define sem_unlink( arg )
#define OS_TO_PTHREAD(x) (x)
#else
@ -43,7 +38,7 @@ @@ -43,7 +38,7 @@
#define OS_TO_PTHREAD(x) pthread_from_mach_thread_np( x )
#endif // !OSX
#ifdef PLATFORM_BSD
#if defined(PLATFORM_BSD) || defined(PLATFORM_HAIKU)
# undef OS_TO_PTRHEAD
# define OS_TO_PTHREAD(x) (pthread_t)(x)
#endif
@ -1632,7 +1627,7 @@ bool CThreadFullMutex::Release() @@ -1632,7 +1627,7 @@ bool CThreadFullMutex::Release()
//
//-----------------------------------------------------------------------------
#if defined( WIN32 ) || defined( _PS3 ) || defined( _OSX ) || defined (_LINUX) || defined(PLATFORM_BSD)
#if defined( WIN32 ) || defined( _PS3 ) || defined(POSIX)
#if !defined(_PS3)
namespace GenericThreadLocals
{

6
tier0/wscript

@ -17,6 +17,9 @@ def configure(conf): @@ -17,6 +17,9 @@ def configure(conf):
conf.define('TIER0_DLL_EXPORT',1)
# conf.define('NO_HOOK_MALLOC',1)
if conf.env.DEST_OS == 'freebsd':
conf.check_cc(lib='execinfo')
def build(bld):
source = [
'assert_dialog.cpp',
@ -82,6 +85,9 @@ def build(bld): @@ -82,6 +85,9 @@ def build(bld):
libs = ['ADVAPI32', 'WS2_32']
else:
libs = ['DL', 'M', 'LOG']
if bld.env.DEST_OS == 'freebsd': libs += ['EXECINFO']
if bld.env.DEST_OS == 'haiku': libs += ['NETWORK']
install_path = bld.env.LIBDIR

2
tier1/KeyValues.cpp

@ -2239,7 +2239,7 @@ bool EvaluateConditional( const char *str ) @@ -2239,7 +2239,7 @@ bool EvaluateConditional( const char *str )
return bNot;
if ( Q_stristr( str, "$LINUX" ) )
return ( IsLinux() || IsBSD() || IsOSX() ) ^ bNot;
return ( IsPosix() ) ^ bNot;
if ( Q_stristr( str, "$POSIX" ) )
return IsPosix() ^ bNot;

4
tier1/interface.cpp

@ -247,7 +247,7 @@ HMODULE Sys_LoadLibrary( const char *pLibraryName, Sys_Flags flags ) @@ -247,7 +247,7 @@ HMODULE Sys_LoadLibrary( const char *pLibraryName, Sys_Flags flags )
#elif POSIX
int dlopen_mode = RTLD_NOW;
#ifndef ANDROID
#if !defined(ANDROID) && !defined(PLATFORM_HAIKU)
if ( flags & SYS_NOLOAD )
dlopen_mode |= RTLD_NOLOAD;
#endif
@ -271,6 +271,8 @@ static bool s_bRunningWithDebugModules = false; @@ -271,6 +271,8 @@ static bool s_bRunningWithDebugModules = false;
#ifdef ANDROID
#define DEFAULT_LIB_PATH ""
#elif defined(PLATFORM_HAIKU)
#define DEFAULT_LIB_PATH "lib/"
#else
#define DEFAULT_LIB_PATH "bin/"
#endif

10
tier1/strtools.cpp

@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
#ifdef ANDROID
#include "common/iconv.h"
#elif POSIX
#include <iconv.h>
# include <iconv.h>
#endif
static int FastToLower( char c )
@ -2953,11 +2953,11 @@ extern "C" void qsort_s( void *base, size_t num, size_t width, int (*compare )(v @@ -2953,11 +2953,11 @@ 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 )
{
#if defined(OSX) || defined(PLATFORM_BSD)
// the arguments are swapped 'round on the mac - awesome, huh?
return qsort_r( base, num, width, context, compare );
#else
#if defined(_WIN32) || defined(LINUX)
// the arguments are swapped 'round on the win32 - awesome, huh?
return qsort_s( base, num, width, compare, context );
#else
return qsort_r( base, num, width, context, compare );
#endif
}

8
tier1/wscript

@ -75,8 +75,7 @@ def build(bld): @@ -75,8 +75,7 @@ def build(bld):
'../',
'../public',
'../public/tier1',
'../public/tier0',
'../common'
'../public/tier0'
]
defines = []
@ -84,9 +83,10 @@ def build(bld): @@ -84,9 +83,10 @@ def build(bld):
libs = []
if bld.env.DEST_OS == 'win32':
libs += ['RPCRT4']
elif bld.env.DEST_OS == "darwin":
elif bld.env.DEST_OS in ['darwin', 'haiku']:
libs += ['ICONV']
if bld.env.DEST_OS == 'haiku': libs += ['GNU']
bld.stlib(
source = source,
target = PROJECT_NAME,

2
togl/linuxwin/cglmbuffer.cpp

@ -1071,7 +1071,7 @@ void CGLMBuffer::Unlock( int nActualSize, const void *pActualData ) @@ -1071,7 +1071,7 @@ void CGLMBuffer::Unlock( int nActualSize, const void *pActualData )
g_nTotalVBLockBytes += nActualSize;
#endif
#ifndef OSX
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
if ( m_nPinnedMemoryOfs >= 0 )
{
#if TOGL_SUPPORT_NULL_DEVICE

2
togl/linuxwin/dxabstract.cpp

@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
#include "glmgr_flush.inl"
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION )) || defined(PLATFORM_BSD)
#if defined(POSIX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
#include "appframework/ilaunchermgr.h"
extern ILauncherMgr *g_pLauncherMgr;
#endif

8
togl/linuxwin/glentrypoints.cpp

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
#include "tier1.h"
#include "tier2/tier2.h"
#if (defined(_LINUX) || defined(PLATFORM_BSD)) && !defined(__ANDROID__)
#if defined(POSIX) && !defined(__ANDROID__) && !defined(PLATFORM_HAIKU)
#include <GL/glx.h>
#endif
@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
#error
#endif
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION )) || defined(PLATFORM_BSD)
#if defined(POSIX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
#include "appframework/ilaunchermgr.h"
ILauncherMgr *g_pLauncherMgr = NULL;
#endif
@ -296,7 +296,7 @@ static bool CheckOpenGLExtension_internal(const char *ext, const int coremajor, @@ -296,7 +296,7 @@ static bool CheckOpenGLExtension_internal(const char *ext, const int coremajor,
return false;
}
}
#elif !defined ( OSX ) && !defined( __ANDROID__ )
#elif !defined ( OSX ) && !defined( __ANDROID__ ) && !defined(PLATFORM_HAIKU)
if (!ptr)
{
static CDynamicFunctionOpenGL< true, Display *( APIENTRY *)( ), Display* > glXGetCurrentDisplay("glXGetCurrentDisplay");
@ -427,7 +427,7 @@ COpenGLEntryPoints::COpenGLEntryPoints() @@ -427,7 +427,7 @@ COpenGLEntryPoints::COpenGLEntryPoints()
#undef GL_EXT
#endif
#ifdef OSX
#if defined(OSX) || defined(PLATFORM_HAIKU)
m_bHave_GL_NV_bindless_texture = false;
m_bHave_GL_AMD_pinned_memory = false;
#else

8
togl/linuxwin/glmgr.cpp

@ -1771,7 +1771,7 @@ void GLMContext::PreloadTex( CGLMTex *tex, bool force ) @@ -1771,7 +1771,7 @@ void GLMContext::PreloadTex( CGLMTex *tex, bool force )
// bind texture and sampling params
CGLMTex *pPrevTex = m_samplers[15].m_pBoundTex;
#ifndef OSX // 10.6
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
if ( m_bUseSamplerObjects )
{
gGL->glBindSampler( 15, 0 );
@ -2410,7 +2410,7 @@ void GLMContext::Present( CGLMTex *tex ) @@ -2410,7 +2410,7 @@ void GLMContext::Present( CGLMTex *tex )
m_nTotalVSUniformCalls = 0, m_nTotalVSUniformBoneCalls = 0, m_nTotalVSUniformsSet = 0, m_nTotalVSUniformsBoneSet = 0, m_nTotalPSUniformCalls = 0, m_nTotalPSUniformsSet = 0;
#endif
#ifndef OSX
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
GLMGPUTimestampManagerTick();
#endif
}
@ -2609,7 +2609,7 @@ GLMContext::GLMContext( IDirect3DDevice9 *pDevice, GLMDisplayParams *params ) @@ -2609,7 +2609,7 @@ GLMContext::GLMContext( IDirect3DDevice9 *pDevice, GLMDisplayParams *params )
m_texLayoutTable = new CGLMTexLayoutTable;
#ifndef OSX
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
if ( m_bUseSamplerObjects )
{
memset( m_samplerObjectHash, 0, sizeof( m_samplerObjectHash ) );
@ -2850,7 +2850,7 @@ void GLMContext::Reset() @@ -2850,7 +2850,7 @@ void GLMContext::Reset()
GLMContext::~GLMContext ()
{
#ifndef OSX
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
GLMGPUTimestampManagerDeinit();
for ( uint t = 0; t < cNumPinnedMemoryBuffers; t++ )

4
togl/linuxwin/glmgr_flush.inl

@ -12,7 +12,7 @@ FORCEINLINE uint32 bitmix32(uint32 a) @@ -12,7 +12,7 @@ FORCEINLINE uint32 bitmix32(uint32 a)
return a;
}
#ifndef OSX
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
FORCEINLINE GLuint GLMContext::FindSamplerObject( const GLMTexSamplingParams &desiredParams )
{
@ -255,7 +255,7 @@ FORCEINLINE void GLMContext::FlushDrawStates( uint nStartIndex, uint nEndIndex, @@ -255,7 +255,7 @@ FORCEINLINE void GLMContext::FlushDrawStates( uint nStartIndex, uint nEndIndex,
GL_BATCH_PERF( m_FlushStats.m_nNumChangedSamplers += m_nNumDirtySamplers );
#if !defined( OSX ) // no support for sampler objects in OSX 10.6 (GL 2.1 profile)
#if !defined( OSX ) && !defined(PLATFORM_HAIKU) // no support for sampler objects in OSX 10.6 (GL 2.1 profile)
if ( m_bUseSamplerObjects)
{
while ( m_nNumDirtySamplers )

47
togl/linuxwin/glmgrbasics.cpp

@ -2628,11 +2628,6 @@ bool GLMDetectOGLP( void ) @@ -2628,11 +2628,6 @@ bool GLMDetectOGLP( void )
#include <sys/types.h>
#ifndef _WIN32
#include <unistd.h>
#ifdef LINUX
#include <linux/sysctl.h>
#else
#include <sys/sysctl.h>
#endif
#endif
// From Technical Q&A QA1361
@ -2643,43 +2638,7 @@ bool GLMDetectOGLP( void ) @@ -2643,43 +2638,7 @@ bool GLMDetectOGLP( void )
bool GLMDetectGDB( void ) // aka AmIBeingDebugged()
{
#ifdef OSX
bool result;
int junk;
int mib[4];
struct kinfo_proc info;
size_t size;
// Initialize the flags so that,
// if sysctl fails for some bizarre
// reason, we get a predictable result.
info.kp_proc.p_flag = 0;
// Initialize mib, which tells sysctl the info
// we want, in this case we're looking for
// information about a specific process ID.
mib[0] = CTL_KERN;
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);
assert(junk == 0);
// We're being debugged if the P_TRACED
// flag is set.
result = ( (info.kp_proc.p_flag & P_TRACED) != 0 );
return result;
#else
return Sys_IsDebuggerPresent();
#endif
}
@ -3116,7 +3075,7 @@ void GLMSetIndent( int indent ) @@ -3116,7 +3075,7 @@ void GLMSetIndent( int indent )
char sg_pPIXName[128];
#ifndef OSX
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
ConVar gl_telemetry_gpu_pipeline_flushing( "gl_telemetry_gpu_pipeline_flushing", "0" );
class CGPUTimestampManager
@ -3724,7 +3683,7 @@ static uint g_nPIXEventIndex; @@ -3724,7 +3683,7 @@ static uint g_nPIXEventIndex;
void GLMBeginPIXEvent( const char *str )
{
#ifndef OSX
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
char szName[1024];
V_snprintf( szName, sizeof( szName ), "[ID:%u FR:%u] %s", g_nPIXEventIndex, g_GPUTimestampManager.GetCurFrame(), str );
const char *p = tmDynamicString( TELEMETRY_LEVEL2, szName ); //p can be null if tm is getting shut down
@ -3748,7 +3707,7 @@ void GLMBeginPIXEvent( const char *str ) @@ -3748,7 +3707,7 @@ void GLMBeginPIXEvent( const char *str )
void GLMEndPIXEvent( void )
{
#ifndef OSX
#if !defined(OSX) && !defined(PLATFORM_HAIKU)
g_GPUTimestampManager.EndZone();
#endif

1
togles/wscript

@ -39,6 +39,7 @@ def build(bld): @@ -39,6 +39,7 @@ def build(bld):
includes = [
'.',
'../common',
'../public',
'../public/tier0',
'../public/tier1'

10
vgui2/src/system_posix.cpp

@ -10,7 +10,6 @@ @@ -10,7 +10,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/param.h>
@ -33,6 +32,8 @@ @@ -33,6 +32,8 @@
#include <sys/mount.h>
#elif defined(LINUX)
#include <sys/vfs.h>
#elif defined(PLATFORM_HAIKU)
# include <sys/statvfs.h>
#endif
#ifdef OSX
#include <Carbon/Carbon.h>
@ -292,7 +293,7 @@ void CSystem::ShellExecute(const char *command, const char *file) @@ -292,7 +293,7 @@ void CSystem::ShellExecute(const char *command, const char *file)
if ( pid == 0 )
{
// Child
#if defined(LINUX) || defined(PLATFORM_BSD)
#if defined(POSIX) && !defined(OSX)
// Escape steam runtime if necessary
const char *szSteamRuntime = getenv( "STEAM_RUNTIME" );
if ( szSteamRuntime )
@ -587,6 +588,10 @@ int CSystem::GetAvailableDrives(char *buf, int bufLen) @@ -587,6 +588,10 @@ int CSystem::GetAvailableDrives(char *buf, int bufLen)
//-----------------------------------------------------------------------------
double CSystem::GetFreeDiskSpace(const char *path)
{
#if PLATFORM_HAIKU
struct statvfs buf;
int ret = statvfs(path, &buf);
#else
#if __DARWIN_ONLY_64_BIT_INO_T || PLATFORM_BSD
// MoeMod: newer macOS only support 64bit, so no statfs64 is provided
struct statfs buf;
@ -594,6 +599,7 @@ double CSystem::GetFreeDiskSpace(const char *path) @@ -594,6 +599,7 @@ double CSystem::GetFreeDiskSpace(const char *path)
#else
struct statfs64 buf;
int ret = statfs64( path, &buf );
#endif
#endif
if ( ret < 0 )
return 0.0;

2
vgui2/src/wscript

@ -53,7 +53,7 @@ def build(bld): @@ -53,7 +53,7 @@ def build(bld):
'../../public',
'../../public/tier0',
'../../public/tier1',
'../../common'
'../../common',
] + bld.env.INCLUDES_SDL2
defines = []

1
vgui2/vgui_controls/wscript

@ -97,6 +97,7 @@ def build(bld): @@ -97,6 +97,7 @@ def build(bld):
includes = [
'.',
'../../common',
'../../public',
'../../public/tier0',
'../../public/tier1'

18
vgui2/vgui_surfacelib/FontManager.cpp

@ -584,20 +584,20 @@ FallbackFont_t g_FallbackFonts[] = @@ -584,20 +584,20 @@ FallbackFont_t g_FallbackFonts[] =
{ NULL, "Monaco" } // every other font falls back to this
};
#elif defined(LINUX) || defined(PLATFORM_BSD)
static const char *g_szValidAsianFonts[] = { "Marlett", "WenQuanYi Zen Hei", "unifont", NULL };
#elif defined(_PS3)
// list of how fonts fallback
FallbackFont_t g_FallbackFonts[] =
{
{ "DejaVu Sans", NULL },
{ NULL, "DejaVu Sans" }, // every other font falls back to this
{ NULL, "Tahoma" }, // every other font falls back to this
};
#elif defined(_PS3)
#elif defined(POSIX)
static const char *g_szValidAsianFonts[] = { "Marlett", "WenQuanYi Zen Hei", "unifont", NULL };
// list of how fonts fallback
FallbackFont_t g_FallbackFonts[] =
{
{ NULL, "Tahoma" }, // every other font falls back to this
{ "DejaVu Sans", NULL },
{ NULL, "DejaVu Sans" }, // every other font falls back to this
};
#else
#error
@ -649,10 +649,10 @@ const char *CFontManager::GetForeignFallbackFontName() @@ -649,10 +649,10 @@ const char *CFontManager::GetForeignFallbackFontName()
return "Tahoma";
#elif defined(OSX)
return "Helvetica";
#elif defined(LINUX) || defined(PLATFORM_BSD)
return "WenQuanYi Zen Hei";
#elif defined(_PS3)
return "Tahoma";
#elif defined(POSIX)
return "WenQuanYi Zen Hei";
#else
#error
#endif

2
vgui2/vgui_surfacelib/wscript

@ -42,6 +42,8 @@ def build(bld): @@ -42,6 +42,8 @@ def build(bld):
] + bld.env.INCLUDES_FC + bld.env.INCLUDES_FT2
defines = []
if bld.env.DEST_OS == 'haiku':
defines += ['HAVE_FC=0']
libs = []

2
vguimatsurface/FontTextureCache.cpp

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
#include <windows.h>
#elif defined( OSX )
#include <Carbon/Carbon.h>
#elif defined( LINUX ) || defined(PLATFORM_BSD)
#elif defined(POSIX)
//#error
#elif defined( _X360 )
#else

8
vguimatsurface/MatSystemSurface.cpp

@ -146,7 +146,7 @@ CMatSystemSurface g_MatSystemSurface; @@ -146,7 +146,7 @@ CMatSystemSurface g_MatSystemSurface;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CMatSystemSurface, ISurface,
VGUI_SURFACE_INTERFACE_VERSION, g_MatSystemSurface );
#if defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
#if defined(POSIX)
CUtlDict< CMatSystemSurface::font_entry, unsigned short > CMatSystemSurface::m_FontData;
#endif
@ -407,7 +407,7 @@ InitReturnVal_t CMatSystemSurface::Init( void ) @@ -407,7 +407,7 @@ InitReturnVal_t CMatSystemSurface::Init( void )
FontManager().SetLanguage( "english" );
}
#if defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
#if defined(POSIX)
FontManager().SetFontDataHelper( &CMatSystemSurface::FontDataHelper );
#endif
@ -1907,7 +1907,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon @@ -1907,7 +1907,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon
}
Assert( success );
return success;
#elif defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
#elif defined(POSIX)
int size;
if ( CMatSystemSurface::FontDataHelper( fontName, size, fontFileName ) )
@ -1921,7 +1921,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon @@ -1921,7 +1921,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon
#endif
}
#if defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
#if defined(POSIX)
static void RemoveSpaces( CUtlString &str )
{

2
vguimatsurface/MatSystemSurface.h

@ -556,7 +556,7 @@ private: @@ -556,7 +556,7 @@ private:
int m_nFullscreenViewportHeight;
ITexture *m_pFullscreenRenderTarget;
#if defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
#if defined(POSIX)
struct font_entry
{
void *data;

6
video/videoservices.cpp

@ -58,14 +58,14 @@ DEFINE_ENUM_BITWISE_OPERATORS( EPlatform_t ); @@ -58,14 +58,14 @@ DEFINE_ENUM_BITWISE_OPERATORS( EPlatform_t );
const EPlatform_t thisPlatform = PLATFORM_XBOX_360;
#elif defined( _PS3 )
const EPlatform_t thisPlatform = PLATFORM_PS3;
#elif defined ( _LINUX ) || defined(PLATFORM_BSD)
#elif defined(POSIX)
const EPlatform_t thisPlatform = PLATFORM_LINUX;
#else
#error "UNABLE TO DETERMINE PLATFORM"
#endif
#if defined( OSX ) || defined( LINUX ) || defined(PLATFORM_BSD)
#if defined(POSIX)
ILauncherMgr *g_pLauncherMgr = NULL;
#endif
@ -1382,7 +1382,7 @@ bool CVideoCommonServices::ProcessFullScreenInput( bool &bAbortEvent, bool &bPau @@ -1382,7 +1382,7 @@ bool CVideoCommonServices::ProcessFullScreenInput( bool &bAbortEvent, bool &bPau
bool bEscPressed = ( m_bScanEsc ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Escape ) : false;
bool bReturnPressed = ( m_bScanReturn ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Return ) : false;
bool bSpacePressed = ( m_bScanSpace ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Space ) : false;
#elif defined(LINUX) || defined(PLATFORM_BSD)
#elif defined(POSIX)
g_pLauncherMgr->PumpWindowsMessageLoop();
// Escape, return, or space stops or pauses the playback

2
waf vendored

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# encoding: latin-1
# Thomas Nagy, 2005-2018
#

30
wscript

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
#! /usr/bin/env python
# vim: noexpandtab
# encoding: utf-8
# nillerusr
@ -221,14 +222,30 @@ def define_platform(conf): @@ -221,14 +222,30 @@ def define_platform(conf):
'_DLL_EXT=.dylib'
])
elif conf.env.DEST_OS in ['freebsd', 'openbsd', 'netbsd', 'dragonflybsd']: # Tested only in freebsd
elif conf.env.DEST_OS in ['freebsd', 'openbsd', 'netbsd']: # Tested only in freebsd
if conf.env.DEST_OS == 'freebsd':
conf.env.append_unique('DEFINES', ['PLATFORM_FBSD=1'])
conf.env.append_unique('DEFINES', [
'POSIX=1', '_POSIX=1', 'PLATFORM_POSIX=1',
'GNUC', # but uses clang
'NO_HOOK_MALLOC',
'PLATFORM_BSD=1',
'_DLL_EXT=.so'
])
elif conf.env.DEST_OS == 'haiku':
conf.check_cc(lib='iconv')
conf.check_cc(lib='gnu')
conf.check_cc(lib='network')
conf.env.append_unique('DEFINES', [
'POSIX=1', '_POSIX=1', 'PLATFORM_POSIX=1',
'GNUC',
'NO_HOOK_MALLOC',
'_GNU_SOURCE',
'PLATFORM_HAIKU=1',
'_DLL_EXT=.so'
])
if conf.options.DEBUG_ENGINE:
conf.env.append_unique('DEFINES', [
'DEBUG', '_DEBUG'
@ -378,9 +395,6 @@ def configure(conf): @@ -378,9 +395,6 @@ def configure(conf):
elif conf.env.DEST_CPU in ['arm', 'aarch64']:
flags += ['-fsigned-char', '-mfpu=neon-vfpv4']
if conf.env.DEST_OS == 'freebsd':
linkflags += ['-lexecinfo']
if conf.env.DEST_OS != 'win32':
cflags += flags
linkflags += flags
@ -454,7 +468,6 @@ def configure(conf): @@ -454,7 +468,6 @@ def configure(conf):
conf.env.append_unique('CFLAGS', cflags)
conf.env.append_unique('CXXFLAGS', cxxflags)
conf.env.append_unique('LINKFLAGS', linkflags)
conf.env.append_unique('INCLUDES', [os.path.abspath('common/')])
if conf.env.DEST_OS != 'android':
if conf.env.DEST_OS != 'win32':
@ -490,7 +503,7 @@ def configure(conf): @@ -490,7 +503,7 @@ def configure(conf):
conf.check(lib='android_support', uselib_store='ANDROID_SUPPORT')
conf.check(lib='opus', uselib_store='OPUS')
if conf.env.DEST_OS == "darwin":
if conf.env.DEST_OS == 'darwin':
conf.check(lib='iconv', uselib_store='ICONV')
conf.env.FRAMEWORK_APPKIT = "AppKit"
conf.env.FRAMEWORK_IOKIT = "IOKit"
@ -557,7 +570,9 @@ def configure(conf): @@ -557,7 +570,9 @@ def configure(conf):
# indicate if we are packaging for Linux/BSD
if conf.env.DEST_OS != 'android':
conf.env.LIBDIR = conf.env.PREFIX+'/bin/'
if conf.env.DEST_OS in ['haiku']:
conf.env.LIBDIR = conf.env.PREFIX+'/lib/'
else: conf.env.LIBDIR = conf.env.PREFIX+'/bin/'
conf.env.TESTDIR = conf.env.PREFIX+'/tests/'
conf.env.BINDIR = conf.env.PREFIX
else:
@ -595,3 +610,4 @@ def build(bld): @@ -595,3 +610,4 @@ def build(bld):
projects['game'] += ['togl']
bld.add_subproject(projects['game'])

Loading…
Cancel
Save