mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +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:
@@ -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 )
|
||||
#elif defined( LINUX ) || defined(BSD)
|
||||
#define DEFINE_WINDOWED_APPLICATION_OBJECT_GLOBALVAR( _globalVarName ) \
|
||||
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.
|
||||
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;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,11 +39,13 @@
|
||||
#endif
|
||||
|
||||
// stdio.h
|
||||
#ifndef NULL
|
||||
#if !defined(NULL) || defined(__FreeBSD__)
|
||||
#ifdef NULL
|
||||
# undef NULL
|
||||
#endif
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef POSIX
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
+29
-17
@@ -64,7 +64,11 @@
|
||||
|
||||
#ifdef POSIX
|
||||
// need this for _alloca
|
||||
#include <alloca.h>
|
||||
# ifdef BSD
|
||||
# define va_list __va_list
|
||||
# else
|
||||
# include <alloca.h>
|
||||
# endif
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
@@ -104,6 +108,7 @@
|
||||
#define IsLinux() false
|
||||
#define IsOSX() false
|
||||
#define IsPosix() false
|
||||
#define IsBSD() false
|
||||
#define PLATFORM_WINDOWS 1 // Windows PC or Xbox 360
|
||||
#ifndef _X360
|
||||
#define IsWindows() true
|
||||
@@ -156,7 +161,13 @@
|
||||
#else
|
||||
#define IsOSX() false
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BSD
|
||||
#define IsBSD() true
|
||||
#else
|
||||
#define IsBSD() false
|
||||
#endif
|
||||
|
||||
#define IsPosix() true
|
||||
#define IsPlatformOpenGL() true
|
||||
#else
|
||||
@@ -439,20 +450,20 @@ typedef void * HINSTANCE;
|
||||
#else
|
||||
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
|
||||
// So if being debugged, use INT3 which is precise.
|
||||
#ifdef OSX
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
#ifdef __clang__
|
||||
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0)
|
||||
#elif defined __GNUC__
|
||||
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_trap(); } else { raise(SIGTRAP); } } while(0)
|
||||
#if defined(OSX) || defined(BSD)
|
||||
# if defined(__arm__) || defined(__aarch64__)
|
||||
# ifdef __clang__
|
||||
# define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0)
|
||||
# elif defined __GNUC__
|
||||
# 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
|
||||
#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)
|
||||
# define DebuggerBreak() raise(SIGTRAP)
|
||||
#endif
|
||||
#endif
|
||||
#define DebuggerBreakIfDebugging() if ( !Plat_IsInDebugSession() ) ; else DebuggerBreak()
|
||||
@@ -550,7 +561,7 @@ typedef void * HINSTANCE;
|
||||
//-----------------------------------------------------------------------------
|
||||
#if defined( GNUC )
|
||||
#define stackalloc( _size ) alloca( ALIGN_VALUE( _size, 16 ) )
|
||||
#ifdef _LINUX
|
||||
#if defined(_LINUX) || defined(BSD)
|
||||
#define mallocsize( _p ) ( malloc_usable_size( _p ) )
|
||||
#elif defined(OSX)
|
||||
#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
|
||||
//-----------------------------------------------------------------------------
|
||||
#if defined(_WIN32) || defined(LINUX) || defined(OSX)
|
||||
#if defined(_WIN32) || defined(LINUX) || defined(OSX) || defined(BSD)
|
||||
PLATFORM_INTERFACE bool Plat_IsInDebugSession();
|
||||
PLATFORM_INTERFACE void Plat_DebugString( const char * );
|
||||
#else
|
||||
#warning "Plat_IsInDebugSession isn't working properly"
|
||||
inline bool Plat_IsInDebugSession( bool bForceRecheck = false ) { return false; }
|
||||
#define Plat_DebugString(s) ((void)0)
|
||||
#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
|
||||
#endif
|
||||
|
||||
#if defined( _LINUX ) || defined( _OSX )
|
||||
#if defined( _LINUX ) || defined( _OSX ) || defined(BSD)
|
||||
#define USE_INTRINSIC_INTERLOCKED
|
||||
// linux implementation
|
||||
inline int32 ThreadInterlockedIncrement( int32 volatile *p )
|
||||
@@ -486,7 +486,7 @@ PLATFORM_INTERFACE void ThreadNotifySyncReleasing(void *p);
|
||||
|
||||
#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
|
||||
|
||||
#if defined(_PS3)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef _LINUX
|
||||
#if defined(_LINUX) || defined(BSD)
|
||||
#include <dlfcn.h> // dlopen,dlclose, et al
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user