mirror of
https://github.com/celisej567/source-engine.git
synced 2026-01-03 05:49:41 +03: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:
@@ -20,6 +20,11 @@
|
||||
#include <copyfile.h>
|
||||
#import <mach/mach_host.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)
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -105,7 +110,7 @@
|
||||
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
|
||||
#elif defined(OSX)
|
||||
#define BUG_REPOSITORY_URL "/Volumes/bugs"
|
||||
#elif defined(LINUX)
|
||||
#elif defined(LINUX) || defined(BSD)
|
||||
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
|
||||
#else
|
||||
//#error
|
||||
@@ -139,7 +144,7 @@ unsigned long GetRam()
|
||||
MEMORYSTATUS stat;
|
||||
GlobalMemoryStatus( &stat );
|
||||
return (stat.dwTotalPhys / (1024 * 1024));
|
||||
#elif defined(OSX)
|
||||
#elif defined(OSX) || defined(BSD)
|
||||
int mib[2] = { CTL_HW, HW_MEMSIZE };
|
||||
u_int namelen = sizeof(mib) / sizeof(mib[0]);
|
||||
uint64_t memsize;
|
||||
@@ -340,6 +345,12 @@ void DisplaySystemVersion( char *osversion, int maxlen )
|
||||
|
||||
fclose( fpKernelVer );
|
||||
}
|
||||
#elif BSD
|
||||
#ifdef __FreeBSD__
|
||||
osversion = (char *)"FreeBSD";
|
||||
#else
|
||||
osversion = (char *)"*BSD";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2246,7 +2257,7 @@ void NonFileSystem_CreatePath (const char *path)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LINUX
|
||||
#if defined(LINUX) || defined(BSD)
|
||||
#define COPYFILE_ALL 0
|
||||
#define BSIZE 65535
|
||||
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)
|
||||
return true;
|
||||
#else
|
||||
if ( sv.IsDedicated() || IsOSX() || IsLinux() )
|
||||
if ( sv.IsDedicated() || IsOSX() || IsLinux() || IsBSD() )
|
||||
{
|
||||
// dedicated servers and Mac and Linux binaries don't check signatures
|
||||
return true;
|
||||
|
||||
@@ -2714,6 +2714,14 @@ bool CGameServer::SpawnServer( const char *szMapName, const char *szMapFile, con
|
||||
event->SetString( "os", "LINUX" );
|
||||
#elif defined ( OSX )
|
||||
event->SetString( "os", "OSX" );
|
||||
#elif defined(BSD)
|
||||
event->SetString("os",
|
||||
# ifdef __FreeBSD__
|
||||
"FreeBSD"
|
||||
# else
|
||||
"BSD"
|
||||
# endif
|
||||
);
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
|
||||
@@ -21,9 +21,10 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
//$ #include <uuid/uuid.h>
|
||||
typedef unsigned char uuid_t[16];
|
||||
#ifdef OSX
|
||||
#include <uuid/uuid.h>
|
||||
#elif defined(BSD)
|
||||
#include <uuid.h>
|
||||
#else
|
||||
typedef unsigned char uuid_t[16];
|
||||
#endif
|
||||
@@ -397,6 +398,9 @@ public:
|
||||
uuid_t newId;
|
||||
#ifdef OSX
|
||||
uuid_generate( newId );
|
||||
#elif defined(BSD)
|
||||
uint32_t status;
|
||||
uuid_create( &newId, &status );
|
||||
#endif
|
||||
#else
|
||||
#error
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
#elif defined(OSX)
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <sys/sysctl.h>
|
||||
#elif defined(BSD)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#define HW_MEMSIZE HW_PHYSMEM
|
||||
#endif
|
||||
#if defined(LINUX)
|
||||
#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
|
||||
}
|
||||
#elif defined( OSX )
|
||||
#elif defined(POSIX)
|
||||
// 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 );
|
||||
fflush(stdout );
|
||||
|
||||
int *p = 0;
|
||||
*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;
|
||||
raise(SIGTRAP);
|
||||
#else
|
||||
#warning "need minidump impl on sys_error"
|
||||
#endif
|
||||
@@ -671,7 +668,7 @@ void Sys_InitMemory( void )
|
||||
#elif defined(POSIX)
|
||||
uint64_t memsize = ONE_HUNDRED_TWENTY_EIGHT_MB;
|
||||
|
||||
#if defined(OSX)
|
||||
#if defined(OSX) || defined(BSD)
|
||||
int mib[2] = { CTL_HW, HW_MEMSIZE };
|
||||
u_int namelen = sizeof(mib) / sizeof(mib[0]);
|
||||
size_t len = sizeof(memsize);
|
||||
@@ -1589,7 +1586,9 @@ 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 );
|
||||
#else
|
||||
#elif BSD
|
||||
# warning TODO: Implement memory stats (peace of sheet of course)
|
||||
#else // Win32
|
||||
MEMORYSTATUS stat;
|
||||
GlobalMemoryStatus( &stat );
|
||||
Msg( "Available: %.2f MB, Used: %.2f MB, Free: %.2f MB\n",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <Psapi.h>
|
||||
#endif
|
||||
|
||||
#if defined( OSX )
|
||||
#if defined( OSX ) || defined(BSD)
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
@@ -278,7 +278,7 @@ static void posix_signal_handler( int i )
|
||||
#define DO_TRY if ( sigsetjmp( g_mark, 1 ) == 0 )
|
||||
#define DO_CATCH else
|
||||
|
||||
#if defined( OSX )
|
||||
#if defined( OSX ) || defined(BSD)
|
||||
#define __sighandler_t sig_t
|
||||
#endif
|
||||
|
||||
@@ -537,7 +537,7 @@ public:
|
||||
FreeLibrary( hInst );
|
||||
}
|
||||
|
||||
#elif defined( OSX )
|
||||
#elif defined( OSX ) || defined(BSD)
|
||||
|
||||
static const struct
|
||||
{
|
||||
@@ -548,8 +548,13 @@ public:
|
||||
#define _XTAG( _x ) { _x, #_x }
|
||||
_XTAG( HW_PHYSMEM ),
|
||||
_XTAG( HW_USERMEM ),
|
||||
#ifdef BSD
|
||||
_XTAG( HW_PHYSMEM ),
|
||||
_XTAG( HW_NCPU ),
|
||||
#else
|
||||
_XTAG( HW_MEMSIZE ),
|
||||
_XTAG( HW_AVAILCPU ),
|
||||
#endif
|
||||
#undef _XTAG
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#elif defined(_X360)
|
||||
// nothing to include for 360
|
||||
#elif defined(OSX)
|
||||
#elif defined(LINUX)
|
||||
#elif defined(LINUX) || defined(BSD)
|
||||
#include "tier0/dynfunction.h"
|
||||
#elif defined(_WIN32)
|
||||
#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 lRet;
|
||||
}
|
||||
#elif defined(OSX)
|
||||
|
||||
#elif defined(LINUX)
|
||||
|
||||
#elif defined(_WIN32)
|
||||
#elif defined(OSX) || defined(LINUX) || defined(_WIN32) || defined(BSD)
|
||||
|
||||
#else
|
||||
#error
|
||||
|
||||
Reference in New Issue
Block a user